Skip to content

Commit 7e476ef

Browse files
committed
Client:2.4.21|Res:24-12-09-16-51-40-0560bc
1 parent 5c13fb9 commit 7e476ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+39911
-1870
lines changed

Diff for: [uc]lua/hotfixes/definedfix.lua

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ local list =
44

55
"HotFixes/TestStubHotfixer",
66
"HotFixes/V057Hotfixer",
7+
"HotFixes/RO4DLC2BounceAbilityHotfixer"
78
};
89

910
return list;

Diff for: [uc]lua/hotfixes/ro4dlc2bounceabilityhotfixer.lua

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
local RO4DLC2BounceAbilityHotfixer = Class("RO4DLC2BounceAbilityHotfixer", HotfixBase)
3+
4+
local function Fix_ApplyCollision(self, collision, targetMapPos, source)
5+
local enemy = self.m_bounceEnemy:Lock()
6+
if enemy ~= nil then
7+
if source ~= nil then
8+
local enemyVelocity = enemy:GetVelocity()
9+
local curEnemyDir = CS.Torappu.Battle.MapUtil.ParseDirection(enemyVelocity.normalized)
10+
local standardOldDir = CS.Torappu.SharedConsts.FOUR_WAYS[curEnemyDir:GetHashCode()]
11+
local inverseDir = -standardOldDir
12+
local predictNextPos = enemy.mapPosition + inverseDir * 0.25 + inverseDir * enemyVelocity.magnitude * 0.017
13+
local predictTile = CS.Torappu.Battle.Map.instance:GetTile(CS.Torappu.GridPosition.FromVectorPosition(predictNextPos))
14+
if predictTile == nil or predictTile.heightType == CS.Torappu.TileData.HeightType.HIGHLAND then
15+
return
16+
end
17+
18+
enemy.RO4DLC2TypeDescriteForceInfo.direction = inverseDir
19+
enemy:ApplyForce(source, enemy.RO4DLC2TypeDescriteForceInfo)
20+
else
21+
local tile = collision:GetComponentInParent(typeof(CS.Torappu.Battle.Tile))
22+
if tile ~= nil then
23+
local rawDir = CS.UnityEngine.Vector2(enemy.mapPosition.x - tile.mapPosition.x, enemy.mapPosition.y - tile.mapPosition.y)
24+
local rawDirNorm = rawDir.normalized;
25+
local newDirEnum = CS.Torappu.Battle.MapUtil.ParseDirection(rawDirNorm)
26+
local newDir = CS.Torappu.SharedConsts.FOUR_WAYS[newDirEnum:GetHashCode()]
27+
enemy.RO4DLC2TypeDescriteForceInfo.direction = newDir
28+
enemy:ApplyForce(source, enemy.RO4DLC2TypeDescriteForceInfo)
29+
end
30+
end
31+
end
32+
end
33+
34+
function RO4DLC2BounceAbilityHotfixer:OnInit()
35+
xlua.private_accessible(CS.Torappu.Battle.RO4DLC2BounceEnemy)
36+
xlua.private_accessible(CS.Torappu.Battle.Abilities.RO4DLC2BounceAbility)
37+
xlua.private_accessible(CS.Torappu.Battle.Tile)
38+
self:Fix_ex(CS.Torappu.Battle.Abilities.RO4DLC2BounceAbility, "_ApplyCollision", function(self, collision, targetMapPos, source)
39+
local ok, errorInfo = xpcall(Fix_ApplyCollision, debug.traceback, self, collision, targetMapPos, source)
40+
if not ok then
41+
LogError("[RO4DLC2BounceAbilityHotfixer] fix" .. errorInfo)
42+
end
43+
end)
44+
end
45+
46+
function RO4DLC2BounceAbilityHotfixer:OnDispose()
47+
end
48+
49+
return RO4DLC2BounceAbilityHotfixer

Diff for: [uc]lua/hotfixes/v057hotfixer.lua

+210-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local xutil = require('xlua.util')
66

77
local V057Hotfixer = Class("V057Hotfixer", HotfixBase)
88

9+
local luaUtils = CS.Torappu.Lua.Util;
10+
911
local function Fix_Act1VAutoChessShopQuickAssist_TryRefreshNormalItemView(self, arg1)
1012
if self.view == nil then
1113
return;
@@ -20,21 +22,226 @@ local function Fix_Act1VAutoChessShopQuickAssist_TryRefreshTitleItemView(self, a
2022
self.view:Render(arg1);
2123
end
2224

25+
local function _GetArcadeUnlockDes(actId, zoneId)
26+
local curTs = CS.Torappu.DateTimeUtil.timeStampNow
27+
local succ, zoneValidInfo = CS.Torappu.ZoneDB.data.zoneValidInfo:TryGetValue(zoneId)
28+
if not succ then
29+
return ""
30+
end
31+
local startTs = zoneValidInfo:GetStartTs()
32+
local endTs = zoneValidInfo:GetEndTs()
33+
local isNotOpen = curTs < startTs
34+
local isClosed = curTs >= endTs
35+
local avail = not isNotOpen and not isClosed
36+
if avail then
37+
return ""
38+
end
39+
local arcadeData = CS.Torappu.Activity.Act1Arcade.ArcadeUtil.GetActArcadeData(actId)
40+
if arcadeData == nil then
41+
return ""
42+
end
43+
if isNotOpen then
44+
local startTime = CS.Torappu.DateTimeUtil.TimeStampToDateTime(startTs)
45+
local timeSpan = startTime - CS.Torappu.DateTimeUtil.currentTime
46+
local timeDelta = CS.Torappu.FormatUtil.FormatTimeDelta(timeSpan)
47+
return luaUtils.Format(StringRes.ACT1ARCADE_STAGE_UNLOCK_TIME_FORMAT, timeDelta)
48+
else
49+
return arcadeData.constData.zoneEntryEndText
50+
end
51+
end
52+
53+
local function Fix_Act1ArcadeEntryGameEntryItemViewModel_GetIsZoneAvail(self, actId, zoneId)
54+
local avail, _ = self:_GetIsZoneAvail(actId, zoneId)
55+
local unlockDes = _GetArcadeUnlockDes(actId, zoneId)
56+
return avail, unlockDes
57+
end
58+
59+
local function Fix_Act1ArcadeStageZoneEntryItemView_OnValueChanged(self, property)
60+
self:OnValueChanged(property)
61+
if self.m_zoneModel == nil then
62+
return
63+
end
64+
local stageSelectModel = property:GetValueNotNull()
65+
local arcadeData = stageSelectModel.arcadeData
66+
if arcadeData == nil then
67+
return
68+
end
69+
self._textUnlockDes.text = _GetArcadeUnlockDes(stageSelectModel.actId, self.m_zoneModel.zoneId)
70+
end
71+
72+
local ZONE_LAYER_MAP = {
73+
zone_1 = 1,
74+
zone_2 = 2,
75+
zone_3 = 3,
76+
zone_4 = 4,
77+
zone_5 = 5,
78+
};
79+
80+
81+
local function GetChatUnlockStatusFix(currentData)
82+
local status = CS.Torappu.RoguelikeDataUtil.GetChatUnlockStatus(currentData);
83+
local zoneIndex = currentData.player.cursor.zone;
84+
local playerMap = currentData.map;
85+
if playerMap == nil or playerMap.zones == nil then
86+
return status;
87+
end
88+
local ok, playerZone = playerMap.zones:TryGetValue(zoneIndex);
89+
if not ok then
90+
return status;
91+
end
92+
local zoneId = playerZone.id;
93+
local zoneLayer = ZONE_LAYER_MAP[zoneId];
94+
if zoneLayer == nil then
95+
return status;
96+
end
97+
status.curZone = zoneLayer;
98+
return status;
99+
end
100+
101+
local function Fix_HomeCharRotationViewModel_LoadData(self)
102+
self:LoadData()
103+
local playerCharRotation = CS.Torappu.PlayerData.instance.data.charRotation
104+
if playerCharRotation == nil then
105+
return
106+
end
107+
self:RefreshData(playerCharRotation.currentPresetId, CS.Torappu.UI.Home.HomeCharRotationViewModel.SelectSkinStrategy.USE_NOW_PREVIEWING)
108+
end
109+
110+
local function Fix_HomeCharRotationViewModel_RefreshData(self, displayPresetInstId, selectSkinStrategy)
111+
local cachedDisplayPresetInstId = self.displayPresetInstId
112+
self:RefreshData(displayPresetInstId, selectSkinStrategy)
113+
if displayPresetInstId == nil or displayPresetInstId.Length == 0 then
114+
if self.presets:ContainsKey(cachedDisplayPresetInstId) then
115+
self:_SetDisplayPreset(cachedDisplayPresetInstId, selectSkinStrategy)
116+
end
117+
end
118+
end
119+
120+
local function Fix_HomeCharRotationPresetListDialog_EventOnBackBtnClicked(self)
121+
self.m_isHiding = true
122+
local output = CS.Torappu.ValueBundle()
123+
local intVal = 0
124+
if self.m_hasAppliedPreset then
125+
intVal = 1
126+
end
127+
output.intVal = intVal
128+
local playerCharRotation = CS.Torappu.PlayerData.instance.data.charRotation
129+
if playerCharRotation == nil then
130+
return
131+
end
132+
output.strVal = playerCharRotation.currentPresetId
133+
self:OnConfirmWithHide(output)
134+
end
135+
136+
137+
local function Fix_BuildingDataConverter_LoadWorkshopFormulaUnlockCondition(formula)
138+
139+
local isUnlock, unlockCond = CS.Torappu.Building.BuildingDataConverter.LoadWorkshopFormulaUnlockCondition(formula);
140+
if not isUnlock then
141+
return isUnlock, unlockCond;
142+
end
143+
144+
local playerBuilding = CS.Torappu.PlayerData.instance.data.building;
145+
if playerBuilding == nil then
146+
return false, unlockCond;
147+
end
148+
local playerRooms = playerBuilding.rooms;
149+
if playerRooms == nil then
150+
return false, unlockCond;
151+
end
152+
local playerWorkshop = playerBuilding.rooms.workshop;
153+
if playerWorkshop == nil or playerWorkshop.Count == 0 then
154+
return false, unlockCond;
155+
end
156+
local slotId = playerWorkshop.Keys[0];
157+
local playerSlots = playerBuilding.roomSlots;
158+
if playerSlots == nil then
159+
return false, unlockCond;
160+
end
161+
local ok, slotInfo = playerSlots:TryGetValue(slotId);
162+
if not ok then
163+
return false, unlockCond;
164+
end
165+
if slotInfo.state == CS.Torappu.PlayerRoomSlotState.UPGRADING then
166+
local lockInfo = StringRes.BUILDING_WORKSHOP_UPGRADING;
167+
return false, lockInfo;
168+
end
169+
170+
return isUnlock, unlockCond;
171+
end
172+
23173
function V057Hotfixer:OnInit()
24174
xlua.private_accessible(CS.Torappu.Activity.Act1VAutoChess.Act1VAutoChessChessShopQuickAssistOnlyItemView.VirtualView)
25175
self:Fix_ex(CS.Torappu.Activity.Act1VAutoChess.Act1VAutoChessChessShopQuickAssistOnlyItemView.VirtualView, "TryRefreshAssistItemView", function(self, arg1)
26176
local ok, errorInfo = xpcall(Fix_Act1VAutoChessShopQuickAssist_TryRefreshNormalItemView, debug.traceback, self, arg1)
27-
if not ok then
28-
LogError("fix Act1VAutoChessChessShopQuickAssistOnlyItemView virtualView error" .. errorInfo)
29-
end
177+
if not ok then
178+
LogError("fix Act1VAutoChessChessShopQuickAssistOnlyItemView virtualView error" .. errorInfo)
179+
end
30180
end)
31181
xlua.private_accessible(CS.Torappu.Activity.Act1VAutoChess.Act1VAutoChessChessShopQuickAssistTitleWithItemView.VirtualView)
32182
self:Fix_ex(CS.Torappu.Activity.Act1VAutoChess.Act1VAutoChessChessShopQuickAssistTitleWithItemView.VirtualView, "TryRefreshAssistItemView", function(self, arg1)
33183
local ok, errorInfo = xpcall(Fix_Act1VAutoChessShopQuickAssist_TryRefreshTitleItemView, debug.traceback, self, arg1)
184+
if not ok then
185+
LogError("fix Act1VAutoChessChessShopQuickAssistTitleWithItemView virtualView error" .. errorInfo)
186+
end
187+
end)
188+
xlua.private_accessible(CS.Torappu.Activity.Act1Arcade.Act1ArcadeEntryGameEntryItemViewModel)
189+
self:Fix_ex(CS.Torappu.Activity.Act1Arcade.Act1ArcadeEntryGameEntryItemViewModel, "_GetIsZoneAvail", function(self, actId, zoneId)
190+
local ok, value, unlockDesc = xpcall(Fix_Act1ArcadeEntryGameEntryItemViewModel_GetIsZoneAvail, debug.traceback, self, actId, zoneId)
191+
if not ok then
192+
LogError("fix Act1VAutoChessChessShopQuickAssistTitleWithItemView virtualView error" .. value)
193+
return self:_GetIsZoneAvail(actId, zoneId)
194+
end
195+
return value, unlockDesc
196+
end)
197+
xlua.private_accessible(CS.Torappu.Activity.Act1Arcade.Act1ArcadeStageZoneEntryItemView)
198+
self:Fix_ex(CS.Torappu.Activity.Act1Arcade.Act1ArcadeStageZoneEntryItemView, "OnValueChanged", function(self, property)
199+
local ok, errorInfo = xpcall(Fix_Act1ArcadeStageZoneEntryItemView_OnValueChanged, debug.traceback, self, property)
34200
if not ok then
35201
LogError("fix Act1VAutoChessChessShopQuickAssistTitleWithItemView virtualView error" .. errorInfo)
36202
end
37203
end)
204+
205+
self:Fix_ex(CS.Torappu.RoguelikeDataUtil, "GetChatUnlockStatus", function(currentData)
206+
local ok, errorInfo = xpcall(GetChatUnlockStatusFix, debug.traceback, currentData)
207+
if not ok then
208+
LogError("[RoguelikeDataUtilHotfixer] fix GetChatUnlockStatus error " .. errorInfo);
209+
return CS.Torappu.RoguelikeDataUtil.GetChatUnlockStatus(currentData);
210+
end
211+
return errorInfo;
212+
end);
213+
214+
xlua.private_accessible(CS.Torappu.UI.Home.HomeCharRotationViewModel)
215+
self:Fix_ex(CS.Torappu.UI.Home.HomeCharRotationViewModel, "RefreshData", function(self, displayPresetInstId, selectSkinStrategy)
216+
local ok, errorInfo = xpcall(Fix_HomeCharRotationViewModel_RefreshData, debug.traceback, self, displayPresetInstId, selectSkinStrategy)
217+
if not ok then
218+
LogError("fix HomeCharRotationViewModel RefreshData error" .. errorInfo)
219+
end
220+
end)
221+
xlua.private_accessible(CS.Torappu.UI.Home.HomeCharRotationViewModel)
222+
self:Fix_ex(CS.Torappu.UI.Home.HomeCharRotationViewModel, "LoadData", function(self)
223+
local ok, errorInfo = xpcall(Fix_HomeCharRotationViewModel_LoadData, debug.traceback, self)
224+
if not ok then
225+
LogError("fix HomeCharRotationViewModel LoadData error" .. errorInfo)
226+
end
227+
end)
228+
xlua.private_accessible(CS.Torappu.UI.Home.HomeCharRotationPresetListDialog)
229+
self:Fix_ex(CS.Torappu.UI.Home.HomeCharRotationPresetListDialog, "EventOnBackBtnClicked", function(self)
230+
local ok, errorInfo = xpcall(Fix_HomeCharRotationPresetListDialog_EventOnBackBtnClicked, debug.traceback, self)
231+
if not ok then
232+
LogError("fix HomeCharRotationPresetListDialog EventOnBackBtnClicked error" .. errorInfo)
233+
end
234+
end)
235+
236+
self:Fix_ex(CS.Torappu.Building.BuildingDataConverter, "LoadWorkshopFormulaUnlockCondition", function(formula)
237+
local ok, unlock, unlockInfo = xpcall(Fix_BuildingDataConverter_LoadWorkshopFormulaUnlockCondition, debug.traceback, formula)
238+
if not ok then
239+
LogError("[BuildingDataConverter] fix LoadWorkshopFormulaUnlockCondition error ");
240+
return CS.Torappu.Building.BuildingDataConverter.LoadWorkshopFormulaUnlockCondition(formula);
241+
end
242+
return unlock, unlockInfo;
243+
end);
244+
38245
end
39246

40247
return V057Hotfixer

0 commit comments

Comments
 (0)