@Override
public void handlePacket(ChannelHandlerContext ctx, P137_InstanceLoadRequestPlayerData packet, GameServerSession serverData, List<QueueAction> actions)
throws Exception {
// Retrieve the map this user is on
// FIXME: the login server could actually pass all the data directly to the GameServer (via RMI) instead of loading it while treating packets!!!
CharacterData character = serverData.getCurrentCharacter();
LOGGER.debug("The Character: {}", character);
P230_ZoneDataBeginCharInfo zoneDataBeginCharInfo = new P230_ZoneDataBeginCharInfo();
zoneDataBeginCharInfo.setUnknown1(1886151033); // "yalp" ???
ctx.write(zoneDataBeginCharInfo);
P044_AgentAttributeCreate updateAttributePoints = new P044_AgentAttributeCreate();
updateAttributePoints.setAgentID(character.getAgentID());
updateAttributePoints.setFreePoints((short) character.getAttPtsFree());
updateAttributePoints.setMaxPoints((short) character.getAttPtsTotal());
ctx.write(updateAttributePoints);
P171_UpdatePrivProfessions updatePrivProfessions = new P171_UpdatePrivProfessions();
updatePrivProfessions.setAgentID(character.getAgentID());
updatePrivProfessions.setProfession1(character.getProfessionPrimary());
updatePrivProfessions.setProfession2(character.getProfessionSecondary());
ctx.write(updatePrivProfessions);
P206_UpdateSkillBar updateSkillBar = new P206_UpdateSkillBar();
updateSkillBar.setAgentID(character.getAgentID());
updateSkillBar.setSkillBar(new long[8]);
updateSkillBar.setSkillBarPvpMask(new long[8]);
updateSkillBar.setUnknown4((byte) 1);
ctx.write(updateSkillBar);
P147_UpdateGenericValueInt updateEnergy = new P147_UpdateGenericValueInt();
updateEnergy.setAgentId(character.getAgentID());
updateEnergy.setValueId(GenericValues.Energy.getValue());
updateEnergy.setValue(character.getEnergy());
ctx.write(updateEnergy);
P150_UpdateGenericValueFloat updateEnergyRegen = new P150_UpdateGenericValueFloat();
updateEnergyRegen.setAgentId(character.getAgentID());
updateEnergyRegen.setValueId(GenericValues.EnergyRegen.getValue());
updateEnergyRegen.setValue(character.getEnergyRegen());
ctx.write(updateEnergyRegen);
P147_UpdateGenericValueInt updateHealth = new P147_UpdateGenericValueInt();
updateHealth.setAgentId(character.getAgentID());
updateHealth.setValueId(GenericValues.Health.getValue());
updateHealth.setValue(character.getHealth());
ctx.write(updateHealth);
P150_UpdateGenericValueFloat updateHealthRegen = new P150_UpdateGenericValueFloat();
updateHealthRegen.setAgentId(character.getAgentID());
updateHealthRegen.setValueId(GenericValues.HealthRegen.getValue());
updateHealthRegen.setValue(character.getHealthRegen());
ctx.write(updateHealthRegen);
P147_UpdateGenericValueInt updatelevel = new P147_UpdateGenericValueInt();
updatelevel.setAgentId(character.getAgentID());
updatelevel.setValueId(GenericValues.PublicLevel.getValue());
updatelevel.setValue(character.getLevel());
ctx.write(updatelevel);
P127_ZoneDataPrepMapData prepMap = new P127_ZoneDataPrepMapData();
prepMap.setUnknown1(64);
prepMap.setUnknown2(128);
prepMap.setUnknown3(27);
ctx.write(prepMap);
P126_ZoneDataMapData mapData = new P126_ZoneDataMapData();
mapData.setUnknown1(new long[] { (0x0B << 16), (0xff | 0xff << 8 | 0x54 << 16 | 0x03 << 24), (0x3b | 0x04 << 8 | 0x3a << 16 | 0x04 << 24),
(0x3a | 0x04 << 8 | 0xe8 << 16), 0, 0, (0x17 << 24) });
ctx.write(mapData);
P221_UpdateFaction faction = new P221_UpdateFaction();
faction.setKurzFree(0);
faction.setKurzTotal(0);
faction.setLuxFree(0);
faction.setLuxTotal(0);
faction.setImpFree(0);
faction.setImpTotal(0);
faction.setBalthFree(0);
faction.setBalthMax(0);
faction.setLevel(character.getLevel());
faction.setMorale(character.getMorale());
ctx.write(faction);
P207_UpdateAvailableSkills updateAvailableSkills = new P207_UpdateAvailableSkills();
// TODO: convert the skills from the char to the right integer values (because the client uses the length of ints, we have bytes)
// empty for now, database doesn't support it for now anyway