public void valueItem(int slot, bool inventory)
        {
            Item item = inventory ? player.getInventory().getSlot(slot) : inMainStock?shop.getMainItem(slot) : shop.getSlot(slot);

            int id = item.getItemId();

            if (item.getItemId() <= 0)
            {
                return;
            }
            bool noted = ItemData.forId(item.getItemId()).isNoted();

            if (noted)
            {
                id = ItemData.getUnNotedItem(item.getItemId());
            }
            if (!shopWillBuyItem(id))
            {
                return;
            }
            ItemData.Item def = ItemData.forId(id);
            if (inventory)
            {
                player.getPackets().sendMessage("This shop will pay " + def.getPrice().getMinimumPrice().ToString("#,##0") + " coins for 1 " + def.getName() + ".");
                return;
            }
            player.getPackets().sendMessage("1 " + def.getName() + " costs " + def.getPrice().getMaximumPrice().ToString("#,##0") + " coins.");
        }
예제 #2
0
        private static bool _cast(this ItemData.Item item, GameObject target)
        {
            var slot = item.GetItemSlot();

            return(slot != null && slot.SpellSlot != SpellSlot.Unknown && slot.SpellSlot.IsReady() &&
                   ObjectManager.Player.Spellbook.CastSpell(slot.SpellSlot, target));
        }
예제 #3
0
        public void updateSearchItem(int item)
        {
            ItemData.Item def = ItemData.forId(item);
            if (def == null)
            {
                p.getPackets().sendMessage("Item: " + item + " cannot be found in item definitions, please report it.");
                return;
            }

            if (currentOffer == null)
            {
                p.getPackets().sendMessage("You shouldn't be running GE Item Search if you didn't click Buy in GE first");
                p.getPackets().sendCloseInterface(752, 6);    // Removes the item search
                p.getPackets().sendInterface(0, 752, 6, 137); // Removes the item search
                return;
            }

            p.getPackets().sendConfig(1109, item);
            p.getPackets().sendConfig(1110, 0);
            p.getPackets().sendConfig(1114, def.getPrice().getNormalPrice());
            p.getPackets().sendConfig(1116, def.getPrice().getMaximumPrice());
            p.getPackets().sendConfig(1115, def.getPrice().getMinimumPrice());
            p.getPackets().sendConfig(1111, def.getPrice().getNormalPrice());
            p.getPackets().modifyText(def.getExamine(), 105, 142); //item examine text.

            currentOffer.setTotalAmount(0);
            currentOffer.setItem(item);
            currentOffer.setPriceEach(def.getPrice().getNormalPrice());
            p.getPackets().sendInterface(0, 752, 6, 137);// Removes the item search
        }
예제 #4
0
        public void offerSellItem(int inventorySlot)
        {
            if (currentOffer == null)
            {
                p.getPackets().sendMessage("[offerSellItem]: Nice try cheater!, If this is bug please report it.");
                return;
            }

            Item item = p.getInventory().getSlot(inventorySlot);

            if (item != null && item.getItemId() > 0 && item.getItemAmount() > 0)
            {
                int           itemToShow = item.getItemId();
                ItemData.Item def        = item.getDefinition();

                if (def == null)
                {
                    p.getPackets().sendMessage("Item: " + item.getItemId() + " cannot be found in item definitions, please report it.");
                    return;
                }

                if (def.isNoted())
                {
                    itemToShow = ItemData.getUnNotedItem(item.getItemId());
                    if (itemToShow == item.getItemId())
                    {
                        // item is only noted (this is definetly itemData.xml file issue).
                        p.getPackets().sendMessage("Item: " + item.getItemId() + " An unnoted equivalent of this item cannot be found, please report it.");
                        return;
                    }
                    else
                    {
                        //update item def with un-noted def.
                        def = ItemData.forId(itemToShow);
                        item.setItemId(itemToShow);
                    }
                }

                if (def.isPlayerBound() || (def.getPrice().getNormalPrice() == 0 && def.getPrice().getMaximumPrice() == 0 && def.getPrice().getMinimumPrice() == 0))
                {
                    //look at unNoted item price, of a item which was previously noted.
                    p.getPackets().sendMessage("This item cannot be sold on the Grand Exchange.");
                    return;
                }
                p.getPackets().sendConfig(1109, item.getItemId());
                p.getPackets().sendConfig(1110, item.getItemAmount());
                p.getPackets().sendConfig(1114, def.getPrice().getNormalPrice());
                p.getPackets().sendConfig(1116, def.getPrice().getMaximumPrice());
                p.getPackets().sendConfig(1115, def.getPrice().getMinimumPrice());
                p.getPackets().sendConfig(1111, def.getPrice().getNormalPrice());
                p.getPackets().modifyText(def.getExamine(), 105, 142); //item examine text.

                currentOffer.setItem(item.getItemId());
                currentOffer.setTotalAmount(item.getItemAmount());
                currentOffer.setPriceEach(def.getPrice().getNormalPrice());
            }
        }
예제 #5
0
        public void offerSellItem(int inventorySlot)
        {
            Item item = p.getInventory().getSlot(inventorySlot);

            if (item != null && item.getItemId() > 0 && item.getItemAmount() > 0)
            {
                int           itemToShow = item.getItemId();
                ItemData.Item def        = item.getDefinition();

                if (def == null)
                {
                    p.getPackets().sendMessage("This item cannot be found in item definitions, please report it.");
                    return;
                }

                if (def.isNoted())
                {
                    itemToShow = ItemData.getUnNotedItem(item.getItemId());
                    if (itemToShow == item.getItemId())   // item is only noted
                    {
                        p.getPackets().sendMessage("An unnoted equivalent of this item cannot be found, please report it.");
                        return;
                    }
                    else
                    {
                        def = ItemData.forId(itemToShow); //update item def with un-noted def.. to fix price.
                    }
                }

                if (def.isPlayerBound() || (def.getPrice().getNormalPrice() == 0 && def.getPrice().getMaximumPrice() == 0 && def.getPrice().getMinimumPrice() == 0))
                { //look at unNoted item price, of a item which was previously noted.
                    p.getPackets().sendMessage("This item cannot be sold on the Grand Exchange.");
                    return;
                }

                p.getPackets().sendConfig(1109, itemToShow);
                p.getPackets().sendConfig(1110, item.getItemAmount());
                p.getPackets().sendConfig(1114, def.getPrice().getNormalPrice());
                p.getPackets().sendConfig(1116, def.getPrice().getMaximumPrice());
                p.getPackets().sendConfig(1115, def.getPrice().getMinimumPrice());
                p.getPackets().sendConfig(1111, def.getPrice().getNormalPrice());
                currentOffer = new SellOffer(item.getItemId(), item.getItemAmount(), def.getPrice().getNormalPrice(), slot, p.getLoginDetails().getUsername());
                currentOffer.setUnNotedId(item.getDefinition().isNoted() ? itemToShow : item.getItemId());
            }
        }
예제 #6
0
 public void updateSearchItem(int item)
 {
     p.getPackets().sendConfig(1109, item);
     p.getPackets().sendConfig(1110, 0);
     ItemData.Item def = ItemData.forId(item);
     if (def == null)
     {
         return;
     }
     p.getPackets().sendConfig(1109, item);
     p.getPackets().sendConfig(1114, def.getPrice().getNormalPrice());
     p.getPackets().sendConfig(1116, def.getPrice().getMaximumPrice());
     p.getPackets().sendConfig(1115, def.getPrice().getMinimumPrice());
     p.getPackets().sendConfig(1111, def.getPrice().getNormalPrice());
     currentOffer = new BuyOffer(slot, p.getLoginDetails().getUsername());
     currentOffer.setTotalAmount(0);
     currentOffer.setItem(item);
     currentOffer.setPriceEach(def.getPrice().getNormalPrice());
     p.getPackets().sendInterface(0, 752, 6, 137);         // Removes the item search
 }
예제 #7
0
 public void setItemId(int itemId)
 {
     this.itemId         = itemId;
     this.itemDefinition = ItemData.forId(itemId);
 }
예제 #8
0
 public Item(int id, int amount)
 {
     this.itemId         = id;
     this.itemAmount     = amount;
     this.itemDefinition = ItemData.forId(id);
 }
예제 #9
0
        public void checkOffer(byte slot)
        {
            this.currentOffer = myGEItems[slot];

            /*
             * The line below always gets the GEItem by player and GE slot from database.
             * It's alot slower to keep retrieving it from database.
             * Line above this comment uses the preloaded GEItems
             * That should be the same thing, But faster.
             */
            //this.currentOffer = Server.getGrandExchange().getOfferByPlayerSlot(p, slot);

            if (currentOffer == null)
            {
                p.getPackets().sendMessage("[checkOffer]: Nice try cheater!, If this is bug please report it.");
                return;
            }

            ItemData.ItemPrice price = currentOffer.getItemPrice();
            ItemData.Item      def   = ItemData.forId(currentOffer.getItem());

            if (def == null)
            {
                p.getPackets().sendMessage("Item: " + currentOffer.getItem() + " cannot be found in item definitions, please report it.");
                return;
            }

            p.getPackets().sendConfig(1109, currentOffer.getItem());
            p.getPackets().sendConfig(1110, currentOffer.getTotalAmount());
            p.getPackets().sendConfig(1111, currentOffer.getPriceEach());
            p.getPackets().sendConfig(1112, currentOffer.getSlot());
            p.getPackets().sendConfig(1113, 0);
            p.getPackets().sendConfig(1114, price.getNormalPrice());
            p.getPackets().sendConfig(1116, price.getMaximumPrice());
            p.getPackets().sendConfig(1115, price.getMinimumPrice());
            p.getPackets().modifyText(def.getExamine(), 105, 142); //item examine text.

            if (currentOffer is BuyOffer)
            {
                //A Buyer can have how much of the item's he bought shown even if they aborted the currentOffer.
                currentOffer.setSlot1((currentOffer.getAmountItemsLeftToCollect() > 0) ? new Item(currentOffer.getItem(), currentOffer.getAmountItemsLeftToCollect()) : null);

                /**If Buyer Aborted the item buying, it shows UnBought item gold + Overpay gold
                 * If Buyer doesn't abort the item it shows just Overpay gold.
                 */
                if (currentOffer.isAborted())
                {
                    currentOffer.setSlot2((currentOffer.getTotalAmountGoldLeftToCollect() > 0) ? new Item(995, currentOffer.getTotalAmountGoldLeftToCollect()) : null);
                }
                else
                {
                    currentOffer.setSlot2((currentOffer.getAmountCollectedGold() < currentOffer.getAmountOverpaid()) ? new Item(995, currentOffer.getAmountOverpaid()) : null);
                }
            }
            else if (currentOffer is SellOffer)
            {
                //If Seller Aborted the item selling, it shows UnSold items
                currentOffer.setSlot1((currentOffer.isAborted() && currentOffer.getTotalAmountItemsLeftToCollect() > 0) ? new Item(currentOffer.getItem(), currentOffer.getTotalAmountItemsLeftToCollect()) : null);

                //Always shows Seller Item Sold Gold + Overpay gold (shows how much money you made from sales + overpays.)
                currentOffer.setSlot2((currentOffer.getAmountGoldLeftToCollect() > 0) ? new Item(995, currentOffer.getAmountGoldLeftToCollect()) : null);
            }

            Item[] items = { currentOffer.getSlot1(), currentOffer.getSlot2() };
            p.getPackets().sendItems(-1, -1757, 523 + currentOffer.getSlot(), items);
        }
예제 #10
0
 private static InventorySlot GetItemSlot(this ItemData.Item item)
 {
     return(ObjectManager.Player.InventoryItems.FirstOrDefault(i => i.Id == (ItemId)item.Id));
 }
예제 #11
0
        public static bool IsReady(this ItemData.Item item)
        {
            var slot = item.GetItemSlot();

            return(slot != null && slot.IsValidSlot() && slot.SpellSlot.IsReady());
        }
예제 #12
0
        public static bool HasItem(this ItemData.Item item)
        {
            var slot = item.GetItemSlot();

            return(slot != null && slot.IsValidSlot());
        }
예제 #13
0
 public static bool Cast(this ItemData.Item item, Obj_AI_Base target)
 {
     return(item._cast(target));
 }
예제 #14
0
 public static bool Cast(this ItemData.Item item)
 {
     return(item._cast(ObjectManager.Player));
 }