Advertisement
botters

Untitled

Sep 28th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.39 KB | None | 0 0
  1. #region Booth
  2. static void ShowBoothItems(ItemUsage usage, Client.GameState client)
  3. {
  4. Client.GameState Owner = null;
  5. Game.Entity entity = null;
  6. Game.ConquerStructures.Booth booth = null;
  7. if (Game.ConquerStructures.Booth.TryGetValue(usage.UID, out booth))
  8. {
  9. Owner = booth.Base.Owner;
  10. entity = Owner.Entity;
  11. if (client.Trade.InTrade || Owner.Trade.InTrade)
  12. return;
  13. if (Owner != null)
  14. {
  15. if (Owner.Entity.UID != client.Entity.UID)
  16. {
  17. BoothItem Item = new BoothItem(true);
  18. if (Owner.Booth != null)
  19. {
  20. foreach (Game.ConquerStructures.BoothItem item in Owner.Booth.ItemList.Values)
  21. {
  22. Item.Fill(item, Owner.Booth.Base.UID);
  23. client.Send(Item);
  24. item.Item.SendExtras(client);
  25. }
  26. }
  27. }
  28. }
  29. }
  30. if (Game.ConquerStructures.Booth.TryGetValue2(usage.UID, out booth))
  31. {
  32. BoothItem Item = new BoothItem(true);
  33. if (booth != null)
  34. {
  35. foreach (Game.ConquerStructures.BoothItem item in booth.ItemList.Values)
  36. {
  37. Item.Fill(item, usage.UID);
  38. client.Send(Item);
  39. item.Item.SendExtras(client);
  40. }
  41. }
  42. }
  43. }
  44. static void AddItemOnBooth(ItemUsage usage, Client.GameState client)
  45. {
  46. if (client.Booth != null && !client.Trade.InTrade)
  47. {
  48. if (!client.Booth.ItemList.ContainsKey(usage.UID))
  49. {
  50. if (client.Inventory.ContainsUID(usage.UID))
  51. {
  52. Game.ConquerStructures.BoothItem item = new VenusProject.Game.ConquerStructures.BoothItem();
  53. item.Cost = usage.dwParam;
  54. client.Inventory.TryGetItem(usage.UID, out item.Item);
  55. Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
  56. if (item.Item.Lock != 0 || item.Item.Suspicious || item.Item.Bound || infos.BaseInformation.Type != Database.ConquerItemBaseInformation.ItemType.Dropable)
  57. {
  58. return;
  59. }
  60. if (Constants.SoulList.Contains((int)item.Item.ID) && item.Cost < 1000000)
  61. {
  62. Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "you cant sell any special soul item less than 1kk cps ok?");
  63. npc.OptionID = 255;
  64. client.Send(npc.ToArray());
  65. return;
  66. }
  67. if (Constants.SoulList.Contains((int)item.Item.Purification.PurificationItemID) && item.Cost < 1000000)
  68. {
  69. Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "you cant sell any special soul item less than 3kk cps ok?");
  70. npc.OptionID = 255;
  71. client.Send(npc.ToArray());
  72. return;
  73. }
  74. if (Constants.SoulList.Contains((int)item.Item.Purification.PurificationItemID) && item.Cost_Type == VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers)
  75. {
  76. Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "you cant sell any special soul item for silver?");
  77. npc.OptionID = 255;
  78. client.Send(npc.ToArray());
  79. return;
  80. }
  81. item.Cost_Type = usage.ID == ItemUsage.AddItemOnBoothForSilvers ? VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers : VenusProject.Game.ConquerStructures.BoothItem.CostType.ConquerPoints;
  82. client.Booth.ItemList.Add(item.Item.UID, item);
  83. client.Send(usage);
  84. BoothItem Item = new BoothItem(true);
  85. Item.Fill(item, client.Booth.Base.UID);
  86. client.SendScreen(Item, false);
  87. }
  88. }
  89. }
  90. }
  91. static void BuyFromBooth(ItemUsage usage, Client.GameState client)
  92. {
  93. if (client.Server != null)
  94. return;
  95. Client.GameState Owner = null;
  96. Game.Entity entity = null;
  97. Game.ConquerStructures.Booth booth = null;
  98. if (Game.ConquerStructures.Booth.TryGetValue(usage.dwParam, out booth))
  99. {//k that should be it, test and see ok
  100. Owner = booth.Base.Owner;
  101. entity = Owner.Entity;
  102. if (client.Trade.InTrade || Owner.Trade.InTrade)
  103. return;
  104. if (Owner != null)
  105. {
  106. if (Owner.Trade != null)
  107. {
  108. if (Owner.Trade.InTrade) return;
  109. }
  110. if (Owner.Entity.UID != client.Entity.UID)
  111. {
  112. if (Owner.Booth.ItemList.ContainsKey(usage.UID))
  113. {
  114. Game.ConquerStructures.BoothItem item;
  115. if (Owner.Booth.ItemList.TryGetValue(usage.UID, out item))
  116. {
  117. if (client.Inventory.Count <= 39)
  118. {
  119. if (item.Cost_Type == VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers)
  120. {
  121. if (client.Entity.Money >= item.Cost)
  122. {
  123. client.Entity.Money -= item.Cost;
  124. //Database.EntityTable.UpdateMoney(client);
  125. Owner.Entity.Money += item.Cost;
  126. //Database.EntityTable.UpdateMoney(Owner);
  127. client.Send(usage);
  128. client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
  129. usage.ID = ItemUsage.RemoveItemFromBooth;
  130. Owner.Send(usage);
  131. Owner.Inventory.Remove(item.Item.UID, Game.Enums.ItemUse.None, false);
  132. usage.ID = ItemUsage.RemoveInventory;
  133. Owner.Send(usage);
  134. Owner.Booth.ItemList.Remove(item.Item.UID);
  135. Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
  136. Owner.Send(Constants.BoothItemSell(client.Entity.Name, infos.BaseInformation.Name, false, item.Cost));
  137. Program.AddVendorLog(Owner.Entity.Name, client.Entity.Name, item.Cost.ToString() + " Silvers", item.Item);
  138. }
  139. }
  140. else
  141. {
  142. if (client.Entity.ConquerPoints >= item.Cost)
  143. {
  144. client.Entity.ConquerPoints -= item.Cost;
  145. Database.EntityTable.UpdateCps(client);
  146. Owner.Entity.ConquerPoints += item.Cost;
  147. Database.EntityTable.UpdateCps(Owner);
  148. client.Send(usage);
  149. client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
  150. usage.ID = ItemUsage.RemoveItemFromBooth;
  151. Owner.Send(usage);
  152. Owner.Inventory.Remove(item.Item.UID, Game.Enums.ItemUse.None, false);
  153. usage.ID = ItemUsage.RemoveInventory;
  154. Owner.Send(usage);
  155. Owner.Booth.ItemList.Remove(item.Item.UID);
  156. Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
  157. Owner.Send(Constants.BoothItemSell(client.Entity.Name, infos.BaseInformation.Name, true, item.Cost));
  158. Program.AddVendorLog(Owner.Entity.Name, client.Entity.Name, item.Cost.ToString() + " CPs", item.Item);
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. if (Game.ConquerStructures.Booth.TryGetValue2(usage.dwParam, out booth))
  168. {
  169. if (booth.ItemList.ContainsKey(usage.UID))
  170. {
  171. Game.ConquerStructures.BoothItem item;
  172. if (booth.ItemList.TryGetValue(usage.UID, out item))
  173. {
  174. if (client.Inventory.Count <= 39)
  175. {
  176. if (item.Cost_Type == VenusProject.Game.ConquerStructures.BoothItem.CostType.Silvers)
  177. {
  178. if (client.Entity.Money >= item.Cost)
  179. {
  180. client.Entity.Money -= item.Cost;
  181. client.Send(usage);
  182. client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
  183. Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
  184. Program.AddVendorLog("matrix™[" + usage.dwParam.ToString() + "]", client.Entity.Name, item.Cost.ToString() + " Silvers", item.Item);
  185. var newitem = new Game.ConquerStructures.BoothItem();
  186. newitem.Regenerate(item, booth);
  187. Network.GamePackets.BoothItem Item = new Network.GamePackets.BoothItem(true);
  188. foreach (Game.ConquerStructures.BoothItem i in booth.ItemList.Values)
  189. {
  190. Item.Fill(i, usage.dwParam);
  191. client.Send(Item);
  192. item.Item.SendExtras(client);
  193. }
  194. }
  195. }
  196. else
  197. {
  198. if (client.Entity.ConquerPoints >= item.Cost)
  199. {
  200. client.Entity.ConquerPoints -= item.Cost;
  201. Database.EntityTable.UpdateCps(client);
  202. client.Send(usage);
  203. client.Inventory.Add(item.Item, Game.Enums.ItemUse.Move);
  204. Database.ConquerItemInformation infos = new Database.ConquerItemInformation(item.Item.ID, 0);
  205. Program.AddVendorLog("matrix™[" + usage.dwParam.ToString() + "]", client.Entity.Name, item.Cost.ToString() + " CPs", item.Item);
  206. var newitem = new Game.ConquerStructures.BoothItem();
  207. newitem.Regenerate(item, booth);
  208. Network.GamePackets.BoothItem Item = new Network.GamePackets.BoothItem(true);
  209. foreach (Game.ConquerStructures.BoothItem i in booth.ItemList.Values)
  210. {
  211. Item.Fill(i, usage.dwParam);
  212. client.Send(Item);
  213. item.Item.SendExtras(client);
  214. }
  215. }
  216. }
  217. }
  218.  
  219. }
  220. }
  221. }
  222. }
  223. static void RemoveItemFromBooth(ItemUsage usage, Client.GameState client)
  224. {
  225. if (client.Booth.ItemList.ContainsKey(usage.UID))
  226. {
  227. client.Booth.ItemList.Remove(usage.UID);
  228. client.SendScreen(usage, true);
  229. }
  230. }
  231. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement