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 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1ffe6ad
Implementation of the Hercules Ultimate Storage System
jasonch35 Nov 4, 2024
0a930b5
Add SQL files for main db and upgrades
jasonch35 Nov 4, 2024
d403047
Add data on message tables for the updated atcommands
jasonch35 Nov 4, 2024
520001b
Storage configuration
jasonch35 Nov 4, 2024
95d6f76
Update NPC scripts to comply with new command
jasonch35 Nov 4, 2024
98ad026
Update script and atcommand documentation
jasonch35 Nov 4, 2024
0cb567d
Update HPM Hooks
jasonch35 Nov 4, 2024
4aea3a4
Show warning if storage capacity is over MAX_STORAGE
jasonch35 Nov 5, 2024
c8947dc
Use cart function when storing from cart
jasonch35 Nov 21, 2024
c5e746a
Indexed storage_id column from storage sql table
jasonch35 Dec 1, 2024
41528de
Char-server to ignore storage sizes and hardcoded to MAX_STORAGE instead
jasonch35 Dec 1, 2024
6e485b3
Moved storage_settings struct from mmo to storage header
jasonch35 Dec 1, 2024
1dccefc
Added access modes argument for storage->open
jasonch35 Dec 1, 2024
8baf55b
Refactored atcommands logic
jasonch35 Dec 1, 2024
973f6f6
Missed name parameter in clif.c
jasonch35 Dec 1, 2024
dcdd63c
Fixed invalid storage(0) assertion
jasonch35 Dec 1, 2024
49997aa
Indentation/space fix
jasonch35 Dec 1, 2024
645b77a
PCCHECK_STORAGE check fix
jasonch35 Dec 1, 2024
d6adf1b
Initialization logic fix
jasonch35 Dec 1, 2024
007a858
Removed unnecessary cleaning of VECTOR
jasonch35 Dec 1, 2024
1c34316
Removed full storage checks for functions that calls storage->additem()
jasonch35 Dec 1, 2024
a919fd8
Set constant at the end of every iteration at config reading
jasonch35 Dec 1, 2024
53baf8b
Update HPM Hooks
jasonch35 Dec 1, 2024
e882183
Messagetable update
jasonch35 Dec 1, 2024
dc85a3e
Proper code styling for asterisks
jasonch35 Dec 1, 2024
3ec152b
Clif update storage amount window to capacity
jasonch35 Dec 1, 2024
8df6252
Corrected documentation
jasonch35 Dec 1, 2024
9f08c77
Storage config reading
jasonch35 Dec 11, 2024
8eaf684
Removed redundant assignment
jasonch35 Jan 2, 2025
761ea97
Clear item list for every storage at unit freeing
jasonch35 Jan 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/map/atcommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,6 @@ ACMD(storage)
return false;
}

sd->storage.access = STORAGE_ACCESS_ALL; // Default storage access for atcommands.

struct storage_data *stor = NULL;
if ((stor = storage->ensure(sd, storage_id)) == NULL) {
ShowError("atcommand_storage: Error ensuring storage for player %d, storage_id %d\n", sd->bl.id, storage_id);
Expand All @@ -916,7 +914,7 @@ ACMD(storage)
return false;
}

if (storage->open(sd, stor) == 1) { //Already open.
if (storage->open(sd, stor, STORAGE_ACCESS_ALL) == 1) { //Already open.
clif->message(fd, msg_fd(fd, MSGTBL_STORAGE_ALREADY_OPEN)); // You have already opened your storage. Close it first.
return false;
}
Expand Down Expand Up @@ -5690,9 +5688,6 @@ ACMD(storeall)
clif->message(fd, msg_fd(fd, MSGTBL_STORAGE_SPECIFY_STOREALL)); // Please specify a storage ID or name. (usage: @storeall <storage name/ID>).
return false;
}

sd->storage.access = STORAGE_ACCESS_ALL; // Default storage access for atcommands.

struct storage_data *stor = NULL;
if ((stor = storage->ensure(sd, storage_id)) == NULL) {
ShowError("atcommand_storeall: Error ensuring storage for player %d, storage_id %d\n", sd->bl.id, storage_id);
Expand All @@ -5701,7 +5696,7 @@ ACMD(storeall)

if (sd->state.storage_flag != STORAGE_FLAG_NORMAL) {
//Open storage.
if (storage->open(sd, stor) == 1) {
if (storage->open(sd, stor, STORAGE_ACCESS_ALL) == 1) {
clif->message(fd, msg_fd(fd, MSGTBL_CANNOT_OPEN_STORAGE)); // You currently cannot open your storage.
return false;
}
Expand Down Expand Up @@ -5756,8 +5751,6 @@ ACMD(clearstorage)
return false;
}

sd->storage.access = STORAGE_ACCESS_ALL; // Default storage access for atcommands.

struct storage_data *stor = NULL;
if ((stor = storage->ensure(sd, storage_id)) == NULL) {
ShowError("atcommand_clearstorage: Error ensuring storage for player %d, storage_id %d\n", sd->bl.id, storage_id);
Expand Down
2 changes: 1 addition & 1 deletion src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -12035,7 +12035,7 @@ static BUILDIN(openstorage)

sd->storage.access = storage_access; // Set storage access level. [Smokexyz/Hercules]
jasonch35 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

This is now redundant since it's done by storage->open()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. thank you. please rereview.


if (storage->open(sd, stor) == 0) {
if (storage->open(sd, stor, storage_access) == 0) {
script_pushint(st, 1); // success
} else {
script_pushint(st, 0);
Expand Down
9 changes: 4 additions & 5 deletions src/map/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,13 @@ const struct storage_settings* storage_get_settings(int storage_id)
* 0 - success
* 1 - fail
*------------------------------------------*/
static int storage_storageopen(struct map_session_data *sd, struct storage_data* stor)
static int storage_storageopen(struct map_session_data *sd, struct storage_data *stor, enum storage_access_modes mode)
{
nullpo_retr(1, sd);
nullpo_retr(1, stor);
Assert_retr(1, stor->received); // Assert the availability of data.

const struct storage_settings* stst = NULL;

nullpo_retr(1, stst = storage->get_settings(stor->uid));
const struct storage_settings *stst = storage->get_settings(stor->uid);
nullpo_retr(1, stst);

if (sd->state.storage_flag != STORAGE_FLAG_CLOSED)
return 1; // Storage is already open.
Expand All @@ -199,6 +197,7 @@ static int storage_storageopen(struct map_session_data *sd, struct storage_data*

sd->state.storage_flag = STORAGE_FLAG_NORMAL; // Set the storage use state.
sd->storage.current = stor->uid; // Set current storage ID used.
sd->storage.access = mode;

/* Send item list to client if available. */
if (stor->aggregate > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/map/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct storage_interface {
struct storage_data* (*ensure) (struct map_session_data* sd, int storage_id);
const struct storage_settings* (*get_settings) (int storage_id);
int (*delitem) (struct map_session_data* sd, struct storage_data* stor, int n, int amount);
int (*open) (struct map_session_data* sd, struct storage_data* stor);
int (*open) (struct map_session_data* sd, struct storage_data* stor, enum storage_access_modes mode);
int (*add) (struct map_session_data* sd, struct storage_data* stor, int index, int amount);
int (*get) (struct map_session_data* sd, struct storage_data* stor, int index, int amount);
int (*additem) (struct map_session_data* sd, struct storage_data* stor, struct item* item_data, int amount);
Expand Down