public void LoadUpgradeLevel(LogicJSONObject jsonObject)
        {
            LogicJSONNumber lvlObject = jsonObject.GetJSONNumber("lvl");
            LogicTrapData   data      = this.GetTrapData();

            if (lvlObject != null)
            {
                this.m_upgLevel = lvlObject.GetIntValue();
                int maxLvl = data.GetUpgradeLevelCount();

                if (this.m_upgLevel >= maxLvl)
                {
                    Debugger.Warning(string.Format("LogicTrap::load() - Loaded upgrade level {0} is over max! (max = {1}) id {2} data id {3}",
                                                   lvlObject.GetIntValue(),
                                                   maxLvl,
                                                   this.m_globalId,
                                                   data.GetGlobalID()));
                    this.m_upgLevel = maxLvl - 1;
                }
                else
                {
                    if (this.m_upgLevel < -1)
                    {
                        Debugger.Error("LogicTrap::load() - Loaded an illegal upgrade level!");
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        ///     Reads this instance from json.
        /// </summary>
        public void ReadFromJSON(LogicJSONObject jsonObject)
        {
            LogicJSONNumber id = jsonObject.GetJSONNumber("id");

            if (id != null && id.GetIntValue() != 0)
            {
                this._data = LogicDataTables.GetDataById(id.GetIntValue());
            }

            this._count = LogicJSONHelper.GetJSONNumber(jsonObject, "cnt");
        }
Example #3
0
        public override void LoadFromJSON(LogicJSONObject jsonRoot)
        {
            LogicJSONObject baseObject = jsonRoot.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("Replay LogicCastSpellCommand load failed! Base missing!");
            }

            base.LoadFromJSON(baseObject);

            LogicJSONNumber dataNumber = jsonRoot.GetJSONNumber("d");

            if (dataNumber != null)
            {
                this.m_data = (LogicSpellData)LogicDataTables.GetDataById(dataNumber.GetIntValue(), LogicDataType.SPELL);
            }

            if (this.m_data == null)
            {
                Debugger.Error("Replay LogicCastSpellCommand load failed! Data is NULL!");
            }

            this.m_x = jsonRoot.GetJSONNumber("x").GetIntValue();
            this.m_y = jsonRoot.GetJSONNumber("y").GetIntValue();

            LogicJSONNumber dataLevelNumber = jsonRoot.GetJSONNumber("dl");

            if (dataLevelNumber != null)
            {
                this.m_allianceSpell = true;
                this.m_upgLevel      = dataLevelNumber.GetIntValue();
            }
        }
Example #4
0
        public override void LoadFromJSON(LogicJSONObject jsonRoot)
        {
            LogicJSONObject baseObject = jsonRoot.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("Replay LogicChangeUnitVillage2Command load failed! Base missing!");
            }

            base.LoadFromJSON(baseObject);

            LogicJSONNumber newDataNumber = jsonRoot.GetJSONNumber("n");

            if (newDataNumber != null)
            {
                this.m_newUnitData = (LogicCharacterData)LogicDataTables.GetDataById(newDataNumber.GetIntValue(), LogicDataType.CHARACTER);
            }

            LogicJSONNumber oldDataNumber = jsonRoot.GetJSONNumber("o");

            if (oldDataNumber != null)
            {
                this.m_oldUnitData = (LogicCharacterData)LogicDataTables.GetDataById(oldDataNumber.GetIntValue(), LogicDataType.CHARACTER);
            }
        }
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = jsonObject.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("JoinAllianceResponseAvatarStreamEntry::load base is NULL");
            }

            base.Load(baseObject);

            LogicJSONNumber allianceIdHighNumber = jsonObject.GetJSONNumber("alli_id_high");
            LogicJSONNumber allianceIdLowNumber  = jsonObject.GetJSONNumber("alli_id_low");

            if (allianceIdHighNumber != null && allianceIdLowNumber != null)
            {
                this.m_allianceId = new LogicLong(allianceIdHighNumber.GetIntValue(), allianceIdLowNumber.GetIntValue());
            }

            this.m_allianceName    = LogicJSONHelper.GetString(jsonObject, "alli_name");
            this.m_allianceBadgeId = LogicJSONHelper.GetInt(jsonObject, "alli_badge_id");
            this.m_message         = LogicJSONHelper.GetString(jsonObject, "message");

            LogicJSONNumber senderIdHighNumber = jsonObject.GetJSONNumber("sender_id_high");
            LogicJSONNumber senderIdLowNumber  = jsonObject.GetJSONNumber("sender_id_low");

            if (senderIdHighNumber != null && senderIdLowNumber != null)
            {
                this.m_senderHomeId = new LogicLong(senderIdHighNumber.GetIntValue(), senderIdLowNumber.GetIntValue());
            }
        }
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = jsonObject.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("ReplayStreamEntry::load base is NULL");
            }

            base.Load(baseObject);

            this.m_battleLogJSON  = jsonObject.GetJSONString("battleLog").GetStringValue();
            this.m_message        = jsonObject.GetJSONString("message").GetStringValue();
            this.m_opponentName   = jsonObject.GetJSONString("opponent_name").GetStringValue();
            this.m_attack         = jsonObject.GetJSONBoolean("attack").IsTrue();
            this.m_majorVersion   = jsonObject.GetJSONNumber("replay_major_v").GetIntValue();
            this.m_buildVersion   = jsonObject.GetJSONNumber("replay_build_v").GetIntValue();
            this.m_contentVersion = jsonObject.GetJSONNumber("replay_content_v").GetIntValue();

            LogicJSONNumber replayShardId = jsonObject.GetJSONNumber("replay_shard_id");

            if (replayShardId != null)
            {
                this.m_replayShardId = replayShardId.GetIntValue();
                this.m_replayId      = new LogicLong(jsonObject.GetJSONNumber("replay_id_hi").GetIntValue(), jsonObject.GetJSONNumber("replay_id_lo").GetIntValue());
            }
        }
Example #7
0
        /// <summary>
        ///     Loads this instance.
        /// </summary>
        public virtual void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber idHigh = jsonObject.GetJSONNumber("id_hi");
            LogicJSONNumber idLow  = jsonObject.GetJSONNumber("id_lo");

            if (idHigh != null)
            {
                if (idLow != null)
                {
                    this._id = new LogicLong(idHigh.GetIntValue(), idLow.GetIntValue());
                }
            }

            LogicJSONObject senderObject = jsonObject.GetJSONObject("sender");

            if (senderObject != null)
            {
                LogicJSONString nameObject = senderObject.GetJSONString("name");

                if (nameObject != null)
                {
                    this._senderName = nameObject.GetStringValue();
                }

                LogicJSONNumber expLevelObject = senderObject.GetJSONNumber("exp_lvl");

                if (expLevelObject != null)
                {
                    this._senderExpLevel = expLevelObject.GetIntValue();
                }

                LogicJSONNumber leagueTypeObject = senderObject.GetJSONNumber("league_type");

                if (leagueTypeObject != null)
                {
                    this._senderLeagueType = leagueTypeObject.GetIntValue();
                }

                LogicJSONNumber ageSecsObject = senderObject.GetJSONNumber("age_secs");

                if (ageSecsObject != null)
                {
                    this._ageSeconds = ageSecsObject.GetIntValue();
                }

                LogicJSONBoolean isDismissedObject = senderObject.GetJSONBoolean("is_dismissed");

                if (isDismissedObject != null)
                {
                    this._dismiss = isDismissedObject.IsTrue();
                }

                LogicJSONBoolean isNewObject = senderObject.GetJSONBoolean("is_new");

                if (isNewObject != null)
                {
                    this._new = isNewObject.IsTrue();
                }
            }
        }
Example #8
0
        public virtual void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber allianceIdHighNumber = jsonObject.GetJSONNumber("alliance_id_hi");

            if (allianceIdHighNumber != null)
            {
                this.m_allianceId       = new LogicLong(allianceIdHighNumber.GetIntValue(), jsonObject.GetJSONNumber("alliance_id_lo").GetIntValue());
                this.m_allianceName     = jsonObject.GetJSONString("alliance_name").GetStringValue();
                this.m_allianceBadgeId  = jsonObject.GetJSONNumber("alliance_badge").GetIntValue();
                this.m_allianceExpLevel = jsonObject.GetJSONNumber("alliance_xp_lvl").GetIntValue();
            }

            this.m_accountId = new LogicLong(jsonObject.GetJSONNumber("acc_id_hi").GetIntValue(), jsonObject.GetJSONNumber("acc_id_lo").GetIntValue());
            this.m_avatarId  = new LogicLong(jsonObject.GetJSONNumber("avatar_id_hi").GetIntValue(), jsonObject.GetJSONNumber("avatar_id_lo").GetIntValue());

            LogicJSONNumber homeIdHighNumber = jsonObject.GetJSONNumber("home_id_hi");

            if (homeIdHighNumber != null)
            {
                this.m_homeId = new LogicLong(homeIdHighNumber.GetIntValue(), jsonObject.GetJSONNumber("home_id_lo").GetIntValue());
            }

            this.m_name             = jsonObject.GetJSONString("name").GetStringValue();
            this.m_remainingSeconds = jsonObject.GetJSONNumber("remainingSecs").GetIntValue();
        }
        public void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber avatarIdHighObject = jsonObject.GetJSONNumber("avatar_id_high");
            LogicJSONNumber avatarIdLowObject  = jsonObject.GetJSONNumber("avatar_id_low");

            if (avatarIdHighObject != null && avatarIdLowObject != null)
            {
                this.m_avatarId = new LogicLong(avatarIdHighObject.GetIntValue(), avatarIdLowObject.GetIntValue());
            }

            LogicJSONArray donationArray = jsonObject.GetJSONArray("donations");

            if (donationArray != null)
            {
                for (int i = 0; i < donationArray.Size(); i++)
                {
                    LogicJSONArray array = donationArray.GetJSONArray(i);

                    if (array != null && array.Size() == 2)
                    {
                        LogicData data = LogicDataTables.GetDataById(array.GetJSONNumber(0).GetIntValue());

                        if (data != null)
                        {
                            this.m_donationData.Add((LogicCombatItemData)data);
                            this.m_donationLevel.Add(array.GetJSONNumber(1).GetIntValue());
                        }
                    }
                }
            }
        }
Example #10
0
        public override void LoadFromJSON(LogicJSONObject jsonRoot)
        {
            LogicJSONObject baseObject = jsonRoot.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("Replay LogicPlaceAttackerCommand load failed! Base missing!");
            }

            base.LoadFromJSON(baseObject);

            LogicJSONNumber dataNumber = jsonRoot.GetJSONNumber("d");

            if (dataNumber != null)
            {
                this.m_data = (LogicCharacterData)LogicDataTables.GetDataById(dataNumber.GetIntValue(), LogicDataType.CHARACTER);
            }

            if (this.m_data == null)
            {
                Debugger.Error("Replay LogicPlaceAttackerCommand load failed! Character is NULL!");
            }

            this.m_x = jsonRoot.GetJSONNumber("x").GetIntValue();
            this.m_y = jsonRoot.GetJSONNumber("y").GetIntValue();
        }
Example #11
0
        public override void LoadFromJSON(LogicJSONObject jsonRoot)
        {
            LogicJSONObject baseObject = jsonRoot.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("Replay LogicPlaceAlliancePortalCommand load failed! Base missing!");
            }

            base.LoadFromJSON(baseObject);

            LogicJSONNumber dataNumber = jsonRoot.GetJSONNumber("d");

            if (dataNumber != null)
            {
                this.m_data = (LogicAlliancePortalData)LogicDataTables.GetDataById(dataNumber.GetIntValue(), LogicDataType.ALLIANCE_PORTAL);
            }

            if (this.m_data == null)
            {
                Debugger.Error("Replay LogicPlaceAlliancePortalCommand load failed! Data is NULL!");
            }

            this.m_x = jsonRoot.GetJSONNumber("x").GetIntValue();
            this.m_y = jsonRoot.GetJSONNumber("y").GetIntValue();
        }
        /// <summary>
        ///     Loads this instance from json.
        /// </summary>
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber  hpNumber     = jsonObject.GetJSONNumber("hp");
            LogicJSONBoolean regenBoolean = jsonObject.GetJSONBoolean("reg");

            if (hpNumber != null)
            {
                if (this._parent.GetLevel().GetState() != 2)
                {
                    this._hp = LogicMath.Clamp(hpNumber.GetIntValue(), 0, this._maxHp);
                }
                else
                {
                    this._hp = this._maxHp;
                }
            }
            else
            {
                this._hp = this._maxHp;
            }

            if (regenBoolean != null)
            {
                this._regenerationEnabled = regenBoolean.IsTrue();
            }
            else
            {
                this._regenerationEnabled = false;
            }
        }
Example #13
0
        public void Load(LogicJSONObject jsonObject)
        {
            this.m_allianceName           = jsonObject.GetJSONString("alliance_name").GetStringValue();
            this.m_allianceBadgeId        = jsonObject.GetJSONNumber("badge_id").GetIntValue();
            this.m_allianceType           = (AllianceType)jsonObject.GetJSONNumber("type").GetIntValue();
            this.m_memberCount            = jsonObject.GetJSONNumber("member_count").GetIntValue();
            this.m_score                  = jsonObject.GetJSONNumber("score").GetIntValue();
            this.m_duelScore              = jsonObject.GetJSONNumber("duel_score").GetIntValue();
            this.m_requiredScore          = jsonObject.GetJSONNumber("required_score").GetIntValue();
            this.m_requiredDuelScore      = jsonObject.GetJSONNumber("required_duel_score").GetIntValue();
            this.m_winWarCount            = jsonObject.GetJSONNumber("win_war_count").GetIntValue();
            this.m_lostWarCount           = jsonObject.GetJSONNumber("lost_war_count").GetIntValue();
            this.m_drawWarCount           = jsonObject.GetJSONNumber("draw_war_count").GetIntValue();
            this.m_warFrequency           = jsonObject.GetJSONNumber("war_freq").GetIntValue();
            this.m_expLevel               = jsonObject.GetJSONNumber("xp_level").GetIntValue();
            this.m_expPoints              = jsonObject.GetJSONNumber("xp_points").GetIntValue();
            this.m_consecutiveWinWarCount = jsonObject.GetJSONNumber("cons_win_war_count").GetIntValue();
            this.m_publicWarLog           = jsonObject.GetJSONBoolean("public_war_log").IsTrue();
            this.m_amicalWarEnabled       = jsonObject.GetJSONBoolean("amical_war_enabled").IsTrue();

            LogicJSONNumber localeObject = jsonObject.GetJSONNumber("locale");

            if (localeObject != null)
            {
                this.m_localeData = LogicDataTables.GetDataById(localeObject.GetIntValue());
            }

            LogicJSONNumber originObject = jsonObject.GetJSONNumber("origin");

            if (originObject != null)
            {
                this.m_originData = LogicDataTables.GetDataById(originObject.GetIntValue());
            }
        }
Example #14
0
        public virtual void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber senderAvatarIdHighObject = jsonObject.GetJSONNumber("sender_avatar_id_high");
            LogicJSONNumber senderAvatarIdLowObject  = jsonObject.GetJSONNumber("sender_avatar_id_low");

            if (senderAvatarIdHighObject != null && senderAvatarIdLowObject != null)
            {
                this.m_senderAvatarId = new LogicLong(senderAvatarIdHighObject.GetIntValue(), senderAvatarIdLowObject.GetIntValue());
            }

            LogicJSONNumber senderHomeIdHighObject = jsonObject.GetJSONNumber("sender_home_id_high");
            LogicJSONNumber senderHomeIdLowObject  = jsonObject.GetJSONNumber("sender_home_id_low");

            if (senderHomeIdHighObject != null && senderHomeIdLowObject != null)
            {
                this.m_senderHomeId = new LogicLong(senderHomeIdHighObject.GetIntValue(), senderHomeIdLowObject.GetIntValue());
            }


            this.m_senderName       = LogicJSONHelper.GetString(jsonObject, "sender_name");
            this.m_senderLevel      = LogicJSONHelper.GetInt(jsonObject, "sender_level");
            this.m_senderLeagueType = LogicJSONHelper.GetInt(jsonObject, "sender_league_type");
            this.m_senderRole       = (LogicAvatarAllianceRole)LogicJSONHelper.GetInt(jsonObject, "sender_role");
            this.m_removed          = LogicJSONHelper.GetBool(jsonObject, "removed");
        }
Example #15
0
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = jsonObject.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("BattleReportStreamEntry::load base is NULL");
            }

            base.Load(baseObject);

            this.m_battleLogJSON  = jsonObject.GetJSONString("battle_log").GetStringValue();
            this.m_majorVersion   = jsonObject.GetJSONNumber("major_v").GetIntValue();
            this.m_buildVersion   = jsonObject.GetJSONNumber("build_v").GetIntValue();
            this.m_contentVersion = jsonObject.GetJSONNumber("content_v").GetIntValue();
            this.m_replayShardId  = jsonObject.GetJSONNumber("replay_shard_id").GetIntValue();
            this.m_revengeUsed    = jsonObject.GetJSONBoolean("revenge_used").IsTrue();

            LogicJSONNumber replayIdHigh = jsonObject.GetJSONNumber("replay_id_hi");

            if (replayIdHigh != null)
            {
                this.m_replayId = new LogicLong(replayIdHigh.GetIntValue(), jsonObject.GetJSONNumber("replay_id_lo").GetIntValue());
            }
        }
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONBoolean initialSpawnDoneBoolean = jsonObject.GetJSONBoolean("initial_spawn_done");

            if (initialSpawnDoneBoolean != null)
            {
                this.m_initialSpawnDone = initialSpawnDoneBoolean.IsTrue();
            }

            if (this.m_timer != null)
            {
                this.m_timer.Destruct();
                this.m_timer = null;
            }

            this.m_timer = LogicTimer.GetLogicTimer(jsonObject, this.m_parent.GetLevel().GetLogicTime(), "spawn_timer", this.m_intervalSeconds);

            LogicJSONNumber lifetimeSpawnsNumber = jsonObject.GetJSONNumber("lifetime_spawns");

            if (lifetimeSpawnsNumber != null)
            {
                this.m_lifeTimeSpawns = lifetimeSpawnsNumber.GetIntValue();
            }

            LogicJSONArray spawnedArray = jsonObject.GetJSONArray("spawned");

            if (spawnedArray != null)
            {
                for (int i = 0; i < spawnedArray.Size(); i++)
                {
                    this.m_spawned.Add(spawnedArray.GetJSONNumber(i).GetIntValue());
                }
            }
        }
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = jsonObject.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("AllianceInvitationAvatarStreamEntry::load base is NULL");
            }

            base.Load(baseObject);

            LogicJSONNumber allianceIdHighNumber = jsonObject.GetJSONNumber("alli_id_high");
            LogicJSONNumber allianceIdLowNumber  = jsonObject.GetJSONNumber("alli_id_low");

            if (allianceIdHighNumber != null && allianceIdLowNumber != null)
            {
                this.m_allianceId = new LogicLong(allianceIdHighNumber.GetIntValue(), allianceIdLowNumber.GetIntValue());
            }

            this.m_allianceName    = jsonObject.GetJSONString("alli_name").GetStringValue();
            this.m_allianceBadgeId = jsonObject.GetJSONNumber("alli_badge_id").GetIntValue();
            this.m_allianceLevel   = jsonObject.GetJSONNumber("alli_level").GetIntValue();

            LogicJSONNumber senderIdHighNumber = jsonObject.GetJSONNumber("sender_id_high");
            LogicJSONNumber senderIdLowNumber  = jsonObject.GetJSONNumber("sender_id_low");

            if (senderIdHighNumber != null && senderIdLowNumber != null)
            {
                this.m_senderHomeId = new LogicLong(senderIdHighNumber.GetIntValue(), senderIdLowNumber.GetIntValue());
            }
        }
        public virtual void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject senderObject = jsonObject.GetJSONObject("sender");

            if (senderObject != null)
            {
                LogicJSONNumber avatarIdHighNumber = senderObject.GetJSONNumber("avatar_id_hi");

                if (avatarIdHighNumber != null)
                {
                    this.m_senderAvatarId = new LogicLong(avatarIdHighNumber.GetIntValue(), senderObject.GetJSONNumber("avatar_id_lo").GetIntValue());
                }

                this.m_senderName       = senderObject.GetJSONString("name").GetStringValue();
                this.m_senderExpLevel   = senderObject.GetJSONNumber("exp_lvl").GetIntValue();
                this.m_senderLeagueType = senderObject.GetJSONNumber("league_type").GetIntValue();

                LogicJSONBoolean isDismissedObject = senderObject.GetJSONBoolean("is_dismissed");

                if (isDismissedObject != null)
                {
                    this.m_dismiss = isDismissedObject.IsTrue();
                }

                LogicJSONBoolean isNewObject = senderObject.GetJSONBoolean("is_new");

                if (isNewObject != null)
                {
                    this.m_new = isNewObject.IsTrue();
                }
            }
        }
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = jsonObject.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("ChatStreamEntry::load base is NULL");
            }

            base.Load(baseObject);

            this.m_eventType = (AllianceEventStreamEntryType)jsonObject.GetJSONNumber("event_type").GetIntValue();

            LogicJSONNumber eventAvatarIdHighObject = jsonObject.GetJSONNumber("event_avatar_id_high");
            LogicJSONNumber eventAvatarIdLowObject  = jsonObject.GetJSONNumber("event_avatar_id_low");

            if (eventAvatarIdHighObject != null && eventAvatarIdLowObject != null)
            {
                this.m_eventAvatarId = new LogicLong(eventAvatarIdHighObject.GetIntValue(), eventAvatarIdLowObject.GetIntValue());

                LogicJSONString eventAvatarNameObject = jsonObject.GetJSONString("event_avatar_name");

                if (eventAvatarNameObject != null)
                {
                    this.m_eventAvatarName = eventAvatarNameObject.GetStringValue();
                }
            }
        }
        public void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber avatarIdHighObject = jsonObject.GetJSONNumber("avatar_id_high");
            LogicJSONNumber avatarIdLowObject  = jsonObject.GetJSONNumber("avatar_id_low");

            if (avatarIdHighObject != null && avatarIdLowObject != null)
            {
                this.m_avatarId = new LogicLong(avatarIdHighObject.GetIntValue(), avatarIdLowObject.GetIntValue());
            }

            LogicJSONNumber homeIdHighObject = jsonObject.GetJSONNumber("home_id_high");
            LogicJSONNumber homeIdLowObject  = jsonObject.GetJSONNumber("home_id_low");

            if (homeIdHighObject != null && homeIdLowObject != null)
            {
                this.m_homeId = new LogicLong(homeIdHighObject.GetIntValue(), homeIdLowObject.GetIntValue());
            }

            this.m_name                  = LogicJSONHelper.GetString(jsonObject, "name");
            this.m_allianceRole          = (LogicAvatarAllianceRole)LogicJSONHelper.GetInt(jsonObject, "alliance_role");
            this.m_expLevel              = LogicJSONHelper.GetInt(jsonObject, "xp_level");
            this.m_leagueType            = LogicJSONHelper.GetInt(jsonObject, "league_type");
            this.m_score                 = LogicJSONHelper.GetInt(jsonObject, "score");
            this.m_duelScore             = LogicJSONHelper.GetInt(jsonObject, "duel_score");
            this.m_donationCount         = LogicJSONHelper.GetInt(jsonObject, "donations");
            this.m_receivedDonationCount = LogicJSONHelper.GetInt(jsonObject, "received_donations");
            this.m_order                 = LogicJSONHelper.GetInt(jsonObject, "order");
            this.m_previousOrder         = LogicJSONHelper.GetInt(jsonObject, "prev_order");
            this.m_orderVillage2         = LogicJSONHelper.GetInt(jsonObject, "order_v2");
            this.m_previousOrderVillage2 = LogicJSONHelper.GetInt(jsonObject, "prev_order_v2");
            this.m_warCooldown           = LogicJSONHelper.GetInt(jsonObject, "war_cooldown");
            this.m_warPreference         = LogicJSONHelper.GetInt(jsonObject, "war_preference");
        }
Example #21
0
        /// <summary>
        ///     Loads this instance from json.
        /// </summary>
        public void Load(LogicJSONObject jsonObject)
        {
            this._avatarId        = new LogicLong(LogicJSONHelper.GetJSONNumber(jsonObject, "avatar_id_hi"), LogicJSONHelper.GetJSONNumber(jsonObject, "avatar_id_lo"));
            this._homeId          = new LogicLong(LogicJSONHelper.GetJSONNumber(jsonObject, "home_id_hi"), LogicJSONHelper.GetJSONNumber(jsonObject, "home_id_lo"));
            this._avatarName      = LogicJSONHelper.GetJSONString(jsonObject, "name");
            this._facebookId      = LogicJSONHelper.GetJSONString(jsonObject, "facebook_id");
            this._expLevel        = LogicJSONHelper.GetJSONNumber(jsonObject, "exp_lvl");
            this._leagueType      = LogicJSONHelper.GetJSONNumber(jsonObject, "league_type");
            this._nameChangeState = LogicJSONHelper.GetJSONNumber(jsonObject, "name_change_state");
            this._nameSetByUser   = LogicJSONHelper.GetJSONBoolean(jsonObject, "name_set");

            LogicJSONNumber allianceIdHigh = jsonObject.GetJSONNumber("alliance_id_hi");
            LogicJSONNumber allianceIdLow  = jsonObject.GetJSONNumber("alliance_id_lo");

            if (allianceIdHigh != null && allianceIdLow != null)
            {
                this._allianceId       = new LogicLong(allianceIdHigh.GetIntValue(), allianceIdLow.GetIntValue());
                this._allianceName     = LogicJSONHelper.GetJSONString(jsonObject, "alliance_name");
                this._allianceExpLevel = LogicJSONHelper.GetJSONNumber(jsonObject, "alliance_exp_lvl");
                this._allianceRole     = LogicJSONHelper.GetJSONNumber(jsonObject, "alliance_role");
                this._badgeId          = LogicJSONHelper.GetJSONNumber(jsonObject, "badge_id");
            }
            else
            {
                this._badgeId = -1;
            }
        }
Example #22
0
        /// <summary>
        ///     Loads this instance from json.
        /// </summary>
        public override void LoadFromJSON(LogicJSONObject jsonRoot)
        {
            LogicJSONObject baseObject = jsonRoot.GetJSONObject("base");

            if (baseObject != null)
            {
                base.LoadFromJSON(baseObject);
            }
            else
            {
                Debugger.Error("Replay LogicDebugCommand load failed! Base missing!");
            }

            LogicJSONNumber debugActionObject = jsonRoot.GetJSONNumber("dA");

            if (debugActionObject != null)
            {
                this._debugAction = debugActionObject.GetIntValue();
            }

            LogicJSONNumber intArg1Object = jsonRoot.GetJSONNumber("gi");

            if (intArg1Object != null)
            {
                this._intArg1 = intArg1Object.GetIntValue();
            }

            LogicJSONNumber intArg2Object = jsonRoot.GetJSONNumber("int");

            if (intArg2Object != null)
            {
                this._intArg2 = intArg2Object.GetIntValue();
            }
        }
Example #23
0
        public override void Load(LogicJSONObject jsonObject)
        {
            this.LoadUpgradeLevel(jsonObject);

            if (this.m_constructionTimer != null)
            {
                this.m_constructionTimer.Destruct();
                this.m_constructionTimer = null;
            }

            LogicJSONNumber constTimeObject = jsonObject.GetJSONNumber("const_t");

            if (constTimeObject != null)
            {
                int constTime = constTimeObject.GetIntValue();

                if (!LogicDataTables.GetGlobals().ClampBuildingTimes())
                {
                    if (this.m_upgLevel < this.GetVillageObjectData().GetUpgradeLevelCount() - 1)
                    {
                        constTime = LogicMath.Min(constTime, this.GetVillageObjectData().GetBuildTime(this.m_upgLevel + 1));
                    }
                }

                this.m_constructionTimer = new LogicTimer();
                this.m_constructionTimer.StartTimer(constTime, this.m_level.GetLogicTime(), false, -1);

                LogicJSONNumber constTimeEndObject = jsonObject.GetJSONNumber("const_t_end");

                if (constTimeEndObject != null)
                {
                    this.m_constructionTimer.SetEndTimestamp(constTimeEndObject.GetIntValue());
                }

                LogicJSONNumber conffObject = jsonObject.GetJSONNumber("con_ff");

                if (conffObject != null)
                {
                    this.m_constructionTimer.SetFastForward(conffObject.GetIntValue());
                }

                LogicVillageObjectData villageObjectData = this.GetVillageObjectData();

                if (villageObjectData.IsRequiresBuilder() && !villageObjectData.IsAutomaticUpgrades())
                {
                    this.m_level.GetWorkerManagerAt(this.m_villageType).AllocateWorker(this);
                }

                this.m_upgrading = this.m_upgLevel != -1;
            }

            this.m_upgLevel = LogicMath.Clamp(this.m_upgLevel, 0, this.GetVillageObjectData().GetUpgradeLevelCount() - 1);

            base.Load(jsonObject);

            this.SetPositionXY((this.GetVillageObjectData().GetTileX100() << 9) / 100,
                               (this.GetVillageObjectData().GetTileY100() << 9) / 100);
        }
Example #24
0
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONObject baseObject = jsonObject.GetJSONObject("base");

            if (baseObject == null)
            {
                Debugger.Error("AllianceInvitationAvatarStreamEntry::load base is NULL");
            }

            base.Load(baseObject);

            this.m_titleTID       = jsonObject.GetJSONString("title").GetStringValue();
            this.m_descriptionTID = jsonObject.GetJSONString("description").GetStringValue();

            LogicJSONString buttonString = jsonObject.GetJSONString("button");

            if (buttonString != null)
            {
                this.m_buttonTID = buttonString.GetStringValue();
            }

            LogicJSONString helpshiftUrlString = jsonObject.GetJSONString("helpshift_url");

            if (helpshiftUrlString != null)
            {
                this.m_helpshiftLink = helpshiftUrlString.GetStringValue();
            }

            LogicJSONString urlString = jsonObject.GetJSONString("url");

            if (urlString != null)
            {
                this.m_urlLink = urlString.GetStringValue();
            }

            LogicJSONNumber diamondsNumber = jsonObject.GetJSONNumber("diamonds");

            if (diamondsNumber != null)
            {
                this.m_diamondCount = diamondsNumber.GetIntValue();
            }

            LogicJSONBoolean supportMessageBoolean = jsonObject.GetJSONBoolean("support_msg");

            if (supportMessageBoolean != null)
            {
                this.m_supportMessage = supportMessageBoolean.IsTrue();
            }

            LogicJSONBoolean claimedBoolean = jsonObject.GetJSONBoolean("claimed");

            if (claimedBoolean != null)
            {
                this.m_claimed = claimedBoolean.IsTrue();
            }
        }
Example #25
0
        public void LoadUpgradeLevel(LogicJSONObject jsonObject)
        {
            LogicJSONNumber lvlObject = jsonObject.GetJSONNumber("lvl");

            if (lvlObject != null)
            {
                this.m_upgLevel = lvlObject.GetIntValue();
                int maxLvl = this.GetVillageObjectData().GetUpgradeLevelCount();

                if (this.m_upgLevel >= maxLvl)
                {
                    Debugger.Warning(string.Format("LogicVillageObject::load() - Loaded upgrade level {0} is over max! (max = {1}) id {2} data id {3}",
                                                   lvlObject.GetIntValue(),
                                                   maxLvl,
                                                   this.m_globalId,
                                                   this.m_data.GetGlobalID()));
                    this.m_upgLevel = maxLvl - 1;
                }
                else
                {
                    if (this.m_upgLevel < -1)
                    {
                        Debugger.Error("LogicVillageObject::load() - Loaded an illegal upgrade level!");
                    }
                }
            }
            else
            {
                Debugger.Error("LogicVillageObject::load - Upgrade level was not found!");
            }

            if (this.GetVillageObjectData().IsRequiresBuilder())
            {
                this.m_level.GetWorkerManagerAt(this.m_villageType).DeallocateWorker(this);
            }

            LogicJSONBoolean lockedObject = jsonObject.GetJSONBoolean("locked");

            if (lockedObject != null)
            {
                this.m_locked = lockedObject.IsTrue();
            }
        }
Example #26
0
        /// <summary>
        ///     Gets the specified json number.
        /// </summary>
        public static int GetJSONNumber(LogicJSONObject jsonObject, string key)
        {
            LogicJSONNumber jsonNumber = jsonObject.GetJSONNumber(key);

            if (jsonNumber != null)
            {
                return(jsonNumber.GetIntValue());
            }

            return(0);
        }
        public void LoadPosition(LogicJSONObject jsonObject)
        {
            LogicJSONNumber xNumber = jsonObject.GetJSONNumber("x");
            LogicJSONNumber yNumber = jsonObject.GetJSONNumber("y");

            if (xNumber == null || yNumber == null)
            {
                Debugger.Error("LogicGameObject::load - x or y is NULL!");
            }

            this.SetInitialPosition(xNumber.GetIntValue() << 9, yNumber.GetIntValue() << 9);
        }
Example #28
0
        public override void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber resourceTimeObject = jsonObject.GetJSONNumber("res_time");
            int             time = this.m_productionPer100Hour > 0 ? (int)(360000L * this.m_maxResources / this.m_productionPer100Hour) : 0;

            if (resourceTimeObject != null)
            {
                time = LogicMath.Min(resourceTimeObject.GetIntValue(), time);
            }

            this.m_resourceTimer.StartTimer(time, this.m_parent.GetLevel().GetLogicTime(), false, -1);
        }
Example #29
0
        public virtual void LoadFromJSON(LogicJSONObject jsonRoot)
        {
            LogicJSONNumber tickNumber = jsonRoot.GetJSONNumber("t");

            if (tickNumber != null)
            {
                this.m_executeSubTick = tickNumber.GetIntValue();
            }
            else
            {
                Debugger.Error("Replay - Load command from JSON failed! Execute sub tick was not found!");
            }
        }
Example #30
0
        public override void Load(LogicJSONObject root)
        {
            if (this.m_timer != null)
            {
                this.m_timer.Destruct();
                this.m_timer = null;
            }

            this.m_unit = null;

            LogicJSONObject jsonObject = root.GetJSONObject("unit_upg");

            if (jsonObject != null)
            {
                LogicJSONNumber unitTypeObject         = jsonObject.GetJSONNumber("unit_type");
                LogicJSONNumber idObject               = jsonObject.GetJSONNumber("id");
                LogicJSONNumber timerObject            = jsonObject.GetJSONNumber("t");
                LogicJSONNumber timerEndObject         = jsonObject.GetJSONNumber("t_end");
                LogicJSONNumber timerFastForwardObject = jsonObject.GetJSONNumber("t_ff");

                this.m_unitType = unitTypeObject != null?unitTypeObject.GetIntValue() : 0;

                if (idObject != null)
                {
                    if (timerObject != null)
                    {
                        LogicData data = LogicDataTables.GetDataById(idObject.GetIntValue(), this.m_unitType == 0 ? LogicDataType.CHARACTER : LogicDataType.SPELL);

                        if (data != null)
                        {
                            this.m_unit = (LogicCombatItemData)data;

                            this.m_timer = new LogicTimer();
                            this.m_timer.StartTimer(timerObject.GetIntValue(), this.m_parent.GetLevel().GetLogicTime(), false, -1);

                            if (timerEndObject != null)
                            {
                                this.m_timer.SetEndTimestamp(timerEndObject.GetIntValue());
                            }

                            if (timerFastForwardObject != null)
                            {
                                this.m_timer.SetFastForward(timerFastForwardObject.GetIntValue());
                            }
                        }
                    }
                }
            }
        }