Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

House Bid #470

Closed
htc16 opened this issue Apr 9, 2021 · 11 comments
Closed

House Bid #470

htc16 opened this issue Apr 9, 2021 · 11 comments
Labels
Solved/answered Issue has been completed/solved/answered. Support/Help Asking for help or guidance to solve a problem or challenge Unrelated Issue not related to this Znote AAC repository

Comments

@htc16
Copy link

htc16 commented Apr 9, 2021

Good afternoon!

Znote, I am not able to solve the problem regarding the purchase of house on the website.
I use the Nostalrius base, and when I try to buy a house it says that I have no money.
I imagine that the problem is associated with the balance, which in the case of nostalrius there is not.
Everything is done by players_items.
Would I have to change the balance check to look for money in players_items, in house.php?

$yourChars = mysql_select_multi("SELECT id, name, balanceFROMplayersWHEREaccount_id='". $user_data['id'] ."';");

How would I go about looking for money in the player instead of the balance on balance?

Thank you!

@Znote
Copy link
Owner

Znote commented Apr 12, 2021

I would query depotitems table for itemids associated to currency, calculate and sum their values together for each player.
I think in the olden days, if you wanted to buy or pay rent for carlin houses, you needed to place the money inside carlin depot. That narrows down the search in the SQL query to player id and depot id.

Getting the balance is the easy part though, removing the money can be a bit tricky. You need to keep track of the unique identifiers for each row containing some currency item, remove it until the last stack, and update the last stack to its appropriate value, or replace it with the remaining gold. The player has to be offline for this to work, so it might be best to do it in-game on server startup.

If you link me your database schema structure, I might build a few queries for you. But I don't have time to test them.

@htc16
Copy link
Author

htc16 commented Apr 12, 2021

Many thanks for the reply.
But there is already a configuration that performs this form of payment.
As seen here:
Ezzz-dev/Nostalrius#47 (comment)
and
V0RT4C/Nostalrius@a63f33b

The work of paying directly for the corresponding depot is already set up directly in the source as you can see.
Now the only thing missing is the website to check if there is money in the player's database, because after that the lottery itself will do the rest ...

@htc16
Copy link
Author

htc16 commented Apr 12, 2021

In order to complement:
Ezzz-dev/Nostalrius#47 (comment)

@Znote
Copy link
Owner

Znote commented Apr 12, 2021

Aha, well you can try to replace $yourChars = mysql_select_multi ... with this:

$yourChars = mysql_select_multi("
	SELECT 
		`p`.`id`, 
		`p`.`name`,
		(
			SELECT 
				SUM(CASE 
					WHEN `d`.`itemtype` = 3043 THEN (`d`.`count` * 10000)
					WHEN `d`.`itemtype` = 3035 THEN (`d`.`count` * 100)
					ELSE `d`.`count`
				END)
			FROM `player_depotitems` AS `d`
			WHERE 
				`d`.`player_id`=`p`.`id`
				AND `d`.`itemtype` IN (3031, 3035, 3043)
		) AS `balance`
	FROM `players` AS `p`
	WHERE 
		`p`.`account_id`='{$user_data['id']}';
");

@htc16
Copy link
Author

htc16 commented Apr 12, 2021

Did not find the item, it looks like this:
image

@Znote
Copy link
Owner

Znote commented Apr 16, 2021

Thats weird, did the query work, just not the balance part? Does the character ADM Viper have money in the same depot id the house is connected to?

Are you using a custom version of Znote AAC to properly support Nostalrius? github URL?

@Znote Znote added Support/Help Asking for help or guidance to solve a problem or challenge Unrelated Issue not related to this Znote AAC repository labels Apr 16, 2021
@htc16
Copy link
Author

htc16 commented Apr 17, 2021

Znote, the query worked, but in the wrong way. She researched the money balance in players table, when the correct one was in the player_item table, right?

As for the version I'm using the correct one, I'm just stuck on it, I believe that this would solve the problem of other znote x nostalrius users ...

And thanks for your support!

@htc16
Copy link
Author

htc16 commented Apr 17, 2021

About the money, I left 100k in each city bank to be sure.

@htc16
Copy link
Author

htc16 commented May 12, 2021

@Znote any solution to help me?

@Znote
Copy link
Owner

Znote commented May 12, 2021

@Heitortadeu I'm not sure what the solution is, but I'm fairly certain I could get this solved if I had a development environment I could connect into and code a bit freely. But currently, I'm to busy to set it up. What is your discord tag? You could try to reach me on Discord

@htc16
Copy link
Author

htc16 commented May 12, 2021

Ok @Znote I already sent the request, thanks!

@Znote Znote added the Solved/answered Issue has been completed/solved/answered. label May 26, 2021
@Znote Znote closed this as completed May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Solved/answered Issue has been completed/solved/answered. Support/Help Asking for help or guidance to solve a problem or challenge Unrelated Issue not related to this Znote AAC repository
Projects
None yet
Development

No branches or pull requests

2 participants