• 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!

Solved Full Item Description

xydius

Just an otland wanderer
Joined
Feb 25, 2016
Messages
41
Reaction score
37
Hi fellow otlanders,
i have a small issue but yet an important one imo but i cant figure out where and what to edit if i have to do it on sources or anything really... My issue is that i want a really custom server with attributes on items for example maxHitPoints etc but i want those attributes to display on description.

for example this item:

Code:
<item id="8881" article="a" name="fireborn giant armor">
        <attribute key="weight" value="12000" />
        <attribute key="armor" value="150" />
        <attribute key="skillSword" value="120" />
        <attribute key="absorbPercentFire" value="25" />
        <attribute key="absorbPercentIce" value="-25" />
        <attribute key="maxHitPoints" value="1500" />
        <attribute key="healthGain" value="650" />
        <attribute key="healthTicks" value="2000" />
        <attribute key="absorbPercentPhysical" value="5" />
        <attribute key="suppressFire" value="1" />
        <attribute key="slotType" value="body" />
    </item>

Right now it looks like this

20:51 You see a fireborn giant armor (Arm:150, sword fighting +120%, protection physical +5%, fire +25%, ice -25%).
It can only be wielded properly by knights of level 100 or higher.
It weighs 120.00 oz.
and i want it to look something like this

20:51 You see a fireborn giant armor (Arm:150, sword fighting +120%, protection physical +5%, fire +25%, ice -25%, MaxHP +1500, HPgain +650, Suppress Fire).
It can only be wielded properly by knights of level 100 or higher.
It weighs 120.00 oz.

maybe it can be done with lua it would be better but i dont know if there is any function to get all item attributes xd

im using otxserver3 vanxi version based on tfs 1.2
 
Last edited:
Have u tried adding
Code:
<attribute key="showattributes" value="1" />
? (Restart the server after changes)
If that doesnt work maybe you could go the hard way and use
Code:
<attribute key="description" value="your desc here" />
and add them manually?
 
I do have showattributes enabled but still it doesnt show maxhp or hp regen o stats like that, i thought about doing that and editing the description but i thought that was just very tedious to do and maybe could be done with a function lol ill give it a try and look a little more into this without editing the descriptions
 
I solved it it just needed a src edit in item.cpp in the function getDescription()

wherever u find

C++:
if (it.abilities->stats[STAT_MAGICPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "magic level " << std::showpos << it.abilities->stats[STAT_MAGICPOINTS] << std::noshowpos;
                }

you add this code afterwards

C++:
if (it.abilities->stats[STAT_MAXHITPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max HP " << std::showpos << it.abilities->stats[STAT_MAXHITPOINTS] << std::noshowpos;
                }

                if (it.abilities->statsPercent[STAT_MAXHITPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max HP " << std::showpos << (it.abilities->statsPercent[STAT_MAXHITPOINTS] - 100) << "%" << std::noshowpos;
                }

                if (it.abilities->stats[STAT_MAXMANAPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max MP " << std::showpos << it.abilities->stats[STAT_MAXMANAPOINTS] << std::noshowpos;
                }

                if (it.abilities->statsPercent[STAT_MAXMANAPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max MP " << std::showpos << (it.abilities->statsPercent[STAT_MAXMANAPOINTS] - 100) << "%" << std::noshowpos;
                }

                if (it.abilities->manaGain) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "MP Regen " << std::showpos << it.abilities->manaGain << std::noshowpos;
                }

                if (it.abilities->healthGain) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "HP Regen " << std::showpos << it.abilities->healthGain << std::noshowpos;
                }

then you jut compile and thats it :)

Items on look now show like this

22:33 You see a fireborn giant armor (Arm:150, sword fighting +120%, Max HP +1500, HP Regen 650, protection physical +5%, fire +25%, ice -25%).
It can only be wielded properly by knights of level 100 or higher.
It weighs 120.00 oz.

I hope this helps someone else :p

P.D. edited to work properly with maxhp/mp percents and it now shows hp/mp regen aswell
 
Last edited:
Is there a specific place? when the character receives a monster attack or damage the server crashes. If you remove the modification everything works again.

FLP
 
I solved it it just needed a src edit in item.cpp in the function getDescription()

wherever u find

C++:
if (it.abilities->stats[STAT_MAGICPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "magic level " << std::showpos << it.abilities->stats[STAT_MAGICPOINTS] << std::noshowpos;
                }

you add this code afterwards

C++:
if (it.abilities->stats[STAT_MAXHITPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max HP " << std::showpos << it.abilities->stats[STAT_MAXHITPOINTS] << std::noshowpos;
                }

                if (it.abilities->statsPercent[STAT_MAXHITPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max HP " << std::showpos << (it.abilities->statsPercent[STAT_MAXHITPOINTS] - 100) << "%" << std::noshowpos;
                }

                if (it.abilities->stats[STAT_MAXMANAPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max MP " << std::showpos << it.abilities->stats[STAT_MAXMANAPOINTS] << std::noshowpos;
                }

                if (it.abilities->statsPercent[STAT_MAXMANAPOINTS]) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "Max MP " << std::showpos << (it.abilities->statsPercent[STAT_MAXMANAPOINTS] - 100) << "%" << std::noshowpos;
                }

                if (it.abilities->manaGain) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "MP Regen " << std::showpos << it.abilities->manaGain << std::noshowpos;
                }

                if (it.abilities->healthGain) {
                    if (begin) {
                        begin = false;
                        s << " (";
                    } else {
                        s << ", ";
                    }

                    s << "HP Regen " << std::showpos << it.abilities->healthGain << std::noshowpos;
                }

then you jut compile and thats it :)

Items on look now show like this

22:33 You see a fireborn giant armor (Arm:150, sword fighting +120%, Max HP +1500, HP Regen 650, protection physical +5%, fire +25%, ice -25%).
It can only be wielded properly by knights of level 100 or higher.
It weighs 120.00 oz.

I hope this helps someone else :p

P.D. edited to work properly with maxhp/mp percents and it now shows hp/mp regen aswell
Work for tfs 0.4?
 
Back
Top