mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Bug Fix] Replace uses of SPELL_UNKNOWN with IsValidSpell() (#2938)
This commit is contained in:
parent
4a64048744
commit
5ee2856133
@ -823,7 +823,7 @@ void Client::InspectBuffs(Client* Inspector, int Rank)
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
uint32 packet_index = 0;
|
||||
for (uint32 i = 0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(buffs[i].spellid))
|
||||
continue;
|
||||
ib->spell_id[packet_index] = buffs[i].spellid;
|
||||
if (Rank > 1)
|
||||
|
||||
@ -1694,8 +1694,9 @@ void Client::Damage(Mob* other, int64 damage, uint16 spell_id, EQ::skills::Skill
|
||||
if (dead || IsCorpse())
|
||||
return;
|
||||
|
||||
if (spell_id == 0)
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
spell_id = SPELL_UNKNOWN;
|
||||
}
|
||||
|
||||
// cut all PVP spell damage to 2/3
|
||||
// Blasting ourselfs is considered PvP
|
||||
@ -1719,8 +1720,9 @@ void Client::Damage(Mob* other, int64 damage, uint16 spell_id, EQ::skills::Skill
|
||||
|
||||
if (damage > 0) {
|
||||
|
||||
if (spell_id == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
CheckIncreaseSkill(EQ::skills::SkillDefense, other, -15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1755,7 +1757,7 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
|
||||
}
|
||||
}
|
||||
|
||||
if (killerMob && (killerMob->IsClient() || killerMob->IsBot()) && (spell != SPELL_UNKNOWN) && damage > 0) {
|
||||
if (killerMob && killerMob->IsOfClientBot() && IsValidSpell(spell) && damage > 0) {
|
||||
char val1[20] = { 0 };
|
||||
|
||||
entity_list.MessageCloseString(
|
||||
@ -1794,8 +1796,8 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
|
||||
d->killer_id = killerMob ? killerMob->GetID() : 0;
|
||||
d->corpseid = GetID();
|
||||
d->bindzoneid = m_pp.binds[0].zone_id;
|
||||
d->spell_id = spell == SPELL_UNKNOWN ? 0xffffffff : spell;
|
||||
d->attack_skill = spell != SPELL_UNKNOWN ? 0xe7 : attack_skill;
|
||||
d->spell_id = IsValidSpell(spell) ? spell : 0xffffffff;
|
||||
d->attack_skill = IsValidSpell(spell) ? 0xe7 : attack_skill;
|
||||
d->damage = damage;
|
||||
app.priority = 6;
|
||||
entity_list.QueueClients(this, &app);
|
||||
@ -1923,7 +1925,7 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
|
||||
}
|
||||
}
|
||||
|
||||
if (spell != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(spell)) {
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (uint16 buffIt = 0; buffIt < buff_count; buffIt++) {
|
||||
if (buffs[buffIt].spellid == spell && buffs[buffIt].client) {
|
||||
@ -2416,7 +2418,7 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
||||
}
|
||||
}
|
||||
|
||||
if (killer_mob && (killer_mob->IsClient() || killer_mob->IsBot()) && (spell != SPELL_UNKNOWN) && damage > 0) {
|
||||
if (killer_mob && killer_mob->IsOfClientBot() && IsValidSpell(spell) && damage > 0) {
|
||||
char val1[20] = { 0 };
|
||||
|
||||
entity_list.MessageCloseString(
|
||||
@ -2946,7 +2948,7 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
|
||||
if (GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && other->IsClient())
|
||||
return;
|
||||
|
||||
if (spell_id != SPELL_UNKNOWN && NoDetrimentalSpellAggro(spell_id))
|
||||
if (IsValidSpell(spell_id) && NoDetrimentalSpellAggro(spell_id))
|
||||
return;
|
||||
|
||||
if (other == myowner)
|
||||
@ -3110,8 +3112,9 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
|
||||
DS = spellbonuses.DamageShield;
|
||||
rev_ds = attacker->spellbonuses.ReverseDamageShield;
|
||||
|
||||
if (spellbonuses.DamageShieldSpellID != 0 && spellbonuses.DamageShieldSpellID != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(spellbonuses.DamageShieldSpellID)) {
|
||||
spellid = spellbonuses.DamageShieldSpellID;
|
||||
}
|
||||
}
|
||||
else {
|
||||
DS = spellbonuses.SpellDamageShield + itembonuses.SpellDamageShield + aabonuses.SpellDamageShield;
|
||||
@ -3180,8 +3183,9 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
|
||||
//if we've gotten to this point, we know we know "attacker" hit "this" (us) for damage & we aren't invulnerable
|
||||
uint16 rev_ds_spell_id = SPELL_UNKNOWN;
|
||||
|
||||
if (spellbonuses.ReverseDamageShieldSpellID != 0 && spellbonuses.ReverseDamageShieldSpellID != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(spellbonuses.ReverseDamageShieldSpellID)) {
|
||||
rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID;
|
||||
}
|
||||
|
||||
if (rev_ds < 0) {
|
||||
LogCombat("Applying Reverse Damage Shield of value [{}] to [{}]", rev_ds, attacker->GetName());
|
||||
@ -3614,7 +3618,7 @@ int64 Mob::ReduceAllDamage(int64 damage)
|
||||
bool Mob::HasProcs() const
|
||||
{
|
||||
for (int i = 0; i < MAX_PROCS; i++) {
|
||||
if (PermaProcs[i].spellID != SPELL_UNKNOWN || SpellProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(PermaProcs[i].spellID) || IsValidSpell(SpellProcs[i].spellID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3632,7 +3636,7 @@ bool Mob::HasProcs() const
|
||||
bool Mob::HasDefensiveProcs() const
|
||||
{
|
||||
for (int i = 0; i < MAX_PROCS; i++) {
|
||||
if (DefensiveProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(DefensiveProcs[i].spellID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3668,7 +3672,7 @@ bool Mob::HasSkillProcSuccess() const
|
||||
bool Mob::HasRangedProcs() const
|
||||
{
|
||||
for (int i = 0; i < MAX_PROCS; i++){
|
||||
if (RangedProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(RangedProcs[i].spellID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3760,16 +3764,16 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
damage = DMG_INVULNERABLE;
|
||||
}
|
||||
|
||||
if (spell_id != SPELL_UNKNOWN || attacker == nullptr)
|
||||
if (IsValidSpell(spell_id) || attacker == nullptr)
|
||||
avoidable = false;
|
||||
|
||||
// only apply DS if physical damage (no spell damage)
|
||||
// damage shield calls this function with spell_id set, so its unavoidable
|
||||
if (attacker && damage > 0 && spell_id == SPELL_UNKNOWN && skill_used != EQ::skills::SkillArchery && skill_used != EQ::skills::SkillThrowing) {
|
||||
if (attacker && damage > 0 && !IsValidSpell(spell_id) && skill_used != EQ::skills::SkillArchery && skill_used != EQ::skills::SkillThrowing) {
|
||||
DamageShield(attacker);
|
||||
}
|
||||
|
||||
if (spell_id == SPELL_UNKNOWN && skill_used >= EQ::skills::Skill1HBlunt) {
|
||||
if (!IsValidSpell(spell_id) && skill_used >= EQ::skills::Skill1HBlunt) {
|
||||
CheckNumHitsRemaining(NumHit::IncomingHitAttempts);
|
||||
|
||||
if (attacker)
|
||||
@ -3796,7 +3800,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
//if there is some damage being done and theres an attacker involved
|
||||
if (attacker) {
|
||||
// if spell is lifetap add hp to the caster
|
||||
if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) {
|
||||
if (IsValidSpell(spell_id) && IsLifetapSpell(spell_id)) {
|
||||
int64 healed = damage;
|
||||
|
||||
healed = RuleB(Spells, CompoundLifetapHeals) ? attacker->GetActSpellHealing(spell_id, healed) : healed;
|
||||
@ -3867,7 +3871,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
}
|
||||
|
||||
//see if any runes want to reduce this damage
|
||||
if (spell_id == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
damage = ReduceDamage(damage);
|
||||
LogCombat("Melee Damage reduced to [{}]", damage);
|
||||
damage = ReduceAllDamage(damage);
|
||||
@ -4147,12 +4151,12 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
}
|
||||
}
|
||||
|
||||
if (spell_id != SPELL_UNKNOWN && !iBuffTic) {
|
||||
if (IsValidSpell(spell_id) && !iBuffTic) {
|
||||
//see if root will break
|
||||
if (IsRooted() && !FromDamageShield) // neotoyko: only spells cancel root
|
||||
TryRootFadeByDamage(buffslot, attacker);
|
||||
}
|
||||
else if (spell_id == SPELL_UNKNOWN)
|
||||
else if (!IsValidSpell(spell_id))
|
||||
{
|
||||
//increment chances of interrupting
|
||||
if (IsCasting()) { //shouldnt interrupt on regular spell damage
|
||||
@ -4213,17 +4217,18 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
//attacker is a pet, let pet owners see their pet's damage
|
||||
Mob* owner = attacker->GetOwner();
|
||||
if (owner && owner->IsClient()) {
|
||||
if (((spell_id != SPELL_UNKNOWN) || (FromDamageShield)) && damage>0) {
|
||||
if ((IsValidSpell(spell_id) || (FromDamageShield)) && damage > 0) {
|
||||
//special crap for spell damage, looks hackish to me
|
||||
char val1[20] = { 0 };
|
||||
owner->MessageString(Chat::NonMelee, OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1));
|
||||
}
|
||||
else {
|
||||
if (damage > 0) {
|
||||
if (spell_id != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(spell_id)) {
|
||||
filter = iBuffTic ? FilterDOT : FilterSpellDamage;
|
||||
else
|
||||
} else {
|
||||
filter = FilterPetHits;
|
||||
}
|
||||
}
|
||||
else if (damage == -5)
|
||||
filter = FilterNone; //cant filter invulnerable
|
||||
@ -4240,7 +4245,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
//attacker is not a pet, send to the attacker
|
||||
//if the attacker is a client, try them with the correct filter
|
||||
if (attacker && (attacker->IsClient() || attacker->IsBot())) {
|
||||
if ((spell_id != SPELL_UNKNOWN || FromDamageShield) && damage > 0) {
|
||||
if ((IsValidSpell(spell_id) || FromDamageShield) && damage > 0) {
|
||||
//special crap for spell damage, looks hackish to me
|
||||
char val1[20] = { 0 };
|
||||
if (FromDamageShield) {
|
||||
@ -4265,10 +4270,12 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
// Only try to queue these packets to a client
|
||||
else if (attacker && (attacker->IsClient())) {
|
||||
if (damage > 0) {
|
||||
if (spell_id != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(spell_id)) {
|
||||
filter = iBuffTic ? FilterDOT : FilterSpellDamage;
|
||||
else
|
||||
filter = FilterNone; //cant filter our own hits
|
||||
}
|
||||
else {
|
||||
filter = FilterNone; //cant filter our own hits
|
||||
}
|
||||
}
|
||||
else if (damage == -5)
|
||||
filter = FilterNone; //cant filter invulnerable
|
||||
@ -4283,10 +4290,12 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
|
||||
//send damage to all clients around except the specified skip mob (attacker or the attacker's owner) and ourself
|
||||
if (damage > 0) {
|
||||
if (spell_id != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(spell_id)) {
|
||||
filter = iBuffTic ? FilterDOT : FilterSpellDamage;
|
||||
else
|
||||
}
|
||||
else {
|
||||
filter = FilterOthersHit;
|
||||
}
|
||||
}
|
||||
else if (damage == -5)
|
||||
filter = FilterNone; //cant filter invulnerable
|
||||
@ -4347,7 +4356,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
else {
|
||||
//else, it is a buff tic...
|
||||
// So we can see our dot dmg like live shows it.
|
||||
if (spell_id != SPELL_UNKNOWN && damage > 0 && attacker && attacker != this && !attacker->IsCorpse()) {
|
||||
if (IsValidSpell(spell_id) && damage > 0 && attacker && attacker != this && !attacker->IsCorpse()) {
|
||||
//might filter on (attack_skill>200 && attack_skill<250), but I dont think we need it
|
||||
if (attacker->IsClient()) {
|
||||
attacker->FilteredMessageString(attacker, Chat::DotDamage,
|
||||
@ -4740,7 +4749,7 @@ void Mob::TrySpellProc(const EQ::ItemInstance *inst, const EQ::ItemData *weapon,
|
||||
// Not ranged
|
||||
if (!rangedattk) {
|
||||
// Perma procs (Not used for AA, they are handled below)
|
||||
if (PermaProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(PermaProcs[i].spellID)) {
|
||||
if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus?
|
||||
LogCombat("Permanent proc [{}] procing spell [{}] ([{}] percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
|
||||
ExecWeaponProc(nullptr, PermaProcs[i].spellID, on);
|
||||
@ -4751,7 +4760,7 @@ void Mob::TrySpellProc(const EQ::ItemInstance *inst, const EQ::ItemData *weapon,
|
||||
}
|
||||
|
||||
// Spell procs (buffs)
|
||||
if (SpellProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(SpellProcs[i].spellID)) {
|
||||
if (SpellProcs[i].base_spellID == POISON_PROC) {
|
||||
poison_slot=i;
|
||||
continue; // Process the poison proc last per @mackal
|
||||
@ -4776,7 +4785,7 @@ void Mob::TrySpellProc(const EQ::ItemInstance *inst, const EQ::ItemData *weapon,
|
||||
}
|
||||
else if (rangedattk) { // ranged only
|
||||
// ranged spell procs (buffs)
|
||||
if (RangedProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(RangedProcs[i].spellID)) {
|
||||
|
||||
passed_skill_limit_check = PassLimitToSkill(skillinuse, RangedProcs[i].base_spellID, ProcType::RANGED_PROC);
|
||||
|
||||
|
||||
@ -1858,12 +1858,13 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon)
|
||||
newbon->AssistRange = -1;
|
||||
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(i = 0; i < buff_count; i++) {
|
||||
if(buffs[i].spellid != SPELL_UNKNOWN){
|
||||
for (i = 0; i < buff_count; i++) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon, buffs[i].casterid, 0, buffs[i].ticsremaining, i, buffs[i].instrument_mod);
|
||||
|
||||
if (buffs[i].hit_number > 0)
|
||||
if (buffs[i].hit_number > 0) {
|
||||
Numhits(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1874,7 +1875,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon)
|
||||
//Disables a specific spell effect bonus completely, can also be limited to negate only item, AA or spell bonuses.
|
||||
if (spellbonuses.NegateEffects){
|
||||
for(i = 0; i < buff_count; i++) {
|
||||
if( (buffs[i].spellid != SPELL_UNKNOWN) && (IsEffectInSpell(buffs[i].spellid, SE_NegateSpellEffect)) )
|
||||
if(IsValidSpell(buffs[i].spellid) && (IsEffectInSpell(buffs[i].spellid, SE_NegateSpellEffect)) )
|
||||
NegateSpellEffectBonuses(buffs[i].spellid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5352,7 +5352,7 @@ void Bot::Damage(Mob *from, int64 damage, uint16 spell_id, EQ::skills::SkillType
|
||||
|
||||
attacked_timer.Start(CombatEventTimer_expire);
|
||||
// if spell is lifetap add hp to the caster
|
||||
if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) {
|
||||
if (IsValidSpell(spell_id) && IsLifetapSpell(spell_id)) {
|
||||
int64 healed = GetActSpellHealing(spell_id, damage);
|
||||
LogCombatDetail("Applying lifetap heal of [{}] to [{}]", healed, GetCleanName());
|
||||
HealDamage(healed);
|
||||
@ -7043,7 +7043,7 @@ void Bot::CalcRestState() {
|
||||
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (unsigned int j = 0; j < buff_count; j++) {
|
||||
if(buffs[j].spellid != SPELL_UNKNOWN) {
|
||||
if(IsValidSpell(buffs[j].spellid)) {
|
||||
if(IsDetrimentalSpell(buffs[j].spellid) && (buffs[j].ticsremaining > 0))
|
||||
if(!DetrimentalSpellAllowsRest(buffs[j].spellid))
|
||||
return;
|
||||
@ -7294,7 +7294,7 @@ void Bot::DoEnduranceUpkeep() {
|
||||
uint32 buffs_i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[buffs_i].spellid)) {
|
||||
int upkeep = spells[buffs[buffs_i].spellid].endurance_upkeep;
|
||||
if(upkeep > 0) {
|
||||
if(cost_redux > 0) {
|
||||
@ -8716,7 +8716,7 @@ bool Bot::GetNeedsCured(Mob *tar) {
|
||||
int buffsWithCounters = 0;
|
||||
needCured = true;
|
||||
for (unsigned int j = 0; j < buff_count; j++) {
|
||||
if(tar->GetBuffs()[j].spellid != SPELL_UNKNOWN) {
|
||||
if(IsValidSpell(tar->GetBuffs()[j].spellid)) {
|
||||
if(CalculateCounters(tar->GetBuffs()[j].spellid) > 0) {
|
||||
buffsWithCounters++;
|
||||
if(buffsWithCounters == 1 && (tar->GetBuffs()[j].ticsremaining < 2 || (int32)((tar->GetBuffs()[j].ticsremaining * 6) / tar->GetBuffs()[j].counters) < 2)) {
|
||||
|
||||
@ -1514,8 +1514,9 @@ bool BotDatabase::SavePetBuffs(const uint32 bot_id, const SpellBuff_Struct* pet_
|
||||
return true;
|
||||
|
||||
for (int buff_index = 0; buff_index < PET_BUFF_COUNT; ++buff_index) {
|
||||
if (!pet_buffs[buff_index].spellid || pet_buffs[buff_index].spellid == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(pet_buffs[buff_index].spellid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
query = StringFormat(
|
||||
"INSERT INTO `bot_pet_buffs` ("
|
||||
|
||||
@ -6687,7 +6687,7 @@ void Client::SendStatsWindow(Client* client, bool use_window)
|
||||
uint32 magic_rune_number = 0;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (int i=0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
if (buffs[i].melee_rune > 0) { rune_number += buffs[i].melee_rune; }
|
||||
|
||||
if (buffs[i].magic_rune > 0) { magic_rune_number += buffs[i].magic_rune; }
|
||||
@ -8494,7 +8494,7 @@ void Client::ShowNumHits()
|
||||
uint32 buffcount = GetMaxTotalSlots();
|
||||
for (uint32 buffslot = 0; buffslot < buffcount; buffslot++) {
|
||||
const Buffs_Struct &curbuff = buffs[buffslot];
|
||||
if (curbuff.spellid != SPELL_UNKNOWN && curbuff.hit_number)
|
||||
if (IsValidSpell(curbuff.spellid) && curbuff.hit_number)
|
||||
Message(0, "You have %d hits left on %s", curbuff.hit_number, GetSpellName(curbuff.spellid));
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1456,7 +1456,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
database.LoadBuffs(this);
|
||||
uint32 max_slots = GetMaxBuffSlots();
|
||||
for (int i = 0; i < BUFF_COUNT; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
m_pp.buffs[i].spellid = buffs[i].spellid;
|
||||
m_pp.buffs[i].bard_modifier = buffs[i].instrument_mod;
|
||||
m_pp.buffs[i].effect_type = 2;
|
||||
|
||||
@ -1917,7 +1917,7 @@ void Client::DoEnduranceUpkeep() {
|
||||
uint32 buffs_i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[buffs_i].spellid)) {
|
||||
int upkeep = spells[buffs[buffs_i].spellid].endurance_upkeep;
|
||||
if(upkeep > 0) {
|
||||
has_effect = true;
|
||||
@ -1966,7 +1966,7 @@ void Client::CalcRestState()
|
||||
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (unsigned int j = 0; j < buff_count; j++) {
|
||||
if(buffs[j].spellid != SPELL_UNKNOWN) {
|
||||
if(IsValidSpell(buffs[j].spellid)) {
|
||||
if(IsDetrimentalSpell(buffs[j].spellid) && (buffs[j].ticsremaining > 0))
|
||||
if(!DetrimentalSpellAllowsRest(buffs[j].spellid))
|
||||
return;
|
||||
|
||||
@ -1113,7 +1113,7 @@ void Merc::DoEnduranceUpkeep() {
|
||||
uint32 buffs_i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[buffs_i].spellid)) {
|
||||
int upkeep = spells[buffs[buffs_i].spellid].endurance_upkeep;
|
||||
if(upkeep > 0) {
|
||||
has_effect = true;
|
||||
@ -1158,7 +1158,7 @@ void Merc::CalcRestState() {
|
||||
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (unsigned int j = 0; j < buff_count; j++) {
|
||||
if(buffs[j].spellid != SPELL_UNKNOWN) {
|
||||
if(IsValidSpell(buffs[j].spellid)) {
|
||||
if(IsDetrimentalSpell(buffs[j].spellid) && (buffs[j].ticsremaining > 0))
|
||||
if(!DetrimentalSpellAllowsRest(buffs[j].spellid))
|
||||
return;
|
||||
@ -2579,7 +2579,7 @@ int64 Merc::GetFocusEffect(focusType type, uint16 spell_id, bool from_buff_tic)
|
||||
if (equipment[x] == 0)
|
||||
continue;
|
||||
TempItem = database.GetItem(equipment[x]);
|
||||
if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) {
|
||||
if (TempItem && IsValidSpell(TempItem->Focus.Effect)) {
|
||||
if(rand_effectiveness) {
|
||||
focus_max = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id, true);
|
||||
if (focus_max > 0 && focus_max_real >= 0 && focus_max > focus_max_real) {
|
||||
@ -3895,7 +3895,7 @@ bool Merc::GetNeedsCured(Mob *tar) {
|
||||
needCured = true;
|
||||
|
||||
for (unsigned int j = 0; j < buff_count; j++) {
|
||||
if(tar->GetBuffs()[j].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(tar->GetBuffs()[j].spellid)) {
|
||||
if(CalculateCounters(tar->GetBuffs()[j].spellid) > 0) {
|
||||
buffsWithCounters++;
|
||||
|
||||
|
||||
40
zone/mob.cpp
40
zone/mob.cpp
@ -2331,7 +2331,7 @@ void Mob::ShowBuffs(Client* client) {
|
||||
uint32 i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (i=0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
if (spells[buffs[i].spellid].buff_duration_formula == DF_Permanent)
|
||||
client->Message(Chat::White, " %i: %s: Permanent", i, spells[buffs[i].spellid].name);
|
||||
else
|
||||
@ -2365,7 +2365,7 @@ void Mob::ShowBuffList(Client* client) {
|
||||
uint32 i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (i = 0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
if (spells[buffs[i].spellid].buff_duration_formula == DF_Permanent)
|
||||
client->Message(Chat::White, " %i: %s: Permanent", i, spells[buffs[i].spellid].name);
|
||||
else
|
||||
@ -4103,7 +4103,7 @@ void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on,
|
||||
return;
|
||||
}
|
||||
|
||||
if(spell_id == SPELL_UNKNOWN || on->GetSpecialAbility(NO_HARM_FROM_CLIENT)) {
|
||||
if(!IsValidSpell(spell_id) || on->GetSpecialAbility(NO_HARM_FROM_CLIENT)) {
|
||||
//This is so 65535 doesn't get passed to the client message and to logs because it is not relavant information for debugging.
|
||||
return;
|
||||
}
|
||||
@ -4364,8 +4364,9 @@ int Mob::CountDispellableBuffs()
|
||||
if(spells[buffs[x].spellid].good_effect == 0)
|
||||
continue;
|
||||
|
||||
if(buffs[x].spellid != SPELL_UNKNOWN && spells[buffs[x].spellid].buff_duration_formula != DF_Permanent)
|
||||
if(IsValidSpell(buffs[x].spellid) && spells[buffs[x].spellid].buff_duration_formula != DF_Permanent) {
|
||||
val++;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@ -4926,9 +4927,9 @@ bool Mob::TryFadeEffect(int slot)
|
||||
if(spell_id)
|
||||
{
|
||||
|
||||
if(spell_id == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
return false;
|
||||
|
||||
}
|
||||
if(IsValidSpell(spell_id))
|
||||
{
|
||||
if (IsBeneficialSpell(spell_id)) {
|
||||
@ -5285,7 +5286,7 @@ void Mob::DoKnockback(Mob *caster, uint32 push_back, uint32 push_up)
|
||||
|
||||
void Mob::TrySpellOnKill(uint8 level, uint16 spell_id)
|
||||
{
|
||||
if (spell_id != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(spell_id))
|
||||
{
|
||||
if(IsEffectInSpell(spell_id, SE_ProcOnSpellKillShot)) {
|
||||
for (int i = 0; i < EFFECT_COUNT; i++) {
|
||||
@ -5599,7 +5600,7 @@ void Mob::DoGravityEffect()
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for (int slot = 0; slot < buff_count; slot++)
|
||||
{
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN && IsEffectInSpell(buffs[slot].spellid, SE_GravityEffect))
|
||||
if (IsValidSpell(buffs[slot].spellid) && IsEffectInSpell(buffs[slot].spellid, SE_GravityEffect))
|
||||
{
|
||||
for (int i = 0; i < EFFECT_COUNT; i++)
|
||||
{
|
||||
@ -6170,19 +6171,20 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
|
||||
bool Mob::HasSpellEffect(int effect_id)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(i = 0; i < buff_count; i++)
|
||||
{
|
||||
if(buffs[i].spellid == SPELL_UNKNOWN) { continue; }
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(i = 0; i < buff_count; i++)
|
||||
{
|
||||
if (!IsValidSpell(buffs[i].spellid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(IsEffectInSpell(buffs[i].spellid, effect_id))
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
if (IsEffectInSpell(buffs[i].spellid, effect_id)) {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int Mob::GetSpecialAbility(int ability)
|
||||
|
||||
@ -574,7 +574,7 @@ void NPC::GetPetState(SpellBuff_Struct *pet_buffs, uint32 *items, char *name) {
|
||||
|
||||
//save their buffs.
|
||||
for (int i=EQ::invslot::EQUIPMENT_BEGIN; i < GetPetMaxTotalSlots(); i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
pet_buffs[i].spellid = buffs[i].spellid;
|
||||
pet_buffs[i].effect_type = i+1;
|
||||
pet_buffs[i].duration = buffs[i].ticsremaining;
|
||||
@ -600,7 +600,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
|
||||
for (i = 0; i < GetPetMaxTotalSlots(); i++) {
|
||||
for(int z = 0; z < GetPetMaxTotalSlots(); z++) {
|
||||
// check for duplicates
|
||||
if(buffs[z].spellid != SPELL_UNKNOWN && buffs[z].spellid == pet_buffs[i].spellid) {
|
||||
if(IsValidSpell(buffs[z].spellid) && buffs[z].spellid == pet_buffs[i].spellid) {
|
||||
buffs[z].spellid = SPELL_UNKNOWN;
|
||||
pet_buffs[i].spellid = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
@ -1079,7 +1079,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
}
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(int slot = 0; slot < buff_count; slot++) {
|
||||
if( buffs[slot].spellid != SPELL_UNKNOWN &&
|
||||
if(IsValidSpell(buffs[slot].spellid) &&
|
||||
spells[buffs[slot].spellid].dispel_flag == 0 &&
|
||||
!IsDiscipline(buffs[slot].spellid))
|
||||
{
|
||||
@ -1110,7 +1110,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
int chance = spells[spell_id].base_value[i];
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(int slot = 0; slot < buff_count; slot++) {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN &&
|
||||
if (IsValidSpell(buffs[slot].spellid) &&
|
||||
IsDetrimentalSpell(buffs[slot].spellid) &&
|
||||
spells[buffs[slot].spellid].dispel_flag == 0)
|
||||
{
|
||||
@ -1137,7 +1137,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
int chance = spells[spell_id].base_value[i];
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(int slot = 0; slot < buff_count; slot++) {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN &&
|
||||
if (IsValidSpell(buffs[slot].spellid) &&
|
||||
IsBeneficialSpell(buffs[slot].spellid) &&
|
||||
spells[buffs[slot].spellid].dispel_flag == 0)
|
||||
{
|
||||
@ -1336,7 +1336,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
if (BeneficialSpell(spell_id) && spells[spell_id].buff_duration == 0) {
|
||||
int buff_count = GetMaxBuffSlots();
|
||||
for (int slot = 0; slot < buff_count; slot++) {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN && IsEffectInSpell(buffs[slot].spellid, SE_Blind)) {
|
||||
if (IsValidSpell(buffs[slot].spellid) && IsEffectInSpell(buffs[slot].spellid, SE_Blind)) {
|
||||
if (caster && TryDispel(caster->GetCasterLevel(spell_id), buffs[slot].casterlevel, 1)) {
|
||||
BuffFadeBySlot(slot);
|
||||
slot = buff_count;
|
||||
@ -3755,12 +3755,13 @@ void Mob::BuffProcess()
|
||||
|
||||
for (int buffs_i = 0; buffs_i < buff_count; ++buffs_i)
|
||||
{
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(buffs[buffs_i].spellid))
|
||||
{
|
||||
DoBuffTic(buffs[buffs_i], buffs_i, entity_list.GetMob(buffs[buffs_i].casterid));
|
||||
// If the Mob died during DoBuffTic, then the buff we are currently processing will have been removed
|
||||
if(buffs[buffs_i].spellid == SPELL_UNKNOWN)
|
||||
if(!IsValidSpell(buffs[buffs_i].spellid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// DF_Permanent uses -1 DF_Aura uses -4 but we need to check negatives for some spells for some reason?
|
||||
if (spells[buffs[buffs_i].spellid].buff_duration_formula != DF_Permanent &&
|
||||
@ -6429,7 +6430,7 @@ int64 Mob::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool fro
|
||||
}
|
||||
|
||||
TempItem = ins->GetItem();
|
||||
if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) {
|
||||
if (TempItem && IsValidSpell(TempItem->Focus.Effect)) {
|
||||
if(rand_effectiveness) {
|
||||
focus_max = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id, true);
|
||||
if (focus_max > 0 && focus_max_real >= 0 && focus_max > focus_max_real) {
|
||||
@ -6461,7 +6462,7 @@ int64 Mob::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool fro
|
||||
aug = ins->GetAugment(y);
|
||||
if (aug) {
|
||||
const EQ::ItemData* TempItemAug = aug->GetItem();
|
||||
if (TempItemAug && TempItemAug->Focus.Effect > 0 && TempItemAug->Focus.Effect != SPELL_UNKNOWN) {
|
||||
if (TempItemAug && IsValidSpell(TempItemAug->Focus.Effect)) {
|
||||
if(rand_effectiveness) {
|
||||
focus_max = CalcFocusEffect(type, TempItemAug->Focus.Effect, spell_id, true);
|
||||
if (focus_max > 0 && focus_max_real >= 0 && focus_max > focus_max_real) {
|
||||
@ -6501,7 +6502,7 @@ int64 Mob::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool fro
|
||||
}
|
||||
|
||||
TempItem = ins->GetItem();
|
||||
if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) {
|
||||
if (TempItem && IsValidSpell(TempItem->Focus.Effect)) {
|
||||
if (rand_effectiveness) {
|
||||
focus_max = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id, true);
|
||||
if (focus_max > 0 && focus_max_real >= 0 && focus_max > focus_max_real) {
|
||||
@ -6711,7 +6712,7 @@ int64 NPC::GetFocusEffect(focusType type, uint16 spell_id, Mob* caster, bool fro
|
||||
|
||||
TempItem = cur;
|
||||
|
||||
if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) {
|
||||
if (TempItem && IsValidSpell(TempItem->Focus.Effect)) {
|
||||
if(rand_effectiveness) {
|
||||
focus_max = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id, true);
|
||||
if (focus_max > 0 && focus_max_real >= 0 && focus_max > focus_max_real) {
|
||||
@ -9754,7 +9755,7 @@ bool Mob::PassLimitToSkill(EQ::skills::SkillType skill, int32 spell_id, int proc
|
||||
|
||||
if (!aa_id && spellbonuses.LimitToSkill[EQ::skills::HIGHEST_SKILL + 2]) {
|
||||
|
||||
if (spell_id == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -10361,13 +10362,13 @@ void Mob::SetBuffDuration(int spell_id, int duration) {
|
||||
for (int slot = 0; slot < buff_count; slot++) {
|
||||
|
||||
if (!adjust_all_buffs) {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN && buffs[slot].spellid == spell_id) {
|
||||
if (IsValidSpell(buffs[slot].spellid) && buffs[slot].spellid == spell_id) {
|
||||
SpellOnTarget(buffs[slot].spellid, this, 0, false, 0, false, -1, duration, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[slot].spellid)) {
|
||||
SpellOnTarget(buffs[slot].spellid, this, 0, false, 0, false, -1, duration, true);
|
||||
}
|
||||
}
|
||||
@ -10409,7 +10410,7 @@ int Mob::GetBuffStatValueBySpell(int32 spell_id, const char* stat_identifier)
|
||||
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for (int slot = 0; slot < buff_count; slot++) {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN && buffs[slot].spellid == spell_id) {
|
||||
if (IsValidSpell(buffs[slot].spellid) && buffs[slot].spellid == spell_id) {
|
||||
return GetBuffStatValueBySlot(slot, stat_identifier);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1144,8 +1144,9 @@ void Mob::ZeroBardPulseVars()
|
||||
|
||||
void Mob::InterruptSpell(uint16 spellid)
|
||||
{
|
||||
if (spellid == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(spellid)) {
|
||||
spellid = casting_spell_id;
|
||||
}
|
||||
|
||||
InterruptSpell(0, 0x121, spellid);
|
||||
}
|
||||
@ -1156,7 +1157,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
|
||||
EQApplicationPacket *outapp = nullptr;
|
||||
uint16 message_other;
|
||||
bool bard_song_mode = false; //has the bard song gone to auto repeat mode
|
||||
if (spellid == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(spellid)) {
|
||||
if(bardsong) {
|
||||
spellid = bardsong;
|
||||
bard_song_mode = true;
|
||||
@ -3284,7 +3285,7 @@ uint32 Client::GetLastBuffSlot(bool disc, bool song)
|
||||
bool Mob::HasDiscBuff()
|
||||
{
|
||||
int slot = GetFirstBuffSlot(true, false);
|
||||
return buffs[slot].spellid != SPELL_UNKNOWN;
|
||||
return IsValidSpell(buffs[slot].spellid);
|
||||
}
|
||||
|
||||
// returns the slot the buff was added to, -1 if it wasn't added due to
|
||||
@ -3329,7 +3330,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
|
||||
for (buffslot = 0; buffslot < buff_count; buffslot++) {
|
||||
const Buffs_Struct &curbuf = buffs[buffslot];
|
||||
|
||||
if (curbuf.spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(curbuf.spellid)) {
|
||||
// there's a buff in this slot
|
||||
ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id,
|
||||
caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot);
|
||||
@ -3480,7 +3481,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
|
||||
const Buffs_Struct &curbuf = buffs[i];
|
||||
|
||||
// no buff in this slot
|
||||
if (curbuf.spellid == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(curbuf.spellid))
|
||||
{
|
||||
// if we haven't found a free slot, this is the first one so save it
|
||||
if(firstfree == -2)
|
||||
@ -5865,7 +5866,7 @@ bool Client::SpellBucketCheck(uint16 spell_id, uint32 character_id) {
|
||||
int16 Mob::GetBuffSlotFromType(uint16 type) {
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (int i = 0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[i].spellid)) {
|
||||
for (int j = 0; j < EFFECT_COUNT; j++) {
|
||||
if (spells[buffs[i].spellid].effect_id[j] == type )
|
||||
return i;
|
||||
@ -5877,8 +5878,9 @@ int16 Mob::GetBuffSlotFromType(uint16 type) {
|
||||
|
||||
uint16 Mob::GetSpellIDFromSlot(uint8 slot)
|
||||
{
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(buffs[slot].spellid)) {
|
||||
return buffs[slot].spellid;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5920,7 +5922,7 @@ bool Mob::IsCombatProc(uint16 spell_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spell_id == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
return(false);
|
||||
}
|
||||
/*
|
||||
@ -5948,13 +5950,13 @@ bool Mob::IsCombatProc(uint16 spell_id) {
|
||||
}
|
||||
|
||||
bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 base_spell_id, int level_override, uint32 proc_reuse_time) {
|
||||
if(spell_id == SPELL_UNKNOWN)
|
||||
if(!IsValidSpell(spell_id))
|
||||
return(false);
|
||||
|
||||
int i;
|
||||
if (bPerma) {
|
||||
for (i = 0; i < MAX_PROCS; i++) {
|
||||
if (PermaProcs[i].spellID == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(PermaProcs[i].spellID)) {
|
||||
PermaProcs[i].spellID = spell_id;
|
||||
PermaProcs[i].chance = iChance;
|
||||
PermaProcs[i].base_spellID = base_spell_id;
|
||||
@ -5986,7 +5988,7 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b
|
||||
// Find a slot and use it as normal.
|
||||
|
||||
for (i = 0; i < MAX_PROCS; i++) {
|
||||
if (SpellProcs[i].spellID == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(SpellProcs[i].spellID)) {
|
||||
SpellProcs[i].spellID = spell_id;
|
||||
SpellProcs[i].chance = iChance;
|
||||
SpellProcs[i].base_spellID = base_spell_id;;
|
||||
@ -6017,12 +6019,12 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) {
|
||||
|
||||
bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id, uint32 proc_reuse_time)
|
||||
{
|
||||
if(spell_id == SPELL_UNKNOWN)
|
||||
if(!IsValidSpell(spell_id))
|
||||
return(false);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MAX_PROCS; i++) {
|
||||
if (DefensiveProcs[i].spellID == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(DefensiveProcs[i].spellID)) {
|
||||
DefensiveProcs[i].spellID = spell_id;
|
||||
DefensiveProcs[i].chance = iChance;
|
||||
DefensiveProcs[i].base_spellID = base_spell_id;
|
||||
@ -6051,12 +6053,12 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll)
|
||||
|
||||
bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id, uint32 proc_reuse_time)
|
||||
{
|
||||
if(spell_id == SPELL_UNKNOWN)
|
||||
if(!IsValidSpell(spell_id))
|
||||
return(false);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MAX_PROCS; i++) {
|
||||
if (RangedProcs[i].spellID == SPELL_UNKNOWN) {
|
||||
if (!IsValidSpell(RangedProcs[i].spellID)) {
|
||||
RangedProcs[i].spellID = spell_id;
|
||||
RangedProcs[i].chance = iChance;
|
||||
RangedProcs[i].base_spellID = base_spell_id;
|
||||
@ -6087,17 +6089,16 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll)
|
||||
// behavior should be used.
|
||||
bool Mob::UseBardSpellLogic(uint16 spell_id, int slot)
|
||||
{
|
||||
if(spell_id == SPELL_UNKNOWN)
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
spell_id = casting_spell_id;
|
||||
|
||||
if(slot == -1)
|
||||
}
|
||||
if (slot == -1) {
|
||||
slot = static_cast<int>(casting_spell_slot);
|
||||
|
||||
}
|
||||
// should we treat this as a bard singing?
|
||||
return
|
||||
(
|
||||
spell_id != 0 &&
|
||||
spell_id != SPELL_UNKNOWN &&
|
||||
IsValidSpell(spell_id) &&
|
||||
slot != -1 &&
|
||||
GetClass() == BARD &&
|
||||
slot <= EQ::spells::SPELL_GEM_COUNT &&
|
||||
@ -6193,7 +6194,7 @@ void Mob::SendPetBuffsToClient()
|
||||
|
||||
for(int buffslot = 0; buffslot < MaxSlots; buffslot++)
|
||||
{
|
||||
if(buffs[buffslot].spellid != SPELL_UNKNOWN) {
|
||||
if (IsValidSpell(buffs[buffslot].spellid)) {
|
||||
pbs->spellid[buffslot] = buffs[buffslot].spellid;
|
||||
pbs->ticsremaining[buffslot] = buffs[buffslot].ticsremaining;
|
||||
PetBuffCount++;
|
||||
@ -6225,7 +6226,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target)
|
||||
uint32 buff_count = for_target ? GetMaxBuffSlots() : GetMaxTotalSlots();
|
||||
for(int i = 0; i < buff_count; ++i)
|
||||
{
|
||||
if(buffs[i].spellid != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(buffs[i].spellid))
|
||||
{
|
||||
++count;
|
||||
}
|
||||
@ -6258,7 +6259,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target)
|
||||
uint32 index = 0;
|
||||
for(int i = 0; i < buff_count; ++i)
|
||||
{
|
||||
if(buffs[i].spellid != SPELL_UNKNOWN)
|
||||
if (IsValidSpell(buffs[i].spellid))
|
||||
{
|
||||
buff->entries[index].buff_slot = i;
|
||||
buff->entries[index].spell_id = buffs[i].spellid;
|
||||
|
||||
@ -2535,8 +2535,9 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) {
|
||||
}
|
||||
|
||||
for (int buffCount = 0; buffCount <= BUFF_COUNT; buffCount++) {
|
||||
if(buffs[buffCount].spellid == 0 || buffs[buffCount].spellid == SPELL_UNKNOWN)
|
||||
continue;
|
||||
if (!IsValidSpell(buffs[buffCount].spellid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int IsPersistent = buffs[buffCount].persistant_buff? 1: 0;
|
||||
|
||||
@ -3079,8 +3080,9 @@ void ZoneDatabase::SaveBuffs(Client *client) {
|
||||
Buffs_Struct *buffs = client->GetBuffs();
|
||||
|
||||
for (int index = 0; index < buff_count; index++) {
|
||||
if(buffs[index].spellid == SPELL_UNKNOWN)
|
||||
continue;
|
||||
if (!IsValidSpell(buffs[index].spellid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
query = StringFormat("INSERT INTO `character_buffs` (character_id, slot_id, spell_id, "
|
||||
"caster_level, caster_name, ticsremaining, counters, numhits, melee_rune, "
|
||||
@ -3261,8 +3263,9 @@ void ZoneDatabase::SavePetInfo(Client *client)
|
||||
// pet buffs!
|
||||
int max_slots = RuleI(Spells, MaxTotalSlotsPET);
|
||||
for (int index = 0; index < max_slots; index++) {
|
||||
if (petinfo->Buffs[index].spellid == SPELL_UNKNOWN || petinfo->Buffs[index].spellid == 0)
|
||||
if (!IsValidSpell(petinfo->Buffs[index].spellid)) {
|
||||
continue;
|
||||
}
|
||||
if (query.length() == 0)
|
||||
query = StringFormat("INSERT INTO `character_pet_buffs` "
|
||||
"(`char_id`, `pet`, `slot`, `spell_id`, `caster_level`, "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user