Well so far nobody answered so here i go:
I couldn't handle things from otclient so i did it in server-side.
In order to fix the problem of hitting the first creature in the stack (on bottom) instead of the last creature on stack (on top, how it is supposed to be in 7.4) i just reversed the result of this iterator in tile.cpp
Code:
Creature* Tile::getTopCreature()
{
if(CreatureVector* creatures = getCreatures()){
if(!creatures->empty()){
return *creatures->rbegin(); // Here i changed "begin()" for "rbegin()".
}
}
return NULL;
}
After this change, you can heal-damage anyone on top of the stack, but only the runes in scripts that have the
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) (any number above 0 enables this feature) makes you heal/damage the creature on top on the stack, the rest of the runes that doesn't have this combat param in the script just hit everyone on the stack.
It works fine if you're not in the stack, but the problem with this feature is regardness of being on bottom or top of the stack, if you're in the stack you heal yourself no matter what. To change this to the 7.4 behaviour (heal yourself only if you're the one in the top), you need commit this lines in combat.cpp:
Lua:
if(params.targetCasterOrTopMost){
/* if(caster && caster->getTile() == iter_tile){ -- Commented lines to disable priority of caster in stack for healing purposes.
if(*cit == caster){
bContinue = false;
}
}
else */if(*cit == iter_tile->getTopCreature()){
bContinue = false;
}
In that way, you have most of your 7.4 uh trap working.
What is left: At the momment you can use any rune that doesn't have that parameter in the script in a stack and you hit everyone, but if you use any other rune without that param, you hit everyone in the stack regardness of your position inside the stack. If you set all runes with that parameter (i.e hmm or sd) you will hit only the person on top of the stack (back then in 7.4 you could hit everyone with 1 shoot, but you couldn't shot if you were on top of the stack).
That's all, i hope someone can help me out with the other parameter or figure out how to fix what is left. I'm using Othire 1.0 and 7.72 client from here:
Tibia Legacy Server is a OpenTibia 7.72 real map server. - peonso/tibialegacyserver
github.com
An alternative client for OTServ 7.72. Contribute to peonso/otclient772 development by creating an account on GitHub.
github.com