public static bool checkBlacklisted(EconomyItem Item) { if (Item.isBlacklisted) { return(true); } return(false); }
public static bool checkBlacklisted(EconomyItem Item) { if (Item.isBlacklisted) { return true; } return false; }
internal static void addItem(string Name, decimal buyPrice, decimal sellPrice, bool isBlacklisted = false) { EconomyItem newItem = new EconomyItem(); newItem.ItemName = Name; newItem.BuyPrice = buyPrice; newItem.SellPrice = sellPrice; newItem.isBlacklisted = isBlacklisted; addItem(newItem); }
public static string getTypeId(EconomyItem Item) { return(Item.TypeId); }
public static decimal getSellPrice(EconomyItem Item) { return(Item.SellPrice); }
public static decimal getBuyPrice(EconomyItem Item) { return(Item.BuyPrice); }
public static void removeItem(EconomyItem Item) { Items.Remove(Item); }
public static void addItem(EconomyItem Item) { Items.Add(Item); }
static void Main(string[] args) { Console.WriteLine("Begin testing"); EconomyItem SomeBlock = new EconomyItem(); SomeBlock.SubTypeName = "SomeBlock"; SomeBlock.BuyPrice = 4.50m; SomeBlock.SellPrice = 3.50m; ItemAPI.addItem(SomeBlock); EconomyItem RedBlock = new EconomyItem(); RedBlock.SubTypeName = "RedBlock"; RedBlock.BuyPrice = 3.50m; RedBlock.SellPrice = 4.90m; RedBlock.isBlacklisted = true; ItemAPI.addItem(RedBlock); EconomyItem BlueBlock = new EconomyItem(); BlueBlock.SubTypeName = "BlueBlock"; BlueBlock.BuyPrice = 3.50m; BlueBlock.SellPrice = 4.90m; BlueBlock.isBlacklisted = false; ItemAPI.addItem(BlueBlock); EconomyItem TNTBlock = new EconomyItem(); TNTBlock.SubTypeName = "TNTBlock"; TNTBlock.BuyPrice = 90.00m; TNTBlock.SellPrice = 120.00m; TNTBlock.isBlacklisted = true; ItemAPI.addItem(TNTBlock); Console.WriteLine("Standard foreach loop through the whole list..."); Console.WriteLine("================================== Items: =================================="); foreach (EconomyItem Item in ItemAPI.getItems()) { Console.WriteLine(" Item: " + ItemAPI.getHumanFriendly(Item.SubTypeName) + " Buy Price: " + Item.BuyPrice + " Sell Price: " + Item.SellPrice + " Blacklisted: " + Item.isBlacklisted.ToString()); } Console.WriteLine("============================================================================"); Console.WriteLine("Gets the buy and sell price for each item in the whole list... This just proves that we can grab an item buy and sell price seperate using a command."); Console.WriteLine("================================== Items: =================================="); foreach (EconomyItem Item in ItemAPI.getItems()) { Console.WriteLine(" Item: " + ItemAPI.getHumanFriendly(Item.SubTypeName) + " Buy Price: " + ItemAPI.getBuyPrice(Item).ToString() + " Sell Price: " + ItemAPI.getSellPrice(Item).ToString() + " Blacklisted: " + ItemAPI.checkBlacklisted(Item).ToString()); } Console.WriteLine("============================================================================"); Console.WriteLine("Get a single block named 'Some Block' buy price by string input:" + ItemAPI.getBuyPrice("Some Block")); Console.WriteLine("Get a single block named 'Some Block' sell price by string input:" + ItemAPI.getSellPrice("Some Block")); Console.WriteLine("============================================================================"); EconomyItem AnotherBlock = new EconomyItem(); AnotherBlock.SubTypeName = "AnotherBlock"; AnotherBlock.BuyPrice = 1.50m; AnotherBlock.SellPrice = 2.50m; ItemAPI.addItem(AnotherBlock); Console.WriteLine("Get a single block named 'Another Block' buy price by EconomyItem type input (Note we add Another Block to the list here):" + ItemAPI.getBuyPrice(AnotherBlock).ToString()); ItemAPI.removeItem(AnotherBlock); Console.WriteLine("Get a single block named 'Another Block' sell price by EconomyItem type input (Note we add Another Block to the list here):" + ItemAPI.getSellPrice(AnotherBlock).ToString()); Console.WriteLine("============================================================================"); Console.WriteLine("Check to see if 'Red Block' is blacklisted (It should be): " + ItemAPI.checkBlacklisted("RedBlock")); Console.WriteLine("Check to see if 'Blue Block' is blacklisted (It should not be): " + ItemAPI.checkBlacklisted("BlueBlock")); Console.WriteLine("Check to see if 'TNT Block' is blacklisted (It should be): " + ItemAPI.checkBlacklisted("TNTBlock")); Console.WriteLine("End of testing"); Console.WriteLine("Press any key to exit this prototype..."); Console.ReadKey(); }
public static string getTypeId(EconomyItem Item) { return Item.TypeId; }
public static decimal getSellPrice(EconomyItem Item) { return Item.SellPrice; }
public static decimal getBuyPrice(EconomyItem Item) { return Item.BuyPrice; }