示例#1
0
        /// <summary>
        /// Buys the specified item from the currently loaded shop.
        /// </summary>
        /// <param name="name">The name of the item to buy.</param>
        public void BuyItem(string name)
        {
            ShopItem item;

            if (IsShopLoaded && (item = ShopItems.Find(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase))) != null)
            {
                if (Bot.Options.SafeTimings)
                {
                    Bot.Wait.ForActionCooldown(ScriptWait.GameActions.BuyItem);
                }
                Bot.SendPacket($"%xt%zm%buyItem%{Bot.Map.RoomID}%{item.ID}%{ShopID}%{item.ShopItemID}%");
                if (Bot.Options.SafeTimings)
                {
                    Bot.Wait.ForTrue(() => Bot.Inventory.Contains(name), 10);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Buys the specified item from the currently loaded shop.
        /// </summary>
        /// <param name="itemId">The id of the item to buy.</param>
        public void BuyItem(int itemId)
        {
            var item = ShopItems.Find(i => i.ID == itemId);

            Bot.SendPacket($"%xt%zm%buyItem%{Bot.Map.RoomID}%{item.ID}%{ShopID}%{item.ShopItemID}%");
        }