28 lines
1.9 KiB
Lua
28 lines
1.9 KiB
Lua
-- Research target derived from the missing saved-role comparison, not a game rule.
|
|
-- Reads the Client-selected handbook default and its existing star configurations.
|
|
do local function capture()
|
|
local s=_G.__gacCwReplacement1 or {index=0};_G.__gacCwReplacement1=s
|
|
if s.done then return end
|
|
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
|
|
local manager=CS.RPG.Client.GlobalVars.s_GamePhaseManager
|
|
local phase=manager and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(manager)
|
|
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
|
|
local log=function(x)CS.UnityEngine.Debug.Log('[GAC_CW_REPLACEMENT] '..tostring(x))end
|
|
if not s.rows then s.rows=CS.RPG.Client.GlobalVars.s_ModuleManager.GridFightModule:GetHandBookAllRoleConfig();if s.rows.Count>512 then error('bound')end end
|
|
if s.role then
|
|
local role=s.role;local c=role.RoleConfig
|
|
local star=c:GetStarConfig(s.star)
|
|
local row=c:GetType():GetField('_Row',flags):GetValue(c)
|
|
local starRow=star:GetType():GetField('_Row',flags):GetValue(star)
|
|
local servant=star:GetType():GetField('_ServantStarRow',flags):GetValue(star)
|
|
local json=CS.Newtonsoft.Json.JsonConvert.SerializeObject
|
|
log('ROW {"Config":'..json(row)..',"Price":'..c.Price..',"MaxStar":'..c.MaxStar..',"Star":'..s.star..',"SaleQuoteKnown":false,"StarConfig":'..json(starRow)..',"ServantStarConfig":'..json(servant)..'}')
|
|
s.star=s.star+1;if s.star>c.MaxStar then s.done=true;log('END')end;return
|
|
end
|
|
for n=1,4 do
|
|
if s.index>=s.rows.Count then s.done=true;log('ERROR default not found');return end
|
|
local role=s.rows[s.index].DefaultRole;s.index=s.index+1
|
|
if role.RoleConfig.AvatarID==1511 then s.role=role;s.star=1;log('DEFAULT '..role.ID);return end
|
|
end
|
|
end;local ok,e=pcall(capture);if not ok then _G.__gacCwReplacement1={done=true};CS.UnityEngine.Debug.Log('[GAC_CW_REPLACEMENT] ERROR '..tostring(e))end end
|