本文整理汇总了C++中SpellItem::update方法的典型用法代码示例。如果您正苦于以下问题:C++ SpellItem::update方法的具体用法?C++ SpellItem::update怎么用?C++ SpellItem::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpellItem
的用法示例。
在下文中一共展示了SpellItem::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buffLoad
//slot for loading buffs when main char struct is loaded
void SpellShell::buffLoad(const spellBuff* c)
{
#ifdef DIAG_SPELLSHELL
seqDebug("Loading buff - id=%d.",c->spellid);
#endif // DIAG_SPELLSHELL
const Spell* spell = m_spells->spell(c->spellid);
int duration = c->duration * 6;
SpellItem *item = findSpell(c->spellid, m_player->id(), m_player->name());
if (item)
{ // exists
item->update(c->spellid, spell, duration,
0, "Buff", m_player->id(), m_player->name());
emit changeSpell(item);
}
else
{ // new spell
item = new SpellItem();
item->update(c->spellid, spell, duration,
0, "Buff", m_player->id(), m_player->name());
m_spellList.append(item);
if ((m_spellList.count() > 0) && (!m_timer->isActive()))
m_timer->start(1000 *
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6));
emit addSpell(item);
}
}
示例2: action
void SpellShell::action(const uint8_t* data, size_t, uint8_t)
{
const actionStruct* a = (const actionStruct*)data;
if (a->type != 0xe7) // only things to do if action is a spell
return;
const Item* s;
QString targetName;
if (a->target &&
((s = m_spawnShell->findID(tSpawn, a->target))))
targetName = s->name();
SpellItem *item = findSpell(a->spell, a->target, targetName);
if (item || (a->target == m_player->id()))
{
int duration = 0;
const Spell* spell = m_spells->spell(a->spell);
if (spell)
duration = spell->calcDuration(a->level) * 6;
QString casterName;
if (a->source &&
((s = m_spawnShell->findID(tSpawn, a->source))))
casterName = s->name();
if (item)
{
#ifdef DIAG_SPELLSHELL
seqDebug("action - found - source=%d (lvl: %d) cast id=%d on target=%d causing %d damage",
a->source, a->level, a->spell, a->target, a->damage);
#endif // DIAG_SPELLSHELL
item->update(a->spell, spell, duration,
a->source, casterName, a->target, targetName);
emit changeSpell(item);
}
else
{
// otherwise check for spells cast on us
#ifdef DIAG_SPELLSHELL
seqDebug("action - new - source=%d (lvl: %d) cast id=%d on target=%d causing %d damage",
a->source, a->level, a->spell, a->target, a->damage);
#endif // DIAG_SPELLSHELL
// only way to get here is if there wasn't an existing spell, so...
item = new SpellItem();
item->update(a->spell, spell, duration,
a->source, casterName, a->target, targetName);
m_spellList.append(item);
if ((m_spellList.count() > 0) && (!m_timer->isActive()))
m_timer->start(1000 *
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6));
emit addSpell(item);
}
}
}
示例3: selfStartSpellCast
void SpellShell::selfStartSpellCast(const uint8_t* data)
{
const startCastStruct *c = (const startCastStruct *)data;
#ifdef DIAG_SPELLSHELL
seqDebug("selfStartSpellCast - id=%d (slot=%d, inv=%d) on spawnid=%d",
c->spellId, c->slot, c->inventorySlot, c->targetId);
#endif // DIAG_SPELLSHELL
// get the target
const Item* s;
QString targetName;
int duration = 0;
const Spell* spell = m_spells->spell(c->spellId);
SpellItem *item;
if (spell)
duration = spell->calcDuration(m_player->level()) * 6;
if (!spell || spell->targetType() != 6)
{
if (c->targetId &&
((s = m_spawnShell->findID(tSpawn, c->targetId))))
targetName = s->name();
item = findSpell(c->spellId, c->targetId, targetName);
}
else
{
targetName = m_player->name();
item = findSpell(c->spellId);
}
if (item)
{ // exists
item->update(c->spellId, spell, duration,
m_player->id(), m_player->name(),
c->targetId, targetName);
emit changeSpell(item);
}
else
{ // new spell
item = new SpellItem();
item->update(c->spellId, spell, duration,
m_player->id(), m_player->name(),
c->targetId, targetName);
m_spellList.append(item);
if ((m_spellList.count() > 0) && (!m_timer->isActive()))
m_timer->start(1000 *
pSEQPrefs->getPrefInt("SpellTimer", "SpellList", 6));
emit addSpell(item);
m_lastPlayerSpell = item;
}
}