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

Storing Item Use Callbacks #137

Open
geoversed opened this issue Jul 13, 2024 · 3 comments
Open

Storing Item Use Callbacks #137

geoversed opened this issue Jul 13, 2024 · 3 comments
Assignees
Labels
economy Relevant to the economy system. feature This is a feature request.

Comments

@geoversed
Copy link
Owner

No description provided.

@geoversed geoversed added feature This is a feature request. economy Relevant to the economy system. labels Jul 13, 2024
@geoversed geoversed self-assigned this Jul 13, 2024
@geoversed geoversed moved this to Backlog in c2c Development Jul 13, 2024
@geoversed
Copy link
Owner Author

I may or may not have opened an issue similar to this in the past, but to no surprise it is difficult to figure out how to approach this one. It seems bundling the item uses in a dictionary seems to be the only option. Still in the process of looking for more alternatives.

@geoversed
Copy link
Owner Author

geoversed commented Jul 19, 2024

Seems I have to think of my own solution here, the internet doesn't have any.

This could take months.

@geoversed
Copy link
Owner Author

This pairs alongside the issue: storing item logic within the database, rather than manually carrying them out in each individual item use callback.

For instance, we can create a column named reuse alongside the shop item table to indicate which items are reusable. Then, in the single use slash command callback, we check that it is reusable. If not, deduct the specified quantity from the user. It is frankly disturbing that this has only just been realized.

As for storing connections in the callback, we don't want this happening so from now on, we are simply going to release the currently acquired connection after all item checks pass and before we begin searching for the respective item callback. In the callback itself, we'll need to acquire another connection. Alternatively, we don't and just store the connection in the dataclass we already use:
https://github.com/SGA-A/c2c/blob/527a530e4908d78bcdf3032ac154e39fbf98e3d9/cogs/economy.py#L1739-L1741

@geoversed geoversed mentioned this issue Aug 31, 2024
2 tasks
@geoversed geoversed removed the planned label Oct 16, 2024
@geoversed geoversed changed the title Rewrite how items uses are set Storing Item Use Callbacks Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
economy Relevant to the economy system. feature This is a feature request.
Projects
Status: Backlog
Development

No branches or pull requests

1 participant