xRelic

Show Clan npc crest

Jul 6th, 2021 (edited)
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | None | 0 0
  1. Index: head-src/com/l2jfrozen/Config.java
  2. ===================================================================
  3. --- head-src/com/l2jfrozen/Config.java (wersja 669)
  4. +++ head-src/com/l2jfrozen/Config.java (kopia robocza)
  5. @@ -2239,6 +2239,7 @@
  6. public static String FARM2_CUSTOM_MESSAGE;
  7. public static String PVP1_CUSTOM_MESSAGE;
  8. public static String PVP2_CUSTOM_MESSAGE;
  9. + public static boolean SHOW_NPC_CREST;
  10.  
  11. //============================================================
  12. public static void loadL2SCORIAConfig()
  13. @@ -2357,6 +2358,7 @@
  14. FARM2_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
  15. PVP1_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
  16. PVP2_CUSTOM_MESSAGE = L2ScoriaSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
  17. + SHOW_NPC_CREST = Boolean.parseBoolean(L2ScoriaSettings.getProperty("ShowNpcCrest", "False"));
  18. }
  19. catch(Exception e)
  20. {
  21. Index: config/functions/l2jfrozen.properties
  22. ===================================================================
  23. --- config/functions/l2jfrozen.properties (wersja 669)
  24. +++ config/functions/l2jfrozen.properties (kopia robocza)
  25. @@ -275,4 +275,8 @@
  26. ProtectorSkillLevel = 13
  27. ProtectorSkillTime = 600
  28. # Npc Protector Message
  29. -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  30. \ No newline at end of file
  31. +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
  32. +
  33. +# Show clan, alliance crests for territory NPC's.
  34. +# Default: False
  35. +ShowNpcCrest = False
  36. \ No newline at end of file
  37. Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/NpcInfo.java
  38. ===================================================================
  39. --- head-src/com/l2jfrozen/gameserver/network/serverpackets/NpcInfo.java (wersja 669)
  40. +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/NpcInfo.java (kopia robocza)
  41. @@ -19,11 +19,15 @@
  42. package com.l2jfrozen.gameserver.network.serverpackets;
  43.  
  44. import com.l2jfrozen.Config;
  45. +import com.l2jfrozen.gameserver.datatables.sql.ClanTable;
  46. +import com.l2jfrozen.gameserver.managers.TownManager;
  47. import com.l2jfrozen.gameserver.model.L2Character;
  48. +import com.l2jfrozen.gameserver.model.L2Clan;
  49. import com.l2jfrozen.gameserver.model.L2Summon;
  50. import com.l2jfrozen.gameserver.model.actor.instance.L2MonsterInstance;
  51. import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
  52. import com.l2jfrozen.gameserver.model.actor.instance.L2PetInstance;
  53. +import com.l2jfrozen.gameserver.model.zone.type.L2TownZone;
  54.  
  55. /**
  56. * This class ...
  57. @@ -46,6 +50,10 @@
  58. private int _collisionHeight, _collisionRadius;
  59. private String _name = "";
  60. private String _title = "";
  61. + int _clanCrest = 0;
  62. + int _allyCrest = 0;
  63. + int _allyId = 0;
  64. + int _clanId = 0;
  65.  
  66. /**
  67. * @param _characters
  68. @@ -99,6 +107,32 @@
  69. _title = t;
  70. }
  71.  
  72. + if(Config.SHOW_NPC_CREST)
  73. + {
  74. + if(cha instanceof L2NpcInstance && cha.isInsideZone(L2Character.ZONE_PEACE) && cha.getCastle().getOwnerId() != 0)
  75. + {
  76. + int _x,_y,_z;
  77. + _x = cha.getX();
  78. + _y = cha.getY();
  79. + _z = cha.getZ();
  80. + L2TownZone Town;
  81. + Town = TownManager.getInstance().getTown(_x, _y, _z);
  82. + if(Town != null)
  83. + {
  84. + int townId = Town.getTownId();
  85. + if(townId != 33 && townId != 22)
  86. + {
  87. + L2Clan clan;
  88. + clan = ClanTable.getInstance().getClan(cha.getCastle().getOwnerId());
  89. + _clanCrest = clan.getCrestId();
  90. + _clanId = clan.getClanId();
  91. + _allyCrest = clan.getAllyCrestId();
  92. + _allyId = clan.getAllyId();
  93. + }
  94. + }
  95. + }
  96. + }
  97. +
  98. _x = _activeChar.getX();
  99. _y = _activeChar.getY();
  100. _z = _activeChar.getZ();
  101. @@ -187,12 +221,23 @@
  102. writeD(0000); // hmm karma ??
  103.  
  104. writeD(_activeChar.getAbnormalEffect()); // C2
  105. - writeD(0000); // C2
  106. - writeD(0000); // C2
  107. - writeD(0000); // C2
  108. - writeD(0000); // C2
  109. - writeC(0000); // C2
  110.  
  111. + if(Config.SHOW_NPC_CREST)
  112. + {
  113. + writeD(_clanId);
  114. + writeD(_clanCrest);
  115. + writeD(_allyId);
  116. + writeD(_allyCrest);
  117. + }
  118. + else
  119. + {
  120. + writeD(0000);
  121. + writeD(0000);
  122. + writeD(0000);
  123. + writeD(0000);
  124. + writeC(0000);
  125. + }
  126. +
  127. writeC(0x00); // C3 team circle 1-blue, 2-red
  128. writeF(_collisionRadius);
  129. writeF(_collisionHeight);
  130. Index: head-src/com/l2jfrozen/gameserver/model/entity/siege/Castle.java
  131. ===================================================================
  132. --- head-src/com/l2jfrozen/gameserver/model/entity/siege/Castle.java (wersja 669)
  133. +++ head-src/com/l2jfrozen/gameserver/model/entity/siege/Castle.java (kopia robocza)
  134. @@ -90,6 +90,7 @@
  135. private int _taxPercent = 0;
  136. private double _taxRate = 0;
  137. private int _treasury = 0;
  138. + private boolean _showNpcCrest = false;
  139. private L2CastleZone _zone;
  140. private L2CastleTeleportZone _teleZone;
  141. private L2Clan _formerOwner = null;
  142. @@ -364,6 +365,7 @@
  143. }
  144.  
  145. updateOwnerInDB(clan); // Update in database
  146. + setShowNpcCrest(false);
  147.  
  148. if(getSiege().getIsInProgress())
  149. {
  150. @@ -552,6 +554,7 @@
  151.  
  152. _taxPercent = rs.getInt("taxPercent");
  153. _treasury = rs.getInt("treasury");
  154. + _showNpcCrest = rs.getBoolean("showNpcCrest");
  155. }
  156.  
  157. rs.close();
  158. @@ -854,6 +857,20 @@
  159. return _treasury;
  160. }
  161.  
  162. + public final boolean getShowNpcCrest()
  163. + {
  164. + return _showNpcCrest;
  165. + }
  166. +
  167. + public final void setShowNpcCrest(boolean showNpcCrest)
  168. + {
  169. + if(_showNpcCrest != showNpcCrest)
  170. + {
  171. + _showNpcCrest = showNpcCrest;
  172. + updateShowNpcCrest();
  173. + }
  174. + }
  175. +
  176. public FastList<SeedProduction> getSeedProduction(int period)
  177. {
  178. return period == CastleManorManager.PERIOD_CURRENT ? _production : _productionNext;
  179. @@ -1324,6 +1341,36 @@
  180. }
  181. }
  182.  
  183. + public void updateShowNpcCrest()
  184. + {
  185. + Connection con = null;
  186. + PreparedStatement statement;
  187. + try
  188. + {
  189. + con = L2DatabaseFactory.getInstance().getConnection();
  190. +
  191. + statement = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?");
  192. + statement.setString(1, String.valueOf(getShowNpcCrest()));
  193. + statement.setInt(2, getCastleId());
  194. + statement.execute();
  195. + statement.close();
  196. + }
  197. + catch (Exception e)
  198. + {
  199. + _log.info("Error saving showNpcCrest for castle " + getName() + ": " + e.getMessage());
  200. + }
  201. + finally
  202. + {
  203. + try
  204. + {
  205. + con.close();
  206. + }
  207. + catch (Exception e)
  208. + {
  209. + }
  210. + }
  211. + }
  212. +
  213. public boolean isNextPeriodApproved()
  214. {
  215. return _isNextPeriodApproved;
  216.  
  217.  
  218.  
  219. ALTER TABLE castle ADD showNpcCrest enum('true','false') DEFAULT 'false' NOT NULL;
Advertisement
Add Comment
Please, Sign In to add comment