Guest User

Untitled

a guest
Feb 3rd, 2015
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.90 KB | None | 0 0
  1. Index: config/players.properties
  2. ===================================================================
  3. --- config/players.properties (revision 127)
  4. +++ config/players.properties (working copy)
  5. @@ -298,4 +298,8 @@
  6. MaxBuffsAmount = 99
  7.  
  8. # Store buffs/debuffs on user logout?
  9. -StoreSkillCooltime = True
  10. \ No newline at end of file
  11. +StoreSkillCooltime = True
  12. +
  13. +# Cow - shit:
  14. +NameColorSwapsPvp = 100_00FF00,FFFF00;200_F34342,000000,54673F
  15. +NameColorSwapTime = 1
  16. \ No newline at end of file
  17. Index: java/net/sf/l2j/gameserver/ExtremeColoring.java
  18. ===================================================================
  19. --- java/net/sf/l2j/gameserver/ExtremeColoring.java (revision 0)
  20. +++ java/net/sf/l2j/gameserver/ExtremeColoring.java (revision 0)
  21. @@ -0,0 +1,111 @@
  22. +/*
  23. + * This program is free software: you can redistribute it and/or modify it under
  24. + * the terms of the GNU General Public License as published by the Free Software
  25. + * Foundation, either version 3 of the License, or (at your option) any later
  26. + * version.
  27. + *
  28. + * This program is distributed in the hope that it will be useful, but WITHOUT
  29. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  30. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  31. + * details.
  32. + *
  33. + * You should have received a copy of the GNU General Public License along with
  34. + * this program. If not, see <http://www.gnu.org/licenses/>.
  35. + */
  36. +package net.sf.l2j.gameserver;
  37. +
  38. +import java.util.ArrayList;
  39. +
  40. +import net.sf.l2j.Config;
  41. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  42. +
  43. +/**
  44. + * @author Anarchy
  45. + *
  46. + */
  47. +public class ExtremeColoring
  48. +{
  49. + public static void checkUpdate(L2PcInstance p)
  50. + {
  51. + int lastI = 0;
  52. + for (int i : Config.PLAYER_COLORS.keySet())
  53. + {
  54. + if (p.getPvpKills() >= i)
  55. + {
  56. + lastI = i;
  57. + }
  58. + }
  59. +
  60. + if (lastI == 0)
  61. + return;
  62. +
  63. + String s = "";
  64. + for (int i : Config.PLAYER_COLORS.get(lastI))
  65. + {
  66. + s += i;
  67. + }
  68. +
  69. + if (!s.equals(p.getColoring().getColors()))
  70. + {
  71. + p.getColorTask().cancel(true);
  72. + p.setColorTask(null);
  73. + p.setColoring(null);
  74. +
  75. + p.setColorTask(ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Coloring(Config.PLAYER_COLORS.get(lastI), p), Config.PLAYER_COLORS_TIME*1000, Config.PLAYER_COLORS_TIME*1000));
  76. + }
  77. + }
  78. +
  79. + public static void begin(L2PcInstance p)
  80. + {
  81. + int lastI = 0;
  82. +
  83. + for (int i : Config.PLAYER_COLORS.keySet())
  84. + {
  85. + if (p.getPvpKills() >= i)
  86. + {
  87. + lastI = i;
  88. + }
  89. + }
  90. +
  91. + if (lastI == 0)
  92. + return;
  93. +
  94. + p.setColorTask(ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Coloring(Config.PLAYER_COLORS.get(lastI), p), Config.PLAYER_COLORS_TIME*1000, Config.PLAYER_COLORS_TIME*1000));
  95. + }
  96. +
  97. + public static class Coloring implements Runnable
  98. + {
  99. + private int[] color;
  100. + private L2PcInstance p;
  101. + private int last = 0;
  102. +
  103. + public Coloring(ArrayList<Integer> colors, L2PcInstance p)
  104. + {
  105. + for (int i = 0; i < colors.size(); i++)
  106. + {
  107. + color[i] = colors.get(i);
  108. + }
  109. + this.p = p;
  110. + }
  111. +
  112. + @Override
  113. + public void run()
  114. + {
  115. + last++;
  116. + p.getAppearance().setNameColor(color[last]);
  117. + p.broadcastUserInfo();
  118. + }
  119. +
  120. + public String getColors()
  121. + {
  122. + String s = "";
  123. +
  124. + for (int i : color)
  125. + {
  126. + s += i;
  127. + }
  128. +
  129. + return s;
  130. + }
  131. + }
  132. +}
  133. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  134. ===================================================================
  135. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 127)
  136. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  137. @@ -36,6 +36,8 @@
  138.  
  139. import net.sf.l2j.Config;
  140. import net.sf.l2j.L2DatabaseFactory;
  141. +import net.sf.l2j.gameserver.ExtremeColoring;
  142. +import net.sf.l2j.gameserver.ExtremeColoring.Coloring;
  143. import net.sf.l2j.gameserver.GameTimeController;
  144. import net.sf.l2j.gameserver.GeoData;
  145. import net.sf.l2j.gameserver.ItemsAutoDestroy;
  146. @@ -251,6 +253,30 @@
  147. */
  148. public final class L2PcInstance extends L2Playable
  149. {
  150. + private Coloring coloring = null;
  151. +
  152. + public Coloring getColoring()
  153. + {
  154. + return coloring;
  155. + }
  156. +
  157. + public void setColoring(Coloring val)
  158. + {
  159. + coloring = val;
  160. + }
  161. +
  162. + private Future<?> colorTask = null;
  163. +
  164. + public Future<?> getColorTask()
  165. + {
  166. + return colorTask;
  167. + }
  168. +
  169. + public void setColorTask(Future<?> val)
  170. + {
  171. + colorTask = val;
  172. + }
  173. +
  174. private int mobsKilled = 0;
  175.  
  176. public void setMobsKilled(int val)
  177. @@ -4541,6 +4567,15 @@
  178. return;
  179. }
  180.  
  181. + if (getColorTask() == null)
  182. + {
  183. + ExtremeColoring.begin(this);
  184. + }
  185. + else
  186. + {
  187. + ExtremeColoring.checkUpdate(this);
  188. + }
  189. +
  190. getAppearance().setNameColor(0xFFFFFF);
  191. broadcastUserInfo();
  192. }
  193. Index: java/net/sf/l2j/Config.java
  194. ===================================================================
  195. --- java/net/sf/l2j/Config.java (revision 127)
  196. +++ java/net/sf/l2j/Config.java (working copy)
  197. @@ -488,6 +488,10 @@
  198. public static boolean STORE_SKILL_COOLTIME;
  199. public static int BUFFS_MAX_AMOUNT;
  200.  
  201. + /** Crap */
  202. + public static Map<Integer, ArrayList<Integer>> PLAYER_COLORS = new HashMap<>();
  203. + public static int PLAYER_COLORS_TIME;
  204. +
  205. // --------------------------------------------------
  206. // Server
  207. // --------------------------------------------------
  208. @@ -1175,6 +1179,20 @@
  209. BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
  210. STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
  211.  
  212. + PLAYER_COLORS_TIME = players.getProperty("NameColorSwapTime", 1);
  213. + String player_colors = players.getProperty("NameColorSwapsPvp", "100_00FF00,FFFF00;200_F34342,000000,54673F");
  214. + String[] pc1 = player_colors.split(";");
  215. + for (String s : pc1)
  216. + {
  217. + String[] pc2 = s.split("_");
  218. + ArrayList<Integer> temp = new ArrayList<>();
  219. + for (String ss : pc2[1].split(","))
  220. + {
  221. + temp.add(Integer.decode("0x"+ss));
  222. + }
  223. + PLAYER_COLORS.put(Integer.parseInt(pc2[0]), temp);
  224. + }
  225. +
  226. // server
  227. ExProperties server = load(SERVER_FILE);
  228.  
  229. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  230. ===================================================================
  231. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 127)
  232. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
  233. @@ -16,6 +16,7 @@
  234.  
  235. import net.sf.l2j.Config;
  236. import net.sf.l2j.gameserver.Announcements;
  237. +import net.sf.l2j.gameserver.ExtremeColoring;
  238. import net.sf.l2j.gameserver.GameTimeController;
  239. import net.sf.l2j.gameserver.SevenSigns;
  240. import net.sf.l2j.gameserver.customs.events.SoloEventManager;
  241. @@ -251,6 +252,8 @@
  242. //{
  243. //ServerPreview.getInstance().createNew(activeChar);
  244. //}
  245. +
  246. + ExtremeColoring.begin(activeChar);
  247. }
  248.  
  249. private static void engage(L2PcInstance cha)
Advertisement
Add Comment
Please, Sign In to add comment