public override void Deserialize(Packet rawPacket) { this.rawPacket = rawPacket; var reader = new ArrayPacketReader(rawPacket.Payload); reader.ReadByte(); ushort packetSize = reader.ReadUShort(); byte type = reader.ReadByte(); var values = new List <SkillValue>(); ushort skillNumber; ushort value; ushort unmodifiedValue; bool isLocked = false; switch (type) { case 0x00: case 0x02: case 0xDF: while (reader.Position < packetSize && (skillNumber = reader.ReadUShort()) != 0) { value = reader.ReadUShort(); unmodifiedValue = reader.ReadUShort(); isLocked = reader.ReadBool(); ushort cap = 0; if (type == 0x02 || type == 0xDF) { cap = reader.ReadUShort(); } values.Add(new SkillValue((Skill)skillNumber, value, unmodifiedValue, cap, isLocked)); } break; case 0xFF: skillNumber = reader.ReadUShort(); var skill = skillNumber != 0 ? (Skill)(skillNumber + 1) : Skill.Alchemy; value = reader.ReadUShort(); unmodifiedValue = reader.ReadUShort(); isLocked = reader.ReadBool(); values.Add(new SkillValue(skill, value, unmodifiedValue, 0, isLocked)); break; default: throw new NotImplementedException($"Unknown type {type} of SendSkills packet."); } Values = values.ToArray(); }
public override void Deserialize(Packet rawPacket) { this.rawPacket = rawPacket; var reader = new ArrayPacketReader(rawPacket.Payload); reader.Skip(3); PlayerId = reader.ReadObjectId(); PlayerName = reader.ReadString(30); CurrentHealth = reader.ReadUShort(); MaxHealth = reader.ReadUShort(); CanRename = reader.ReadBool(); var validStats = reader.ReadByte(); // status flag / valid stats if (validStats == 0) { return; } if (validStats != 1 && validStats != 7) { throw new NotImplementedException($"unknown validStats {validStats}"); } reader.ReadByte(); // sex + race Strength = reader.ReadUShort(); Dexterity = reader.ReadUShort(); Intelligence = reader.ReadUShort(); CurrentStamina = reader.ReadUShort(); MaxStamina = reader.ReadUShort(); CurrentMana = reader.ReadUShort(); MaxMana = reader.ReadUShort(); Gold = reader.ReadUInt(); Armor = reader.ReadUShort(); Weight = reader.ReadUShort(); }
public override void Deserialize(Packet rawPacket) { this.rawPacket = rawPacket; var reader = new ArrayPacketReader(rawPacket.Payload); reader.Skip(1); DirectionType = (EffectDirectionType)reader.ReadByte(); CharacterId = reader.ReadObjectId(); TargetId = reader.ReadObjectId(); Type = reader.ReadModelId(); Location = new Location3D(reader.ReadUShort(), reader.ReadUShort(), reader.ReadSByte()); TargetLocation = new Location3D(reader.ReadUShort(), reader.ReadUShort(), reader.ReadSByte()); AnimationSpeed = reader.ReadByte(); AdjustDirection = reader.ReadBool(); ExplodeOnImpact = reader.ReadBool(); }