API overhaul, convert Toy Plugins to Listeners
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package core.game.content.activity.duel;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
@@ -569,7 +569,7 @@ public final class DuelSession extends ComponentPlugin {
|
||||
amount = c.getAmount(c.get(slot));
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
c.withdraw(slot, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
@@ -686,7 +686,7 @@ public final class DuelSession extends ComponentPlugin {
|
||||
c1.offer(slot, player.getInventory().getAmount(player.getInventory().get(slot).getId()));
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
c1.offer(slot, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.activity.guild;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
@@ -61,7 +61,7 @@ public final class WizardGuildPlugin extends OptionHandler {
|
||||
switch (id) {
|
||||
case 1600:
|
||||
case 1601:
|
||||
if (ContentAPI.getDynLevel(player, Skills.MAGIC) < 66) {
|
||||
if (getDynLevel(player, Skills.MAGIC) < 66) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Magic level of at least 66 to enter.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
@@ -316,7 +316,7 @@ public final class PartyRoomPlugin extends OptionHandler {
|
||||
viewer.getContainer().addItem(slot, ammount);
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
viewer.getContainer().addItem(slot, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
@@ -347,7 +347,7 @@ public final class PartyRoomPlugin extends OptionHandler {
|
||||
viewer.getContainer().takeItem(slot, ammount);
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
viewer.getContainer().takeItem(slot, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package core.game.content.activity.pyramidplunder;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.content.global.action.ClimbActionHandler;
|
||||
@@ -84,7 +84,7 @@ public final class PyramidOptionHandler extends OptionHandler {
|
||||
if(entrance == currentEntrance && willBePushed){
|
||||
player.lock();
|
||||
player.animate(new Animation(7299));
|
||||
ContentAPI.submitWorldPulse(new Pulse(4, player){
|
||||
submitWorldPulse(new Pulse(4, player){
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.unlock();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package core.game.content.consumable;
|
||||
|
||||
import api.Container;
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
@@ -50,11 +50,11 @@ public abstract class Consumable implements Plugin<Object> {
|
||||
final int nextItemId = getNextItemId(item.getId());
|
||||
|
||||
if(item.getAmount() > 1){
|
||||
ContentAPI.removeItem(player, item.getId(), Container.INVENTORY);
|
||||
} else ContentAPI.removeItem(player, item, Container.INVENTORY);
|
||||
removeItem(player, item.getId(), Container.INVENTORY);
|
||||
} else removeItem(player, item, Container.INVENTORY);
|
||||
|
||||
if (nextItemId != -1) {
|
||||
ContentAPI.addItem(player, nextItemId, 1);
|
||||
addItem(player, nextItemId, 1);
|
||||
}
|
||||
final int initialLifePoints = player.getSkills().getLifepoints();
|
||||
Consumables.getConsumableById(item.getId()).effect.activate(player);
|
||||
|
||||
@@ -11,6 +11,7 @@ import rs09.game.content.dialogue.DialogueFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static api.DialUtilsKt.splitLines;
|
||||
import static rs09.tools.DialogueConstKt.DIALOGUE_INITIAL_OPTIONS_HANDLE;
|
||||
import static rs09.tools.DialogueConstKt.START_DIALOGUE;
|
||||
|
||||
@@ -318,7 +319,7 @@ public abstract class DialoguePlugin implements Plugin<Player> {
|
||||
* @param msg the message for the NPC to say
|
||||
*/
|
||||
public Component npcl(FacialExpression expr, String msg){
|
||||
return npc(expr, api.DialUtils.splitLines(msg));
|
||||
return npc(expr, splitLines(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,7 +328,7 @@ public abstract class DialoguePlugin implements Plugin<Player> {
|
||||
* @param msg the message for the player to say
|
||||
*/
|
||||
public Component playerl(FacialExpression expr, String msg){
|
||||
return player(expr, api.DialUtils.splitLines(msg));
|
||||
return player(expr, splitLines(msg));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.quest.Quest;
|
||||
@@ -83,7 +83,7 @@ public final class DrezelMonumentDialogue extends DialoguePlugin {
|
||||
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Greetings again adventurer, How go your travels in", "Morytania? Is it as evil as I have heard?");
|
||||
stage = 420;
|
||||
} else if (quest.getStage(player) < 100){
|
||||
ContentAPI.openDialogue(player, new NSDrezelDialogue(), npc);
|
||||
openDialogue(player, new NSDrezelDialogue(), npc);
|
||||
} else {
|
||||
npcl(FacialExpression.NEUTRAL, "I heard you finished your quest with Filliman! Great work!");
|
||||
stage = END_DIALOGUE;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.runecrafting.Altar;
|
||||
import core.game.node.entity.skill.runecrafting.EnchantTiaraPulse;
|
||||
@@ -76,7 +76,7 @@ public final class EnchantTiaraDialogue extends DialoguePlugin {
|
||||
amt = 5;
|
||||
break;
|
||||
case 4:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
player.getPulseManager().run(new EnchantTiaraPulse(player, event.getUsedItem(), Talisman.forItem(event.getUsedItem()).getTiara(), (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import kotlin.Unit;
|
||||
@@ -111,7 +111,7 @@ public final class LeatherCraftDialogue extends DialoguePlugin {
|
||||
amt = 5;
|
||||
break;
|
||||
case 3:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
player.getPulseManager().run(new HardCraftPulse(player, null, (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
@@ -205,7 +205,7 @@ public final class LeatherCraftDialogue extends DialoguePlugin {
|
||||
if (hidee == null) {
|
||||
return false;
|
||||
}
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
player.getPulseManager().run(new DragonCraftPulse(player, null, hidee, (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import api.Container;
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.plugin.Initializable;
|
||||
@@ -288,8 +288,8 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||
player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON);
|
||||
player.getPacketDispatch().sendInterfaceConfig(548,69,true);
|
||||
|
||||
ContentAPI.registerLogoutListener(player, "magic-carpet", (pl) -> {
|
||||
ContentAPI.removeItem(pl, Items.MAGIC_CARPET_5614, Container.EQUIPMENT);
|
||||
registerLogoutListener(player, "magic-carpet", (pl) -> {
|
||||
removeItem(pl, Items.MAGIC_CARPET_5614, Container.EQUIPMENT);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -333,7 +333,7 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||
player.animate(new Animation(-1));
|
||||
player.getConfigManager().set(499, 0);
|
||||
|
||||
ContentAPI.clearLogoutListener(player, "magic-carpet");
|
||||
clearLogoutListener(player, "magic-carpet");
|
||||
|
||||
break;
|
||||
case 902:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.plugin.Initializable;
|
||||
@@ -58,7 +58,7 @@ public class SkillDialoguePlugin extends DialoguePlugin {
|
||||
if (amount != -1) {
|
||||
handler.create(amount, index);
|
||||
} else {
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
handler.create((int) value, index);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package core.game.content.global.shop
|
||||
|
||||
import rs09.game.world.World.ticks
|
||||
import api.ContentAPI.amountInInventory
|
||||
import api.*
|
||||
import rs09.game.system.SystemLogger.logInfo
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.quest.members.rovingelves;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.ImpactHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
@@ -56,15 +56,15 @@ public final class IsafdarZone extends MapZone implements Plugin<Object> {
|
||||
if (e instanceof Player) {
|
||||
Player player = (Player) e;
|
||||
if(LEAF_TRAPS.contains(player.getLocation())){
|
||||
ContentAPI.sendMessage(player,LEAF_FAIL_MSG);
|
||||
ContentAPI.impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
sendMessage(player,LEAF_FAIL_MSG);
|
||||
impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
player.teleport(LEAF_TRAP_PIT);
|
||||
} else if(STICK_TRAPS.contains(player.getLocation())) {
|
||||
ContentAPI.sendMessage(player,STICK_FAIL_MSG);
|
||||
ContentAPI.impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
sendMessage(player,STICK_FAIL_MSG);
|
||||
impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
} else if (WIRE_TRAPS.contains(player.getLocation())){
|
||||
ContentAPI.sendMessage(player,WIRE_FAIL_MSG);
|
||||
ContentAPI.impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
sendMessage(player,WIRE_FAIL_MSG);
|
||||
impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package core.game.content.quest.members.rovingelves;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.node.entity.skill.agility.AgilityHandler;
|
||||
import core.game.interaction.OptionHandler;
|
||||
@@ -200,7 +200,7 @@ public final class RovingElvesObstacles extends OptionHandler {
|
||||
break;
|
||||
case 3927:
|
||||
player.teleport(LEAF_TRAP_CLIMB);
|
||||
ContentAPI.sendMessage(player,LEAF_LADDER_MSG);
|
||||
sendMessage(player,LEAF_LADDER_MSG);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.content.zone.phasmatys;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.content.global.Bones;
|
||||
import core.game.content.global.action.ClimbActionHandler;
|
||||
import core.game.interaction.Option;
|
||||
@@ -76,16 +76,16 @@ public final class PhasmatysZone extends MapZone implements Plugin<Object> {
|
||||
return true;
|
||||
case 5267:
|
||||
player.animate(Animation.create(536));
|
||||
ContentAPI.sendMessage(player, "The trapdoor opens...");
|
||||
sendMessage(player, "The trapdoor opens...");
|
||||
SceneryBuilder.replace((Scenery) target, ((Scenery) target).transform(5268));
|
||||
return true;
|
||||
case 5268:
|
||||
if (option.getName().equals("Close")) {
|
||||
player.animate(Animation.create(535));
|
||||
ContentAPI.sendMessage(player, "You close the trapdoor.");
|
||||
sendMessage(player, "You close the trapdoor.");
|
||||
SceneryBuilder.replace((Scenery) target, ((Scenery) target).transform(5267));
|
||||
} else {
|
||||
ContentAPI.sendMessage(player, "You climb down through the trapdoor...");
|
||||
sendMessage(player, "You climb down through the trapdoor...");
|
||||
player.getProperties().setTeleportLocation(Location.create(3669, 9888, 3));
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.city;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.content.global.action.ClimbActionHandler;
|
||||
@@ -50,7 +50,7 @@ public final class EdgevilleNodePlugin extends OptionHandler {
|
||||
case 9262:
|
||||
case 9261:
|
||||
case 30806:
|
||||
ContentAPI.sendMessage(player, "There doesn't seem to be any seeds on this rosebush.");
|
||||
sendMessage(player, "There doesn't seem to be any seeds on this rosebush.");
|
||||
break;
|
||||
case 12265:
|
||||
ClimbActionHandler.climb(player, null, Location.create(3078, 3493, 0));
|
||||
@@ -65,17 +65,17 @@ public final class EdgevilleNodePlugin extends OptionHandler {
|
||||
case 26933: // Edgeville Dungeon trapdoor (when closed)
|
||||
if (option.equalsIgnoreCase("open")) {
|
||||
player.animate(Animation.create(536));
|
||||
ContentAPI.sendMessage(player, "The trapdoor opens...");
|
||||
sendMessage(player, "The trapdoor opens...");
|
||||
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(26934), 500);
|
||||
}
|
||||
break;
|
||||
case 26934: // Edgeville Dungeon trapdoor (when open)
|
||||
if (option.equalsIgnoreCase("close")) {
|
||||
player.animate(Animation.create(535));
|
||||
ContentAPI.sendMessage(player, "You close the trapdoor.");
|
||||
sendMessage(player, "You close the trapdoor.");
|
||||
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(26933));
|
||||
} else if (option.equalsIgnoreCase("climb-down")) {
|
||||
ContentAPI.sendMessage(player, "You climb down through the trapdoor...");
|
||||
sendMessage(player, "You climb down through the trapdoor...");
|
||||
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.city;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.Component;
|
||||
@@ -687,7 +687,7 @@ public final class WizardTowerPlugin extends OptionHandler {
|
||||
}
|
||||
final int amount = getAmt(buttonId);
|
||||
if (amount == -1) {// rscript.
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
make(bark, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package core.game.interaction.city.lumbridge;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
|
||||
import api.ContentAPIKt;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.OptionHandler;
|
||||
@@ -44,9 +46,9 @@ public class CowFieldSign extends OptionHandler {
|
||||
public boolean open(Object... args){
|
||||
int dailyCowDeaths = GlobalStats.getDailyCowDeaths();
|
||||
if(dailyCowDeaths > 0) {
|
||||
ContentAPI.sendDialogue(player, "Local cowherders have reported that " + dailyCowDeaths + " cows have been slain in this field today by passing adventurers. Farmers throughout the land fear this may be an epidemic.");
|
||||
ContentAPIKt.sendDialogue(player,"Local cowherders have reported that " + dailyCowDeaths + " cows have been slain in this field today by passing adventurers. Farmers throughout the land fear this may be an epidemic.");
|
||||
} else {
|
||||
ContentAPI.sendDialogue(player, "The Lumbridge cow population has been thriving today, without a single cow death to worry about!" );
|
||||
ContentAPIKt.sendDialogue(player,"The Lumbridge cow population has been thriving today, without a single cow death to worry about!" );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -89,9 +89,9 @@ public final class ClanInterfacePlugin extends ComponentPlugin {
|
||||
MSPacketRepository.sendClanRename(player, "");
|
||||
break;
|
||||
default:
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter clan prefix:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter clan prefix:", (value) -> {
|
||||
String name = StringUtils.formatDisplayName((String) value);
|
||||
ContentAPI.setInterfaceText(player, name, 590, 22);
|
||||
setInterfaceText(player, name, 590, 22);
|
||||
MSPacketRepository.sendClanRename(player, name);
|
||||
clan.setName(name);
|
||||
return Unit.INSTANCE;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -74,7 +74,7 @@ public final class GlassInterface extends ComponentPlugin {
|
||||
real = p.getInventory().getAmount(MOLTEN_GLASS);
|
||||
break;
|
||||
case 211:
|
||||
ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
make(p, def, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -31,7 +31,7 @@ public final class GliderInterface extends ComponentPlugin {
|
||||
if (glider == null) {
|
||||
return true;
|
||||
}
|
||||
ContentAPI.submitWorldPulse(new GliderPulse(1, player, glider));
|
||||
submitWorldPulse(new GliderPulse(1, player, glider));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.CS2Mapping;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
@@ -334,7 +334,7 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
setOfferAmount(player, offer, amount + 1000);
|
||||
return true;
|
||||
case 170: // value x
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
if (player.getInterfaceManager().getChatbox().getId() == 389) {
|
||||
player.getPlayerGrandExchange().openSearch();
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
player.getPacketDispatch().sendMessage("Please select an offer first.");
|
||||
return true;
|
||||
}
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
if (player.getInterfaceManager().getChatbox().getId() == 389) {
|
||||
player.getPlayerGrandExchange().openSearch();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
@@ -180,7 +180,7 @@ public final class JewelleryInterface extends ComponentPlugin {
|
||||
break;
|
||||
case 199:
|
||||
final JewelleryItem d = data;
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
JewelleryCrafting.make(player, d, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -45,8 +45,8 @@ public final class LeatherCraftInterface extends ComponentPlugin {
|
||||
amount = player.getInventory().getAmount(new Item(LeatherCrafting.LEATHER));
|
||||
break;
|
||||
case 199:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
ContentAPI.submitIndividualPulse(player, new SoftCraftPulse(player, new Item(LeatherCrafting.LEATHER), soft, (int) value));
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
submitIndividualPulse(player, new SoftCraftPulse(player, new Item(LeatherCrafting.LEATHER), soft, (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -66,7 +66,7 @@ public class SawmillPlankInterface extends ComponentPlugin {
|
||||
}
|
||||
if (amount == 69) {
|
||||
final Plank plankk = plank;
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
create(player, plankk, (int) value);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -32,8 +32,8 @@ public class SmeltingInterface extends ComponentPlugin {
|
||||
}
|
||||
if (barType.getAmount() == -1) {
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
ContentAPI.submitIndividualPulse(player, new SmeltingPulse(player, null, barType.getBar(), (int) value));
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
submitIndividualPulse(player, new SmeltingPulse(player, null, barType.getBar(), (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -38,7 +38,7 @@ public class SmithingInterface extends ComponentPlugin {
|
||||
p.getGameAttributes().setAttribute("smith-bar", bar);
|
||||
p.getGameAttributes().setAttribute("smith-item", item);
|
||||
if (amount == -1) {
|
||||
ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
p.getPulseManager().run(new SmithingPulse(p, new Item((int) p.getGameAttributes().getAttribute("smith-item"), (int) value), (Bars) p.getGameAttributes().getAttribute("smith-bar"), (int) value));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
@@ -45,8 +45,8 @@ public class SpinningInterface extends ComponentPlugin {
|
||||
amt = p.getInventory().getAmount(new Item(spin.getNeed()));
|
||||
break;
|
||||
case 199:
|
||||
ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
ContentAPI.submitIndividualPulse(p, new SpinningPulse(p, new Item(spin.getNeed(), 1), (int) value, spin));
|
||||
sendInputDialogue(p, true, "Enter the amount:", (value) -> {
|
||||
submitIndividualPulse(p, new SpinningPulse(p, new Item(spin.getNeed(), 1), (int) value, spin));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -75,7 +75,7 @@ public class TanningInterface extends ComponentPlugin {
|
||||
case 124:
|
||||
amount = 10;
|
||||
case 199:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
TanningProduct.tan(player, (int) value, deff);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.inter;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -68,7 +68,7 @@ public final class TradeInterfacePlugin extends ComponentPlugin {
|
||||
module.getContainer().withdraw(slot, module.getContainer().getAmount(module.getContainer().get(slot)));
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
@@ -102,7 +102,7 @@ public final class TradeInterfacePlugin extends ComponentPlugin {
|
||||
module.getContainer().offer(slot, player.getInventory().getAmount(player.getInventory().get(slot)));
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
|
||||
@@ -3,7 +3,7 @@ package core.game.interaction.item;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
@@ -51,7 +51,7 @@ public final class CasketPlugin extends OptionHandler {
|
||||
final Item reward = table.roll().get(0);
|
||||
player.getInventory().remove((Item) node);
|
||||
player.getDialogueInterpreter().sendItemMessage(reward, "You open the casket. Inside you find " + (reward.getAmount() > 1 ? "some" : (StringUtils.isPlusN(reward.getName()) ? "an" : "a")) + " " + reward.getName().toLowerCase() + ".");
|
||||
ContentAPI.addItemOrDrop(player, reward.getId(), reward.getAmount());
|
||||
addItemOrDrop(player, reward.getId(), reward.getAmount());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.item
|
||||
|
||||
import api.ContentAPI
|
||||
import api.*
|
||||
import core.Util
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
import core.plugin.Initializable
|
||||
@@ -36,28 +36,28 @@ class ExplorersRingPlugin : InteractionListener() {
|
||||
on(RINGS, ITEM, "run-replenish"){player, node ->
|
||||
val charges = getStoreFile().getInt(player.username.toLowerCase() + ":run")
|
||||
if (charges >= getRingLevel(node.id)) {
|
||||
ContentAPI.sendMessage(player,"You have used all the charges you can for one day.")
|
||||
sendMessage(player,"You have used all the charges you can for one day.")
|
||||
return@on true
|
||||
}
|
||||
player.settings.updateRunEnergy(-50.0)
|
||||
|
||||
getStoreFile()[player.username.toLowerCase() + ":run"] = charges + 1
|
||||
|
||||
ContentAPI.sendMessage(player,"You feel refreshed as the ring revitalises you and a charge is used up.")
|
||||
ContentAPI.visualize(player, 9988, 1733)
|
||||
sendMessage(player,"You feel refreshed as the ring revitalises you and a charge is used up.")
|
||||
visualize(player, 9988, 1733)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(RINGS, ITEM, "low-alchemy"){player, _ ->
|
||||
if (!ContentAPI.hasLevelStat(player, Skills.MAGIC, 21)) {
|
||||
ContentAPI.sendMessage(player,"You need a Magic level of 21 in order to do that.")
|
||||
if (!hasLevelStat(player, Skills.MAGIC, 21)) {
|
||||
sendMessage(player,"You need a Magic level of 21 in order to do that.")
|
||||
return@on true
|
||||
}
|
||||
if(getStoreFile().getBoolean(player.username.toLowerCase() + ":alchs")){
|
||||
ContentAPI.sendMessage(player, "You have claimed all the charges you can for one day.")
|
||||
sendMessage(player, "You have claimed all the charges you can for one day.")
|
||||
return@on true
|
||||
}
|
||||
ContentAPI.sendMessage(player,"You grant yourself with 30 free low alchemy charges.") // todo this implementation is not correct, see https://www.youtube.com/watch?v=UbUIF2Kw_Dw
|
||||
sendMessage(player,"You grant yourself with 30 free low alchemy charges.") // todo this implementation is not correct, see https://www.youtube.com/watch?v=UbUIF2Kw_Dw
|
||||
|
||||
getStoreFile()[player.username.toLowerCase() + ":alchs"] = true
|
||||
|
||||
@@ -71,7 +71,7 @@ class ExplorersRingPlugin : InteractionListener() {
|
||||
|
||||
on(RINGS, ITEM, "operate", "rub"){player, node ->
|
||||
if(getRingLevel(node.id) < 3){
|
||||
ContentAPI.sendMessage(player, "This item can not be operated.")
|
||||
sendMessage(player, "This item can not be operated.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class ExplorersRingPlugin : InteractionListener() {
|
||||
}
|
||||
|
||||
fun teleport(player: Player){
|
||||
ContentAPI.teleport(player, CABBAGE_PORT, TeleportType.CABBAGE)
|
||||
teleport(player, CABBAGE_PORT, TeleportType.CABBAGE)
|
||||
}
|
||||
|
||||
fun getRingLevel(id: Int): Int{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.item;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
@@ -32,7 +32,7 @@ public final class SilverSicklePlugin extends OptionHandler {
|
||||
player.getPacketDispatch().sendAnimation(9021);
|
||||
NSUtils.castBloom(player);
|
||||
} else {
|
||||
ContentAPI.sendDialogue(player, "You must complete Nature Spirit to use this.");
|
||||
sendDialogue(player, "You must complete Nature Spirit to use this.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
@Initializable
|
||||
public class ChocatriceCape extends OptionHandler {
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.forId(12634).getHandlers().put("option:operate",this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(new Animation(8903),new Graphics(1566));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import api.ContentAPI;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -10,12 +9,17 @@ import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.game.content.holiday.easter.BasketofEggsEvent;
|
||||
import org.rs09.consts.Items;
|
||||
import rs09.game.interaction.item.ToyListeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static api.ContentAPIKt.inEquipment;
|
||||
import static api.ContentAPIKt.inInventory;
|
||||
|
||||
|
||||
/**
|
||||
* Handles diango's item reclaiming interface
|
||||
@@ -25,14 +29,13 @@ import java.util.Objects;
|
||||
public class DiangoReclaimInterface extends ComponentPlugin {
|
||||
private static final int COMPONENT_ID = 468;
|
||||
public static final List<Item> ITEMS = new ArrayList<>(20);
|
||||
public static final Item[] HOLIDAY_ITEMS = {YoyoPlugin.YOYO, ReindeerHatPlugin.ReindeerHat, BasketofEggsEvent.RUBBER_CHICKEN,ZombieHeadPlugin.ZOMBIE_HEAD, new Item(6857), new Item(6856), new Item(6858), new Item(6859), new Item(6860), new Item(6861), new Item(6862), new Item(6863), new Item(9920), new Item(9921),new Item(9922), new Item(9923), new Item(9924), new Item(9925), new Item(11019), new Item(11020), new Item(11021), new Item(11022), new Item(11789), new Item(11949), new Item(12634), new Item(14076), new Item(14077), new Item(14081),new Item(14595), new Item(14602), new Item(14603), new Item(14605), new Item(14654)};
|
||||
public static final Item[] HOLIDAY_ITEMS = {new Item(Items.YO_YO_4079), new Item(Items.REINDEER_HAT_10507), BasketofEggsEvent.RUBBER_CHICKEN,new Item(Items.ZOMBIE_HEAD_6722), new Item(6857), new Item(6856), new Item(6858), new Item(6859), new Item(6860), new Item(6861), new Item(6862), new Item(6863), new Item(9920), new Item(9921),new Item(9922), new Item(9923), new Item(9924), new Item(9925), new Item(11019), new Item(11020), new Item(11021), new Item(11022), new Item(11789), new Item(11949), new Item(12634), new Item(14076), new Item(14077), new Item(14081),new Item(14595), new Item(14602), new Item(14603), new Item(14605), new Item(14654), new Item(Items.RED_MARIONETTE_6867), new Item(Items.GREEN_MARIONETTE_6866), new Item(Items.BLUE_MARIONETTE_6865)};
|
||||
|
||||
//initialize the plugin, add lists of items to the ITEMS list...
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(COMPONENT_ID,this);
|
||||
ITEMS.addAll(Arrays.asList(HOLIDAY_ITEMS));
|
||||
ITEMS.addAll(MarionettePlugin.MARIONETTES);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -47,7 +50,7 @@ public class DiangoReclaimInterface extends ComponentPlugin {
|
||||
Item[] reclaimables = ITEMS.stream().filter(Objects::nonNull)
|
||||
.filter(item -> !player.getEquipment().containsItem(item) && !player.getInventory().containsItem(item) && !player.getBank().containsItem(item)
|
||||
&& (item.getId() != 14654
|
||||
|| (!(ContentAPI.inInventory(player, 14655, 1) || ContentAPI.inEquipment(player, 14656, 1)) && player.getAttribute("sotr:purchased",false))
|
||||
|| (!(inInventory(player, 14655, 1) || inEquipment(player, 14656, 1)) && player.getAttribute("sotr:purchased",false))
|
||||
))
|
||||
.toArray(Item[]::new);
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Initializable
|
||||
public class MarionettePlugin extends OptionHandler {
|
||||
public final static List<Item> MARIONETTES = Arrays.asList(new Item(6865), new Item(6866), new Item(6867));
|
||||
private final Animation JUMP = new Animation(3003);
|
||||
private final Animation WALK = new Animation(3004);
|
||||
private final Animation BOW = new Animation(3005);
|
||||
private final Animation DANCE = new Animation(3006);
|
||||
private final int[][] GFX = new int[][] {{507,508,509,510}, {511,512,513,514}, {515,516,517,518}};
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for(Item item : MARIONETTES) {
|
||||
ItemDefinition def = item.getDefinition();
|
||||
def.getHandlers().put("option:jump",this);
|
||||
def.getHandlers().put("option:walk",this);
|
||||
def.getHandlers().put("option:bow",this);
|
||||
def.getHandlers().put("option:dance",this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
int index = 0;
|
||||
switch(node.getId()){
|
||||
case 6865:
|
||||
index = 1;
|
||||
break;
|
||||
case 6866:
|
||||
index = 2;
|
||||
break;
|
||||
case 6867:
|
||||
index = 0;
|
||||
break;
|
||||
}
|
||||
switch(option){
|
||||
case "jump":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(JUMP, new Graphics(GFX[index][0]));
|
||||
break;
|
||||
case "walk":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(WALK, new Graphics(GFX[index][1]));
|
||||
break;
|
||||
case "bow":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(BOW, new Graphics(GFX[index][2]));
|
||||
break;
|
||||
case "dance":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(DANCE, new Graphics(GFX[index][3]));
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
@Initializable
|
||||
public class ReindeerHatPlugin extends OptionHandler {
|
||||
public final static Item ReindeerHat = new Item(10507);
|
||||
|
||||
@Override
|
||||
public Plugin newInstance(Object arg) throws Throwable {
|
||||
ReindeerHat.getDefinition().getHandlers().put("option:operate",this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(new Animation(5059));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,6 @@ import rs09.plugin.PluginManager;
|
||||
|
||||
@Initializable
|
||||
public class SnowGlobePlugin extends OptionHandler {
|
||||
|
||||
private final Animation SHAKE = new Animation(7535);//Initial Shake
|
||||
private final Animation HOLDFACE = new Animation(7536);//Immediately after shake, player holds the snow globe to face
|
||||
private static final Component INTERFACE = new Component(659);//After HOLDFACE this interface is displayed, player either clicks 'continue' for inv of snowballs, or 'close' for no snowballs
|
||||
private final Animation DOWNFAST = new Animation(7537);//Used when player hit 'close' on the interface
|
||||
private final Animation DOWNSLOW = new Animation(7538);//Used when the player hit 'continue' on the interface
|
||||
@@ -29,28 +26,11 @@ public class SnowGlobePlugin extends OptionHandler {
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
PluginManager.definePlugin(new SnowGlobeInterface());
|
||||
ItemDefinition.forId(11949).getHandlers().put("option:shake",this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(SHAKE);
|
||||
player.getPulseManager().run(new Pulse(3) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.getAnimator().animate(HOLDFACE);
|
||||
player.getPulseManager().run(new Pulse(1){
|
||||
@Override
|
||||
public boolean pulse(){
|
||||
player.getInterfaceManager().open(INTERFACE);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
@Initializable
|
||||
public class YoyoPlugin extends OptionHandler {
|
||||
final static Animation PLAY = new Animation(1457);
|
||||
final static Animation LOOP = new Animation(1458);
|
||||
final static Animation WALK = new Animation(1459);
|
||||
final static Animation CRAZY = new Animation(1460);
|
||||
final static Item YOYO = new Item(4079);
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition def = ItemDefinition.forId(YOYO.getId());
|
||||
def.getHandlers().put("option:play",this);
|
||||
def.getHandlers().put("option:loop",this);
|
||||
def.getHandlers().put("option:walk",this);
|
||||
def.getHandlers().put("option:crazy",this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
|
||||
switch(option){
|
||||
case "play":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(PLAY);
|
||||
break;
|
||||
case "loop":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(LOOP);
|
||||
break;
|
||||
case "walk":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(WALK);
|
||||
break;
|
||||
case "crazy":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(CRAZY);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package core.game.interaction.item.toys;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
@Initializable
|
||||
public class ZombieHeadPlugin extends OptionHandler {
|
||||
static final Item ZOMBIE_HEAD = new Item(6722);
|
||||
static final Animation TALK_AT = new Animation(2840);
|
||||
static final Animation DISPLAY = new Animation(2844);
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition def = ItemDefinition.forId(ZOMBIE_HEAD.getId());
|
||||
def.getHandlers().put("option:talk-at",this);
|
||||
def.getHandlers().put("option:display",this);
|
||||
def.getHandlers().put("option:question",this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
switch(option){
|
||||
case "talk-at":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(TALK_AT);
|
||||
player.sendChat("Alas!");
|
||||
break;
|
||||
case "display":
|
||||
player.getLocks().lockInteractions(2);
|
||||
player.getAnimator().animate(DISPLAY);
|
||||
player.sendChat("MWAHHAHAHAHAHAHA");
|
||||
break;
|
||||
case "question":
|
||||
//player.getDialogueInterpreter().open()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.item.withitem;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.plugin.Initializable;
|
||||
import kotlin.Unit;
|
||||
@@ -222,7 +222,7 @@ public final class FruitCuttingPlugin extends UseWithHandler {
|
||||
amount = 5;
|
||||
break;
|
||||
case 4:
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.item.withitem;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
@@ -299,8 +299,8 @@ public class PoisonWeaponPlugin extends UseWithHandler {
|
||||
}
|
||||
int amt = Math.min(weaponItem.getAmount(), 5);
|
||||
player.getInventory().remove(new Item(weaponItem.getId(), amt));
|
||||
ContentAPI.addItemOrDrop(player, product, amt);
|
||||
ContentAPI.addItemOrDrop(player, Items.VIAL_229, 1);
|
||||
addItemOrDrop(player, product, amt);
|
||||
addItemOrDrop(player, Items.VIAL_229, 1);
|
||||
player.getPacketDispatch().sendMessage("You poison the " + weaponItem.getName().toLowerCase() + ".");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.item.withobject;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.plugin.Initializable;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
@@ -41,7 +41,7 @@ public final class WaterSourcePlugin extends UseWithHandler {
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int i : OBJECTS) {
|
||||
if(ContentAPI.sceneryDefinition(i).getName().toLowerCase().contains("well")){
|
||||
if(sceneryDefinition(i).getName().toLowerCase().contains("well")){
|
||||
continue;
|
||||
}
|
||||
addHandler(i, OBJECT_TYPE, this);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.npc
|
||||
|
||||
import api.ContentAPI
|
||||
import api.*
|
||||
import core.cache.def.impl.NPCDefinition
|
||||
import core.game.component.Component
|
||||
import core.plugin.Initializable
|
||||
@@ -27,16 +27,16 @@ class NPCTradePlugin : InteractionListener() {
|
||||
return@on true
|
||||
}
|
||||
if (npc.id == 7601) {
|
||||
ContentAPI.openInterface(player, 732)
|
||||
openInterface(player, 732)
|
||||
return@on true
|
||||
}
|
||||
return@on npc.openShop(player)
|
||||
}
|
||||
|
||||
on(NPCs.SIEGFRIED_ERKLE_933, NPC, "trade"){player, node ->
|
||||
val points = ContentAPI.getQP(player)
|
||||
val points = getQP(player)
|
||||
if(points < 40){
|
||||
ContentAPI.sendNPCDialogue(player, NPCs.SIEGFRIED_ERKLE_933, "I'm sorry, adventurer, but you need 40 quest points to buy from me.")
|
||||
sendNPCDialogue(player, NPCs.SIEGFRIED_ERKLE_933, "I'm sorry, adventurer, but you need 40 quest points to buy from me.")
|
||||
return@on true
|
||||
}
|
||||
node.asNpc().openShop(player)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package core.game.interaction.npc
|
||||
|
||||
import api.Container
|
||||
import api.ContentAPI
|
||||
import api.*
|
||||
import api.InputType
|
||||
import core.cache.def.impl.NPCDefinition
|
||||
import core.plugin.Initializable
|
||||
@@ -311,7 +311,7 @@ class ZaffPlugin : OptionHandler() {
|
||||
1001 -> when(buttonId){
|
||||
1 -> {
|
||||
end()
|
||||
ContentAPI.openDialogue(player, 9679, npc)
|
||||
openDialogue(player, 9679, npc)
|
||||
}
|
||||
2 -> {
|
||||
end()
|
||||
@@ -393,13 +393,13 @@ class ZaffPlugin : OptionHandler() {
|
||||
)
|
||||
stage = 1
|
||||
}
|
||||
1 -> end().also { ContentAPI.sendInputDialogue(player, InputType.NUMERIC, "Enter an amount:"){ value ->
|
||||
1 -> end().also { sendInputDialogue(player, InputType.NUMERIC, "Enter an amount:"){ value ->
|
||||
ammount = getStoreFile().getInt(player.username.toLowerCase())
|
||||
var amt = value as Int
|
||||
if(amt > maxStaffs - ammount) amt = maxStaffs - ammount
|
||||
val coinage = amt * 8000
|
||||
if(!ContentAPI.inInventory(player, Items.COINS_995, coinage)){
|
||||
ContentAPI.sendDialogue(player, "You can't afford that many.")
|
||||
if(!inInventory(player, Items.COINS_995, coinage)){
|
||||
sendDialogue(player, "You can't afford that many.")
|
||||
return@sendInputDialogue
|
||||
}
|
||||
|
||||
@@ -407,8 +407,8 @@ class ZaffPlugin : OptionHandler() {
|
||||
return@sendInputDialogue
|
||||
}
|
||||
|
||||
if(ContentAPI.removeItem(player, Item(Items.COINS_995, coinage), Container.INVENTORY)){
|
||||
ContentAPI.addItem(player, Items.BATTLESTAFF_1392, amt)
|
||||
if(removeItem(player, Item(Items.COINS_995, coinage), Container.INVENTORY)){
|
||||
addItem(player, Items.BATTLESTAFF_1392, amt)
|
||||
ZaffPlugin.getStoreFile()[player.username.toLowerCase()] = amt + ammount
|
||||
}
|
||||
} }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.interaction.object;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.CloseEvent;
|
||||
@@ -372,7 +372,7 @@ public final class BankingPlugin extends OptionHandler {
|
||||
amount = p.getBank().getLastAmountX();
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(p, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
@@ -452,7 +452,7 @@ public final class BankingPlugin extends OptionHandler {
|
||||
p.getBank().addItem(slot, p.getBank().getLastAmountX());
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(p, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
@@ -522,7 +522,7 @@ public final class BankingPlugin extends OptionHandler {
|
||||
});
|
||||
return true;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(p, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.combat.spell;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.skill.magic.Runes;
|
||||
import core.game.node.entity.Entity;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.npc.drop;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.content.global.Bones;
|
||||
import core.game.ge.GrandExchangeDatabase;
|
||||
@@ -113,7 +113,7 @@ public final class NPCDropTables {
|
||||
}
|
||||
return;
|
||||
}
|
||||
ContentAPI.announceIfRare(player, item);
|
||||
announceIfRare(player, item);
|
||||
if(item.getId() == 6199 && player instanceof Player){
|
||||
player.sendMessage("<col=990000>A mystery box has fallen on the ground.</col>");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package core.game.node.entity.player;
|
||||
|
||||
import api.ContentAPI;
|
||||
import core.game.component.Component;
|
||||
import core.game.container.Container;
|
||||
import core.game.container.impl.BankContainer;
|
||||
@@ -94,6 +93,7 @@ import rs09.tools.TickUtilsKt;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static api.ContentAPIKt.*;
|
||||
import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_BASE;
|
||||
import static rs09.game.node.entity.player.info.stats.StatAttributeKeysKt.STATS_DEATHS;
|
||||
import static rs09.tools.stringtools.GlobalsKt.colorize;
|
||||
@@ -801,11 +801,11 @@ public class Player extends Entity {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
boolean legs = ContentAPI.inEquipment(this, Items.VOID_KNIGHT_ROBE_8840, 1);
|
||||
boolean top = ContentAPI.inEquipment(this, Items.VOID_KNIGHT_TOP_8839, 1)
|
||||
|| ContentAPI.inEquipment(this, Items.VOID_KNIGHT_TOP_10611, 1);
|
||||
boolean gloves = ContentAPI.inEquipment(this, Items.VOID_KNIGHT_GLOVES_8842, 1);
|
||||
return ContentAPI.inEquipment(this, helm, 1) && legs && top && gloves;
|
||||
boolean legs = inEquipment(this, Items.VOID_KNIGHT_ROBE_8840, 1);
|
||||
boolean top = inEquipment(this, Items.VOID_KNIGHT_TOP_8839, 1)
|
||||
|| inEquipment(this, Items.VOID_KNIGHT_TOP_10611, 1);
|
||||
boolean gloves = inEquipment(this, Items.VOID_KNIGHT_GLOVES_8842, 1);
|
||||
return inEquipment(this, helm, 1) && legs && top && gloves;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.player.link.request.trade;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.container.*;
|
||||
import core.game.node.entity.player.Player;
|
||||
@@ -167,7 +167,7 @@ public final class TradeContainer extends Container {
|
||||
return false;
|
||||
}
|
||||
if ((playerIsBot || targetIsBot) && (playerIP.equals(targetIP) || playerMac.equals(targetMac) || playerHost.equals(targetHost))){
|
||||
ContentAPI.sendMessage(player, colorize("%RYou can not trade items with your own bot accounts."));
|
||||
sendMessage(player, colorize("%RYou can not trade items with your own bot accounts."));
|
||||
return false;
|
||||
}
|
||||
if (item.getName().equals("Coins") && item.getId() != 995) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.skill.agility;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.player.link.TeleportManager;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.MovementPulse;
|
||||
@@ -102,21 +102,21 @@ public final class AgilityHandler {
|
||||
*/
|
||||
public static void fail(final Player player, int delay, final Location dest, Animation anim, final int hit, final String message) {
|
||||
if (anim != null) {
|
||||
ContentAPI.animate(player, anim, true);
|
||||
ContentAPI.submitWorldPulse(new Pulse(ContentAPI.animationDuration(anim), player) {
|
||||
animate(player, anim, true);
|
||||
submitWorldPulse(new Pulse(animationDuration(anim), player) {
|
||||
boolean dmg = false;
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
ContentAPI.teleport(player, dest, TeleportManager.TeleportType.INSTANT);
|
||||
ContentAPI.animate(player, Animation.RESET, true);
|
||||
teleport(player, dest, TeleportManager.TeleportType.INSTANT);
|
||||
animate(player, Animation.RESET, true);
|
||||
if (!dmg) {
|
||||
if (hit > 0) {
|
||||
player.getImpactHandler().setDisabledTicks(0);
|
||||
ContentAPI.impact(player, hit, HitsplatType.NORMAL);
|
||||
impact(player, hit, HitsplatType.NORMAL);
|
||||
}
|
||||
if (message != null) {
|
||||
ContentAPI.sendMessage(player, message);
|
||||
sendMessage(player, message);
|
||||
}
|
||||
dmg = true;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package core.game.node.entity.skill.construction;
|
||||
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.content.dialogue.DialogueInterpreter;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
@@ -121,10 +121,10 @@ public final class PortalOptionPlugin extends OptionHandler {
|
||||
case 3:
|
||||
if(player.getIronmanManager().isIronman()){
|
||||
end();
|
||||
ContentAPI.sendMessage(player, "You can't do that as an ironman.");
|
||||
sendMessage(player, "You can't do that as an ironman.");
|
||||
return true;
|
||||
}
|
||||
ContentAPI.sendInputDialogue(player, false, "Enter friend's name:", (value) -> {
|
||||
sendInputDialogue(player, false, "Enter friend's name:", (value) -> {
|
||||
Player p = Repository.getPlayerByName((String) value);
|
||||
if (p == null || !p.isActive()) {
|
||||
player.getPacketDispatch().sendMessage("This player is not online.");
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package core.game.node.entity.skill.construction.decoration.chapel;
|
||||
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.content.global.Bones;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
@@ -89,7 +89,7 @@ public class BoneOfferPlugin extends UseWithHandler {
|
||||
|
||||
Location gfxLoc = player.getLocation().transform(player.getDirection(), 1);
|
||||
|
||||
ContentAPI.submitIndividualPulse(player, new Pulse(1) {
|
||||
submitIndividualPulse(player, new Pulse(1) {
|
||||
int counter = 0;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package core.game.node.entity.skill.herblore;
|
||||
|
||||
import api.Container;
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
@@ -39,9 +39,9 @@ public final class HerbCleanPlugin extends OptionHandler {
|
||||
return true;
|
||||
}
|
||||
double exp = herb.getExperience();
|
||||
if (ContentAPI.removeItem(player, node.asItem(), Container.INVENTORY)){
|
||||
if (removeItem(player, node.asItem(), Container.INVENTORY)){
|
||||
player.getSkills().addExperience(Skills.HERBLORE, exp, true);
|
||||
ContentAPI.addItem(player, herb.getProduct().getId(), 1);
|
||||
addItem(player, herb.getProduct().getId(), 1);
|
||||
player.getAudioManager().send(SFX_IDS[RandomFunction.random(SFX_IDS.length)], 1);
|
||||
player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf.");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.skill.slayer
|
||||
|
||||
import api.ContentAPI
|
||||
import api.*
|
||||
import api.EquipmentSlot
|
||||
import core.game.node.entity.player.Player
|
||||
import org.rs09.consts.Items
|
||||
@@ -18,16 +18,16 @@ object SlayerEquipmentFlags {
|
||||
@JvmStatic
|
||||
fun updateFlags(player: Player){
|
||||
var flags = 0
|
||||
if(SkillcapePerks.isActive(SkillcapePerks.TRICKS_OF_THE_TRADE,player) && ContentAPI.getAttribute(player, "cape_perks:tott:helmet-stored", false)) flags = 0x3F
|
||||
if(SkillcapePerks.isActive(SkillcapePerks.TRICKS_OF_THE_TRADE,player) && getAttribute(player, "cape_perks:tott:helmet-stored", false)) flags = 0x3F
|
||||
else if(hasItem(player, Items.SLAYER_HELMET_13263)) flags = 0x1F
|
||||
else if(hasItem(player, Items.NOSE_PEG_4168)) flags = 1
|
||||
else if(hasItem(player, Items.EARMUFFS_4166)) flags = flags or (1 shl 1)
|
||||
else if(hasItem(player, Items.FACE_MASK_4164)) flags = flags or (1 shl 2)
|
||||
else if((ContentAPI.getItemFromEquipment(player, EquipmentSlot.HAT)?.id ?: 0) in blackMasks) flags = flags or (1 shl 3)
|
||||
else if((getItemFromEquipment(player, EquipmentSlot.HAT)?.id ?: 0) in blackMasks) flags = flags or (1 shl 3)
|
||||
else if(hasItem(player, Items.SPINY_HELMET_4551)) flags = flags or (1 shl 4)
|
||||
|
||||
if((ContentAPI.getItemFromEquipment(player, EquipmentSlot.AMULET)?.id ?: 0) == Items.WITCHWOOD_ICON_8923) flags = flags or (1 shl 7)
|
||||
if((ContentAPI.getItemFromEquipment(player, EquipmentSlot.SHIELD)?.id ?: 0) == Items.MIRROR_SHIELD_4156) flags = flags or (1 shl 8)
|
||||
if((getItemFromEquipment(player, EquipmentSlot.AMULET)?.id ?: 0) == Items.WITCHWOOD_ICON_8923) flags = flags or (1 shl 7)
|
||||
if((getItemFromEquipment(player, EquipmentSlot.SHIELD)?.id ?: 0) == Items.MIRROR_SHIELD_4156) flags = flags or (1 shl 8)
|
||||
player.slayer.flags.equipmentFlags = flags
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ object SlayerEquipmentFlags {
|
||||
}
|
||||
|
||||
private fun hasItem(player: Player, id: Int): Boolean{
|
||||
return (ContentAPI.getItemFromEquipment(player, EquipmentSlot.HAT)?.id ?: 0) == id
|
||||
return (getItemFromEquipment(player, EquipmentSlot.HAT)?.id ?: 0) == id
|
||||
}
|
||||
|
||||
fun isSlayerEq(item: Int): Boolean{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.skill.slayer.dungeon;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.component.Component;
|
||||
@@ -68,7 +68,7 @@ public final class AncientCavern extends MapZone implements Plugin<Object> {
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Node node, String option) {
|
||||
ContentAPI.lock(player, 30);
|
||||
lock(player, 30);
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), player.getLocation().transform(0, -6, 0), Animation.create(6723), 10, 0.0, null);
|
||||
World.getPulser().submit(new Pulse(1, player) {
|
||||
int count;
|
||||
@@ -87,7 +87,7 @@ public final class AncientCavern extends MapZone implements Plugin<Object> {
|
||||
player.getPacketDispatch().sendMessages("You dive into the swirling maelstorm of the whirlpool.", "You are swirled beneath the water, the darkness and pressure are overwhelming.", "Mystical forces guide you into a cavern below the whirlpool.");
|
||||
break;
|
||||
case 8:
|
||||
ContentAPI.unlock(player);
|
||||
unlock(player);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.skill.smithing.smelting;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import api.EquipmentSlot;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import org.rs09.consts.Items;
|
||||
@@ -189,13 +189,13 @@ public class SmeltingPulse extends SkillPulse<Item> {
|
||||
public boolean success(Player player) {
|
||||
if (bar == Bar.IRON && !superHeat) {
|
||||
if (hasForgingRing(player)) {
|
||||
Item ring = ContentAPI.getItemFromEquipment(player, EquipmentSlot.RING);
|
||||
Item ring = getItemFromEquipment(player, EquipmentSlot.RING);
|
||||
if(ring != null){
|
||||
if(ContentAPI.getCharge(ring) == 1000) ContentAPI.setCharge(ring, 140);
|
||||
ContentAPI.adjustCharge(ring, -1);
|
||||
if(ContentAPI.getCharge(ring) == 0){
|
||||
if(getCharge(ring) == 1000) setCharge(ring, 140);
|
||||
adjustCharge(ring, -1);
|
||||
if(getCharge(ring) == 0){
|
||||
player.getEquipment().remove(ring);
|
||||
ContentAPI.sendMessage(player, "Your ring of forging uses up its last charge and disintegrates.");
|
||||
sendMessage(player, "Your ring of forging uses up its last charge and disintegrates.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.skill.summoning;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
@@ -49,7 +49,7 @@ public final class SummoningCreationPlugin extends ComponentPlugin {
|
||||
SummoningCreator.create(player, getItemAmount(opcode), component.getId() == 669 ? SummoningPouch.forSlot(slot > 50 ? slot -1 : slot) : SummoningScroll.forId(slot > 50 ? slot -1 : slot));
|
||||
break;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
SummoningCreator.create(player, (int) value, component.getId() == 669 ? SummoningPouch.forSlot(slot > 50 ? slot -1 : slot) : SummoningScroll.forId(slot > 50 ? slot -1 : slot));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.skill.summoning.familiar;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
@@ -56,7 +56,7 @@ public final class BurdenInterfacePlugin extends ComponentPlugin {
|
||||
beast.transfer(item, container.getAmount(item), withdraw);
|
||||
return true;
|
||||
case 234:
|
||||
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
|
||||
beast.transfer(item, (int) value, withdraw);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package core.net.packet.in;
|
||||
|
||||
import api.ContentAPI;
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.net.packet.IncomingPacket;
|
||||
@@ -33,7 +33,7 @@ public class RunScriptPacketHandler implements IncomingPacket {
|
||||
try {
|
||||
script.invoke(value);
|
||||
} catch (NumberFormatException nfe){
|
||||
ContentAPI.sendDialogue(player, "That number's a bit large, don't you think?");
|
||||
sendDialogue(player, "That number's a bit large, don't you think?");
|
||||
}
|
||||
player.removeAttribute("runscript");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user