Advertisement
VANPER

Siege Renewal

Feb 8th, 2020
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.96 KB | None | 0 0
  1. Index: java/net/sf/l2j/Config.java
  2. ===================================================================
  3. --- java/net/sf/l2j/Config.java (revision 84)
  4. +++ java/net/sf/l2j/Config.java (working copy)
  5.  
  6.  
  7. +   public static IntIntHolder[] REWARD_WINNER_SIEGE_CLAN;
  8. +   public static IntIntHolder[] LEADER_REWARD_WINNER_SIEGE_CLAN;
  9.    
  10.    
  11.    
  12. +   REWARD_WINNER_SIEGE_CLAN = sieges.parseIntIntList("MembersRewardsID", "57-100");
  13. +   LEADER_REWARD_WINNER_SIEGE_CLAN = sieges.parseIntIntList("LeaderRewardsID", "57-400");
  14.        
  15.        
  16.         ===================================================================
  17. --- java/net/sf/l2j/gameserver/configserver/model/entity/Siege.java (revision 0)
  18. +++ java/net/sf/l2j/gameserver/configserver/model/entity/Siege.java (working copy)
  19. @@ -0,0 +1,84 @@
  20.  
  21.  
  22.     @Override
  23.     public void endSiege()
  24.     {
  25.         if (!isInProgress())
  26.             return;
  27.        
  28.         World.toAllOnlinePlayers(SystemMessage.getSystemMessage(SystemMessageId.SIEGE_OF_S1_HAS_ENDED).addString(_castle.getName()));
  29.         World.toAllOnlinePlayers(new PlaySound("systemmsg_e.18"));
  30.        
  31. +       if (_castle.getOwnerId() > 0)
  32. +       {
  33. +           Clan clan = ClanTable.getInstance().getClan(_castle.getOwnerId());
  34. +           World.toAllOnlinePlayers(SystemMessage.getSystemMessage(SystemMessageId.CLAN_S1_VICTORIOUS_OVER_S2_S_SIEGE).addString(clan.getName()).addString(_castle.getName()));
  35. +           final List<String> playerIps = new ArrayList<>();
  36. +           for (Player player : World.getInstance().getPlayers())
  37. +           {
  38. +               final String pIp = player.getClient().getConnection().getInetAddress().getHostAddress();
  39. +              
  40. +               if (!playerIps.contains(pIp))
  41. +               {
  42. +                   playerIps.add(pIp);
  43. +                  
  44. +                   if (player.isClanLeader())
  45. +                   {
  46. +                       for (IntIntHolder reward : Config.LEADER_REWARD_WINNER_SIEGE_CLAN)
  47. +                       {
  48. +                           if (reward.getId() > 0)
  49. +                               player.addItem("", reward.getId(), reward.getValue(), player, true);  
  50. +                       }
  51. +                   }
  52. +                   else
  53. +                   {
  54. +                       for (IntIntHolder reward : Config.REWARD_WINNER_SIEGE_CLAN)
  55. +                       {
  56. +                           if (reward.getId() > 0)
  57. +                               player.addItem("", reward.getId(), reward.getValue(), player, true);    
  58. +                       }
  59. +                   }
  60. +               }
  61. +           }
  62.             // An initial clan was holding the castle and is different of current owner.
  63.             if (_formerOwner != null && clan != _formerOwner)
  64.             {
  65.                 // Delete circlets and crown's leader for initial castle's owner (if one was existing)
  66.                 _castle.checkItemsForClan(_formerOwner);
  67.                
  68.                 // Refresh hero diaries.
  69.                 for (ClanMember member : clan.getMembers())
  70.                 {
  71.                     final Player player = member.getPlayerInstance();
  72.                     if (player != null && player.isNoble())
  73.                         HeroManager.getInstance().setCastleTaken(player.getObjectId(), _castle.getCastleId());
  74.                 }
  75.             }
  76.         }
  77.         else
  78.             World.toAllOnlinePlayers(SystemMessage.getSystemMessage(SystemMessageId.SIEGE_S1_DRAW).addString(_castle.getName()));
  79.        
  80.         // Cleanup clans kills/deaths counters, cleanup flag.
  81.         for (Clan clan : _registeredClans.keySet())
  82.         {
  83.             clan.setSiegeKills(0);
  84.             clan.setSiegeDeaths(0);
  85.             clan.setFlag(null);
  86.         }
  87.        
  88.         // Refresh reputation points towards siege end.
  89.         updateClansReputation();
  90.        
  91.         // Teleport all non-owning castle players on second closest town.
  92.         _castle.getSiegeZone().banishForeigners(_castle.getOwnerId());
  93.        
  94.         // Clear all flags.
  95.         updatePlayerSiegeStateFlags(true);
  96.        
  97.         // Save castle specific data.
  98.         saveCastleSiege(true);
  99.        
  100.         // Clear registered clans.
  101.         clearAllClans();
  102.        
  103.         // Remove all towers from this castle.
  104.         removeTowers();
  105.        
  106.         // Despawn guards or mercenaries.
  107.         _castle.despawnSiegeGuardsOrMercenaries();
  108.        
  109.         // Respawn/repair castle doors.
  110.         _castle.spawnDoors(false);
  111.        
  112.         _castle.getSiegeZone().setActive(false);
  113.     }
  114. #=============================================================
  115. #                   Renewal Sieges
  116. #=============================================================
  117. # Reward Clan Winner, For Leaders clan/ members clan. Example : itemId-ItemCount;itemId-ItemCount;
  118. LeaderRewardsID = 0-0;
  119. MembersRewardsID = 0-0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement