Jump to content

Tachi

Members
  • Posts

    174
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Tachi

  1. Very insteresting you can check out and this one http://www.4shared.com/rar/5T1hoBbD/Item_Market_frozen_edit__.html

     

    Its pretty good give many options 

    Search Weapons,armors,jewerls,etc,misc,accessories,grades,D,C,B,A,S,no grades

    Allow player put item on sale,allow player to get the item from shop back when they want etc /// 

     

    I paste this not to flame you must check it out and maybe new ideas will come up ..

     

    BTW excelent code dude !! :)

     

    PS.Here is the post on mxc click me

    ty man i know this mod' and i think is nice to be online in many server's

     

    I think it's exciting that someone can change a weapon augmented for another augmented wepoan :)

  2. Hello guys, yesterday I saw on a server that mod, and ended up going to some research on it and found it, and there are people there selling this mod, beware! it's FREE !
    compatible system with frozen! 
     
    what mod do?
    you go on the npc, and "put your item for sale" the person who wants to buy go there on NPC, click on its entry and purchase the amount you put!
    
    coreside
    Index: com/l2jfrozen/gameserver/GameServer.java
    ===================================================================
    --- com/l2jfrozen/gameserver/GameServer.java (revisÆo 5307)
    +++ com/l2jfrozen/gameserver/GameServer.java (c¢pia de trabalho)
    @@ -42,6 +42,7 @@
     import com.l2jfrozen.gameserver.datatables.sql.HennaTable;
     
     import com.l2jfrozen.gameserver.datatables.sql.HennaTreeTable;
     
     import com.l2jfrozen.gameserver.datatables.sql.HeroSkillTable;
     
    +import com.l2jfrozen.gameserver.datatables.sql.ItemMarketTable;
     
     import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
     
     import com.l2jfrozen.gameserver.datatables.sql.LevelUpData;
     
     import com.l2jfrozen.gameserver.datatables.sql.NobleSkillTable;
     
     
    @@ -342,6 +343,7 @@
      
            CastleManorManager.getInstance();
      
            L2Manor.getInstance();
      
            AuctionManager.getInstance();
     
    +       ItemMarketTable.getInstance();
     
     
      Util.printSection("Olympiad");
     
      Olympiad.getInstance();
     
      Util.printSection("Dungeons");
     
     
    datapack
    Index: data/html/marketer/all.htm
    ===================================================================
    --- data/html/marketer/all.htm (revisÆo 0)
    +++ data/html/marketer/all.htm (revisÆo 0)
    @@ -0,0 +1,12 @@
    +<html><body>
    +Marketer:<br>
    +What kind of item grade?<br>
    +<a action="bypass -h npc_%objectId%_See 0">No Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 1">D Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 2">C Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 3">B Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 4">A Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 5">S Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 6">S80 Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 7">All Grades</a><br>
    +</body></html>
    Index: data/html/marketer/weapon.htm
    ===================================================================
    --- data/html/marketer/weapon.htm (revisÆo 0)
    +++ data/html/marketer/weapon.htm (revisÆo 0)
    @@ -0,0 +1,12 @@
    +<html><body>
    +Marketer:<br>
    +What kind of item grade?<br>
    +<a action="bypass -h npc_%objectId%_See 8">No Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 9">D Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 10">C Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 11">B Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 12">A Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 13">S Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 14">S80 Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 15">All Grades</a><br>
    +</body></html>
    Index: data/html/marketer/info.htm
    ===================================================================
    --- data/html/marketer/info.htm (revisÆo 0)
    +++ data/html/marketer/info.htm (revisÆo 0)
    @@ -0,0 +1,8 @@
    +<html><body>
    +Marketer:<br>
    +Well, the service I offer is very simple, you give a certain amount of an item and a price.
    +I will sell it for you in the entire world.
    +And the most important thing, it's for <font color="00FF00">free</font>! Whether will we someday charge a tax? Only Einhasad knows!
    +<br>
    +<a action="bypass -h npc_%objectId%_Main">Back.</a>
    +</body></html>
    Index: data/html/marketer/comfirm.htm
    ===================================================================
    --- data/html/marketer/comfirm.htm (revisÆo 0)
    +++ data/html/marketer/comfirm.htm (revisÆo 0)
    @@ -0,0 +1,13 @@
    +<html><body>
    +<table width=270><tr>
    +<td valign=top width=35><img src="%itemIcon%" width=32 height=32 align=left></td>
    +<td valign=top width=235>
    +<table border=0 width=100%>
    +<tr><td><font color="A2A0A2">Name:</font> <font color="B09878">%itemName%</font></td></tr>
    +<tr><td><font color="A2A0A2">Count:</font> <font color="B09878">%count%</font></td></tr>
    +<tr><td><font color="A2A0A2">Price:</font> <font color="B09878">%price%</font></td></tr>
    +<tr><td><button value="Comfirm" action="bypass -h npc_%objectId%_AddItem %itemObjId% %count% %iprice%" width=66 height=16 back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td></tr>
    +<tr><td><button value="Back" action="bypass -h npc_%objectId%_SelectItem %itemObjId%" width=66 height=16 back="L2UI.DefaultButton_click" fore="L2UI.DefaultButton"></td></tr>
    +</table></td>
    +</tr></table>
    +</body></html>
    \ No newline at end of file
    Index: data/html/marketer/shot.htm
    ===================================================================
    --- data/html/marketer/shot.htm (revisÆo 0)
    +++ data/html/marketer/shot.htm (revisÆo 0)
    @@ -0,0 +1,12 @@
    +<html><body>
    +Marketer:<br>
    +What kind of item grade?<br>
    +<a action="bypass -h npc_%objectId%_See 32">No Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 33">D Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 34">C Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 35">B Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 36">A Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 37">S Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 38">S80 Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 39">All Grades</a><br>
    +</body></html>
    Index: data/html/marketer/cash.htm
    ===================================================================
    --- data/html/marketer/cash.htm (revisÆo 0)
    +++ data/html/marketer/cash.htm (revisÆo 0)
    @@ -0,0 +1,5 @@
    +<html><body>
    +You have got %money% of Adena.<br>
    +<a action="bypass -h npc_%objectId%_Cash">Get the money.</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/deal.htm">Back.</a><br>
    +</body></html>
    Index: data/html/marketer/armor.htm
    ===================================================================
    --- data/html/marketer/armor.htm (revisÆo 0)
    +++ data/html/marketer/armor.htm (revisÆo 0)
    @@ -0,0 +1,12 @@
    +<html><body>
    +Marketer:<br>
    +What kind of item grade?<br>
    +<a action="bypass -h npc_%objectId%_See 16">No Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 17">D Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 18">C Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 19">B Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 20">A Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 21">S Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 22">S80 Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 23">All Grades</a><br>
    +</body></html>
    Index: data/html/marketer/other.htm
    ===================================================================
    --- data/html/marketer/other.htm (revisÆo 0)
    +++ data/html/marketer/other.htm (revisÆo 0)
    @@ -0,0 +1,12 @@
    +<html><body>
    +Marketer:<br>
    +What kind of item grade?<br>
    +<a action="bypass -h npc_%objectId%_See 48">No Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 49">D Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 50">C Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 51">B Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 52">A Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 53">S Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 54">S80 Grade</a><br>
    +<a action="bypass -h npc_%objectId%_See 55">All Grades</a><br>
    +</body></html>
    Index: data/html/marketer/main.htm
    ===================================================================
    --- data/html/marketer/main.htm (revisÆo 0)
    +++ data/html/marketer/main.htm (revisÆo 0)
    @@ -0,0 +1,8 @@
    +<html><body>
    +Marketer:<br>
    +Welcome adventurer! I am a marketer, people from all the world give me various items to sell.<br>
    +Are you interested?<br>
    +<a action="bypass -h npc_%objectId%_Link marketer/info.htm">Tell me more.</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/search.htm">Show me your items.</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/deal.htm">My Market.</a><br>
    +</body></html>
    Index: data/html/marketer/deal.htm
    ===================================================================
    --- data/html/marketer/deal.htm (revisÆo 0)
    +++ data/html/marketer/deal.htm (revisÆo 0)
    @@ -0,0 +1,7 @@
    +<html><body>
    +Marketer:<br>
    +So, how can I help you?<br>
    +<a action="bypass -h npc_%objectId%_ListInv">Add an item.</a><br>
    +<a action="bypass -h npc_%objectId%_Private">See My Items.</a><br>
    +<a action="bypass -h npc_%objectId%_SeeCash">My Cash.</a><br>
    +</body></html>
    Index: data/html/marketer/search.htm
    ===================================================================
    --- data/html/marketer/search.htm (revisÆo 0)
    +++ data/html/marketer/search.htm (revisÆo 0)
    @@ -0,0 +1,12 @@
    +<html><body>
    +Marketer:<br>
    +What kind of item would you like to see?<br>
    +<a action="bypass -h npc_%objectId%_Link marketer/weapon.htm">Weapons</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/armor.htm">Armor</a><br>
    +<a action="bypass -h npc_%objectId%_See 31">Recipe</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/shot.htm">Shots</a><br>
    +<a action="bypass -h npc_%objectId%_See 47">Spellbooks</a><br>
    +<a action="bypass -h npc_%objectId%_See 63">Material</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/other.htm">Other</a><br>
    +<a action="bypass -h npc_%objectId%_Link marketer/all.htm">All Items</a>
    +</body></html>
    Index: data/html/marketer/addItem.htm
    ===================================================================
    --- data/html/marketer/addItem.htm (revisÆo 0)
    +++ data/html/marketer/addItem.htm (revisÆo 0)
    @@ -0,0 +1,7 @@
    +<html><body>Enter Quantity:<br>
    +<edit var="count" width=110> Max of %aval%<br></td></tr>
    +Enter Price (for each item):<br>
    +<edit var="price" width=110><br></td></tr>
    +<tr><td><button value="Enter" action="bypass -h npc_%objectId%_ComfirmAdd %itemObjId% $count $price" width=80 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_ct1.button_df"><br>
    +<button value="Cancel" action="bypass -h npc_%objectId%_Link marketer/deal.htm" width=80 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_ct1.button_df">
    +</body></html>
    
    Add Item marketable Location:
    com.l2jfrozen.gameserver.data tables.sql
     
    /*
     * This program is free software: you can redistribute it and/or modify it under
     * the terms of the GNU General Public License as published by the Free Software
     * Foundation, either version 3 of the License, or (at your option) any later
     * version.
     * 
     * This program is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     * details.
     * 
     * You should have received a copy of the GNU General Public License along with
     * this program. If not, see <http://www.gnu.org/licenses/>.
     */
    package com.l2jfrozen.gameserver.datatables.sql;
     
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.Map;
    import java.util.List;
     
    import javolution.util.FastMap;
    import javolution.util.FastList;
    import java.util.logging.Logger;
     
    import com.l2jfrozen.util.database.L2DatabaseFactory;
    import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
    import com.l2jfrozen.gameserver.model.L2ItemMarketModel;
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
     
    public class ItemMarketTable {
     
    private static ItemMarketTable _instance = null;
    private Map<Integer, String> _itemIcons = null;
    private Map<Integer, List<L2ItemMarketModel>> _marketItems = null;
    private Map<Integer, Integer> _sellers = null;
    private static final Logger                             _log = Logger.getLogger(ItemMarketTable.class.getName());
    private ItemMarketTable() {
    }
     
    public static ItemMarketTable getInstance() {
    if (_instance == null) {
    _instance = new ItemMarketTable();
    _instance.load();
    }
    return _instance;
    }
     
    private void load() {
    _marketItems = new FastMap<Integer, List<L2ItemMarketModel>>();
    Connection con = null;
    int mrktCount = 0;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Select * From item_market Order By ownerId");
    ResultSet rset = statement.executeQuery();
     
    while (rset.next()) { 
    int ownerId = rset.getInt("ownerId");
    String ownerName = rset.getString("ownerName");
    int itemObjId = rset.getInt("itemObjId");
    int itemId = rset.getInt("itemId");
    String itemName = rset.getString("itemName");
    String itemType = rset.getString("itemType");
    String l2Type = rset.getString("l2Type");
    int itemGrade = rset.getInt("itemGrade");
    int enchLvl = rset.getInt("enchLvl");
    int count = rset.getInt("_count");
    int price = rset.getInt("price");
     
    L2ItemMarketModel mrktItem = new L2ItemMarketModel();
    mrktItem.setOwnerId(ownerId);
    mrktItem.setOwnerName(ownerName);
    mrktItem.setItemObjId(itemObjId);
    mrktItem.setItemId(itemId);
    mrktItem.setItemName(itemName);
    mrktItem.setItemType(itemType);
    mrktItem.setL2Type(l2Type);
    mrktItem.setItemGrade(itemGrade);
    mrktItem.setEnchLvl(enchLvl);
    mrktItem.setCount(count);
    mrktItem.setPrice(price);
    if (_marketItems.containsKey(ownerId)) {
    List<L2ItemMarketModel> list = _marketItems.get(ownerId);
    list.add(mrktItem);
    _marketItems.put(ownerId, list);
    } else {
    List<L2ItemMarketModel> list = new FastList<L2ItemMarketModel>();
    list.add(mrktItem);
    _marketItems.put(ownerId, list);
    }
    mrktCount++;
    }
     
    _log.finest("ItemMarketTable: Loaded "+mrktCount+" market items.");
     
    rset.close();
    statement.close();
    } catch (Exception e) {
    _log.warning("Error while loading market items " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    loadSellers();
    loadIcons();
    }
     
    private void loadSellers() {
    _sellers = new FastMap<Integer, Integer>();
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Select * From market_seller");
    ResultSet rset = statement.executeQuery();
     
    while(rset.next()) {
    int sellerId = rset.getInt("sellerId");
    int money = rset.getInt("money");
    _sellers.put(sellerId, money);
    }
     
    rset.close();
    statement.close();
    } catch(Exception e) {
    _log.warning("Error while loading market sellers " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
     
    private void loadIcons() {
    _itemIcons = new FastMap<Integer, String>();
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Select * From market_icons");
    ResultSet rset = statement.executeQuery();
     
    while(rset.next()) {
    int itemId = rset.getInt("itemId");
    String itemIcon = rset.getString("itemIcon");
    _itemIcons.put(itemId, itemIcon);
    }
     
    rset.close();
    statement.close();
    } catch(Exception e) {
    _log.warning("Error while loading market icons " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
     
    public void addItemToMarket(L2ItemMarketModel itemToMarket, L2PcInstance owner) {
    synchronized(this) {
    if (_marketItems != null && owner != null && itemToMarket != null) {
    List<L2ItemMarketModel> list = _marketItems.get(owner.getObjectId());
    if (list != null) {
    list.add(itemToMarket);
    _marketItems.put(owner.getObjectId(), list);
    } else {
    list = new FastList<L2ItemMarketModel>();
    list.add(itemToMarket);
    _marketItems.put(owner.getObjectId(), list);
    }
    ThreadPoolManager.getInstance().scheduleGeneral(new SaveTask(itemToMarket), 2000);
    }
    }
    }
     
    public void removeItemFromMarket(int ownerId, int itemObjId, int count) {
    L2ItemMarketModel mrktItem = getItem(itemObjId);
    List<L2ItemMarketModel> list = getItemsByOwnerId(ownerId);
    synchronized (this) {
    if (list != null && mrktItem != null && !list.isEmpty()) {
    if (mrktItem.getCount() == count) {
    list.remove(mrktItem);
    _marketItems.put(ownerId, list);
    ThreadPoolManager.getInstance().scheduleGeneral(new DeleteTask(mrktItem), 2000);
    } else {
    list.remove(mrktItem);
    mrktItem.setCount(mrktItem.getCount() - count);
    list.add(mrktItem);
    _marketItems.put(ownerId, list);
    ThreadPoolManager.getInstance().scheduleGeneral(new UpdateTask(mrktItem), 2000);
    }
    }
    }
    }
     
    public void addMoney(int sellerId, int money) {
    synchronized(this) {
    if (_sellers != null) {
    if (_sellers.containsKey(sellerId)) {
    int oldMoney = _sellers.get(sellerId);
    money += oldMoney;
    _sellers.put(sellerId, money);
    ThreadPoolManager.getInstance().scheduleGeneral(new AddMoneyTask(sellerId, money), 2000);
    } else {
    _sellers.put(sellerId, money);
    ThreadPoolManager.getInstance().scheduleGeneral(new AddSellerTask(sellerId, money), 2000);
    }
    }
    }
    }
     
    public int getMoney(int sellerId) {
    synchronized(this) {
    if (_sellers != null && !_sellers.isEmpty()) {
    if (_sellers.containsKey(sellerId)) {
    return _sellers.get(sellerId);
    } else {
    return 0;
    }
    }
    }
    return 0;
    }
     
    public void takeMoney(int sellerId, int amount) {
    synchronized(this) {
    if (_sellers != null && !_sellers.isEmpty()) {
    if (_sellers.containsKey(sellerId)) {
    int oldMoney = _sellers.get(sellerId);
    if (oldMoney >= amount) {
    oldMoney -= amount;
    _sellers.put(sellerId, oldMoney);
    ThreadPoolManager.getInstance().scheduleGeneral(new AddMoneyTask(sellerId, oldMoney), 2000);
    }
    }
    }
    }
    }
     
    public List<L2ItemMarketModel> getItemsByOwnerId(int ownerId) {
    synchronized(this) {
    if (_marketItems != null && !_marketItems.isEmpty()) {
    return _marketItems.get(ownerId);
    }
    }
    return null;
    }
     
    public L2ItemMarketModel getItem(int itemObjId) {
    List<L2ItemMarketModel> list = getAllItems();
    synchronized (this) {
    for (L2ItemMarketModel model : list) {
    if (model.getItemObjId() == itemObjId) {
    return model;
    }
    }
    }
    return null;
    }
     
    public List<L2ItemMarketModel> getAllItems() {
    synchronized(this) {
    if (_marketItems != null && !_marketItems.isEmpty()) {
    List<L2ItemMarketModel> list = new FastList<L2ItemMarketModel>();
    for (List<L2ItemMarketModel> lst : _marketItems.values()) {
    if (lst != null && !lst.isEmpty()) {
    for (L2ItemMarketModel auctItem : lst) {
    if (auctItem != null) {
    list.add(auctItem);
    }
    }
    }
    }
    return list;
    }
    }
    return null;
    }
     
    public String getItemIcon(int itemId) {
    if (_itemIcons != null && !_itemIcons.isEmpty()) {
    return _itemIcons.get(itemId);
    }
    return null;
    }
     
    private static class SaveTask implements Runnable {
     
    private final L2ItemMarketModel _marketItem;
    // private final static Log _log = LogFactory.getLog(SaveTask.class.getName());
     
    public SaveTask(L2ItemMarketModel marketItem) {
    this._marketItem = marketItem;
    }
     
    public void run() {
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Insert Into item_market Values (?,?,?,?,?,?,?,?,?,?,?)");
    statement.setInt(1, _marketItem.getOwnerId());
    statement.setString(2, _marketItem.getOwnerName());
    statement.setString(3, _marketItem.getItemName());
    statement.setInt(4, _marketItem.getEnchLvl());
    statement.setInt(5, _marketItem.getItemGrade());
    statement.setString(6, _marketItem.getL2Type());
    statement.setString(7, _marketItem.getItemType());
    statement.setInt(8, _marketItem.getItemId());
    statement.setInt(9, _marketItem.getItemObjId());
    statement.setInt(10, _marketItem.getCount());
    statement.setInt(11, _marketItem.getPrice());
    statement.execute();
    statement.close();
    } catch (Exception e) {
    _log.warning("Error while saving market item into DB " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
    }
     
    private static class DeleteTask implements Runnable {
     
    private final L2ItemMarketModel _marketItem;
    // private final static Log _log = LogFactory.getLog(DeleteTask.class.getName());
     
    public DeleteTask(L2ItemMarketModel marketItem) {
    this._marketItem = marketItem;
    }
     
    public void run() {
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Delete From item_market Where ownerId = ? AND itemObjId = ?");
    statement.setInt(1, _marketItem.getOwnerId());
    statement.setInt(2, _marketItem.getItemObjId());
    statement.execute();
    statement.close();
    } catch (Exception e) {
    _log.warning("Error while deleting market item from DB " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
    }
     
    private static class UpdateTask implements Runnable {
    private final L2ItemMarketModel _marketItem;
    // private final static Log _log = LogFactory.getLog(UpdateTask.class.getName());
     
    public UpdateTask(L2ItemMarketModel marketItem) {
    this._marketItem = marketItem;
    }
     
    public void run() {
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Update item_market Set _count = ? Where itemObjId = ? AND ownerId = ?");
    statement.setInt(1, _marketItem.getCount());
    statement.setInt(2, _marketItem.getItemObjId());
    statement.setInt(3, _marketItem.getOwnerId());
    statement.executeUpdate();
    statement.close();
    } catch (Exception e) {
    _log.warning("Error while updating market item in DB " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
    }
     
    private static class AddMoneyTask implements Runnable {
    private final int sellerId;
    private final int money;
     
    public AddMoneyTask(int sellerId, int money) {
    this.sellerId = sellerId;
    this.money = money;
    }
     
    public void run() {
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Update market_seller Set money = ? Where sellerId = ?");
    statement.setInt(1, money);
    statement.setInt(2, sellerId);
    statement.executeUpdate();
    statement.close();
    } catch (Exception e) {
    _log.warning("Error while adding money in DB " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
    }
     
    private static class AddSellerTask implements Runnable {
    private final int sellerId;
    private final int money;
     
    public AddSellerTask(int sellerId, int money) {
    this.sellerId = sellerId;
    this.money = money;
    }
     
    public void run() {
    Connection con = null;
    try {
    con = L2DatabaseFactory.getInstance().getConnection(false);
    PreparedStatement statement = con.prepareStatement("Insert Into market_seller(sellerId, money) Values (?,?)");
    statement.setInt(1, sellerId);
    statement.setInt(2, money);
    statement.executeUpdate();
    statement.close();
    } catch (Exception e) {
    _log.warning("Error while adding seller in DB " + e.getMessage());
    } finally {
    try {
    if (con != null) {
    con.close();
    }
    } catch (Exception e) {
    }
    }
    }
    }
    }
    
    Add L2ItemMarketerInstance the settlement:
    com.l2jfrozen.gameserver.model.actor.instance:
     
     
    /*
     * This program is free software: you can redistribute it and/or modify it under
     * the terms of the GNU General Public License as published by the Free Software
     * Foundation, either version 3 of the License, or (at your option) any later
     * version.
     *
     * This program is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     * details.
     *
     * You should have received a copy of the GNU General Public License along with
     * this program. If not, see <http://www.gnu.org/licenses/>.
     */
    package com.l2jfrozen.gameserver.model.actor.instance;
     
    import java.util.List;
    import java.util.StringTokenizer;
     
    import javolution.text.TextBuilder;
    import javolution.util.FastList;
     
    import com.l2jfrozen.gameserver.ai.CtrlIntention;
    import com.l2jfrozen.gameserver.datatables.sql.ItemMarketTable;
    import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
    import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
    import com.l2jfrozen.gameserver.model.L2ItemMarketModel;
    import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
    import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
    import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
    import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
    import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
    import com.l2jfrozen.gameserver.templates.L2EtcItemType;
    import com.l2jfrozen.gameserver.templates.L2WeaponType;
    import com.l2jfrozen.gameserver.util.Util;
     
    public class L2ItemMarketerInstance extends L2FolkInstance {
     
    private final int ITEMS_PER_PAGE = 4;
     
    //Pack Method : pack (L2_Type << 3) | Grade
    //Item L2 Type
    private final int ALL = 0x00;
    private final int WEAPON = 0x01;
    private final int ARMOR = 0x02;
    private final int RECIPE  = 0x03;
    private final int SHOTS  = 0x04;
    private final int BOOK  = 0x05;
    private final int OTHER  = 0x06;
    private final int MATERIAL = 0x07;
     
    //Item Grade
    private final int NO_G  = 0x00;
        private final int D_G  = 0x01;
    private final int C_G  = 0x02;
    private final int B_G  = 0x03;
    private final int A_G  = 0x04;
    private final int S_G  = 0x05;
    private final int S80_G = 0x06;
    private final int ALL_G = 0x07;
     
    public L2ItemMarketerInstance(int objectId, L2NpcTemplate template) {
            super(objectId, template);
        }
     
    @Override
    public void onAction(L2PcInstance player) {
    if (!canTarget(player)) {
    return;
    }
    // Check if the L2PcInstance already target the L2NpcInstance
    if (this != player.getTarget()) {
    // Set the target of the L2PcInstance player
    player.setTarget(this);
     
    // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
    MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
    player.sendPacket(my);
     
    // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client
    player.sendPacket(new ValidateLocation(this));
    } else {
    // Calculate the distance between the L2PcInstance and the L2NpcInstance
    if (!canInteract(player)) {
    // Notify the L2PcInstance AI with AI_INTENTION_INTERACT
    player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
    } else {
    showMsgWindow(player);
    }
    }
    // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
    player.sendPacket(ActionFailed.STATIC_PACKET);
    }
     
    @Override
        public void onBypassFeedback(L2PcInstance player, String command) {
    List<L2ItemMarketModel> list = null;
            StringTokenizer st = new StringTokenizer(command, " ");
            String actualCommand = st.nextToken();
    if ("Private".equalsIgnoreCase(actualCommand)) {
    list = getItemList(player);
    int pId = 0;
    if (st.hasMoreTokens()) {
    pId = new Integer(st.nextToken());
    }
    showPrivateItemList(list, pId, player);
    } else if ("See".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int bitmask = new Integer(st.nextToken());
    int pgId = 0;
    if (st.hasMoreTokens()) {
    pgId = new Integer(st.nextToken());
    }
    list = ItemMarketTable.getInstance().getAllItems();
    if (list != null) {
    list = filterItemType(bitmask, list);
    showItemList(list, pgId, player, bitmask);
    } else {
    sendMsg("There are no items for you", player);
    return;
    }
    }
    } else if ("BuyItem".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int itemObjId = Integer.parseInt(st.nextToken());
    if (st.hasMoreTokens()) {
    int count = new Integer(st.nextToken());
    buyItem(player, itemObjId, count);
    }
    }
    } else if ("AddItem".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int itemObjId = new Integer(st.nextToken());
    if (st.hasMoreTokens()) {
    int count = new Integer(st.nextToken());
    if (st.hasMoreTokens()) {
    int price = new Integer(st.nextToken());
    if (price <=0) {
    sendMsg("You can't sell an item for 0 or negative number.", player);
    return;
    }
    L2ItemInstance item = player.getInventory().getItemByObjectId(itemObjId);
    list = getItemList(player);
    if (canAddItem(item, count, list, player)) {
    player.destroyItem("Market Add", item.getObjectId(), count, null, true);
    addItem(player, item, count, price);
    } else {
    sendMsg("Unable to add item or incorret item count.", player);
    }
    }
    }
    }
    } else if ("ListInv".equalsIgnoreCase(actualCommand)) {
    int pageId = 0;
    if (st.hasMoreTokens()) {
    pageId = new Integer(st.nextToken());
    }
    showInvList(player, pageId);
    } else if ("ItemInfo".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int pgId = new Integer(st.nextToken());
    if (st.hasMoreTokens()) {
    int bitmask = new Integer(st.nextToken());
    if (st.hasMoreTokens()) {
    int itemObjId = new Integer(st.nextToken());
    L2ItemMarketModel mrktItem = ItemMarketTable.getInstance().getItem(itemObjId);
    if (mrktItem != null) {
    showItemInfo(mrktItem, bitmask, pgId, player);
    }
    }
    }
    }
    } else if ("Main".equalsIgnoreCase(actualCommand)) {
    showMsgWindow(player);
    } else if ("SelectItem".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int itemObjId = new Integer(st.nextToken());
    player.sendPacket(ActionFailed.STATIC_PACKET);
    String filename = "data/html/marketer/addItem.htm";
    NpcHtmlMessage html = new NpcHtmlMessage(1);
    html.setFile(filename);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    L2ItemInstance item = player.getInventory().getItemByObjectId(itemObjId);
    html.replace("%aval%", ""+item.getCount());
    html.replace("%itemObjId%", String.valueOf(itemObjId));
    player.sendPacket(html);
    }
    } else if ("ItemInfo2".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int pgId = new Integer(st.nextToken());
    if (st.hasMoreTokens()) {
    int itemObjId = new Integer(st.nextToken());
    L2ItemMarketModel mrktItem = ItemMarketTable.getInstance().getItem(itemObjId);
    if (mrktItem != null) {
    showItemInfo2(mrktItem, pgId, player);
    }
    }
    }
    } else if ("TakeItem".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int itemObjId = new Integer(st.nextToken());
    L2ItemMarketModel mrktItem = ItemMarketTable.getInstance().getItem(itemObjId);
    if (mrktItem != null && player.getObjectId() == mrktItem.getOwnerId()) {
    ItemMarketTable.getInstance().removeItemFromMarket(mrktItem.getOwnerId(), mrktItem.getItemObjId(), mrktItem.getCount());
    L2ItemInstance item = ItemTable.getInstance().createItem("Market Remove", mrktItem.getItemId(), mrktItem.getCount(), player);
    item.setEnchantLevel(mrktItem.getEnchLvl());
    player.getInventory().addItem("Market Buy", item, player, null);
    sendMsg(mrktItem.getItemName()+" removed succesfully.", player);
    }
    }
    } else if ("SeeCash".equalsIgnoreCase(actualCommand)) {
    player.sendPacket(ActionFailed.STATIC_PACKET);
    String filename = "data/html/marketer/cash.htm";
    NpcHtmlMessage html = new NpcHtmlMessage(1);
    html.setFile(filename);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    int money = ItemMarketTable.getInstance().getMoney(player.getObjectId());
    html.replace("%money%", Util.formatAdena(money));
    player.sendPacket(html);
    } else if ("Cash".equalsIgnoreCase(actualCommand)) {
    int amount = ItemMarketTable.getInstance().getMoney(player.getObjectId());
    ItemMarketTable.getInstance().takeMoney(player.getObjectId(), amount);
    player.getInventory().addAdena("Market Cash", amount, player, null);
    sendMsg("You've earned "+Util.formatAdena(amount)+" Gold Bar", player);
    } else if ("ComfirmAdd".equalsIgnoreCase(actualCommand)) {
    if (st.hasMoreTokens()) {
    int itemObjId = new Integer(st.nextToken());
    L2ItemInstance item = player.getInventory().getItemByObjectId(itemObjId);
    if (item == null) {
    return;
    }
     
    if (st.hasMoreTokens()) {
    int count = new Integer(st.nextToken());
    if (count <= 0 || item.getCount() < count) {
    sendMsg("Item count must be a valid value.", player);
    return;
    }
    if (st.hasMoreTokens()) {
    int price = new Integer(st.nextToken());
    if (price <= 0) {
    sendMsg("Price must be a valid value.", player);
    return;
    }
    player.sendPacket(ActionFailed.STATIC_PACKET);
    String filename = "data/html/marketer/comfirm.htm";
    NpcHtmlMessage html = new NpcHtmlMessage(1);
    html.setFile(filename);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    html.replace("%count%", ""+count);
    html.replace("%itemName%", item.getName()+" +"+item.getEnchantLevel());
    html.replace("%itemIcon%", getItemIcon(item.getItemId()));
    html.replace("%price%", Util.formatAdena(price));
    html.replace("%iprice%", Util.formatAdena(price));
    html.replace("%itemObjId%", ""+itemObjId);
    player.sendPacket(html);
    }
    }
    }
    }
    super.onBypassFeedback(player, command);
        }
     
    private void showMsgWindow(L2PcInstance player) {
    player.sendPacket(ActionFailed.STATIC_PACKET);
    String filename = "data/html/marketer/main.htm";
    NpcHtmlMessage html = new NpcHtmlMessage(1);
    html.setFile(filename);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    player.sendPacket(html);
    }
     
    private void addItem(L2PcInstance player, L2ItemInstance item, int count, int price) {
    L2ItemMarketModel itemModel = new L2ItemMarketModel();
    itemModel.setOwnerId(player.getObjectId());
    itemModel.setOwnerName(player.getName());
    itemModel.setItemObjId(item.getObjectId());
    itemModel.setItemId(item.getItemId());
    itemModel.setPrice(price);
    itemModel.setCount(count);
    itemModel.setItemType(item.getItem().getItemType().toString());
    itemModel.setEnchLvl(item.getEnchantLevel());
    if (itemModel.getEnchLvl() > 0) {
    itemModel.setItemName(item.getItemName()+" +"+itemModel.getEnchLvl());
    } else {
    itemModel.setItemName(item.getItemName());
    }
    itemModel.setItemGrade(item.getItem().getCrystalType());
    if (item.isEquipable()) {
    if (item.getItemType() == L2WeaponType.NONE) {
    itemModel.setL2Type("Armor");
    } else {
    itemModel.setL2Type("Weapon");
    }
     
    } else if (item.isEquipable()) {
    itemModel.setL2Type("Armor");
    } else {
    if (item.getItemType() == L2EtcItemType.MATERIAL) {
    itemModel.setL2Type("Material");
    } else if (item.getItemType() == L2EtcItemType.RECEIPE) {
    itemModel.setL2Type("Recipe");
    } else if (item.getItemType() == L2EtcItemType.SPELLBOOK) {
    itemModel.setL2Type("Spellbook");
    } else if (item.getItemType() == L2EtcItemType.SHOT) {
    itemModel.setL2Type("Shot");
    } else {
    itemModel.setL2Type("Other");
    }
    }
    ItemMarketTable.getInstance().addItemToMarket(itemModel, player);
    sendMsg("You added "+count+" <font color=\"LEVEL\">"+item.getItemName()+"</font>.", player);
    }
     
    private boolean canAddItem(L2ItemInstance item, int count, List<L2ItemMarketModel> list, L2PcInstance activeChar) {
    if (activeChar != null && activeChar.getActiveTradeList() != null) {
    return false;
    }
    if (activeChar != null && activeChar.isProcessingTransaction()) {
    return false;
    }
    if (list != null && !list.isEmpty()) {
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemId() == item.getItemId()) {
    return false;
    }
    }
    }
    }
     
    return (item.getItemType() != L2EtcItemType.HERB && item.getCount() >= count && item.getItem().getDuration() == -1 && item.getItemId() != 3470 && item.isTradeable() && !item.isEquipped() && !item.isAugmented());
    }
     
    private boolean canAddItem(L2ItemInstance item) {
    return canAddItem(item, 0, null, null);
    }
     
    private String getItemIcon(int itemId) {
    return "Icon." + ItemMarketTable.getInstance().getItemIcon(itemId);
    }
     
    private List<L2ItemMarketModel> getItemList(L2PcInstance player) {
    return ItemMarketTable.getInstance().getItemsByOwnerId(player.getObjectId());
    }
     
    private void buyItem(L2PcInstance player, int itemObjId, int count) {
         L2ItemMarketModel mrktItem = ItemMarketTable.getInstance().getItem(itemObjId);
         if (mrktItem != null && mrktItem.getCount() >= count && (count > 0)) { 
    L2ItemInstance adena = player.getInventory().getItemByItemId(3470);
    if (adena.getCount() >= (mrktItem.getPrice() * count)) {
    int itemId  = mrktItem.getItemId();
    int price = mrktItem.getPrice() * count;
    ItemMarketTable.getInstance().removeItemFromMarket(mrktItem.getOwnerId(), mrktItem.getItemObjId(), count);
    player.destroyItem("Market Buy", adena.getObjectId(), price, null, true);
    ItemMarketTable.getInstance().addMoney(mrktItem.getOwnerId(), price);
    L2ItemInstance item = ItemTable.getInstance().createItem("Market Buy", itemId, count, player);
    item.setEnchantLevel(mrktItem.getEnchLvl());
    player.getInventory().addItem("Market Buy", item, player, null);
    sendMsg("You bought "+count+" <font color=\"LEVEL\">"+mrktItem.getItemName()+"</font>.", player);
    return;
    }
    sendMsg("You don't have enought Gold Bars.", player);
    return;
    }
    sendMsg("Incorrect item count.", player);
    }
     
    private List<L2ItemMarketModel> filterItemType(int mask, List<L2ItemMarketModel> list) {
    List<L2ItemMarketModel> mrktList = new FastList<L2ItemMarketModel>();
    int itype = mask >> 3;
    switch(itype) {
    case ALL:
    return filterItemGrade(mask, list);
    case WEAPON:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Weapon")) {
    mrktList.add(model);
    }
    }
    }
    return filterItemGrade(mask, mrktList);
    case ARMOR:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Armor")) {
    mrktList.add(model);
    }
    }
    }
    return filterItemGrade(mask, mrktList);
    case RECIPE:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Recipe")) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case BOOK:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Spellbook")) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case SHOTS:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Shot")) {
    mrktList.add(model);
    }
    }
    }
    return filterItemGrade(mask, mrktList);
    case OTHER:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Other")) {
    mrktList.add(model);
    }
    }
    }
    return filterItemGrade(mask, mrktList);
    case MATERIAL:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getL2Type().equalsIgnoreCase("Material")) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    }
     
    return filterItemGrade(mask, list);
    }
     
    private List<L2ItemMarketModel> filterItemGrade(int mask, List<L2ItemMarketModel> list) {
    List<L2ItemMarketModel> mrktList = new FastList<L2ItemMarketModel>();
    int igrade = mask & 7;
    switch(igrade) {
    case ALL_G:
    return list;
    case NO_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == NO_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case D_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == D_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case C_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == C_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case B_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == B_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case A_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == A_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case S_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == S_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    case S80_G:
    for (L2ItemMarketModel model : list) {
    if (model != null) {
    if (model.getItemGrade() == S80_G) {
    mrktList.add(model);
    }
    }
    }
    return mrktList;
    }
    return list;
    }
     
    private List<L2ItemInstance> filterInventory(L2ItemInstance[] inv) {
    List<L2ItemInstance> filteredInventory = new FastList<L2ItemInstance>();
    for(L2ItemInstance item : inv) {
    if (canAddItem(item)) {
    filteredInventory.add(item);
    }
    }
    return filteredInventory;
    }
     
    private List<L2ItemMarketModel> filterList(List<L2ItemMarketModel> list, L2PcInstance player) {
    List<L2ItemMarketModel> filteredList = new FastList<L2ItemMarketModel>();
    if (!list.isEmpty()) {
    for(L2ItemMarketModel model : list) {
    if (model != null && model.getOwnerId() != player.getObjectId()) {
    filteredList.add(model);
    }
    }
    }
    return filteredList;
    }
     
    private void showInvList(L2PcInstance player, int pageId) {
    int itemsOnPage = ITEMS_PER_PAGE;
    List<L2ItemInstance> list = filterInventory(player.getInventory().getItems());
    int pages = list.size() / itemsOnPage;
    if (list.isEmpty()) {
    sendMsg("Your inventory is empty.", player);
    return;
    }
    if (list.size() > pages * itemsOnPage) {
    pages++;
    }
    if (pageId > pages) { 
    pageId = pages;
    }
    int itemStart = pageId * itemsOnPage;
    int itemEnd = list.size();
    if (itemEnd - itemStart > itemsOnPage) {
    itemEnd = itemStart + itemsOnPage;
    }
    NpcHtmlMessage npcReply = new NpcHtmlMessage(1);
    TextBuilder reply = new TextBuilder("<html><body>");
    reply.append("<center>Items in Inventory</center>");
    reply.append("<img src=\"L2UI.SquareWhite\" width=270 height=1> <img src=\"L2UI.SquareBlank\" width=1 height=3>");
    reply.append("<table width=270><tr>");
    reply.append("<td width=66><button value=\"Back\" action=\"bypass -h npc_"+getObjectId()+((pageId==0)?"_Main ":"_ListInv ")+(pageId-1)+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td>");
    reply.append("<td width=138></td>");
    reply.append("<td width=66>"+((pageId+1<pages)?"<button value=\"Next\" action=\"bypass -h npc_"+getObjectId()+"_ListInv "+(pageId+1)+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">":"")+"</td>");
    reply.append("</tr></table>");
    reply.append("<br>");
    for (int i = itemStart; i < itemEnd; i++) {
    L2ItemInstance item = list.get(i);
    if (item == null) {
    continue;
    }
     
    String itemIcon = getItemIcon(item.getItemId());
    reply.append("<br>");
    reply.append("<table width=270><tr>");
    reply.append("<td valign=top width=35><button value=\"\" action=\"bypass -h npc_"+getObjectId()+"_SelectItem "+item.getObjectId()+"\" width=32 height=32 back=\""+itemIcon +"\" fore=\""+itemIcon +"\"></td>");
    reply.append("<td valign=top width=235>");
    reply.append("<table border=0 width=100%>");
    reply.append("<tr><td><font color=\"A2A0A2\">"+item.getItemName()+" +"+item.getEnchantLevel()+"</font></td></tr>");
    reply.append("<tr><td><font color=\"A2A0A2\">Quantity:</font> <font color=\"B09878\">"+item.getCount()+"</font></td></tr></table></td>");
    reply.append("</tr></table>");
    reply.append("<br>");
    }
    reply.append("</body></html>");
    npcReply.setHtml(reply.toString());
    player.sendPacket(npcReply);
    }
     
    private void showItemList(List<L2ItemMarketModel> list, int pageId, L2PcInstance player, int mask) {
    int itemsOnPage = ITEMS_PER_PAGE;
    list = filterList(list, player);
    if (list.isEmpty()) {
    sendMsg("There are no items for you", player);
    return;
    }
    int pages = list.size() / itemsOnPage;
    if (list.size() > pages * itemsOnPage) {
    pages++;
    }
    if (pageId > pages) { 
    pageId = pages;
    }
    int itemStart = pageId * itemsOnPage;
    int itemEnd = list.size();
    if (itemEnd - itemStart > itemsOnPage) {
    itemEnd = itemStart + itemsOnPage;
    }
    NpcHtmlMessage npcReply = new NpcHtmlMessage(1);
    TextBuilder reply = new TextBuilder("<html><body>");
    reply.append("<center>Market</center>");
    reply.append("<img src=\"L2UI.SquareWhite\" width=270 height=1> <img src=\"L2UI.SquareBlank\" width=1 height=3>");
    reply.append("<table width=270><tr>");
    reply.append("<td width=66><button value=\"Back\" action=\"bypass -h npc_"+getObjectId()+((pageId==0)?"_Main ":"_See ")+mask+" "+(pageId-1)+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td>");
    reply.append("<td width=138></td>");
    reply.append("<td width=66>"+((pageId+1<pages)?"<button value=\"Next\" action=\"bypass -h npc_"+getObjectId()+"_See "+mask+" "+(pageId+1)+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">":"")+"</td>");
    reply.append("</tr></table>");
    reply.append("<br>");
     
    for (int i = itemStart; i < itemEnd; i++) {
    L2ItemMarketModel mrktItem = list.get(i);
    if (mrktItem == null) {
    continue;
    }
     
    if (mrktItem.getOwnerId() == player.getObjectId()) {
    continue;
    }
     
    int _price = mrktItem.getPrice();
    if (_price == 0) {
    continue;
    }
     
    int _grade = mrktItem.getItemGrade();
    String itemIcon = getItemIcon(mrktItem.getItemId());
    reply.append("<br>");
    reply.append("<table width=270><tr>");
    reply.append("<td valign=top width=35><button value=\"\" action=\"bypass -h npc_"+getObjectId()+"_ItemInfo "+pageId+" "+mask+" "+mrktItem.getItemObjId()+"\" width=32 height=32 back=\""+itemIcon +"\" fore=\""+itemIcon +"\"></td>");
    reply.append("<td valign=top width=235>");
    reply.append("<table border=0 width=100%>");
    reply.append("<tr><td><font color=\"A2A0A2\">"+mrktItem.getItemName()+"["+mrktItem.getCount()+"]"+"</font></td></tr>");
    if ((mask & 7) == ALL_G) {
    reply.append("<tr><td><font color=\"A2A0A2\">"+"Grade:"+getGrade(mrktItem.getItemGrade())+"</font></td></tr>");
    }
    reply.append("<tr><td><font color=\"A2A0A2\">Price:</font> <font color=\"B09878\">"+Util.formatAdena(mrktItem.getPrice())+"</font></td></tr></table></td>");
    reply.append("</tr></table>");
    reply.append("<br>");
    }
     
    reply.append("</body></html>");
    npcReply.setHtml(reply.toString());
    player.sendPacket(npcReply);
    }
     
    private void showItemInfo(L2ItemMarketModel mrktItem, int mask, int pageId, L2PcInstance player) {
    NpcHtmlMessage npcReply = new NpcHtmlMessage(1);
    TextBuilder reply = new TextBuilder("<html><body>");
    reply.append("<center>Info</center>");
    reply.append("<img src=\"L2UI.SquareWhite\" width=270 height=1> <img src=\"L2UI.SquareBlank\" width=1 height=3>");
    reply.append("<table width=270><tr>");
    reply.append("<td width=66><button value=\"Back\" action=\"bypass -h npc_"+getObjectId()+"_See "+mask+" "+pageId+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td>");
    reply.append("<td width=138></td>");
    reply.append("</tr></table>");
    reply.append("<br>");
    reply.append("<table width=270><tr>");
    reply.append("<td valign=top width=35><img src="+getItemIcon(mrktItem.getItemId())+" width=32 height=32 align=left></td>");
    reply.append("<td valign=top width=235>");
    reply.append("<table border=0 width=100%>");
    reply.append("<tr><td><font color=\"A2A0A2\">Name:</font> <font color=\"B09878\">"+mrktItem.getItemName()+"</font><font color=\"A2A0A2\">[<font color=\"B09878\">"+mrktItem.getCount()+"</font>]</td></tr>");
    reply.append("<tr><td><font color=\"A2A0A2\">Price:</font> <font color=\"B09878\">"+Util.formatAdena(mrktItem.getPrice())+"</font><font color=\"A2A0A2\">     Seller:</font> <font color=\"B09878\">"+mrktItem.getOwnerName()+"</font></td></tr>");
    reply.append("<tr><td><edit var=\"count\" width=110></td></tr>");
    reply.append("<tr><td><button value=\"Buy\" action=\"bypass -h npc_"+getObjectId()+"_BuyItem "+mrktItem.getItemObjId()+" $count\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td></tr></table></td>");
    reply.append("</tr></table>");
    reply.append("</body></html>");
    npcReply.setHtml(reply.toString());
    player.sendPacket(npcReply);
    }
     
    private void showPrivateItemList(List<L2ItemMarketModel> list, int pageId, L2PcInstance player) {
    int itemsOnPage = ITEMS_PER_PAGE;
    if (list == null || list.isEmpty()) {
    sendMsg("There are no items for you", player);
    return;
    }
    int pages = list.size() / itemsOnPage;
    if (list.size() > pages * itemsOnPage) {
    pages++;
    }
    if (pageId > pages) { 
    pageId = pages;
    }
    int itemStart = pageId * itemsOnPage;
    int itemEnd = list.size();
    if (itemEnd - itemStart > itemsOnPage) {
    itemEnd = itemStart + itemsOnPage;
    }
    NpcHtmlMessage npcReply = new NpcHtmlMessage(1);
    TextBuilder reply = new TextBuilder("<html><body>");
    reply.append("<center>Private</center>");
    reply.append("<img src=\"L2UI.SquareWhite\" width=270 height=1> <img src=\"L2UI.SquareBlank\" width=1 height=3>");
    reply.append("<table width=270><tr>");
    reply.append("<td width=66><button value=\"Back\" action=\"bypass -h npc_"+getObjectId()+((pageId==0)?"_Main ":"_Private ")+(pageId-1)+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td>");
    reply.append("<td width=138></td>");
    reply.append("<td width=66>"+((pageId+1<pages)?"<button value=\"Next\" action=\"bypass -h npc_"+getObjectId()+"_Private "+(pageId+1)+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">":"")+"</td>");
    reply.append("</tr></table>");
    reply.append("<br>");
     
    for (int i = itemStart; i < itemEnd; i++) {
    L2ItemMarketModel mrktItem = list.get(i);
    if (mrktItem == null) {
    continue;
    }
     
    int _price = mrktItem.getPrice();
    if (_price == 0) {
    continue;
    }
     
    String itemIcon = getItemIcon(mrktItem.getItemId());
    reply.append("<br>");
    reply.append("<table width=270><tr>");
    reply.append("<td valign=top width=35><button value=\"\" action=\"bypass -h npc_"+getObjectId()+"_ItemInfo2 "+pageId+" "+mrktItem.getItemObjId()+"\" width=32 height=32 back=\""+itemIcon +"\" fore=\""+itemIcon +"\"></td>");
    reply.append("<td valign=top width=235>");
    reply.append("<table border=0 width=100%>");
    reply.append("<tr><td><font color=\"A2A0A2\">"+mrktItem.getItemName()+"["+mrktItem.getCount()+"]"+"</font></td></tr>");
    reply.append("<tr><td><font color=\"A2A0A2\">Price:</font> <font color=\"B09878\">"+Util.formatAdena(mrktItem.getPrice())+"</font></td></tr></table></td>");
    reply.append("</tr></table>");
    reply.append("<br>");
    }
     
    reply.append("</body></html>");
    npcReply.setHtml(reply.toString());
    player.sendPacket(npcReply);
    }
     
    private void sendMsg(String message, L2PcInstance player) {
    player.sendPacket(ActionFailed.STATIC_PACKET);
    NpcHtmlMessage npcReply = new NpcHtmlMessage(1);
    TextBuilder reply = new TextBuilder("<html><body>");
    reply.append(message);
    reply.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_Main\">Back</a>");
    reply.append("</body></html>");
    npcReply.setHtml(reply.toString());
    player.sendPacket(npcReply);
    }
     
    private void showItemInfo2(L2ItemMarketModel mrktItem, int pageId, L2PcInstance player) {
    NpcHtmlMessage npcReply = new NpcHtmlMessage(1);
    TextBuilder reply = new TextBuilder("<html><body>");
    reply.append("<center>Info</center>");
    reply.append("<img src=\"L2UI.SquareWhite\" width=270 height=1> <img src=\"L2UI.SquareBlank\" width=1 height=3>");
    reply.append("<table width=270><tr>");
    reply.append("<td width=66><button value=\"Back\" action=\"bypass -h npc_"+getObjectId()+"_Private "+pageId+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td>");
    reply.append("<td width=138></td>");
    reply.append("</tr></table>");
    reply.append("<br>");
    reply.append("<table width=270><tr>");
    reply.append("<td valign=top width=35><img src="+getItemIcon(mrktItem.getItemId())+" width=32 height=32 align=left></td>");
    reply.append("<td valign=top width=235>");
    reply.append("<table border=0 width=100%>");
    reply.append("<tr><td><font color=\"A2A0A2\">Name:</font> <font color=\"B09878\">"+mrktItem.getItemName()+"</font><font color=\"A2A0A2\">[<font color=\"B09878\">"+mrktItem.getCount()+"</font>]</td></tr>");
    reply.append("<tr><td><font color=\"A2A0A2\">Price:</font> <font color=\"B09878\">"+Util.formatAdena(mrktItem.getPrice())+"</font><font color=\"A2A0A2\"></td></tr>");
    reply.append("<tr><td><button value=\"Remove\" action=\"bypass -h npc_"+getObjectId()+"_TakeItem "+mrktItem.getItemObjId()+"\" width=66 height=16 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"></td></tr></table></td>");
    reply.append("</tr></table>");
    reply.append("</body></html>");
    npcReply.setHtml(reply.toString());
    player.sendPacket(npcReply);
    }
     
    private String getGrade(int grade) {
    switch(grade) {
    case D_G:
    return "D Grade";
    case C_G:
    return "C Grade";
    case B_G:
    return "B Grade";
    case A_G:
    return "A Grade";
    case S_G:
    return "S Grade";
    case S80_G:
    return "S80 Grade";
    default:
    return "No Grade";
    }
    }
    }
    
    Add L2ItemMarketModel the settlement:
    com.l2jfrozen.gameserver.model:
     
     
    /*
     * This program is free software: you can redistribute it and/or modify it under
     * the terms of the GNU General Public License as published by the Free Software
     * Foundation, either version 3 of the License, or (at your option) any later
     * version.
     * 
     * This program is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     * details.
     * 
     * You should have received a copy of the GNU General Public License along with
     * this program. If not, see <http://www.gnu.org/licenses/>.
     */
    package com.l2jfrozen.gameserver.model;
     
    public class L2ItemMarketModel {
     
    private int ownerId;
    private int enchLvl;
    private int itemId;
    private int itemGrade;
    private int itemObjId;
    private int price;
    private int count;
    private String ownerName = null;
    private String itemName = null;
    private String itemType = null;
    private String l2Type = null;
     
    public void setOwnerId(int ownerId) {
    this.ownerId = ownerId;
    }
     
    public void setOwnerName(String ownerName) {
    this.ownerName = ownerName;
    }
     
    public void setItemId(int itemId) {
    this.itemId = itemId;
    }
     
    public void setItemObjId(int itemObjId) {
    this.itemObjId = itemObjId;
    }
     
    public void setItemName(String itemName) {
    this.itemName = itemName;
    }
     
    public void setEnchLvl(int enchLvl) {
    this.enchLvl = enchLvl;
    }
     
    public void setItemGrade(int itemGrade) {
    this.itemGrade = itemGrade;
    }
     
    public void setItemType(String itemType) {
    this.itemType = itemType;
    }
     
    public void setL2Type(String l2Type) {
    this.l2Type = l2Type;
    }
     
    public void setPrice(int price) {
    this.price = price;
    }
     
    public void setCount(int count) {
    this.count = count;
    }
     
    public int getOwnerId() {
    return ownerId;
    }
     
    public String getOwnerName() {
    return ownerName;
    }
     
    public int getItemId() {
    return itemId;
    }
     
    public int getItemObjId() {
    return itemObjId;
    }
     
    public String getItemName() {
    return itemName;
    }
     
    public int getEnchLvl() {
    return enchLvl;
    }
     
    public int getItemGrade() {
    return itemGrade;
    }
     
    public String getItemType() {
    return itemType;
    }
     
    public String getL2Type() {
    return l2Type;
    }
     
    public int getPrice() {
    return price;
    }
     
    public int getCount() {
    return count;
    }
     
    } 
    

    Sql part:

     

    http://www.mediafire.com/download/k57kshzbh2nxuk3/market.sql

     

     

    let's not forget that when you create the npc with the type:

      ~ ~ L2ItemMarketer ok?
     
    credits: U3 Games (. He was told by our friend the topics below thank have researched on it.)

     

    Some pic:

     

     

     

     

    http://www.mediafire.com/convkey/cc0e/vjt15wmdm88s8gozg.jpg?size_id=7

    http://www.mediafire.com/convkey/6dab/s3sc6b314mjwimbzg.jpg?size_id=7

    http://www.mediafire.com/convkey/06cd/6axbioj2lva74qrzg.jpg?size_id=7

    http://www.mediafire.com/convkey/969c/nzntdetjtnmk6z1zg.jpg?size_id=7

  3. package custom.PartyTeleporter;
    import net.sf.l2j.gameserver.cache.HtmCache;
    import net.sf.l2j.gameserver.datatables.ItemTable;
    import net.sf.l2j.gameserver.instancemanager.ZoneManager;
    import net.sf.l2j.gameserver.model.L2Party;
    import net.sf.l2j.gameserver.model.actor.L2Character;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.quest.Quest;
    import net.sf.l2j.gameserver.model.zone.L2ZoneType;
    import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
    import net.sf.l2j.gameserver.network.serverpackets.ItemList;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
    
    /**
     * @author `Heroin
     * Made For Maxcheaters.com
     * PartyTeleporter
     */
    public class PartyTeleporter extends Quest
    {
    	private static final int npcid = 36650; // npc id
    	//-------------------------------------
    	//Teleport Location Coordinates X,Y,Z.
    	//Use /loc command in game to find them.
    	private static final int locationX = -56742; // npc id
    	private static final int locationY = 140569; // npc id
    	private static final int locationZ = -2625; // npc id
    	//-------------------------------------
    	//-------------------------------------
    	// Select the id of your zone.
    	// If you dont know how to find your zone id is simple.
    	// Go to data/zones/(your zone file).xml and find your zone
    	// E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
    	/**The id of your zone is id="6" */
    	/**---------------------------------------------------------------------------*/
    	/**WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self*/ // required to calculate parties & players
    	/**---------------------------------------------------------------------------*/
    	private static final int ZoneId = 155; //Here you have to set your zone Id
    	//-------------------------------------
    	private static final int MinPtMembers = 2; // Minimum Party Members Count For Enter on Zone.
    	private static final int ItemConsumeId = 57; // Item Consume id.
    	private static final int ItemConsumeNum = 100; // Item Consume Am.ount.
    	private static final boolean ShowPlayersInside = true; //If you set it true, NPC will show how many players are inside area.
    	private static final boolean ShowPartiesInside = true; //If you set it true, NPC will show how many parties are inside area.
    	//-------------------------------------
    	private static String htm = "data/scripts/custom/PartyTeleporter/1.htm"; //html location.
    	private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName(); //Item name, Dont Change this
    
    	
    	public PartyTeleporter(int questId, String name, String descr)
    	{
    		super(questId, name, descr);
    		addFirstTalkId(npcid);
    		addTalkId(npcid);
    		addStartNpc(npcid);
    	}
    	
    	@Override
    	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    	{
    		if (event.startsWith("partytp"))
    		{
    			TP(event, npc, player, event);
    		}
    
    		return "";
    	}
    	@SuppressWarnings("deprecation")
    	public int getPartiesInside(int zoneId)//Calculating parties inside party area.
        {
            int i = 0;
            for (L2ZoneType zone : ZoneManager.getInstance().getAllZones())
                if (zone.getId() == zoneId)
                {
                    for (L2Character character : zone.getCharactersInside().values())
                        if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()) && 
                        		((L2PcInstance) character).getParty() != null && 
                        		((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
                            i++;
                }
            return i;
        } 
    	@SuppressWarnings("deprecation")
    	public int getPlayerInside(int zoneId)//Calculating players inside party area.
        {
            int i = 0;
            for (L2ZoneType zone : ZoneManager.getInstance().getAllZones())
                if (zone.getId() == zoneId)
                {
                    for (L2Character character : zone.getCharactersInside().values())
                        if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()))
                            i++;
                }
    return i;
    } 
    	private boolean PartyItemsOk(L2PcInstance player)
    	//Checks if all party members have the item in their inventory.
    	//If pt member has not enough items, party not allowed to enter.
    	{
    		
    		try
    		{
    			for (L2PcInstance member : player.getParty().getPartyMembers())
    			{
    				if (member.getInventory().getItemByItemId(ItemConsumeId) == null)
    							
    				{
    					player.sendMessage("Your party member "+member.getName()+" does not have enough items.");
    					return false;
    				}
    				if (member.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNum)
    				{
    					player.sendMessage("Your party member "+member.getName()+" does not have enough items.");
    					return false;
    				}
    			}
    			return true;
    			
    		}
    		catch (Exception e)
    		{
    			player.sendMessage("Something went wrong try again.");
    			return true;
    		}
    	}
    
    	private void proccessTP(L2PcInstance player) // Teleporting party members to zone
    	{
    		for (L2PcInstance member : player.getParty().getPartyMembers())
    		{
    			member.teleToLocation(locationX, locationY, locationZ);//Location X, Y ,Z
    		}
    	}
    	private void TP(String event, L2Npc npc, L2PcInstance player, String command) // Teleport player & his party
    	{
    		
    		try
    		{
    			L2Party pt = player.getParty();
    			if (pt == null)
    			{
    				player.sendMessage("You are not currently on party.");
    				return;
    			}
    			if (!pt.isLeader(player))
    			{
    				player.sendMessage("You are not party leader.");
    				return;
    			}
    			if (pt.getMemberCount() < MinPtMembers)
    			{
    				player.sendMessage("You are going to need a bigger party " +
    						"in order to enter party area.");
    				return;
    			}
    			if (!PartyItemsOk(player))
    			{
    				return;
    			}
    			else
    			{
    				proccessTP(player);
    				for (L2PcInstance ppl : pt.getPartyMembers())
    				{
    					if (ppl.getObjectId() != player.getObjectId())//Dont send this message to pt leader.
    					{
    						ppl.sendMessage("Your party leader asked to teleport on party area!");//Message only to party members
    					}
    					ppl.sendMessage(ItemConsumeNum+" "+ItemName+" have been dissapeared.");//Item delete from inventory message
    					ppl.getInventory().destroyItemByItemId("Party_Teleporter", ItemConsumeId, ItemConsumeNum, ppl, true);//remove item from inventory
    					ppl.sendPacket(new InventoryUpdate());//Update
    					ppl.sendPacket(new ItemList(ppl, false));//Update
    					ppl.sendPacket(new StatusUpdate(ppl));//Update
    					
    				}
    				//Sends message to party leader.
    				player.sendMessage(ItemConsumeNum*player.getParty().getMemberCount()+" "+ItemName+" dissapeard from your party.");
    			}
    			
    		}
    		catch (Exception e)
    		{
    			player.sendMessage("Something went wrong try again.");
    		}
    	}
    	
    	@Override
    	public String onFirstTalk(L2Npc npc, L2PcInstance player)
    	{
    		final int npcId = npc.getNpcId();
    		if (player.getQuestState(getName()) == null)
    		{
    			newQuestState(player);
    		}
    		if (npcId == npcid)
    		{
    			String html = HtmCache.getInstance().getHtm(L2PcInstance.getHtmlPrefix(), htm);
    			html = html.replaceAll("%player%", player.getName());//Replaces %player% with player name on html
    			html = html.replaceAll("%itemname%", ItemName);//Item name replace on html
    			html = html.replaceAll("%price%", player.getParty()!=null ? ""+ItemConsumeNum*player.getParty().getMemberCount()+"": "0");//Price calculate replace
    			html = html.replaceAll("%minmembers%", ""+MinPtMembers);//Mimum entry party members replace
    			html = html.replaceAll("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" :
    				"<font color=FF0000>not allowed</font>");//Condition checker replace on html
    			html = html.replaceAll("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: "+getPartiesInside(ZoneId)+"</font><br>": "");//Parties inside
    			html = html.replaceAll("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: "+getPlayerInside(ZoneId)+"</font><br>": "");//Players Inside
    			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
    			npcHtml.setHtml(html);
    			player.sendPacket(npcHtml);
    		}
    		return "";
    	}
    	private boolean isAllowedEnter(L2PcInstance player) //Checks if player & his party is allowed to teleport.
    	{
    		if (player.getParty() != null)
    		{
    			if( player.getParty().getMemberCount() >= MinPtMembers && PartyItemsOk(player))//Party Length & Item Checker
    			{
    				return true;
    			}
    			else 
    			{
    				return false;
    			}
    		}
    		else
    		{
    			return false;
    		}
    	}
    	public static void main(final String[] args)
    	{
    		new PartyTeleporter(-1, PartyTeleporter.class.getSimpleName(), "custom");
    		System.out.println("Party Teleporter by `Heroin has been loaded successfully!");
    	}
    }
    

    here you have all code

  4. you can send me our configs? i want to see the topzone / hopzone URL

    # Vote reward for Hopzone.
    AllowHopzoneVoteReward = True
    # Vote reward server link.
    HopzoneServerLink = http://l2.topzone.net/lineage2/details/74078/L2World-Servers/'>http://l2.topzone.net/lineage2/details/74078/L2World-Servers/
    # First page of servers list link.
    HopzoneFirstPageLink = http://l2.hopzone.net/lineage2/
    # Votes for next reward needed.
    HopzoneVotesDifference = 5
    # Rank needed for server to be on first page.
    HopzoneFirstPageRankNeeded = 15
    # Minutes between rewards.
    # Eg. You put 5 it checks every 5 minutes for reward.
    HopzoneRewardCheckTime = 5
    # Small reward(s).
    HopzoneSmallReward = 57,100000000;
    # Big reward(s).
    HopzoneBigReward = 3470,1;
    # Hopzone reward max dual boxes reward.
    # For example if you put 2 and someone has 3 boxes open 2 will be rewarded.
    HopzoneDuaboxesAllowed = 1
    # Game server console report.
    # If set to true, game server console will get a report of
    # current vote count, votes needed for next reward and votes needed for first page.
    AllowHopzoneGameServerReport = True
    
    # Vote reward for Topzone.
    AllowTopzoneVoteReward = True
    # Vote reward server link.
    TopzoneServerLink = http://l2.topzone.net/lineage2/details/74078/L2World-Servers/'>http://l2.topzone.net/lineage2/details/74078/L2World-Servers/
    # First page of servers list link.
    TopzoneFirstPageLink = http://l2.topzone.net/lineage2/
    # Votes for next reward needed.
    TopzoneVotesDifference = 5
    # Rank needed for server to be on first page.
    TopzoneFirstPageRankNeeded = 15
    # Minutes between rewards.
    # Eg. You put 5 it checks every 5 minutes for reward.
    TopzoneRewardCheckTime = 5
    # Small reward(s).
    TopzoneSmallReward = 57,100000000;
    # Big reward(s).
    TopzoneBigReward = 3470,1;
    # Hopzone reward max dual boxes reward.
    # For example if you put 2 and someone has 3 boxes open 2 will be rewarded.
    TopzoneDuaboxesAllowed = 1
    # Game server console report.
    # If set to true, game server console will get a report of
    # current vote count, votes needed for next reward and votes needed for first page.
    AllowTopzoneGameServerReport = True
    
  5. any help cuz don't work ..look at my java file 

    /*
     * This program is free software: you can redistribute it and/or modify it under
     * the terms of the GNU General Public License as published by the Free Software
     * Foundation, either version 3 of the License, or (at your option) any later
     * version.
     *
     * This program is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
     * details.
     *
     * You should have received a copy of the GNU General Public License along with
     * this program. If not, see <http://www.gnu.org/licenses/>.
     */
    package Extensions.AutoVoteReward;
     
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.Collection;
    import java.util.HashMap;
     
    import net.sf.l2j.Config;
    import net.sf.l2j.gameserver.Announcements;
    import net.sf.l2j.gameserver.ThreadPoolManager;
    import net.sf.l2j.gameserver.model.L2World;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    /**
     * @author Anarchy
     *
     */
    public class VoteRewardHopzone
    {
           // Configurations.
           private static String hopzoneUrl = Config.HOPZONE_SERVER_LINK;
           private static String page1Url = Config.HOPZONE_FIRST_PAGE_LINK;
           private static int voteRewardVotesDifference = Config.HOPZONE_VOTES_DIFFERENCE;
           private static int firstPageRankNeeded = Config.HOPZONE_FIRST_PAGE_RANK_NEEDED;
           private static int checkTime = 60*1000*Config.HOPZONE_REWARD_CHECK_TIME;
          
           // Don't-touch variables.
           private static int lastVotes = 0;
           private static HashMap<String, Integer> playerIps = new HashMap<>();
          
           public static void updateConfigurations()
           {
                   hopzoneUrl = Config.HOPZONE_SERVER_LINK;
                   page1Url = Config.HOPZONE_FIRST_PAGE_LINK;
                   voteRewardVotesDifference = Config.HOPZONE_VOTES_DIFFERENCE;
                   firstPageRankNeeded = Config.HOPZONE_FIRST_PAGE_RANK_NEEDED;
                   checkTime = 60*1000*Config.HOPZONE_REWARD_CHECK_TIME;
           }
          
           public static void getInstance()
           {
                   System.out.println("Hopzone - Vote reward system initialized.");
                   ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
                   {
                           @Override
                           public void run()
                           {
                                   if (Config.ALLOW_HOPZONE_VOTE_REWARD)
                                   {
                                           reward();
                                   }
                                   else
                                   {
                                           return;
                                   }
                           }
                   }, checkTime/2, checkTime);
           }
          
           static void reward()
           {
                   int firstPageVotes = getFirstPageRankVotes();
                   int currentVotes = getVotes();
                  
                   if (firstPageVotes == -1 || currentVotes == -1)
                   {
                           if (firstPageVotes == -1)
                           {
                                   System.out.println("There was a problem on getting Hopzone votes from server with rank "+firstPageRankNeeded+".");
                           }
                           if (currentVotes == -1)
                           {
                                   System.out.println("There was a problem on getting Hopzone server votes.");
                           }
                          
                           return;
                   }
                  
                   if (lastVotes == 0)
                   {
                           lastVotes = currentVotes;
                           Announcements.announceToAll("Hopzone: Vote count is "+currentVotes+".");
                           Announcements.announceToAll("Hopzone: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for reward.");
                           if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                           {
                                   System.out.println("Server votes on hopzone: "+currentVotes);
                                   System.out.println("Votes needed for reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes));
                           }
                           if (firstPageVotes-lastVotes <= 0)
                           {
                                   Announcements.announceToAll("Hopzone: We are in the top "+firstPageRankNeeded+", so the reward will be big.");
                                   if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server is on the top "+firstPageRankNeeded+" of hopzone.");
                                   }
                           }
                           else
                           {
                                   Announcements.announceToAll("Hopzone: We need "+(firstPageVotes-lastVotes)+" vote(s) to get to the top "+firstPageRankNeeded+" of Hopzone for big reward.");
                                   if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes needed for top "+firstPageRankNeeded+": "+(firstPageVotes-lastVotes));
                                   }
                           }
                           return;
                   }
                  
                   if (currentVotes >= lastVotes+voteRewardVotesDifference)
                   {
                           Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
                           if (firstPageVotes-currentVotes <= 0)
                           {
                                   if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on hopzone: "+currentVotes);
                                           System.out.println("Server is on the first page of hopzone.");
                                           System.out.println("Votes needed for next reward: "+((currentVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Hopzone: Everyone has been rewarded with big reward.");
                                   Announcements.announceToAll("Hopzone: Current vote count is "+currentVotes+".");
                                   for (L2PcInstance p : pls)
                                   {
                                           boolean canReward = false;
                                           String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
                                           if (playerIps.containsKey(pIp))
                                           {
                                                   int count = playerIps.get(pIp);
                                                   if (count < Config.HOPZONE_DUALBOXES_ALLOWED)
                                                   {
                                                           playerIps.remove(pIp);
                                                           playerIps.put(pIp, count+1);
                                                           canReward = true;
                                                   }
                                           }
                                           else
                                           {
                                                   canReward = true;
                                                   playerIps.put(pIp, 1);
                                           }
                                           if (canReward)
                                           {
                                                   for (int i = 0; i < Config.HOPZONE_BIG_REWARD.length; i++)
                                                   {
                                                           p.addItem("Vote reward.", Config.HOPZONE_BIG_REWARD[i][0], Config.HOPZONE_BIG_REWARD[i][1], p, true);
                                                   }
                                           }
                                           else
                                           {
                                                   p.sendMessage("Already "+Config.HOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
                                           }
                                   }
                                   playerIps.clear();
                           }
                           else
                           {
                                   if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on hopzone: "+currentVotes);
                                           System.out.println("Server votes needed for first page: "+(firstPageVotes-lastVotes));
                                           System.out.println("Votes needed for next reward: "+((currentVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Hopzone: Everyone has been rewarded with small reward.");
                                   Announcements.announceToAll("Hopzone: Current vote count is "+currentVotes+".");
                                   Announcements.announceToAll("Hopzone: We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the top "+firstPageRankNeeded+" of Hopzone for big reward.");
                                   for (L2PcInstance p : pls)
                                   {
                                           boolean canReward = false;
                                           String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
                                           if (playerIps.containsKey(pIp))
                                           {
                                                   int count = playerIps.get(pIp);
                                                   if (count < Config.HOPZONE_DUALBOXES_ALLOWED)
                                                   {
                                                           playerIps.remove(pIp);
                                                           playerIps.put(pIp, count+1);
                                                           canReward = true;
                                                   }
                                           }
                                           else
                                           {
                                                   canReward = true;
                                                   playerIps.put(pIp, 1);
                                           }
                                           if (canReward)
                                           {
                                                   for (int i = 0; i < Config.HOPZONE_SMALL_REWARD.length; i++)
                                                   {
                                                           p.addItem("Vote reward.", Config.HOPZONE_SMALL_REWARD[i][0], Config.HOPZONE_SMALL_REWARD[i][1], p, true);
                                                   }
                                           }
                                           else
                                           {
                                                   p.sendMessage("Already "+Config.HOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
                                           }
                                   }
                                   playerIps.clear();
                           }
                          
                           lastVotes = currentVotes;
                   }
                   else
                   {
                           if (firstPageVotes-currentVotes <= 0)
                           {
                                   if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on hopzone: "+currentVotes);
                                           System.out.println("Server is on the first page of hopzone.");
                                           System.out.println("Votes needed for next reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Hopzone: Current vote count is "+currentVotes+".");
                                   Announcements.announceToAll("Hopzone: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for big reward.");
                           }
                           else
                           {
                                   if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on hopzone: "+currentVotes);
                                           System.out.println("Server votes needed for first page: "+(firstPageVotes-lastVotes));
                                           System.out.println("Votes needed for next reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Hopzone: Current vote count is "+currentVotes+".");
                                   Announcements.announceToAll("Hopzone: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for small reward.");
                                   Announcements.announceToAll("Hopzone: We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the top "+firstPageRankNeeded+" of Hopzone for big reward.");
                           }
                   }
           }
          
           private static int getFirstPageRankVotes()
           {
                   InputStreamReader isr = null;
                   BufferedReader br = null;
                  
                   try
                   {
                           URLConnection con = new URL(page1Url).openConnection();
                           con.addRequestProperty("User-Agent", "Mozilla/4.76");
                           isr = new InputStreamReader(con.getInputStream());
                           br = new BufferedReader(isr);
                          
                           String line;
                           int i = 0;
                           while ((line = br.readLine()) != null)
                           {
                                   if (line.contains("<span class=\"no\">"+firstPageRankNeeded+"</span>"))
                                   {
                                           i++;
                                   }
                                   if (line.contains("<span class=\"rank anonymous tooltip\"") && i == 1)
                                   {
                                           i = 0;
                                           int votes = Integer.valueOf(line.replaceAll("[^\\d]", ""));
                                           return votes;
                                   }
                           }
                          
                           br.close();
                           isr.close();
                   }
                   catch (Exception e)
                   {
                           System.out.println(e);
                           System.out.println("Error while getting Hopzone server vote count.");
                   }
                  
                   return -1;
           }
          
           private static int getVotes()
           {
                   InputStreamReader isr = null;
                   BufferedReader br = null;
                  
                   try
                   {
                           URLConnection con = new URL(hopzoneUrl).openConnection();
                           con.addRequestProperty("User-Agent", "Mozilla/4.76");
                           isr = new InputStreamReader(con.getInputStream());
                           br = new BufferedReader(isr);
                          
                           String line;
                           while ((line = br.readLine()) != null)
                           {
                                   if (line.contains("<li><span class=\"rank anonymous tooltip\""))
                                   {
                                           int votes = Integer.valueOf(line.replaceAll("[^\\d]", ""));
                                           return votes;
                                   }
                           }
                          
                           br.close();
                           isr.close();
                   }
                   catch (Exception e)
                   {
                           System.out.println(e);
                           System.out.println("Error while getting server vote count.");
                   }
                  
                   return -1;
           }
    }
    

    and 

    package Extensions.AutoVoteReward;
    
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.Collection;
    import java.util.HashMap;
    
    import net.sf.l2j.Config;
    import net.sf.l2j.gameserver.Announcements;
    import net.sf.l2j.gameserver.ThreadPoolManager;
    import net.sf.l2j.gameserver.model.L2World;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    /**
    + * @author Anarchy
    + *
    + */
    public class VoteRewardTopzone
    {
           // Configurations.
           private static String topzoneUrl = Config.TOPZONE_SERVER_LINK;
           private static String page1Url = Config.TOPZONE_FIRST_PAGE_LINK;
           private static int voteRewardVotesDifference = Config.TOPZONE_VOTES_DIFFERENCE;
           private static int firstPageRankNeeded = Config.TOPZONE_FIRST_PAGE_RANK_NEEDED;
           private static int checkTime = 60*1000*Config.TOPZONE_REWARD_CHECK_TIME;
         
           // Don't-touch variables.
           private static int lastVotes = 0;
           private static HashMap<String, Integer> playerIps = new HashMap<>();
          
           public static void updateConfigurations()
           {
                   topzoneUrl = Config.TOPZONE_SERVER_LINK;
                   page1Url = Config.TOPZONE_FIRST_PAGE_LINK;
                   voteRewardVotesDifference = Config.TOPZONE_VOTES_DIFFERENCE;
                   firstPageRankNeeded = Config.TOPZONE_FIRST_PAGE_RANK_NEEDED;
                   checkTime = 60*1000*Config.TOPZONE_REWARD_CHECK_TIME;
           }
          
           public static void getInstance()
           {
                   System.out.println("Topzone - Vote reward system initialized.");
                   ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
                   {
                           @Override
                           public void run()
                           {
                                   if (Config.ALLOW_TOPZONE_VOTE_REWARD)
                                   {
                                           reward();
                                   }
                                   else
                                   {
                                           return;
                                   }
                           }
                   }, checkTime/2, checkTime);
           }
         
           static void reward()
           {
                   int firstPageVotes = getFirstPageRankVotes();
                   int currentVotes = getVotes();
                  
                   if (firstPageVotes == -1 || currentVotes == -1)
                   {
                           if (firstPageVotes == -1)
                           {
                                   System.out.println("There was a problem on getting Topzone votes from server with rank "+firstPageRankNeeded+".");
                           }
                           if (currentVotes == -1)
                           {
                                   System.out.println("There was a problem on getting Topzone server votes.");
                           }
                          
                          return;
                   }
                  
                   if (lastVotes == 0)
                   {
                           lastVotes = currentVotes;
                           Announcements.announceToAll("Topzone: Current vote count is "+currentVotes+".");
                           Announcements.announceToAll("Topzone: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for reward.");
                           if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                           {
                                   System.out.println("Server votes on topzone: "+currentVotes);
                                   System.out.println("Votes needed for reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes));
                           }
                           if (firstPageVotes-lastVotes <= 0)
                           {
                                   Announcements.announceToAll("Topzone: We are in the top "+firstPageRankNeeded+" of topzone, so the reward will be big.");
                                   if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server is on the top "+firstPageRankNeeded+" of topzone.");
                                   }
                           }
                           else
                           {
                                   Announcements.announceToAll("Topzone: We need "+(firstPageVotes-lastVotes)+" vote(s) to get to the top "+firstPageRankNeeded+" of topzone for big reward.");
                                   if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes needed for top "+firstPageRankNeeded+": "+(firstPageVotes-lastVotes));
                                  }
                           }
                           return;
                   }
                  
                   if (currentVotes >= lastVotes+voteRewardVotesDifference)
                   {
                           Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
                           if (firstPageVotes-currentVotes <= 0)
                           {
                                   if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on topzone: "+currentVotes);
                                           System.out.println("Server is on the top "+firstPageRankNeeded+" of topzone.");
                                           System.out.println("Votes needed for next reward: "+((currentVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Topzone: Everyone has been rewarded with big reward.");
                                   Announcements.announceToAll("Topzone: Current vote count is "+currentVotes+".");
                                   for (L2PcInstance p : pls)
                                   {
                                          boolean canReward = false;
                                           String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
                                           if (playerIps.containsKey(pIp))
                                           {
                                                   int count = playerIps.get(pIp);
                                                   if (count < Config.TOPZONE_DUALBOXES_ALLOWED)
                                                   {
                                                           playerIps.remove(pIp);
                                                           playerIps.put(pIp, count+1);
                                                           canReward = true;
                                                   }
                                           }
                                           else
                                           {
                                                   canReward = true;
                                                   playerIps.put(pIp, 1);
                                           }
                                           if (canReward)
                                           {
                                                   for (int i = 0; i < Config.TOPZONE_BIG_REWARD.length; i++)
                                                   {
                                                           p.addItem("Vote reward.", Config.TOPZONE_BIG_REWARD[i][0], Config.TOPZONE_BIG_REWARD[i][1], p, true);
                                                  }
                                           }
                                           else
                                           {
                                                   p.sendMessage("Already "+Config.TOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
                                           }
                                   }
                                   playerIps.clear();
                           }
                           else
                           {
                                   if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                                  {
                                           System.out.println("Server votes on topzone: "+currentVotes);
                                           System.out.println("Server votes needed for top "+firstPageRankNeeded+": "+(firstPageVotes-lastVotes));
                                           System.out.println("Votes needed for next reward: "+((currentVotes+voteRewardVotesDifference)-currentVotes));
                                  }
                                   Announcements.announceToAll("Topzone: Everyone has been rewarded with small reward.");
                                   Announcements.announceToAll("Topzone: Current vote count is "+currentVotes+".");
                                   Announcements.announceToAll("Topzone: We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the top "+firstPageRankNeeded+" of topzone for big reward.");
                                   for (L2PcInstance p : pls)
                                   {
                                           boolean canReward = false;
                                           String pIp = p.getClient().getConnection().getInetAddress().getHostAddress();
                                           if (playerIps.containsKey(pIp))
                                           {
                                                   int count = playerIps.get(pIp);
                                                   if (count < Config.TOPZONE_DUALBOXES_ALLOWED)
                                                   {
                                                           playerIps.remove(pIp);
                                                           playerIps.put(pIp, count+1);
                                                           canReward = true;
                                                   }
                                           }
                                           else
                                           {
                                                   canReward = true;
                                                   playerIps.put(pIp, 1);
                                           }
                                           if (canReward)
                                           {
                                                   for (int i = 0; i < Config.TOPZONE_SMALL_REWARD.length; i++)
                                                   {
                                                           p.addItem("Vote reward.", Config.TOPZONE_SMALL_REWARD[i][0], Config.TOPZONE_SMALL_REWARD[i][1], p, true);
                                                   }
                                           }
                                           else
                                           {
                                                   p.sendMessage("Already "+Config.TOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded.");
                                           }
                                   }
                                   playerIps.clear();
                           }
                          
                           lastVotes = currentVotes;
                   }
                   else
                   {
                           if (firstPageVotes-currentVotes <= 0)
                           {
                                   if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on topzone: "+currentVotes);
                                           System.out.println("Server is on the top "+firstPageRankNeeded+" of topzone.");
                                           System.out.println("Votes needed for next reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Topzone: Current vote count is "+currentVotes+".");
                                   Announcements.announceToAll("Topzone: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for big reward.");
                           }
                           else
                           {
                                   if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT)
                                   {
                                           System.out.println("Server votes on topzone: "+currentVotes);
                                           System.out.println("Server votes needed for top "+firstPageRankNeeded+": "+(firstPageVotes-lastVotes));
                                           System.out.println("Votes needed for next reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes));
                                   }
                                   Announcements.announceToAll("Topzone: Current vote count is "+currentVotes+".");
                                   Announcements.announceToAll("Topzone: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for small reward.");
                                   Announcements.announceToAll("Topzone: We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the top "+firstPageRankNeeded+" of topzone for big reward.");
                           }
                   }
           }
          
           private static int getFirstPageRankVotes()
           {
                   InputStreamReader isr = null;
                   BufferedReader br = null;
                  
                   try
                   {
                           URLConnection con = new URL(page1Url).openConnection();
                           con.addRequestProperty("User-Agent", "Mozilla/4.76");
                           isr = new InputStreamReader(con.getInputStream());
                           br = new BufferedReader(isr);
                         
                           String line;
                           while ((line = br.readLine()) != null)
                           {
                                   if (line.contains("<div class=\"slr\">"+firstPageRankNeeded+"<div class=\"votes\">Votes:<br><span>"))
                                   {
                                           int votes = Integer.valueOf(line.split("<div class=\"slr\">"+firstPageRankNeeded+"<div class=\"votes\">Votes:<br><span>")[1].replace("</span></div></div>", ""));
                                           return votes;
                                   }
                           }
                          
                           br.close();
                           isr.close();
                   }
                   catch (Exception e)
                   {
                           System.out.println(e);
                           System.out.println("Error while getting Hopzone server vote count.");
                   }
                  
                   return -1;
           }
                 
           private static int getVotes()
           {
                   InputStreamReader isr = null;
                   BufferedReader br = null;
                  
                   try
                   {
                           URLConnection con = new URL(topzoneUrl).openConnection();
                           con.addRequestProperty("User-Agent", "Mozilla/4.76");
                           isr = new InputStreamReader(con.getInputStream());
                           br = new BufferedReader(isr);
                          
                           boolean got = false;
                          
                           String line;
                           while ((line = br.readLine()) != null)
                           {
                                   if (line.contains("<div class=\"rank\"><div class=\"votes2\">Votes:<br>") && !got)
                                   {
                                           got = true;
                                           int votes = Integer.valueOf(line.split("<div class=\"rank\"><div class=\"votes2\">Votes:<br>")[1].replace("</div></div>", ""));
                                          return votes;
                                  }
                          }
                         
                           br.close();
                           isr.close();
                   }
                   catch (Exception e)
                   {
                           System.out.println(e);
                           System.out.println("Error while getting server vote count.");
                   }
                  
                   return -1;
           }
    }
    
  6. ok i fix this problem but error at line 20 stil here :(

     

     

    http://postimg.org/image/r9tln9prb/

    package custom.PartyTeleporter;
    import net.sf.l2j.gameserver.cache.HtmCache;
    import net.sf.l2j.gameserver.datatables.ItemTable;
    import net.sf.l2j.gameserver.instancemanager.ZoneManager;
    import net.sf.l2j.gameserver.model.L2Party;
    import net.sf.l2j.gameserver.model.actor.L2Character;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.quest.Quest;
    import net.sf.l2j.gameserver.model.zone.L2ZoneType;
    import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
    import net.sf.l2j.gameserver.network.serverpackets.ItemList;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
    
    public class PartyTeleporter extends Quest
    {
    	private static final int npcid = 36650; // npc id
    	//-------------------------------------
    	//Teleport Location Coordinates X,Y,Z.
    	//Use /loc command in game to find them.
    line 20 private static final int locationX = -56742; // npc id
    	private static final int locationY = 140569; // npc id
    	private static final int locationZ = -2625; // npc id
    
  7. i have a problem can help me :(?

     

    http://postimg.org/image/r9tln9prb/

     

    http://postimg.org/image/9vths5nvx/

    package custom.PartyTeleporter;
    import net.sf.l2j.gameserver.cache.HtmCache;
    import net.sf.l2j.gameserver.datatables.ItemTable;
    import net.sf.l2j.gameserver.instancemanager.ZoneManager;
    import net.sf.l2j.gameserver.model.L2Party;
    import net.sf.l2j.gameserver.model.actor.L2Character;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.quest.Quest;
    import net.sf.l2j.gameserver.model.zone.L2ZoneType;
    import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
    import net.sf.l2j.gameserver.network.serverpackets.ItemList;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
    
    public class PartyTeleporter extends Quest
    {
    	private static final int npcid = 36650; // npc id
    	//-------------------------------------
    	//Teleport Location Coordinates X,Y,Z.
    	//Use /loc command in game to find them.
    	private static final int locationX = -56742; // npc id
    	private static final int locationY = 140569; // npc id
    	private static final int locationZ = -2625; // npc id
    	//-------------------------------------
    	//-------------------------------------
    	// Select the id of your zone.
    	// If you dont know how to find your zone id is simple.
    	// Go to data/zones/(your zone file).xml and find your zone
    	// E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
    	/**The id of your zone is id="6" */
    	/**---------------------------------------------------------------------------*/
    	/**WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self*/ // required to calculate parties & players
    	/**---------------------------------------------------------------------------*/
    	private static final int ZoneId = 155; //Here you have to set your zone Id
    	//-------------------------------------
    	private static final int MinPtMembers = 7; // Minimum Party Members Count For Enter on Zone.
    	private static final boolean ShowPlayersInside = true; //If you set it true, NPC will show how many players are inside area.
    	private static final boolean ShowPartiesInside = true; //If you set it true, NPC will show how many parties are inside area.
    	public PartyTeleporter(int questId, String name, String descr)
    	{
    		super(questId, name, descr);
    		addFirstTalkId(npcid);
    		addTalkId(npcid);
    		addStartNpc(npcid);
    	}
    	
    	@Override
    	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    	{
    		if (event.startsWith("partytp"))
    		{
    			TP(event, npc, player, event);
    		}
    
    		return "";
    	}
    	@SuppressWarnings("deprecation")
    	public int getPartiesInside(int zoneId)//Calculating parties inside party area.
        {
            int i = 0;
            for (L2ZoneType zone : ZoneManager.getInstance().getAllZones(null))
                if (zone.getId() == zoneId)
                {
                    for (L2Character character : zone.getCharactersInside().values())
                        if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()) && 
                        		((L2PcInstance) character).getParty() != null && 
                        		((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
                            i++;
                }
            return i;
        } 
    	@SuppressWarnings("deprecation")
    	public int getPlayerInside(int zoneId)//Calculating players inside party area.
        {
            int i = 0;
            for (L2ZoneType zone : ZoneManager.getInstance().getAllZones(null))
                if (zone.getId() == zoneId)
                {
                    for (L2Character character : zone.getCharactersInside().values())
                        if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()))
                            i++;
                }
    return i;
    } 
    	private void proccessTP(L2PcInstance player) // Teleporting party members to zone
    	{
    		for (L2PcInstance member : player.getParty().getPartyMembers())
    		{
    			member.teleToLocation(locationX, locationY, locationZ);//Location X, Y ,Z
    		}
    	}
    	private void TP(String event, L2Npc npc, L2PcInstance player, String command) // Teleport player & his party
    	{
    		
    		try
    		{
    			L2Party pt = player.getParty();
    			if (pt == null)
    			{
    				player.sendMessage("You are not currently on party.");
    				return;
    			}
    			if (!pt.isLeader(player))
    			{
    				player.sendMessage("You are not party leader.");
    				return;
    			}
    			if (pt.getMemberCount() < MinPtMembers)
    			{
    				player.sendMessage("You are going to need a bigger party " +
    						"in order to enter party area.");
    				return;
    			}
    			else
    			{
    				proccessTP(player);
    				for (L2PcInstance ppl : pt.getPartyMembers())
    				{
    					if (ppl.getObjectId() != player.getObjectId())//Dont send this message to pt leader.
    					{
    						ppl.sendMessage("Your party leader asked to teleport on party area!");//Message only to party members
    					}					
    				}
    			}
    			
    		}
    		catch (Exception e)
    		{
    			player.sendMessage("Something went wrong try again.");
    		}
    	}
    	
    	@Override
    	public String onFirstTalk(L2Npc npc, L2PcInstance player)
    	{
    		final int npcId = npc.getNpcId();
    		if (player.getQuestState(getName()) == null)
    		{
    			newQuestState(player);
    		}
    		if (npcId == npcid)
    		{
    			String html = HtmCache.getInstance().getHtm(L2PcInstance.getHtmlPrefix());
    			html = html.replaceAll("%player%", player.getName());//Replaces %player% with player name on html
    			html = html.replaceAll("%minmembers%", ""+MinPtMembers);//Mimum entry party members replace
    			html = html.replaceAll("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" :
    				"<font color=FF0000>not allowed</font>");//Condition checker replace on html
    			html = html.replaceAll("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: "+getPartiesInside(ZoneId)+"</font><br>": "");//Parties inside
    			html = html.replaceAll("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: "+getPlayerInside(ZoneId)+"</font><br>": "");//Players Inside
    			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
    			npcHtml.setHtml(html);
    			player.sendPacket(npcHtml);
    		}
    		return "";
    	}
    	private boolean isAllowedEnter(L2PcInstance player) //Checks if player & his party is allowed to teleport.
    	{
    		if (player.getParty() != null)
    		{
    
    			{
    				return true;
    			}
    	
    		}
    		else
    		{
    			return false;
    		}
    	}
    	public static void main(final String[] args)
    	{
    		new PartyTeleporter(-1, PartyTeleporter.class.getSimpleName(), "custom");
    		System.out.println("Party Teleporter by `Heroin has been loaded successfully!");
    	}
    }
    

    an gs say me 1 problem at line 20 :(

  8. selling website for lineage

     

    It is bought from Strain

    for my own server

    I stopped work for server and I decided to sell it

     

    website has never been online,so is uniqe

     

    have full PSD,+script php online/loghin,gameserver,top pvp/pk

     

    add me skype saulea.stefancCeEuaT.jpg

  9. Hi I decided to make a complete project with event nexus for acis

     

    + test source with nexus live event = 25 Euro

    ACIS build project implemented nexus event = 15 Euro

    Geodata + 95% phantom tested = 10 euro

     

    and of course help in case of questions

     

    only accept payment through paypal

     

     

    Skype saulea_stefan

    gmail: arn932@gmail.com

×
×
  • Create New...