Files
SVSimServer/SVSim.BattleEngine/Engine/ReplayDetailInfo.cs
gamer147 0d9d8acae0 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.
2026-06-05 16:57:20 -04:00

339 lines
10 KiB
C#

using System.Collections.Generic;
using LitJson;
using MiniJSON;
using Wizard;
public class ReplayDetailInfo
{
public bool is_win;
public Format deck_format;
public bool is_two_pick;
public TwoPickFormat _twoPickFormat;
public long battle_id;
public int seed;
public int field_id;
public int first_turn;
public Dictionary<string, object> play_list;
public int _battleType;
public List<int> TurnStartIndexList = new List<int>();
public int viewer_id;
public string name;
public int chara_id;
public int class_id;
public long emblem_id;
public int degree_id;
public string country_code;
public long sleeve_id;
public int battle_point;
public int master_point;
public int rank;
public List<object> deck;
public int ChaosId;
public int SubClassId = 10;
public string MyRotationId = "";
public int opponent_viewer_id;
public string opponent_name;
public int opponent_chara_id;
public int opponent_class_id;
public long opponent_emblem_id;
public int opponent_degree_id;
public string opponent_country_code;
public long opponent_sleeve_id;
public int opponent_battle_point;
public int opponent_master_point;
public int opponent_rank;
public List<object> opponent_deck;
public int IdxChangeSeed;
public int OppoIdxChangeSeed;
public int OpponentChaosId;
public int OpponentSubClassId = 10;
public string OpponentMyRotationId = "";
protected const string PLAYLIST_BATTLE_ID_KEY = "battleId";
protected const string PLAYLIST_SEED_KEY = "seed";
protected const string PLAYLIST_FIELD_ID_KEY = "fieldId";
protected const string PLAYLIST_FIRST_TURN_KEY = "firstTurn";
protected const string PLAYLIST_PLAYLIST_KEY = "playlist";
protected const string PLAYLIST_URI_KEY = "uri";
protected const string URI_WATCH_KEY = "Watch";
protected const string PARAM_PLAYER_VIEWER_ID_KEY = "vid1";
protected const string PARAM_PLAYER_NAME_KEY = "name1";
protected const string PARAM_PLAYER_CHARA_ID_KEY = "charaId1";
protected const string PARAM_PLAYER_CLASS_ID_KEY = "classId1";
protected const string PARAM_PLAYER_EMBLEM_ID_KEY = "emblemId1";
protected const string PARAM_PLAYER_DEGREE_ID_KEY = "degreeId1";
protected const string PARAM_PLAYER_COUNTRY_CODE_KEY = "countryCode1";
protected const string PARAM_PLAYER_SLEEVE_ID_KEY = "sleeveId1";
protected const string PARAM_PLAYER_BATTLE_POINT_KEY = "battlePoint1";
protected const string PARAM_PLAYER_MASTER_POINT_KEY = "masterPoint1";
protected const string PARAM_PLAYER_RANK_KEY = "rank1";
protected const string PARAM_PLAYER_IS_OFFICIAL_KEY = "isOfficial1";
protected const string PARAM_PLAYER_DECK_KEY = "deck1";
protected const string PARAM_PLAYER_CHAOS_ID_KEY = "chaosId1";
protected const string PARAM_PLAYER_SUB_CLASS_ID_KEY = "subclassId1";
protected const string PARAM_PLAYER_MY_ROTATION_ID_KEY = "rotationId1";
protected const string PARAM_ENEMY_VIEWER_ID_KEY = "vid2";
protected const string PARAM_ENEMY_NAME_KEY = "name2";
protected const string PARAM_ENEMY_CHARA_ID_KEY = "charaId2";
protected const string PARAM_ENEMY_CLASS_ID_KEY = "classId2";
protected const string PARAM_ENEMY_EMBLEM_ID_KEY = "emblemId2";
protected const string PARAM_ENEMY_DEGREE_ID_KEY = "degreeId2";
protected const string PARAM_ENEMY_COUNTRY_CODE_KEY = "countryCode2";
protected const string PARAM_ENEMY_SLEEVE_ID_KEY = "sleeveId2";
protected const string PARAM_ENEMY_BATTLE_POINT_KEY = "battlePoint2";
protected const string PARAM_ENEMY_MASTER_POINT_KEY = "masterPoint2";
protected const string PARAM_ENEMY_RANK_KEY = "rank2";
protected const string PARAM_ENEMY_IS_OFFICIAL_KEY = "isOfficial2";
protected const string PARAM_ENEMY_DECK_KEY = "deck2";
protected const string PARAM_ENEMY_OPPO_DECK_COUNT_KEY = "oppoDeckCount";
protected const string PARAM_ENEMY_CHAOS_ID_KEY = "chaosId2";
protected const string PARAM_ENEMY_SUB_CLASS_ID_KEY = "subclassId2";
protected const string PARAM_ENEMY_MY_ROTATION_ID_KEY = "rotationId2";
protected const string PARAM_COMMON_IDX_KEY = "idx";
protected const string PARAM_COMMON_CARD_ID_KEY = "cardId";
protected const string PARAM_COMMON_IS_WIN_KEY = "is_win";
protected const string PARAM_COMMON_DECK_FORMAT_KEY = "deck_format";
protected const string PARAM_COMMON_IDX_CHANGE_SEED_KEY = "idxChangeSeed";
protected const string PARAM_COMMON_OPPO_IDX_CHANGE_SEED_KEY = "oppoIdxChangeSeed";
protected const string PARAM_COMMON_IS_CHAOS_SKIN_OVERRIDE_KEY = "isChaosSkinOverride";
protected const string PARAM_COMMON_MISSION_PARAMETER = "mission_parameter";
protected const string PARAM_COMMON_TURN_START_INDEX_LIST = "turn_start_index_list";
protected const string PARAM_COMMON_TWOPICK_TYPE = "twoPickType";
public UIManager.ViewScene ReplayEndBackScene { get; private set; }
public UIManager.ChangeViewSceneParam ReplayEndBackSceneParam { get; private set; }
public bool IsOfficialUser { get; set; }
public bool IsOpponentOfficialUser { get; set; }
public bool IsChaosSkinOverride { get; private set; }
public ReplayDetailInfo(JsonData data)
{
IdxChangeSeed = -1;
OppoIdxChangeSeed = -1;
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
battle_id = data["battleId"].ToLong();
seed = data["seed"].ToInt();
field_id = data["fieldId"].ToInt();
first_turn = data["firstTurn"].ToInt();
if (data.Keys.Contains("deck_format"))
{
deck_format = Data.ParseApiFormat(data["deck_format"].ToInt());
}
if (data.Keys.Contains("twoPickType"))
{
_twoPickFormat = (TwoPickFormat)data["twoPickType"].ToInt();
}
if (data.Keys.Contains("idxChangeSeed"))
{
IdxChangeSeed = data["idxChangeSeed"].ToInt();
}
if (data.Keys.Contains("oppoIdxChangeSeed"))
{
OppoIdxChangeSeed = data["oppoIdxChangeSeed"].ToInt();
}
if (data.Keys.Contains("playlist"))
{
JsonData jsonData = data["playlist"];
play_list = new Dictionary<string, object>();
play_list.Add("uri", "Watch");
List<object> list = new List<object>();
for (int i = 0; i < jsonData.Count; i++)
{
CheckMulliganFlags(jsonData[i]);
Dictionary<string, object> item = Json.Deserialize(jsonData[i].ToJson()) as Dictionary<string, object>;
list.Add(item);
}
play_list.Add("playlist", list);
}
if (data.Keys.Contains("isChaosSkinOverride"))
{
IsChaosSkinOverride = data["isChaosSkinOverride"].ToInt() == 1;
}
if (data.Keys.Contains("mission_parameter"))
{
dataMgr.SetMissionNecessaryInformation(data["mission_parameter"]);
}
CardMaster.SetBattleCardMasterId(data["card_master_id"].ToInt());
viewer_id = data["vid1"].ToInt();
name = data["name1"].ToString();
chara_id = data["charaId1"].ToInt();
class_id = data["classId1"].ToInt();
emblem_id = data["emblemId1"].ToLong();
degree_id = data["degreeId1"].ToInt();
country_code = data["countryCode1"].ToString();
sleeve_id = data["sleeveId1"].ToLong();
battle_point = data["battlePoint1"].ToInt();
master_point = data["masterPoint1"].ToInt();
rank = data["rank1"].ToInt();
IsOfficialUser = data["isOfficial1"].ToBoolean();
SetMyDeck(data);
ChaosId = (data.Keys.Contains("chaosId1") ? data["chaosId1"].ToInt() : (-1));
SubClassId = (data.Keys.Contains("subclassId1") ? data["subclassId1"].ToInt() : 10);
MyRotationId = (data.Keys.Contains("rotationId1") ? data["rotationId1"].ToString() : "");
string text = "deck1";
if (data.Keys.Contains(text))
{
GameMgr.GetIns().GetDataMgr().SetDeckMaxCount(data[text].Count, isSelf: true);
}
opponent_viewer_id = data["vid2"].ToInt();
opponent_name = data["name2"].ToString();
opponent_chara_id = data["charaId2"].ToInt();
opponent_class_id = data["classId2"].ToInt();
opponent_emblem_id = data["emblemId2"].ToLong();
opponent_degree_id = data["degreeId2"].ToInt();
opponent_country_code = data["countryCode2"].ToString();
opponent_sleeve_id = data["sleeveId2"].ToLong();
opponent_battle_point = data["battlePoint2"].ToInt();
opponent_master_point = data["masterPoint2"].ToInt();
opponent_rank = data["rank2"].ToInt();
IsOpponentOfficialUser = data["isOfficial2"].ToBoolean();
SetOpponentDeck(data);
OpponentChaosId = (data.Keys.Contains("chaosId2") ? data["chaosId2"].ToInt() : (-1));
OpponentSubClassId = (data.Keys.Contains("subclassId2") ? data["subclassId2"].ToInt() : 10);
OpponentMyRotationId = (data.Keys.Contains("rotationId2") ? data["rotationId2"].ToString() : "");
if (data.Keys.Contains("oppoDeckCount"))
{
GameMgr.GetIns().GetDataMgr().SetDeckMaxCount(data["oppoDeckCount"].ToInt(), isSelf: false);
}
if (data.Keys.Contains("turn_start_index_list"))
{
TurnStartIndexList = new List<int>();
for (int j = 0; j < data["turn_start_index_list"].Count; j++)
{
TurnStartIndexList.Add(data["turn_start_index_list"][j].ToInt());
}
}
}
public void SetReplayEndBackScene(UIManager.ViewScene scene, UIManager.ChangeViewSceneParam param = null)
{
ReplayEndBackScene = scene;
ReplayEndBackSceneParam = param;
}
protected virtual void CheckMulliganFlags(JsonData data)
{
}
protected void SetMyDeck(JsonData data)
{
JsonData jsonData = data["deck1"];
deck = new List<object>();
for (int i = 0; i < jsonData.Count; i++)
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
dictionary.Add("idx", jsonData[i]["idx"].ToString());
dictionary.Add("cardId", jsonData[i]["cardId"].ToString());
deck.Add(dictionary);
}
}
protected virtual void SetOpponentDeck(JsonData data)
{
JsonData jsonData = data["deck2"];
opponent_deck = new List<object>();
for (int i = 0; i < jsonData.Count; i++)
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
dictionary.Add("idx", jsonData[i]["idx"].ToString());
dictionary.Add("cardId", jsonData[i]["cardId"].ToString());
opponent_deck.Add(dictionary);
}
}
}