public static bool ClaimCorpse(Mobile from, Corpse corpse, ClaimOption option) { if (null == corpse || corpse.Owner == from) { return(false); } Container goldBag = GetGoldBag(from); Container silverBag = GetSilverBag(from); Container lootBag = GetLootBag(from); if (ClaimConfig.AggregateSilver) { AggregateSilver(from, silverBag); } if (ClaimOption.Carve == option && !(corpse.Owner is PlayerMobile)) { corpse.Carve(from, null); } LootCorpse(from, corpse, option, goldBag, silverBag, lootBag); AwardGold(from, corpse, goldBag); corpse.Delete(); return(true); }
public static void Grab_OnCommand(CommandEventArgs e) { // Get LootData attachment LootData lootoptions = new LootData(); // does player already have a lootdata attachment? if (XmlAttach.FindAttachment(e.Mobile, typeof(LootData)) == null) { XmlAttach.AttachTo(e.Mobile, lootoptions); // give them one free lootbag e.Mobile.AddToBackpack(new LootBag()); } else { // they have the attachment, just load their options lootoptions = (LootData)XmlAttach.FindAttachment(e.Mobile, typeof(LootData)); } // Check args to see if they want to change loot options // if we have args after "grab" if (e.Length != 0) { // we need to set the loot bag if (e.GetString(0) != "options") { e.Mobile.SendMessage("Typing the command [grab by itself loots corpses of your victims. [grab options will allow you to decide what you want to loot."); } // show loot options gump else if (e.GetString(0) == "options") { e.Mobile.SendGump(new LootGump(e.Mobile)); } } // Check loot legalities 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 != CompetitiveGrabRadius && BlockingMobilesInRange( from, GrabRadius )) //{ // from.PlaySound( 1069 ); //hey // from.SendMessage( "You are too close to another player to do that!" ); // return; //} ArrayList grounditems = new ArrayList(); ArrayList lootitems = new ArrayList(); ArrayList corpses = new ArrayList(); Container lootBag = GetLootBag(from); // Gather lootable corpses and items into lists foreach (Item item in from.GetItemsInRange(GrabRadius)) { if (!from.InLOS(item) || !item.IsAccessibleTo(from) || !(item.Movable || item is Corpse)) { continue; } // add to corpse list if corpse if (item is Corpse && CorpseIsLootable(from, item as Corpse, false)) // && item.Killer == from { Corpse deadbody = item as Corpse; if (deadbody.Killer == null) { corpses.Add(item); } else if (deadbody.Killer == from) { corpses.Add(item); } else if (deadbody.Killer is BaseCreature && !(deadbody.Killer is PlayerMobile)) { BaseCreature pet = deadbody.Killer as BaseCreature; if (pet.ControlMaster == from || pet.ControlMaster == null) { corpses.Add(item); } } } // otherwise add to ground items list if loot options indicate //ORIGINALY HERE-Trying to clear up yellow startup saying that item moble never is // else if ( !( item is PlayerMobile ) ) // { // if(lootoptions.GetGroundItems) // if (!(item is Corpse)) // grounditems.Add( item ); // } //END ORIGINALY HERE else if (lootoptions.GetGroundItems) { if (!(item is Corpse)) { grounditems.Add(item); } } } // see if we really want any of the junk lying on the ground GetItems(lootoptions, from, grounditems); grounditems.Clear(); // now inspect and loot appropriate items in corpses foreach (Item corpse in corpses) { Corpse bod = corpse as Corpse; PlayerMobile pm = from as PlayerMobile; //pm.PlayerLevel += 1; /* // Uncomment for eventual modifications (not to allow grabbing certain bodies) * Mobile own = bod.Owner as Mobile; * if( (own is Mobile1) || (own is Mobile2) ) // Change mobile names according to what you want to get */ { // if we are looting hides/scales/meat then carve the corpse if (lootoptions.GetHides && !(bod.Owner is PlayerMobile)) { bod.Carve(from, null); } //rummage through the corpse for good stuff foreach (Item item in bod.Items) { lootitems.Add(item); } // now see if we really want any of this junk GetItems(lootoptions, from, lootitems); // alrighty then, we have all the items we want, now award gold for this corpse, delete it and increment the body count // AwardGold(from, bod, lootBag); //REMED OUT SO THAT REGULAR MOBS WONT GIVE GOLD WHEN USE GRAB COMMAND bod.Delete(); // empty lootitems arraylist lootitems.Clear(); } } }
public static void Grab_OnCommand(CommandEventArgs e) { // Get LootData attachment LootData lootoptions = new LootData(); // does player already have a lootdata attachment? if (XmlAttach.FindAttachment(e.Mobile, typeof(LootData)) == null) { XmlAttach.AttachTo(e.Mobile, lootoptions); // give them one free DocLootBag e.Mobile.AddToBackpack(new DocLootBag()); } else { // they have the attachment, just load their options lootoptions = (LootData)XmlAttach.FindAttachment(e.Mobile, typeof(LootData)); } // Check args to see if they want to change loot options // if we have args after "grab" if (e.Length != 0) { // we need to set the loot bag if (e.GetString(0) != "options") { e.Mobile.SendMessage("Typing the command [grab by itself loots corpses of your victims. [grab options will allow you to decide what you want to loot."); } // show loot options gump else if (e.GetString(0) == "options") { e.Mobile.SendGump(new LootGump(e.Mobile)); } } // Check loot legalities 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 != CompetitiveGrabRadius && BlockingMobilesInRange(from, GrabRadius)) { from.PlaySound(1069); //hey from.SendMessage("You are too close to another player to do that!"); return; } ArrayList grounditems = new ArrayList(); ArrayList lootitems = new ArrayList(); ArrayList corpses = new ArrayList(); Container DocLootBag = GetLootBag(from); // Gather lootable corpses and items into lists foreach (Item item in from.GetItemsInRange(GrabRadius)) { if (!from.InLOS(item) || !item.IsAccessibleTo(from) || !(item.Movable || item is Corpse)) { continue; } // add to corpse list if corpse if (item is Corpse && CorpseIsLootable(from, item as Corpse, false)) { corpses.Add(item); } // otherwise add to ground items list if loot options indicate else if (lootoptions.GetGroundItems) { if (!(item is Corpse)) { grounditems.Add(item); } } } // see if we really want any of the junk lying on the ground GetItems(lootoptions, from, grounditems); grounditems.Clear(); // now inspect and loot appropriate items in corpses foreach (Item corpse in corpses) { Corpse bod = corpse as Corpse; // if we are looting hides/scales/meat then carve the corpse if (lootoptions.GetHides && !(bod.Owner is PlayerMobile)) { bod.Carve(from, null); } //rummage through the corpse for good stuff foreach (Item item in bod.Items) { lootitems.Add(item); } // now see if we really want any of this junk GetItems(lootoptions, from, lootitems); // alrighty then, we have all the items we want, now award gold for this corpse, delete it and increment the body count AwardGold(from, bod, DocLootBag); bod.Delete(); // empty lootitems arraylist lootitems.Clear(); } }