public static void HandleBuyItemRequestMessage(BuyItemRequestMessage message, LoLClient client) { ItemRecord itemRecord = ItemRecord.GetItemRecord(message.itemId); if (client.Hero.Stats.Gold >= itemRecord.Price) { int[] recipePrices = client.Hero.Inventory.RemoveRecipeItem(itemRecord); Item itemResult = client.Hero.Inventory.AddItem(itemRecord); if (itemResult != null) { int priceTotal = itemRecord.GetTotalPrice(); foreach (var price in recipePrices) { priceTotal -= price; } client.Hero.RemoveGold(priceTotal); client.Hero.UpdateStats(); } } }