feat(battle-engine): M1 auto-copy closure (782 battle-logic files)

Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
gamer147
2026-06-05 16:57:20 -04:00
parent 23a6596558
commit 0d9d8acae0
778 changed files with 165107 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using LitJson;
using Wizard.AutoTest;
namespace Wizard.Battle.Recovery;
public class BattleConditionEnemyInfo : BattleConditionPlayerInfo
{
public int? AIDifficulty { get; private set; }
public int? AILevel { get; private set; }
public int? AIDeckId { get; private set; }
public int? AIMaxLife { get; private set; }
public int? AIStyleId { get; private set; }
public int? AIEmoteId { get; private set; }
public bool? AIUseInnerEmote { get; private set; }
public BattleConditionEnemyInfo(JsonData jsonData, bool useDefaultInPlayCardValue)
: base(jsonData, useDefaultInPlayCardValue)
{
AIDifficulty = jsonData.ToIntOrNull("ai_difficulty");
AILevel = jsonData.ToIntOrNull("ai_logic_level");
AIDeckId = jsonData.ToIntOrNull("ai_deck_id");
AIMaxLife = jsonData.ToIntOrNull("ai_max_life");
AIStyleId = jsonData.ToIntOrNull("ai_style_id");
AIEmoteId = jsonData.ToIntOrNull("ai_emote_id");
AIUseInnerEmote = jsonData.ToBooleanOrNull("ai_use_inner_emote");
}
}

View File

@@ -0,0 +1,16 @@
using LitJson;
namespace Wizard.Battle.Recovery;
public class BattleConditionInfo
{
public BattleConditionPlayerInfo PlayerInfo { get; private set; }
public BattleConditionEnemyInfo EnemyInfo { get; private set; }
public BattleConditionInfo(JsonData jsonData, bool useDefaultInPlayCardValue)
{
PlayerInfo = new BattleConditionPlayerInfo(jsonData["player"], useDefaultInPlayCardValue);
EnemyInfo = new BattleConditionEnemyInfo(jsonData["enemy"], useDefaultInPlayCardValue);
}
}

View File

@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.Linq;
using LitJson;
using Wizard.AutoTest;
namespace Wizard.Battle.Recovery;
public class BattleConditionPlayerInfo
{
public int? CemeteryCount { get; private set; }
public int Pp { get; private set; }
public int ClassId { get; private set; }
public int SubClassId { get; private set; }
public string MyRotationId { get; private set; }
public int CharaId { get; private set; }
public long SleeveId { get; private set; }
public IEnumerable<InPlayCardInfo> InPlayCardInfos { get; private set; }
public IEnumerable<HandCardInfo> HandCardInfos { get; private set; }
public IEnumerable<DeckCardInfo> DeckCardInfos { get; private set; }
public IEnumerable<CemeteryCardInfo> CemeteryCardInfos { get; private set; }
public BattleConditionPlayerInfo(JsonData jsonData, bool useDefaultInPlayCardValue)
{
ClassId = jsonData.ToIntOrDefault("clan_type", 1);
SubClassId = jsonData.ToIntOrDefault("sub_class_type", 1);
MyRotationId = jsonData.ToStringOrDefault("my_rotation_id", "");
CharaId = jsonData.ToIntOrDefault("chara_id", 1);
SleeveId = jsonData.ToLongOrDefault("sleeve_id", 1);
CemeteryCount = jsonData.ToIntOrNull("cemetery_count");
Pp = jsonData.ToIntOrDefault("pp", 0);
InPlayCardInfos = from d in jsonData.ToJsonDataCollection("inplay")
select new InPlayCardInfo(d, useDefaultInPlayCardValue);
HandCardInfos = from d in jsonData.ToJsonDataCollection("hand")
select new HandCardInfo(d, useDefaultInPlayCardValue);
DeckCardInfos = from d in jsonData.ToJsonDataCollection("deck")
select new DeckCardInfo(d);
CemeteryCardInfos = from d in jsonData.ToJsonDataCollection("cemetery")
select new CemeteryCardInfo(d);
}
}

View File

@@ -0,0 +1,23 @@
using LitJson;
using Wizard.AutoTest;
namespace Wizard.Battle.Recovery;
public class CardInfoBase
{
public string Name { get; private set; }
public bool IsPlayer { get; private set; }
public int Index { get; private set; }
public int? CardId { get; private set; }
public CardInfoBase(JsonData jsonData)
{
Name = jsonData["index"].ToString();
IsPlayer = Name[0] == 'p';
Index = int.Parse(Name.Substring(1));
CardId = jsonData.ToIntOrNull("id");
}
}

View File

@@ -0,0 +1,11 @@
using LitJson;
namespace Wizard.Battle.Recovery;
public class CemeteryCardInfo : CardInfoBase
{
public CemeteryCardInfo(JsonData jsonData)
: base(jsonData)
{
}
}

View File

@@ -0,0 +1,11 @@
using LitJson;
namespace Wizard.Battle.Recovery;
public class DeckCardInfo : CardInfoBase
{
public DeckCardInfo(JsonData jsonData)
: base(jsonData)
{
}
}

View File

@@ -0,0 +1,22 @@
using LitJson;
using Wizard.AutoTest;
namespace Wizard.Battle.Recovery;
public class HandCardInfo : CardInfoBase
{
public int? Cost { get; private set; }
public int? ChargeCount { get; private set; }
public HandCardInfo(JsonData jsonData, bool useDefaultCardValue)
: base(jsonData)
{
Cost = jsonData.ToIntOrNull("cost");
ChargeCount = jsonData.ToIntOrNull("chage_count");
if (useDefaultCardValue)
{
ChargeCount = ChargeCount.GetValueOrDefault();
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections;
using UnityEngine;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Recovery;
public interface IRecoveryManager
{
DataMgr.BattleType BattleType { get; }
bool? DidPlayerGoFirst { get; }
int RandomSeed { get; }
bool HasMulliganInfo { get; }
int BackGroundId { get; }
string BgmId { get; }
long RecordTime { get; }
int IdxChangeSeed { get; }
event Action OnStartRecovery;
event Action OnEndDataRecovery;
event Action OnEndRecovery;
void Setup();
VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func<IEnumerator, Coroutine> startCoroutine);
VfxBase UpdateRecovery();
void RecoveryBeforeMulligan();
VfxBase RecoveryMulligan(BattlePlayer battlePlayer, BattleEnemy battleEnemy);
string RecoveryPopSkillTargetCardName();
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace Wizard.Battle.Recovery;
public interface IRecoveryRecordManager
{
void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE");
void RecordSkillTarget(IEnumerable<BattleCardBase> targetCards);
void SetupMulliganStartTimeRecorderEvent(BattleManagerBase battleMgr);
}

View File

@@ -0,0 +1,41 @@
using LitJson;
using Wizard.AutoTest;
namespace Wizard.Battle.Recovery;
public class InPlayCardInfo : CardInfoBase
{
public int? Life { get; private set; }
public int? Offense { get; private set; }
public bool? Guard { get; private set; }
public bool? Killer { get; private set; }
public int? AttackableCount { get; private set; }
public bool? Evolve { get; private set; }
public InPlayCardInfo(JsonData jsonData, bool useDefaultCardValue)
: base(jsonData)
{
Life = jsonData.ToIntOrNull("life");
Offense = jsonData.ToIntOrNull("offense");
Guard = jsonData.ToBooleanOrNull("guard");
Killer = jsonData.ToBooleanOrNull("killer");
AttackableCount = jsonData.ToIntOrNull("attack_count");
Evolve = jsonData.ToBooleanOrNull("evolve");
if (useDefaultCardValue)
{
if (base.Index == 0)
{
Life = Life ?? 20;
return;
}
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(base.CardId.Value);
Life = Life ?? cardParameterFromId.Life;
Evolve = Evolve == true;
}
}
}

View File

@@ -0,0 +1,392 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cute;
using UnityEngine;
using Wizard.RoomMatch;
using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick;
namespace Wizard.Battle.Recovery;
public class RecoveryController
{
private NetworkBattleManagerBase _networkBattleMgr;
private List<Coroutine> _recoveryCoroutineList = new List<Coroutine>();
private Matching _matchingInstance;
public RecoveryDataHandler RecoveryDataHandlerInstance { get; private set; }
public bool IsMariganFinished => Data.BattleRecoveryInfo.IsMulliganEnd;
public RecoveryOperationInfo AIBattleRecoveryData { get; private set; }
public event Action OnFinishRecoveringData;
public event Action OnFinishRecoveryLogSync;
public RecoveryController(RecoveryOperationInfo aiBattleRecoveryData = null)
{
AIBattleRecoveryData = aiBattleRecoveryData;
Format format = Data.CurrentFormat;
if (format == Format.Max && GameMgr.GetIns().GetDataMgr().IsDipslayHighRankFormat())
{
format = PlayerStaticData.HighRankFormat();
}
PlayerStaticData.LoadUserRankTexture(format);
switch (GameMgr.GetIns().GetDataMgr().m_BattleType)
{
case DataMgr.BattleType.FreeBattle:
_matchingInstance = new Matching_Free();
break;
case DataMgr.BattleType.RankBattle:
_matchingInstance = new Matching_RankMatch();
break;
case DataMgr.BattleType.ColosseumNormal:
case DataMgr.BattleType.ColosseumTwoPick:
case DataMgr.BattleType.ColosseumHof:
case DataMgr.BattleType.ColosseumWindFall:
_matchingInstance = new Matching_Colosseum();
break;
case DataMgr.BattleType.CompetitionNormal:
case DataMgr.BattleType.CompetitionTwoPick:
_matchingInstance = new Matching_Competition();
break;
case DataMgr.BattleType.RoomBattle:
ResetRoomInfo(NetworkDefine.ServerBattleType.OpenRoom, Data.BattleRecoveryInfo, RoomConnectController.BattleRule.Bo1, Format.Max, TwoPickFormat.None, isOpenDeckRule: false);
break;
case DataMgr.BattleType.RoomTwoPick:
ResetRoomInfo(NetworkDefine.ServerBattleType.RoomTwoPick, Data.BattleRecoveryInfo, Data.BattleRecoveryInfo.BattleParameterInstance.Rule, Format.Max, Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat, isOpenDeckRule: false);
break;
case DataMgr.BattleType.TwoPickBackdraft:
ResetRoomInfo(NetworkDefine.ServerBattleType.RoomTwoPick, Data.BattleRecoveryInfo, RoomConnectController.BattleRule.Bo1, Format.Max, Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat, isOpenDeckRule: false);
break;
case DataMgr.BattleType.TwoPick:
_matchingInstance = new Matching_TwoPick();
break;
case DataMgr.BattleType.Sealed:
_matchingInstance = new Matching_Sealed();
break;
}
ConnectNode();
UIManager.GetInstance().StartCoroutine(WaitRealtimeObjectCreateToSetupRecoveryData());
}
private void ResetRoomInfo(NetworkDefine.ServerBattleType battleType, BattleRecoveryInfo battleRecoveryInfo, RoomConnectController.BattleRule roomRule, Format format, TwoPickFormat deckFormatType, bool isOpenDeckRule)
{
_matchingInstance = new Matching_Room(battleRecoveryInfo._isConventionRoom, battleRecoveryInfo.IsGatheringRoom);
(_matchingInstance as Matching_Room).SetBattleParameter(new BattleParameter(battleType, format, deckFormatType, roomRule, isOpenDeckRule));
RoomBase.SettingOpponentDispData(!Data.BattleRecoveryInfo.is_owner, Data.BattleRecoveryInfo.opponent_name, Data.BattleRecoveryInfo.opponent_emblem_id, Data.BattleRecoveryInfo.opponent_degree_id, Data.BattleRecoveryInfo.opponent_country_code, Data.BattleRecoveryInfo.opponent_rank, Data.BattleRecoveryInfo.IsOpponentOfficialUser, Data.BattleRecoveryInfo.OpponentHighFormatRank);
}
private IEnumerator WaitRealtimeObjectCreateToSetupRecoveryData()
{
while (ToolboxGame.RealTimeNetworkAgent == null)
{
_matchingInstance.UpdateOffLineMatching();
yield return null;
}
ToolboxGame.RealTimeNetworkAgent.IsNotPlayReceivingData = true;
SetupRecoveryData();
}
private void SetupRecoveryData()
{
ParseRecoveryData();
OnRecoveryReady();
ToolboxGame.RealTimeNetworkAgent.StartRecovery(Data.BattleRecoveryInfo.battle_id.ToString(), Data.BattleRecoveryInfo.Play_seq, Data.BattleRecoveryInfo.Pub_seq);
if (!GameMgr.GetIns().IsAINetwork)
{
_recoveryCoroutineList.Add(UIManager.GetInstance().StartCoroutine(RealtimeOpenToRecoveryStart()));
}
_recoveryCoroutineList.Add(UIManager.GetInstance().StartCoroutine(WaitTillBattleCreate()));
}
private IEnumerator RealtimeOpenToRecoveryStart()
{
while (!ToolboxGame.RealTimeNetworkAgent.IsOpen())
{
yield return null;
}
ToolboxGame.RealTimeNetworkAgent.EmitMsgPack(NetworkBattleDefine.NetworkBattleURI.RecoveryStart);
}
private IEnumerator WaitTillBattleCreate()
{
while (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().SBattleLoad == null || !BattleManagerBase.GetIns().SBattleLoad.isLoadEnd || !ToolboxGame.RealTimeNetworkAgent.IsOpen())
{
yield return null;
}
RecoveryEndToChangeBattleScene();
}
private void RecoveryEndToChangeBattleScene()
{
_networkBattleMgr = BattleManagerBase.GetIns() as NetworkBattleManagerBase;
ToolboxGame.RealTimeNetworkAgent.SetNetworkBattleMgr(_networkBattleMgr);
BattleManagerBase.GetIns().OnStartOpening += delegate
{
_networkBattleMgr._recoveryController = this;
RecoveryDataHandlerInstance = new RecoveryDataHandler(_networkBattleMgr, this.OnFinishRecoveringData, this.OnFinishRecoveryLogSync, AIBattleRecoveryData);
RecoveryDataHandlerInstance.OnBattleReceived();
};
_matchingInstance.GotoBattle();
BattleManagerBase.GetIns().SBattleLoad.StartBattleScene();
}
private void RecoveryReturnScene()
{
if (!_matchingInstance.GetMatchingDataReady())
{
UIManager.GetInstance().OffViewAll();
}
ToolboxGame.DestroyNetworkAgent();
if (_matchingInstance is Matching_Room)
{
RoomBase.ResetOpponentData();
}
if (_matchingInstance.GetMatchingDataReady() && GameMgr.GetIns().GetBattleCtrl() != null)
{
UIManager.GetInstance().StartCoroutine(BattleEndCoroutin(ChangeScene));
return;
}
UIManager.GetInstance().CloseInSceneLoadingMatching();
ChangeScene();
}
private void ChangeScene()
{
UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam();
changeViewSceneParam.OnFinishChangeView = delegate
{
UIManager.GetInstance().CloseInSceneLoadingMatching();
UIManager.GetInstance().CloseInSceneLoadingBattle();
};
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam);
}
private IEnumerator BattleEndCoroutin(Action callback)
{
while (BattleManagerBase.GetIns() == null)
{
yield return null;
}
SBattleLoad battleLoad = BattleManagerBase.GetIns().SBattleLoad;
while (!battleLoad.isLoadEnd)
{
yield return null;
}
yield return GameMgr.GetIns().GetBattleCtrl().BattleEnd();
callback();
}
private void ConnectNode()
{
MatchingNetworkConnectChecker matchingNetworkConnectCheker = _matchingInstance._matchingNetworkConnectCheker;
matchingNetworkConnectCheker.Start();
matchingNetworkConnectCheker.OnConnectError = ReturnTitle;
string battleId = Data.BattleRecoveryInfo.battle_id.ToString();
if (GameMgr.GetIns().GetDataMgr().IsRoomBattleType())
{
battleId = Data.BattleRecoveryInfo.roomId.ToString();
}
matchingNetworkConnectCheker.SetBattleId(battleId);
matchingNetworkConnectCheker.SetConnectOnly();
}
private void ReturnTitle()
{
for (int i = 0; i < _recoveryCoroutineList.Count; i++)
{
Coroutine routine = _recoveryCoroutineList[i];
UIManager.GetInstance().StopCoroutine(routine);
routine = null;
}
_recoveryCoroutineList.Clear();
SystemText systemText = Data.SystemText;
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true);
dialogBase.SetSize(DialogBase.Size.M);
dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0012"));
dialogBase.SetText(systemText.Get("Error_0012"));
dialogBase.AddButton(DialogBase.ButtonType.BackToTitle);
dialogBase.SetPanelDepth(6000);
dialogBase.SetFadeButtonEnabled(flag: false);
dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate
{
if (_matchingInstance.GetMatchingDataReady() && GameMgr.GetIns().GetBattleCtrl() != null)
{
UIManager.GetInstance().StartCoroutine(BattleEndCoroutin(SoftwareReset));
}
else
{
SoftwareReset();
}
});
}
private void SoftwareReset()
{
Wizard.SoftwareReset.exec();
}
private void OnRecoveryReady()
{
UIManager.GetInstance().createInSceneLoadingMatching(notBlack: true);
UIManager.GetInstance().closeInSceneLoading();
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
List<int> list = null;
list = ((!GameMgr.GetIns().IsAINetwork) ? (from i in GameMgr.GetIns().GetNetworkUserInfoData().GetSelfDeck()
select i.CardId).ToList() : AIBattleRecoveryData.SetupInfo.PlayerInfo.DeckCardInfos.Select((DeckCardInfo i) => i?.CardId.Value ?? 100011010).ToList());
dataMgr.SetCurrentDeckData(list);
dataMgr.SetPlayerCharaId(Data.BattleRecoveryInfo.chara_id);
dataMgr.SetPlayerSubClassID(Data.BattleRecoveryInfo.SubClassId);
dataMgr.SetPlayerMyRotationInfo(Data.BattleRecoveryInfo.MyRotationId);
dataMgr.SetPlayerSleeveId(Data.BattleRecoveryInfo.sleeve_id);
dataMgr.SetSelectDeckFormat(Data.BattleRecoveryInfo.deck_format);
if (GameMgr.GetIns().IsAINetwork)
{
List<int> currentEnemyDeckData = AIBattleRecoveryData.SetupInfo.EnemyInfo.DeckCardInfos.Select((DeckCardInfo i) => i?.CardId.Value ?? 100011010).ToList();
dataMgr.SetCurrentEnemyDeckData(currentEnemyDeckData);
dataMgr.SetEnemyCharaId(AIBattleRecoveryData.SetupInfo.EnemyInfo.CharaId);
dataMgr.SetEnemySleeveId(AIBattleRecoveryData.SetupInfo.EnemyInfo.SleeveId);
}
else
{
List<int> currentEnemyDeckData2 = (from i in GameMgr.GetIns().GetNetworkUserInfoData().GetOpponentDeck()
select i.CardId).ToList();
dataMgr.SetCurrentEnemyDeckData(currentEnemyDeckData2);
dataMgr.SetEnemyCharaId(Data.BattleRecoveryInfo.chara_id);
dataMgr.SetEnemySubClassID(Data.BattleRecoveryInfo.OpponentSubClassId);
dataMgr.SetEnemyMyRotationInfo(Data.BattleRecoveryInfo.OpponentMyRotationId);
dataMgr.SetEnemySleeveId(Data.BattleRecoveryInfo.sleeve_id);
}
int playerClassId = dataMgr.GetPlayerClassId();
int selectDeckId = dataMgr.GetSelectDeckId();
bool num = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK);
_matchingInstance.FirstSetting(playerClassId, selectDeckId, isRecovery: true);
if (num && (Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat != TwoPickFormat.Chaos || Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat != TwoPickFormat.BackdraftChaos))
{
DeckData deckData = new DeckData(Format.Max, DeckAttributeType.TrialDeck);
deckData.SetDeckID(selectDeckId);
deckData.SetDeckClassID(playerClassId);
deckData.SetCardIdList(list);
deckData.SetDeckName(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_NAME_TRIALDECK));
dataMgr.SetSelectDeckId(deckData.GetDeckID());
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.TrialDeck;
dataMgr.SetPlayerCharaIdBySkinId(deckData.GetSkinId());
}
else if (dataMgr.IsTwoPickBattleType())
{
DeckData deckData2 = new DeckData();
deckData2.SetDeckID(0);
deckData2.SetDeckClassID(playerClassId);
deckData2.SetDeckSleeveID(3000011L);
deckData2.SetDeckName(GameMgr.GetIns().GetDataMgr().GetClanNameByKey(playerClassId));
deckData2.SetCardIdList(list);
dataMgr.SetSelectDeckId(deckData2.GetDeckID());
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.Invalid;
dataMgr.SetPlayerCharaIdBySkinId(Data.BattleRecoveryInfo.chara_id);
dataMgr._roomTwoPickDeckData = deckData2;
if (dataMgr.m_BattleType == DataMgr.BattleType.TwoPickBackdraft)
{
Data.RoomTwoPickInfo.deckData.classId = dataMgr.GetEnemyClassId();
dataMgr._roomTwoPickDeckData.SetDeckClassID(dataMgr.GetEnemyClassId());
}
else
{
Data.RoomTwoPickInfo.deckData.classId = playerClassId;
}
Data.RoomTwoPickInfo.deckData.entryId = 0;
Data.RoomTwoPickInfo.deckData.isSelectCompleted = true;
Data.RoomTwoPickInfo.deckData.cardIds = deckData2.GetCardIdList().ToArray();
Data.RoomTwoPickBeforeBattleInfo.SetSelfClassIdTwoPickDraftData(playerClassId);
if (Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat == TwoPickFormat.Chaos || Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat == TwoPickFormat.BackdraftChaos)
{
CandidateChaos candidateChaos = Data.RoomTwoPickInfo.CandidateChaos;
candidateChaos.SelectedChaosId = Data.BattleRecoveryInfo.ChaosId;
candidateChaos.SelectedCharaId = Data.BattleRecoveryInfo.chara_id;
candidateChaos.SelectedClassId = Data.BattleRecoveryInfo.class_id;
}
}
if ((bool)ToolboxGame.RealTimeNetworkAgent)
{
CustomPreference.SetNodeServerURL(Data.BattleRecoveryInfo.node_server_url);
}
}
private int DecideFirstUser(int id)
{
if (id == PlayerStaticData.UserViewerID)
{
return 0;
}
return 1;
}
private bool IsPlayer(int id)
{
if (id == PlayerStaticData.UserViewerID)
{
return true;
}
return false;
}
private void ParseRecoveryData()
{
int first_turn = Data.BattleRecoveryInfo.first_turn;
GameMgr.GetIns().GetNetworkUserInfoData().TurnState = DecideFirstUser(first_turn);
Dictionary<string, object> info = ParseData(isPlayer: true);
Dictionary<string, object> info2 = ParseData(isPlayer: false);
GameMgr.GetIns().SettingSelfInfo(info, isWatchReplayRecovery: true);
GameMgr.GetIns().SettingOpponentInfo(info2, isWatchReplayRecovery: true);
GameMgr.GetIns().GetNetworkUserInfoData().SetSelfDeck(Data.BattleRecoveryInfo.deck);
}
private Dictionary<string, object> ParseData(bool isPlayer)
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
dictionary.Add("fieldId", Data.BattleRecoveryInfo.field_id);
dictionary.Add("seed", Data.BattleRecoveryInfo.seed);
if (isPlayer)
{
dictionary.Add("viewerId", Data.BattleRecoveryInfo.viewer_id);
dictionary.Add("oppoId", Data.BattleRecoveryInfo.opponent_viewer_id);
dictionary.Add("charaId", Data.BattleRecoveryInfo.chara_id);
dictionary.Add("classId", Data.BattleRecoveryInfo.class_id);
dictionary.Add("sleeveId", Data.BattleRecoveryInfo.sleeve_id);
dictionary.Add("rank", Data.BattleRecoveryInfo.rank);
dictionary.Add("degreeId", Data.BattleRecoveryInfo.degree_id);
dictionary.Add("emblemId", Data.BattleRecoveryInfo.emblem_id);
dictionary.Add("country_code", Data.BattleRecoveryInfo.country_code);
dictionary.Add("userName", Data.BattleRecoveryInfo.name);
dictionary.Add("isOfficial", Data.BattleRecoveryInfo.IsOfficialUser);
dictionary.Add("chaosId", Data.BattleRecoveryInfo.ChaosId);
dictionary.Add("subclassId", Data.BattleRecoveryInfo.SubClassId);
dictionary.Add("rotationId", Data.BattleRecoveryInfo.MyRotationId);
}
else
{
dictionary.Add("viewerId", Data.BattleRecoveryInfo.viewer_id);
dictionary.Add("charaId", Data.BattleRecoveryInfo.opponent_chara_id);
dictionary.Add("classId", Data.BattleRecoveryInfo.opponent_class_id);
dictionary.Add("sleeveId", Data.BattleRecoveryInfo.opponent_sleeve_id);
dictionary.Add("rank", Data.BattleRecoveryInfo.opponent_rank);
dictionary.Add("degreeId", Data.BattleRecoveryInfo.opponent_degree_id);
dictionary.Add("emblemId", Data.BattleRecoveryInfo.opponent_emblem_id);
dictionary.Add("country_code", Data.BattleRecoveryInfo.opponent_country_code);
dictionary.Add("userName", Data.BattleRecoveryInfo.opponent_name);
dictionary.Add("battlePoint", Data.BattleRecoveryInfo.opponent_battle_point);
dictionary.Add("isMasterRank", Data.BattleRecoveryInfo.is_opponent_master_rank);
dictionary.Add("masterPoint", Data.BattleRecoveryInfo.opponent_master_point);
dictionary.Add("isOfficial", Data.BattleRecoveryInfo.IsOpponentOfficialUser);
dictionary.Add("chaosId", Data.BattleRecoveryInfo.OpponentChaosId);
dictionary.Add("subclassId", Data.BattleRecoveryInfo.OpponentSubClassId);
dictionary.Add("rotationId", Data.BattleRecoveryInfo.OpponentMyRotationId);
}
dictionary.Add("isChaosSkinOverride", Data.BattleRecoveryInfo.IsChaosSkinOverride);
return dictionary;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Cute;
using LitJson;
using Wizard.AutoTest;
using Wizard.Battle.Operation;
namespace Wizard.Battle.Recovery;
public class RecoveryOperationInfo
{
public DataMgr.BattleType BattleType { get; private set; }
public long RecordTime { get; private set; }
public SetupConditionInfo SetupInfo { get; private set; }
public IEnumerable<IOperationCommand> ActionCommands { get; private set; }
public ResultConditionInfo CheckInfo { get; private set; }
public IEnumerable<string> SkillTargetCardNames { get; private set; }
public long MulliganStartTime { get; private set; }
public long TurnStartTime { get; private set; }
public long OpeningStartTime { get; private set; }
public RecoveryOperationInfo(string filePath)
{
JsonData jsonData = ReadRecoveryFile(filePath);
BattleType = (DataMgr.BattleType)jsonData.ToIntOrDefault("battle_type", 100);
MulliganStartTime = jsonData["setup"].ToLongOrDefault("start_mulligan_time", 0);
OpeningStartTime = jsonData["setup"].ToLongOrDefault("opening_start_time", 0);
TurnStartTime = jsonData.ToLongOrDefault("turn_start_time", 0);
RecordTime = jsonData.ToLongOrDefault("record_time", 0);
SetupInfo = new SetupConditionInfo(jsonData["setup"], BattleType);
ActionCommands = AutoTestBattleMgr.CreateOperationCommands(jsonData.ToJsonDataCollection("operations"), SetupInfo.DidPlayerGoFirst);
CheckInfo = new ResultConditionInfo(jsonData["check"]);
SkillTargetCardNames = from n in jsonData.ToJsonDataCollection("skill_targets")
select n.ToString();
}
public static JsonData ReadRecoveryFile(string filePath)
{
JsonData result = new JsonData();
using (StreamReader streamReader = new StreamReader(filePath))
{
string text = streamReader.ReadToEnd();
if (!string.IsNullOrEmpty(text))
{
result = JsonMapper.ToObject(CryptAES.decryptForNode(text));
}
}
return result;
}
}

View File

@@ -0,0 +1,11 @@
using LitJson;
namespace Wizard.Battle.Recovery;
public class ResultConditionInfo : BattleConditionInfo
{
public ResultConditionInfo(JsonData jsonData)
: base(jsonData, useDefaultInPlayCardValue: false)
{
}
}

View File

@@ -0,0 +1,147 @@
using System.Collections.Generic;
using System.Linq;
using LitJson;
using Wizard.AutoTest;
using Wizard.Story;
namespace Wizard.Battle.Recovery;
public class SetupConditionInfo : BattleConditionInfo
{
public bool DidPlayerGoFirst { get; private set; }
public int RandomSeed { get; private set; }
public int BackGroundId { get; private set; }
public string BgmId { get; private set; }
public bool HasMulliganInfo { get; private set; }
public IEnumerable<int> PlayerMulliganReplaceCards { get; private set; }
public IEnumerable<int> PlayerMulliganCompleteCards { get; private set; }
public IEnumerable<int> EnemyMulliganReplaceCards { get; private set; }
public IEnumerable<int> EnemyMulliganCompleteCards { get; private set; }
public int PracticeDifficultyDegreeId { get; private set; }
public bool IsPrebuildDeck { get; private set; }
public bool IsTrialDeck { get; private set; }
public bool IsDefaultDeck { get; private set; }
public int QuestStageId { get; private set; }
public int QuestEnemyAiId { get; private set; }
public int QuestEnemyEmblemId { get; private set; }
public int QuestEnemyDegreeId { get; private set; }
public int RecoveryPoint { get; private set; }
public List<BossRushSpecialSkill> QuestPlayerSkillList { get; private set; }
public BossRushSpecialSkill QuestEnemySkill { get; private set; }
public int QuestMaxBattleCount { get; private set; }
public int QuestCurrentWinCount { get; private set; }
public int QuestEnemyEmotionOverride { get; private set; }
public int QuestPlayerEmotionOverride { get; private set; }
public bool QuestIsExtra { get; private set; }
public bool QuestIsMockBattle { get; private set; }
public int QuestExtraDeckScheduleId { get; private set; }
public BattleManagerBase.MissionNecessaryInformation MissionNecessaryInformation { get; private set; } = new BattleManagerBase.MissionNecessaryInformation(new Dictionary<string, string>());
public StoryRecoveryData StoryRecoveryData { get; }
public bool ScenarioDeckIsPreBuild { get; private set; }
public bool ScenarioDeckIsTrial { get; private set; }
public SetupConditionInfo(JsonData jsonData, DataMgr.BattleType battleType)
: base(jsonData, useDefaultInPlayCardValue: true)
{
DidPlayerGoFirst = jsonData.ToBooleanOrDefault("player_start_turn", defaultBoolean: true);
RandomSeed = jsonData.ToIntOrDefault("random_seed", 0);
BackGroundId = jsonData.ToIntOrDefault("background_id", -1);
BgmId = jsonData.ToStringOrDefault("bgm_id", "NONE");
HasMulliganInfo = jsonData.HasKey("player_mulligan_abandon");
PracticeDifficultyDegreeId = jsonData.ToIntOrDefault("practice_difficulty_degree_id", 400001);
IsPrebuildDeck = jsonData.ToBooleanOrDefault("is_prebuild_deck", defaultBoolean: false);
IsTrialDeck = jsonData.ToBooleanOrDefault("is_trial_deck", defaultBoolean: false);
IsDefaultDeck = jsonData.ToBooleanOrDefault("is_default_deck", defaultBoolean: false);
QuestStageId = jsonData.ToIntOrDefault("quest_stage_id", 0);
QuestEnemyAiId = jsonData.ToIntOrDefault("quest_enemy_ai_id", 0);
QuestEnemyEmblemId = jsonData.ToIntOrDefault("quest_enemy_emblem_id", 0);
QuestEnemyDegreeId = jsonData.ToIntOrDefault("quest_enemy_degree_id", 0);
QuestEnemyEmotionOverride = jsonData.ToIntOrDefault("quest_enemy_emotion_override", 0);
QuestPlayerEmotionOverride = jsonData.ToIntOrDefault("quest_player_emotion_override", 0);
QuestIsExtra = jsonData.ToBooleanOrDefault("quest_is_extra", defaultBoolean: false);
QuestIsMockBattle = jsonData.ToBooleanOrDefault("quest_is_mock_battle", defaultBoolean: false);
QuestExtraDeckScheduleId = jsonData.ToIntOrDefault("quest_extra_deck_schedule_id", 0);
if ((battleType == DataMgr.BattleType.Story || DataMgr.IsQuestBattleType(battleType)) && jsonData.HasKey("story_special_battle_player_attach_skill"))
{
GameMgr.GetIns().GetDataMgr().SetSpecialBattleSetting(DidPlayerGoFirst, jsonData.ToStringOrDefault("story_special_battle_player_attach_skill", string.Empty), jsonData.ToStringOrDefault("story_special_battle_enemy_attach_skill", string.Empty), jsonData.ToIntOrDefault("story_special_battle_player_start_pp", 0), jsonData.ToIntOrDefault("story_special_battle_enemy_start_pp", 0), jsonData.ToIntOrDefault("story_special_battle_player_current_life", 0), jsonData.ToIntOrDefault("story_special_battle_player_start_life", 0), jsonData.ToIntOrDefault("story_special_battle_enemy_start_life", 0), jsonData.ToStringOrDefault("story_special_battle_id_override_in_battle_log", string.Empty), jsonData.ToStringOrDefault("story_special_battle_id", string.Empty), jsonData.ToStringOrDefault("story_special_battle_banish_effect_override", string.Empty), jsonData.ToStringOrDefault("story_special_battle_token_draw_effect_override", string.Empty), jsonData.ToStringOrDefault("story_special_battle_special_token_draw_effect_override", string.Empty), jsonData.ToIntOrDefault("story_special_battle_skip_result", 0));
}
if (battleType == DataMgr.BattleType.BossRushQuest)
{
RecoveryPoint = jsonData.ToIntOrDefault("recovery_point", 0);
QuestPlayerSkillList = (from d in jsonData.ToJsonDataCollection("quest_player_skill_list")
select new BossRushSpecialSkill(d)).ToList();
QuestEnemySkill = new BossRushSpecialSkill(jsonData.ToObjectOrNull("quest_enemy_skill"));
QuestMaxBattleCount = jsonData.ToIntOrDefault("quest_max_battle_count", 0);
QuestCurrentWinCount = jsonData.ToIntOrDefault("quest_current_win_count", 0);
}
if (battleType == DataMgr.BattleType.SecretBossQuest)
{
QuestPlayerSkillList = (from d in jsonData.ToJsonDataCollection("quest_player_skill_list")
select new BossRushSpecialSkill(d)).ToList();
QuestEnemySkill = new BossRushSpecialSkill(jsonData.ToObjectOrNull("quest_enemy_skill"));
}
if (jsonData.HasKey("mission_necessary_information"))
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (string key in jsonData["mission_necessary_information"].Keys)
{
dictionary.Add(key, jsonData["mission_necessary_information"].ToStringOrDefault(key, string.Empty));
}
MissionNecessaryInformation = new BattleManagerBase.MissionNecessaryInformation(dictionary);
}
switch (battleType)
{
case DataMgr.BattleType.Practice:
GameMgr.GetIns().GetDataMgr().Practice3DfieldId = jsonData.ToIntOrDefault("practice_3d_field_id", 0);
break;
case DataMgr.BattleType.Story:
StoryRecoveryData = new StoryRecoveryData(jsonData);
ScenarioDeckIsPreBuild = jsonData.ToBooleanOrDefault("scenario_deck_is_pre_build", defaultBoolean: false);
ScenarioDeckIsTrial = jsonData.ToBooleanOrDefault("scenario_deck_is_trial", defaultBoolean: false);
break;
}
if (HasMulliganInfo)
{
PlayerMulliganReplaceCards = ParseJsonDataIndexes(jsonData, "player_mulligan_abandon");
PlayerMulliganCompleteCards = ParseJsonDataIndexes(jsonData, "player_mulligan_complete");
EnemyMulliganReplaceCards = ParseJsonDataIndexes(jsonData, "enemy_mulligan_abandon");
EnemyMulliganCompleteCards = ParseJsonDataIndexes(jsonData, "enemy_mulligan_complete");
}
}
private IEnumerable<int> ParseJsonDataIndexes(JsonData jsonData, string keyName)
{
return from j in jsonData.ToJsonDataCollection(keyName)
select int.Parse(j.ToString().Substring(1));
}
}