forked from 2009Scape/Server
commit
3824f19cb2
7 changed files with 548 additions and 5 deletions
41
Server/src/org/crandor/game/content/global/jobs/Job.java
Normal file
41
Server/src/org/crandor/game/content/global/jobs/Job.java
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package org.crandor.game.content.global.jobs;
|
||||
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
|
||||
/**
|
||||
* Represents the job of a player
|
||||
* @author jamix77
|
||||
*
|
||||
*/
|
||||
public abstract class Job {
|
||||
|
||||
private final int employer;
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* Constructs a new @{Code Job} object.
|
||||
* @param employer
|
||||
*/
|
||||
protected Job(int employer, Player player) {
|
||||
this.employer = employer;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reward for the player after the player has completed their job.
|
||||
*/
|
||||
public abstract boolean reward();
|
||||
|
||||
/**
|
||||
* The employer of the job.
|
||||
* @return
|
||||
*/
|
||||
public int getEmployer() {
|
||||
return employer;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* Handles the jobs of a player
|
||||
* @author jamix77
|
||||
*/
|
||||
public final class JobsMinigameManager implements SavingModule {
|
||||
|
||||
/**
|
||||
* The current job of the player.
|
||||
*/
|
||||
private Job job;
|
||||
|
||||
/**
|
||||
* The player.
|
||||
*/
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* The amount of jobs the player has completed.
|
||||
*/
|
||||
private int jobsDone = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code TreasureTrailManager} {@Code
|
||||
* Object}
|
||||
* @param player the player.
|
||||
*/
|
||||
public JobsMinigameManager(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ByteBuffer buffer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parse(ByteBuffer buffer) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the jobsDone variable by 1.
|
||||
*/
|
||||
public void incrementJobs() {
|
||||
jobsDone++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player.
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public Job getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public void setJob(Job job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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,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,5 +1,8 @@
|
|||
package org.crandor.game.node.entity.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.crandor.ServerConstants;
|
||||
import org.crandor.game.component.Component;
|
||||
import org.crandor.game.container.Container;
|
||||
|
|
@ -9,6 +12,7 @@ import org.crandor.game.container.impl.InventoryListener;
|
|||
import org.crandor.game.content.ame.AntiMacroHandler;
|
||||
import org.crandor.game.content.dialogue.DialogueInterpreter;
|
||||
import org.crandor.game.content.eco.ge.GrandExchange;
|
||||
import org.crandor.game.content.global.jobs.JobsMinigameManager;
|
||||
import org.crandor.game.content.global.ttrail.TreasureTrailManager;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.content.skill.member.construction.HouseManager;
|
||||
|
|
@ -36,7 +40,20 @@ import org.crandor.game.node.entity.player.info.UIDInfo;
|
|||
import org.crandor.game.node.entity.player.info.login.LoginConfiguration;
|
||||
import org.crandor.game.node.entity.player.info.portal.DonatorType;
|
||||
import org.crandor.game.node.entity.player.info.portal.Perks;
|
||||
import org.crandor.game.node.entity.player.link.*;
|
||||
import org.crandor.game.node.entity.player.link.BankPinManager;
|
||||
import org.crandor.game.node.entity.player.link.BarcrawlManager;
|
||||
import org.crandor.game.node.entity.player.link.ConfigurationManager;
|
||||
import org.crandor.game.node.entity.player.link.GlobalData;
|
||||
import org.crandor.game.node.entity.player.link.HintIconManager;
|
||||
import org.crandor.game.node.entity.player.link.InterfaceManager;
|
||||
import org.crandor.game.node.entity.player.link.IronmanManager;
|
||||
import org.crandor.game.node.entity.player.link.IronmanMode;
|
||||
import org.crandor.game.node.entity.player.link.PacketDispatch;
|
||||
import org.crandor.game.node.entity.player.link.SavedData;
|
||||
import org.crandor.game.node.entity.player.link.Settings;
|
||||
import org.crandor.game.node.entity.player.link.SkullManager;
|
||||
import org.crandor.game.node.entity.player.link.SpellBookManager;
|
||||
import org.crandor.game.node.entity.player.link.WarningMessages;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Appearance;
|
||||
import org.crandor.game.node.entity.player.link.audio.AudioManager;
|
||||
import org.crandor.game.node.entity.player.link.diary.AchievementDiaryManager;
|
||||
|
|
@ -55,7 +72,12 @@ import org.crandor.game.system.communication.CommunicationInfo;
|
|||
import org.crandor.game.system.monitor.PlayerMonitor;
|
||||
import org.crandor.game.system.task.LogoutTask;
|
||||
import org.crandor.game.world.GameWorld;
|
||||
import org.crandor.game.world.map.*;
|
||||
import org.crandor.game.world.map.Direction;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.map.Region;
|
||||
import org.crandor.game.world.map.RegionChunk;
|
||||
import org.crandor.game.world.map.RegionManager;
|
||||
import org.crandor.game.world.map.Viewport;
|
||||
import org.crandor.game.world.map.build.DynamicRegion;
|
||||
import org.crandor.game.world.map.zone.ZoneType;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
|
|
@ -78,9 +100,6 @@ import org.crandor.net.packet.out.UpdateSceneGraph;
|
|||
import org.crandor.plugin.Plugin;
|
||||
import org.crandor.tools.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a player entity.
|
||||
* @author Emperor
|
||||
|
|
@ -272,6 +291,11 @@ public class Player extends Entity {
|
|||
* The Ironman manager.
|
||||
*/
|
||||
private final IronmanManager ironmanManager = new IronmanManager(this);
|
||||
|
||||
/**
|
||||
* The jobs minigame manager.
|
||||
*/
|
||||
private final JobsMinigameManager jobsManager = new JobsMinigameManager(this);
|
||||
|
||||
/**
|
||||
* The logout plugins.
|
||||
|
|
@ -1304,4 +1328,8 @@ public class Player extends Entity {
|
|||
public void setArcheryTotal(int archeryTotal) {
|
||||
this.archeryTotal = archeryTotal;
|
||||
}
|
||||
|
||||
public JobsMinigameManager getJobsManager() {
|
||||
return jobsManager;
|
||||
}
|
||||
}
|
||||
105
Server/src/plugin/activity/jobs/WorkForOptionHandler.java
Normal file
105
Server/src/plugin/activity/jobs/WorkForOptionHandler.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
package plugin.activity.jobs;
|
||||
|
||||
import org.crandor.cache.def.impl.NPCDefinition;
|
||||
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;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
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
|
||||
* @author jamix77
|
||||
*/
|
||||
@InitializablePlugin
|
||||
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);
|
||||
NPCDefinition.forId(4904).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(4903).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(4902).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(4901).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(4899).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(3807).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(1861).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(922).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(705).getConfigurations().put("option:work-for", this);
|
||||
NPCDefinition.forId(0).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.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 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
|
||||
|
||||
while (true) {
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue