TFS: 1.X
Greetings otland, I was looking for how to modify the Infight condition, only receive the condition if a monster attacks you (1SQM).
As you know, when a monster just sees you from afar, the player receives the Infight condition.
I started looking in the sources about that and found this:
Player:ccp
I do not know what I have to modify, I would be grateful for any help.
Greetings otland, I was looking for how to modify the Infight condition, only receive the condition if a monster attacks you (1SQM).
As you know, when a monster just sees you from afar, the player receives the Infight condition.
I started looking in the sources about that and found this:
Player:ccp
Lua:
void Player::onAttackedCreature(Creature* target, bool addFightTicks /* = true */)
{
Creature::onAttackedCreature(target);
if (target->getZone() == ZONE_PVP) {
return;
}
if (target == this) {
if (addFightTicks) {
addInFightTicks();
}
return;
}
if (hasFlag(PlayerFlag_NotGainInFight)) {
return;
}
Player* targetPlayer = target->getPlayer();
if (targetPlayer && !isPartner(targetPlayer) && !isGuildMate(targetPlayer)) {
if (!pzLocked && g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
pzLocked = true;
sendIcons();
}
targetPlayer->addInFightTicks();
if (getSkull() == SKULL_NONE && getSkullClient(targetPlayer) == SKULL_YELLOW) {
addAttacked(targetPlayer);
targetPlayer->sendCreatureSkull(this);
}
else if (!targetPlayer->hasAttacked(this)) {
if (!pzLocked) {
pzLocked = true;
sendIcons();
}
if (!Combat::isInPvpZone(this, targetPlayer) && !isInWar(targetPlayer)) {
addAttacked(targetPlayer);
if (targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE) {
setSkull(SKULL_WHITE);
}
if (getSkull() == SKULL_NONE) {
targetPlayer->sendCreatureSkull(this);
}
}
}
}
if (addFightTicks) {
addInFightTicks();
}
}
I do not know what I have to modify, I would be grateful for any help.