package l2p.gameserver.serverpackets;
import l2p.commons.dbutils.DbUtils;
import l2p.gameserver.Config;
import l2p.gameserver.dao.CharacterDAO;
import l2p.gameserver.data.xml.holder.CharTemplateHolder;
import l2p.gameserver.database.DatabaseFactory;
import l2p.gameserver.model.CharSelectInfoPackage;
import l2p.gameserver.model.base.Experience;
import l2p.gameserver.model.items.Inventory;
import l2p.gameserver.templates.PlayerTemplate;
import l2p.gameserver.utils.AutoBan;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
public class CharacterSelectionInfo extends L2GameServerPacket {
// dc cd SdSddddddddddffdQfddddddddddddddddddddddddddddddddddddddddffdddchhdddddffdd
private static final Logger _log = LoggerFactory.getLogger(CharacterSelectionInfo.class);
private String _loginName;
private int _sessionId;
private CharSelectInfoPackage[] _characterPackages;
public CharacterSelectionInfo(String loginName, int sessionId) {
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(loginName);
}
public CharSelectInfoPackage[] getCharInfo() {
return _characterPackages;
}
@Override
protected final void writeImpl() {
int size = _characterPackages != null ? _characterPackages.length : 0;
writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeD(0x00);
long lastAccess = -1L;
int lastUsed = -1;
for (int i = 0; i < size; i++) {
if (lastAccess < _characterPackages.getLastAccess()) {
lastAccess = _characterPackages.getLastAccess();
lastUsed = i;
}
}
for (int i = 0; i < size; i++) {
CharSelectInfoPackage charInfoPackage = _characterPackages;
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getCharId()); // ?
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());
writeD(0x01); // active ??
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeD(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
int lvl = charInfoPackage.getLevel();
writeF(Experience.getExpPercent(lvl, charInfoPackage.getExp()));
writeD(lvl);
writeD(charInfoPackage.getKarma());
writeD(charInfoPackage.getPk());
writeD(charInfoPackage.getPvP());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER) {
writeD(charInfoPackage.getPaperdollItemId(PAPERDOLL_ID));
}
if (getClient().getRevision() == 411 || getClient().getRevision() == 448) {
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
}
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max
writeD(charInfoPackage.getAccessLevel() > -100 ? charInfoPackage.getDeleteTimer() : -1);
writeD(charInfoPackage.getClassId());
writeD(0x00);
writeC(Math.min(charInfoPackage.getPaperdollEnchantEffect(Inventory.PAPERDOLL_RHAND), 127));
writeD(charInfoPackage.getPaperdollAugmentationId(Inventory.PAPERDOLL_RHAND));
int weaponId = charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND);
if (weaponId == 8190) // Transform id (на оффе отображаются только КВ трансформации или вообще не отображаются
{
writeD(301);
} else if (weaponId == 8689) {
writeD(302);
} else {
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);
writeD(0x00);
writeD(0x00);
}
}
}
public static CharSelectInfoPackage[] loadCharacterSelectInfo(String loginName) {
CharSelectInfoPackage charInfopackage;
List<CharSelectInfoPackage> characterList = new ArrayList<CharSelectInfoPackage>();
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM characters AS c LEFT JOIN character_subclasses AS cs ON (c.obj_Id=cs.char_obj_id AND cs.active=1) WHERE account_name=? LIMIT 7");
statement.setString(1, loginName);
rset = statement.executeQuery();
while (rset.next()) // fills the package
{
charInfopackage = restoreChar(rset);
if (charInfopackage != null) {
characterList.add(charInfopackage);
}
}
} catch (Exception e) {
_log.error("could not restore charinfo:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}
return characterList.toArray(new CharSelectInfoPackage[characterList.size()]);
}
private static int restoreBaseClassId(int objId) {
int classId = 0;
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT class_id FROM character_subclasses WHERE char_obj_id=? AND isBase=1");
statement.setInt(1, objId);
rset = statement.executeQuery();
while (rset.next()) {
classId = rset.getInt("class_id");
}
} catch (Exception e) {
_log.error("could not restore base class id:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}
return classId;
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata) {
CharSelectInfoPackage charInfopackage = null;
try {
int objectId = chardata.getInt("obj_Id");
int classid = chardata.getInt("class_id");
int baseClassId = classid;
boolean useBaseClass = chardata.getInt("isBase") > 0;
if (!useBaseClass) {
baseClassId = restoreBaseClassId(objectId);
}
boolean female = chardata.getInt("sex") == 1;
PlayerTemplate templ = CharTemplateHolder.getInstance().getTemplate(baseClassId, female);
if (templ == null) {
_log.error("restoreChar fail | templ == null | objectId: " + objectId + " | classid: " + baseClassId + " | female: " + female);
return null;
}
String name = chardata.getString("char_name");
charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setLevel(chardata.getInt("level"));
charInfopackage.setMaxHp(chardata.getInt("maxHp"));
charInfopackage.setCurrentHp(chardata.getDouble("curHp"));
charInfopackage.setMaxMp(chardata.getInt("maxMp"));
charInfopackage.setCurrentMp(chardata.getDouble("curMp"));
charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
charInfopackage.setPk(chardata.getInt("pkkills"));
charInfopackage.setPvP(chardata.getInt("pvpkills"));
charInfopackage.setFace(chardata.getInt("face"));
charInfopackage.setHairStyle(chardata.getInt("hairstyle"));
charInfopackage.setHairColor(chardata.getInt("haircolor"));
charInfopackage.setSex(female ? 1 : 0);
charInfopackage.setExp(chardata.getLong("exp"));
charInfopackage.setSp(chardata.getInt("sp"));
charInfopackage.setClanId(chardata.getInt("clanid"));
charInfopackage.setKarma(chardata.getInt("karma"));
charInfopackage.setRace(templ.race.ordinal());
charInfopackage.setClassId(classid);
charInfopackage.setBaseClassId(baseClassId);
long deletetime = chardata.getLong("deletetime");
int deletedays = 0;
if (Config.DELETE_DAYS > 0) {
if (deletetime > 0) {
deletetime = (int) (System.currentTimeMillis() / 1000 - deletetime);
deletedays = (int) (deletetime / 3600 / 24);
if (deletedays >= Config.DELETE_DAYS) {
CharacterDAO.getInstance().deleteCharByObjId(objectId);
return null;
}
deletetime = Config.DELETE_DAYS * 3600 * 24 - deletetime;
} else {
deletetime = 0;
}
}
charInfopackage.setDeleteTimer((int) deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess") * 1000L);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));
int points = chardata.getInt("vitality") + (int) ((System.currentTimeMillis() - charInfopackage.getLastAccess()) / 15.);
if (points > 20000) {
points = 20000;
} else if (points < 0) {
points = 0;
}
charInfopackage.setVitalityPoints(points);
if (charInfopackage.getAccessLevel() < 0 && !AutoBan.isBanned(objectId)) {
charInfopackage.setAccessLevel(0);
}
} catch (Exception e) {
_log.error(StringUtils.EMPTY, e);
}
return charInfopackage;
}
}
import l2p.commons.dbutils.DbUtils;
import l2p.gameserver.Config;
import l2p.gameserver.dao.CharacterDAO;
import l2p.gameserver.data.xml.holder.CharTemplateHolder;
import l2p.gameserver.database.DatabaseFactory;
import l2p.gameserver.model.CharSelectInfoPackage;
import l2p.gameserver.model.base.Experience;
import l2p.gameserver.model.items.Inventory;
import l2p.gameserver.templates.PlayerTemplate;
import l2p.gameserver.utils.AutoBan;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
public class CharacterSelectionInfo extends L2GameServerPacket {
// dc cd SdSddddddddddffdQfddddddddddddddddddddddddddddddddddddddddffdddchhdddddffdd
private static final Logger _log = LoggerFactory.getLogger(CharacterSelectionInfo.class);
private String _loginName;
private int _sessionId;
private CharSelectInfoPackage[] _characterPackages;
public CharacterSelectionInfo(String loginName, int sessionId) {
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(loginName);
}
public CharSelectInfoPackage[] getCharInfo() {
return _characterPackages;
}
@Override
protected final void writeImpl() {
int size = _characterPackages != null ? _characterPackages.length : 0;
writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeD(0x00);
long lastAccess = -1L;
int lastUsed = -1;
for (int i = 0; i < size; i++) {
if (lastAccess < _characterPackages.getLastAccess()) {
lastAccess = _characterPackages.getLastAccess();
lastUsed = i;
}
}
for (int i = 0; i < size; i++) {
CharSelectInfoPackage charInfoPackage = _characterPackages;
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getCharId()); // ?
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());
writeD(0x01); // active ??
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeD(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
int lvl = charInfoPackage.getLevel();
writeF(Experience.getExpPercent(lvl, charInfoPackage.getExp()));
writeD(lvl);
writeD(charInfoPackage.getKarma());
writeD(charInfoPackage.getPk());
writeD(charInfoPackage.getPvP());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER) {
writeD(charInfoPackage.getPaperdollItemId(PAPERDOLL_ID));
}
if (getClient().getRevision() == 411 || getClient().getRevision() == 448) {
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
}
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max
writeD(charInfoPackage.getAccessLevel() > -100 ? charInfoPackage.getDeleteTimer() : -1);
writeD(charInfoPackage.getClassId());
writeD(0x00);
writeC(Math.min(charInfoPackage.getPaperdollEnchantEffect(Inventory.PAPERDOLL_RHAND), 127));
writeD(charInfoPackage.getPaperdollAugmentationId(Inventory.PAPERDOLL_RHAND));
int weaponId = charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND);
if (weaponId == 8190) // Transform id (на оффе отображаются только КВ трансформации или вообще не отображаются
{
writeD(301);
} else if (weaponId == 8689) {
writeD(302);
} else {
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);
writeD(0x00);
writeD(0x00);
}
}
}
public static CharSelectInfoPackage[] loadCharacterSelectInfo(String loginName) {
CharSelectInfoPackage charInfopackage;
List<CharSelectInfoPackage> characterList = new ArrayList<CharSelectInfoPackage>();
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM characters AS c LEFT JOIN character_subclasses AS cs ON (c.obj_Id=cs.char_obj_id AND cs.active=1) WHERE account_name=? LIMIT 7");
statement.setString(1, loginName);
rset = statement.executeQuery();
while (rset.next()) // fills the package
{
charInfopackage = restoreChar(rset);
if (charInfopackage != null) {
characterList.add(charInfopackage);
}
}
} catch (Exception e) {
_log.error("could not restore charinfo:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}
return characterList.toArray(new CharSelectInfoPackage[characterList.size()]);
}
private static int restoreBaseClassId(int objId) {
int classId = 0;
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT class_id FROM character_subclasses WHERE char_obj_id=? AND isBase=1");
statement.setInt(1, objId);
rset = statement.executeQuery();
while (rset.next()) {
classId = rset.getInt("class_id");
}
} catch (Exception e) {
_log.error("could not restore base class id:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}
return classId;
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata) {
CharSelectInfoPackage charInfopackage = null;
try {
int objectId = chardata.getInt("obj_Id");
int classid = chardata.getInt("class_id");
int baseClassId = classid;
boolean useBaseClass = chardata.getInt("isBase") > 0;
if (!useBaseClass) {
baseClassId = restoreBaseClassId(objectId);
}
boolean female = chardata.getInt("sex") == 1;
PlayerTemplate templ = CharTemplateHolder.getInstance().getTemplate(baseClassId, female);
if (templ == null) {
_log.error("restoreChar fail | templ == null | objectId: " + objectId + " | classid: " + baseClassId + " | female: " + female);
return null;
}
String name = chardata.getString("char_name");
charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setLevel(chardata.getInt("level"));
charInfopackage.setMaxHp(chardata.getInt("maxHp"));
charInfopackage.setCurrentHp(chardata.getDouble("curHp"));
charInfopackage.setMaxMp(chardata.getInt("maxMp"));
charInfopackage.setCurrentMp(chardata.getDouble("curMp"));
charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
charInfopackage.setPk(chardata.getInt("pkkills"));
charInfopackage.setPvP(chardata.getInt("pvpkills"));
charInfopackage.setFace(chardata.getInt("face"));
charInfopackage.setHairStyle(chardata.getInt("hairstyle"));
charInfopackage.setHairColor(chardata.getInt("haircolor"));
charInfopackage.setSex(female ? 1 : 0);
charInfopackage.setExp(chardata.getLong("exp"));
charInfopackage.setSp(chardata.getInt("sp"));
charInfopackage.setClanId(chardata.getInt("clanid"));
charInfopackage.setKarma(chardata.getInt("karma"));
charInfopackage.setRace(templ.race.ordinal());
charInfopackage.setClassId(classid);
charInfopackage.setBaseClassId(baseClassId);
long deletetime = chardata.getLong("deletetime");
int deletedays = 0;
if (Config.DELETE_DAYS > 0) {
if (deletetime > 0) {
deletetime = (int) (System.currentTimeMillis() / 1000 - deletetime);
deletedays = (int) (deletetime / 3600 / 24);
if (deletedays >= Config.DELETE_DAYS) {
CharacterDAO.getInstance().deleteCharByObjId(objectId);
return null;
}
deletetime = Config.DELETE_DAYS * 3600 * 24 - deletetime;
} else {
deletetime = 0;
}
}
charInfopackage.setDeleteTimer((int) deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess") * 1000L);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));
int points = chardata.getInt("vitality") + (int) ((System.currentTimeMillis() - charInfopackage.getLastAccess()) / 15.);
if (points > 20000) {
points = 20000;
} else if (points < 0) {
points = 0;
}
charInfopackage.setVitalityPoints(points);
if (charInfopackage.getAccessLevel() < 0 && !AutoBan.isBanned(objectId)) {
charInfopackage.setAccessLevel(0);
}
} catch (Exception e) {
_log.error(StringUtils.EMPTY, e);
}
return charInfopackage;
}
}
package l2p.gameserver.serverpackets;
import l2p.gameserver.Config;
import l2p.gameserver.data.xml.holder.NpcHolder;
import l2p.gameserver.instancemanager.CursedWeaponsManager;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.Zone;
import l2p.gameserver.model.base.Element;
import l2p.gameserver.model.base.Experience;
import l2p.gameserver.model.base.TeamType;
import l2p.gameserver.model.entity.events.GlobalEvent;
import l2p.gameserver.model.entity.events.impl.DominionSiegeEvent;
import l2p.gameserver.model.items.Inventory;
import l2p.gameserver.model.matching.MatchingRoom;
import l2p.gameserver.model.pledge.Alliance;
import l2p.gameserver.model.pledge.Clan;
import l2p.gameserver.skills.effects.EffectCubic;
import l2p.gameserver.utils.Location;
import org.apache.commons.lang3.StringUtils;
public class UserInfo extends L2GameServerPacket {
private boolean can_writeImpl = false, partyRoom;
private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd, _relation;
private double move_speed, attack_speed, col_radius, col_height;
private int[][] _inv;
private Location _loc, _fishLoc;
private int obj_id, vehicle_obj_id, _race, sex, base_class, level, curCp, maxCp, _enchant, _weaponFlag;
private long _exp;
private int curHp, maxHp, curMp, maxMp, curLoad, maxLoad, rec_left, rec_have;
private int _str, _con, _dex, _int, _wit, _men, _sp, ClanPrivs, InventoryLimit;
private int _patk, _patkspd, _pdef, evasion, accuracy, crit, _matk, _matkspd, mevasion, maccuracy, mCritRate;
private int _mdef, pvp_flag, karma, hair_style, hair_color, face, gm_commands, fame, vitality;
private int clan_id, clan_crest_id, ally_id, ally_crest_id, large_clan_crest_id;
private int private_store, can_crystalize, pk_kills, pvp_kills, class_id, agathion;
private int _abnormalEffect, _abnormalEffect2, noble, hero, mount_id, cw_level;
private int name_color, running, pledge_class, pledge_type, title_color, transformation, fishing;
private int defenceFire, defenceWater, defenceWind, defenceEarth, defenceHoly, defenceUnholy;
private int mount_type;
private String _name, title;
private EffectCubic[] cubics;
private Element attackElement;
private int attackElementValue;
private boolean isFlying, _allowMap;
private int talismans;
private boolean openCloak;
private double _expPercent;
private TeamType _team;
private static final Logger _log = LoggerFactory.getLogger(UserInfo.class);
public UserInfo(Player player) {
if (player.getTransformationName() != null) {
_name = player.getTransformationName();
title = "";
clan_crest_id = 0;
ally_crest_id = 0;
large_clan_crest_id = 0;
cw_level = CursedWeaponsManager.getInstance().getLevel(player.getCursedWeaponEquippedId());
} else {
_name = player.getName();
Clan clan = player.getClan();
Alliance alliance = clan == null ? null : clan.getAlliance();
//
clan_id = clan == null ? 0 : clan.getClanId();
clan_crest_id = clan == null ? 0 : clan.getCrestId();
large_clan_crest_id = clan == null ? 0 : clan.getCrestLargeId();
//
ally_id = alliance == null ? 0 : alliance.getAllyId();
ally_crest_id = alliance == null ? 0 : alliance.getAllyCrestId();
cw_level = 0;
title = player.getTitle();
}
if (player.getPlayerAccess().GodMode && player.isInvisible())
title += "";
if (player.isPolymorphed())
if (NpcHolder.getInstance().getTemplate(player.getPolyId()) != null)
title += " - " + NpcHolder.getInstance().getTemplate(player.getPolyId()).name;
else
title += " - Polymorphed";
if (player.isMounted()) {
_enchant = 0;
mount_id = player.getMountNpcId() + 1000000;
mount_type = player.getMountType();
} else {
_enchant = player.getEnchantEffect();
mount_id = 0;
mount_type = 0;
}
_weaponFlag = player.getActiveWeaponInstance() == null ? 0x14 : 0x28;
move_speed = player.getMovementSpeedMultiplier();
_runSpd = (int) (player.getRunSpeed() / move_speed);
_walkSpd = (int) (player.getWalkSpeed() / move_speed);
//_flRunSpd = (int) player.getTemplate().getBaseFlyRunSpd();
//_flWalkSpd = (int) player.getTemplate().getBaseFlyWalkSpd();
if (player.isFlying()) {
_flyRunSpd = _runSpd;
_flyWalkSpd = _walkSpd;
} else {
_flyRunSpd = 0;
_flyWalkSpd = 0;
}
_swimRunSpd = player.getSwimSpeed();
_swimWalkSpd = player.getSwimSpeed();
_inv = new int[Inventory.PAPERDOLL_MAX][3];
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER) {
_inv[PAPERDOLL_ID][0] = player.getInventory().getPaperdollObjectId(PAPERDOLL_ID);
_inv[PAPERDOLL_ID][1] = player.getInventory().getPaperdollItemId(PAPERDOLL_ID);
_inv[PAPERDOLL_ID][2] = player.getInventory().getPaperdollAugmentationId(PAPERDOLL_ID);
}
_relation = player.isClanLeader() ? 0x40 : 0;
for (GlobalEvent e : player.getEvents())
_relation = e.getUserRelation(player, _relation);
_loc = player.getLoc();
obj_id = player.getObjectId();
vehicle_obj_id = player.isInBoat() ? player.getBoat().getObjectId() : 0x00;
_race = player.getRace().ordinal();
sex = player.getSex();
base_class = player.getBaseClassId();
level = player.getLevel();
_exp = player.getExp();
_expPercent = Experience.getExpPercent(player.getLevel(), player.getExp());
_str = player.getSTR();
_dex = player.getDEX();
_con = player.getCON();
_int = player.getINT();
_wit = player.getWIT();
_men = player.getMEN();
curHp = (int) player.getCurrentHp();
maxHp = player.getMaxHp();
curMp = (int) player.getCurrentMp();
maxMp = player.getMaxMp();
curLoad = player.getCurrentLoad();
maxLoad = player.getMaxLoad();
_sp = player.getIntSp();
_patk = player.getPAtk(null);
_patkspd = player.getPAtkSpd();
_pdef = player.getPDef(null);
evasion = player.getEvasionRate(null);
mevasion = player.getMEvasionRate(null);
maccuracy = player.getMAccuracy();
mCritRate = (int) player.getMagicCriticalRate(null, null);
accuracy = player.getAccuracy();
crit = player.getCriticalHit(null, null);
_matk = player.getMAtk(null, null);
_matkspd = player.getMAtkSpd();
_mdef = player.getMDef(null, null);
pvp_flag = player.getPvpFlag(); // 0=white, 1=purple, 2=purpleblink
karma = player.getKarma();
attack_speed = player.getAttackSpeedMultiplier();
col_radius = player.getColRadius();
col_height = player.getColHeight();
hair_style = player.getHairStyle();
hair_color = player.getHairColor();
face = player.getFace();
gm_commands = player.isGM() || player.getPlayerAccess().CanUseGMCommand ? 1 : 0;
// builder level активирует в клиенте админские команды
clan_id = player.getClanId();
ally_id = player.getAllyId();
private_store = player.getPrivateStoreType();
can_crystalize = player.getSkillLevel(Skill.SKILL_CRYSTALLIZE) > 0 ? 1 : 0;
pk_kills = player.getPkKills();
pvp_kills = player.getPvpKills();
cubics = player.getCubics().toArray(new EffectCubic[player.getCubics().size()]);
_abnormalEffect = player.getAbnormalEffect();
_abnormalEffect2 = player.getAbnormalEffect2();
ClanPrivs = player.getClanPrivileges();
rec_left = player.getRecomLeft(); //c2 recommendations remaining
rec_have = player.getRecomHave(); //c2 recommendations received
InventoryLimit = player.getInventoryLimit();
class_id = player.getClassId().getId();
maxCp = player.getMaxCp();
curCp = (int) player.getCurrentCp();
_team = player.getTeam();
noble = player.isNoble() || player.isGM() && Config.GM_HERO_AURA ? 1 : 0; //0x01: symbol on char menu ctrl+I
hero = player.isHero() || player.isGM() && Config.GM_HERO_AURA ? 1 : 0; //0x01: Hero Aura and symbol
//fishing = _cha.isFishing() ? 1 : 0; // Fishing Mode
_fishLoc = player.getFishLoc();
name_color = player.getNameColor();
running = player.isRunning() ? 0x01 : 0x00; //changes the Speed display on Status Window
pledge_class = player.getPledgeClass();
pledge_type = player.getPledgeType();
title_color = player.getTitleColor();
transformation = player.getTransformation();
attackElement = player.getAttackElement();
attackElementValue = player.getAttack(attackElement);
defenceFire = player.getDefence(Element.FIRE);
defenceWater = player.getDefence(Element.WATER);
defenceWind = player.getDefence(Element.WIND);
defenceEarth = player.getDefence(Element.EARTH);
defenceHoly = player.getDefence(Element.HOLY);
defenceUnholy = player.getDefence(Element.UNHOLY);
agathion = player.getAgathionId();
fame = player.getFame();
vitality = (int) player.getVitality();
partyRoom = player.getMatchingRoom() != null && player.getMatchingRoom().getType() == MatchingRoom.PARTY_MATCHING && player.getMatchingRoom().getLeader() == player;
isFlying = player.isInFlyingTransform();
talismans = player.getTalismanCount();
openCloak = player.getOpenCloak();
_allowMap = player.isActionBlocked(Zone.BLOCKED_ACTION_MINIMAP);
fishing = player.isFishing() ? 1 : 0; // Fishing Mode
can_writeImpl = true;
}
@Override
protected final void writeImpl() {
if (!can_writeImpl)
return;
Player activeChar = getClient().getActiveChar();
if (activeChar == null)
return;
if (!activeChar.isTautiClient())
{
writeC(0x32);
writeD(_loc.x);
writeD(_loc.y);
writeD(_loc.z + Config.CLIENT_Z_SHIFT);
writeD(vehicle_obj_id);
writeD(obj_id);
writeS(_name);
writeD(_race);
writeD(sex);
writeD(base_class);// Ид профессии, которую персонаж получает при создании (Human fighter, elven fighter...)
writeD(level);
writeQ(_exp);
writeF(_expPercent);
writeD(_str);
writeD(_dex);
writeD(_con);
writeD(_int);
writeD(_wit);
writeD(_men);
writeD(maxHp);
writeD(curHp);
writeD(maxMp);
writeD(curMp);
writeD(_sp);
writeD(curLoad);
writeD(maxLoad);
writeD(_weaponFlag);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][0]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][1]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][2]);
writeD(talismans);
writeD(openCloak ? 0x01 : 0x00);
writeD(0x00); //Внешний вид оружия (ИД Итема).
writeD(0x00); //Внешний вид щита (ИД Итема).
writeD(0x00); //???
writeD(_patk);
writeD(_patkspd);
writeD(_pdef);
writeD(evasion);
writeD(accuracy);
writeD(crit);
writeD(_matk);
writeD(_matkspd);
writeD(_patkspd);
writeD(_mdef);
writeD(mevasion); // mEvasion //GOD
writeD(maccuracy); // mAccuracy //GOD
writeD(mCritRate); // mCritRate //GOD
writeD(pvp_flag);
writeD(karma);
writeD(_runSpd);
writeD(_walkSpd);
writeD(_swimRunSpd); // swimspeed
writeD(_swimWalkSpd); // swimspeed
writeD(_flRunSpd);
writeD(_flWalkSpd);
writeD(_flyRunSpd);
writeD(_flyWalkSpd);
writeF(move_speed);
writeF(attack_speed);
writeF(col_radius);
writeF(col_height);
writeD(hair_style);
writeD(hair_color);
writeD(face);
writeD(gm_commands);
writeS(title);
writeD(clan_id);
writeD(clan_crest_id);
writeD(ally_id);
writeD(ally_crest_id);
// 0x40 leader rights
// siege flags: attacker - 0x180 sword over name, defender - 0x80 shield, 0xC0 crown (|leader), 0x1C0 flag (|leader)
writeD(_relation);
writeC(mount_type); // mount type
writeC(private_store);
writeC(can_crystalize);
writeD(pk_kills);
writeD(pvp_kills);
writeH(cubics.length);
for (EffectCubic cubic : cubics) {
writeH(cubic == null ? 0 : cubic.getId());
}
writeC(partyRoom ? 0x01 : 0x00); //1-find party members
writeD(_abnormalEffect);
writeC(isFlying ? 0x02 : 0x00);
writeD(ClanPrivs);
writeH(rec_left);
writeH(rec_have);
writeD(mount_id);
writeH(InventoryLimit);
writeD(class_id);
writeD(0x00); // special effects? circles around player...
writeD(maxCp);
writeD(curCp);
writeC(_enchant);
writeC(_team.ordinal());
writeD(large_clan_crest_id);
writeC(noble);
writeC(hero);
writeC(fishing);
writeD(_fishLoc.x);
writeD(_fishLoc.y);
writeD(_fishLoc.z);
writeD(name_color);
writeC(running);
writeD(pledge_class);
writeD(pledge_type);
writeD(title_color);
writeD(cw_level);
writeD(transformation); // Transformation id
// AttackElement (0 - Fire, 1 - Water, 2 - Wind, 3 - Earth, 4 - Holy, 5 - Dark, -2 - None)
writeH(attackElement.getId());
writeH(attackElementValue); // AttackElementValue
writeH(defenceFire); // DefAttrFire
writeH(defenceWater); // DefAttrWater
writeH(defenceWind); // DefAttrWind
writeH(defenceEarth); // DefAttrEarth
writeH(defenceHoly); // DefAttrHoly
writeH(defenceUnholy); // DefAttrUnholy
writeD(agathion);
// T2 Starts
writeD(fame); // Fame
writeD(_allowMap ? 1 : 0); // Minimap on Hellbound
writeD(vitality); // Vitality Points
writeD(_abnormalEffect2);
writeD(0x00);// Unknown GOD
writeD(0x00);// Unknown GOD (1 - Party searching?)
writeC(0x00);// Unknown GOD
} else {
writeC(0x32);
writeD(_loc.x);
writeD(_loc.y);
writeD(_loc.z + Config.CLIENT_Z_SHIFT);
writeD(vehicle_obj_id);
writeD(obj_id);
writeS(_name);
writeD(_race);
writeD(sex);
writeD(base_class);
writeD(level);
writeQ(_exp);
writeF(_expPercent);
writeD(_str);
writeD(_dex);
writeD(_con);
writeD(_int);
writeD(_wit);
writeD(_men);
writeD(maxHp);
writeD(curHp);
writeD(maxMp);
writeD(curMp);
writeD(_sp);
writeD(curLoad);
writeD(maxLoad);
writeD(_weaponFlag);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][0]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][1]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][2]);
writeD(talismans);
writeD(openCloak ? 0x01 : 0x00);
writeD(0x00); //Внешний вид оружия (ИД Итема).
writeD(0x00); //Внешний вид щита (ИД Итема).
writeD(0x00); //???
if (getClient().getRevision() == 448) {
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
}
writeD(_patk);
writeD(_patkspd);
writeD(_pdef);
writeD(evasion);
writeD(accuracy);
writeD(crit);
writeD(_matk);
writeD(_matkspd);
writeD(_patkspd);
writeD(_mdef);
writeD(mevasion); // mEvasion //GOD
writeD(maccuracy); // mAccuracy //GOD
writeD(mCritRate); // mCritRate //GOD
writeD(pvp_flag);
writeD(karma);
writeD(_runSpd);
writeD(_walkSpd);
writeD(_swimRunSpd); // swimspeed
writeD(_swimWalkSpd); // swimspeed
writeD(_flRunSpd);
writeD(_flWalkSpd);
writeD(_flyRunSpd);
writeD(_flyWalkSpd);
writeF(move_speed);
writeF(attack_speed);
writeF(col_radius);
writeF(col_height);
writeD(hair_style);
writeD(hair_color);
writeD(face);
writeD(gm_commands);
writeS(title);
writeD(clan_id);
writeD(clan_crest_id);
writeD(ally_id);
writeD(ally_crest_id);
// 0x40 leader rights
// siege flags: attacker - 0x180 sword over name, defender - 0x80
// shield, 0xC0 crown (|leader), 0x1C0 flag (|leader)
writeD(_relation);
writeC(mount_type); // mount type
writeC(private_store);
writeC(can_crystalize);
writeD(pk_kills);
writeD(pvp_kills);
writeH(cubics.length);
for (EffectCubic cubic : cubics) {
writeH(cubic == null ? 0 : cubic.getId());
}
writeC(partyRoom ? 0x01 : 0x00); // 1-find party members
writeC(isFlying ? 0x02 : 0x00);
writeD(ClanPrivs);
writeH(rec_left);
writeH(rec_have);
writeD(mount_id);
writeH(InventoryLimit);
writeD(class_id);
writeD(0x00);
writeD(maxCp);
writeD(curCp);
writeC(_enchant);
writeC(_team.ordinal());
writeD(large_clan_crest_id);
writeC(noble);
writeC(hero);
writeC(fishing);
writeD(_fishLoc.x);
writeD(_fishLoc.y);
writeD(_fishLoc.z);
writeD(name_color);
writeC(running);
writeD(pledge_class);
writeD(pledge_type);
writeD(title_color);
writeD(cw_level);
writeD(transformation); // Transformation id
// AttackElement (0 - Fire, 1 - Water, 2 - Wind, 3 - Earth, 4 - Holy, 5
// - Dark, -2 - None)
writeH(attackElement.getId());
writeH(attackElementValue); // AttackElementValue
writeH(defenceFire); // DefAttrFire
writeH(defenceWater); // DefAttrWater
writeH(defenceWind); // DefAttrWind
writeH(defenceEarth); // DefAttrEarth
writeH(defenceHoly); // DefAttrHoly
writeH(defenceUnholy); // DefAttrUnholy
writeD(agathion);
// T2 Starts
writeD(fame); // Fame
writeD(_allowMap ? 1 : 0); // Minimap on Hellbound
writeD(vitality); // Vitality Points
/*START: Структура написана от балды, чтобы соответствовать размеру пакета:*/
writeD(0x00); // TAUTI
writeD(0x00); // TAUTI
writeD(0x00); // TAUTI
writeC(0x00); // TAUTI
/*END: Структура написана от балды, чтобы соответствовать размеру пакета:*/
//TODO доделать абнормалы для таути
writeD(0x00);
/*
writeD(_abnormalEffects.size());
for(int abnormalId : _abnormalEffects.toArray())
writeD(abnormalId);
*/
writeC(0x00); // TAUTI
}
}
}
import l2p.gameserver.Config;
import l2p.gameserver.data.xml.holder.NpcHolder;
import l2p.gameserver.instancemanager.CursedWeaponsManager;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.Skill;
import l2p.gameserver.model.Zone;
import l2p.gameserver.model.base.Element;
import l2p.gameserver.model.base.Experience;
import l2p.gameserver.model.base.TeamType;
import l2p.gameserver.model.entity.events.GlobalEvent;
import l2p.gameserver.model.entity.events.impl.DominionSiegeEvent;
import l2p.gameserver.model.items.Inventory;
import l2p.gameserver.model.matching.MatchingRoom;
import l2p.gameserver.model.pledge.Alliance;
import l2p.gameserver.model.pledge.Clan;
import l2p.gameserver.skills.effects.EffectCubic;
import l2p.gameserver.utils.Location;
import org.apache.commons.lang3.StringUtils;
public class UserInfo extends L2GameServerPacket {
private boolean can_writeImpl = false, partyRoom;
private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd, _relation;
private double move_speed, attack_speed, col_radius, col_height;
private int[][] _inv;
private Location _loc, _fishLoc;
private int obj_id, vehicle_obj_id, _race, sex, base_class, level, curCp, maxCp, _enchant, _weaponFlag;
private long _exp;
private int curHp, maxHp, curMp, maxMp, curLoad, maxLoad, rec_left, rec_have;
private int _str, _con, _dex, _int, _wit, _men, _sp, ClanPrivs, InventoryLimit;
private int _patk, _patkspd, _pdef, evasion, accuracy, crit, _matk, _matkspd, mevasion, maccuracy, mCritRate;
private int _mdef, pvp_flag, karma, hair_style, hair_color, face, gm_commands, fame, vitality;
private int clan_id, clan_crest_id, ally_id, ally_crest_id, large_clan_crest_id;
private int private_store, can_crystalize, pk_kills, pvp_kills, class_id, agathion;
private int _abnormalEffect, _abnormalEffect2, noble, hero, mount_id, cw_level;
private int name_color, running, pledge_class, pledge_type, title_color, transformation, fishing;
private int defenceFire, defenceWater, defenceWind, defenceEarth, defenceHoly, defenceUnholy;
private int mount_type;
private String _name, title;
private EffectCubic[] cubics;
private Element attackElement;
private int attackElementValue;
private boolean isFlying, _allowMap;
private int talismans;
private boolean openCloak;
private double _expPercent;
private TeamType _team;
private static final Logger _log = LoggerFactory.getLogger(UserInfo.class);
public UserInfo(Player player) {
if (player.getTransformationName() != null) {
_name = player.getTransformationName();
title = "";
clan_crest_id = 0;
ally_crest_id = 0;
large_clan_crest_id = 0;
cw_level = CursedWeaponsManager.getInstance().getLevel(player.getCursedWeaponEquippedId());
} else {
_name = player.getName();
Clan clan = player.getClan();
Alliance alliance = clan == null ? null : clan.getAlliance();
//
clan_id = clan == null ? 0 : clan.getClanId();
clan_crest_id = clan == null ? 0 : clan.getCrestId();
large_clan_crest_id = clan == null ? 0 : clan.getCrestLargeId();
//
ally_id = alliance == null ? 0 : alliance.getAllyId();
ally_crest_id = alliance == null ? 0 : alliance.getAllyCrestId();
cw_level = 0;
title = player.getTitle();
}
if (player.getPlayerAccess().GodMode && player.isInvisible())
title += "";
if (player.isPolymorphed())
if (NpcHolder.getInstance().getTemplate(player.getPolyId()) != null)
title += " - " + NpcHolder.getInstance().getTemplate(player.getPolyId()).name;
else
title += " - Polymorphed";
if (player.isMounted()) {
_enchant = 0;
mount_id = player.getMountNpcId() + 1000000;
mount_type = player.getMountType();
} else {
_enchant = player.getEnchantEffect();
mount_id = 0;
mount_type = 0;
}
_weaponFlag = player.getActiveWeaponInstance() == null ? 0x14 : 0x28;
move_speed = player.getMovementSpeedMultiplier();
_runSpd = (int) (player.getRunSpeed() / move_speed);
_walkSpd = (int) (player.getWalkSpeed() / move_speed);
//_flRunSpd = (int) player.getTemplate().getBaseFlyRunSpd();
//_flWalkSpd = (int) player.getTemplate().getBaseFlyWalkSpd();
if (player.isFlying()) {
_flyRunSpd = _runSpd;
_flyWalkSpd = _walkSpd;
} else {
_flyRunSpd = 0;
_flyWalkSpd = 0;
}
_swimRunSpd = player.getSwimSpeed();
_swimWalkSpd = player.getSwimSpeed();
_inv = new int[Inventory.PAPERDOLL_MAX][3];
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER) {
_inv[PAPERDOLL_ID][0] = player.getInventory().getPaperdollObjectId(PAPERDOLL_ID);
_inv[PAPERDOLL_ID][1] = player.getInventory().getPaperdollItemId(PAPERDOLL_ID);
_inv[PAPERDOLL_ID][2] = player.getInventory().getPaperdollAugmentationId(PAPERDOLL_ID);
}
_relation = player.isClanLeader() ? 0x40 : 0;
for (GlobalEvent e : player.getEvents())
_relation = e.getUserRelation(player, _relation);
_loc = player.getLoc();
obj_id = player.getObjectId();
vehicle_obj_id = player.isInBoat() ? player.getBoat().getObjectId() : 0x00;
_race = player.getRace().ordinal();
sex = player.getSex();
base_class = player.getBaseClassId();
level = player.getLevel();
_exp = player.getExp();
_expPercent = Experience.getExpPercent(player.getLevel(), player.getExp());
_str = player.getSTR();
_dex = player.getDEX();
_con = player.getCON();
_int = player.getINT();
_wit = player.getWIT();
_men = player.getMEN();
curHp = (int) player.getCurrentHp();
maxHp = player.getMaxHp();
curMp = (int) player.getCurrentMp();
maxMp = player.getMaxMp();
curLoad = player.getCurrentLoad();
maxLoad = player.getMaxLoad();
_sp = player.getIntSp();
_patk = player.getPAtk(null);
_patkspd = player.getPAtkSpd();
_pdef = player.getPDef(null);
evasion = player.getEvasionRate(null);
mevasion = player.getMEvasionRate(null);
maccuracy = player.getMAccuracy();
mCritRate = (int) player.getMagicCriticalRate(null, null);
accuracy = player.getAccuracy();
crit = player.getCriticalHit(null, null);
_matk = player.getMAtk(null, null);
_matkspd = player.getMAtkSpd();
_mdef = player.getMDef(null, null);
pvp_flag = player.getPvpFlag(); // 0=white, 1=purple, 2=purpleblink
karma = player.getKarma();
attack_speed = player.getAttackSpeedMultiplier();
col_radius = player.getColRadius();
col_height = player.getColHeight();
hair_style = player.getHairStyle();
hair_color = player.getHairColor();
face = player.getFace();
gm_commands = player.isGM() || player.getPlayerAccess().CanUseGMCommand ? 1 : 0;
// builder level активирует в клиенте админские команды
clan_id = player.getClanId();
ally_id = player.getAllyId();
private_store = player.getPrivateStoreType();
can_crystalize = player.getSkillLevel(Skill.SKILL_CRYSTALLIZE) > 0 ? 1 : 0;
pk_kills = player.getPkKills();
pvp_kills = player.getPvpKills();
cubics = player.getCubics().toArray(new EffectCubic[player.getCubics().size()]);
_abnormalEffect = player.getAbnormalEffect();
_abnormalEffect2 = player.getAbnormalEffect2();
ClanPrivs = player.getClanPrivileges();
rec_left = player.getRecomLeft(); //c2 recommendations remaining
rec_have = player.getRecomHave(); //c2 recommendations received
InventoryLimit = player.getInventoryLimit();
class_id = player.getClassId().getId();
maxCp = player.getMaxCp();
curCp = (int) player.getCurrentCp();
_team = player.getTeam();
noble = player.isNoble() || player.isGM() && Config.GM_HERO_AURA ? 1 : 0; //0x01: symbol on char menu ctrl+I
hero = player.isHero() || player.isGM() && Config.GM_HERO_AURA ? 1 : 0; //0x01: Hero Aura and symbol
//fishing = _cha.isFishing() ? 1 : 0; // Fishing Mode
_fishLoc = player.getFishLoc();
name_color = player.getNameColor();
running = player.isRunning() ? 0x01 : 0x00; //changes the Speed display on Status Window
pledge_class = player.getPledgeClass();
pledge_type = player.getPledgeType();
title_color = player.getTitleColor();
transformation = player.getTransformation();
attackElement = player.getAttackElement();
attackElementValue = player.getAttack(attackElement);
defenceFire = player.getDefence(Element.FIRE);
defenceWater = player.getDefence(Element.WATER);
defenceWind = player.getDefence(Element.WIND);
defenceEarth = player.getDefence(Element.EARTH);
defenceHoly = player.getDefence(Element.HOLY);
defenceUnholy = player.getDefence(Element.UNHOLY);
agathion = player.getAgathionId();
fame = player.getFame();
vitality = (int) player.getVitality();
partyRoom = player.getMatchingRoom() != null && player.getMatchingRoom().getType() == MatchingRoom.PARTY_MATCHING && player.getMatchingRoom().getLeader() == player;
isFlying = player.isInFlyingTransform();
talismans = player.getTalismanCount();
openCloak = player.getOpenCloak();
_allowMap = player.isActionBlocked(Zone.BLOCKED_ACTION_MINIMAP);
fishing = player.isFishing() ? 1 : 0; // Fishing Mode
can_writeImpl = true;
}
@Override
protected final void writeImpl() {
if (!can_writeImpl)
return;
Player activeChar = getClient().getActiveChar();
if (activeChar == null)
return;
if (!activeChar.isTautiClient())
{
writeC(0x32);
writeD(_loc.x);
writeD(_loc.y);
writeD(_loc.z + Config.CLIENT_Z_SHIFT);
writeD(vehicle_obj_id);
writeD(obj_id);
writeS(_name);
writeD(_race);
writeD(sex);
writeD(base_class);// Ид профессии, которую персонаж получает при создании (Human fighter, elven fighter...)
writeD(level);
writeQ(_exp);
writeF(_expPercent);
writeD(_str);
writeD(_dex);
writeD(_con);
writeD(_int);
writeD(_wit);
writeD(_men);
writeD(maxHp);
writeD(curHp);
writeD(maxMp);
writeD(curMp);
writeD(_sp);
writeD(curLoad);
writeD(maxLoad);
writeD(_weaponFlag);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][0]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][1]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][2]);
writeD(talismans);
writeD(openCloak ? 0x01 : 0x00);
writeD(0x00); //Внешний вид оружия (ИД Итема).
writeD(0x00); //Внешний вид щита (ИД Итема).
writeD(0x00); //???
writeD(_patk);
writeD(_patkspd);
writeD(_pdef);
writeD(evasion);
writeD(accuracy);
writeD(crit);
writeD(_matk);
writeD(_matkspd);
writeD(_patkspd);
writeD(_mdef);
writeD(mevasion); // mEvasion //GOD
writeD(maccuracy); // mAccuracy //GOD
writeD(mCritRate); // mCritRate //GOD
writeD(pvp_flag);
writeD(karma);
writeD(_runSpd);
writeD(_walkSpd);
writeD(_swimRunSpd); // swimspeed
writeD(_swimWalkSpd); // swimspeed
writeD(_flRunSpd);
writeD(_flWalkSpd);
writeD(_flyRunSpd);
writeD(_flyWalkSpd);
writeF(move_speed);
writeF(attack_speed);
writeF(col_radius);
writeF(col_height);
writeD(hair_style);
writeD(hair_color);
writeD(face);
writeD(gm_commands);
writeS(title);
writeD(clan_id);
writeD(clan_crest_id);
writeD(ally_id);
writeD(ally_crest_id);
// 0x40 leader rights
// siege flags: attacker - 0x180 sword over name, defender - 0x80 shield, 0xC0 crown (|leader), 0x1C0 flag (|leader)
writeD(_relation);
writeC(mount_type); // mount type
writeC(private_store);
writeC(can_crystalize);
writeD(pk_kills);
writeD(pvp_kills);
writeH(cubics.length);
for (EffectCubic cubic : cubics) {
writeH(cubic == null ? 0 : cubic.getId());
}
writeC(partyRoom ? 0x01 : 0x00); //1-find party members
writeD(_abnormalEffect);
writeC(isFlying ? 0x02 : 0x00);
writeD(ClanPrivs);
writeH(rec_left);
writeH(rec_have);
writeD(mount_id);
writeH(InventoryLimit);
writeD(class_id);
writeD(0x00); // special effects? circles around player...
writeD(maxCp);
writeD(curCp);
writeC(_enchant);
writeC(_team.ordinal());
writeD(large_clan_crest_id);
writeC(noble);
writeC(hero);
writeC(fishing);
writeD(_fishLoc.x);
writeD(_fishLoc.y);
writeD(_fishLoc.z);
writeD(name_color);
writeC(running);
writeD(pledge_class);
writeD(pledge_type);
writeD(title_color);
writeD(cw_level);
writeD(transformation); // Transformation id
// AttackElement (0 - Fire, 1 - Water, 2 - Wind, 3 - Earth, 4 - Holy, 5 - Dark, -2 - None)
writeH(attackElement.getId());
writeH(attackElementValue); // AttackElementValue
writeH(defenceFire); // DefAttrFire
writeH(defenceWater); // DefAttrWater
writeH(defenceWind); // DefAttrWind
writeH(defenceEarth); // DefAttrEarth
writeH(defenceHoly); // DefAttrHoly
writeH(defenceUnholy); // DefAttrUnholy
writeD(agathion);
// T2 Starts
writeD(fame); // Fame
writeD(_allowMap ? 1 : 0); // Minimap on Hellbound
writeD(vitality); // Vitality Points
writeD(_abnormalEffect2);
writeD(0x00);// Unknown GOD
writeD(0x00);// Unknown GOD (1 - Party searching?)
writeC(0x00);// Unknown GOD
} else {
writeC(0x32);
writeD(_loc.x);
writeD(_loc.y);
writeD(_loc.z + Config.CLIENT_Z_SHIFT);
writeD(vehicle_obj_id);
writeD(obj_id);
writeS(_name);
writeD(_race);
writeD(sex);
writeD(base_class);
writeD(level);
writeQ(_exp);
writeF(_expPercent);
writeD(_str);
writeD(_dex);
writeD(_con);
writeD(_int);
writeD(_wit);
writeD(_men);
writeD(maxHp);
writeD(curHp);
writeD(maxMp);
writeD(curMp);
writeD(_sp);
writeD(curLoad);
writeD(maxLoad);
writeD(_weaponFlag);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][0]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][1]);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(_inv[PAPERDOLL_ID][2]);
writeD(talismans);
writeD(openCloak ? 0x01 : 0x00);
writeD(0x00); //Внешний вид оружия (ИД Итема).
writeD(0x00); //Внешний вид щита (ИД Итема).
writeD(0x00); //???
if (getClient().getRevision() == 448) {
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
writeD(0x00); // Harmony NEW
}
writeD(_patk);
writeD(_patkspd);
writeD(_pdef);
writeD(evasion);
writeD(accuracy);
writeD(crit);
writeD(_matk);
writeD(_matkspd);
writeD(_patkspd);
writeD(_mdef);
writeD(mevasion); // mEvasion //GOD
writeD(maccuracy); // mAccuracy //GOD
writeD(mCritRate); // mCritRate //GOD
writeD(pvp_flag);
writeD(karma);
writeD(_runSpd);
writeD(_walkSpd);
writeD(_swimRunSpd); // swimspeed
writeD(_swimWalkSpd); // swimspeed
writeD(_flRunSpd);
writeD(_flWalkSpd);
writeD(_flyRunSpd);
writeD(_flyWalkSpd);
writeF(move_speed);
writeF(attack_speed);
writeF(col_radius);
writeF(col_height);
writeD(hair_style);
writeD(hair_color);
writeD(face);
writeD(gm_commands);
writeS(title);
writeD(clan_id);
writeD(clan_crest_id);
writeD(ally_id);
writeD(ally_crest_id);
// 0x40 leader rights
// siege flags: attacker - 0x180 sword over name, defender - 0x80
// shield, 0xC0 crown (|leader), 0x1C0 flag (|leader)
writeD(_relation);
writeC(mount_type); // mount type
writeC(private_store);
writeC(can_crystalize);
writeD(pk_kills);
writeD(pvp_kills);
writeH(cubics.length);
for (EffectCubic cubic : cubics) {
writeH(cubic == null ? 0 : cubic.getId());
}
writeC(partyRoom ? 0x01 : 0x00); // 1-find party members
writeC(isFlying ? 0x02 : 0x00);
writeD(ClanPrivs);
writeH(rec_left);
writeH(rec_have);
writeD(mount_id);
writeH(InventoryLimit);
writeD(class_id);
writeD(0x00);
writeD(maxCp);
writeD(curCp);
writeC(_enchant);
writeC(_team.ordinal());
writeD(large_clan_crest_id);
writeC(noble);
writeC(hero);
writeC(fishing);
writeD(_fishLoc.x);
writeD(_fishLoc.y);
writeD(_fishLoc.z);
writeD(name_color);
writeC(running);
writeD(pledge_class);
writeD(pledge_type);
writeD(title_color);
writeD(cw_level);
writeD(transformation); // Transformation id
// AttackElement (0 - Fire, 1 - Water, 2 - Wind, 3 - Earth, 4 - Holy, 5
// - Dark, -2 - None)
writeH(attackElement.getId());
writeH(attackElementValue); // AttackElementValue
writeH(defenceFire); // DefAttrFire
writeH(defenceWater); // DefAttrWater
writeH(defenceWind); // DefAttrWind
writeH(defenceEarth); // DefAttrEarth
writeH(defenceHoly); // DefAttrHoly
writeH(defenceUnholy); // DefAttrUnholy
writeD(agathion);
// T2 Starts
writeD(fame); // Fame
writeD(_allowMap ? 1 : 0); // Minimap on Hellbound
writeD(vitality); // Vitality Points
/*START: Структура написана от балды, чтобы соответствовать размеру пакета:*/
writeD(0x00); // TAUTI
writeD(0x00); // TAUTI
writeD(0x00); // TAUTI
writeC(0x00); // TAUTI
/*END: Структура написана от балды, чтобы соответствовать размеру пакета:*/
//TODO доделать абнормалы для таути
writeD(0x00);
/*
writeD(_abnormalEffects.size());
for(int abnormalId : _abnormalEffects.toArray())
writeD(abnormalId);
*/
writeC(0x00); // TAUTI
}
}
}