Advertisement
warc222

Reward System For L2Jfrozen Last Rev By Dagger

Oct 10th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1.  
  2. ===================================================================
  3. com/l2jfrozen/Config.java
  4. ===================================================================
  5. + public static boolean ALLOW_AUTO_REWARDER;
  6. + public static int AUTO_REWARD_DELAY;
  7. + public static int AUTO_REWARD_ID;
  8. + public static int AUTO_REWARD_COUNT;
  9. + public static String NAME_ITEM_REWARD;
  10. +
  11. public static String ALLOWED_SKILLS;
  12. ;
  13.  
  14. + /** Automatic Restart **/
  15. + ALLOW_AUTO_REWARDER = Boolean.parseBoolean(L2JSanneSettings.getProperty("AllowAutoRewarder", "True"));
  16. + AUTO_REWARD_DELAY = Integer.parseInt(L2JSanneSettings.getProperty("AutoRewardDelay", "1200"));
  17. + AUTO_REWARD_ID = Integer.parseInt(L2JSanneSettings.getProperty("AutoRewardID", "57"));
  18. + AUTO_REWARD_COUNT = Integer.parseInt(L2JSanneSettings.getProperty("AutoRewardCount", "1000"));
  19. + NAME_ITEM_REWARD = L2JSanneSettings.getProperty("RewardItemName", "Event medal");
  20. +
  21. /** Server Name **/
  22.  
  23. gameserver/model/entity/AutoRewarder.java
  24. ===================================================================
  25. gameserver/model/entity/AutoRewarder.java (revision 0)
  26. gameserver/model/entity/AutoRewarder.java (working copy)
  27. /*
  28. * This program is free software: you can redistribute it and/or modify it under
  29. * the terms of the GNU General Public License as published by the Free Software
  30. * Foundation, either version 3 of the License, or (at your option) any later
  31. * version.
  32. *
  33. * This program is distributed in the hope that it will be useful, but WITHOUT
  34. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  35. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  36. * details.
  37. *
  38. * You should have received a copy of the GNU General Public License along with
  39. * this program. If not, see .
  40. */
  41. package com.l2jfrozen.gameserver.model.entity;
  42.  
  43. import java.util.Collection;
  44.  
  45. import com.l2jfrozen.Config;
  46. import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  47. import com.l2jfrozen.gameserver.model.L2World;
  48. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  49.  
  50. /**
  51. * @author Dagger
  52. *
  53. */
  54. public class AutoRewarder
  55. {
  56. public static void getInstance()
  57. {
  58. ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  59. {
  60. @Override
  61. public void run()
  62. {
  63. AutoReward();
  64. }
  65.  
  66. }, 0,Config.AUTO_REWARD_DELAY * 1000);
  67. }
  68. public static void AutoReward()
  69. {
  70. Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
  71. for (L2PcInstance p : pls)
  72. {
  73. p.sendMessage("AutoReward: Usted ha recibido " + Config.AUTO_REWARD_COUNT +" "+ Config.NAME_ITEM_REWARD + " Por Estar online 1 Hora");
  74. p.getInventory().addItem("", Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, p, null);
  75. }
  76. }
  77. }
  78. \ No newline at end of file
  79. ===================================================================
  80. gameserver/GameServer.java
  81. ===================================================================
  82.  
  83. import com.l2jfrozen.gameserver.model.entity.Announcements;
  84. +import com.l2jfrozen.gameserver.model.entity.AutoRewarder;
  85. import com.l2jfrozen.gameserver.model.entity.Hero;
  86.  
  87. Util.printSection("Custom Mods");
  88.  
  89. - if (Config.L2JMOD_ALLOW_WEDDING || Config.ALLOW_AWAY_STATUS || Config.PCB_ENABLE || Config.POWERPAK_ENABLED)
  90. + if (Config.L2JMOD_ALLOW_WEDDING || Config.ALLOW_AWAY_STATUS || Config.PCB_ENABLE || Config.POWERPAK_ENABLED || Config.ALLOW_AUTO_REWARDER)
  91. {
  92. if (Config.L2JMOD_ALLOW_WEDDING)
  93. CoupleManager.getInstance();
  94.  
  95. if (Config.POWERPAK_ENABLED)
  96. PowerPak.getInstance();
  97. +
  98. + if (Config.ALLOW_AUTO_REWARDER)
  99. + AutoRewarder.getInstance();
  100. }
  101. else
  102. LOGGER.info("All custom mods are Disabled.");
  103.  
  104. config/functions/L2Jfrozen.properties
  105. ===================================================================
  106. +# Auto rewarder.
  107. +AllowAutoRewarder = True
  108. +# Delay for reward. (in seconds)
  109. +AutoRewardDelay = 1200
  110. +# ID of item reward.
  111. +AutoRewardID = 6392
  112. +# Count of item reward.
  113. +AutoRewardCount = 1000
  114. +# Item Name SendMensagem the payer will win ex Medal Event.
  115. +RewardItemNameItemName = Event Medal
  116. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement