public void SellItemTest() { AppId.AppName app = AppId.AppName.CounterStrikGlobalOffensive; SteamInventoryItem item = null; foreach (AppId.AppName appId in Enum.GetValues(typeof(AppId.AppName))) { AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, 1); if (accountInventorys.SteamInventory.TotalItems > 0) { item = accountInventorys.SteamInventory.SteamInventoryItems[0]; app = appId; break; } } if (item != null) { string itemId = item.ItemIds[0]; double itemPrice = item.SuggestedPrice.Value * 5; InformationAboutSale information = Sale.SellItem(app, new List <string> { itemId }, new List <double> { itemPrice }); string id = information.SoldItems[0].ItemId; Assert.AreEqual(itemId, id); } Assert.IsTrue(true); }
public void RelistAndDelistItemTest() { AppId.AppName app = AppId.AppName.CounterStrikGlobalOffensive; BitSkinsInventoryItem item = null; foreach (AppId.AppName appId in Enum.GetValues(typeof(AppId.AppName))) { AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, 1); if (accountInventorys.BitSkinsInventory.TotalItems > 0) { item = accountInventorys.BitSkinsInventory.BitSkinsInventoryItems[0]; app = appId; break; } } if (item != null) { string itemId = item.ItemIds[0]; double itemPrice = item.Prices[0]; Console.WriteLine(item.MarketHashName + " " + itemPrice); List <DelistedItem> delistedItems = DelistFromSale.DelistItem(app, new List <string> { itemId }); Assert.AreEqual(itemId, delistedItems[0].ItemId); List <RelistedItem> relistedItems = RelistForSale.RelistItem(app, new List <string> { itemId }, new List <double> { itemPrice }); } Assert.IsTrue(true); }
public void WithdrawItemTest() { BitSkinsApi.Market.AppId.AppName app = BitSkinsApi.Market.AppId.AppName.CounterStrikGlobalOffensive; string itemId = ""; foreach (BitSkinsApi.Market.AppId.AppName appId in Enum.GetValues(typeof(BitSkinsApi.Market.AppId.AppName))) { AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, 1); foreach (var item in accountInventorys.PendingWithdrawalFromBitskinsInventory.PendingWithdrawalFromBitskinsInventoryItems) { if (item.WithdrawableAt < DateTime.Now) { app = appId; itemId = item.ItemId; break; } } if (!String.IsNullOrEmpty(itemId)) { break; } } if (!String.IsNullOrEmpty(itemId)) { InformationAboutWithdrawn information = WithdrawalOfItems.WithdrawItem(app, new List <string> { itemId }); string id = information.WithdrawnItems[0].ItemId; Assert.AreEqual(itemId, id); } Assert.IsTrue(true); }
public void GetAccountInventoryTest() { foreach (BitSkinsApi.Market.AppId.AppName appId in Enum.GetValues(typeof(BitSkinsApi.Market.AppId.AppName))) { int page = 1; AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, page); while (accountInventorys.BitSkinsInventory.BitSkinsInventoryItems.Count != 0) { page++; accountInventorys = Inventories.GetAccountInventory(appId, page); } } Assert.IsTrue(true); }
private static HashSet <int> GetAccountIDs(string APIKey, AccountInventory accountInv) { var itemIDs = new HashSet <int>(); foreach (Character character in accountInv.Characters) { itemIDs.UnionWith(GetIDs(GetInventory(character.Bags))); itemIDs.UnionWith(GetIDs(GetEquiment(character.Equipment))); } itemIDs.UnionWith(GetIDs(accountInv.Bank)); itemIDs.UnionWith(GetIDs(accountInv.MaterialStorage)); itemIDs.UnionWith(GetIDs(accountInv.OwnSellListings)); itemIDs.UnionWith(GetIDs(accountInv.OwnBuyListings)); return(itemIDs); }
public void ModifySaleTest() { AppId.AppName app = AppId.AppName.CounterStrikGlobalOffensive; BitSkinsInventoryItem item = null; foreach (AppId.AppName appId in Enum.GetValues(typeof(AppId.AppName))) { AccountInventory accountInventorys = Inventories.GetAccountInventory(appId, 1); if (accountInventorys.BitSkinsInventory.TotalItems > 0) { item = accountInventorys.BitSkinsInventory.BitSkinsInventoryItems[0]; app = appId; break; } } if (item != null) { string itemId = item.ItemIds[0]; double itemPrice = item.Prices[0]; double itemNewPrice = itemPrice * 5; List <ModifiedItem> modifiedItems = ModifySaleItems.ModifySale(app, new List <string> { itemId }, new List <double> { itemNewPrice }); Assert.AreEqual(itemId, modifiedItems[0].ItemId); modifiedItems = ModifySaleItems.ModifySale(app, new List <string> { itemId }, new List <double> { itemPrice }); Assert.AreEqual(itemId, modifiedItems[0].ItemId); } Assert.IsTrue(true); }
/// <summary> /// Calculates Account Value. Uses known Items to reduce amount of calls. /// Lighter API Call(Depends on the amount of known Itemlistings and Items). /// </summary> /// <param name="APIKey"></param> /// <param name="knownItemListings"></param> /// <param name="knownItems"></param> /// <returns></returns> public static AccountValue GetAccountValue(string APIKey, List <Item> knownItems) { AccountInventory accountInv = GetAccountInventory(APIKey); //Retrive all IDs that need to be called from the Official GWAPI HashSet <int> itemIDs = GetAccountIDs(APIKey, accountInv); Console.WriteLine("Count = " + itemIDs.Count); //Determines what items are already known and are removed from the request HashSet <int> unknownItemIDs = new HashSet <int>(itemIDs.Except(GetIDs(knownItems)).ToList()); List <Item> items = ItemAPI.GetItem(unknownItemIDs); items.AddRange(knownItems); Console.WriteLine("Count = " + itemIDs.Count); List <ItemListing> itemListings = ItemAPI.GetItemListing(itemIDs); //Parse it into object AccountValue account = new AccountValue(); account.Bank = GetItemValues(accountInv.Bank, itemListings, items); account.Material = GetItemValues(accountInv.MaterialStorage, itemListings, items); account.Wallet = GetWalletEntries(APIKey); account.GemConversion = GetGemToGoldConversion(); account.OwnSellListings = GetTransactionValues(itemListings, accountInv.OwnSellListings); account.OwnBuyListings = GetTransactionValues(itemListings, accountInv.OwnBuyListings); foreach (Character character in accountInv.Characters) { account.Characters.Add(new CharacterValue() { Name = character.Name, Inventory = GetItemValues(GetInventory(character.Bags), itemListings, items), Equipment = GetItemValues(GetEquiment(character.Equipment), itemListings, items), }); } return(account); }