Hello, So i have been working on a glitch i've come across to do with the max and completionist cape in a release called elysium. I have tried in many ways to fix the problem.
Apparently when you wear one of the two capes its does not show up on the characters back even though its in the correct slot. It actually ends up nulling the server out instead. heres what it says when you equip it ingame on the command box.
Code:
ERROR! THREAD NAME: World Thread
java.lang.NullPointerException
at com.rs.game.player.Appearence.generateAppearenceData(Appearence.java:
212)
at com.rs.net.decoders.handlers.ButtonHandler.sendWear(ButtonHandler.jav
a:2355)
at com.rs.net.decoders.handlers.InventoryOptionsHandler$1.run(InventoryO
ptionsHandler.java:119)
at com.rs.game.tasks.WorldTasksManager.processTasks(WorldTasksManager.ja
va:19)
at com.rs.cores.WorldThread.run(WorldThread.java:24)
This is the generateappearancedata, same as the original matrix.
Code:
public void generateAppearenceData() {
OutputStream stream = new OutputStream();
int flag = 0;
if (!male)
flag |= 0x1;
if (transformedNpcId >= 0
&& NPCDefinitions.getNPCDefinitions(transformedNpcId).aBoolean3190)
flag |= 0x2;
if(title != 0)
flag |= title >= 32 && title <= 37 ? 0x80 : 0x40; //after/before
stream.writeByte(flag);
if(title != 0) {
String titleName = title == 666 ? "<col=00FF00>Fuck You Jagex</col>" : ClientScriptMap.getMap(male ? 1093 : 3872).getStringValue(title);
stream.writeGJString(titleName);
}
stream.writeByte(player.hasSkull() ? player.getSkullId() : -1); // pk// icon
stream.writeByte(player.getPrayer().getPrayerHeadIcon()); // prayer icon
stream.writeByte(hidePlayer ? 1 : 0);
// npc
if (transformedNpcId >= 0) {
stream.writeShort(-1); // 65535 tells it a npc
stream.writeShort(transformedNpcId);
stream.writeByte(0);
} else {
for (int index = 0; index < 4; index++) {
Item item = player.getEquipment().getItems().get(index);
if (glowRed) {
if (index == 0) {
stream.writeShort(32768 + ItemsEquipIds.getEquipId(2910));
continue;
}
if (index == 1) {
stream.writeShort(32768 + ItemsEquipIds
.getEquipId(14641));
continue;
}
}
if (item == null)
stream.writeByte(0);
else
stream.writeShort(32768 + item.getEquipId());
}
Item item = player.getEquipment().getItems()
.get(Equipment.SLOT_CHEST);
stream.writeShort(item == null ? 0x100 + lookI[2] : 32768 + item.getEquipId());
item = player.getEquipment().getItems().get(Equipment.SLOT_SHIELD);
if (item == null)
stream.writeByte(0);
else
stream.writeShort(32768 + item.getEquipId());
item = player.getEquipment().getItems().get(Equipment.SLOT_CHEST);
if (item == null || !Equipment.hideArms(item))
stream.writeShort(0x100 + lookI[3]);
else
stream.writeByte(0);
item = player.getEquipment().getItems().get(Equipment.SLOT_LEGS);
stream.writeShort(glowRed ? 32768 + ItemsEquipIds.getEquipId(2908)
: item == null ? 0x100 + lookI[5] : 32768 + item
.getEquipId());
item = player.getEquipment().getItems().get(Equipment.SLOT_HAT);
if (!glowRed
&& (item == null || !Equipment.hideHair(item)))
stream.writeShort(0x100 + lookI[0]);
else
stream.writeByte(0);
item = player.getEquipment().getItems().get(Equipment.SLOT_HANDS);
stream.writeShort(glowRed ? 32768 + ItemsEquipIds.getEquipId(2912)
: item == null ? 0x100 + lookI[4] : 32768 + item
.getEquipId());
item = player.getEquipment().getItems().get(Equipment.SLOT_FEET);
stream.writeShort(glowRed ? 32768 + ItemsEquipIds.getEquipId(2904)
: item == null ? 0x100 + lookI[6] : 32768 + item
.getEquipId());
//tits for female, bear for male
item = player.getEquipment().getItems().get(male ? Equipment.SLOT_HAT : Equipment.SLOT_CHEST);
if (item == null || (male && Equipment.showBear(item)))
stream.writeShort(0x100 + lookI[1]);
else
stream.writeByte(0);
item = player.getEquipment().getItems().get(Equipment.SLOT_AURA);
if (item == null)
stream.writeByte(0);
else
stream.writeShort(32768 + item.getEquipId()); //Fixes the winged auras lookIing fucked.
int pos = stream.getOffset();
stream.writeShort(0);
int hash = 0;
int slotFlag = -1;
for (int slotId = 0; slotId < player.getEquipment().getItems()
.getSize(); slotId++) {
if (Equipment.DISABLED_SLOTS[slotId] != 0)
continue;
slotFlag++;
if(slotId == Equipment.SLOT_HAT) {
int hatId = player.getEquipment().getHatId();
if (hatId == 20768 || hatId == 20770 || hatId == 20772) {
ItemDefinitions defs = ItemDefinitions.getItemDefinitions(hatId-1);
if ((hatId == 20768
&& Arrays.equals(
player.getMaxedCapeCustomized(),
defs.originalModelColors) || ((hatId == 20770 || hatId == 20772) && Arrays
.equals(player.getCompletionistCapeCustomized(),
defs.originalModelColors))))
continue;
hash |= 1 << slotFlag;
stream.writeByte(0x4); // modify 4 model colors
int[] hat = hatId == 20768 ? player
.getMaxedCapeCustomized() : player
.getCompletionistCapeCustomized();
int slots = 0 | 1 << 4 | 2 << 8 | 3 << 12;
stream.writeShort(slots);
for (int i = 0; i < 4; i++)
stream.writeShort(hat[i]);
}
}else if (slotId == Equipment.SLOT_CAPE) {
int capeId = player.getEquipment().getCapeId();
if (capeId == 20767 || capeId == 20769 || capeId == 20771) {
ItemDefinitions defs = ItemDefinitions
.getItemDefinitions(capeId);
if ((capeId == 20767
&& Arrays.equals(
player.getMaxedCapeCustomized(),
defs.originalModelColors) || ((capeId == 20769 || capeId == 20771) && Arrays
.equals(player.getCompletionistCapeCustomized(),
defs.originalModelColors))))
continue;
hash |= 1 << slotFlag;
stream.writeByte(0x4); // modify 4 model colors
int[] cape = capeId == 20767 ? player
.getMaxedCapeCustomized() : player
.getCompletionistCapeCustomized();
int slots = 0 | 1 << 4 | 2 << 8 | 3 << 12;
stream.writeShort(slots);
for (int i = 0; i < 4; i++)
stream.writeShort(cape[i]);
}
If anyone has any thoughts or idea's to help fix this it is highly appreciated
Thanks!
-Kyle