Skip to content

Commit

Permalink
Follow up fa75733
Browse files Browse the repository at this point in the history
* `getiteminfo` fix after `elvmax` added

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
  • Loading branch information
cydh committed Feb 28, 2015
1 parent d8ecfeb commit 7d42cf2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/sample/getiteminfo.txt
Expand Up @@ -17,7 +17,7 @@ prontera,156,179,6 script test_getiteminfo 117,{
mes "Item ID: " + .@value + " ^nItemID^" + .@value;

mes "Current item info:";
for(.@id = 0; .@id < 14; .@id++)
for(.@id = 0; .@id <= 16; .@id++)
mes " getiteminfo(" + .@value + "," + .@id + ") = " + getiteminfo(.@value,.@id);
close;
}
3 changes: 2 additions & 1 deletion doc/script_commands.txt
Expand Up @@ -2829,7 +2829,8 @@ Valid types are:
12 - eLV
13 - wLV
14 - SpriteID from 'db/item_avail.txt'
15 - matk if RENEWAL is defined
15 - eLVMax
16 - matk if RENEWAL is defined

See the sample in 'doc/sample/getiteminfo.txt'.

Expand Down
2 changes: 1 addition & 1 deletion src/map/itemdb.h
Expand Up @@ -390,9 +390,9 @@ struct item_data
int slot;
int look;
int elv;
int elvmax; ///< Maximum level for this item
int wlv;
int view_id;
int elvmax; ///< Maximum level for this item
#ifdef RENEWAL
int matk;
#endif
Expand Down
9 changes: 8 additions & 1 deletion src/map/script.c
Expand Up @@ -12590,6 +12590,8 @@ BUILDIN_FUNC(getitemslots)
12 elv;
13 wlv;
14 view id
15 eLvmax
16 matk (renewal)
*------------------------------------------*/
BUILDIN_FUNC(getiteminfo)
{
Expand All @@ -12600,8 +12602,13 @@ BUILDIN_FUNC(getiteminfo)
n = script_getnum(st,3);
i_data = itemdb_exists(item_id);

if (i_data && n <= 14) {
if (i_data && n <= 16) {
int *item_arr = (int*)&i_data->value_buy;
#ifndef RENEWAL
if (n == 16)
script_pushint(st,0);
else
#endif
script_pushint(st,item_arr[n]);
} else
script_pushint(st,-1);
Expand Down

1 comment on commit 7d42cf2

@tmav94
Copy link

@tmav94 tmav94 commented on 7d42cf2 Mar 1, 2015

Choose a reason for hiding this comment

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

Ty

Please sign in to comment.