bool IsSuspendableSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && spells[spell_id].suspendable) return true; return false; }
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<void*> *extra_pointers) { Seperator sep(data.c_str()); Mob *o = entity_list.GetMobID(std::stoi(sep.arg[0])); Lua_Mob l_mob(o); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); lua_setfield(L, -2, "other"); lua_pushinteger(L, std::stoi(sep.arg[1])); lua_setfield(L, -2, "damage"); int spell_id = std::stoi(sep.arg[2]); if(IsValidSpell(spell_id)) { Lua_Spell l_spell(&spells[spell_id]); luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell); l_spell_o.push(L); lua_setfield(L, -2, "spell"); } else { Lua_Spell l_spell(nullptr); luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell); l_spell_o.push(L); lua_setfield(L, -2, "spell"); } lua_pushinteger(L, std::stoi(sep.arg[3])); lua_setfield(L, -2, "skill"); }
// returns true for both detrimental and beneficial buffs bool IsBuffSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && (spells[spell_id].buffduration || spells[spell_id].buffdurationformula)) return true; return false; }
bool DetrimentalSpellAllowsRest(uint16 spell_id) { if (IsValidSpell(spell_id)) return spells[spell_id].AllowRest; return false; }
DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) { // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { _log(SPELLS__EFFECT_VALUES, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) return (DmgShieldType) spells[spell_id].DamageShieldType; switch (spells[spell_id].resisttype) { case RESIST_COLD: return DS_TORMENT; case RESIST_FIRE: return DS_BURN; case RESIST_DISEASE: return DS_DECAY; default: return DS_THORNS; } } else if (DSType) return (DmgShieldType) DSType; return DS_THORNS; }
bool IsBardSong(uint16 spell_id) { if (IsValidSpell(spell_id) && spells[spell_id].classes[BARD - 1] < 255) return true; return false; }
bool IsPersistDeathSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && spells[spell_id].persistdeath) return true; return false; }
int32 GetFuriousBash(uint16 spell_id) { if(!IsValidSpell(spell_id)) return 0; bool found_effect_limit = false; int32 mod = 0; for(int i = 0; i < EFFECT_COUNT; ++i) { if(spells[spell_id].effectid[i] == SE_SpellHateMod) { mod = spells[spell_id].base[i]; } else if(spells[spell_id].effectid[i] == SE_LimitEffect) { if(spells[spell_id].base[i] == 999) { found_effect_limit = true; } } } if(found_effect_limit) return mod; else return 0; }
bool IsTargetableAESpell(uint16 spell_id) { if (IsValidSpell(spell_id) && spells[spell_id].targettype == ST_AETarget) return true; return false; }
bool IsBeneficialSpell(uint16 spell_id) { if(!IsValidSpell(spell_id)) return false; if(spells[spell_id].goodEffect == 1){ SpellTargetType tt = spells[spell_id].targettype; if(tt != ST_Self && tt != ST_Pet){ if(IsEffectInSpell(spell_id, SE_CancelMagic)) return false; } if(tt == ST_Target || tt == ST_AETarget || tt == ST_Animal || tt == ST_Undead || tt == ST_Pet) { uint16 sai = spells[spell_id].SpellAffectIndex; if(spells[spell_id].resisttype == RESIST_MAGIC){ if(sai == SAI_Calm || sai == SAI_Dispell_Sight || sai == SAI_Memory_Blur || sai == SAI_Calm_Song) return false; }else{ // Bind Sight and Cast Sight if(sai == SAI_Dispell_Sight && spells[spell_id].skill == 18 && !IsEffectInSpell(spell_id, SE_VoiceGraft)) return false; } } } return spells[spell_id].goodEffect != 0 || IsGroupSpell(spell_id); }
void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<void*> *extra_pointers) { Lua_Mob l_mob(init); luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob); l_mob_o.push(L); lua_setfield(L, -2, "other"); Seperator sep(data.c_str()); lua_pushinteger(L, std::stoi(sep.arg[0])); lua_setfield(L, -2, "damage"); int spell_id = std::stoi(sep.arg[1]); if(IsValidSpell(spell_id)) { Lua_Spell l_spell(&spells[spell_id]); luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell); l_spell_o.push(L); lua_setfield(L, -2, "spell"); } else { Lua_Spell l_spell(nullptr); luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell); l_spell_o.push(L); lua_setfield(L, -2, "spell"); } lua_pushinteger(L, std::stoi(sep.arg[2])); lua_setfield(L, -2, "skill_id"); }
bool IsShortDurationBuff(uint16 spell_id) { if (IsValidSpell(spell_id) && spells[spell_id].short_buff_box != 0) return true; return false; }
uint32 GetNimbusEffect(uint16 spell_id) { if (IsValidSpell(spell_id)) return (int32)spells[spell_id].NimbusEffect; return 0; }
int GetSpellEffectDescNum(uint16 spell_id) { if (IsValidSpell(spell_id)) return spells[spell_id].effectdescnum; return -1; }
bool IsAERainNukeSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) && spells[spell_id].aoerange > 0 && spells[spell_id].AEDuration > 1000) return true; return false; }
bool IsPBAENukeSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) && spells[spell_id].aoerange > 0 && spells[spell_id].targettype == ST_AECaster) return true; return false; }
bool IsAENukeSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && IsPureNukeSpell(spell_id) && spells[spell_id].aoerange > 0) return true; return false; }
bool IsResurrectionEffects(uint16 spell_id) { // spell id 756 is Resurrection Effects spell if(IsValidSpell(spell_id) && spell_id == 756) return true; return false; }
bool IsPowerDistModSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && (spells[spell_id].max_dist_mod || spells[spell_id].min_dist_mod) && spells[spell_id].max_dist > spells[spell_id].min_dist) return true; return false; }
bool IsDeathSaveSpell(uint16 spell_id) { bool Result = false; if(IsValidSpell(spell_id)) Result = IsEffectInSpell(spell_id, SE_DeathSave); return Result; }
bool IsResurrectionEffects(uint16 spell_id) { bool Result = false; if(IsValidSpell(spell_id) && spell_id == 756) // spell id 756 is Resurrection Effects spell Result = true; return Result; }
bool IsAllianceSpellLine(uint16 spell_id) { bool Result = false; if(IsValidSpell(spell_id)) Result = IsEffectInSpell(spell_id, SE_AddFaction); return Result; }
bool IsBardSong(uint16 spell_id) { return ( IsValidSpell(spell_id) && spells[spell_id].classes[BARD - 1] < 255 ); }
bool IsMagicRuneSpell(uint16 spell_id) { if(IsValidSpell(spell_id)) for(int i = 0; i < EFFECT_COUNT; i++) if(spells[spell_id].effectid[i] == SE_AbsorbMagicAtt) return true; return false; }
bool IsTargetableAESpell(uint16 spell_id) { bool bResult = false; if (IsValidSpell(spell_id) && spells[spell_id].targettype == ST_AETarget) { bResult = true; } return bResult; }
bool IsAEDurationSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && (spells[spell_id].targettype == ST_AETarget || spells[spell_id].targettype == ST_UndeadAE) && spells[spell_id].AEDuration != 0) return true; return false; }
// checks if this spell can be targeted bool IsTGBCompatibleSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && (!IsDetrimentalSpell(spell_id) && spells[spell_id].buffduration != 0 && !IsBardSong(spell_id) && !IsEffectInSpell(spell_id, SE_Illusion))) return true; return false; }
bool IsSpellUsableThisZoneType(uint16 spell_id, uint8 zone_type) { //check if spell can be cast in any zone (-1 or 255), then if spell zonetype matches zone's zonetype // || spells[spell_id].zonetype == 255 comparing signed 8 bit int to 255 is always false if (IsValidSpell(spell_id) && (spells[spell_id].zonetype == -1 || spells[spell_id].zonetype == zone_type)) return true; return false; }
// checks if this spell affects your group bool IsGroupSpell(uint16 spell_id) { if (IsValidSpell(spell_id) && (spells[spell_id].targettype == ST_AEBard || spells[spell_id].targettype == ST_Group || spells[spell_id].targettype == ST_GroupTeleport)) return true; return false; }
bool IsManaTapSpell(uint16 spell_id) { if (IsValidSpell(spell_id)) for (int i = 0; i < EFFECT_COUNT; i++) if (spells[spell_id].effectid[i] == SE_CurrentMana && spells[spell_id].targettype == ST_Tap) return true; return false; }