public PlayerMobile() { m_AutoStabled = new List<Mobile>(); m_VisList = new List<Mobile>(); m_PermaFlags = new List<Mobile>(); m_AntiMacroTable = new Hashtable(); m_RecentlyReported = new List<Mobile>(); m_BOBFilter = new Engines.BulkOrders.BOBFilter(); m_GameTime = TimeSpan.Zero; m_ShortTermElapse = TimeSpan.FromHours(8.0); m_LongTermElapse = TimeSpan.FromHours(40.0); m_JusticeProtectors = new List<Mobile>(); m_GuildRank = Guilds.RankDefinition.Lowest; m_ChampionTitles = new ChampionTitleInfo(); InvalidateMyRunUO(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 29: { if (reader.ReadBool()) { m_StuckMenuUses = new DateTime[reader.ReadInt()]; for (int i = 0; i < m_StuckMenuUses.Length; ++i) { m_StuckMenuUses[i] = reader.ReadDateTime(); } } else { m_StuckMenuUses = null; } goto case 28; } case 28: { m_PeacedUntil = reader.ReadDateTime(); goto case 27; } case 27: { m_AnkhNextUse = reader.ReadDateTime(); goto case 26; } case 26: { m_AutoStabled = reader.ReadStrongMobileList(); goto case 25; } case 25: { int recipeCount = reader.ReadInt(); if (recipeCount > 0) { m_AcquiredRecipes = new Dictionary<int, bool>(); for (int i = 0; i < recipeCount; i++) { int r = reader.ReadInt(); if (reader.ReadBool()) //Don't add in recipies which we haven't gotten or have been removed m_AcquiredRecipes.Add(r, true); } } goto case 24; } case 24: { m_LastHonorLoss = reader.ReadDeltaTime(); goto case 23; } case 23: { m_ChampionTitles = new ChampionTitleInfo(reader); goto case 22; } case 22: { m_LastValorLoss = reader.ReadDateTime(); goto case 21; } case 21: { m_ToTItemsTurnedIn = reader.ReadEncodedInt(); m_ToTTotalMonsterFame = reader.ReadInt(); goto case 20; } case 20: { m_AllianceMessageHue = reader.ReadEncodedInt(); m_GuildMessageHue = reader.ReadEncodedInt(); goto case 19; } case 19: { int rank = reader.ReadEncodedInt(); int maxRank = Guilds.RankDefinition.Ranks.Length - 1; if (rank > maxRank) rank = maxRank; m_GuildRank = Guilds.RankDefinition.Ranks[rank]; m_LastOnline = reader.ReadDateTime(); goto case 18; } case 18: { m_SolenFriendship = (SolenFriendship)reader.ReadEncodedInt(); goto case 17; } case 17: // changed how DoneQuests is serialized case 16: { m_Quest = QuestSerializer.DeserializeQuest(reader); if (m_Quest != null) m_Quest.From = this; int count = reader.ReadEncodedInt(); if (count > 0) { m_DoneQuests = new List<QuestRestartInfo>(); for (int i = 0; i < count; ++i) { Type questType = QuestSerializer.ReadType(QuestSystem.QuestTypes, reader); DateTime restartTime; if (version < 17) restartTime = DateTime.MaxValue; else restartTime = reader.ReadDateTime(); m_DoneQuests.Add(new QuestRestartInfo(questType, restartTime)); } } m_Profession = reader.ReadEncodedInt(); goto case 15; } case 15: { m_LastCompassionLoss = reader.ReadDeltaTime(); goto case 14; } case 14: { m_CompassionGains = reader.ReadEncodedInt(); if (m_CompassionGains > 0) m_NextCompassionDay = reader.ReadDeltaTime(); goto case 13; } case 13: // just removed m_PayedInsurance list case 12: { m_BOBFilter = new Engines.BulkOrders.BOBFilter(reader); goto case 11; } case 11: { if (version < 13) { List<Item> payed = reader.ReadStrongItemList(); for (int i = 0; i < payed.Count; ++i) payed[i].PayedInsurance = true; } goto case 10; } case 10: { if (reader.ReadBool()) { m_HairModID = reader.ReadInt(); m_HairModHue = reader.ReadInt(); m_BeardModID = reader.ReadInt(); m_BeardModHue = reader.ReadInt(); } goto case 9; } case 9: { SavagePaintExpiration = reader.ReadTimeSpan(); if (SavagePaintExpiration > TimeSpan.Zero) { BodyMod = (Female ? 184 : 183); HueMod = 0; } goto case 8; } case 8: { m_NpcGuild = (NpcGuild)reader.ReadInt(); m_NpcGuildJoinTime = reader.ReadDateTime(); m_NpcGuildGameTime = reader.ReadTimeSpan(); goto case 7; } case 7: { m_PermaFlags = reader.ReadStrongMobileList(); goto case 6; } case 6: { NextTailorBulkOrder = reader.ReadTimeSpan(); goto case 5; } case 5: { NextSmithBulkOrder = reader.ReadTimeSpan(); goto case 4; } case 4: { m_LastJusticeLoss = reader.ReadDeltaTime(); m_JusticeProtectors = reader.ReadStrongMobileList(); goto case 3; } case 3: { m_LastSacrificeGain = reader.ReadDeltaTime(); m_LastSacrificeLoss = reader.ReadDeltaTime(); m_AvailableResurrects = reader.ReadInt(); goto case 2; } case 2: { m_Flags = (PlayerFlag)reader.ReadInt(); goto case 1; } case 1: { m_LongTermElapse = reader.ReadTimeSpan(); m_ShortTermElapse = reader.ReadTimeSpan(); m_GameTime = reader.ReadTimeSpan(); goto case 0; } case 0: { if (version < 26) m_AutoStabled = new List<Mobile>(); break; } } if (m_RecentlyReported == null) m_RecentlyReported = new List<Mobile>(); // Professions weren't verified on 1.0 RC0 if (!CharacterCreation.VerifyProfession(m_Profession)) m_Profession = 0; if (m_PermaFlags == null) m_PermaFlags = new List<Mobile>(); if (m_JusticeProtectors == null) m_JusticeProtectors = new List<Mobile>(); if (m_BOBFilter == null) m_BOBFilter = new Engines.BulkOrders.BOBFilter(); if (m_GuildRank == null) m_GuildRank = Guilds.RankDefinition.Member; //Default to member if going from older version to new version (only time it should be null) if (m_LastOnline == DateTime.MinValue && Account != null) m_LastOnline = ((Account)Account).LastLogin; if (m_ChampionTitles == null) m_ChampionTitles = new ChampionTitleInfo(); if (AccessLevel > AccessLevel.Player) m_IgnoreMobiles = true; List<Mobile> list = this.Stabled; for (int i = 0; i < list.Count; ++i) { BaseCreature bc = list[i] as BaseCreature; if (bc != null) { bc.IsStabled = true; bc.StabledBy = this; } } CheckAtrophies(this); if (Hidden) //Hiding is the only buff where it has an effect that's serialized. AddBuff(new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655)); }