Advertisement
Guest User

Spree Kills aCis 382 in xml

a guest
Sep 22nd, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.91 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/model/actor/Player.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/model/actor/Player.java (revision 3)
  6. +++ java/net/sf/l2j/gameserver/model/actor/Player.java (working copy)
  7. import net.sf.l2j.gameserver.data.xml.RecipeData;
  8. import net.sf.l2j.gameserver.data.xml.ScriptData;
  9. +import net.sf.l2j.gameserver.data.xml.SpreeKillsData;
  10. +import net.sf.l2j.gameserver.data.xml.SpreeKillsData.SpreeKills;
  11. import net.sf.l2j.gameserver.enums.AiEventType;
  12. import net.sf.l2j.gameserver.enums.CabalType;
  13. import net.sf.l2j.gameserver.enums.GaugeColor;
  14.  
  15. @@ -313,6 +334,7 @@
  16. private byte _pvpFlag;
  17. private byte _siegeState;
  18. private int _curWeightPenalty;
  19. + private int _spreeKills;
  20.  
  21. private int _lastCompassZone; // the last compass zone update send to the client
  22.  
  23. @@ -3724,7 +3760,29 @@
  24. {
  25. // Add PvP point to attacker.
  26. setPvpKills(getPvpKills() + 1);
  27. +
  28. + if (Config.ENABLE_SPREEKILLS)
  29. + {
  30. + _spreeKills += 1;
  31. +
  32. + for (SpreeKills kills : SpreeKillsData.getInstance().getSpreeKills())
  33. + {
  34. + if (kills.getKills() == _spreeKills)
  35. + {
  36. + World.announceToOnlinePlayers(getName() + " marcou " + kills.getMsg(), true);
  37. +
  38. + if (!kills.getSound().isEmpty())
  39. + sendPacket(new PlaySound(2, kills.getSound()));
  40. +
  41. + if (kills.getItemId() > 0)
  42. + addItem("Reward", kills.getItemId(), kills.getItemCount(), null, true);
  43. + }
  44. + }
  45. + }
  46. +
  47. \ No newline at end of file
  48. Index: java/net/sf/l2j/gameserver/data/xml/SpreeKillsData.java
  49. ===================================================================
  50. --- java/net/sf/l2j/gameserver/data/xml/SpreeKillsData.java (revision 0)
  51. +++ java/net/sf/l2j/gameserver/data/xml/SpreeKillsData.java (working copy)
  52. @@ -0,0 +1,106 @@
  53. +package net.sf.l2j.gameserver.data.xml;
  54. +
  55. +import java.nio.file.Path;
  56. +import java.util.ArrayList;
  57. +import java.util.List;
  58. +import net.sf.l2j.commons.data.xml.IXmlReader;
  59. +import net.sf.l2j.commons.util.StatsSet;
  60. +
  61. +import org.w3c.dom.Document;
  62. +
  63. +/**
  64. + * @author Williams
  65. + *
  66. + */
  67. +public class SpreeKillsData implements IXmlReader
  68. +{
  69. + private final List<SpreeKills> _spree = new ArrayList<>();
  70. +
  71. + public SpreeKillsData()
  72. + {
  73. + load();
  74. + }
  75. +
  76. + public void reload()
  77. + {
  78. + _spree.clear();
  79. + load();
  80. + }
  81. +
  82. + @Override
  83. + public void load()
  84. + {
  85. + parseFile("./data/xml/spreeKills.xml");
  86. + LOGGER.info("Loaded {} spreeKills data.", _spree.size());
  87. + }
  88. +
  89. + @Override
  90. + public void parseDocument(Document doc, Path path)
  91. + {
  92. + forEach(doc, "list", listNode -> forEach(listNode, "pvp", node ->
  93. + {
  94. + final StatsSet set = parseAttributes(node);
  95. + forEach(node, "SpreeKills", setNode -> set.putAll(parseAttributes(setNode)));
  96. + _spree.add(new SpreeKills(set));
  97. + }));
  98. +
  99. + }
  100. +
  101. + public List<SpreeKills> getSpreeKills()
  102. + {
  103. + return _spree;
  104. + }
  105. +
  106. + public class SpreeKills
  107. + {
  108. + private final int _kill;
  109. + private final String _msg;
  110. + private final String _sound;
  111. + private final int _itemId;
  112. + private final int _itemCount;
  113. +
  114. + public SpreeKills(StatsSet set)
  115. + {
  116. + _kill = set.getInteger("kills");
  117. + _msg = set.getString("msg");
  118. + _sound = set.getString("sound");
  119. + _itemId = set.getInteger("itemId");
  120. + _itemCount = set.getInteger("itemCount");
  121. + }
  122. +
  123. + public int getKills()
  124. + {
  125. + return _kill;
  126. + }
  127. +
  128. + public String getMsg()
  129. + {
  130. + return _msg;
  131. + }
  132. +
  133. + public String getSound()
  134. + {
  135. + return _sound;
  136. + }
  137. +
  138. + public int getItemId()
  139. + {
  140. + return _itemId;
  141. + }
  142. +
  143. + public int getItemCount()
  144. + {
  145. + return _itemCount;
  146. + }
  147. + }
  148. +
  149. + public static SpreeKillsData getInstance()
  150. + {
  151. + return SingletonHolder.INSTANCE;
  152. + }
  153. +
  154. + private static class SingletonHolder
  155. + {
  156. + protected static final SpreeKillsData INSTANCE = new SpreeKillsData();
  157. + }
  158. +}
  159. \ No newline at end of file
  160. Index: java/net/sf/l2j/gameserver/GameServer.java
  161. ===================================================================
  162. --- java/net/sf/l2j/gameserver/GameServer.java (revision 3)
  163. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  164. @@ -69,6 +74,7 @@
  165. import net.sf.l2j.gameserver.data.xml.SkillTreeData;
  166. import net.sf.l2j.gameserver.data.xml.SoulCrystalData;
  167. import net.sf.l2j.gameserver.data.xml.SpellbookData;
  168. +import net.sf.l2j.gameserver.data.xml.SpreeKillsData;
  169. import net.sf.l2j.gameserver.data.xml.StaticObjectData;
  170. import net.sf.l2j.gameserver.data.xml.SummonItemData;
  171. import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
  172. @@ -187,6 +194,11 @@
  173. PartyMatchWaitingList.getInstance();
  174. PartyMatchRoomList.getInstance();
  175. RaidPointManager.getInstance();
  176. + SpreeKillsData.getInstance();
  177. +
  178. StringUtil.printSection("Community server");
  179. if (Config.ENABLE_COMMUNITY_BOARD) // Forums has to be loaded before clan data
  180. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
  181. ===================================================================
  182. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (revision 3)
  183. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (working copy)
  184. @@ -15,6 +15,8 @@
  185. import net.sf.l2j.gameserver.data.xml.AnnouncementData;
  186. import net.sf.l2j.gameserver.data.xml.DoorData;
  187. import net.sf.l2j.gameserver.data.xml.PolymorphData;
  188. +import net.sf.l2j.gameserver.data.xml.PvPData;
  189. +import net.sf.l2j.gameserver.data.xml.SpreeKillsData;
  190. import net.sf.l2j.gameserver.data.xml.MultisellData;
  191. import net.sf.l2j.gameserver.data.xml.NpcData;
  192. import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
  193. @@ -233,6 +235,16 @@
  194. TeleportLocationData.getInstance().reload();
  195. activeChar.sendMessage("Teleport locations have been reloaded.");
  196. }
  197. + else if (type.startsWith("spreekills"))
  198. + {
  199. + SpreeKillsData.getInstance().reload();
  200. + activeChar.sendMessage("SpreeKills have been reloaded.");
  201. + }
  202. else if (type.startsWith("zone"))
  203. {
  204. ZoneManager.getInstance().reload();
  205. @@ -242,7 +254,7 @@
  206. {
  207. activeChar.sendMessage("Usage : //reload <admin|announcement|config|crest|cw>");
  208. activeChar.sendMessage("Usage : //reload <door|htm|item|multisell|npc>");
  209. - activeChar.sendMessage("Usage : //reload <npcwalker|skill|teleport|zone>");
  210. + activeChar.sendMessage("Usage : //reload <npcwalker|skill|spreekills|teleport|zone>");
  211. }
  212. }
  213. while (st.hasMoreTokens());
  214. @@ -251,7 +263,7 @@
  215. {
  216. activeChar.sendMessage("Usage : //reload <admin|announcement|config|crest|cw>");
  217. activeChar.sendMessage("Usage : //reload <door|htm|item|multisell|npc>");
  218. - activeChar.sendMessage("Usage : //reload <npcwalker|skill|teleport|zone>");
  219. + activeChar.sendMessage("Usage : //reload <npcwalker|skill|spreekills|teleport|zone>");
  220. }
  221. }
  222. return true;
  223. ### Eclipse Workspace Patch 1.0
  224. #P aCis_datapack
  225. Index: data/xml/spreeKills.xml
  226. ===================================================================
  227. --- data/xml/spreeKills.xml (revision 0)
  228. +++ data/xml/spreeKills.xml (working copy)
  229. @@ -0,0 +1,21 @@
  230. +<?xml version="1.0" encoding="UTF-8"?>
  231. +<list>
  232. + <pvp>
  233. + <SpreeKills kills="2" msg="Double Kill" sound="doublekill" itemId="0" itemCount="0"/>
  234. + </pvp>
  235. + <pvp>
  236. + <SpreeKills kills="3" msg="Triple Kill" sound="triplekill" itemId="0" itemCount="0"/>
  237. + </pvp>
  238. + <pvp>
  239. + <SpreeKills kills="5" msg="Mega Kill" sound="megakill" itemId="0" itemCount="0"/>
  240. + </pvp>
  241. + <pvp>
  242. + <SpreeKills kills="8" msg="Ultra Kill" sound="ultrakill" itemId="0" itemCount="0"/>
  243. + </pvp>
  244. + <pvp>
  245. + <SpreeKills kills="10" msg="Monster Kill" sound="monsterkill" itemId="0" itemCount="0"/>
  246. + </pvp>
  247. + <pvp>
  248. + <SpreeKills kills="12" msg="Unstoppable Kill" sound="Unstoppable" itemId="9217" itemCount="1"/>
  249. + </pvp>
  250. +</list>
  251. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement