public override void Serialize(GenericWriter writer) { if (LastFealty + TimeSpan.FromDays(1.0) < DateTime.UtcNow) { CalculateGuildmaster(); } CheckExpiredWars(); if (Alliance != null) { Alliance.CheckLeader(); } writer.Write(5); //version #region War Serialization writer.Write(m_PendingWars.Count); for (int i = 0; i < m_PendingWars.Count; i++) { m_PendingWars[i].Serialize(writer); } writer.Write(m_AcceptedWars.Count); for (int i = 0; i < m_AcceptedWars.Count; i++) { m_AcceptedWars[i].Serialize(writer); } #endregion #region Alliances bool isAllianceLeader = (m_AllianceLeader == null && m_AllianceInfo != null); writer.Write(isAllianceLeader); if (isAllianceLeader) { m_AllianceInfo.Serialize(writer); } else { writer.Write(m_AllianceLeader); } #endregion // writer.WriteGuildList(m_AllyDeclarations, true); writer.WriteGuildList(m_AllyInvitations, true); writer.Write(m_TypeLastChange); writer.Write((int)m_Type); writer.Write(m_LastFealty); writer.Write(m_Leader); writer.Write(m_Name); writer.Write(m_Abbreviation); writer.WriteGuildList(m_Allies, true); writer.WriteGuildList(m_Enemies, true); writer.WriteGuildList(m_WarDeclarations, true); writer.WriteGuildList(m_WarInvitations, true); writer.Write(m_Members, true); writer.Write(m_Candidates, true); writer.Write(m_Accepted, true); writer.Write(m_Guildstone); writer.Write(m_Teleporter); writer.Write(m_Charter); writer.Write(m_Website); }
public override void Serialize(IGenericWriter writer) { if (LastFealty + TimeSpan.FromDays(1.0) < DateTime.UtcNow) { CalculateGuildmaster(); } CheckExpiredWars(); Alliance?.CheckLeader(); writer.Write(5); // version writer.Write(PendingWars.Count); for (int i = 0; i < PendingWars.Count; i++) { PendingWars[i].Serialize(writer); } writer.Write(AcceptedWars.Count); for (int i = 0; i < AcceptedWars.Count; i++) { AcceptedWars[i].Serialize(writer); } bool isAllianceLeader = m_AllianceLeader == null && m_AllianceInfo != null; writer.Write(isAllianceLeader); if (isAllianceLeader) { m_AllianceInfo.Serialize(writer); } else { writer.Write(m_AllianceLeader); } // writer.WriteGuildList(AllyDeclarations, true); writer.WriteGuildList(AllyInvitations, true); writer.Write(TypeLastChange); writer.Write((int)m_Type); writer.Write(LastFealty); writer.Write(m_Leader); writer.Write(m_Name); writer.Write(m_Abbreviation); writer.WriteGuildList(Allies, true); writer.WriteGuildList(Enemies, true); writer.WriteGuildList(WarDeclarations, true); writer.WriteGuildList(WarInvitations, true); writer.Write(Members, true); writer.Write(Candidates, true); writer.Write(Accepted, true); writer.Write(Guildstone); writer.Write(Teleporter); writer.Write(Charter); writer.Write(Website); }