Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rs.game.player.content;
- import com.rs.cache.loaders.ItemDefinitions;
- import com.rs.game.item.Item;
- import com.rs.game.player.Equipment;
- import com.rs.game.player.Player;
- import com.rs.game.tasks.WorldTask;
- import com.rs.game.tasks.WorldTasksManager;
- import com.rs.net.decoders.handlers.ButtonHandler;
- public class CosmeticsHandler {
- /**
- * Every Item Id You Put will show in the dialogue when clicked at the slot
- * no matter how many it will calculate the number of pages needed
- * automaticly
- */
- public static int[] HATS = { 20824, 1038, 1040, 1037, 1046, 1025 };
- public static int[] CAPES = { 1052, 1019, 1021, 19368 };
- public static int[] AMULETS = { 6585, 19335 };
- public static int[] CHESTS = { 20822, 20139, 1113, 1115, 1117, 1119, 1121, 1123, 1125, 1127, 1129, 20139, 1113,
- 1115, 1117, 1119, 1121, 1123, 1125, 1127, 1129 };
- public static int[] WEAPONS = { 16955, 18349, 18351, 18353 };
- public static int[] SHIELDS = { 17361, 13740, 13742, 13744, 17357, 17353 };
- public static int[] LEGS = { 20823 };
- public static int[] BOOTS = { 20826 };
- public static int[] GLOVES = { 20825 };
- public static void openCosmeticsHandler(final Player player) {
- player.stopAll();
- player.getTemporaryAttributtes().put("Cosmetics", Boolean.TRUE);
- player.getInterfaceManager().sendInventoryInterface(670);
- player.getInterfaceManager().sendInterface(667);
- player.getVarsManager().sendVarBit(8348, 1);
- player.getVarsManager().sendVarBit(4894, 0);
- player.getPackets().sendItems(93, player.getInventory().getItems());
- player.getPackets().sendInterSetItemsOptionsScript(670, 0, 93, 4, 7, "Equip", "Compare", "Stats", "Examine");
- player.getPackets().sendUnlockIComponentOptionSlots(670, 0, 0, 27, 0, 1, 2, 3);
- Item[] cosmetics = player.getEquipment().getItems().getItemsCopy();
- for (int i = 0; i < cosmetics.length; i++) {
- Item item = cosmetics[i];
- if (i == Equipment.SLOT_AURA || i == Equipment.SLOT_ARROWS || i == Equipment.SLOT_RING)
- continue;
- if (item == null)
- cosmetics[i] = new Item(0);
- }
- player.getPackets().sendItems(94, cosmetics);
- player.getPackets().sendUnlockIComponentOptionSlots(667, 9, 0, 13, true, 0, 1, 2, 3);
- ButtonHandler.refreshEquipBonuses(player);
- WorldTasksManager.schedule(new WorldTask() {
- @Override
- public void run() {
- player.getVarsManager().sendVarBit(8348, 1);
- player.getPackets().sendRunScriptBlank(2319);
- }
- });
- player.setCloseInterfacesEvent(new Runnable() {
- @Override
- public void run() {
- player.getDialogueManager().finishDialogue();
- player.getTemporaryAttributtes().remove("Cosmetics");
- for (int i = 0; i < 15; i++) {
- player.getEquipment().refresh(i);
- }
- }
- });
- }
- /*
- * Change the names of certain items of the costumes
- */
- public static String getNameOnDialogue(int itemId) {
- switch (itemId) {
- case 20139:
- return "The Plate Of Torva!";
- }
- return ItemDefinitions.getItemDefinitions(itemId).getName();
- }
- /*
- * Restricts player from using certain items if they doesn't have the
- * requirment needed
- */
- public static boolean isRestrictedItem(Player player, int itemId) {
- switch (itemId) {
- case 18351:// Chaotic Long Sword Available for extreme donators
- return !player.isExtremeDonator();
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment