void SpellItem::UpdateSpell(SpawnShell* spawnShell, uint16_t casterId, const castStruct *c) { if (c) { m_spellId = c->spellId; m_targetId = c->targetId; m_targetName = QString("N/A"); m_casterId = casterId; m_casterName = QString("N/A"); m_spellName = spell_name(c->spellId); //printf("Update:: %s\n", m_spellName.latin1()); struct spellInfoStruct *info = spell_info(m_spellId); m_duration = info->duration; m_target = info->target; const Item *s; if (m_casterId) if ((s = spawnShell->findID(tSpawn, m_casterId))) m_casterName = s->name(); if ( (m_targetId) && (m_target) ) if ((s = spawnShell->findID(tSpawn, m_targetId))) m_targetName = s->name(); struct timezone tz; gettimeofday(&m_castTime,&tz); } }
void SpellShell::selfFinishSpellCast(const memSpellStruct *b) { if (b->param2 != 3) return; printf("selfFinishSpellCast - id=%d, by=%d\n", b->spellId, b->spawnId); SpellItem *item = FindSpell(b->spellId, m_player->getPlayerID(), b->spawnId); if (item) { struct spellInfoStruct *info = spell_info(b->spellId); item->setDuration(info->duration); } }
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; }