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
Expand item unique id control #4195
Expand item unique id control #4195
Conversation
Also, recommend renaming uniqueid item commands to something like
uniqueid_COMMAND
or unique_id_COMMAND
to keep all unique_id with the same pre-fix or post-fix.
Also, you forgot to add documentation with examples to /doc/script_commands.txt
Co-Authored-By: anacondaq <anacondaq@users.noreply.github.com>
Co-Authored-By: anacondaq <anacondaq@users.noreply.github.com>
Co-Authored-By: anacondaq <anacondaq@users.noreply.github.com>
|
tested it , work great |
thanks to @cydh Co-Authored-By: Cydh Ramdh <cydh@users.noreply.github.com>
|
No worries, you did nothing wrong. I figured it'd be quicker for me to manually make the changes than list tons of edits. |
|
if someone want to test the PR (like for a real life usage) |
|
update to work as |
src/map/script.cpp
Outdated
| if (it->equip) | ||
| pc_unequipitem(sd, i, 3); | ||
|
|
||
| if (buildin_delitem_search(sd, it, 0, 0)) { |
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.
buildin_delitem_search doesn't check the unique id and it may delete the wrong item. Maybe pc_delitem would do the job
…nd-Item-unique-id-Control
|
@Atemo thanks for the feedback, will work on it for the and it would be easier then just making the writer remember what index the cards are etc |
|
Eventually the unique id could be also saved in
|
Co-Authored-By: Atemo <Atemo@users.noreply.github.com>
|
This pull request introduces 1 alert when merging c1ae466 into 58f2d21 - view on LGTM.com new alerts:
|
Co-Authored-By: Atemo <Atemo@users.noreply.github.com>
Co-Authored-By: Atemo <Atemo@users.noreply.github.com>
this I think better, this the same variable names as the getinventorylist , however it start with ".@uid_" better then remembering the index of each value
| .@uid_item_id - item ID | ||
| .@uid_equip - on which position the item is equipped (see EQP_* constants) | ||
| It will contain 0 if the item is not equipped. | ||
| .@uid_refine - refine | ||
| .@uid_identify - identify | ||
| .@uid_attribute - attribute | ||
| .@uid_card1 - card 1 | ||
| .@uid_card2 - card 2 | ||
| .@uid_card3 - card 3 | ||
| .@uid_card4 - card 4 | ||
| .@uid_expire - expire time | ||
| .@uid_bound - bound type | ||
| .@uid_option_id1 - option ID 1 | ||
| .@uid_option_value1 - option value 1 | ||
| .@uid_option_parameter1 - option parameter 1 | ||
| .@uid_option_id2 - option ID 2 | ||
| .@uid_option_value2 - option value 2 | ||
| .@uid_option_parameter2 - option parameter 2 | ||
| .@uid_option_id3 - option ID 3 | ||
| .@uid_option_value3 - option value 3 | ||
| .@uid_option_parameter3 - option parameter 3 | ||
| .@uid_option_id4 - option ID 4 | ||
| .@uid_option_value4 - option value 4 | ||
| .@uid_option_parameter4 - option parameter 4 | ||
| .@uid_option_id5 - option ID 5 | ||
| .@uid_option_value5 - option value 5 | ||
| .@uid_option_parameter5 - option parameter 5 | ||
| .@uid_tradable - item tradability |
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 think this is way better then just letting the scripter provide a .@array , the variables like this are the same as getinventorylist command but they start with ".@uid" instead of "@inventorylist_"
we can get the same result with something like this
getinventorylist;
if((.@ndx = inarray(@inventorylist_unique_id$,<"unique_id">)) !=-1){
//@inventorylist_id[.@ndx]
//@inventorylist_refine[.@ndx]
//@inventorylist_card1[.@ndx]
//etc
}else{
//item not found
}but i still think if we want the information of one item only , no need to use getinventory list command
|
This pull request introduces 2 alerts when merging efebd7e into 58f2d21 - view on LGTM.com new alerts:
|
`uniqueid_find` check if the player have an item with the unique id provided.
| @@ -2689,6 +2689,82 @@ See 'getequipid' for a full list of valid equipment slots. | |||
|
|
|||
| --------------------------------------- | |||
|
|
|||
| *uniqueid_getiteminfo(<"item_unique_id">{,<char_id>}) | |||
|
|
|||
| This function assigns the item information of <item_unique_id> to the variables mentioned down there. | |||
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.
recommend to add "from the invoking character's inventory if found." for more detailed description
|
I think after this update #6247 |
Addressed Issue(s): #4175
Server Mode: both
Description of Pull Request:
there is already a command to get the equipment unique id
with this PR
getinventorylistnow assign a int variable the item unique id@inventorylist_unique_id$OnSellItemnow assign@sold_unique_id$"idea from https://rathena.org/board/topic/119433-how-to-get-unique-id-from-onsellitem/#comment-362164"countboundnow returns@bound_unique_id$[]too for the item unique idnew commands
this command get the item information by it's unique id and assign it to the variables.
the variables are the same as the
getinventorylistcommand , however it start with.@uid_instead of@inventorylist_check if the player have an item with the unique id provided.
this command delete an item from the inventory by it's unique id
test scripts
Old Script/Idea
``` //@item hat 5 prontera,152,175,4 script unique_id_control 444,{ .@unique_id = getequipuniqueid(EQI_HEAD_TOP); mes .@unique_id; next; uniqueid_delitem .@unique_id; end; }prontera,152,177,4 script unique_id_control2 444,{
.@unique_id = getequipuniqueid(EQI_HEAD_TOP);
mes .@unique_id;
next;
uniqueid_getiteminfo .@unique_id,.@item;
for(.@i=0;.@i<getarraysize(.s$);.@i++){
mes .s$[.@i] + " " + .@item[.@i];
}
for(.@i= getarraysize(.s$);.@i<getarraysize(.@item);.@i+=3){
mes "it->option[" + .@i + "].id" + .@item[.@i];
mes "it->option[" + .@i + "].value" + .@item[.@i];
mes "it->option[" + .@i + "].param" + .@item[.@i];
}
end;
OnInit:
setarray .s$,
"it->nameid"
,"it->refine"
,"it->identify"
,"it->attribute"
,"it->card[0]"
,"it->card[1]"
,"it->card[2]"
,"it->card[3]"
,"it->expire_time"
,"it->bound";
}
prontera,152,179,4 script unique_id_control3 444,{
getinventorylist;
for(.@i = 0;.@i< @inventorylist_count;.@i++){
mes @inventorylist_id[.@i] + " " + @inventorylist_unique_id[.@i];
}
end;
}
prontera,152,181,4 script unique_id_control4 444,{
callshop "dyn_shop1",2;
npcshopattach "dyn_shop1";
end;
OnSellItem:
mes @sold_uniqueid;
end;
}