bool InstantSpell::SummonMonster(const InstantSpell* spell, Creature* creature, const std::string& param)
{
Player* player = creature->getPlayer();
if(!player)
return false;
if(!Position::areInRange(player->getPosition(), Position(100, 100, 7), Position(200, 200, 7)))
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
MonsterType* mType = g_monsters.getMonsterType(param);
if(!mType)
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
int32_t manaCost = (int32_t)(mType->manaCost * g_config.getDouble(ConfigManager::RATE_MONSTER_MANA));
if(!player->hasFlag(PlayerFlag_CanSummonAll))
{
if(player->getSkull() == SKULL_BLACK)
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(!mType->isSummonable)
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if(player->getMana() < manaCost)
{
player->sendCancelMessage(RET_NOTENOUGHMANA);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
if((int32_t)player->getSummonCount() >= g_config.getNumber(ConfigManager::MAX_PLAYER_SUMMONS))
{
player->sendCancel("You cannot summon more creatures.");
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
}
ReturnValue ret = g_game.placeSummon(creature, param);
if(ret == RET_NOERROR)
{
spell->postSpell(player, (uint32_t)manaCost, (uint32_t)spell->getSoulCost());
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);
return true;
}
player->sendCancelMessage(ret);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
local t = {
serpent = {x=115, y=123, z=7},
serpentto = {x=151, y=159, z=7},
zombie = {x=100, y=179, z=6},
zombieto = {x=128, y=208, z=6},
pacman = {x=32282, y=32886, z=6},
pacmanto = {x=32289, y=32895, z=6},
bomber = {x=32156, y=32549, z=6},
bomberto = {x=32165, y=32570, z=6},
ping = {x=32521, y=32780, z=6},
pingto = {x=32539, y=32787, z=6}
}
function onSay(cid, words, param, channel)
if isPlayer(cid) and isInRange(getThingPos(cid), t.serpent, t.serpentto) or isPlayer(cid) and isInRange(getThingPos(cid), t.zombie, t.zombieto) or isPlayer(cid) and isInRange(getThingPos(cid), t.pacman, t.pacmanto) then
if(param == "utevo res") then
doPlayerSendCancel(cid, "You can't using this spell here.")
end
return true
end
end