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 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"); }
public override void ReadFromJSON(LogicJSONObject jsonObject) { base.ReadFromJSON(jsonObject); this.m_resourceData = (LogicResourceData)LogicJSONHelper.GetLogicData(jsonObject, "resource"); this.m_resourceAmount = LogicJSONHelper.GetInt(jsonObject, "resourceAmount"); }
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"); }
public override void ReadFromJSON(LogicJSONObject jsonObject) { base.ReadFromJSON(jsonObject); this.m_scaledResourceData = (LogicResourceData)LogicJSONHelper.GetLogicData(jsonObject, "scaledResource"); this.m_scaledResourceMultiplier = LogicJSONHelper.GetInt(jsonObject, "scaledResourceMultiplier"); }
public override void ReadFromJSON(LogicJSONObject jsonObject) { base.ReadFromJSON(jsonObject); this.m_buildingData = (LogicBuildingData)LogicJSONHelper.GetLogicData(jsonObject, "building"); this.m_buildingCount = LogicJSONHelper.GetInt(jsonObject, "buildingNumber"); this.m_buildingLevel = LogicJSONHelper.GetInt(jsonObject, "buildingLevel"); }
public void Load(LogicJSONObject jsonObject) { Debugger.DoAssert(jsonObject != null, "Unable to load targeting"); this.m_minTownHallLevel = LogicJSONHelper.GetInt(jsonObject, "minTownHallLevel") & 0x7FFFFFFF; this.m_maxTownHallLevel = LogicJSONHelper.GetInt(jsonObject, "maxTownHallLevel") & 0x7FFFFFFF; this.m_minGemsLevel = LogicJSONHelper.GetInt(jsonObject, "minGemsPurchased") & 0x7FFFFFFF; this.m_maxGemsLevel = LogicJSONHelper.GetInt(jsonObject, "maxGemsPurchased") & 0x7FFFFFFF; }
public override void Load(LogicJSONObject jsonObject) { base.Load(jsonObject); this.m_duelLootLimitCooldownInMinutes = LogicJSONHelper.GetInt(jsonObject, "lootLimitCooldownInMinutes", 1320); this.m_duelBonusPercentWin = LogicJSONHelper.GetInt(jsonObject, "duelBonusPercentWin", 100); this.m_duelBonusPercentLose = LogicJSONHelper.GetInt(jsonObject, "duelBonusPercentLose", 0); this.m_duelBonusPercentDraw = LogicJSONHelper.GetInt(jsonObject, "duelBonusPercentDraw", 0); this.m_duelBonusMaxDiamondCostPercent = LogicJSONHelper.GetInt(jsonObject, "duelBonusMaxDiamondCostPercent", 100); }
public void ReadFromJSON(LogicJSONObject jsonObject) { LogicJSONNumber id = jsonObject.GetJSONNumber("id"); if (id != null && id.GetIntValue() != 0) { this.m_data = LogicDataTables.GetDataById(id.GetIntValue()); } this.m_count = LogicJSONHelper.GetInt(jsonObject, "cnt"); }
public void ReadFromJSON(LogicJSONObject jsonObject) { this.m_bestSeasonState = LogicJSONHelper.GetInt(jsonObject, "best_season_state"); this.m_bestSeasonYear = LogicJSONHelper.GetInt(jsonObject, "best_season_year"); this.m_bestSeasonMonth = LogicJSONHelper.GetInt(jsonObject, "best_season_month"); this.m_bestSeasonRank = LogicJSONHelper.GetInt(jsonObject, "best_season_rank"); this.m_bestSeasonScore = LogicJSONHelper.GetInt(jsonObject, "best_season_score"); this.m_lastSeasonState = LogicJSONHelper.GetInt(jsonObject, "last_season_state"); this.m_lastSeasonYear = LogicJSONHelper.GetInt(jsonObject, "last_season_year"); this.m_lastSeasonMonth = LogicJSONHelper.GetInt(jsonObject, "last_season_month"); this.m_lastSeasonRank = LogicJSONHelper.GetInt(jsonObject, "last_season_rank"); this.m_lastSeasonScore = LogicJSONHelper.GetInt(jsonObject, "last_season_score"); }
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_castleLevel = LogicJSONHelper.GetInt(jsonObject, "castle_level"); this.m_castleUsedCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_used"); this.m_castleUsedSpellCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_sp_used"); this.m_castleTotalCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_total"); this.m_castleTotalSpellCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_sp_total"); LogicJSONString messageObject = jsonObject.GetJSONString("message"); if (messageObject != null) { this.m_message = messageObject.GetStringValue(); } LogicJSONArray donationArray = jsonObject.GetJSONArray("donators"); if (donationArray != null) { for (int i = 0; i < donationArray.Size(); i++) { DonationContainer donationContainer = new DonationContainer(); donationContainer.Load(donationArray.GetJSONObject(i)); this.m_donationContainerList.Add(donationContainer); } } LogicJSONArray unitArray = jsonObject.GetJSONArray("units"); if (unitArray != null) { this.m_unitCount = new LogicArrayList <LogicUnitSlot>(); for (int i = 0; i < unitArray.Size(); i++) { LogicUnitSlot unitSlot = new LogicUnitSlot(null, -1, 0); unitSlot.ReadFromJSON(unitArray.GetJSONObject(i)); this.m_unitCount.Add(unitSlot); } } }
public void Load(LogicJSONObject jsonObject) { this.m_json = jsonObject; if (jsonObject != null) { LogicJSONObject village1Object = jsonObject.GetJSONObject("Village1"); Debugger.DoAssert(village1Object != null, "pVillage1 = NULL!"); LogicJSONString specialObstacleObject = village1Object.GetJSONString("SpecialObstacle"); if (specialObstacleObject != null) { this.m_specialObstacle = LogicDataTables.GetObstacleByName(specialObstacleObject.GetStringValue(), null); } LogicJSONObject village2Object = jsonObject.GetJSONObject("Village2"); Debugger.DoAssert(village2Object != null, "pVillage2 = NULL!"); this.m_maxTownHallLevel = LogicJSONHelper.GetInt(village2Object, "TownHallMaxLevel"); LogicJSONArray scoreChangeForLosingArray = village2Object.GetJSONArray("ScoreChangeForLosing"); Debugger.DoAssert(scoreChangeForLosingArray != null, "ScoreChangeForLosing array is null"); this.m_milestoneScoreChangeForLosing = new LogicArrayList <int>(scoreChangeForLosingArray.Size()); this.m_percentageScoreChangeForLosing = new LogicArrayList <int>(scoreChangeForLosingArray.Size()); for (int i = 0; i < scoreChangeForLosingArray.Size(); i++) { LogicJSONObject obj = scoreChangeForLosingArray.GetJSONObject(i); if (obj != null) { LogicJSONNumber milestoneObject = obj.GetJSONNumber("Milestone"); LogicJSONNumber percentageObject = obj.GetJSONNumber("Percentage"); if (milestoneObject != null && percentageObject != null) { this.m_milestoneScoreChangeForLosing.Add(milestoneObject.GetIntValue()); this.m_percentageScoreChangeForLosing.Add(percentageObject.GetIntValue()); } } } LogicJSONArray strengthRangeForScoreArray = village2Object.GetJSONArray("StrengthRangeForScore"); Debugger.DoAssert(strengthRangeForScoreArray != null, "StrengthRangeForScore array is null"); this.m_milestoneStrengthRangeForScore = new LogicArrayList <int>(strengthRangeForScoreArray.Size()); this.m_percentageStrengthRangeForScore = new LogicArrayList <int>(strengthRangeForScoreArray.Size()); for (int i = 0; i < strengthRangeForScoreArray.Size(); i++) { LogicJSONObject obj = strengthRangeForScoreArray.GetJSONObject(i); if (obj != null) { LogicJSONNumber milestoneObject = obj.GetJSONNumber("Milestone"); LogicJSONNumber percentageObject = obj.GetJSONNumber("Percentage"); if (milestoneObject != null && percentageObject != null) { this.m_milestoneStrengthRangeForScore.Add(milestoneObject.GetIntValue()); this.m_percentageStrengthRangeForScore.Add(percentageObject.GetIntValue()); } } } LogicJSONObject killSwitchesObject = jsonObject.GetJSONObject("KillSwitches"); Debugger.DoAssert(killSwitchesObject != null, "pKillSwitches = NULL!"); this.m_battleWaitForProjectileDestruction = LogicJSONHelper.GetBool(killSwitchesObject, "BattleWaitForProjectileDestruction"); this.m_battleWaitForDieDamage = LogicJSONHelper.GetBool(killSwitchesObject, "BattleWaitForDieDamage"); LogicJSONObject globalsObject = jsonObject.GetJSONObject("Globals"); Debugger.DoAssert(globalsObject != null, "pGlobals = NULL!"); this.m_giftPackExtension = LogicJSONHelper.GetString(globalsObject, "GiftPackExtension"); this.m_duelLootLimitCooldownInMinutes = LogicJSONHelper.GetInt(globalsObject, "DuelLootLimitCooldownInMinutes"); this.m_duelBonusLimitWinsPerDay = LogicJSONHelper.GetInt(globalsObject, "DuelBonusLimitWinsPerDay"); this.m_duelBonusPercentWin = LogicJSONHelper.GetInt(globalsObject, "DuelBonusPercentWin"); this.m_duelBonusPercentLose = LogicJSONHelper.GetInt(globalsObject, "DuelBonusPercentLose"); this.m_duelBonusPercentDraw = LogicJSONHelper.GetInt(globalsObject, "DuelBonusPercentDraw"); this.m_duelBonusMaxDiamondCostPercent = LogicJSONHelper.GetInt(globalsObject, "DuelBonusMaxDiamondCostPercent"); } else { Debugger.Error("pConfiguration = NULL!"); } }
public void Load(LogicJSONObject jsonObject) { this.m_payCount = LogicJSONHelper.GetInt(jsonObject, "pc", 0); }
public override void ReadFromJSON(LogicJSONObject jsonObject) { base.ReadFromJSON(jsonObject); this.m_giftLimit = LogicJSONHelper.GetInt(jsonObject, "giftLimit"); }
public void Load(LogicJSONObject root) { LogicJSONObject jsonObject = root.GetJSONObject("offer"); if (jsonObject != null) { this.m_offerObject = jsonObject; if (this.m_timer != null) { this.m_timer.Destruct(); this.m_timer = null; } this.m_timer = LogicTimer.GetLogicTimer(jsonObject, this.m_level.GetLogicTime(), "pct", 604800); if (jsonObject.Get("t") != null) { this.m_terminate = true; } LogicJSONArray offerArray = jsonObject.GetJSONArray("offers"); if (offerArray != null) { for (int i = 0; i < offerArray.Size(); i++) { LogicJSONObject obj = (LogicJSONObject)offerArray.Get(i); if (obj != null) { int data = LogicJSONHelper.GetInt(obj, "data", -1); if (data != -1) { LogicOffer offer = this.GetOfferById(data); if (offer != null) { offer.Load(obj); } } } else { Debugger.Error("LogicOfferManager::load - Offer is NULL!"); } } } for (int i = 0; i < 2; i++) { LogicJSONNumber number = (LogicJSONNumber)jsonObject.Get(i == 1 ? "top2" : "top"); if (number != null) { this.m_topOffer[i] = this.GetOfferById(number.GetIntValue()); } } } }
public void Save(LogicJSONObject root) { if (this.m_offerObject != null && this.m_level.GetState() != 1) { root.Put("offer", this.m_offerObject); } else { LogicJSONObject jsonObject = new LogicJSONObject(); LogicTimer.SetLogicTimer(jsonObject, this.m_timer, this.m_level, "pct"); if (this.m_terminate) { jsonObject.Put("t", new LogicJSONBoolean(true)); } LogicJSONArray offerArray = new LogicJSONArray(); for (int i = 0; i < this.m_offers.Size(); i++) { LogicJSONObject obj = this.m_offers[i].Save(); if (obj != null) { offerArray.Add(obj); } } if (this.m_offerObject != null) { LogicJSONArray oldArray = this.m_offerObject.GetJSONArray("offers"); if (oldArray != null) { for (int i = 0; i < oldArray.Size(); i++) { LogicJSONObject obj = (LogicJSONObject)oldArray.Get(i); if (obj != null) { int data = LogicJSONHelper.GetInt(jsonObject, "data", -1); if (this.GetOfferById(data) == null) { offerArray.Add(obj); } } } } } root.Put("offers", offerArray); for (int i = 0; i < 2; i++) { if (this.m_topOffer[i] != null) { root.Put(i == 1 ? "top2" : "top", new LogicJSONNumber(this.m_topOffer[i].GetData().GetId())); } } root.Put("offer", jsonObject); } }
public virtual void Load(LogicJSONObject jsonObject) { if (jsonObject == null) { this.m_errorHandler.Error(this, "Json cannot be null"); } this.m_id = LogicJSONHelper.GetInt(jsonObject, "id", -1); this.m_version = LogicJSONHelper.GetInt(jsonObject, "version", 0); this.m_newTrainingBoostBarracksCost = LogicDataTables.GetGlobals().GetNewTrainingBoostBarracksCost(); this.m_newTrainingBoostSpellCost = LogicDataTables.GetGlobals().GetNewTrainingBoostLaboratoryCost(); this.m_startTime = LogicCalendarEvent.ConvertStringToTimestamp(LogicJSONHelper.GetString(jsonObject, "startTime"), false); this.m_endTime = LogicCalendarEvent.ConvertStringToTimestamp(LogicJSONHelper.GetString(jsonObject, "endTime"), true); if (this.m_startTime >= this.m_endTime) { this.m_errorHandler.ErrorField(this, "endTime", "End time must be after start time."); } LogicJSONString visibleTimeString = jsonObject.GetJSONString("visibleTime"); if (visibleTimeString != null) { this.m_visibleTime = LogicCalendarEvent.ConvertStringToTimestamp(visibleTimeString.GetStringValue(), false); if (this.m_visibleTime > this.m_startTime) { this.m_errorHandler.ErrorField(this, "visibleTime", "Visible time must be before or at start time."); } } else { this.m_visibleTime = 0; } this.m_clashBoxEntryName = jsonObject.GetJSONString("clashBoxEntryName").GetStringValue(); LogicJSONString eventEntryNameString = jsonObject.GetJSONString("eventEntryName"); this.m_eventEntryData = LogicDataTables.GetEventEntryByName(eventEntryNameString.GetStringValue(), null); if (eventEntryNameString.GetStringValue().Length > 0) { if (this.m_eventEntryData == null) { this.m_errorHandler.ErrorField(this, "eventEntryName", string.Format("Invalid event entry name: {0}.", eventEntryNameString.GetStringValue())); } if (this.m_visibleTime == 0) { this.m_errorHandler.ErrorField(this, "visibleTime", "Visible time must be set if event entry name is set."); } } if (this.m_visibleTime != 0) { if (this.m_eventEntryData == null) { this.m_errorHandler.ErrorField(this, "eventEntryName", "Event entry name must be set if visible time is set."); } } this.m_inboxEntryId = LogicJSONHelper.GetInt(jsonObject, "inboxEntryId", -1); this.m_notificationTid = LogicJSONHelper.GetString(jsonObject, "notificationTid"); this.m_image = LogicJSONHelper.GetString(jsonObject, "image"); this.m_sc = LogicJSONHelper.GetString(jsonObject, "sc"); this.m_localization = LogicJSONHelper.GetString(jsonObject, "localization"); LogicJSONObject targetingObject = jsonObject.GetJSONObject("targeting"); if (targetingObject != null) { this.m_targeting = new LogicCalendarTargeting(jsonObject); } LogicJSONArray functionArray = jsonObject.GetJSONArray("functions"); if (functionArray != null) { for (int i = 0; i < functionArray.Size(); i++) { this.m_functions.Add(new LogicCalendarFunction(this, i, functionArray.GetJSONObject(i), this.m_errorHandler)); } } }
public override void ReadFromJSON(LogicJSONObject jsonObject) { base.ReadFromJSON(jsonObject); this.m_id = LogicJSONHelper.GetInt(jsonObject, "id"); }