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) { 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); } } }
public LootTypesGump( Mobile mobile, LootBag bag, int page ) : base( 50, 50 ) { if ( null != bag && !bag.Deleted ) { m_Bag = bag; m_Page = page; while ( m_Page * kTypesPerPage >= m_Bag.TypesToLoot.Count ) m_Page--; mobile.CloseGump( typeof( LootTypesGump ) ); MakeGump(); } }
public LootTypesGump( Mobile mobile, LootBag bag, int page ) : base(50, 50) { if ( null != bag && !bag.Deleted ) { m_Bag = bag; m_Page = page; while ( m_Page * kTypesPerPage >= m_Bag.TypesToLoot.Count ) m_Page--; mobile.CloseGump( typeof( LootTypesGump ) ); MakeGump(); } }
protected override void OnTarget(Mobile from, object target) { LootBag bag = target as Xanthos.Claim.LootBag; if (bag == null) { from.SendMessage("That is not a Loot Bag."); } else if (!bag.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { from.SendGump(new LootTypesGump(from, bag)); } }
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) { 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"); } }
public LootTypesGump( Mobile m, LootBag bag, bool goLastPage ) : this(m, bag, bag.TypesToLoot.Count / kTypesPerPage) { }
public LootTypesGump( Mobile m, LootBag bag ) : this(m, bag, 0) { }
public SetCollectionTypeTarget( Mobile from, LootBag bag ) : base(-1, false, TargetFlags.None) { from.SendMessage( "Choose an item to be collected by this loot bag." ); m_Bag = bag; }
public LootTypesGump( Mobile m, LootBag bag, bool goLastPage ) : this( m, bag, bag.TypesToLoot.Count / kTypesPerPage ) { }
public LootTypesGump( Mobile m, LootBag bag ) : this( m, bag, 0 ) { }
public SetCollectionTypeTarget( Mobile from, LootBag bag ) : base( -1, false, TargetFlags.None ) { from.SendMessage( "Choose an item to be collected by this loot bag." ); m_Bag = bag; }