mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add support for setting cast_time of aura
This commit is contained in:
parent
94038ebb75
commit
ee618f70ab
@ -9,5 +9,6 @@ CREATE TABLE `auras` (
|
||||
`movement` INT(10) NOT NULL DEFAULT 0,
|
||||
`duration` INT(10) NOT NULL DEFAULT 5400,
|
||||
`icon` INT(10) NOT NULL DEFAULT -1,
|
||||
`cast_time` INT(10) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`type`)
|
||||
)
|
||||
|
||||
@ -12,6 +12,11 @@ Aura::Aura(NPCType *type_data, Mob *owner, AuraRecord &record)
|
||||
GiveNPCTypeData(type_data); // we will delete this later on
|
||||
m_owner = owner->GetID();
|
||||
|
||||
if (record.cast_time) {
|
||||
cast_timer.SetTimer(record.cast_time);
|
||||
cast_timer.Disable(); // we don't want to be enabled yet
|
||||
}
|
||||
|
||||
if (record.aura_type < static_cast<int>(AuraType::Max))
|
||||
type = static_cast<AuraType>(record.aura_type);
|
||||
else
|
||||
@ -58,8 +63,6 @@ void Aura::ProcessOnAllFriendlies(Mob *owner)
|
||||
|
||||
void Aura::ProcessOnAllGroupMembers(Mob *owner)
|
||||
{
|
||||
if (!process_timer.Check())
|
||||
return;
|
||||
auto &mob_list = entity_list.GetMobList(); // read only reference so we can do it all inline
|
||||
std::set<int> delayed_remove;
|
||||
if (owner->IsRaidGrouped() && owner->IsClient()) { // currently raids are just client, but safety check
|
||||
@ -228,15 +231,19 @@ void Aura::ProcessOnAllGroupMembers(Mob *owner)
|
||||
casted_on.erase(e);
|
||||
}
|
||||
|
||||
if (cast_timer.Enabled() || !cast_timer.Check())
|
||||
// so if we have a cast timer and our set isn't empty and timer is disabled we need to enable it
|
||||
if (cast_timer.GetDuration() > 0 && !cast_timer.Enabled() && !casted_on.empty())
|
||||
cast_timer.Start();
|
||||
|
||||
if (!cast_timer.Enabled() || !cast_timer.Check())
|
||||
return;
|
||||
|
||||
// TODO: some auras have to recast (DRU for example, non-buff too)
|
||||
/* for (auto &e : casted_on) {
|
||||
// some auras have to recast (DRU for example, non-buff too)
|
||||
for (auto &e : casted_on) {
|
||||
auto mob = entity_list.GetMob(e);
|
||||
if (mob != nullptr && (!is_buff || !mob->IsAffectedByBuff(spell_id)))
|
||||
|
||||
}*/
|
||||
if (mob != nullptr)
|
||||
SpellFinished(spell_id, mob);
|
||||
}
|
||||
}
|
||||
|
||||
void Aura::ProcessOnGroupMembersPets(Mob *owner)
|
||||
@ -277,6 +284,9 @@ bool Aura::Process()
|
||||
}
|
||||
// TODO: waypoints?
|
||||
|
||||
if (!process_timer.Check())
|
||||
return true;
|
||||
|
||||
if (process_func)
|
||||
process_func(*this, owner);
|
||||
|
||||
@ -356,7 +366,7 @@ void Mob::MakeAura(uint16 spell_id)
|
||||
bool ZoneDatabase::GetAuraEntry(uint16 spell_id, AuraRecord &record)
|
||||
{
|
||||
auto query = StringFormat("SELECT npc_type, name, spell_id, distance, aura_type, spawn_type, movement, "
|
||||
"duration, icon FROM auras WHERE type='%d'",
|
||||
"duration, icon, cast_time FROM auras WHERE type='%d'",
|
||||
spell_id);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
@ -378,6 +388,7 @@ bool ZoneDatabase::GetAuraEntry(uint16 spell_id, AuraRecord &record)
|
||||
record.movement = atoi(row[6]);
|
||||
record.duration = atoi(row[7]) * 1000; // DB is in seconds
|
||||
record.icon = atoi(row[8]);
|
||||
record.cast_time = atoi(row[9]) * 1000; // DB is in seconds
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -133,6 +133,7 @@ struct AuraRecord {
|
||||
int movement;
|
||||
int duration; // seconds some live for 90 mins (normal) others for 2 mins (traps)
|
||||
int icon; // -1 will use the buffs NEW_ICON
|
||||
int cast_time; // seconds some auras recast on a timer, most seem to be every 12 seconds
|
||||
};
|
||||
|
||||
// Actual pet info for a client.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user