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

[Feature] Implement Move Multiple Items #4259

Merged
merged 20 commits into from
Jul 30, 2024

Conversation

catapultam-habeo
Copy link
Contributor

@catapultam-habeo catapultam-habeo commented Apr 15, 2024

Description

This implements ctrl-click movement of bag contents for ROF+ clients.

Type of change

  • New feature (non-breaking change which adds functionality)

Testing

There are three behaviors that are introduced here;

  • CTRL + left click -> drops an item into a bag without opening it.
  • CTRL + left click -> adds the contents of a bag (on cursor) into another bag without opening it
  • CTRL + right click -> swaps the contents of two bags if a bag is on your cursor and you ctrl-right click on another bag.

I don't know how to attach images to demonstrate this.

I would furthermore like some assistance testing this.

Clients tested:

  • ROF2

Checklist

  • I have tested my changes
  • I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
  • I have made corresponding changes to the documentation (if applicable, if not delete this line)
  • I own the changes of my code and take responsibility for the potential issues that occur

@catapultam-habeo
Copy link
Contributor Author

Do not merge this. Found some bugs.

@Akkadius Akkadius marked this pull request as draft April 16, 2024 04:13
@catapultam-habeo
Copy link
Contributor Author

catapultam-habeo commented Apr 17, 2024

This isn't working correctly because the cursor bag re-orders itself on SwapItem, causing the transfers subsequent to the first one to fail. I'm not certain how to fix that right now.

No, it is because the swap contains redundant two-way operations.

@catapultam-habeo
Copy link
Contributor Author

catapultam-habeo commented Apr 18, 2024

This works according to my testing. It implements all 3 ctrl-click modes exactly replicating client behavior.

  1. ctrl + left click single item into bag -> places item into bag without opening it. This will combine stacks as needed, including filling multiple stacks as needed.
  2. ctrl + left click bag into bag -> fills target bag with contents of source bag. client checks if there is enough room, etc. This will combine stacks as possible\needed.
  3. ctrl + right click bag into bag -> swaps contents of bags. This puts things into lowest ordinal bag slots, but does not combine stacks.

left and right click logic needs to be bifurcated because left click handles things a lot like proper slot swaps or autoinv in terms of stack combining, etc, so we want to leverage the existing logic of SwapItem. right click just bluntly exchanges contents, but we need to respect the new targets instead of just explicitly exchanging the bag contents slot for slot.

@catapultam-habeo catapultam-habeo marked this pull request as ready for review April 18, 2024 07:17
@catapultam-habeo catapultam-habeo marked this pull request as draft April 18, 2024 07:25
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
@Kinglykrab Kinglykrab changed the title Implement Move Multiple Items [Feature] Implement Move Multiple Items Apr 21, 2024
@catapultam-habeo catapultam-habeo marked this pull request as ready for review April 23, 2024 06:05
@catapultam-habeo
Copy link
Contributor Author

This has been running on my servers for a while now without issues (~40 users total). I haven't been able to break it personally. I'm reasonably confident in this implementation.

@MazeEQ
Copy link

MazeEQ commented May 5, 2024

This has been running on my servers for a while now without issues (~40 users total). I haven't been able to break it personally. I'm reasonably confident in this implementation.

Can confirm this has been working as expected.

Have not ran into any issues while testing on Cata's servers.

common/emu_constants.h Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
zone/client_packet.cpp Outdated Show resolved Hide resolved
@catapultam-habeo
Copy link
Contributor Author

That was a rebase.

@catapultam-habeo
Copy link
Contributor Author

I'm comfortable with this. I... don't actually know how to make or post videos to demo this in action. It is currently deployed on Retribution.

@Akkadius
Copy link
Member

Akkadius commented Jul 8, 2024

I'm comfortable with this. I... don't actually know how to make or post videos to demo this in action. It is currently deployed on Retribution.

You can use OBS

@catapultam-habeo
Copy link
Contributor Author

Screencast.from.07-07-2024.10.01.57.PM.webm

@catapultam-habeo
Copy link
Contributor Author

I found a dupe. Stand by, do not merge.

@catapultam-habeo
Copy link
Contributor Author

I have corrected the duplication bug. Attached is a video test of all functions.

Screencast.from.07-08-2024.05.17.06.PM.webm

@Akkadius
Copy link
Member

I have corrected the duplication bug. Attached is a video test of all functions.

Screencast.from.07-08-2024.05.17.06.PM.webm

Thank you for addressing all of the changes and posting the video. I think this is great you put this feature together.

My only concern (albeit large) was the feedback around item loss and dupes.

If we feel like we are good there - then I'm good.

@catapultam-habeo
Copy link
Contributor Author

The previous issue was caused by PopItem(...) not sending database updates, so bag swaps could cause additional items to be saved into db in certain circumstances.

I haven't been able to cause any more issues like this; asymmetrical bags, full bags, etc.

@fryguy503
Copy link
Contributor

I pulled this to WFH for live testing, will post any issues I encounter if any.

@Akkadius
Copy link
Member

I pulled this to WFH for live testing, will post any issues I encounter if any.

Awesome

Copy link
Contributor

@fryguy503 fryguy503 left a comment

Choose a reason for hiding this comment

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

Been running this for a week and have not noticed any issues related to this PR. Players that use it absolutely love it!

Thank you Cata!

@fryguy503 fryguy503 merged commit fc3c691 into EQEmu:master Jul 30, 2024
1 check passed
@joligario joligario mentioned this pull request Jul 30, 2024
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.

5 participants