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

fix: obtain phantasmal jade mount #3100

Closed
wants to merge 5 commits into from
Closed

Conversation

pedrohfk
Copy link
Contributor

Description

The check condition of required items is wrong.

Behaviour

To get the mount, you need to have exactly 1x spectral saddle and 1x spectral horse tack

Actual

Now, regardless of whether you have 1 or more items in your backpack, you will be able to receive the item.

Expected

Fixes

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Server Version:
  • Client:
  • Operating System:

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

pedrohfk and others added 5 commits June 29, 2024 00:55
Variable success on function SaveHirelings() always return nill, crashing the server at the time of /closeserver or when the character tries to log out.
Co-authored-by: Pedro Cruz <[email protected]>
# Description

The check condition of required items is wrong.

## Behaviour

To get the mount, you need to have exactly 1x spectral saddle and 1x spectral horse tack

### **Actual**

Now, regardless of whether you have 1 or more items in your backpack, you will be able to receive the item.
Copy link

@@ -37,7 +37,7 @@ function phantasmalJadeMount.onUse(player, item, fromPosition, target, toPositio
end

if table.contains({ 34072, 34073, 34074 }, item.itemid) then
if player:getItemCount(34072) >= 4 and player:getItemCount(34073) == 1 and player:getItemCount(34074) == 1 then
if player:getItemCount(34072) >= 4 and player:getItemCount(34073) >= 1 and player:getItemCount(34074) >= 1 then
Copy link

@Nottinghster Nottinghster Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that better?

if player:removeItem(34072, 4) and player:removeItem(34073, 1) and player:removeItem(34074, 1) then

And remove all these lines

player:removeItem(34072, 4)
player:removeItem(34073, 1)
player:removeItem(34074, 1)

Copy link
Contributor

@phacUFPE phacUFPE Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is not a good idea, because with this code that you are suggesting it could lead to the removal of the first 4 items but if the others items did not fulfill the requirement of 1 item each, it will not deliver the mount and it will be removing the items that has the requirements fulfilled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, the mechanics are completely wrong. Here is how it works correctly:
https://www.youtube.com/watch?v=qkZQiHLUvjA

@pedrohfk pedrohfk closed this Nov 15, 2024
dudantas pushed a commit that referenced this pull request Nov 21, 2024
This fixes the item usage mechanics for obtaining the
Phantasmal Jade mount.
It ensures that the correct number of items are used, and the mount is
granted when all requirements are met.
Additionally, it automates the registration of item IDs to simplify the
code and reduce redundancy.

Close #3100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants