Example #1
0
        public bool CheckFilter(int amountMax, bool isLarge)
        {
            TamingBOBFilter f = (m_From.UseOwnFilter ? m_From.TamingBOBFilter : m_Book.Filter);

            if (f.IsDefault)
            {
                return(true);
            }

            if (f.Quantity == 1 && amountMax != 10)
            {
                return(false);
            }
            else if (f.Quantity == 2 && amountMax != 15)
            {
                return(false);
            }
            else if (f.Quantity == 3 && amountMax != 20)
            {
                return(false);
            }

            if (f.Type == 1 && isLarge)
            {
                return(false);
            }
            else if (f.Type == 2 && !isLarge)
            {
                return(false);
            }

            return(true);
        }
        public AnimalBODModule(Mobile from) : base()
        {
            this.LinkMobile(from);

            m_TamingBOBFilter = new Server.Engines.BulkOrders.TamingBOBFilter();

            BaseCore.OnEnabledChanged += BaseCore_OnEnabledChanged;
        }
        public TamingBulkOrderBook() : base(0x2259)
        {
            Name     = "taming bulk order book";
            Weight   = 1.0;
            LootType = LootType.Blessed;

            m_Entries = new ArrayList();
            m_Filter  = new TamingBOBFilter();

            m_Level = SecureLevel.CoOwners;
        }
		public TamingBulkOrderBook() : base( 0x2259 )
		{
			Name = "taming bulk order book";
			Weight = 1.0;
			LootType = LootType.Blessed;

			m_Entries = new ArrayList();
			m_Filter = new TamingBOBFilter();

			m_Level = SecureLevel.CoOwners;
		}
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            Int32 version = reader.ReadInt();

            switch (version)
            {
            case 0:
                m_TamingBOBFilter = new Server.Engines.BulkOrders.TamingBOBFilter(reader);
                break;
            }

            if (m_TamingBOBFilter == null)
            {
                m_TamingBOBFilter = new Server.Engines.BulkOrders.TamingBOBFilter();
            }
        }
        public TamingBOBFilterGump(PlayerMobile from, TamingBulkOrderBook book) : base(12, 24)
        {
            from.CloseGump(typeof(TamingBOBGump));
            from.CloseGump(typeof(TamingBOBFilterGump));

            m_From = from;
            m_Book = book;

            AnimalBODModule module = from.GetModule(typeof(AnimalBODModule)) as AnimalBODModule ?? new AnimalBODModule(from);
            TamingBOBFilter f      = (from.UseOwnFilter ? module.TamingBOBFilter : m_Book.Filter);

            AddPage(0);

            AddBackground(10, 10, 600, 439, 5054);

            AddImageTiled(18, 20, 583, 420, 2624);
            AddAlphaRegion(18, 20, 583, 420);

            AddImage(5, 5, 10460);
            AddImage(585, 5, 10460);
            AddImage(5, 424, 10460);
            AddImage(585, 424, 10460);

            AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor, false, false);               // Filter Preference

            AddHtmlLocalized(26, 258, 120, 32, 1062228, LabelColor, false, false);               // Bulk Order Type
            AddFilterList(25, 288, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0);

            AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor, false, false);               // Amount
            AddFilterList(25, 352, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 1);

            AddHtmlLocalized(75, 416, 120, 32, 1062477, (from.UseOwnFilter ? LabelColor : 16927), false, false);                 // Set Book Filter
            AddButton(40, 416, 4005, 4007, 1, GumpButtonType.Reply, 0);

            AddHtmlLocalized(235, 416, 120, 32, 1062478, (from.UseOwnFilter ? 16927 : LabelColor), false, false);                 // Set Your Filter
            AddButton(200, 416, 4005, 4007, 2, GumpButtonType.Reply, 0);

            AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor, false, false);               // Clear Filter
            AddButton(370, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);

            AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor, false, false);               // APPLY
            AddButton(505, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
        }
Example #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_Level = (SecureLevel)reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                m_BookName = reader.ReadString();

                m_Filter = new TamingBOBFilter(reader);

                int count = reader.ReadEncodedInt();

                m_Entries = new ArrayList(count);

                for (int i = 0; i < count; ++i)
                {
                    int v = reader.ReadEncodedInt();

                    switch (v)
                    {
                    case 0: m_Entries.Add(new TamingBOBLargeEntry(reader)); break;

                    case 1: m_Entries.Add(new TamingBOBSmallEntry(reader)); break;
                    }
                }

                break;
            }
            }
        }
Example #8
0
        public bool CheckFilter(int amountMax, bool isLarge)
        {
            AnimalBODModule module = m_From.GetModule(typeof(AnimalBODModule)) as AnimalBODModule ?? new AnimalBODModule(m_From);
            TamingBOBFilter f      = (m_From.UseOwnFilter ? module.TamingBOBFilter : m_Book.Filter);

            //TamingBOBFilter f = ( m_From.UseOwnFilter ? m_From.TamingBOBFilter : m_Book.Filter );

            if (f.IsDefault)
            {
                return(true);
            }

            if (f.Quantity == 1 && amountMax != 10)
            {
                return(false);
            }
            else if (f.Quantity == 2 && amountMax != 15)
            {
                return(false);
            }
            else if (f.Quantity == 3 && amountMax != 20)
            {
                return(false);
            }

            if (f.Type == 1 && isLarge)
            {
                return(false);
            }
            else if (f.Type == 2 && !isLarge)
            {
                return(false);
            }

            return(true);
        }
Example #9
0
        public TamingBOBGump(PlayerMobile from, TamingBulkOrderBook book, int page, ArrayList list) : base(12, 24)
        {
            from.CloseGump(typeof(TamingBOBGump));
            from.CloseGump(typeof(TamingBOBFilterGump));

            m_From = from;
            m_Book = book;
            m_Page = page;

            if (list == null)
            {
                list = new ArrayList(book.Entries.Count);

                for (int i = 0; i < book.Entries.Count; ++i)
                {
                    object obj = book.Entries[i];

                    if (CheckFilter(obj))
                    {
                        list.Add(obj);
                    }
                }
            }

            m_List = list;

            int index = GetIndexForPage(page);
            int count = GetCountForIndex(index);

            int tableIndex = 0;

            PlayerVendor pv = book.RootParent as PlayerVendor;

            bool canDrop  = book.IsChildOf(from.Backpack);
            bool canBuy   = (pv != null);
            bool canPrice = (canDrop || canBuy);

            if (canBuy)
            {
                VendorItem vi = pv.GetVendorItem(book);

                canBuy = (vi != null && !vi.IsForSale);
            }

            int width = 600;

            if (!canPrice)
            {
                width = 516;
            }

            X = (624 - width) / 2;

            AddPage(0);

            AddBackground(10, 10, width, 439, 5054);
            AddImageTiled(18, 20, width - 17, 420, 2624);

            if (canPrice)
            {
                AddImageTiled(573, 64, 24, 352, 200);
                AddImageTiled(493, 64, 78, 352, 1416);
            }

            if (canDrop)
            {
                AddImageTiled(24, 64, 32, 352, 1416);
            }

            AddImageTiled(58, 64, 36, 352, 200);
            AddImageTiled(96, 64, 133, 352, 1416);
            //AddImage( 231, 100, 5549 );
            AddImageTiled(415, 64, 76, 352, 200);

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                object obj = list[i];

                if (!CheckFilter(obj))
                {
                    continue;
                }

                AddImageTiled(24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624);

                if (obj is TamingBOBLargeEntry)
                {
                    tableIndex += ((TamingBOBLargeEntry)obj).Entries.Length;
                }
                else if (obj is TamingBOBSmallEntry)
                {
                    ++tableIndex;
                }
            }

            AddAlphaRegion(18, 20, width - 17, 420);
            AddImage(5, 5, 10460);
            AddImage(width - 15, 5, 10460);
            AddImage(5, 424, 10460);
            AddImage(width - 15, 424, 10460);

            AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
            AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor, false, false);                   // Type
            AddLabel(147, 64, 1149, @"Animal");
            AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor, false, false);                  // Amount

            AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false);               // Set Filter

            TamingBOBFilter f = (from.UseOwnFilter ? from.TamingBOBFilter : book.Filter);

            if (f.IsDefault)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false);                   // Using No Filter
            }
            else if (from.UseOwnFilter)
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false);                   // Using Your Filter
            }
            else
            {
                AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false);                   // Using Book Filter
            }
            AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false);               // EXIT

            if (canDrop)
            {
                AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false);                   // Drop
            }
            if (canPrice)
            {
                AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false);                   // Price

                if (canBuy)
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false);                       // Buy
                }
                else
                {
                    AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false);                       // Set

                    AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
                    AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
                }
            }

            tableIndex = 0;

            if (page > 0)
            {
                AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false);                   // Previous page
            }

            if (GetIndexForPage(page + 1) < list.Count)
            {
                AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false);                   // Next page
            }

            for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i)
            {
                object obj = list[i];

                if (!CheckFilter(obj))
                {
                    continue;
                }

                if (obj is TamingBOBLargeEntry)
                {
                    TamingBOBLargeEntry e = (TamingBOBLargeEntry)obj;

                    int y = 96 + (tableIndex * 32);

                    if (canDrop)
                    {
                        AddButton(35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0);
                    }

                    if (canDrop || (canBuy && e.Price > 0))
                    {
                        AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
                        AddLabel(495, y, 1152, e.Price.ToString());
                    }

                    AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false);                       // Large

                    for (int j = 0; j < e.Entries.Length; ++j)
                    {
                        TamingBOBLargeSubEntry sub = e.Entries[j];

                        string s = sub.AnimalName;

                        int capsbreak = s.IndexOfAny("ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(), 1);

                        if (capsbreak > -1)
                        {
                            string secondhalf = s.Substring(capsbreak);
                            string firsthalf  = s.Substring(0, capsbreak);

                            string newname = firsthalf + " " + secondhalf;

                            AddLabel(103, y, 1149, newname.ToString());
                        }
                        else
                        {
                            AddLabel(103, y, 1149, sub.AnimalName.ToString());
                        }

                        object name = GetMaterialName(sub.Type);

                        if (name is int)
                        {
                            AddHtmlLocalized(316, y, 100, 20, (int)name, LabelColor, false, false);
                        }
                        else if (name is string)
                        {
                            AddLabel(316, y, 1152, (string)name);
                        }

                        AddLabel(421, y, 1152, String.Format("{0} / {1}", sub.AmountCur, e.AmountMax));

                        ++tableIndex;
                        y += 32;
                    }
                }
                else if (obj is TamingBOBSmallEntry)
                {
                    TamingBOBSmallEntry e = (TamingBOBSmallEntry)obj;

                    int y = 96 + (tableIndex++ *32);

                    if (canDrop)
                    {
                        AddButton(35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0);
                    }

                    if (canDrop || (canBuy && e.Price > 0))
                    {
                        AddButton(579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0);
                        AddLabel(495, y, 1152, e.Price.ToString());
                    }

                    AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false);                       // Small

                    string s = e.AnimalName;

                    int capsbreak = s.IndexOfAny("ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(), 1);

                    if (capsbreak > -1)
                    {
                        string secondhalf = s.Substring(capsbreak);
                        string firsthalf  = s.Substring(0, capsbreak);

                        string newname = firsthalf + " " + secondhalf;

                        AddLabel(103, y, 1149, newname.ToString());
                    }
                    else
                    {
                        AddLabel(103, y, 1149, e.AnimalName.ToString());
                    }

                    object name = GetMaterialName(e.Type);

                    if (name is int)
                    {
                        AddHtmlLocalized(316, y, 100, 20, (int)name, LabelColor, false, false);
                    }
                    else if (name is string)
                    {
                        AddLabel(316, y, 1152, (string)name);
                    }

                    AddLabel(421, y, 1152, String.Format("{0} / {1}", e.AmountCur, e.AmountMax));
                }
            }
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			switch ( version )
			{

                case 33:

                    #region SA
                    {
                        m_SSNextSeed = reader.ReadDateTime();
                        m_SSSeedExpire = reader.ReadDateTime();
                        m_SSSeedLocation = reader.ReadPoint3D();
                        m_SSSeedMap = reader.ReadMap();
                        goto case 32;
                    }
                    #endregion

                #region NeoLevelSystem      // Neo's Level System
                case 32:
                {
                    m_LevelExp = reader.ReadLong();
                    m_Exp = reader.ReadLong();
                    m_Level = reader.ReadInt();
                    
                    m_ExpTitle = reader.ReadString();
                    
                    goto case 31;
                }
                #endregion

                case 31: 
                    {
                        m_AutoStabled = reader.ReadStrongMobileList();
                        goto case 30;
                    }
                case 30:
                    {
                        m_FortuneType1 = reader.ReadEncodedInt();
                        if (m_FortuneType1 > 0)
                        {
                            m_FortunePower1 = reader.ReadEncodedInt();
                            m_FortuneType2 = reader.ReadEncodedInt();
                            m_FortunePower2 = reader.ReadEncodedInt();
                            FortuneExpire = reader.ReadDateTime();
                            if (FortuneExpire > DateTime.Now)
                            {
                                ApplyFortune(m_FortuneType1, m_FortunePower1);
                                ApplyFortune(m_FortuneType2, m_FortunePower2);
                                FortuneGump.Told.Add(this);
                            }
                            else
                                m_FortuneType1 = m_FortuneType2 = m_FortunePower1 = m_FortunePower2 = 0;
                        }

                        goto case 29;
                    }
               
				#region Mondain's Legacy
				case 29: 
					{
						m_AnkhNextUse = reader.ReadDateTime();

						goto case 28;
					}
				#endregion

				case 28:
				{
					m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter( reader );

					goto case 27;
					
					}
				case 27:
				{
					m_Bioenginer = reader.ReadBool();
					NextTamingBulkOrder = reader.ReadTimeSpan();
					goto case 26;
				}
				case 26:
				{
					#region Mondain's Legacy
					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();
					m_Peaced = reader.ReadDateTime();

						goto case 25;
					}
				#endregion

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

						// 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 < 32 )
						m_AutoStabled = new List<Mobile>();

                    #region SA
                    if (version < 33)
                    {
                        m_SSNextSeed = m_SSSeedExpire = DateTime.Now;
                        m_SSSeedLocation = Point3D.Zero;
                    }
                    #endregion

					break;
				}
            }

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


            #region NeoLevelSystem      // Neo's Level System

            if (version < 32)
            {
                m_LevelExp = 1000;
                m_Exp = -1000;
                m_Level = 0;

                m_ExpTitle = "TerMur-guest";
            }

            #endregion                  // End of Neo's Level System


			#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 Engines.BulkOrders.BOBFilter();

			if ( m_TamingBOBFilter == null )
				m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter();

			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 ) );
		}
		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_Peaced = DateTime.Now;
			#endregion
		
			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();
			#region FS:ATS Edits
			m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter();
			#endregion

			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:
				{
					m_Bioenginer = reader.ReadBool();
					NextTamingBulkOrder = reader.ReadTimeSpan();
					goto case 28;
				}
				case 28:
				{
					m_ShowRadar = reader.ReadBool();
					goto case 27;
				}
				case 27:
				{
					m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter( reader );
					goto case 26;
				}
				case 26:
				{
					m_City = (CityManagementStone)reader.ReadItem();
					m_CityTitle = reader.ReadString();
					m_ShowCityTitle = reader.ReadBool();
					m_OwesBackTaxes = reader.ReadBool();
					m_BackTaxesAmount = reader.ReadInt();
					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();

						// 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:
				{
					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_TamingBOBFilter == null )
				m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFiler();
			
			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();

			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 ) );
		}
Example #13
0
 //--<< Event System >>--------------------[End 2/2]
 public PlayerModule( Serial serial )
     : base(serial)
 {
     //--<<Custom BODs>>-----------------------[Start 1/1]
     m_BOBFilter = new Engines.BulkOrders.BOBFilter();
     m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter();
     m_TinkBOBFilter = new Engines.BulkOrders.TinkBOBFilter();
     //--<<Custom BODs>>-----------------------[End 1/1]
 }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            AnimalBODModule module = m_From.GetModule(typeof(AnimalBODModule)) as AnimalBODModule ?? new AnimalBODModule(m_From);
            TamingBOBFilter f      = (m_From.UseOwnFilter ? module.TamingBOBFilter : m_Book.Filter);

            int index = info.ButtonID;

            switch (index)
            {
            case 0:                     // Apply
            {
                m_From.SendGump(new TamingBOBGump(m_From, m_Book));

                break;
            }

            case 1:                     // Set Book Filter
            {
                m_From.UseOwnFilter = false;
                m_From.SendGump(new TamingBOBFilterGump(m_From, m_Book));

                break;
            }

            case 2:                     // Set Your Filter
            {
                m_From.UseOwnFilter = true;
                m_From.SendGump(new TamingBOBFilterGump(m_From, m_Book));

                break;
            }

            case 3:                     // Clear Filter
            {
                f.Clear();
                m_From.SendGump(new TamingBOBFilterGump(m_From, m_Book));

                break;
            }

            default:
            {
                index -= 4;

                int type = index % 2;

                //index -= type;

                index /= 4;

                if (type >= 0 && type < m_Filters.Length)
                {
                    int[,] filters = m_Filters[type];

                    if (index >= 0 && index < filters.GetLength(0))
                    {
                        if (filters[index, 0] == 0)
                        {
                            break;
                        }

                        switch (type)
                        {
                        case 0: f.Type = filters[index, 1]; break;

                        case 1: f.Quantity = filters[index, 1]; break;
                        }

                        m_From.SendGump(new TamingBOBFilterGump(m_From, m_Book));
                    }
                }

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

            switch( version )
            {
                    /*case 2:
                    {
                        m_Score = reader.ReadInt();
                        m_Wins = reader.ReadInt();
                        m_Losses = reader.ReadInt();
                        m_GameLevel = reader.ReadInt();
                        m_Banned = reader.ReadBool();
                        Hallucinating = ( bool )reader.ReadBool();
                        goto case 1;
                    }*/
                case 1:
                    {
                        IsMarried = ( bool )reader.ReadBool();
                        m_AllowGayMarriages = ( bool )reader.ReadBool();
                        m_AllowCelestialMarriages = ( bool )reader.ReadBool();
                        m_MarriageTime = reader.ReadDateTime();
                        m_WifeLoc = reader.ReadPoint3D();
                        m_HusbandLoc = reader.ReadPoint3D();
                        m_MaritalStatus = ( MaritalStatus )reader.ReadInt();
                        m_TypeOfMarriage = ( TypeOfMarriage )reader.ReadInt();
                        m_FirstName = ( string )reader.ReadString();
                        m_LastName = ( string )reader.ReadString();
                        m_MaidenName = ( string )reader.ReadString();
                        m_RankPoints = reader.ReadInt();

                        /*GD13_HS_Start_5*/
                        m_HuntMode = ( HuntMode )reader.ReadInt();
                        m_HuntRank = ( HuntRank )reader.ReadInt();
                        m_HuntReward = ( HuntReward )reader.ReadInt();
                        m_Hunting = ( bool )reader.ReadBool();
                        m_EasyKills = reader.ReadInt();
                        m_HardKills = reader.ReadInt();
                        m_ExtremeKills = reader.ReadInt();
                        m_GodKills = reader.ReadInt();
                        /*GD13_HS_End_5*/
                        goto case 0;
                    }

                case 0:
                    {
                        m_Class = ( PlayerClasses )reader.ReadInt();
                        m_Race = ( PlayerRaces )reader.ReadInt();
                        m_Tribe = ( PlayerTribes )reader.ReadInt();
                        m_Rank = ( PlayerRanks )reader.ReadInt();
                        m_RewardsClaimed = reader.ReadInt();
                        m_Level = reader.ReadInt();
                        m_SkillPts = reader.ReadInt();
                        m_Experience = reader.ReadInt();
                        m_Age = reader.ReadInt();
                        m_NextLevelUp = reader.ReadInt();
                        m_Updated = reader.ReadBool();
                        m_Bioenginer = reader.ReadBool();
                        NextSmithBulkOrder = reader.ReadTimeSpan();
                        NextTailorBulkOrder = reader.ReadTimeSpan();
                        NextFletcherBulkOrder = reader.ReadTimeSpan();
                        NextCarpenterBulkOrder = reader.ReadTimeSpan();
                        NextTinkerBulkOrder = reader.ReadTimeSpan();
                        NextTamingBulkOrder = reader.ReadTimeSpan();
                        m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );
                        m_TinkBOBFilter = new Engines.BulkOrders.TinkBOBFilter( reader );
                        m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter( reader );
                        m_Flags = (MyPlayerFlag)reader.ReadInt();
                        break;
                    }
            }

            if ( m_BOBFilter == null )
                m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            if ( m_TinkBOBFilter == null )
                m_TinkBOBFilter = new Engines.BulkOrders.TinkBOBFilter();

            if ( m_TamingBOBFilter == null )
                m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter();
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				{
					m_Level = (SecureLevel)reader.ReadInt();
					goto case 0;
				}
				case 0:
				{
					m_BookName = reader.ReadString();

					m_Filter = new TamingBOBFilter( reader );

					int count = reader.ReadEncodedInt();

					m_Entries = new ArrayList( count );

					for ( int i = 0; i < count; ++i )
					{
						int v = reader.ReadEncodedInt();

						switch ( v )
						{
							case 0: m_Entries.Add( new TamingBOBLargeEntry( reader ) ); break;
							case 1: m_Entries.Add( new TamingBOBSmallEntry( reader ) ); break;
						}
					}

					break;
				}
			}
		}
		public PlayerMobile()
		{
			m_VisList = new List<Mobile>();
			m_PermaFlags = new List<Mobile>();
			m_AntiMacroTable = new Hashtable();

			m_BOBFilter = new Engines.BulkOrders.BOBFilter();
			#region FS:ATS Edits
			m_TamingBOBFilter = new Engines.BulkOrders.TamingBOBFilter();
			#endregion

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