Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
3.9 kB
1
Indexable
Never
} else if (opcode == KEY_TYPED_PACKET) {
			if (player.isDead() || player.hasFinished()) {
				return;
			}
			int keyPressed = stream.readByte();
			int interfaceHash = stream.read24BitInt();

			int keyIndex = keyPressed == 100 ? 7 : keyPressed >= 6 && keyPressed <= 12 ? keyPressed - 6 : -1;
			/*
			 * int keyIndex = keyPressed == 100 ? 7 : keyPressed >= 6 && keyPressed <= 12 ?
			 * keyPressed - 6 : -1; if (keyIndex == -1) { return; }
			 */
			switch (keyPressed) {
			case 13:
				if (player.getInterfaceManager().containsScreenInter()) {
					player.closeInterfaces();
				}
				break;
			case 102:
				Magic.sendNormalTeleportSpell(player, 0, 0, player.getHomeTile());
				break;
			}
			if (keyIndex == -1) {
				return;
			}
			int actionId = player.getKeyBinds()[keyIndex];
			switch (actionId) {
			case 0:
				player.sm("You don't have any keybinds attached to "
						+ (keyPressed >= 6 && keyPressed <= 12 ? "F" + keyPressed : "Insert") + ".");
				break;
			case 1:
				if (player.getRegionId() == 11601 || player.getRegionId() == 15178) {
					player.sm("You cannot bank in this area.");
					return;
				}
				if (player.getPerkManager().bankCommand) {
					if (!player.canSpawn()) {
						player.sendMessage("You cannot open your bank account at the moment.");
						return;
					}
					if (player.isLocked()) {
						player.sendMessage("You can't bank at the moment, please wait.");
						return;
					}
					if (!player.canSpawn() || player.getControlerManager().getControler() != null) {
						player.sendMessage("You can't bank while you're in this area.");
						return;
					}
					if (player.isUnderCombat()) {
						player.sendMessage("You can't bank while in combat, please wait.");
						return;
					}
					if (!player.promptList()) {
						player.getBank().openBank();
					} else {
						player.getDialogueManager().startDialogue("BankList", false);
					}
					return;
				} else {
					player.sendMessage("You have to purchase the Bank Command perk in order to do this.");
				}
				break;
			case 2:
				if (player.getRegionId() == 11601 || player.getRegionId() == 15178) {
					player.sm("You cannot open grand exchange in this area.");
					return;
				}
				if (player.getPerkManager().bankCommand) {
					if (!player.canSpawn()) {
						player.sendMessage("You cannot open your bank account at the moment.");
						return;
					}
					if (player.isLocked()) {
						player.sendMessage("You can't bank at the moment, please wait.");
						return;
					}
					if (!player.canSpawn() || player.getControlerManager().getControler() != null) {
						player.sendMessage("You can't bank while you're in this area.");
						return;
					}
					if (player.isUnderCombat()) {
						player.sendMessage("You can't bank while in combat, please wait.");
						return;
					}
					player.getGEManager().openGrandExchange();
					return;
				} else {
					player.sendMessage("You have to purchase the Bank Command perk in order to do this.");
				}
				break;
			case 3:
				player.getDialogueManager().startDialogue("BossTeleports");
				break;
			case 4:
				ButtonHandler.submitSpecialRequest(player);
				break;
			case 5:
				player.getPrayer().switchQuickPrayers();
				break;
			case 6:
				if (player.getFamiliar() != null && player.getFamiliar().getBOBSize() > 0) {
					player.getFamiliar().store();
				}
				break;
			case 7:
				if (player.getFamiliar() != null && player.getFamiliar().hasSpecialOn()) {
					player.getFamiliar().submitSpecial(player);
				}
				break;
			case 8:
				if (player.getRegionId() == 11601 || player.getRegionId() == 15178) {
					player.sm("You cannot bank in this area.");
					return;
				}
				player.getBank().depositAllKeyBind();
				player.getAppearence().generateAppearenceData();
				break;
			}
		}