Example #1
0
        public static void UpdateMarker(Transform parent, Dictionary <string, GameObject> trickObj, GameObject baseObj)
        {
            Dictionary <TrickData, GameObject> dictionary = new Dictionary <TrickData, GameObject>();

            using (Dictionary <TrickData, GameObject> .Enumerator enumerator = TrickData.mTrickMarkerLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <TrickData, GameObject> current = enumerator.Current;
                    TrickData key = current.Key;
                    if (!TrickData.mTrickDataLists.Contains(key))
                    {
                        GameObject gameObject = current.Value;
                        if (UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject))
                        {
                            UnityEngine.Object.Destroy((UnityEngine.Object)gameObject.get_gameObject());
                        }
                    }
                    else
                    {
                        dictionary.Add(key, current.Value);
                    }
                }
            }
            if (TrickData.mTrickMarkerLists.Count != dictionary.Count)
            {
                TrickData.mTrickMarkerLists = dictionary;
            }
            TrickData.AddMarker(parent, trickObj, baseObj);
        }
Example #2
0
        private static void entryMarker(SceneBattle sb, TrickData td)
        {
            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)sb) || td == null || !td.IsVisualized())
            {
                return;
            }
            GameObject gameObject1 = sb.TrickMarker;
            string     markerName  = td.mTrickParam.MarkerName;

            if (!string.IsNullOrEmpty(markerName) && sb.TrickMarkerDics.ContainsKey(markerName))
            {
                gameObject1 = sb.TrickMarkerDics[markerName];
            }
            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject1))
            {
                return;
            }
            Vector3    vector3     = sb.CalcGridCenter((int)td.mGridX, (int)td.mGridY);
            GameObject gameObject2 = UnityEngine.Object.Instantiate((UnityEngine.Object)gameObject1, vector3, Quaternion.get_identity()) as GameObject;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject2))
            {
                return;
            }
            gameObject2.get_transform().SetParent(sb.CurrentScene.get_transform(), false);
            TrickData.mTrickMarkerLists.Add(td, gameObject2);
        }
Example #3
0
        public static bool CheckClock(int now_clock)
        {
            if (TrickData.mTrickDataLists.Count == 0)
            {
                return(false);
            }
            List <TrickData> trickDataList = new List <TrickData>(TrickData.mTrickDataLists.Count);

            using (List <TrickData> .Enumerator enumerator = TrickData.mTrickDataLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TrickData current = enumerator.Current;
                    if ((int)current.mTrickParam.ValidClock == 0 || (int)current.mTrickParam.ValidClock + (int)current.mCreateClock >= now_clock)
                    {
                        trickDataList.Add(current);
                    }
                }
            }
            if (TrickData.mTrickDataLists.Count == trickDataList.Count)
            {
                return(false);
            }
            TrickData.mTrickDataLists = trickDataList;
            return(true);
        }
Example #4
0
        public static TrickData EntryEffect(string iname, int grid_x, int grid_y, string tag, Unit creator = null, int create_clock = 0, int rank = 1, int rankcap = 1)
        {
            if (string.IsNullOrEmpty(iname))
            {
                return((TrickData)null);
            }
            TrickData trickData = new TrickData();

            trickData.setup(iname, grid_x, grid_y, tag, creator, create_clock, rank, rankcap);
            if (trickData.mTrickParam == null)
            {
                return((TrickData)null);
            }
            TrickData trick_data = TrickData.SearchEffect(grid_x, grid_y);

            if (trick_data != null)
            {
                if ((bool)trick_data.mTrickParam.IsNoOverWrite)
                {
                    return((TrickData)null);
                }
                TrickData.RemoveEffect(trick_data);
            }
            TrickData.mTrickDataLists.Add(trickData);
            return(trickData);
        }
Example #5
0
        private static void entryMarker(Transform parent, TrickData td, Dictionary <string, GameObject> dic, GameObject baseObj)
        {
            if (!td.IsVisualized())
            {
                return;
            }
            GameObject gameObject1 = baseObj;
            string     markerName  = td.mTrickParam.MarkerName;

            if (!string.IsNullOrEmpty(markerName) && dic.ContainsKey(markerName))
            {
                gameObject1 = dic[markerName];
            }
            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject1))
            {
                return;
            }
            Vector3 vector3;

            // ISSUE: explicit reference operation
            ((Vector3)@vector3).\u002Ector((float)(int)td.mGridX + 0.5f, GameUtility.CalcHeight((float)(int)td.mGridX + 0.5f, (float)(int)td.mGridY + 0.5f), (float)(int)td.mGridY + 0.5f);
            GameObject gameObject2 = UnityEngine.Object.Instantiate((UnityEngine.Object)gameObject1, vector3, Quaternion.get_identity()) as GameObject;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject2))
            {
                return;
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)parent, (UnityEngine.Object)null))
            {
                gameObject2.get_transform().SetParent(parent, false);
            }
            TrickData.mTrickMarkerLists.Add(td, gameObject2);
        }
Example #6
0
        public static TrickData SuspendEffect(string iname, int grid_x, int grid_y, string tag, Unit creator, int create_clock, int rank, int rankcap, int rest_count)
        {
            TrickData trickData = TrickData.EntryEffect(iname, grid_x, grid_y, tag, creator, create_clock, rank, rankcap);

            if (trickData != null)
            {
                trickData.mRestActionCount = (OInt)rest_count;
            }
            return(trickData);
        }
Example #7
0
 private void decActionCount()
 {
     if ((int)this.mTrickParam.ActionCount == 0)
     {
         return;
     }
     --this.mRestActionCount;
     if ((int)this.mRestActionCount > 0)
     {
         return;
     }
     TrickData.RemoveEffect(this);
 }
Example #8
0
        public static void MomentBuff(Unit target, int grid_x, int grid_y, EffectCheckTimings chk_timing = EffectCheckTimings.Moment)
        {
            if (target == null)
            {
                return;
            }
            TrickData trickData = TrickData.SearchEffect(grid_x, grid_y);

            if (trickData == null || !trickData.checkTarget(target, false) || !trickData.checkTiming(chk_timing))
            {
                return;
            }
            trickData.actionBuff(target, chk_timing, (RandXorshift)null);
        }
Example #9
0
        public static bool CheckRemoveMarker(TrickData trick_data)
        {
            if (trick_data == null || TrickData.mTrickDataLists.Contains(trick_data) || !TrickData.mTrickMarkerLists.ContainsKey(trick_data))
            {
                return(false);
            }
            GameObject mTrickMarkerList = TrickData.mTrickMarkerLists[trick_data];

            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)mTrickMarkerList))
            {
                UnityEngine.Object.Destroy((UnityEngine.Object)mTrickMarkerList.get_gameObject());
            }
            TrickData.mTrickMarkerLists.Remove(trick_data);
            return(true);
        }
Example #10
0
        public static void RemoveEffect(int grid_x, int grid_y)
        {
            List <TrickData> all = TrickData.mTrickDataLists.FindAll((Predicate <TrickData>)(tdl =>
            {
                if ((int)tdl.mGridX == grid_x)
                {
                    return((int)tdl.mGridY == grid_y);
                }
                return(false);
            }));

            if (all == null || all.Count == 0)
            {
                return;
            }
            using (List <TrickData> .Enumerator enumerator = all.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TrickData   current  = enumerator.Current;
                    SceneBattle instance = SceneBattle.Instance;
                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
                    {
                        BattleCore battle = instance.Battle;
                        if (battle != null)
                        {
                            battle.GimmickEventTrickKillCount(current);
                        }
                    }
                }
            }
            List <TrickData> trickDataList = new List <TrickData>(TrickData.mTrickDataLists.Count);

            using (List <TrickData> .Enumerator enumerator = TrickData.mTrickDataLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TrickData current = enumerator.Current;
                    if (!all.Contains(current))
                    {
                        trickDataList.Add(current);
                    }
                }
            }
            TrickData.mTrickDataLists = trickDataList;
        }
Example #11
0
        public static void AddMarker()
        {
            SceneBattle instance = SceneBattle.Instance;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance) || !UnityEngine.Object.op_Implicit((UnityEngine.Object)instance.CurrentScene) || instance.Battle == null)
            {
                return;
            }
            using (List <TrickData> .Enumerator enumerator1 = TrickData.mTrickDataLists.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    TrickData current1 = enumerator1.Current;
                    if ((bool)current1.mValid && !TrickData.mTrickMarkerLists.ContainsKey(current1))
                    {
                        Dictionary <TrickData, GameObject> dictionary = new Dictionary <TrickData, GameObject>();
                        using (Dictionary <TrickData, GameObject> .Enumerator enumerator2 = TrickData.mTrickMarkerLists.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                KeyValuePair <TrickData, GameObject> current2 = enumerator2.Current;
                                TrickData key = current2.Key;
                                if ((int)key.mGridX == (int)current1.mGridX && (int)key.mGridY == (int)current1.mGridY)
                                {
                                    GameObject gameObject = current2.Value;
                                    if (UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject))
                                    {
                                        UnityEngine.Object.Destroy((UnityEngine.Object)gameObject.get_gameObject());
                                    }
                                }
                                else
                                {
                                    dictionary.Add(key, current2.Value);
                                }
                            }
                        }
                        if (TrickData.mTrickMarkerLists.Count != dictionary.Count)
                        {
                            TrickData.mTrickMarkerLists = dictionary;
                        }
                        TrickData.entryMarker(instance, current1);
                    }
                }
            }
        }
Example #12
0
        private static void addTargetAreaEff(int grid_x, int grid_y, TrickData trick_data, List <Unit> target_lists)
        {
            if (trick_data == null || target_lists == null)
            {
                return;
            }
            TrickParam mTrickParam = trick_data.mTrickParam;

            if (!mTrickParam.IsAreaEff)
            {
                return;
            }
            SceneBattle instance = SceneBattle.Instance;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                return;
            }
            BattleCore battle = instance.Battle;

            if (battle == null)
            {
                return;
            }
            GridMap <bool> scopeGridMap = battle.CreateScopeGridMap(grid_x, grid_y, mTrickParam.EffShape, (int)mTrickParam.EffScope, (int)mTrickParam.EffHeight);

            if (scopeGridMap == null)
            {
                return;
            }
            for (int x = 0; x < scopeGridMap.w; ++x)
            {
                for (int y = 0; y < scopeGridMap.h; ++y)
                {
                    if (scopeGridMap.get(x, y))
                    {
                        Unit unitAtGrid = battle.FindUnitAtGrid(x, y);
                        if (unitAtGrid != null && !target_lists.Contains(unitAtGrid) && trick_data.checkTarget(unitAtGrid, true))
                        {
                            target_lists.Add(unitAtGrid);
                        }
                    }
                }
            }
        }
Example #13
0
        public static bool RemoveEffect(TrickData trick_data)
        {
            if (trick_data == null || !TrickData.mTrickDataLists.Contains(trick_data))
            {
                return(false);
            }
            SceneBattle instance = SceneBattle.Instance;

            if (UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                BattleCore battle = instance.Battle;
                if (battle != null)
                {
                    battle.GimmickEventTrickKillCount(trick_data);
                }
            }
            TrickData.mTrickDataLists.Remove(trick_data);
            return(true);
        }
Example #14
0
 public static void AddMarker(Transform parent, Dictionary <string, GameObject> trickObj, GameObject baseObj)
 {
     using (List <TrickData> .Enumerator enumerator1 = TrickData.mTrickDataLists.GetEnumerator())
     {
         while (enumerator1.MoveNext())
         {
             TrickData current1 = enumerator1.Current;
             if ((bool)current1.mValid && !TrickData.mTrickMarkerLists.ContainsKey(current1))
             {
                 Dictionary <TrickData, GameObject> dictionary = new Dictionary <TrickData, GameObject>();
                 using (Dictionary <TrickData, GameObject> .Enumerator enumerator2 = TrickData.mTrickMarkerLists.GetEnumerator())
                 {
                     while (enumerator2.MoveNext())
                     {
                         KeyValuePair <TrickData, GameObject> current2 = enumerator2.Current;
                         TrickData key = current2.Key;
                         if ((int)key.mGridX == (int)current1.mGridX && (int)key.mGridY == (int)current1.mGridY)
                         {
                             GameObject gameObject = current2.Value;
                             if (UnityEngine.Object.op_Implicit((UnityEngine.Object)gameObject))
                             {
                                 UnityEngine.Object.Destroy((UnityEngine.Object)gameObject.get_gameObject());
                             }
                         }
                         else
                         {
                             dictionary.Add(key, current2.Value);
                         }
                     }
                 }
                 if (TrickData.mTrickMarkerLists.Count != dictionary.Count)
                 {
                     TrickData.mTrickMarkerLists = dictionary;
                 }
                 TrickData.entryMarker(parent, current1, trickObj, baseObj);
             }
         }
     }
 }
Example #15
0
        public static void ActionEffect(eTrickActionTiming action_timing, Unit target, int grid_x, int grid_y, RandXorshift rand, LogMapTrick log_mt = null)
        {
            if (target == null)
            {
                return;
            }
            TrickData trick_data = TrickData.SearchEffect(grid_x, grid_y);

            if (trick_data == null || !trick_data.checkTarget(target, false) || target.IsJump)
            {
                return;
            }
            if (log_mt != null)
            {
                log_mt.TrickData = trick_data;
                log_mt.TargetInfoLists.Clear();
            }
            List <Unit> target_lists = new List <Unit>();

            if (trick_data.checkTarget(target, true))
            {
                target_lists.Add(target);
            }
            TrickData.addTargetAreaEff(grid_x, grid_y, trick_data, target_lists);
            switch (action_timing)
            {
            case eTrickActionTiming.TURN_START:
                trick_data.actionEffectTurnStart(target_lists, rand);
                break;

            case eTrickActionTiming.TURN_END:
                trick_data.actionEffectTurnEnd(target_lists, rand, log_mt);
                trick_data.decActionCount();
                break;
            }
        }
Example #16
0
        private static bool restoreSaveData(BattleSuspend.Data data)
        {
            if (data == null || !data.ivl)
            {
                return(false);
            }
            SceneBattle instance = SceneBattle.Instance;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                return(false);
            }
            BattleCore battle = instance.Battle;

            if (battle == null)
            {
                return(false);
            }
            BattleSuspend.Data.Header hdr = data.hdr;
            if (hdr.apv != Application.get_version())
            {
                DebugUtility.LogWarning("BattleSuspend/Restoration failure! Version is different.");
                return(false);
            }
            if (hdr.arv != AssetManager.AssetRevision)
            {
                DebugUtility.LogWarning("BattleSuspend/Restoration failure! Revision is different.");
                return(false);
            }
            if (hdr.qid != battle.QuestID)
            {
                DebugUtility.LogWarning("BattleSuspend/Restoration failure! QuestID is different.");
                return(false);
            }
            if (hdr.bid != battle.BtlID)
            {
                DebugUtility.LogWarning("BattleSuspend/Restoration failure! BattleID is different.");
                return(false);
            }
            GameUtility.Config_AutoMode_Treasure.Value     = hdr.cat;
            GameUtility.Config_AutoMode_DisableSkill.Value = hdr.cad;
            for (int count = battle.AllUnits.Count; count < data.uil.Count; ++count)
            {
                BattleSuspend.Data.UnitInfo unitInfo = data.uil[count];
                if (!string.IsNullOrEmpty(unitInfo.boi))
                {
                    battle.BreakObjCreate(unitInfo.boi, unitInfo.ugx, unitInfo.ugy, (Unit)null, (LogSkill)null, 0);
                }
            }
            for (int index = 0; index < data.uil.Count && index < battle.AllUnits.Count; ++index)
            {
                BattleSuspend.Data.UnitInfo unit_info = data.uil[index];
                Unit allUnit = battle.AllUnits[index];
                if (!(allUnit.UnitName != unit_info.nam))
                {
                    allUnit.SetupSuspend(battle, unit_info);
                }
            }
            BattleCore.Record questRecord = battle.GetQuestRecord();
            using (List <BattleSuspend.Data.UsedItem> .Enumerator enumerator = data.itl.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BattleSuspend.Data.UsedItem current = enumerator.Current;
                    questRecord.used_items[(OString)current.iti] = (OInt)current.num;
                    ItemData inventoryByItemId = battle.FindInventoryByItemID(current.iti);
                    if (inventoryByItemId != null)
                    {
                        inventoryByItemId.Used(current.num);
                    }
                }
            }
            TrickData.ClearEffect();
            using (List <BattleSuspend.Data.TrickInfo> .Enumerator enumerator = data.trl.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BattleSuspend.Data.TrickInfo current = enumerator.Current;
                    Unit unitFromAllUnits = BattleSuspend.GetUnitFromAllUnits(battle, current.cun);
                    TrickData.SuspendEffect(current.tid, current.grx, current.gry, current.tag, unitFromAllUnits, current.ccl, current.rnk, current.rcp, current.rac);
                }
            }
            using (List <BattleSuspend.Data.SkillExecLogInfo> .Enumerator enumerator = data.sel.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BattleSuspend.Data.SkillExecLogInfo current      = enumerator.Current;
                    BattleCore.SkillExecLog             skillExecLog = new BattleCore.SkillExecLog();
                    skillExecLog.Restore(current);
                    battle.SkillExecLogs.Add(current.inm, skillExecLog);
                }
            }
            BattleSuspend.Data.Variables var = data.var;
            battle.WinTriggerCount   = var.wtc;
            battle.LoseTriggerCount  = var.ltc;
            battle.ActionCount       = var.act;
            battle.Killstreak        = var.kls;
            battle.MaxKillstreak     = var.mks;
            battle.TotalHeal         = var.thl;
            battle.TotalDamagesTaken = var.tdt;
            battle.TotalDamages      = var.tdm;
            battle.NumUsedItems      = var.nui;
            battle.NumUsedSkills     = var.nus;
            battle.ClockTime         = var.ctm;
            battle.ClockTimeTotal    = var.ctt;
            battle.ContinueCount     = var.coc;
            battle.FinisherIname     = var.fns;
            instance.GoldCount       = var.glc;
            instance.RestoreTreasureCount(var.trc);
            battle.Seed              = var.rsd;
            battle.PlayByManually    = var.pbm;
            battle.IsUseAutoPlayMode = var.uam;
            if (var.ris != null)
            {
                for (int index = 0; index < var.ris.Length; ++index)
                {
                    battle.SetRandSeed(index, var.ris[index]);
                }
            }
            if (var.gsl.Count == battle.GimmickEventList.Count)
            {
                for (int index = 0; index < var.gsl.Count; ++index)
                {
                    BattleSuspend.Data.Variables.GimmickEvent gimmickEvent = var.gsl[index];
                    battle.GimmickEventList[index].count       = gimmickEvent.ctr;
                    battle.GimmickEventList[index].IsCompleted = gimmickEvent.cmp != 0;
                }
            }
            if (var.ssl.Count != 0)
            {
                battle.EventTriggers = new bool[var.ssl.Count];
                for (int index = 0; index < var.ssl.Count; ++index)
                {
                    BattleSuspend.Data.Variables.ScriptEvent scriptEvent = var.ssl[index];
                    battle.EventTriggers[index] = scriptEvent.trg;
                }
            }
            Dictionary <string, int> dictionary1 = new Dictionary <string, int>();
            int num1 = Math.Min(var.tkk.Length, var.tkv.Length);

            for (int index = 0; index < num1; ++index)
            {
                dictionary1.Add(var.tkk[index], var.tkv[index]);
            }
            battle.TargetKillstreak = dictionary1;
            Dictionary <string, int> dictionary2 = new Dictionary <string, int>();
            int num2 = Math.Min(var.mtk.Length, var.mtv.Length);

            for (int index = 0; index < num2; ++index)
            {
                dictionary2.Add(var.mtk[index], var.mtv[index]);
            }
            battle.MaxTargetKillstreak = dictionary2;
            BattleSuspend.Data.Variables.WeatherInfo wti = var.wti;
            if (!string.IsNullOrEmpty(wti.wid))
            {
                Unit unitFromAllUnits = BattleSuspend.GetUnitFromAllUnits(battle, wti.mun);
                WeatherData.SuspendWeather(wti.wid, battle.Units, unitFromAllUnits, wti.rnk, wti.rcp, wti.ccl);
            }
            return(true);
        }
Example #17
0
 public Data(TrickData _data)
 {
     this.data  = _data;
     this.param = _data.TrickParam;
 }
Example #18
0
        private static BattleSuspend.Data makeSaveData()
        {
            SceneBattle instance = SceneBattle.Instance;

            if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance))
            {
                return((BattleSuspend.Data)null);
            }
            BattleCore battle = instance.Battle;

            if (battle == null)
            {
                return((BattleSuspend.Data)null);
            }
            BattleSuspend.Data        data = new BattleSuspend.Data();
            BattleSuspend.Data.Header hdr  = data.hdr;
            hdr.apv = Application.get_version();
            hdr.arv = AssetManager.AssetRevision;
            hdr.qid = battle.QuestID;
            hdr.bid = battle.BtlID;
            hdr.cat = GameUtility.Config_AutoMode_Treasure.Value;
            hdr.cad = GameUtility.Config_AutoMode_DisableSkill.Value;
            data.uil.Clear();
            using (List <Unit> .Enumerator enumerator1 = battle.AllUnits.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    Unit current1 = enumerator1.Current;
                    if (current1 != null)
                    {
                        BattleSuspend.Data.UnitInfo unitInfo = new BattleSuspend.Data.UnitInfo();
                        unitInfo.nam = current1.UnitName;
                        unitInfo.nhp = (int)current1.CurrentStatus.param.hp;
                        unitInfo.gem = current1.Gems;
                        unitInfo.ugx = current1.x;
                        unitInfo.ugy = current1.y;
                        unitInfo.dir = (int)current1.Direction;
                        unitInfo.ufg = current1.UnitFlag;
                        unitInfo.isb = current1.IsSub;
                        unitInfo.crt = (int)current1.ChargeTime;
                        unitInfo.tgi = BattleSuspend.GetIdxFromAllUnits(battle, current1.Target);
                        unitInfo.rti = BattleSuspend.GetIdxFromAllUnits(battle, current1.RageTarget);
                        unitInfo.cti = -1;
                        if (current1.CastSkill != null)
                        {
                            unitInfo.csi = current1.CastSkill.SkillParam.iname;
                            unitInfo.ctm = (int)current1.CastTime;
                            unitInfo.cid = (int)current1.CastIndex;
                            if (current1.CastSkillGridMap != null)
                            {
                                unitInfo.cgw = current1.CastSkillGridMap.w;
                                unitInfo.cgh = current1.CastSkillGridMap.h;
                                if (current1.CastSkillGridMap.data != null)
                                {
                                    unitInfo.cgm = new int[current1.CastSkillGridMap.data.Length];
                                    for (int index = 0; index < current1.CastSkillGridMap.data.Length; ++index)
                                    {
                                        unitInfo.cgm[index] = !current1.CastSkillGridMap.data[index] ? 0 : 1;
                                    }
                                }
                            }
                            unitInfo.ctx = current1.GridTarget == null ? -1 : current1.GridTarget.x;
                            unitInfo.cty = current1.GridTarget == null ? -1 : current1.GridTarget.y;
                            unitInfo.cti = BattleSuspend.GetIdxFromAllUnits(battle, current1.UnitTarget);
                        }
                        unitInfo.dct = current1.DeathCount;
                        unitInfo.ajw = current1.AutoJewel;
                        unitInfo.wtt = current1.WaitClock;
                        unitInfo.mvt = current1.WaitMoveTurn;
                        unitInfo.acc = current1.ActionCount;
                        unitInfo.tuc = current1.TurnCount;
                        unitInfo.trc = current1.EventTrigger == null ? 0 : current1.EventTrigger.Count;
                        unitInfo.klc = current1.KillCount;
                        if (current1.EntryTriggers != null)
                        {
                            unitInfo.etr = new int[current1.EntryTriggers.Count];
                            for (int index = 0; index < current1.EntryTriggers.Count; ++index)
                            {
                                unitInfo.etr[index] = !current1.EntryTriggers[index].on ? 0 : 1;
                            }
                        }
                        unitInfo.aid = (int)current1.AIActionIndex;
                        unitInfo.atu = (int)current1.AIActionTurnCount;
                        unitInfo.apt = (int)current1.AIPatrolIndex;
                        unitInfo.boi = current1.CreateBreakObjId;
                        unitInfo.boc = current1.CreateBreakObjClock;
                        unitInfo.sul.Clear();
                        using (Dictionary <SkillData, OInt> .Enumerator enumerator2 = current1.GetSkillUseCount().GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                KeyValuePair <SkillData, OInt> current2 = enumerator2.Current;
                                unitInfo.sul.Add(new BattleSuspend.Data.UnitInfo.SkillUse()
                                {
                                    sid = current2.Key.SkillParam.iname,
                                    ctr = (int)current2.Value
                                });
                            }
                        }
                        unitInfo.bfl.Clear();
                        using (List <BuffAttachment> .Enumerator enumerator2 = current1.BuffAttachments.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                BuffAttachment current2 = enumerator2.Current;
                                if ((!(bool)current2.IsPassive || current2.skill != null && !current2.skill.IsSubActuate()) && current2.CheckTiming != EffectCheckTimings.Moment)
                                {
                                    unitInfo.bfl.Add(new BattleSuspend.Data.UnitInfo.Buff()
                                    {
                                        sid = current2.skill == null ? (string)null : current2.skill.SkillParam.iname,
                                        stg = (int)current2.skilltarget,
                                        tur = (int)current2.turn,
                                        uni = BattleSuspend.GetIdxFromAllUnits(battle, current2.user),
                                        cui = BattleSuspend.GetIdxFromAllUnits(battle, current2.CheckTarget),
                                        tim = (int)current2.CheckTiming,
                                        ipa = (bool)current2.IsPassive,
                                        ucd = (int)current2.UseCondition,
                                        btp = (int)current2.BuffType,
                                        ctp = (int)current2.CalcType
                                    });
                                }
                            }
                        }
                        unitInfo.cdl.Clear();
                        using (List <CondAttachment> .Enumerator enumerator2 = current1.CondAttachments.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                CondAttachment current2 = enumerator2.Current;
                                if (!(bool)current2.IsPassive || current2.skill != null && !current2.skill.IsSubActuate())
                                {
                                    unitInfo.cdl.Add(new BattleSuspend.Data.UnitInfo.Cond()
                                    {
                                        sid = current2.skill == null ? (string)null : current2.skill.SkillParam.iname,
                                        tur = (int)current2.turn,
                                        uni = BattleSuspend.GetIdxFromAllUnits(battle, current2.user),
                                        cui = BattleSuspend.GetIdxFromAllUnits(battle, current2.CheckTarget),
                                        tim = (int)current2.CheckTiming,
                                        ipa = (bool)current2.IsPassive,
                                        ucd = (int)current2.UseCondition,
                                        cdt = (int)current2.CondType,
                                        cnd = (int)current2.Condition,
                                        icu = current2.IsCurse
                                    });
                                }
                            }
                        }
                        unitInfo.shl.Clear();
                        using (List <Unit.UnitShield> .Enumerator enumerator2 = current1.Shields.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                Unit.UnitShield current2 = enumerator2.Current;
                                unitInfo.shl.Add(new BattleSuspend.Data.UnitInfo.Shield()
                                {
                                    inm = current2.skill_param.iname,
                                    nhp = (int)current2.hp,
                                    mhp = (int)current2.hpMax,
                                    ntu = (int)current2.turn,
                                    mtu = (int)current2.turnMax,
                                    drt = (int)current2.damage_rate,
                                    dvl = (int)current2.damage_value
                                });
                            }
                        }
                        data.uil.Add(unitInfo);
                    }
                }
            }
            data.itl.Clear();
            using (Dictionary <OString, OInt> .Enumerator enumerator = battle.GetQuestRecord().used_items.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <OString, OInt> current = enumerator.Current;
                    data.itl.Add(new BattleSuspend.Data.UsedItem()
                    {
                        iti = (string)current.Key,
                        num = (int)current.Value
                    });
                }
            }
            data.trl.Clear();
            using (List <TrickData> .Enumerator enumerator = TrickData.GetEffectAll().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TrickData current = enumerator.Current;
                    data.trl.Add(new BattleSuspend.Data.TrickInfo()
                    {
                        tid = current.TrickParam.Iname,
                        val = (bool)current.Valid,
                        cun = BattleSuspend.GetIdxFromAllUnits(battle, current.CreateUnit),
                        rnk = (int)current.Rank,
                        rcp = (int)current.RankCap,
                        grx = (int)current.GridX,
                        gry = (int)current.GridY,
                        rac = (int)current.RestActionCount,
                        ccl = (int)current.CreateClock,
                        tag = current.Tag
                    });
                }
            }
            data.sel.Clear();
            using (Dictionary <string, BattleCore.SkillExecLog> .KeyCollection.Enumerator enumerator = battle.SkillExecLogs.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.Current;
                    data.sel.Add(new BattleSuspend.Data.SkillExecLogInfo()
                    {
                        inm  = current,
                        ucnt = battle.SkillExecLogs[current].use_count,
                        kcnt = battle.SkillExecLogs[current].kill_count
                    });
                }
            }
            BattleSuspend.Data.Variables var = data.var;
            var.wtc = battle.WinTriggerCount;
            var.ltc = battle.LoseTriggerCount;
            var.act = battle.ActionCount;
            var.kls = battle.Killstreak;
            var.mks = battle.MaxKillstreak;
            var.thl = battle.TotalHeal;
            var.tdt = battle.TotalDamagesTaken;
            var.tdm = battle.TotalDamages;
            var.nui = battle.NumUsedItems;
            var.nus = battle.NumUsedSkills;
            var.ctm = battle.ClockTime;
            var.ctt = battle.ClockTimeTotal;
            var.coc = battle.ContinueCount;
            var.fns = battle.FinisherIname;
            var.glc = instance.GoldCount;
            var.trc = instance.TreasureCount;
            var.rsd = battle.Seed;
            uint[] seed = battle.Rand.GetSeed();
            if (seed != null)
            {
                var.ris = new uint[seed.Length];
                seed.CopyTo((Array)var.ris, 0);
            }
            var.gsl.Clear();
            using (List <GimmickEvent> .Enumerator enumerator = battle.GimmickEventList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    GimmickEvent current = enumerator.Current;
                    var.gsl.Add(new BattleSuspend.Data.Variables.GimmickEvent()
                    {
                        ctr = current.count,
                        cmp = !current.IsCompleted ? 0 : 1
                    });
                }
            }
            var.ssl.Clear();
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance.EventScript, (UnityEngine.Object)null) && instance.EventScript.mSequences != null)
            {
                foreach (EventScript.ScriptSequence mSequence in instance.EventScript.mSequences)
                {
                    var.ssl.Add(new BattleSuspend.Data.Variables.ScriptEvent()
                    {
                        trg = mSequence.Triggered
                    });
                }
            }
            var.tkk     = battle.TargetKillstreak.Keys.ToArray <string>();
            var.tkv     = battle.TargetKillstreak.Values.ToArray <int>();
            var.mtk     = battle.MaxTargetKillstreak.Keys.ToArray <string>();
            var.mtv     = battle.MaxTargetKillstreak.Values.ToArray <int>();
            var.pbm     = battle.PlayByManually;
            var.uam     = battle.IsUseAutoPlayMode;
            var.wti.wid = (string)null;
            WeatherData currentWeatherData = WeatherData.CurrentWeatherData;

            if (currentWeatherData != null)
            {
                var.wti.wid = currentWeatherData.WeatherParam.Iname;
                var.wti.mun = BattleSuspend.GetIdxFromAllUnits(battle, currentWeatherData.ModifyUnit);
                var.wti.rnk = (int)currentWeatherData.Rank;
                var.wti.rcp = (int)currentWeatherData.RankCap;
                var.wti.ccl = (int)currentWeatherData.ChangeClock;
            }
            data.ivl = true;
            return(data);
        }