Ejemplo n.º 1
0
        public override void Save(LogicJSONObject jsonObject, int villageType)
        {
            LogicLevel level = this.m_parent.GetLevel();

            int activeLayout = this.m_parent.GetLevel().GetActiveLayout(villageType);

            for (int i = 0; i < 8; i++)
            {
                LogicVector2 pos = this.m_editModeLayoutPosition[i];

                if (pos.m_x != -1 && pos.m_y != -1)
                {
                    if (level.GetLayoutState(i, villageType) == 1)
                    {
                        jsonObject.Put(this.GetLayoutVariableNameX(i, true), new LogicJSONNumber(pos.m_x));
                        jsonObject.Put(this.GetLayoutVariableNameY(i, true), new LogicJSONNumber(pos.m_y));
                    }
                }
            }

            for (int i = 0; i < 8; i++)
            {
                if (i != activeLayout)
                {
                    LogicVector2 pos = this.m_layoutPosition[i];

                    if (pos.m_x != -1 && pos.m_y != -1)
                    {
                        jsonObject.Put(this.GetLayoutVariableNameX(i, false), new LogicJSONNumber(pos.m_x));
                        jsonObject.Put(this.GetLayoutVariableNameY(i, false), new LogicJSONNumber(pos.m_y));
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Saves this instance to json.
 /// </summary>
 internal void Save(LogicJSONObject jsonObject)
 {
     jsonObject.Put("st", new LogicJSONNumber(this.StartTime));
     jsonObject.Put("et", new LogicJSONNumber(this.EndTime));
     jsonObject.Put("ip", new LogicJSONString(this.EndPoint));
     jsonObject.Put("dm", new LogicJSONString(this.DeviceModel));
 }
        protected sealed override void Save(LogicJSONObject jsonObject)
        {
            LogicJSONArray allianceRankingListArray = new LogicJSONArray(2);
            LogicJSONArray avatarRankingArray       = new LogicJSONArray(SeasonDocument.RANKING_LIST_SIZE);
            LogicJSONArray avatarDuelRankingArray   = new LogicJSONArray(SeasonDocument.RANKING_LIST_SIZE);

            for (int i = 0; i < 2; i++)
            {
                LogicJSONArray allianceRankingArray = new LogicJSONArray(SeasonDocument.RANKING_LIST_SIZE);
                LogicArrayList <AllianceRankingEntry> allianceRankingList = this.AllianceRankingList[i];

                for (int j = 0; j < allianceRankingList.Size(); j++)
                {
                    allianceRankingArray.Add(allianceRankingList[j].Save());
                }

                allianceRankingListArray.Add(allianceRankingArray);
            }

            for (int i = 0; i < this.AvatarRankingList.Size(); i++)
            {
                avatarRankingArray.Add(this.AvatarRankingList[i].Save());
            }

            for (int i = 0; i < this.AvatarDuelRankingList.Size(); i++)
            {
                avatarDuelRankingArray.Add(this.AvatarDuelRankingList[i].Save());
            }

            jsonObject.Put(SeasonDocument.JSON_ATTRIBUTE_ALLIANCE_RANKINGS, allianceRankingListArray);
            jsonObject.Put(SeasonDocument.JSON_ATTRIBUTE_AVATAR_RANKINGS, avatarRankingArray);
            jsonObject.Put(SeasonDocument.JSON_ATTRIBUTE_AVATAR_DUEL_RANKINGS, avatarDuelRankingArray);
            jsonObject.Put(SeasonDocument.JSON_ATTRIBUTE_NEXT_CHECK_TIME, new LogicJSONString(this.NextCheckTime.ToString("O")));
        }
Ejemplo n.º 4
0
        public override LogicJSONObject Save()
        {
            LogicJSONObject jsonObject = base.Save();

            jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_EXP_LEVEL, new LogicJSONNumber(this.m_expLevel));
            jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_ATTACK_WIN_COUNT, new LogicJSONNumber(this.m_attackWinCount));
            jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_ATTACK_LOSE_COUNT, new LogicJSONNumber(this.m_attackLoseCount));
            jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_DEFENSE_WIN_COUNT, new LogicJSONNumber(this.m_defenseWinCount));
            jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_DEFENSE_LOSE_COUNT, new LogicJSONNumber(this.m_defenseLoseCount));
            jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_LEAGUE_TYPE, new LogicJSONNumber(this.m_leagueType));

            if (this.m_allianceId != null)
            {
                LogicJSONObject allianceObject  = new LogicJSONObject();
                LogicJSONArray  allianceIdArray = new LogicJSONArray(2);

                allianceIdArray.Add(new LogicJSONNumber(this.m_allianceId.GetHigherInt()));
                allianceIdArray.Add(new LogicJSONNumber(this.m_allianceId.GetLowerInt()));

                allianceObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_ALLIANCE_ID, allianceIdArray);
                allianceObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_ALLIANCE_NAME, new LogicJSONString(this.m_allianceName));
                allianceObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_ALLIANCE_BADGE_ID, new LogicJSONNumber(this.m_allianceBadgeId));

                jsonObject.Put(AvatarRankingEntry.JSON_ATTRIBUTE_ALLIANCE, allianceObject);
            }

            return(jsonObject);
        }
        public override void Save(LogicJSONObject root, int villageType)
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("m", new LogicJSONNumber(1));
            jsonObject.Put("unit_type", new LogicJSONNumber(this.m_productionType));

            if (this.m_timer != null)
            {
                jsonObject.Put("t", new LogicJSONNumber(this.m_timer.GetRemainingSeconds(this.m_parent.GetLevel().GetLogicTime())));
            }

            if (this.m_slots.Size() > 0)
            {
                LogicJSONArray slotArray = new LogicJSONArray();

                for (int i = 0; i < this.m_slots.Size(); i++)
                {
                    LogicDataSlot   slot       = this.m_slots[i];
                    LogicJSONObject slotObject = new LogicJSONObject();

                    slotObject.Put("id", new LogicJSONNumber(slot.GetData().GetGlobalID()));
                    slotObject.Put("cnt", new LogicJSONNumber(slot.GetCount()));

                    slotArray.Add(slotObject);
                }

                jsonObject.Put("slots", slotArray);
            }

            root.Put("unit_prod", jsonObject);
        }
 public override void SaveToSnapshot(LogicJSONObject jsonObject, int layoutId)
 {
     if (this.m_hp < this.m_maxHp)
     {
         jsonObject.Put("hp", new LogicJSONNumber(this.m_hp));
         jsonObject.Put("reg", new LogicJSONBoolean(this.m_regenerationEnabled));
     }
 }
 public override void Save(LogicJSONObject jsonObject, int villageType)
 {
     if (this.m_hp < this.m_maxHp)
     {
         jsonObject.Put("hp", new LogicJSONNumber(this.m_hp));
         jsonObject.Put("reg", new LogicJSONBoolean(this.m_regenerationEnabled));
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Saves this instance to the specified <see cref="LogicJSONObject"/>.
 /// </summary>
 internal void Save(LogicJSONObject json)
 {
     if (this.Upgrading)
     {
         json.Put("upgradingHero", new LogicJSONNumber(this.HeroData));
         json.Put("upgradingHeroTime", new LogicJSONNumber(this.Timer.RemainingSecs));
     }
 }
 /// <summary>
 /// Saves this instance to the specified <see cref="LogicJSONObject"/>.
 /// </summary>
 internal void Save(LogicJSONObject json)
 {
     if (this.BoosterID != -1)
     {
         json.Put("xp_boost_t", new LogicJSONNumber(this.Timer.RemainingSecs));
         json.Put("xp_boost_p", new LogicJSONNumber(this.BoosterID));
     }
 }
                public LogicJSONObject Save()
                {
                    LogicJSONObject jsonObject = new LogicJSONObject();

                    jsonObject.Put("name", new LogicJSONString(this.Name));
                    jsonObject.Put("connectionString", new LogicJSONString(this.ConnectionString));

                    return(jsonObject);
                }
Ejemplo n.º 11
0
        public override void WriteToJSON(LogicJSONObject jsonObject)
        {
            base.WriteToJSON(jsonObject);

            LogicJSONHelper.SetLogicData(jsonObject, "building", this.m_buildingData);

            jsonObject.Put("buildingNumber", new LogicJSONNumber(this.m_buildingCount));
            jsonObject.Put("buildingLevel", new LogicJSONNumber(this.m_buildingLevel));
        }
Ejemplo n.º 12
0
        public void Save(LogicJSONObject jsonObject)
        {
            Debugger.DoAssert(jsonObject != null, "Unable to save targeting");

            jsonObject.Put("minTownHallLevel", new LogicJSONNumber(this.m_minTownHallLevel));
            jsonObject.Put("maxTownHallLevel", new LogicJSONNumber(this.m_maxTownHallLevel));
            jsonObject.Put("minGemsPurchased", new LogicJSONNumber(this.m_minGemsLevel));
            jsonObject.Put("maxGemsPurchased", new LogicJSONNumber(this.m_maxGemsLevel));
        }
        public override void Save(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = new LogicJSONObject();

            base.Save(baseObject);

            jsonObject.Put("base", baseObject);
            jsonObject.Put("message", new LogicJSONString(this.m_message));
        }
            public LogicJSONObject Save()
            {
                LogicJSONObject jsonObject = new LogicJSONObject();

                jsonObject.Put("contentValidationModeEnabled", new LogicJSONBoolean(this.ContentValidationModeEnabled));
                jsonObject.Put("proxy", this.Proxy.Save());
                jsonObject.Put("admin", this.Admin.Save());

                return(jsonObject);
            }
Ejemplo n.º 15
0
        public static LogicJSONObject Save()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("friendlyChallengeEnabled", new LogicJSONBoolean(GamePlaySettings.FriendlyChallengeEnabled));
            jsonObject.Put("opAttackEnabled", new LogicJSONBoolean(GamePlaySettings.OpAttackEnabled));
            jsonObject.Put("opRankingEnabled", new LogicJSONBoolean(GamePlaySettings.OpRankingEnabled));

            return(jsonObject);
        }
        /// <summary>
        /// Saves this instance to the specified <see cref="LogicJSONObject"/>.
        /// </summary>
        internal void Save(LogicJSONObject json)
        {
            LogicJSONObject energy = new LogicJSONObject();

            energy.Put("enemyK", new LogicJSONNumber());
            energy.Put("given", new LogicJSONNumber());
            energy.Put("time", new LogicJSONNumber(this.Timer.RemainingSecs));

            json.Put("energyVars", energy);
        }
        public static string Save(CouchbaseDocument document)
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put(CouchbaseDocument.JSON_ATTRIBUTE_ID_HIGH, new LogicJSONNumber(document.Id.GetHigherInt()));
            jsonObject.Put(CouchbaseDocument.JSON_ATTRIBUTE_ID_LOW, new LogicJSONNumber(document.Id.GetLowerInt()));
            document.Save(jsonObject);

            return(LogicJSONParser.CreateJSONString(jsonObject, 256));
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     Saves this instance to json.
        /// </summary>
        internal LogicJSONObject Save()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("id_hi", new LogicJSONNumber(this.Id.GetHigherInt()));
            jsonObject.Put("id_lo", new LogicJSONNumber(this.Id.GetLowerInt()));
            jsonObject.Put("entry", this.AvatarEntry.Save());

            return(jsonObject);
        }
Ejemplo n.º 19
0
        public override LogicJSONObject GetJSONForReplay()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("base", base.GetJSONForReplay());
            jsonObject.Put("id", new LogicJSONNumber(this.m_id));
            jsonObject.Put("dataid", new LogicJSONNumber(this.m_data.GetGlobalID()));
            jsonObject.Put("objs", this.m_json);

            return(jsonObject);
        }
Ejemplo n.º 20
0
        /// <summary>
        ///     Gets the json for replay.
        /// </summary>
        public override LogicJSONObject GetJSONForReplay()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("base", base.GetJSONForReplay());
            jsonObject.Put("dA", new LogicJSONNumber(this._debugAction));
            jsonObject.Put("gi", new LogicJSONNumber(this._intArg1));
            jsonObject.Put("int", new LogicJSONNumber(this._intArg2));

            return(jsonObject);
        }
Ejemplo n.º 21
0
        public LogicJSONObject Save()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("homeJSON", this.m_compressibleHomeJson.Save());
            jsonObject.Put("shield_t", new LogicJSONNumber(this.m_shieldDurationSeconds));
            jsonObject.Put("guard_t", new LogicJSONNumber(this.m_guardDurationSeconds));
            jsonObject.Put("personal_break_t", new LogicJSONNumber(this.m_personalBreakSeconds));

            return(jsonObject);
        }
        public void Save(LogicJSONObject jsonObject)
        {
            jsonObject.Put(ReplayStreamEntry.JSON_ATTRIBUTE_STREAM_DATA, new LogicJSONString(Convert.ToBase64String(this.m_streamData)));

            LogicJSONArray versionArray = new LogicJSONArray(3);

            versionArray.Add(new LogicJSONNumber(this.m_majorVersion));
            versionArray.Add(new LogicJSONNumber(this.m_buildVersion));
            versionArray.Add(new LogicJSONNumber(this.m_contentVersion));

            jsonObject.Put(ReplayStreamEntry.JSON_ATTRIBUTE_STREAM_VERSION, versionArray);
        }
Ejemplo n.º 23
0
        /// <summary>
        ///     Saves this instance to json.
        /// </summary>
        public void Save(LogicJSONObject jsonObject)
        {
            if (this._stringValue != null)
            {
                jsonObject.Put("s", new LogicJSONString(this._stringValue));
            }

            if (this._compressedData != null)
            {
                jsonObject.Put("c", new LogicJSONString(Convert.ToBase64String(this._compressedData, 0, this._compressedLength)));
            }
        }
        public override void SaveToSnapshot(LogicJSONObject root, int layoutId)
        {
            if (this.m_timer != null && this.m_hero != null)
            {
                LogicJSONObject jsonObject = new LogicJSONObject();

                jsonObject.Put("level", new LogicJSONNumber(this.m_upgLevel));
                jsonObject.Put("t", new LogicJSONNumber(this.m_timer.GetRemainingSeconds(this.m_parent.GetLevel().GetLogicTime())));

                root.Put("hero_upg", jsonObject);
            }
        }
        public override LogicJSONObject Save()
        {
            LogicJSONObject jsonObject = base.Save();

            jsonObject.Put("lootLimitCooldownInMinutes", new LogicJSONNumber(this.m_duelLootLimitCooldownInMinutes));
            jsonObject.Put("duelBonusPercentWin", new LogicJSONNumber(this.m_duelBonusPercentWin));
            jsonObject.Put("duelBonusPercentLose", new LogicJSONNumber(this.m_duelBonusPercentLose));
            jsonObject.Put("duelBonusPercentDraw", new LogicJSONNumber(this.m_duelBonusPercentDraw));
            jsonObject.Put("duelBonusMaxDiamondCostPercent", new LogicJSONNumber(this.m_duelBonusMaxDiamondCostPercent));

            return(jsonObject);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Saves the ongoing quest data to the specified <see cref="LogicJSONObject"/>.
        /// </summary>
        internal void Save(LogicJSONObject json)
        {
            json.Put("ongoing_quest_data", new LogicJSONNumber(this.Avatar.OngoingQuestData));
            json.Put("ongoing_level_idx", new LogicJSONNumber(this.Avatar.OngoingQuestData));
            json.Put("ongoing_event_data", new LogicJSONNumber());

            if (this.Avatar.Variables.Get(LogicVariables.IgnoreOngoingQuest.GlobalID) != null)
            {
                json.Put("IgnoreOngoingQuest", new LogicJSONNumber(this.Avatar.Variables.Get(LogicVariables.IgnoreOngoingQuest.GlobalID).Id));
            }

            // Json.Put("ongoing_level", new LogicJSONObject());
        }
        public override LogicJSONObject GetJSONForReplay()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("base", base.GetJSONForReplay());

            if (this.m_data != null)
            {
                jsonObject.Put("d", new LogicJSONNumber(this.m_data.GetGlobalID()));
            }

            return(jsonObject);
        }
Ejemplo n.º 28
0
 public void WriteToJSON(LogicJSONObject jsonObject)
 {
     jsonObject.Put("best_season_state", new LogicJSONNumber(this.m_bestSeasonState));
     jsonObject.Put("best_season_year", new LogicJSONNumber(this.m_bestSeasonYear));
     jsonObject.Put("best_season_month", new LogicJSONNumber(this.m_bestSeasonMonth));
     jsonObject.Put("best_season_rank", new LogicJSONNumber(this.m_bestSeasonRank));
     jsonObject.Put("best_season_score", new LogicJSONNumber(this.m_bestSeasonScore));
     jsonObject.Put("last_season_state", new LogicJSONNumber(this.m_lastSeasonState));
     jsonObject.Put("last_season_year", new LogicJSONNumber(this.m_lastSeasonYear));
     jsonObject.Put("last_season_month", new LogicJSONNumber(this.m_lastSeasonMonth));
     jsonObject.Put("last_season_rank", new LogicJSONNumber(this.m_lastSeasonRank));
     jsonObject.Put("last_season_score", new LogicJSONNumber(this.m_lastSeasonScore));
 }
        public void SetAccountInfo(LogicLong accountId, string passToken)
        {
            this.m_accountInfo.AccountId = accountId;
            this.m_accountInfo.PassToken = passToken;

            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("id_high", new LogicJSONNumber(accountId.GetHigherInt()));
            jsonObject.Put("id_low", new LogicJSONNumber(accountId.GetLowerInt()));
            jsonObject.Put("passToken", new LogicJSONString(passToken));

            Directory.CreateDirectory("accounts");
            File.WriteAllText(string.Format("accounts/{0}-{1}", accountId.GetHigherInt(), accountId.GetLowerInt()), LogicJSONParser.CreateJSONString(jsonObject));
        }
Ejemplo n.º 30
0
        /// <summary>
        ///     Saves this instance to json.
        /// </summary>
        internal LogicJSONObject Save()
        {
            LogicJSONObject jsonObject = new LogicJSONObject();

            jsonObject.Put("id_hi", new LogicJSONNumber(this.Id.GetHigherInt()));
            jsonObject.Put("id_lo", new LogicJSONNumber(this.Id.GetLowerInt()));
            jsonObject.Put("pass_t", new LogicJSONString(this.PassToken));
            jsonObject.Put("pt_secs", new LogicJSONNumber(this.PlayTimeSecs));
            jsonObject.Put("acc_cr", new LogicJSONString(this.AccountCreatedDate));
            jsonObject.Put("t_ban", new LogicJSONNumber(this.TotalBan));

            LogicJSONArray sessionArray = new LogicJSONArray();

            for (int i = 0; i < this.LastSessions.Count; i++)
            {
                LogicJSONObject obj = new LogicJSONObject();
                this.LastSessions[i].Save(obj);
                sessionArray.Add(obj);
            }

            jsonObject.Put("sessions", sessionArray);

            if (this.CurrentBan != null)
            {
                LogicJSONObject banObject = new LogicJSONObject();
                this.CurrentBan.Save(banObject);
                jsonObject.Put("ban", banObject);
            }

            return(jsonObject);
        }