1package com.osroyale.game.world.entity.mob.player;
3import com.osroyale.Config;
4import com.osroyale.content.store.Store;
5import com.osroyale.content.tradingpost.TradingPost;
6import com.osroyale.game.world.entity.mob.player.exchange.ExchangeSessionType;
7import com.osroyale.net.packet.out.*;
41public class InterfaceManager {
47 private int main = -1;
50 private int overlay = -1;
53 private int walkable = -1;
56 private int dialogue = -1;
58 private int[] sidebars =
new int[15];
61 InterfaceManager(
Player player) {
66 public void open(
int identification) {
67 open(identification,
true);
71 public void open(
int identification,
boolean secure) {
73 if (player.isBot || main == identification) {
77 if (player.getCombat().inCombat()) {
78 player.send(
new SendMessage(
"You can't do this right now!"));
82 if (player.dialogueFactory.isActive() || player.dialogueFactory.isOption()) {
83 player.dialogueFactory.clear();
87 main = identification;
88 player.movement.reset();
90 player.send(
new SendString(
"[CLOSE_MENU]", 0));
91 setSidebar(
Config.LOGOUT_TAB, -1);
96 if (walkable == identification) {
99 walkable = identification;
105 if (player.isBot || main == identification &&
this.overlay == overlay) {
109 main = identification;
110 this.overlay = overlay;
111 player.movement.reset();
112 player.send(
new SendString(
"[CLOSE_MENU]", 0));
114 setSidebar(
Config.LOGOUT_TAB, -1);
118 public void close(
int interfaceId) {
130 public void close(
boolean walkable) {
135 if (player.attributes.has(
"SHOP")) {
136 Store.closeShop(player);
139 if (player.attributes.is(
"BANK_KEY")) {
143 if (player.attributes.is(
"PRICE_CHECKER_KEY")) {
144 player.priceChecker.close();
147 if (player.attributes.is(
"TRADE_KEY")) {
151 if (player.attributes.is(
"DUEL_KEY")) {
155 if (player.attributes.is(
"DONATOR_DEPOSIT_KEY")) {
156 player.donatorDeposit.close();
160 player.tradingPost.cleanUp();
169 player.dialogueFactory.clear();
172 setSidebar(
Config.LOGOUT_TAB, 2449);
175 public void setSidebar(
int tab,
int id) {
176 if (sidebars[tab] ==
id &&
id != -1) {
189 public boolean hasAnyOpen(
int... ids) {
199 return main == -1 && dialogue == -1 && walkable == -1;
209 return dialogue == -1;
214 this.main = currentInterface;
229 this.dialogue = dialogueInterface;
239 this.walkable = walkableInterface;
242 public int getSidebar(
int tab) {
243 if (tab > sidebars.length) {
246 return sidebars[tab];
249 public boolean isSidebar(
int tab,
int id) {
250 return tab <= sidebars.length && sidebars[tab] == id;
253 public boolean hasSidebar(
int id) {
254 for (
int sidebar : sidebars) {
void openWalkable(int identification)
void setMain(int currentInterface)
boolean isInterfaceOpen(int id)
boolean isDialogueClear()
void open(int identification, boolean secure)
void openInventory(int identification, int overlay)
void setWalkable(int walkableInterface)
void open(int identification)
void setDialogue(int dialogueInterface)
void close(boolean walkable)