- Joined
- Jan 31, 2009
- Messages
- 43
- Reaction score
- 6
Hello.
I will share with my vocation effect system. It is useful for all OTS with transform system etc.
First in vocation.h after:
paste:
After:
add
Now, in vocation.cpp after:
Insert our line:
And of course, under
insert
Now in player.h after:
add:
and in player.cpp after
add
And after:
add our:
Now in our vocation.xml file we can use:
I wrote it some months ago, so i will be glad if someone will test it and report bugs. If someone will be interestet to get more configurable version, i can upload it (Or all transform system).
P.S
this line is from my edited OTS so use your own vocation example.
I will share with my vocation effect system. It is useful for all OTS with transform system etc.
First in vocation.h after:
Code:
std::string name, description;
Code:
uint8_t effect;
After:
Code:
uint64_t getReqMana(uint32_t magLevel);
Code:
uint16_t getEffect() const {return effect;};
void setEffect(int32_t v) {effect = v;};
Now, in vocation.cpp after:
Code:
else if(!xmlStrcmp(configNode->name, (const xmlChar*)"reflect"))
{
if(readXMLInteger(configNode, "percentAll", intValue))
{
for(int32_t i = COMBAT_FIRST; i <= COMBAT_LAST; i++)
voc->increaseReflect(REFLECT_PERCENT, (CombatType_t)i, intValue);
}
if(readXMLInteger(configNode, "percentElements", intValue))
{
voc->increaseReflect(REFLECT_PERCENT, COMBAT_ENERGYDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_FIREDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_EARTHDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_ICEDAMAGE, intValue);
}
if(readXMLInteger(configNode, "percentMagic", intValue))
{
voc->increaseReflect(REFLECT_PERCENT, COMBAT_ENERGYDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_FIREDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_EARTHDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_ICEDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_HOLYDAMAGE, intValue);
voc->increaseReflect(REFLECT_PERCENT, COMBAT_DEATHDAMAGE, intValue);
}
if(readXMLInteger(configNode, "percentEnergy", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_ENERGYDAMAGE, intValue);
if(readXMLInteger(configNode, "percentFire", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_FIREDAMAGE, intValue);
if(readXMLInteger(configNode, "percentPoison", intValue) || readXMLInteger(configNode, "percentEarth", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_EARTHDAMAGE, intValue);
if(readXMLInteger(configNode, "percentIce", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_ICEDAMAGE, intValue);
if(readXMLInteger(configNode, "percentHoly", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_HOLYDAMAGE, intValue);
if(readXMLInteger(configNode, "percentDeath", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_DEATHDAMAGE, intValue);
if(readXMLInteger(configNode, "percentLifeDrain", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_LIFEDRAIN, intValue);
if(readXMLInteger(configNode, "percentManaDrain", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_MANADRAIN, intValue);
if(readXMLInteger(configNode, "percentDrown", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_DROWNDAMAGE, intValue);
if(readXMLInteger(configNode, "percentPhysical", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_PHYSICALDAMAGE, intValue);
if(readXMLInteger(configNode, "percentHealing", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_HEALING, intValue);
if(readXMLInteger(configNode, "percentUndefined", intValue))
voc->increaseReflect(REFLECT_PERCENT, COMBAT_UNDEFINEDDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceAll", intValue))
{
for(int32_t i = COMBAT_FIRST; i <= COMBAT_LAST; i++)
voc->increaseReflect(REFLECT_CHANCE, (CombatType_t)i, intValue);
}
if(readXMLInteger(configNode, "chanceElements", intValue))
{
voc->increaseReflect(REFLECT_CHANCE, COMBAT_ENERGYDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_FIREDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_EARTHDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_ICEDAMAGE, intValue);
}
if(readXMLInteger(configNode, "chanceMagic", intValue))
{
voc->increaseReflect(REFLECT_CHANCE, COMBAT_ENERGYDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_FIREDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_EARTHDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_ICEDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_HOLYDAMAGE, intValue);
voc->increaseReflect(REFLECT_CHANCE, COMBAT_DEATHDAMAGE, intValue);
}
if(readXMLInteger(configNode, "chanceEnergy", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_ENERGYDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceFire", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_FIREDAMAGE, intValue);
if(readXMLInteger(configNode, "chancePoison", intValue) || readXMLInteger(configNode, "chanceEarth", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_EARTHDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceIce", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_ICEDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceHoly", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_HOLYDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceDeath", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_DEATHDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceLifeDrain", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_LIFEDRAIN, intValue);
if(readXMLInteger(configNode, "chanceManaDrain", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_MANADRAIN, intValue);
if(readXMLInteger(configNode, "chanceDrown", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_DROWNDAMAGE, intValue);
if(readXMLInteger(configNode, "chancePhysical", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_PHYSICALDAMAGE, intValue);
if(readXMLInteger(configNode, "chanceHealing", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_HEALING, intValue);
if(readXMLInteger(configNode, "chanceUndefined", intValue))
voc->increaseReflect(REFLECT_CHANCE, COMBAT_UNDEFINEDDAMAGE, intValue);
}
Insert our line:
Code:
else if(!xmlStrcmp(configNode->name, (const xmlChar*)"transform"))
{
if(readXMLInteger(configNode, "effect", intValue))
voc->setEffect(intValue);
}
Code:
name = description = "";
Code:
effect = 0;
Now in player.h after:
Code:
uint64_t lastAttack;
Code:
uint64_t lastEffect;
and in player.cpp after
Code:
lastLoad = lastPing = lastPong = OTSYS_TIME();
Code:
lastEffect = 0;
And after:
Code:
Creature::onThink(interval);
int64_t timeNow = OTSYS_TIME();
Code:
if((timeNow - lastEffect) >= 2500)
{//sawex transform
if(vocation->getEffect() > 0)
g_game.addMagicEffect(getPosition(), vocation->getEffect());
lastEffect = timeNow;
}
Now in our vocation.xml file we can use:
Code:
<vocation id="1" name="uzumaki naruto" description="a Uzumaki Naruto" needpremium="0" gaincap="20" gainhp="25" gainmana="25" gainhpticks="4" gainhpamount="10" gainmanaticks="4" gainmanaamount="10" manamultiplier="1.3" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="1">
<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
<skill taijutsu="1.1" dodge="1.5" sword="2.0" attackspeed="1.5" dist="2.0" shield="1.5" critical="1.5" experience="1.0"/>
<transform effect="55"/>
</vocation>
I wrote it some months ago, so i will be glad if someone will test it and report bugs. If someone will be interestet to get more configurable version, i can upload it (Or all transform system).
P.S
Code:
<skill taijutsu="1.1" dodge="1.5" sword="2.0" attackspeed="1.5" dist="2.0" shield="1.5" critical="1.5" experience="1.0"/>