Redwings Drop III: Ceikry GE, Job, Slayer, Achievement Diary rewrites
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package core.game.container.impl;
|
||||
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.container.access.InterfaceContainer;
|
||||
import rs09.ServerConstants;
|
||||
import core.game.component.Component;
|
||||
import core.game.container.*;
|
||||
@@ -81,6 +83,18 @@ public final class BankContainer extends Container {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to open the deposit box.
|
||||
*/
|
||||
public void openDepositBox() {
|
||||
player.getInterfaceManager().open(new Component(11)).setCloseEvent((player, c) -> {
|
||||
player.getInterfaceManager().openDefaultTabs();
|
||||
return true;
|
||||
});
|
||||
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6);
|
||||
InterfaceContainer.generateItems(player, player.getInventory().toArray(), new String[]{"Examine", "Deposit-X", "Deposit-All", "Deposit-10", "Deposit-5", "Deposit-1"}, 11, 15, 5, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the bank.
|
||||
*/
|
||||
@@ -130,7 +144,7 @@ public final class BankContainer extends Container {
|
||||
BankContainer.this.close();
|
||||
return true;
|
||||
});
|
||||
this.player.getBank().refresh(player.getBank().listener);
|
||||
refresh(listener);
|
||||
player.getInterfaceManager().openSingleTab(new Component(763));
|
||||
player.getInventory().getListeners().add(player.getBank().listener);
|
||||
player.getInventory().refresh();
|
||||
|
||||
@@ -1073,21 +1073,6 @@ public final class RangingGuildPlugin extends OptionHandler {
|
||||
super(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
if (killer instanceof Player) {
|
||||
Player player = (Player) killer;
|
||||
if (!player.getAchievementDiaryManager().hasCompletedTask(DiaryType.SEERS_VILLAGE, 1, 6)) {
|
||||
player.setAttribute("/save:diary:seers:tower-archers",
|
||||
player.getAttribute("diary:seers:tower-archers", 0)
|
||||
| 1 << getId() - 688);
|
||||
if (player.getAttribute("diary:seers:tower-archers", 0) == 15) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 1, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
|
||||
@@ -244,9 +244,6 @@ public final class BalloonManager extends OptionHandler {
|
||||
getBalloons().remove(object);
|
||||
player.animate(Animation.create(10017));
|
||||
|
||||
// Pop a party balloon
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 0, 12);
|
||||
|
||||
GameWorld.getPulser().submit(new Pulse(1) {
|
||||
int counter;
|
||||
|
||||
|
||||
-1
@@ -121,7 +121,6 @@ public final class StrongHoldSecurityPlugin extends MapZone implements Plugin<Ob
|
||||
openComponent(player, Location.create(2358, 5215, 0));
|
||||
return true;
|
||||
case 16149:// fourth ladder going down.
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 4);
|
||||
openComponent(player, Location.create(2042, 5245, 0));
|
||||
return true;
|
||||
case 16135:// claim gift of piece.
|
||||
|
||||
@@ -103,18 +103,6 @@ public final class TzhaarFightCaveNPC extends AbstractNPC {
|
||||
return mover instanceof TzhaarFightCaveNPC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(Entity killer) {
|
||||
if (killer.isPlayer()) {
|
||||
Player player = killer.asPlayer();
|
||||
// Successfully kill a Ket-Zek in the Fight Caves
|
||||
if ((getId() == 2743 || getId() == 2744)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.KARAMJA, 2, 1);
|
||||
}
|
||||
}
|
||||
super.finalizeDeath(killer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Heals the NPC.
|
||||
* @param amount The amount to heal.
|
||||
|
||||
@@ -4,6 +4,8 @@ import core.game.ge.GrandExchangeDatabase;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.player.Player;
|
||||
import rs09.game.interaction.inter.ge.ExchangeItemSets;
|
||||
import rs09.game.interaction.inter.ge.StockMarket;
|
||||
|
||||
/**
|
||||
* Handles the GrandExchangeClerk dialogue.
|
||||
@@ -92,7 +94,7 @@ public final class GrandExchangeClerk extends DialoguePlugin {
|
||||
break;
|
||||
case 11:
|
||||
end();
|
||||
player.getPlayerGrandExchange().open();
|
||||
StockMarket.openFor(player);
|
||||
break;
|
||||
case 20:
|
||||
npc("As you wish, sir.");
|
||||
@@ -100,7 +102,7 @@ public final class GrandExchangeClerk extends DialoguePlugin {
|
||||
break;
|
||||
case 21:
|
||||
end();
|
||||
player.getPlayerGrandExchange().openCollectionBox();
|
||||
player.getExchangeRecords().openCollectionBox();
|
||||
break;
|
||||
case 30:
|
||||
npc("If that is your wish.");
|
||||
@@ -108,7 +110,7 @@ public final class GrandExchangeClerk extends DialoguePlugin {
|
||||
break;
|
||||
case 31:
|
||||
end();
|
||||
player.getPlayerGrandExchange().openHistoryLog(player);
|
||||
player.getExchangeRecords().openHistoryLog(player);
|
||||
break;
|
||||
case 40:
|
||||
npc("It would be my pleasure, sir.");
|
||||
@@ -116,7 +118,7 @@ public final class GrandExchangeClerk extends DialoguePlugin {
|
||||
break;
|
||||
case 41:
|
||||
end();
|
||||
player.getPlayerGrandExchange().openItemSets();
|
||||
ExchangeItemSets.openFor(player);
|
||||
break;
|
||||
case 50:
|
||||
npc("If you say so, sir.");
|
||||
|
||||
@@ -2,6 +2,7 @@ package core.game.content.global;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
@@ -162,9 +163,9 @@ public enum EnchantedJewellery {
|
||||
}
|
||||
player.lock();
|
||||
player.visualize(ANIMATION, GRAPHICS);
|
||||
player.getAudioManager().send(200);
|
||||
player.getAudioManager().send(new Audio(200), true);
|
||||
player.getImpactHandler().setDisabledTicks(4);
|
||||
GameWorld.getPulser().submit(new Pulse(4, player) {
|
||||
GameWorld.getPulser().submit(new Pulse(4) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.unlock();
|
||||
|
||||
@@ -201,45 +201,6 @@ public final class ClimbActionHandler {
|
||||
for (String message : messages) {
|
||||
player.getPacketDispatch().sendMessage(message);
|
||||
}
|
||||
|
||||
// Achievement Diary Handlers
|
||||
// falador climb to top of white knight's castle
|
||||
player.debug(destination.toString());
|
||||
if ((destination.equals(2959, 3338, 3) || destination.equals(2983, 3350, 3) || destination.equals(2995, 3341, 3))) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 0, 3);
|
||||
}
|
||||
// falador dark wizards tower proselyte
|
||||
if (destination.equals(2908, 3336, 2)
|
||||
&& isEquipped(player, Items.PROSELYTE_SALLET_9672)
|
||||
&& isEquipped(player, Items.PROSELYTE_HAUBERK_9674)
|
||||
&& isEquipped(player, Items.PROSELYTE_CUISSE_9676)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 2, 0);
|
||||
}
|
||||
// falador enter the mining guild
|
||||
if (destination.equals(3021, 9739, 0)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 2, 6);
|
||||
}
|
||||
|
||||
// Climb to the highest point in Lumbridge
|
||||
if (destination.equals(3207, 3222, 3)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 0);
|
||||
}
|
||||
|
||||
// Climb to the top of the Wizards' Tower
|
||||
if (destination.equals(3104, 3161, 2)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 11);
|
||||
}
|
||||
|
||||
// Enter Edgeville Dungeon using the entrance to the south of<br><br>Edgeville
|
||||
if (destination.equals(3096, 9867, 0)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 10);
|
||||
}
|
||||
|
||||
// Find the highest point in Varrock
|
||||
if (destination.equals(3206, 3497, 3) || destination.equals(3223, 3472, 3) || destination.equals(3258, 3486, 3)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 18);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ package core.game.ge;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.StringUtils;
|
||||
import rs09.game.ge.OfferManager;
|
||||
import rs09.game.ge.GrandExchange;
|
||||
|
||||
/**
|
||||
* Represents the glass used to open the guide prices for the different type of
|
||||
@@ -140,7 +140,7 @@ public final class GEGuidePrice {
|
||||
player.getPacketDispatch().sendInterfaceConfig(642, i, false);
|
||||
}
|
||||
for (GuideItem item : getItems()) {
|
||||
player.getPacketDispatch().sendString("" + OfferManager.getRecommendedPrice(item.item, false) + " gp", COMPONENT.getId(), item.getChildData()[0]);
|
||||
player.getPacketDispatch().sendString("" + GrandExchange.getRecommendedPrice(item.item, false) + " gp", COMPONENT.getId(), item.getChildData()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,8 @@ import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.ge.GEGuidePrice;
|
||||
import core.game.ge.GEItemSet;
|
||||
import core.game.ge.GrandExchangeDatabase;
|
||||
import core.game.ge.OfferState;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
@@ -21,9 +19,10 @@ import core.net.packet.out.ContainerPacket;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import kotlin.Unit;
|
||||
import rs09.game.ge.GrandExchange;
|
||||
import rs09.game.ge.GrandExchangeOffer;
|
||||
import rs09.game.ge.OfferManager;
|
||||
import rs09.game.ge.PlayerGrandExchange;
|
||||
import rs09.game.ge.GrandExchangeRecords;
|
||||
import rs09.game.interaction.inter.ge.StockMarket;
|
||||
import rs09.game.interaction.npc.BogrogPouchSwapper;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
@@ -37,8 +36,8 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(105, this); // Main interface
|
||||
ComponentDefinition.put(107, this); // Selling tab
|
||||
//ComponentDefinition.put(105, this); // Main interface
|
||||
//ComponentDefinition.put(107, this); // Selling tab
|
||||
ComponentDefinition.put(109, this); // Collection interface
|
||||
ComponentDefinition.put(389, this); // Search interface
|
||||
ComponentDefinition.put(644, this); // Item sets inventory interface
|
||||
@@ -47,64 +46,26 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the opened grand exchange offer amount.
|
||||
* @param player The player.
|
||||
* @param amount The amount to increment.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void setOfferAmount(Player player, GrandExchangeOffer offer, int amount) {
|
||||
if (offer == null || amount < 0 || offer.getOfferState() != OfferState.PENDING) {
|
||||
return;
|
||||
}
|
||||
offer.setAmount(amount);
|
||||
player.getConfigManager().send(1110, offer.getAmount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the opened grand exchange offer amount.
|
||||
* @param player The player.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void setOfferValue(Player player, GrandExchangeOffer offer, int value) {
|
||||
if (offer == null || value < 1 || offer.getOfferState() != OfferState.PENDING) {
|
||||
return;
|
||||
}
|
||||
if (value == OfferManager.getRecommendedPrice(offer.getItemID(), false)) {
|
||||
player.getAudioManager().send(new Audio(4043, 1, 1));
|
||||
} else if (value > offer.getOfferedValue()) {
|
||||
player.getAudioManager().send(new Audio(4041, 1, 1));
|
||||
} else {
|
||||
player.getAudioManager().send(new Audio(4045, 1, 1));
|
||||
}
|
||||
offer.setOfferedValue(value);
|
||||
player.varpManager.get(1111).setVarbit(0,offer.getOfferedValue()).send(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, final Component component, final int opcode, final int button, final int slot, final int itemId) {
|
||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
switch (component.getId()) {
|
||||
case 644:
|
||||
case 645:
|
||||
handleItemSet(player, component, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 389:
|
||||
handleSearchInterface(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 107:
|
||||
handleSellingTab(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 109:
|
||||
handleCollectionBox(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 642:
|
||||
handleGuidePrice(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 644:
|
||||
case 645:
|
||||
handleItemSet(player, component, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 389:
|
||||
handleSearchInterface(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 109:
|
||||
handleCollectionBox(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
case 642:
|
||||
handleGuidePrice(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
}
|
||||
handleMainInterface(player, opcode, button, slot, itemId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -122,37 +83,9 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
*/
|
||||
public boolean handleSearchInterface(final Player player, int opcode, int button, int slot, int itemId) {
|
||||
switch (button) {
|
||||
case 10:
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the selling tab interface options.
|
||||
* @param player The player.
|
||||
* @param opcode The packet opcode.
|
||||
* @param button The button id.
|
||||
* @param slot The slot.
|
||||
* @param itemId The item id.
|
||||
* @return {@code true} if the option got handled.
|
||||
*/
|
||||
public boolean handleSellingTab(final Player player, int opcode, int button, int slot, int itemId) {
|
||||
if (button != 18 || slot < 0 || slot > 27) {
|
||||
return false;
|
||||
}
|
||||
Item item = player.getInventory().get(slot);
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
switch (opcode) {
|
||||
case 196:
|
||||
player.getPacketDispatch().sendMessage(item.getDefinition().getExamine());
|
||||
return true;
|
||||
case 155:
|
||||
player.getPlayerGrandExchange().constructSale(item);
|
||||
return true;
|
||||
case 10:
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -169,20 +102,20 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
public boolean handleCollectionBox(final Player player, int opcode, int button, int slot, int itemId) {
|
||||
int index = -1;
|
||||
switch (button) {
|
||||
case 18:
|
||||
case 23:
|
||||
case 28:
|
||||
index = (button - 18) >> 2;
|
||||
break;
|
||||
case 36:
|
||||
case 44:
|
||||
case 52:
|
||||
index = 3 + ((button - 36) >> 3);
|
||||
break;
|
||||
case 18:
|
||||
case 23:
|
||||
case 28:
|
||||
index = (button - 18) >> 2;
|
||||
break;
|
||||
case 36:
|
||||
case 44:
|
||||
case 52:
|
||||
index = 3 + ((button - 36) >> 3);
|
||||
break;
|
||||
}
|
||||
GrandExchangeOffer offer;
|
||||
if (index > -1 && (offer = player.getPlayerGrandExchange().getOffers()[index]) != null) {
|
||||
player.getPlayerGrandExchange().withdraw(offer, slot >> 1);
|
||||
if (index > -1 && (offer = player.getExchangeRecords().getOffer(player.getExchangeRecords().getOfferRecords()[index])) != null) {
|
||||
StockMarket.withdraw(player, offer, slot >> 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -213,192 +146,44 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
return;
|
||||
}
|
||||
switch (opcode) {
|
||||
case 124:
|
||||
player.getPacketDispatch().sendMessage(item.getDefinition().getExamine());
|
||||
break;
|
||||
case 196:
|
||||
if (inventory) {
|
||||
if (player.getInventory().freeSlots() < set.getComponents().length - 1) {
|
||||
player.getPacketDispatch().sendMessage("You don't have enough inventory space for the component parts.");
|
||||
return;
|
||||
case 124:
|
||||
player.getPacketDispatch().sendMessage(item.getDefinition().getExamine());
|
||||
break;
|
||||
case 196:
|
||||
if (inventory) {
|
||||
if (player.getInventory().freeSlots() < set.getComponents().length - 1) {
|
||||
player.getPacketDispatch().sendMessage("You don't have enough inventory space for the component parts.");
|
||||
return;
|
||||
}
|
||||
if (!player.getInventory().remove(item, false)) {
|
||||
return;
|
||||
}
|
||||
for (int id : set.getComponents()) {
|
||||
player.getInventory().add(new Item(id, 1));
|
||||
}
|
||||
player.getInventory().refresh();
|
||||
player.getPacketDispatch().sendMessage("You successfully traded your set for its component items!");
|
||||
} else {
|
||||
if (!player.getInventory().containItems(set.getComponents())) {
|
||||
player.getPacketDispatch().sendMessage("You don't have the parts that make up this set.");
|
||||
break;
|
||||
}
|
||||
for (int id : set.getComponents()) {
|
||||
player.getInventory().remove(new Item(id, 1), false);
|
||||
}
|
||||
player.getInventory().add(item);
|
||||
player.getInventory().refresh();
|
||||
player.getPacketDispatch().sendMessage("You successfully traded your item components for a set!");
|
||||
}
|
||||
if (!player.getInventory().remove(item, false)) {
|
||||
return;
|
||||
}
|
||||
for (int id : set.getComponents()) {
|
||||
player.getInventory().add(new Item(id, 1));
|
||||
}
|
||||
player.getInventory().refresh();
|
||||
player.getPacketDispatch().sendMessage("You successfully traded your set for its component items!");
|
||||
} else {
|
||||
if (!player.getInventory().containItems(set.getComponents())) {
|
||||
player.getPacketDispatch().sendMessage("You don't have the parts that make up this set.");
|
||||
break;
|
||||
}
|
||||
for (int id : set.getComponents()) {
|
||||
player.getInventory().remove(new Item(id, 1), false);
|
||||
}
|
||||
player.getInventory().add(item);
|
||||
player.getInventory().refresh();
|
||||
player.getPacketDispatch().sendMessage("You successfully traded your item components for a set!");
|
||||
}
|
||||
player.getAudioManager().send(new Audio(4044, 1, 1));
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, -1, -2, player.getAttribute("container-key", 93), player.getInventory(), false));
|
||||
break;
|
||||
case 155:
|
||||
player.getPacketDispatch().sendMessage((String) CS2Mapping.forId(1089).getMap().get(set.getItemId()));
|
||||
break;
|
||||
player.getAudioManager().send(new Audio(4044, 1, 1));
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, -1, -2, player.getAttribute("container-key", 93), player.getInventory(), false));
|
||||
break;
|
||||
case 155:
|
||||
player.getPacketDispatch().sendMessage((String) CS2Mapping.forId(1089).getMap().get(set.getItemId()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the main interface options.
|
||||
* @param player The player.
|
||||
* @param opcode The packet opcode.
|
||||
* @param button The button id.
|
||||
* @param slot The slot.
|
||||
* @param itemId The item id.
|
||||
* @return {@code true} if the option got handled.
|
||||
*/
|
||||
public boolean handleMainInterface(final Player player, int opcode, int button, int slot, int itemId) {
|
||||
final GrandExchangeOffer offer = player.getPlayerGrandExchange().getTemporaryOffer();
|
||||
final GrandExchangeOffer opened = player.getPlayerGrandExchange().getOpenedOffer();
|
||||
int amount = offer == null ? 0 : offer.getAmount();
|
||||
switch (button) {
|
||||
case 209:
|
||||
case 211:
|
||||
if (opened == null) {
|
||||
return false;
|
||||
}
|
||||
player.getPlayerGrandExchange().withdraw(opened, (button - 209) >> 1);
|
||||
return true;
|
||||
case 190:
|
||||
player.getPlayerGrandExchange().confirmOffer();
|
||||
player.getPlayerGrandExchange().setTemporaryOffer(null);
|
||||
return true;
|
||||
case 194:
|
||||
player.getPlayerGrandExchange().openSearch();
|
||||
return true;
|
||||
case 203:
|
||||
if (opened == null) {
|
||||
return false;
|
||||
}
|
||||
player.getPlayerGrandExchange().abort(opened.getIndex());
|
||||
return true;
|
||||
case 18:
|
||||
case 34:
|
||||
case 50:
|
||||
case 69:
|
||||
case 88:
|
||||
case 107:
|
||||
if (opcode == 205) {
|
||||
player.getPlayerGrandExchange().abort((button - 18) >> 4);
|
||||
return true;
|
||||
}
|
||||
player.getPlayerGrandExchange().view((button - 18) >> 4);
|
||||
return true;
|
||||
case 30:
|
||||
case 46:
|
||||
case 62:
|
||||
case 81:
|
||||
case 100:
|
||||
case 119:
|
||||
player.getPlayerGrandExchange().openBuy((button - 30) >> 4);
|
||||
return true;
|
||||
case 31:
|
||||
case 47:
|
||||
case 63:
|
||||
case 82:
|
||||
case 101:
|
||||
case 120:
|
||||
player.getPlayerGrandExchange().openSell((button - 31) >> 4);
|
||||
return true;
|
||||
case 157: // -1
|
||||
setOfferAmount(player, offer, amount - 1);
|
||||
return true;
|
||||
case 159: // +1
|
||||
setOfferAmount(player, offer, amount + 1);
|
||||
return true;
|
||||
case 162: // 1
|
||||
setOfferAmount(player, offer, offer != null && offer.getSell() ? 1 : amount + 1);
|
||||
return true;
|
||||
case 164: // 10
|
||||
setOfferAmount(player, offer, offer != null && offer.getSell() ? 10 : amount + 10);
|
||||
return true;
|
||||
case 166: // 100
|
||||
setOfferAmount(player, offer, offer != null && offer.getSell() ? 100 : amount + 100);
|
||||
return true;
|
||||
case 168: // 1000 / sell all
|
||||
if (offer != null && offer.getSell()) {
|
||||
setOfferAmount(player, offer, PlayerGrandExchange.getInventoryAmount(player, offer.getItemID()));
|
||||
return true;
|
||||
}
|
||||
setOfferAmount(player, offer, amount + 1000);
|
||||
return true;
|
||||
case 170: // value x
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
if (player.getInterfaceManager().getChatbox().getId() == 389) {
|
||||
player.getPlayerGrandExchange().openSearch();
|
||||
}
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
s = s.replace("m","000000");
|
||||
s = s.replace("M","000000");
|
||||
setOfferAmount(player, offer, Integer.parseInt(s));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return false;
|
||||
case 180:
|
||||
if (offer != null) {
|
||||
setOfferValue(player, offer, OfferManager.getRecommendedPrice(offer.getItemID(), false));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 177: // mid - 5% value
|
||||
case 183: // mid + 5% value
|
||||
if (offer != null) {
|
||||
setOfferValue(player, offer, (int) (OfferManager.getRecommendedPrice(offer.getItemID(), false) * (button == 177 ? 0.95 : 1.05)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 171: // Decrease value by 1
|
||||
case 173: // Increase value with 1
|
||||
if (offer != null) {
|
||||
setOfferValue(player, offer, offer.getOfferedValue() + (button == 171 ? -1 : 1));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 185: // Set value x
|
||||
if (offer == null) {
|
||||
player.getPacketDispatch().sendMessage("Please select an offer first.");
|
||||
return true;
|
||||
}
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
if (player.getInterfaceManager().getChatbox().getId() == 389) {
|
||||
player.getPlayerGrandExchange().openSearch();
|
||||
}
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
s = s.replace("m","000000");
|
||||
s = s.replace("M","000000");
|
||||
setOfferValue(player, offer, Integer.parseInt(s));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return false;
|
||||
case 195:
|
||||
player.getInterfaceManager().close();
|
||||
return true;
|
||||
case 127:
|
||||
player.getPlayerGrandExchange().setTemporaryOffer(null);
|
||||
player.getInterfaceManager().closeSingleTab();
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
* Method used to handle the guide price opcode.
|
||||
* @param player the player.
|
||||
@@ -409,29 +194,29 @@ public class GrandExchangeInterface extends ComponentPlugin {
|
||||
*/
|
||||
private void handleGuidePrice(final Player player, final int opcode, final int buttonId, final int slot, final int itemId) {
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
GEGuidePrice.GuideType type = player.getAttribute("guide-price", null);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
int subtract = 0;
|
||||
if (buttonId >= 15 && buttonId <= 23) {
|
||||
subtract = 15;
|
||||
}
|
||||
if (buttonId >= 43 && buttonId <= 57) {
|
||||
subtract = 43;
|
||||
}
|
||||
if (buttonId >= 89 && buttonId <= 103) {
|
||||
subtract = 89;
|
||||
}
|
||||
if (buttonId >= 135 && buttonId <= 144) {
|
||||
subtract = 135;
|
||||
}
|
||||
if (buttonId >= 167 && buttonId <= 182) {
|
||||
subtract = 167;
|
||||
}
|
||||
player.getPacketDispatch().sendMessage(ItemDefinition.forId(type.getItems()[buttonId - subtract].getItem()).getExamine());
|
||||
break;
|
||||
case 155:
|
||||
GEGuidePrice.GuideType type = player.getAttribute("guide-price", null);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
int subtract = 0;
|
||||
if (buttonId >= 15 && buttonId <= 23) {
|
||||
subtract = 15;
|
||||
}
|
||||
if (buttonId >= 43 && buttonId <= 57) {
|
||||
subtract = 43;
|
||||
}
|
||||
if (buttonId >= 89 && buttonId <= 103) {
|
||||
subtract = 89;
|
||||
}
|
||||
if (buttonId >= 135 && buttonId <= 144) {
|
||||
subtract = 135;
|
||||
}
|
||||
if (buttonId >= 167 && buttonId <= 182) {
|
||||
subtract = 167;
|
||||
}
|
||||
player.getPacketDispatch().sendMessage(ItemDefinition.forId(type.getItems()[buttonId - subtract].getItem()).getExamine());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package core.game.interaction.npc
|
||||
import api.*
|
||||
import core.cache.def.impl.NPCDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.plugin.Initializable
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
@@ -12,6 +13,7 @@ import core.plugin.Plugin
|
||||
import core.game.node.entity.skill.crafting.TanningProduct
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* Represents the plugin used for an npc with the trade option.
|
||||
@@ -42,6 +44,24 @@ class NPCTradePlugin : InteractionListener() {
|
||||
node.asNpc().openShop(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(NPCs.FUR_TRADER_1316, NPC,"trade") { player, node ->
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
sendNPCDialogue(player, NPCs.FUR_TRADER_1316, "I don't sell to outerlanders.", FacialExpression.ANNOYED).also { END_DIALOGUE }
|
||||
} else {
|
||||
END_DIALOGUE.also { node.asNpc().openShop(player) }
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(NPCs.FISH_MONGER_1315, NPC,"trade") { player, node ->
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
sendNPCDialogue(player, NPCs.FISH_MONGER_1315, "I don't sell to outerlanders.", FacialExpression.ANNOYED).also { END_DIALOGUE }
|
||||
} else {
|
||||
END_DIALOGUE.also { node.asNpc().openShop(player) }
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
override fun defineDestinationOverrides() {
|
||||
|
||||
@@ -32,8 +32,8 @@ import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import kotlin.Unit;
|
||||
import org.rs09.consts.Items;
|
||||
import rs09.game.content.dialogue.DumpContainer;
|
||||
import rs09.game.content.dialogue.DepositAllDialogue;
|
||||
import rs09.game.ge.GrandExchangeRecords;
|
||||
import rs09.game.ge.GrandExchangeOffer;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
@@ -92,7 +92,7 @@ public final class BankingPlugin extends OptionHandler {
|
||||
checkAchievements(player);
|
||||
return true;
|
||||
case "collect":
|
||||
player.getPlayerGrandExchange().openCollectionBox();
|
||||
player.getExchangeRecords().openCollectionBox();
|
||||
return true;
|
||||
case "deposit":
|
||||
openDepositBox(player);
|
||||
@@ -174,7 +174,8 @@ public final class BankingPlugin extends OptionHandler {
|
||||
return true;
|
||||
}
|
||||
interpreter.sendDialogues(id, FacialExpression.HALF_GUILTY, "Good day, How may I help you?");
|
||||
for (GrandExchangeOffer o : player.getPlayerGrandExchange().getOffers()) {
|
||||
for (GrandExchangeRecords.OfferRecord r : player.getExchangeRecords().getOfferRecords()) {
|
||||
GrandExchangeOffer o = player.getExchangeRecords().getOffer(r);
|
||||
if (o != null && (o.getWithdraw()[0] != null || o.getWithdraw()[1] != null)) {
|
||||
stage = -1;
|
||||
break;
|
||||
@@ -428,7 +429,7 @@ public final class BankingPlugin extends OptionHandler {
|
||||
case 762:
|
||||
switch (button) {
|
||||
case 18:
|
||||
p.getDialogueInterpreter().open(new DumpContainer().getID());
|
||||
p.getDialogueInterpreter().open(new DepositAllDialogue().getID());
|
||||
return true;
|
||||
case 23:
|
||||
p.getDialogueInterpreter().sendOptions("Select an Option", "Check bank value", "Banking assistance", "Close");
|
||||
@@ -675,7 +676,7 @@ public final class BankingPlugin extends OptionHandler {
|
||||
player.getBank().open();
|
||||
checkAchievements(player);
|
||||
} else {
|
||||
player.getPlayerGrandExchange().openCollectionBox();
|
||||
player.getExchangeRecords().openCollectionBox();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.game.interaction.inter.ge.ExchangeItemSets;
|
||||
import rs09.game.interaction.inter.ge.StockMarket;
|
||||
|
||||
/**
|
||||
* Represents the plugin used for grand exchange npc and object options.
|
||||
@@ -56,17 +58,17 @@ public final class GrandExchangePlugin extends OptionHandler {
|
||||
player.getDialogueInterpreter().sendDialogue("The Grand Exchange desk seems to be closed...");
|
||||
break;
|
||||
}
|
||||
player.getPlayerGrandExchange().open();
|
||||
StockMarket.openFor(player);
|
||||
break;
|
||||
case "history":
|
||||
player.getPlayerGrandExchange().openHistoryLog(player);
|
||||
player.getExchangeRecords().openHistoryLog(player);
|
||||
break;
|
||||
case "collect":
|
||||
if (!GrandExchangeDatabase.hasInitialized()) {
|
||||
player.getDialogueInterpreter().sendDialogue("The Grand Exchange desk seems to be closed...");
|
||||
break;
|
||||
}
|
||||
player.getPlayerGrandExchange().openCollectionBox();
|
||||
player.getExchangeRecords().openCollectionBox();
|
||||
break;
|
||||
case "info-logs":
|
||||
GEGuidePrice.open(player, GuideType.LOGS);
|
||||
@@ -84,7 +86,7 @@ public final class GrandExchangePlugin extends OptionHandler {
|
||||
GEGuidePrice.open(player, GuideType.WEAPONS_AND_ARMOUR);
|
||||
break;
|
||||
case "sets":
|
||||
player.getPlayerGrandExchange().openItemSets();
|
||||
ExchangeItemSets.openFor(player);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
@@ -137,7 +139,7 @@ public final class GrandExchangePlugin extends OptionHandler {
|
||||
player.getBank().open();
|
||||
break;
|
||||
case "collect":
|
||||
player.getPlayerGrandExchange().openCollectionBox();
|
||||
player.getExchangeRecords().openCollectionBox();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class LumbridgeBasementPlugin extends OptionHandler {
|
||||
SceneryDefinition.forId(40849).getHandlers().put("option:jump-down", this);
|
||||
SceneryDefinition.forId(40260).getHandlers().put("option:climb-through", this);
|
||||
SceneryDefinition.forId(41077).getHandlers().put("option:crawl-through", this);
|
||||
PluginManager.definePlugins(new LightCreatureNPC(), new LightCreatureHandler(), new FishMongerDialogue());
|
||||
PluginManager.definePlugins(new LightCreatureNPC(), new LightCreatureHandler());
|
||||
SceneryBuilder.add(new Scenery(40260, Location.create(2526, 5828, 2), 2));
|
||||
return this;
|
||||
}
|
||||
@@ -256,69 +256,4 @@ public class LumbridgeBasementPlugin extends OptionHandler {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the fish monger dialogue.
|
||||
* @author Vexia
|
||||
*
|
||||
*/
|
||||
public class FishMongerDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Constructs the {@code FishMongerDialogue}
|
||||
*/
|
||||
public FishMongerDialogue() {
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the {@code FishMongerDialogue}
|
||||
*/
|
||||
public FishMongerDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new FishMongerDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
npc = (NPC) args[0];
|
||||
npc("Hello, " + player.getUsername() + " would you like to look at", "my wares?");
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
options("Yes, please.", "No, thanks.");
|
||||
stage++;
|
||||
break;
|
||||
case 1:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
end();
|
||||
npc.openShop(player);
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] {1369};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import core.game.node.entity.combat.equipment.WeaponInterface.AttackStyle;
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.WeaponInterfaces;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.node.scenery.SceneryBuilder;
|
||||
@@ -73,6 +74,7 @@ public final class SlashWebPlugin extends OptionHandler {
|
||||
}
|
||||
final boolean success = RandomFunction.random(2) == 1;
|
||||
player.lock(2);
|
||||
player.getAudioManager().send(new Audio(2548));
|
||||
player.animate(weapon == KNIFE ? KNIFE_ANIMATION : ANIMATION);
|
||||
if (success) {
|
||||
player.getPacketDispatch().sendMessage("You slash the web apart.");
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package core.game.node.entity;
|
||||
|
||||
import api.events.Event;
|
||||
import api.events.EventHook;
|
||||
import core.game.content.holiday.HolidayEvent;
|
||||
import core.game.interaction.DestinationFlag;
|
||||
import core.game.node.Node;
|
||||
@@ -28,6 +30,7 @@ import core.game.world.update.flag.context.Graphics;
|
||||
import rs09.game.node.entity.combat.CombatSwingHandler;
|
||||
import rs09.game.world.update.UpdateMasks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -107,6 +110,13 @@ public abstract class Entity extends Node {
|
||||
*/
|
||||
private final ActionLocks locks = new ActionLocks();
|
||||
|
||||
|
||||
/**
|
||||
* The mapping of event types to event hooks
|
||||
*/
|
||||
private HashMap<Class<?>, ArrayList<EventHook>> hooks = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* If the entity is invisible.
|
||||
*/
|
||||
@@ -145,6 +155,54 @@ public abstract class Entity extends Node {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an event to this entity's event hooks
|
||||
*/
|
||||
public void dispatch(Event event)
|
||||
{
|
||||
if(this.hooks.containsKey(event.getClass()))
|
||||
{
|
||||
this.hooks.get(event.getClass()).forEach((hook) -> { hook.process(this, event); });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unhooks an eventhook from this entity
|
||||
*/
|
||||
public void unhook(EventHook hook)
|
||||
{
|
||||
GameWorld.getPulser().submit(new Pulse() {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
for(ArrayList<EventHook> s : hooks.values()) s.remove(hook);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks an eventhook to this entity
|
||||
*/
|
||||
public void hook(Event event, EventHook hook)
|
||||
{
|
||||
hook(event.getClass(), hook);
|
||||
}
|
||||
|
||||
public void hook(Class<?> event, EventHook hook)
|
||||
{
|
||||
ArrayList<EventHook> hookList;
|
||||
if(hooks.get(event) != null)
|
||||
{
|
||||
hookList = hooks.get(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
hookList = new ArrayList<EventHook>();
|
||||
}
|
||||
hookList.add(hook);
|
||||
hooks.put(event, hookList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the entity.
|
||||
*/
|
||||
|
||||
+15
-27
@@ -1,6 +1,5 @@
|
||||
package core.game.node.entity.combat.special;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
@@ -10,13 +9,12 @@ import core.game.node.entity.impl.Animator.Priority;
|
||||
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;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the dragon axe's clobbrer special handler.
|
||||
* @author Emperor
|
||||
* @version 1.0
|
||||
* Handles the Dragon axe special attack.
|
||||
* @author Crash
|
||||
*/
|
||||
@Initializable
|
||||
public final class ClobberSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
|
||||
@@ -36,8 +34,14 @@ public final class ClobberSpecialHandler extends MeleeSwingHandler implements Pl
|
||||
*/
|
||||
private static final Graphics GRAPHIC = new Graphics(479, 96);
|
||||
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
switch (identifier) {
|
||||
case "instant_spec":
|
||||
case "ncspec":
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -49,29 +53,13 @@ public final class ClobberSpecialHandler extends MeleeSwingHandler implements Pl
|
||||
|
||||
@Override
|
||||
public int swing(Entity entity, Entity victim, BattleState state) {
|
||||
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
|
||||
Player p = (Player) entity;
|
||||
if (!p.getSettings().drainSpecial(SPECIAL_ENERGY))
|
||||
return -1;
|
||||
}
|
||||
state.setStyle(CombatStyle.MELEE);
|
||||
int hit = 0;
|
||||
if (entity instanceof Player) {
|
||||
entity.asPlayer().sendChat("Chop chop!");
|
||||
}
|
||||
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.05, 1.0)) {
|
||||
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
|
||||
if (hit > 9) {
|
||||
int amount = hit / 10;
|
||||
victim.getSkills().updateLevel(Skills.DEFENCE, -amount, 0);
|
||||
victim.getSkills().updateLevel(Skills.MAGIC, -amount, 0);
|
||||
}
|
||||
}
|
||||
entity.getSkills().updateLevel(Skills.WOODCUTTING, 3);
|
||||
state.setEstimatedHit(hit);
|
||||
return 1;
|
||||
p.sendChat("Chop chop!");
|
||||
p.visualize(ANIMATION, GRAPHIC);
|
||||
p.getSkills().updateLevel(Skills.WOODCUTTING, 3, p.getSkills().getStaticLevel(Skills.WOODCUTTING) + 3);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(Entity entity, Entity victim, BattleState state) {
|
||||
entity.visualize(ANIMATION, GRAPHIC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package core.game.node.entity.combat.special;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
import core.game.node.entity.combat.CombatStyle;
|
||||
import rs09.game.node.entity.combat.handlers.RangeSwingHandler;
|
||||
import core.game.node.entity.impl.Projectile;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the Seercull's special attack which lowers the opponent's magic
|
||||
* level.
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class SeercullSpecialHandler extends RangeSwingHandler implements Plugin<Object> {
|
||||
|
||||
/**
|
||||
* The special energy required.
|
||||
*/
|
||||
private static final int SPECIAL_ENERGY = 100;
|
||||
|
||||
/**
|
||||
* The attack animation.
|
||||
*/
|
||||
private static final Graphics DRAWBACK_GFX = new Graphics(472, 96);
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
CombatStyle.RANGE.getSwingHandler().register(6724, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int swing(Entity entity, Entity victim, BattleState state) {
|
||||
Player p = (Player) entity;
|
||||
configureRangeData(p, state);
|
||||
if (state.getWeapon() == null || !Companion.hasAmmo(entity, state)) {
|
||||
entity.getProperties().getCombatPulse().stop();
|
||||
p.getSettings().toggleSpecialBar();
|
||||
return -1;
|
||||
}
|
||||
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
|
||||
return -1;
|
||||
}
|
||||
int hit = 0;
|
||||
if (isAccurateImpact(entity, victim, CombatStyle.RANGE, 1.05, 1.0)) {
|
||||
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
|
||||
victim.getSkills().updateLevel(Skills.MAGIC, -hit, 0);
|
||||
}
|
||||
Companion.useAmmo(entity, state, victim.getLocation());
|
||||
state.setEstimatedHit(hit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(Entity entity, Entity victim, BattleState state) {
|
||||
victim.graphics(new Graphics(474));
|
||||
int speed = (int) (35 + (entity.getLocation().getDistance(victim.getLocation()) * 10));
|
||||
entity.visualize(entity.getProperties().getAttackAnimation(), DRAWBACK_GFX);
|
||||
Projectile.create(entity, victim, 473, 40, 40, 40, speed, 15, 11).send();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void impact(final Entity entity, final Entity victim, final BattleState state) {
|
||||
int hit = state.getEstimatedHit();
|
||||
victim.getImpactHandler().handleImpact(entity, hit, CombatStyle.RANGE, state);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package core.game.node.entity.combat.special;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
import core.game.node.entity.combat.CombatStyle;
|
||||
import rs09.game.node.entity.combat.handlers.MeleeSwingHandler;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Handles Darklight's special attack, Weaken.
|
||||
* @author Crash, based on Emperor's code for other special attacks
|
||||
*/
|
||||
@Initializable
|
||||
public final class WeakenSpecialHandler extends MeleeSwingHandler implements Plugin<Object> {
|
||||
|
||||
/**
|
||||
* The special energy required.
|
||||
*/
|
||||
private static final int SPECIAL_ENERGY = 50;
|
||||
|
||||
/**
|
||||
* The attack animation.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(2890, Priority.HIGH);
|
||||
|
||||
/**
|
||||
* The graphic.
|
||||
*/
|
||||
private static final Graphics GRAPHIC = new Graphics(483);
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
CombatStyle.MELEE.getSwingHandler().register(6746, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int swing(Entity entity, Entity victim, BattleState state) {
|
||||
if (!((Player) entity).getSettings().drainSpecial(SPECIAL_ENERGY)) {
|
||||
return -1;
|
||||
}
|
||||
state.setStyle(CombatStyle.MELEE);
|
||||
int hit = 0;
|
||||
if (isAccurateImpact(entity, victim, CombatStyle.MELEE, 1.0, 1.0)) {
|
||||
hit = RandomFunction.random(calculateHit(entity, victim, 1.0));
|
||||
}
|
||||
state.setEstimatedHit(hit);
|
||||
if (victim instanceof Player) {
|
||||
((Player) victim).getPacketDispatch().sendMessage("You have been drained.");
|
||||
}
|
||||
int lower = (int) (victim.getSkills().getLevel(Skills.DEFENCE) * 0.05);
|
||||
victim.getSkills().updateLevel(Skills.DEFENCE, -lower, 0);
|
||||
int lower2 = (int) (victim.getSkills().getLevel(Skills.ATTACK) * 0.05);
|
||||
victim.getSkills().updateLevel(Skills.ATTACK, -lower2, 0);
|
||||
int lower3 = (int) (victim.getSkills().getLevel(Skills.STRENGTH) * 0.05);
|
||||
victim.getSkills().updateLevel(Skills.STRENGTH, -lower3, 0);
|
||||
return hit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(Entity entity, Entity victim, BattleState state) {
|
||||
entity.visualize(ANIMATION, GRAPHIC);
|
||||
entity.asPlayer().getAudioManager().send(new Audio(225), true);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package core.game.node.entity.npc;
|
||||
|
||||
import api.events.NPCKillEvent;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
import core.game.content.global.shop.Shop;
|
||||
@@ -442,17 +443,9 @@ public class NPC extends Entity {
|
||||
if(walkRadius == 0)
|
||||
walkRadius = 3;
|
||||
}
|
||||
getPulseManager().run(new MovementPulse(this, getProperties().getSpawnLocation(), Pathfinder.SMART) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
return true;
|
||||
}
|
||||
}, "movement");
|
||||
if (aggressiveHandler != null) {
|
||||
aggressiveHandler.setPauseTicks(walkRadius + 1);
|
||||
}
|
||||
nextWalk = GameWorld.getTicks() + walkRadius + 1;
|
||||
return;
|
||||
}
|
||||
if (aggressive && aggressiveHandler != null && aggressiveHandler.selectTarget()) {
|
||||
return;
|
||||
@@ -527,12 +520,6 @@ public class NPC extends Entity {
|
||||
if (getZoneMonitor().handleDeath(killer)) {
|
||||
return;
|
||||
}
|
||||
if (task != null && killer instanceof Player && ((Player) killer).getSlayer().getTask() == task && ((Player) killer).getSlayer().hasTask()) {
|
||||
((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), this);
|
||||
}
|
||||
if (killer instanceof Player && killer.getAttribute("jobs:id",null) != null) {
|
||||
JobManager.handleDeath(id,(Player) killer);
|
||||
}
|
||||
setRespawnTick(GameWorld.getTicks() + definition.getConfiguration(NPCConfigParser.RESPAWN_DELAY, 17));
|
||||
Player p = !(killer instanceof Player) ? null : (Player) killer;
|
||||
if (p != null) {
|
||||
@@ -543,6 +530,7 @@ public class NPC extends Entity {
|
||||
if (!isRespawn()) {
|
||||
clear();
|
||||
}
|
||||
killer.dispatch(new NPCKillEvent(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,7 +705,19 @@ public class NPC extends Entity {
|
||||
*/
|
||||
protected Location getMovementDestination() {
|
||||
if (!pathBoundMovement || movementPath == null || movementPath.length < 1) {
|
||||
return getProperties().getSpawnLocation().transform(-5 + RandomFunction.random(getWalkRadius()), -5 + RandomFunction.random(getWalkRadius()), 0);
|
||||
Location returnToSpawnLocation = getProperties().getSpawnLocation().transform(-5 + RandomFunction.random(getWalkRadius()), -5 + RandomFunction.random(getWalkRadius()), 0);
|
||||
int dist = (int) Location.getDistance(location, returnToSpawnLocation);
|
||||
int pathLimit = 15;
|
||||
if(dist > pathLimit || dist < -pathLimit)
|
||||
{
|
||||
int diffX = returnToSpawnLocation.getX() - location.getX();
|
||||
int diffY = returnToSpawnLocation.getY() - location.getY();
|
||||
returnToSpawnLocation = location.transform(
|
||||
Math.min(Math.max(-pathLimit, diffX), pathLimit), //Try to path no more than pathLimit and no less than -pathLimit tiles away in the X and Y directions
|
||||
Math.min(Math.max(-pathLimit, diffY), pathLimit),
|
||||
0);
|
||||
}
|
||||
return returnToSpawnLocation;
|
||||
}
|
||||
Location l = movementPath[movementIndex++];
|
||||
if (movementIndex == movementPath.length) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import rs09.game.ai.AIRepository;
|
||||
import rs09.game.ai.general.GeneralBotCreator;
|
||||
import rs09.game.content.global.GlobalKillCounter;
|
||||
import rs09.game.content.global.NPCDropTable;
|
||||
import rs09.game.ge.OfferManager;
|
||||
import rs09.game.ge.GrandExchange;
|
||||
import rs09.game.system.config.ItemConfigParser;
|
||||
import rs09.game.world.repository.Repository;
|
||||
|
||||
@@ -162,7 +162,7 @@ public final class NPCDropTables {
|
||||
}
|
||||
}
|
||||
player.sendMessage(player.getInterfaceManager().isResizable()+"");
|
||||
int price = item.getName().endsWith("charm") ? 100 : OfferManager.getRecommendedPrice(itemId, false);
|
||||
int price = item.getName().endsWith("charm") ? 100 : GrandExchange.getRecommendedPrice(itemId, false);
|
||||
looter.getGlobalData().setLootSharePoints(looter.getGlobalData().getLootSharePoints() - (price) + ((price / looters.size())));
|
||||
looter.sendMessage((player.getInterfaceManager().isResizable() ? "<col=32CD32>" : "<col=009900>") + "You received: " + item.getAmount() + " " + item.getName());
|
||||
for (Player p : looters) {
|
||||
|
||||
@@ -50,18 +50,6 @@ public final class CowNPC extends AbstractNPC {
|
||||
return new CowNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(final Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
if (killer != null) {
|
||||
Player player = killer.asPlayer();
|
||||
// Obtain a cow-hide from a cow in the field north-east of<br><br>Lumbridge
|
||||
if (player.getViewport().getRegion().getId() == 12850 || player.getViewport().getRegion().getId() == 12851) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 81, 397, 955, 1766, 1767, 3309 };
|
||||
|
||||
@@ -50,17 +50,6 @@ public final class DuckNPC extends AbstractNPC {
|
||||
return new DuckNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(final Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
if (killer instanceof Player) {
|
||||
final Player player = killer.asPlayer();
|
||||
if (this.getLocation().withinDistance(new Location(2991,3383,0))) {
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.FALADOR,0, 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 46, 2693, 6113 };
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package core.game.node.entity.npc.other;
|
||||
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
|
||||
/**
|
||||
* Represents the Earth, Fire, Air, and Water Elemental NPCs.
|
||||
* @author afaroutdude
|
||||
*/
|
||||
@Initializable
|
||||
public final class ElementalMonsterNPC extends AbstractNPC {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DuckNPC} {@code Object}.
|
||||
*/
|
||||
public ElementalMonsterNPC() {
|
||||
super(0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DuckNPC} {@code Object}.
|
||||
* @param id the id.
|
||||
* @param location the location.
|
||||
*/
|
||||
public ElementalMonsterNPC(int id, Location location) {
|
||||
super(id, location, true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
return new ElementalMonsterNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(final Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
if (killer instanceof Player) {
|
||||
final Player player = killer.asPlayer();
|
||||
if (this.getLocation().withinDistance(new Location(2719, 9889, 0), 100)) {
|
||||
switch (this.getId()) {
|
||||
case 1019:
|
||||
player.setAttribute("/save:diary:seers:elemental:fire", true);
|
||||
break;
|
||||
case 1020:
|
||||
player.setAttribute("/save:diary:seers:elemental:earth", true);
|
||||
break;
|
||||
case 1021:
|
||||
player.setAttribute("/save:diary:seers:elemental:air", true);
|
||||
break;
|
||||
case 1022:
|
||||
player.setAttribute("/save:diary:seers:elemental:water", true);
|
||||
break;
|
||||
}
|
||||
if (player.getAttribute("diary:seers:elemental:fire", false)
|
||||
&& player.getAttribute("diary:seers:elemental:earth", false)
|
||||
&& player.getAttribute("diary:seers:elemental:air", false)
|
||||
&& player.getAttribute("diary:seers:elemental:water", false)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 1, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 1019, 1020, 1021, 1022 };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package core.game.node.entity.npc.other;
|
||||
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
|
||||
/**
|
||||
* Represents a Jogre NPC.
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class JogreNPC extends AbstractNPC {
|
||||
|
||||
/**
|
||||
* If the jogre is in the pothole zone.
|
||||
*/
|
||||
private boolean inPothole;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code JogreNPC} {@code Object}
|
||||
* @param id the id.
|
||||
* @param location the location.
|
||||
*/
|
||||
public JogreNPC(int id, Location location) {
|
||||
super(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
inPothole = this.getViewport().getRegion().getId() == 11412;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code JogreNPC} {@code Object}
|
||||
*/
|
||||
public JogreNPC() {
|
||||
this(-1, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
return new JogreNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(Entity killer) {
|
||||
if (inPothole && killer.isPlayer()) {
|
||||
Player player = killer.asPlayer();
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.KARAMJA, 0, 9);
|
||||
}
|
||||
super.finalizeDeath(killer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 113 };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package core.game.node.entity.npc.other;
|
||||
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.world.map.Location;
|
||||
|
||||
/**
|
||||
* Represents a rat npc.
|
||||
* @author afaroutdude
|
||||
*/
|
||||
@Initializable
|
||||
public class LumbridgeSwampGiantRatNPC extends AbstractNPC {
|
||||
|
||||
/**
|
||||
* The NPC ids of NPCs using this plugin.
|
||||
*/
|
||||
private static final int[] ID = { 86 };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code RatNPC} {@code Object}.
|
||||
*/
|
||||
public LumbridgeSwampGiantRatNPC() {
|
||||
super(0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code RatNPC} {@code Object}.
|
||||
* @param id the id.
|
||||
* @param location the location.
|
||||
*/
|
||||
private LumbridgeSwampGiantRatNPC(int id, Location location) {
|
||||
super(id, location, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
return new LumbridgeSwampGiantRatNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(final Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
|
||||
// Kill a giant rat in Lumbridge Swamp
|
||||
if (killer instanceof Player && (killer.getViewport().getRegion().getId() == 12593 || killer.getViewport().getRegion().getId() == 12849)) {
|
||||
killer.asPlayer().getAchievementDiaryManager().finishTask(killer.asPlayer(), DiaryType.LUMBRIDGE, 1, 7);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,15 +53,6 @@ public final class MetalDragonNPC extends AbstractNPC {
|
||||
return combatAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(Entity killer) {
|
||||
if (killer.isPlayer() && (killer.getViewport().getRegion().getId() == 10899 || killer.getViewport().getRegion().getId() == 10900)) {
|
||||
Player player = killer.asPlayer();
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.KARAMJA, 2, 9);
|
||||
}
|
||||
super.finalizeDeath(killer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDragonfireProtection(boolean fire) {
|
||||
return 0x2 | 0x4 | 0x8;
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
package core.game.node.entity.npc.other;
|
||||
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.world.map.Location;
|
||||
|
||||
/**
|
||||
* Handles the zombie npc.
|
||||
* @author Vexia
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public class ZombieNPC extends AbstractNPC {
|
||||
|
||||
/**
|
||||
* Constructs the {@code ZombieNPC}
|
||||
*/
|
||||
public ZombieNPC() {
|
||||
super(0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the {@code ZombieNPC}
|
||||
* @param id The id.
|
||||
* @param location The location.
|
||||
*/
|
||||
public ZombieNPC(int id, Location location) {
|
||||
super(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
if (killer instanceof Player) {
|
||||
Player player = killer.asPlayer();
|
||||
// Defeat a zombie in the sewers under the jail
|
||||
if (player.getViewport().getRegion().getId() == 12438 || player.getViewport().getRegion().getId() == 12439) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 1, 18);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
return new ZombieNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] {73, 74};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ import core.game.node.entity.player.link.skillertasks.SkillerTasks;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.skill.construction.HouseManager;
|
||||
import core.game.node.entity.skill.hunter.HunterManager;
|
||||
import core.game.node.entity.skill.slayer.SlayerManager;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerManager;
|
||||
import core.game.node.entity.skill.summoning.familiar.FamiliarManager;
|
||||
import core.game.node.item.GroundItem;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
@@ -77,7 +77,7 @@ import rs09.GlobalStats;
|
||||
import rs09.ServerConstants;
|
||||
import rs09.game.VarpManager;
|
||||
import rs09.game.content.ame.RandomEventManager;
|
||||
import rs09.game.ge.PlayerGrandExchange;
|
||||
import rs09.game.ge.GrandExchangeRecords;
|
||||
import rs09.game.node.entity.combat.CombatSwingHandler;
|
||||
import rs09.game.node.entity.combat.equipment.EquipmentDegrader;
|
||||
import rs09.game.node.entity.player.info.login.PlayerSaver;
|
||||
@@ -86,7 +86,6 @@ import rs09.game.node.entity.state.newsys.State;
|
||||
import rs09.game.node.entity.state.newsys.StateRepository;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import rs09.game.world.GameWorld;
|
||||
import rs09.game.world.repository.DisconnectionQueue;
|
||||
import rs09.game.world.repository.Repository;
|
||||
import rs09.game.world.update.MapChunkRenderer;
|
||||
import rs09.game.world.update.NPCRenderer;
|
||||
@@ -251,7 +250,7 @@ public class Player extends Entity {
|
||||
/**
|
||||
* The new grand exchange interface manager.
|
||||
*/
|
||||
private final PlayerGrandExchange playerGrandExchange = new PlayerGrandExchange(this);
|
||||
public final GrandExchangeRecords exchangeRecords = new GrandExchangeRecords(this);
|
||||
|
||||
/**
|
||||
* The familiar manager.
|
||||
@@ -398,6 +397,8 @@ public class Player extends Entity {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if(!artificial)
|
||||
SystemLogger.logInfo(getUsername() + " initialising...");
|
||||
if (!artificial) {
|
||||
getProperties().setSpawnLocation(ServerConstants.HOME_LOCATION);
|
||||
getDetails().getSession().setObject(this);
|
||||
@@ -1445,7 +1446,7 @@ public class Player extends Entity {
|
||||
|
||||
public BrawlingGlovesManager getBrawlingGlovesManager() { return brawlingGlovesManager;}
|
||||
|
||||
public PlayerGrandExchange getPlayerGrandExchange() { return playerGrandExchange; }
|
||||
public GrandExchangeRecords getExchangeRecords() { return exchangeRecords; }
|
||||
|
||||
public boolean hasActiveState(String key){
|
||||
State state = states.get(key);
|
||||
|
||||
+10
-1
@@ -80,6 +80,11 @@ public final class LoginConfiguration {
|
||||
} else {
|
||||
configureGameWorld(player);
|
||||
}
|
||||
|
||||
if(!player.isArtificial())
|
||||
{
|
||||
GameWorld.getLoginListeners().forEach((listener) -> listener.login(player));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,6 +208,8 @@ public final class LoginConfiguration {
|
||||
* @param player the player.
|
||||
*/
|
||||
public static final void config(final Player player) {
|
||||
if(!player.isArtificial())
|
||||
SystemLogger.logInfo("configuring player " + player.getUsername());
|
||||
player.getInventory().refresh();
|
||||
player.getEquipment().refresh();
|
||||
player.getSkills().refresh();
|
||||
@@ -212,7 +219,7 @@ public final class LoginConfiguration {
|
||||
player.getPacketDispatch().sendRunEnergy();
|
||||
player.getFamiliarManager().login();
|
||||
player.getInterfaceManager().openDefaultTabs();
|
||||
player.getPlayerGrandExchange().init();
|
||||
player.getExchangeRecords().init();
|
||||
player.getPacketDispatch().sendString("Friends List - World " + GameWorld.getSettings().getWorldId(), 550, 3);
|
||||
player.getConfigManager().init();
|
||||
player.getAntiMacroHandler().init();
|
||||
@@ -221,6 +228,8 @@ public final class LoginConfiguration {
|
||||
player.getInterfaceManager().close();
|
||||
player.getEmoteManager().refresh();
|
||||
player.getInterfaceManager().openInfoBars();
|
||||
if(!player.isArtificial())
|
||||
SystemLogger.logInfo("finished configuring player " + player.getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class PlayerSQLManager {
|
||||
table.getColumn("credits").updateValue(player.getDetails().credits);
|
||||
table.getColumn("bank").updateValue(player.getBank().format());
|
||||
table.getColumn("lastLogin").updateValue(player.getDetails().getLastLogin());
|
||||
table.getColumn("ge").updateValue(player.getPlayerGrandExchange().format());
|
||||
table.getColumn("ge").updateValue(player.getExchangeRecords().format());
|
||||
table.getColumn("inventory").updateValue(player.getInventory().format());
|
||||
table.getColumn("equipment").updateValue(player.getEquipment().format());
|
||||
table.getColumn("netWorth").updateValue(player.getMonitor().getNetworth());
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package core.game.node.entity.player.link;
|
||||
|
||||
import core.cache.misc.buffer.ByteBufferUtils;
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
import rs09.game.interaction.inter.ge.StockMarket;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.ChildPositionContext;
|
||||
@@ -14,7 +14,6 @@ import core.net.packet.out.StringPacket;
|
||||
import core.tools.RandomFunction;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -203,9 +202,9 @@ public class BankPinManager {
|
||||
player.getBank().open();
|
||||
}
|
||||
} else if (buttonId == 3) {
|
||||
player.getPlayerGrandExchange().openCollectionBox();
|
||||
player.getExchangeRecords().openCollectionBox();
|
||||
} else if (buttonId == 4) {
|
||||
player.getPlayerGrandExchange().open();
|
||||
StockMarket.openFor(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.quest.Quest;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
@@ -197,7 +198,7 @@ public class TeleportManager {
|
||||
public boolean pulse() {
|
||||
if (delay == 0) {
|
||||
if (entity instanceof Player) {
|
||||
entity.asPlayer().getAudioManager().send(200);
|
||||
entity.asPlayer().getAudioManager().send(new Audio(200), true);
|
||||
}
|
||||
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
|
||||
entity.graphics(new Graphics(getSettings().getStartGfx()));
|
||||
@@ -206,7 +207,7 @@ public class TeleportManager {
|
||||
fireRandom(entity, location);
|
||||
} else if (delay == 4) {
|
||||
if (entity instanceof Player) {
|
||||
entity.asPlayer().getAudioManager().send(201);
|
||||
entity.asPlayer().getAudioManager().send(new Audio(201), true);
|
||||
}
|
||||
entity.getAnimator().forceAnimation(new Animation(getSettings().getEndEmote(), Priority.HIGH));
|
||||
entity.graphics(new Graphics(getSettings().getEndGfx()));
|
||||
|
||||
@@ -202,7 +202,7 @@ public final class HouseManager {
|
||||
player.getConfigManager().set(261, buildingMode);
|
||||
player.getConfigManager().set(262, getRoomAmount());
|
||||
player.getAudioManager().send(new Audio(984));
|
||||
// player.getMusicPlayer().unlock(454, true);
|
||||
player.getMusicPlayer().unlock(454, true);
|
||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import core.game.content.dialogue.DialogueInterpreter;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
@@ -78,7 +79,7 @@ public class MountedGloryPlugin extends OptionHandler {
|
||||
}
|
||||
player.lock();
|
||||
player.visualize(ANIMATION, GRAPHICS);
|
||||
player.getAudioManager().send(200);
|
||||
player.getAudioManager().send(new Audio(200), true);
|
||||
player.getImpactHandler().setDisabledTicks(4);
|
||||
GameWorld.getPulser().submit(new Pulse(4, player) {
|
||||
@Override
|
||||
|
||||
@@ -90,7 +90,12 @@ public enum CookableItems {
|
||||
//Miscellaneous
|
||||
RAW_OOMLIE(Items.RAW_OOMLIE_2337, 0, Items.BURNT_OOMLIE_2426, 50, 0, 999,0,0), // always burns
|
||||
OOMLIE_WRAP(Items.COOKED_OOMLIE_WRAP_2343, Items.WRAPPED_OOMLIE_2341, Items.BURNT_OOMLIE_WRAP_2345, 50, 110, 999,0,0),
|
||||
SEAWEED(Items.SEAWEED_401,0,Items.SODA_ASH_1781,0,0,999,0,0);
|
||||
SEAWEED(Items.SEAWEED_401,0,Items.SODA_ASH_1781,0,0,999,0,0),
|
||||
/**
|
||||
* Sinew gets overridden by BEEF in this enum, due to values being looked up by the items RAW id.
|
||||
* This gets corrected in {@link core.game.node.entity.skill.cooking.SinewCookingPulse}
|
||||
*/
|
||||
SINEW(Items.SINEW_9436,Items.RAW_BEEF_2132,Items.SINEW_9436,0,3,0,0,0);
|
||||
|
||||
public final static HashMap<Integer,CookableItems>cookingMap = new HashMap<>();
|
||||
public final static HashMap<Integer, CookableItems>intentionalBurnMap = new HashMap<>();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
|
||||
/**
|
||||
* Fixes the half assed previous implementation of cooking Sinew.
|
||||
* @author Woah
|
||||
*/
|
||||
public class SinewCookingPulse extends StandardCookingPulse {
|
||||
|
||||
public SinewCookingPulse(Player player, Scenery object, int initial, int product, int amount) {
|
||||
super(player, object, initial, product, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
properties = CookableItems.SINEW;
|
||||
return super.checkRequirements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBurned(Player player, Scenery object, int food) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(Item food, Item product, boolean burned) {
|
||||
return "You dry a piece of beef and extract the sinew.";
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ public class StandardCookingPulse extends Pulse {
|
||||
private Player player;
|
||||
private double experience;
|
||||
private boolean burned = false;
|
||||
public CookableItems properties;
|
||||
|
||||
public StandardCookingPulse(Player player, Scenery object, int initial, int product, int amount) {
|
||||
this.player = player;
|
||||
@@ -43,6 +44,7 @@ public class StandardCookingPulse extends Pulse {
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
properties = CookableItems.forId(initial);
|
||||
if (checkRequirements()) {
|
||||
super.start();
|
||||
cook(player, object, CookableItems.cookingMap.get(initial) != null && isBurned(player, object, initial), initial, product);
|
||||
@@ -63,7 +65,6 @@ public class StandardCookingPulse extends Pulse {
|
||||
}
|
||||
|
||||
public boolean checkRequirements() {
|
||||
CookableItems properties = CookableItems.forId(initial);
|
||||
this.level = 1;
|
||||
this.experience = 0;
|
||||
if (properties != null) {
|
||||
@@ -214,11 +215,8 @@ public class StandardCookingPulse extends Pulse {
|
||||
if (food.getId() == Items.RAW_OOMLIE_2337) {
|
||||
return "The meat is far too delicate to cook like this. Perhaps you should wrap something around it to protect it from the heat.";
|
||||
}
|
||||
switch (product.getId()) {
|
||||
case Items.SINEW_9436:
|
||||
return "You dry the meat into sinew.";
|
||||
case Items.SODA_ASH_1781:
|
||||
return "You burn the seaweed into soda ash.";
|
||||
if (product.getId() == Items.SODA_ASH_1781) {
|
||||
return "You burn the seaweed into soda ash.";
|
||||
}
|
||||
if (CookableItems.intentionalBurn(food.getId())) {
|
||||
return "You deliberately burn the perfectly good piece of meat.";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package core.game.node.entity.skill.firemaking;
|
||||
|
||||
import api.events.LitFireEvent;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.game.content.quest.tutorials.tutorialisland.TutorialSession;
|
||||
import core.game.content.quest.tutorials.tutorialisland.TutorialStage;
|
||||
@@ -140,20 +141,8 @@ public final class FireMakingPulse extends SkillPulse<Item> {
|
||||
|
||||
int playerRegion = player.getViewport().getRegion().getId();
|
||||
|
||||
if (fire == Log.MAGIC && playerRegion == 10806) {
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.SEERS_VILLAGE,2, 5);
|
||||
}
|
||||
// Light a campfire from normal logs in Lumbridge Swamp
|
||||
if (fire == Log.NORMAL && (playerRegion == 12593 || playerRegion == 12849)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 1, 9);
|
||||
}
|
||||
// Light a willow log fire in Lumbridge Castle courtyard
|
||||
if (fire == Log.WILLOW
|
||||
&& new ZoneBorders(3216, 3207, 3225, 3233, 0).insideBorder(player)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 2, 3);
|
||||
}
|
||||
|
||||
setLastFire();
|
||||
player.dispatch(new LitFireEvent(fire.getLogId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum Fish {
|
||||
LOBSTER(new Item(377), 40, 90, 0.16, 0.375),
|
||||
BASS(new Item(363), 46, 100, 0.078, 0.16),
|
||||
SWORDFISH(new Item(371), 50, 100, 0.105, 0.191),
|
||||
LAVA_EEL(new Item(2148), 53, 100, 0.227, 0.379),
|
||||
LAVA_EEL(new Item(2148), 53, 30, 0.227, 0.379),
|
||||
MONKFISH(new Item(7944), 62, 120, 0.293, 0.356),
|
||||
KARAMBWAN(new Item(3142), 65, 105, 0.414, 0.629),
|
||||
SHARK(new Item(383), 76, 110, 0.121, 0.16),
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class StringPulse extends SkillPulse<Item> {
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
if (getDelay() == 1) {
|
||||
setDelay(bow.string == 1777 ? 2 : 1);
|
||||
setDelay(2);
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.FLETCHING) < bow.level) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + bow.level + " to string this bow.");
|
||||
|
||||
+2
-50
@@ -1,5 +1,6 @@
|
||||
package core.game.node.entity.skill.gather.woodcutting;
|
||||
|
||||
import api.events.ResourceGatheredEvent;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.game.content.dialogue.FacialExpression;
|
||||
@@ -159,6 +160,7 @@ public class WoodcuttingSkillPulse extends Pulse {
|
||||
}
|
||||
//give the reward
|
||||
player.getInventory().add(new Item(reward, rewardAmount));
|
||||
player.dispatch(new ResourceGatheredEvent(reward, rewardAmount, node));
|
||||
int cutLogs = player.getAttribute(STATS_BASE + ":" + STATS_LOGS,0);
|
||||
player.setAttribute("/save:" + STATS_BASE + ":" + STATS_LOGS,++cutLogs);
|
||||
|
||||
@@ -174,7 +176,6 @@ public class WoodcuttingSkillPulse extends Pulse {
|
||||
}
|
||||
}
|
||||
|
||||
applyAchievementTask(reward); // apply achievements
|
||||
}
|
||||
// Tutorial stuff, maybe?
|
||||
if (tutorialStage == 7) {
|
||||
@@ -261,55 +262,6 @@ public class WoodcuttingSkillPulse extends Pulse {
|
||||
return reward;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the has completed any achievements from their diary
|
||||
*/
|
||||
private void applyAchievementTask(int reward) {
|
||||
// Cut a log from a teak tree
|
||||
if (reward == Items.TEAK_LOGS_6333) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.KARAMJA, 1, 7);
|
||||
}
|
||||
// Cut a log from a mahogany tree
|
||||
if (reward == Items.MAHOGANY_LOGS_6332) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.KARAMJA, 1, 8);
|
||||
}
|
||||
|
||||
int playerRegion = player.getViewport().getRegion().getId();
|
||||
|
||||
// Chop down a dying tree in the Lumber Yard
|
||||
if (node.getId() == 24168 && playerRegion == 13110) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 6);
|
||||
}
|
||||
if (resource == WoodcuttingNode.YEW && playerRegion == 10806) {
|
||||
if (!player.getAchievementDiaryManager().hasCompletedTask(DiaryType.SEERS_VILLAGE, 2, 1)) {
|
||||
player.setAttribute("/save:diary:seers:cut-yew", player.getAttribute("diary:seers:cut-yew", 0) + 1);
|
||||
}
|
||||
if (player.getAttribute("diary:seers:cut-yew", 0) >= 5) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* if (resource.isFarming()) {
|
||||
PatchWrapper tree = player.getFarmingManager().getPatchWrapper(node.getWrapper().getId());
|
||||
if (node.getId() == 8389
|
||||
&& node.getLocation().equals(3003, 3372, 0)
|
||||
&& Trees.forNode(tree.getNode()) != null
|
||||
&& (Trees.forNode(tree.getNode()) == Trees.YEW || Trees.forNode(tree.getNode()) == Trees.MAGIC)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.FALADOR, 2, 3);
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Cut down a dead tree in Lumbridge Swamp
|
||||
if (resource.name().toLowerCase().startsWith("dead") && (playerRegion == 12593 || playerRegion == 12849)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 1, 8);
|
||||
}
|
||||
|
||||
// Cut a willow tree, east of Lumbridge Castle
|
||||
if (resource.name().toLowerCase().startsWith("willow") && playerRegion == 12850) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 2, 6);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player gets rewarded.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package core.game.node.entity.skill.magic;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -12,7 +14,7 @@ public enum MagicStaff {
|
||||
/**
|
||||
* Represents the fire rune staves.
|
||||
*/
|
||||
FIRE_RUNE(554, 1387, 1393, 1401, 3053, 3055, 3056, 11736, 11738),
|
||||
FIRE_RUNE(554, 1387, 1393, 1401, 3053, 3054, 3055, 3056, 11736, 11738),
|
||||
|
||||
/**
|
||||
* Represents the water rune staves.
|
||||
|
||||
@@ -9,6 +9,7 @@ import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import rs09.game.node.entity.combat.CombatSwingHandler;
|
||||
import rs09.game.node.entity.combat.handlers.MagicSwingHandler;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
|
||||
/**
|
||||
* Handles the aberrant spectre npc.
|
||||
|
||||
@@ -11,6 +11,7 @@ import rs09.game.node.entity.combat.handlers.MeleeSwingHandler;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
|
||||
@@ -11,6 +11,7 @@ import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.RandomFunction;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
|
||||
/**
|
||||
* Handles the Cave Horrors on Mos'le Harmless. You technically do not need a witchwood icon to fight them.
|
||||
|
||||
@@ -11,6 +11,7 @@ import rs09.game.node.entity.combat.handlers.MeleeSwingHandler;
|
||||
import core.game.node.entity.npc.AbstractNPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.Location;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
|
||||
/**
|
||||
* Handles the dust devil npc.
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class KuraskNPC extends AbstractNPC {
|
||||
boolean effective = false;
|
||||
if (state.getAttacker() instanceof Player) {
|
||||
final Player player = (Player) state.getAttacker();
|
||||
effective = new SlayerUtils(player).hasBroadWeaponEquipped(state);
|
||||
effective = SlayerUtils.hasBroadWeaponEquipped(player, state);
|
||||
}
|
||||
if (!effective) {
|
||||
state.setEstimatedHit(0);
|
||||
|
||||
@@ -218,9 +218,9 @@ public enum Master {
|
||||
}
|
||||
|
||||
int npc_id,required_combat,required_slayer;
|
||||
int[] assignment_range;
|
||||
public int[] assignment_range;
|
||||
int[] streakPoints;
|
||||
List<Task> tasks;
|
||||
public List<Task> tasks;
|
||||
Master(int npc_id, int required_combat, int required_slayer, int[] assignment_range, int[] streakPoints, Task... tasks) {
|
||||
this.npc_id = npc_id;
|
||||
this.required_combat = required_combat;
|
||||
@@ -251,11 +251,11 @@ public enum Master {
|
||||
}
|
||||
|
||||
public static class Task{
|
||||
Tasks task;
|
||||
Integer weight;
|
||||
public Tasks task;
|
||||
public Integer weight;
|
||||
Task(Tasks task, Integer weight){
|
||||
this.task = task;
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.BattleState;
|
||||
import rs09.game.node.entity.combat.handlers.MeleeSwingHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
|
||||
/**
|
||||
* The swing handler for an npc that requires a mirror shield with its victim.
|
||||
|
||||
@@ -84,15 +84,6 @@ public final class SkeletalWyvernNPC extends AbstractNPC {
|
||||
return COMBAT_HANDLER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(final Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
if (killer instanceof Player) {
|
||||
final Player player = killer.asPlayer();
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.FALADOR, 2, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return Tasks.SKELETAL_WYVERN.getNpcs();
|
||||
|
||||
@@ -1,347 +0,0 @@
|
||||
package core.game.node.entity.skill.slayer;
|
||||
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.tools.RandomFunction;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerFlags;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Manages the players slayer task.
|
||||
* @author Vexia
|
||||
*
|
||||
*/
|
||||
public final class SlayerManager {
|
||||
|
||||
/**
|
||||
* The player instance.
|
||||
*/
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* The player's slayer flags
|
||||
*/
|
||||
public final SlayerFlags flags;
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code SlayerManager} {@Code Object}
|
||||
* @param player The player.
|
||||
*/
|
||||
public SlayerManager(Player player) {
|
||||
this.player = player;
|
||||
this.flags = new SlayerFlags(player);
|
||||
}
|
||||
|
||||
public void parse(JSONObject slayerData){
|
||||
Object m = slayerData.get("master");
|
||||
if(m != null) {
|
||||
flags.setMaster(Master.forId(Integer.parseInt(m.toString())));
|
||||
}
|
||||
Object t = slayerData.get("taskId");
|
||||
if(t != null)
|
||||
flags.setTask(Tasks.values()[Integer.parseInt(t.toString())]);
|
||||
Object a = slayerData.get("taskAmount");
|
||||
if(a != null)
|
||||
flags.setTaskAmount(Integer.parseInt(a.toString()));
|
||||
Object points = slayerData.get("points");
|
||||
if(points != null){
|
||||
flags.setPoints(Integer.parseInt(points.toString()));
|
||||
}
|
||||
Object taskStreak = slayerData.get("taskStreak");
|
||||
if(taskStreak != null){
|
||||
flags.setTaskStreak(Integer.parseInt(taskStreak.toString()));
|
||||
}
|
||||
Object la = slayerData.get("learned_rewards");
|
||||
if(la != null) {
|
||||
JSONArray learnedArray = (JSONArray) slayerData.get("learned_rewards");
|
||||
for (int i = 0; i < learnedArray.size(); i++) {
|
||||
boolean unlocked = (boolean) learnedArray.get(i);
|
||||
switch(i){
|
||||
case 0:
|
||||
if(unlocked) flags.unlockBroads();
|
||||
break;
|
||||
case 1:
|
||||
if(unlocked) flags.unlockRing();
|
||||
break;
|
||||
case 2:
|
||||
if(unlocked) flags.unlockHelm();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONArray removedTasks = (JSONArray) slayerData.get("removedTasks");
|
||||
if(removedTasks != null){
|
||||
for(int i = 0; i < removedTasks.size(); i++){
|
||||
flags.getRemoved().add(Tasks.values()[Integer.parseInt(removedTasks.get(i).toString())]);
|
||||
}
|
||||
}
|
||||
Object completedTasks = slayerData.get("totalTasks").toString();
|
||||
if(completedTasks != null) flags.setCompletedTasks(Integer.parseInt(completedTasks.toString()));
|
||||
if(flags.getCompletedTasks() >= 4) flags.flagCanEarnPoints();
|
||||
|
||||
//New system parsing
|
||||
if(slayerData.containsKey("equipmentFlags"))
|
||||
flags.setEquipmentFlags(Integer.parseInt(slayerData.get("equipmentFlags").toString()));
|
||||
if(slayerData.containsKey("taskFlags"))
|
||||
flags.setTaskFlags(Integer.parseInt(slayerData.get("taskFlags").toString()));
|
||||
if(slayerData.containsKey("rewardFlags"))
|
||||
flags.setRewardFlags(Integer.parseInt(slayerData.get("rewardFlags").toString()));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a hunted creature dies.
|
||||
* @param player The player.
|
||||
* @param npc The NPC. You're currently
|
||||
*/
|
||||
public void finalizeDeath(Player player, NPC npc) {
|
||||
if(hasTask()) {
|
||||
player.getSkills().addExperience(Skills.SLAYER, npc.getSkills().getMaximumLifepoints());
|
||||
decrementAmount(1);
|
||||
if(!hasTask()){
|
||||
flags.setTaskStreak(flags.getTaskStreak() + 1);
|
||||
flags.setCompletedTasks(flags.getCompletedTasks() + 1);
|
||||
if ((flags.getCompletedTasks() > 4 || flags.canEarnPoints() ) && flags.getMaster() != Master.TURAEL && flags.getPoints() < 64000) {
|
||||
int points = flags.getMaster().getTaskPoints()[0];
|
||||
if (flags.getTaskStreak() % 50 == 0) {
|
||||
points = flags.getMaster().getTaskPoints()[2];
|
||||
} else if (flags.getTaskStreak() % 10 == 0) {
|
||||
points = flags.getMaster().getTaskPoints()[1];
|
||||
}
|
||||
flags.incrementPoints(points);
|
||||
if (flags.getPoints() > 64000) {
|
||||
flags.setPoints(64000);
|
||||
}
|
||||
player.sendMessages("You've completed " + flags.getTaskStreak() + " tasks in a row and received " + points + " points, with a total of " + flags.getPoints(),"You have completed " + flags.getCompletedTasks() + " tasks in total. Return to a Slayer master.");
|
||||
} else if(flags.getCompletedTasks() == 4){
|
||||
player.sendMessage("You've completed your task; you will start gaining points on your next task!");
|
||||
flags.flagCanEarnPoints();
|
||||
} else if (flags.getMaster() == Master.TURAEL){
|
||||
player.sendMessages("You've completed your task; Tasks from Turael do not award points.", "Return to a Slayer master.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessages("You've completed your task; Complete " + (4 - flags.getCompletedTasks()) + " more task(s) to start gaining points.", "Return to a Slayer master.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns a task to the manager.
|
||||
* @param task the task.
|
||||
* @param master the master.
|
||||
*/
|
||||
public void assign(Tasks task, final Master master) {
|
||||
setMaster(master);
|
||||
setTask(task);
|
||||
setAmount(getRandomAmount(master.assignment_range));
|
||||
if (master == Master.DURADEL) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.KARAMJA, 2, 8);
|
||||
} else if (master == Master.VANNAKA) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 1, 14);
|
||||
}
|
||||
getPlayer().varpManager.get(2502).setVarbit(0, flags.getTaskFlags() >> 4).send(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to assign a new task for a player.
|
||||
* @param master the master to give the task.
|
||||
*/
|
||||
public void generate(Master master) {
|
||||
final List<Master.Task> tasks = new ArrayList<>(10);
|
||||
final int[] taskWeightSum = {0};
|
||||
master.tasks.stream().filter(task -> canBeAssigned(task.task) && task.task.combatCheck <= player.getProperties().getCurrentCombatLevel()).forEach(task -> {
|
||||
taskWeightSum[0] += task.weight;
|
||||
tasks.add(task);
|
||||
});
|
||||
Collections.shuffle(tasks, RandomFunction.RANDOM);
|
||||
int rnd = RandomFunction.random(taskWeightSum[0]);
|
||||
for(Master.Task task : tasks){
|
||||
if(rnd < task.weight)
|
||||
assign(task.task,master);
|
||||
rnd -= task.weight;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canBeAssigned(Tasks task){
|
||||
return player.getSkills().getLevel(Skills.SLAYER) >= task.levelReq && !flags.getRemoved().contains(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the task.
|
||||
*/
|
||||
public void clear() {
|
||||
setAmount(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a random amount.
|
||||
* @param ranges the ranges.
|
||||
* @return the amt.
|
||||
*/
|
||||
private int getRandomAmount(int[] ranges) {
|
||||
return RandomFunction.random(ranges[0], ranges[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the task name.
|
||||
* @return the name.
|
||||
*/
|
||||
public String getTaskName() {
|
||||
Tasks task = flags.getTask();
|
||||
if (task.getNpcs() == null) {
|
||||
return "no npcs report me";
|
||||
}
|
||||
if (task.getNpcs().length < 1) {
|
||||
return "npc length too small report me";
|
||||
}
|
||||
return NPCDefinition.forId(task.getNpcs()[0]).getName().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the task.
|
||||
* @return The task.
|
||||
*/
|
||||
public Tasks getTask() {
|
||||
return flags.getTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the task.
|
||||
* @param task The task to set.
|
||||
*/
|
||||
public void setTask(Tasks task){
|
||||
flags.setTask(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player.
|
||||
* @return The player.
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the master.
|
||||
* @return The master.
|
||||
*/
|
||||
public Master getMaster() {
|
||||
return flags.getMaster();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the master.
|
||||
* @param master The master to set.
|
||||
*/
|
||||
public void setMaster(Master master) {
|
||||
flags.setMaster(master);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a <b>Player</b> contains a task.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasTask() {
|
||||
return getAmount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to check if the task is completed.
|
||||
* @return <code>True</code> if so.
|
||||
*/
|
||||
public boolean isCompleted() {
|
||||
return flags.getTaskAmount() <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount.
|
||||
* @return The amount.
|
||||
*/
|
||||
public int getAmount() {
|
||||
return flags.getTaskAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount.
|
||||
* @param amount The amount to set.
|
||||
*/
|
||||
public void setAmount(int amount) {
|
||||
flags.setTaskAmount(amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to decrement an amount.
|
||||
* @param amount the amount.
|
||||
*/
|
||||
public void decrementAmount(int amount) {
|
||||
flags.decrementTaskAmount(amount);
|
||||
player.varpManager.get(2502).setVarbit(0, flags.getTaskFlags() >> 4).send(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to check if the player has started slayer.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasStarted() {
|
||||
return flags.getCompletedTasks() > 0 || flags.getTaskAmount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slayerPoints.
|
||||
* @return the slayerPoints.
|
||||
*/
|
||||
public int getSlayerPoints() {
|
||||
return flags.getPoints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the slayerPoints.
|
||||
* @param slayerPoints the slayerPoints to set
|
||||
*/
|
||||
public void setSlayerPoints(int slayerPoints) {
|
||||
flags.setPoints(slayerPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the taskCount.
|
||||
* @return the taskCount.
|
||||
*/
|
||||
public int getTaskCount() {
|
||||
return flags.getTaskStreak();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the taskCount.
|
||||
* @param taskCount the taskCount to set
|
||||
*/
|
||||
public void setTaskCount(int taskCount) {
|
||||
flags.setTaskStreak(taskCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the removed.
|
||||
* @return the removed.
|
||||
*/
|
||||
public List<Tasks> getRemoved() {
|
||||
return flags.getRemoved();
|
||||
}
|
||||
|
||||
public int getTotalTasks() {return flags.getCompletedTasks();}
|
||||
|
||||
public boolean isCanEarnPoints(){
|
||||
return flags.canEarnPoints();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -505,7 +505,7 @@ public final class SlayerMasterDialogue extends DialoguePlugin {
|
||||
interpreter.sendDialogues(master.getNpc(), getExpression(master), "You're still hunting something. But let me check something...");
|
||||
stage = 847;
|
||||
} else {
|
||||
player.getSlayer().setTaskCount(0);
|
||||
player.getSlayer().flags.setTaskStreak(0);
|
||||
player.getSlayer().generate(master);
|
||||
if (player.getSlayer().getTask() == Tasks.JAD) {
|
||||
interpreter.sendDialogues(master.getNpc(), getExpression(master), "Excellent, you're doing great. Your new task is to", "defeat the almighty TzTok-Jad.");
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class TurothNPC extends AbstractNPC {
|
||||
boolean effective = false;
|
||||
if (state.getAttacker() instanceof Player) {
|
||||
final Player player = (Player) state.getAttacker();
|
||||
effective = new SlayerUtils(player).hasBroadWeaponEquipped(state);
|
||||
effective = SlayerUtils.hasBroadWeaponEquipped(player, state);
|
||||
}
|
||||
if (!effective) {
|
||||
state.setEstimatedHit(0);
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package core.game.node.entity.skill.slayer.dungeon;
|
||||
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
import core.game.interaction.Option;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
|
||||
@@ -2,7 +2,7 @@ package core.game.node.entity.skill.slayer.dungeon;
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
|
||||
@@ -18,8 +18,8 @@ public enum Stall {
|
||||
SILK_STALL(new Integer[]{34383, 2560}, new Integer[] { 34381, 634 }, 20, new Item[]{new Item(950, 1)}, 24, 13,"silk"),
|
||||
WINE_STALL(new Integer[]{2046}, new Integer[] { 634 }, 22, new Item[]{new Item(1935, 1), new Item(1937, 1), new Item(1993, 1), new Item(7919, 1)}, 27, 27,"wine"), //OBJECT MISSING IN CACHE
|
||||
MARKET_SEED_STALL(new Integer[]{7053}, new Integer[] { 634 }, 27, new Item[]{new Item(5096, 1), new Item(5097, 1), new Item(5101, 1), new Item(5318, 1), new Item(5319, 1), new Item(5324, 1)}, 10, 19,"seeds"),
|
||||
FUR_STALL(new Integer[]{34387, 2563}, new Integer[] { 34381, 634 }, 35, new Item[]{new Item(6814, 1), new Item(958, 1)}, 36, 25,"fur"),
|
||||
FISH_STALL(new Integer[]{4277, 4705, 4707}, new Integer[] { 634 }, 42, new Item[]{new Item(331, 1), new Item(359, 1), new Item(377, 1)}, 42, 27,"fish"),
|
||||
FUR_STALL(new Integer[]{ 34387, 2563, 4278}, new Integer[] { 34381, 634, 634 }, 35, new Item[]{new Item(6814, 1), new Item(958, 1)}, 36, 25,"fur"),
|
||||
FISH_STALL(new Integer[]{ 4277, 4705, 4707 }, new Integer[] { 634, 634, 634 }, 42, new Item[]{new Item(331, 1), new Item(359, 1), new Item(377, 1)}, 42, 27,"fish"),
|
||||
CROSSBOW_STALL(new Integer[]{17031}, new Integer[] { 6984 }, 49, new Item[]{new Item(877, 3), new Item(9420, 1), new Item(9440, 1)}, 52, 19,"equipment"),
|
||||
SILVER_STALL(new Integer[]{2565, 6164, 34382}, new Integer[] { 634, 6984, 34381}, 50, new Item[]{new Item(442, 1)}, 54, 50,"jewellery"),
|
||||
SPICE_STALL(new Integer[]{34386, 6166}, new Integer[] { 34381, 6984 }, 65, new Item[]{new Item(2007, 1)}, 81, 134,"spices"),
|
||||
|
||||
@@ -15,6 +15,8 @@ import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.RandomFunction;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
import static api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Represents the pulse used to thieve a stall.
|
||||
* @author 'Vexia
|
||||
@@ -70,6 +72,15 @@ public final class StallThiefPulse extends SkillPulse<Scenery> {
|
||||
player.getPacketDispatch().sendMessage("You don't have enough inventory space.");
|
||||
return false;
|
||||
}
|
||||
if (player.getLocation().isInRegion(10553) && !isQuestComplete(player, "Fremennik Trials") && stall.full_ids.contains(4278)) {
|
||||
sendDialogue(player, "The fur trader is staring at you suspiciously. You cannot steal from his stall while he distrusts you.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.getLocation().isInRegion(10553) && !isQuestComplete(player, "Fremennik Trials") && stall.full_ids.contains(4277)) {
|
||||
sendDialogue(player, "The fishmonger is staring at you suspiciously. You cannot steal from his stall while he distrusts you.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,7 +111,7 @@ public final class StallThiefPulse extends SkillPulse<Scenery> {
|
||||
player.getSavedData().getGlobalData().setSilkSteal(System.currentTimeMillis() + 1800000);
|
||||
}
|
||||
if (node.isActive()) {
|
||||
SceneryBuilder.replace(((Scenery) node), ((Scenery) node).transform(stall.getEmpty(node.getId())), stall.getDelay());
|
||||
SceneryBuilder.replace(node, node.transform(stall.getEmpty(node.getId())), stall.getDelay());
|
||||
}
|
||||
final Item item = stall.getRandomLoot();
|
||||
player.getInventory().add(item);
|
||||
|
||||
@@ -8,7 +8,6 @@ import core.game.interaction.Interaction;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.combat.equipment.DegradableEquipment;
|
||||
import rs09.game.ge.OfferManager;
|
||||
|
||||
/**
|
||||
* Represents an item.
|
||||
|
||||
@@ -8,7 +8,6 @@ import rs09.Server;
|
||||
import rs09.ServerConstants;
|
||||
import rs09.ServerStore;
|
||||
import rs09.game.content.global.GlobalKillCounter;
|
||||
import rs09.game.ge.OfferManager;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import rs09.game.world.repository.Repository;
|
||||
|
||||
@@ -94,7 +93,6 @@ public final class SystemTermination {
|
||||
Repository.getDisconnectionQueue().update();
|
||||
GlobalKillCounter.save();
|
||||
GrandExchangeDatabase.save();
|
||||
OfferManager.save();
|
||||
SystemLogger.flushLogs();
|
||||
SystemLogger.logInfo("[SystemTerminator] Saved Grand Exchange databases!");
|
||||
Repository.getDisconnectionQueue().clear();
|
||||
|
||||
@@ -287,6 +287,23 @@ public final class Location extends Node {
|
||||
return locs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a square of 3 x 3 tiles as an ArrayList<Location>
|
||||
*/
|
||||
public ArrayList<Location> get3x3Tiles() {
|
||||
ArrayList<Location> locs = new ArrayList<>();
|
||||
locs.add(transform(0,0,0)); //Center
|
||||
locs.add(transform(0,1,0)); //N
|
||||
locs.add(transform(1,1,0)); //NE
|
||||
locs.add(transform(1,0,0)); //E
|
||||
locs.add(transform(1,-1,0)); //SE
|
||||
locs.add(transform(0,-1,0)); //S
|
||||
locs.add(transform(-1,-1,0));//SW
|
||||
locs.add(transform(-1,0,0));//W
|
||||
locs.add(transform(-1,1,0));//NW
|
||||
return locs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the x position on the region chunk.
|
||||
* @return The x position on the region chunk.
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package core.game.world.map
|
||||
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.map.RegionPlane
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.tools.RandomFunction
|
||||
import rs09.game.system.SystemLogger
|
||||
@@ -729,6 +727,27 @@ object RegionManager {
|
||||
return players
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of local players.
|
||||
* @param l The location.
|
||||
* @param distance The distance to that location.
|
||||
* @return The list of players.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getLocalPlayersMaxNorm(l: Location, distance: Int): MutableList<Player> {
|
||||
val players: MutableList<Player> = LinkedList()
|
||||
for (regionX in ((l.regionX - 6) shr 3)..((l.regionX + 6) shr 3)) {
|
||||
for (regionY in ((l.regionY - 6) shr 3)..((l.regionY + 6) shr 3)) {
|
||||
for (player in forId((regionX shl 8) or regionY).planes[l.z].players) {
|
||||
if (player.location.withinMaxnormDistance(l, distance)) {
|
||||
players.add(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return players
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of local players within 16 tile distance of the location.
|
||||
* @param l The location.
|
||||
|
||||
@@ -194,9 +194,6 @@ public final class WildernessZone extends MapZone {
|
||||
|
||||
if (e instanceof NPC) {
|
||||
e.asNpc().getDefinition().getDropTables().drop(e.asNpc(), killer);
|
||||
if (((NPC) e).getTask() != null && ((Player) killer).getSlayer().getTask() == e.asNpc().getTask()) {
|
||||
((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), e.asNpc());
|
||||
}
|
||||
e.asNpc().setRespawnTick(GameWorld.getTicks() + e.asNpc().getDefinition().getConfiguration(NPCConfigParser.RESPAWN_DELAY, 17));
|
||||
if (!e.asNpc().isRespawn()) {
|
||||
e.asNpc().clear();
|
||||
|
||||
@@ -5,7 +5,6 @@ import core.game.node.entity.player.Player;
|
||||
import core.gui.ConsoleFrame;
|
||||
import core.gui.ConsoleTab;
|
||||
import rs09.game.ge.GrandExchangeOffer;
|
||||
import rs09.game.ge.OfferManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -142,12 +141,12 @@ public class GrandExchangeTab extends ConsoleTab {
|
||||
JOptionPane.showMessageDialog(null, "Error! No player found.");
|
||||
return;
|
||||
}
|
||||
for (GrandExchangeOffer o : player.getPlayerGrandExchange().getOffers()) {
|
||||
/* for (GrandExchangeOffer o : player.getPlayerGrandExchange().getOfferRecords()) {
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
addOffer(o);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,12 +160,12 @@ public class GrandExchangeTab extends ConsoleTab {
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
}
|
||||
for (GrandExchangeOffer o : OfferManager.getOffersForItem(itemId)) {
|
||||
/* for (GrandExchangeOffer o : OfferManager.getOffersForItem(itemId)) {
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
addOffer(o);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,8 +183,8 @@ public class GrandExchangeTab extends ConsoleTab {
|
||||
JOptionPane.showMessageDialog(null, "Error! No data in DB yet. Press load.");
|
||||
return;
|
||||
}
|
||||
for (GrandExchangeOffer offer : OfferManager.getOFFER_MAPPING().values()) {
|
||||
/* for (GrandExchangeOffer offer : OfferManager.getOFFER_MAPPING().values()) {
|
||||
model.addElement(offer);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ public final class ExaminePacket implements IncomingPacket {
|
||||
player.debug("Object id: " + id + ", models: " + (d.getModelIds() != null ? Arrays.toString(d.getModelIds()) : null) + ", anim: " + d.animationId + ", config: " + (d.getVarbitID() != -1 ? d.getVarbitID() + " (file)" : d.getConfigId()) + ".");
|
||||
player.debug("Varp config index: " + VarbitDefinition.forObjectID(d.getVarbitID()).getConfigId());
|
||||
player.getPacketDispatch().sendMessage(""+name+"");
|
||||
/*if {
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("LandscapeParser.removeGameObject(new GameObject("+coords+"));//"+ d.getName() ), null);
|
||||
}*/
|
||||
break;
|
||||
case 235:
|
||||
case 92: // Item examine
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package core.net.packet.in;
|
||||
|
||||
import api.ContentAPIKt;
|
||||
import core.game.ge.GrandExchangeDatabase;
|
||||
import core.game.ge.GrandExchangeEntry;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.net.packet.IncomingPacket;
|
||||
import core.net.packet.IoBuffer;
|
||||
import rs09.game.ge.GrandExchange;
|
||||
import rs09.game.ge.GrandExchangeOffer;
|
||||
import rs09.game.interaction.inter.ge.StockMarket;
|
||||
|
||||
/**
|
||||
* Represents the <b>Incoming</b> packet of the grand exchange.
|
||||
@@ -13,7 +19,23 @@ public class GrandExchangePacket implements IncomingPacket {
|
||||
@Override
|
||||
public void decode(Player player, int opcode, IoBuffer buffer) {
|
||||
int itemId = buffer.getShort();
|
||||
player.getPlayerGrandExchange().constructBuy(itemId);
|
||||
GrandExchangeOffer offer = player.getAttribute("ge-temp", new GrandExchangeOffer());
|
||||
int index = player.getAttribute("ge-index", -1);
|
||||
offer.setItemID(itemId);
|
||||
offer.setSell(false);
|
||||
GrandExchangeEntry entry = GrandExchangeDatabase.getDatabase().get(itemId);
|
||||
if(entry == null || !ContentAPIKt.itemDefinition(itemId).isTradeable())
|
||||
{
|
||||
ContentAPIKt.sendMessage(player, "That item is blacklisted from the grand exchange.");
|
||||
return;
|
||||
}
|
||||
offer.setPlayer(player);
|
||||
offer.setAmount(1);
|
||||
offer.setOfferedValue(GrandExchange.getRecommendedPrice(itemId, false));
|
||||
offer.setIndex(index);
|
||||
StockMarket.updateVarbits(player, offer, index, false);
|
||||
player.setAttribute("ge-temp",offer);
|
||||
player.getPacketDispatch().sendString(GrandExchange.getOfferStats(itemId, false), 105, 142);
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package core.net.packet.in;
|
||||
|
||||
import api.events.InteractionEvent;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.cache.def.impl.VarbitDefinition;
|
||||
import core.game.content.quest.PluginInteractionManager;
|
||||
@@ -29,6 +30,7 @@ import rs09.game.world.repository.Repository;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.IntPredicate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ public class DatabaseManager {
|
||||
|
||||
public DatabaseManager connect() {
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + db.host() + "/" + db.name() + "?useTimezone=true&serverTimezone=UTC", db.username(), db.password());
|
||||
connections.put(db.name(), connection);
|
||||
|
||||
@@ -37,6 +38,8 @@ public class DatabaseManager {
|
||||
SystemLogger.logErr("Couldn't connect to the database.");
|
||||
e.printStackTrace();
|
||||
ServerConstants.MYSQL = false;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1379,11 +1379,17 @@ fun announceIfRare(player: Player, item: Item) {
|
||||
*/
|
||||
|
||||
fun getMasteredSkillNames(player: Player): List<String> {
|
||||
val hasMastered = player.getSkills().masteredSkills > 0
|
||||
val masteredSkills = ArrayList<String>()
|
||||
|
||||
for ((skillId, skillName) in Skills.SKILL_NAME.withIndex()) {
|
||||
if(hasLevelStat(player, skillId, 99)){
|
||||
masteredSkills.add(skillName)
|
||||
if(hasMastered){
|
||||
for ((skillId, skillName) in Skills.SKILL_NAME.withIndex()) {
|
||||
//phil you were looping every skill and performing a string comparison (another loop) for every one here.
|
||||
//that's some real shit code bro.
|
||||
//you were also performing a dynamic level check rather than a static.
|
||||
if(hasLevelStat(player, skillId, 99)){
|
||||
masteredSkills.add(skillName)
|
||||
}
|
||||
}
|
||||
}
|
||||
return masteredSkills
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package api
|
||||
|
||||
import core.game.node.entity.player.Player
|
||||
|
||||
interface LoginListener {
|
||||
fun login(player: Player)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package api.events
|
||||
|
||||
interface Event {}
|
||||
@@ -0,0 +1,7 @@
|
||||
package api.events
|
||||
|
||||
import core.game.node.entity.Entity
|
||||
|
||||
interface EventHook<T: Event> {
|
||||
fun process(entity: Entity, event: T)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package api.events
|
||||
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.link.TeleportManager.TeleportType
|
||||
|
||||
data class ResourceGatheredEvent(val itemId: Int, val amount: Int, val source: Node) : Event
|
||||
data class NPCKillEvent(val npc: NPC) : Event
|
||||
data class TeleportEvent(val type: TeleportType, val source: Int = -1) : Event
|
||||
data class LitFireEvent(val logId: Int) : Event
|
||||
data class InteractionEvent(val target: Node, val option: String) : Event
|
||||
@@ -12,6 +12,7 @@ import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import rs09.game.content.global.GlobalKillCounter;
|
||||
import rs09.game.ge.GEAutoStock
|
||||
import rs09.game.ge.GEDB
|
||||
import rs09.game.system.SystemLogger
|
||||
import rs09.game.system.config.ServerConfigParser
|
||||
import rs09.game.world.GameWorld
|
||||
@@ -34,8 +35,8 @@ object Server {
|
||||
/**
|
||||
* The time stamp of when the server started running.
|
||||
*/
|
||||
@JvmField
|
||||
var startTime: Long = 0
|
||||
@JvmField
|
||||
var startTime: Long = 0
|
||||
|
||||
var lastHeartbeat = System.currentTimeMillis()
|
||||
|
||||
|
||||
@@ -167,7 +167,9 @@ class ServerConstants {
|
||||
arrayOf(Location.create(2722, 4886, 0), "quest the golem 1"),
|
||||
arrayOf(Location.create(2704, 5349, 0), "dorgeshuun", "dorg"),
|
||||
arrayOf(Location.create(2711, 10132, 0), "brine rats"),
|
||||
arrayOf(Location.create(2328, 3677, 0), "piscatoris")
|
||||
arrayOf(Location.create(2328, 3677, 0), "piscatoris"),
|
||||
arrayOf(Location.create(2660, 3158, 0), "fishing trawler", "trawler"),
|
||||
arrayOf(Location.create(2800, 3667, 0), "mountain camp")
|
||||
)
|
||||
|
||||
@JvmField
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package rs09.game
|
||||
|
||||
import api.events.*
|
||||
|
||||
object Event {
|
||||
val ResourceGathered = ResourceGatheredEvent::class.java
|
||||
val NPCKilled = NPCKillEvent::class.java
|
||||
val Teleport = TeleportEvent::class.java
|
||||
val FireLit = LitFireEvent::class.java
|
||||
val Interaction = InteractionEvent::class.java
|
||||
}
|
||||
@@ -30,8 +30,8 @@ import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.ai.AIRepository
|
||||
import rs09.game.ge.GrandExchange
|
||||
import rs09.game.ge.GrandExchangeOffer
|
||||
import rs09.game.ge.OfferManager
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import rs09.game.system.SystemLogger
|
||||
@@ -374,7 +374,9 @@ class ScriptAPI(private val bot: Player) {
|
||||
diffX /= 2
|
||||
diffY /= 2
|
||||
}
|
||||
GameWorld.Pulser.submit(object : MovementPulse(bot, bot.location.transform(diffX, diffY, 0), Pathfinder.SMART) { // if this uses bot.pulseManager.run, it will get cleared when the bot dies and then the bot gets stuck in lumby
|
||||
GameWorld.Pulser.submit(object : MovementPulse(bot, bot.location.transform(diffX, diffY, 0), Pathfinder.SMART) {
|
||||
|
||||
|
||||
override fun pulse(): Boolean {
|
||||
return true
|
||||
}
|
||||
@@ -448,10 +450,10 @@ class ScriptAPI(private val bot: Player) {
|
||||
if (ItemDefinition.forId(id).noteId == id){
|
||||
actualId = Item(id).noteChange
|
||||
}
|
||||
val canSell = OfferManager.addBotOffer(actualId, itemAmt)
|
||||
val canSell = GrandExchange.addBotOffer(actualId, itemAmt)
|
||||
if (canSell && saleIsBigNews(actualId, itemAmt)) {
|
||||
SystemLogger.logAI("Offered $itemAmt of $actualId on the GE.")
|
||||
Repository.sendNews("2009Scape just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
|
||||
Repository.sendNews("Fellerscape just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
|
||||
}
|
||||
bot.bank.remove(Item(id, itemAmt))
|
||||
bot.bank.refresh()
|
||||
@@ -479,9 +481,9 @@ class ScriptAPI(private val bot: Player) {
|
||||
if (ItemDefinition.forId(actualId).noteId == actualId){
|
||||
actualId = Item(actualId).noteChange
|
||||
}
|
||||
val canSell = OfferManager.addBotOffer(actualId, itemAmt)
|
||||
val canSell = GrandExchange.addBotOffer(actualId, itemAmt)
|
||||
if (canSell && saleIsBigNews(actualId, itemAmt)) {
|
||||
Repository.sendNews("2009Scape just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
|
||||
Repository.sendNews("FellerScape just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
|
||||
}
|
||||
bot.bank.remove(item)
|
||||
bot.bank.refresh()
|
||||
@@ -508,7 +510,7 @@ class ScriptAPI(private val bot: Player) {
|
||||
if (ItemDefinition.forId(actualId).noteId == actualId){
|
||||
actualId = Item(actualId).noteChange
|
||||
}
|
||||
val canSell = OfferManager.addBotOffer(actualId, itemAmt)
|
||||
val canSell = GrandExchange.addBotOffer(actualId, itemAmt)
|
||||
if (canSell && saleIsBigNews(actualId, itemAmt)) {
|
||||
when (actualId){
|
||||
1511 -> continue
|
||||
@@ -517,7 +519,7 @@ class ScriptAPI(private val bot: Player) {
|
||||
1517 -> continue
|
||||
1519 -> continue
|
||||
1521 -> continue
|
||||
else -> Repository.sendNews("2009Scape just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
|
||||
else -> Repository.sendNews("Fellerscape just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
|
||||
}
|
||||
}
|
||||
bot.bank.remove(item).also { SystemLogger.logAI("$item has been listed on the GE.") }
|
||||
@@ -651,7 +653,7 @@ class ScriptAPI(private val bot: Player) {
|
||||
offer.offeredValue = checkPriceOverrides(itemID) ?: ItemDefinition.forId(itemID).value
|
||||
offer.amount = amount
|
||||
offer.player = bot
|
||||
OfferManager.dispatch(bot, offer)
|
||||
//GrandExchange.dispatch(bot, offer)
|
||||
AIRepository.addOffer(bot, offer)
|
||||
var bought: Boolean = false
|
||||
val latch = CountDownLatch(1)
|
||||
|
||||
@@ -179,7 +179,7 @@ class Adventurer(val style: CombatStyle): Script() {
|
||||
State.LOOT -> {
|
||||
val items = AIRepository.groundItems[bot]
|
||||
if (items?.isNotEmpty() == true && !bot.inventory.isFull) {
|
||||
items.forEach {
|
||||
items.toTypedArray().forEach {
|
||||
scriptAPI.takeNearestGroundItem(it.id)
|
||||
}
|
||||
return
|
||||
|
||||
@@ -9,7 +9,6 @@ import core.tools.RandomFunction
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.ai.AIPlayer
|
||||
import rs09.game.ai.general.ScriptAPI
|
||||
import rs09.game.ge.OfferManager
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import kotlin.random.Random
|
||||
@@ -89,7 +88,7 @@ class SharkCatcher : Script() {
|
||||
|
||||
State.STOP -> {
|
||||
val botAmount = bot.bank.getAmount(Items.RAW_SHARK_383) + 1
|
||||
var geAmount = OfferManager.getQuantitySoldForItem(Items.RAW_SHARK_383)
|
||||
var geAmount = 0//OfferManager.getQuantitySoldForItem(Items.RAW_SHARK_383)
|
||||
val totalAmount = (geAmount + botAmount) + 1
|
||||
if((totalAmount > limit) && myCounter++ == 300){
|
||||
bot.randomWalk(5,5)
|
||||
@@ -174,7 +173,7 @@ class SharkCatcher : Script() {
|
||||
|
||||
State.SELL_GE -> {
|
||||
val botAmount = bot.bank.getAmount(Items.RAW_SHARK_383) + 1
|
||||
var geAmount = OfferManager.getQuantitySoldForItem(Items.RAW_SHARK_383)
|
||||
var geAmount = 0//OfferManager.getQuantitySoldForItem(Items.RAW_SHARK_383)
|
||||
val totalAmount = (geAmount + botAmount) + 1
|
||||
if(totalAmount > limit){
|
||||
scriptAPI.walkTo(Location.create(3164, 3487, 0))
|
||||
|
||||
@@ -305,9 +305,9 @@ class VinesweeperNPC : AbstractNPC {
|
||||
}
|
||||
|
||||
override fun handleTickActions() {
|
||||
val dest = seedDestinations.find({sd -> sd.loc == location})
|
||||
val dest = seedDestinations.find { sd -> sd.loc == location }
|
||||
if(dest != null) {
|
||||
for(npc in findLocalNPCs(this, intArrayOf(RABBIT, *FARMERS), 30)) {
|
||||
for(npc in RegionManager.getRegionPlane(location).npcs) {
|
||||
if(npc is VinesweeperNPC) {
|
||||
npc.seedDestinations.remove(dest)
|
||||
npc.resetWalk()
|
||||
@@ -343,8 +343,8 @@ class VinesweeperNPC : AbstractNPC {
|
||||
|
||||
override fun getMovementDestination(): Location? {
|
||||
if(seedDestinations.size > 0) {
|
||||
seedDestinations.sortBy({a -> a.loc.getDistance(location).toInt()})
|
||||
return seedDestinations.get(0).loc
|
||||
seedDestinations.sortBy { a -> a.loc.getDistance(location).toInt() }
|
||||
return seedDestinations.first().loc
|
||||
} else {
|
||||
return super.getMovementDestination()
|
||||
}
|
||||
|
||||
+2
-6
@@ -1,13 +1,9 @@
|
||||
package rs09.game.content.dialogue
|
||||
|
||||
import api.*
|
||||
import core.game.container.Container
|
||||
import core.game.container.impl.EquipmentContainer
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
@Initializable
|
||||
/**
|
||||
@@ -15,11 +11,11 @@ import core.plugin.Plugin
|
||||
* @author Splinter
|
||||
* @author James Triantafylos
|
||||
*/
|
||||
class DumpContainer(player: Player? = null) : DialoguePlugin(player) {
|
||||
class DepositAllDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
val ID = 628371
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return DumpContainer(player)
|
||||
return DepositAllDialogue(player)
|
||||
}
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
package rs09.game.content.dialogue.region.apeatoll.marim
|
||||
|
||||
import api.addItemOrDrop
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
@@ -9,6 +9,7 @@ import core.game.node.item.Item
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
@@ -30,7 +31,7 @@ class DagaDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
1 -> when (buttonId) {
|
||||
1 -> player(FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 }
|
||||
2 -> player(FacialExpression.FRIENDLY, "No, thanks.").also { stage = 99 }
|
||||
2 -> player(FacialExpression.FRIENDLY, "No, thanks.").also { stage = END_DIALOGUE }
|
||||
3 -> player(FacialExpression.HALF_ASKING, "Do you have any Dragon Scimitars in stock?").also { stage = 30 }
|
||||
}
|
||||
|
||||
@@ -40,16 +41,15 @@ class DagaDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
31 -> options("Yes, please.", "No, thanks.").also { stage++ }
|
||||
|
||||
32 -> when (buttonId) {
|
||||
1 -> if (player.inventory.contains(Items.COINS_995, 100000)) {
|
||||
player.inventory.remove(Item(995,100000))
|
||||
addItemOrDrop(player, Items.DRAGON_SCIMITAR_4587, 1)
|
||||
1 -> if (inInventory(player, Items.COINS_995, 100000)) {
|
||||
end()
|
||||
removeItem(player, Item(Items.COINS_995, 100000), Container.INVENTORY)
|
||||
addItem(player, Items.DRAGON_SCIMITAR_4587, 1)
|
||||
} else {
|
||||
npcl(FacialExpression.OLD_NORMAL, "Sorry but you don't have enough to buy one, at the moment it costs 100,000 gold coins.").also { stage = 99 }
|
||||
npcl(FacialExpression.OLD_NORMAL, "Sorry but you don't have enough to buy one, at the moment it costs 100,000 gold coins.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
2 -> player(FacialExpression.FRIENDLY, "No thanks.").also { stage = 99 }
|
||||
2 -> player(FacialExpression.FRIENDLY, "No thanks.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
99 -> end()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package rs09.game.content.dialogue.region.etceteria
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class FishmongerEtcDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
npcl(FacialExpression.FRIENDLY,"Welcome, ${player.getAttribute("fremennikname","fremmyname")}. My fish is fresher than any in Miscellania.").also { stage = 0 }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> end().also { npc.openShop(player) }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return FishmongerEtcDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.FISHMONGER_1369)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -37,7 +37,7 @@ class SirsalBankerDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
1 -> when (buttonId) {
|
||||
1 -> end().also { player.bank.open() }
|
||||
2 -> end().also { player.bankPinManager.openSettings() }
|
||||
3 -> end().also { player.playerGrandExchange.openCollectionBox() }
|
||||
3 -> end().also { player.exchangeRecords.openCollectionBox() }
|
||||
4 -> player(FacialExpression.HALF_ASKING, "What is this place?").also { stage = 5 }
|
||||
}
|
||||
|
||||
|
||||
+7
-9
@@ -1,5 +1,6 @@
|
||||
package rs09.game.content.dialogue.region.miscellania
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
@@ -8,7 +9,6 @@ import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
/**
|
||||
* Dialogue for the Fishmonger in Misc.
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@@ -17,19 +17,17 @@ class FishmongerMiscDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
npc(FacialExpression.FRIENDLY,"Greetings, Sir.",
|
||||
"Get your fresh fish here!",
|
||||
"I've heard that the Etceterian fish is stored in",
|
||||
"a cow shed.")
|
||||
stage = 0
|
||||
if (!isQuestComplete(player, "Throne of Miscellania")) {
|
||||
npcl(FacialExpression.FRIENDLY,"Greetings, Sir. Get your fresh fish here! I've heard that the Etceterian fish is stored in a cow shed.").also { stage = 0 }
|
||||
} else {
|
||||
npcl(FacialExpression.FRIENDLY,"Greetings, Your Highness. Have some fresh fish! I've heard that the Etceterian fish is stored in a cow shed.").also { stage = 0 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> {
|
||||
end().also { npc.openShop(player) }
|
||||
}
|
||||
0 -> end().also { npc.openShop(player) }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class BjornAndEldgrimDialogues(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
player(FacialExpression.FRIENDLY, "Hello there.").also { stage = 0 }
|
||||
} else if (isQuestComplete(player, "Fremennik Trials")) {
|
||||
npc(FacialExpression.DRUNK, "Hey! Itsh you again! Whatshyerfashe!").also { stage = 10 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> npcl(FacialExpression.DRUNK, "Hey! scheck it out! Itsh an outerlandub! Yer shud go shpeak to the chieftain!").also { stage++ }
|
||||
1 -> player(FacialExpression.ASKING, "The who?").also { stage++ }
|
||||
2 -> npcl(FacialExpression.DRUNK, "That guy over there by that stuff! (hic) Yeh, abshoultely! He's da bosh!").also { stage = END_DIALOGUE }
|
||||
|
||||
10 -> player(FacialExpression.ASKING, "${player.name}?").also { stage++ }
|
||||
11 -> npcl(FacialExpression.DRUNK, "Nah nah nah, not them, the other one, whatshyerfashe!").also { stage++ }
|
||||
12 -> player(FacialExpression.ASKING, "${player.getAttribute("fremennikname","fremmyname")}?").also { stage++ }
|
||||
13 -> npc(FacialExpression.DRUNK, "Thatsh what I said diddle I?").also { stage++ }
|
||||
14 -> player(FacialExpression.ASKING, "Um.... okay. I'll leave you to your drinking.").also { stage++ }
|
||||
15 -> npc(FacialExpression.DRUNK, "Thanksh pal! You're alright!").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return BjornAndEldgrimDialogues(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.BJORN_1284, NPCs.ELDGRIM_1285)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class BlaninDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
player(FacialExpression.FRIENDLY, "Good day.").also { stage = 0 }
|
||||
} else {
|
||||
player(FacialExpression.FRIENDLY, "That's one less thing to worry about.").also { stage = 10 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> npc(FacialExpression.FRIENDLY, "Good day to you, sir.").also { stage = END_DIALOGUE }
|
||||
10 -> npc(FacialExpression.FRIENDLY, "Glad I could help.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return BlaninDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.BLANIN_2940)
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -1,6 +1,9 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.questStage
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import rs09.game.content.quest.members.thefremenniktrials.CouncilWorkerFTDialogue
|
||||
@@ -8,14 +11,19 @@ import rs09.game.content.quest.members.thefremenniktrials.CouncilWorkerFTDialogu
|
||||
@Initializable
|
||||
class CouncilWorkerDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
if(player.questRepository.getStage("Fremennik Trials") in 1..99){
|
||||
npc = args[0] as NPC
|
||||
if(questStage(player, "Fremennik Trials") in 1..99){
|
||||
loadFile(CouncilWorkerFTDialogue(1))
|
||||
} else {
|
||||
npc(FacialExpression.FRIENDLY,"'Ello there.").also { stage = 0 }
|
||||
}
|
||||
npc("'Ello there.")
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when (stage) {
|
||||
0 -> end()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class DronDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Making History")) {
|
||||
player(FacialExpression.FRIENDLY, "Excuse me.").also { stage = 0 }
|
||||
} else {
|
||||
player(FacialExpression.FRIENDLY, "Excuse me.").also { stage = 10 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> npc(FacialExpression.ANNOYED, "Leave me or I'll destroy you!").also { stage = END_DIALOGUE }
|
||||
10 -> npc(FacialExpression.ANNOYED, "You have your answers, now go away!").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return DronDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.DRON_2939)
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class FishmongerRellekkaDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npc(FacialExpression.ANNOYED, "I don't sell to outerlanders.").also { stage = END_DIALOGUE }
|
||||
} else {
|
||||
npcl(FacialExpression.FRIENDLY,"Hello there, ${player.getAttribute("fremennikname","fremmyname")}. Looking for fresh fish?").also { stage = 0 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> end().also { npc.openShop(player) }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return FishmongerRellekkaDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.FISH_MONGER_1315)
|
||||
}
|
||||
}
|
||||
+5
-8
@@ -1,16 +1,16 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
* Needs the quest to be completed to really do anything else here
|
||||
* Trade option shouldn't work either unless it's completed
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
@@ -18,20 +18,17 @@ class FurTraderDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!player.questRepository.isComplete("The Fremennik Trials")) {
|
||||
npc(FacialExpression.ANNOYED, "I don't sell to outerlanders.").also { stage = 99 }
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npc(FacialExpression.ANNOYED, "I don't sell to outerlanders.").also { stage = END_DIALOGUE }
|
||||
} else {
|
||||
npc(FacialExpression.FRIENDLY,"Welcome back <Fremennik Name>! Have you seen the furs I have today?").also { stage = 10 }
|
||||
npcl(FacialExpression.FRIENDLY,"Welcome back, ${player.getAttribute("fremennikname","fremmyname")}. Have you seen the furs I have today?").also { stage = 10 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> npc(FacialExpression.ANNOYED, "I don't sell to outerlanders.").also { stage = 99 }
|
||||
10 -> end().also { npc.openShop(player) }
|
||||
|
||||
99 -> end()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class IngridHradsonDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npcl(FacialExpression.ANNOYED, "Outlander, I have work to be getting on with... Please stop bothering me.").also { stage = END_DIALOGUE }
|
||||
} else if (isQuestComplete(player, "Fremennik Trials") && !isQuestComplete(player, "Olaf's Quest")) {
|
||||
npc(FacialExpression.FRIENDLY, "Good afternoon! How do you like our village?").also { stage = 0 }
|
||||
} else if (isQuestComplete(player, "Fremennik Trials") && isQuestComplete(player, "Olaf's Quest")) {
|
||||
npc(FacialExpression.ASKING, "Hello again! Have you any word from my husband?").also { stage = 10 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> playerl(FacialExpression.FRIENDLY, "It's lovely. You have a fine collection of goats.").also { stage++ }
|
||||
1 -> npcl(FacialExpression.FRIENDLY, "We polish them every day to get them nice and clean.").also { stage = END_DIALOGUE }
|
||||
|
||||
10 -> playerl(FacialExpression.HALF_GUILTY, "Err, no, not yet. It takes a while for the messages to reach me you know.").also { stage++ }
|
||||
11 -> npcl(FacialExpression.FRIENDLY, "Well, when you do, tell him we'll be more than happy to see him again.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return IngridHradsonDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.INGRID_HRADSON_3696)
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class LonghallBouncerDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npcl(FacialExpression.ANNOYED, "Hey, outerlander. You can't go through there. Talent only, backstage.").also { stage = END_DIALOGUE }
|
||||
} else{
|
||||
npcl(FacialExpression.ANNOYED, "You can't go through there. Talent only, backstage.").also { stage = 0 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> player(FacialExpression.PANICKED, "But I'm a Bard!").also { stage++ }
|
||||
1 -> npcl(FacialExpression.FRIENDLY, "No you're not. I saw your performance. I was paid well to keep you from ever setting foot on stage here again.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return LonghallBouncerDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.LONGHALL_BOUNCER_1278)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class ReesoDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npcl(FacialExpression.ANNOYED, "Please do not disturb me, outerlander. I have much to do.").also { stage = END_DIALOGUE }
|
||||
} else {
|
||||
npcl(FacialExpression.STRUGGLE, "Sorry, ${player.getAttribute("fremennikname","fremmyname")}, I must get on with my work.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return ReesoDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.REESO_3116)
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
* There is no available dialogue for after Fremennik Trials,
|
||||
* only after Hero's Welcome which isn't in this revision.
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class TalkToChiefDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npcl(FacialExpression.ANNOYED, "I cannot speak to you outerlander! Talk to Brundt, the Chieftain!").also { stage = END_DIALOGUE }
|
||||
} else {
|
||||
player(FacialExpression.FRIENDLY, "Hello.").also { stage = 0 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> npc(FacialExpression.FRIENDLY, "Hello to you, too!").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return TalkToChiefDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.BORROKAR_1307, NPCs.FREIDIR_1306, NPCs.INGA_1314,
|
||||
NPCs.JENNELLA_1312, NPCs.LANZIG_1308, NPCs.PONTAK_1309,
|
||||
NPCs.SASSILIK_1313)
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import api.isQuestComplete
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class VolfOlasfsonDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
if (!isQuestComplete(player, "Fremennik Trials")) {
|
||||
npc(FacialExpression.ANNOYED, "Sorry, outlander, but I have things to be doing.").also { stage = END_DIALOGUE }
|
||||
} else if (isQuestComplete(player, "Fremennik Trials") && !isQuestComplete(player, "Olaf's Quest")) {
|
||||
npc(FacialExpression.FRIENDLY, "Hello there. Enjoying the view?").also { stage = 0 }
|
||||
} else if (isQuestComplete(player, "Fremennik Trials") && isQuestComplete(player, "Olaf's Quest")) {
|
||||
npcl(FacialExpression.ASKING, "Hello again, friend! Does my father send any word... or treasures like before?").also { stage = 10 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> player(FacialExpression.FRIENDLY, "Yes I am. You have a lovely yurt.").also { stage++ }
|
||||
1 -> npc(FacialExpression.FRIENDLY, "Thanks! I exercise it regularly.").also { stage = END_DIALOGUE }
|
||||
|
||||
10 -> playerl(FacialExpression.HALF_GUILTY, "Not today, but if he does, you will be the first to know.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return VolfOlasfsonDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.VOLF_OLAFSON_3695)
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package rs09.game.content.dialogue.region.rellekka
|
||||
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author qmqz
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class WaitingOnTheShowDialogues(player: Player? = null) : DialoguePlugin(player){
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
npc(FacialExpression.ANNOYED, "Shhh! I'm waiting for the show!").also { stage = END_DIALOGUE }
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return WaitingOnTheShowDialogues(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.FRIDGEIR_1277, NPCs.OSPAK_1274, NPCs.STYRMIR_1275)
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,13 @@ import core.game.node.entity.combat.equipment.WeaponInterface
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.audio.Audio
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.entity.skill.slayer.SlayerEquipmentFlags
|
||||
import core.game.system.task.Pulse
|
||||
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.plugin.Plugin
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.game.interaction.InteractionListeners
|
||||
import rs09.game.system.config.ItemConfigParser
|
||||
import rs09.game.world.GameWorld
|
||||
|
||||
/**
|
||||
* Represents the equipment equipping handler plugin.
|
||||
|
||||
@@ -12,7 +12,6 @@ import core.game.node.item.Item
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.ai.AIRepository.Companion.getItems
|
||||
import rs09.game.system.SystemLogger
|
||||
import rs09.game.system.config.GroundSpawnLoader
|
||||
import rs09.game.world.GameWorld
|
||||
|
||||
@@ -38,18 +38,6 @@ object JobManager {
|
||||
player.setAttribute("jobs:amount",new)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun handleDeath(npc: Int, player: Player) {
|
||||
val jobId = player.getAttribute("jobs:id",0)
|
||||
val type = player.getAttribute("jobs:type",0)
|
||||
if(type == 1) {
|
||||
val job = SlayingJob.values()[jobId]
|
||||
if (job.ids.contains(npc)) {
|
||||
updateJobRemaining(player, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun rewardPlayer(player: Player, npc: NPC){
|
||||
val amt = player.getAttribute("jobs:original_amount",0)
|
||||
@@ -78,6 +66,7 @@ object JobManager {
|
||||
player.dialogueInterpreter.sendDialogue("You still need to kill $needed more ${NPC(SlayingJob.values()[jobId].ids[0]).name.toLowerCase()}.")
|
||||
return
|
||||
}
|
||||
player.dialogueInterpreter.sendDialogue("Excellent work, thank you! Here's your reward.")
|
||||
}
|
||||
if(!player.inventory.add(Item(995,250 * amt))){
|
||||
GroundItemManager.create(Item(995,250 * amt),player.centerLocation,player)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user