API overhaul, convert Toy Plugins to Listeners

This commit is contained in:
Ceikry 2021-12-19 08:59:35 +00:00
parent 762604b1c5
commit d7fd988f50
165 changed files with 2233 additions and 2364 deletions

View file

@ -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;
});

View file

@ -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;
}

View file

@ -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;
});

View file

@ -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();

View file

@ -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);

View file

@ -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));
}
}

View file

@ -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;

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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:

View file

@ -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;
});

View file

@ -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

View file

@ -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);
}
}
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
});

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
});

View file

@ -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;
}
}

View file

@ -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();
}

View file

@ -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;
});

View file

@ -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;

View file

@ -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;
});

View file

@ -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;

View file

@ -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 {

View file

@ -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;
});

View file

@ -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;

View file

@ -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;
});

View file

@ -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");

View file

@ -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;
}

View file

@ -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{

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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");

View file

@ -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() + ".");
}

View file

@ -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);

View file

@ -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)

View file

@ -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
}
} }

View file

@ -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");

View file

@ -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;

View file

@ -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>");
}

View file

@ -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;
}
/**

View file

@ -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) {

View file

@ -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;
}

View file

@ -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.");

View file

@ -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

View file

@ -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.");
}

View file

@ -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{

View file

@ -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;

View file

@ -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;

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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");
}

File diff suppressed because it is too large Load diff

View file

@ -3,52 +3,48 @@ import rs09.game.system.SystemLogger
import java.util.*
import kotlin.system.exitProcess
object DialUtils {
//Number of chars per line. Line is split at the nearest whole word that doesn't exceed this length. This should remain constant once a perfect value is found
const val LINE_SIZE = 52.0
//Number of chars per line. Line is split at the nearest whole word that doesn't exceed this length. This should remain constant once a perfect value is found
const val LINE_SIZE = 52.0
/**
* Automatically split a single continuous string into multiple comma-separated lines.
* Should this not work out for any reason, you should fallback to standard npc and player methods for dialogue.
*/
fun splitLines(message: String): Array<String>{
val chars = message.split("").toTypedArray().size.toDouble()
val words = message.split(" ").toTypedArray()
val lines = Math.ceil(chars / LINE_SIZE).toInt()
@JvmStatic
/**
* Automatically split a single continuous string into multiple comma-separated lines.
* Should this not work out for any reason, you should fallback to standard npc and player methods for dialogue.
*/
fun splitLines(message: String): Array<String>{
val chars = message.split("").toTypedArray().size.toDouble()
val words = message.split(" ").toTypedArray()
val lines = Math.ceil(chars / LINE_SIZE).toInt()
if(lines > 4){
SystemLogger.logErr("INVALID NUM LINES. NUM CHARS: $chars")
}
val messages = ArrayList<String>()
var index = 0
for (msg in 0 until lines) {
var length = 0
val line = StringBuilder()
while (length <= LINE_SIZE && !(index == words.size)) {
var currentWord = ""
try {
currentWord = words[index] + if (length + words[index].length + 1 <= LINE_SIZE) " " else ""
} catch (e: Exception){
SystemLogger.logWarn("INDEX: $index WORDSIZE: ${words.size}")
for(word in words.indices){
SystemLogger.logErr("Word $word: ${words[word]}")
}
exitProcess(0)
}
length += currentWord.length
if (length <= LINE_SIZE) {
line.append(currentWord)
++index
}
}
messages.add(line.toString())
}
return messages.toTypedArray()
if(lines > 4){
SystemLogger.logErr("INVALID NUM LINES. NUM CHARS: $chars")
}
val messages = ArrayList<String>()
var index = 0
for (msg in 0 until lines) {
var length = 0
val line = StringBuilder()
while (length <= LINE_SIZE && !(index == words.size)) {
var currentWord = ""
try {
currentWord = words[index] + if (length + words[index].length + 1 <= LINE_SIZE) " " else ""
} catch (e: Exception){
SystemLogger.logWarn("INDEX: $index WORDSIZE: ${words.size}")
for(word in words.indices){
SystemLogger.logErr("Word $word: ${words[word]}")
}
exitProcess(0)
}
length += currentWord.length
if (length <= LINE_SIZE) {
line.append(currentWord)
++index
}
}
messages.add(line.toString())
}
return messages.toTypedArray()
}

View file

@ -1,6 +1,6 @@
package rs09.game.ai.general
import api.ContentAPI
import api.*
import core.cache.def.impl.ItemDefinition
import core.game.component.Component
import core.game.content.consumable.Consumable
@ -704,7 +704,7 @@ class ScriptAPI(private val bot: Player) {
*/
fun checkPriceOverrides(id: Int): Int?{
return when(id){
else -> ContentAPI.itemDefinition(id).getConfiguration(ItemConfigParser.GE_PRICE)
else -> itemDefinition(id).getConfiguration(ItemConfigParser.GE_PRICE)
}
}

View file

@ -12,7 +12,7 @@ import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import api.ContentAPI
import api.*
@PlayerCompatible
@ScriptName("Falador Coal Miner")
@ -58,7 +58,7 @@ class CoalMiner : Script() {
val rock = scriptAPI.getNearestNode("rocks",true)
rock?.let { InteractionListeners.run(rock.id, InteractionListener.SCENERY,"mine",bot,rock) }
}
overlay!!.setAmount(ContentAPI.amountInInventory(bot, Items.COAL_453) + coalAmount)
overlay!!.setAmount(amountInInventory(bot, Items.COAL_453) + coalAmount)
}
State.TO_BANK -> {

View file

@ -1,6 +1,6 @@
package rs09.game.ai.general.scriptrepository
import api.ContentAPI
import api.*
import core.game.world.map.zone.ZoneBorders
import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler

View file

@ -1,6 +1,6 @@
package rs09.game.ai.general.scriptrepository
import api.ContentAPI
import api.*
import core.game.interaction.DestinationFlag
import core.game.interaction.MovementPulse
import core.game.node.entity.skill.crafting.spinning.SpinningItem
@ -131,7 +131,7 @@ class GnomeBowstring : Script() {
}
})
}
if(ContentAPI.freeSlots(bot) > 27){
if(freeSlots(bot) > 27){
bLadderSwitch = true
state = State.RETURN_TO_FLAX
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.activity.barrows
import api.ContentAPI
import api.*
import core.game.component.Component
import core.game.container.access.InterfaceContainer
import core.game.content.global.BossKillCounter
@ -94,7 +94,7 @@ object RewardChest {
player.interfaceManager.open(Component(Components.TRAIL_REWARD_364))
BossKillCounter.addtoBarrowsCount(player)
for(item in rewards){
ContentAPI.announceIfRare(player, item);
announceIfRare(player, item);
if(!player.inventory.add(item)){
GroundItemManager.create(item,player)
}

View file

@ -1,4 +1,4 @@
import api.ContentAPI
import api.*
import core.game.component.Component
import core.game.node.entity.Entity
import core.game.node.entity.impl.Projectile
@ -68,14 +68,14 @@ data class SeedDestination(val player: Player, val loc: Location, val alive: Boo
var SEED_LOCS: HashSet<Location> = HashSet()
fun isSeed(loc: Location): Boolean {
val scenery = ContentAPI.getScenery(loc)
val scenery = getScenery(loc)
return scenery != null && SEED_LOCS.contains(scenery.location)
}
fun populateSeeds() {
while(SEED_LOCS.size < MAX_SEEDS) {
val loc = VINESWEEPER_BORDERS.getRandomLoc()
val scenery = ContentAPI.getScenery(loc)
val scenery = getScenery(loc)
if(scenery != null && HOLES.contains(scenery.id)) {
SEED_LOCS.add(loc)
}
@ -83,14 +83,14 @@ fun populateSeeds() {
}
fun isHole(loc: Location): Boolean {
val scenery = ContentAPI.getScenery(loc)
val scenery = getScenery(loc)
return scenery != null && HOLES.contains(scenery.id)
}
fun scheduleNPCs(player: Player, loc: Location, alive: Boolean, rabbit: Boolean) {
val dest = SeedDestination(player, loc, alive)
val ids = if(rabbit) { intArrayOf(RABBIT, *FARMERS) } else { FARMERS }
for(npc in ContentAPI.findLocalNPCs(player, ids, 30)) {
for(npc in findLocalNPCs(player, ids, 30)) {
if(npc is VinesweeperNPC) {
npc.seedDestinations.add(dest)
npc.resetWalk()
@ -138,7 +138,7 @@ class VinesweeperListener : InteractionListener() {
sendUpdatedPoints(player)
player.sendMessage("Oh dear! It looks like you dug up a potato seed by mistake.");
scheduleNPCs(player, loc, false, false)
val scenery = ContentAPI.getScenery(loc)
val scenery = getScenery(loc)
if(scenery != null) {
SceneryBuilder.replace(scenery, scenery.transform(DEAD_PLANT_OBJ))
}
@ -153,7 +153,7 @@ class VinesweeperListener : InteractionListener() {
}
}
}
val scenery = ContentAPI.getScenery(loc)
val scenery = getScenery(loc)
if(scenery != null) {
SceneryBuilder.replace(scenery, scenery.transform(NUMBERS[count]))
}
@ -174,7 +174,7 @@ class VinesweeperListener : InteractionListener() {
on(PORTAL, SCENERY, "enter") { player, _ ->
val x = player.getAttribute("vinesweeper:return-tele:x", 3052)
val y = player.getAttribute("vinesweeper:return-tele:y", 3304)
ContentAPI.teleport(player, Location(x, y))
teleport(player, Location(x, y))
return@on true
}
on(SIGNS, SCENERY, "read") { player, node ->
@ -219,14 +219,14 @@ class VinesweeperListener : InteractionListener() {
"You are certain there is no seed planted here."
}
}
ContentAPI.sendDialogue(player, msg)
sendDialogue(player, msg)
return true
}
})
return@on true
}
on(MRS_WINKIN, NPC, "talk-to") { player, npc ->
ContentAPI.openDialogue(player, WinkinDialogue(), npc)
openDialogue(player, WinkinDialogue(), npc)
return@on true
}
on(MRS_WINKIN, NPC, "trade") { player, _ ->
@ -236,7 +236,7 @@ class VinesweeperListener : InteractionListener() {
on(MRS_WINKIN, NPC, "buy flags") { player, npc ->
val dialogue = WinkinDialogue()
dialogue.stage = 20
ContentAPI.openDialogue(player, dialogue, npc)
openDialogue(player, dialogue, npc)
return@on true
}
on(RABBIT, NPC, "feed") { player, node ->
@ -263,19 +263,19 @@ class VinesweeperListener : InteractionListener() {
}
on(FARMER_BLINKIN, NPC, "talk-to") { player, npc ->
//player.interfaceManager.open(Component(TUTORIAL))
ContentAPI.openDialogue(player, BlinkinDialogue(), npc)
openDialogue(player, BlinkinDialogue(), npc)
return@on true
}
on(FARMER_BLINKIN, NPC, "buy-flags") { player, npc ->
val dialogue = BlinkinDialogue()
dialogue.stage = 21
ContentAPI.openDialogue(player, dialogue, npc)
openDialogue(player, dialogue, npc)
return@on true
}
on(FARMER_BLINKIN, NPC, "buy-roots") { player, npc ->
val dialogue = BlinkinDialogue()
dialogue.stage = 40
ContentAPI.openDialogue(player, dialogue, npc)
openDialogue(player, dialogue, npc)
return@on true
}
}
@ -306,13 +306,13 @@ class VinesweeperNPC : AbstractNPC {
override fun handleTickActions() {
val dest = seedDestinations.find({sd -> sd.loc == location})
if(dest != null) {
for(npc in ContentAPI.findLocalNPCs(this, intArrayOf(RABBIT, *FARMERS), 30)) {
for(npc in findLocalNPCs(this, intArrayOf(RABBIT, *FARMERS), 30)) {
if(npc is VinesweeperNPC) {
npc.seedDestinations.remove(dest)
npc.resetWalk()
}
}
val scenery = ContentAPI.getScenery(dest.loc)
val scenery = getScenery(dest.loc)
if(scenery != null) {
if(id == RABBIT) {
val replacement = if(SEED_LOCS.contains(dest.loc)) { DEAD_PLANT_OBJ } else { HOLES[0] }
@ -389,7 +389,7 @@ class VinesweeperNPC : AbstractNPC {
fun farmerClear(dest: SeedDestination) {
for(dx in -FARMER_CLEAR_RADIUS..FARMER_CLEAR_RADIUS) {
for(dy in -FARMER_CLEAR_RADIUS..FARMER_CLEAR_RADIUS) {
val toClear = ContentAPI.getScenery(dest.loc.transform(dx, dy, 0))
val toClear = getScenery(dest.loc.transform(dx, dy, 0))
if(toClear != null && intArrayOf(DEAD_PLANT_OBJ, *NUMBERS).contains(toClear.id)) {
SceneryBuilder.replace(toClear, toClear.transform(HOLES[0]))
}
@ -508,7 +508,7 @@ class VinesweeperRewards : InterfaceListener() {
override fun defineListeners() {
onOpen(IFACE) { _, _ ->
/*for((buttonID, reward) in REWARDS) {
ContentAPI.sendItemOnInterface(player, IFACE, buttonID, reward.itemID, 5)
sendItemOnInterface(player, IFACE, buttonID, reward.itemID, 5)
}*/
//player.packetDispatch.sendRunScript(2003, "")
return@onOpen true

View file

@ -1,4 +1,4 @@
import api.ContentAPI
import api.*
import core.game.component.Component
import core.game.node.entity.player.Player
import core.game.node.item.GroundItemManager
@ -140,7 +140,7 @@ class BlinkinDialogue : FarmerDialogue() {
npcl("Sorry, ya can't afford that many. Come back when yer feeling a bit richer if ya like!")
stage = END_DIALOGUE
}
//ContentAPI.openDialogue(player!!, this, npc as Any)
//openDialogue(player!!, this, npc as Any)
}
player!!.dialogueInterpreter.sendInput(false, "Enter the amount:")
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.ame
import api.ContentAPI
import api.*
import core.game.interaction.MovementPulse
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
@ -35,7 +35,7 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
open fun terminate(){
player.antiMacroHandler.event = null
if(initialized){
ContentAPI.poofClear(this)
poofClear(this)
}
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.ame.events.certer
import api.ContentAPI
import api.*
import core.game.component.Component
import core.game.node.item.GroundItemManager
import rs09.game.content.dialogue.DialogueFile
@ -23,7 +23,7 @@ class CerterDialogue(val initial: Boolean) : DialogueFile() {
0 -> if(!isCorrect) npc("Sorry, I don't think so.").also { stage = END_DIALOGUE; player!!.antiMacroHandler.event?.terminate() } else npc("Oh yes! That's right.").also { stage++ }
1 -> {
npc("Please, take this as a thanks.")
player!!.antiMacroHandler.event?.loot!!.roll().forEach { ContentAPI.addItemOrDrop(player!!, it.id, it.amount) }
player!!.antiMacroHandler.event?.loot!!.roll().forEach { addItemOrDrop(player!!, it.id, it.amount) }
player!!.antiMacroHandler.event?.terminate()
stage = END_DIALOGUE
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.ame.events.drilldemon
import api.ContentAPI
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.game.node.item.GroundItemManager
@ -29,8 +29,8 @@ object DrillDemonUtils {
player.packetDispatch.sendInterfaceConfig(548, 69, true)
player.packetDispatch.sendInterfaceConfig(746, 12, true)
ContentAPI.registerLogoutListener(player, "drilldemon"){p ->
ContentAPI.teleport(p, player.getAttribute(DD_KEY_RETURN_LOC, p.location))
registerLogoutListener(player, "drilldemon"){p ->
teleport(p, player.getAttribute(DD_KEY_RETURN_LOC, p.location))
}
changeSignsAndAssignTask(player)
@ -78,7 +78,7 @@ object DrillDemonUtils {
}
fun cleanup(player: Player){
ContentAPI.clearLogoutListener(player, "drilldemon")
clearLogoutListener(player, "drilldemon")
player.properties.teleportLocation = player.getAttribute(DD_KEY_RETURN_LOC)
player.removeAttribute(DD_KEY_NPC)
player.removeAttribute(DD_KEY_RETURN_LOC)

View file

@ -1,6 +1,6 @@
package rs09.game.content.ame.events.genie
import api.ContentAPI
import api.*
import core.game.content.dialogue.FacialExpression
import core.cache.def.impl.ItemDefinition
import core.game.component.Component
@ -14,7 +14,7 @@ class GenieDialogue : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
val assigned = player!!.getAttribute("genie:item",0)
npcl(FacialExpression.NEUTRAL, "Ah, so you are there, ${player!!.name.capitalize()}. I'm so glad you summoned me. Please take this lamp and make your wish.")
ContentAPI.addItemOrDrop(player!!, assigned)
addItemOrDrop(player!!, assigned)
player!!.antiMacroHandler.event?.terminate()
stage = END_DIALOGUE
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.ame.events.supriseexam
import api.ContentAPI
import api.*
import core.game.node.entity.player.Player
import core.game.node.item.GroundItemManager
import core.game.node.item.Item
@ -30,8 +30,8 @@ object SurpriseExamUtils {
fun teleport(player: Player){
player.setAttribute(SE_KEY_LOC,player.location)
ContentAPI.registerLogoutListener(player, SE_LOGOUT_KEY){p ->
ContentAPI.teleport(p, p.getAttribute(SE_KEY_LOC, p.location))
registerLogoutListener(player, SE_LOGOUT_KEY){p ->
teleport(p, p.getAttribute(SE_KEY_LOC, p.location))
}
player.properties.teleportLocation = Location.create(1886, 5025, 0)
@ -39,7 +39,7 @@ object SurpriseExamUtils {
fun cleanup(player: Player){
player.properties.teleportLocation = player.getAttribute(SE_KEY_LOC,null)
ContentAPI.clearLogoutListener(player, SE_LOGOUT_KEY)
clearLogoutListener(player, SE_LOGOUT_KEY)
player.removeAttribute(SE_KEY_LOC)
player.removeAttribute(SE_KEY_INDEX)
player.removeAttribute(SE_KEY_CORRECT)

View file

@ -1,6 +1,6 @@
package rs09.game.content.dialogue
import api.ContentAPI
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.player.Player
@ -41,7 +41,7 @@ class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) {
10 -> npcl(FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ }
11 -> options("Here you go!","Nevermind.").also { stage++ }
12 -> when(buttonId){
1 -> if(ContentAPI.inInventory(player, 995, 7500000))
1 -> if(inInventory(player, 995, 7500000))
playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
else
playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
@ -51,8 +51,8 @@ class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) {
20 -> {
npcl(FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.")
if(ContentAPI.removeItem(player, Item(995,7500000), api.Container.INVENTORY)) {
ContentAPI.addItem(player, Items.FIGHTER_TORSO_10551, 1)
if(removeItem(player, Item(995,7500000), api.Container.INVENTORY)) {
addItem(player, Items.FIGHTER_TORSO_10551, 1)
}
stage = END_DIALOGUE
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.dialogue
import api.DialUtils.splitLines
import api.splitLines
import core.game.component.Component
import core.game.content.dialogue.DialogueInterpreter
import core.game.content.dialogue.DialoguePlugin

View file

@ -1,7 +1,7 @@
package rs09.game.content.dialogue.region.dungeon.taverley
import api.Container
import api.ContentAPI
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.player.Player
@ -17,11 +17,11 @@ class VelrakDialogue(player: Player? = null) : DialoguePlugin(player) {
}
override fun open(vararg args: Any?): Boolean {
if(ContentAPI.inInventory(player, Items.DUSTY_KEY_1590)){
if(inInventory(player, Items.DUSTY_KEY_1590)){
playerl(FacialExpression.HALF_THINKING, "Are you still here?").also { stage = 100 }
} else {
npcl(FacialExpression.FRIENDLY, "Thank you for rescuing me! It isn't very comfy in this cell.")
ContentAPI.removeItem(player, Items.JAIL_KEY_1591, Container.INVENTORY)
removeItem(player, Items.JAIL_KEY_1591, Container.INVENTORY)
}
return true
}
@ -42,7 +42,7 @@ class VelrakDialogue(player: Player? = null) : DialoguePlugin(player) {
2 -> playerl(FacialExpression.NEUTRAL, "No, it's too dangerous for me too.").also { stage = 15 }
}
14 -> ContentAPI.sendItemDialogue(player, Items.DUSTY_KEY_1590, "Velrak reaches somewhere mysterious and passes you a key.").also { ContentAPI.addItem(player, Items.DUSTY_KEY_1590, 1); stage = END_DIALOGUE }
14 -> sendItemDialogue(player, Items.DUSTY_KEY_1590, "Velrak reaches somewhere mysterious and passes you a key.").also { addItem(player, Items.DUSTY_KEY_1590, 1); stage = END_DIALOGUE }
15 -> npcl(FacialExpression.FRIENDLY, "I don't blame you!").also { stage = END_DIALOGUE }

View file

@ -1,6 +1,6 @@
package rs09.game.content.dialogue.region.jatizso
import api.DialUtils
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import org.rs09.consts.NPCs
@ -27,6 +27,6 @@ class LeftieRightieDialogue() : DialogueFile() {
}
fun npc2(messages: String){
sendNormalDialogue(leftie, FacialExpression.NEUTRAL, *DialUtils.splitLines(messages))
sendNormalDialogue(leftie, FacialExpression.NEUTRAL, *splitLines(messages))
}
}

View file

@ -1,7 +1,7 @@
package rs09.game.content.global.worldevents.holiday.christmas
import api.Container
import api.ContentAPI
import api.*
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.plugin.Initializable
@ -30,8 +30,8 @@ class GiftRollPlugin : XPGainPlugin() {
if(System.currentTimeMillis() > cooldown && numDaily < 10 && RandomFunction.roll(15).also { player.debug("Rolling gift: $it") } && amount > 20) {
incrementDailyGifts(player)
ContentAPI.addItemOrDrop(player, Items.MYSTERY_BOX_6199)
ContentAPI.sendMessage(player, colorize("%RMerry Christmas! %GYou randomly receive a mystery box while training ${Skills.SKILL_NAME[skill]}!"))
addItemOrDrop(player, Items.MYSTERY_BOX_6199)
sendMessage(player, colorize("%RMerry Christmas! %GYou randomly receive a mystery box while training ${Skills.SKILL_NAME[skill]}!"))
}
}
@ -63,9 +63,9 @@ class XMASMboxHandler : InteractionListener() {
on(MBOX, ITEM, "open"){player, used ->
val item = MBOX_LOOT.roll().first()
if(ContentAPI.removeItem(player, used, Container.INVENTORY)) {
ContentAPI.sendDialogue(player, "You open the gift and find ${item.amount} ${item.name}!")
ContentAPI.addItemOrDrop(player, item.id, item.amount)
if(removeItem(player, used, Container.INVENTORY)) {
sendDialogue(player, "You open the gift and find ${item.amount} ${item.name}!")
addItemOrDrop(player, item.id, item.amount)
}
return@on true
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.global.worldevents.holiday.halloween
import api.ContentAPI
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.combat.ImpactHandler
@ -179,7 +179,7 @@ class GrimDialogue(player: Player? = null) : DialoguePlugin(player){
fun buyStaff(player: Player){
player.setAttribute("/save:sotr:purchased", true)
removeCandies(player, 40)
ContentAPI.addItem(player, 14654, 1)
addItem(player, 14654, 1)
stage = 104
handleRewardShop(player, -1)
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.global.worldevents.holiday.halloween
import api.ContentAPI
import api.*
import core.game.component.Component
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
@ -26,12 +26,12 @@ class TrickOrTreatHandler : InteractionListener() {
val hasDoneMe = getTrickOrTreatedNPCs(player).contains(node.name.toLowerCase())
if(hasDone5){
ContentAPI.sendNPCDialogue(player, node.id, "My informants tell me you've already collected candy from 5 people today.", FacialExpression.FRIENDLY)
sendNPCDialogue(player, node.id, "My informants tell me you've already collected candy from 5 people today.", FacialExpression.FRIENDLY)
return@on true
}
if(hasDoneMe){
ContentAPI.sendNPCDialogue(player, node.id, "You've already asked me today! Don't get greedy, now.", FacialExpression.ANNOYED)
sendNPCDialogue(player, node.id, "You've already asked me today! Don't get greedy, now.", FacialExpression.ANNOYED)
return@on true
}
@ -42,7 +42,7 @@ class TrickOrTreatHandler : InteractionListener() {
1 -> npcl(FacialExpression.FRIENDLY, "Very well, then, here you are my friend.").also { stage++ }
2 -> {
player.dialogueInterpreter.sendItemMessage(14084, "They hand you a nicely-wrapped candy.")
ContentAPI.addItemOrDrop(player, 14084, 1)
addItemOrDrop(player, 14084, 1)
registerNpc(player, npc!!)
incrementDailyToT(player)
stage = END_DIALOGUE

View file

@ -1,6 +1,6 @@
package rs09.game.content.global.worldevents.penguinhns
import api.ContentAPI
import api.*
import core.game.component.Component
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
@ -75,7 +75,7 @@ class LarryHandler(player: Player? = null) : DialoguePlugin(player){
return
}
val level = ContentAPI.getStatLevel(player, skill)
val level = getStatLevel(player, skill)
System.out.println("Level: $level")
val expGained = points?.toDouble()?.times((level * 25))
System.out.print("exp: $expGained")

View file

@ -1,6 +1,6 @@
package rs09.game.content.global.worldevents.shootingstar
import api.ContentAPI
import api.*
import core.game.content.global.worldevents.shootingstar.ScoreboardManager
import core.game.node.scenery.Scenery
import core.game.node.entity.player.Player
@ -101,7 +101,7 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin
if (ShootingStarOptionHandler.getStarDust(player) < 200) {
player.inventory.add(Item(ShootingStarOptionHandler.STAR_DUST, 1))
}
if(!ContentAPI.inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !ContentAPI.inBank(player, Items.ANCIENT_BLUEPRINT_14651)){
if(!inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !inBank(player, Items.ANCIENT_BLUEPRINT_14651)){
rollBlueprint(player)
}
return false
@ -121,9 +121,9 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin
}
if(RandomFunction.roll(chance)){
ContentAPI.addItemOrDrop(player, Items.ANCIENT_BLUEPRINT_14651, 1)
ContentAPI.sendMessage(player, colorize("%RWhile mining the star you find an ancient-looking blueprint."))
ContentAPI.sendNews("${player.username} found an Ancient Blueprint while mining a shooting star!")
addItemOrDrop(player, Items.ANCIENT_BLUEPRINT_14651, 1)
sendMessage(player, colorize("%RWhile mining the star you find an ancient-looking blueprint."))
sendNews("${player.username} found an Ancient Blueprint while mining a shooting star!")
}
}

View file

@ -1,7 +1,7 @@
package rs09.game.content.global.worldevents.shootingstar
import api.Container
import api.ContentAPI
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
@ -64,10 +64,10 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any): Boolean {
npc = args[0] as NPC
if (ContentAPI.inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !ContentAPI.getAttribute(player, "star-ring:bp-shown", false)) {
if (inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !getAttribute(player, "star-ring:bp-shown", false)) {
npcl(FacialExpression.NEUTRAL, "I see you got ahold of a blueprint of those silly old rings we used to make.")
stage = 1000
} else if (ContentAPI.inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && ContentAPI.getAttribute(player, "star-ring:bp-shown", false)) {
} else if (inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && getAttribute(player, "star-ring:bp-shown", false)) {
playerl(FacialExpression.HALF_ASKING, "So about those rings...")
stage = 2000
} else if (getStoreFile().getBoolean(player.username.toLowerCase()) || !player.getInventory().contains(ShootingStarOptionHandler.STAR_DUST, 1)) {
@ -184,7 +184,7 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
}
41 -> end()
50 -> {
val wearingRing = ContentAPI.inEquipment(player, Items.RING_OF_THE_STAR_SPRITE_14652)
val wearingRing = inEquipment(player, Items.RING_OF_THE_STAR_SPRITE_14652)
val dust = if (player.getInventory().getAmount(ShootingStarOptionHandler.STAR_DUST) > 200) 200 else player.getInventory().getAmount(ShootingStarOptionHandler.STAR_DUST)
if (player.getInventory().remove(Item(ShootingStarOptionHandler.STAR_DUST, dust))) {
val cosmicRunes = (Math.ceil(0.76 * dust) * AMPLIFIER).toInt()
@ -214,10 +214,10 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
}
}
if(!ContentAPI.inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !ContentAPI.inBank(player, Items.ANCIENT_BLUEPRINT_14651) && RandomFunction.roll(500)){
ContentAPI.addItemOrDrop(player, Items.ANCIENT_BLUEPRINT_14651, 1)
ContentAPI.sendMessage(player, colorize("%RThe Star Sprite dropped what looks like some ancient piece of paper and you pick it up."))
ContentAPI.sendNews("${player.username} found an Ancient Blueprint while mining a shooting star!")
if(!inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !inBank(player, Items.ANCIENT_BLUEPRINT_14651) && RandomFunction.roll(500)){
addItemOrDrop(player, Items.ANCIENT_BLUEPRINT_14651, 1)
sendMessage(player, colorize("%RThe Star Sprite dropped what looks like some ancient piece of paper and you pick it up."))
sendNews("${player.username} found an Ancient Blueprint while mining a shooting star!")
}
stage = 52
}
@ -235,19 +235,19 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
1008 -> npcl(FacialExpression.NEUTRAL, "Yes, it seems we need a ring mould, a silver bar, a cut dragonstone and 200 stardust. Oh, and make sure to bring this blueprint with you.").also { stage++ }
1009 -> playerl(FacialExpression.FRIENDLY, "Thanks, I'll get right on it!").also { stage++ }
1010 -> playerl(FacialExpression.ASKING, "So just to make sure I've got it right, I need a ring mould, a silver bar, a cut dragonstone and 200 stardust, as well as this blueprint?").also { stage++ }
1011 -> npcl(FacialExpression.NEUTRAL, "Yeah, you've got it, human. Any of my kin should be able to do this for you.").also { stage++; ContentAPI.setAttribute(player, "/save:star-ring:bp-shown", true) }
1011 -> npcl(FacialExpression.NEUTRAL, "Yeah, you've got it, human. Any of my kin should be able to do this for you.").also { stage++; setAttribute(player, "/save:star-ring:bp-shown", true) }
1012 -> playerl(FacialExpression.FRIENDLY, "Thanks!").also { stage = END_DIALOGUE }
2000 -> npcl(FacialExpression.NEUTRAL, "Yes, did you bring the components to make it, human?").also { stage++ }
2001 -> if(ContentAPI.inInventory(player, Items.DRAGONSTONE_1615,1) && ContentAPI.inInventory(player, Items.RING_MOULD_1592, 1) && ContentAPI.inInventory(player, Items.STARDUST_13727, 200) && ContentAPI.inInventory(player, Items.SILVER_BAR_2355, 1)){
2001 -> if(inInventory(player, Items.DRAGONSTONE_1615,1) && inInventory(player, Items.RING_MOULD_1592, 1) && inInventory(player, Items.STARDUST_13727, 200) && inInventory(player, Items.SILVER_BAR_2355, 1)){
playerl(FacialExpression.FRIENDLY, "Yes, I have them right here, friend.").also { stage++ }
} else {
playerl(FacialExpression.HALF_GUILTY, "I'm afraid not, what did I need again?").also { stage = 2100 }
}
2002 -> npcl(FacialExpression.NEUTRAL, "Excellent, give me just a moment here...").also { stage++ }
2003 -> sendDialogue("You watch as the Star Sprite casts some strange spell.").also { stage++ }
2004 -> if(ContentAPI.removeItem(player, Items.SILVER_BAR_2355, Container.INVENTORY) && ContentAPI.removeItem(player, Items.DRAGONSTONE_1615, Container.INVENTORY) && ContentAPI.removeItem(player, Item(Items.STARDUST_13727, 200), Container.INVENTORY)){
ContentAPI.addItem(player, Items.RING_OF_THE_STAR_SPRITE_14652)
2004 -> if(removeItem(player, Items.SILVER_BAR_2355, Container.INVENTORY) && removeItem(player, Items.DRAGONSTONE_1615, Container.INVENTORY) && removeItem(player, Item(Items.STARDUST_13727, 200), Container.INVENTORY)){
addItem(player, Items.RING_OF_THE_STAR_SPRITE_14652)
player.dialogueInterpreter.sendItemMessage(Items.RING_OF_THE_STAR_SPRITE_14652, "The Star Sprite hands you a strange ring.").also { stage++ }
} else end()
2005 -> npcl(FacialExpression.NEUTRAL, "There you go, I hope you enjoy it!").also { stage++ }
@ -266,13 +266,13 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) {
if(RandomFunction.roll(3)){
val state = player.states["shooting-star"] as? ShootingStarState ?: return
state.ticksLeft += secondsToTicks(TimeUnit.MINUTES.toSeconds(5).toInt())
ContentAPI.sendMessage(player, colorize("%RYour ring shines dimly as if imbued with energy."))
sendMessage(player, colorize("%RYour ring shines dimly as if imbued with energy."))
} else if(RandomFunction.roll(5)){
ContentAPI.addItem(player, bonusId, bonusBaseAmt)
ContentAPI.sendMessage(player, colorize("%RYour ring shines brightly as if surging with energy and then fades out."))
addItem(player, bonusId, bonusBaseAmt)
sendMessage(player, colorize("%RYour ring shines brightly as if surging with energy and then fades out."))
} else if(RandomFunction.roll(25)){
getStoreFile()[player.username.toLowerCase()] = false //flag daily as uncompleted
ContentAPI.sendMessage(player, colorize("%RYour ring vibrates briefly as if surging with power, and then stops."))
sendMessage(player, colorize("%RYour ring vibrates briefly as if surging with power, and then stops."))
}
}

View file

@ -2,7 +2,7 @@ package rs09.game.content.jobs
import GatheringJobs
import SlayingJob
import api.ContentAPI
import api.*
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType
@ -64,7 +64,7 @@ class WorkForInteractionListener : InteractionListener() {
var jobId = 0
if(JobManager.getStoreFile().getInt(player.username.toLowerCase()) == 3){
ContentAPI.sendNPCDialogue(player, node.id,"You've hit your limit for the day. Come back tomorrow!")
sendNPCDialogue(player, node.id,"You've hit your limit for the day. Come back tomorrow!")
return@on true
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.quest.free.dragonslayer
import api.ContentAPI
import api.*
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
@ -28,7 +28,7 @@ class DSEquipListeners : InteractionListener() {
for(id in restrictedItems){
onEquip(id){ player, _ ->
if(!player.questRepository.isComplete("Dragon Slayer")){
ContentAPI.sendMessage(player, "You must have completed Dragon Slayer to equip this.")
sendMessage(player, "You must have completed Dragon Slayer to equip this.")
return@onEquip false
}
return@onEquip true

View file

@ -1,6 +1,6 @@
package rs09.game.content.quest.members.naturespirit
import api.ContentAPI
import api.*
import core.game.node.entity.npc.AbstractNPC
import core.game.world.map.Location
import core.plugin.Initializable
@ -23,7 +23,7 @@ class FillimanTarlockNPC : AbstractNPC {
override fun handleTickActions() {
super.handleTickActions()
if(spawnedTicks++ > 100) ContentAPI.poofClear(this)
if(spawnedTicks++ > 100) poofClear(this)
}
override fun getIds(): IntArray {

View file

@ -1,6 +1,6 @@
package rs09.game.content.quest.members.naturespirit
import api.ContentAPI
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
@ -48,10 +48,10 @@ class NSDrezelDialogue : DialogueFile() {
20 -> npcl(FacialExpression.NEUTRAL, "That's great! Many Thanks! Now then, please be aware of the Ghasts, you cannot attack them, only Filliman knew how to take them on.").also { stage++ }
21 -> npcl(FacialExpression.NEUTRAL, "Just run from them if you can. If you start to get lost, try to make your way back to the temple.").also { stage++ }
22 -> {
ContentAPI.sendDoubleItemDialogue(player!!, Items.MEAT_PIE_2327, Items.APPLE_PIE_2323, "The cleric hands you some food.")
sendDoubleItemDialogue(player!!, Items.MEAT_PIE_2327, Items.APPLE_PIE_2323, "The cleric hands you some food.")
if(questStage == 0){
repeat(3) { ContentAPI.addItemOrDrop(player!!, Items.MEAT_PIE_2327, 1) }
repeat(3) { ContentAPI.addItemOrDrop(player!!, Items.APPLE_PIE_2323, 1) }
repeat(3) { addItemOrDrop(player!!, Items.MEAT_PIE_2327, 1) }
repeat(3) { addItemOrDrop(player!!, Items.APPLE_PIE_2323, 1) }
player!!.questRepository.getQuest("Nature Spirit").setStage(player!!, 5)
}
stage++
@ -80,7 +80,7 @@ class NSDrezelDialogue : DialogueFile() {
4 -> {
end()
player!!.lock();
ContentAPI.submitIndividualPulse(player!!, BlessingPulse(npc!!, player!!))
submitIndividualPulse(player!!, BlessingPulse(npc!!, player!!))
}
}
}
@ -105,9 +105,9 @@ private class BlessingPulse(val drezel: NPC, val player: Player) : Pulse(){
override fun pulse(): Boolean {
when(ticks){
0 -> ContentAPI.animate(drezel, 1162).also { ContentAPI.spawnProjectile(drezel, player, 268); ContentAPI.playAudio(player, Audio(2674)) }
2 -> ContentAPI.visualize(player, Animation(645), Graphics(267, 100))
4 -> ContentAPI.unlock(player).also { player.questRepository.getQuest("Nature Spirit").setStage(player, 40); return true }
0 -> animate(drezel, 1162).also { spawnProjectile(drezel, player, 268); playAudio(player, Audio(2674)) }
2 -> visualize(player, Animation(645), Graphics(267, 100))
4 -> unlock(player).also { player.questRepository.getQuest("Nature Spirit").setStage(player, 40); return true }
}
ticks++
return false
@ -115,6 +115,6 @@ private class BlessingPulse(val drezel: NPC, val player: Player) : Pulse(){
override fun stop() {
super.stop()
ContentAPI.openDialogue(player, NSDrezelDialogue(), drezel)
openDialogue(player, NSDrezelDialogue(), drezel)
}
}

View file

@ -1,8 +1,7 @@
package rs09.game.content.quest.members.naturespirit
import api.Container
import api.ContentAPI
import api.DialUtils
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
@ -46,15 +45,15 @@ class NSListeners : InteractionListener() {
override fun defineListeners() {
on(GROTTO_TREE, SCENERY, "look-at"){player, _ ->
ContentAPI.sendMessage(player, "It looks like a tree on a large rock with roots trailing down to the ground.")
sendMessage(player, "It looks like a tree on a large rock with roots trailing down to the ground.")
return@on true
}
on(GROTTO_TREE, SCENERY, "search"){player, _ ->
if(!ContentAPI.getAttribute(player, GROTTO_SEARCHED, false) || !(ContentAPI.inInventory(player, JOURNAL) || ContentAPI.inBank(player, JOURNAL))){
ContentAPI.sendItemDialogue(player, JOURNAL, "You search the strange rock. You find a knot and inside of it you discover a small tome. The words on the front are a bit vague, but you can make out the words 'Tarlock' and 'journal'.")
ContentAPI.addItemOrDrop(player, JOURNAL, 1)
ContentAPI.setAttribute(player, GROTTO_SEARCHED, true)
if(!getAttribute(player, GROTTO_SEARCHED, false) || !(inInventory(player, JOURNAL) || inBank(player, JOURNAL))){
sendItemDialogue(player, JOURNAL, "You search the strange rock. You find a knot and inside of it you discover a small tome. The words on the front are a bit vague, but you can make out the words 'Tarlock' and 'journal'.")
addItemOrDrop(player, JOURNAL, 1)
setAttribute(player, GROTTO_SEARCHED, true)
return@on true
}
return@on false
@ -76,7 +75,7 @@ class NSListeners : InteractionListener() {
on(GROTTO_ALTAR, SCENERY,"search"){player, node ->
val stage = player.questRepository.getStage("Nature Spirit")
if(stage == 55){
ContentAPI.openDialogue(player, FillimanCompletionDialogue(), NPC(NPCs.FILLIMAN_TARLOCK_1050))
openDialogue(player, FillimanCompletionDialogue(), NPC(NPCs.FILLIMAN_TARLOCK_1050))
return@on true
}
@ -84,17 +83,17 @@ class NSListeners : InteractionListener() {
}
on(NATURE_STONE, SCENERY, "search"){player, _ ->
ContentAPI.sendDialogue(player, "You search the stone and find that it has some sort of nature symbol scratched into it.")
sendDialogue(player, "You search the stone and find that it has some sort of nature symbol scratched into it.")
return@on true
}
on(FAITH_STONE, SCENERY, "search"){player, _ ->
ContentAPI.sendDialogue(player, "You search the stone and find that it has some sort of faith symbol scratched into it.")
sendDialogue(player, "You search the stone and find that it has some sort of faith symbol scratched into it.")
return@on true
}
on(FREELY_GIVEN_STONE, SCENERY, "search"){player, _ ->
ContentAPI.sendDialogue(player, "You search the stone and find it has some sort of spirit symbol scratched into it.")
sendDialogue(player, "You search the stone and find it has some sort of spirit symbol scratched into it.")
return@on true
}
@ -102,7 +101,7 @@ class NSListeners : InteractionListener() {
if(player.questRepository.isComplete("Nature Spirit") && player.questRepository.isComplete("Wolf Whistle"))
ShopParser.openUid(player, 241)
else
ContentAPI.sendDialogue(player, "You can't do that yet.")
sendDialogue(player, "You can't do that yet.")
return@on true
}
@ -120,19 +119,19 @@ class NSListeners : InteractionListener() {
}
on(MIRROR, GROUNDITEM, "take"){player, node ->
if(ContentAPI.getAttribute(player, MIRROR_TAKEN, false) && (ContentAPI.inInventory(player, MIRROR) || ContentAPI.inBank(player, MIRROR))){
ContentAPI.sendDialogue(player, "I don't need another one of these.")
if(getAttribute(player, MIRROR_TAKEN, false) && (inInventory(player, MIRROR) || inBank(player, MIRROR))){
sendDialogue(player, "I don't need another one of these.")
return@on true
}
ContentAPI.setAttribute(player, MIRROR_TAKEN, true)
setAttribute(player, MIRROR_TAKEN, true)
PickupHandler.take(player, node as GroundItem)
return@on true
}
on(SPELLCARD, ITEM, "cast"){player, node ->
if(NSUtils.castBloom(player)){
ContentAPI.removeItem(player, node.asItem(), Container.INVENTORY)
ContentAPI.addItem(player, Items.A_USED_SPELL_2969)
removeItem(player, node.asItem(), Container.INVENTORY)
addItem(player, Items.A_USED_SPELL_2969)
}
return@on true
}
@ -140,26 +139,26 @@ class NSListeners : InteractionListener() {
on(intArrayOf(DRUID_POUCH, DRUID_POUCH_EMPTY), ITEM, "fill"){player, node ->
if(player.questRepository.getStage("Nature Spirit") >= 75) {
if (ContentAPI.amountInInventory(player, Items.MORT_MYRE_FUNGUS_2970) >= 3) {
if (amountInInventory(player, Items.MORT_MYRE_FUNGUS_2970) >= 3) {
if (node.id != Items.DRUID_POUCH_2958) {
ContentAPI.removeItem(player, node, Container.INVENTORY)
removeItem(player, node, Container.INVENTORY)
}
ContentAPI.removeItem(player, Item(Items.MORT_MYRE_FUNGUS_2970, 3), Container.INVENTORY)
ContentAPI.addItem(player, Items.DRUID_POUCH_2958, 3)
removeItem(player, Item(Items.MORT_MYRE_FUNGUS_2970, 3), Container.INVENTORY)
addItem(player, Items.DRUID_POUCH_2958, 3)
} else {
ContentAPI.sendDialogue(player, "You need 3 fungus before you can do that.")
sendDialogue(player, "You need 3 fungus before you can do that.")
}
} else {
ContentAPI.sendDialogue(player, "I don't know how to use that yet.")
sendDialogue(player, "I don't know how to use that yet.")
}
return@on true
}
onUseWith(SCENERY, Items.SILVER_SICKLE_2961, NATURE_ALTAR){player, used, with ->
ContentAPI.sendItemDialogue(player, Items.SILVER_SICKLEB_2963, "You dump the sickle into the waters.")
if(ContentAPI.removeItem(player, Items.SILVER_SICKLE_2961, Container.INVENTORY)){
ContentAPI.addItem(player, Items.SILVER_SICKLEB_2963, 1)
sendItemDialogue(player, Items.SILVER_SICKLEB_2963, "You dump the sickle into the waters.")
if(removeItem(player, Items.SILVER_SICKLE_2961, Container.INVENTORY)){
addItem(player, Items.SILVER_SICKLEB_2963, 1)
}
return@onUseWith true
}
@ -172,22 +171,22 @@ class NSListeners : InteractionListener() {
when (used.id) {
USED_SPELLCARD -> {
if (with.id == FREELY_GIVEN_STONE) {
if(ContentAPI.removeItem(player, used, Container.INVENTORY)){
ContentAPI.sendNPCDialogue(player, NPCs.FILLIMAN_TARLOCK_1050, "Aha, yes, that seems right well done!")
ContentAPI.sendMessage(player, "The stone seems to absorb the used spell scroll.")
if(removeItem(player, used, Container.INVENTORY)){
sendNPCDialogue(player, NPCs.FILLIMAN_TARLOCK_1050, "Aha, yes, that seems right well done!")
sendMessage(player, "The stone seems to absorb the used spell scroll.")
NSUtils.flagCardPlaced(player)
}
} else ContentAPI.sendMessage(player, "You try to put the item on the stone, but it just moves off.")
} else sendMessage(player, "You try to put the item on the stone, but it just moves off.")
}
FUNGUS -> {
if (with.id == NATURE_STONE) {
if(ContentAPI.removeItem(player, used, Container.INVENTORY)){
ContentAPI.sendNPCDialogue(player, NPCs.FILLIMAN_TARLOCK_1050, "Aha, yes, that seems right well done!")
ContentAPI.sendMessage(player, "The stone seems to absorb the used fungus.")
if(removeItem(player, used, Container.INVENTORY)){
sendNPCDialogue(player, NPCs.FILLIMAN_TARLOCK_1050, "Aha, yes, that seems right well done!")
sendMessage(player, "The stone seems to absorb the used fungus.")
NSUtils.flagFungusPlaced(player)
}
} else ContentAPI.sendMessage(player, "You try to put the item on the stone, but it just moves off.")
} else sendMessage(player, "You try to put the item on the stone, but it just moves off.")
}
}
return@onUseWith true
@ -198,8 +197,8 @@ class NSListeners : InteractionListener() {
class NSJournalDialogue : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when(stage){
0 -> dialogue(*DialUtils.splitLines("Most of the writing is pretty uninteresting, but something inside refers to a nature spirit. The requirements for which are,")).also { stage++ }
1 -> dialogue(*DialUtils.splitLines("'Something from nature', 'something with faith' and 'something of the spirit-to-become freely given'. It's all pretty vague.")).also { stage = END_DIALOGUE }
0 -> dialogue(*splitLines("Most of the writing is pretty uninteresting, but something inside refers to a nature spirit. The requirements for which are,")).also { stage++ }
1 -> dialogue(*splitLines("'Something from nature', 'something with faith' and 'something of the spirit-to-become freely given'. It's all pretty vague.")).also { stage = END_DIALOGUE }
}
}
}
@ -211,8 +210,8 @@ class FillimanCompletionDialogue : DialogueFile() {
1 -> npcl(FacialExpression.NEUTRAL, "I must complete the transformation now. Just stand there and watch the show, apparently it's quite good!").also { stage++ }
2 -> {
end()
ContentAPI.lock(player!!, 10)
ContentAPI.submitWorldPulse(CompleteSpellPulse(player!!))
lock(player!!, 10)
submitWorldPulse(CompleteSpellPulse(player!!))
}
}
}
@ -224,10 +223,10 @@ class CompleteSpellPulse(val player: Player) : Pulse(2){
val dest = Location.create(3441, 9738, 0)
override fun pulse(): Boolean {
when(counter++){
0 -> repeat(6) { ContentAPI.spawnProjectile(locations[it], dest, 268, 0, 1000, 0, 40, 20) }
0 -> repeat(6) { spawnProjectile(locations[it], dest, 268, 0, 1000, 0, 40, 20) }
1 -> player.questRepository.getQuest("Nature Spirit").setStage(player, 60)
2 -> player.teleport(player.location.transform(0,0,1))
3 -> ContentAPI.openDialogue(player, NPCs.NATURE_SPIRIT_1051, ContentAPI.findLocalNPC(player, NPCs.NATURE_SPIRIT_1051) as NPC).also { ContentAPI.unlock(player); return true }
3 -> openDialogue(player, NPCs.NATURE_SPIRIT_1051, findLocalNPC(player, NPCs.NATURE_SPIRIT_1051) as NPC).also { unlock(player); return true }
}
return false
}

View file

@ -1,8 +1,7 @@
package rs09.game.content.quest.members.naturespirit
import api.Container
import api.ContentAPI
import api.DialUtils
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
@ -29,7 +28,7 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
val quest = player.questRepository.getQuest("Nature Spirit")
questStage = quest.getStage(player)
if(questStage > 10 && !ContentAPI.inEquipment(player, Items.GHOSTSPEAK_AMULET_552)){
if(questStage > 10 && !inEquipment(player, Items.GHOSTSPEAK_AMULET_552)){
npcl(FacialExpression.HALF_GUILTY, "OooOOOOOOoooOoOOoOOOo")
setQuest(15)
return false
@ -42,7 +41,7 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
30 -> npcl(FacialExpression.HALF_GUILTY, "Thanks for the journal, I've been reading it. It looks like I came to a violent and bitter end but that's not really important. I just have to figure out what I am going to do now?").also { stage = 14 }
35 -> npcl(FacialExpression.NEUTRAL, "Hello there, have you been blessed yet?").also { stage = 60 }
45 -> {
if(ContentAPI.inInventory(player, Items.MORT_MYRE_FUNGUS_2970)){
if(inInventory(player, Items.MORT_MYRE_FUNGUS_2970)){
npcl(FacialExpression.NEUTRAL, "Did you manage to get something from nature?").also { stage = 80 }
} else {
playerl(
@ -59,7 +58,7 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> if(ContentAPI.inInventory(player, Items.MIRROR_2966)){
0 -> if(inInventory(player, Items.MIRROR_2966)){
sendDialogue("You use the mirror on the spirit","of the dead Filliman Tarlock.").also { stage++ }
} else {
playerl(FacialExpression.NEUTRAL, "Yes, I do think you're dead and I'll prove it somehow.").also { stage = 1002 }
@ -71,9 +70,9 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
4 -> playerl(FacialExpression.NEUTRAL, "That's because you're dead! Dead as a door nail... Deader in fact... You bear a remarkable resemblance to wormbait! Err... No offence...").also { stage++ }
5 -> npcl(FacialExpression.HALF_GUILTY, "I think you might be right my friend, though I still feel very much alive. It is strange how I still come to be here and yet I've not turned into a Ghast.").also { stage++ }
6 -> npcl(FacialExpression.HALF_GUILTY, " It must be a sign... Yes a sign... I must try to find out what it means. Now, where did I put my journal?").also { stage++ }
7 -> if(!ContentAPI.inInventory(player, Items.JOURNAL_2967)){
7 -> if(!inInventory(player, Items.JOURNAL_2967)){
playerl(FacialExpression.NEUTRAL, "Where did you put it?").also { stage++; setQuest(25) }
} else sendDialogue("You give the journal to Filliman Tarlock").also { ContentAPI.removeItem(player, Items.JOURNAL_2967, Container.INVENTORY); stage = 10; setQuest(30) }
} else sendDialogue("You give the journal to Filliman Tarlock").also { removeItem(player, Items.JOURNAL_2967, Container.INVENTORY); stage = 10; setQuest(30) }
//no journal
8 -> npcl(FacialExpression.HALF_GUILTY, "Well, if I knew that, I wouldn't still be looking for it. However, I do remember something about a knot? Perhaps I was meant to tie a knot or something?").also { stage = END_DIALOGUE }
@ -107,7 +106,7 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
52 -> npcl(FacialExpression.HALF_GUILTY, "Well, the book says, that I need, and I quote:- 'Something with faith', 'something from nature' and the 'spirit-to-become' freely given'. Hmm, I know how to get something from nature.").also { stage++ }
53 -> playerl(FacialExpression.NEUTRAL, "Well, that does seem a bit vague.").also { stage++ }
54 -> npcl(FacialExpression.HALF_GUILTY, "Hmm, it does and I could understand if you didn't want to help. However, if you could perhaps at least get the item from nature, that would be a start. Perhaps we can figure out the rest as we go along.").also { stage++ }
55 -> sendDialogue(*DialUtils.splitLines("The druid produces a small sheet of papyrus with some writing on it.")).also { ContentAPI.addItemOrDrop(player, Items.DRUIDIC_SPELL_2968); setQuest(35); stage++ }
55 -> sendDialogue(*splitLines("The druid produces a small sheet of papyrus with some writing on it.")).also { addItemOrDrop(player, Items.DRUIDIC_SPELL_2968); setQuest(35); stage++ }
56 -> npcl(FacialExpression.NEUTRAL, "This spell needs to be cast in the swamp after you have been blessed. I'm afraid you'll need to go to the temple to the North and ask a member of the clergy to bless you.").also { stage++ }
57 -> playerl(FacialExpression.NEUTRAL, "Blessed, what does that do?").also { stage++ }
58 -> npcl(FacialExpression.NEUTRAL, "It is required if you're to cast this druid spell. Once you've cast the spell, you should find something from nature. Bring it back to me and then we'll try to figure out the other things we need.").also { stage = END_DIALOGUE }
@ -115,20 +114,20 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
//have you been blessed yet
60 -> playerl(FacialExpression.NEUTRAL, "No, not yet.").also { stage++ }
61 -> npcl(FacialExpression.NEUTRAL, "Well, hurry up!").also { stage++ }
62 -> if(ContentAPI.inInventory(player, Items.DRUIDIC_SPELL_2968) || ContentAPI.inBank(player, Items.DRUIDIC_SPELL_2968)) end()
62 -> if(inInventory(player, Items.DRUIDIC_SPELL_2968) || inBank(player, Items.DRUIDIC_SPELL_2968)) end()
else playerl(FacialExpression.NEUTRAL, "Could I have another bloom scroll please?").also { stage++ }
63 -> npcl(FacialExpression.NEUTRAL, "Sure, but please look after this one.").also { stage++ }
64 -> sendDialogue("The spirit of Filliman Tarlock gives you another bloom spell.").also { ContentAPI.addItemOrDrop(player, Items.DRUIDIC_SPELL_2968); stage = END_DIALOGUE }
64 -> sendDialogue("The spirit of Filliman Tarlock gives you another bloom spell.").also { addItemOrDrop(player, Items.DRUIDIC_SPELL_2968); stage = END_DIALOGUE }
//I've been blessed
70 -> npcl(FacialExpression.NEUTRAL, "Well, you need to bring 'something from nature', 'something with faith' and 'something of the spirit-to- become freely given.'").also { stage++ }
71 -> playerl(FacialExpression.NEUTRAL, "Yeah, but what does that mean?").also { stage++ }
72 -> npcl(FacialExpression.NEUTRAL, "Hmm, it is a conundrum, however, if you use that spell I gave you, you should be able to get from nature. Once you have that, we may be puzzle the rest out.").also { stage++ }
73 -> if(!ContentAPI.inInventory(player, Items.DRUIDIC_SPELL_2968) && !ContentAPI.inBank(player, Items.DRUIDIC_SPELL_2968)){
73 -> if(!inInventory(player, Items.DRUIDIC_SPELL_2968) && !inBank(player, Items.DRUIDIC_SPELL_2968)){
playerl(FacialExpression.NEUTRAL, "Could I have another bloom scroll please?").also { stage++ }
} else end()
74 -> npcl(FacialExpression.NEUTRAL, "Sure, but please look after this one.").also { stage++ }
75 -> sendDialogue("The spirit of Filliman Tarlock gives you","another bloom spell.").also { ContentAPI.addItem(player, Items.DRUIDIC_SPELL_2968); stage = END_DIALOGUE }
75 -> sendDialogue("The spirit of Filliman Tarlock gives you","another bloom spell.").also { addItem(player, Items.DRUIDIC_SPELL_2968); stage = END_DIALOGUE }
//has fungus
80 -> sendDialogue("You show the fungus to Filliman.").also { stage++ }
@ -161,22 +160,22 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
120 -> npcl(FacialExpression.NEUTRAL, "Oh really.. Have you placed all the items on the stones? Ok, well, let's try!").also { stage++ }
121 -> sendDialogue("~ The druid attempts to cast a spell. ~").also { stage++ }
122 -> {
ContentAPI.animate(npc, 812)
animate(npc, 812)
if(NSUtils.hasPlacedCard(player) && NSUtils.hasPlacedFungus(player) && NSUtils.onStone(player)){
end()
player.lock()
val locations = arrayOf(Location.create(3439, 3336, 0), Location.create(3441, 3336, 0), Location.create(3440, 3335, 0))
repeat(3) {i -> ContentAPI.spawnProjectile(locations[i], Location.create(3440, 3336, 0), 268, 0, 35, 0, 100, 20) }
ContentAPI.submitIndividualPulse(player, object : Pulse(4){
repeat(3) {i -> spawnProjectile(locations[i], Location.create(3440, 3336, 0), 268, 0, 35, 0, 100, 20) }
submitIndividualPulse(player, object : Pulse(4){
override fun pulse(): Boolean {
ContentAPI.sendNPCDialogue(player, npc.originalId, "Aha, everything seems to be in place! You can come through now into the grotto for the final section of my transformation.")
sendNPCDialogue(player, npc.originalId, "Aha, everything seems to be in place! You can come through now into the grotto for the final section of my transformation.")
setQuest(55)
ContentAPI.unlock(player)
unlock(player)
return true
}
override fun stop() {
ContentAPI.visualize(npc, -1, Graphics(266, 80))
visualize(npc, -1, Graphics(266, 80))
super.stop()
}
})
@ -187,17 +186,17 @@ class NSTarlockDialogue(player: Player? = null) : DialoguePlugin(player) {
stage = END_DIALOGUE
}
130 -> if(ContentAPI.inInventory(player, Items.DRUIDIC_SPELL_2968) || ContentAPI.inBank(player, Items.DRUIDIC_SPELL_2968)){
130 -> if(inInventory(player, Items.DRUIDIC_SPELL_2968) || inBank(player, Items.DRUIDIC_SPELL_2968)){
npcl(FacialExpression.NEUTRAL, "No, you've already got one!").also { stage = END_DIALOGUE }
} else {
npcl(FacialExpression.NEUTRAL, "Sure, but look after this one.")
ContentAPI.addItem(player, Items.DRUIDIC_SPELL_2968)
addItem(player, Items.DRUIDIC_SPELL_2968)
stage = END_DIALOGUE
}
//Initial dialogue
1000 -> playerl(FacialExpression.HALF_ASKING, "Hello?").also { stage++ }
1001 -> if(ContentAPI.inEquipment(player, Items.GHOSTSPEAK_AMULET_552)){
1001 -> if(inEquipment(player, Items.GHOSTSPEAK_AMULET_552)){
npcl(FacialExpression.EXTREMELY_SHOCKED, "Oh, I understand you! At last, someone who doesn't just mumble. I understand what you're saying!").also { stage++ }
} else npcl(FacialExpression.HALF_GUILTY, "OooOOoOOoOOOOo.")

View file

@ -1,7 +1,7 @@
package rs09.game.content.quest.members.naturespirit
import api.Container
import api.ContentAPI
import api.*
import core.game.node.Node
import core.game.node.scenery.Scenery
import core.game.node.scenery.SceneryBuilder
@ -19,19 +19,19 @@ import rs09.game.node.entity.npc.other.MortMyreGhastNPC
object NSUtils {
fun flagFungusPlaced(player: Player) {
ContentAPI.setAttribute(player, "/save:ns:fungus_placed", true)
setAttribute(player, "/save:ns:fungus_placed", true)
}
fun flagCardPlaced(player: Player){
ContentAPI.setAttribute(player, "/save:ns:card_placed", true)
setAttribute(player, "/save:ns:card_placed", true)
}
fun hasPlacedFungus(player: Player): Boolean {
return ContentAPI.getAttribute(player, "ns:fungus_placed", false)
return getAttribute(player, "ns:fungus_placed", false)
}
fun hasPlacedCard(player: Player): Boolean {
return ContentAPI.getAttribute(player, "ns:card_placed", false)
return getAttribute(player, "ns:card_placed", false)
}
fun onStone(player: Player): Boolean {
@ -39,11 +39,11 @@ object NSUtils {
}
fun getGhastKC(player: Player): Int {
return ContentAPI.getAttribute(player,"ns:ghasts_killed", 0) as Int
return getAttribute(player,"ns:ghasts_killed", 0) as Int
}
fun incrementGhastKC(player: Player){
ContentAPI.setAttribute(player, "/save:ns:ghasts_killed", getGhastKC(player) + 1)
setAttribute(player, "/save:ns:ghasts_killed", getGhastKC(player) + 1)
val msg = when(getGhastKC(player)) {
1 -> "That's one down, two more to go."
2 -> "Two down, only one more to go."
@ -52,25 +52,25 @@ object NSUtils {
}
if(!msg.isEmpty()){
ContentAPI.sendMessage(player, msg)
sendMessage(player, msg)
}
}
fun activatePouch(player: Player, attacker: MortMyreGhastNPC): Boolean {
var shouldAddEmptyPouch = false
val pouchAmt = ContentAPI.amountInInventory(player, Items.DRUID_POUCH_2958)
val pouchAmt = amountInInventory(player, Items.DRUID_POUCH_2958)
if(pouchAmt == 1) shouldAddEmptyPouch = true
if(pouchAmt > 0 && ContentAPI.removeItem(player, Items.DRUID_POUCH_2958, Container.INVENTORY)){
if(pouchAmt > 0 && removeItem(player, Items.DRUID_POUCH_2958, Container.INVENTORY)){
if(shouldAddEmptyPouch){
ContentAPI.addItem(player, Items.DRUID_POUCH_2957)
addItem(player, Items.DRUID_POUCH_2957)
}
ContentAPI.spawnProjectile(player, attacker, 268)
ContentAPI.submitWorldPulse(object : Pulse(){
spawnProjectile(player, attacker, 268)
submitWorldPulse(object : Pulse(){
var ticks = 0
override fun pulse(): Boolean {
when(ticks++){
2 -> ContentAPI.visualize(attacker, -1, Graphics(269, 125))
3 -> attacker.transform(attacker.id + 1).also { attacker.attack(player); attacker.setAttribute("woke", ContentAPI.getWorldTicks()); return true }
2 -> visualize(attacker, -1, Graphics(269, 125))
3 -> attacker.transform(attacker.id + 1).also { attacker.attack(player); attacker.setAttribute("woke", getWorldTicks()); return true }
}
return false
}

View file

@ -1,7 +1,7 @@
package rs09.game.content.quest.members.naturespirit
import api.Container
import api.ContentAPI
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
@ -57,7 +57,7 @@ class NatureSpiritDialogue(player: Player? = null) : DialoguePlugin(player){
30 -> npcl(FacialExpression.NEUTRAL, "My blessings will entice nature to bloom in Mort Myre! And then with nature's harvest you can fill a druids pouch and release the Ghasts from their torment.").also { stage = 2 } //this dude kinda weird
//have you brought me a sickle yet bro
100 -> if(ContentAPI.inInventory(player, Items.SILVER_SICKLE_2961)){
100 -> if(inInventory(player, Items.SILVER_SICKLE_2961)){
playerl(FacialExpression.FRIENDLY, "Yes, here it is. What are you going to do with it?").also { stage = 110 }
} else {
playerl(FacialExpression.NEUTRAL, "No sorry, not yet!").also { stage++ }
@ -76,11 +76,11 @@ class NatureSpiritDialogue(player: Player? = null) : DialoguePlugin(player){
/**
* Here we go uoooh
*/
112 -> end().also { ContentAPI.lock(player, 10); ContentAPI.submitWorldPulse(SickleBlessPulse(player, npc)) }
112 -> end().also { lock(player, 10); submitWorldPulse(SickleBlessPulse(player, npc)) }
//go kill some ghasts bro
200 -> npcl(FacialExpression.NEUTRAL, "Go forth into Mort Myre and slay three Ghasts. You'll be releasing their souls from Mort Myre.").also { stage++ }
201 -> ContentAPI.sendItemDialogue(player, Items.DRUID_POUCH_2957, "The nature spirit gives you an empty pouch.").also { stage++; setQuest(75) }
201 -> sendItemDialogue(player, Items.DRUID_POUCH_2957, "The nature spirit gives you an empty pouch.").also { stage++; setQuest(75) }
202 -> npcl(FacialExpression.NEUTRAL, "You'll need this in order to collect together nature's bounty. It will bind the Ghast to you until you flee or it is defeated.").also { stage = END_DIALOGUE }
//Have you killed the ghasts yet bro
@ -135,21 +135,21 @@ class NatureSpiritDialogue(player: Player? = null) : DialoguePlugin(player){
override fun pulse(): Boolean {
when(ticks++){
0 -> ContentAPI.animate(spirit, 812)
0 -> animate(spirit, 812)
1 -> repeat(4) {
val loc = locs.random()
locs.remove(loc)
ContentAPI.spawnProjectile(loc, player.location, 268, 0, 400, 0, 125, 180)
ContentAPI.animate(player, 9021)
spawnProjectile(loc, player.location, 268, 0, 400, 0, 125, 180)
animate(player, 9021)
}
4 -> {
if(ContentAPI.removeItem(player, Items.SILVER_SICKLE_2961, Container.INVENTORY)){
ContentAPI.addItem(player, Items.SILVER_SICKLEB_2963)
ContentAPI.unlock(player)
if(removeItem(player, Items.SILVER_SICKLE_2961, Container.INVENTORY)){
addItem(player, Items.SILVER_SICKLEB_2963)
unlock(player)
player.questRepository.getQuest("Nature Spirit").setStage(player, 70)
ContentAPI.openDialogue(player, NPCs.NATURE_SPIRIT_1051, ContentAPI.findLocalNPC(player, NPCs.NATURE_SPIRIT_1051) as NPC)
ContentAPI.sendMessage(player, "Your sickle has been blessed! You can bless a new sickle by dipping it into the grotto waters.")
openDialogue(player, NPCs.NATURE_SPIRIT_1051, findLocalNPC(player, NPCs.NATURE_SPIRIT_1051) as NPC)
sendMessage(player, "Your sickle has been blessed! You can bless a new sickle by dipping it into the grotto waters.")
}
}
6 -> return true

View file

@ -1,6 +1,6 @@
package rs09.game.content.quest.members.naturespirit
import api.ContentAPI
import api.*
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.quest.Quest
import core.game.node.entity.skill.Skills
@ -114,9 +114,9 @@ class NatureSpiritQuest : Quest("Nature Spirit", 95, 94, 2, 307, 0, 1, 110 ) {
drawReward(player, "3,000 Crafting XP",ln++)
drawReward(player, "2,000 Hitpoints XP", ln++)
drawReward(player, "2,000 Defence XP", ln++)
ContentAPI.rewardXP(player, Skills.CRAFTING, 3000.0)
ContentAPI.rewardXP(player, Skills.HITPOINTS, 2000.0)
ContentAPI.rewardXP(player, Skills.DEFENCE, 2000.0)
rewardXP(player, Skills.CRAFTING, 3000.0)
rewardXP(player, Skills.HITPOINTS, 2000.0)
rewardXP(player, Skills.DEFENCE, 2000.0)
NSUtils.cleanupAttributes(player)
}
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.zone;
import api.ContentAPI
import api.*
import core.cache.def.impl.SceneryDefinition
import core.game.content.global.action.DoorActionHandler
import core.game.interaction.OptionHandler
@ -28,7 +28,7 @@ class AlKharidStairsPlugin : OptionHandler() {
node ?: return false
option ?: return false
if(node.location == zekeDoorOpened.location || node.location == craftingDoorOpened.location){
ContentAPI.sendMessage(player,"This door appears to be stuck open.")
sendMessage(player,"This door appears to be stuck open.")
} else{
DoorActionHandler.handleDoor(player,node.asScenery())
}

View file

@ -1,6 +1,6 @@
package rs09.game.content.zone
import api.ContentAPI
import api.*
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
@ -26,7 +26,7 @@ class FarmingPatchZone : MapZone("farming patch", true), Plugin<Any> {
registerRegion(12083)
registerRegion(10548)
register(ZoneBorders(3594,3521,3608,3532))
ContentAPI.submitWorldPulse(zonePulse)
submitWorldPulse(zonePulse)
}
override fun newInstance(arg: Any?): Plugin<Any> {
@ -39,7 +39,7 @@ class FarmingPatchZone : MapZone("farming patch", true), Plugin<Any> {
}
override fun enter(e: Entity?): Boolean {
if(e is Player && playersInZone[e] == null && ContentAPI.getStatLevel(e, Skills.FARMING) <= 15) {
if(e is Player && playersInZone[e] == null && getStatLevel(e, Skills.FARMING) <= 15) {
playersInZone[e] = 0
}
return super.enter(e)
@ -61,14 +61,14 @@ class FarmingPatchZone : MapZone("farming patch", true), Plugin<Any> {
npc.init()
npc.moveStep()
npc.face(player)
ContentAPI.openDialogue(player, SpiritDialogue(true), npc)
openDialogue(player, SpiritDialogue(true), npc)
} else if (ticks == secondsToTicks(TimeUnit.MINUTES.toSeconds(10).toInt())){
val npc = NPC(NPCs.GITHAN_7122)
npc.location = player.location
npc.init()
npc.moveStep()
npc.face(player)
ContentAPI.openDialogue(player, SpiritDialogue(false), npc)
openDialogue(player, SpiritDialogue(false), npc)
playersInZone.remove(player)
}
@ -91,7 +91,7 @@ class FarmingPatchZone : MapZone("farming patch", true), Plugin<Any> {
override fun end(){
super.end()
ContentAPI.poofClear(npc ?: return)
poofClear(npc ?: return)
}
}

View file

@ -1,7 +1,7 @@
package rs09.game.content.zone.phasmatys.bonegrinder
import api.Container
import api.ContentAPI
import api.*
import core.game.content.global.Bones
import core.game.node.entity.player.Player
import core.game.node.item.Item
@ -71,15 +71,15 @@ class BoneGrinderListener : InteractionListener() {
fun handleFill(player: Player): Boolean{
val bone = getBone(player)
if(bone == null){
ContentAPI.sendMessage(player,"You have no bones to grind.")
sendMessage(player,"You have no bones to grind.")
return true
}
if(ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false)){
ContentAPI.sendMessage(player,"You already have some bones in the hopper.")
if(getAttribute(player,BONE_HOPPER_KEY,false)){
sendMessage(player,"You already have some bones in the hopper.")
return true
}
if(ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
ContentAPI.sendMessage(player,"You already have some bonemeal that needs to be collected.")
if(getAttribute(player,BONE_BIN_KEY,false)){
sendMessage(player,"You already have some bonemeal that needs to be collected.")
return true
}
@ -88,14 +88,14 @@ class BoneGrinderListener : InteractionListener() {
override fun pulse(): Boolean {
when(stage++){
0 -> {
ContentAPI.lock(player, FILL_ANIM.duration)
ContentAPI.animate(player,FILL_ANIM)
lock(player, FILL_ANIM.duration)
animate(player,FILL_ANIM)
}
FILL_ANIM.duration -> {
ContentAPI.sendMessage(player,"You fill the hopper with bones.")
ContentAPI.removeItem(player,Item(bone.itemId),Container.INVENTORY)
ContentAPI.setAttribute(player,LOADED_BONE_KEY,bone.ordinal)
ContentAPI.setAttribute(player,BONE_HOPPER_KEY,true)
sendMessage(player,"You fill the hopper with bones.")
removeItem(player,Item(bone.itemId),Container.INVENTORY)
setAttribute(player,LOADED_BONE_KEY,bone.ordinal)
setAttribute(player,BONE_HOPPER_KEY,true)
return true
}
}
@ -103,15 +103,15 @@ class BoneGrinderListener : InteractionListener() {
}
}
if(ContentAPI.inInventory(player,bone.itemId)){
if(inInventory(player,bone.itemId)){
player.pulseManager.run(object : Pulse(){
var stage = 0
override fun pulse(): Boolean {
when(stage++){
0 -> Pulser.submit(fillPulse).also { delay = FILL_ANIM.duration + 1}
1 -> {
ContentAPI.stopWalk(player)
ContentAPI.forceWalk(player,Location(3659,3524),"smart")
stopWalk(player)
forceWalk(player,Location(3659,3524),"smart")
delay = 2
}
2 -> {
@ -119,12 +119,12 @@ class BoneGrinderListener : InteractionListener() {
delay = WIND_ANIM.duration + 1
}
3 -> {
ContentAPI.stopWalk(player)
ContentAPI.forceWalk(player,Location(3658,3524),"smart")
stopWalk(player)
forceWalk(player,Location(3658,3524),"smart")
delay = 2
}
4 -> {
if(!ContentAPI.inInventory(player,Items.EMPTY_POT_1931,1)){
if(!inInventory(player,Items.EMPTY_POT_1931,1)){
return handleEmpty(player)
} else {
handleEmpty(player)
@ -132,12 +132,12 @@ class BoneGrinderListener : InteractionListener() {
}
}
5 -> {
ContentAPI.stopWalk(player)
ContentAPI.forceWalk(player,Location(3660,3524),"smart")
stopWalk(player)
forceWalk(player,Location(3660,3524),"smart")
delay = 4
}
6 -> {
ContentAPI.face(player,Location(3660,3526))
face(player,Location(3660,3526))
handleFill(player)
return true
}
@ -152,13 +152,13 @@ class BoneGrinderListener : InteractionListener() {
}
fun handleWind(player: Player): Boolean{
if(!ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false)){
ContentAPI.sendMessage(player,"You have no bones loaded to grind.")
if(!getAttribute(player,BONE_HOPPER_KEY,false)){
sendMessage(player,"You have no bones loaded to grind.")
return true
}
if(ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
ContentAPI.sendMessage(player,"You already have some bonemeal which you need to collect.")
if(getAttribute(player,BONE_BIN_KEY,false)){
sendMessage(player,"You already have some bonemeal which you need to collect.")
return true
}
@ -167,15 +167,15 @@ class BoneGrinderListener : InteractionListener() {
override fun pulse(): Boolean {
when(stage++){
0 -> {
ContentAPI.face(player,Location(3659, 3526, 1))
ContentAPI.lock(player,WIND_ANIM.duration)
ContentAPI.animate(player,WIND_ANIM)
ContentAPI.sendMessage(player,"You wind the handle.")
face(player,Location(3659, 3526, 1))
lock(player,WIND_ANIM.duration)
animate(player,WIND_ANIM)
sendMessage(player,"You wind the handle.")
}
WIND_ANIM.duration -> {
ContentAPI.sendMessage(player,"The bonemeal falls into the bin.")
ContentAPI.setAttribute(player,BONE_HOPPER_KEY,false)
ContentAPI.setAttribute(player,BONE_BIN_KEY,true)
sendMessage(player,"The bonemeal falls into the bin.")
setAttribute(player,BONE_HOPPER_KEY,false)
setAttribute(player,BONE_BIN_KEY,true)
return true
}
}
@ -186,36 +186,36 @@ class BoneGrinderListener : InteractionListener() {
}
private fun handleStatus(player: Player): Boolean{
val bonesLoaded = ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false)
val boneMealReady = ContentAPI.getAttribute(player,BONE_BIN_KEY,false)
val bonesLoaded = getAttribute(player,BONE_HOPPER_KEY,false)
val boneMealReady = getAttribute(player,BONE_BIN_KEY,false)
if(bonesLoaded) ContentAPI.sendMessage(player,"There are bones waiting in the hopper.")
if(boneMealReady) ContentAPI.sendMessage(player,"There is bonemeal waiting in the bin to be collected.")
if(bonesLoaded) sendMessage(player,"There are bones waiting in the hopper.")
if(boneMealReady) sendMessage(player,"There is bonemeal waiting in the bin to be collected.")
if(!bonesLoaded && !boneMealReady){
ContentAPI.sendMessage(player,"There is nothing loaded into the machine.")
sendMessage(player,"There is nothing loaded into the machine.")
}
return true
}
fun handleEmpty(player: Player): Boolean{
if(!ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
ContentAPI.sendMessage(player,"You have no bonemeal to collect.")
if(!getAttribute(player,BONE_BIN_KEY,false)){
sendMessage(player,"You have no bonemeal to collect.")
return true
}
if(ContentAPI.getAttribute(player,BONE_HOPPER_KEY,false) && !ContentAPI.getAttribute(player,BONE_BIN_KEY,false)){
ContentAPI.sendMessage(player,"You need to wind the wheel to grind the bones.")
if(getAttribute(player,BONE_HOPPER_KEY,false) && !getAttribute(player,BONE_BIN_KEY,false)){
sendMessage(player,"You need to wind the wheel to grind the bones.")
return true
}
if(!ContentAPI.inInventory(player,Items.EMPTY_POT_1931,1)){
ContentAPI.sendMessage(player,"You don't have any pots to take the bonemeal with.")
if(!inInventory(player,Items.EMPTY_POT_1931,1)){
sendMessage(player,"You don't have any pots to take the bonemeal with.")
return true
}
val bone = Bones.values()[ContentAPI.getAttribute(player,LOADED_BONE_KEY,-1)]
val bone = Bones.values()[getAttribute(player,LOADED_BONE_KEY,-1)]
Pulser.submit(object : Pulse(){
@ -223,16 +223,16 @@ class BoneGrinderListener : InteractionListener() {
override fun pulse(): Boolean {
when(stage++){
0 -> {
ContentAPI.face(player,Location(3658, 3525, 1))
ContentAPI.lock(player, SCOOP_ANIM.duration)
ContentAPI.animate(player,SCOOP_ANIM)
face(player,Location(3658, 3525, 1))
lock(player, SCOOP_ANIM.duration)
animate(player,SCOOP_ANIM)
}
SCOOP_ANIM.duration -> {
if(ContentAPI.removeItem(player,Item(Items.EMPTY_POT_1931),Container.INVENTORY)){
ContentAPI.addItem(player,bone.boneMeal.id)
ContentAPI.setAttribute(player,BONE_BIN_KEY,false)
ContentAPI.setAttribute(player,BONE_HOPPER_KEY,false)
ContentAPI.setAttribute(player,LOADED_BONE_KEY,-1)
if(removeItem(player,Item(Items.EMPTY_POT_1931),Container.INVENTORY)){
addItem(player,bone.boneMeal.id)
setAttribute(player,BONE_BIN_KEY,false)
setAttribute(player,BONE_HOPPER_KEY,false)
setAttribute(player,LOADED_BONE_KEY,-1)
}
return true
}
@ -245,7 +245,7 @@ class BoneGrinderListener : InteractionListener() {
fun getBone(player: Player): Bones? {
for(bone in Bones.values()){
if(ContentAPI.inInventory(player,bone.itemId)) return bone
if(inInventory(player,bone.itemId)) return bone
}
return null
}

View file

@ -1,6 +1,6 @@
package rs09.game.ge
import api.ContentAPI
import api.*
import rs09.ServerConstants
import core.cache.def.impl.ItemDefinition
import core.game.content.eco.EcoStatus
@ -510,7 +510,7 @@ object OfferManager {
}
private fun getItemDefPrice(itemID: Int): Int {
return max(ContentAPI.itemDefinition(itemID).getConfiguration(ItemConfigParser.GE_PRICE) ?: 0, ContentAPI.itemDefinition(itemID).value)
return max(itemDefinition(itemID).getConfiguration(ItemConfigParser.GE_PRICE) ?: 0, itemDefinition(itemID).value)
}
@JvmStatic

View file

@ -1,6 +1,6 @@
package rs09.game.ge
import api.ContentAPI
import api.*
import core.cache.def.impl.ItemDefinition
import core.game.component.CloseEvent
import core.game.component.Component
@ -318,7 +318,7 @@ class PlayerGrandExchange(private val player: Player) {
temporaryOffer!!.itemID = itemId
temporaryOffer!!.sell = false
var itemDb = GrandExchangeDatabase.getDatabase()[itemId]
if (itemDb == null || !ContentAPI.itemDefinition(itemId).isTradeable) {
if (itemDb == null || !itemDefinition(itemId).isTradeable) {
player.packetDispatch.sendMessage("This item has been blacklisted from the Grand Exchange.")
return
}

View file

@ -1,6 +1,6 @@
package rs09.game.interaction.inter
import api.ContentAPI
import api.*
import core.game.node.entity.player.Player
import core.game.node.item.Item
import org.rs09.consts.Components
@ -17,7 +17,7 @@ class CreditShopInterface : InterfaceListener() {
val item = getItem(buttonID)
if(opcode == 155){
ContentAPI.sendDialogue(player, "This item costs ${item.price} credits.")
sendDialogue(player, "This item costs ${item.price} credits.")
return@on true
}
@ -59,19 +59,19 @@ class CreditShopInterface : InterfaceListener() {
}
fun sendCredits(player: Player){
ContentAPI.setInterfaceText(player, "You have ${player.details.credits} credits to spend.", CREDIT_SHOP, TEXT_CHILD)
setInterfaceText(player, "You have ${player.details.credits} credits to spend.", CREDIT_SHOP, TEXT_CHILD)
}
fun attemptPurchase(player: Player, item: Int, price: Int){
if(player.details.credits < price){
ContentAPI.sendDialogue(player, "You don't have enough credits for that.")
sendDialogue(player, "You don't have enough credits for that.")
return
}
if(player.inventory.add(Item(item))){
player.details.credits -= price
} else {
ContentAPI.sendDialogue(player, "You don't have enough inventory space for that.")
sendDialogue(player, "You don't have enough inventory space for that.")
}
sendCredits(player)
}

Some files were not shown because too many files have changed in this diff Show more