Beispiel #1
0
        public static void LootCorpse(Mobile from, Corpse corpse, ClaimOption option, Container goldBag, Container silverBag, Container lootBag)
        {
            ArrayList items = new ArrayList(corpse.Items.Count);

            foreach (Item item in corpse.Items)
            {
                if (item != null && LootBag.TypeIsLootable(lootBag, item))
                {
                    items.Add(item);
                }
            }

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

                if (item is Gold)
                {
                    GoldToLedger.Deposit(from, item);                       //DropGold( from, item as Gold, goldBag );
                }
                else if (item is Server.Factions.Silver)
                {
                    DropSilver(from, item as Server.Factions.Silver, silverBag);
                }
                else
                {
                    DropLoot(from, item, lootBag);
                }
            }
        }
Beispiel #2
0
        public static void DropGold(Mobile from, Gold gold, Container goldBag)
        {
            /* Check to see if player has a CheckBook */
            Item      item      = from.Backpack.FindItemByType(typeof(CheckBook));
            CheckBook checkBook = item as CheckBook;

            GoldToLedger.Deposit(from, gold);
            // if (checkBook == null)
            // {
            // if (!goldBag.TryDropItem(from, gold, false))	// Attempt to stack it
            // goldBag.DropItem(gold);
            // }
            // else
            // {
            // checkBook.Token += gold.Amount;
            // gold.Delete();
            // }

            from.PlaySound(0x2E6);               // drop gold sound
        }
Beispiel #3
0
        public static void Grab_OnCommand(CommandEventArgs e)
        {
            ClaimOption option = GetOptions(e);

            switch (option)
            {
            case ClaimOption.Error:
                Misc.SendCommandDetails(e.Mobile, "Grab");
                return;

            case ClaimOption.None:
                break;

            case ClaimOption.Carve:
                goto case ClaimOption.Error;

            case ClaimOption.SetTypes:
                e.Mobile.Target = new SetLootBagTarget();
                e.Mobile.SendMessage("Choose a loot bag to set the items that will be collected.");
                break;
            }

            Mobile from = e.Mobile;

            if (from.Alive == false)
            {
                from.PlaySound(1069);                   //hey
                from.SendMessage("You cannot do that while you are dead!");
                return;
            }
            else if (0 != ClaimConfig.CompetitiveGrabRadius && BlockingMobilesInRange(from, ClaimConfig.GrabRadius))
            {
                from.PlaySound(1069);                   //hey
                from.SendMessage("You are too close to another player to do that!");
                return;
            }

            Container goldBag   = GetGoldBag(from);
            Container silverBag = GetSilverBag(from);
            Container lootBag   = GetLootBag(from);

            // Cleanup silver
            if (ClaimConfig.AggregateSilver)
            {
                AggregateSilver(from, silverBag);
            }

            ArrayList items   = new ArrayList();
            ArrayList corpses = new ArrayList();

            // Gather lootable corpses and items into lists
            foreach (Item item in from.GetItemsInRange(ClaimConfig.GrabRadius))
            {
                if (!from.InLOS(item) || !item.IsAccessibleTo(from) || !(item.Movable || item is Corpse))
                {
                    continue;
                }

                if (item is Corpse && CorpseIsLootable(from, item as Corpse, false))
                {
                    corpses.Add(item);
                }

                else if (null != item && LootBag.TypeIsLootable(lootBag, item))
                {
                    items.Add(item);
                }
            }

            // Drop all of the items into the player's bag/pack
            foreach (Item item in items)
            {
                if (item is Gold)
                {
                    GoldToLedger.Deposit(e.Mobile, item);                       //DropGold( from, item as Gold, goldBag );
                }
                else if (item is Server.Factions.Silver)
                {
                    DropSilver(from, item as Server.Factions.Silver, silverBag);
                }
                else
                {
                    DropLoot(from, item, lootBag);
                }
            }

            // Loot and claim the corpses
            int corpsesClaimed = 0;

            foreach (Item item in corpses)
            {
                corpsesClaimed = ClaimCorpse(from, item as Corpse, ClaimOption.None) ? corpsesClaimed + 1 : corpsesClaimed;
            }

            if (corpsesClaimed > 0)
            {
                from.SendMessage("You claim {0} and recieve a reward.", corpsesClaimed == 1 ? "a corpse" : "some corpses");
            }
        }