Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.32 KB | None | 0 0
  1. package com.vencillio.rs2.content.kingdomtest;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.util.Arrays;
  6. import java.util.TimerTask;
  7.  
  8. import com.oslegend.Server;
  9. import com.vencillio.core.util.Utility;
  10. import com.vencillio.core.util.chance.Chance;
  11. import com.vencillio.core.util.chance.WeightedChance;
  12. import com.vencillio.rs2.entity.World;
  13. import com.vencillio.rs2.entity.item.Item;
  14. import com.vencillio.rs2.entity.player.Player;
  15. import com.vencillio.rs2.entity.player.controllers.Controller;
  16. import com.vencillio.rs2.entity.player.controllers.ControllerManager;
  17. import com.vencillio.rs2.entity.player.net.out.impl.SendMessage;
  18. import com.vencillio.rs2.entity.player.net.out.impl.SendString;
  19.  
  20. import javax.swing.Timer;
  21. /**
  22. * Handles Mystery Box rewards
  23. * @author EEAZY
  24. *
  25. */
  26. public abstract class HireResourceWorkers{
  27. /**
  28. * @author EEAZY
  29. */
  30.  
  31. /**
  32. * Hire Resource Workers
  33. */
  34. //Start CollectionInts
  35. static int CoalCollect = 0;
  36. static int GoldCollect = 0;
  37. static int MithrilCollect = 0;
  38. static int AdaCollect = 0;
  39. static int LogCollect = 0;
  40. static int WillowCollect = 0;
  41. static int YewCollect = 0;
  42. static int MagicCollect = 0;
  43. //END COLLECTION INTS
  44. public static boolean nodepurchasetrue = true;
  45. public static boolean nodepurchasefalse = false;
  46.  
  47. //logic for buying tree nodes
  48. public static void NormalWoodNodeTrue(Player player) {
  49. Player.resourcenodes [0] = 1;
  50. player.send(new SendMessage("You've purchased Normal Log Node"));
  51. }
  52.  
  53. public static void WillowNodeTrue(Player player) {
  54. Player.resourcenodes [1] = 1;
  55. player.send(new SendMessage("You've purchased Willow Node"));
  56.  
  57. }
  58.  
  59. public static void YewNodeTrue(Player player) {
  60. Player.resourcenodes [2] = 1;
  61. player.send(new SendMessage("You've purchased Yew Node"));
  62. }
  63.  
  64. public static void MagicNodeFalse(Player player) {
  65. Player.resourcenodes [3] = 1;
  66. player.send(new SendMessage("You've purchased Magic Node"));
  67. }
  68.  
  69. public static void CoalNode(Player player) {
  70. boolean MagicNodeFalse = true;
  71. MagicNodeFalse = MagicNodeFalse == true ? true : false;
  72. Player.resourcenodes2 [0] = 1;
  73. player.send(new SendMessage("You've purchased Coal Node"));
  74. }
  75. public static void GoldNode(Player player) {
  76. Player.resourcenodes2 [1] = 1;
  77. player.send(new SendMessage("You've purchased Gold Node"));
  78. }
  79. public static void MithrilNode(Player player) {
  80. Player.resourcenodes2 [2] = 1;
  81. player.send(new SendMessage("You've purchased Mithril Node"));
  82. }
  83. public static void AdamantiteNode(Player player) {
  84. Player.resourcenodes2 [3] = 1;
  85. player.send(new SendMessage("You've purchased Adamantite Node"));
  86. }
  87.  
  88. public static void res(Player player) {
  89. boolean update = true;
  90. if(LogCollect > 1) {
  91. player.getBank().depositFromNoting(1511, LogCollect, 1, update);
  92. LogCollect = 0;
  93. player.send(new SendString(LogCollect + "", 24256));
  94. }
  95. if(WillowCollect > 1) {
  96. player.getBank().depositFromNoting(1519, WillowCollect, 1, update);
  97. WillowCollect = 0;
  98. player.send(new SendString(WillowCollect + "", 24257));
  99.  
  100. }
  101. if(YewCollect > 1) {
  102. player.getBank().depositFromNoting(1515, YewCollect, 1, update);
  103. YewCollect = 0;
  104. player.send(new SendString(YewCollect + "", 24258));
  105.  
  106. }
  107. if(MagicCollect > 1) {
  108. player.getBank().depositFromNoting(1513, MagicCollect, 1, update);
  109. MagicCollect = 0;
  110. player.send(new SendString(MagicCollect + "", 24259));
  111.  
  112. }
  113. if(CoalCollect > 1) {
  114. player.getBank().depositFromNoting(453, CoalCollect, 1, update);
  115. CoalCollect = 0;
  116. player.send(new SendString(CoalCollect + "", 24260));
  117.  
  118. }
  119. if(GoldCollect > 1) {
  120. player.getBank().depositFromNoting(444, GoldCollect, 1, update);
  121. GoldCollect = 0;
  122. player.send(new SendString(GoldCollect + "", 24261));
  123.  
  124. }
  125. if(MithrilCollect > 1) {
  126. player.getBank().depositFromNoting(447, MithrilCollect, 1, update);
  127. MithrilCollect = 0;
  128. player.send(new SendString(MithrilCollect + "", 24262));
  129. }
  130. if(AdaCollect > 1) {
  131. player.getBank().depositFromNoting(449, AdaCollect, 1, update);
  132. AdaCollect = 0;
  133. player.send(new SendString(AdaCollect + "", 24263));
  134. }
  135. }
  136.  
  137. //collecting resource logic
  138. public static void open(Player player) {
  139. int NormalWoodNode = Player.resourcenodes [0];
  140. int WillowNode = Player.resourcenodes [1];
  141. int YewNode = Player.resourcenodes [2];
  142. int MagicNode = Player.resourcenodes [3];
  143. if(NormalWoodNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  144.  
  145. Timer timer = new Timer(5000, new ActionListener() {
  146. @Override
  147. public void actionPerformed(ActionEvent e) {
  148. // TODO Auto-generated method stub
  149. LogCollect++;
  150. player.send(new SendString(LogCollect + "", 24256));
  151. }
  152. });
  153. timer.start();
  154. } else {
  155. player.send(new SendMessage("You need to purchase this node."));
  156. }
  157. if(WillowNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  158. Timer timer = new Timer(5000, new ActionListener() {
  159. @Override
  160. public void actionPerformed(ActionEvent e) {
  161. // TODO Auto-generated method stub
  162. WillowCollect++;
  163. player.send(new SendString(WillowCollect + "", 24257));
  164.  
  165. }
  166. });
  167. timer.start();
  168.  
  169.  
  170. } else {
  171. player.send(new SendMessage("You need to purchase this node."));
  172. }
  173. if(YewNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  174. Timer timer = new Timer(5000, new ActionListener() {
  175. @Override
  176. public void actionPerformed(ActionEvent e) {
  177. // TODO Auto-generated method stub
  178. YewCollect++;
  179. player.send(new SendString(YewCollect + "", 24258));
  180.  
  181. }
  182. });
  183. timer.start();
  184. } else {
  185. player.send(new SendMessage("You need to purchase this node."));
  186. }
  187. if(MagicNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  188. Timer timer = new Timer(5000, new ActionListener() {
  189. @Override
  190. public void actionPerformed(ActionEvent e) {
  191. // TODO Auto-generated method stub
  192. MagicCollect++;
  193. player.send(new SendString(MagicCollect + "", 24259));
  194.  
  195. }
  196. });
  197. timer.start();
  198. } else {
  199. player.send(new SendMessage("You need to purchase this node."));
  200. }
  201. }
  202.  
  203. public static void open2(Player player) {
  204. int CoalNode = Player.resourcenodes2 [0];
  205. int GoldNode = Player.resourcenodes2 [1];
  206. int MithrilNode = Player.resourcenodes2 [2];
  207. int AdamantiteNode = Player.resourcenodes2 [3];
  208. if(CoalNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  209. Timer timer = new Timer(5000, new ActionListener() {
  210. @Override
  211. public void actionPerformed(ActionEvent e) {
  212. CoalCollect++;
  213. player.send(new SendString(CoalCollect + "", 24260));
  214.  
  215. }
  216. });
  217. timer.start();
  218.  
  219. } else {
  220. player.send(new SendMessage("You need to purchase this node."));
  221. }
  222. if(GoldNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  223. Timer timer = new Timer(5000, new ActionListener() {
  224. @Override
  225. public void actionPerformed(ActionEvent e) {
  226. GoldCollect++;
  227. player.send(new SendString(GoldCollect + "", 24261));
  228. }
  229. });
  230. timer.start();
  231.  
  232. } else {
  233. player.send(new SendMessage("You need to purchase this node."));
  234. }
  235. if(MithrilNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  236. Timer timer = new Timer(5000, new ActionListener() {
  237. @Override
  238. public void actionPerformed(ActionEvent e) {
  239. MithrilCollect++;
  240. player.send(new SendString(MithrilCollect + "", 24262));
  241. }
  242. });
  243. timer.start();
  244.  
  245. } else {
  246. player.send(new SendMessage("You need to purchase this node."));
  247. }
  248. if(AdamantiteNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
  249. Timer timer = new Timer(5000, new ActionListener() {
  250. @Override
  251. public void actionPerformed(ActionEvent e) {
  252. // TODO Auto-generated method stub
  253. AdaCollect++;
  254. player.send(new SendString(AdaCollect + "", 24263));
  255.  
  256. }
  257. });
  258. timer.start();
  259.  
  260. } else {
  261. player.send(new SendMessage("You need to purchase this node."));
  262. }
  263.  
  264. }
  265.  
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement