Jump to content

Recommended Posts

Posted


Index: java/net/sf/l2j/gameserver/GameServer.java

===================================================================

--- java/net/sf/l2j/gameserver/GameServer.java    (revision 21)

+++ java/net/sf/l2j/gameserver/GameServer.java    (working copy)

@@ -75,6 +75,7 @@

 import net.sf.l2j.gameserver.instancemanager.PetitionManager;

 import net.sf.l2j.gameserver.instancemanager.ZoneManager;

 import net.sf.l2j.gameserver.l2spike.botengine.BotManager;

+import net.sf.l2j.gameserver.l2spike.datatables.AuctionTable;

 import net.sf.l2j.gameserver.l2spike.datatables.IconTable;

 import net.sf.l2j.gameserver.l2spike.handler.BypassHandler;

 import net.sf.l2j.gameserver.l2spike.partymatching.PartyMatchingManager;

@@ -226,6 +227,7 @@

         IconTable.getInstance();

         BotManager.getInstance();

         PartyMatchingManager.getInstance();

+        AuctionTable.getInstance();

         

         StringUtil.printSection("System");

         Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());

Index: java/net/sf/l2j/gameserver/l2spike/auction/AuctionItem.java

===================================================================

--- java/net/sf/l2j/gameserver/l2spike/auction/AuctionItem.java    (revision 0)

+++ java/net/sf/l2j/gameserver/l2spike/auction/AuctionItem.java    (revision 0)

@@ -0,0 +1,76 @@

+/*

+ * 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 net.sf.l2j.gameserver.l2spike.auction;

+

+/**

+ * @author Anarchy

+ *

+ */

+public class AuctionItem

+{

+    private int auctionId;

+    private int ownerId;

+    private int itemId;

+    private int count;

+    private int enchant;

+    private int costId;

+    private int costCount;

+    

+    public AuctionItem(int auctionId, int ownerId, int itemId, int count, int enchant, int costId, int costCount)

+    {

+        this.auctionId = auctionId;

+        this.ownerId = ownerId;

+        this.itemId = itemId;

+        this.count = count;

+        this.enchant = enchant;

+        this.costId = costId;

+        this.costCount = costCount;

+    }

+    

+    public int getAuctionId()

+    {

+        return auctionId;

+    }

+    

+    public int getOwnerId()

+    {

+        return ownerId;

+    }

+    

+    public int getItemId()

+    {

+        return itemId;

+    }

+    

+    public int getCount()

+    {

+        return count;

+    }

+    

+    public int getEnchant()

+    {

+        return enchant;

+    }

+    

+    public int getCostId()

+    {

+        return costId;

+    }

+    

+    public int getCostCount()

+    {

+        return costCount;

+    }

+}

Index: java/net/sf/l2j/gameserver/l2spike/datatables/AuctionTable.java

===================================================================

--- java/net/sf/l2j/gameserver/l2spike/datatables/AuctionTable.java    (revision 0)

+++ java/net/sf/l2j/gameserver/l2spike/datatables/AuctionTable.java    (revision 0)

@@ -0,0 +1,199 @@

/*

 * 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 net.sf.l2j.gameserver.l2spike.datatables;

 

 

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.util.Map;

import java.util.concurrent.ConcurrentHashMap;

import java.util.logging.Logger;

 

 

import net.sf.l2j.L2DatabaseFactory;

import net.sf.l2j.gameserver.l2spike.auction.AuctionItem;

 

 

/**

 * @author Anarchy

 *

 

 */

public class AuctionTable

{

    private static Logger log = Logger.getLogger(AuctionTable.class.getName());

   

    private Map<Integer, AuctionItem> items;

    private int maxId;

   

    public static AuctionTable getInstance()

    {

        return SingletonHolder._instance;

    }

   

    protected AuctionTable()

    {

        items = new ConcurrentHashMap<>();

        maxId = 0;

       

        load();

    }

   

    private void load()

    {

        try (Connection con = L2DatabaseFactory.getInstance().getConnection())

        {

            PreparedStatement stm = con.prepareStatement("SELECT * FROM auction_table");

            ResultSet rset = stm.executeQuery();

           

            while (rset.next())

            {

                int auctionId = rset.getInt("auctionid");

                int ownerId = rset.getInt("ownerid");

                int itemId = rset.getInt("itemid");

                int count = rset.getInt("count");

                int enchant = rset.getInt("enchant");

                int costId = rset.getInt("costid");

                int costCount = rset.getInt("costcount");

               

                items.put(auctionId, new AuctionItem(auctionId, ownerId, itemId, count, enchant, costId, costCount));

               

                if (auctionId > maxId)

                    maxId = auctionId;

            }

           

            rset.close();

            stm.close();

        }

        catch (Exception e)

        {

            e.printStackTrace();

        }

       

        log.info("AuctionTable: Loaded "+items.size()+" items.");

    }

   

    public void addItem(AuctionItem item)

    {

        items.put(item.getAuctionId(), item);

       

        try (Connection con = L2DatabaseFactory.getInstance().getConnection())

        {

            PreparedStatement stm = con.prepareStatement("INSERT INTO auction_table VALUES (?,?,?,?,?,?,?)");

            stm.setInt(1, item.getAuctionId());

            stm.setInt(2, item.getOwnerId());

            stm.setInt(3, item.getItemId());

            stm.setInt(4, item.getCount());

            stm.setInt(5, item.getEnchant());

            stm.setInt(6, item.getCostId());

            stm.setInt(7, item.getCostCount());

           

            stm.execute();

            stm.close();

        }

        catch (Exception e)

        {

            e.printStackTrace();

        }

    }

   

    public void deleteItem(AuctionItem item)

    {

        items.remove(item);

       

        try (Connection con = L2DatabaseFactory.getInstance().getConnection())

        {

            PreparedStatement stm = con.prepareStatement("DELETE FROM auction_table WHERE auctionid=?");

            stm.setInt(1, item.getAuctionId());

           

            stm.execute();

            stm.close();

        }

        catch (Exception e)

        {

            e.printStackTrace();

        }

    }

   

    public AuctionItem getItem(int auctionId)

    {

        return items.get(auctionId);

    }

   

    public Map<Integer, AuctionItem> getItems()

    {

        return items;

    }

   

    public int getNextAuctionId()

    {

        maxId++;

        return maxId;

    }

   

    private static class SingletonHolder

    {

        protected static final AuctionTable _instance = new AuctionTable();

    }}

 

Index: java/net/sf/l2j/gameserver/model/actor/instance/L2AuctionManagerInstance.java

===================================================================

--- java/net/sf/l2j/gameserver/model/actor/instance/L2AuctionManagerInstance.java    (revision 0)

+++ java/net/sf/l2j/gameserver/model/actor/instance/L2AuctionManagerInstance.java    (revision 0)

@@ -0,0 +1,512 @@

/*

 * 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 net.sf.l2j.gameserver.model.actor.instance;

 

 

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;

 

 

import net.sf.l2j.commons.lang.StringUtil;

 

 

import net.sf.l2j.L2DatabaseFactory;

import net.sf.l2j.gameserver.datatables.ItemTable;

import net.sf.l2j.gameserver.idfactory.IdFactory;

import net.sf.l2j.gameserver.l2spike.auction.AuctionItem;

import net.sf.l2j.gameserver.l2spike.datatables.AuctionTable;

import net.sf.l2j.gameserver.l2spike.datatables.IconTable;

import net.sf.l2j.gameserver.model.World;

import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;

import net.sf.l2j.gameserver.model.item.instance.ItemInstance;

import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

 

 

/**

 * @author Anarchy

 *

 */

public class L2AuctionManagerInstance extends L2NpcInstance

{

    public L2AuctionManagerInstance(int objectId, NpcTemplate template)

    {

        super(objectId, template);

    }

   

    @Override

    public void onBypassFeedback(L2PcInstance player, String command)

    {

        if (command.startsWith("auction"))

        {

            try

            {

                String[] data = command.substring(8).split(" - ");

                int page = Integer.parseInt(data[0]);

                String search = data[1];

                showAuction(player, page, search);

            }

            catch (Exception e)

            {

                showChatWindow(player);

                player.sendMessage("Invalid input. Please try again.");

                return;

            }

        }

        else if (command.startsWith("buy"))

        {

            int auctionId = Integer.parseInt(command.substring(4));

            AuctionItem item = AuctionTable.getInstance().getItem(auctionId);

           

            if (item == null)

            {

                showChatWindow(player);

                player.sendMessage("Invalid choice. Please try again.");

                return;

            }

           

            if (player.getInventory().getItemByItemId(item.getCostId()) == null || player.getInventory().getItemByItemId(item.getCostId()).getCount() < item.getCostCount())

            {

                showChatWindow(player);

                player.sendMessage("Incorrect item count.");

                return;

            }

           

            player.destroyItemByItemId("auction", item.getCostId(), item.getCostCount(), this, true);

           

            L2PcInstance owner = World.getInstance().getPlayer(item.getOwnerId());

            if (owner != null && owner.isOnline())

            {

                owner.addItem("auction", item.getCostId(), item.getCostCount(), null, true);

                owner.sendMessage("You have sold an item in the Auction Shop.");

            }

            else

            {

                addItemToOffline(item.getOwnerId(), item.getCostId(), item.getCostCount());

            }

           

            ItemInstance i = player.addItem("auction", item.getItemId(), item.getCount(), this, true);

            i.setEnchantLevel(item.getEnchant());

            player.sendPacket(new InventoryUpdate());

            player.sendMessage("You have purchased an item from the Auction Shop.");

           

            AuctionTable.getInstance().deleteItem(item);

           

            showChatWindow(player);

        }

        else if (command.startsWith("addpanel"))

        {

            int page = Integer.parseInt(command.substring(9));

 

           

            showAddPanel(player, page);

        }

        else if (command.startsWith("additem"))

        {

            int itemId = Integer.parseInt(command.substring(8));

           

            if (player.getInventory().getItemByObjectId(itemId) == null)

            {

                showChatWindow(player);

                player.sendMessage("Invalid item. Please try again.");

                return;

            }

           

            showAddPanel2(player, itemId);

        }

        else if (command.startsWith("addit2"))

        {

            try

            {

                String[] data = command.substring(7).split(" ");

                int itemId = Integer.parseInt(data[0]);

                String costitemtype = data[1];

                int costCount = Integer.parseInt(data[2]);

                int itemAmount = Integer.parseInt(data[3]);

               

                if (player.getInventory().getItemByObjectId(itemId) == null)

                {

                    showChatWindow(player);

                    player.sendMessage("Invalid item. Please try again.");

                    return;

                }

                if (player.getInventory().getItemByObjectId(itemId).getCount() < itemAmount)

                {

                    showChatWindow(player);

                    player.sendMessage("Invalid item. Please try again.");

                    return;

                }

                if (!player.getInventory().getItemByObjectId(itemId).isTradable())

                {

                    showChatWindow(player);

                    player.sendMessage("Invalid item. Please try again.");

                    return;

                }

               

                int costId = 0;

                if (costitemtype.equals("Adena"))

                {

                    costId = 57;

                }

               

                AuctionTable.getInstance().addItem(new AuctionItem(AuctionTable.getInstance().getNextAuctionId(), player.getObjectId(), player.getInventory().getItemByObjectId(itemId).getItemId(), itemAmount, player.getInventory().getItemByObjectId(itemId).getEnchantLevel(), costId, costCount));

               

                player.destroyItem("auction", itemId, itemAmount, this, true);

                player.sendPacket(new InventoryUpdate());

                player.sendMessage("You have added an item for sale in the Auction Shop.");

                showChatWindow(player);

            }

            catch (Exception e)

            {

                showChatWindow(player);

                player.sendMessage("Invalid input. Please try again.");

                return;

            }

        }

        else if (command.startsWith("myitems"))

 

        {

            int page = Integer.parseInt(command.substring(8));

            showMyItems(player, page);

        }

        else if (command.startsWith("remove"))

        {

            int auctionId = Integer.parseInt(command.substring(7));

            AuctionItem item = AuctionTable.getInstance().getItem(auctionId);

           

            if (item == null)

            {

                showChatWindow(player);

                player.sendMessage("Invalid choice. Please try again.");

                return;

            }

           

            AuctionTable.getInstance().deleteItem(item);

           

            ItemInstance i = player.addItem("auction", item.getItemId(), item.getCount(), this, true);

            i.setEnchantLevel(item.getEnchant());

            player.sendPacket(new InventoryUpdate());

            player.sendMessage("You have removed an item from the Auction Shop.");

            showChatWindow(player);

        }

        else

        {

            super.onBypassFeedback(player, command);

        }

    }

   

    private void showMyItems(L2PcInstance player, int page)

    {

        HashMap<Integer, ArrayList<AuctionItem>> items = new HashMap<>();

        int curr = 1;

        int counter = 0;

       

        ArrayList<AuctionItem> temp = new ArrayList<>();

        for (Map.Entry<Integer, AuctionItem> entry : AuctionTable.getInstance().getItems().entrySet())

        {

            if (entry.getValue().getOwnerId() == player.getObjectId())

            {

                temp.add(entry.getValue());

               

                counter++;

               

                if (counter == 10)

                {

                    items.put(curr, temp);

                    temp = new ArrayList<>();

                    curr++;

                    counter = 0;

                }

            }

        }

        items.put(curr, temp);

       

        if (!items.containsKey(page))

        {

            showChatWindow(player);

            player.sendMessage("Invalid page. Please try again.");

            return;

        }

       

        String html = "";

        html += "<html><title>Auction Shop</title><body><center><br1>";

        html += "<table width=310 bgcolor=000000 border=1>";

        html += "<tr><td>Item</td><td>Cost</td><td></td></tr>";

        for (AuctionItem item : items.get(page))

        {

            html += "<tr>";

            html += "<td><img src=\""+IconTable.getInstance().getIcon(item.getItemId())+"\" width=32 height=32 align=center></td>";

            html += "<td>Item: "+(item.getEnchant() > 0 ? "+"+item.getEnchant()+" "+ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount() : ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount());

            html += "<br1>Cost: "+StringUtil.formatNumber(item.getCostCount())+" "+ItemTable.getInstance().getTemplate(item.getCostId()).getName();

            html += "</td>";

            html += "<td fixwidth=71><button value=\"Remove\" action=\"bypass -h npc_"+getObjectId()+"_remove "+item.getAuctionId()+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";

            html += "</td></tr>";

        }

        html += "</table><br><br>";

       

        html += "Page: "+page;

        html += "<br1>";

       

        if (items.keySet().size() > 1)

        {

            if (page > 1)

                html += "<a action=\"bypass -h npc_"+getObjectId()+"_myitems "+(page-1)+"\"><- Prev</a>";

           

            if (items.keySet().size() > page)

                html += "<a action=\"bypass -h npc_"+getObjectId()+"_myitems "+(page+1)+"\">Next -></a>";

        }

       

        html += "</center></body></html>";

       

        NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());

        htm.setHtml(html);

        player.sendPacket(htm);

    }

   

    private void showAddPanel2(L2PcInstance player, int itemId)

    {

        ItemInstance item = player.getInventory().getItemByObjectId(itemId);

       

        String html = "";

        html += "<html><title>Auction Shop</title><body><center><br1>";

        html += "<img src=\""+IconTable.getInstance().getIcon(item.getItemId())+"\" width=32 height=32 align=center>";

        html += "Item: "+(item.getEnchantLevel() > 0 ? "+"+item.getEnchantLevel()+" "+item.getName() : item.getName());

       

        if (item.isStackable())

        {

            html += "<br>Set amount of items to sell:";

            html += "<edit var=amm type=number width=120 height=17>";

        }

       

        html += "<br>Select price:";

        html += "<br><combobox width=120 height=17 var=ebox list=Adena;>";

        html += "<br><edit var=count type=number width=120 height=17>";

        html += "<br><button value=\"Add item\" action=\"bypass -h npc_"+getObjectId()+"_addit2 "+itemId+" $ebox $count "+(item.isStackable() ? "$amm" : "1")+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";

        html += "</center></body></html>";

       

        NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());

        htm.setHtml(html);

        player.sendPacket(htm);

    }

   

    private void showAddPanel(L2PcInstance player, int page)

    {

        HashMap<Integer, ArrayList<ItemInstance>> items = new HashMap<>();

        int curr = 1;

        int counter = 0;

       

        ArrayList<ItemInstance> temp = new ArrayList<>();

        for (ItemInstance item : player.getInventory().getItems())

        {

            if (item.getItemId() != 57 && item.isTradable())

            {

                temp.add(item);

               

                counter++;

               

                if (counter == 10)

                {

                    items.put(curr, temp);

                    temp = new ArrayList<>();

                    curr++;

                    counter = 0;

                }

            }

        }

        items.put(curr, temp);

       

        if (!items.containsKey(page))

        {

            showChatWindow(player);

            player.sendMessage("Invalid page. Please try again.");

            return;

        }

       

        String html = "";

        html += "<html><title>Auction Shop</title><body><center><br1>";

        html += "Select item:";

        html += "<br><table width=310 bgcolor=000000 border=1>";

       

        for (ItemInstance item : items.get(page))

        {

            html += "<tr>";

            html += "<td>";

            html += "<img src=\""+IconTable.getInstance().getIcon(item.getItemId())+"\" width=32 height=32 align=center></td>";

            html += "<td>"+(item.getEnchantLevel() > 0 ? "+"+item.getEnchantLevel()+" "+item.getName() : item.getName());

            html += "</td>";

            html += "<td><button value=\"Select\" action=\"bypass -h npc_"+getObjectId()+"_additem "+item.getObjectId()+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";

            html += "</td>";

            html += "</tr>";

        }

        html += "</table><br><br>";

       

        html += "Page: "+page;

        html += "<br1>";

       

        if (items.keySet().size() > 1)

        {

            if (page > 1)

                html += "<a action=\"bypass -h npc_"+getObjectId()+"_addpanel "+(page-1)+"\"><- Prev</a>";

           

            if (items.keySet().size() > page)

                html += "<a action=\"bypass -h npc_"+getObjectId()+"_addpanel "+(page+1)+"\">Next -></a>";

        }

       

        html += "</center></body></html>";

       

        NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());

        htm.setHtml(html);

        player.sendPacket(htm);

    }

   

    @SuppressWarnings("resource")

    private static void addItemToOffline(int playerId, int itemId, int count)

    {

        try (Connection con = L2DatabaseFactory.getInstance().getConnection())

        {

            PreparedStatement stm = con.prepareStatement("SELECT count FROM items WHERE owner_id=? AND item_id=?");

            stm.setInt(1, playerId);

            stm.setInt(2, itemId);

            ResultSet rset = stm.executeQuery();

           

            if (rset.next())

            {

                stm = con.prepareStatement("UPDATE items SET count=? WHERE owner_id=? AND item_id=?");

                stm.setInt(1, rset.getInt("count") + count);

                stm.setInt(2, playerId);

                stm.setInt(3, itemId);

               

                stm.execute();

            }

            else

            {

                stm = con.prepareStatement("INSERT INTO items VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");

                stm.setInt(1, playerId);

                stm.setInt(2, IdFactory.getInstance().getNextId());

                stm.setInt(3, itemId);

                stm.setInt(4, count);

                stm.setInt(5, 0);

                stm.setString(6, "INVENTORY");

                stm.setInt(7, 0);

                stm.setInt(8, 0);

                stm.setInt(9, 0);

                stm.setInt(10, 0);

                stm.setInt(11, -1);

                stm.setInt(12, 0);

               

                stm.execute();

            }

           

            rset.close();

            stm.close();

        }

        catch (Exception e)

        {

            e.printStackTrace();

        }

    }

   

    private void showAuction(L2PcInstance player, int page, String search)

    {

        boolean src = !search.equals("*null*");

       

        HashMap<Integer, ArrayList<AuctionItem>> items = new HashMap<>();

        int curr = 1;

        int counter = 0;

       

        ArrayList<AuctionItem> temp = new ArrayList<>();

        for (Map.Entry<Integer, AuctionItem> entry : AuctionTable.getInstance().getItems().entrySet())

        {

            if (entry.getValue().getOwnerId() != player.getObjectId() && (!src || (src && ItemTable.getInstance().getTemplate(entry.getValue().getItemId()).getName().contains(search))))

            {

                temp.add(entry.getValue());

               

                counter++;

               

                if (counter == 10)

                {

                    items.put(curr, temp);

                    temp = new ArrayList<>();

                    curr++;

                    counter = 0;

                }

            }

        }

        items.put(curr, temp);

       

        if (!items.containsKey(page))

        {

            showChatWindow(player);

            player.sendMessage("Invalid page. Please try again.");

            return;

        }

       

        String html = "<html><title>Auction Shop</title><body><center><br1>";

        html += "<multiedit var=srch width=150 height=20><br1>";

        html += "<button value=\"Search\" action=\"bypass -h npc_"+getObjectId()+"_auction 1 - $srch\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";

        html += "<br><table width=310 bgcolor=000000 border=1>";

        html += "<tr><td>Item</td><td>Cost</td><td></td></tr>";

        for (AuctionItem item : items.get(page))

        {

            html += "<tr>";

            html += "<td><img src=\""+IconTable.getInstance().getIcon(item.getItemId())+"\" width=32 height=32 align=center></td>";

            html += "<td>Item: "+(item.getEnchant() > 0 ? "+"+item.getEnchant()+" "+ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount() : ItemTable.getInstance().getTemplate(item.getItemId()).getName()+" - "+item.getCount());

            html += "<br1>Cost: "+StringUtil.formatNumber(item.getCostCount())+" "+ItemTable.getInstance().getTemplate(item.getCostId()).getName();

            html += "</td>";

            html += "<td fixwidth=71><button value=\"Buy\" action=\"bypass -h npc_"+getObjectId()+"_buy "+item.getAuctionId()+"\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\">";

            html += "</td></tr>";

        }

        html += "</table><br><br>";

       

        html += "Page: "+page;

        html += "<br1>";

       

        if (items.keySet().size() > 1)

        {

            if (page > 1)

                html += "<a action=\"bypass -h npc_"+getObjectId()+"_auction "+(page-1)+" - "+search+"\"><- Prev</a>";

           

            if (items.keySet().size() > page)

                html += "<a action=\"bypass -h npc_"+getObjectId()+"_auction "+(page+1)+" - "+search+"\">Next -></a>";

        }

       

        html += "</center></body></html>";

       

        NpcHtmlMessage htm = new NpcHtmlMessage(getObjectId());

        htm.setHtml(html);

        player.sendPacket(htm);

    }

   

    @Override

    public String getHtmlPath(int npcId, int val)

    {

        String pom = "";

        if (val == 0)

            pom = "" + npcId;

        else

            pom = npcId + "-" + val;

               

        return "data/html/l2spike/auction/" + pom + ".htm";

    }}

 

Index: data/html/l2spike/auction/65529.htm

===================================================================

--- data/html/l2spike/auction/65529.htm    (revision 0)

+++ data/html/l2spike/auction/65529.htm    (revision 0)

@@ -0,0 +1,25 @@

+<html>

+<title>

+Auction Shop

+</title>

+<body>

+<center>

+<img src="l2spike.npclogo" width=256 height=95>

+<br><img src="l2spike.splitter" width=256 height=8 align=center>

+<br>

+Welcome to L2Spike auction shop!

+<br>

+<table width=230 bgcolor="000000">

+    <tr>

+        <td align=center>

+            <button value="Shop" action="bypass -h npc_%objectId%_auction 1 - *null*" width=204 height=20 back="sek.cbui81" fore="sek.cbui82">

+            <button value="Add item" action="bypass -h npc_%objectId%_addpanel 1" width=204 height=20 back="sek.cbui81" fore="sek.cbui82">

+            <button value="My items" action="bypass -h npc_%objectId%_myitems 1" width=204 height=20 back="sek.cbui81" fore="sek.cbui82">

+        </td>

+    </tr>

+</table>

+<br>

+<img src="l2spike.splitter" width=256 height=8 align=center>

+</center>

+</body>

+</html>

\ No newline at end of file

Index: sql/auction_table.sql

===================================================================

--- sql/auction_table.sql    (revision 0)

+++ sql/auction_table.sql    (revision 0)

@@ -0,0 +1,10 @@

+CREATE TABLE IF NOT EXISTS `auction_table` (

+  `auctionid` INT UNSIGNED NOT NULL DEFAULT 0,

+  `ownerid` INT UNSIGNED NOT NULL DEFAULT 0,

+  `itemid` INT UNSIGNED NOT NULL DEFAULT 0,

+  `count` INT UNSIGNED NOT NULL DEFAULT 0,

+  `enchant` INT UNSIGNED NOT NULL DEFAULT 0,

+  `costid` INT UNSIGNED NOT NULL DEFAULT 0,

+  `costcount` INT UNSIGNED NOT NULL DEFAULT 0,

+  PRIMARY KEY (auctionid)

+);

Index: tools/database_installer.bat

===================================================================

--- tools/database_installer.bat    (revision 17)

+++ tools/database_installer.bat    (working copy)

@@ -104,6 +104,7 @@

 %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/topic.sql

 %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/character_schemes.sql

 %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/bots.sql

+%mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/auction_table.sql

 

 echo Done.

 echo.

Index: tools/database_installer.sh

===================================================================

--- tools/database_installer.sh    (revision 17)

+++ tools/database_installer.sh    (working copy)

@@ -124,6 +124,7 @@

 $MYG < ../sql/topic.sql &> /dev/null

 $MYG < ../sql/character_schemes.sql &> /dev/null

 $MYG < ../sql/bots.sql &> /dev/null

+$MYG < ../sql/auction_table.sql &> /dev/null

 echo ""

 echo "Was fast, isn't it ?"

 }

Index: tools/full_install.sql

===================================================================

--- tools/full_install.sql    (revision 17)

+++ tools/full_install.sql    (working copy)

@@ -45,4 +45,5 @@

 DROP TABLE IF EXISTS siege_clans;

 DROP TABLE IF EXISTS topic;

 DROP TABLE IF EXISTS character_schemes;

-DROP TABLE IF EXISTS bots;

\ No newline at end of file

+DROP TABLE IF EXISTS bots;

+DROP TABLE IF EXISTS auction_table;

\ No newline at end of file

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • It's also the players' fault, because there have been decent servers implementing some of the things you said plus some other 'innovations', plus many QOL things for newbies (ingame bestiary, with drops searchers, etc). In the end, it's the players who decide to feed into that shit and play the most garbage servers simply because the owners of the servers gave their clan leaders 100 euros, or they insta quit the server because they didn't win the first QA, etc, etc, etc.   In the end, if a server is garbage or great it doesn't really matter if the players don't wanna stay in there.   Players are no better than the devs themselves, in the end it seems there are abusive devs who will milk the shit out of their willingly milkable players, or there are none, goes both ways.
    • In my opinion, L2 is dead because the people who make servers didn’t adapt to today’s reality. People are getting older, life moves faster, there are more responsibilities, and less free time. And I’m not even talking about newcomers—how can you expect someone new to this game to learn by Googling every drop location or quest requirement? These things should’ve been integrated into the game, made accessible with just a few clicks through the interface. Instead, so much time was wasted trying to recreate retail-like features that no one asked for. Everyone hates autofarm, but why? Because admins never found a smart way to implement it. You could have made it available only in specific zones, with reduced drops, working like Adrenaline, or auto-teleporting to farm for a limited time per day—just enough to help people with limited time stay relevant in-game. There should also be zones with better drops, where active farming actually matters. Other features feel pointless—like the Life Stone system. Spamming LS to get a skill? Instead, you could create a system where you level up the skill with low chances per level, something that feels progressive and fair. Crafting should be simpler too. Right-click a recipe, and the required materials should show up right there. As for sieges, why not create daily clan war events at peak hours—one for Europeans, one for Latinos? You could spawn crystals inside or outside castles that give points and trigger PvP. Add a boss during the event that gives even more points, and let the top clan in the ranking take the castle. I could go on forever, but what’s the point? The community died because the people who had the knowledge to improve the game just took the easy way out, copying the same server formula over and over until no one could enjoy playing it anymore.
    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
  • Topics

×
×
  • Create New...