CipsoftStinks
www.relicaria.com
Hello to everyone
im using tfs 0.3.7- 0.4 (otx 2)
i want to add this functions becuse the server doesn't have it
but i don't even know how to write it
could anyone help me please?
im using tfs 0.3.7- 0.4 (otx 2)
i want to add this functions becuse the server doesn't have it
but i don't even know how to write it
could anyone help me please?
Code:
bool Spell::checkRuneSpell(Player* player, const Position& toPos)
{
if(!checkSpell(player))
return false;
if(toPos.x == 0xFFFF)
return true;
const Position& playerPos = player->getPosition();
if(playerPos.z > toPos.z)
{
player->sendCancelMessage(RET_FIRSTGOUPSTAIRS);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(playerPos.z < toPos.z)
{
player->sendCancelMessage(RET_FIRSTGODOWNSTAIRS);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
Tile* tile = g_game.getTile(toPos);
if(!tile)
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(range != -1 && !g_game.canThrowObjectTo(playerPos, toPos, true, range, range))
{
player->sendCancelMessage(RET_DESTINATIONOUTOFREACH);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
ReturnValue ret;
if((ret = Combat::canDoCombat(player, tile, isAggressive, false)) != RET_NOERROR)
{
player->sendCancelMessage(ret);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
Creature* targetCreature = tile->getTopCreature();
if(blockingCreature && targetCreature)
{
player->sendCancelMessage(RET_NOTENOUGHROOM);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(blockingSolid && tile->hasProperty(BLOCKSOLID))
{
player->sendCancelMessage(RET_NOTENOUGHROOM);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(needTarget && !targetCreature)
{
player->sendCancelMessage(RET_CANONLYUSETHISRUNEONCREATURES);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(!targetCreature)
return true;
Player* targetPlayer = targetCreature->getPlayer();
if(isAggressive && needTarget && !Combat::isInPvpZone(player, targetPlayer) && player->getSecureMode() == SECUREMODE_ON && (targetPlayer && targetPlayer != player && targetPlayer->getSkull() == SKULL_NONE))
{
player->sendCancelMessage(RET_TURNSECUREMODETOATTACKUNMARKEDPLAYERS);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
return true;
}