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)); } } }