public override void Serialize(GenericWriter writer) { #region Factions if (m_FactionState != null && m_FactionState.HasExpired) { m_FactionState.Detach(); } #endregion base.Serialize(writer); writer.Write((int)4); // version writer.WriteEncodedInt((int)m_MaxHitPoints); writer.WriteEncodedInt((int)m_HitPoints); writer.WriteEncodedInt((int)m_Resource); writer.WriteEncodedInt((int)m_GemType); }
private static void FactionReset() { List <Faction> factions = Faction.Factions; for (int i = 0; i < factions.Count; ++i) { Faction f = factions[i]; List <PlayerState> memberlist = new List <PlayerState>(f.Members); for (int j = 0; j < memberlist.Count; ++j) { f.RemoveMember(memberlist[j].Mobile); } List <FactionItem> itemlist = new List <FactionItem>(f.State.FactionItems); for (int j = 0; j < itemlist.Count; ++j) { FactionItem fi = itemlist[j]; if (fi.Expiration == DateTime.MinValue) { fi.Item.Delete(); } else { fi.Detach(); } } List <BaseFactionTrap> traplist = new List <BaseFactionTrap>(f.Traps); for (int j = 0; j < traplist.Count; ++j) { traplist[i].Delete(); } } }
public override void Serialize(GenericWriter writer) { #region Ethics if (m_EthicState != null && m_EthicState.HasExpired) { m_EthicState.Detach(); } #endregion #region Factions if (m_FactionState != null && m_FactionState.HasExpired) { m_FactionState.Detach(); } #endregion base.Serialize(writer); writer.Write(0); // version SaveFlag flags = SaveFlag.None; SetSaveFlag(ref flags, SaveFlag.Attributes, !m_Attributes.IsEmpty); SetSaveFlag(ref flags, SaveFlag.LowerAmmoCost, m_LowerAmmoCost != 0); SetSaveFlag(ref flags, SaveFlag.WeightReduction, m_WeightReduction != 0); SetSaveFlag(ref flags, SaveFlag.DamageIncrease, m_DamageIncrease != 0); SetSaveFlag(ref flags, SaveFlag.Crafter, m_Crafter != null); SetSaveFlag(ref flags, SaveFlag.Quality, true); SetSaveFlag(ref flags, SaveFlag.Capacity, m_Capacity > 0); writer.WriteEncodedInt((int)flags); if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_Attributes.Serialize(writer); } if (GetSaveFlag(flags, SaveFlag.LowerAmmoCost)) { writer.Write((int)m_LowerAmmoCost); } if (GetSaveFlag(flags, SaveFlag.WeightReduction)) { writer.Write((int)m_WeightReduction); } if (GetSaveFlag(flags, SaveFlag.DamageIncrease)) { writer.Write((int)m_DamageIncrease); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { writer.Write((Mobile)m_Crafter); } if (GetSaveFlag(flags, SaveFlag.Quality)) { writer.Write((int)m_Quality); } if (GetSaveFlag(flags, SaveFlag.Capacity)) { writer.Write((int)m_Capacity); } }
public override void Serialize(GenericWriter writer) { #region Ethics if (m_EthicState != null && m_EthicState.HasExpired) { m_EthicState.Detach(); } #endregion #region Factions if (m_FactionState != null && m_FactionState.HasExpired) { m_FactionState.Detach(); } #endregion base.Serialize(writer); writer.Write((int)5); // version SaveFlag flags = SaveFlag.None; SetSaveFlag(ref flags, SaveFlag.Resource, m_Resource != DefaultResource); SetSaveFlag(ref flags, SaveFlag.Attributes, !m_AosAttributes.IsEmpty); SetSaveFlag(ref flags, SaveFlag.ClothingAttributes, !m_AosClothingAttributes.IsEmpty); SetSaveFlag(ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty); SetSaveFlag(ref flags, SaveFlag.Resistances, !m_AosResistances.IsEmpty); SetSaveFlag(ref flags, SaveFlag.MaxHitPoints, m_MaxHitPoints != 0); SetSaveFlag(ref flags, SaveFlag.HitPoints, m_HitPoints != 0); SetSaveFlag(ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false); SetSaveFlag(ref flags, SaveFlag.Crafter, m_Crafter != null); SetSaveFlag(ref flags, SaveFlag.Quality, m_Quality != ClothingQuality.Regular); SetSaveFlag(ref flags, SaveFlag.StrReq, m_StrReq != -1); SetSaveFlag(ref flags, SaveFlag.Identified, m_Identified != false); writer.WriteEncodedInt((int)flags); if (GetSaveFlag(flags, SaveFlag.Resource)) { writer.WriteEncodedInt((int)m_Resource); } if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_AosAttributes.Serialize(writer); } if (GetSaveFlag(flags, SaveFlag.ClothingAttributes)) { m_AosClothingAttributes.Serialize(writer); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses.Serialize(writer); } if (GetSaveFlag(flags, SaveFlag.Resistances)) { m_AosResistances.Serialize(writer); } if (GetSaveFlag(flags, SaveFlag.MaxHitPoints)) { writer.WriteEncodedInt((int)m_MaxHitPoints); } if (GetSaveFlag(flags, SaveFlag.HitPoints)) { writer.WriteEncodedInt((int)m_HitPoints); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { writer.Write((Mobile)m_Crafter); } if (GetSaveFlag(flags, SaveFlag.Quality)) { writer.WriteEncodedInt((int)m_Quality); } if (GetSaveFlag(flags, SaveFlag.StrReq)) { writer.WriteEncodedInt((int)m_StrReq); } }