public MasterLooterSetupGump(MasterLooterBackpack backpack, int page) : base(20, 20) { this.backpack = backpack; this.page = page; int typesCount = backpack.TypesCount; int lastPage = typesCount / 10; if (lastPage * 11 == typesCount && lastPage > 0) { --lastPage; } if (this.page == -1 || this.page > lastPage) //last page { this.page = lastPage; } if (this.page < 0) { this.page = 0; } initialize(); addTop(typesCount); addAddSettingsSection(); addTypesPage(); addPageControls(); }
public static bool GivePlayerTokens(PlayerMobile player, int amount, bool informPlayer) { #if USE_TOKENS int amountLeft = amount; if (amount < 0) { return(false); } MasterLooterBackpack backpack = GetMasterLooter(player); if (backpack != null) { amountLeft = (int)backpack.AddTokensAmount((ulong)amountLeft); } while (amountLeft > 0) { int pileAmount = amountLeft > 60000?60000:amountLeft; amountLeft -= pileAmount; Daat99Tokens tokens = new Daat99Tokens(pileAmount); if (!DropItemInBagOrFeet(player, backpack, tokens)) { return(false); } } if (informPlayer) { player.SendMessage(1173, "You recieved " + (amount - amountLeft) + " tokens."); } if (amountLeft == 0) { return(true); } #endif return(false); }
public MasterLooterLedgerGump(MasterLooterBackpack backpack) : base(50, 50) { this.backpack = backpack; this.Closable = true; this.Disposable = true; this.Dragable = true; this.Resizable = false; this.AddPage(0); bool gold = backpack.GoldLedger; bool token = backpack.TokenLedger; int totalLines = 7 + (gold?2:0) + (token?2:0); int offset = 0; this.AddBackground(0, 0, 350, 75 + 25 * totalLines, 5170); this.AddLabel(120, 25, 69, "Account information"); if (gold) { this.AddLabel(25, 50, 69, "You have " + backpack.GoldAmount + " gold."); offset += 25; } if (token) { this.AddLabel(25, 50 + offset, 88, "You have " + backpack.TokensAmount + " tokens."); offset += 25; } this.AddLabel(25, 50 + offset, 32, "Add Currency:"); this.AddButton(180, 50 + offset, 2443, 2444, (int)BUTTONS.ADD, GumpButtonType.Reply, 0); this.AddLabel(190, 50 + offset, 0, "Add Pile"); this.AddButton(255, 50 + offset, 2443, 2444, (int)BUTTONS.FILL, GumpButtonType.Reply, 0); this.AddLabel(265, 50 + offset, 0, "Add All"); this.AddLabel(25, 98 + offset, 0, @"How much to withdraw?"); this.AddBackground(170, 85 + offset, 150, 50, 9270); this.AddTextEntry(180, 98 + offset, 130, 25, 39, (int)BUTTONS.AMOUNT, ""); if (gold) { this.AddButton(25, 145 + offset, 4027, 4028, (int)BUTTONS.GOLD, GumpButtonType.Reply, 0); this.AddLabel(65, 145 + offset, 69, "Gold Pile"); this.AddButton(195, 145 + offset, 4012, 4013, (int)BUTTONS.GOLD_CHECK, GumpButtonType.Reply, 0); this.AddLabel(235, 145 + offset, 69, "Gold Check"); offset += 25; } if (token) { this.AddButton(25, 145 + offset, 4027, 4028, (int)BUTTONS.TOKENS, GumpButtonType.Reply, 0); this.AddLabel(65, 145 + offset, 69, "Tokens Pile"); this.AddButton(195, 145 + offset, 4012, 4013, (int)BUTTONS.TOKENS_CHECK, GumpButtonType.Reply, 0); this.AddLabel(235, 145 + offset, 69, "Tokens Check"); offset += 25; } this.AddImage(25, 150 + offset, 7012); this.AddImage(250, 150 + offset, 7012); this.AddLabel(150, 160 + offset, 38, "Daat99's"); this.AddLabel(130, 185 + offset, 38, "Master Looter"); }
private static void addToMasterLootersList(PlayerMobile player, MasterLooterBackpack bag) { if (bag == null) return; if (!Daat99MasterLootersUtils.PlayersMasterLooterList.ContainsKey(player.Serial)) Daat99MasterLootersUtils.PlayersMasterLooterList.Add(player.Serial, bag); }
public static void SendGump(Mobile from, MasterLooterBackpack backpack, int page) { CloseGump(from); if ( backpack == null || backpack.Deleted || !backpack.IsOwner(from as PlayerMobile)) return; from.SendGump(new MasterLooterSetupGump(backpack, page)); }
public static bool GivePlayerGold(PlayerMobile player, int amount, bool informPlayer) { int amountLeft = amount; if (amount < 0) { return(false); } MasterLooterBackpack backpack = GetMasterLooter(player); if (backpack != null) { amountLeft = (int)backpack.AddGoldAmount((ulong)amountLeft); } while (amountLeft > 0) { int pileAmount = amountLeft > 60000?60000:amountLeft; amountLeft -= pileAmount; Gold gold = new Gold(pileAmount); if (!DropItemInBagOrFeet(player, backpack, gold)) { return(false); } } if (informPlayer) { player.SendMessage(1173, "You recieved " + (amount - amountLeft) + " gold."); } if (amountLeft == 0) { return(true); } return(false); }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { MasterLooterBackpack backpack = Daat99MasterLootersUtils.GetMasterLooter(from as PlayerMobile); if (backpack == null) { from.SendMessage("You must have your Master Looter in your backpack!"); } else if (backpack.TokenLedger) { from.SendMessage("You already have token ledger enabled on your master looter backpack."); } else if (!this.Deleted && !backpack.Deleted) { backpack.TokenLedger = true; this.Delete(); from.SendMessage("You enabled the token ledger on your master looter backpack."); } } }
public static void SendGump(Mobile from, MasterLooterBackpack backpack) { CloseGump(from); if (backpack == null || backpack.Deleted || (!backpack.GoldLedger && !backpack.TokenLedger) || !backpack.IsOwner(from as PlayerMobile)) { return; } from.SendGump(new MasterLooterLedgerGump(backpack)); }
public static void SendGump(Mobile from, MasterLooterBackpack backpack, int page) { CloseGump(from); if (backpack == null || backpack.Deleted || !backpack.IsOwner(from as PlayerMobile)) { return; } from.SendGump(new MasterLooterSetupGump(backpack, page)); }
private static void addToMasterLootersList(PlayerMobile player, MasterLooterBackpack bag) { if (bag == null) { return; } if (!Daat99MasterLootersUtils.PlayersMasterLooterList.ContainsKey(player.Serial)) { Daat99MasterLootersUtils.PlayersMasterLooterList.Add(player.Serial, bag); } }
public MasterLooterAddTypeTarget(MasterLooterBackpack backpack, Mobile from, SELECTION selection, Type previousType ) : base(18, false, TargetFlags.None) { this.backpack = backpack; this.previousType = previousType; this.selection = selection; if ( selection == SELECTION.ITEM_SELECTION ) from.SendMessage("Please select an item to loot."); else if ( selection == SELECTION.TYPE_SELECTION && previousType == null ) from.SendMessage("Please select the first item in order to look for common loot type."); else if ( selection == SELECTION.TYPE_SELECTION && previousType != null ) from.SendMessage("Please select the second item in order to look for common loot type."); }
public static bool DropItemInBagOrFeet(PlayerMobile player, MasterLooterBackpack backpack, Item item) { if (player == null || item == null) { return(false); } if (backpack == null) { backpack = GetMasterLooter(player); } if (backpack != null && backpack.TryDropItem(player, item, false)) { return(true); } if (player.Backpack != null && player.Backpack.TryDropItem(player, item, false)) { return(true); } Map map = player.Map; if (map == null) { return(false); } List <Item> atFeet = new List <Item>(); foreach (Item obj in player.GetItemsInRange(0)) { atFeet.Add(obj); } for (int i = 0; i < atFeet.Count; ++i) { Item check = atFeet[i]; if (check.StackWith(player, item, false)) { break; } } item.MoveToWorld(player.Location, map); return(true); }
public MasterLooterAddTypeTarget(MasterLooterBackpack backpack, Mobile from, SELECTION selection, Type previousType) : base(18, false, TargetFlags.None) { this.backpack = backpack; this.previousType = previousType; this.selection = selection; if (selection == SELECTION.ITEM_SELECTION) { from.SendMessage("Please select an item to loot."); } else if (selection == SELECTION.TYPE_SELECTION && previousType == null) { from.SendMessage("Please select the first item in order to look for common loot type."); } else if (selection == SELECTION.TYPE_SELECTION && previousType != null) { from.SendMessage("Please select the second item in order to look for common loot type."); } }
public MasterLooterSetupGump(MasterLooterBackpack backpack, int page) : base(20, 20) { this.backpack = backpack; this.page = page; int typesCount = backpack.TypesCount; int lastPage = typesCount/10; if ( lastPage*11 == typesCount && lastPage > 0 ) --lastPage; if ( this.page == -1 || this.page > lastPage ) //last page this.page = lastPage; if ( this.page < 0 ) this.page = 0; initialize(); addTop(typesCount); addAddSettingsSection(); addTypesPage(); addPageControls(); }
public static void Loot_OnCommand(CommandEventArgs e) { PlayerMobile player = e.Mobile as PlayerMobile; if (player == null || !CanPlayerLoot(player)) { return; } MasterLooterBackpack backpack = GetMasterLooter(player); if (backpack == null) { player.SendMessage("You must have a Master Looter in your backpack!"); return; } if (backpack.IsOwner(player)) { backpack.Loot(player); } }
///WARNING!!! may return null!!! public static MasterLooterBackpack GetMasterLooter(PlayerMobile player) { if (player == null || player.Backpack == null) { return(null); } Serial serial = player.Serial; MasterLooterBackpack bag = null; if (Daat99MasterLootersUtils.PlayersMasterLooterList.ContainsKey(serial)) { bag = Daat99MasterLootersUtils.PlayersMasterLooterList[serial]; if (bag.IsChildOf(player.Backpack) && !bag.Deleted) { return(bag); } else { Daat99MasterLootersUtils.PlayersMasterLooterList.Remove(serial); } } bag = player.Backpack.FindItemByType(typeof(MasterLooterBackpack), false) as MasterLooterBackpack; if (bag != null && bag.Deleted) { bag = null; } if (bag != null && bag.IsOwner(player)) { Daat99MasterLootersUtils.PlayersMasterLooterList.Add(serial, bag); return(bag); } else { return(null); } }
public static bool DropItemInBagOrFeet(PlayerMobile player, MasterLooterBackpack backpack, Item item) { if ( player == null || item == null ) return false; if ( backpack == null ) backpack = GetMasterLooter(player); if ( backpack != null && backpack.TryDropItem(player, item, false) ) return true; if ( player.Backpack != null && player.Backpack.TryDropItem(player, item, false) ) return true; Map map = player.Map; if (map == null) return false; List<Item> atFeet = new List<Item>(); foreach (Item obj in player.GetItemsInRange(0)) atFeet.Add(obj); for (int i = 0; i < atFeet.Count; ++i) { Item check = atFeet[i]; if (check.StackWith(player, item, false)) break; } item.MoveToWorld(player.Location, map); return true; }
public MasterLooterAddTypeTarget(MasterLooterBackpack backpack, Mobile from, SELECTION selection) : this(backpack, from, selection, null) { }
public MasterLooterSetupGump(MasterLooterBackpack backpack) : this( backpack, 0) { }
public MasterLooterLedgerGump( MasterLooterBackpack backpack ) : base( 50, 50 ) { this.backpack = backpack; this.Closable=true; this.Disposable=true; this.Dragable=true; this.Resizable=false; this.AddPage(0); bool gold = backpack.GoldLedger; bool token = backpack.TokenLedger; int totalLines = 7 + (gold?2:0) + (token?2:0); int offset = 0; this.AddBackground(0, 0, 350, 75+25*totalLines, 5170); this.AddLabel(120, 25, 69, "Account information"); if ( gold ) { this.AddLabel(25, 50, 69, "You have " + backpack.GoldAmount + " gold."); offset += 25; } if ( token ) { this.AddLabel(25, 50+offset, 88, "You have " + backpack.TokensAmount + " tokens."); offset += 25; } this.AddLabel( 25, 50+offset, 32, "Add Currency:"); this.AddButton(180, 50+offset, 2443, 2444, (int)BUTTONS.ADD, GumpButtonType.Reply, 0); this.AddLabel( 190, 50+offset, 0, "Add Pile"); this.AddButton(255, 50+offset, 2443, 2444, (int)BUTTONS.FILL, GumpButtonType.Reply, 0); this.AddLabel( 265, 50+offset, 0, "Add All"); this.AddLabel(25, 98+offset, 0, @"How much to withdraw?"); this.AddBackground(170, 85+offset, 150, 50, 9270); this.AddTextEntry(180, 98+offset, 130, 25, 39, (int)BUTTONS.AMOUNT, ""); if ( gold ) { this.AddButton( 25, 145+offset, 4027, 4028, (int)BUTTONS.GOLD, GumpButtonType.Reply, 0); this.AddLabel( 65, 145+offset, 69, "Gold Pile"); this.AddButton(195, 145+offset, 4012, 4013, (int)BUTTONS.GOLD_CHECK, GumpButtonType.Reply, 0); this.AddLabel( 235, 145+offset, 69, "Gold Check"); offset += 25; } if ( token ) { this.AddButton( 25, 145+offset, 4027, 4028, (int)BUTTONS.TOKENS, GumpButtonType.Reply, 0); this.AddLabel( 65, 145+offset, 69, "Tokens Pile"); this.AddButton(195, 145+offset, 4012, 4013, (int)BUTTONS.TOKENS_CHECK, GumpButtonType.Reply, 0); this.AddLabel( 235, 145+offset, 69, "Tokens Check"); offset += 25; } this.AddImage(25, 150+offset, 7012); this.AddImage(250, 150+offset, 7012); this.AddLabel(150, 160+offset, 38, "Daat99's"); this.AddLabel(130, 185+offset, 38, "Master Looter"); }
public static void SendGump(Mobile from, MasterLooterBackpack backpack) { CloseGump(from); if ( backpack == null || backpack.Deleted || (!backpack.GoldLedger && !backpack.TokenLedger) || !backpack.IsOwner(from as PlayerMobile)) return; from.SendGump(new MasterLooterLedgerGump(backpack)); }
public MasterLooterFillContextMenu(Mobile from, Item item) : base(6230, 3) { player = from as PlayerMobile; backpack = item as MasterLooterBackpack; }
public MasterLooterSetupGump(MasterLooterBackpack backpack) : this(backpack, 0) { }
public MasterLooterAddCurrencyTarget(Mobile from, MasterLooterBackpack backpack) : base(18, false, TargetFlags.None) { this.backpack = backpack; }
public MasterLooterAddTypeTarget(MasterLooterBackpack backpack, Mobile from, SELECTION selection) : this(backpack, from, selection, null) { }
public MasterLooterAddCurrencyTarget(Mobile from, MasterLooterBackpack backpack) : base(18, false, TargetFlags.None) { this.backpack = backpack; }
public MasterLooterSetupContextMenu(Mobile from, Item item) : base(97, 2) { player = from as PlayerMobile; backpack = item as MasterLooterBackpack; }
public MasterLooterSetupContextMenu( Mobile from, Item item ) : base( 97, 2 ) { player = from as PlayerMobile; backpack = item as MasterLooterBackpack; }
public MasterLooterLedgerContextMenu( Mobile from, Item item ) : base( 99, 1 ) { player = from as PlayerMobile; backpack = item as MasterLooterBackpack; }
public MasterLooterLedgerContextMenu(Mobile from, Item item) : base(99, 1) { player = from as PlayerMobile; backpack = item as MasterLooterBackpack; }
public MasterLooterFillContextMenu( Mobile from, Item item ) : base( 6230, 3 ) { player = from as PlayerMobile; backpack = item as MasterLooterBackpack; }