void Map::AttackSpell(Character *from, int spellid, int targetid) { ESF_Data *spell = this->world->esf->Get(spellid); if (!spell) return; if (this->pk || (static_cast<int>(this->world->config["GlobalPK"]) && !this->world->PKExcept(this->id))) { if (this->AttackPKSpell(from, spellid, targetid)) { return; } } UTIL_PTR_LIST_FOREACH(this->characters, Character, character) { UTIL_PTR_VECTOR_FOREACH(this->npcs, NPC, npc) { if (from->clas == 9) { if ((npc->pet || npc->Data()->type == ENF::Pet || npc->Data()->type == ENF::Passive || npc->Data()->type == ENF::Aggressive || from->admin > static_cast<int>(this->world->admin_config["killnpcs"])) && npc->alive) { int amount = util::rand(spell->mindam + 60000, spell->maxdam +60000); //int amount = util::rand(from->mindam + 0, from->maxdam + 0); npc->SpellDamage(from, amount, spellid, targetid); } } else if (from->clas != 9) { if ((npc->pet || npc->Data()->type == ENF::Pet || npc->Data()->type == ENF::Passive || npc->Data()->type == ENF::Aggressive || from->admin > static_cast<int>(this->world->admin_config["killnpcs"])) && npc->alive && npc->index == targetid) { int amount = util::rand(spell->mindam, spell->maxdam); //int amount = util::rand(from->mindam, from->maxdam); npc->SpellDamage(from, amount, spellid, targetid); return; } } } } }