public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);
			int version = reader.ReadInt();

			switch (version)
			{
                case 29:
					{
						m_GauntletPoints = reader.ReadDouble();

						m_SSNextSeed = reader.ReadDateTime();
						m_SSSeedExpire = reader.ReadDateTime();
						m_SSSeedLocation = reader.ReadPoint3D();
						m_SSSeedMap = reader.ReadMap();

						m_LevelExp = reader.ReadLong();
						m_Exp = reader.ReadLong();
						m_Level = reader.ReadInt();
						m_ExpTitle = reader.ReadString();

						m_VASTotalMonsterFame = reader.ReadInt();

						m_Quests = QuestReader.Quests(reader, this);
						m_Chains = QuestReader.Chains(reader);

						m_Collections = new Dictionary<Collection, int>();
						m_CollectionTitles = new List<object>();

						for (int i = reader.ReadInt(); i > 0; i--)
						{
							m_Collections.Add((Collection)reader.ReadInt(), reader.ReadInt());
						}

						for (int i = reader.ReadInt(); i > 0; i--)
						{
							m_CollectionTitles.Add(QuestReader.Object(reader));
						}

						m_SelectedTitle = reader.ReadInt();

						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 = RankDefinition.Ranks.Length - 1;
						if (rank > maxRank)
						{
							rank = maxRank;
						}

						m_GuildRank = 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 BOBFilter(reader);
						goto case 11;
					}
				case 11:
					{
						if (version < 13)
						{
							var 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 (version < 29)
			{
				m_SSNextSeed = m_SSSeedExpire = DateTime.UtcNow;
				m_SSSeedLocation = Point3D.Zero;
			}

			if (m_RecentlyReported == null)
			{
				m_RecentlyReported = new List<Mobile>();
			}

			#region QueensLoyaltySystem
			if (version < 29)
			{
				m_LevelExp = 2000;
				m_Exp = 0;
				m_Level = 0;

				m_ExpTitle = "Friend of TerMur";
			}
			#endregion

			#region Mondain's Legacy
			if (m_Quests == null)
			{
				m_Quests = new List<BaseQuest>();
			}

			if (m_Chains == null)
			{
				m_Chains = new Dictionary<QuestChain, BaseChain>();
			}

			if (m_DoneQuests == null)
			{
				m_DoneQuests = new List<QuestRestartInfo>();
			}

			if (m_Collections == null)
			{
				m_Collections = new Dictionary<Collection, int>();
			}

			if (m_CollectionTitles == null)
			{
				m_CollectionTitles = new List<object>();
			}
			#endregion

			// 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 BOBFilter();
			}

			if (m_GuildRank == null)
			{
				m_GuildRank = 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();
			}

			var list = 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));
			}
		}
Example #2
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			//46+ (This should ALWAYS come just after the version!)
			if (version >= 46)
			{
				DeserializeSnapshot(reader);
			}

			if (LostStabledPetRecorder.Enabled)
			{
				LostStabledPetRecorder.PlayerMobiles.Add(this);
			}

			switch (version)
			{
                case 51:
                    {
                        HalloweenPaintExpirationOrange = reader.ReadTimeSpan();

                        if (HalloweenPaintExpirationOrange > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 1358;
                        }

                        HalloweenPaintExpirationPurple = reader.ReadTimeSpan();

                        if (HalloweenPaintExpirationPurple > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 1378;
                        }
                    }
                    goto case 50;
                case 50:
                    {
                        ZombiePaintExperationBooger = reader.ReadTimeSpan();

                        if (ZombiePaintExperationBooger > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 61;
                        }

                        ZombiePaintExperationVesper = reader.ReadTimeSpan();

                        if (ZombiePaintExperationVesper > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 1159;
                        }
                    }
                    goto case 49;
                case 49:
                    {
                        BattlePaintExpirationShadow = reader.ReadTimeSpan();

                        if (BattlePaintExpirationShadow > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 1175;
                        }

                        BattlePaintExpirationRed = reader.ReadTimeSpan();

                        if (BattlePaintExpirationRed > TimeSpan.Zero)
                        {
                            BodyMod = (Female ? 184 : 183);
                            HueMod = 1157;
                        }
                    }
                    goto case 48;
                case 48:
			    {
			        NewbieQuestCompleted = reader.ReadBool();
			    }
                    goto case 47;
				case 47:
					{
						if (reader.ReadBool())
						{
							BodyValue = Race.Body(this);
						}
					}
					goto case 46;
				case 46:
				case 45:
					{
						EventMsgFlag = reader.ReadBool();
						EventPoints = reader.ReadInt();
					}
					goto case 44;
				case 44:
					{
						int titleCount = reader.ReadInt();

						if (titleCount > 0)
						{
							_ValorTitles = new List<string>();

							for (int i = 0; i < titleCount; i++)
							{
								string title = reader.ReadString();
								_ValorTitles.Add(title);
							}
						}
					}
					goto case 43;
				case 43:
					{
						Lastkilled = reader.ReadDateTime();
						goto case 42;
					}
				case 42:
					_ValorRating = reader.ReadInt();
					goto case 41;
				case 41:
					ValorQuests = reader.ReadInt();
					goto case 40;
				case 40:
					ValorTitle = reader.ReadString();
					goto case 39;
				case 39:
					ValorRank = reader.ReadInt();
					goto case 38;
				case 38:
					MurderersKilled = reader.ReadInt();
					goto case 37;
				case 37:
					ValorPoints = reader.ReadInt();
					goto case 36;
				case 36:
					LongTermLastDecayGameTime = reader.ReadTimeSpan();
					goto case 35;
				case 35:
					Companion = reader.ReadBool();
					goto case 34;
				case 34:
					{
						// don't check stat loss decay here, just on login
						GameParticipant = reader.ReadBool();
					}
					goto case 33;
				case 33:
					{
						// don't check stat loss decay here, just on login
						StatEnd = reader.ReadDateTime();
					}
					goto case 32;
				case 32:
					reader.ReadInt(); //m_InStat = reader.ReadInt(); 
					// TODO: Remove
					goto case 31;
				case 31:
					KMUsed = reader.ReadInt();
					goto case 30;
				case 30:
					MurderBounty = reader.ReadInt();
					goto case 29;
				case 29:
					{
						int skillgaincount = reader.ReadEncodedInt();

						for (int i = 0; i < skillgaincount; i++)
						{
							SkillGainMods.Add(new SkillGainMod(this, reader));
						}

						goto case 28;
					}
				case 28:
					PeacedUntil = reader.ReadDateTime();
					goto case 27;
				case 27:
					AnkhNextUse = reader.ReadDateTime();
					goto case 26;
				case 26:
					{
						AutoStabled = reader.ReadStrongMobileList();

						CustomFlags = (CustomPlayerFlag)reader.ReadEncodedInt();

						if (GetCustomFlag(CustomPlayerFlag.VisibilityList))
						{
							int length = reader.ReadInt();

							for (int i = 0; i < length; i++)
							{
								VisibilityList.Add(reader.ReadMobile());
							}
						}

						if (GetCustomFlag(CustomPlayerFlag.StaffLevel))
						{
							AccessLevelToggler.m_Mobiles.Add(this, new AccessLevelMod((AccessLevel)reader.ReadInt()));
						}

						if (GetCustomFlag(CustomPlayerFlag.StaffRank))
						{
							m_StaffRank = (StaffRank)reader.ReadInt();
						}

						if (GetCustomFlag(CustomPlayerFlag.DisplayStaffRank))
						{
							m_StaffTitle = reader.ReadString();
						}
					}
					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();

								//Don't add in recipies which we haven't gotten or have been removed
								if (reader.ReadBool())
								{
									m_AcquiredRecipes.Add(r, true);
								}
							}
						}
					}
					goto case 24;
				case 24:
					reader.ReadDeltaTime(); //m_LastHonorLoss = reader.ReadDeltaTime();
					// TODO: Remove
					goto case 23;
				case 23:
					ChampionTitles = new ChampionTitleInfo(reader);
					goto case 22;
				case 22:
					reader.ReadDateTime(); //m_LastValorLoss = reader.ReadDateTime();
					// TODO: Remove
					goto case 21;
				case 21:
					{
						ToTItemsTurnedIn = reader.ReadEncodedInt();
						ToTTotalMonsterFame = reader.ReadInt();
					}
					goto case 20;
				case 20:
					{
						AllianceMessageHue = reader.ReadEncodedInt();
						GuildMessageHue = reader.ReadEncodedInt();
					}
					goto case 19;
				case 19:
					{
						int rank = reader.ReadEncodedInt();
						int maxRank = RankDefinition.Ranks.Length - 1;

						if (rank > maxRank)
						{
							rank = maxRank;
						}

						m_GuildRank = RankDefinition.Ranks[rank];
						LastOnline = reader.ReadDateTime();
					}
					goto case 18;
				case 18:
					SolenFriendship = (SolenFriendship)reader.ReadEncodedInt();
					goto case 17;
				case 17: // changed how DoneQuests is serialized
				case 16:
					{
						Quest = QuestSerializer.DeserializeQuest(reader);

						if (Quest != null)
						{
							Quest.From = this;
						}

						int count = reader.ReadEncodedInt();

						DoneQuests = new List<QuestRestartInfo>(count);

						if (count > 0)
						{
							for (int i = 0; i < count; ++i)
							{
								Type questType = QuestSerializer.ReadType(QuestSystem.QuestTypes, reader);
								DateTime restartTime = version < 17 ? DateTime.MaxValue : reader.ReadDateTime();

								DoneQuests.Add(new QuestRestartInfo(questType, restartTime));
							}
						}

						Profession = reader.ReadEncodedInt();
					}
					goto case 15;
				case 15:
					reader.ReadDeltaTime(); //m_LastCompassionLoss = reader.ReadDeltaTime();
					// TODO: Remove
					goto case 14;
				case 14:
					{
						// TODO: Remove
						if (reader.ReadEncodedInt() > 0)
						{
							reader.ReadDeltaTime(); //m_NextCompassionDay = reader.ReadDeltaTime();
						}
					}
					goto case 13;
				case 13: // removed PaidInsurance list
				case 12:
					BOBFilter = new BOBFilter(reader);
					goto case 11;
				case 11:
					{
						if (version < 13)
						{
							List<Item> paid = reader.ReadStrongItemList();

							foreach (Item i in paid)
							{
								i.PaidInsurance = 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:
					{
						NpcGuild = (NpcGuild)reader.ReadInt();
						NpcGuildJoinTime = reader.ReadDateTime();
						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:
				case 3:
				case 2:
					Flags = (PlayerFlag)reader.ReadInt();
					goto case 1;
				case 1:
					{
						m_ShortTermElapse = reader.ReadDateTime();
						m_GameTime = reader.ReadTimeSpan();
					}
					goto case 0;
				case 0:
					break;
			}

			if (RecentlyReported == null)
			{
				RecentlyReported = new List<Mobile>();
			}

			// Professions weren't verified on 1.0 RC0
			if (!CharacterCreation.VerifyProfession(Profession, Expansion))
			{
				Profession = 0;
			}

			if (m_PermaFlags == null)
			{
				m_PermaFlags = new List<Mobile>();
			}

			if (BOBFilter == null)
			{
				BOBFilter = new BOBFilter();
			}

			if (m_GuildRank == null)
			{
				//Default to member if going from older version to new version (only time it should be null)
				m_GuildRank = RankDefinition.Member;
			}

			if (LastOnline == DateTime.MinValue && Account != null)
			{
				LastOnline = ((Account)Account).LastLogin;
			}

			if (ChampionTitles == null)
			{
				ChampionTitles = new ChampionTitleInfo();
			}

			if (AccessLevel > AccessLevel.Player)
			{
				IgnoreMobiles = true;
			}

			List<Mobile> list = Stabled;

			foreach (BaseCreature bc in list.OfType<BaseCreature>())
			{
				bc.IsStabled = true; //Charge date set in BaseCreature
			}

			CheckAtrophies(this);

			if (Hidden) //Hiding is the only buff where it has an effect that's serialized.
			{
				AddBuff(new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655));
			}
		}
		public PlayerMobile()
		{
			m_AutoStabled = new List<Mobile>();

			#region Mondain's Legacy
			m_Quests = new List<BaseQuest>();
			m_Chains = new Dictionary<QuestChain, BaseChain>();
			m_DoneQuests = new List<QuestRestartInfo>();
			m_Collections = new Dictionary<Collection, int>();
			m_CollectionTitles = new List<object>();

			m_PeacedUntil = DateTime.UtcNow;
			#endregion

			m_VisList = new List<Mobile>();
			m_PermaFlags = new List<Mobile>();
			m_AntiMacroTable = new Hashtable();
			m_RecentlyReported = new List<Mobile>();

			m_BOBFilter = new BOBFilter();

			m_GameTime = TimeSpan.Zero;
			m_ShortTermElapse = TimeSpan.FromHours(8.0);
			m_LongTermElapse = TimeSpan.FromHours(40.0);

			m_JusticeProtectors = new List<Mobile>();
			m_GuildRank = RankDefinition.Lowest;

			m_ChampionTitles = new ChampionTitleInfo();

			InvalidateMyRunUO();
		}
Example #4
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			switch ( version )
			{
                case 44:
			        {
			            AntiMacroGump = reader.ReadBool();
			            goto case 43;
			        }
                case 43:
                    {
                        ShowTipsOnLogin = reader.ReadBool();
                        goto case 42;
                    }
                case 42:
			        {
			            AllowMulti = reader.ReadBool();
			            goto case 41;
			        }
                case 41:
                    {
                        GameInfoGumpType = (GameInfoGumpType)reader.ReadInt();
                        goto case 40;
                    }
                case 40:
                    {
                        m_EventType = (EventType)reader.ReadByte();
                        m_CurrentEvent = reader.ReadItem() as BaseGame;
                        goto case 39;
                    }
                case 39:
			        {
			            TempCheck = reader.ReadBool();
			            goto case 38;
			        }
                case 38:
                    {
                        m_AutoStabled = reader.ReadStrongMobileList();
                        m_AnkhNextUse = reader.ReadDateTime();
                        m_PeacedUntil = reader.ReadDateTime();
                        goto case 37;
                    }
                case 37:
			        {
			            ShowArriveMsg = reader.ReadBool();
			            goto case 36;
			        }
                case 36:
                    {
                        m_Rating = reader.ReadInt();
                        m_TournamentRating = reader.ReadInt();
                        m_CurrentEvent = null;
                        goto case 35;
                    }
                case 35:
                    {
                        m_Snoopers = reader.ReadStrongMobileList();
                        goto case 34;
                    }
                case 34:
                    m_HasStartingSkillBoost = reader.ReadBool();
                    goto case 33;
                case 33:
			        {
			            m_OriginalHairHue = reader.ReadInt();
			            m_OriginalHairItemID = reader.ReadInt();
			            m_OriginalHue = reader.ReadInt();
			            m_HasCustomRace = reader.ReadBool();
			            goto case 32;
			        }
                case 32:
                    VirtualArmor = reader.ReadInt();
                    goto case 31;
                case 31:
                    m_PlayerGuildGameTime = reader.ReadTimeSpan();
                    goto case 30;
                case 30:
                    m_AlwaysMurderer = reader.ReadBool();
                    goto case 29;
                case 29:
                    m_Imported = reader.ReadBool();
                    goto case 28;
                case 28:
                    /*Item nullItem = reader.ReadItem();
                    goto case 27;*/
                case 27:
                    m_Stoned = reader.ReadBool();
                    goto case 26;
				case 26:
					UseUnicodeSpeech = reader.ReadBool();
					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:
				{
					AllianceMessageHue = reader.ReadEncodedInt();
					GuildMessageHue = reader.ReadEncodedInt();

					goto case 19;
				}
				case 19:
				{
					int rank = reader.ReadEncodedInt();
					int maxRank = RankDefinition.Ranks.Length -1;
					if( rank > maxRank )
						rank = maxRank;

					m_GuildRank = RankDefinition.Ranks[rank];
					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 ) );
						}
					}

					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 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:
				{
					NpcGuild = (NpcGuild)reader.ReadInt();
					NpcGuildJoinTime = reader.ReadDateTime();
					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 < 43)
                        ShowTipsOnLogin = true;

                    if (version < 38)
                        m_AutoStabled = new List<Mobile>();
					break;
				}
			}

			// Professions weren't verified on 1.0 RC0
			if ( !CharacterCreation.VerifyProfession( Profession ) )
				Profession = 0;

			if ( m_PermaFlags == null )
				m_PermaFlags = new List<Mobile>();

            if ( m_Snoopers == null)
                m_Snoopers = new List<Mobile>();

			if ( m_JusticeProtectors == null )
				m_JusticeProtectors = new List<Mobile>();

			if ( m_BOBFilter == null )
				m_BOBFilter = new BOBFilter();

			if( m_GuildRank == null )
				m_GuildRank = RankDefinition.Member;	//Default to member if going from older verstion to new version (only time it should be null)

			if( LastOnline == DateTime.MinValue && Account != null )
				LastOnline = ((Account)Account).LastLogin;

			if( m_ChampionTitles == null )
				m_ChampionTitles = new ChampionTitleInfo();

            if (AccessLevel > AccessLevel.Player)
                m_IgnoreMobiles = true;

			List<Mobile> list = Stabled;

			for ( int i = 0; i < list.Count; ++i )
			{
				BaseCreature bc = list[i] as BaseCreature;

				if ( bc != null )
					bc.IsStabled = true;
			}

			CheckAtrophies( this );


			if( Hidden )	//Hiding is the only buff where it has an effect that's serialized.
				AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );
		}
Example #5
0
		public PlayerMobile()
		{
			AllFollowers = new List<Mobile>();
			AutoStabled = new List<Mobile>();
			RecentlyReported = new List<Mobile>();
			SkillGainMods = new List<SkillGainMod>();
			m_VisList = new List<Mobile>();
			m_PermaFlags = new List<Mobile>();
			m_AntiMacroTable = new Hashtable();

			BOBFilter = new BOBFilter();

			ChampionTitles = new ChampionTitleInfo();

			Learning = (SkillName)(-1);
			LastHelped = DateTime.MinValue;
			StatEnd = DateTime.MinValue;

			EventMsgFlag = true;

			m_GameTime = TimeSpan.Zero;
			m_ShortTermElapse = DateTime.UtcNow + ShortTermDuration;
			LongTermLastDecayGameTime = TimeSpan.Zero;

			m_GuildRank = RankDefinition.Lowest;

            //InvalidateLegends();
		}
Example #6
0
        public void CreateAlliance_Callback(Mobile from, string text)
        {
            PlayerMobile pm = from as PlayerMobile;


            AllianceInfo alliance      = guild.Alliance;
            AllianceInfo otherAlliance = m_Other.Alliance;

            if (!IsMember(from, guild) || alliance != null)
            {
                return;
            }


            RankDefinition playerRank = pm.GuildRank;


            if (!playerRank.GetFlag(RankFlags.AllianceControl))
            {
                pm.SendLocalizedMessage(1070747);                   // You don't have permission to create an alliance.
            }
            else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
            {
                //Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
                pm.SendLocalizedMessage(1070758);                   // You cannot propose an alliance to a guild with a different faction allegiance.
            }
            else if (otherAlliance != null)
            {
                if (otherAlliance.IsPendingMember(m_Other))
                {
                    pm.SendLocalizedMessage(1063416, m_Other.Name);                       // ~1_val~ is currently considering another alliance proposal.
                }
                else
                {
                    pm.SendLocalizedMessage(1063426, m_Other.Name);                       // ~1_val~ already belongs to an alliance.
                }
            }
            else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
            {
                pm.SendLocalizedMessage(1063427, m_Other.Name);                   // ~1_val~ is currently involved in a guild war.
            }
            else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
            {
                pm.SendLocalizedMessage(1063427, guild.Name);                   // ~1_val~ is currently involved in a guild war.
            }
            else
            {
                string name = Utility.FixHtml(text.Trim());

                if (!BaseGuildGump.CheckProfanity(name))
                {
                    pm.SendLocalizedMessage(1070886);                       // That alliance name is not allowed.
                }
                else if (name.Length > Guild.NameLimit)
                {
                    pm.SendLocalizedMessage(1070887, Guild.NameLimit.ToString());                       // An alliance name cannot exceed ~1_val~ characters in length.
                }
                else if (AllianceInfo.Alliances.ContainsKey(name.ToLower()))
                {
                    pm.SendLocalizedMessage(1063428);                       // That alliance name is not available.
                }
                else
                {
                    pm.SendLocalizedMessage(1070750, m_Other.Name);                  // An invitation to join your alliance has been sent to ~1_val~.

                    m_Other.GuildMessage(1070780, guild.Name);                       // ~1_val~ has proposed an alliance.

                    new AllianceInfo(guild, name, m_Other);
                }
            }
        }
Example #7
0
	    public PlayerMobile()
		{
            m_AutoStabled = new List<Mobile>();

			m_VisList = new List<Mobile>();
			m_PermaFlags = new List<Mobile>();
			m_AntiMacroTable = new Hashtable();
            m_Snoopers = new List<Mobile>();

			m_BOBFilter = new BOBFilter();

			m_GameTime = TimeSpan.Zero;
			m_ShortTermElapse = TimeSpan.FromHours( 8.0 );
			m_LongTermElapse = TimeSpan.FromHours( 40.0 );

			m_JusticeProtectors = new List<Mobile>();
			m_GuildRank = RankDefinition.Lowest;

			m_ChampionTitles = new ChampionTitleInfo();

			InvalidateMyRunUO();
		}
Example #8
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (!IsMember(pm, guild))
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;

            Guild guildLeader = Guild.GetAllianceLeader(guild);
            Guild otherGuild  = Guild.GetAllianceLeader(m_Other);

            WarDeclaration war       = guildLeader.FindPendingWar(otherGuild);
            WarDeclaration activeWar = guildLeader.FindActiveWar(otherGuild);
            WarDeclaration otherWar  = otherGuild.FindPendingWar(guildLeader);

            AllianceInfo alliance      = guild.Alliance;
            AllianceInfo otherAlliance = otherGuild.Alliance;

            switch (info.ButtonID)
            {
                #region War
            case 5:                     //Accept the war
            {
                if (war != null && !war.WarRequester && activeWar == null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        //Accept the war
                        guild.PendingWars.Remove(war);
                        war.WarBeginning = DateTime.Now;
                        guild.AcceptedWars.Add(war);

                        if (alliance != null && alliance.IsMember(guild))
                        {
                            alliance.AllianceMessage(1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            alliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            guild.GuildMessage(1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            guild.InvalidateMemberProperties();
                        }
                        //Technically  SHOULD say Your guild is now at war w/out any info, intentional diff.

                        otherGuild.PendingWars.Remove(otherWar);
                        otherWar.WarBeginning = DateTime.Now;
                        otherGuild.AcceptedWars.Add(otherWar);

                        if (otherAlliance != null && m_Other.Alliance.IsMember(m_Other))
                        {
                            otherAlliance.AllianceMessage(1070769, ((alliance != null) ? alliance.Name : guild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            otherAlliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            otherGuild.GuildMessage(1070769, ((alliance != null) ? alliance.Name : guild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            otherGuild.InvalidateMemberProperties();
                        }
                    }
                }

                break;
            }

            case 6:                     //Modify war terms
            {
                if (war != null && !war.WarRequester && activeWar == null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        pm.SendGump(new WarDeclarationGump(pm, guild, otherGuild));
                    }
                }
                break;
            }

            case 7:                     //Dismiss war
            {
                if (war != null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        //Dismiss the war
                        guild.PendingWars.Remove(war);
                        otherGuild.PendingWars.Remove(otherWar);
                        pm.SendLocalizedMessage(1070752);                                   // The proposal has been updated.
                        //Messages to opposing guild? (Testing on OSI says no)
                    }
                }
                break;
            }

            case 8:                     //Surrender
            {
                if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                {
                    pm.SendLocalizedMessage(1063440);                               // You don't have permission to negotiate wars.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                    pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                 // You need to negotiate via ~1_val~ instead.
                }
                else
                {
                    if (activeWar != null)
                    {
                        if (alliance != null && alliance.IsMember(guild))
                        {
                            alliance.AllianceMessage(1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                      // You have lost the war with ~1_val~.
                            alliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            guild.GuildMessage(1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                      // You have lost the war with ~1_val~.
                            guild.InvalidateMemberProperties();
                        }

                        guild.AcceptedWars.Remove(activeWar);

                        if (otherAlliance != null && otherAlliance.IsMember(otherGuild))
                        {
                            otherAlliance.AllianceMessage(1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name));                                      // You have won the war against ~1_val~!
                            otherAlliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            otherGuild.GuildMessage(1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name));                                      // You have won the war against ~1_val~!
                            otherGuild.InvalidateMemberProperties();
                        }

                        otherGuild.AcceptedWars.Remove(otherGuild.FindActiveWar(guild));
                    }
                }
                break;
            }

            case 1:                     //Declare War
            {
                if (war == null && activeWar == null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else if (otherAlliance != null && otherAlliance.Leader != m_Other)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        pm.SendGump(new WarDeclarationGump(pm, guild, m_Other));
                    }
                }
                break;
            }

                #endregion
            case 2:                     //Request Alliance
            {
                #region New alliance
                if (alliance == null)
                {
                    if (!playerRank.GetFlag(RankFlags.AllianceControl))
                    {
                        pm.SendLocalizedMessage(1070747);                                   // You don't have permission to create an alliance.
                    }
                    else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
                    {
                        pm.SendLocalizedMessage(1070758);                                   // You cannot propose an alliance to a guild with a different faction allegiance.
                    }
                    else if (otherAlliance != null)
                    {
                        if (otherAlliance.IsPendingMember(m_Other))
                        {
                            pm.SendLocalizedMessage(1063416, m_Other.Name);                                       // ~1_val~ is currently considering another alliance proposal.
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1063426, m_Other.Name);                                       // ~1_val~ already belongs to an alliance.
                        }
                    }
                    else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, m_Other.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, guild.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1063439);                                   // Enter a name for the new alliance:
                        pm.BeginPrompt(new PromptCallback(CreateAlliance_Callback));
                    }
                }
                #endregion
                #region Existing Alliance
                else
                {
                    if (!playerRank.GetFlag(RankFlags.AllianceControl))
                    {
                        pm.SendLocalizedMessage(1063436);                                   // You don't have permission to negotiate an alliance.
                    }
                    else if (alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));                                     // ~1_val~ is not the leader of the ~2_val~ alliance.
                    }
                    else if (otherAlliance != null)
                    {
                        if (otherAlliance.IsPendingMember(m_Other))
                        {
                            pm.SendLocalizedMessage(1063416, m_Other.Name);                                       // ~1_val~ is currently considering another alliance proposal.
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1063426, m_Other.Name);                                       // ~1_val~ already belongs to an alliance.
                        }
                    }
                    else if (alliance.IsPendingMember(guild))
                    {
                        pm.SendLocalizedMessage(1063416, guild.Name);                                   // ~1_val~ is currently considering another alliance proposal.
                    }
                    else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, m_Other.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, guild.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
                    {
                        pm.SendLocalizedMessage(1070758);                                   // You cannot propose an alliance to a guild with a different faction allegiance.
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1070750, m_Other.Name);                 // An invitation to join your alliance has been sent to ~1_val~.

                        m_Other.GuildMessage(1070780, guild.Name);                      // ~1_val~ has proposed an alliance.

                        m_Other.Alliance = alliance;                                    //Calls addPendingGuild
                        //alliance.AddPendingGuild( m_Other );
                    }
                }
                #endregion
                break;
            }

            case 10:                            //Show Alliance Roster
            {
                if (alliance != null && alliance == otherAlliance)
                {
                    pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, alliance));
                }

                break;
            }

            case 11:                            //Leave Alliance
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.IsMember(guild))
                {
                    guild.Alliance = null;                              //Calls alliance.Removeguild
//						alliance.RemoveGuild( guild );

                    m_Other.InvalidateWarNotoriety();

                    guild.InvalidateMemberNotoriety();
                }
                break;
            }

            case 12:                            //Remove Guild from alliance
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));                                 // ~1_val~ is not the leader of the ~2_val~ alliance.
                }
                else if (alliance != null && alliance.IsMember(guild) && alliance.IsMember(m_Other))
                {
                    m_Other.Alliance = null;

                    m_Other.InvalidateMemberNotoriety();

                    guild.InvalidateWarNotoriety();
                }
                break;
            }

            case 13:                            //Promote to Alliance leader
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));                                 // ~1_val~ is not the leader of the ~2_val~ alliance.
                }
                else if (alliance != null && alliance.IsMember(guild) && alliance.IsMember(m_Other))
                {
                    pm.SendLocalizedMessage(1063434, String.Format("{0}\t{1}", m_Other.Name, alliance.Name));                                 // ~1_val~ is now the leader of ~2_val~.

                    alliance.Leader = m_Other;
                }
                break;
            }

            case 14:                            //Withdraw Request
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.Leader == guild && alliance.IsPendingMember(m_Other))
                {
                    m_Other.Alliance = null;
                    pm.SendLocalizedMessage(1070752);                               // The proposal has been updated.
                }
                break;
            }

            case 15:                     //Deny Alliance Request
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember(guild))
                {
                    pm.SendLocalizedMessage(1070752);                               // The proposal has been updated.
                    //m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.	//Per OSI commented out.

                    guild.Alliance = null;
                }
                break;
            }

            case 16:                     //Accept Alliance Request
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember(guild))
                {
                    pm.SendLocalizedMessage(1070752);                               // The proposal has been updated.

                    otherAlliance.TurnToMember(m_Other);                            //No need to verify it's in the guild or already a member, the function does this

                    otherAlliance.TurnToMember(guild);
                }
                break;
            }
            }
        }
Example #9
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (pm == null || !IsMember(pm, guild) || !IsMember(m_Member, guild))
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;
            RankDefinition targetRank = m_Member.GuildRank;

            switch (info.ButtonID)
            {
            case 1:     //Promote
            {
                if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && ((playerRank.Rank - 1) > targetRank.Rank || (playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank)))
                {
                    targetRank = RankDefinition.Ranks[targetRank.Rank + 1];

                    if (targetRank == RankDefinition.Leader)
                    {
                        if (m_ToLeader)
                        {
                            m_Member.GuildRank = targetRank;
                            pm.SendLocalizedMessage(1063156, m_Member.Name);   // The guild information for ~1_val~ has been updated.
                            pm.SendLocalizedMessage(1063156, pm.Name);         // The guild information for ~1_val~ has been updated.
                            guild.Leader = m_Member;
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1063144);         // Are you sure you wish to make this member the new guild leader?
                            pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, false, true));
                        }
                    }
                    else
                    {
                        m_Member.GuildRank = targetRank;
                        pm.SendLocalizedMessage(1063156, m_Member.Name);         // The guild information for ~1_val~ has been updated.
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063143);         // You don't have permission to promote this member.
                }
                break;
            }

            case 2:     //Demote
            {
                if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && playerRank.Rank > targetRank.Rank)
                {
                    if (targetRank == RankDefinition.Lowest)
                    {
                        if (RankDefinition.Lowest.Name.Number == 1062963)
                        {
                            pm.SendLocalizedMessage(1063333);         // You can't demote a ronin.
                        }
                        else
                        {
                            pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
                        }
                    }
                    else
                    {
                        m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
                        pm.SendLocalizedMessage(1063156, m_Member.Name);         // The guild information for ~1_val~ has been updated.
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063146);         // You don't have permission to demote this member.
                }
                break;
            }

            case 3:     //Set Guild title
            {
                if (playerRank.GetFlag(RankFlags.CanSetGuildTitle) && (playerRank.Rank > targetRank.Rank || m_Member == player))
                {
                    pm.SendLocalizedMessage(1011128);         // Enter the new title for this guild member or 'none' to remove a title:

                    pm.BeginPrompt(new PromptCallback(SetTitle_Callback));
                }
                else if (m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0)
                {
                    pm.SendLocalizedMessage(1070746);         // You don't have the permission to set that member's guild title.
                }
                else
                {
                    pm.SendLocalizedMessage(1063148);         // You don't have permission to change this member's guild title.
                }

                break;
            }

            case 4:     //Vote
            {
                if (m_Member == pm.GuildFealty && guild.Leader != m_Member)
                {
                    pm.SendLocalizedMessage(1063158);    // You have cleared your vote for guild leader.
                }
                else if (guild.CanVote(m_Member))        //( playerRank.GetFlag( RankFlags.CanVote ) )
                {
                    if (m_Member == guild.Leader)
                    {
                        pm.SendLocalizedMessage(1063424);         // You can't vote for the current guild leader.
                    }
                    else if (!guild.CanBeVotedFor(m_Member))
                    {
                        pm.SendLocalizedMessage(1063425);         // You can't vote for an inactive guild member.
                    }
                    else
                    {
                        pm.GuildFealty = m_Member;
                        pm.SendLocalizedMessage(1063159, m_Member.Name);         // You cast your vote for ~1_val~ for guild leader.
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063149);         // You don't have permission to vote.
                }
                break;
            }

            case 5:     //Kick
            {
                if ((playerRank.GetFlag(RankFlags.RemovePlayers) && playerRank.Rank > targetRank.Rank) || (playerRank.GetFlag(RankFlags.RemoveLowestRank) && targetRank == RankDefinition.Lowest))
                {
                    if (m_toKick)
                    {
                        guild.RemoveMember(m_Member);
                        pm.SendLocalizedMessage(1063157);         // The member has been removed from your guild.
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1063152);         // Are you sure you wish to kick this member from the guild?
                        pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, true, false));
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063151);         // You don't have permission to remove this member.
                }
                break;
            }
            }
        }
Example #10
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (!IsMember(pm, guild))
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;

            switch (info.ButtonID)
            {
            case 1:
            {
                AllianceInfo alliance      = guild.Alliance;
                AllianceInfo otherAlliance = m_Other.Alliance;

                if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                {
                    pm.SendLocalizedMessage(1063440);         // You don't have permission to negotiate wars.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, string.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                    pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                 // You need to negotiate via ~1_val~ instead.
                }
                else if (otherAlliance != null && otherAlliance.Leader != m_Other)
                {
                    pm.SendLocalizedMessage(1063239, string.Format("{0}\t{1}", m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                    pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                }
                else
                {
                    WarDeclaration activeWar = guild.FindActiveWar(m_Other);

                    if (activeWar == null)
                    {
                        WarDeclaration war      = guild.FindPendingWar(m_Other);
                        WarDeclaration otherWar = m_Other.FindPendingWar(guild);

                        //Note: OSI differs from what it says on website.  unlimited war = 0 kills/ 0 hrs.  Not > 999.  (sidenote: they both cap at 65535, 7.5 years, but, still.)
                        TextRelay tKills     = info.GetTextEntry(11);
                        TextRelay tWarLength = info.GetTextEntry(10);

                        int      maxKills  = (tKills == null) ? 0 : Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(11).Text), 0xFFFF), 0);
                        TimeSpan warLength = TimeSpan.FromHours((tWarLength == null) ? 0 : Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(10).Text), 0xFFFF), 0));

                        if (war != null)
                        {
                            war.MaxKills     = maxKills;
                            war.WarLength    = warLength;
                            war.WarRequester = true;
                        }
                        else
                        {
                            guild.PendingWars.Add(new WarDeclaration(guild, m_Other, maxKills, warLength, true));
                        }

                        if (otherWar != null)
                        {
                            otherWar.MaxKills     = maxKills;
                            otherWar.WarLength    = warLength;
                            otherWar.WarRequester = false;
                        }
                        else
                        {
                            m_Other.PendingWars.Add(new WarDeclaration(m_Other, guild, maxKills, warLength, false));
                        }

                        if (war != null)
                        {
                            pm.SendLocalizedMessage(1070752);         // The proposal has been updated.
                        }
                        else
                        {
                            m_Other.GuildMessage(1070781, guild.Alliance != null ? guild.Alliance.Name : guild.Name);         // ~1_val~ has proposed a war.
                        }

                        pm.SendLocalizedMessage(1070751, m_Other.Alliance != null ? m_Other.Alliance.Name : m_Other.Name);         // War proposal has been sent to ~1_val~.
                    }
                }
                break;
            }

            default:
            {
                pm.SendGump(new OtherGuildInfo(pm, guild, m_Other));
                break;
            }
            }
        }
        public PlayerMobile()
        {
            m_AutoStabled = new List<Mobile>();

            m_VisList = new List<Mobile>();
            m_PermaFlags = new List<Mobile>();
            m_AntiMacroTable = new Hashtable();

            m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            m_GameTime = TimeSpan.Zero;
            m_ShortTermElapse = ShortTermDuration;
            m_LongTermElapse = LongTermDuration;

            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 36:
                {
                    m_PeacedUntil = reader.ReadDateTime();

                    goto case 35;
                }
                case 35:
                {
                    m_AnkhNextUse = reader.ReadDateTime();

                    goto case 34;
                }
                case 34:
                {
                    m_AutoStabled = reader.ReadStrongMobileList();

                    m_CustomFlags = (CustomPlayerFlag)reader.ReadEncodedInt();

                    if ( GetCustomFlag( CustomPlayerFlag.VisibilityList ) )
                    {
                        int length = reader.ReadInt();
                        for( int i = 0; i < length; i++ )
                            VisibilityList.Add( reader.ReadMobile() );
                    }

                    if ( GetCustomFlag( CustomPlayerFlag.StaffLevel ) )
                        AccessLevelToggler.m_Mobiles.Add( this, new AccessLevelMod( (AccessLevel)reader.ReadInt() ) );

                    if ( GetCustomFlag( CustomPlayerFlag.StaffRank ) )
                        m_StaffRank = (StaffRank)reader.ReadInt();

                    if ( GetCustomFlag( CustomPlayerFlag.DisplayStaffRank ) )
                        m_StaffTitle = reader.ReadString();

                    goto case 33;
                }
                case 33: // Added by Blady for Sphynx
                {
                    m_FortuneType = reader.ReadEncodedInt();
                    if ( m_FortuneType > 0 )
                    {
                        m_FortunePower = reader.ReadEncodedInt();
                        FortuneExpire = reader.ReadDateTime();
                        if ( FortuneExpire > DateTime.Now )
                        {
                            ApplyFortune( m_FortuneType, m_FortunePower );
                            FortuneGump.Told.Add( this );
                        }
                        else
                            m_FortuneType = m_FortunePower = 0;
                    }

                    goto case 32;
                }
                case 32: //PowerHour added by Blady
                {
                    m_PowerHourStart = reader.ReadDeltaTime();
                    goto case 31;
                }
                //*** Edit by Sunny ***\\
                case 31:
                case 30:
                {
                    m_OSIHouseLoading = reader.ReadBool();
                    goto case 29;
                }
                //*** End edit ***\\

                case 29:
                {
                    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 28;
                }
                case 28:
                {
                    m_LastHonorLoss = reader.ReadDeltaTime();
                    goto case 27;
                }
                case 27:
                {
                    m_ChampionTitles = new ChampionTitleInfo(reader);
                    goto case 26;
                }
                case 26:
                {
                    m_LastValorLoss = reader.ReadDateTime();
                    goto case 25;
                }
                case 25:
                {
                    m_ToTItemsTurnedIn = reader.ReadEncodedInt();
                    m_ToTTotalMonsterFame = reader.ReadInt();
                    goto case 24;
                }
                case 24:
                {
                    m_AllianceMessageHue = reader.ReadEncodedInt();
                    m_GuildMessageHue = reader.ReadEncodedInt();

                    goto case 23;
                }
                case 23:
                {
                    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 22;
                }
                case 22:
                {
                    if (version < 31)
                        reader.ReadInt();
                    goto case 21;
                }
                // *** Added for Hunting Contracts ***
                case 21:
                {
                    m_NextHuntContract = reader.ReadDateTime();
                    goto case 20;
                }
                // *** ***
                // *** Added for Honor ***
                case 20:
                {
                    if (version < 29)
                    {
                        double m_HonorGain = reader.ReadDouble();
                        DateTime m_LastHonorLoss = reader.ReadDateTime();
                        DateTime m_LastEmbrace = reader.ReadDateTime();
                    }
                    goto case 19;
                }
                // *** ***
                // *** Added for Valor ***
                case 19:
                {
                    if (version < 29)
                    {
                        double m_ValorGain = reader.ReadDouble();
                        DateTime m_LastValorLoss = reader.ReadDeltaTime();
                    }
                    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_PaidInsurance list
                case 12:
                {
                    m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );
                    goto case 11;
                }
                case 11:
                {
                    if ( version < 13 )
                    {
                        List<Item> paid = reader.ReadStrongItemList();

                        for ( int i = 0; i < paid.Count; ++i )
                            paid[i].PaidInsurance = 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();

                        // We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
            //						Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
                    }

                    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 < 34 )
                        m_AutoStabled = new List<Mobile>();
                    break;
                }
            }

            // 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 verstion 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;
            }

            CheckAtrophies( this );

            if( Hidden )	//Hiding is the only buff where it has an effect that's serialized.
                AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );
        }