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

Implementation of Hercules Ultimate Storage System (HUSS) #3330

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jasonch35
Copy link
Contributor

@jasonch35 jasonch35 commented Nov 4, 2024

Pull Request Prelude

Changes Proposed

  • Implementation of the Hercules Ultimate Storage System
  • Storages can now be created through a configuration file that describes their attributes.
  • Integrated storage_constants (Constant) into the configuration so that it can be assigned dynamically
  • Capacity is capped by MAX_STORAGE at config reading

Storage Configuration

{
        Id: (int)			Unique Identifier
        Name: (string)			Name of the storage sent to the client.
        Constant: (string)		Storage constant to be used by scripts
        Capacity: (int)			Maximum capacity of the storage.
}

Script Command
openstorage(<storage_constant>{, <storage_mode>});

Storage Modes

  • STORAGE_ACCESS_VIEW: View storage only.
  • STORAGE_ACCESS_GET: Allow retrieving items from storage.
  • STORAGE_ACCESS_PUT: Allow depositing items into storage.
  • STORAGE_ACCESS_ALL: (Default mode) Full access for viewing, retrieving, and depositing items.

All atcommands utilizing storage has been updated as well:

  • @storage <storage name/id>
  • @storeall <storage name/id>
  • @clearstorage <storage name/id>
  • @storagelist command only list Main storage for now

Issues addressed:

Credits to: @sagunkho and @dastgirp

Let's gooooo let's push this through!

This commit includes:
- HUSS main implementation
- openstorage script command update
- @storage atcommand update
- @clearstorage atcommand update
- @storeall atcommand update
- @storagelist atcommand update
- There can be an unlimited amount of storages and limits.
- All setting names are case-sensitive and must be keyed accurately.
- The storage capacity will default to MAX_STORAGE in mmo.h if it is set higher
- Storage ID 1 is the default (official) storage for accounts.
- Integrated storage_constants (Constant) into the configuration so that it can be assigned dynamically
@vBrenth
Copy link

vBrenth commented Nov 6, 2024

Thank you @jasonch35 hope this one will get implemented.
Also i want to ask about Storage Limit its still 600 correct?

@jasonch35
Copy link
Contributor Author

Thank you @jasonch35 hope this one will get implemented.
Also i want to ask about Storage Limit its still 600 correct?

Yes, Limit is capped by MAX_STORAGE which is 600 by default.

@jasonch35
Copy link
Contributor Author

jasonch35 commented Nov 7, 2024

Btw, I kept the "default" storage without warning/errors as it is set as default in original Herc's branch.
Commands and scripts will result in "no storage found" message if it is removed/changed.
Or parameter error on server start if its constant isn't found.
I believe server owners should be responsible for adjusting the configuration file, just as they would if they manually remove Red_Potion in item_db.conf, they'd have to manually remove them in scripts if they choose to do so.

Copy link
Member

@guilherme-gm guilherme-gm left a comment

Choose a reason for hiding this comment

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

Thank you for putting the effort in fixing the previous PRs!
I did not try running it yet, but from the code review, I got those questions/points that may need to be addressed.

src/map/storage.c Show resolved Hide resolved
Comment on lines 448 to 452
if ((sd->storage.access & STORAGE_ACCESS_PUT) == 0) {
clif->delitem(sd, index, amount, DELITEM_NORMAL);
clif->additem(sd, index, amount, 0);
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

same question here

Copy link
Member

Choose a reason for hiding this comment

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

I did not test, but another question here: clif->delitem and clif->additem are related to player inventory, in this case, shouldn't we use the calls for Cart instead (clif->cart_additem / clif->cart_delitem)? since this is a move from cart to storage

Copy link
Contributor Author

@jasonch35 jasonch35 Nov 21, 2024

Choose a reason for hiding this comment

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

Just tested. You're right, should be clif->cart_delitem / clif->cart_additem. Changed. c8947dc

src/map/storage.c Show resolved Hide resolved
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.

4 participants