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

Add script function to work with item_group #3275

Merged

Conversation

lucasgolino
Copy link
Contributor

Pull Request Prelude

  • I have followed [proper Hercules code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

This PR aims to create a script function to get all items without duplicated from a specific group_id. The idea behind this is be able to get all items and be capable to create more complex NPC with it. Ideal for this is: use more groups feature to handle with a list of group in a easiest way without needed to create arrays of a item listing all itens you need, and instead of it, use groups list as resource in NPC.

In same PR i create an utilities tool set to clean duplicated from group in order to get only unique list from group.

Note: I add script command on docs/script_commands.txt

Example:

getitemgroupitems(.@item_list[0], "Old_Card_Album");
for ( .@i = 0; .@i < getarraysize(.@item_list); .@i++ ) {
    mes "^1E56BD\t"+getitemname(.@item_list[.@i])+" ^000000";
}

doc/script_commands.txt Outdated Show resolved Hide resolved
doc/script_commands.txt Outdated Show resolved Hide resolved
doc/script_commands.txt Outdated Show resolved Hide resolved
src/map/itemdb.c Outdated Show resolved Hide resolved
src/map/itemdb.c Outdated Show resolved Hide resolved
src/map/script.c Outdated Show resolved Hide resolved
doc/script_commands.txt Outdated Show resolved Hide resolved
src/map/script.c Outdated Show resolved Hide resolved
src/map/script.c Outdated Show resolved Hide resolved
src/map/script.c Outdated Show resolved Hide resolved
src/map/script.c Outdated Show resolved Hide resolved
@MishimaHaruna MishimaHaruna changed the base branch from stable to master April 30, 2024 18:04
src/map/script.c Show resolved Hide resolved
src/map/script.c Show resolved Hide resolved
src/map/itemdb.c Outdated Show resolved Hide resolved
src/map/itemdb.c Show resolved Hide resolved
src/map/script.c Show resolved Hide resolved
- Memory leak in the deduplication function
- Some unnecessary data copies in the search and deduplication function
- Accidental overwrite of the original group's data in the deduplication
  function

Signed-off-by: Haru <haru@dotalux.com>
@MishimaHaruna MishimaHaruna merged commit 9fc9d76 into HerculesWS:master Apr 30, 2024
15 of 46 checks passed
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