HerculesWS / Hercules

Hercules is a collaborative software development project revolving around the creation of a robust massively multiplayer online role playing game (MMORPG) server package. Written in C, the program is very versatile and provides NPCs, warps and modifications. The project is jointly managed by a group of volunteers located around the world as well as a tremendous community providing QA and support. Hercules is a continuation of the original Athena project.
http://herc.ws
GNU General Public License v3.0
894 stars 754 forks source link

HUSS #3302

Open Samuel23 opened 3 months ago

Samuel23 commented 3 months ago

Pull Request Prelude

Changes Proposed

Design

Implementation of the Hercules Ultimate Storage System Storages can now be created through a configuration file that describes their attributes. Example storage configuration:

{
        Id: (int)                              (required|unique) Unique Identifier
        Name: (string)                         (required) Name of the storage sent to the client.
        Capacity: (int)                        (required) Maximum capacity of the storage.
}

Additional storages are handled with dynamic arrays that will save a tonne of memory when created, as opposed to a design in which they were implemented using fixed length arrays. In simple terms, a storage of 600 items would approximately cost the same amount of memory as 600 storages with 1 item each. They are saved in the same storage database (SQL) as the original separating them by a storage identifier. An infinite number of storages can be created, there are no limits. The current design implementation only allow saving/loading of approximately 1600 items per storage due to packet size limits.

PS. Make sure you apply SQL upgrades for this patch!

Access Modes

Storage access modes can be set through the openstorage builtin command.

    STORAGE_ACCESS_VIEW     // View storage only
    STORAGE_ACCESS_GET      // Allow getting items from storage.
    STORAGE_ACCESS_PUT      // Allow putting items to storage.
    STORAGE_ACCESS_ALL      // Allow all actions.

Default storage mode : STORAGE_ACCESS_ALL

Script Commands

Changed: openstorage(<storage_id>{, <storage_mode>})

Credits still to: @sagunkho and @dastgirp Just updated and tested with latest repository version Issues addressed:

[x] #1763 [x] #2724

vBrenth commented 1 month ago

Still waiting for this to get implemented officially.