std::string CCreatureSet::getRoughAmount (SlotID slot) const { int quantity = CCreature::getQuantityID(getStackCount(slot)); if (quantity) return VLC->generaltexth->arraytxt[174 + 3*CCreature::getQuantityID(getStackCount(slot))]; return ""; }
void CCreatureSet::addToSlot(SlotID slot, CreatureID cre, TQuantity count, bool allowMerging/* = true*/) { const CCreature *c = VLC->creh->creatures[cre]; if(!hasStackAtSlot(slot)) { setCreature(slot, cre, count); } else if(getCreature(slot) == c && allowMerging) //that slot was empty or contained same type creature { setStackCount(slot, getStackCount(slot) + count); } else { tlog1 << "Failed adding to slot!\n"; } }
void UpdateAI(uint32 diff) { events.Update(diff); uint32 eventId = events.GetEvent(); if (eventId == EVENT_SPELL_INHIBIT_MAGIC) { Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* player = i->GetSource()) { float dist = me->GetDistance(player); if (player->IsAlive() && dist < 45.0f) { Aura* aura = player->GetAura(SPELL_INHIBIT_MAGIC); if (!aura) aura = me->AddAura(SPELL_INHIBIT_MAGIC, player); else aura->RefreshDuration(); if (aura) aura->SetStackAmount(getStackCount(dist)); } else player->RemoveAurasDueToSpell(SPELL_INHIBIT_MAGIC); } events.RepeatEvent(3000); return; } if (!UpdateVictim()) return; switch (eventId) { case EVENT_SPELL_ATTRACT_MAGIC: me->CastSpell(me, SPELL_ATTRACT_MAGIC, false); events.RepeatEvent(30000); events.RescheduleEvent(EVENT_SPELL_CARNIVOROUS, 1500); break; case EVENT_SPELL_CARNIVOROUS: me->CastSpell(me, DUNGEON_MODE(SPELL_CARNIVOROUS_BITE_N, SPELL_CARNIVOROUS_BITE_H), false); events.RepeatEvent(10000); break; case EVENT_SPELL_FOCUS_FIRE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) { if (Creature* cr = me->SummonCreature(ENTRY_FOCUS_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 7000)) focusGUID = cr->GetGUID(); Talk(EMOTE_FOCUSED, target); } events.RepeatEvent(urand(15000, 20000)); events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3000); events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3500); events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 4000); events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_3, 5000); me->SetControlled(true, UNIT_STATE_ROOT); break; case EVENT_SPELL_FOCUS_FIRE_2: if (Unit* flare = ObjectAccessor::GetCreature(*me, focusGUID)) me->CastSpell(flare, SPELL_FOCUS_CAST, true); events.PopEvent(); break; case EVENT_SPELL_FOCUS_FIRE_3: me->SetControlled(false, UNIT_STATE_ROOT); events.PopEvent(); break; } DoMeleeAttackIfReady(); }
void CCreatureSet::changeStackCount(SlotID slot, TQuantity toAdd) { setStackCount(slot, getStackCount(slot) + toAdd); }