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

TFS 0.X Wrong charges amount on amulets

gader

New Member
Joined
Dec 20, 2017
Messages
22
Reaction score
1
Hi,

Part of amulets looted from monsters have only 1 charge instead of 20 for example. Also when I going to sell it in shop required is also only amulet with 1 charge. Somebody know what causes that?
 
in monster source it shows like this

bool Monsters::loadLoot(xmlNodePtr node, LootBlock& lootBlock)
{
std::string strValue;
if(readXMLString(node, "id", strValue) || readXMLString(node, "ids", strValue))
{
IntegerVec idsVec;
parseIntegerVec(strValue, idsVec);
for(IntegerVec::iterator it = idsVec.begin(); it != idsVec.end(); ++it)
{
lootBlock.ids.push_back(*it);
if(Item::items[(*it)].isContainer())
loadChildLoot(node, lootBlock);
}
}
else if(readXMLString(node, "name", strValue) || readXMLString(node, "names", strValue))
{
StringVec names = explodeString(strValue, ";");
for(StringVec::iterator it = names.begin(); it != names.end(); ++it)
{
uint16_t tmp = Item::items.getItemIdByName(strValue);
if(!tmp)
continue;

lootBlock.ids.push_back(tmp);
if(Item::items[tmp].isContainer())
loadChildLoot(node, lootBlock);
}
}

if(lootBlock.ids.empty())
return false;

int32_t intValue;
if(readXMLInteger(node, "count", intValue) || readXMLInteger(node, "countmax", intValue))
lootBlock.count = intValue;
else
lootBlock.count = 1;

if(readXMLInteger(node, "chance", intValue) || readXMLInteger(node, "chance1", intValue))
lootBlock.chance = std::min(MAX_LOOTCHANCE, intValue);
else
lootBlock.chance = MAX_LOOTCHANCE;

if(readXMLInteger(node, "subtype", intValue) || readXMLInteger(node, "subType", intValue))
lootBlock.subType = intValue;

if(readXMLInteger(node, "actionId", intValue) || readXMLInteger(node, "actionid", intValue)
|| readXMLInteger(node, "aid", intValue))
lootBlock.actionId = intValue;

if(readXMLInteger(node, "uniqueId", intValue) || readXMLInteger(node, "uniqueid", intValue)
|| readXMLInteger(node, "uid", intValue))
lootBlock.uniqueId = intValue;

if(readXMLString(node, "text", strValue))
lootBlock.text = strValue;

return true;
}

so I think you can use count or subtype to set how many charges your item will have.
try using it like this to test:

Code:
<item id="xxxx" count="20" chance="10000"/>
<item id="xxxx" subtype="20" chance="10000"/>
 
Can you post the shop NPC XML/lua? You just need to add another field in the XML if I remember correctly.
 
in monster source it shows like this



so I think you can use count or subtype to set how many charges your item will have.
try using it like this to test:

Code:
<item id="xxxx" count="20" chance="10000"/>
<item id="xxxx" subtype="20" chance="10000"/>

To be honest I don't think so :(. It should be loaded from items.xml by default in my opinion.

Can you post the shop NPC XML/lua? You just need to add another field in the XML if I remember correctly.

It's the same like that:
Code:
<parameter key="shop_buyable" value="brown bread,2691,8;ham,2671,8;carrot,2684,8;meat,2666,8;apple,2674,8;brown mushroom,2789,8;egg,2695,8"/>

But like I said this amount of charge is visible when I loot item from monster and when I display that in shop. It looks like wrong default value loading.
 
Back
Top