Jump to content

Recommended Posts

Posted (edited)

Hello.

 

This is an auction shop I made some time ago for aCis.

 

How it works: Players can add items for sale at the auction shop at the price they want. Then, even if they are offline other players can buy the items and they will get the rewards(the price they put). Enchant of items stays, augmented items are not sellable.

There is a searching system(case sensitive) and a paging system.

 

I have NOT tested this code on a live server (only local testing), but I remember adding a shittone of checks to avoid any exploits. I recommend you test it out well before using it.

 

You need to make an npc with id 65529 and type L2AuctionManager.

 

Code: http://pastebin.com/QqY6LGWV

Update - Replace AuctionTable and L2AuctionManagerInstance with these:

AuctionTable (update: the bug mentioned in the replies fixed): http://pastebin.com/vVPhiXKY

L2AuctionManagerInstance: http://pastebin.com/h8LFuesV

 

Some pictures:

 

(Please excuse my html designs..)

 

2ikpbbm.jpgk9c9bk.jpgsdfx4l.jpg2qsb5ab.jpg

 

24n35s2.jpg2cmniwg.jpgrqwuq1.jpg

Edited by An4rchy
Posted (edited)

- You will end with instant ConcurrentException on multiplayer scenario. items list should be stored on a concurrenthashmap (avoid copyonwritearraylist, terrible performance).

- string concat in a for loop is the devil (while regular concat is transformed into StringBuilder, in a for loop it doesn't), use StringUtil.append and a StringBuilder.

- all your paging systems can be replaced for existing and cleaner scenarios, such as Bookmark and SchemeBuffer (using MathUtil.countPagesNumber).

- Use try-with-ressources statement (jdk 7) to avoid to bother with ressource close (eliminate an eventual miss and drop the finally block).

- HTM on htm side, to make code more readable/maintainable.

- There could have a bid system, if price is 0 (or you add a checking case).

- Adena should be formatted using StringUtil.formatNumber

- If an item is listed for a very long time, it should be moved back on player inventory (to avoid the list being longer and longer) - One week default.

- server should take a fee, both to set an item (avoid to flood the market with single soulshots) and once the item is sold (to recycle some adena, economy lesson).

- Some items shouldn't be able to be sold, or at least not with low amount (I think about soulshots, arrows) to limit the number of objects (idiots can easily make your server a burden spamming 1 soulshot selling, making the whole system lag if they find a way to automatize it)

- Writting "Cost:" and "Item:" is a waste of space.

Edited by Tryskell
Posted

- You will end with instant ConcurrentException on multiplayer scenario. items list should be stored on a concurrenthashmap (avoid copyonwritearraylist, terrible performance).

- string concat in a for loop is the devil (while regular concat is transformed into StringBuilder, in a for loop it doesn't), use StringUtil.append and a StringBuilder.

- all your paging systems can be replaced for existing and cleaner scenarios, such as Bookmark and SchemeBuffer (using MathUtil.countPagesNumber).

- Use try-with-ressources statement (jdk 7) to avoid to bother with ressource close (eliminate an eventual miss and drop the finally block).

- HTM on htm side, to make code more readable/maintainable.

- There could have a bid system, if price is 0 (or you add a checking case).

- Adena should be formatted using StringUtil.formatNumber

- If an item is listed for a very long time, it should be moved back on player inventory (to avoid the list being longer and longer)

- server should take a fee, both to set an item (avoid to flood the market) and once the item is sold (to recycle some adena, economy lesson)

- I thought about that to be honest when I was uploading this share, but it's been 2+ years since I made it. Gonna update it.

- I don't see what could go wrong with that to be honest..

- The paging system was added after the original npc was created(since I ended with critical errors on many items) so it's really messy and to be honest I can't be bothered to update it.

- I know, idk why I did it that way when I was making it to be honest. Gonna be on next update.

- I always prefer htmls on htm side but in this case most of the htm is generated server-side so it would be pointless having 5 lines of htm code in htm side when the htm is way longer.

- Extra feature, can't be bothered to add it.

- Gonna be on next update, thanks.

- Extra feature, can't be bothered to add it.

- Extra feature, can't be bothered to add it.

 

Thanks for the feedback.

Posted (edited)

Just wait the update. To be honest was looking for something like this tho :D
Had an auction system before but no idea where it vanished.

+1 for your recent shares.

Edited by big man bill
Posted

update

  • L2AuctionManagerInstance.java
        ArrayList<ItemInstance> temp = new ArrayList<>();
        for (ItemInstance item : player.getInventory().getItems())
        {
-           if (item.getItemId() != 57 && item.isTradable())
+           if (item.getItemId() != 57 && item.isTradable() && !item.isEquipped())
Posted

Yeah this bug was caused because I changed from a list to a map, I forgot to change items.remove(item); to items.remove(item.getAuctionId()); on removeItem() method.

 

Thanks for the report, fixed and topic updated.

  • 2 months later...
  • 2 weeks later...
Posted (edited)

Its interesting because this code works perfectly but when im trying it in game everything working exclude method "showAuction" do not show any items but in block "My Items" or "Add Items" its working normally any suggestion? THX :)

 

// edit

 

I only delete Icons because i dont have table in DB with items icon that cant be a problem I'm sure :)

Edited by TheMark147

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • 🔥 L2-LORENA.COM — INTERLUDE x5000 CUSTOM PvP 🔥 ⚔️ GRAND OPENING — 02 OCTOBER 2026 🕗 20:00 UTC+2 / Berlin Time Website: L2-LORENA Interlude x5000 PvP Discord: Discord < Join Us! A new season is coming. L2-LORENA x5000 is a Custom Interlude PvP server built around fast progression, active PvP, custom equipment, farming zones, Epic Boss competition, weekly clan objectives and rebalanced classes. ━━━━━━━━━━━━━━━━━━━━━━ 🔥 SERVER INFORMATION ━━━━━━━━━━━━━━━━━━━━━━ ⚔️ Chronicle: Interlude 🔥 Type: Custom PvP ⭐ EXP: x5000 💰 Adena: x500 👤 Starting Level: 76 🏰 Starting Town: Giran 🤖 Auto Farm: Enabled 👥 Maximum Boxes: 2 ✨ Buff Slots: 50 🏯 Castle Siege: Weekly Giran Siege ━━━━━━━━━━━━━━━━━━━━━━ ⚒️ ENCHANT SYSTEM ━━━━━━━━━━━━━━━━━━━━━━ 🔹 Safe Enchant: +4 🔹 Normal Scroll: 50% 🔹 Blessed Scroll: 70% 🔹 Crystal Scroll: 100% Normal / Blessed Maximum: +15 Crystal Maximum: +20 💎 Crystal Scrolls are obtained from Epic Bosses. ━━━━━━━━━━━━━━━━━━━━━━ 🛡️ CUSTOM PROGRESSION ━━━━━━━━━━━━━━━━━━━━━━ ✨ Custom Armor & Weapons 💍 Epic, Rare & Custom Jewelry 🪽 Custom Wings with special stats 🐉 Agathion Upgrade System — Lv.1 → Lv.2 → Lv.3 ⚔️ Fighter & Mage Tattoos 🎭 Accessories with different bonuses 👗 DressMe Character Skins 💎 Custom Augmentation System 🔥 PvP Coins & PvP Rewards ━━━━━━━━━━━━━━━━━━━━━━ 🌍 FARMING ZONES ━━━━━━━━━━━━━━━━━━━━━━ 🟢 Easy Zone — designed for new players 🟡 Medium Zone — stronger monsters and improved rewards 🔴 Premium Zone — large farming area with excellent drops ⚠️ Harder farming zones have NO PK Guards. Premium Account provides: 💰 x2 Drop 🌍 Access to the Premium Farm Zone ━━━━━━━━━━━━━━━━━━━━━━ ⚔️ PvP & EVENTS ━━━━━━━━━━━━━━━━━━━━━━ 🔥 Dedicated Despair PvP Zone 🚩 Automatic PvP Flag 🪙 PvP Coins from PvP ⚔️ Automatic Team vs Team events 🏆 Dungeon Event 👑 Weekly Giran Castle Siege Dungeon Event Rewards 🌟 Top Farmer: 30x Lucky Box 💀 Top Killer: 30x Lucky Box ━━━━━━━━━━━━━━━━━━━━━━ 👑 EPIC BOSSES ━━━━━━━━━━━━━━━━━━━━━━ 🐜 Ant Queen ⚙️ Core 🕷️ Orfen ⚓ Zaken 👑 Baium 🐉 Antharas 🔥 Valakas ☠️ Frintezza ⏱️ Normal Raid Boss Respawn: 2 Hours ⏱️ Epic Boss Respawn: 8–12 Hours Epic Bosses can reward Crystal Enchant Scrolls. Our in-game Raid Boss Drop Informer allows you to check boss items, quantities and drop chances directly from Giran before teleporting. ━━━━━━━━━━━━━━━━━━━━━━ 🧙 CLASS REBALANCE ━━━━━━━━━━━━━━━━━━━━━━ L2-LORENA includes extensive Interlude class adjustments designed for the custom PvP environment. ✔️ Dreadnought ✔️ Duelist ✔️ Phoenix Knight ✔️ Adventurer ✔️ Sagittarius ✔️ Archmage ✔️ Soultaker ✔️ More balancing and adjustments Changes include PvP attack/defense adjustments, skill range and reuse modifications, improved class-specific mechanics, monster damage bonuses and reworked skills. ━━━━━━━━━━━━━━━━━━━━━━ 💎 AUGMENTATION ━━━━━━━━━━━━━━━━━━━━━━ 🔹 Mid Life Stone — 3% 🔹 High Life Stone — 5% 🔹 Top Life Stone — 8% Maximum: 2 Augmentation Skills ⚡ 1 Active + 1 Passive A custom Augment Seller allows players to browse organized augmentation skill categories directly in-game. ━━━━━━━━━━━━━━━━━━━━━━ 🏙️ GIRAN — MAIN TOWN ━━━━━━━━━━━━━━━━━━━━━━ Everything you need is available directly from the main town: 🛒 GM Shop ✨ Custom Shop 🧙 NPC Buffer + Schemes 🌍 Farming Gatekeeper 👑 Raid Boss Drop Informer 💎 Augment Seller 📖 Complete Server Information Useful Commands: 🌍 .gk — Global Teleport ❤️ .ap — Auto CP / HP / MP ━━━━━━━━━━━━━━━━━━━━━━ 🔥 NEW ITEMS • NEW RULES • NEW SEASON 🔥 ⚔️ Tier 1 / Tier 2 Weapons & Armors 🪽 Wings 🐉 Agathions 🤖 Auto Farm 👥 Free 1+1 Boxes 🏆 Custom Events 👑 Epic Boss Competition 🏯 Weekly Giran Siege ⚔️ Rebalanced PvP 📅 GRAND OPENING 🔥 02 OCTOBER 2026 🕗 20:00 UTC+2 — Berlin Time 🌐 L2-LORENA.COM 💬 DISCORD.GG/TYZ88TGX4B ⚔️ INTERLUDE x5000 CUSTOM PvP 🔥 L2-LORENA — NEW SEASON
    • L2-Gold Custom PvP – is LIVE! Hey guys! We are opening a brand new Custom PvP server. What we offer: High Rates & Custom PvP Gameplay Custom NPC Buffer, GM Shop & Global GK Balanced classes and epic custom items Interlude with c4 skills Rewards: Every active player who reports bugs or gives feedback will receive Exclusive Custom Rewards.   All files, patch, and support are inside our Discord. Join Here: [https://discord.gg/9qkSxQtTq] Join Here:https://www.facebook.com/profile.php?id=61594313618908
    • 🎨 Full Design Suite: Canva Pro, CapCut Pro, and Adobe suites in stock. Upgrade today with zero downtime!
    • the concept integrated also in public acis  https://youtu.be/KEBvdTSTzl8
    • Highly recommend Litch is super passionate about his work and always puts in the effort to deliver great quality 10/10 give it a try big vouch good luck @Litch
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..