• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ [TFS 1.3] Where do items get their "(faster regeneration)" from?

Silba

is stephany, the josh wife
Premium User
Joined
Aug 22, 2013
Messages
373
Solutions
8
Reaction score
287
Hello :)

I've been pulling my hair out trying to figure out why life ring, roh, soft boots etc all have (faster regeneration) when I look at them but my custom items with the same items.xml and movements.xml setup don't.

I've *found the code literally responsible for adding "(faster regeneration)" but I've got no idea why it doesn't apply to custom items. It looks like to me then any item setup correctly should show "(faster regeneration)" but obviously since none of my custom items with regen show "(faster regeneration)" I must be missing something.

I would like my custom items to show "(faster regeneration)" just like they do for the vanilla items. Mostly for consistency however I'm also trying to 'see' the regen when looking at my custom items and was planning to use this line to show them. (which I've already done and it works, just not for my custom items)

Any help is appreciated :)


*
C++:
else if (it.abilities->regeneration) {
  s << " (faster regeneration)";
 
Last edited:

ManuelOficial

Member
Joined
Jul 20, 2012
Messages
22
Solutions
1
Reaction score
5
I guess that happens because there are a bunch of "if" that are filtering what each kind of items need to show when getDescription is called.

I can only guess that you'll need to insert the lines of code you quoted in each "if" for your custom item type.
 
OP
OP
Silba

Silba

is stephany, the josh wife
Premium User
Joined
Aug 22, 2013
Messages
373
Solutions
8
Reaction score
287
I guess that happens because there are a bunch of "if" that are filtering what each kind of items need to show when getDescription is called.

I can only guess that you'll need to insert the lines of code you quoted in each "if" for your custom item type.
I think the "regeneration" ability is given when an item has gainHealth/Mana attributes, however im just guessing since i don't understand this code at all.
C++:
                case ITEM_PARSE_HEALTHGAIN: {
                    abilities.regeneration = true;
                    abilities.healthGain = pugi::cast<uint32_t>(valueAttribute.value());
                    break;
                }

                case ITEM_PARSE_HEALTHTICKS: {
                    abilities.regeneration = true;
                    abilities.healthTicks = pugi::cast<uint32_t>(valueAttribute.value());
                    break;
                }

                case ITEM_PARSE_MANAGAIN: {
                    abilities.regeneration = true;
                    abilities.manaGain = pugi::cast<uint32_t>(valueAttribute.value());
                    break;
                }

                case ITEM_PARSE_MANATICKS: {
                    abilities.regeneration = true;
                    abilities.manaTicks = pugi::cast<uint32_t>(valueAttribute.value());
                    break;
                }


I did also try adding code from here that looks for manaGain and healthGain etc but it simply didn't work at all, instead of focusing on why that didn't work i thought it might be a good idea to instead try to make the default "(faster regeneration)" apply to my items instead and modify that but obviously that hasn't worked out for me since i have no idea what's going on 😅
Edit: Solved this issue now, I added the code to the wrong place since there's duplicate code in the source. Would still like to understand the "(faster regeneration)" though.
 
Last edited:
Top