From 50caef00868f9e09ec12e48fd9e6e25c7a503508 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 7 Jan 2014 23:29:46 -0500 Subject: [PATCH] Implement persist death spell field --- common/shareddb.cpp | 1 + common/spdat.cpp | 8 ++++++++ common/spdat.h | 14 +++++++++++++- zone/attack.cpp | 2 +- zone/client_process.cpp | 2 +- zone/mob.h | 1 + zone/spells.cpp | 11 +++++++++++ 7 files changed, 36 insertions(+), 3 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 7d96ff50a..ee0c2d9e6 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1733,6 +1733,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].powerful_flag=atoi(row[209]); sp[tempid].CastRestriction = atoi(row[211]); sp[tempid].AllowRest = atoi(row[212]) != 0; + sp[tempid].persistdeath = atoi(row[224]) != 0; sp[tempid].DamageShieldType = 0; } mysql_free_result(result); diff --git a/common/spdat.cpp b/common/spdat.cpp index f43b77a9b..d75dd67c4 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -966,6 +966,14 @@ bool IsBuffSpell(uint16 spell_id) return false; } +bool IsPersistDeathSpell(uint16 spell_id) +{ + if (IsValidSpell(spell_id) && spells[spell_id].persistdeath) + return true; + + return false; +} + uint32 GetMorphTrigger(uint32 spell_id) { for (int i = 0; i < EFFECT_COUNT; ++i) diff --git a/common/spdat.h b/common/spdat.h index 19e965ad6..5b762d7d3 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -710,11 +710,22 @@ struct SPDat_Spell_Struct /* 193 */ int NimbusEffect; /* 194 */ float directional_start; /* 195 */ float directional_end; +/* 196 - 199 */ +/* 200 */ //bool suspendable; // buff is suspended in suspended buff zones +/* 201 - 202 */ +/* 203 */ //int songcap; // individual song cap (how live currently does it, not implemented) +/* 204 - 206 */ /* 207 */ int spellgroup; +/* 208 */ /* 209 */ int powerful_flag; // Need more investigation to figure out what to call this, for now we know -1 makes charm spells not break before their duration is complete, it does alot more though +/* 210 */ /* 211 */ int CastRestriction; //Various restriction categories for spells most seem targetable race related but have also seen others for instance only castable if target hp 20% or lower or only if target out of combat /* 212 */ bool AllowRest; -/* 219 */ //int maxtargets; // not in DB yet, is used for beam and ring spells for target # limits +/* 213 - 218 */ +/* 219 */ //int maxtargets; // is used for beam and ring spells for target # limits (not implemented) +/* 220 - 223 */ +/* 224 */ bool persistdeath; // buff doesn't get stripped on death +/* 225 - 236 */ uint8 DamageShieldType; // This field does not exist in spells_us.txt }; @@ -809,6 +820,7 @@ bool IsDebuffSpell(uint16 spell_id); bool IsResistDebuffSpell(uint16 spell_id); bool IsSelfConversionSpell(uint16 spell_id); bool IsBuffSpell(uint16 spell_id); +bool IsPersistDeathSpell(uint16 spell_id); uint32 GetMorphTrigger(uint32 spell_id); uint32 GetPartialMeleeRuneReduction(uint32 spell_id); uint32 GetPartialMagicRuneReduction(uint32 spell_id); diff --git a/zone/attack.cpp b/zone/attack.cpp index 0ce9c45fd..7f17d5fc3 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1601,7 +1601,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } //this generates a lot of 'updates' to the client that the client does not need - BuffFadeAll(); + BuffFadeNonPersistDeath(); if((GetClientVersionBit() & BIT_SoFAndLater) && RuleB(Character, RespawnFromHover)) UnmemSpellAll(true); else diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 0f6b4b5cf..4934ab19e 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1139,7 +1139,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); - this->BuffFadeAll(); + this->BuffFadeNonPersistDeath(); int SpellEffectDescNum = GetSpellEffectDescNum(SpellID); // Rez spells with Rez effects have this DescNum (first is Titanium, second is 6.2 Client) if((SpellEffectDescNum == 82) || (SpellEffectDescNum == 39067)) { diff --git a/zone/mob.h b/zone/mob.h index acb42c10e..d7b61ca11 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -213,6 +213,7 @@ public: void BuffFadeBySpellID(uint16 spell_id); void BuffFadeByEffect(int effectid, int skipslot = -1); void BuffFadeAll(); + void BuffFadeNonPersistDeath(); void BuffFadeDetrimental(); void BuffFadeBySlot(int slot, bool iRecalcBonuses = true); void BuffFadeDetrimentalByCaster(Mob *caster); diff --git a/zone/spells.cpp b/zone/spells.cpp index 8f33af4d9..9a99a70ad 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3752,6 +3752,17 @@ void Mob::BuffFadeAll() CalcBonuses(); } +void Mob::BuffFadeNonPersistDeath() +{ + uint32 buff_count = GetMaxTotalSlots(); + for (int j = 0; j < buff_count; j++) { + if (buffs[j].spellid != SPELL_UNKNOWN && !IsPersistDeathSpell(buffs[j].spellid)) + BuffFadeBySlot(j, false); + } + //we tell BuffFadeBySlot not to recalc, so we can do it only once when were done + CalcBonuses(); +} + void Mob::BuffFadeDetrimental() { uint32 buff_count = GetMaxTotalSlots(); for (int j = 0; j < buff_count; j++) {