Ejemplo n.º 1
0
        public static int GetPriceInfo(SkillName skill, double value)
        {
            PsPriceInfo info = null;
            int         price;

            foreach (PsPriceInfo ppi in PsTable)
            {
                if (ppi.PsName == skill)
                {
                    info = ppi;
                }
            }

            if (info == null)
            {
                return(0);
            }

            if (value == 120.0)
            {
                price = info.Price120;
                price = (int)(price - price * info.Discount / 100);
                price = (int)(price / 1000) * 1000;
            }
            else if (value == 115.0)
            {
                price = (info.Price115 > 2000 ? info.Price115 : (int)(info.Price120 / 2)); // Price115 =  Price120 / 2
                price = (int)(price - price * info.Discount / 100);                        // to handle discount
                price = (int)(price / 1000) * 1000;                                        // to truncate last 3 digits to 0s
            }
            else if (value == 110)
            {
                price = (info.Price115 > 2000 ? info.Price110 : (int)(info.Price120 / 6)); // Price110 = Price120 / 6
                price = (int)(price - price * info.Discount / 100);                        // to handle discount
                price = (int)(price / 1000) * 1000;                                        // to truncate last 3 digits to 0s
            }
            else
            {
                price = 20000;                 // 105 PS
            }

            return(price);
        }
Ejemplo n.º 2
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			// stat scroll prices
			PsPriceInfo.Price25 = reader.ReadInt();
			PsPriceInfo.Price20 = reader.ReadInt();
			PsPriceInfo.Price15 = reader.ReadInt();
			PsPriceInfo.Price10 = reader.ReadInt();
			PsPriceInfo.Price5 = reader.ReadInt();

			int length = reader.ReadInt();
			m_Table = new PsPriceInfo[length];

			for ( int i = 0; i < length; i++ )
			{
				m_Table[i] = new PsPriceInfo( i, (SkillName)reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadBool() );
			}
			
			PsPriceInfo.PsTable = m_Table;
		}
Ejemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            // stat scroll prices
            PsPriceInfo.Price25 = reader.ReadInt();
            PsPriceInfo.Price20 = reader.ReadInt();
            PsPriceInfo.Price15 = reader.ReadInt();
            PsPriceInfo.Price10 = reader.ReadInt();
            PsPriceInfo.Price5  = reader.ReadInt();

            int length = reader.ReadInt();

            m_Table = new PsPriceInfo[length];

            for (int i = 0; i < length; i++)
            {
                m_Table[i] = new PsPriceInfo(i, (SkillName)reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt(), reader.ReadBool());
            }

            PsPriceInfo.PsTable = m_Table;
        }
Ejemplo n.º 4
0
		public static void UpdatePriceInfo( int skill, PsPriceInfo info )
		{
			m_PsTable[skill] = info;
		}
Ejemplo n.º 5
0
		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile from = state.Mobile;

//			from.SendMessage( "I received! {0}", info.ButtonID ); // for debug

			switch ( info.ButtonID )
			{
				case 0: // Closed
				{
					if ( m_IsPs )
						from.SendGump( new PSPriceGump( m_Page ) );

					break;
				}

				case 1:
				{
					TextRelay text = info.GetTextEntry( 0 );

					int value;
					bool parsed = Int32.TryParse( text.Text, out value );

					if ( parsed )
					{
						value = ( value > 100000000 ? 100000000 : value );
						PsPriceInfo fo = PsPriceInfo.PsTable[m_Skill] as PsPriceInfo;
						PsPriceInfo ps;

						switch ( m_Button )
						{
							case 0: { ps = new PsPriceInfo( m_Skill, (SkillName)m_Skill, ( value > 20000 ) ? value : 20000, fo.Price115, fo.Price110, fo.Discount, fo.Enabled ); break; }
							case 1: { ps = new PsPriceInfo( m_Skill, (SkillName)m_Skill, fo.Price120, ( value > 1000 ) ? value : fo.Price115, fo.Price110, fo.Discount, fo.Enabled ); break; }
							case 2: { ps = new PsPriceInfo( m_Skill, (SkillName)m_Skill, fo.Price120, fo.Price115, ( value > 1000 ) ? value : fo.Price110, fo.Discount, fo.Enabled ); break; }
							default: { ps = new PsPriceInfo( m_Skill, (SkillName)m_Skill, fo.Price120, fo.Price115, fo.Price110, ( value >=0 && value < 100 ) ? value : fo.Discount, fo.Enabled ); break; }
						}

						PsPriceInfo.UpdatePriceInfo( m_Skill, ps );
					}

					from.SendGump( new PSPriceGump( m_Page ) );
					break;
				}

				default:
				{
					if ( info.ButtonID == 2 || info.ButtonID == 3 )
					{ 
						bool bval = false;

						if ( info.ButtonID == 2 )
							bval = true;

						PsPriceInfo fo = PsPriceInfo.PsTable[m_Skill] as PsPriceInfo;
						if ( fo.Enabled != bval )
						{
							PsPriceInfo ps = new PsPriceInfo( m_Skill, (SkillName)m_Skill, fo.Price120, fo.Price115, fo.Price110, fo.Discount, bval );
							PsPriceInfo.UpdatePriceInfo( m_Skill, ps );
						}

						from.SendGump( new PSPriceGump( m_Page ) );
					}
					else if ( info.ButtonID == 11 ) // StatScrolls
					{
						TextRelay text = info.GetTextEntry( 0 );

						int value;
						bool parsed = Int32.TryParse( text.Text, out value );
	
						if ( parsed )
						{
							value = ( value > 100000000 ? 100000000 : value );

							switch ( m_Button )
							{
								case 10: PsPriceInfo.Price25 = value; break;
								case 11: PsPriceInfo.Price20 = value; break;
								case 12: PsPriceInfo.Price15 = value; break;
								case 13: PsPriceInfo.Price10 = value; break;
								case 14: PsPriceInfo.Price5 = value; break;
							}
						}

						from.SendGump( new SetPsPriceGump( m_Skill, false, m_Page ) );
					}

					break;
				}
			}
		}
Ejemplo n.º 6
0
 public static void UpdatePriceInfo(int skill, PsPriceInfo info)
 {
     m_PsTable[skill] = info;
 }
Ejemplo n.º 7
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

//			from.SendMessage( "I received! {0}", info.ButtonID ); // for debug

            switch (info.ButtonID)
            {
            case 0:                     // Closed
            {
                if (m_IsPs)
                {
                    from.SendGump(new PSPriceGump(m_Page));
                }

                break;
            }

            case 1:
            {
                TextRelay text = info.GetTextEntry(0);

                int  value;
                bool parsed = Int32.TryParse(text.Text, out value);

                if (parsed)
                {
                    value = (value > 100000000 ? 100000000 : value);
                    PsPriceInfo fo = PsPriceInfo.PsTable[m_Skill] as PsPriceInfo;
                    PsPriceInfo ps;

                    switch (m_Button)
                    {
                    case 0: { ps = new PsPriceInfo(m_Skill, (SkillName)m_Skill, (value > 20000) ? value : 20000, fo.Price115, fo.Price110, fo.Discount, fo.Enabled); break; }

                    case 1: { ps = new PsPriceInfo(m_Skill, (SkillName)m_Skill, fo.Price120, (value > 1000) ? value : fo.Price115, fo.Price110, fo.Discount, fo.Enabled); break; }

                    case 2: { ps = new PsPriceInfo(m_Skill, (SkillName)m_Skill, fo.Price120, fo.Price115, (value > 1000) ? value : fo.Price110, fo.Discount, fo.Enabled); break; }

                    default: { ps = new PsPriceInfo(m_Skill, (SkillName)m_Skill, fo.Price120, fo.Price115, fo.Price110, (value >= 0 && value < 100) ? value : fo.Discount, fo.Enabled); break; }
                    }

                    PsPriceInfo.UpdatePriceInfo(m_Skill, ps);
                }

                from.SendGump(new PSPriceGump(m_Page));
                break;
            }

            default:
            {
                if (info.ButtonID == 2 || info.ButtonID == 3)
                {
                    bool bval = false;

                    if (info.ButtonID == 2)
                    {
                        bval = true;
                    }

                    PsPriceInfo fo = PsPriceInfo.PsTable[m_Skill] as PsPriceInfo;
                    if (fo.Enabled != bval)
                    {
                        PsPriceInfo ps = new PsPriceInfo(m_Skill, (SkillName)m_Skill, fo.Price120, fo.Price115, fo.Price110, fo.Discount, bval);
                        PsPriceInfo.UpdatePriceInfo(m_Skill, ps);
                    }

                    from.SendGump(new PSPriceGump(m_Page));
                }
                else if (info.ButtonID == 11)                           // StatScrolls
                {
                    TextRelay text = info.GetTextEntry(0);

                    int  value;
                    bool parsed = Int32.TryParse(text.Text, out value);

                    if (parsed)
                    {
                        value = (value > 100000000 ? 100000000 : value);

                        switch (m_Button)
                        {
                        case 10: PsPriceInfo.Price25 = value; break;

                        case 11: PsPriceInfo.Price20 = value; break;

                        case 12: PsPriceInfo.Price15 = value; break;

                        case 13: PsPriceInfo.Price10 = value; break;

                        case 14: PsPriceInfo.Price5 = value; break;
                        }
                    }

                    from.SendGump(new SetPsPriceGump(m_Skill, false, m_Page));
                }

                break;
            }
            }
        }
Ejemplo n.º 8
0
        public PsPriceEntryGump(int skill, int button, int page) : base(GumpOffsetX, GumpOffsetY)
        {
            m_Skill  = skill;
            m_Button = button;
            m_Page   = page;
            string title       = "";
            string initialText = "";
            bool   setbool     = false;
            int    bt          = 0;

            if (button < 10)               // PowerScroll
            {
                m_IsPs = true;
                PsPriceInfo info = PsPriceInfo.PsTable[skill] as PsPriceInfo;
                title = ((SkillName)skill).ToString();

                switch (button)
                {
                case 0: { title = title + " Price120"; initialText = info.Price120.ToString(); break; }

                case 1: { title = title + " Price115"; initialText = info.Price115.ToString(); break; }

                case 2: { title = title + " Price110"; initialText = info.Price110.ToString(); break; }

                case 3: { title = title + " Discount"; initialText = info.Discount.ToString(); break; }

                default: { title = title + " Enabled = " + info.Enabled.ToString(); setbool = true; break; }
                }
            }
            else             // StatScroll
            {
                m_IsPs = false;
                bt     = 10;

                switch (button)
                {
                case 10: title = "Stat+25"; initialText = PsPriceInfo.StatPriceInfo(250).ToString(); break;

                case 11: title = "Stat+20"; initialText = PsPriceInfo.StatPriceInfo(245).ToString(); break;

                case 12: title = "Stat+15"; initialText = PsPriceInfo.StatPriceInfo(240).ToString(); break;

                case 13: title = "Stat+10"; initialText = PsPriceInfo.StatPriceInfo(235).ToString(); break;

                default: title = "Stat+5"; initialText = PsPriceInfo.StatPriceInfo(230).ToString(); break;
                }
            }

            if (!setbool)
            {
                AddPage(0);

                AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
                AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);

                int x = BorderSize + OffsetSize;
                int y = BorderSize + OffsetSize;

                AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
                AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, title);
                x += EntryWidth + OffsetSize;

                if (SetGumpID != 0)
                {
                    AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
                }

                x  = BorderSize + OffsetSize;
                y += EntryHeight + OffsetSize;

                AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
                AddTextEntry(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, 0, initialText);
                x += EntryWidth + OffsetSize;

                if (SetGumpID != 0)
                {
                    AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
                }

                AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1 + bt, GumpButtonType.Reply, 0);
            }
            else
            {
                AddPage(0);

                int totalHeight = OffsetSize + (4 * (EntryHeight + OffsetSize));
                int backHeight  = BorderSize + totalHeight + BorderSize;

                AddBackground(0, 0, BackWidth, backHeight, BackGumpID);
                AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);

                int x = BorderSize + OffsetSize;
                int y = BorderSize + OffsetSize;

                int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4);

                AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);

                x += PrevWidth + OffsetSize;
                AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);

                x += emptyWidth + OffsetSize;
                AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);


                AddRect(0, title, 0);

                for (int i = 0; i < 2; ++i)
                {
                    AddRect(i + 1, m_Names[i], i + 2);
                }
            }
        }
Ejemplo n.º 9
0
        public SetPsPriceGump(int skill, bool isPs, int page) : base(GumpOffsetX, GumpOffsetY)
        {
            string name = "";
            string sval = "";

            m_Skill = skill;
            m_IsPs  = isPs;
            m_Page  = page;
            int bt = 10;

            AddPage(0);

            AddBackground(0, 0, BackWidth, BorderSize + TotalHeight + BorderSize, BackGumpID);
            AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);

            int x = BorderSize + OffsetSize;
            int y = BorderSize + OffsetSize;

            AddLabelCropped(x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, HeaderTextHue, isPs ? ((SkillName)skill).ToString() : "StatCapScroll");

            for (int i = 0; i < 5; i++)
            {
                x  = BorderSize + OffsetSize;
                y += EntryHeight + OffsetSize;

                if (isPs)
                {
                    PsPriceInfo info = PsPriceInfo.PsTable[skill] as PsPriceInfo;

                    switch (i)
                    {
                    case 0: name = "Price120"; sval = info.Price120.ToString(); break;

                    case 1: name = "Price115"; sval = info.Price115.ToString(); break;

                    case 2: name = "Price110"; sval = info.Price110.ToString(); break;

                    case 3: name = "Discount"; sval = info.Discount.ToString(); break;

                    case 4: name = "Enabled"; sval = info.Enabled.ToString(); break;
                    }
                }
                else
                {
                    bt = 20;

                    switch (i)
                    {
                    case 0: name = "Stat+25"; sval = PsPriceInfo.StatPriceInfo(250).ToString(); break;

                    case 1: name = "Stat+20"; sval = PsPriceInfo.StatPriceInfo(245).ToString(); break;

                    case 2: name = "Stat+15"; sval = PsPriceInfo.StatPriceInfo(240).ToString(); break;

                    case 3: name = "Stat+10"; sval = PsPriceInfo.StatPriceInfo(235).ToString(); break;

                    case 4: name = "Stat+5"; sval = PsPriceInfo.StatPriceInfo(230).ToString(); break;
                    }
                }


                AddImageTiled(x, y, NameWidth, EntryHeight, EntryGumpID);
                AddLabelCropped(x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, TextHue, name);
                x += NameWidth + OffsetSize;
                AddImageTiled(x, y, ValueWidth, EntryHeight, EntryGumpID);
                AddLabelCropped(x + TextOffsetX, y, ValueWidth - TextOffsetX, EntryHeight, TextHue, sval);
                x += ValueWidth + OffsetSize;

                if (SetGumpID != 0)
                {
                    AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
                }

                AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + bt, GumpButtonType.Reply, 0);
            }
        }