-
Notifications
You must be signed in to change notification settings - Fork 74
House auction #47
Comments
Not a nostalrius server side issue, auctions should be managed on website. |
Yes of course the auctioning should be managed by an external website. However this specific event "onStartup" is in fact part of the server side of Nostalrius. The behaviour that exists right now does not reflect how cip handled this in 7.7 as there was no banking system back then. |
You have to change website too to make a bid because it looks for player balance, so I think that would be more suitable to add bank System to bank npcs. |
Well still, this is supposed to be a 7.7 clone so I dont think a banking system should be implemented if you want to keep it a 7.7 clone. So the question is how to fix this in the best way? Should a sql request be performed from lua and try to count the money in the affected depot at startup and then remove the money with another sql statement or should this be performed in some other way. The removing of rent is currently correctly being performed by the payHouses method on the House class. The server does this at startup in otserv.cpp on line 268. I figure, maybe the same can be done for when an auction has been won by somehow implementing a new method for this. But then we need to check who is highest bidder for house and when auction ends. These methods do not currently exist in the House class. |
Nice workaround, you can replace that: |
You need to change website too to look for depot instead balance. |
Yes I dont know how to implement this with sql because Im not sure exactly how the pid and sid work in the player_depotitems table, they dont seem logic to me. If I put items in the depot locker in thais it will get pid 101, however the pid for other containers in the same depot will differ and not in a logical way that is easy to understand. How would I query to only get the items in for example Thais depot? I dont understand why I would need to change that on website though? The frontend doesnt need that information. Server will check at startup if enough money exists in depot, if not enough money the auction will simply be restarted by setting the bid, bid_end, highest_bid, last_bid, owner and highest_bidder to 0. |
You have to look on RME for that, but I'm not sure atm. How do you place a bid? |
Im building a frontend from scratch. Im not using ZnoteAAC or any other prebuilt scripts. Everything will be handled through http requests via javascript from the frontend to a backend server that communicates with the database. I've got all of the bidding and every logic working with that. However the gameserver needs to check at startup for auctions that have ended and update the owners in that case and draw money from the depot in the affected city. I dont know how to do this in a good way with SQL as I dont know how to query for one specific city depot. |
I really like your approach but this issue fix cannot be applied to all, because almost all the people are using premade website frontends like Znote or gesior and they need to check for balance. |
Yes maybe you are right. I think I finally understand how the table works now so I think I can implement this. So just to explain how the player_depotitems table works (according to my investigation): Every depot that has items will get a new row in the table. |
Despite your solution could not be suitable for all nostalrius users, I would like to see it and if you want to share it, it will be great! |
In startup.lua there is this code:
You only have to change that to a function to remove the required money from depot. In Medivia, if you don't have the money required it bans your character to avoid people abuse the system. Something like: Check depot money |
Thanks, I actually solved it in the cpp code, so I've got it all working now. This is how they did it in Tibia during 7.72, I dont know what they do today cause I dont play anymore :) However ofc I could ban them if not having money, I will think about that :) |
Well, now can you share the code to test on my server? |
Sure, see my latest commit on my fork of this repo. |
Working perfectly!
|
how disable? can u tell me? exactly? idk work with Znote system |
You have to look in the code where it checks for “balance” and comment or change that lines. I let the players bid without restrictions. It would be nice to have any system to prevent abuse like a ban when you bid and no money on your depot on startup checks for example. |
Current behaviour: At startup server checks in global event startup.lua for houses on auction and if auction has ended. If auction has ended it finds the playerid with highest bid and then tries to draw money from players balance in database. Since the balance property isnt being used and balance property is most likely 0 the script will reset auction and player doesnt get the house. Keep in mind, this has nothing to do with the talkaction !buyhouse.
Desired behaviour:
At startup server should check if player with highest bid has enough money in depot to pay rent + bid. Then server should decrement this amount from amount of money in players depot.
If player doesnt have this amount in the depot the auction should be restarted and player does not receive the house.
Affected code:
The affected lines of code can be found in data/globalevents/scripts/startup.lua on lines
20 to 37.
I've been trying to figure out how to fix this in a good way but I'm stuck.
The text was updated successfully, but these errors were encountered: