mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
Fully implement player synchronization.
This commit is contained in:
@@ -2,19 +2,24 @@ package org.apollo.net.release.r377;
|
||||
|
||||
import org.apollo.game.event.impl.PlayerSynchronizationEvent;
|
||||
import org.apollo.game.model.Animation;
|
||||
import org.apollo.game.model.Appearance;
|
||||
import org.apollo.game.model.Direction;
|
||||
import org.apollo.game.model.EquipmentConstants;
|
||||
import org.apollo.game.model.Gender;
|
||||
import org.apollo.game.model.Graphic;
|
||||
import org.apollo.game.model.Inventory;
|
||||
import org.apollo.game.model.Item;
|
||||
import org.apollo.game.model.Position;
|
||||
import org.apollo.game.model.def.EquipmentDefinition;
|
||||
import org.apollo.game.model.Appearance;
|
||||
import org.apollo.game.model.EquipmentConstants;
|
||||
import org.apollo.game.sync.block.AnimationBlock;
|
||||
import org.apollo.game.sync.block.AppearanceBlock;
|
||||
import org.apollo.game.sync.block.ChatBlock;
|
||||
import org.apollo.game.sync.block.ForceChatBlock;
|
||||
import org.apollo.game.sync.block.ForceMovementBlock;
|
||||
import org.apollo.game.sync.block.GraphicBlock;
|
||||
import org.apollo.game.sync.block.HitUpdateBlock;
|
||||
import org.apollo.game.sync.block.InteractingCharacterBlock;
|
||||
import org.apollo.game.sync.block.SecondHitUpdateBlock;
|
||||
import org.apollo.game.sync.block.SynchronizationBlockSet;
|
||||
import org.apollo.game.sync.block.TurnToPositionBlock;
|
||||
import org.apollo.game.sync.seg.AddCharacterSegment;
|
||||
@@ -34,6 +39,7 @@ import org.apollo.net.release.EventEncoder;
|
||||
* An {@link EventEncoder} for the {@link PlayerSynchronizationEvent}.
|
||||
*
|
||||
* @author Graham
|
||||
* @author Major
|
||||
*/
|
||||
public final class PlayerSynchronizationEventEncoder extends EventEncoder<PlayerSynchronizationEvent> {
|
||||
|
||||
@@ -73,16 +79,6 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder<Player
|
||||
return builder.toGamePacket();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a remove character update.
|
||||
*
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putRemoveCharacterUpdate(GamePacketBuilder builder) {
|
||||
builder.putBits(1, 1);
|
||||
builder.putBits(2, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an add character update.
|
||||
*
|
||||
@@ -102,6 +98,292 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder<Player
|
||||
builder.putBits(5, other.getY() - player.getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an Animation block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putAnimationBlock(AnimationBlock block, GamePacketBuilder blockBuilder) {
|
||||
Animation animation = block.getAnimation();
|
||||
blockBuilder.put(DataType.SHORT, animation.getId());
|
||||
blockBuilder.put(DataType.BYTE, DataTransformation.ADD, animation.getDelay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an Appearance block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putAppearanceBlock(AppearanceBlock block, GamePacketBuilder blockBuilder) {
|
||||
Appearance appearance = block.getAppearance();
|
||||
GamePacketBuilder playerProperties = new GamePacketBuilder();
|
||||
|
||||
playerProperties.put(DataType.BYTE, appearance.getGender().toInteger());
|
||||
playerProperties.put(DataType.BYTE, -1); // skull icon
|
||||
playerProperties.put(DataType.BYTE, -1); // prayer icon
|
||||
|
||||
if (block.appearingAsNpc()) {
|
||||
playerProperties.put(DataType.BYTE, 255);
|
||||
playerProperties.put(DataType.BYTE, 255);
|
||||
playerProperties.put(DataType.SHORT, block.getNpcId());
|
||||
} else {
|
||||
Inventory equipment = block.getEquipment();
|
||||
int[] style = appearance.getStyle();
|
||||
Item item, chest, helm;
|
||||
|
||||
for (int slot = 0; slot < 4; slot++) {
|
||||
if ((item = equipment.get(slot)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ((chest = equipment.get(EquipmentConstants.CHEST)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + chest.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[2]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.SHIELD)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
|
||||
if (chest != null) {
|
||||
EquipmentDefinition def = EquipmentDefinition.forId(chest.getId());
|
||||
if (def != null && !def.isFullBody()) {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[3]);
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[3]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.LEGS)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[5]);
|
||||
}
|
||||
|
||||
if ((helm = equipment.get(EquipmentConstants.HAT)) != null) {
|
||||
EquipmentDefinition def = EquipmentDefinition.forId(helm.getId());
|
||||
if (def != null && !def.isFullHat() && !def.isFullMask()) {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[0]);
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[0]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.HANDS)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[4]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.FEET)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[6]);
|
||||
}
|
||||
|
||||
EquipmentDefinition def = null;
|
||||
if (helm != null) {
|
||||
def = EquipmentDefinition.forId(helm.getId());
|
||||
}
|
||||
if (def != null && (def.isFullHat() || def.isFullMask()) || appearance.getGender() == Gender.FEMALE) {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[1]);
|
||||
}
|
||||
}
|
||||
|
||||
int[] colors = appearance.getColors();
|
||||
for (int color : colors) {
|
||||
playerProperties.put(DataType.BYTE, color);
|
||||
}
|
||||
|
||||
playerProperties.put(DataType.SHORT, 0x328); // stand
|
||||
playerProperties.put(DataType.SHORT, 0x337); // stand turn
|
||||
playerProperties.put(DataType.SHORT, 0x333); // walk
|
||||
playerProperties.put(DataType.SHORT, 0x334); // turn 180
|
||||
playerProperties.put(DataType.SHORT, 0x335); // turn 90 cw
|
||||
playerProperties.put(DataType.SHORT, 0x336); // turn 90 ccw
|
||||
playerProperties.put(DataType.SHORT, 0x338); // run
|
||||
|
||||
playerProperties.put(DataType.LONG, block.getName());
|
||||
playerProperties.put(DataType.BYTE, block.getCombatLevel());
|
||||
playerProperties.put(DataType.SHORT, block.getSkillLevel());
|
||||
|
||||
blockBuilder.put(DataType.BYTE, playerProperties.getLength());
|
||||
blockBuilder.putRawBuilderReverse(playerProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the blocks for the specified segment.
|
||||
*
|
||||
* @param segment The segment.
|
||||
* @param blockBuilder The block builder.
|
||||
*/
|
||||
private void putBlocks(SynchronizationSegment segment, GamePacketBuilder blockBuilder) {
|
||||
SynchronizationBlockSet blockSet = segment.getBlockSet();
|
||||
if (blockSet.size() > 0) {
|
||||
int mask = 0;
|
||||
|
||||
if (blockSet.contains(AnimationBlock.class)) {
|
||||
mask |= 0x8;
|
||||
}
|
||||
if (blockSet.contains(ForceChatBlock.class)) {
|
||||
mask |= 0x10;
|
||||
}
|
||||
if (blockSet.contains(ForceMovementBlock.class)) {
|
||||
mask |= 0x100;
|
||||
}
|
||||
if (blockSet.contains(InteractingCharacterBlock.class)) {
|
||||
mask |= 0x1;
|
||||
}
|
||||
if (blockSet.contains(TurnToPositionBlock.class)) {
|
||||
mask |= 0x2;
|
||||
}
|
||||
if (blockSet.contains(GraphicBlock.class)) {
|
||||
mask |= 0x200;
|
||||
}
|
||||
if (blockSet.contains(AppearanceBlock.class)) {
|
||||
mask |= 0x4;
|
||||
}
|
||||
if (blockSet.contains(SecondHitUpdateBlock.class)) {
|
||||
mask |= 0x400;
|
||||
}
|
||||
if (blockSet.contains(ChatBlock.class)) {
|
||||
mask |= 0x40;
|
||||
}
|
||||
if (blockSet.contains(HitUpdateBlock.class)) {
|
||||
mask |= 0x80;
|
||||
}
|
||||
|
||||
if (mask >= 0x100) {
|
||||
mask |= 0x20;
|
||||
blockBuilder.put(DataType.SHORT, DataOrder.LITTLE, mask);
|
||||
} else {
|
||||
blockBuilder.put(DataType.BYTE, mask);
|
||||
}
|
||||
|
||||
if (blockSet.contains(AnimationBlock.class)) {
|
||||
putAnimationBlock(blockSet.get(AnimationBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(ForceChatBlock.class)) {
|
||||
putForceChatBlock(blockSet.get(ForceChatBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(ForceMovementBlock.class)) {
|
||||
putForceMovementBlock(blockSet.get(ForceMovementBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(InteractingCharacterBlock.class)) {
|
||||
putInteractingCharacterBlock(blockSet.get(InteractingCharacterBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(TurnToPositionBlock.class)) {
|
||||
putTurnToPositionBlock(blockSet.get(TurnToPositionBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(GraphicBlock.class)) {
|
||||
putGraphicBlock(blockSet.get(GraphicBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(AppearanceBlock.class)) {
|
||||
putAppearanceBlock(blockSet.get(AppearanceBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(SecondHitUpdateBlock.class)) {
|
||||
putSecondHitUpdateBlock(blockSet.get(SecondHitUpdateBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(ChatBlock.class)) {
|
||||
putChatBlock(blockSet.get(ChatBlock.class), blockBuilder);
|
||||
}
|
||||
if (blockSet.contains(HitUpdateBlock.class)) {
|
||||
putHitUpdateBlock(blockSet.get(HitUpdateBlock.class), blockBuilder);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a chat block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putChatBlock(ChatBlock block, GamePacketBuilder blockBuilder) {
|
||||
byte[] bytes = block.getCompressedMessage();
|
||||
blockBuilder.put(DataType.SHORT, DataOrder.LITTLE, block.getTextEffects() << 8 | block.getTextColor());
|
||||
blockBuilder.put(DataType.BYTE, DataTransformation.NEGATE, block.getPrivilegeLevel().toInteger());
|
||||
blockBuilder.put(DataType.BYTE, DataTransformation.ADD, bytes.length);
|
||||
blockBuilder.putBytes(DataTransformation.ADD, bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a force chat block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putForceChatBlock(ForceChatBlock block, GamePacketBuilder builder) {
|
||||
builder.putString(block.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a force movement block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putForceMovementBlock(ForceMovementBlock block, GamePacketBuilder builder) {
|
||||
builder.put(DataType.BYTE, DataTransformation.ADD, block.getInitialX());
|
||||
builder.put(DataType.BYTE, DataTransformation.NEGATE, block.getInitialY());
|
||||
builder.put(DataType.BYTE, DataTransformation.SUBTRACT, block.getFinalX());
|
||||
builder.put(DataType.BYTE, block.getFinalY());
|
||||
builder.put(DataType.SHORT, block.getTravelDurationX());
|
||||
builder.put(DataType.SHORT, DataTransformation.ADD, block.getTravelDurationY());
|
||||
builder.put(DataType.BYTE, block.getDirection().toInteger());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a graphic block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putGraphicBlock(GraphicBlock block, GamePacketBuilder blockBuilder) {
|
||||
Graphic graphic = block.getGraphic();
|
||||
blockBuilder.put(DataType.SHORT, DataTransformation.ADD, graphic.getId());
|
||||
blockBuilder.put(DataType.INT, DataOrder.MIDDLE, graphic.getHeight() << 16 & 0xFFFF0000 | graphic.getDelay()
|
||||
& 0x0000FFFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a hit update block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putHitUpdateBlock(HitUpdateBlock block, GamePacketBuilder builder) {
|
||||
builder.put(DataType.BYTE, DataTransformation.SUBTRACT, block.getDamage());
|
||||
builder.put(DataType.BYTE, DataTransformation.NEGATE, block.getType());
|
||||
builder.put(DataType.BYTE, DataTransformation.SUBTRACT, block.getCurrentHealth());
|
||||
builder.put(DataType.BYTE, block.getMaximumHealth());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an interacting character block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putInteractingCharacterBlock(InteractingCharacterBlock block, GamePacketBuilder builder) {
|
||||
builder.put(DataType.SHORT, DataTransformation.ADD, block.getInteractingCharacterIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a movement update for the specified segment.
|
||||
*
|
||||
@@ -145,63 +427,26 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder<Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the blocks for the specified segment.
|
||||
* Puts a remove character update.
|
||||
*
|
||||
* @param segment The segment.
|
||||
* @param blockBuilder The block builder.
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putBlocks(SynchronizationSegment segment, GamePacketBuilder blockBuilder) {
|
||||
SynchronizationBlockSet blockSet = segment.getBlockSet();
|
||||
if (blockSet.size() > 0) {
|
||||
int mask = 0;
|
||||
private void putRemoveCharacterUpdate(GamePacketBuilder builder) {
|
||||
builder.putBits(1, 1);
|
||||
builder.putBits(2, 3);
|
||||
}
|
||||
|
||||
if (blockSet.contains(AnimationBlock.class)) {
|
||||
mask |= 0x8;
|
||||
}
|
||||
|
||||
if (blockSet.contains(ChatBlock.class)) {
|
||||
mask |= 0x40;
|
||||
}
|
||||
|
||||
if (blockSet.contains(GraphicBlock.class)) {
|
||||
mask |= 0x200;
|
||||
}
|
||||
|
||||
if (blockSet.contains(AppearanceBlock.class)) {
|
||||
mask |= 0x4;
|
||||
}
|
||||
|
||||
if (blockSet.contains(TurnToPositionBlock.class)) {
|
||||
mask |= 0x2;
|
||||
}
|
||||
|
||||
if (mask >= 0x100) {
|
||||
mask |= 0x20;
|
||||
blockBuilder.put(DataType.SHORT, DataOrder.LITTLE, mask);
|
||||
} else {
|
||||
blockBuilder.put(DataType.BYTE, mask);
|
||||
}
|
||||
|
||||
if (blockSet.contains(AnimationBlock.class)) {
|
||||
putAnimationBlock(blockSet.get(AnimationBlock.class), blockBuilder);
|
||||
}
|
||||
|
||||
if (blockSet.contains(ChatBlock.class)) {
|
||||
putChatBlock(blockSet.get(ChatBlock.class), blockBuilder);
|
||||
}
|
||||
|
||||
if (blockSet.contains(GraphicBlock.class)) {
|
||||
putGraphicBlock(blockSet.get(GraphicBlock.class), blockBuilder);
|
||||
}
|
||||
|
||||
if (blockSet.contains(AppearanceBlock.class)) {
|
||||
putAppearanceBlock(blockSet.get(AppearanceBlock.class), blockBuilder);
|
||||
}
|
||||
|
||||
if (blockSet.contains(TurnToPositionBlock.class)) {
|
||||
putTurnToPositionBlock(blockSet.get(TurnToPositionBlock.class), blockBuilder);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Puts a secondary hit update block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param builder The builder.
|
||||
*/
|
||||
private void putSecondHitUpdateBlock(SecondHitUpdateBlock block, GamePacketBuilder builder) {
|
||||
builder.put(DataType.BYTE, DataTransformation.ADD, block.getDamage());
|
||||
builder.put(DataType.BYTE, DataTransformation.SUBTRACT, block.getType());
|
||||
builder.put(DataType.BYTE, DataTransformation.NEGATE, block.getCurrentHealth());
|
||||
builder.put(DataType.BYTE, block.getMaximumHealth());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,152 +461,4 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder<Player
|
||||
blockBuilder.put(DataType.SHORT, pos.getY() * 2 + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a graphic block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putGraphicBlock(GraphicBlock block, GamePacketBuilder blockBuilder) {
|
||||
Graphic graphic = block.getGraphic();
|
||||
blockBuilder.put(DataType.SHORT, DataTransformation.ADD, graphic.getId());
|
||||
blockBuilder.put(DataType.INT, DataOrder.MIDDLE,
|
||||
((graphic.getHeight() << 16) & 0xFFFF0000) | (graphic.getDelay() & 0x0000FFFF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an animation block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putAnimationBlock(AnimationBlock block, GamePacketBuilder blockBuilder) {
|
||||
Animation animation = block.getAnimation();
|
||||
blockBuilder.put(DataType.SHORT, animation.getId());
|
||||
blockBuilder.put(DataType.BYTE, DataTransformation.ADD, animation.getDelay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a chat block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putChatBlock(ChatBlock block, GamePacketBuilder blockBuilder) {
|
||||
byte[] bytes = block.getCompressedMessage();
|
||||
blockBuilder.put(DataType.SHORT, DataOrder.LITTLE, (block.getTextEffects() << 8) | block.getTextColor());
|
||||
blockBuilder.put(DataType.BYTE, DataTransformation.NEGATE, block.getPrivilegeLevel().toInteger());
|
||||
blockBuilder.put(DataType.BYTE, DataTransformation.ADD, bytes.length);
|
||||
blockBuilder.putBytes(DataTransformation.ADD, bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an appearance block into the specified builder.
|
||||
*
|
||||
* @param block The block.
|
||||
* @param blockBuilder The builder.
|
||||
*/
|
||||
private void putAppearanceBlock(AppearanceBlock block, GamePacketBuilder blockBuilder) {
|
||||
Appearance appearance = block.getAppearance();
|
||||
GamePacketBuilder playerProperties = new GamePacketBuilder();
|
||||
|
||||
playerProperties.put(DataType.BYTE, appearance.getGender().toInteger()); // gender
|
||||
playerProperties.put(DataType.BYTE, -1); // skull icon
|
||||
playerProperties.put(DataType.BYTE, -1); // prayer icon
|
||||
|
||||
Inventory equipment = block.getEquipment();
|
||||
int[] style = appearance.getStyle();
|
||||
Item item, chest, helm;
|
||||
|
||||
for (int slot = 0; slot < 4; slot++) {
|
||||
if ((item = equipment.get(slot)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if ((chest = equipment.get(EquipmentConstants.CHEST)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + chest.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[2]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.SHIELD)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
|
||||
if (chest != null) {
|
||||
EquipmentDefinition def = EquipmentDefinition.forId(chest.getId());
|
||||
if (def != null && !def.isFullBody()) {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[3]);
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[3]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.LEGS)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[5]);
|
||||
}
|
||||
|
||||
if ((helm = equipment.get(EquipmentConstants.HAT)) != null) {
|
||||
EquipmentDefinition def = EquipmentDefinition.forId(helm.getId());
|
||||
if (def != null && !def.isFullHat() && !def.isFullMask()) {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[0]);
|
||||
} else {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
}
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[0]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.HANDS)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[4]);
|
||||
}
|
||||
|
||||
if ((item = equipment.get(EquipmentConstants.FEET)) != null) {
|
||||
playerProperties.put(DataType.SHORT, 0x200 + item.getId());
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[6]);
|
||||
}
|
||||
|
||||
EquipmentDefinition def = null;
|
||||
if (helm != null) {
|
||||
def = EquipmentDefinition.forId(helm.getId());
|
||||
}
|
||||
if ((def != null && (def.isFullHat() || def.isFullMask())) || appearance.getGender() == Gender.FEMALE) {
|
||||
playerProperties.put(DataType.BYTE, 0);
|
||||
} else {
|
||||
playerProperties.put(DataType.SHORT, 0x100 + style[1]);
|
||||
}
|
||||
|
||||
int[] colors = appearance.getColors();
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
playerProperties.put(DataType.BYTE, colors[i]);
|
||||
}
|
||||
|
||||
playerProperties.put(DataType.SHORT, 0x328); // stand
|
||||
playerProperties.put(DataType.SHORT, 0x337); // stand turn
|
||||
playerProperties.put(DataType.SHORT, 0x333); // walk
|
||||
playerProperties.put(DataType.SHORT, 0x334); // turn 180
|
||||
playerProperties.put(DataType.SHORT, 0x335); // turn 90 cw
|
||||
playerProperties.put(DataType.SHORT, 0x336); // turn 90 ccw
|
||||
playerProperties.put(DataType.SHORT, 0x338); // run
|
||||
|
||||
playerProperties.put(DataType.LONG, block.getName());
|
||||
playerProperties.put(DataType.BYTE, block.getCombatLevel()); // combat level
|
||||
playerProperties.put(DataType.SHORT, block.getSkillLevel()); // total skill level
|
||||
|
||||
blockBuilder.put(DataType.BYTE, playerProperties.getLength());
|
||||
blockBuilder.putRawBuilderReverse(playerProperties);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user