Seuss_CZ

Untitled

Feb 8th, 2017
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. case ("buy"):
  2. if (int.TryParse(command[1], out auctionid))
  3. {
  4. try
  5. {
  6. byte x = 0, y = 0, rot = 0, page = 0;
  7. if (player.Inventory.tryFindSpace(1, 1, out page, out x, out y, out rot))
  8. {
  9. string[] itemInfo = LIGHT.Instance.DatabaseAuction.AuctionBuy(auctionid);
  10. decimal balance = Uconomy.Instance.Database.GetBalance(player.Id);
  11. decimal cost = 1.00m;
  12. decimal.TryParse(itemInfo[2], out cost);
  13. if (balance < cost)
  14. {
  15. UnturnedChat.Say(player, LIGHT.Instance.DefaultTranslations.Translate("not_enough_currency_msg", Uconomy.Instance.Configuration.Instance.MoneyName, itemInfo[1]));
  16. return;
  17. }
  18. player.GiveItem(ushort.Parse(itemInfo[0]), 1);
  19. InventorySearch inventory = player.Inventory.has(ushort.Parse(itemInfo[0]));
  20. byte index = player.Inventory.getIndex(inventory.page, inventory.jar.x, inventory.jar.y);
  21. player.Inventory.updateQuality(inventory.page, index, byte.Parse(itemInfo[3]));
  22. LIGHT.Instance.DatabaseAuction.DeleteAuction(command[1]);
  23. decimal newbal = Uconomy.Instance.Database.IncreaseBalance(player.CSteamID.ToString(), (cost * -1));
  24. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_buy_msg", itemInfo[1], cost, Uconomy.Instance.Configuration.Instance.MoneyName, newbal, Uconomy.Instance.Configuration.Instance.MoneyName));
  25. decimal sellernewbalance = Uconomy.Instance.Database.IncreaseBalance(itemInfo[4], (cost * 1));
  26. }
  27. else
  28. {
  29. UnturnedChat.Say(caller, "Inventory is full!");
  30. return;
  31. }
  32. }
  33. catch
  34. {
  35. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_addcommand_idnotexist"));
  36. return;
  37. }
  38.  
  39. }
  40. else
  41. {
  42. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_addcommand_usage2"));
  43. return;
  44. }
  45. break;
  46. case ("cancel"):
  47. if (int.TryParse(command[1], out auctionid))
  48. {
  49. if (LIGHT.Instance.DatabaseAuction.checkAuctionExist(auctionid))
  50. {
  51. string OwnerID = LIGHT.Instance.DatabaseAuction.GetOwner(auctionid);
  52. if (OwnerID.Trim() == player.Id.Trim())
  53. {
  54. byte x = 0, y = 0, rot = 0, page = 0;
  55. if (player.Inventory.tryFindSpace(1, 1, out page, out x, out y, out rot))
  56. {
  57. string[] itemInfo = LIGHT.Instance.DatabaseAuction.AuctionCancel(auctionid);
  58. player.GiveItem(ushort.Parse(itemInfo[0]), 1);
  59. InventorySearch inventory = player.Inventory.has(ushort.Parse(itemInfo[0]));
  60. byte index = player.Inventory.getIndex(inventory.page, inventory.jar.x, inventory.jar.y);
  61. player.Inventory.updateQuality(inventory.page, index, byte.Parse(itemInfo[1]));
  62. LIGHT.Instance.DatabaseAuction.DeleteAuction(auctionid.ToString());
  63. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_cancelled", auctionid));
  64. }
  65. else
  66. {
  67. UnturnedChat.Say(caller, "Inventory is full!");
  68. return;
  69. }
  70. }
  71. else
  72. {
  73. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_notown"));
  74. return;
  75. }
  76. }
  77. else
  78. {
  79. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_notexist"));
  80. return;
  81. }
  82. }
  83. else
  84. {
  85. UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_notexist"));
  86. return;
  87. }
  88. break;
RAW Paste Data