Beispiel #1
0
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;
}
Beispiel #2
0
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;
}
Beispiel #3
0
void SpellShell::killSpawn(const Item* deceased)
{
  uint16_t id = deceased->id();
  SpellItem* spell;

  if (m_lastPlayerSpell && (m_lastPlayerSpell->targetId() == id))
    m_lastPlayerSpell = 0;

  QValueList<SpellItem*>::Iterator it = m_spellList.begin();
  while(it != m_spellList.end())
  {
    spell = *it;
    if (spell->targetId() == id)
    {
      it = m_spellList.remove(it);
      emit delSpell(spell);
      delete spell;
    }
    else
      ++it;
  }

  if (m_spellList.count() == 0)
    m_timer->stop();
}
Beispiel #4
0
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;
}
Beispiel #5
0
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;
}
Beispiel #6
0
void SpellShell::killSpawn(const Item* deceased)
{
    uint16_t id = deceased->id();

    if (id == m_player->id())
    {
        // We're dead. No more buffs for us.
        clear();
    }
    else
    {
        SpellItem* spell;

        if (m_lastPlayerSpell && (m_lastPlayerSpell->targetId() == id))
        {
            m_lastPlayerSpell = 0;
        }

        QValueList<SpellItem*>::Iterator it = m_spellList.begin();
        while(it != m_spellList.end())
        {
            spell = *it;
            if (spell->targetId() == id)
            {
                it = m_spellList.remove(it);
                emit delSpell(spell);
                delete spell;
            }
            else
            {
                ++it;
            }
        }

        if (m_spellList.count() == 0)
        {
            m_timer->stop();
        }
    }

}