Axelut

CharInfo

Aug 13th, 2023
39
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.NpcTable;
  5. import net.sf.l2j.gameserver.data.manager.CursedWeaponManager;
  6. import net.sf.l2j.gameserver.model.actor.instance.Player;
  7. import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
  8. import net.sf.l2j.gameserver.model.location.Location;
  9. import net.sf.l2j.gameserver.skills.AbnormalEffect;
  10.  
  11. public class CharInfo extends L2GameServerPacket
  12. {
  13. private final Player _activeChar;
  14. private final Inventory _inv;
  15.  
  16. public CharInfo(Player cha)
  17. {
  18. _activeChar = cha;
  19. _inv = _activeChar.getInventory();
  20. }
  21.  
  22. @Override
  23. protected final void writeImpl()
  24. {
  25. boolean gmSeeInvis = false;
  26.  
  27. if (_activeChar.getAppearance().getInvisible())
  28. {
  29. Player tmp = getClient().getActiveChar();
  30. if (tmp != null && tmp.isGM())
  31. gmSeeInvis = true;
  32. }
  33.  
  34. writeC(0x03);
  35. writeD(_activeChar.getX());
  36. writeD(_activeChar.getY());
  37. writeD(_activeChar.getZ());
  38. writeD(_activeChar.getHeading());
  39. writeD(_activeChar.getObjectId());
  40. writeS(_activeChar.getName());
  41. writeD(_activeChar.getRace().ordinal());
  42. writeD(_activeChar.getAppearance().getSex().ordinal());
  43.  
  44. if (_activeChar.getClassIndex() == 0)
  45. writeD(_activeChar.getClassId().getId());
  46. else
  47. writeD(_activeChar.getBaseClass());
  48.  
  49. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIRALL));
  50. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
  51. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  52. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
  53. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
  54. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
  55. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
  56. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
  57. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
  58. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
  59. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
  60. writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
  61.  
  62. // c6 new h's
  63. writeH(0x00);
  64. writeH(0x00);
  65. writeH(0x00);
  66. writeH(0x00);
  67. writeD(_inv.getPaperdollAugmentationId(Inventory.PAPERDOLL_RHAND));
  68. writeH(0x00);
  69. writeH(0x00);
  70. writeH(0x00);
  71. writeH(0x00);
  72. writeH(0x00);
  73. writeH(0x00);
  74. writeH(0x00);
  75. writeH(0x00);
  76. writeH(0x00);
  77. writeH(0x00);
  78. writeH(0x00);
  79. writeH(0x00);
  80. writeD(_inv.getPaperdollAugmentationId(Inventory.PAPERDOLL_LHAND));
  81. writeH(0x00);
  82. writeH(0x00);
  83. writeH(0x00);
  84. writeH(0x00);
  85.  
  86. writeD(_activeChar.getPvpFlag());
  87. writeD(_activeChar.getKarma());
  88.  
  89. writeD(_activeChar.getMAtkSpd());
  90. writeD(_activeChar.getPAtkSpd());
  91.  
  92. writeD(_activeChar.getPvpFlag());
  93. writeD(_activeChar.getKarma());
  94.  
  95. int _runSpd = _activeChar.getStat().getBaseRunSpeed();
  96. int _walkSpd = _activeChar.getStat().getBaseWalkSpeed();
  97. int _swimSpd = _activeChar.getStat().getBaseSwimSpeed();
  98. writeD(_runSpd); // base run speed
  99. writeD(_walkSpd); // base walk speed
  100. writeD(_swimSpd); // swim run speed
  101. writeD(_swimSpd); // swim walk speed
  102. writeD(_runSpd);
  103. writeD(_walkSpd);
  104. writeD(_activeChar.isFlying() ? _runSpd : 0); // fly run speed
  105. writeD(_activeChar.isFlying() ? _walkSpd : 0); // fly walk speed
  106. writeF(_activeChar.getStat().getMovementSpeedMultiplier()); // run speed multiplier
  107. writeF(_activeChar.getStat().getAttackSpeedMultiplier()); // attack speed multiplier
  108.  
  109. if (_activeChar.getMountType() != 0)
  110. {
  111. writeF(NpcTable.getInstance().getTemplate(_activeChar.getMountNpcId()).getCollisionRadius());
  112. writeF(NpcTable.getInstance().getTemplate(_activeChar.getMountNpcId()).getCollisionHeight());
  113. }
  114. else
  115. {
  116. writeF(_activeChar.getCollisionRadius());
  117. writeF(_activeChar.getCollisionHeight());
  118. }
  119.  
  120. writeD(_activeChar.getAppearance().getHairStyle());
  121. writeD(_activeChar.getAppearance().getHairColor());
  122. writeD(_activeChar.getAppearance().getFace());
  123.  
  124. if (gmSeeInvis)
  125. writeS("Invisible");
  126. else
  127. writeS(_activeChar.getTitle());
  128.  
  129. writeD(_activeChar.getClanId());
  130. writeD(_activeChar.getClanCrestId());
  131. writeD(_activeChar.getAllyId());
  132. writeD(_activeChar.getAllyCrestId());
  133.  
  134. writeD(0);
  135.  
  136. writeC(_activeChar.isSitting() ? 0 : 1); // standing = 1 sitting = 0
  137. writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0
  138. writeC(_activeChar.isInCombat() ? 1 : 0);
  139. writeC(_activeChar.isAlikeDead() ? 1 : 0);
  140.  
  141. if (gmSeeInvis)
  142. writeC(0);
  143. else
  144. writeC(_activeChar.getAppearance().getInvisible() ? 1 : 0); // invisible = 1 visible =0
  145.  
  146. writeC(_activeChar.getMountType()); // 1 on strider 2 on wyvern 0 no mount
  147. writeC(_activeChar.getStoreType().getId()); // 1 - sellshop
  148.  
  149. writeH(_activeChar.getCubics().size());
  150. for (int id : _activeChar.getCubics().keySet())
  151. writeH(id);
  152.  
  153. writeC(_activeChar.isInPartyMatchRoom() ? 1 : 0);
  154.  
  155. if (gmSeeInvis)
  156. writeD((_activeChar.getAbnormalEffect() | AbnormalEffect.STEALTH.getMask()));
  157. else
  158. writeD(_activeChar.getAbnormalEffect());
  159.  
  160. writeC(_activeChar.getRecomLeft());
  161. writeH(_activeChar.getRecomHave()); // Blue value for name (0 = white, 255 = pure blue)
  162. writeD(_activeChar.getClassId().getId());
  163.  
  164. writeD(_activeChar.getMaxCp());
  165. writeD((int) _activeChar.getCurrentCp());
  166. writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect());
  167.  
  168. if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected()))
  169. writeC(0x01); // team circle around feet 1= Blue, 2 = red
  170. else if (_activeChar.getTeam() == 2)
  171. writeC(0x02); // team circle around feet 1= Blue, 2 = red
  172. else
  173. writeC(0x00); // team circle around feet 1= Blue, 2 = red
  174.  
  175. writeD(_activeChar.getClanCrestLargeId());
  176. writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
  177. writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); // Hero Aura
  178.  
  179. writeC(_activeChar.isFishing() ? 1 : 0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
  180.  
  181. Location loc = _activeChar.getFishingLoc();
  182. if (loc != null)
  183. {
  184. writeD(loc.getX());
  185. writeD(loc.getY());
  186. writeD(loc.getZ());
  187. }
  188. else
  189. {
  190. writeD(0);
  191. writeD(0);
  192. writeD(0);
  193. }
  194.  
  195. writeD(_activeChar.getAppearance().getNameColor());
  196.  
  197. writeD(0x00); // isRunning() as in UserInfo?
  198.  
  199. writeD(_activeChar.getPledgeClass());
  200. writeD(_activeChar.getPledgeType());
  201.  
  202. writeD(_activeChar.getAppearance().getTitleColor());
  203.  
  204. if (_activeChar.isCursedWeaponEquipped())
  205. writeD(CursedWeaponManager.getInstance().getCurrentStage(_activeChar.getCursedWeaponEquippedId()) - 1);
  206. else
  207. writeD(0x00);
  208. }
  209. }
Add Comment
Please, Sign In to add comment