Jump to content

Interlude Auction Shop


An4rchy

Recommended Posts


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

+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);

 

Edited by Tony360
Link to comment
Share on other sites

  • 1 month later...

What if exception is thrown in add/delete when trying to update database?
Correct me if I am wrong but shouldn't these operations act as transactions or otherwise you will have possibility of duplicated/lost items?

 

edit:

ah I see it was updated

all fine for me now

 

edit2:

Why is no one complaining about missing IconTable?

Edited by bistabil
Link to comment
Share on other sites

I am testing this and reading the code.

 

Seller will lose adena if sum of price and adena he currently owns exceeds max adena amount.

 

Also, way the pagination is implemented worries me.

 

Another feature that this auction should have is expiration otherwise list could get full of trash fast.

 

edit:

 

First I thing that bothered me about pagination was performance but now I see that it wont work because order of inserts is not preserved thus one can't predict end result.

Edited by bistabil
Link to comment
Share on other sites

  • 4 weeks later...

Hello, how would you put it to sell also the weapons with skill of argumets to sell?

 

I can put some of my girlfriends there so you can argument all the day.

Link to comment
Share on other sites

  • 2 years later...


Hi guys.
Sorry for my English.
My Java is bad too.))


I am using 382 aCis.

There is no XMLDocumentFactory.java 

(which, as I understand it, is used for parsing icons for an auction.)

ACis 382 have IXmlReader.java method

is there an option to use IXmlReader.java?.

Pulled with (368)
XMLDocumentFactory.java.  the norm works


And please tell me.
How to limit items allowed for sale at auctions?

Edited by alexmaghym
Link to comment
Share on other sites

Hey.

 

Regarding your XML issue, it's not really used in this code, except for the icon table which I basically don't have anymore in order to provide a fix/help for you. But IXmlReader is much easier and cleaner to use than previous methods for reading xml (on aCis always). Try to see some examples in datatables.xml.

 

As for a limit on the items one can add on the shop, it's quite simple really, you just need to add a method in AuctionTable to read how many items a player has for auction like so:

 

https://pastebin.com/XANukcpm

 

Then just add a check under else if (command.startsWith("addit2"))

to check if player exceeded the limit: if (AuctionTable.getInstance().getNumberOfAuctions(player) >= YOUR_LIMIT

Link to comment
Share on other sites

On 4/8/2020 at 6:44 AM, An4rchy said:

Привет.

 

Что касается вашей проблемы с XML, она не используется в этом коде, за исключением таблицы значков, которая может предоставить вам исправление / помощь. Но IXmlReader гораздо проще, чем предыдущие методы чтения XML (всегда в aCis). Попробуйте увидеть некоторые примеры в datatables.xml.

 

Что касается ограничения на количество предметов, которые можно добавить в магазин, то можно просто добавить метод в AuctionTable, чтобы узнать, сколько предметов у игрока на аукционе, например:

 

https://pastebin.com/XANukcpm

 

Затем просто добавьте проверку в  else if (command.startsWith ("addit2"))

проверить, превысил ли игрок лимит: if (AuctionTable.getInstance (). getNumberOfAuctions (player)> = YOUR_LIMIT

 

 

my English is not very good ((( thanks a lot !!!

but

I want the auction to have only certain items in inventory.

For example - armor weapons jewelry
 

 

 


Error: for (AuctionItem item : items)

Error: Can only iterate over an array or an instance of java.lang.Iterable

 

  1.     public int getNumberOfAuctions(Player player)
  2.     {
  3.         int i = 0;
  4.         for (AuctionItem item : items)
  5.             if (item.getOwnerId() == player.getObjectId())
  6.                 i++;
  7.         return i;
  8.     }

 

 

 

Сan tell me a piece of code: to charge for the services of an auction?

For example, adena

 

 

Edited by alexmaghym
Link to comment
Share on other sites

  • 10 months later...

Everything that @Tryskell cited has not been done yet, I organized a few things and redid AuctionTable, I still need to paginate the pages and optimize the AuctionManager.

 

AuctionManager - https://pastebin.com/YGmT4Uv2

AuctionTable - https://pastebin.com/TnXjWFdi

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...