-
Notifications
You must be signed in to change notification settings - Fork 759
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 *setfavoriteitemidx & *autofavoriteitem script commands - alter item favorite state #2427
Add *setfavoriteitemidx & *autofavoriteitem script commands - alter item favorite state #2427
Conversation
71029c6
to
932424d
Compare
932424d
to
8ac1989
Compare
8ac1989
to
1bbea11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing nameid
and amount
check
search idx >= sd->status.inventorySize
in Hercules\src
folder for more example
} else if (idx < 0 || idx >= sd->status.inventorySize) {
ShowError("buildin_setfavouriteitem: Invalid inventory index %d (min: %d, max: %d).\n", idx, 0, (sd->status.inventorySize - 1));
return false;
} else if (sd->inventory_data[idx] == NULL || sd->inventory_data[idx].nameid <= 0 || sd->inventory_data[idx].amount <= 0) {
ShowWarning("buildin_setfavouriteitem: Current inventory index %d has no data.\n", idx);
return false;
something like that
btw, why using inventory index for this ? hmm ... so ... |
how about split into 3 script commands |
for itemID as parameter, |
com'on, you didn't read the topic link in rathena forum ... even if I said I can always release as plugin on the forum, |
1bbea11
to
3eb9a97
Compare
Kindly help re-review the PR. |
3eb9a97
to
456e9e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested ItemID 50 works
{
Id: 50
AegisName: "Red_Potion__"
Name: "Red Potion__"
Type: "IT_HEALING"
Buy: 1
Weight: 1
Script: <" percentheal 100,100; ">
Sprite: 501
},
@item 50
will create this item that can fully heal character
in other words, this patch only assume nobody is using ItemID below 500,
but actually you CAN create itemID below 500
the patch check for EDIT:
|
elaborating possible use-case of the code changes, its irrelevant to code changes.
LOL !! I actually want to say gravity is stupid enough to not start the ID from 1 or 0
yes, because we can use |
I am leaving the restriction here since there are no official way to tell the if I to changed the code to give priority for legit
this is why itemID as parameter aren't preferable in the beginning, it has lack accuracy, and create unnecessary works, which originally could be avoided if they use |
I have been saying separate into ok now wait 1 month until Haru come back and review this --> #2427 (comment) |
456e9e5
to
1e11fa4
Compare
I also think that having a command that can take either an index or a nameid is a recipe for problems. My main concerns are:
I'd suggest to accept either the nameid or the index (and have separate commands if you want to accept both). It's not nice to have several commands that do the same thing, but it seems to me the approach that's less prone to errors. |
1e11fa4
to
be24e14
Compare
Then I will just proceed with original plan, only accept and renamed |
- set an item as favorite item or not based inventory index. - if an item is set to favorite item, it will be moved into favorite tab, else move out from favorite tab. - only non-equipped item can adjust the favorite item state.
be24e14
to
d20cbae
Compare
Following up on what Haru said:
|
Pull Request Prelude
Changes Proposed
setfavoriteitemidx()
set an item as favorite item or nottab, else move out from favorite tab.
autofavoriteitem()
will auto set an item as favorite state or not whenever obtained. (affect globally)Sample Script:
autofavoriteitem(<itemID>, <flag>)
Sample Script:
setfavoriteitemidx(<idx>, <flag>)
@inventorylist_favorite[.@i]
from this PR, but not really dependant on it. Since it can be just set with the value0 or 1
. Bonus if have it.Issues addressed:
None