Pisałem w TFS 0.3. Zaczynajmy!
items.cpp
Szukamy:
Kod:
else if(tmpStrValue == "name")
{
if(readXMLString(itemAttributesNode, "value", strValue))
it.name = strValue;
}
Kod:
else if(tmpStrValue == "weartext")
{
if(readXMLString(itemAttributesNode, "value", strValue))
it.weartext = strValue;
}
else if(tmpStrValue == "wearofftext")
{
if(readXMLString(itemAttributesNode, "value", strValue))
it.wearofftext = strValue;
}
else if(tmpStrValue == "weareffect")
{
if(readXMLInteger(itemAttributesNode, "value", intValue))
it.weareffect = intValue;
}
else if(tmpStrValue == "wearoffeffect")
{
if(readXMLInteger(itemAttributesNode, "value", intValue))
it.wearoffeffect = intValue;
}
Szukamy:
Kod:
int32_t attack, extraAttack, defense, extraDefense, armor, breakChance, hitChance, maxHitChance, runeLevel, runeMagLevel, lightLevel, lightColor, decayTo, rotateTo, alwaysOnTopOrder;
Kod:
weareffect, wearoffeffect
Kod:
std::string name, pluralName, article, description, runeSpellName, vocationString;
Kod:
weartext, wearofftext
weartext - tutaj przechowywany będzie tekst, który pojawiać będzie się po ZAŁOŻENIU itemu.
wearofftext - podobnie jak wyżej, ale po zdjęciu go z siebie
weareffect - efekt przy założeniu, np. ten dymek przy sorry, not possible.
wearoffeffect - podobnie jak wyżej, ale po zdjęciu przedmiotu z siebie.
Teraz jedyne, co nam pozostało, to dodać do movement.cpp :-)
movement.cpp
Szukamy w funkcji uint32_t MoveEvent::EquipItem(MoveEvent* moveEvent, Player* player, Item* item, slots_t slot, bool isCheck):
Kod:
for(uint32_t s = STAT_FIRST; s <= STAT_LAST; ++s)
Kod:
if(it.weartext != "")
player->sendTextMessage(MSG_INFO_DESCR, it.weartext);
if(it.weareffect)
g_game.addMagicEffect(player->getPosition(), it.weareffect);
Kod:
for(uint32_t s = STAT_FIRST; s <= STAT_LAST; ++s)
Kod:
if(it.wearofftext != "")
player->sendTextMessage(MSG_INFO_DESCR, it.wearofftext);
if(it.wearoffeffect)
g_game.addMagicEffect(player->getPosition(), it.wearoffeffect);
Kod:
<item id="2463" article="a" name="plate armor">
<attribute key="weartext" value="Feel the power of plate armor."/>
<attribute key="weareffect" value="2"/>
<attribute key="wearofftext" value="Why did you do this?"/>
<attribute key="wearoffeffect" value="3"/>
<attribute key="weight" value="12000"/>
<attribute key="armor" value="10"/>
<attribute key="slotType" value="body"/>
</item>
Zakładki