Advertisement
Guest User

Auction Manager

a guest
Sep 7th, 2019
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.74 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/data/sql/AuctionTable.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/data/sql/AuctionTable.java (revision 0)
  6. +++ java/net/sf/l2j/gameserver/data/sql/AuctionTable.java (working copy)
  7. @@ -0,0 +1,131 @@
  8. +package net.sf.l2j.gameserver.data.sql;
  9. +
  10. +import java.sql.Connection;
  11. +import java.sql.PreparedStatement;
  12. +import java.sql.ResultSet;
  13. +import java.util.ArrayList;
  14. +import net.sf.l2j.commons.logging.CLogger;
  15. +
  16. +import net.sf.l2j.L2DatabaseFactory;
  17. +import net.sf.l2j.gameserver.model.entity.AuctionItem;
  18. +
  19. +/**
  20. + * @author An4rchy
  21. + *
  22. + */
  23. +public class AuctionTable
  24. +{
  25. + private static final CLogger log = new CLogger(AuctionTable.class.getName());
  26. +
  27. + private ArrayList<AuctionItem> _items = new ArrayList<>();
  28. + private int _maxId = 0;
  29. +
  30. + private static final String RESTORE_ITEM = "SELECT * FROM auction_table";
  31. + private static final String ADD_ITEM = "INSERT INTO auction_table VALUES (?,?,?,?,?,?,?)";
  32. + private static final String DELETE_ITEM = "DELETE FROM auction_table WHERE auctionid=?";
  33. +
  34. + public static AuctionTable getInstance()
  35. + {
  36. + return SingletonHolder._instance;
  37. + }
  38. +
  39. + protected AuctionTable()
  40. + {
  41. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  42. + PreparedStatement stm = con.prepareStatement(RESTORE_ITEM))
  43. + {
  44. + try (ResultSet rset = stm.executeQuery())
  45. + {
  46. + while (rset.next())
  47. + {
  48. + int auctionId = rset.getInt("auctionid");
  49. + int ownerId = rset.getInt("ownerid");
  50. + int itemId = rset.getInt("itemid");
  51. + int count = rset.getInt("count");
  52. + int enchant = rset.getInt("enchant");
  53. + int costId = rset.getInt("costid");
  54. + int costCount = rset.getInt("costcount");
  55. +
  56. + _items.add(new AuctionItem(auctionId, ownerId, itemId, count, enchant, costId, costCount));
  57. +
  58. + if (auctionId > _maxId)
  59. + _maxId = auctionId;
  60. + }
  61. + }
  62. + }
  63. + catch (Exception e)
  64. + {
  65. + e.printStackTrace();
  66. + }
  67. +
  68. + log.info("AuctionTable: Loaded "+ _items.size() +" items.");
  69. + }
  70. +
  71. + public void addItem(AuctionItem item)
  72. + {
  73. + _items.add(item);
  74. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  75. + PreparedStatement stm = con.prepareStatement(ADD_ITEM))
  76. + {
  77. + stm.setInt(1, item.getAuctionId());
  78. + stm.setInt(2, item.getOwnerId());
  79. + stm.setInt(3, item.getItemId());
  80. + stm.setInt(4, item.getCount());
  81. + stm.setInt(5, item.getEnchant());
  82. + stm.setInt(6, item.getCostId());
  83. + stm.setInt(7, item.getCostCount());
  84. + stm.execute();
  85. + }
  86. + catch (Exception e)
  87. + {
  88. + e.printStackTrace();
  89. + }
  90. + }
  91. +
  92. + public void deleteItem(AuctionItem item)
  93. + {
  94. + _items.remove(item);
  95. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  96. + PreparedStatement stm = con.prepareStatement(DELETE_ITEM))
  97. + {
  98. + stm.setInt(1, item.getAuctionId());
  99. + stm.execute();
  100. + }
  101. + catch (Exception e)
  102. + {
  103. + e.printStackTrace();
  104. + }
  105. + }
  106. +
  107. + public AuctionItem getItem(int auctionId)
  108. + {
  109. + AuctionItem ret = null;
  110. +
  111. + for (AuctionItem item : _items)
  112. + {
  113. + if (item.getAuctionId() == auctionId)
  114. + {
  115. + ret = item;
  116. + break;
  117. + }
  118. + }
  119. +
  120. + return ret;
  121. + }
  122. +
  123. + public ArrayList<AuctionItem> getItems()
  124. + {
  125. + return _items;
  126. + }
  127. +
  128. + public int getNextAuctionId()
  129. + {
  130. + _maxId++;
  131. + return _maxId;
  132. + }
  133. +
  134. + private static class SingletonHolder
  135. + {
  136. + protected static final AuctionTable _instance = new AuctionTable();
  137. + }
  138. +}
  139. \ No newline at end of file
  140. Index: java/net/sf/l2j/gameserver/model/actor/instance/AuctionManager.java
  141. ===================================================================
  142. --- java/net/sf/l2j/gameserver/model/actor/instance/AuctionManager.java (revision 0)
  143. +++ java/net/sf/l2j/gameserver/model/actor/instance/AuctionManager.java (working copy)
  144. @@ -0,0 +1,466 @@
  145. +package net.sf.l2j.gameserver.model.actor.instance;
  146. +
  147. +import java.sql.Connection;
  148. +import java.sql.PreparedStatement;
  149. +import java.sql.SQLException;
  150. +import java.util.ArrayList;
  151. +import java.util.HashMap;
  152. +import java.util.List;
  153. +import java.util.Map;
  154. +
  155. +import net.sf.l2j.L2DatabaseFactory;
  156. +import net.sf.l2j.gameserver.data.ItemTable;
  157. +import net.sf.l2j.gameserver.data.sql.AuctionTable;
  158. +import net.sf.l2j.gameserver.idfactory.IdFactory;
  159. +import net.sf.l2j.gameserver.model.World;
  160. +import net.sf.l2j.gameserver.model.actor.Player;
  161. +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  162. +import net.sf.l2j.gameserver.model.entity.AuctionItem;
  163. +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  164. +import net.sf.l2j.gameserver.model.item.kind.Item;
  165. +import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
  166. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  167. +
  168. +/**
  169. + * @author An4rchy
  170. + *
  171. + */
  172. +public class AuctionManager extends Folk
  173. +{
  174. + public AuctionManager(int objectId, NpcTemplate template)
  175. + {
  176. + super(objectId, template);
  177. + }
  178. +
  179. + @Override
  180. + public void onBypassFeedback(Player player, String command)
  181. + {
  182. + if (command.startsWith("auction"))
  183. + {
  184. + try
  185. + {
  186. + String[] data = command.substring(8).split(" - ");
  187. + int page = Integer.parseInt(data[0]);
  188. + String search = data[1];
  189. + showAuction(player, page, search);
  190. + }
  191. + catch (Exception e)
  192. + {
  193. + showChatWindow(player);
  194. + player.sendMessage("Invalid input. Please try again.");
  195. + return;
  196. + }
  197. + }
  198. + else if (command.startsWith("buy"))
  199. + {
  200. + int auctionId = Integer.parseInt(command.substring(4));
  201. + AuctionItem item = AuctionTable.getInstance().getItem(auctionId);
  202. +
  203. + if (item == null)
  204. + {
  205. + showChatWindow(player);
  206. + player.sendMessage("Invalid choice. Please try again.");
  207. + return;
  208. + }
  209. +
  210. + if (player.getInventory().getItemByItemId(item.getCostId()) == null || player.getInventory().getItemByItemId(item.getCostId()).getCount() < item.getCostCount())
  211. + {
  212. + showChatWindow(player);
  213. + player.sendMessage("Incorrect item count.");
  214. + return;
  215. + }
  216. +
  217. + player.destroyItemByItemId("auction", item.getCostId(), item.getCostCount(), this, true);
  218. +
  219. + Player owner = World.getInstance().getPlayer(item.getOwnerId());
  220. + if (owner != null && owner.isOnline())
  221. + {
  222. + owner.addItem("auction", item.getCostId(), item.getCostCount(), null, true);
  223. + owner.sendMessage("You have sold an item in the Auction Shop.");
  224. + }
  225. + else
  226. + addItemToOffline(item.getOwnerId(), item.getCostId(), item.getCostCount());
  227. +
  228. + ItemInstance i = player.addItem("auction", item.getItemId(), item.getCount(), this, true);
  229. + i.setEnchantLevel(item.getEnchant());
  230. + player.sendPacket(new InventoryUpdate());
  231. + player.sendMessage("You have purchased an item from the Auction Shop.");
  232. +
  233. + AuctionTable.getInstance().deleteItem(item);
  234. +
  235. + showChatWindow(player);
  236. + }
  237. + else if (command.startsWith("addpanel"))
  238. + {
  239. + int page = Integer.parseInt(command.substring(9));
  240. +
  241. + showAddPanel(player, page);
  242. + }
  243. + else if (command.startsWith("additem"))
  244. + {
  245. + int itemId = Integer.parseInt(command.substring(8));
  246. +
  247. + if (player.getInventory().getItemByObjectId(itemId) == null)
  248. + {
  249. + showChatWindow(player);
  250. + player.sendMessage("Invalid item. Please try again.");
  251. + return;
  252. + }
  253. +
  254. + showAddPanel2(player, itemId);
  255. + }
  256. + else if (command.startsWith("addit2"))
  257. + {
  258. + try
  259. + {
  260. + String[] data = command.substring(7).split(" ");
  261. + int itemId = Integer.parseInt(data[0]);
  262. + String costitemtype = data[1];
  263. + int costCount = Integer.parseInt(data[2]);
  264. + int itemAmount = Integer.parseInt(data[3]);
  265. +
  266. + if (player.getInventory().getItemByObjectId(itemId) == null)
  267. + {
  268. + showChatWindow(player);
  269. + player.sendMessage("Invalid item. Please try again.");
  270. + return;
  271. + }
  272. + if (player.getInventory().getItemByObjectId(itemId).getCount() < itemAmount)
  273. + {
  274. + showChatWindow(player);
  275. + player.sendMessage("Invalid item. Please try again.");
  276. + return;
  277. + }
  278. + if (!player.getInventory().getItemByObjectId(itemId).isTradable())
  279. + {
  280. + showChatWindow(player);
  281. + player.sendMessage("Invalid item. Please try again.");
  282. + return;
  283. + }
  284. +
  285. + int costId = 0;
  286. + if (costitemtype.equals("Adena"))
  287. + costId = 57;
  288. +
  289. + AuctionTable.getInstance().addItem(new AuctionItem(AuctionTable.getInstance().getNextAuctionId(), player.getObjectId(), player.getInventory().getItemByObjectId(itemId).getItemId(), itemAmount, player.getInventory().getItemByObjectId(itemId).getEnchantLevel(), costId, costCount));
  290. +
  291. + player.destroyItem("auction", itemId, itemAmount, this, true);
  292. + player.sendPacket(new InventoryUpdate());
  293. + player.sendMessage("You have added an item for sale in the Auction Shop.");
  294. + showChatWindow(player);
  295. + }
  296. + catch (Exception e)
  297. + {
  298. + showChatWindow(player);
  299. + player.sendMessage("Invalid input. Please try again.");
  300. + return;
  301. + }
  302. + }
  303. + else if (command.startsWith("myitems"))
  304. + {
  305. + int page = Integer.parseInt(command.substring(8));
  306. + showMyItems(player, page);
  307. + }
  308. + else if (command.startsWith("remove"))
  309. + {
  310. + int auctionId = Integer.parseInt(command.substring(7));
  311. + AuctionItem item = AuctionTable.getInstance().getItem(auctionId);
  312. +
  313. + if (item == null)
  314. + {
  315. + showChatWindow(player);
  316. + player.sendMessage("Invalid choice. Please try again.");
  317. + return;
  318. + }
  319. +
  320. + AuctionTable.getInstance().deleteItem(item);
  321. +
  322. + ItemInstance i = player.addItem("auction", item.getItemId(), item.getCount(), this, true);
  323. + i.setEnchantLevel(item.getEnchant());
  324. + player.sendPacket(new InventoryUpdate());
  325. + player.sendMessage("You have removed an item from the Auction Shop.");
  326. + showChatWindow(player);
  327. + }
  328. + else
  329. + super.onBypassFeedback(player, command);
  330. + }
  331. +
  332. + private void showMyItems(Player player, int page)
  333. + {
  334. + Map<Integer, List<AuctionItem>> items = new HashMap<>();
  335. + int curr = 1;
  336. + int counter = 0;
  337. +
  338. + List<AuctionItem> temp = new ArrayList<>();
  339. + for (AuctionItem item : AuctionTable.getInstance().getItems())
  340. + {
  341. + if (item.getOwnerId() == player.getObjectId())
  342. + {
  343. + temp.add(item);
  344. +
  345. + counter++;
  346. +
  347. + if (counter == 10)
  348. + {
  349. + items.put(curr, temp);
  350. + temp = new ArrayList<>();
  351. + curr++;
  352. + counter = 0;
  353. + }
  354. + }
  355. + }
  356. + items.put(curr, temp);
  357. +
  358. + if (!items.containsKey(page))
  359. + {
  360. + showChatWindow(player);
  361. + player.sendMessage("Invalid page. Please try again.");
  362. + return;
  363. + }
  364. +
  365. + String html = "";
  366. + html += "<html><title>Auction Shop</title><body><center><br1>";
  367. + html += "<table width=310 bgcolor=000000 border=1>";
  368. + html += "<tr><td>Item</td><td>Cost</td><td></td></tr>";
  369. +
  370. + for (AuctionItem item : items.get(page))
  371. + {
  372. + html += "<tr>";
  373. + html += "<td><img src=\""+ ItemTable.getInstance().getTemplate(item.getItemId()).getIcon() + "\" width=32 height=32 align=center></td>";
  374. + html += "<td>Item: " + (item.getEnchant() > 0 ? "+"+item.getEnchant() + " " + ItemTable.getInstance().getTemplate(item.getItemId()).getName() + " - "+item.getCount() : ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount());
  375. + html += "<br1>Cost: "+item.getCostCount()+" "+ ItemTable.getInstance().getTemplate(item.getCostId()).getName();
  376. + html += "</td>";
  377. + html += "<td fixwidth=71><button value=\"Remove\" action=\"bypass -h npc_"+getObjectId()+"_remove "+item.getAuctionId()+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";
  378. + html += "</td></tr>";
  379. + }
  380. +
  381. + html += "</table><br><br>";
  382. +
  383. + html += "Page: "+page;
  384. + html += "<br1>";
  385. +
  386. + if (items.keySet().size() > 1)
  387. + {
  388. + if (page > 1)
  389. + html += "<a action=\"bypass -h npc_"+getObjectId()+"_myitems "+(page-1)+"\"><- Prev</a>";
  390. +
  391. + if (items.keySet().size() > page)
  392. + html += "<a action=\"bypass -h npc_"+getObjectId()+"_myitems "+(page+1)+"\">Next -></a>";
  393. + }
  394. +
  395. + html += "</center></body></html>";
  396. +
  397. + NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());
  398. + htm.setHtml(html);
  399. + player.sendPacket(htm);
  400. + }
  401. +
  402. + private void showAddPanel2(Player player, int itemId)
  403. + {
  404. + ItemInstance item = player.getInventory().getItemByObjectId(itemId);
  405. +
  406. + String html = "";
  407. + html += "<html><title>Auction Shop</title><body><center><br1>";
  408. + html += "<img src=\""+ ItemTable.getInstance().getTemplate(item.getItemId()).getIcon() +"\" width=32 height=32 align=center>";
  409. + html += "Item: "+(item.getEnchantLevel() > 0 ? "+"+item.getEnchantLevel()+" "+item.getName() : item.getName());
  410. +
  411. + if (item.isStackable())
  412. + {
  413. + html += "<br>Set amount of items to sell:";
  414. + html += "<edit var=amm type=number width=120 height=17>";
  415. + }
  416. +
  417. + html += "<br>Select price:";
  418. + html += "<br><combobox width=120 height=17 var=ebox list=Adena;>";
  419. + html += "<br><edit var=count type=number width=120 height=17>";
  420. + html += "<br><button value=\"Add item\" action=\"bypass -h npc_"+getObjectId()+"_addit2 "+itemId+" $ebox $count "+(item.isStackable() ? "$amm" : "1")+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";
  421. + html += "</center></body></html>";
  422. +
  423. + NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());
  424. + htm.setHtml(html);
  425. + player.sendPacket(htm);
  426. + }
  427. +
  428. + private void showAddPanel(Player player, int page)
  429. + {
  430. + Map<Integer, List<ItemInstance>> items = new HashMap<>();
  431. + int curr = 1;
  432. + int counter = 0;
  433. +
  434. + List<ItemInstance> temp = new ArrayList<>();
  435. + for (ItemInstance item : player.getInventory().getItems())
  436. + {
  437. + if (item.getItemId() != 57 && item.isTradable())
  438. + {
  439. + temp.add(item);
  440. +
  441. + counter++;
  442. +
  443. + if (counter == 10)
  444. + {
  445. + items.put(curr, temp);
  446. + temp = new ArrayList<>();
  447. + curr++;
  448. + counter = 0;
  449. + }
  450. + }
  451. + }
  452. + items.put(curr, temp);
  453. +
  454. + if (!items.containsKey(page))
  455. + {
  456. + showChatWindow(player);
  457. + player.sendMessage("Invalid page. Please try again.");
  458. + return;
  459. + }
  460. +
  461. + String html = "";
  462. + html += "<html><title>Auction Shop</title><body><center><br1>";
  463. + html += "Select item:";
  464. + html += "<br><table width=310 bgcolor=000000 border=1>";
  465. +
  466. + for (ItemInstance item : items.get(page))
  467. + {
  468. + html += "<tr>";
  469. + html += "<td>";
  470. + html += "<img src=\""+ ItemTable.getInstance().getTemplate(item.getItemId()).getIcon() +"\" width=32 height=32 align=center></td>";
  471. + html += "<td>"+(item.getEnchantLevel() > 0 ? "+"+item.getEnchantLevel()+" "+item.getName() : item.getName());
  472. + html += "</td>";
  473. + html += "<td><button value=\"Select\" action=\"bypass -h npc_"+getObjectId()+"_additem "+item.getObjectId()+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";
  474. + html += "</td>";
  475. + html += "</tr>";
  476. + }
  477. + html += "</table><br><br>";
  478. +
  479. + html += "Page: "+page;
  480. + html += "<br1>";
  481. +
  482. + if (items.keySet().size() > 1)
  483. + {
  484. + if (page > 1)
  485. + html += "<a action=\"bypass -h npc_"+getObjectId()+"_addpanel "+(page-1)+"\"><- Prev</a>";
  486. +
  487. + if (items.keySet().size() > page)
  488. + html += "<a action=\"bypass -h npc_"+getObjectId()+"_addpanel "+(page+1)+"\">Next -></a>";
  489. + }
  490. +
  491. + html += "</center></body></html>";
  492. +
  493. + NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());
  494. + htm.setHtml(html);
  495. + player.sendPacket(htm);
  496. + }
  497. +
  498. + private static void addItemToOffline(int owner_id, int item_id, int count)
  499. + {
  500. + Item item = ItemTable.getInstance().getTemplate(item_id);
  501. + int objectId = IdFactory.getInstance().getNextId();
  502. +
  503. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  504. + PreparedStatement statement = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
  505. + {
  506. + if (count > 1 && !item.isStackable())
  507. + return;
  508. +
  509. + statement.setInt(1, owner_id);
  510. + statement.setInt(2, item.getItemId());
  511. + statement.setInt(3, count);
  512. + statement.setString(4, "INVENTORY");
  513. + statement.setInt(5, 0);
  514. + statement.setInt(6, 0);
  515. + statement.setInt(7, objectId);
  516. + statement.setInt(8, 0);
  517. + statement.setInt(9, 0);
  518. + statement.setInt(10, -1);
  519. + statement.setLong(11, 0);
  520. + statement.executeUpdate();
  521. + }
  522. + catch (SQLException e)
  523. + {
  524. + LOGGER.info("Could not update item char: " + e);
  525. + }
  526. + }
  527. +
  528. + private void showAuction(Player player, int page, String search)
  529. + {
  530. + boolean src = !search.equals("*null*");
  531. +
  532. + HashMap<Integer, ArrayList<AuctionItem>> items = new HashMap<>();
  533. + int curr = 1;
  534. + int counter = 0;
  535. +
  536. + ArrayList<AuctionItem> temp = new ArrayList<>();
  537. + for (AuctionItem item : AuctionTable.getInstance().getItems())
  538. + {
  539. + if (item.getOwnerId() != player.getObjectId() && (!src || (src && ItemTable.getInstance().getTemplate(item.getItemId()).getName().contains(search))))
  540. + {
  541. + temp.add(item);
  542. +
  543. + counter++;
  544. +
  545. + if (counter == 10)
  546. + {
  547. + items.put(curr, temp);
  548. + temp = new ArrayList<>();
  549. + curr++;
  550. + counter = 0;
  551. + }
  552. + }
  553. + }
  554. + items.put(curr, temp);
  555. +
  556. + if (!items.containsKey(page))
  557. + {
  558. + showChatWindow(player);
  559. + player.sendMessage("Invalid page. Please try again.");
  560. + return;
  561. + }
  562. +
  563. + String html = "<html><title>Auction Shop</title><body><center><br1>";
  564. + html += "<multiedit var=srch width=150 height=20><br1>";
  565. + html += "<button value=\"Search\" action=\"bypass -h npc_"+getObjectId()+"_auction 1 - $srch\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";
  566. + html += "<br><table width=310 bgcolor=000000 border=1>";
  567. + html += "<tr><td>Item</td><td>Cost</td><td></td></tr>";
  568. + for (AuctionItem item : items.get(page))
  569. + {
  570. + html += "<tr>";
  571. + html += "<td><img src=\""+ ItemTable.getInstance().getTemplate(item.getItemId()).getIcon() +"\" width=32 height=32 align=center></td>";
  572. + html += "<td>Item: "+(item.getEnchant() > 0 ? "+"+item.getEnchant()+" "+ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount() : ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount());
  573. + html += "<br1>Cost: "+item.getCostCount()+" "+ItemTable.getInstance().getTemplate(item.getCostId()).getName();
  574. + html += "</td>";
  575. + html += "<td fixwidth=71><button value=\"Buy\" action=\"bypass -h npc_"+getObjectId()+"_buy "+item.getAuctionId()+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";
  576. + html += "</td></tr>";
  577. + }
  578. + html += "</table><br><br>";
  579. +
  580. + html += "Page: "+page;
  581. + html += "<br1>";
  582. +
  583. + if (items.keySet().size() > 1)
  584. + {
  585. + if (page > 1)
  586. + html += "<a action=\"bypass -h npc_"+getObjectId()+"_auction "+(page-1)+" - "+search+"\"><- Prev</a>";
  587. +
  588. + if (items.keySet().size() > page)
  589. + html += "<a action=\"bypass -h npc_"+getObjectId()+"_auction "+(page+1)+" - "+search+"\">Next -></a>";
  590. + }
  591. +
  592. + html += "</center></body></html>";
  593. +
  594. + NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());
  595. + htm.setHtml(html);
  596. + player.sendPacket(htm);
  597. + }
  598. +
  599. + @Override
  600. + public String getHtmlPath(int npcId, int val)
  601. + {
  602. + String pom = "";
  603. + if (val == 0)
  604. + pom = "" + npcId;
  605. + else
  606. + pom = npcId + "-" + val;
  607. +
  608. + return "data/html/auction/" + pom + ".htm";
  609. + }
  610. +}
  611. \ No newline at end of file
  612. Index: java/net/sf/l2j/gameserver/model/entity/AuctionItem.java
  613. ===================================================================
  614. --- java/net/sf/l2j/gameserver/model/entity/AuctionItem.java (revision 0)
  615. +++ java/net/sf/l2j/gameserver/model/entity/AuctionItem.java (working copy)
  616. @@ -0,0 +1,62 @@
  617. +package net.sf.l2j.gameserver.model.entity;
  618. +
  619. +/**
  620. + * @author An4rchy
  621. + *
  622. + */
  623. +public class AuctionItem
  624. +{
  625. + private int _auctionId;
  626. + private int _ownerId;
  627. + private int _itemId;
  628. + private int _count;
  629. + private int _enchant;
  630. + private int _costId;
  631. + private int _costCount;
  632. +
  633. + public AuctionItem(int auctionId, int ownerId, int itemId, int count, int enchant, int costId, int costCount)
  634. + {
  635. + _auctionId = auctionId;
  636. + _ownerId = ownerId;
  637. + _itemId = itemId;
  638. + _count = count;
  639. + _enchant = enchant;
  640. + _costId = costId;
  641. + _costCount = costCount;
  642. + }
  643. +
  644. + public int getAuctionId()
  645. + {
  646. + return _auctionId;
  647. + }
  648. +
  649. + public int getOwnerId()
  650. + {
  651. + return _ownerId;
  652. + }
  653. +
  654. + public int getItemId()
  655. + {
  656. + return _itemId;
  657. + }
  658. +
  659. + public int getCount()
  660. + {
  661. + return _count;
  662. + }
  663. +
  664. + public int getEnchant()
  665. + {
  666. + return _enchant;
  667. + }
  668. +
  669. + public int getCostId()
  670. + {
  671. + return _costId;
  672. + }
  673. +
  674. + public int getCostCount()
  675. + {
  676. + return _costCount;
  677. + }
  678. +}
  679. \ No newline at end of file
  680. Index: java/net/sf/l2j/gameserver/GameServer.java
  681. ===================================================================
  682. --- java/net/sf/l2j/gameserver/GameServer.java (revision 3)
  683. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  684. @@ -44,6 +44,7 @@
  685. import net.sf.l2j.gameserver.data.manager.RaidPointManager;
  686. import net.sf.l2j.gameserver.data.manager.SevenSignsManager;
  687. import net.sf.l2j.gameserver.data.manager.ZoneManager;
  688. +import net.sf.l2j.gameserver.data.sql.AuctionTable;
  689. import net.sf.l2j.gameserver.data.sql.AutoSpawnTable;
  690. import net.sf.l2j.gameserver.data.sql.BookmarkTable;
  691. import net.sf.l2j.gameserver.data.sql.ClanTable;
  692. @@ -154,6 +156,9 @@
  693. AnnouncementData.getInstance();
  694. ServerMemoTable.getInstance();
  695.  
  696. + StringUtil.printSection("Shoop");
  697. + AuctionTable.getInstance();
  698. +
  699. StringUtil.printSection("Skills");
  700. SkillTable.getInstance();
  701. SkillTreeData.getInstance();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement