public int getStandWalkAnimation() { if (player.getAppearance().getWalkAnimation() > 0) { return(player.getAppearance().getWalkAnimation()); } if (slots[3].getItemId() == -1) { return(1426); } return(ItemData.forId(slots[3].getItemId()).getAnimation()); }
public static void openInterface(Player p) { p.getPackets().displayInterface(771); p.getPackets().sendPlayerHead(771, 79); p.getPackets().animateInterface(9804, 771, 79); p.getPackets().sendConfig(1262, p.getAppearance().getGender() == 2 ? 1 : 8); p.getAppearance().setTemporaryAppearance(new Appearance()); p.getAppearance().getTemporaryAppearance().setColoursArray(p.getAppearance().getColoursArray()); p.getAppearance().getTemporaryAppearance().setLookArray(p.getAppearance().getLookArray()); p.getAppearance().getTemporaryAppearance().setGender(p.getAppearance().getGender()); p.removeTemporaryAttribute("hairToggle"); }
private static int getTorsoColour(Player p, int button) { int[] buttons = { 189, 190, 191, 192, 193, 194, 195, 196 }; int[] colours = { 10, 1, 2, 3, 4, 5, 6, 7 }; for (int i = 0; i < buttons.Length; i++) { if (button == buttons[i]) { return(colours[i]); } } return(p.getAppearance().getColour(2)); }
private static int getSkinColour(Player p, int button) { int[] buttons = { 151, 152, 153, 154, 155, 156, 157, 158 }; int[] skins = { 10, 1, 2, 3, 4, 5, 6, 7 }; for (int i = 0; i < buttons.Length; i++) { if (button == buttons[i]) { return(skins[i]); } } return(p.getAppearance().getColour(4)); }
public static void sortButton(Player p, int button) { Appearance temp = p.getAppearance().getTemporaryAppearance(); if (button == 362) { p.setAppearance(p.getAppearance().getTemporaryAppearance()); p.getPackets().closeInterfaces(); return; } if ((button == 52 && temp.getGender() == 1) || (button == 49 && temp.getGender() == 0)) { p.getPackets().sendConfig(1262, temp.getGender() == 0 ? 1 : 8); temp.setGender(temp.getGender() == 0 ? 1 : 0); return; } if (button == 93) { temp.setLook(0, getHairStyle(p, false)); return; } if (button == 93) { temp.setLook(0, getHairStyle(p, true)); return; } if (button >= 151 && button <= 158) { temp.setColour(4, getSkinColour(p, button)); return; } if (button >= 189 && button <= 217) { temp.setColour(2, getTorsoColour(p, button)); return; } }
public void execute(Player player, string[] arguments) { if (arguments.Length == 0) { player.getPackets().sendMessage("[PlayerAsNpc command]: ::pnpc npcId"); return; } int npcId = 0; if (!int.TryParse(arguments[0], out npcId)) { player.getPackets().sendMessage("[PlayerAsNpc command]: ::pnpc npcId [npcId is not a number error]"); return; } player.getAppearance().setNpcId(npcId); player.getUpdateFlags().setAppearanceUpdateRequired(true); }
private static int getHairStyle(Player p, bool decrease) { int oldHair = p.getAppearance().getLook(0); int newHair = oldHair; if (p.getTemporaryAttribute("hairToggle") == null) { p.setTemporaryAttribute("hairToggle", 0); return(0); } newHair = (int)p.getTemporaryAttribute("hairToggle"); newHair = decrease ? -1 : +1; if (newHair == 11) { newHair = 186;// } else if (newHair == 12) { newHair = 188;// } else if (newHair == 13) { newHair = 190;// } else if (newHair == 14) { newHair = 192;// } else if (newHair == 15) { newHair = 194;// } else if (newHair == 16) { newHair = 196; // } else if (newHair == 17) { //17 to 25 dump from rs } p.setTemporaryAttribute("hairToggle", newHair); return(newHair); }
private static void appendAppearanceUpdate(Player p, PacketBuilder updateBlock) { PacketBuilder playerProps = new PacketBuilder().setSize(Packet.Size.Bare); Appearance app = p.getAppearance(); playerProps.addByte((byte) (app.getGender() & 0xFF)); if((app.getGender() & 0x2) == 2) { playerProps.addByte((byte) 0); playerProps.addByte((byte) 0); } playerProps.addByte((byte) p.getPrayers().getPkIcon()); playerProps.addByte((byte) p.getPrayers().getHeadIcon()); if (!app.isInvisible()) { if(!app.isNpc()) { for(int i = 0; i < 4; i++) { if(p.getEquipment().getItemInSlot((ItemData.EQUIP)i) != -1) { playerProps.addUShort(32768 + p.getEquipment().getSlot((ItemData.EQUIP)i).getDefinition().getEquipId()); } else { playerProps.addByte((byte) 0); } } if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) != -1) { playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.CHEST).getDefinition().getEquipId()); } else { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.AMULET)); } if (p.getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD) != -1) { playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.SHIELD).getDefinition().getEquipId()); } else { playerProps.addByte((byte) 0); } Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST); if (chest != null && chest.getDefinition() != null) { if(!ItemData.isFullBody(chest.getDefinition())) { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON)); } else { playerProps.addByte((byte) 0); } } else { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON)); } if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1) { playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId()); } else { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD)); } Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT); if (hat != null && hat.getDefinition() != null) { if(!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition())) { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT)); } else { playerProps.addByte((byte) 0); } } else { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT)); } if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1) { playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId()); } else { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST)); } if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1) { playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId()); } else { playerProps.addUShort(0x100 + app.getLook(6)); } if (hat != null && hat.getDefinition() != null) { if(!ItemData.isFullMask(hat.getDefinition())) { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE)); } else { playerProps.addByte((byte) 0); } } else { playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE)); } } else { playerProps.addUShort(-1); playerProps.addUShort(app.getNpcId()); playerProps.addByte((byte) 255); } } else { for (int i = 0; i < 12; i++) { playerProps.addByte((byte) 0); } } foreach(int colour in app.getColoursArray()) { playerProps.addByte((byte) colour); } playerProps.addUShort(p.getEquipment().getStandWalkAnimation()); playerProps.addLong(p.getLoginDetails().getLongName()); playerProps.addByte((byte) p.getSkills().getCombatLevel()); playerProps.addUShort(0); playerProps.addByte((byte) 0); updateBlock.addByteA((byte) (playerProps.getLength() & 0xFF)); updateBlock.addBytes(playerProps.toPacket().getData(), 0, playerProps.getLength()); }