mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Rewrote or refactored many interfaces, fixing many small bugs
This commit is contained in:
parent
7cf5049687
commit
264c2aa550
49 changed files with 796 additions and 1523 deletions
|
|
@ -1,159 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.game.system.communication.ClanRank;
|
||||
import core.game.system.communication.ClanRepository;
|
||||
import core.net.amsc.MSPacketRepository;
|
||||
import core.net.amsc.WorldCommunicator;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.StringUtils;
|
||||
import kotlin.Unit;
|
||||
|
||||
import static core.api.ContentAPIKt.sendInputDialogue;
|
||||
import static core.api.ContentAPIKt.setInterfaceText;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the clan interfaces.
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class ClanInterfacePlugin extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(590, this);
|
||||
ComponentDefinition.put(589, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (component.getId()) {
|
||||
case 589:
|
||||
switch (button) {
|
||||
case 9:
|
||||
if (player.getInterfaceManager().getComponent(590) != null) {
|
||||
player.getPacketDispatch().sendMessage("Please close the interface you have open before using 'Clan Setup'");
|
||||
return true;
|
||||
}
|
||||
ClanRepository.openSettings(player);
|
||||
return true;
|
||||
case 14:
|
||||
if (player.getIronmanManager().checkRestriction()) {
|
||||
return false;
|
||||
}
|
||||
player.getDetails().getCommunication().toggleLootshare(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case 590:
|
||||
final ClanRepository clan = ClanRepository.get(player.getName(), true);
|
||||
switch (button) {
|
||||
case 23:
|
||||
if (opcode == 155) {
|
||||
clan.setJoinRequirement(ClanRank.NONE);
|
||||
} else {
|
||||
clan.setJoinRequirement(getRank(opcode));
|
||||
}
|
||||
player.getDetails().getCommunication().setJoinRequirement(clan.getJoinRequirement());
|
||||
MSPacketRepository.setClanSetting(player, 0, clan.getJoinRequirement());
|
||||
player.getPacketDispatch().sendString(clan.getJoinRequirement().getInfo(), 590, 23);
|
||||
break;
|
||||
case 24:
|
||||
clan.setMessageRequirement(getRank(opcode));
|
||||
player.getDetails().getCommunication().setMessageRequirement(clan.getMessageRequirement());
|
||||
MSPacketRepository.setClanSetting(player, 1, clan.getMessageRequirement());
|
||||
player.getPacketDispatch().sendString(clan.getMessageRequirement().getInfo(), 590, 24);
|
||||
break;
|
||||
case 25:
|
||||
clan.setKickRequirement(getRank(opcode));
|
||||
player.getDetails().getCommunication().setKickRequirement(clan.getKickRequirement());
|
||||
MSPacketRepository.setClanSetting(player, 2, clan.getKickRequirement());
|
||||
player.getPacketDispatch().sendString(clan.getKickRequirement().getInfo(), 590, 25);
|
||||
clan.update();
|
||||
break;
|
||||
case 26:
|
||||
if (opcode == 230) {
|
||||
clan.setLootRequirement(ClanRank.ADMINISTRATOR);
|
||||
} else {
|
||||
clan.setLootRequirement(getRank(opcode));
|
||||
}
|
||||
player.getDetails().getCommunication().setLootRequirement(clan.getLootRequirement());
|
||||
MSPacketRepository.setClanSetting(player, 3, clan.getLootRequirement());
|
||||
player.getPacketDispatch().sendString(clan.getLootRequirement().getInfo(), 590, 26);
|
||||
break;
|
||||
case 22:
|
||||
switch (opcode) {
|
||||
case 196:
|
||||
clan.setName("Chat disabled");
|
||||
player.getCommunication().setClanName("");
|
||||
player.getPacketDispatch().sendString(clan.getName(), 590, 22);
|
||||
if (WorldCommunicator.isEnabled()) {
|
||||
MSPacketRepository.sendClanRename(player, "");
|
||||
break;
|
||||
}
|
||||
clan.clean(true);
|
||||
break;
|
||||
default:
|
||||
sendInputDialogue(player, false, "Enter clan prefix:", (value) -> {
|
||||
String name = StringUtils.formatDisplayName((String) value);
|
||||
setInterfaceText(player, name, 590, 22);
|
||||
if(WorldCommunicator.isEnabled()){
|
||||
MSPacketRepository.sendClanRename(player, name);
|
||||
clan.setName(name);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
if (clan.getName().equals("Chat disabled")) {
|
||||
player.getPacketDispatch().sendMessage("Your clan channel has now been enabled!");
|
||||
player.getPacketDispatch().sendMessage("Join your channel by clicking 'Join Chat' and typing: " + player.getUsername());
|
||||
}
|
||||
clan.setName(name);
|
||||
player.getCommunication().setClanName(name);
|
||||
clan.update();
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value to set.
|
||||
* @param opcode the opcode.
|
||||
* @return the value.
|
||||
*/
|
||||
public static ClanRank getRank(int opcode) {
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
return ClanRank.NONE;
|
||||
case 196:
|
||||
return ClanRank.FRIEND;
|
||||
case 124:
|
||||
return ClanRank.RECRUIT;
|
||||
case 199:
|
||||
return ClanRank.CORPORAL;
|
||||
case 234:
|
||||
return ClanRank.SERGEANT;
|
||||
case 168:
|
||||
return ClanRank.LIEUTENANT;
|
||||
case 166:
|
||||
return ClanRank.CAPTAIN;
|
||||
case 64:
|
||||
return ClanRank.GENERAL;
|
||||
case 53:
|
||||
return ClanRank.OWNER;
|
||||
}
|
||||
return ClanRank.NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
@Initializable
|
||||
public class CrystalKeyChestPlugin extends ComponentPlugin {
|
||||
|
||||
private final Integer CHEST_INTERFACE = 501;
|
||||
|
||||
private Player player;
|
||||
|
||||
public CrystalKeyChestPlugin() {
|
||||
/*
|
||||
* Empty
|
||||
*/
|
||||
}
|
||||
|
||||
public CrystalKeyChestPlugin(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(CHEST_INTERFACE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void constructInterface(Player player) {
|
||||
Integer[] hiddenChildren = new Integer[] { 3, 4, 5, 6, 7};
|
||||
Component component = new Component(CHEST_INTERFACE);
|
||||
for (int i = 3; i < hiddenChildren.length; i++) {
|
||||
player.getPacketDispatch().sendInterfaceConfig(CHEST_INTERFACE, i, true);
|
||||
}
|
||||
player.getPacketDispatch().sendItemOnInterface(989, 1, CHEST_INTERFACE, hiddenChildren[2]);
|
||||
player.getInterfaceManager().open(component);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package content.global.handlers.iface
|
||||
|
||||
import core.api.closeInterface
|
||||
import core.game.interaction.InterfaceListener
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class DeathInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.AIDE_DEATH_153) { player, _, _, buttonID, _, _ ->
|
||||
if (buttonID == 1) {
|
||||
player.savedData.globalData.setDisableDeathScreen(true)
|
||||
closeInterface(player)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the death interface.
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class DeathInterfacePlugin extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.forId(153).setPlugin(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
if (button == 1) {
|
||||
player.getSavedData().getGlobalData().setDisableDeathScreen(true);
|
||||
player.getInterfaceManager().close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.emote.Emotes;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the emote tab interface.
|
||||
* @author Vexia
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class EmoteTabInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(464, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
Emotes.handle(player, button);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,231 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import content.global.skill.summoning.familiar.BurdenBeast;
|
||||
import core.api.ContentAPIKt;
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.container.Container;
|
||||
import core.game.container.ContainerEvent;
|
||||
import core.game.container.ContainerListener;
|
||||
import core.game.container.access.InterfaceContainer;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.entity.combat.DeathTask;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.prayer.PrayerType;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.ContainerContext;
|
||||
import core.net.packet.out.ContainerPacket;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.game.global.action.EquipHandler;
|
||||
import core.game.interaction.IntType;
|
||||
import core.game.interaction.InteractionListeners;
|
||||
import core.game.world.GameWorld;
|
||||
import core.tools.Log;
|
||||
|
||||
/**
|
||||
* Represents the equipment interface.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class EquipmentInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(102, this);
|
||||
ComponentDefinition.put(387, this);
|
||||
ComponentDefinition.put(667, this);
|
||||
ComponentDefinition.put(670, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player p, Component component, int opcode, int button, final int slot, final int itemId) {
|
||||
if (component.getId() == 667) {
|
||||
if (button != 14) {
|
||||
return false;
|
||||
}
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
p.getPulseManager().clear();
|
||||
GameWorld.getPulser().submit(new Pulse(1, p) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
EquipHandler.unequip(p, slot, itemId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
case 9:
|
||||
p.sendMessage(p.getEquipment().get(slot).getDefinition().getExamine());
|
||||
return true;
|
||||
case 196:
|
||||
GameWorld.getPulser().submit(new Pulse(1, p) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
operate(p, slot, itemId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (component.getId() == 670) {
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
p.getPulseManager().clear();
|
||||
final Item item = p.getInventory().get(slot);
|
||||
GameWorld.getPulser().submit(new Pulse(1, p) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (item == null) return true;
|
||||
InteractionListeners.run(item.getId(), IntType.ITEM,"equip",p, item);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
case 9:
|
||||
p.sendMessage(p.getInventory().get(slot).getDefinition().getExamine());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
switch (opcode) {
|
||||
case 206:
|
||||
if (button != 28) {
|
||||
return false;
|
||||
}
|
||||
GameWorld.getPulser().submit(new Pulse(1, p) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
operate(p, slot, itemId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
default:
|
||||
switch (button) {
|
||||
case 52:
|
||||
if (p.getInterfaceManager().isOpened() && p.getInterfaceManager().getOpened().getId() == 102) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// (Highlight white items are auto destroyed on death Enum#616 (Items kept on death interface) TODO: Parse server sided
|
||||
// SCRIPT 118 - Items kept on death interface CS
|
||||
// ARG 0: Safe location check Takes: 0 Safe Area/2 in POH/3 in Castle Wars/4 in Trouble Brewing/5 in Barbass
|
||||
int zoneType = p.getZoneMonitor().getType();
|
||||
// ARG 1: Amount of items kept on death Takes: 0/1/3/4
|
||||
Container[] itemArray = DeathTask.getContainers(p);
|
||||
Container kept = itemArray[0];
|
||||
int amtKeptOnDeath = kept.itemCount();
|
||||
if (amtKeptOnDeath > 4 && zoneType == 0) {
|
||||
ContentAPIKt.log(this.getClass(), Log.ERR, "Items kept on death interface should not contain more than 4 items when not in a safe zone!");
|
||||
}
|
||||
// ARG 2: Item kept on death slot 0
|
||||
int slot0 = kept.getId(0);
|
||||
// ARG 3: Item kept on death slot 1
|
||||
int slot1 = kept.getId(1);
|
||||
// ARG 4: Item kept on death slot 2
|
||||
int slot2 = kept.getId(2);
|
||||
// ARG 5: Item kept on death slot 3
|
||||
int slot3 = kept.getId(3);
|
||||
// ARG 6: Player skulled Takes: 0 not skulled/1 skulled
|
||||
int skulled = p.getSkullManager().isSkulled() ? 1 : 0;
|
||||
// ARG 7: Player has summoning creature out Takes: 0 not out/1 Creature summoned
|
||||
int hasBoB;
|
||||
if (p.getFamiliarManager().hasFamiliar()) {
|
||||
if (p.getFamiliarManager().getFamiliar().isBurdenBeast()) {
|
||||
hasBoB = ((BurdenBeast) p.getFamiliarManager().getFamiliar()).getContainer().isEmpty() ? 0 : 1;
|
||||
} else {
|
||||
hasBoB = 0;
|
||||
}
|
||||
} else {
|
||||
hasBoB = 0;
|
||||
}
|
||||
// ARG 8: String for effect:
|
||||
// if (arg1 == 0) arg8 + " This reduces the items you keep from three to zero!"
|
||||
// if (arg1 == 1) arg8 + " This reduces the items you keep from three to zero!" + "<br>" + "<br>" + "However, you also have the " + "<col=ff3333>" + "Protect Items" + "<col=ff981f>" + " prayer active, which saves you one extra item!");
|
||||
Object[] params = new Object[] { hasBoB, skulled, slot3, slot2, slot1, slot0, amtKeptOnDeath, zoneType, "You are skulled." };
|
||||
p.getPacketDispatch().sendRunScript(118, "siiooooii", params);
|
||||
|
||||
p.getInterfaceManager().openComponent(102);
|
||||
break;
|
||||
case 28:
|
||||
if (opcode == 81) {
|
||||
p.getPulseManager().clear();
|
||||
GameWorld.getPulser().submit(new Pulse(1, p) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
EquipHandler.unequip(p, slot, itemId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 55:
|
||||
if (p.getInterfaceManager().isOpened() && p.getInterfaceManager().getOpened().getId() == 667) {
|
||||
return true;
|
||||
}
|
||||
final ContainerListener listener = new ContainerListener() {
|
||||
@Override
|
||||
public void update(Container c, ContainerEvent e) {
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(p, -1, -1, 98, e.getItems(), false, e.getSlots()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(Container c) {
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(p, -1, -1, 98, c, false));
|
||||
}
|
||||
};
|
||||
p.getInterfaceManager().openComponent(667).setCloseEvent((player, c) -> {
|
||||
player.removeAttribute("equip_stats_open");
|
||||
player.getInterfaceManager().closeSingleTab();
|
||||
player.getInventory().getListeners().remove(listener);
|
||||
return true;
|
||||
});
|
||||
p.setAttribute("equip_stats_open", true);
|
||||
EquipmentContainer.update(p);
|
||||
p.getInterfaceManager().openSingleTab(new Component(670));
|
||||
InterfaceContainer.generateItems(p, p.getInventory().toArray(), new String[] { "Equip" }, 670, 0, 7, 4, 93);
|
||||
p.getInventory().getListeners().add(listener);
|
||||
p.getInventory().refresh();
|
||||
ItemDefinition.statsUpdate(p);
|
||||
p.getPacketDispatch().sendIfaceSettings(1278, 14, 667, 0, 13);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operates an item.
|
||||
* @param player The player.
|
||||
* @param slot The container slot.
|
||||
* @param itemId The item id.
|
||||
*/
|
||||
public void operate(Player player, int slot, int itemId) {
|
||||
if (slot < 0 || slot > 13) {
|
||||
return;
|
||||
}
|
||||
Item item = player.getEquipment().get(slot);
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
if(InteractionListeners.run(item.getId(),IntType.ITEM,"operate",player,item)){
|
||||
return;
|
||||
}
|
||||
OptionHandler handler = item.getOperateHandler();
|
||||
if (handler != null && handler.handle(player, item, "operate")) {
|
||||
return;
|
||||
}
|
||||
player.getPacketDispatch().sendMessage("You can't operate that.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface;
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.WeaponInterfaces;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.info.Rights;
|
||||
import core.game.world.GameWorld;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the component plugin used for the game interface.
|
||||
* @author Vexia
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class GameInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(740, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (component.getId()) {
|
||||
case 740:
|
||||
switch (button){
|
||||
case 3:
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case 746:
|
||||
switch (button){
|
||||
case 12:
|
||||
player.getPacketDispatch().sendString("When you have finished playing " + GameWorld.getSettings().getName() + ", always use the button below to logout safely. ", 182, 0);
|
||||
break;
|
||||
case 49:
|
||||
player.getPacketDispatch().sendString("Friends List - " + GameWorld.getSettings().getName() + " " + GameWorld.getSettings().getWorldId(), 550, 3);
|
||||
break;
|
||||
case 110:
|
||||
configureWorldMap(player);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case 548:
|
||||
if (button >= 38 && button<= 44 || button >= 20 && button <= 26) {
|
||||
player.getInterfaceManager().setCurrentTabIndex(getTabIndex(button));
|
||||
}
|
||||
//Interface buttons that advance the Tutorial Island stages
|
||||
switch (button) {
|
||||
case 21://Friends Tab
|
||||
player.getPacketDispatch().sendString("Friends List -" + GameWorld.getSettings().getName() + " " + GameWorld.getSettings().getWorldId(), 550, 3);
|
||||
break;
|
||||
case 22://Ignore Tab
|
||||
break;
|
||||
case 24://Settings Tab
|
||||
break;
|
||||
case 25://Emotes Tab
|
||||
break;
|
||||
case 26://Music Tab
|
||||
break;
|
||||
case 38://Attack Tab
|
||||
if (player.getExtension(WeaponInterface.class) == WeaponInterfaces.STAFF) {
|
||||
final Component c = new Component(WeaponInterfaces.STAFF.getInterfaceId());
|
||||
player.getInterfaceManager().openTab(0, c);
|
||||
final WeaponInterface inter = player.getExtension(WeaponInterface.class);
|
||||
inter.updateInterface();
|
||||
}
|
||||
break;
|
||||
case 39://Skill Tab
|
||||
break;
|
||||
case 40://Quest Tab
|
||||
/*if (GameWorld.isEconomyWorld()) {
|
||||
player.getQuestRepository().syncronizeTab(player);
|
||||
} else {
|
||||
player.getSavedData().getSpawnData().drawStatsTab(player);
|
||||
}*/
|
||||
|
||||
player.getQuestRepository().syncronizeTab(player);
|
||||
break;
|
||||
case 41://Inventory Tab
|
||||
player.getInventory().refresh();
|
||||
break;
|
||||
case 42://Worn Equipment Tab
|
||||
break;
|
||||
case 43://Prayer Tab
|
||||
break;
|
||||
case 44://Magic Tab
|
||||
break;
|
||||
case 66://World map
|
||||
case 110:
|
||||
configureWorldMap(player);
|
||||
break;
|
||||
case 69://Logout
|
||||
player.getPacketDispatch().sendString("When you have finished playing " + GameWorld.getSettings().getName() + ", always use the button below to logout safely. ", 182, 0);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case 750:
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
switch (button) {
|
||||
case 1:
|
||||
player.getSettings().toggleRun();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case 751:
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
switch (button) {
|
||||
case 27:
|
||||
openReport(player);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* World map
|
||||
* Thanks, Snickerize!
|
||||
*/
|
||||
private void configureWorldMap(Player player) {
|
||||
if (player.inCombat()) {
|
||||
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
|
||||
return;
|
||||
}
|
||||
if(player.getLocks().isInteractionLocked() || player.getLocks().isMovementLocked()){
|
||||
player.getPacketDispatch().sendMessage("You can't do this right now.");
|
||||
return;
|
||||
}
|
||||
player.getInterfaceManager().openWindowsPane(new Component(755));
|
||||
int posHash = (player.getLocation().getZ() << 28) | (player.getLocation().getX() << 14) | player.getLocation().getY();
|
||||
player.getPacketDispatch().sendScriptConfigs(622, posHash, "", 0);
|
||||
player.getPacketDispatch().sendScriptConfigs(674, posHash, "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to open the report interface.
|
||||
* @param player the player.
|
||||
*/
|
||||
public static void openReport(final Player player) {
|
||||
player.getInterfaceManager().open(new Component(553)).setCloseEvent((player1, c) -> {
|
||||
player1.getPacketDispatch().sendRunScript(80, "");
|
||||
player1.getPacketDispatch().sendRunScript(137, "");
|
||||
return true;
|
||||
});
|
||||
player.getPacketDispatch().sendRunScript(508, "");
|
||||
if (player.getDetails().getRights() != Rights.REGULAR_PLAYER) {
|
||||
for (int i = 0; i < 18; i++) {
|
||||
player.getPacketDispatch().sendInterfaceConfig(553, i, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tab index.
|
||||
* @param button The button id.
|
||||
* @return The tab index.
|
||||
*/
|
||||
private static int getTabIndex(int button) {
|
||||
int tabIndex = button - 38;
|
||||
if (button < 27) {
|
||||
tabIndex = (button - 20) + 7;
|
||||
}
|
||||
return tabIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the world map for a player.
|
||||
* @param player The player.
|
||||
*/
|
||||
}
|
||||
|
|
@ -152,11 +152,11 @@ class HairDresserInterface : ComponentPlugin(){
|
|||
player.setAttribute("beard-setting",false)
|
||||
if(!pl.getAttribute("hairdresser-paid",false)){
|
||||
val original_hair = player.getAttribute("original-hair",0)
|
||||
val original_beard = player.getAttribute("original_beard",-1)
|
||||
val original_color = player.getAttribute("original_color",0)
|
||||
val original_beard = player.getAttribute("original-beard",-1)
|
||||
val original_color = player.getAttribute("original-color",0)
|
||||
pl.appearance.hair.changeLook(original_hair)
|
||||
pl.appearance.hair.changeColor(original_color)
|
||||
if(original_beard != -1) {
|
||||
if (original_beard != -1) {
|
||||
pl.appearance.beard.changeLook(original_beard)
|
||||
}
|
||||
pl.appearance.sync()
|
||||
|
|
@ -174,7 +174,7 @@ class HairDresserInterface : ComponentPlugin(){
|
|||
when(button){
|
||||
199 -> player.setAttribute("beard-setting",false)
|
||||
200 -> player.setAttribute("beard-setting",true)
|
||||
68,196,274 -> pay(player)
|
||||
196,274 -> pay(player)
|
||||
else -> when(component?.id){
|
||||
592 -> { //Female
|
||||
if(femaleColorButtonRange.contains(button)){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package content.global.handlers.iface
|
||||
|
||||
import core.api.closeInterface
|
||||
import core.api.runTask
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.info.login.LoginConfiguration
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class LoginInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.WELCOME_SCREEN_378) { player, _, _, buttonID, _, _ ->
|
||||
val playButton = 140
|
||||
val creditButton = 145
|
||||
val discordButton = 204
|
||||
|
||||
when (buttonID) {
|
||||
playButton -> {
|
||||
player.locks.lock("login", 2)
|
||||
closeInterface(player)
|
||||
runTask(player, 1, 0) {
|
||||
LoginConfiguration.configureGameWorld(player)
|
||||
}
|
||||
}
|
||||
creditButton -> return@on true
|
||||
discordButton -> return@on true
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
onClose(Components.WELCOME_SCREEN_378) { player, _ ->
|
||||
return@onClose player.locks.isLocked("login")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.info.login.LoginConfiguration;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used for the login interface.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class LoginInterfacePlugin extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(378, this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (button) {
|
||||
case 140:
|
||||
if (player.getLocks().isLocked("login")) {
|
||||
return true;
|
||||
}
|
||||
player.getLocks().lock("login", 2);
|
||||
player.getInterfaceManager().close();
|
||||
player.getPulseManager().run(new Pulse(1) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
LoginConfiguration.configureGameWorld(player);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 145://credits
|
||||
break;
|
||||
case 204://message centre
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.GameWorld;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.game.world.repository.Repository;
|
||||
|
||||
/**
|
||||
* Represents the interface used to logout of the game.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class LogoutInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(182, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
if (!player.getZoneMonitor().canLogout()) {
|
||||
return true;
|
||||
}
|
||||
if (player.inCombat()) {
|
||||
player.getPacketDispatch().sendMessage("You can't log out until 10 seconds after the end of combat.");
|
||||
return true;
|
||||
}
|
||||
if (player.isTeleporting()) {
|
||||
player.sendMessage("Please finish your teleport before logging out.");
|
||||
return true;
|
||||
}
|
||||
Repository.getDisconnectionQueue().add(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import content.global.skill.magic.SpellListener;
|
||||
import content.global.skill.magic.SpellListeners;
|
||||
import content.global.skill.magic.SpellUtils;
|
||||
import core.game.event.SpellCastEvent;
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.combat.spell.MagicSpell;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.world.GameWorld;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the magic book interface handling of non-combat spells.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class MagicBookInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(192, this);
|
||||
ComponentDefinition.put(193, this);
|
||||
ComponentDefinition.put(430, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
if (GameWorld.getTicks() < player.getAttribute("magic:delay", -1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellBook spellBook = component.getId() == 192
|
||||
? SpellBook.MODERN
|
||||
: component.getId() == 193
|
||||
? SpellBook.ANCIENT
|
||||
: SpellBook.LUNAR;
|
||||
|
||||
SpellListeners.run(button, SpellListener.NONE, SpellUtils.getBookFromInterface(component.getId()),player,null);
|
||||
boolean result = MagicSpell.castSpell(player, spellBook, button, player);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,32 +31,13 @@ class MainGameInterface : InterfaceListener {
|
|||
}
|
||||
|
||||
on(TOPLEVEL_FS){player, _, _, buttonID, _, _ ->
|
||||
when (buttonID) {
|
||||
12 -> setInterfaceText(player,
|
||||
"When you have finished playing " + settings!!.name + ", always use the button below to logout safely. ",
|
||||
182,
|
||||
0
|
||||
)
|
||||
49 -> setInterfaceText(player,
|
||||
"Friends List - " + settings!!.name + " " + settings!!.worldId,
|
||||
550,
|
||||
3
|
||||
)
|
||||
110 -> configureWorldMap(player)
|
||||
}
|
||||
if (buttonID == 110)
|
||||
configureWorldMap(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
|
||||
on(TOPLEVEL){player, _, _, buttonID, _, _ ->
|
||||
when (buttonID) {
|
||||
21 -> {
|
||||
player.packetDispatch.sendString(
|
||||
"Friends List -" + settings!!.name + " " + settings!!.worldId,
|
||||
550,
|
||||
3
|
||||
)
|
||||
}
|
||||
38 -> {
|
||||
if (player.getExtension<Any>(WeaponInterface::class.java) === WeaponInterfaces.STAFF) {
|
||||
val c = Component(WeaponInterfaces.STAFF.interfaceId)
|
||||
|
|
@ -67,12 +48,7 @@ class MainGameInterface : InterfaceListener {
|
|||
}
|
||||
40 -> player.questRepository.syncronizeTab(player)
|
||||
41 -> player.inventory.refresh()
|
||||
66, 110 -> configureWorldMap(player)
|
||||
69 -> player.packetDispatch.sendString(
|
||||
"When you have finished playing " + settings!!.name + ", always use the button below to logout safely. ",
|
||||
182,
|
||||
0
|
||||
)
|
||||
66 -> configureWorldMap(player)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
|
@ -95,11 +71,11 @@ class MainGameInterface : InterfaceListener {
|
|||
|
||||
private fun configureWorldMap(player: Player) {
|
||||
if (player.inCombat()) {
|
||||
player.packetDispatch.sendMessage("It wouldn't be very wise opening the world map during combat.")
|
||||
sendMessage(player, "It wouldn't be very wise opening the world map during combat.")
|
||||
return
|
||||
}
|
||||
if (player.locks.isInteractionLocked || player.locks.isMovementLocked) {
|
||||
player.packetDispatch.sendMessage("You can't do this right now.")
|
||||
sendMessage(player, "You can't do this right now.")
|
||||
return
|
||||
}
|
||||
player.interfaceManager.close()
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.info.Rights;
|
||||
import core.game.node.entity.player.link.music.MusicEntry;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the interface tab buttons.
|
||||
* @author Emperor
|
||||
*/
|
||||
@Initializable
|
||||
public final class MusicTabInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(187, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (opcode) {
|
||||
case 155:
|
||||
switch (button) {
|
||||
case 11:
|
||||
player.getMusicPlayer().toggleLooping();
|
||||
return true;
|
||||
case 1:
|
||||
MusicEntry entry = player.getMusicPlayer().getUnlocked().get(slot);
|
||||
if (entry == null) {
|
||||
if(player.getRights().equals(Rights.ADMINISTRATOR)){
|
||||
for(MusicEntry ent : MusicEntry.getSongs().values()){
|
||||
if(ent.getIndex() == slot){
|
||||
player.getMusicPlayer().unlock(ent.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.getPacketDispatch().sendMessage("You have not unlocked this piece of music yet!</col>");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
player.getMusicPlayer().setPlaying(false);
|
||||
player.getMusicPlayer().play(entry);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package content.global.handlers.iface
|
||||
|
||||
import core.api.*
|
||||
import core.game.dialogue.FacialExpression
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.item.Item
|
||||
import core.tools.StringUtils
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
class MysticStaffEnchantInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(INTERFACE_332) { player, _, _, buttonID, _, _ ->
|
||||
val staff = buttonMap[buttonID] ?: return@on true
|
||||
val price = if (inEquipment(player, Items.SEERS_HEADBAND_14631)) 27000 else 40000
|
||||
|
||||
if (!inInventory(player, staff.basicID)) {
|
||||
sendMessage(player, "You don't have a${if (StringUtils.isPlusN(getItemName(staff.basicID))) "n" else ""} ${getItemName(staff.basicID)} to enchant.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
closeInterface(player)
|
||||
|
||||
if (!inInventory(player, Items.COINS_995, price)) {
|
||||
sendNPCDialogue(player, NPCs.THORMAC_389, "I need ${String.format("%,d", price)} coins for materials. Come back when you have the money!", FacialExpression.NEUTRAL)
|
||||
return@on true
|
||||
}
|
||||
|
||||
if (removeItem(player, Item(staff.basicID, 1)) && removeItem(player, Item(Items.COINS_995, price))) {
|
||||
sendNPCDialogue(player, NPCs.THORMAC_389, "Just a moment... hang on... hocus pocus abra-cadabra... there you go! Enjoy your enchanted staff!", FacialExpression.NEUTRAL)
|
||||
addItem(player, staff.enchantedID, 1)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
enum class EnchantedStaff(val enchantedID: Int, val basicID: Int, val buttonID: Int) {
|
||||
AIR(Items.MYSTIC_AIR_STAFF_1405, Items.AIR_BATTLESTAFF_1397, 21),
|
||||
WATER(Items.MYSTIC_WATER_STAFF_1403, Items.WATER_BATTLESTAFF_1395, 22),
|
||||
EARTH(Items.MYSTIC_EARTH_STAFF_1407, Items.EARTH_BATTLESTAFF_1399, 23),
|
||||
FIRE(Items.MYSTIC_FIRE_STAFF_1401, Items.FIRE_BATTLESTAFF_1393, 24),
|
||||
LAVA(Items.MYSTIC_LAVA_STAFF_3054, Items.LAVA_BATTLESTAFF_3053, 25),
|
||||
MUD(Items.MYSTIC_MUD_STAFF_6563, Items.MUD_BATTLESTAFF_6562, 26),
|
||||
STEAM(Items.MYSTIC_STEAM_STAFF_11738, Items.STEAM_BATTLESTAFF_11736, 27),
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val INTERFACE_332 = 332
|
||||
|
||||
val buttonMap = HashMap<Int, EnchantedStaff>()
|
||||
|
||||
init {
|
||||
for (staff in EnchantedStaff.values()) {
|
||||
buttonMap[staff.buttonID] = staff
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the agility ticket interface.
|
||||
* @author afaroutdude
|
||||
*/
|
||||
@Initializable
|
||||
public final class MysticStaffEnchantingPlugin extends ComponentPlugin {
|
||||
|
||||
private final Component COMPONENT = new Component(332);
|
||||
|
||||
protected enum EnchantedStaff {
|
||||
AIR(Items.MYSTIC_AIR_STAFF_1405, Items.AIR_BATTLESTAFF_1397, 21),
|
||||
WATER(Items.MYSTIC_WATER_STAFF_1403, Items.WATER_BATTLESTAFF_1395, 22),
|
||||
EARTH(Items.MYSTIC_EARTH_STAFF_1407, Items.EARTH_BATTLESTAFF_1399, 23),
|
||||
FIRE(Items.MYSTIC_FIRE_STAFF_1401, Items.FIRE_BATTLESTAFF_1393, 24),
|
||||
LAVA(Items.MYSTIC_LAVA_STAFF_3054, Items.LAVA_BATTLESTAFF_3053, 25),
|
||||
MUD(Items.MYSTIC_MUD_STAFF_6563, Items.MUD_BATTLESTAFF_6562, 26),
|
||||
STEAM(Items.MYSTIC_STEAM_STAFF_11738, Items.STEAM_BATTLESTAFF_11736, 27);
|
||||
|
||||
public final int enchanted;
|
||||
public final int basic;
|
||||
public final int child;
|
||||
|
||||
private static final HashMap<Integer, Integer> basicToEnchanted = new HashMap<>();
|
||||
private static final HashMap<Integer, Integer> childToBasic = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (EnchantedStaff staff : EnchantedStaff.values()) {
|
||||
basicToEnchanted.put(staff.basic, staff.enchanted);
|
||||
childToBasic.put(staff.child, staff.basic);
|
||||
}
|
||||
}
|
||||
|
||||
EnchantedStaff(int enchantedId, int basicId, int childId) {
|
||||
this.enchanted = enchantedId;
|
||||
this.basic = basicId;
|
||||
this.child = childId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.forId(332).setPlugin(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(Player player, Component component) {
|
||||
super.open(player, component);
|
||||
// zoom doesn't work, but based on https://youtu.be/qxxhhCdxBsQ?t=75 seems correct anyway
|
||||
for (EnchantedStaff staff : EnchantedStaff.values()) {
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(staff.basic, 240, COMPONENT.getId(), staff.child);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int buttonId, int slot, int itemId) {
|
||||
|
||||
if (EnchantedStaff.childToBasic.containsKey(buttonId)) {
|
||||
Item basicStaff = new Item(EnchantedStaff.childToBasic.get(buttonId));
|
||||
Item enchantedStaff = new Item(EnchantedStaff.basicToEnchanted.get(basicStaff.getId()));
|
||||
|
||||
if (!player.getInventory().containsItem(basicStaff)) {
|
||||
player.getPacketDispatch().sendMessage("You don't have a" + (StringUtils.isPlusN(basicStaff.getName()) ? "n " : " ") + basicStaff.getName() + " to enchant.");
|
||||
return true;
|
||||
}
|
||||
int cost = player.getEquipment().contains(Items.SEERS_HEADBAND_14631, 1)? 27000 : 40000;
|
||||
if (!player.getInventory().contains(995, cost)) {
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().sendDialogues(389, null, "I need " + String.format("%,d", cost) + " coins for materials. Come", "back when you have the money!");
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().remove(basicStaff, new Item(995, cost))) {
|
||||
player.getInterfaceManager().close();
|
||||
player.getDialogueInterpreter().sendDialogues(389, null, "Just a moment... hang on... hocus pocus abra-", "cadabra... there you go! Enjoy your enchanted staff!");
|
||||
player.getInventory().add(enchantedStaff);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.prayer.PrayerType;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import static core.api.ContentAPIKt.hasRequirement;
|
||||
import content.data.Quests;
|
||||
|
||||
/**
|
||||
* Represents the prayer interface.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class PrayerTabInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(271, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
final PrayerType type = PrayerType.get(button);
|
||||
if (type == PrayerType.CHIVALRY || type == PrayerType.PIETY)
|
||||
if (!hasRequirement(player, Quests.KINGS_RANSOM))
|
||||
return true;
|
||||
if (type == null) {
|
||||
return true;
|
||||
}
|
||||
player.getPrayer().toggle(type);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.AchievementDiary;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.player.link.quest.Quest;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the quest tab reward buttons.
|
||||
* @author Emperor
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class QuestTabInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(274, this); // Quests
|
||||
ComponentDefinition.put(259, this); // Achievement diary
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player p, Component component, int opcode, int button, int slot, int itemId) {
|
||||
p.getPulseManager().clear();
|
||||
switch (component.getId()) {
|
||||
case 274:
|
||||
// if (!GameWorld.isEconomyWorld()) {
|
||||
// p.getSavedData().getSpawnData().handleButton(p, button);
|
||||
// }
|
||||
switch (button) {
|
||||
case 3:
|
||||
p.getAchievementDiaryManager().openTab();
|
||||
return true;
|
||||
case 10:
|
||||
break;
|
||||
default:
|
||||
// if (GameWorld.isEconomyWorld()) {
|
||||
|
||||
Quest quest = p.getQuestRepository().forButtonId(button);
|
||||
if (quest != null) {
|
||||
p.getInterfaceManager().open(new Component(275));
|
||||
quest.drawJournal(p, quest.getStage(p));
|
||||
return true;
|
||||
} else QuestTabUtils.showRequirementsInterface(p, button);
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 259:
|
||||
switch (button) {
|
||||
case 8:
|
||||
p.getInterfaceManager().openTab(2, new Component(274));
|
||||
return true;
|
||||
default:
|
||||
AchievementDiary diary = p.getAchievementDiaryManager().getDiary(DiaryType.forChild(button));
|
||||
if (diary != null) {
|
||||
diary.open(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class SettingTabInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(261, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player p, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (button) {
|
||||
case 10:// brightness
|
||||
int brightness = button - 7;
|
||||
p.getSettings().setBrightness(brightness);
|
||||
break;
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:// music
|
||||
int volume = 15 - button;
|
||||
p.getSettings().setMusicVolume(volume);
|
||||
break;
|
||||
case 16://530 settings
|
||||
/* if (TutorialSession.getExtension(p).getStage() != TutorialSession.MAX_STAGE) {
|
||||
p.sendMessage("You must finish the tutorial before opening the graphic settings.");
|
||||
break;
|
||||
}*/
|
||||
p.getInterfaceManager().open(new Component(742));
|
||||
break;
|
||||
case 18://530 settings
|
||||
p.getInterfaceManager().open(new Component(743));
|
||||
break;
|
||||
case 17:
|
||||
case 19:
|
||||
case 20:// sonund
|
||||
int volume1 = 20 - button;
|
||||
p.getSettings().setSoundEffectVolume(volume1);
|
||||
break;
|
||||
case 29:
|
||||
case 30:
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:// all sound
|
||||
int volume11 = 33 - button;
|
||||
p.getSettings().setAreaSoundVolume(volume11);
|
||||
break;
|
||||
case 6:// mouse
|
||||
p.getSettings().toggleMouseButton();
|
||||
break;
|
||||
case 4:// effects
|
||||
p.getSettings().toggleChatEffects();
|
||||
break;
|
||||
case 5:// private chat
|
||||
p.getSettings().toggleSplitPrivateChat();
|
||||
break;
|
||||
case 7:// aid
|
||||
if (p.getIronmanManager().checkRestriction()) {
|
||||
return true;
|
||||
}
|
||||
p.getSettings().toggleAcceptAid();
|
||||
break;
|
||||
case 3:// run
|
||||
p.getSettings().toggleRun();
|
||||
break;
|
||||
case 8:// house
|
||||
p.getInterfaceManager().close();
|
||||
setVarp(p, 261, getVarp(p, 261) & 0x1);
|
||||
p.getInterfaceManager().openSingleTab(new Component(398));
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Represents the plugin used for the skilling interface.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class SkillInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(499, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
setVarbit(player, 3288, player.getAttribute("skillMenu", -1));
|
||||
setVarbit(player, 3289, button - 10);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.skill.LevelUp;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.GameWorld;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the skilling tab.
|
||||
* @author Vexia
|
||||
* @author Splinter
|
||||
* @version 1.1
|
||||
*/
|
||||
@Initializable
|
||||
public final class SkillTabInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.put(320, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player p, Component component, int opcode, int button, int slot, int itemId) {
|
||||
final SkillConfig config = SkillConfig.forId(button);
|
||||
if (config == null) {
|
||||
return true;
|
||||
}
|
||||
if (!GameWorld.getSettings().isPvp()) {
|
||||
if (p.getAttribute("levelup:" + config.getSkillId(), false)) {
|
||||
p.removeAttribute("levelup:" + config.getSkillId());
|
||||
LevelUp.sendFlashingIcons(p, -1);
|
||||
setVarp(p, 1230, ADVANCE_CONFIGS[config.getSkillId()]);
|
||||
p.getInterfaceManager().open(new Component(741));
|
||||
} else {
|
||||
p.getPulseManager().clear();
|
||||
p.getInterfaceManager().open(new Component(499));
|
||||
setVarp(p, 965, config.getConfig());
|
||||
p.getAttributes().put("skillMenu", config.getConfig());
|
||||
}
|
||||
} else {
|
||||
if (config.getSkillId() > 6) {
|
||||
p.getPacketDispatch().sendMessage("You cannot set a target level for this skill.");
|
||||
return false;
|
||||
}
|
||||
if (p.canSpawn()) {
|
||||
p.sendMessage("You must be inside Edgeville bank to set levels.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds all the config values of the skill advances.
|
||||
*/
|
||||
public static final int[] ADVANCE_CONFIGS = {
|
||||
9, 40, 17, 49,
|
||||
25, 57, 33, 641,
|
||||
659, 664, 121, 649,
|
||||
89, 114, 107, 72,
|
||||
64, 80, 673, 680,
|
||||
99, 698, 689, 705,
|
||||
};
|
||||
|
||||
public enum SkillConfig {
|
||||
ATTACK(125, 1, Skills.ATTACK),
|
||||
STRENGTH(126, 2, Skills.STRENGTH),
|
||||
DEFENCE(127, 5, Skills.DEFENCE),
|
||||
RANGE(128, 3, Skills.RANGE),
|
||||
PRAYER(129, 7, Skills.PRAYER),
|
||||
MAGIC(130, 4, Skills.MAGIC),
|
||||
RUNECRAFTING(131, 12, Skills.RUNECRAFTING),
|
||||
HITPOINTS(133, 6, Skills.HITPOINTS),
|
||||
AGILITY(134, 8, Skills.AGILITY),
|
||||
HERBLORE(135, 9, Skills.HERBLORE),
|
||||
THIEVING(136, 10, Skills.THIEVING),
|
||||
CRAFTING(137, 11, Skills.CRAFTING),
|
||||
FLETCHING(138, 19, Skills.FLETCHING),
|
||||
SLAYER(139, 20, Skills.SLAYER),
|
||||
MINING(141, 13, Skills.MINING),
|
||||
SMITHING(142, 14, Skills.SMITHING),
|
||||
FISHING(143, 15, Skills.FISHING),
|
||||
COOKING(144, 16, Skills.COOKING),
|
||||
FIREMAKING(145, 17, Skills.FIREMAKING),
|
||||
WOODCUTTING(146, 18, Skills.WOODCUTTING),
|
||||
FARMING(147, 21, Skills.FARMING),
|
||||
CONSTRUCTION(132, 22, Skills.CONSTRUCTION),
|
||||
HUNTER(140, 23, Skills.HUNTER),
|
||||
SUMMONING(148, 24, Skills.SUMMONING);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SkillConfig} {@code Object}.
|
||||
* @param button the button.
|
||||
* @param config the config.
|
||||
*/
|
||||
SkillConfig(int button, int config, int skillId) {
|
||||
this.button = button;
|
||||
this.config = config;
|
||||
this.skillId = skillId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the button.
|
||||
*/
|
||||
private int button;
|
||||
|
||||
/**
|
||||
* Represents the config.
|
||||
*/
|
||||
private int config;
|
||||
|
||||
/**
|
||||
* The skill id.
|
||||
*/
|
||||
private int skillId;
|
||||
|
||||
/**
|
||||
* Gets the skill config.
|
||||
* @param id the id.
|
||||
* @return the skill config.
|
||||
*/
|
||||
public static SkillConfig forId(int id) {
|
||||
for (SkillConfig config : SkillConfig.values()) {
|
||||
if (config.button == id)
|
||||
return config;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the button.
|
||||
* @return the button.
|
||||
*/
|
||||
public int getButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the config.
|
||||
* @return the config.
|
||||
*/
|
||||
public int getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the skill id.
|
||||
* @return The skill id.
|
||||
*/
|
||||
public int getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.api.sendInputDialogue
|
||||
import core.api.sendMessage
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.system.communication.ClanRank
|
||||
import core.game.system.communication.ClanRepository
|
||||
import core.net.amsc.MSPacketRepository
|
||||
import core.net.amsc.WorldCommunicator
|
||||
import core.tools.StringUtils
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class ClanTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.CLANJOIN_589) { player, _, _, buttonID, _, _ ->
|
||||
if (buttonID == 9) {
|
||||
if (player.interfaceManager.opened != null) {
|
||||
sendMessage(player, "Please close the interface you have open before using 'Clan Setup'")
|
||||
} else {
|
||||
ClanRepository.openSettings(player)
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonID == 14) {
|
||||
player.communication.toggleLootshare(player)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Components.CLANSETUP_590) { player, _, opcode, buttonID, _, _ ->
|
||||
val clan = ClanRepository.get(player.name, true)
|
||||
|
||||
when (buttonID) {
|
||||
22 -> {
|
||||
if (opcode == 155) {
|
||||
sendInputDialogue(player, false, "Enter clan prefix:", ) { value ->
|
||||
val clanName = StringUtils.formatDisplayName(value.toString())
|
||||
|
||||
if (WorldCommunicator.isEnabled()) { MSPacketRepository.sendClanRename(player, clanName) }
|
||||
|
||||
if (clan.name == "Chat disabled") {
|
||||
sendMessage(player, "Your clan channel has now been enabled!")
|
||||
sendMessage(player, "Join your channel by clicking 'Join Chat' and typing: ${player.username}")
|
||||
}
|
||||
|
||||
clan.name = clanName
|
||||
player.communication.clanName = clanName
|
||||
clan.updateSettings(player)
|
||||
clan.update()
|
||||
}
|
||||
}
|
||||
|
||||
if (opcode == 196) {
|
||||
clan.name = "Chat disabled"
|
||||
player.communication.clanName = ""
|
||||
if (WorldCommunicator.isEnabled()) { MSPacketRepository.sendClanRename(player, player.communication.clanName) }
|
||||
clan.updateSettings(player)
|
||||
clan.delete()
|
||||
}
|
||||
}
|
||||
|
||||
23 -> {
|
||||
clan.joinRequirement = getRank(opcode)
|
||||
player.communication.joinRequirement = clan.joinRequirement
|
||||
MSPacketRepository.setClanSetting(player, 0, clan.joinRequirement)
|
||||
}
|
||||
|
||||
24 -> {
|
||||
clan.messageRequirement = getRank(opcode)
|
||||
player.communication.messageRequirement = clan.messageRequirement
|
||||
MSPacketRepository.setClanSetting(player, 1, clan.messageRequirement)
|
||||
}
|
||||
|
||||
25 -> {
|
||||
clan.kickRequirement = getRank(opcode)
|
||||
player.communication.kickRequirement = clan.kickRequirement
|
||||
MSPacketRepository.setClanSetting(player, 2, clan.kickRequirement)
|
||||
}
|
||||
|
||||
26 -> {
|
||||
clan.lootRequirement = if (opcode == 155) ClanRank.ADMINISTRATOR else getRank(opcode)
|
||||
player.communication.lootRequirement = clan.lootRequirement
|
||||
MSPacketRepository.setClanSetting(player, 3, clan.lootRequirement)
|
||||
}
|
||||
|
||||
33 -> sendMessage(player, "CoinShare is not available.")
|
||||
}
|
||||
|
||||
clan.updateSettings(player)
|
||||
clan.update()
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
fun getRank(opcode: Int): ClanRank {
|
||||
return when (opcode) {
|
||||
155 -> ClanRank.NONE
|
||||
196 -> ClanRank.FRIEND
|
||||
124 -> ClanRank.RECRUIT
|
||||
199 -> ClanRank.CORPORAL
|
||||
234 -> ClanRank.SERGEANT
|
||||
168 -> ClanRank.LIEUTENANT
|
||||
166 -> ClanRank.CAPTAIN
|
||||
64 -> ClanRank.GENERAL
|
||||
53 -> ClanRank.OWNER
|
||||
else -> ClanRank.NONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package content.global.handlers.iface;
|
||||
package content.global.handlers.iface.tabs;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.link.emote.Emotes
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class EmoteTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.EMOTES_464) { player, _, _, buttonID, _, _ ->
|
||||
Emotes.handle(player, buttonID)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import content.global.skill.summoning.familiar.BurdenBeast
|
||||
import core.api.*
|
||||
|
||||
import core.game.container.access.InterfaceContainer
|
||||
import core.game.container.impl.EquipmentContainer
|
||||
import core.game.global.action.EquipHandler
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListeners
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.combat.DeathTask
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.prayer.PrayerType
|
||||
import core.tools.Log
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
|
||||
class EquipmentTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
onOpen(ITEMS_KEPT_ON_DEATH_102) { player, component ->
|
||||
/**
|
||||
* (Highlight white items are auto destroyed on death Enum#616 (Items kept on death interface) TODO: Parse server sided
|
||||
* CS2 Script 118 - Items kept on death interface
|
||||
* Credit Woahscam for figuring this all out.
|
||||
* @arg_0 (Int): Zone type - 0 Default/1 Safe/2 POH/3 Castle Wars/4 Trouble Brewing/5 Barbarian Assault
|
||||
* @arg_1 (Int): Amount of items kept on death - 0/1/3/4
|
||||
* @arg_2 (Object): Item kept on death - slot 0 item id
|
||||
* @arg_3 (Object): Item kept on death - slot 1 item id
|
||||
* @arg_4 (Object): Item kept on death - slot 2 item id
|
||||
* @arg_5 (Object): Item kept on death - slot 3 item id
|
||||
* @arg_6 (Int): Player is skulled - 0 Not Skulled/1 Skulled
|
||||
* @arg_7 (Int): Player has BoB summoned with items - 0 BoB not summoned or has no items /1 BoB summoned with items
|
||||
* @arg_8 (String): String to append based on amount of items kept on death.
|
||||
*/
|
||||
val zoneType = player.zoneMonitor.type
|
||||
val itemsKeptOnDeath = DeathTask.getContainers(player)[0]
|
||||
val amountKeptOnDeath = if (!player.skullManager.isSkulled && itemsKeptOnDeath.itemCount() < 3) {
|
||||
if (player.prayer[PrayerType.PROTECT_ITEMS]) 4 else 3
|
||||
} else {
|
||||
itemsKeptOnDeath.itemCount()
|
||||
}
|
||||
val slot0 = itemsKeptOnDeath.getId(0)
|
||||
val slot1 = itemsKeptOnDeath.getId(1)
|
||||
val slot2 = itemsKeptOnDeath.getId(2)
|
||||
val slot3 = itemsKeptOnDeath.getId(3)
|
||||
val hasSkull = if (player.skullManager.isSkulled) 1 else 0
|
||||
val beast: BurdenBeast? = if (player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast) player.familiarManager.familiar as BurdenBeast else null
|
||||
val hasBob = if (beast != null && !beast.container.isEmpty) 1 else 0
|
||||
val message = "You are skulled."
|
||||
val cs2Args = arrayOf<Any>(hasBob, hasSkull, slot3, slot2, slot1, slot0, amountKeptOnDeath, zoneType, message)
|
||||
|
||||
if (amountKeptOnDeath > 4 && zoneType == 0) {
|
||||
log(this::class.java, Log.ERR, "Items kept on death interface should not contain more than 4 items when not in a safe zone!")
|
||||
}
|
||||
|
||||
player.packetDispatch.sendRunScript(118, "siiooooii", *cs2Args)
|
||||
|
||||
val settings = IfaceSettingsBuilder().enableAllOptions().build()
|
||||
player.packetDispatch.sendIfaceSettings(settings, 18, component.id, 0, itemsKeptOnDeath.itemCount())
|
||||
player.packetDispatch.sendIfaceSettings(settings, 21, component.id, 0, DeathTask.getContainers(player)[1].itemCount())
|
||||
return@onOpen true
|
||||
}
|
||||
|
||||
on(Components.WORNITEMS_387) { player, component, opcode, buttonID, slot, itemID ->
|
||||
when (buttonID) {
|
||||
28 -> {
|
||||
if (opcode == 81) EquipHandler.unequip(player, slot, itemID)
|
||||
if (opcode == 206) operateItem(player, slot)
|
||||
}
|
||||
52 -> openInterface(player, ITEMS_KEPT_ON_DEATH_102)
|
||||
55 -> openInterface(player, Components.EQUIP_SCREEN2_667)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
onOpen(Components.EQUIP_SCREEN2_667) { player, component ->
|
||||
val settings = IfaceSettingsBuilder().enableAllOptions().build()
|
||||
player.packetDispatch.sendIfaceSettings(settings, 14, component.id, 0, 13)
|
||||
EquipmentContainer.update(player)
|
||||
openSingleTab(player, Components.INVENTORY_WEAR2_670)
|
||||
return@onOpen true
|
||||
}
|
||||
|
||||
on(Components.EQUIP_SCREEN2_667) { player, _, opcode, buttonID, slot, itemID ->
|
||||
if (buttonID == 14) {
|
||||
when (opcode) {
|
||||
9 -> sendMessage(player, player.equipment.get(slot).definition.examine)
|
||||
155 -> EquipHandler.unequip(player, slot, itemID)
|
||||
196 -> operateItem(player, slot)
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
onClose(Components.EQUIP_SCREEN2_667) { player, _ ->
|
||||
closeTabInterface(player)
|
||||
return@onClose true
|
||||
}
|
||||
|
||||
onOpen(Components.INVENTORY_WEAR2_670) { player, component ->
|
||||
InterfaceContainer.generateItems(player, player.inventory.toArray(), arrayOf("Equip"), component.id, 0, 7, 4, 93)
|
||||
return@onOpen true
|
||||
}
|
||||
|
||||
on(Components.INVENTORY_WEAR2_670) { player, _, opcode, _, slot, _ ->
|
||||
if (opcode == 9) sendMessage(player, player.inventory.get(slot).definition.examine)
|
||||
if (opcode == 155) equipItem(player, slot)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
private fun equipItem(player: Player, slot: Int) {
|
||||
val item = player.inventory.get(slot) ?: return
|
||||
|
||||
if (item.definition.options.any { it in arrayOf("Equip", "Wield", "Wear") } || item.id == Items.BEER_1917) {
|
||||
InteractionListeners.run(item.id, IntType.ITEM, "equip", player, item)
|
||||
} else {
|
||||
sendMessage(player, "You can't wear that.")
|
||||
}
|
||||
}
|
||||
|
||||
private fun operateItem(player: Player, slot: Int) {
|
||||
val item = player.equipment.get(slot) ?: return
|
||||
|
||||
when {
|
||||
InteractionListeners.run(item.id, IntType.ITEM, "operate", player, item) -> return
|
||||
item.operateHandler?.handle(player, item, "operate") == true -> return
|
||||
else -> sendMessage(player, "You can't operate that.")
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ITEMS_KEPT_ON_DEATH_102 = 102
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.api.sendMessage
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.world.repository.Repository
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class LogoutTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.LOGOUT_182) { player, _, _, buttonID, _, _ ->
|
||||
if (buttonID == 6) {
|
||||
return@on when {
|
||||
!player.zoneMonitor.canLogout() -> true
|
||||
|
||||
player.inCombat() -> {
|
||||
sendMessage(player, "You can't log out until 10 seconds after the end of combat.")
|
||||
true
|
||||
}
|
||||
|
||||
player.isTeleporting -> {
|
||||
sendMessage(player, "Please finish your teleport before logging out.")
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
Repository.disconnectionQueue.add(player)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import content.global.skill.magic.SpellListener
|
||||
import content.global.skill.magic.SpellListeners
|
||||
import core.api.getAttribute
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.combat.spell.MagicSpell
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook
|
||||
import core.game.world.GameWorld
|
||||
|
||||
class MagicTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
SpellBook.values().forEach {
|
||||
on(it.interfaceId) { player, _, _, buttonID, _, _ ->
|
||||
if (GameWorld.ticks < getAttribute(player, "magic:delay", -1)) return@on true
|
||||
|
||||
SpellListeners.run(buttonID, SpellListener.NONE, it.name.lowercase(), player)
|
||||
|
||||
return@on MagicSpell.castSpell(player, it, buttonID, player)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.api.sendMessage
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.link.music.MusicEntry
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class MusicTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.MUSIC_V3_187) { player, _, opcode, buttonID, slot, _ ->
|
||||
if (opcode == 155) {
|
||||
if (buttonID == 11) {
|
||||
player.musicPlayer.toggleLooping()
|
||||
return@on true
|
||||
}
|
||||
|
||||
if (buttonID == 1) {
|
||||
if (player.musicPlayer.unlocked[slot] != null) {
|
||||
player.musicPlayer.play(player.musicPlayer.unlocked[slot])
|
||||
return@on true
|
||||
}
|
||||
|
||||
if (player.isAdmin) {
|
||||
for (entry in MusicEntry.getSongs().values) {
|
||||
if (entry.index == slot) {
|
||||
player.musicPlayer.unlock(entry.id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendMessage(player, "You have not unlocked this piece of music yet!")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.link.prayer.PrayerType
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class PrayerTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.PRAYER_271) { player, _, _, buttonID, _, _ ->
|
||||
val prayer = PrayerType.get(buttonID) ?: return@on true
|
||||
return@on player.prayer.toggle(prayer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import content.global.handlers.iface.tabs.QuestTabUtils.showRequirementsInterface
|
||||
import core.api.openInterface
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class QuestTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.QUESTJOURNAL_V2_274) { player, _, _, buttonID, _, _ ->
|
||||
if (buttonID == 3) {
|
||||
player.achievementDiaryManager.openTab()
|
||||
} else {
|
||||
val quest = player.questRepository.forButtonId(buttonID)
|
||||
if (quest != null) {
|
||||
openInterface(player, Components.QUESTJOURNAL_SCROLL_275)
|
||||
quest.drawJournal(player, quest.getStage(player))
|
||||
} else {
|
||||
showRequirementsInterface(player, buttonID)
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Components.AREA_TASK_259) { player, _, _, buttonID, _, _ ->
|
||||
if (buttonID == 8) {
|
||||
player.interfaceManager.openTab(2, Component(Components.QUESTJOURNAL_V2_274))
|
||||
} else {
|
||||
player.achievementDiaryManager.getDiary(DiaryType.forChild(buttonID))?.open(player)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package content.global.handlers.iface
|
||||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.game.requirement.*
|
||||
import core.api.*
|
||||
|
|
@ -242,4 +242,4 @@ object QuestTabUtils {
|
|||
}
|
||||
return quest as String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.api.*
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.link.IronmanMode
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class SettingsTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.OPTIONS_261) { player, _, _, buttonID, _, _ ->
|
||||
when (buttonID) {
|
||||
RUN -> player.settings.toggleRun()
|
||||
CHAT_EFFECTS -> player.settings.toggleChatEffects()
|
||||
SPLIT_PM -> player.settings.toggleSplitPrivateChat()
|
||||
MOUSE -> player.settings.toggleMouseButton()
|
||||
AID -> restrictForIronman(player, IronmanMode.STANDARD) { player.settings.toggleAcceptAid() }
|
||||
HOUSE -> openSingleTab(player, Components.POH_HOUSE_OPTIONS_398)
|
||||
GRAPHICS -> openInterface(player, Components.GRAPHICS_OPTIONS_742)
|
||||
AUDIO -> openInterface(player, Components.SOUND_OPTIONS_743)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val RUN = 3
|
||||
const val CHAT_EFFECTS = 4
|
||||
const val SPLIT_PM = 5
|
||||
const val MOUSE = 6
|
||||
const val AID = 7
|
||||
const val HOUSE = 8
|
||||
const val GRAPHICS = 16
|
||||
const val AUDIO = 18
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package content.global.handlers.iface.tabs
|
||||
|
||||
import core.api.*
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.skill.LevelUp
|
||||
import core.game.node.entity.skill.Skills
|
||||
import org.rs09.consts.Components
|
||||
|
||||
|
||||
class StatsTabInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.STATS_320) { player, _, _, buttonID, _, _ ->
|
||||
val config = skillMap[buttonID] ?: return@on true
|
||||
|
||||
if (getAttribute(player, "levelup:${config.skillID}", false)) {
|
||||
removeAttributes(player, "levelup:${config.skillID}")
|
||||
LevelUp.sendFlashingIcons(player, -1)
|
||||
setVarp(player, 1230, ADVANCE_CONFIGS[config.skillID])
|
||||
openInterface(player, 741)
|
||||
} else {
|
||||
openInterface(player, Components.SKILL_GUIDE_V2_499)
|
||||
setVarp(player, 965, config.configID)
|
||||
setAttribute(player, "skillMenu", config.configID)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Components.SKILL_GUIDE_V2_499) { player, _, _, buttonID, _, _ ->
|
||||
setVarbit(player, 3288, getAttribute(player, "skillMenu", -1))
|
||||
setVarbit(player, 3289, buttonID - 10)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(LEVEL_UP_INTERFACE_740) { player, component, opcode, buttonID, slot, itemID ->
|
||||
if (buttonID == 3) {
|
||||
closeInterface(player)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
enum class SkillConfig(val buttonID: Int, val configID: Int, val skillID: Int) {
|
||||
ATTACK(125, 1, Skills.ATTACK),
|
||||
STRENGTH(126, 2, Skills.STRENGTH),
|
||||
DEFENCE(127, 5, Skills.DEFENCE),
|
||||
RANGE(128, 3, Skills.RANGE),
|
||||
PRAYER(129, 7, Skills.PRAYER),
|
||||
MAGIC(130, 4, Skills.MAGIC),
|
||||
RUNECRAFT(131, 12, Skills.RUNECRAFTING),
|
||||
HITPOINTS(133, 6, Skills.HITPOINTS),
|
||||
AGILITY(134, 8, Skills.AGILITY),
|
||||
HERBLORE(135, 9, Skills.HERBLORE),
|
||||
THIEVING(136, 10, Skills.THIEVING),
|
||||
CRAFTING(137, 11, Skills.CRAFTING),
|
||||
FLETCHING(138, 19, Skills.FLETCHING),
|
||||
SLAYER(139, 20, Skills.SLAYER),
|
||||
MINING(141, 13, Skills.MINING),
|
||||
SMITHING(142, 14, Skills.SMITHING),
|
||||
FISHING(143, 15, Skills.FISHING),
|
||||
COOKING(144, 16, Skills.COOKING),
|
||||
FIREMAKING(145, 17, Skills.FIREMAKING),
|
||||
WOODCUTTING(146, 18, Skills.WOODCUTTING),
|
||||
FARMING(147, 21, Skills.FARMING),
|
||||
CONSTRUCTION(132, 22, Skills.CONSTRUCTION),
|
||||
HUNTER(140, 23, Skills.HUNTER),
|
||||
SUMMONING(148, 24, Skills.SUMMONING),
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val LEVEL_UP_INTERFACE_740 = 740
|
||||
val skillMap= HashMap<Int, SkillConfig>()
|
||||
val ADVANCE_CONFIGS = intArrayOf(
|
||||
9, 40, 17, 49,
|
||||
25, 57, 33, 641,
|
||||
659, 664, 121, 649,
|
||||
89, 114, 107, 72,
|
||||
64, 80, 673, 680,
|
||||
99, 698, 689, 705
|
||||
)
|
||||
|
||||
init {
|
||||
for (skill in SkillConfig.values()) {
|
||||
skillMap[skill.buttonID] = skill
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,12 +3,11 @@ package content.global.skill.construction;
|
|||
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.build.DynamicRegion;
|
||||
import core.game.world.map.zone.MapZone;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.game.world.map.Region;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.zone.ZoneRestriction;
|
||||
import core.game.world.map.zone.ZoneType;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
|
|
@ -44,6 +43,7 @@ public final class HouseZone extends MapZone {
|
|||
|
||||
@Override
|
||||
public void configure() {
|
||||
setZoneType(ZoneType.P_O_H.getId());
|
||||
unregisterOldRegions();
|
||||
registerRegion(house.getHouseRegion().getId());
|
||||
if (house.getDungeonRegion() != null) {
|
||||
|
|
@ -82,7 +82,7 @@ public final class HouseZone extends MapZone {
|
|||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
HouseManager.leave(p);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return super.death(e, killer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package content.minigame.barbassault
|
||||
|
||||
import core.api.MapArea
|
||||
import core.api.getRegionBorders
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneType
|
||||
|
||||
class BarbAssaultArea : MapArea {
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
return arrayOf(getRegionBorders(7509))
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
zone.zoneType = ZoneType.BARBARIAN_ASSAULT.id
|
||||
super.areaEnter(entity)
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import core.game.node.entity.player.Player
|
|||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneType
|
||||
import core.tools.Log
|
||||
import core.tools.ticksPerMinute
|
||||
import org.rs09.consts.Components
|
||||
|
|
@ -70,6 +71,7 @@ class CastleWarsGameArea : CastleWarsArea(), TickListener {
|
|||
override fun areaEnter(entity: Entity) {
|
||||
val player = entity as? Player ?: return
|
||||
super.areaEnter(player)
|
||||
zone.zoneType = ZoneType.CASTLE_WARS.id
|
||||
registerTimer (player, spawnTimer("teleblock", (CastleWars.gameTimeMinutes)*60*2))
|
||||
|
||||
if (saradominPlayers.contains(player)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package content.minigame.troublebrewing
|
||||
|
||||
import core.api.MapArea
|
||||
import core.api.getRegionBorders
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneType
|
||||
|
||||
class TroubleBrewingArea : MapArea {
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
return arrayOf(getRegionBorders(15150))
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
zone.zoneType = ZoneType.TROUBLE_BREWING.id
|
||||
super.areaEnter(entity)
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import core.game.diary.DiaryLevel
|
|||
import core.game.event.*
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.entity.player.link.prayer.PrayerType
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
|
|
@ -30,6 +31,7 @@ class SeersVillageAchievementDiary : DiaryEventHookBase(DiaryType.SEERS_VILLAGE)
|
|||
private val SEERS_VILLAGE_AREA = ZoneBorders(2687, 3455, 2742, 3507)
|
||||
private val SEERS_BANK_AREA = ZoneBorders(2721, 3490, 2730, 3493)
|
||||
private val SEERS_COAL_TRUCKS_AREA = ZoneBorders(2690, 3502, 2699, 3508)
|
||||
private val SEERS_COURTHOUSE_AREA = ZoneBorders(2732, 3467, 2739, 3471)
|
||||
|
||||
private val RANGING_GUILD_LOCATION = Location(2657, 3439)
|
||||
|
||||
|
|
@ -352,4 +354,14 @@ class SeersVillageAchievementDiary : DiaryEventHookBase(DiaryType.SEERS_VILLAGE)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAreaVisited(player: Player) {
|
||||
if (inBorders(player, SEERS_COURTHOUSE_AREA) && player.prayer.equals(PrayerType.PIETY)) {
|
||||
finishTask(
|
||||
player,
|
||||
DiaryLevel.HARD,
|
||||
HardTasks.ENTER_SEERS_COURTHOUSE_WITH_PIETY
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1918,7 +1918,7 @@ fun runTask(entity: Entity, delay: Int = 0, repeatTimes: Int = 1, task: () -> Un
|
|||
entity.pulseManager.run(object : Pulse(delay) {
|
||||
override fun pulse(): Boolean {
|
||||
task.invoke()
|
||||
return --cycles == 0
|
||||
return --cycles <= 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1544,27 +1544,6 @@ public class ItemDefinition extends Definition<Item> {
|
|||
*/
|
||||
private static final String[] BONUS_NAMES = { "Stab: ", "Slash: ", "Crush: ", "Magic: ", "Ranged: ", "Stab: ", "Slash: ", "Crush: ", "Magic: ", "Ranged: ", "Summoning: ", "Strength: ", "Prayer: " };
|
||||
|
||||
/**
|
||||
* Updates the equipment stats interface.
|
||||
* @param player The player to update for.
|
||||
*/
|
||||
public static void statsUpdate(Player player) {
|
||||
if (!player.getAttribute("equip_stats_open", false)) {
|
||||
return;
|
||||
}
|
||||
int index = 0;
|
||||
int[] bonuses = player.getProperties().getBonuses();
|
||||
for (int i = 36; i < 50; i++) {
|
||||
if (i == 47) {
|
||||
continue;
|
||||
}
|
||||
int bonus = bonuses[index];
|
||||
String bonusValue = bonus > -1 ? ("+" + bonus) : Integer.toString(bonus);
|
||||
player.getPacketDispatch().sendString(BONUS_NAMES[index++] + bonusValue, 667, i);
|
||||
}
|
||||
player.getPacketDispatch().sendString("Attack bonus", 667, 34);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it has a plugin.
|
||||
* @return {@code True} if so.
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import core.plugin.Plugin;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
import core.game.interaction.InteractionListeners;
|
||||
import core.game.system.config.ItemConfigParser;
|
||||
import org.rs09.consts.Components;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
@ -303,11 +304,11 @@ public final class EquipmentContainer extends Container {
|
|||
player.removeAttribute("dfs_spec");
|
||||
player.getProperties().getCombatPulse().setHandler(null);
|
||||
if (!player.getSettings().isSpecialToggled()) {
|
||||
setVarp(player, 301, 0);
|
||||
setVarp(player, 301, 0);
|
||||
}
|
||||
}
|
||||
player.getAppearance().setAnimations();
|
||||
player.updateAppearance();
|
||||
player.updateAppearance();
|
||||
player.getSettings().updateWeight();
|
||||
updateBonuses(player);
|
||||
}
|
||||
|
|
@ -349,7 +350,9 @@ public final class EquipmentContainer extends Container {
|
|||
bonuses[10] += increase;
|
||||
}
|
||||
player.getProperties().setBonuses(bonuses);
|
||||
update(player);
|
||||
if (player.getInterfaceManager().hasMainComponent(Components.EQUIP_SCREEN2_667)) {
|
||||
update(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -357,9 +360,6 @@ public final class EquipmentContainer extends Container {
|
|||
* @param player The player to update for.
|
||||
*/
|
||||
public static void update(Player player) {
|
||||
if (!player.getInterfaceManager().hasMainComponent(667)) {
|
||||
return;
|
||||
}
|
||||
int index = 0;
|
||||
int[] bonuses = player.getProperties().getBonuses();
|
||||
for (int i = 36; i < 50; i++) {
|
||||
|
|
@ -370,6 +370,7 @@ public final class EquipmentContainer extends Container {
|
|||
String bonusValue = bonus > -1 ? ("+" + bonus) : Integer.toString(bonus);
|
||||
player.getPacketDispatch().sendString(BONUS_NAMES[index++] + bonusValue, 667, i);
|
||||
}
|
||||
player.getSettings().updateWeight();
|
||||
player.getPacketDispatch().sendString("Attack bonus", 667, 34);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package core.game.node.entity.player.info.login;
|
||||
|
||||
import core.game.component.CloseEvent;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.emote.Emotes;
|
||||
|
|
@ -48,22 +47,17 @@ public final class LoginConfiguration {
|
|||
*/
|
||||
private static final Component LOBBY_PANE = new Component(549);
|
||||
|
||||
/**
|
||||
* The lobby interface component.
|
||||
*/
|
||||
private static final Component LOBBY_INTERFACE = new Component(378);
|
||||
|
||||
/**
|
||||
* The lobby message of the week models & constant to be set for auto selecting the models
|
||||
*/
|
||||
private static final int[] MESSAGE_MODEL = {15, 16, 17, 18, 19, 20, 21, 22, 23, 405, 447, 622, 623, 679, 715, 800};
|
||||
private static int messModel;
|
||||
|
||||
/**
|
||||
* The lobby interface close event.
|
||||
*/
|
||||
private static final Component LOBBY_INTERFACE = new Component(378).setCloseEvent(new CloseEvent() {
|
||||
@Override
|
||||
public boolean close(Player player, Component c) {
|
||||
return player.getLocks().isLocked("login");
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code LoginConfiguration} {@Code Object}
|
||||
*/
|
||||
|
|
@ -102,25 +96,25 @@ public final class LoginConfiguration {
|
|||
}
|
||||
}
|
||||
Repository.getLobbyPlayers().add(player);
|
||||
player.getPacketDispatch().sendString(getLastLogin(player), 378, 116);
|
||||
player.getPacketDispatch().sendString("Welcome to " + GameWorld.getSettings().getName(), 378, 115);
|
||||
player.getPacketDispatch().sendString(" ", 378, 37);
|
||||
player.getPacketDispatch().sendString("Want to stay up to date with the latest news and updates? Join our <br>discord by using the link below!", 378, 38);
|
||||
player.getPacketDispatch().sendString(" ", 378, 39);
|
||||
player.getPacketDispatch().sendString("Discord Invite", 378, 14);
|
||||
player.getPacketDispatch().sendString("Discord Invite", 378, 129);
|
||||
player.getPacketDispatch().sendString("Credits", 378, 94);
|
||||
player.getPacketDispatch().sendString(player.getDetails().getCredits() + "", 378, 96);
|
||||
player.getPacketDispatch().sendString(" ", 378, 229);
|
||||
player.getPacketDispatch().sendString("Want to contribute to " + ServerConstants.SERVER_NAME + "? <br>Visit the GitLab using the link below!", 378, 230);
|
||||
player.getPacketDispatch().sendString(" ", 378, 231);
|
||||
player.getPacketDispatch().sendString("Github", 378, 240);
|
||||
player.getPacketDispatch().sendString(GameWorld.getSettings().getMessage_string(), messModel, getMessageChild(messModel));
|
||||
player.getPacketDispatch().sendString("You can gain more credits by voting, reporting bugs and various other methods of contribution.", 378, 93);
|
||||
setInterfaceText(player, "Welcome to " + ServerConstants.SERVER_NAME, 378, 115);
|
||||
setInterfaceText(player, getLastLogin(player), 378, 116);
|
||||
setInterfaceText(player, "", 378, 37);
|
||||
setInterfaceText(player, "Want to stay up to date with the latest news and updates? Join our discord by using the link on our website!", 378, 38);
|
||||
setInterfaceText(player, "", 378, 39);
|
||||
setInterfaceText(player, "Discord Invite", 378, 14);
|
||||
setInterfaceText(player, "Discord Invite", 378, 129);
|
||||
setInterfaceText(player, "You can gain more credits by reporting bugs and various other methods of contribution.", 378, 93);
|
||||
setInterfaceText(player, player.getDetails().getCredits() + "", 378, 96);
|
||||
setInterfaceText(player, "Credits", 378, 94);
|
||||
setInterfaceText(player, "", 378, 229);
|
||||
setInterfaceText(player, "Want to contribute to " + ServerConstants.SERVER_NAME + "? Visit the GitLab using the link on our website!", 378, 230);
|
||||
setInterfaceText(player, "", 378, 231);
|
||||
setInterfaceText(player, "Github", 378, 240);
|
||||
setInterfaceText(player, GameWorld.getSettings().getMessage_string(), messModel, getMessageChild(messModel));
|
||||
player.getInterfaceManager().openWindowsPane(LOBBY_PANE);
|
||||
player.getInterfaceManager().setOpened(LOBBY_INTERFACE);
|
||||
PacketRepository.send(Interface.class, new InterfaceContext(player, 549, 2, 378, true));
|
||||
PacketRepository.send(Interface.class, new InterfaceContext(player, 549, 3, messModel, true));//UPDATE `configs` SET `value`=FLOOR(RAND()*(25-10)+10) WHERE key_="messageInterface"
|
||||
PacketRepository.send(Interface.class, new InterfaceContext(player, LOBBY_PANE.getId(), 2, 378, true));
|
||||
PacketRepository.send(Interface.class, new InterfaceContext(player, LOBBY_PANE.getId(), 3, messModel, true));//UPDATE `configs` SET `value`=FLOOR(RAND()*(25-10)+10) WHERE key_="messageInterface"
|
||||
player.getDetails().setLastLogin(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
|
@ -168,12 +162,11 @@ public final class LoginConfiguration {
|
|||
|
||||
// 1050 is checked client-side for making piety/chivalry disallowed sfx, likely due to the minigame requirement.
|
||||
// Set it here unconditionally until the minigame is implemented.
|
||||
setVarbit(player, 3909, 8, false);
|
||||
if (hasRequirement(player, Quests.KINGS_RANSOM, false)) {
|
||||
setVarbit(player, 3909, 8, false);
|
||||
}
|
||||
if(ServerConstants.RULES_AND_INFO_ENABLED)
|
||||
RulesAndInfo.openFor(player);
|
||||
/*if (GameWorld.getSettings().isPvp()) {
|
||||
player.getPacketDispatch().sendString("", 226, 1);
|
||||
}*/
|
||||
/*if (TutorialSession.getExtension(player).getStage() != 73) {
|
||||
TutorialStage.load(player, TutorialSession.getExtension(player).getStage(), true);
|
||||
}*/
|
||||
|
|
@ -206,21 +199,14 @@ public final class LoginConfiguration {
|
|||
* @param player the player. Fullscreen mode Object id:
|
||||
*/
|
||||
public static final void welcome(final Player player) {
|
||||
if (GameWorld.getSettings().isPvp()) {
|
||||
player.getPacketDispatch().sendString("", 226, 0);
|
||||
}
|
||||
if (player.isArtificial()) {
|
||||
|
||||
return;
|
||||
}
|
||||
player.getPacketDispatch().sendMessage("Welcome to " + GameWorld.getSettings().getName() + ".");
|
||||
//player.getPacketDispatch().sendMessage("You are currently playing in beta version 1.2");
|
||||
player.getPacketDispatch().sendMessage("Welcome to " + ServerConstants.SERVER_NAME + ".");
|
||||
if (player.getDetails().isMuted()) {
|
||||
player.getPacketDispatch().sendMessage("You are muted.");
|
||||
player.getPacketDispatch().sendMessage("To prevent further mutes please read the rules.");
|
||||
}
|
||||
// ResourceAIPManager.get().load(player);
|
||||
// ResourceAIPManager.get().save(player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -240,7 +226,8 @@ public final class LoginConfiguration {
|
|||
player.getPacketDispatch().sendRunEnergy();
|
||||
player.getFamiliarManager().login();
|
||||
player.getInterfaceManager().openDefaultTabs();
|
||||
player.getPacketDispatch().sendString("Friends List - World " + GameWorld.getSettings().getWorldId(), 550, 3);
|
||||
setInterfaceText(player, "Friends List - " + ServerConstants.SERVER_NAME + " " + GameWorld.getSettings().getWorldId(), 550, 3);
|
||||
setInterfaceText(player, "When you have finished playing " + ServerConstants.SERVER_NAME + ", always use the button below to logout safely.", 182, 0);
|
||||
player.getQuestRepository().syncronizeTab(player);
|
||||
player.getInterfaceManager().close();
|
||||
player.getEmoteManager().refresh();
|
||||
|
|
@ -260,11 +247,11 @@ public final class LoginConfiguration {
|
|||
return 8;
|
||||
} else if (interfaceId == 16) {
|
||||
return 6;
|
||||
} else if (interfaceId == 17 || interfaceId == 15 || interfaceId == 18 || interfaceId == 19 || interfaceId == 21 || interfaceId == 22 || interfaceId == 447 || interfaceId == 405) {
|
||||
return 4;
|
||||
} else if (interfaceId == 20 || interfaceId == 623) {
|
||||
return 5;
|
||||
} else if (interfaceId == 23 || interfaceId == 800) {
|
||||
} else if (interfaceId == 15 || interfaceId == 18 || interfaceId == 19 || interfaceId == 21 || interfaceId == 22 || interfaceId == 447 || interfaceId == 405) {
|
||||
return 4;
|
||||
} else if (interfaceId == 17 || interfaceId == 23 || interfaceId == 800) {
|
||||
return 3;
|
||||
} else if (interfaceId == 715) {
|
||||
return 2;
|
||||
|
|
@ -289,12 +276,8 @@ public final class LoginConfiguration {
|
|||
* @return the last login.
|
||||
*/
|
||||
public static String getLastLogin(Player player) {
|
||||
String lastIp = player.getDetails().accountInfo.getLastUsedIp();
|
||||
if (lastIp.equals("")) {
|
||||
lastIp = player.getDetails().getIpAddress();
|
||||
}
|
||||
player.getDetails().accountInfo.setLastUsedIp(player.getDetails().getIpAddress());
|
||||
String string = "You last logged in @timeAgo from: " + lastIp;
|
||||
player.getPacketDispatch().sendLastLoginInfo();
|
||||
String string = "You last logged in @timeAgo from:";
|
||||
long time = player.getDetails().getLastLogin();
|
||||
Date lastLogin = new Date(time);
|
||||
Date current = new Date();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package core.game.node.entity.player.link;
|
|||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.tools.Log;
|
||||
import core.tools.SystemLogger;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
|
|
@ -431,8 +430,11 @@ public final class PacketDispatch {
|
|||
PacketRepository.send(CSConfigPacket.class, new CSConfigContext(player, id, value, type, params));
|
||||
}
|
||||
|
||||
public void resetInterface(int id)
|
||||
{
|
||||
public void resetInterface(int id) {
|
||||
PacketRepository.send(ResetInterface.class, new InterfaceContext(player, 0, 0, id, false));
|
||||
}
|
||||
|
||||
public void sendLastLoginInfo() {
|
||||
PacketRepository.send(LastLoginInfo.class, new PlayerContext(player));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import core.game.component.Component;
|
|||
import core.game.node.entity.combat.spell.MagicSpell;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static core.api.ContentAPIKt.setVarbit;
|
||||
|
||||
/**
|
||||
* Represents a managing class of a players spell book.
|
||||
|
|
@ -15,7 +17,7 @@ import java.util.Map;
|
|||
public final class SpellBookManager {
|
||||
|
||||
/**
|
||||
* Represents the current interface if of the spellbook.
|
||||
* Represents the current interface if of the spell book.
|
||||
*/
|
||||
private int spellBook = SpellBook.MODERN.getInterfaceId();
|
||||
|
||||
|
|
@ -23,25 +25,26 @@ public final class SpellBookManager {
|
|||
* Constructs a new {@code SpellBookManager} {@code Object}.
|
||||
*/
|
||||
public SpellBookManager() {
|
||||
/**
|
||||
/*
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the spell book.
|
||||
* @param book
|
||||
* @param book the spell book.
|
||||
*/
|
||||
public void setSpellBook(SpellBook book) {
|
||||
this.spellBook = book.getInterfaceId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the
|
||||
* @param player
|
||||
* Updates the spell book.
|
||||
* @param player the player.
|
||||
*/
|
||||
public void update(Player player) {
|
||||
player.getInterfaceManager().openTab(new Component(SpellBook.forInterface(this.spellBook).getInterfaceId()));
|
||||
player.getInterfaceManager().openTab(new Component(spellBook));
|
||||
setVarbit(player, 357, Objects.requireNonNull(SpellBook.forInterface(spellBook)).ordinal());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,7 +56,7 @@ public final class SpellBookManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Represents a characters spellbook.
|
||||
* Represents a characters spell book.
|
||||
* @author 'Vexia
|
||||
* @author Emperor
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ public enum Emotes {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handles the reward button for an emote.
|
||||
* Handles the button for an emote.
|
||||
*
|
||||
* @param player the player.
|
||||
* @param buttonId the button id.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package core.game.node.entity.player.link.prayer;
|
||||
|
||||
import content.data.Quests;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.skill.SkillBonus;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
|
@ -221,11 +222,20 @@ public enum PrayerType {
|
|||
* @return <code>True</code> if it is permitted.
|
||||
*/
|
||||
public boolean permitted(final Player player) {
|
||||
if (player.getSkills().getStaticLevel(Skills.PRAYER) < getLevel() || player.getSkills().getStaticLevel(Skills.DEFENCE) < defenceReq) {
|
||||
playAudio(player, Sounds.PRAYER_OFF_2673);
|
||||
player.getDialogueInterpreter().sendDialogue("You need a <col=08088A>Prayer level of " + getLevel() + (player.getSkills().getStaticLevel(Skills.DEFENCE) < defenceReq ? (" and a Defence level of " + defenceReq) : "") + " to use " + StringUtils.formatDisplayName(name().toLowerCase().replace("_", " ")) + ".");
|
||||
if (!hasLevelStat(player, Skills.PRAYER, level) || !hasLevelStat(player, Skills.DEFENCE, defenceReq)) {
|
||||
sendDialogue(player, "You need a <col=08088A>" + (!hasLevelStat(player, Skills.PRAYER, level) ? "Prayer level of " + level + (!hasLevelStat(player, Skills.DEFENCE, defenceReq) ? " and a " : "") : "") + (!hasLevelStat(player, Skills.DEFENCE, defenceReq) ? "Defence level of " + defenceReq : "") + " to use " + StringUtils.formatDisplayName(name().toLowerCase().replace("_", " ")) + ".");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (defenceReq == 65 || defenceReq == 70) {
|
||||
if (!hasRequirement(player, Quests.KINGS_RANSOM)) {
|
||||
return false;
|
||||
} else {
|
||||
if (getVarbit(player, 3909) != 8) {
|
||||
setVarbit(player, 3909, 8, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -241,17 +251,12 @@ public enum PrayerType {
|
|||
player.getPrayer().getActive().add(this);
|
||||
iconify(player, getIcon(player, this));
|
||||
playAudio(player, sound.id);
|
||||
|
||||
if (this == PrayerType.PIETY
|
||||
&& new ZoneBorders(2732, 3467, 2739, 3471, 0).insideBorder(player)) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 2, 3);
|
||||
}
|
||||
player.dispatch (new PrayerActivatedEvent(this));
|
||||
player.dispatch (new PrayerActivatedEvent(this));
|
||||
} else {
|
||||
player.getPrayer().getActive().remove(this);
|
||||
playAudio(player, Sounds.CANCEL_PRAYER_2663);
|
||||
findNextIcon(player);
|
||||
player.dispatch (new PrayerDeactivatedEvent(this));
|
||||
player.dispatch (new PrayerDeactivatedEvent(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,17 +88,16 @@ class GameSettings
|
|||
|
||||
/**"Lobby" interface
|
||||
* The message of the week models to display
|
||||
* 15 & 22 = keys & lock || 16 = fly swat || 17 = person with question marks || 18 & 447 = wise old man
|
||||
* 19 = man & woman with mouth closed || 20 = man & lock & key || 21 = closed chests
|
||||
* 23 = snowmen || 405 = Construction houses || 622 = Two sets of 3 people range, mage, melee
|
||||
* 623 = Woodcutting || 679 = Summoning || 715 = Easter || 800 = Halloween
|
||||
* Any value that isn't one listed above = random selection
|
||||
* 15 & 22 = Lock w/key & keys || 16 = Fly swatters || 17 = Man & woman with question marks
|
||||
* 18 & 447 = Wise old man & woman || 19 = Man with mouth zipped & woman talking || 20 = Man & lock w/key
|
||||
* 21 = Chests that open & close || 23 = Christmas || 405 = Construction houses
|
||||
* 622 = Two sets 3 people range, mage, melee 623 = Woodcutting || 679 = Summoning || 715 = Easter || 800 = Halloween
|
||||
*/
|
||||
var message_model: Int,
|
||||
|
||||
/**"Lobby" interface
|
||||
* The message of the week text
|
||||
* The "child" for writing text to these interfaces is located inside of LoginConfiguration.java
|
||||
* The "child" for writing text to these interfaces is located inside LoginConfiguration.java
|
||||
* method: getMessageChild
|
||||
*/
|
||||
var message_string: String
|
||||
|
|
|
|||
|
|
@ -75,9 +75,10 @@ public final class PacketRepository {
|
|||
OUTGOING_PACKETS.put(InstancedLocationUpdate.class, new InstancedLocationUpdate()); //
|
||||
OUTGOING_PACKETS.put(CSConfigPacket.class, new CSConfigPacket()); //
|
||||
OUTGOING_PACKETS.put(Varbit.class, new Varbit());
|
||||
OUTGOING_PACKETS.put(ResetInterface.class, new ResetInterface());
|
||||
OUTGOING_PACKETS.put(ResetInterface.class, new ResetInterface());
|
||||
OUTGOING_PACKETS.put(VarcUpdate.class, new VarcUpdate());
|
||||
OUTGOING_PACKETS.put(InterfaceSetAngle.class, new InterfaceSetAngle());
|
||||
OUTGOING_PACKETS.put(LastLoginInfo.class, new LastLoginInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -105,5 +106,4 @@ public final class PacketRepository {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
Server/src/main/core/net/packet/out/LastLoginInfo.kt
Normal file
15
Server/src/main/core/net/packet/out/LastLoginInfo.kt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package core.net.packet.out
|
||||
|
||||
import core.net.packet.IoBuffer
|
||||
import core.net.packet.OutgoingPacket
|
||||
import core.net.packet.context.PlayerContext
|
||||
import java.net.Inet4Address
|
||||
|
||||
class LastLoginInfo : OutgoingPacket<PlayerContext> {
|
||||
override fun send(context: PlayerContext) {
|
||||
val buffer = IoBuffer(164)
|
||||
buffer.imp4(Inet4Address.getByName(context.player.details.ipAddress).hashCode())
|
||||
buffer.cypherOpcode(context.player.session.isaacPair.output)
|
||||
context.player.session.write(buffer)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue