Skip to content

Commit e52cb33

Browse files
committed
Add ITEMINFO_VIEWSPRITE support to getiteminfo() / setiteminfo().
Adds the ability to query an item's view sprite, lost with HerculesWS#1828 Fixes HerculesWS#1895 Signed-off-by: Haru <[email protected]>
1 parent dfcb1ff commit e52cb33

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

doc/sample/getiteminfo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ prontera,156,179,6 script test_getiteminfo 4_F_KAFRA1,{
3333
mesf("Weapon Level: %d", getiteminfo(.@value, ITEMINFO_WLV));
3434
mesf("View ID: %d", getiteminfo(.@value, ITEMINFO_VIEWID));
3535
mesf("MATK: %d", getiteminfo(.@value, ITEMINFO_MATK));
36+
mesf("View Sprite: %d", getiteminfo(.@value, ITEMINFO_VIEWSPRITE));
3637
close;
3738
}

doc/sample/npc_test_setitemx.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ prontera,164,161,5 script Lupus WOLF,{
2121
mes "Ok. We made Apple equippable.";
2222
setiteminfo(Apple, ITEMINFO_TYPE, IT_ARMOR);
2323
setiteminfo(Apple, ITEMINFO_LOC, EQP_HEAD_MID); //where to equip to (equip = 512)
24-
//setiteminfo(Apple, 14, 85); //set Headgear Sprite ID (view id = 85)
24+
setiteminfo(Apple, ITEMINFO_VIEWID, 85); //set Headgear Sprite ID (view id = 85)
2525
setitemscript(Apple, "{dispbottom \"* Other item's changed\";}", 0);
2626
setitemscript(Apple, "{dispbottom \"* Equipped\";}", 1);
2727
setitemscript(Apple, "{dispbottom \"* Unequipped\";}", 2);

doc/script_commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3202,6 +3202,7 @@ Valid types are:
32023202
ITEMINFO_WLV - Weapon level
32033203
ITEMINFO_VIEWID - View ID ("Sprite" field in the Item DB)
32043204
ITEMINFO_MATK - MATK (only relevant if RENEWAL is set)
3205+
ITEMINFO_VIEWSPRITE - View Sprite ("ViewSprite" field in the Item DB)
32053206

32063207
Check sample in doc/sample/getiteminfo.txt
32073208

src/map/script.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14129,6 +14129,9 @@ BUILDIN(getiteminfo)
1412914129
case ITEMINFO_MATK:
1413014130
script_pushint(st, it->matk);
1413114131
break;
14132+
case ITEMINFO_VIEWSPRITE:
14133+
script_pushint(st, it->view_sprite);
14134+
break;
1413214135
default:
1413314136
ShowError("buildin_getiteminfo: Invalid item type %d.\n", n);
1413414137
script_pushint(st,-1);
@@ -14392,6 +14395,9 @@ BUILDIN(setiteminfo)
1439214395
case ITEMINFO_MATK:
1439314396
it->matk = value;
1439414397
break;
14398+
case ITEMINFO_VIEWSPRITE:
14399+
it->view_sprite = value;
14400+
break;
1439514401
default:
1439614402
ShowError("buildin_setiteminfo: invalid type %d.\n", n);
1439714403
script_pushint(st,-1);
@@ -24837,6 +24843,7 @@ void script_hardcoded_constants(void)
2483724843
script->set_constant("ITEMINFO_WLV", ITEMINFO_WLV, false, false);
2483824844
script->set_constant("ITEMINFO_VIEWID", ITEMINFO_VIEWID, false, false);
2483924845
script->set_constant("ITEMINFO_MATK", ITEMINFO_MATK, false, false);
24846+
script->set_constant("ITEMINFO_VIEWSPRITE", ITEMINFO_VIEWSPRITE, false, false);
2484024847

2484124848
script->constdb_comment("Renewal");
2484224849
#ifdef RENEWAL

src/map/script.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ enum script_iteminfo_types {
448448
ITEMINFO_WLV,
449449
ITEMINFO_VIEWID,
450450
ITEMINFO_MATK,
451+
ITEMINFO_VIEWSPRITE,
451452

452453
ITEMINFO_MAX
453454
};

0 commit comments

Comments
 (0)