Issue information

Issue ID
#5378
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Feb 29, 2012 2:47
Last Post
Hercules Elf Bot
Apr 19, 2012 18:35
Confirmation
Yes (4)
No (0)

Hercules Elf Bot - Feb 29, 2012 2:47

Originally posted by [b]Aleos[/b]
The NPC script function [i]getiteminfo[/i] is a little off after the addition of the MATK 'type' to items.
[quote]/*==========================================
* Returns some values of an item [Lupus]
* Price, Weight, etc...
getiteminfo(itemID,n), where n
0 value_buy;
1 value_sell;
2 type;
3 maxchance = Max drop chance of this item e.g. 1 = 0.01% , etc..
if = 0, then monsters don't drop it at all (rare or a quest item)
if = -1, then this item is sold in NPC shops only
4 sex;
5 equip;
6 weight;
7 atk;
8 def;
9 range;
10 slot;
11 look;
12 elv;
13 wlv;
14 view id
*------------------------------------------*/[/quote]
Anything after 7 (atk) is off by 1 because it is trying to get the MATK value, thus anything after is resulting in incorrect returns. Also the check needs to be expanded to include 15 types rather than 14 in [i]src/script.c[/i].

It took me a bit to realize that this was the issue with items (i.e: Beholder Master Card) that weren't giving their bonuses to players that use the getiteminfo function.

So there is the simple route which is to move the MATK value to the end of the item type list (Found in [i]src/item_db.h[/i]), or the more detailed route of modifying all items/NPC that use [i]getiteminfo[/i] (That are looking for a value greater than 7) to the new listing. :)

This post has been edited by Aleos on Feb 29, 2012 2:48

Hercules Elf Bot - Mar 1, 2012 19:41

Originally posted by [b]Wildcard[/b]
Semi-related: BUILDIN_FUNC[color=#000000]([/color]setiteminfo[color=#000000]) is floating around right next to it, unused and possibly misleading- the changes are not permanent. Can we remove this?[/color]

Hercules Elf Bot - Mar 1, 2012 19:43

Originally posted by [b]Brian[/b]
I think 'setiteminfo' could be useful; for example changing an item's script during an event?

Edit: oops, forgot about 'setitemscript'

This post has been edited by Brian on Mar 2, 2012 2:32

Hercules Elf Bot - Mar 1, 2012 21:18

Originally posted by [b]Wildcard[/b]
That one has its own script function, setitemscript (which I can agree might be useful) setiteminfo however.. only allows for very limited (and potentially confusing) modifications (weight is the one that makes the most sense- and really, it doesnt)

Hercules Elf Bot - Mar 2, 2012 12:57

Originally posted by [b]Gepard[/b]
What do you mean that changes are not permanent and why is that misleading? All manipulations on conf/db/npc entities (with help of commands or script functions) are not permanent by design, because server has no means to write changes back to files. (There are many more prominent examples of this design, like @loadnpc or @unloadnpc, which are not permanent either; but should we remove them because of that? I doubt so)
Only manipulations on castles/pets/characters/accounts/storage and other stuff that gets saved are permanent.

So I'd say setiteminfo is working as intended.

Hercules Elf Bot - Mar 2, 2012 15:58

Originally posted by [b]Wildcard[/b]
Sure they are, I just don't see any any scenario where changing any of the parameters it exposes would make any sense... But I suppose we can leave it as it is for the time being.

Hercules Elf Bot - Mar 2, 2012 16:22

Originally posted by [b]Gepard[/b]
Something like "Item of the day" (every 24 hours one or more items change their properties, for example increase attack, decrease weight, change zeny value etc) could make use of setiteminfo.

Hercules Elf Bot - Mar 2, 2012 20:47

Originally posted by [b]Aleos[/b]
Turns out there weren't that many NPC that use getiteminfo(). I went ahead and made a patch file. A note should be made for anyone who has custom scripts that use getiteminfo() to check for values that are greater than 7 to up them by 1.

Hercules Elf Bot - Mar 2, 2012 22:44

Originally posted by [b]Wildcard[/b]
It's not as simple, I'm afraid, since the matk field actually only exists for #REMODE 1.. I'm not entirely sure if I should just move matk down to 15 and make it available for REMODE only for the time being.

Hercules Elf Bot - Mar 3, 2012 2:47

Originally posted by [b]Aleos[/b]
Ah, true I forgot about REMODE. The simplest thing would be to move it down then unless you made a general attack field and combined ATK and MATK to be an array in the struct.

Hercules Elf Bot - Mar 3, 2012 13:16

Originally posted by [b]Wildcard[/b]
Fixed in [url="http://sourceforge.net/apps/trac/rathena/changeset/15652"]r15652[/url] (without any means of getting the value via getiteminfo() just yet, it is not needed and can wait.