Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                var pm = from as PlayerMobile;

                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is AddonComponent)
                {
                    var addoncomponent = (AddonComponent)targeted;

                    if (addoncomponent is MagicVinesComponent || addoncomponent is StoneWallComponent ||
                        addoncomponent is DungeonWallComponent)
                    {
                        var Xs = addoncomponent.X;

                        if (addoncomponent is MagicVinesComponent)
                        {
                            Xs += -1;
                        }

                        if (addoncomponent.Addon is StoneWallAndVineAddon)
                        {
                            wall        = new SecretStoneWallNS();
                            wallandvine = new StoneWallAndVineAddon();
                        }
                        else if (addoncomponent.Addon is DungeonWallAndVineAddon)
                        {
                            wall        = new SecretDungeonWallNS();
                            wallandvine = new DungeonWallAndVineAddon();
                        }

                        wall.MoveToWorld(new Point3D(Xs, addoncomponent.Y, addoncomponent.Z), addoncomponent.Map);

                        addoncomponent.Delete();

                        m_Item.Consume();

                        wall.PublicOverheadMessage(0, 1358, 1111662);
                        // The acid quickly burns through the writhing wallvines, revealing the strange wall.

                        Timer.DelayCall(TimeSpan.FromSeconds(15.0), delegate
                        {
                            this.wallandvine.MoveToWorld(this.wall.Location, this.wall.Map);

                            this.wall.Delete();
                            this.wallandvine.PublicOverheadMessage(0, 1358, 1111663);
                            // The vines recover from the acid and, spreading like tentacles, reclaim their grip over the wall.
                        });
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1111657); // The acid swiftly burn through it.
                    m_Item.Consume();
                }
            }
Ejemplo n.º 2
0
        public virtual void Recharge(Mobile from, Mobile guildmaster)
        {
            if (from.Backpack != null)
            {
                Item diamond = from.Backpack.FindItemByType(typeof(Diamond));

                if (guildmaster != null)
                {
                    if (m_UsesRemaining <= 0)
                    {
                        if (diamond != null && Banker.Withdraw(from, 100000))
                        {
                            diamond.Consume();
                            UsesRemaining = 10;
                            guildmaster.Say(1076165);                               // Your weapon engraver should be good as new!
                        }
                        else
                        {
                            guildmaster.Say("You need a 100,000 gold and a diamond to recharge the weapon engraver.");
                        }
                    }
                    else
                    {
                        guildmaster.Say(1076164);                           // I can only help with this if you are carrying an engraving tool that needs repair.
                    }
                }
                else
                {
                    if (from.Skills.Tinkering.Value == 0)
                    {
                        from.SendLocalizedMessage(1076179);                           // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
                    }
                    else if (from.Skills.Tinkering.Value < 75.0)
                    {
                        from.SendLocalizedMessage(1076178);                           // Your tinkering skill is too low to fix this yourself.  An NPC tinkerer can help you repair this for a fee.
                    }
                    else if (diamond != null)
                    {
                        diamond.Consume();

                        if (Utility.RandomDouble() < from.Skills.Tinkering.Value / 100)
                        {
                            UsesRemaining = 1;
                            from.SendLocalizedMessage(1076165);                               // Your weapon engraver should be good as new! ?????
                        }
                        else
                        {
                            from.SendLocalizedMessage(1076175);                               // You cracked the diamond attempting to fix the weapon engraver.
                        }
                    }
                    else
                    {
                        from.SendMessage("You do not posess the required diamond.");                         // You do not have a blue diamond needed to recharge the engraving tool.
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void Recharge(Mobile from, Mobile guildmaster)
        {
            if (from.Backpack != null)
            {
                Item diamond = from.Backpack.FindItemByType(typeof(BlueDiamond));

                if (guildmaster != null)
                {
                    if (m_UsesRemaining <= 0)
                    {
                        if (diamond != null && Banker.Withdraw(from, 100000))
                        {
                            diamond.Consume();
                            UsesRemaining = 10;
                            guildmaster.Say(1076165); // Your weapon engraver should be good as new!
                        }
                        else
                        {
                            guildmaster.Say(1076167); // You need a 100,000 gold and a blue diamond to recharge the weapon engraver.
                        }
                    }
                    else
                    {
                        guildmaster.Say(1076164); // I can only help with this if you are carrying an engraving tool that needs repair.
                    }
                }
                else
                {
                    if (CheckSkill(from))
                    {
                        if (diamond != null)
                        {
                            diamond.Consume();

                            if (Utility.RandomDouble() < from.Skills[SkillName.Tinkering].Value / 100)
                            {
                                UsesRemaining = 10;
                                from.SendLocalizedMessage(1076165); // Your engraver should be good as new!
                            }
                            else
                            {
                                from.SendLocalizedMessage(1076175); // You cracked the diamond attempting to fix the engraver.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1076166); // You do not have a blue diamond needed to recharge the engraving tool.
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
            public override void OnResponse(Mobile from, string text)
            {
                if (m_Item == null || m_Item.Deleted)
                {
                    return;
                }

                if (m_Item.IsChildOf(from.Backpack))
                {
                    string title = Utility.FixHtml(text.Trim());

                    if (title.Length > 20)
                    {
                        from.SendLocalizedMessage(501178); // That title is too long.
                    }
                    else if (!BaseGuildGump.CheckProfanity(title))
                    {
                        from.SendLocalizedMessage(501179); // That title is disallowed.
                    }
                    else
                    {
                        from.Title = title;
                        from.SendAsciiMessage("Your title has been changed!");
                        Effects.SendLocationEffect(from.Location, from.Map, 14170, 20, 1944, 0);
                        from.PlaySound(0x064C);
                        m_Item.Consume();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
                }
            }
Ejemplo n.º 5
0
        public int ConsumeTotal(Type[] types, int[] amounts, bool recurse, OnItemConsumed callback)
        {
            if (types.Length != amounts.Length)
            {
                throw new ArgumentException();
            }

            Item[][] items  = new Item[types.Length][];
            int[]    totals = new int[types.Length];

            for (int i = 0; i < types.Length; ++i)
            {
                items[i] = FindItemsByType(types[i], recurse);

                for (int j = 0; j < items[i].Length; ++j)
                {
                    totals[i] += items[i][j].Amount;
                }

                if (totals[i] < amounts[i])
                {
                    return(i);
                }
            }

            for (int i = 0; i < types.Length; ++i)
            {
                int need = amounts[i];

                for (int j = 0; j < items[i].Length; ++j)
                {
                    Item item = items[i][j];

                    int theirAmount = item.Amount;

                    if (theirAmount < need)
                    {
                        if (callback != null)
                        {
                            callback(item, theirAmount);
                        }

                        item.Delete();
                        need -= theirAmount;
                    }
                    else
                    {
                        if (callback != null)
                        {
                            callback(item, need);
                        }

                        item.Consume(need);
                        break;
                    }
                }
            }

            return(-1);
        }
Ejemplo n.º 6
0
        private static int ConsumeTotal(Container pack, int amount, bool recurse)
        {
            Item[] scrolls      = pack.FindItemsByType(typeof(MarkScroll), recurse);
            int    foundScrolls = 0;
            int    foundRunes   = 0;

            for (int j = 0; j < scrolls.Length; ++j)
            {
                foundScrolls += scrolls[j].Amount;
            }

            if (foundScrolls < amount)
            {
                return(amount - foundScrolls);
            }

            Item[]      runes         = pack.FindItemsByType(typeof(RecallRune), recurse);
            List <Item> unmarkedRunes = new List <Item>();

            for (int j = 0; j < runes.Length; ++j)
            {
                if (!((RecallRune)runes[j]).Marked)
                {
                    foundRunes += runes[j].Amount;
                    unmarkedRunes.Add(runes[j]);
                }
            }

            if (foundRunes < amount)
            {
                return(amount - foundRunes);
            }

            int need = amount;

            for (int j = 0; j < amount; ++j)
            {
                Item item = scrolls[j];

                int theirAmount = item.Amount;

                if (theirAmount < need)
                {
                    item.Delete();
                    need -= theirAmount;
                }
                else
                {
                    item.Consume(need);
                    break;
                }
            }

            for (int j = 0; j < amount; ++j)
            {
                unmarkedRunes[j].Delete();
            }

            return(-1);
        }
Ejemplo n.º 7
0
            public override void OnClick()
            {
                if (!Owner.From.CheckAlive())
                {
                    return;
                }

                if (m_Item.m_CurCharges >= 0 && m_Item.m_CurCharges <= 9)
                {
                    Container pack = m_Mobile.Backpack;
                    Item      a    = pack.FindItemByType(typeof(Feather));

                    if (a != null)
                    {
                        m_Item.Charge();
                        m_Mobile.SendMessage("You add a charge to this tool");
                        a.Consume(1);
                    }

                    else
                    {
                        m_Mobile.SendMessage("You need Feathers in pack to recharge");
                    }
                }

                else
                {
                    m_Mobile.SendMessage("This is already fully charged");
                }
            }
Ejemplo n.º 8
0
        private void ConsumeNeeded(ref int need, Item item, OnItemConsumed callback)
        {
            int theirAmount = item.Amount;

            if (theirAmount < need)
            {
                if (callback != null)
                {
                    callback(item, theirAmount);
                }

                item.Delete();
                need -= theirAmount;
            }
            else
            {
                if (callback != null)
                {
                    callback(item, need);
                }

                item.Consume(need);
                need = 0;
            }
        }
Ejemplo n.º 9
0
        private static void FinishThrow(object state)
        {
            object[] states = (object[])state;

            Mobile from = (Mobile)states[0];
            Mobile to   = (Mobile)states[1];
            Item   bola = (Item)states[2];

            if (!from.Alive)
            {
                return;
            }
            if (!bola.IsChildOf(from.Backpack))
            {
                bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
            }
            else if (!from.InRange(to, 15) || !from.InLOS(to) || !from.CanSee(to))
            {
                from.PrivateOverheadMessage(MessageType.Regular, 946, 1042060, from.NetState); // You cannot see that target!
            }
            else if (!to.Mounted && !to.Flying && !AnimalForm.UnderTransformation(to))
            {
                to.PrivateOverheadMessage(MessageType.Regular, 946, 1049628, from.NetState); // You have no reason to throw a bola at that.
            }
            else
            {
                bola.Consume();

                from.Direction = from.GetDirectionTo(to);
                from.Animate(AnimationType.Attack, 4);
                from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                new Bola().MoveToWorld(to.Location, to.Map);

                if (to is Neira || to is ChaosDragoon || to is ChaosDragoonElite)
                {
                    to.PrivateOverheadMessage(MessageType.Regular, 946, 1042047, from.NetState); // You fail to knock the rider from its mount.
                }
                else
                {
                    if (CheckHit(to, from))
                    {
                        to.Damage(Utility.RandomMinMax(10, 20), from);

                        if (from.Flying)
                        {
                            to.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113590, from.Name); // You have been grounded by ~1_NAME~!
                        }
                        else
                        {
                            to.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1049623, from.Name); // You have been knocked off of your mount by ~1_NAME~!
                        }
                        BaseMount.Dismount(to);

                        BaseMount.SetMountPrevention(to, BlockMountType.Dazed, TimeSpan.FromSeconds(10.0));
                    }
                }
            }
        }
Ejemplo n.º 10
0
        //This method added for [bandself command to call.
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null)
            {
                m_Bandage.Consume();
            }
        }
Ejemplo n.º 11
0
        // Scriptiz : ajout d'une méthode pour la commande .bandself
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null && !Engines.ConPVP.DuelContext.IsFreeConsume(from))
            {
                m_Bandage.Consume();
            }
        }
Ejemplo n.º 12
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target == from)
                {
                    from.SendLocalizedMessage(1005576);                       // You can't throw this at yourself.
                }
                else if (m_Snow == null || m_Snow.Deleted)
                {
                    from.SendMessage("You can't find the snowball!");
                }
                else if (target is Mobile)
                {
                    Mobile    targ = (Mobile)target;
                    Container pack = targ.Backpack;

                    if (pack != null && pack.FindItemByType(new Type[] { typeof(SnowPile), typeof(PileOfGlacialSnow) }) != null)
                    {
                        if (from.BeginAction(typeof(SnowPile)))
                        {
                            new InternalTimer(from).Start();

                            from.PlaySound(0x145);

                            from.Animate(9, 1, 1, true, false, 0);

                            targ.SendLocalizedMessage(1010572); // You have just been hit by a snowball!
                            from.SendLocalizedMessage(1010573); // You throw the snowball and hit the target!

                            Effects.SendMovingEffect(from, targ, 0x36E4, 7, 0, false, true, 0x480, 0);

                            if (m_UseCharges)
                            {
                                if (m_Snow is SnowPile && --((SnowPile)m_Snow).Charges <= 0)
                                {
                                    m_Snow.Consume();
                                    from.SendMessage("You run out of snow!");
                                }
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1005574); // The snow is not ready to be packed yet.  Keep trying.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1005577); // You can only throw a snowball at something that can throw one back.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1005577); // You can only throw a snowball at something that can throw one back.
                }
            }
Ejemplo n.º 13
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            if (item is BasePotion)
            {
                BasePotion pot    = (BasePotion)item;
                int        toHold = Math.Min(100 - m_Held, pot.Amount);

                if (toHold <= 0)
                {
                    from.SendLocalizedMessage(502233);                       // The keg will not hold any more!
                }
                else if (m_Held > 0 && pot.PotionEffect != m_Type)
                {
                    from.SendLocalizedMessage(502236);                       // You decide that it would be a bad idea to mix different types of potions.
                }
                else
                {
                    if (GiveBottle(from, toHold))
                    {
                        if (m_Held == 0)
                        {
                            m_Type = pot.PotionEffect;
                        }

                        Held += toHold;

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237);                           // You place the empty bottle in your backpack.

                        item.Consume(toHold);

                        if (!item.Deleted)
                        {
                            item.Bounce(from);
                        }

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502238);                           // You don't have room for the empty bottle in your backpack.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(502232);                   // The keg is not designed to hold that type of object.
            }
            return(false);
        }
Ejemplo n.º 14
0
        public bool ConsumeTotal(Type type, int amount, bool recurse, OnItemConsumed callback)
        {
            Item[] items = FindItemsByType(type, recurse);

            // First pass, compute total
            int total = 0;

            for (int i = 0; i < items.Length; ++i)
            {
                total += items[i].Amount;
            }

            if (total >= amount)
            {
                // We've enough, so consume it

                int need = amount;

                for (int i = 0; i < items.Length; ++i)
                {
                    Item item = items[i];

                    int theirAmount = item.Amount;

                    if (theirAmount < need)
                    {
                        if (callback != null)
                        {
                            callback(item, theirAmount);
                        }

                        item.Delete();
                        need -= theirAmount;
                    }
                    else
                    {
                        if (callback != null)
                        {
                            callback(item, need);
                        }

                        item.Consume(need);

                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 15
0
        // This method added for [bandself command to call.
        public static void BandSelfCommandCall(Mobile from, Item m_Bandage)
        {
            if (from.Blessed)
            {
                from.SendMessage("You cannot use bandages while in this state.");
                return;
            }

            from.RevealingAction();

            if (BandageContext.BeginHeal(from, from) != null)
            {
                m_Bandage.Consume();
            }
            Server.Gumps.QuickBar.RefreshQuickBar(from);
        }
Ejemplo n.º 16
0
            protected override void OnTarget(Mobile from, object o)
            {
                int itemID;

                if (o is LandTarget)
                {
                    itemID = from.Map.Tiles.GetLandTile(((LandTarget)o).X, ((LandTarget)o).Y).ID & 0x3FFF;

                    for (int i = 0; i < m_DirtIDs.Length; i += 2)
                    {
                        if (itemID >= m_DirtIDs[i] && itemID <= m_DirtIDs[i + 1])
                        {
                            from.SendLocalizedMessage(1053082);                               // You fill the bowl with fresh dirt.
                            FullPlantBowl pf = new FullPlantBowl();
                            pf.Owner = from;
                            from.AddToBackpack(pf);
                            m_pot.Delete();
                        }
                    }
                }
                else if (o is FertileDirt)
                {
                    Item ft = o as Item;
                    if (from.Backpack.GetAmount(typeof(FertileDirt)) >= 40)
                    {
                        ft.Consume(40);
                        FullPlantBowl fpot = new FullPlantBowl();
                        fpot.Fertile = true;
                        fpot.Owner   = from;
                        from.AddToBackpack(fpot);
                        from.SendLocalizedMessage(1053082);                           // You fill the bowl with fresh dirt.
                        m_pot.Delete();
                    }
                    else if (ft.RootParent != from)
                    {
                        from.SendLocalizedMessage(1042038);                           // You must have the object in your backpack to use it.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1053083);                           // You need more dirt to fill a plant bowl!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1053080);                      // You'll want to gather fresh dirt in order to raise a healthy plant!
                }
            }
Ejemplo n.º 17
0
        public void ChooseTarget_OnTarget(Mobile from, object targeted)
        {
            if (!from.Backpack.AcquireItems().Contains(this))
            {
                from.SendMessage("L'extracteur doit se trouver dans votre sac.");
                return;
            }

            if (targeted is IExtractable)
            {
                Item item = ((Item)targeted);

                if (!from.Backpack.AcquireItems().Contains(item))
                {
                    from.SendMessage("La ressource doit se trouver dans votre sac.");
                    return;
                }

                if (item.Amount < 5)
                {
                    from.SendMessage("Vous devez avoir au moins 5 morceaux de ce matériau.");
                    return;
                }

                from.SendMessage((from.Skills[SkillName.Alchimie].Value).ToString());
                from.SendMessage((((IExtractable)targeted).getSkillReq).ToString());

                if (from.Skills[SkillName.Alchimie].Value >= ((IExtractable)targeted).getSkillReq)
                {
                    from.AddToBackpack(new TeintureModif((IExtractable)targeted));
                    item.Consume(5);
                    from.SendMessage("La teinture est créée.");
                    Delete();
                }
                else
                {
                    from.SendMessage("La méthode d'extraction vous semble trop complexe.");
                }
            }
            else
            {
                from.SendMessage("Ceci n'est pas une ressource.");
            }
        }
Ejemplo n.º 18
0
        public static void OnDrink(Item drink, Mobile from)
        {
            if (!drink.IsChildOf(from.Backpack))
            {
                from.SendMessage("This must be in your backpack to drink.");
                return;
            }
            else
            {
                // increase characters thirst value based on type of drink
                if (from.Thirst < 20)
                {
                    from.Thirst += 5;
                    // Send message to character about their current thirst value
                    int iThirst = from.Thirst;
                    if (iThirst < 5)
                    {
                        from.SendMessage("You drink the water but are still extremely thirsty");
                    }
                    else if (iThirst < 10)
                    {
                        from.SendMessage("You drink the water and feel less thirsty");
                    }
                    else if (iThirst < 15)
                    {
                        from.SendMessage("You drink the water and feel much less thirsty");
                    }
                    else
                    {
                        from.SendMessage("You drink the water and are no longer thirsty");
                    }

                    drink.Consume();
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                    Server.Items.DrinkingFunctions.DrinkBenefits(from);
                }
                else
                {
                    from.SendMessage("You are simply too quenched to drink anymore");
                    from.Thirst = 20;
                }
            }
        }
Ejemplo n.º 19
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target == from)
                {
                    from.SendLocalizedMessage(1005576);                     // You can't throw this at yourself.
                }
                else if (target is Mobile)
                {
                    Mobile    targ = (Mobile)target;
                    Container pack = targ.Backpack;

                    if (from.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)) || targ.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                    {
                        from.SendMessage("You may not throw the snowball here.");
                    }
                    else
                    {
                        if (from.BeginAction(typeof(SnowPile)))
                        {
                            new InternalTimer(from).Start();

                            from.PlaySound(0x145);

                            from.Animate(9, 1, 1, true, false, 0);

                            targ.SendLocalizedMessage(1010572);                             // You have just been hit by a snowball!
                            from.SendLocalizedMessage(1010573);                             // You throw the snowball and hit the target!

                            Effects.SendMovingEffect(from, targ, 0x36E4, 7, 0, false, true, 0x480, 0);

                            m_Snow.Consume();
                        }
                        else
                        {
                            from.SendLocalizedMessage(1005574);                             // The snow is not ready to be packed yet.  Keep trying.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1005577);                     // You can only throw a snowball at something that can throw one back.
                }
            }
Ejemplo n.º 20
0
        private static void FinishThrow(object state)
        {
            object[] states = (object[])state;

            Mobile from = (Mobile)states[0];
            Mobile to   = (Mobile)states[1];
            Item   bola = (Item)states[2];

            if (!from.Alive)
            {
                return;
            }
            if (!bola.IsChildOf(from.Backpack))
            {
                bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
            }
            else if (!from.InRange(to, 15) || !from.InLOS(to) || !from.CanSee(to))
            {
                from.PrivateOverheadMessage(MessageType.Regular, 946, 1042060, from.NetState); // You cannot see that target!
            }
            else if (!to.Mounted && !to.Flying && (!Core.ML || !AnimalForm.UnderTransformation(to)))
            {
                to.PrivateOverheadMessage(MessageType.Regular, 946, 1049628, from.NetState); // You have no reason to throw a bola at that.
            }
            else
            {
                bola.Consume();

                from.Direction = from.GetDirectionTo(to);
                from.Animate(AnimationType.Attack, 4);
                from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                new Bola().MoveToWorld(to.Location, to.Map);

                if (CheckHit(to, from))
                {
                    to.Damage(Utility.RandomMinMax(10, 20), from);
                    //    Dismount(from, to, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0), true);
                    Server.Items.Dismount.DoDismount(from, to, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0), true);
                }
            }
        }
Ejemplo n.º 21
0
 protected override void OnTarget(Mobile from, object o)
 {
     if (o is BaseBook)
     {
         BaseBook to = o as BaseBook;
         if (to.Writable)
         {
             to.Writable = false;
             m_RedLeaf.Consume();
             to.SendLocalizedMessageTo(from, 1061910);                          // You seal the ink to the page using wax from the red leaf.
         }
         else
         {
             to.SendLocalizedMessageTo(from, 1061909);                          // The ink in this book has already been sealed.
         }
     }
     else
     {
         from.SendLocalizedMessage(1053090);                      // You can only use the red leaves to seal the ink into book pages!
     }
 }
Ejemplo n.º 22
0
            public override void OnResponse(Mobile from, string text)
            {
                if (m_Deed == null || m_Deed.Deleted || m_Cloth == null || m_Cloth.Deleted)
                {
                    return;
                }

                if (!m_Deed.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
                    return;
                }

                if (!m_Cloth.IsChildOf(from.Backpack))
                {
                    from.SendAsciiMessage("The clothing must be in your backpack.");
                    return;
                }

                string name = Utility.FixHtml(text.Trim());

                if (name.Length > 20)
                {
                    from.SendAsciiMessage("That name is too long.");
                }
                else if (!BaseGuildGump.CheckProfanity(name))
                {
                    from.SendAsciiMessage("That name is disallowed.");
                }
                else
                {
                    m_Cloth.Name = name;
                    from.SendAsciiMessage("The name on your clothing has been changed!");
                    Effects.SendLocationEffect(from.Location, from.Map, 14170, 20, 1946, 0);
                    from.PlaySound(0x064E);
                    m_Deed.Consume();
                }
            }
Ejemplo n.º 23
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Crystal.IsAccessibleTo(from))
                {
                    return;
                }

                if (from.Map != m_Crystal.Map || !from.InRange(m_Crystal.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                if (targeted == m_Crystal)
                {
                    if (m_Crystal.Active)
                    {
                        m_Crystal.Active = false;
                        from.SendLocalizedMessage(500672);                           // You turn the crystal off.
                    }
                    else
                    {
                        if (m_Crystal.Charges > 0)
                        {
                            m_Crystal.Active = true;
                            from.SendLocalizedMessage(500673);                               // You turn the crystal on.
                        }
                        else
                        {
                            from.SendLocalizedMessage(500676);                               // This crystal is out of charges.
                        }
                    }
                }
                else if (targeted is ReceiverCrystal)
                {
                    ReceiverCrystal receiver = (ReceiverCrystal)targeted;

                    if (m_Crystal.Receivers.Count >= 10)
                    {
                        from.SendLocalizedMessage(1010042);                           // This broadcast crystal is already linked to 10 receivers.
                    }
                    else if (receiver.Sender == m_Crystal)
                    {
                        from.SendLocalizedMessage(500674);                           // This crystal is already linked with that crystal.
                    }
                    else if (receiver.Sender != null)
                    {
                        from.SendLocalizedMessage(1010043);                           // That receiver crystal is already linked to another broadcast crystal.
                    }
                    else
                    {
                        receiver.Sender = m_Crystal;
                        from.SendLocalizedMessage(500675);                           // That crystal has been linked to this crystal.
                    }
                }
                else if (targeted == from)
                {
                    foreach (ReceiverCrystal receiver in new List <ReceiverCrystal>(m_Crystal.Receivers))
                    {
                        receiver.Sender = null;
                    }

                    from.SendLocalizedMessage(1010046);                       // You unlink the broadcast crystal from all of its receivers.
                }
                else
                {
                    Item targItem = targeted as Item;

                    if (targItem != null && targItem.VerifyMove(from))
                    {
                        CrystalRechargeInfo info = CrystalRechargeInfo.Get(targItem.GetType());

                        if (info != null)
                        {
                            if (m_Crystal.Charges >= MaxCharges)
                            {
                                from.SendLocalizedMessage(500678);                                   // This crystal is already fully charged.
                            }
                            else
                            {
                                targItem.Consume();

                                if (m_Crystal.Charges + info.Amount >= MaxCharges)
                                {
                                    m_Crystal.Charges = MaxCharges;
                                    from.SendLocalizedMessage(500679);                                       // You completely recharge the crystal.
                                }
                                else
                                {
                                    m_Crystal.Charges += info.Amount;
                                    from.SendLocalizedMessage(500680);                                       // You recharge the crystal.
                                }
                            }

                            return;
                        }
                    }

                    from.SendLocalizedMessage(500681);                       // You cannot use this crystal on that.
                }
            }
Ejemplo n.º 24
0
        public int ConsumeTotalGrouped(Type[][] types, int[] amounts, bool recurse, OnItemConsumed callback, CheckItemGroup grouper)
        {
            if (types.Length != amounts.Length)
            {
                throw new ArgumentException();
            }
            else if (grouper == null)
            {
                throw new ArgumentNullException();
            }

            Item[][][] items  = new Item[types.Length][][];
            int[][]    totals = new int[types.Length][];

            for (int i = 0; i < types.Length; ++i)
            {
                Item[] typedItems = FindItemsByType(types[i], recurse);

                ArrayList groups = new ArrayList();
                int       idx    = 0;

                while (idx < typedItems.Length)
                {
                    Item      a     = typedItems[idx++];
                    ArrayList group = new ArrayList();

                    group.Add(a);

                    while (idx < typedItems.Length)
                    {
                        Item b = typedItems[idx];
                        int  v = grouper(a, b);

                        if (v == 0)
                        {
                            group.Add(b);
                        }
                        else
                        {
                            break;
                        }

                        ++idx;
                    }

                    groups.Add(group);
                }

                items[i]  = new Item[groups.Count][];
                totals[i] = new int[groups.Count];

                bool hasEnough = false;

                for (int j = 0; j < groups.Count; ++j)
                {
                    items[i][j] = (Item[])(((ArrayList)groups[j]).ToArray(typeof(Item)));

                    for (int k = 0; k < items[i][j].Length; ++k)
                    {
                        totals[i][j] += items[i][j][k].Amount;
                    }

                    if (totals[i][j] >= amounts[i])
                    {
                        hasEnough = true;
                    }
                }

                if (!hasEnough)
                {
                    return(i);
                }
            }

            for (int i = 0; i < items.Length; ++i)
            {
                for (int j = 0; j < items[i].Length; ++j)
                {
                    if (totals[i][j] >= amounts[i])
                    {
                        int need = amounts[i];

                        for (int k = 0; k < items[i][j].Length; ++k)
                        {
                            Item item = items[i][j][k];

                            int theirAmount = item.Amount;

                            if (theirAmount < need)
                            {
                                if (callback != null)
                                {
                                    callback(item, theirAmount);
                                }

                                item.Delete();
                                need -= theirAmount;
                            }
                            else
                            {
                                if (callback != null)
                                {
                                    callback(item, need);
                                }

                                item.Consume(need);
                                break;
                            }
                        }

                        break;
                    }
                }
            }

            return(-1);
        }
Ejemplo n.º 25
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallScroll)
            {
                Item scrolls = dropped as Item;
                int  amount  = scrolls.Amount;

                if (amount <= 0)
                {
                    return(false); //amount should not be zero, but better safe than sorry.
                }
                int count = 0;     //this keeps track of the count of scrolls added to each runebook
                int total = 0;     //this keeps track of the total added to all runebooks
                for (int x = 0; x < 51; x++)
                {
                    if (Books[x].Entries.Count < 16)                   //check each runebook
                    {
                        if (Books[x].CurCharges < Books[x].MaxCharges) //if there is space for more charges...
                        {
                            from.Send(new PlaySound(0x249, from.Location));

                            if (amount > (Books[x].MaxCharges - Books[x].CurCharges))  //if the amount of scrolls is > than space free
                            {
                                count = Books[x].MaxCharges - Books[x].CurCharges;
                                scrolls.Consume(count);
                                Books[x].CurCharges = Books[x].MaxCharges;
                                total  += count;
                                amount -= count;
                            }
                            else  //otherwise we just add/delete whatever scrolls are left
                            {
                                Books[x].CurCharges += amount;
                                scrolls.Delete();
                                total += amount;
                                amount = 0;
                            }
                        }
                    }
                    if (amount <= 0)
                    {
                        from.SendMessage("{0} Recall Scrolls were added.", total.ToString());
                        return(true);
                    }
                }
            }
            else
            if (dropped is RecallRune)
            {
                for (int x = 0; x < 51; x++)
                {
                    if (Books[x].Entries.Count < 16)
                    {
                        RecallRune rune = (RecallRune)dropped;

                        if (rune.Marked && rune.TargetMap != null)
                        {
                            Books[x].Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                            dropped.Delete();

                            from.Send(new PlaySound(0x42, GetWorldLocation()));

                            string desc = rune.Description;

                            if (desc == null || (desc = desc.Trim()).Length == 0)
                            {
                                desc = "(indescript)";
                            }

                            from.SendMessage(desc);

                            return(true);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502409);     // This rune does not have a marked location.
                        }
                    }
                }
                from.SendLocalizedMessage(502401);     // This runebook is full.
            }
            else
            if (dropped is Runebook)
            {
                if (((Runebook)dropped).Entries.Count > 0)
                {
                    for (int x = 0; x < 51; x++)
                    {
                        if (Books[x].Entries.Count == 0)
                        {
                            Runebook rb = dropped as Runebook;
                            for (int y = 0; y < rb.Entries.Count; y++)
                            {
                                RunebookEntry rune = rb.Entries[y] as RunebookEntry;
                                Books[x].Entries.Add(new RunebookEntry(rune.Location, rune.Map, rune.Description, rune.House));
                            }
                            Books[x].Name = rb.Name;
                            dropped.Delete();
                            return(true);
                        }
                    }
                    from.SendLocalizedMessage(502401);         // This runebook is full.
                }
                else
                {
                    from.SendMessage("Unable to add a blank runebook.");
                }
            }

            return(false);
        }
Ejemplo n.º 26
0
		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if ( dropped is BlankScroll && UzeraanTurmoilQuest.HasLostScrollOfPower( from ) )
			{
				FocusTo( from );

				Item scroll = new SchmendrickScrollOfPower();

				if ( !from.PlaceInBackpack( scroll ) )
				{
					scroll.Delete();
					from.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
					return false;
				}
				else
				{
					dropped.Consume();
					from.SendLocalizedMessage( 1049346 ); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product.
					return dropped.Deleted;
				}
			}

			return base.OnDragDrop( from, dropped );
		}
Ejemplo n.º 27
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune)
            {
                //Close all runebooks
                from.CloseGump(typeof(RunebookGump));

                if (!CheckAccess(from))
                {
                    from.SendLocalizedMessage(502413);                       // That cannot be done while the book is locked down.
                }
                //else if ( IsOpen( from ) )
                //{
                //	from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
                //}
                else if (m_Entries.Count < 16)
                {
                    RecallRune rune = (RecallRune)dropped;

                    if (rune.Marked && rune.TargetMap != null)
                    {
                        m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                        dropped.Delete();

                        from.Send(new PlaySound(0x42, GetWorldLocation()));

                        string desc = rune.Description;

                        if (desc == null || (desc = desc.Trim()).Length == 0)
                        {
                            desc = "(indescript)";
                        }

                        from.SendMessage(desc);

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502409);                           // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401);                       // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (m_CurCharges < m_MaxCharges)
                {
                    from.Send(new PlaySound(0x249, GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (m_MaxCharges - m_CurCharges))
                    {
                        dropped.Consume(m_MaxCharges - m_CurCharges);
                        m_CurCharges = m_MaxCharges;
                    }
                    else
                    {
                        m_CurCharges += amount;
                        dropped.Delete();

                        return(true);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410);                       // This book already has the maximum amount of charges.
                }
            }
            else
            {
                // Adam: anything other than a scroll will get dropped into your backpack
                // (so your best sword doesn't get dropped on the ground.)
                from.AddToBackpack(dropped);
                //	For richness, we add the drop sound of the item dropped.
                from.PlaySound(dropped.GetDropSound());
                return(true);
            }

            return(false);
        }
Ejemplo n.º 28
0
        public virtual void Recharge(Mobile from, Mobile guildmaster)
        {
            if (from == null || from.Backpack == null)
            {
                return;
            }

            Item diamond = from.Backpack.FindItemByType(typeof(BlueDiamond));

            if (guildmaster != null)
            {
                if (m_UsesRemaining <= 0)
                {
                    Type cType = from.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold);

                    if (diamond != null && Banker.Withdraw(from, cType, 100000))
                    {
                        diamond.Consume();
                        UsesRemaining = 10;

                        // Your weapon engraver should be good as new!
                        guildmaster.Say(1076165);
                    }
                    else
                    {
                        // You need a 100,000 gold and a blue diamond to recharge the weapon engraver.
                        guildmaster.Say(1076167);
                    }
                }
                else
                {
                    // I can only help with this if you are carrying an engraving tool that needs repair.
                    guildmaster.Say(1076164);
                }
            }
            else
            {
                if (from.Skills.Tinkering.Value == 0)
                {
                    // Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
                    from.SendLocalizedMessage(1076179);
                }
                else if (from.Skills.Tinkering.Value < 75.0)
                {
                    // Your tinkering skill is too low to fix this yourself.  An NPC tinkerer can help you repair this for a fee.
                    from.SendLocalizedMessage(1076178);
                }
                else if (diamond != null)
                {
                    diamond.Consume();

                    if (Utility.RandomDouble() < from.Skills.Tinkering.Value / 100)
                    {
                        UsesRemaining = 10;

                        // Your weapon engraver should be good as new! ?????
                        from.SendLocalizedMessage(1076165);
                    }
                    else
                    {
                        // You cracked the diamond attempting to fix the weapon engraver.
                        from.SendLocalizedMessage(1076175);
                    }
                }
                else
                {
                    // You do not have a blue diamond needed to recharge the engraving tool.
                    from.SendLocalizedMessage(1076166);
                }
            }
        }
Ejemplo n.º 29
0
 public void AddTool(Mobile m, Item tar, int uses, ToolBox box)
 {
     if ((tar is BaseTool || tar is BaseHarvestTool) && uses > 0)
     {
         if (tar is Hammer || tar is SmithHammer || tar is Tongs)
         {
             this.i_S += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is TinkerTools)
         {
             this.i_Ti += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is Skillet || tar is RollingPin || tar is FlourSifter)
         {
             this.i_Co += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is DovetailSaw || tar is Saw || tar is DrawKnife || tar is Froe || tar is Inshave || tar is JointingPlane || tar is MouldingPlane || tar is Nails || tar is Scorp || tar is SmoothingPlane)
         {
             this.i_C += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is Shovel || tar is Pickaxe)
         {
             this.i_M += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is Blowpipe)
         {
             this.i_G += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is MalletAndChisel)
         {
             this.i_St += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is SewingKit)
         {
             this.i_T += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is FletcherTools)
         {
             this.i_F += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is MortarPestle)
         {
             this.i_A += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is MapmakersPen)
         {
             this.i_Ca += uses; tar.Consume(); box.OW(m);
         }
         else if (tar is ScribesPen)
         {
             this.i_Sc += uses; tar.Consume(); box.OW(m);
         }
         else
         {
             m.SendMessage("I do not recognize this type."); box.NG(m, box);
         }
     }
     else
     {
         m.SendMessage("This is not the appropriate type of item or it has no uses left."); box.NG(m, box);
     }
 }
Ejemplo n.º 30
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune)
            {
                if (IsLockedDown && from.AccessLevel < AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502413, null, 0x35);                       // That cannot be done while the book is locked down.
                }
                else if (IsOpen(from))
                {
                    from.SendLocalizedMessage(1005571);                       // You cannot place objects in the book while viewing the contents.
                }
                else if (m_Entries.Count < 16)
                {
                    RecallRune rune = (RecallRune)dropped;

                    if (rune.Marked && rune.TargetMap != null)
                    {
                        m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description));

                        dropped.Delete();

                        from.Send(new PlaySound(0x42, GetWorldLocation()));

                        string desc = rune.Description;

                        if (desc == null || (desc = desc.Trim()).Length == 0)
                        {
                            desc = "(indescript)";
                        }

                        from.SendMessage(desc);

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502409);                           // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401);                       // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (m_CurCharges < m_MaxCharges)
                {
                    from.Send(new PlaySound(0x249, GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (m_MaxCharges - m_CurCharges))
                    {
                        dropped.Consume(m_MaxCharges - m_CurCharges);
                        m_CurCharges = m_MaxCharges;
                    }
                    else
                    {
                        m_CurCharges += amount;
                        dropped.Delete();

                        return(true);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410);                       // This book already has the maximum amount of charges.
                }
            }

            return(false);
        }
Ejemplo n.º 31
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune || dropped is ShipRune)
            {
                if (this.IsLockedDown && from.AccessLevel < AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
                }
                else if (this.IsOpen(from))
                {
                    from.SendLocalizedMessage(1005571); // You cannot place objects in the book while viewing the contents.
                }
                else if (this.m_Entries.Count < MaxEntries)
                {
                    if (dropped is RecallRune)
                    {
                        RecallRune rune = (RecallRune)dropped;

                        if (rune.Marked && rune.TargetMap != null)
                        {
                            this.m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                            dropped.Delete();

                            from.Send(new PlaySound(0x42, this.GetWorldLocation()));

                            string desc = rune.Description;

                            if (desc == null || (desc = desc.Trim()).Length == 0)
                            {
                                desc = "(indescript)";
                            }

                            from.SendMessage(desc);

                            return(true);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502409); // This rune does not have a marked location.
                        }
                    }
                    else if (dropped is ShipRune)
                    {
                        ShipRune rune = (ShipRune)dropped;

                        if (rune.Galleon != null && !rune.Galleon.Deleted)
                        {
                            m_Entries.Add(new RunebookEntry(Point3D.Zero, null, rune.Galleon.ShipName, null, rune.Galleon));

                            dropped.Delete();

                            from.Send(new PlaySound(0x42, GetWorldLocation()));

                            string desc = rune.Galleon.ShipName;

                            if (desc == null || (desc = desc.Trim()).Length == 0)
                            {
                                desc = "an unnamed ship";
                            }

                            from.SendMessage(desc);

                            return(true);
                        }
                        else
                        {
                            if (rune.DockedBoat != null)
                            {
                                from.SendMessage("You cannot place a rune to a docked boat in the runebook.");
                            }
                            else
                            {
                                from.SendLocalizedMessage(502409); // This rune does not have a marked location.
                            }
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401); // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (this.m_CurCharges < this.m_MaxCharges)
                {
                    from.Send(new PlaySound(0x249, this.GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (this.m_MaxCharges - this.m_CurCharges))
                    {
                        dropped.Consume(this.m_MaxCharges - this.m_CurCharges);
                        this.m_CurCharges = this.m_MaxCharges;
                    }
                    else
                    {
                        this.m_CurCharges += amount;
                        dropped.Delete();

                        return(true);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410); // This book already has the maximum amount of charges.
                }
            }

            return(false);
        }