cocacola13
Member
Hi, I have this problem because I have a modified tfs that I can add what I want on time, and when time runs out it removes it.
so the point is that I need help with the fact that if it removes the item it will give the basic item to start and read these properties from config_war
does not work adding a change in xml will change the item after time, but still the function with src removes this item
Items.xml
Function on time : Movements.cpp
item.cpp
and wants the shipowners, trousers, vandals, shields, helmets, boots, not to remove them but to change them to a given id
so the point is that I need help with the fact that if it removes the item it will give the basic item to start and read these properties from config_war
does not work adding a change in xml will change the item after time, but still the function with src removes this item
Items.xml
Lua:
<item id="8888" article="a" name="durak paladin armor">
<attribute key="armor" value="15" />
<attribute key="slotType" value="body" />
<attribute key="weight" value="5000" />
<attribute key="skillDist" value="8" />
<attribute key="duration" value="20" />
<attribute key="showduration" value="0" />
<attribute key="decayTo" value="2463" />
<attribute key="absorbPercentPhysical" value="2"/>
<attribute key="absorbPercentDeath" value="3" />
</item>
Function on time : Movements.cpp
Code:
uint32_t itemID = item->getID();
if (itemID == 8852 || itemID == 8849 || itemID == 8853 || itemID == 2455 || itemID == 2399 || itemID == 7366 || itemID == 7368)
{
Outfit_t outfit = player->getCurrentOutfit();
g_game.internalCreatureChangeOutfit(player, outfit);
}
if (!item->hasAttribute(ITEM_ATTRIBUTE_TIMEITEM))
{
int32_t value = 0;
if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 4)
value += 14400 + (OTSYS_TIME() / 1000);
else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 8)
value += 28800 + (OTSYS_TIME() / 1000);
else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 10)
value += 36000 + (OTSYS_TIME() / 1000);
else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 12)
value += 43200 + (OTSYS_TIME() / 1000);
else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 3)
value += 10800 + (OTSYS_TIME() / 1000);
// else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 140)
// value += 2400 + (OTSYS_TIME() / 1000);
// else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 130)
// value += 1800 + (OTSYS_TIME() / 1000);
else if (item->getIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM) == 1)
value += 100 + (OTSYS_TIME() / 1000);
if(value != 0)
{
item->setIntAttr(ITEM_ATTRIBUTE_TIMEITEM, value);
item->removeAttribute(ITEM_ATTRIBUTE_DESCRIPTION);
g_game.addTimeItem(item);
}
}
item.cpp
Code:
int items4h[] = {
2497, 2491, 2323, 2503, 2487, 8870, 2504, 2488,
7730, 2515, 2539, 8900, 11240, 11303, 7434, 12648,
12649, 7422, 8852, 8881, 7899, 6132, 2640, 8886,
2528, 2462, 2475, 7462, 8820, 8819, 8872, 2476,
2477, 2647, 2468, 2521, 8902, 2645, 2195, 7380,
2184, 11307, 7409, 8849
};
int items12h[] = {
12645, 2498, 10016, 2466, 8891, 2656, 12644,
2542, 8904, 12646, 2470, 8925, 12327, 8931, 8929, 8853
};
int items4h_length = sizeof(items4h)/sizeof(items4h[0]);
int items12h_length = sizeof(items12h)/sizeof(items12h[0]);
for (int i = 0; i < items4h_length; i++)
{
if (it.id == items4h[i])
{
newItem->setStrAttr(ITEM_ATTRIBUTE_DESCRIPTION, "This item is BRAND-NEW [4h]");
newItem->setIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM, 4);
}
}
for (int i = 0; i < items12h_length; i++)
{
if (it.id == items12h[i])
{
newItem->setStrAttr(ITEM_ATTRIBUTE_DESCRIPTION, "This item is BRAND-NEW [12h]");
newItem->setIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM, 12);
}
}
if (it.id == 8877 || it.id == 3968 || it.id == 8892 || it.id == 3964)
{
newItem->setStrAttr(ITEM_ATTRIBUTE_DESCRIPTION, "This item is BRAND-NEW [10h]");
newItem->setIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM, 10);
}
else if (it.id == 2100)
{
newItem->setStrAttr(ITEM_ATTRIBUTE_DESCRIPTION, "This item is BRAND-NEW [2h]");
newItem->setIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM, 2);
}
else if (it.id == 8869 || it.id == 2522 || it.id == 11118)
{
newItem->setStrAttr(ITEM_ATTRIBUTE_DESCRIPTION, "This item is BRAND-NEW [3h]");
newItem->setIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM, 3);
}
else if (it.id == 8888 || it.id == 8880)
{
newItem->setStrAttr(ITEM_ATTRIBUTE_DESCRIPTION, "This item is BRAND-NEW [1h]");
newItem->setIntAttr(ITEM_ATTRIBUTE_ISTIMEITEM, 1);
}
and wants the shipowners, trousers, vandals, shields, helmets, boots, not to remove them but to change them to a given id
Last edited: