forked from 2009Scape/Server
Finished most of the jobs activity minigame thingy.
FInishing up
This commit is contained in:
parent
b7043e3b0b
commit
f23b10a0e6
9 changed files with 352 additions and 210 deletions
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.crandor.game.content.global.jobs;
|
||||
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a gathering job, eg fishing woodcutting and such.
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public class GatheringJob extends Job {
|
||||
|
||||
private int itemId;
|
||||
private int amount;
|
||||
|
||||
/**
|
||||
* Constructs a new @{Code GatheringJob} object.
|
||||
*/
|
||||
public GatheringJob(int employer, Player player,int amount, int itemId) {
|
||||
super(employer,player);
|
||||
this.itemId = itemId;
|
||||
this.setAmount(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public
|
||||
boolean reward() {
|
||||
if (getPlayer().getInventory().getAmount(itemId) >= getAmount()) {
|
||||
getPlayer().getInventory().remove(new Item(itemId,getAmount()));
|
||||
setAmount(0);
|
||||
return true;
|
||||
} else {
|
||||
setAmount(getAmount() - getPlayer().getInventory().getAmount(itemId));
|
||||
getPlayer().getInventory().remove(new Item(itemId,getPlayer().getInventory().getAmount(itemId)));
|
||||
getPlayer().sendMessage("You have " + getAmount() + " left to get.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package org.crandor.game.content.global.jobs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public enum JobType {
|
||||
GATHERING,
|
||||
BONE_BURYING,
|
||||
KILLING;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ package org.crandor.game.content.global.jobs;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.crandor.game.content.global.jobs.impl.GatheringJob;
|
||||
import org.crandor.game.content.global.jobs.impl.SlayingJob;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.info.login.SavingModule;
|
||||
|
||||
|
|
@ -20,6 +22,11 @@ public final class JobsMinigameManager implements SavingModule {
|
|||
* The player.
|
||||
*/
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* The amount of jobs the player has completed.
|
||||
*/
|
||||
private int jobsDone = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +45,14 @@ public final class JobsMinigameManager implements SavingModule {
|
|||
|
||||
@Override
|
||||
public void parse(ByteBuffer buffer) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the jobsDone variable by 1.
|
||||
*/
|
||||
public void incrementJobs() {
|
||||
jobsDone++;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -58,6 +72,14 @@ public final class JobsMinigameManager implements SavingModule {
|
|||
this.job = job;
|
||||
}
|
||||
|
||||
public static final int WILFRED_ID = 4906;
|
||||
public int getJobsDone() {
|
||||
return jobsDone;
|
||||
}
|
||||
|
||||
public void setJobsDone(int jobsDone) {
|
||||
this.jobsDone = jobsDone;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,176 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.crandor.game.content.global.jobs.impl;
|
||||
|
||||
import org.crandor.cache.def.impl.ItemDefinition;
|
||||
import org.crandor.game.content.global.jobs.Job;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents a gathering job, eg fishing woodcutting and such.
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public class GatheringJob extends Job {
|
||||
|
||||
private int itemId;
|
||||
private int amount;
|
||||
private int originalAmount;
|
||||
|
||||
/**
|
||||
* Constructs a new @{Code GatheringJob} object.
|
||||
*/
|
||||
public GatheringJob(int employer, Player player,int amount, int itemId) {
|
||||
super(employer,player);
|
||||
this.itemId = itemId;
|
||||
this.setAmount(amount);
|
||||
originalAmount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public
|
||||
boolean reward() {
|
||||
if (getPlayer().getInventory().getAmount(itemId) >= getAmount()) {
|
||||
getPlayer().getInventory().remove(new Item(itemId,getAmount()));
|
||||
setAmount(0);
|
||||
getPlayer().getInventory().add(new Item(995,originalAmount * 25 * ( ItemDefinition.forId(itemId).getValue() + 1)));
|
||||
return true;
|
||||
} else {
|
||||
setAmount(getAmount() - getPlayer().getInventory().getAmount(itemId));
|
||||
getPlayer().getInventory().remove(new Item(itemId,getPlayer().getInventory().getAmount(itemId)));
|
||||
getPlayer().sendMessage("You still have " + getAmount() + " " + new Item(itemId).getName() + "left to gather.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents the jobs that require gathering
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public enum GatheringJobs {
|
||||
LOG(20,28, 1, 1511, Skills.WOODCUTTING),
|
||||
COWHIDES(20,28,1, 1739,0),
|
||||
OAK(22,28,15, 1521,Skills.WOODCUTTING),
|
||||
WATER_RUNE(20,28,5, 555,Skills.RUNECRAFTING),
|
||||
EARTH_RUNE(20,28,9, 557,Skills.RUNECRAFTING),
|
||||
FIRE_RUNE(20,28,14, 554,Skills.RUNECRAFTING),
|
||||
AIR_RUNE(20,28,1, 556,Skills.RUNECRAFTING),
|
||||
RUNE_ESS(20,28,1, 1436,Skills.MINING),
|
||||
BALL_OF_WOOL(20,28,1, 1759,Skills.CRAFTING),
|
||||
LEATHER_GLOVE(20,28,1, 1059,Skills.CRAFTING),
|
||||
WILLOW(22,28,30, 1519,Skills.WOODCUTTING),
|
||||
LEATHER_BOOT(24,24,1, 1061,Skills.CRAFTING),
|
||||
BRONZE_DAGGER(24,24,1,1205,Skills.SMITHING),
|
||||
BRONZE_HELMS(22,22,1,1139, Skills.SMITHING),
|
||||
BRONZE_FULL_HELM(10,10,7,1155,Skills.SMITHING),
|
||||
BRONZE_CHAINBODY(10,10,11,1103,Skills.SMITHING),
|
||||
BRONZE_2H(10,10,14,1307,Skills.SMITHING),
|
||||
BRONZE_SCIM(10,10,5,1321,Skills.SMITHING),
|
||||
BRONZE_PLATEBODY(9,10,18,1117,Skills.SMITHING),
|
||||
BRONZE_PLATELEGS(9,10,16,1075,Skills.SMITHING),
|
||||
BRONZE_PLATESKIRTS(9,10,16,1087,Skills.SMITHING),
|
||||
BRONZE_WARHAMMER(9,9,9,1337,Skills.SMITHING),
|
||||
IRON_DAGGER(13,13,15,1203,Skills.SMITHING),
|
||||
IRON_CHAINBODY(10,10,26,1101,Skills.SMITHING),
|
||||
IRON_2H(9,9,29,1309, Skills.SMITHING),
|
||||
STEEL_BATTLEAXE(9,9, 40,1365,Skills.SMITHING ),
|
||||
STEEL_SCIMITAR(9,9,35,1325, Skills.SMITHING),
|
||||
STEEL_PLATEBODY(9,10,48,1119, Skills.SMITHING),
|
||||
STEEL_WARHAMMER(9,10,39,1339,Skills.SMITHING),
|
||||
LEATHER_CHAPS(22,28,18,1095,Skills.CRAFTING),
|
||||
LEATHER_BODY(22,28,14, 1129, Skills.CRAFTING),
|
||||
LEATHER_COWL(22,28,9,1167,Skills.CRAFTING),
|
||||
LEATHER_COIF(22,28,38,1169,Skills.CRAFTING),
|
||||
RAW_SHRIMP(22,28,1,317,Skills.FISHING),
|
||||
COOKED_SHRIMP(22,28,1,315,Skills.COOKING),
|
||||
RAW_CRAYFISH(22,28,1,13435,Skills.FISHING),
|
||||
COOKED_CRAYFISH(22,28,1,13433,Skills.COOKING),
|
||||
RAW_TROUT(22,28,20,335,Skills.FISHING),
|
||||
COOKED_TROUT(22,28,15,333,Skills.COOKING),
|
||||
RAW_SALMON(22,28,30,331,Skills.FISHING),
|
||||
COOKED_SALMON(22,28,25,329,Skills.COOKING),
|
||||
CAKE(12,16,40,1891,Skills.COOKING),
|
||||
MEAT_PIE(12,16,20,2327,Skills.COOKING),
|
||||
PLAIN_PIZZA(12,16,35,2289,Skills.COOKING),
|
||||
MEAT_PIZZA(12,16,45,2293,Skills.COOKING),
|
||||
ANCHOVY_PIZZA(12,16,55,2297,Skills.COOKING),
|
||||
REDBERRY_PIE(12,16,10,2325,Skills.COOKING),
|
||||
COPPER_ORE(22,28,1,436,Skills.MINING),
|
||||
TIN_ORE(23,26,1,438,Skills.MINING),
|
||||
IRON_ORE(24,24,15,440,Skills.MINING),
|
||||
SILVER_ORE(22,28,20,442, Skills.MINING),
|
||||
COAL(22,26,30,453,Skills.MINING),
|
||||
GOLD_ORE(22,24,40,444, Skills.MINING),
|
||||
BRONZE_BAR(10,12,1,2349,Skills.SMITHING),
|
||||
IRON_BAR(22,28,15,2351,Skills.SMITHING),
|
||||
STEEL_BAR(22,28,30,2353,Skills.SMITHING),
|
||||
ASHES(26,26,1,592,0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final int id;
|
||||
private final int upperBound;
|
||||
private final int lowerBound;
|
||||
private final int lvlReq;
|
||||
private final int skillId;
|
||||
|
||||
private GatheringJobs(int lowerBound,int upperBound, int lvlReq, int id, int skillId) {
|
||||
this.lowerBound = lowerBound;
|
||||
this.upperBound = upperBound;
|
||||
this.id = id;
|
||||
this.lvlReq = lvlReq;
|
||||
this.skillId = skillId;
|
||||
}
|
||||
|
||||
public int getLvlReq() {
|
||||
return lvlReq;
|
||||
}
|
||||
|
||||
public int getid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return RandomFunction.random(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
|
||||
public int getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setItemId(int int1) {
|
||||
itemId = int1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
package org.crandor.game.content.global.jobs.impl;
|
||||
|
||||
import org.crandor.game.content.global.jobs.JobType;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the jobs that Mikasi can give.
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public enum MikasiJobs {
|
||||
LOG(20,28, 1, 1511,JobType.GATHERING, Skills.WOODCUTTING),
|
||||
COWHIDES(20,28,1, 1739,JobType.GATHERING,0),
|
||||
OAK(22,28,15, 1521,JobType.GATHERING,Skills.WOODCUTTING),
|
||||
WATER_RUNE(20,28,5, 555,JobType.GATHERING,Skills.RUNECRAFTING),
|
||||
EARTH_RUNE(20,28,9, 557,JobType.GATHERING,Skills.RUNECRAFTING),
|
||||
FIRE_RUNE(20,28,14, 554,JobType.GATHERING,Skills.RUNECRAFTING),
|
||||
AIR_RUNE(20,28,1, 556,JobType.GATHERING,Skills.RUNECRAFTING),
|
||||
RUNE_ESS(20,28,1, 1436,JobType.GATHERING,Skills.MINING),
|
||||
BALL_OF_WOOL(20,28,1, 1759,JobType.GATHERING,Skills.CRAFTING),
|
||||
LEATHER_GLOVE(20,28,1, 1059,JobType.GATHERING,Skills.CRAFTING),
|
||||
WILLOW(22,28,30, 1519,JobType.GATHERING,Skills.WOODCUTTING),
|
||||
LEATHER_BOOT(24,24,1, 1061,JobType.GATHERING,Skills.CRAFTING);
|
||||
|
||||
private final int id;
|
||||
private final int upperBound;
|
||||
private final int lowerBound;
|
||||
private final int lvlReq;
|
||||
private final JobType jobType;
|
||||
private final int skillId;
|
||||
|
||||
private MikasiJobs(int lowerBound,int upperBound, int lvlReq, int id, JobType jobType, int skillId) {
|
||||
this.lowerBound = lowerBound;
|
||||
this.upperBound = upperBound;
|
||||
this.id = id;
|
||||
this.lvlReq = lvlReq;
|
||||
this.jobType = jobType;
|
||||
this.skillId = skillId;
|
||||
}
|
||||
|
||||
public int getLvlReq() {
|
||||
return lvlReq;
|
||||
}
|
||||
|
||||
public int getid() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return RandomFunction.random(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
public JobType getJobType() {
|
||||
return jobType;
|
||||
}
|
||||
|
||||
public int getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package org.crandor.game.content.global.jobs.impl;
|
||||
|
||||
import org.crandor.game.content.global.jobs.Job;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
import org.crandor.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* A job that requires slaying monsters.
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public class SlayingJob extends Job {
|
||||
|
||||
private int[] npcId;
|
||||
private int amount;
|
||||
private int originalAmount;
|
||||
|
||||
public SlayingJob(int employer, Player player, int amount, int... npcId) {
|
||||
super(employer, player);
|
||||
this.npcId = npcId;
|
||||
this.amount = amount;
|
||||
this.originalAmount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reward() {
|
||||
if (getAmount() <= 0) {
|
||||
if (!(getPlayer().getInventory().add(new Item(995,originalAmount*250)))) {
|
||||
getPlayer().getBank().add(new Item(995,originalAmount*250));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
getPlayer().sendMessage("You still have " + amount + " " + StringUtils.plusS(new NPC(npcId[0]).getName()) + " left to slay.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks when an NPC is kiled that it can cound towards task completion
|
||||
* @param npc
|
||||
*/
|
||||
public void handleDeath(NPC npc) {
|
||||
for (int i = 0; i < npcId.length; i++) {
|
||||
if (npc.getId() == npcId[i]) {
|
||||
amount -= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public int[] getNpcId() {
|
||||
return npcId;
|
||||
}
|
||||
|
||||
public void setNpcId(int[] npcId) {
|
||||
this.npcId = npcId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Jobs that you must slay monsters to complete
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public enum SlayingJobs {
|
||||
CHICKEN(25,26,41,1017),
|
||||
COW(25,25,397,1766,81,1767),
|
||||
GIANT_SPIDER(22,25,59,60),
|
||||
SCORPION(25,25,107,108,109,144,4402,4403),
|
||||
GOBLIN(25,25,100,101,102,298,299,444,445,489,745,1769,1770,1771,1772,1773,1774,1775,1776,2274,2275,2276,2277,2278,2279,2280,2281,2678,2679,2680,2681,3060,3264,3265,3266,3267);
|
||||
|
||||
|
||||
private final int npcId[];
|
||||
private final int upperBound;
|
||||
private final int lowerBound;
|
||||
|
||||
private SlayingJobs(int lowerBound,int upperBound, int... npcId) {
|
||||
this.lowerBound = lowerBound;
|
||||
this.upperBound = upperBound;
|
||||
this.npcId = npcId;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return RandomFunction.random(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
public int[] getNpcId() {
|
||||
return npcId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setAmount(int int1) {
|
||||
amount = int1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
package org.crandor.game.content.global.jobs.impl;
|
||||
|
||||
import org.crandor.game.content.global.jobs.JobType;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the jobs that Wilfred can give.
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public enum WilfredJobs {
|
||||
LOG(22,28, 1, 1511,JobType.GATHERING, Skills.WOODCUTTING),
|
||||
OAK(22,28,15, 1521,JobType.GATHERING,Skills.WOODCUTTING),
|
||||
WILLOW(22,28,30, 1519,JobType.GATHERING,Skills.WOODCUTTING);
|
||||
|
||||
private final int itemId;
|
||||
private final int upperBound;
|
||||
private final int lowerBound;
|
||||
private final int lvlReq;
|
||||
private final JobType jobType;
|
||||
private final int skillId;
|
||||
|
||||
private WilfredJobs(int lowerBound,int upperBound, int lvlReq, int itemId, JobType jobType, int skillId) {
|
||||
this.lowerBound = lowerBound;
|
||||
this.upperBound = upperBound;
|
||||
this.itemId = itemId;
|
||||
this.lvlReq = lvlReq;
|
||||
this.jobType = jobType;
|
||||
this.skillId = skillId;
|
||||
}
|
||||
|
||||
public int getLvlReq() {
|
||||
return lvlReq;
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return RandomFunction.random(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
public JobType getJobType() {
|
||||
return jobType;
|
||||
}
|
||||
|
||||
public int getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package org.crandor.game.node.entity.npc;
|
||||
|
||||
import org.crandor.cache.def.impl.NPCDefinition;
|
||||
import org.crandor.game.content.global.jobs.impl.SlayingJob;
|
||||
import org.crandor.game.content.global.shop.Shop;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.content.skill.member.slayer.Task;
|
||||
|
|
@ -497,6 +498,9 @@ public class NPC extends Entity {
|
|||
if (task != null && killer instanceof Player && ((Player) killer).getSlayer().getTask() == task) {
|
||||
((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), this);
|
||||
}
|
||||
if (killer instanceof Player && ((Player)killer).getJobsManager().getJob() != null && ((Player)killer).getJobsManager().getJob() instanceof SlayingJob) {
|
||||
((SlayingJob) ((Player)killer).getJobsManager().getJob() ).handleDeath(this);
|
||||
}
|
||||
setRespawnTick(GameWorld.getTicks() + definition.getConfiguration(NPCConfigSQLHandler.RESPAWN_DELAY, 17));
|
||||
Player p = killer == null || !(killer instanceof Player) ? null : (Player) killer;
|
||||
handleDrops(p, killer);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package plugin.activity.jobs;
|
||||
|
||||
import org.crandor.cache.def.impl.NPCDefinition;
|
||||
import org.crandor.game.content.global.jobs.GatheringJob;
|
||||
import org.crandor.game.content.global.jobs.JobType;
|
||||
import org.crandor.game.content.global.jobs.impl.MikasiJobs;
|
||||
import org.crandor.game.content.global.jobs.impl.WilfredJobs;
|
||||
import org.crandor.game.content.global.jobs.impl.GatheringJob;
|
||||
import org.crandor.game.content.global.jobs.impl.GatheringJob.GatheringJobs;
|
||||
import org.crandor.game.content.global.jobs.impl.SlayingJob;
|
||||
import org.crandor.game.content.global.jobs.impl.SlayingJob.SlayingJobs;
|
||||
import org.crandor.game.interaction.OptionHandler;
|
||||
import org.crandor.game.node.Node;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
|
|
@ -13,6 +13,7 @@ import org.crandor.game.node.item.Item;
|
|||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.plugin.Plugin;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
import org.crandor.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* Handles the work-for actions for the NPCs
|
||||
|
|
@ -24,45 +25,67 @@ public final class WorkForOptionHandler extends OptionHandler {
|
|||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
NPCDefinition.forId(4906).getConfigurations().put("option:work-for",this);
|
||||
NPCDefinition.forId(4707).getConfigurations().put("option:work-for", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (player.getJobsManager().getJob() != null) {
|
||||
if ( ((NPC)node).getId() != player.getJobsManager().getJob().getEmployer()) {
|
||||
player.getDialogueInterpreter().sendPlainMessage(false, "You're already working for somebody else.");
|
||||
return true;
|
||||
}
|
||||
if (player.getJobsManager().getJob().reward()) {
|
||||
player.sendMessage("You completed the job");
|
||||
player.getDialogueInterpreter().sendPlainMessage(false,"You are rewarded for your services.");
|
||||
player.getJobsManager().setJob(null);
|
||||
player.getJobsManager().incrementJobs();
|
||||
if (player.getJobsManager().getJobsDone() % 15 == 0) {
|
||||
player.getInventory().add(new Item(11141,1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
switch (((NPC)node).getId()) {
|
||||
case 4906://wilfred, woodcutting
|
||||
while (true) {
|
||||
int gen = RandomFunction.random(0, WilfredJobs.values().length -1);
|
||||
if (WilfredJobs.values()[gen].getLvlReq() <= player.getSkills().getLevel(player.getSkills().WOODCUTTING)) {
|
||||
if (WilfredJobs.values()[gen].getJobType() == JobType.GATHERING) {
|
||||
player.getJobsManager().setJob(new GatheringJob( ((NPC)node).getId(), player, WilfredJobs.values()[gen].getAmount(), WilfredJobs.values()[gen].getItemId()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0://hans
|
||||
case 705://harlan, melee tutor
|
||||
case 922://aggie, the witch in draynor
|
||||
case 1861://nemarti, ranged tutor
|
||||
case 3807://gillie groats, the milk lady in the cow farm.
|
||||
case 4899://cordero, cooking tutor
|
||||
case 4901://finlay, fishing tutor
|
||||
case 4902://monlum, mining tutor
|
||||
case 4903://yauchomi, prayer tutor
|
||||
case 4904://feoras, smelting tutor
|
||||
case 4906://wilfred, woodcutting tutor
|
||||
case 4707://mikasi, mage tutor
|
||||
|
||||
case 4707:
|
||||
while (true) {
|
||||
int gen = RandomFunction.random(0, MikasiJobs.values().length -1);
|
||||
if (WilfredJobs.values()[gen].getLvlReq() <= player.getSkills().getLevel(player.getSkills().WOODCUTTING)) {
|
||||
player.getJobsManager().setJob(new GatheringJob( ((NPC)node).getId(), player, WilfredJobs.values()[gen].getAmount(), WilfredJobs.values()[gen].getItemId()));
|
||||
int type = RandomFunction.random(0,2);
|
||||
|
||||
switch (type) {
|
||||
case 0://gathering
|
||||
int gen = RandomFunction.random(0, GatheringJobs.values().length -1);
|
||||
if (GatheringJobs.values()[gen].getLvlReq() <= player.getSkills().getLevel(GatheringJobs.values()[gen].getSkillId())) {
|
||||
player.getJobsManager().setJob(new GatheringJob( ((NPC)node).getId(), player, GatheringJobs.values()[gen].getAmount(), GatheringJobs.values()[gen].getid()));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1://slaying
|
||||
int gen1 = RandomFunction.random(0,SlayingJobs.values().length - 1);
|
||||
player.getJobsManager().setJob(new SlayingJob(((NPC)node).getId(), player, SlayingJobs.values()[gen1].getAmount(),SlayingJobs.values()[gen1].getNpcId()));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (player.getJobsManager().getJob() instanceof GatheringJob) {
|
||||
player.getDialogueInterpreter().sendItemMessage(((GatheringJob)player.getJobsManager().getJob()).getItemId(), "Gather " + ((GatheringJob)player.getJobsManager().getJob()).getAmount() + " " + new Item(((GatheringJob)player.getJobsManager().getJob()).getItemId()).getName() + " for " + ((NPC)node).getName() );
|
||||
} else if (player.getJobsManager().getJob() instanceof SlayingJob) {
|
||||
player.getDialogueInterpreter().sendItemMessage(1321, "Slay " + ((SlayingJob)player.getJobsManager().getJob()).getAmount() + " " + StringUtils.plusS(new NPC(((SlayingJob)player.getJobsManager().getJob()).getNpcId()[0]).getName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue