Advertisement
warc222

CrazyRates

Sep 24th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.55 KB | None | 0 0
  1. Index: head-src/com/l2jfrozen/gameserver/model/entity/event/CrazyRates
  2. ===================================================================
  3. --- head-src/com/l2jfrozen/gameserver/model/entity/event/CrazyRates.java
  4. +++ head-src/com/l2jfrozen/gameserver/model/entity/event/CrazyRates.java
  5. +/**
  6. + * @author Axcel Baseado no de Allan
  7. + *
  8. + */
  9. +package com.l2jfrozen.gameserver.model.entity.event;
  10. +
  11. +import com.l2jfrozen.Config;
  12. +import com.l2jfrozen.gameserver.model.entity.Announcements;
  13. +
  14. +public class CrazyRates
  15. +{
  16. +
  17. + {
  18. +
  19. + }
  20. +
  21. + public static void DoubleRates()
  22. + {
  23. + {
  24. +
  25. + Config.RATE_XP = Config.RateMultipler * Config.RATE_XP;
  26. + Config.RATE_SP = Config.RateMultipler * Config.RATE_SP;
  27. + Config.RATE_DROP_ITEMS = Config.RateMultipler * Config.RATE_DROP_ITEMS;
  28. + Config.ITEMS_RAID = Config.RateMultipler * Config.ITEMS_RAID;
  29. + Config.RATE_DROP_ADENA = Config.RateMultipler * Config.RATE_DROP_ADENA;
  30. + Announcements.getInstance().gameAnnounceToAll("El evento Crazy rates tienes " + Config.time_crazyrate + " minutos para farmear! Los rates aumentaron a: " + Config.RateMultipler) !!!;
  31. + }
  32. + }
  33. +
  34. + public static void DivideRates()
  35. + {
  36. + Config.RATE_XP = Config.RATE_XP / Config.RateMultipler;
  37. + Config.RATE_SP = Config.RATE_SP / Config.RateMultipler;
  38. + Config.RATE_DROP_ITEMS = Config.RATE_DROP_ITEMS / Config.RateMultipler;
  39. + Config.ITEMS_RAID = Config.ITEMS_RAID / Config.RateMultipler;
  40. + Config.RATE_DROP_ADENA = Config.RATE_DROP_ADENA / Config.RateMultipler;
  41. + Announcements.getInstance().gameAnnounceToAll("El evento termino! Gracias por participar !!");
  42. + }
  43. +
  44. + public static void EventManager()
  45. + {
  46. + DoubleRates();
  47. + try
  48. + {
  49. + Thread.sleep(Config.time_crazyrate * 1000 * 60); // Tempo em Minutos
  50. + }
  51. + catch (Exception e)
  52. + {
  53. + e.printStackTrace();
  54. + }
  55. + DivideRates();
  56. +
  57. + }
  58. +
  59. +}
  60.  
  61. Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCrazy.java
  62. ===================================================================
  63. --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCrazy.java (revision 0)
  64. +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCrazy.java
  65. +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
  66. +
  67. +import java.util.StringTokenizer;
  68. +import java.util.logging.Logger;
  69. +
  70. +import com.l2jfrozen.Config;
  71. +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  72. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  73. +import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  74. +
  75.  
  76. +public class AdminCrazy implements IAdminCommandHandler
  77. +{
  78. + private final static Logger _log = Logger.getLogger(AdminCrazy.class.getName());
  79. +
  80. + private static String[] _adminCommands =
  81. + {
  82. + "admin_crazy_event"
  83. + };
  84. +
  85. + private enum CommandEnum
  86. + {
  87. + admin_crazy_event
  88. + }
  89. +
  90. + public void run()
  91. + {
  92. + com.l2jfrozen.gameserver.model.entity.event.CrazyRates.EventManager();
  93. + }
  94. +
  95. + @Override
  96. + public boolean useAdminCommand(String command, L2PcInstance activeChar)
  97. + {
  98. + /*
  99. + if(!AdminCommandAccessRights.getInstance().hasAccess(command, activeChar.getAccessLevel())){
  100. + return false;
  101. + }
  102. +
  103. + if(Config.GMAUDIT)
  104. + {
  105. + Logger _logAudit = Logger.getLogger("gmaudit");
  106. + LogRecord record = new LogRecord(Level.INFO, command);
  107. + record.setParameters(new Object[]
  108. + {
  109. + "GM: " + activeChar.getName(), " to target [" + activeChar.getTarget() + "] "
  110. + });
  111. + _logAudit.log(record);
  112. + }
  113. + */
  114. +
  115. + StringTokenizer st = new StringTokenizer(command);
  116. +
  117. + CommandEnum comm = CommandEnum.valueOf(st.nextToken());
  118. +
  119. + if(comm == null)
  120. + return false;
  121. + long flush2 = 0,timeL = 0;
  122. +
  123. + switch(comm){
  124. + case admin_crazy_event:{
  125. +
  126. + boolean no_token = false;
  127. +
  128. + if(st.hasMoreTokens()){
  129. + String doublerate = st.nextToken();
  130. + int rate = Integer.parseInt(doublerate);
  131. + Config.RateMultipler = rate;
  132. + if(1 == 1){
  133. +
  134. + if (st.hasMoreTokens()) //time
  135. + {
  136. + String time = st.nextToken();
  137. +
  138. + try{
  139. + int value = Integer.parseInt(time);
  140. + Config.time_crazyrate = value;
  141. +
  142. + ThreadPoolManager.getInstance().scheduleGeneral(new StartEvent(), flush2);
  143. +
  144. +
  145. + if(value>0){
  146. +
  147. +
  148. + }else{
  149. +
  150. + activeChar.sendMessage("Time must be bigger then 0!");
  151. + return false;
  152. + }
  153. +
  154. + }catch(NumberFormatException e){
  155. + activeChar.sendMessage("Time must be a number!");
  156. + return false;
  157. + }
  158. +
  159. + }else{
  160. + no_token = true;
  161. + }
  162. +
  163. + }
  164. +
  165. + }else{
  166. +
  167. + no_token=true;
  168. +
  169. + }
  170. +
  171. + if(no_token){
  172. + activeChar.sendMessage("Usage: //crazy_event <rate Multiplique> [time](In Minutes)");
  173. + return false;
  174. + }
  175. +
  176. + }
  177. + }
  178. +
  179. + return true;
  180. +
  181. + }
  182. +
  183. + @Override
  184. + public String[] getAdminCommandList()
  185. + {
  186. + return _adminCommands;
  187. + }
  188. +}
  189.  
  190. Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/StartEvent.java
  191. ===================================================================
  192. --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/StartEvent.java (revision 0) */ATENCION! Tiene que crear este archivo!
  193. +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/StartEvent.java
  194. +package com.l2jfrozen.gameserver.handler.admincommandhandlers;
  195. +
  196. +/**
  197. + * @author UnrealShare
  198. + *
  199. + */
  200. +public class StartEvent implements Runnable
  201. +{
  202. +
  203. + @Override
  204. + public void run()
  205. + {
  206. + com.l2jfrozen.gameserver.model.entity.event.CrazyRates.EventManager();
  207. +
  208. + }
  209. +
  210. +}
  211.  
  212. Index: head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
  213. ===================================================================
  214. --- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java
  215. +++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java .
  216.  
  217. import com.l2jfrozen.gameserver.model.entity.event.CrazyRates;
  218.  
  219. registerAdminCommandHandler(new AdminAio());
  220. registerAdminCommandHandler(new AdminCharSupervision());
  221. + registerAdminCommandHandler(new AdminCrazy());
  222. //ATTENTION: adding new command handlers, you have to change the
  223.  
  224.  
  225. Index: head-src/com/l2jfrozen/Config.java
  226. ===================================================================
  227. --- head-src/com/l2jfrozen/Config.java
  228. +++ hhead-src/com/l2jfrozen/Config.java
  229. public static int MASTERACCESS_NAME_COLOR;
  230. public static int MASTERACCESS_TITLE_COLOR;
  231. + public static float RateMultipler;
  232. + public static int time_crazyrate;
  233.  
  234. @new line@
  235. PM_TEXT1 = frozenSettings.getProperty("PMText1", "Have Fun and Nice Stay on");
  236. PM_TEXT2 = frozenSettings.getProperty("PMText2", "Vote for us every 24h");
  237. +
  238. + RateMultipler = Float.parseFloat(frozenSettings.getProperty("RateMultipler", "2.00"));
  239. + time_crazyrate = Integer.parseInt(frozenSettings.getProperty("TimeCrazy", "1"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement