Axelut

UserInfo

Aug 13th, 2023
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.sf.l2j.gameserver.network.serverpackets;
  2.  
  3. import net.sf.l2j.Config;
  4. import net.sf.l2j.gameserver.data.manager.CursedWeaponManager;
  5. import net.sf.l2j.gameserver.model.WorldObject.PolyType;
  6. import net.sf.l2j.gameserver.model.actor.Summon;
  7. import net.sf.l2j.gameserver.model.actor.instance.Player;
  8. import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
  9. import net.sf.l2j.gameserver.model.location.Location;
  10. import net.sf.l2j.gameserver.skills.AbnormalEffect;
  11.  
  12. public class UserInfo extends L2GameServerPacket
  13. {
  14. private final Player _activeChar;
  15. private int _relation;
  16.  
  17. public UserInfo(Player character)
  18. {
  19. _activeChar = character;
  20.  
  21. _relation = _activeChar.isClanLeader() ? 0x40 : 0;
  22.  
  23. if (_activeChar.getSiegeState() == 1)
  24. _relation |= 0x180;
  25. if (_activeChar.getSiegeState() == 2)
  26. _relation |= 0x80;
  27. }
  28.  
  29. @Override
  30. protected final void writeImpl()
  31. {
  32. writeC(0x04);
  33.  
  34. writeD(_activeChar.getX());
  35. writeD(_activeChar.getY());
  36. writeD(_activeChar.getZ());
  37. writeD(_activeChar.getHeading());
  38. writeD(_activeChar.getObjectId());
  39.  
  40. writeS((_activeChar.getPolyTemplate() != null) ? _activeChar.getPolyTemplate().getName() : _activeChar.getName());
  41.  
  42. writeD(_activeChar.getRace().ordinal());
  43. writeD(_activeChar.getAppearance().getSex().ordinal());
  44.  
  45. if (_activeChar.getClassIndex() == 0)
  46. writeD(_activeChar.getClassId().getId());
  47. else
  48. writeD(_activeChar.getBaseClass());
  49.  
  50. writeD(_activeChar.getLevel());
  51. writeQ(_activeChar.getExp());
  52. writeD(_activeChar.getSTR());
  53. writeD(_activeChar.getDEX());
  54. writeD(_activeChar.getCON());
  55. writeD(_activeChar.getINT());
  56. writeD(_activeChar.getWIT());
  57. writeD(_activeChar.getMEN());
  58. writeD(_activeChar.getMaxHp());
  59. writeD((int) _activeChar.getCurrentHp());
  60. writeD(_activeChar.getMaxMp());
  61. writeD((int) _activeChar.getCurrentMp());
  62. writeD(_activeChar.getSp());
  63. writeD(_activeChar.getCurrentLoad());
  64. writeD(_activeChar.getMaxLoad());
  65.  
  66. writeD(_activeChar.getActiveWeaponItem() != null ? 40 : 20); // 20 no weapon, 40 weapon equipped
  67.  
  68. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIRALL));
  69. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR));
  70. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR));
  71. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK));
  72. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER));
  73. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER));
  74. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD));
  75. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  76. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND));
  77. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES));
  78. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST));
  79. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS));
  80. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET));
  81. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK));
  82. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND));
  83. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR));
  84. writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE));
  85.  
  86. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIRALL));
  87. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR));
  88. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
  89. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK));
  90. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
  91. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
  92. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  93. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  94. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  95. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  96. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  97. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  98. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  99. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  100. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  101. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  102. writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  103.  
  104. // c6 new h's
  105. writeH(0x00);
  106. writeH(0x00);
  107. writeH(0x00);
  108. writeH(0x00);
  109. writeH(0x00);
  110. writeH(0x00);
  111. writeH(0x00);
  112. writeH(0x00);
  113. writeH(0x00);
  114. writeH(0x00);
  115. writeH(0x00);
  116. writeH(0x00);
  117. writeH(0x00);
  118. writeH(0x00);
  119. writeD(_activeChar.getInventory().getPaperdollAugmentationId(Inventory.PAPERDOLL_RHAND));
  120. writeH(0x00);
  121. writeH(0x00);
  122. writeH(0x00);
  123. writeH(0x00);
  124. writeH(0x00);
  125. writeH(0x00);
  126. writeH(0x00);
  127. writeH(0x00);
  128. writeH(0x00);
  129. writeH(0x00);
  130. writeH(0x00);
  131. writeH(0x00);
  132. writeD(_activeChar.getInventory().getPaperdollAugmentationId(Inventory.PAPERDOLL_LHAND));
  133. writeH(0x00);
  134. writeH(0x00);
  135. writeH(0x00);
  136. writeH(0x00);
  137. // end of c6 new h's
  138.  
  139. writeD(_activeChar.getPAtk(null));
  140. writeD(_activeChar.getPAtkSpd());
  141. writeD(_activeChar.getPDef(null));
  142. writeD(_activeChar.getEvasionRate(null));
  143. writeD(_activeChar.getAccuracy());
  144. writeD(_activeChar.getCriticalHit(null, null));
  145. writeD(_activeChar.getMAtk(null, null));
  146.  
  147. writeD(_activeChar.getMAtkSpd());
  148. writeD(_activeChar.getPAtkSpd());
  149.  
  150. writeD(_activeChar.getMDef(null, null));
  151.  
  152. writeD(_activeChar.getPvpFlag()); // 0-non-pvp 1-pvp = violett name
  153. writeD(_activeChar.getKarma());
  154.  
  155. int _runSpd = _activeChar.getStat().getBaseRunSpeed();
  156. int _walkSpd = _activeChar.getStat().getBaseWalkSpeed();
  157. int _swimSpd = _activeChar.getStat().getBaseSwimSpeed();
  158. writeD(_runSpd); // base run speed
  159. writeD(_walkSpd); // base walk speed
  160. writeD(_swimSpd); // swim run speed
  161. writeD(_swimSpd); // swim walk speed
  162. writeD(0);
  163. writeD(0);
  164. writeD(_activeChar.isFlying() ? _runSpd : 0); // fly run speed
  165. writeD(_activeChar.isFlying() ? _walkSpd : 0); // fly walk speed
  166. writeF(_activeChar.getStat().getMovementSpeedMultiplier()); // run speed multiplier
  167. writeF(_activeChar.getStat().getAttackSpeedMultiplier()); // attack speed multiplier
  168.  
  169. Summon pet = _activeChar.getPet();
  170. if (_activeChar.getMountType() != 0 && pet != null)
  171. {
  172. writeF(pet.getCollisionRadius());
  173. writeF(pet.getCollisionHeight());
  174. }
  175. else
  176. {
  177. writeF(_activeChar.getCollisionRadius());
  178. writeF(_activeChar.getCollisionHeight());
  179. }
  180.  
  181. writeD(_activeChar.getAppearance().getHairStyle());
  182. writeD(_activeChar.getAppearance().getHairColor());
  183. writeD(_activeChar.getAppearance().getFace());
  184. writeD(_activeChar.isGM() ? 1 : 0); // builder level
  185.  
  186. writeS((_activeChar.getPolyType() != PolyType.DEFAULT) ? "Morphed" : _activeChar.getTitle());
  187.  
  188. writeD(_activeChar.getClanId());
  189. writeD(_activeChar.getClanCrestId());
  190. writeD(_activeChar.getAllyId());
  191. writeD(_activeChar.getAllyCrestId()); // ally crest id
  192. // 0x40 leader rights
  193. // siege flags: attacker - 0x180 sword over name, defender - 0x80 shield, 0xC0 crown (|leader), 0x1C0 flag (|leader)
  194. writeD(_relation);
  195. writeC(_activeChar.getMountType()); // mount type
  196. writeC(_activeChar.getStoreType().getId());
  197. writeC(_activeChar.hasDwarvenCraft() ? 1 : 0);
  198. writeD(_activeChar.getPkKills());
  199. writeD(_activeChar.getPvpKills());
  200.  
  201. writeH(_activeChar.getCubics().size());
  202. for (int id : _activeChar.getCubics().keySet())
  203. writeH(id);
  204.  
  205. writeC(_activeChar.isInPartyMatchRoom() ? 1 : 0);
  206.  
  207. if (_activeChar.getAppearance().getInvisible() && _activeChar.isGM())
  208. writeD(_activeChar.getAbnormalEffect() | AbnormalEffect.STEALTH.getMask());
  209. else
  210. writeD(_activeChar.getAbnormalEffect());
  211. writeC(0x00);
  212.  
  213. writeD(_activeChar.getClanPrivileges());
  214.  
  215. writeH(_activeChar.getRecomLeft()); // c2 recommendations remaining
  216. writeH(_activeChar.getRecomHave()); // c2 recommendations received
  217. writeD(_activeChar.getMountNpcId() > 0 ? _activeChar.getMountNpcId() + 1000000 : 0);
  218. writeH(_activeChar.getInventoryLimit());
  219.  
  220. writeD(_activeChar.getClassId().getId());
  221. writeD(0x00); // special effects? circles around player...
  222. writeD(_activeChar.getMaxCp());
  223. writeD((int) _activeChar.getCurrentCp());
  224. writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect());
  225.  
  226. if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected()))
  227. writeC(0x01); // team circle around feet 1= Blue, 2 = red
  228. else if (_activeChar.getTeam() == 2)
  229. writeC(0x02); // team circle around feet 1= Blue, 2 = red
  230. else
  231. writeC(0x00); // team circle around feet 1= Blue, 2 = red
  232.  
  233. writeD(_activeChar.getClanCrestLargeId());
  234. writeC(_activeChar.isNoble() ? 1 : 0); // 0x01: symbol on char menu ctrl+I
  235. writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ? 1 : 0); // 0x01: Hero Aura
  236.  
  237. writeC(_activeChar.isFishing() ? 1 : 0); // Fishing Mode
  238.  
  239. Location loc = _activeChar.getFishingLoc();
  240. if (loc != null)
  241. {
  242. writeD(loc.getX());
  243. writeD(loc.getY());
  244. writeD(loc.getZ());
  245. }
  246. else
  247. {
  248. writeD(0);
  249. writeD(0);
  250. writeD(0);
  251. }
  252.  
  253. writeD(_activeChar.getAppearance().getNameColor());
  254.  
  255. // new c5
  256. writeC(_activeChar.isRunning() ? 0x01 : 0x00); // changes the Speed display on Status Window
  257.  
  258. writeD(_activeChar.getPledgeClass()); // changes the text above CP on Status Window
  259. writeD(_activeChar.getPledgeType());
  260.  
  261. writeD(_activeChar.getAppearance().getTitleColor());
  262.  
  263. if (_activeChar.isCursedWeaponEquipped())
  264. writeD(CursedWeaponManager.getInstance().getCurrentStage(_activeChar.getCursedWeaponEquippedId()) - 1);
  265. else
  266. writeD(0x00);
  267. }
  268. }
Add Comment
Please, Sign In to add comment