Bluur

Reward Winner clan of siege

Jan 31st, 2015
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.89 KB | None | 0 0
  1. #P aCis_gameserver
  2. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  3. ===================================================================
  4. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 1)
  5. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  6. @@ -703,6 +703,8 @@
  7.      // open/close gates
  8.      private final GatesRequest _gatesRequest = new GatesRequest();
  9.      
  10. +    private int _countKillsInSiege;
  11. +    
  12.      /** Task for Herbs */
  13.      private class HerbTask implements Runnable
  14.      {
  15. @@ -828,6 +830,16 @@
  16.          _gatesRequest.setTarget(null);
  17.      }
  18.      
  19. +    
  20. +    public void setCountKillsInSiege(int value)
  21. +    {
  22. +        _countKillsInSiege = value;
  23. +    }
  24. +    public int getCountKillsInSiege()    
  25. +    {
  26. +        return _countKillsInSiege;
  27. +    }
  28. +    
  29.      /**
  30.       * Create a new L2PcInstance and add it in the characters table of the database.<BR>
  31.       * <BR>
  32. @@ -4357,8 +4369,10 @@
  33.                  // Now check clan relations.
  34.                  final L2Clan killerClan = getClan();
  35.                  if (killerClan != null)
  36. +                {
  37.                      killerClan.setSiegeKills(killerClan.getSiegeKills() + 1);            
  38. +                    setCountKillsInSiege(getCountKillsInSiege() + 1);
  39. +                }
  40.                  final L2Clan targetClan = targetPlayer.getClan();
  41.  
  42. Index: java/net/sf/l2j/gameserver/model/entity/Siege.java
  43. ===================================================================
  44. --- java/net/sf/l2j/gameserver/model/entity/Siege.java    (revision 1)
  45. +++ java/net/sf/l2j/gameserver/model/entity/Siege.java    (working copy)
  46. @@ -48,6 +48,7 @@
  47.  import net.sf.l2j.gameserver.model.actor.instance.L2FlameTowerInstance;
  48.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  49.  import net.sf.l2j.gameserver.network.SystemMessageId;
  50. +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
  51.  import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
  52.  import net.sf.l2j.gameserver.network.serverpackets.SiegeInfo;
  53.  import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  54. @@ -171,7 +172,11 @@
  55.                  _siegeGuardManager.removeMercs(); // Remove mercenaries
  56.                  
  57.              getCastle().spawnDoors(false); // Respawn door to castle
  58. -            
  59. +            // reward clan winner Siege by Bluur
  60. +            if (Config.ENABLE_WINNNER_REWARD_SIEGE_CLAN)            
  61. +                rewardClanWinner(ClanTable.getInstance().getClan(getCastle().getOwnerId()));
  62. +
  63.              getCastle().getZone().setIsActive(false);
  64.              getCastle().getZone().updateZoneStatusForCharactersInside();
  65.          }
  66.        
  67. @@ -140,6 +141,7 @@
  68.                  {
  69.                      clan.setSiegeKills(0);
  70.                      clan.setSiegeDeaths(0);
  71. +                    cleanKillsInSiege(clan); // cleaning kills by Bluur
  72.                  }
  73.              }
  74.              
  75. @@ -150,6 +152,7 @@
  76.                  {
  77.                      clan.setSiegeKills(0);
  78.                      clan.setSiegeDeaths(0);
  79. +                    cleanKillsInSiege(clan); // cleaning kills by Bluur
  80.                  }
  81.              }
  82.            
  83. @@ -1473,4 +1478,21 @@
  84.              }
  85.          }
  86.      }
  87. +    //by Bluur
  88. +    public void rewardClanWinner(L2Clan clanWinner)
  89. +    {
  90. +        for (L2PcInstance player : clanWinner.getOnlineMembers())
  91. +        {
  92. +            if (player.getCountKillsInSiege() >= Config.PLAYER_COUNT_KILLS_INSIEGE)
  93. +            {
  94. +                for (int[] item : Config.REWARD_WINNER_SIEGE_CLAN)                                    
  95. +                    player.addItem("", item[0], item[1], player, true);                    
  96. +                
  97. +                player.sendPacket(new ExShowScreenMessage("Congratulations! You have been rewarded for the " +getCastle().getName()+ " siege victory!" , 8000));        
  98. +            }                    
  99. +        }
  100. +    }
  101. +    //by Bluur
  102. +    public void cleanKillsInSiege(L2Clan clan)
  103. +    {
  104. +        for (L2PcInstance member : clan.getOnlineMembers())
  105. +            member.setCountKillsInSiege(0);                
  106. +    }
  107. +
  108.  }
  109. \ No newline at end of file
  110. Index: java/net/sf/l2j/Config.java
  111. ===================================================================
  112. --- java/net/sf/l2j/Config.java    (revision 1)
  113. +++ java/net/sf/l2j/Config.java    (working copy)
  114. @@ -70,6 +70,8 @@
  115.      public static int ALT_CLAN_WAR_PENALTY_WHEN_ENDED;
  116.      public static boolean ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH;
  117.      public static boolean REMOVE_CASTLE_CIRCLETS;
  118. +    public static boolean ENABLE_WINNNER_REWARD_SIEGE_CLAN;
  119. +    public static int[][] REWARD_WINNER_SIEGE_CLAN;
  120. +   public static int PLAYER_COUNT_KILLS_INSIEGE;
  121.      
  122.      /** Manor */
  123.      public static int ALT_MANOR_REFRESH_TIME;
  124. @@ -726,7 +728,9 @@
  125.              ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED = clans.getProperty("DaysBeforeCreateNewAllyWhenDissolved", 10);
  126.              ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH = clans.getProperty("AltMembersCanWithdrawFromClanWH", false);
  127.              REMOVE_CASTLE_CIRCLETS = clans.getProperty("RemoveCastleCirclets", true);
  128. -            
  129. +            ENABLE_WINNNER_REWARD_SIEGE_CLAN = clans.getProperty("EnableRewardWinnerClan", false);
  130. +            REWARD_WINNER_SIEGE_CLAN = parseItemsList(clans.getProperty("RewardsID", "57,100"));
  131. +           PLAYER_COUNT_KILLS_INSIEGE = mods.getProperty("KillsToReceiveReward", 0);
  132. +            
  133.              ALT_MANOR_REFRESH_TIME = clans.getProperty("AltManorRefreshTime", 20);
  134.              ALT_MANOR_REFRESH_MIN = clans.getProperty("AltManorRefreshMin", 0);
  135.              ALT_MANOR_APPROVE_TIME = clans.getProperty("AltManorApproveTime", 6);
  136. Index: config/clans.properties
  137. ===================================================================
  138. --- config/clans.properties    (revision 1)
  139. +++ config/clans.properties    (working copy)
  140. @@ -37,6 +37,11 @@
  141.  #Remove Castle circlets after a clan lose its castle or a player leaves a clan? - default true
  142.  RemoveCastleCirclets = True
  143.  
  144. +#=============================================================
  145. +#                        Reward Clan
  146. +#=============================================================
  147. +# Enable reward winners clans
  148. +EnableRewardWinnerClan = True
  149. +# syntax config: itemId,quantity; -> 57,100;999,1;
  150. +RewardsID = 57,100000000;
  151. +# amount of kills to receive the award
  152. +# Disable: 0
  153. +KillsToReceiveReward = 5
  154.  
  155. \ No newline at end of file
  156. Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
  157. ===================================================================
  158. --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (revision 0)
  159. +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (working copy)
  160.  
  161.         registerHandler(new Online());
  162. +        registerHandler(new ShowKillsInSiege());
  163.  
  164. \ No newline at end of file
  165. Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/ShowKillsInSiege.java
  166. ===================================================================
  167. --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/ShowKillsInSiege.java    (revision 0)
  168. +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/ShowKillsInSiege.java    (working copy)
  169. @@ -0,0 +1,48 @@
  170. +/*
  171. + * This program is free software: you can redistribute it and/or modify it under
  172. + * the terms of the GNU General Public License as published by the Free Software
  173. + * Foundation, either version 3 of the License, or (at your option) any later
  174. + * version.
  175. + *
  176. + * This program is distributed in the hope that it will be useful, but WITHOUT
  177. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  178. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  179. + * details.
  180. + *
  181. + * You should have received a copy of the GNU General Public License along with
  182. + * this program. If not, see <http://www.gnu.org/licenses/>.
  183. + */
  184. +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  185. +
  186. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  187. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  188. +
  189. +/**
  190. + * @author Bluur
  191. + *
  192. + */
  193. +public class ShowKillsInSiege implements IVoicedCommandHandler
  194. +{
  195. +    private final String[] comandos = {"siegekills"};
  196. +
  197. +    @Override
  198. +    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
  199. +    {
  200. +        if (command.equals("siegekills"))
  201. +        {
  202. +            if (!activeChar.isInSiege())
  203. +            {
  204. +                activeChar.sendMessage("[Siege Kills]: you're not in siege.");
  205. +                return false;
  206. +            }
  207. +            activeChar.sendMessage("[Siege Kills]: you have " + activeChar.getCountKillsInSiege()+ " kills in siege.");
  208. +        }
  209. +        return true;
  210. +    }
  211. +
  212. +    @Override
  213. +    public String[] getVoicedCommandList()
  214. +    {        
  215. +        return comandos;
  216. +    }
  217. +}
Advertisement
Add Comment
Please, Sign In to add comment