Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.vencillio.rs2.content.kingdomtest;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.Arrays;
- import java.util.TimerTask;
- import com.oslegend.Server;
- import com.vencillio.core.util.Utility;
- import com.vencillio.core.util.chance.Chance;
- import com.vencillio.core.util.chance.WeightedChance;
- import com.vencillio.rs2.entity.World;
- import com.vencillio.rs2.entity.item.Item;
- import com.vencillio.rs2.entity.player.Player;
- import com.vencillio.rs2.entity.player.controllers.Controller;
- import com.vencillio.rs2.entity.player.controllers.ControllerManager;
- import com.vencillio.rs2.entity.player.net.out.impl.SendMessage;
- import com.vencillio.rs2.entity.player.net.out.impl.SendString;
- import javax.swing.Timer;
- /**
- * Handles Mystery Box rewards
- * @author EEAZY
- *
- */
- public abstract class HireResourceWorkers{
- /**
- * @author EEAZY
- */
- /**
- * Hire Resource Workers
- */
- //Start CollectionInts
- static int CoalCollect = 0;
- static int GoldCollect = 0;
- static int MithrilCollect = 0;
- static int AdaCollect = 0;
- static int LogCollect = 0;
- static int WillowCollect = 0;
- static int YewCollect = 0;
- static int MagicCollect = 0;
- //END COLLECTION INTS
- public static boolean nodepurchasetrue = true;
- public static boolean nodepurchasefalse = false;
- //logic for buying tree nodes
- public static void NormalWoodNodeTrue(Player player) {
- Player.resourcenodes [0] = 1;
- player.send(new SendMessage("You've purchased Normal Log Node"));
- }
- public static void WillowNodeTrue(Player player) {
- Player.resourcenodes [1] = 1;
- player.send(new SendMessage("You've purchased Willow Node"));
- }
- public static void YewNodeTrue(Player player) {
- Player.resourcenodes [2] = 1;
- player.send(new SendMessage("You've purchased Yew Node"));
- }
- public static void MagicNodeFalse(Player player) {
- Player.resourcenodes [3] = 1;
- player.send(new SendMessage("You've purchased Magic Node"));
- }
- public static void CoalNode(Player player) {
- boolean MagicNodeFalse = true;
- MagicNodeFalse = MagicNodeFalse == true ? true : false;
- Player.resourcenodes2 [0] = 1;
- player.send(new SendMessage("You've purchased Coal Node"));
- }
- public static void GoldNode(Player player) {
- Player.resourcenodes2 [1] = 1;
- player.send(new SendMessage("You've purchased Gold Node"));
- }
- public static void MithrilNode(Player player) {
- Player.resourcenodes2 [2] = 1;
- player.send(new SendMessage("You've purchased Mithril Node"));
- }
- public static void AdamantiteNode(Player player) {
- Player.resourcenodes2 [3] = 1;
- player.send(new SendMessage("You've purchased Adamantite Node"));
- }
- public static void res(Player player) {
- boolean update = true;
- if(LogCollect > 1) {
- player.getBank().depositFromNoting(1511, LogCollect, 1, update);
- LogCollect = 0;
- player.send(new SendString(LogCollect + "", 24256));
- }
- if(WillowCollect > 1) {
- player.getBank().depositFromNoting(1519, WillowCollect, 1, update);
- WillowCollect = 0;
- player.send(new SendString(WillowCollect + "", 24257));
- }
- if(YewCollect > 1) {
- player.getBank().depositFromNoting(1515, YewCollect, 1, update);
- YewCollect = 0;
- player.send(new SendString(YewCollect + "", 24258));
- }
- if(MagicCollect > 1) {
- player.getBank().depositFromNoting(1513, MagicCollect, 1, update);
- MagicCollect = 0;
- player.send(new SendString(MagicCollect + "", 24259));
- }
- if(CoalCollect > 1) {
- player.getBank().depositFromNoting(453, CoalCollect, 1, update);
- CoalCollect = 0;
- player.send(new SendString(CoalCollect + "", 24260));
- }
- if(GoldCollect > 1) {
- player.getBank().depositFromNoting(444, GoldCollect, 1, update);
- GoldCollect = 0;
- player.send(new SendString(GoldCollect + "", 24261));
- }
- if(MithrilCollect > 1) {
- player.getBank().depositFromNoting(447, MithrilCollect, 1, update);
- MithrilCollect = 0;
- player.send(new SendString(MithrilCollect + "", 24262));
- }
- if(AdaCollect > 1) {
- player.getBank().depositFromNoting(449, AdaCollect, 1, update);
- AdaCollect = 0;
- player.send(new SendString(AdaCollect + "", 24263));
- }
- }
- //collecting resource logic
- public static void open(Player player) {
- int NormalWoodNode = Player.resourcenodes [0];
- int WillowNode = Player.resourcenodes [1];
- int YewNode = Player.resourcenodes [2];
- int MagicNode = Player.resourcenodes [3];
- if(NormalWoodNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- LogCollect++;
- player.send(new SendString(LogCollect + "", 24256));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- if(WillowNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- WillowCollect++;
- player.send(new SendString(WillowCollect + "", 24257));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- if(YewNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- YewCollect++;
- player.send(new SendString(YewCollect + "", 24258));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- if(MagicNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- MagicCollect++;
- player.send(new SendString(MagicCollect + "", 24259));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- }
- public static void open2(Player player) {
- int CoalNode = Player.resourcenodes2 [0];
- int GoldNode = Player.resourcenodes2 [1];
- int MithrilNode = Player.resourcenodes2 [2];
- int AdamantiteNode = Player.resourcenodes2 [3];
- if(CoalNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- CoalCollect++;
- player.send(new SendString(CoalCollect + "", 24260));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- if(GoldNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- GoldCollect++;
- player.send(new SendString(GoldCollect + "", 24261));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- if(MithrilNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- MithrilCollect++;
- player.send(new SendString(MithrilCollect + "", 24262));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- if(AdamantiteNode == 1){ //TODO save node purchase date to compare if it should be collected or not.
- Timer timer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- AdaCollect++;
- player.send(new SendString(AdaCollect + "", 24263));
- }
- });
- timer.start();
- } else {
- player.send(new SendMessage("You need to purchase this node."));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement