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) );
            }
        }
Exemple #2
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (info.ButtonID == 0 || m_Stone.IsEmpty)
                {
                    return;
                }

                Mobile from = sender.Mobile;

                if (!m_Stone.CheckUse(from))
                {
                    return;
                }

                if (info.ButtonID == 1)                   // Remove skill points
                {
                    from.SendGump(new ConfirmRemovalGump(m_Stone));
                    return;
                }

                SkillName skill      = m_Stone.Skill;
                double    skillValue = m_Stone.SkillValue;
                Skill     fromSkill  = from.Skills[m_Stone.Skill];

                /* If we have, say, 88.4 in our skill and the stone holds 100, we need
                 * 11.6 free points. Also, if we're below our skillcap by, say, 8.2 points,
                 * we only need 11.6 - 8.2 = 3.4 points.
                 */
                int requiredAmount = (int)(skillValue * 10) - fromSkill.BaseFixedPoint - (from.SkillsCap - from.SkillsTotal);

                bool cannotAbsorb = false;

                if (fromSkill.Lock != SkillLock.Up)
                {
                    cannotAbsorb = true;
                }
                else if (requiredAmount > 0)
                {
                    int available = 0;

                    for (int i = 0; i < from.Skills.Length; ++i)
                    {
                        if (from.Skills[i].Lock != SkillLock.Down)
                        {
                            continue;
                        }

                        available += from.Skills[i].BaseFixedPoint;
                    }

                    if (requiredAmount > available)
                    {
                        cannotAbsorb = true;
                    }
                }

                if (cannotAbsorb)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /* You cannot absorb the selected skill from the Soulstone at this time. The selected
                     * skill may be locked or set to lower in your skill menu. You may also be at your
                     * total skill cap.  Click on "Skills" in your paperdoll menu to check your
                     * raise/locked/lower settings and your total skills.  Make any needed adjustments,
                     * then click "Continue". If you do not wish to transfer the selected skill at this
                     * time, click "Cancel".
                     */

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1070716));
                    return;
                }

                if (skillValue > fromSkill.Cap)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /* The amount of skill stored in this stone exceeds your individual skill cap for
                     * that skill.  In order to retrieve the skill points stored in this stone, you must
                     * obtain a Power Scroll of the appropriate type and level in order to increase your
                     * skill cap.  You cannot currently retrieve the skill points stored in this stone.
                     */

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1070715));
                    return;
                }

                if (fromSkill.Base >= skillValue)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /* You cannot transfer the selected skill to the Soulstone at this time. The selected
                     * skill has a skill level higher than what is stored in the Soulstone.
                     */

                    // Wrong message?!

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1070802));
                    return;
                }

                #region Scroll of Alacrity
                PlayerMobile pm = from as PlayerMobile;
                if (pm.AcceleratedStart > DateTime.Now)
                {
                    // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER>

                    /*You may not use a soulstone while your character is under the effects of a Scroll of Alacrity.*/

                    // Wrong message?!

                    from.SendGump(new ErrorGump(m_Stone, 1070717, 1078115));
                    return;
                }
                #endregion

                if (requiredAmount > 0)
                {
                    for (int i = 0; i < from.Skills.Length; ++i)
                    {
                        if (from.Skills[i].Lock != SkillLock.Down)
                        {
                            continue;
                        }

                        if (requiredAmount >= from.Skills[i].BaseFixedPoint)
                        {
                            requiredAmount     -= from.Skills[i].BaseFixedPoint;
                            from.Skills[i].Base = 0.0;
                        }
                        else
                        {
                            from.Skills[i].BaseFixedPoint -= requiredAmount;
                            break;
                        }
                    }
                }

                fromSkill.Base     = skillValue;
                m_Stone.SkillValue = 0.0;

                from.SendLocalizedMessage(1070713);                   // You have successfully absorbed the Soulstone's skill points.

                m_Stone.LastUserName = from.Name;

                Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0, 0, 5060, 0);
                Effects.PlaySound(from.Location, from.Map, 0x243);

                Effects.SendMovingParticles(new Entity(Server.Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);

                if (m_Stone is SoulstoneFragment)
                {
                    SoulstoneFragment frag = m_Stone as SoulstoneFragment;

                    if (--frag.UsesRemaining <= 0)
                    {
                        from.SendLocalizedMessage(1070974);                           // You have used up your soulstone fragment.
                    }
                }
            }