About item tooltip string display issue

Post here about all aspects of D2 mod making whether it's information, problems or whatever. Please specify whether your post is relating to Classic D2 or the Expansion.

Moderator: Nizari

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

About item tooltip string display issue

Post by aprildie » Fri Dec 08, 2023 3:22 am

I am working on a database-like strategy website that aims to allow people to access information about everything in the game through the website. Currently, I have progressed to the point where I can view data between various files and attempt to establish connections (such as knowing which key in this file corresponds to the key in which table, and so on).



I am currently developing a database for unique items, and I have encountered some issues with string linking for affixes. For example, in the uniqueitems.txt file, the "prop1" of the item "Islestrike" is "dru," and the displayed string is "+N To Druid Skills." The translation string for this affix in the translation table is identified as "ModStre8a."

Next, I mapped "dru" to the "code = dru" field in the properties.txt file. In the properties.txt file, I obtained the following data for that field:

func1 = 21
stat1 = item_addclassskills
val1 = 5


Then, using the itemstatcost.txt table, I found the entry with the "Stat" as "item_addclassskills" and obtained the following data:

descfunc = 13
descstrpos = descstrneg = ModStr3a


At this point, "ModStr3a" seems close to the desired answer, but it pertains to Amazon description rather than the Druid. Checking the description for "descfunc," it states:

Add Class Skill
· Uses the “StrAllSkills” from the charstats.txt file


My question is, given the current data fields I have, how can I ultimately obtain "ModStre8a" as the answer instead of "ModStr3a"? Can I derive the final affix string displayed in the game solely from these files? Any information or guidance would be greatly appreciated.


Also, I sincerely want to thank this website. Being able to dissect the game I've played since childhood in this manner holds a lot of significance for me! <3

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Fri Dec 08, 2023 11:15 am

Hi aprildie, itemstatcost.txt descfunc=13 is parameterized to read from charstats.txt StrAllSkills. descstrpos/descstrneg are not used by descfunc=13.

Code: Select all

param=0	ModStr3a
param=1	ModStr3d
param=2	ModStr3c
param=3	ModStr3b
param=4	ModStr3e
param=5	ModStre8a
param=6	ModStre8b
param=7+	(not used in vanilla, but if you add an extra row, it will read that row's StrAllSkills corresponding string; you can use this to get thousands of different strings out of a single stat)
Note that Expansion rows are not used by the game, so you can delete them or ignore them.

Your project sounds very interesting, it could help a lot with documentation of mods. I hope to hear more!

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Fri Dec 08, 2023 4:46 pm

Cypress,

Thank you very much for your response. I've learned that this function directly bypasses descstrpos/descstrneg!

I have another question: Is it possible, solely from these files ending in .txt, to determine that when param=5, the translation displayed in the game will be "ModStre8a"? I hope there's a way to navigate through these files and discover patterns or clues for these exceptions (when descstrpos/descstrneg parameters are not used), so I can programmatically incorporate these patterns.

In the current example, is there a method when descfunc=13 to locate a specific field within a file, where I can find that when param=5, the corresponding string is "ModStre8a"? Just like if you hadn't directly informed me, it seems challenging to deduce that the value 5 corresponds to "ModStre8a" based solely on the field data I currently have.

Because I'm currently only examining .txt files, I'm wondering if this information might be concealed within .dll files?

I genuinely appreciate your response! It has been incredibly beneficial.

-


Regarding my project, it is currently in the development stage. I aspire to allow users to select the columns they wish to display, for instance, choosing "prop1" in the "uniqueitems" section. Additionally, users should be able to click on a value in a selected column to navigate to another data table, such as linking from the aforementioned "prop1" to the corresponding "code" in the "Properties" table.

Hence, in the current development phase, I am still working on figuring out how to establish these file connections. :)

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Fri Dec 08, 2023 11:31 pm

Yes, it is possible.
Starting from the original property, you'd gain the property name.
In properties.txt, you'd find the same property name, the property function and the stat.
The dru property has func=21, which sets the parameter to a specific val.
Since the dru property has func=21 and val=5, it will apply param=5 to the stat.
In itemstatcost.txt, you'd find the stat's name and its descfunc.
If descfunc=13 for the stat, then ignore descstrpos/descstrneg, instead use charstats.txt column StrAllSkills.
Since param=5 for the stat, use the corresponding row ID for StrAllSkills -> ModStre8a (the Expansion row does not count towards the row IDs, it is ignored, otherwise it would be ID=5).

Let me know if that makes sense. And if you have any other questions, please ask, your project sounds incredibly useful and I would readily provide explanations for anything I can derive. I love figuring out how the different columns and rows and functions interact, to such an extent that I have made up fake txt files describing how some of the hardcoded parts of the game could be softcoded into txt files and how they would link with the currently existing txt files (my dream is an absurd game engine based entirely off of tabulated txt files and Starcraft-style iscript txt files).

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Sat Dec 09, 2023 4:25 am

It seems like I have gained some understanding. In the properties.txt file, the entry "dru," with func1 = 21, is associated with an index value val1 = 5. Subsequently, dru, through stat1 = item_addclassskills, searches for a row in itemstatcost.txt with the same Stat value. The description in that row, indicated by the function descfunc = 13, instructs us to look in the file charstats.txt for the value in the StrAllSkills column corresponding to the previously identified index.

Excluding the Expansion rows that are not considered, if we index from 0 starting from the top, the Druid's row is located at the 6th line (index 5).

However, there might be an issue with this approach. If I were a Mod developer and accidentally rearranged the order of each row in charstats.txt, wouldn't that lead to errors in the displayed text? It seems that the game determines which class a particular text refers to using index values rather than a unique foreign key.


I feel incredibly fortunate to have your assistance. It seems like you have a tremendous passion for this field!
Last edited by aprildie on Sat Dec 09, 2023 6:43 pm, edited 1 time in total.

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Sat Dec 09, 2023 11:10 am

Yes, it would lead to many errors. If you were to, for example, move the Assassin row between Amazon and Sorceress, your Assassin would now have the charstats settings of the Druid, since this association is also based on the hardcoded row ID of charstats.txt; her charstats is based on row ID=6, not based on the Assassin key (it would also then shift every other character's charstats aside from the Amazon). If the txt files do not describe any way for you to explicitly define which row name/ID is being referenced for a behavior, then the behavior will be hardcoded to a specific row.

Most txt files, you do not want to re-arrange rows. Itemstatcost keeps track of save file data to row IDs, so if the max bits and current bits mismatch (which will likely happen if you try to move rows around), then the save file gets corrupted and also many stat behaviors are hardcoded to specific stat row IDs.
A few dozen skills are hardcoded to specific skill row IDs, and if I remember correctly, staffmods expect relative skill row placement to work properly.
In itemtypes.txt, many row IDs are hardcoded to give behaviors to other rows if the other rows are made equiv1/equiv2 to the hardcoded row.
Monstats.txt and missiles.txt have many quest-related hardcoded rows that can cause unexpected monsters/missiles to appear or crashes to occur.
In states.txt, many states have hidden behaviors hardcoded to their row.

It can also be risky to re-arrange rows from a softcoded modding perspective, since the txt files may sometimes have you reference a specific row ID, in which case if you move rows around, the expected referenced ID may no longer be the expected ID due to row shift or movement.

Also note that although I say row IDs, the ID columns that you might find in a few txt files rarely (if ever) do anything except act as a way to keep track of which row is which ID. The value of this ID column can be entirely inaccurate and I don't know of any cases where it matters. What matters is the actual placement of rows in the txt file, not the arbitrary ID column value.

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Sat Dec 09, 2023 6:26 pm

Thank you for your explanation. No wonder I had trouble understanding this part before. I used to think that tables should be linked to each other through a unique column. Considering that they might have hard-coded situations, such as relying solely on index values to retrieve data, I need to be more careful when linking tables as well.

-

I also have a question about the sorting of affixes. Please refer to the attached image (this is the tooltip screen for items on my website).

In the tooltip, there is a p number for affixes, which I link all the way back to the "descpriority" value in itemstatcost.txt through the "prop" property in the uniqueitems.txt table. This is used for sorting the order of affixes.

However, for the Butcher's Pupil weapon, there are two props, "dmg%" and "indestruct", and it seems that I can't find fields in the properties.txt table that link to itemstatcost.txt.

Perhaps I've overlooked something because directly looking at itemstatcost.txt, there is a stat = item_indestructible affix with descpriority = 160. According to the actual in-game images, it seems like this value is used for sorting.

Additionally, regarding "prop = dmg%," it eventually translates to "strModEnhancedDamage." I also want to understand how this translation occurs.

Image
Image

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Sun Dec 10, 2023 1:29 am

For indestruct, the property func=20 applies only +1 item_indesctructible stat to the item regardless of the min/max settings. I'm not sure why this function exists, when you can apply indestructible just like other stats instead.

For dmg%, the property func=7 has variable behavior depending on what type of item it is being applied to. From my notes (note that wam.txt is how I refer to weapons.txt/armor.txt/misc.txt, and the ┋┋ indicates the respective column of a txt file):

Code: Select all

[7]
if item does not have nor inherit wam.txt┋type#┋ of 'weap' OR if it does have 'weap' and would gain at least 1 max damage (of either one-handed or two-handed damage) from +% enhanced damage, then:
	stat=item_mindamage_percent
	stat=item_maxdamage_percent
	param=0
	amount=rand(min,max)
if it does have 'weap' and would gain no max damage (of either one-handed or two-handed damage) from +% enhanced damage, then:
	stat=maxdamage, secondary_maxdamage
	stat=secondary_maxdamage (only add if wam.txt┋2handmaxdam┋>0)
	param=0
	amount=1
So basically, if a weapon does not gain at least +1 damage from func=7, then it will give max damage directly instead. This is why superior hand axes and other low level weapons will never spawn with Enhanced Damage when superior, because up to +15% Enhanced Damage is not enough to give even one point of damage. As for the description, seems like Blizzard badly hardcoded it, such that when both item_mindamage_percent and item_maxdamage_percent is on an item, then the item will display +#% strModEnhancedDamage instead, with # value being equal to the amount of item_mindamage_percent (so even if you have item_mindamagepercent=100 and item_maxdamagepercent=1, it will display +100% Enhanced Damage).

There's also a third problem, your display shows +30-50 to Minimum Damage instead of Adds 30-50 Damage. For property functions 15 and 16:

Code: Select all

[15]
param=0
amount=min
if stat=mindamage:
	add "adaptive min damage" instead

[16]
param=0
amount=max
if stat=maxdamage:
	add "adaptive max damage" instead
	
[adaptive max damage]
for every 1 of this stat, give these derived stats:
	1 'maxdamage' if wam.txt┋mindam┋>0
	1 'secondary_maxdamage' if wam.txt┋2handmindam┋>0
	1 'item_throw_maxdamage' if wam.txt┋maxmisdam┋>0
Basically, the secondary_min/maxdamage stats apply to two-handed weapon damage, the min/maxdamage stats apply to one-handed weapon damage and the item_throw_min/maxdamage applies to throwing weapon damage. So the way it works is it only applies the stats that need to be applied for the given weapon; a two-handed sword needs one-handed damage and two-handed damage, but doesn't need throwing damage; a throwing axe needs one-handed damage and throwing damage, but doesn't need two-handed damage.

This is also a case of hardcoded stat descriptions. If added min damage>added max damage, then display min damage and max damage stats normally. If added min damage<added max damage, then display strModMinDamageRange from string.tbl: "Adds %d-%d damage" where the first %d is min damage and the second %d is max damage.

Let me know if any of this doesn't make sense, these are some of the most confusing stats/descs.

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Sun Dec 10, 2023 8:49 pm

Cypress,

I've addressed the issues and improved the affix display logic as discussed. Unfortunately, due to certain limitations in Blizzard's design, I had to hard-code specific elements, including the "indestruct" affix and its corresponding translation :lol:

Regarding the third issue you pointed out, adjustments have been made to align with your explanations, and YESSSSS, the tooltips of Butcher's Pupil look better now!
Image


However, following the resolution of these issues, I've encountered a few additional complexities:

1. Regarding the "hit-skill" affix with no max value—how is the skill level determined? The weapon in question has two of these affixes, and for "charged bolt," the max value is 0. However, other websites display it as level 13-20. Could you kindly elucidate on the calculation involved in this scenario?

Image

2. Concerning poison damage calculation and display on the Rakescar item: Three affixes are related to poison damage, with both "pois-min" and "pois-max" having identical values (128), and "pois-len" having min = max = 75. The game displays this information as "+38 Poison Damage Over 3 Seconds." While I understand that the 3 seconds is derived from the duration affix (75 / 25 = 3), I am unsure about the calculation resulting in the +38 damage.

Image


Additionally, in your responses, there were several instances where you posted code snippets. Were those snippets are from the same article? I feel it might be necessary for me to read that article to clarify my understanding in this regard.

Thank you!

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Mon Dec 11, 2023 12:16 am

(1) I remember this one being a huge pain to derive. I couldn't find my proper notes on it, but I did have one random comment that I included in an older mod, so I'll assume what I wrote down is right. The calculation that I derived was:

1+min((ilvl-rlvl)/4,mlvl)
min(1 + (ilvl - rlvl) / 4, mlvl) (this is the corrected formula, as noticed by aprildie)

where:
ilvl=the item level of the item, for Stormrider this varies from its uniqueitems.txt┋lvl┋=49 and up to 99
rlvl=the required level of the skill, this would be Charged Bolt's skills.txt┋reqlevel┋=1
mlvl=the max possible level of the skill, this would be Charged Bolt's skills.txt┋maxlvl┋=20

Using this calculation, we'd get a minimum Charged Bolt level of 13 at ilvl=49 (the lowest ilvl Stormrider can spawn at), and a maximum charged bolt level of 20 at ilvl=77 (the lowest ilvl for Stormrider to reach the max skill level of Charged Bolt).

(2) Poison damage is calculated with the formula: damage*length/256. So for Rakescar, which has damage=128 and length=75, it would be 128*75/256=37.5 (rounds up to) =38


I'll include the txt file I re-wrote those snippets from, but it won't be of much use. It was part of my foray into fully softcoding Diablo 2 into fake txt files purely through experimentation and looking up other documentation, be warned that it's full of {gaps} and has not been thoroughly tested/reviewed.
Attachments
properties(l).7z
(2.17 KiB) Downloaded 40 times
Last edited by Cypress on Sun Jun 09, 2024 12:31 am, edited 2 times in total.

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Mon Dec 11, 2023 11:26 am

Cypress,

Hello, I have a few questions to confirm regarding the generation range of skill levels based on the formula you provided.

1. Is it always the case that the maximum upper limit for skill affixes is 20? And is the minimum for skills determined by item levels?

2. In the event of encountering decimal points in the formula calculation, is rounding done using the standard rounding method (e.g., rounding to the nearest whole number) as in the case of Hellslayer?

3. There seems to be a slight discrepancy between the formula for Lightsabre and the actual values. According to the data, it appears to be listed as 14 to 20 instead of 13 to 20. Could there be a mistake in the parameters on my end?


Stormrider┋lvl┋= 49 / Charged Bolt┋reqlevel┋1
1 + ((49 - 1) / 4) = 13, correct

Boneslayer Blade┋lvl┋= 50 / Holy Bolt┋reqlevel┋6
1 + ((50 - 6) / 4) = 12, correct

Hellslayer┋lvl┋= 71 / Fire Ball┋reqlevel┋12
1 + ((49 - 1) / 4) = 15.75 ≒ 16, correct

Lightsabre┋lvl┋= 66 / Chain Lightning┋reqlevel┋18
1 + ((66 - 18) / 4) = 13, seems incorrect




And thank you for the txt file you provided. :D

OrderOfTheScribble
Posts: 34
Joined: Wed Apr 05, 2023 7:35 pm
United States of America

Re: About item tooltip string display issue

Post by OrderOfTheScribble » Mon Dec 11, 2023 9:24 pm

I took a look at the uniques in question, and in the case of Hellslayer and Lightsabre, the base item's qlvl is higher than the unique's min ilvl. I then applied the formula Cypress provided to see what it would produce at ilvl = base item qlvl for those two items:
  • Hellslayer is a Decapitator (qlvl 73), so 1 + ((73-12)/4) = 16.25, which rounds down to 16
  • Lightsabre is a Phase Blade (qlvl 73), so 1 + ((73-18)/4) = 14.75, which rounds down to 14
This suggests that the formula sets ilvl to qlvl if it's lower than the qlvl of the base item.

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Mon Dec 11, 2023 11:41 pm

1. In vanilla, yes, because the max level of skills is 20 by design. In mods, no, because often times the max level of skills is changed.

2. Diablo 2 almost always truncates values, the only exceptions I know of are cases where the values are actually in 256ths like with life and mana and poison damage's stat description. Hellslayer's minimum Fireball ctc is technically 15, not 16, there's no rounding, it truncates. The reason it's listed as 16 is because it's impossible to get an ilvl=71 Hellslayer in vanilla, although there are cases where it can happen in mods.

3. Just as with Hellslayer, the formula is correct, but the conditions are impossible in vanilla: an ilvl 66 Lightsabre will have ctc lvl 13 Chain Lightning, but Phase Blade's weapons.txt┋level┋=73. I believe this would require at least the weap75 autoTC to drop. There may be some accidental cases where a monster can drop a higher TC than it is supposed to, but probably not to such a degree that it could drop an ilvl<70 Phase Blade. In mods, there are quite a few cases where an ilvl=66 Lightsabre could be produced, such as if there is a unique creating recipe.

The formula does not set ilvl to qlvl if it's lower than the qlvl of the base item, this can be shown by generating an ilvl 66 Lightsabre with the cube: it will have ctc lvl 13 Chain Lightning. Unlike uniques, which require qlvl=>ilvl, base items can be generated at any ilvl, you could mod the game such that Fallen Ones drop ilvl=1 Phase Blades, but they would never spawn as Lightsabres since the ilvl isn't high enough.

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Tue Dec 12, 2023 2:22 pm

Ah, I see! Thank you both for the explanations.

It seems like I should delve into some knowledge about Item Level and Quality Level. I might need to apply this when working on Treasure Class in the future. With the new formula, the data appears to be accurate.

I've gained a lot from this! Thank you both :D

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Mon Dec 18, 2023 4:16 pm

Cypress,

Hello! I have a question I'd like to inquire about. I've been working on displaying set items recently, but there's a part that confuses me. In the "setitems.txt" table, there are attributes that start with "aprop{i}a" or "aprop{i}b." From my understanding, these should be additional effects granted when wearing the set with i+1 pieces.

However, in the case of Trang-Oul's Claws, there is the "aprop3a" attribute with "extra-pois," and I believe it should be the +25% To Poison Skill Damage on gloves. I checked the set items themselves, and indeed, they don't seem to have this particular attribute.

Yet, according to my observations in the game and information from other sources, this attribute is indeed classified under the gloves' inherent properties rather than a set bonus. Is there any evidence or reference supporting this?

Image
Image

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Mon Dec 18, 2023 11:31 pm

Hi aprildie, that's probably a bug that was never fixed since it's fun. Presumably, Blizzard forgot to give a value for the 'add func' column. Civerb's Cudgel has the same oddity, where it has dmg/lvl under aprop1a, but the dmg/lvl bonus is given without any other set items since again no 'add func' is set.

How the 'add func' column works is basically:
(no value) -> All bonuses are given regardless of other set items
1 -> A set prop corresponds to a respective item in the list of other set items (this is only seen on Civerb's Ward: it gains mana with Civerb's Icon and Poison Resist with Civerb's Cudgel)
2 -> The next set prop columns are unlocked per new set item equipped (this is seen on almost every set item)

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Tue Dec 19, 2023 5:43 am

I see! Indeed, Civerb's Cudgel also has this situation. It seems that I can determine from add func = 0 and directly assign the attributes of the original set bonus to the equipment. Having a discernible rule to follow is very helpful! Additionally, since you just mentioned the functionality of the add function, I also have a confusion when add func = 1: how does the attribute know which item it corresponds to?

For Civerb's Ward, where aprop1a = mana and aprop2a = res-pois, they correspond to the two equipment pieces you mentioned, Civerb's Icon and Civerb's Cudgel. How does the game determine that these two affixes correspond to these specific items from the data table columns?

I also have two points that I've been trying to understand on my own this week, coincidentally related to Civerb's Cudgel.

1. Where does the inherent affix for weapons come from? Scepter-type weapons come with a +50% Damage to Undead property. Which table in the data associates this property with Scepter type?

2. About the calculation of all scaling on level – this part has been quite challenging for me. I've looked into explanations mentioning op, op base, op param, and other fields, but I still don't quite grasp how these formulas calculate the increment per level. Taking Civerb's Cudgel as an example, here's what I found:

in setitems.txt, aprop1a┋=dmg/lvl, apar1a┋=8
in properties.txt, func1┋=17, stat1┋= item_maxdamage_perlevel
in itemstatcost.txt, op┋=4, op param┋=3, op base┋=level
Checking the documentation, it mentions applying the formula [“op stat#”] += [“op stat#”] * [“op base”] << [“op param”]
However, since I'm not quite clear on where op stat comes from, I'm unable to proceed with the calculation. I hope to gain some insights into this calculation from you. Thank you!

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Tue Dec 19, 2023 12:09 pm

addfunc=1 works based on the order of set items in setitems.txt. You can think of each set item in the list as having its own ID, but excluding itself from the list. So for Sigon's Gage:

Sigon's Gage -> (ignore, it is Sigon's Gage)
Sigon's Visor -> first item on list, give a/bprop1
Sigon's Shelter -> second item on list, give a/bprop2
Sigon's Sabot -> third item on list, give a/bprop3
Sigon's Wrap -> fourth item on list, give a/bprop4
Sigon's Guard -> fifth item on list, give a/bprop5

For Sigon's Visor:

Sigon's Gage -> first item on list, give a/bprop1
Sigon's Visor -> (ignore, it is Sigon's Visor)
Sigon's Shelter -> second item on list, give a/bprop2
Sigon's Sabot -> third item on list, give a/bprop3
Sigon's Wrap -> fourth item on list, give a/bprop4
Sigon's Guard -> fifth item on list, give a/bprop5


(1) That comes from itemtypes.txt, inherited from the 'blun' itemtypes.txt┋code┋ (row ID=57). Itemtypes can be inherited if an item has an itemtype with an itemtypes.txt┋equiv1┋ or ┋equiv2┋, and items gain their base itemtypes through wam.txt┋type┋ or ┋type2┋.

So as an example:
In weapons.txt, Spiked Club has type=club
In itemtypes.txt, Club has code=club
Club also has equiv1=blun
Blunt has code=blun
Therefore, Spiked Club has the blun itemtype

This is also the way weapons gain the "Mace Class" and "Sword Class" description on the item, based on the itemtype inheritance. In some cases, only some behaviors of a hardcoded itemtype will be inherited through equivs, some require the itemtype to be directly linked through ┋type┋, and linking through ┋type2┋ or ┋equiv1┋ or ┋equiv2┋ won't fully work.

Also see: viewtopic.php?t=67252


(2) D2R's guide doesn't describe op functions well at all. See: kb/viewarticle?a=448

For op=4, as it says:

"the stat bonus is added to the item and not to the player (so that +defense per level properly adds the defense to the armor and not to the character directly!)"
and that
(statvalue * basevalue) / (2 ^ param)

where
statvalue=the amount of the stat on the item
basevalue=┋op base┋
param=┋op param┋

And the outcome of the formula gives the amount of ┋op stat1┋, ┋op stat2┋ and ┋op stat3┋.

So using Civerb's Cudgel:
Stat is given through property dmg/lvl with value of 8, which gives stat of item_maxdamage_perlevel.
item_maxdamage_perlevel has op=4, op param=3, op base=level, op stat1=maxdamage, op stat2=secondary_maxdamage, op stat3=item_throw_maxdamage.
So formula becomes, for a level 99 character: (8*stat('level'.accr))/(2^3)
=(8*99)/(8)=99

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Wed Dec 20, 2023 10:22 am

Hi! Cypress,

After the adjustments, attributes based on level growth can now be displayed! The formulas you provided have finally resolved my week-long confusion, and the two reference documents you shared have been extremely helpful. I am currently working on inheriting properties, and the display of the entire item's attributes is almost complete. Without your assistance, this would have been a challenging process. If I have any future questions, I will definitely reach out to you.

I have a question related to images, specifically one I haven't delved into much. I just want to confirm if my concept is correct.

For unique items like the Harlequin Shako, which undergo a color transformation from base equipment, is it achieved by coloring it on a palette and then overlaying it onto the corresponding base equipment before exporting it as an image? If so, what tools would you recommend for this process?

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Wed Dec 20, 2023 11:29 am

I don't really understand how graphics work, but here's some information I found (for older versions, but it should still apply aside from the columns described being a little different):
kb/viewarticle?a=423 (on colormaps, dat files, colors, palette shifting)
viewtopic.php?t=9423 (on global game palettes, base item colors)
https://phrozenkeep.blob.core.windows.n ... 6color.zip (tool that recolors items I think, although I can't get it to work right now since Windows is being dumb)

My basic understanding is that .dat files are 5376 byte colormaps, containing 21 blocks of 256 bytes, with each block corresponding to the respective color in colors.txt. The color used (the block in the dat file) is defined by uniqueitems.txt┋invtransform┋, setitems.txt┋invtransform┋, magicprefix.txt/magicsuffix.txt/automagic.txt┋transformcolor┋ AND magicprefix.txt/magicsuffix.txt/automagic.txt┋transform┋=1 (this transform boolean must be =1 or it won't apply the transformcolor). The dat file used is defined by wam.txt┋InvTrans┋. The resulting colormaps would do palette shifts on the .pal files

According to D2R (not tested; the guide I linked above says that gold.dat and brown.dat don't work):

Code: Select all

Code   Color
 
0   No color change
1   grey.dat
2   grey2.dat
3   gold.dat
4   brown.dat
5   greybrown.dat
6   invgrey.dat
7   invgrey2.dat
8   invgreybrown.dat
I hope this helps!

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Thu Dec 21, 2023 7:49 pm

Thank you so much! The information you provided is even more than I originally had. I will delve into it further, and hopefully, everything will proceed smoothly. :D

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Tue Jan 16, 2024 4:05 pm

Cypress, Hello! :D

I would like to inquire about an issue regarding class inheritance and affixes.

I am currently working on an affix table that links to relevant item types based on Magicprefix.txt itype 1-7 and excludes item types according to etype 1-5 to narrow down the possible affixes for specific item categories.

When I reached Druid Pelt, I encountered a situation where I am uncertain if I misunderstood something.

Firstly, according to the itemTypes.txt table, a pelt inherits from helm and armo, meaning the item type sequence for pelt is currently armo > helm > pelt.

In the affix table, let's take the example of the affix "Master's." This affix grants +3 Combat Skill to Barbarians and can generate on three item types: phlm, weap, helm. Additionally, it excludes the following two: miss, rod.

My concern is that since the Druid Helmet inherits from helm, currently "Master's" would also generate on the Druid Helmet. However, in the game, Pelt should only generate affixes related to Druid skills, excluding Barbarian skills. Have I misunderstood something in this regard?

User avatar
Cypress
Moderator
Champion of the Light
Posts: 465
Joined: Fri Dec 01, 2017 2:08 am

Re: About item tooltip string display issue

Post by Cypress » Tue Jan 16, 2024 11:40 pm

Hi aprildie. What you're looking for is the 'classspecific' column found in magicprefix/magicsuffix/automagic. If classspecific=class, then only class items of that class may spawn with that affix. Barbarians are of the bar class, so their barbarian only helms can gain the affix, but Druids are not of the bar class, so their pelt helms cannot gain the affix.

As for how an item is chosen as a class specific item, that is controlled by the itemtypes.txt 'class' column. So if we remove classspecific=bar from the Barb tab prefixes, or if we remove class=dru from the Druid pelts, then Druid pelts will be able to spawn with Barb tab prefixes.

aprildie
Posts: 17
Joined: Fri Dec 08, 2023 2:52 am
Taiwan

Re: About item tooltip string display issue

Post by aprildie » Wed Jan 17, 2024 10:16 am

Thank you for your explanation! It seems I overlooked this aspect, and now the affixes can correctly link to the specific types of gear for the restricted professions.

I have another question regarding the scha type, specifically a group with the ID 114 and the Lucky affixes:

51 [4 - 6]% Better Chance of Getting Magic Items
53 [2 - 3]% Better Chance of Getting Magic Items

Despite the lower affix level, the attributes are better. In the game, will the affix levels be swapped, or will this situation indeed occur?

OrderOfTheScribble
Posts: 34
Joined: Wed Apr 05, 2023 7:35 pm
United States of America

Re: About item tooltip string display issue

Post by OrderOfTheScribble » Wed Jan 17, 2024 4:09 pm

I looked at MagicPrefix.txt and saw that those prefixes apply to the mcha type, and the 4-6% affix is indeed lower level than the 2-3% affix, which seems like an oversight. I'm pretty sure the game has no way to swap affixes, so a large charm with high enough ilvl to spawn affix level 51+ should be able to spawn +4-6% Better Chance of Getting Magic Items.

Post Reply

Return to “General Mod Making”