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

Price Discrepancy Issue in NPC Trading. #2702

Closed
3 of 5 tasks
kaleohanopahala opened this issue Jun 19, 2024 · 4 comments · Fixed by #2830
Closed
3 of 5 tasks

Price Discrepancy Issue in NPC Trading. #2702

kaleohanopahala opened this issue Jun 19, 2024 · 4 comments · Fixed by #2830
Labels
Status: Pending Test This PR or Issue requires more testing Type: Missing Content Content that was not yet implemented or is not following the accepted standards

Comments

@kaleohanopahala
Copy link
Contributor

Priority

Missing Content

Area

  • Datapack
  • Source
  • Map
  • Other

What is missing?

Hello, I noticed that there isn't a check that could be important.

It's possible for an item to be sold at a price lower than its purchase price. Currently, there are no checks for this.
Such a flaw may exist in one or more NPCs.

I can buy it for 12.
image

I can sell it for 22.
image

Code of Conduct

  • I agree to follow this project's Code of Conduct
@github-actions github-actions bot added Status: Pending Test This PR or Issue requires more testing Type: Missing Content Content that was not yet implemented or is not following the accepted standards labels Jun 19, 2024
@FelipePaluco
Copy link
Contributor

FelipePaluco commented Jun 21, 2024

The problem that you can sell for more than your buy price it's not a problem because it's fully configurable by the developer. But you may want to tell us which NPC is having this behavior if you found one in the datapack.

@kaleohanopahala
Copy link
Contributor Author

kaleohanopahala commented Jun 22, 2024

The problem that you can sell for more than your buy price it's not a problem because it's fully configurable by the developer. But you may want to tell us which NPC is having this behavior if you found one in the datapack.

In the event that there is an NPC with an issue among the 1000+, adding a warning would be useful, wouldn't it?
Additionally, if someone uses the base to create something custom and mistakenly configures it incorrectly, the same warning would be useful...
PS: In the case of the image, I created an example of an error.

@luanluciano93
Copy link
Contributor

Try replacing this: https://github.com/opentibiabr/canary/blob/main/data/scripts/lib/register_npc_type.lua#L157-L162

that's why:

			if shopItems.buy then
				parent:setBuyPrice(shopItems.buy)
			end
			if shopItems.sell then
				parent:setSellPrice(shopItems.sell)
			end
			if shopItems.buy and shopItems.sell then
				if shopItems.buy <= shopItems.sell then
					logger.warn("The item {} ({}) is being purchased by the NPC for a value greater than the value of its sale by the same NPC.", shopItems.itemName or shopItems.itemname, shopItems.clientId or shopItems.clientid)
				end
			end

@Solkrasm

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Test This PR or Issue requires more testing Type: Missing Content Content that was not yet implemented or is not following the accepted standards
Projects
None yet
4 participants