示例#1
0
        public SpecialHairDyeGump( SpecialHairDye dye )
            : base(0, 0)
        {
            m_SpecialHairDye = dye;

            AddPage( 0 );
            AddBackground( 150, 60, 350, 358, 2600 );
            AddBackground( 170, 104, 110, 270, 5100 );
            AddHtmlLocalized( 230, 75, 200, 20, 1011013, false, false ); // Hair Color Selection Menu
            AddHtmlLocalized( 235, 380, 300, 20, 1011014, false, false ); // Dye my hair this color!
            AddButton( 200, 380, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 ); // DYE HAIR

            for ( int i = 0; i < m_Entries.Length; ++i )
            {
                AddLabel( 180, 109 + ( i * 22 ), m_Entries[i].HueStart - 1, m_Entries[i].Name );
                AddButton( 257, 110 + ( i * 22 ), 5224, 5224, 0, GumpButtonType.Page, i + 1 );
            }

            for ( int i = 0; i < m_Entries.Length; ++i )
            {
                SpecialHairDyeEntry e = m_Entries[i];

                AddPage( i + 1 );

                for ( int j = 0; j < e.HueCount; ++j )
                {
                    AddLabel( 328 + ( ( j / 16 ) * 80 ), 102 + ( ( j % 16 ) * 17 ), e.HueStart + j - 1, "*****" );
                    AddRadio( 310 + ( ( j / 16 ) * 80 ), 102 + ( ( j % 16 ) * 17 ), 210, 211, false, ( i * 100 ) + j );
                }
            }
        }
        public SpecialHairDyeGump(SpecialHairDye dye) : base(0, 0)
        {
            m_SpecialHairDye = dye;

            AddPage(0);
            AddBackground(150, 60, 350, 358, 2600);
            AddBackground(170, 104, 110, 270, 5100);
            AddHtmlLocalized(230, 75, 200, 20, 1011013, false, false);                          // Hair Color Selection Menu
            AddHtmlLocalized(235, 380, 300, 20, 1011014, false, false);                         // Dye my hair this color!
            AddButton(200, 380, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);                      // DYE HAIR

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                AddLabel(180, 109 + (i * 22), m_Entries[i].HueStart - 1, m_Entries[i].Name);
                AddButton(257, 110 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, i + 1);
            }

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                SpecialHairDyeEntry e = m_Entries[i];

                AddPage(i + 1);

                for (int j = 0; j < e.HueCount; ++j)
                {
                    AddLabel(328 + ((j / 16) * 80), 102 + ((j % 16) * 17), e.HueStart + j - 1, "*****");
                    AddRadio(310 + ((j / 16) * 80), 102 + ((j % 16) * 17), 210, 211, false, (i * 100) + j);
                }
            }
        }
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (m_Ticket.Deleted || m_From == null || m_From.Backpack == null || !m_Ticket.IsChildOf(sender.Mobile.Backpack))
                {
                    return;
                }

                //int number = 0;

                Item item = null;

                switch (info.ButtonID)
                {
                case 1: item = new StatsBall(); /*number = 1049368;*/ break;        // You have been rewarded for your dedication to Justice!.

                case 2: break;                                                      // item = new BloodPentagramPart(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.

                case 3: item = new PromotionalToken(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.

                case 4: item = new EtherealBeetle(); /*number = 1049368;*/ break;   // You have been rewarded for your dedication to Justice!.

                case 5: item = new SkinToneDeed(); /*number = 1049368;*/ break;     // You have been rewarded for your dedication to Justice!.

                case 6: item = new SpecialHairDye(); /*number = 1049368;*/ break;   // You have been rewarded for your dedication to Justice!.
                }

                if (item != null)
                {
                    m_Ticket.Delete();

                    //m_From.SendLocalizedMessage( number );
                    m_From.AddToBackpack(item);
                }
            }
        public static void CreateReward(EventRewardInfo info, Mobile m)
        {
            if (m == null)
                return;

            Item item = null;
            switch (info.IncrID)
            {
                case 0: item = new MagicSewingKit(1); break;
                case 1:
                    string str = "PottedCactus";
                    int randint = Utility.Random(6);
                    if (randint > 0)
                        str = str + randint.ToString();

                    Type type = ScriptCompiler.FindTypeByName(str);
                    item = (Item)Activator.CreateInstance(type);
                    item.Weight = 100;
                    break;
                case 2:
                    if (Utility.RandomBool())
                        item = new PottedTree();
                    else
                        item = new PottedTree1();
                    break;
                case 3:
                    switch (Utility.Random(3))
                    {
                        case 0: item = new PottedPlant(); break;
                        case 1: item = new PottedPlant1(); break;
                        case 2: item = new PottedPlant2(); break;
                    }
                    break;
                case 4: item = new SpecialHairDye(); break;
                case 5: item = new SpecialBeardDye(); break;
                case 6: item = new TempHorseEthereal(50);
                        item.Hue = Utility.Random(795, 7);
                        break;
                case 7: item = new FireworksWand(99); break;
                case 8: item = new LayeredSashDeed(); break;
                case 9: item = new SkillBall(1); break;
                case 10: item = new SkillBall(5); break;
                case 11: item = new SkillBall(10); break;
                case 12: item = new SkillBall(25); break;
                case 13: item = new SkillBall(50); break;
                case 14: item = new PersonalisationDeed(); break;
                case 15: item = new CrystalPedestalAddonDeed(); break;
                case 16: item = new FountainStoneAddonDeed(); break;
                case 17: item = new FountainSandstoneAddonDeed(); break;
                case 18: item = new SquirrelStatueEastDeed(); break;
                case 19: item = new SquirrelStatueSouthDeed(); break;
                case 20: item = new ArcanistStatueEastDeed(); break;
                case 21: item = new ArcanistStatueSouthDeed(); break;
                case 22: item = new WarriorStatueEastDeed(); break;
                case 23: item = new WarriorStatueSouthDeed(); break;
                case 24: item = new TempRobe(31);
                        ((BaseClothing)item).Attributes.RegenHits = 3;
                        break;
                case 25: item = new TempCloak(31);
                        ((BaseClothing)item).Attributes.RegenHits = 3;
                        break;
                case 26: item = new CampfireDeed(); break;
                case 27: item = new FireDeed(); break;
                case 28: item = new SoulstoneFragment();
                        ((SoulstoneFragment)item).Account = m.Account.Username;
                        break;
                case 29: item = new NameChangeDeed(); break;
                case 30: item = new SexChangeDeed(); break;
                case 31: item = new KillResetDeedAOS(); break;
                case 32: item = new PetBondingDeed(); break;
                case 33: item = new WarHorseBondingDeed(); break;
                case 34: item = new AntiBlessDeed(); break;
                case 35: item = new WhisperingRose(m.Name); break;
                case 36: item = new WeddingDeed(); break;
                case 37: item = new KillBook();
                        ((KillBook)item).BookOwner = m;
                        break;
            }

            if (item != null)
            {
                m.AddToBackpack(item);
                m.SendMessage("The reward item has been placed into your backpack, have fun!");
            }
            else
            {
                m.SendMessage("That item is not available. Please report the bug at the site that will open in your browser.");
                m.LaunchBrowser( "http://bug.casiopia.net/" );
                m.AddToBackpack( new CopperBar(info.Price) );
            }
        }
			public override void OnResponse( NetState sender, RelayInfo info )
			{
				if ( m_Ticket.Deleted || m_From == null || m_From.Backpack == null || !m_Ticket.IsChildOf( sender.Mobile.Backpack ))
					return;

				//int number = 0;

				Item item = null;

				switch ( info.ButtonID )
				{
					case 1: item = new StatsBall(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.
					case 2: break; // item = new BloodPentagramPart(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.
					case 3: item = new PromotionalToken(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.
					case 4: item = new EtherealBeetle(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.
					case 5: item = new SkinToneDeed(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.
					case 6: item = new SpecialHairDye(); /*number = 1049368;*/ break; // You have been rewarded for your dedication to Justice!.
				}

				if ( item != null)
				{
					m_Ticket.Delete();

					//m_From.SendLocalizedMessage( number );
					m_From.AddToBackpack( item );

				}
			}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );

			if ( 0.75 > Utility.RandomDouble() )
			{
				int r = Utility.Random( 100 );
				Item drop = null;

				if ( r < 1 ) drop = new LayerSashDeed();			
				else if	( r < 4 ) drop = new SpecialQuestSandals();
				else if	( r < 6 ) drop = new RareCreamCarpet( PieceType.Centre );
				else if	( r < 8 ) drop = new RareBlueCarpet( PieceType.Centre );
				else if	( r < 10 ) drop = new RareBloodCarpet( PieceType.Centre );
				else if	( r < 12 ) drop = new BasicBlueCarpet( PieceType.Centre );
				else if	( r < 14 ) drop = new BasicPinkCarpet( PieceType.Centre );
				else if	( r < 29 ) drop = new BloodPentagramPart( Utility.Random( 5 ) );
				else if	( r < 30 ) drop = new ClothingBlessDeed();
				else if	( r < 35 ) drop = new MysteriousCloth();
				else if	( r < 40 ) drop = new SpecialHairDye();
				else if	( r < 45 ) drop = new SpecialBeardDye();
				else if	( r < 50 ) drop = new NameChangeDeed();
				else if	( r < 65 ) drop = new SkillTunic();
				else if	( r < 80 ) drop = new TamersCrook();
				else if	( r < 85 ) drop = new HeroShield();
				else if	( r < 88 ) drop = new EvilShield();
				else if	( r < 91 ) drop = new MondainHat();
				else if	( r < 94 ) drop = new PlatinGloves();
				else if	( r < 96 ) drop = new AncientSamuraiHelm();
				else if	( r < 98 ) drop = Utility.RandomBool() ? (Item)(new MirrorEast()) : (Item)(new MirrorNorth());
				else
					drop = Utility.RandomBool() ? (Item)(new BoneBenchEastPart()) : (Item)(new BoneBenchWestPart());

				c.DropItem( drop );
			}
		}
示例#7
0
        private void GiveMagicItems()
        {
            ArrayList toGive = new ArrayList();

            LogHelper Logger = new LogHelper("HarrowerLoot.log", false);


            ArrayList allNonExpiredPMDamageEntries = new ArrayList();
            //New Looting method (Pix: 4/8/06)
            for (int i = 0; i < DamageEntries.Count; i++)
            {
                DamageEntry de = DamageEntries[i] as DamageEntry;
                if (de != null)
                {
                    Logger.Log(LogType.Text, string.Format("DE[{0}]: {1} ({2})", i, de.Damager, de.Damager != null ? de.Damager.Name : ""));
                    if (de.HasExpired)
                    {
                        Logger.Log(LogType.Text, string.Format("DE[{0}]: Expired", i));
                    }
                    else
                    {
                        if (de.Damager != null && !de.Damager.Deleted)
                        {
                            if (de.Damager is BaseCreature)
                            {
                                Logger.Log(LogType.Text, string.Format("DE[{0}]: BaseCreature", i));
                                BaseCreature bc = (BaseCreature)de.Damager;
                                if (bc.ControlMaster != null && !bc.ControlMaster.Deleted)
                                {
                                    //de.Damager = bc.ControlMaster;
                                    DamageEntry cmde = new DamageEntry(bc.ControlMaster);
                                    cmde.DamageGiven = de.DamageGiven;
                                    de = cmde;
                                    Logger.Log(LogType.Text, string.Format("DE[{0}]: New Damager: {1}", i, de.Damager.Name));
                                }
                            }

                            if (de.Damager is PlayerMobile)
                            {
                                Logger.Log(LogType.Text, string.Format("DE[{0}]: PlayerMobile", i));

                                if (de.Damager.Alive)
                                {
                                    Logger.Log(LogType.Text, string.Format("DE[{0}]: PM Alive", i));

                                    bool bFound = false;
                                    for (int j = 0; j < allNonExpiredPMDamageEntries.Count; j++)
                                    {
                                        DamageEntry de2 = (DamageEntry)allNonExpiredPMDamageEntries[j];
                                        if (de2.Damager == de.Damager)
                                        {
                                            Logger.Log(LogType.Text, string.Format("DE[{0}]: PM Found, adding damage", i));

                                            de2.DamageGiven += de.DamageGiven;
                                            bFound = true;
                                            break;
                                        }
                                    }

                                    if (!bFound)
                                    {
                                        Logger.Log(LogType.Text, string.Format("DE[{0}]: PM not found, adding", i));
                                        allNonExpiredPMDamageEntries.Add(de);
                                    }
                                }
                            }

                        }
                    }
                }
            }

            //Remove any PMs that are over 100 tiles away
            ArrayList toRemove = new ArrayList();
            for (int i = 0; i < allNonExpiredPMDamageEntries.Count; i++)
            {
                DamageEntry de = (DamageEntry)allNonExpiredPMDamageEntries[i];
                if (de.Damager.GetDistanceToSqrt(this.Location) > 100)
                {
                    Logger.Log(LogType.Text, string.Format("Removing {0} for being too far away at death", de.Damager.Name));
                    toRemove.Add(allNonExpiredPMDamageEntries[i]);
                }
            }
            for (int i = 0; i < toRemove.Count; i++)
            {
                allNonExpiredPMDamageEntries.Remove(toRemove[i]);
            }

            int topDamage = 0;
            int minDamage = 0;
            for (int i = 0; i < allNonExpiredPMDamageEntries.Count; i++)
            {
                DamageEntry de = (DamageEntry)allNonExpiredPMDamageEntries[i];
                if (de.DamageGiven > topDamage) topDamage = de.DamageGiven;

                Logger.Log(LogType.Text, string.Format("Non-Expired[{0}]: {1} (damage: {2})", i, de.Damager.Name, de.DamageGiven));

            }

            //Now filter on 'enough' damage
            if (HitsMax >= 3000) minDamage = topDamage / 16;
            else if (HitsMax >= 1000) minDamage = topDamage / 8;
            else if (HitsMax >= 200) minDamage = topDamage / 4;
            else minDamage = topDamage / 2;

            Logger.Log(LogType.Text, string.Format("HitsMax: {0}, TopDamage: {1}, MinDamage: {2}", HitsMax, topDamage, minDamage));


            for (int i = 0; i < allNonExpiredPMDamageEntries.Count; i++)
            {
                DamageEntry de = (DamageEntry)allNonExpiredPMDamageEntries[i];
                if (de.DamageGiven >= minDamage)
                {
                    toGive.Add(de.Damager);
                }
            }


            if (toGive.Count == 0)
                return;

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i] = toGive[rand];
                toGive[rand] = hold;
            }

            Logger.Log(LogType.Text, ""); // new line
            Logger.Log(LogType.Text, "Randomized list of players:");
            for (int i = 0; i < toGive.Count; ++i)
            {
                Mobile mob = toGive[i] as Mobile;
                Logger.Log(LogType.Mobile, mob, "alive:" + mob.Alive.ToString());
            }

            Logger.Log(LogType.Text, ""); // new line
            Logger.Log(LogType.Text, "Begin loot distribution: Who/What:");

            // Loop goes until we've generated MaxGifts items.
            for (int i = 0; i < MaxGifts; ++i)
            {
                Item reward = null;
                Mobile m = (Mobile)toGive[i % toGive.Count];

                switch (Utility.Random(10))
                {
                    case 0:			// Power/Vanq Weapon
                    case 1:
                    case 2:	// 3 in 10 chance	
                        {	// 33% chance at best
                            reward = CreateWeapon((0.32 >= Utility.RandomDouble()) ? 5 : 4);
                            break;
                        }
                    case 3:			// Fort/Invul Armor
                    case 4:
                    case 5:	// 3 in 10 chance 
                        {	// 33% chance at best
                            reward = CreateArmor((0.32 >= Utility.RandomDouble()) ? 5 : 4);
                            break;
                        }
                    case 6:		// hair/beard dye
                        {		// 1 in 10 chance
                            if (Utility.RandomBool())
                                reward = new SpecialHairDye();
                            else
                                reward = new SpecialBeardDye();
                            break;
                        }
                    case 7:		// special cloth
                        {		// 1 in 10 chance
                            reward = new UncutCloth(50);
                            if (Utility.RandomBool())
                                // best ore hues (vet rewards) + really dark 'evil cloth'
                                reward.Hue = Utility.RandomList(2213, 2219, 2207, 2425, 1109);
                            else
                                reward.Hue = 0x01;	// black cloth
                            break;
                        }

                    case 8:		// potted plant
                        {		// 1 in 10 chance
                            switch (Utility.Random(11))
                            {
                                default:	// should never happen
                                case 0: reward = new PottedCactus(); break;
                                case 1: reward = new PottedCactus1(); break;
                                case 2: reward = new PottedCactus2(); break;
                                case 3: reward = new PottedCactus3(); break;
                                case 4: reward = new PottedCactus4(); break;
                                case 5: reward = new PottedCactus5(); break;
                                case 6: reward = new PottedPlant(); break;
                                case 7: reward = new PottedPlant1(); break;
                                case 8: reward = new PottedPlant2(); break;
                                case 9: reward = new PottedTree(); break;
                                case 10: reward = new PottedTree1(); break;
                            }
                            break;
                        }

                    default:	// Should never happen
                    /* fall through*/

                    case 9:		// Magic Item Drop
                        {			// 1 in 10 chance
                            reward = Loot.RandomClothingOrJewelry();
                            if (reward != null)
                            {
                                int minLevel = 3;
                                int maxLevel = 3;
                                if (reward is BaseClothing)
                                    ((BaseClothing)reward).SetRandomMagicEffect(minLevel, maxLevel);
                                else if (reward is BaseJewel)
                                    ((BaseJewel)reward).SetRandomMagicEffect(minLevel, maxLevel);
                            }
                            break;
                        }
                }

                if (reward != null)
                {
                    // Drop the new weapon into their backpack and send them a message.
                    m.SendMessage("You have received a special item!");
                    m.AddToBackpack(reward);

                    Logger.Log(LogType.Mobile, m, "alive:" + m.Alive.ToString());
                    Logger.Log(LogType.Item, reward, string.Format("Hue:{0}:Rare:{1}",
                        reward.Hue,
                        (reward is BaseWeapon || reward is BaseArmor || reward is BaseClothing || reward is BaseJewel) ? "False" : "True"));
                }
            }

            // done logging
            Logger.Finish();
        }