Advertisement
tensador125

l2jorion Box xml

Apr 16th, 2023 (edited)
1,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 16.97 KB | Gaming | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P Orionwins
  3. diff --git a/src/Base/XML/XMLDocument.java b/src/Base/XML/XMLDocument.java
  4. new file mode 100644
  5. index 0000000..2e9bb7a
  6. --- /dev/null
  7. +++ b/src/Base/XML/XMLDocument.java
  8. @@ -0,0 +1,137 @@
  9. +package Base.XML;
  10. +
  11. +import java.io.File;
  12. +import java.util.function.Consumer;
  13. +import java.util.function.Predicate;
  14. +import java.util.logging.Level;
  15. +import java.util.logging.Logger;
  16. +
  17. +import javax.xml.parsers.DocumentBuilderFactory;
  18. +
  19. +import org.w3c.dom.Document;
  20. +import org.w3c.dom.NamedNodeMap;
  21. +import org.w3c.dom.Node;
  22. +import org.w3c.dom.NodeList;
  23. +
  24. +import l2jorion.game.templates.StatsSet;
  25. +
  26. +/**
  27. + * An XML document, relying on a static and single DocumentBuilderFactory.
  28. + */
  29. +public abstract class XMLDocument
  30. +{
  31. +   protected static final Logger LOG = Logger.getLogger(XMLDocument.class.getName());
  32. +  
  33. +   private static final DocumentBuilderFactory BUILDER;
  34. +   static
  35. +   {
  36. +       BUILDER = DocumentBuilderFactory.newInstance();
  37. +       BUILDER.setValidating(false);
  38. +       BUILDER.setIgnoringComments(true);
  39. +   }
  40. +  
  41. +   abstract protected void load();
  42. +  
  43. +   abstract protected void parseDocument(Document doc, File f);
  44. +  
  45. +   public void loadDocument(String filePath)
  46. +   {
  47. +       loadDocument(new File(filePath));
  48. +   }
  49. +  
  50. +   /**
  51. +    * Parse an entire directory or file if found.
  52. +    * @param file
  53. +    */
  54. +   public void loadDocument(File file)
  55. +   {
  56. +       if (!file.exists())
  57. +       {
  58. +           LOG.severe("The following file or directory doesn't exist: " + file.getName());
  59. +           return;
  60. +       }
  61. +      
  62. +       if (file.isDirectory())
  63. +       {
  64. +           for (File f : file.listFiles())
  65. +           {
  66. +               loadDocument(f);
  67. +           }
  68. +       }
  69. +       else if (file.isFile())
  70. +       {
  71. +           try
  72. +           {
  73. +               parseDocument(BUILDER.newDocumentBuilder().parse(file), file);
  74. +           }
  75. +           catch (Exception e)
  76. +           {
  77. +               LOG.log(Level.SEVERE, "Error loading XML file " + file.getName(), e);
  78. +           }
  79. +       }
  80. +   }
  81. +  
  82. +   public void forEach(Node node, Consumer<Node> action)
  83. +   {
  84. +       forEach(node, a -> true, action);
  85. +   }
  86. +  
  87. +   public void forEach(Node node, String nodeName, Consumer<Node> action)
  88. +   {
  89. +       forEach(node, innerNode ->
  90. +       {
  91. +           if (nodeName.contains("|"))
  92. +           {
  93. +               final String[] nodeNames = nodeName.split("\\|");
  94. +               for (String name : nodeNames)
  95. +               {
  96. +                   if (!name.isEmpty() && name.equals(innerNode.getNodeName()))
  97. +                   {
  98. +                       return true;
  99. +                   }
  100. +               }
  101. +               return false;
  102. +           }
  103. +           return nodeName.equals(innerNode.getNodeName());
  104. +       }, action);
  105. +   }
  106. +  
  107. +   public void forEach(Node node, Predicate<Node> filter, Consumer<Node> action)
  108. +   {
  109. +       final NodeList list = node.getChildNodes();
  110. +       for (int i = 0; i < list.getLength(); i++)
  111. +       {
  112. +           final Node targetNode = list.item(i);
  113. +           if (filter.test(targetNode))
  114. +           {
  115. +               action.accept(targetNode);
  116. +           }
  117. +       }
  118. +   }
  119. +  
  120. +   public StatsSet parseAttributes(Node node)
  121. +   {
  122. +       final NamedNodeMap attrs = node.getAttributes();
  123. +       final StatsSet map = new StatsSet();
  124. +       for (int i = 0; i < attrs.getLength(); i++)
  125. +       {
  126. +           final Node att = attrs.item(i);
  127. +           map.set(att.getNodeName(), att.getNodeValue());
  128. +       }
  129. +       return map;
  130. +   }
  131. +  
  132. +   /**
  133. +    * This method parses the content of a NamedNodeMap and feed the given StatsSet.
  134. +    * @param attrs : The NamedNodeMap to parse.
  135. +    * @param set : The StatsSet to feed.
  136. +    */
  137. +   public static void parseAndFeed(NamedNodeMap attrs, StatsSet set)
  138. +   {
  139. +       for (int i = 0; i < attrs.getLength(); i++)
  140. +       {
  141. +           final Node attr = attrs.item(i);
  142. +           set.set(attr.getNodeName(), attr.getNodeValue());
  143. +       }
  144. +   }
  145. +}
  146. \ No newline at end of file
  147. diff --git files/game/data/xml/ComboBoxes.xml files/game/data/xml/ComboBoxes.xml
  148. new file mode 100644
  149. index 0000000..502a60b
  150. --- /dev/null
  151. +++ files/game/data/xml/ComboBoxes.xml
  152. @@ -0,0 +1,27 @@
  153. +<?xml version="1.0" encoding="utf-8"?>
  154. +<ComboBoxes>
  155. +   <ComboBox ID="19000"> <!-- Mage Starter Pack-->
  156. +       <item itemId="177" amount="1" enchantLevel="0"  chance="70"/>
  157. +       <item itemId="1101" amount="1" enchantLevel="0" chance="80"/>
  158. +       <item itemId="1104" amount="1" enchantLevel="0" chance="80"/>
  159. +       <item itemId="908" amount="1" enchantLevel="0" chance="80"/>
  160. +       <item itemId="115" amount="1" enchantLevel="0" chance="80"/>
  161. +       <item itemId="115" amount="1" enchantLevel="0" chance="80"/>
  162. +       <item itemId="877" amount="1" enchantLevel="0" chance="80"/>
  163. +       <item itemId="877" amount="1" enchantLevel="0" chance="80"/>
  164. +       <item itemId="3948" amount="2000" enchantLevel="0" chance="80"/>
  165. +   </ComboBox>
  166. +   <ComboBox ID="19001"> <!-- Fighter Starter Pack-->
  167. +       <item itemId="68" amount="1" enchantLevel="0" chance="0"/>
  168. +       <item itemId="711" amount="1" enchantLevel="0" chance="0"/>
  169. +       <item itemId="715" amount="1" enchantLevel="0" chance="0"/>
  170. +       <item itemId="908" amount="1" enchantLevel="0" chance="0"/>
  171. +       <item itemId="115" amount="1" enchantLevel="0" chance="0"/>
  172. +       <item itemId="115" amount="1" enchantLevel="0" chance="0"/>
  173. +       <item itemId="877" amount="1" enchantLevel="0" chance="0"/>
  174. +       <item itemId="877" amount="1" enchantLevel="0" chance="0"/>
  175. +       <item itemId="1463" amount="2500" enchantLevel="0" chance="0"/>
  176. +   </ComboBox>
  177. +  
  178. +  
  179. +</ComboBoxes>
  180. diff --git src/Base/ComboBox/ComboBox.java src/Base/ComboBox/ComboBox.java
  181. new file mode 100644
  182. index 0000000..5a1bdb5
  183. --- /dev/null
  184. +++ src/Base/ComboBox/ComboBox.java
  185. @@ -0,0 +1,65 @@
  186. +package Base.ComboBox;
  187. +
  188. +import java.util.ArrayList;
  189. +import java.util.List;
  190. +
  191. +import Base.util.StatsSet;
  192. +
  193. +/**
  194. + * @author Rouxy
  195. + */
  196. +public class ComboBox
  197. +{
  198. +   private int id;
  199. +   private List<StatsSet> items = new ArrayList<>();
  200. +  
  201. +   public ComboBox(int id, List<StatsSet> items)
  202. +   {
  203. +       this.id = id;
  204. +       this.setItems(items);
  205. +   }
  206. +  
  207. +   public List<ComboBoxItem> getComboBoxItems()
  208. +   {
  209. +      
  210. +       List<ComboBoxItem> comboItems = new ArrayList<>();
  211. +       for (StatsSet item : items)
  212. +       {
  213. +           comboItems.add(new ComboBoxItem(item.getInteger("itemId"), item.getInteger("amount"), item.getInteger("enchantLevel"), item.getDouble("chance")));
  214. +       }
  215. +       return comboItems;
  216. +   }
  217. +  
  218. +   /**
  219. +    * @return the id
  220. +    */
  221. +   public int getId()
  222. +   {
  223. +       return id;
  224. +   }
  225. +  
  226. +   /**
  227. +    * @param id the id to set
  228. +    */
  229. +   public void setId(int id)
  230. +   {
  231. +       this.id = id;
  232. +   }
  233. +  
  234. +   /**
  235. +    * @return the items
  236. +    */
  237. +   public List<StatsSet> getItems()
  238. +   {
  239. +       return items;
  240. +   }
  241. +  
  242. +   /**
  243. +    * @param items the items to set
  244. +    */
  245. +   public void setItems(List<StatsSet> items)
  246. +   {
  247. +       this.items = items;
  248. +   }
  249. +  
  250. +}
  251. diff --git src/Base/ComboBox/ComboBoxItem.java src/Base/ComboBox/ComboBoxItem.java
  252. new file mode 100644
  253. index 0000000..0a4bba0
  254. --- /dev/null
  255. +++ src/Base/ComboBox/ComboBoxItem.java
  256. @@ -0,0 +1,79 @@
  257. +package Base.ComboBox;
  258. +
  259. +/**
  260. + * @author Rouxy
  261. + */
  262. +public class ComboBoxItem
  263. +{
  264. +   private int enchantLevel;
  265. +   private int amount;
  266. +   private int id;
  267. +   private double chance;
  268. +  
  269. +   public ComboBoxItem(int id, int amount, int enchantLevel, double chance)
  270. +   {
  271. +       this.id = id;
  272. +       this.enchantLevel = enchantLevel;
  273. +       this.amount = amount;
  274. +       this.chance = chance;
  275. +   }
  276. +  
  277. +   /**
  278. +    * @return the enchantLevel
  279. +    */
  280. +   public int getEnchantLevel()
  281. +   {
  282. +       return enchantLevel;
  283. +   }
  284. +  
  285. +   /**
  286. +    * @param enchantLevel the enchantLevel to set
  287. +    */
  288. +   public void setEnchantLevel(int enchantLevel)
  289. +   {
  290. +       this.enchantLevel = enchantLevel;
  291. +   }
  292. +  
  293. +   /**
  294. +    * @return the amount
  295. +    */
  296. +   public int getAmount()
  297. +   {
  298. +       return amount;
  299. +   }
  300. +  
  301. +   /**
  302. +    * @param amount the amount to set
  303. +    */
  304. +   public void setAmount(int amount)
  305. +   {
  306. +       this.amount = amount;
  307. +   }
  308. +  
  309. +   /**
  310. +    * @return the id
  311. +    */
  312. +   public int getId()
  313. +   {
  314. +       return id;
  315. +   }
  316. +  
  317. +   /**
  318. +    * @param id the id to set
  319. +    */
  320. +   public void setId(int id)
  321. +   {
  322. +       this.id = id;
  323. +   }
  324. +  
  325. +   public double getChance()
  326. +   {
  327. +       return chance;
  328. +   }
  329. +  
  330. +   public void setChance(double chance)
  331. +   {
  332. +       this.chance = chance;
  333. +   }
  334. +  
  335. +}
  336. diff --git src/Base/ComboBox/Data/ComboBoxData.java src/Base/ComboBox/Data/ComboBoxData.java
  337. new file mode 100644
  338. index 0000000..d74469e
  339. --- /dev/null
  340. +++ src/Base/ComboBox/Data/ComboBoxData.java
  341. @@ -0,0 +1,121 @@
  342. +package Base.ComboBox.Data;
  343. +
  344. +import java.io.File;
  345. +import java.util.ArrayList;
  346. +import java.util.HashMap;
  347. +import java.util.List;
  348. +import java.util.Map;
  349. +
  350. +import org.w3c.dom.Document;
  351. +import org.w3c.dom.NamedNodeMap;
  352. +import org.w3c.dom.Node;
  353. +
  354. +import Base.ComboBox.ComboBox;
  355. +import Base.data.XMLDocument;
  356. +import Base.util.StatsSet;
  357. +import l2jwins.game.datatables.sql.ItemTable;
  358. +
  359. +/**
  360. + * @author Rouxy
  361. + */
  362. +public class ComboBoxData extends XMLDocument
  363. +{
  364. +   private Map<Integer, ComboBox> comboBoxes = new HashMap<>();
  365. +  
  366. +   public ComboBoxData()
  367. +   {
  368. +       load();
  369. +   }
  370. +  
  371. +   public static ComboBoxData getInstance()
  372. +   {
  373. +       return SingleTonHolder._instance;
  374. +   }
  375. +  
  376. +   private static class SingleTonHolder
  377. +   {
  378. +       protected static final ComboBoxData _instance = new ComboBoxData();
  379. +   }
  380. +  
  381. +   @Override
  382. +   protected void load()
  383. +   {
  384. +       loadDocument("./data/xml/ComboBoxes.xml");
  385. +       LOG.info("ComboBoxData: Loaded " + comboBoxes.size() + " Comboboxes.");
  386. +   }
  387. +  
  388. +   @Override
  389. +   protected void parseDocument(Document doc, File f)
  390. +   {
  391. +       try
  392. +       {
  393. +          
  394. +           // First element is never read.
  395. +           final Node n = doc.getFirstChild();
  396. +          
  397. +           for (Node o = n.getFirstChild(); o != null; o = o.getNextSibling())
  398. +           {
  399. +               if (!"ComboBox".equalsIgnoreCase(o.getNodeName()))
  400. +               {
  401. +                   continue;
  402. +               }
  403. +              
  404. +               NamedNodeMap attrs = o.getAttributes();
  405. +               ComboBox comboBox = null;
  406. +               List<StatsSet> items = new ArrayList<>();
  407. +              
  408. +               final int id = Integer.parseInt(attrs.getNamedItem("ID").getNodeValue());
  409. +              
  410. +               for (Node d = o.getFirstChild(); d != null; d = d.getNextSibling())
  411. +               {
  412. +                   if (!"item".equalsIgnoreCase(d.getNodeName()))
  413. +                   {
  414. +                       continue;
  415. +                   }
  416. +                  
  417. +                   attrs = d.getAttributes();
  418. +                   StatsSet item = new StatsSet();
  419. +                  
  420. +                   item.set("itemId", Integer.parseInt(attrs.getNamedItem("itemId").getNodeValue()));
  421. +                   item.set("amount", Integer.parseInt(attrs.getNamedItem("amount").getNodeValue()));
  422. +                   item.set("enchantLevel", Integer.parseInt(attrs.getNamedItem("enchantLevel").getNodeValue()));
  423. +                   item.set("chance", Integer.parseInt(attrs.getNamedItem("chance").getNodeValue()));
  424. +                   if (ItemTable.getInstance().getTemplate(item.getInteger("itemId")) != null)
  425. +                   {
  426. +                       items.add(item);
  427. +                   }
  428. +                   else
  429. +                   {
  430. +                       LOG.warning("Item Id: " + item.getInteger("itemId") + " is an invalid item for combo box ID: " + id + ".");
  431. +                   }
  432. +                   comboBox = new ComboBox(id, items);
  433. +                  
  434. +               }
  435. +               comboBoxes.put(id, comboBox);
  436. +           }
  437. +       }
  438. +       catch (Exception e)
  439. +       {
  440. +           LOG.warning("ComboBox Data: Error while creating table: " + e);
  441. +           e.printStackTrace();
  442. +       }
  443. +   }
  444. +  
  445. +   public void clear()
  446. +   {
  447. +       comboBoxes.clear();
  448. +       comboBoxes = new HashMap<>();
  449. +   }
  450. +  
  451. +   public void reload()
  452. +   {
  453. +       clear();
  454. +       load();
  455. +   }
  456. +  
  457. +   public ComboBox getComboBoxById(int id)
  458. +   {
  459. +       return comboBoxes.get(id);
  460. +   }
  461. +  
  462. +}
  463. diff --git src/l2jwins/game/GameServer.java src/l2jwins/game/GameServer.java
  464. index f7ad5fa..b8a251c 100644
  465. --- src/l2jwins/game/GameServer.java
  466. +++ src/l2jwins/game/GameServer.java
  467. @@ -12,6 +12,7 @@
  468.  import java.util.logging.LogManager;
  469.  
  470.  import Base.ClanStrongold.ClanStrongholdDeviceSpawner;
  471. +import Base.ComboBox.Data.ComboBoxData;
  472.  import Base.Instance.InstanceManager;
  473.  import Base.Rank.RankManager;
  474.  import Base.Rank.RankingSkillBonuses;
  475. @@ -548,6 +549,9 @@
  476.        
  477.         HistoriasTable.getInstance();
  478.        
  479. +       Util.printSection("ComboBox Data");
  480. +       ComboBoxData.getInstance();
  481. +      
  482.         Util.printSection("Handlers");
  483.         ItemHandler.getInstance();
  484.         SkillHandler.getInstance();
  485. diff --git src/l2jwins/game/handler/ItemHandler.java src/l2jwins/game/handler/ItemHandler.java
  486. index ed8f801..21fb2c8 100644
  487. --- src/l2jwins/game/handler/ItemHandler.java
  488. +++ src/l2jwins/game/handler/ItemHandler.java
  489. @@ -21,6 +21,7 @@
  490.  import l2jwins.game.handler.item.ClanPointCustomItem;
  491.  import l2jwins.game.handler.item.ClanReputationItem;
  492.  import l2jwins.game.handler.item.ClanSkillsCustomItem;
  493. +import l2jwins.game.handler.item.ComboBoxHandler;
  494.  import l2jwins.game.handler.item.CrystalCarol;
  495.  import l2jwins.game.handler.item.Crystals;
  496.  import l2jwins.game.handler.item.CustomItemForFighter;
  497. @@ -131,6 +132,7 @@
  498.         registerItemHandler(new PremiumCustom30DaysItem());
  499.         registerItemHandler(new PremiumCustom365DaysItem());
  500.         registerItemHandler(new MOSKey());
  501. +       registerItemHandler(new ComboBoxHandler());
  502.         registerItemHandler(new BreakingArrow());
  503.         registerItemHandler(new ChristmasTree());
  504.         registerItemHandler(new Crystals());
  505. diff --git src/l2jwins/game/handler/item/ComboBoxHandler.java src/l2jwins/game/handler/item/ComboBoxHandler.java
  506. new file mode 100644
  507. index 0000000..320578d
  508. --- /dev/null
  509. +++ src/l2jwins/game/handler/item/ComboBoxHandler.java
  510. @@ -0,0 +1,223 @@
  511. +package l2jwins.game.handler.item;
  512. +
  513. +import Base.ComboBox.ComboBox;
  514. +import Base.ComboBox.ComboBoxItem;
  515. +import Base.ComboBox.Data.ComboBoxData;
  516. +import l2jwins.game.handler.IItemHandler;
  517. +import l2jwins.game.idfactory.IdFactory;
  518. +import l2jwins.game.model.actor.instance.L2ItemInstance;
  519. +import l2jwins.game.model.actor.instance.L2PcInstance;
  520. +import l2jwins.game.model.actor.instance.L2PlayableInstance;
  521. +import l2jwins.util.random.Rnd;
  522. +
  523. +/**
  524. + * @author Rouxy
  525. + */
  526. +public class ComboBoxHandler implements IItemHandler
  527. +{
  528. +  
  529. +   private static final int ITEM_IDS[] =
  530. +   {
  531. +       19000,
  532. +       19001,
  533. +       19002,
  534. +       19003,
  535. +       19004,
  536. +       19005,
  537. +       19006,
  538. +       19007,
  539. +       19008,
  540. +       19009,
  541. +       19010,
  542. +       19011,
  543. +       19012,
  544. +       19013,
  545. +       19014,
  546. +       19015,
  547. +       19016,
  548. +       19017,
  549. +       19018,
  550. +       19019,
  551. +       19020,
  552. +       19021,
  553. +       19022,
  554. +       19023,
  555. +       19024,
  556. +       19025,
  557. +       19026,
  558. +       19027,
  559. +       19028,
  560. +       19029,
  561. +       19030,
  562. +       19031,
  563. +       19033,
  564. +       19034,
  565. +       19035,
  566. +       19036,
  567. +       19037,
  568. +       19038,
  569. +       19039,
  570. +       19040,
  571. +       19041,
  572. +       19042,
  573. +       19043,
  574. +       19044,
  575. +       19045,
  576. +       19046,
  577. +       19047,
  578. +       19048,
  579. +       19049,
  580. +       19050,
  581. +       19051,
  582. +       19052,
  583. +       19053,
  584. +       19054,
  585. +       19055,
  586. +       19056,
  587. +       19057,
  588. +       19058,
  589. +       19059,
  590. +       19060,
  591. +       19061,
  592. +       19062,
  593. +       19063,
  594. +       19064,
  595. +       19065,
  596. +       19066,
  597. +       19067,
  598. +       19068,
  599. +       19069,
  600. +       19070,
  601. +       19071,
  602. +       19072,
  603. +       19073,
  604. +       19074,
  605. +       19075,
  606. +       19076,
  607. +       19077,
  608. +       19078,
  609. +       19079,
  610. +       19080,
  611. +       19081,
  612. +       19082,
  613. +       19083,
  614. +       19084,
  615. +       19085,
  616. +       19086,
  617. +       19087,
  618. +       19088,
  619. +       19089,
  620. +       19090,
  621. +       19091,
  622. +       19092,
  623. +       19093,
  624. +       19094,
  625. +       19095,
  626. +       19096,
  627. +       19097,
  628. +       19098,
  629. +       19099,
  630. +       19100,
  631. +       19101,
  632. +       19102,
  633. +       19103,
  634. +       19104,
  635. +       19105,
  636. +       19106,
  637. +       19107,
  638. +       19108,
  639. +       19109,
  640. +       19110,
  641. +       19111,
  642. +       19112,
  643. +       19113,
  644. +       19114,
  645. +       19115,
  646. +       19116,
  647. +       19117,
  648. +       19118,
  649. +       19119,
  650. +       19120,
  651. +       19121,
  652. +       19122,
  653. +       19123,
  654. +       19124,
  655. +       19125,
  656. +       19126,
  657. +       19127,
  658. +       19128,
  659. +       19129,
  660. +       19130,
  661. +       19131,
  662. +       19132,
  663. +       19133,
  664. +       19134,
  665. +       19135,
  666. +       19136,
  667. +       19137,
  668. +       19138,
  669. +       19139,
  670. +       19140,
  671. +       19141,
  672. +       15020,
  673. +       29142
  674. +  
  675. +   };
  676. +  
  677. +   @Override
  678. +   public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  679. +   {
  680. +       if (!(playable instanceof L2PcInstance))
  681. +       {
  682. +           return;
  683. +       }
  684. +      
  685. +       final L2PcInstance activeChar = (L2PcInstance) playable;
  686. +       final int itemId = item.getItemId();
  687. +      
  688. +       ComboBox comboBox = ComboBoxData.getInstance().getComboBoxById(itemId);
  689. +       if (comboBox != null)
  690. +       {
  691. +           L2ItemInstance toGive = null;
  692. +           for (ComboBoxItem boxItem : comboBox.getComboBoxItems())
  693. +           {
  694. +               toGive = new L2ItemInstance(IdFactory.getInstance().getNextId(), boxItem.getId());
  695. +               int random = Rnd.get(100);
  696. +               if (random < boxItem.getChance())
  697. +               {
  698. +                   if (!toGive.isStackable())
  699. +                   {
  700. +                       toGive.setEnchantLevel(boxItem.getEnchantLevel());
  701. +                       activeChar.addItem("ComboBox", toGive, activeChar, true);
  702. +                      
  703. +                   }
  704. +                   else
  705. +                   {
  706. +                       activeChar.addItem("ComboBox", boxItem.getId(), boxItem.getAmount(), activeChar, true);
  707. +                   }
  708. +                  
  709. +               }
  710. +               else
  711. +               {
  712. +                   activeChar.sendMessage("You were out of luck opening the item " + toGive.getName());
  713. +               }
  714. +               activeChar.sendMessage(toGive.getName() + " chance: " + boxItem.getChance());
  715. +              
  716. +           }
  717. +           activeChar.sendMessage("You used a combo box type item!");
  718. +       }
  719. +       else
  720. +       {
  721. +           activeChar.sendMessage("This Combo box expired or is invalid!");
  722. +       }
  723. +      
  724. +       playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
  725. +   }
  726. +  
  727. +   @Override
  728. +   public int[] getItemIds()
  729. +   {
  730. +       return ITEM_IDS;
  731. +   }
  732. +  
  733. +}
  734.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement