SpellItem* SpellShell::FindSpell(int spell_id, int caster_id, int target_id) { bool target = true; const Spell* spell = m_spells->spell(spell_id); if (spell) target = (spell->targetType() != 6); for(QValueList<SpellItem*>::Iterator it = m_spellList.begin(); it != m_spellList.end(); it++) { SpellItem *i = *it; //loop to trap a spell being added that is already cast on self. if ((i->spellId() == spell_id) && (i->casterId() == i->targetId())) if (caster_id == target_id) return i; if ((i->spellId() == spell_id) && (i->targetId() == target_id)) { if ( (target) && (target_id) ) { if (i->targetId() == target_id) return i; } else return i; } } return NULL; }
SpellItem* SpellShell::FindSpell(int spell_id, int target_id) { bool target = true; const Spell* spell = m_spells->spell(spell_id); if (spell) target = (spell->targetType() != 6); for(QValueList<SpellItem*>::Iterator it = m_spellList.begin(); it != m_spellList.end(); it++) { SpellItem *i = *it; //loop to trap a spell being added that is already cast on self. if (i->spellId() == spell_id) { // if it's a targeted spell, check target, else just return the item if (target) { // if the target id is non-zero, then check it, otherwise return it if (i->targetId()) { // if target id matches then return it if (i->targetId() == target_id) return i; } else return i; // no target id, return item } else return i; // non-targeted spell, return item } } return NULL; }
SpellItem* SpellShell::findSpell(int spell_id) { for(QValueList<SpellItem*>::Iterator it = m_spellList.begin(); it != m_spellList.end(); it++) { SpellItem *si = *it; if (si->spellId() == spell_id) return si; } return NULL; }
SpellItem* SpellShell::FindSpell(int spell_id, int caster_id, int target_id) { for(QValueList<SpellItem*>::Iterator it = m_spellList.begin(); it != m_spellList.end(); it++) { SpellItem *i = *it; if ((i->spellId() == spell_id) && (i->casterId() == caster_id)) { struct spellInfoStruct *info; info = spell_info(spell_id); if ( (info->target) && (target_id) ) { if (i->targetId() == target_id) return i; } else return i; } } return NULL; }
SpellItem* SpellShell::findSpell(uint16_t spellId, uint16_t targetId, const QString& targetName) { for(QValueList<SpellItem*>::Iterator it = m_spellList.begin(); it != m_spellList.end(); it++) { SpellItem *i = *it; if (i->spellId() == spellId) { if ((i->targetId() == targetId) || ((i->targetId() == 0) && (i->targetName() == targetName))) return i; } } return NULL; }