Guest User

Feanor em xml

a guest
Sep 17th, 2016
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.56 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_datapack
  3. Index: data/xml/feanor.xml
  4. ===================================================================
  5. --- data/xml/feanor.xml (revision 0)
  6. +++ data/xml/feanor.xml (working copy)
  7. @@ -0,0 +1,4 @@
  8. +<?xml version='1.0' encoding='utf-8'?>
  9. +<list>
  10. + <template itemid="3470" min="5" max="10" chance="550000"/>
  11. +</list>
  12. \ No newline at end of file
  13. Index: data/html/admin/server_menu.htm
  14. ===================================================================
  15. --- data/html/admin/server_menu.htm (revision 332)
  16. +++ data/html/admin/server_menu.htm (working copy)
  17. @@ -11,7 +11,7 @@
  18. Reload
  19. <table width=240>
  20. <tr>
  21. - <td><combobox width=120 height=21 var="cb" list=acar;config;crest;cw;door;htm;item;multisell;npc;npcwalker;scripts;skill;teleport;zone;></td>
  22. + <td><combobox width=120 height=21 var="cb" list=acar;config;crest;cw;door;htm;feanor;item;multisell;npc;npcwalker;scripts;skill;teleport;zone;></td>
  23. <td><button value="Reload" action="bypass -h admin_reload $cb" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"></td>
  24. </tr>
  25. </table><br>
  26. #P aCis_gameserver
  27. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
  28. ===================================================================
  29. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (revision 332)
  30. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (working copy)
  31. @@ -30,6 +30,7 @@
  32. import net.sf.l2j.gameserver.datatables.NpcTable;
  33. import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
  34. import net.sf.l2j.gameserver.datatables.SkillTable;
  35. +import net.sf.l2j.gameserver.datatables.SkipTable;
  36. import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
  37. import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  38. import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
  39. @@ -227,6 +228,11 @@
  40. ItemTable.getInstance().reload();
  41. activeChar.sendMessage("Items' templates have been reloaded.");
  42. }
  43. + else if (type.startsWith("feanor"))
  44. + {
  45. + FeanorTable.getInstance();
  46. + activeChar.sendMessage("Feanor list have been reloaded.");
  47. + }
  48. else if (type.equals("multisell"))
  49. {
  50. MultisellData.getInstance().reload();
  51. Index: java/net/sf/l2j/gameserver/GameServer.java
  52. ===================================================================
  53. --- java/net/sf/l2j/gameserver/GameServer.java (revision 332)
  54. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  55. @@ -56,6 +56,7 @@
  56. import net.sf.l2j.gameserver.datatables.RecipeTable;
  57. import net.sf.l2j.gameserver.datatables.SkillTable;
  58. import net.sf.l2j.gameserver.datatables.SkillTreeTable;
  59. +import net.sf.l2j.gameserver.datatables.FeanorTable;
  60. import net.sf.l2j.gameserver.datatables.SoulCrystalsTable;
  61. import net.sf.l2j.gameserver.datatables.SpawnTable;
  62. import net.sf.l2j.gameserver.datatables.SpellbookTable;
  63. @@ -194,6 +195,7 @@
  64. HennaTable.getInstance();
  65. HelperBuffTable.getInstance();
  66. CursedWeaponsManager.getInstance();
  67. + FeanorTable.getInstance();
  68.  
  69. Util.printSection("Clans");
  70. ClanTable.getInstance();
  71. Index: java/net/sf/l2j/gameserver/datatables/NpcTable.java
  72. ===================================================================
  73. --- java/net/sf/l2j/gameserver/datatables/NpcTable.java (revision 332)
  74. +++ java/net/sf/l2j/gameserver/datatables/NpcTable.java (working copy)
  75. @@ -23,6 +23,7 @@
  76. import java.util.logging.Level;
  77. import java.util.logging.Logger;
  78.  
  79. +import net.sf.l2j.Config;
  80. import net.sf.l2j.gameserver.model.L2MinionData;
  81. import net.sf.l2j.gameserver.model.L2NpcAIData;
  82. import net.sf.l2j.gameserver.model.L2Skill;
  83. @@ -201,6 +202,10 @@
  84. _log.warning("Droplist data for undefined itemId: " + data.getItemId());
  85. continue;
  86. }
  87. +
  88. + if (Config.ENABLE_FEANOR && FeanorTable.isFeanor(data.getItemId()))
  89. + continue;
  90. +
  91. template.addDropData(dropDat, category);
  92. }
  93. }
  94. Index: java/net/sf/l2j/Config.java
  95. ===================================================================
  96. --- java/net/sf/l2j/Config.java (revision 332)
  97. +++ java/net/sf/l2j/Config.java (working copy)
  98. @@ -374,6 +374,9 @@
  99. public static int GRID_NEIGHBOR_TURNON_TIME;
  100. public static int GRID_NEIGHBOR_TURNOFF_TIME;
  101.  
  102. + /** Feanor Drop */
  103. + public static boolean ENABLE_FEANOR;
  104. +
  105. // --------------------------------------------------
  106. // Players
  107. // --------------------------------------------------
  108. @@ -995,6 +998,8 @@
  109. GRID_NEIGHBOR_TURNON_TIME = npcs.getProperty("GridNeighborTurnOnTime", 1);
  110. GRID_NEIGHBOR_TURNOFF_TIME = npcs.getProperty("GridNeighborTurnOffTime", 90);
  111.  
  112. + ENABLE_FEANOR = npcs.getProperty("EnableFeanorList", false);
  113. +
  114. // players
  115. ExProperties players = load(PLAYERS_FILE);
  116. STARTING_ADENA = players.getProperty("StartingAdena", 100);
  117. Index: config/npcs.properties
  118. ===================================================================
  119. --- config/npcs.properties (revision 332)
  120. +++ config/npcs.properties (working copy)
  121. @@ -263,4 +263,12 @@
  122. # The always on option allows to ignore all this and let all grids be active at all times
  123. GridsAlwaysOn = False
  124. GridNeighborTurnOnTime = 1
  125. -GridNeighborTurnOffTime = 90
  126. \ No newline at end of file
  127. +GridNeighborTurnOffTime = 90
  128. +
  129. +#=============================================================
  130. +# Feanor Settings
  131. +#=============================================================
  132. +
  133. +# Enable skip all items from feanor.xml out from droplist of all monsters.
  134. +# Default: False
  135. +EnableFeanorList = False
  136. \ No newline at end of file
  137. Index: java/net/sf/l2j/gameserver/datatables/FeanorTable.java
  138. ===================================================================
  139. --- java/net/sf/l2j/gameserver/datatables/FeanorTable.java (revision 0)
  140. +++ java/net/sf/l2j/gameserver/datatables/FeanorTable.java (working copy)
  141. +/*
  142. + * This program is free software: you can redistribute it and/or modify it under
  143. + * the terms of the GNU General Public License as published by the Free Software
  144. + * Foundation, either version 3 of the License, or (at your option) any later
  145. + * version.
  146. + *
  147. + * This program is distributed in the hope that it will be useful, but WITHOUT
  148. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  149. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  150. + * details.
  151. + *
  152. + * You should have received a copy of the GNU General Public License along with
  153. + * this program. If not, see <http://www.gnu.org/licenses/>.
  154. + */
  155. +package net.sf.l2j.gameserver.datatables;
  156. +
  157. +import java.io.File;
  158. +import java.util.ArrayList;
  159. +import java.util.List;
  160. +import java.util.logging.Logger;
  161. +
  162. +import net.sf.l2j.gameserver.templates.StatsSet;
  163. +import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
  164. +
  165. +import org.w3c.dom.Document;
  166. +import org.w3c.dom.NamedNodeMap;
  167. +import org.w3c.dom.Node;
  168. +
  169. +/**
  170. + * @author Williams
  171. + *
  172. + */
  173. +public class FeanorTable
  174. +{
  175. + protected static final Logger _log = Logger.getLogger(FeanorTable.class.getName());
  176. +
  177. + private static List<Feanor> _feanor;
  178. +
  179. + public static FeanorTable getInstance()
  180. + {
  181. + return SingletonHolder._instance;
  182. + }
  183. +
  184. + private static class SingletonHolder
  185. + {
  186. + protected static final FeanorTable _instance = new FeanorTable();
  187. + }
  188. +
  189. + protected FeanorTable()
  190. + {
  191. + _feanor = new ArrayList<>();
  192. + loadFeanor();
  193. + }
  194. +
  195. + public void reload()
  196. + {
  197. + _feanor.clear();
  198. + loadFeanor();
  199. + }
  200. +
  201. + private void loadFeanor()
  202. + {
  203. + try
  204. + {
  205. + File f = new File("./data/xml/feanor.xml");
  206. + Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
  207. +
  208. + Node n = doc.getFirstChild();
  209. + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
  210. + {
  211. + if (d.getNodeName().equalsIgnoreCase("template"))
  212. + {
  213. + NamedNodeMap attrs = d.getAttributes();
  214. +
  215. + int itemId = Integer.valueOf(attrs.getNamedItem("itemId").getNodeValue());
  216. + int min = Integer.parseInt(attrs.getNamedItem("min").getNodeValue());
  217. + int max = Integer.parseInt(attrs.getNamedItem("max").getNodeValue());
  218. + int chance = Integer.parseInt(attrs.getNamedItem("chance").getNodeValue());
  219. +
  220. + StatsSet set = new StatsSet();
  221. + set.set("itemId", itemId);
  222. + set.set("min", min);
  223. + set.set("max", max);
  224. + set.set("chance", chance);
  225. +
  226. + _feanor.add(new Feanor(set));
  227. + }
  228. + }
  229. + }
  230. + catch (Exception e)
  231. + {
  232. + _log.warning("Exception: FeanorTable loadFeanor: " + e);
  233. + }
  234. +
  235. + _log.info("FeanorTable: Loaded " + _feanor.size() + " item's template(s).");
  236. + }
  237. +
  238. + public static boolean isFeanor(int itemId)
  239. + {
  240. + return _feanor.contains(itemId);
  241. + }
  242. +
  243. + public class Feanor
  244. + {
  245. + private int _itemId;
  246. + private int _chance;
  247. + private int _min;
  248. + private int _max;
  249. +
  250. + public Feanor(StatsSet set)
  251. + {
  252. + _itemId = set.getInteger("itemId");
  253. + _chance = set.getInteger("chance");
  254. + _min = set.getInteger("min");
  255. + _max = set.getInteger("max");
  256. + }
  257. +
  258. + public int getItemId()
  259. + {
  260. + return _itemId;
  261. + }
  262. +
  263. + public int getChance()
  264. + {
  265. + return _chance;
  266. + }
  267. +
  268. + public int getMax()
  269. + {
  270. + return _max;
  271. + }
  272. +
  273. + public int getMin()
  274. + {
  275. + return _min;
  276. + }
  277. + }
  278. +}
Advertisement
Add Comment
Please, Sign In to add comment