From f4e085c1213d7f3100e7c73f2cefffb4aadfa731 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 12 Jan 2014 21:26:31 -0500 Subject: [PATCH 1/9] Some clean up in questmgr.cpp --- zone/questmgr.cpp | 65 +++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 9942b1f9f..c78cca00d 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -114,7 +114,7 @@ QuestManager::~QuestManager() { } void QuestManager::Process() { - std::list::iterator cur = QTimerList.begin(), end, tmp; + std::list::iterator cur = QTimerList.begin(), end; end = QTimerList.end(); while (cur != end) { @@ -122,8 +122,7 @@ void QuestManager::Process() { if(entity_list.IsMobInZone(cur->mob)) { if(cur->mob->IsNPC()) { parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0); - } - else { + } else { //this is inheriently unsafe if we ever make it so more than npc/client start timers parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0); } @@ -133,13 +132,10 @@ void QuestManager::Process() { cur = QTimerList.begin(); end = QTimerList.end(); //dunno if this is needed, cant hurt... } else { - tmp = cur; - tmp++; - QTimerList.erase(cur); - cur = tmp; + cur = QTimerList.erase(cur); } } else - cur++; + ++cur; } auto cur_iter = STimerList.begin(); @@ -168,18 +164,14 @@ void QuestManager::EndQuest() { running_quest run = quests_running_.top(); if(run.depop_npc && run.owner->IsNPC()) { //clear out any timers for them... - std::list::iterator cur = QTimerList.begin(), end, tmp; + std::list::iterator cur = QTimerList.begin(), end; end = QTimerList.end(); while (cur != end) { - if(cur->mob == run.owner) { - tmp = cur; - tmp++; - QTimerList.erase(cur); - cur = tmp; - } else { - cur++; - } + if (cur->mob == run.owner) + cur = QTimerList.erase(cur); + else + ++cur; } run.owner->Depop(); @@ -462,7 +454,7 @@ void QuestManager::settimer(const char *timer_name, int seconds) { cur->Timer_.Start(seconds * 1000, false); return; } - cur++; + ++cur; } QTimerList.push_back(QuestTimer(seconds * 1000, owner, timer_name)); @@ -486,7 +478,7 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) { cur->Timer_.Start(milliseconds, false); return; } - cur++; + ++cur; } QTimerList.push_back(QuestTimer(milliseconds, owner, timer_name)); @@ -495,7 +487,7 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) { void QuestManager::stoptimer(const char *timer_name) { QuestManagerCurrentQuestVars(); - if(questitem) { + if (questitem) { questitem->StopTimer(timer_name); return; } @@ -503,14 +495,12 @@ void QuestManager::stoptimer(const char *timer_name) { std::list::iterator cur = QTimerList.begin(), end; end = QTimerList.end(); - while (cur != end) - { - if(cur->mob && cur->mob == owner && cur->name == timer_name) - { + while (cur != end) { + if (cur->mob && cur->mob == owner && cur->name == timer_name) { QTimerList.erase(cur); return; } - cur++; + ++cur; } } @@ -525,19 +515,11 @@ void QuestManager::stopalltimers() { std::list::iterator cur = QTimerList.begin(), end, tmp; end = QTimerList.end(); - while (cur != end) - { + while (cur != end) { if(cur->mob && cur->mob == owner) - { - tmp = cur; - tmp++; - QTimerList.erase(cur); - cur = tmp; - } + cur = QTimerList.erase(cur); else - { - cur++; - } + ++cur; } } @@ -2453,18 +2435,17 @@ uint32 QuestManager::MerchantCountItem(uint32 NPCid, uint32 itemid) { const Item_Struct* item = nullptr; item = database.GetItem(itemid); - if (!item) return 0; // likewise, if it isn't a valid item, the merchant doesn't have any + if (!item) + return 0; // if it isn't a valid item, the merchant doesn't have any // look for the item in the merchant's temporary list std::list MerchList = zone->tmpmerchanttable[NPCid]; std::list::const_iterator itr; - TempMerchantList ml; uint32 Quant = 0; - for(itr = MerchList.begin(); itr != MerchList.end(); itr++){ - ml = *itr; - if (ml.item == itemid) { // if this is the item we're looking for - Quant = ml.charges; + for (itr = MerchList.begin(); itr != MerchList.end(); ++itr) { + if (itr->item == itemid) { // if this is the item we're looking for + Quant = itr->charges; break; } } From 32359da1cce7c88877fa55264c08617813683bf1 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 13 Jan 2014 05:03:21 -0500 Subject: [PATCH 2/9] Spell effect updates --- changelog.txt | 17 ++++ common/spdat.h | 40 +++++----- zone/attack.cpp | 99 +++++++++++++++-------- zone/bonuses.cpp | 107 ++++++++++++++++++------- zone/client.h | 4 +- zone/client_process.cpp | 2 +- zone/common.h | 15 +++- zone/effects.cpp | 14 +++- zone/merc.cpp | 2 +- zone/mob.cpp | 47 +++++++++-- zone/mob.h | 2 +- zone/special_attacks.cpp | 9 ++- zone/spell_effects.cpp | 166 ++++++++++++++++++++++++++++++++------- zone/spells.cpp | 11 +++ 14 files changed, 406 insertions(+), 129 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0be0e4687..2d53f202c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,22 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/13/2014 == +Kayen: Numerous minor fixes to spell effects. +Kayen: Changed SE_ArcheryDoubleAttack -> SE_DoubleRangedAttack (now works with throwing ect) +Kayen: Changed SE_IncreaseHitDmgTaken -> SE_TriggerMeleeThreshold (now only works on melee) +Kayen: Changed SE_MitigateMeleeDamageSP -> SE_MeleeThresholdGuard +Kayen: Implemented SE_SpellThresholdGuard (Partial Spell Rune that only is lowered if spell hits are over X amount of damage) +Kayen: Implemented SE_TriggerSpellThreshold (implemented Trigger effect on X amount of spell damage taken) +Kayen: Changed SE_ReduceHealing -> SE_FcHealAmtIncoming (focus limited Add/Remove amount of healing on target by X amount) +Kayen: Change SE_CriticalHealChance2 -> SE_CriticalHealDecay +Kayen: Change SE_CriticalHealOverTime2 -> SE_CriticalRegenDecay +Kayen: Implemented SE_CriticalDotDecay +Note: 'Decay' effects means the chance to critical decays based on the level of the spell using the effect (like focus decay) +Kayen: Implemented SE_FfLimitUseMin (focus limit to require a min amount of numhits value) +Kayen: Implemented SE_FcLimitUse (focus to increases numhits count by percent) +Kayen: Implemented SE_LimitRace (Limits to spells cast by a certain race) +Kayen: Implemented SE_FcMute (silences casting of spells that contain specific spell effects) ie silence only heals + == 01/09/2014 == demonstar55: Add pet size preservation like live (zone, camp, etc) diff --git a/common/spdat.h b/common/spdat.h index 0dfc202db..e39ea22c2 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -493,7 +493,7 @@ typedef enum { #define SE_ChannelChanceItems 344 // implemented[AA] - chance to not have ITEM effects interrupted when you take damage. #define SE_AssassinationLevel 345 // not implemented as bonus - AA Assisination max level to kill #define SE_HeadShotLevel 346 // not implemented as bonus - AA HeadShot max level to kill -#define SE_ArcheryDoubleAttack 347 // implemented - chance at an additional archery attack (consumes arrow) +#define SE_DoubleRangedAttack 347 // implemented - chance at an additional archery attack (consumes arrow) #define SE_LimitManaCost 348 // implemented #define SE_ShieldEquipHateMod 349 // implemented[AA] Increase melee hate when wearing a shield. #define SE_ManaBurn 350 // implemented - Drains mana for damage/heal at a defined ratio up to a defined maximum amount of mana. @@ -503,7 +503,7 @@ typedef enum { //#define SE_DeactivateAllTraps 354 // *not implemented - looks to be some type of invulnerability? Test DAT (8757) //#define SE_LearnTrap 355 // *not implemented - looks to be some type of invulnerability? Test LT (8758) //#define SE_ChangeTriggerType 356 // not used -#define SE_InhibitSpellCasting 357 // *not implemented - (Stunted Growth 31160) Unlcear what this effect does? silence? +#define SE_FcMute 357 // implemented - silences casting of spells that contain specific spell effects (focus limited) #define SE_CurrentManaOnce 358 // implemented #define SE_Invulnerabilty 359 // *not implemented - Invulnerability (Brell's Blessing) #define SE_SpellOnKill 360 // implemented - a buff that has a base1 % to cast spell base2 when you kill a "challenging foe" base3 min level @@ -540,7 +540,7 @@ typedef enum { #define SE_IncreaseHitDmgTaken 391 // implemented - Most likely a simple negative mitigation modifier (Warlords fury: 23528) #define SE_AdditionalHeal2 392 // implemented - Adds or removes healing from spells #define SE_HealRate2 393 // implemented - HealRate with focus restrictions. -#define SE_ReduceHeal 394 // implemented - Reduces amount of healing on target by X value with foucs restrictions. +#define SE_FcHealAmtIncoming 394 // implemented - Adds/Removes amount of healing on target by X value with foucs restrictions. #define SE_CriticalHealRate 395 // implemented[AA] - Increases chance of having a heal crit when cast on you. [focus limited] #define SE_AdditionalHeal 396 // implemented - Adds a direct healing amount to spells #define SE_PetMeleeMitigation 397 // *not implemented[AA] - additional mitigation to your pets. @@ -549,7 +549,7 @@ typedef enum { #define SE_HealGroupFromMana 400 // implemented - Drains mana and heals for each point of mana drained #define SE_ManaDrainWithDmg 401 // implemented - Deals damage based on the amount of mana drained #define SE_EndDrainWithDmg 402 // implemented - Deals damage for the amount of endurance drained -#define SE_TriggerOnCast2 403 // *not implemented - trigger a spell with percent chance, focus limited. +#define SE_Ff_SpellClass 403 // *not implemented - #define SE_LimitExcludeSkill 404 // implemented - Limit a focus to exclude spells cast using a specific skill. #define SE_TwoHandBluntBlock 405 // implemented - chance to block attacks when using two hand blunt weapons (similiar to shield block) #define SE_CastonNumHitFade 406 // implemented - casts a spell when a buff fades due to its numhits being depleted @@ -558,7 +558,7 @@ typedef enum { #define SE_LimitManaPercent 409 // implemented - limited to a certain percent of your mana #define SE_LimitEndPercent 410 // implemented - limited to a certain percent of your end #define SE_LimitClass 411 // implemented - Limits to spells of a certain class (Note: The class value in dbase is +1 in relation to item class value) -//#define SE_FfRace 412 // not used +#define SE_LimitRace 412 // implemented - Limits to spells cast by a certain race (Note: not used in any known live spells) #define SE_IncreaseSpellPower 413 // implemented - Increases the power of bard songs, skill attacks, runes, bard allowed foci, damage/heal #define SE_LimitSpellSkill 414 // implemented - Limit a focus to include spells cast using a specific skill. //#define SE_FFItemClass 415 // not used @@ -566,10 +566,10 @@ typedef enum { #define SE_ManaRegen_v2 417 // implemented - New mana regen effect #define SE_SkillDamageAmount2 418 // implemented - adds skill damage directly to certain attacks #define SE_AddMeleeProc 419 // implemented - Adds a proc -//#define SE_FcLimitUse 420 // *not used +#define SE_FcLimitUse 420 // implemented - increases numhits count by percent (Note: not used in any known live spells) #define SE_IncreaseNumHits 421 // implemented[AA] - increases number of hits a buff has till fade. (focus) -//#define SE_FfLimitUseMin 422 // not used - Seen in Lasting Bravery[AA] likely a focus limit -//#define SE_FfLimitUseType 423 // not used - Seen in Lasting Bravery[AA] likely a focus limit +#define SE_FfLimitUseMin 422 // implemented - limit a focus to require a min amount of numhits value (used with above) +//#define SE_FfLimitUseType 423 // not used - limit a focus to require a certain numhits type (Field in spells table 175) #define SE_GravityEffect 424 // implemented - Pulls/pushes you toward/away the mob at a set pace #define SE_Display 425 // *not implemented - Illusion: Flying Dragon(21626) #define SE_IncreaseExtTargetWindow 426 // *not implmented[AA] - increases the capacity of your extended target window @@ -579,28 +579,28 @@ typedef enum { //#define SE_PostEffect 430 // *not implemented - Fear of the Dark(27641) - Alters vision //#define SE_PostEffectData 431 // *not implemented - Fear of the Dark(27641) - Alters vision //#define SE_ExpandMaxActiveTrophyBen 432 // not used -//#define SE_CriticalDotDecay 433 // not used (12266 | Placeholder - Test - New Dot Only) -#define SE_CriticalHealChance2 434 // implemented - increase critical heal chance -#define SE_CriticalHealOverTime2 435 // implemented - increase critical heal over time chance +#define SE_CriticalDotDecay 433 // implemented - increase critical dot chance, effect decays based on level of spell it effects. (12266) +#define SE_CriticalHealDecay 434 // implemented - increase critical heal chance, effect decays based on level of spell it effects. +#define SE_CriticalRegenDecay 435 // implemented - increase critical heal over time chance, effect decays based on level of spell it effects. //#define SE_BeneficialCountDownHold 436 // not used ( 23491 | ABTest Buff Hold) -#define SE_Anchor 437 // *not implemented - Teleport Guild Hall Anchor(33099) -#define SE_Anchor2 438 // *not implemented - Translocate Primary Anchor (27750) +#define SE_TeleporttoAnchor 437 // *not implemented - Teleport Guild Hall Anchor(33099) +#define SE_TranslocatetoAnchor 438 // *not implemented - Translocate Primary Anchor (27750) #define SE_IncreaseAssassinationLvl 439 // *not implemented[AA] - increases the maximum level of humanoid that can be affected by assassination #define SE_FinishingBlowLvl 440 // implemented[AA] - Sets the level Finishing blow can be triggered on an NPC #define SE_CancleIfMoved 441 // *not implemented - Buff is removed from target when target moves X amount of distance away from where initially hit. #define SE_TriggerOnValueAmount 442 // implemented - triggers a spell which a certain criteria are met (below X amount of hp,mana,end, number of pets on hatelist) #define SE_TriggerIfMovement 443 // *not implemented - Trigger a spell if you move (37846 | Chopping Block) -#define SE_AggroLock 444 // *not implemented - Locks Aggro On Caster and Decrease other Players Aggro by X% up to level Z -#define SE_AdditionalMercenary 445 // *not implemented[AA] - [Hero's Barracks] Allows you to conscript additional mercs. +#define SE_ImprovedTaunt 444 // *not implemented - Locks Aggro On Caster and Decrease other Players Aggro by X% up to level Z +#define SE_AddMercSlot 445 // *not implemented[AA] - [Hero's Barracks] Allows you to conscript additional mercs. //#define SE_AStacker 446 // *not implementet - bufff stacking blocker ? (26219 | Qirik's Watch) //#define SE_BStacker 447 // *not implemented //#define SE_CStacker 448 // *not implemented //#define SE_DStacker 449 // *not implemented //#define SE_DotGuard 450 // *not implemented -#define SE_MitigateMeleeDamageSP 451 // implemented Partial Melee Rune that only is lowered if melee hits are over X amount of damage -//#define SE_SpellThresholdGuard 452 // *not implemented -#define SE_SpellOnAmtDmgTaken 453 // implemented Trigger effect on X amount of damage taken -//#define SE_DoomSpellThreshold 454 // not used +#define SE_MeleeThresholdGuard 451 // implemented Partial Melee Rune that only is lowered if melee hits are over X amount of damage +#define SE_SpellThresholdGuard 452 // implemented Partial Spell Rune that only is lowered if spell hits are over X amount of damage +#define SE_TriggerMeleeThreshold 453 // implemented Trigger effect on X amount of melee damage taken +#define SE_TriggerSpellThreshold 454 // implemented Trigger effect on X amount of spell damage taken //#define SE_AddHatePct 455 // not used //#define SE_AddHateOverTimePct 456 // not used //#define SE_ResourceTap 457 // not used @@ -694,7 +694,7 @@ struct SPDat_Spell_Struct /* 169 */ /* 173 */ int HateAdded; /* 174 */ int EndurUpkeep; -/* 175 */ +/* 175 */ //numhitstype; // defines which type of behavior will tick down the numhit counter. /* 176 */ int numhits; /* 177 */ int pvpresistbase; /* 178 */ int pvpresistcalc; diff --git a/zone/attack.cpp b/zone/attack.cpp index 7f17d5fc3..aa30557be 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3116,29 +3116,6 @@ int Mob::GetMonkHandToHandDelay(void) } } -int32 Mob::ReduceAllDamage(int32 damage) -{ - if(damage <= 0) - return damage; - - int32 slot = -1; - - if (spellbonuses.SpellOnAmtDmgTaken[2]){ - slot = spellbonuses.SpellOnAmtDmgTaken[1]; - - if (slot >= 0) { - if(damage > buffs[slot].melee_rune) { - if(!TryFadeEffect(slot)) - BuffFadeBySlot(slot); - } - else{ - buffs[slot].melee_rune = (buffs[slot].melee_rune - damage); - CheckHitsRemaining(slot); - } - } - } - return(damage); -} int32 Mob::ReduceDamage(int32 damage) { @@ -3157,16 +3134,16 @@ int32 Mob::ReduceDamage(int32 damage) } //Only mitigate if damage is above the minimium specified. - if (spellbonuses.MitigateMeleeRuneSP[0]){ - slot = spellbonuses.MitigateMeleeRuneSP[1]; + if (spellbonuses.MeleeThresholdGuard[0]){ + slot = spellbonuses.MeleeThresholdGuard[1]; - if (slot >= 0 && (damage > spellbonuses.MitigateMeleeRuneSP[2])) + if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) { DisableMeleeRune = true; - int damage_to_reduce = damage * spellbonuses.MitigateMeleeRuneSP[0] / 100; + int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if(damage_to_reduce > buffs[slot].melee_rune) { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamageSP %d damage negated, %d" + mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= damage_to_reduce; if(!TryFadeEffect(slot)) @@ -3175,7 +3152,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamageSP %d damage negated, %d" + mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; @@ -3211,6 +3188,21 @@ int32 Mob::ReduceDamage(int32 damage) } } + if (spellbonuses.TriggerMeleeThreshold[2]){ + slot = spellbonuses.TriggerMeleeThreshold[1]; + + if (slot >= 0) { + if(damage > buffs[slot].melee_rune) { + if(!TryFadeEffect(slot)) + BuffFadeBySlot(slot); + } + else{ + buffs[slot].melee_rune = (buffs[slot].melee_rune - damage); + CheckHitsRemaining(slot); + } + } + } + if(damage < 1) return -6; @@ -3238,6 +3230,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(damage <= 0) return damage; + bool DisableSpellRune = false; int32 slot = -1; // See if we block the spell outright first @@ -3259,8 +3252,34 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi // Reduce damage by the Spell Shielding first so that the runes don't take the raw damage. damage -= (damage * itembonuses.SpellShield / 100); + + //Only mitigate if damage is above the minimium specified. + if (spellbonuses.SpellThresholdGuard[0]){ + slot = spellbonuses.SpellThresholdGuard[1]; + + if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) + { + DisableSpellRune = true; + int damage_to_reduce = damage * spellbonuses.SpellThresholdGuard[0] / 100; + if(damage_to_reduce > buffs[slot].magic_rune) + { + damage -= damage_to_reduce; + if(!TryFadeEffect(slot)) + BuffFadeBySlot(slot); + //UpdateRuneFlags(); + } + else + { + buffs[slot].melee_rune = (buffs[slot].magic_rune - damage_to_reduce); + damage -= damage_to_reduce; + CheckHitsRemaining(slot); + } + } + } + + // Do runes now. - if (spellbonuses.MitigateSpellRune[0]){ + if (spellbonuses.MitigateSpellRune[0] && !DisableSpellRune){ slot = spellbonuses.MitigateSpellRune[1]; if(slot >= 0) { @@ -3286,6 +3305,21 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } } + if (spellbonuses.TriggerSpellThreshold[2]){ + slot = spellbonuses.TriggerSpellThreshold[1]; + + if (slot >= 0) { + if(damage > buffs[slot].magic_rune) { + if(!TryFadeEffect(slot)) + BuffFadeBySlot(slot); + } + else{ + buffs[slot].melee_rune = (buffs[slot].magic_rune - damage); + CheckHitsRemaining(slot); + } + } + } + if(damage < 1) return 0; @@ -3378,9 +3412,9 @@ bool Client::CheckDoubleAttack(bool tripleAttack) { return false; } -bool Client::CheckArcheryDoubleAttack() { +bool Client::CheckDoubleRangedAttack() { - int16 chance = spellbonuses.ArcheryDoubleAttack + itembonuses.ArcheryDoubleAttack + aabonuses.ArcheryDoubleAttack; + int16 chance = spellbonuses.DoubleRangedAttack + itembonuses.DoubleRangedAttack + aabonuses.DoubleRangedAttack; if(chance && (MakeRandomInt(0, 100) < chance)) return true; @@ -3493,7 +3527,6 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } //final damage has been determined. - ReduceAllDamage(damage); SetHP(GetHP() - damage); if(HasDied()) { diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 7bf88a215..bbb55f989 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -851,8 +851,8 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) case SE_ArcheryDamageModifier: newbon->ArcheryDamageModifier += base1; break; - case SE_ArcheryDoubleAttack: - newbon->ArcheryDoubleAttack += base1; + case SE_DoubleRangedAttack: + newbon->DoubleRangedAttack += base1; break; case SE_DamageShield: newbon->DamageShield += base1; @@ -1982,16 +1982,26 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->DotCritDmgIncrease += effect_value; break; - case SE_CriticalHealChance2: case SE_CriticalHealChance: newbon->CriticalHealChance += effect_value; break; - case SE_CriticalHealOverTime2: case SE_CriticalHealOverTime: newbon->CriticalHealOverTime += effect_value; break; + case SE_CriticalHealDecay: + newbon->CriticalHealDecay = true; + break; + + case SE_CriticalRegenDecay: + newbon->CriticalRegenDecay = true; + break; + + case SE_CriticalDotDecay: + newbon->CriticalDotDecay = true; + break; + case SE_MitigateDamageShield: { if (effect_value < 0) @@ -2173,12 +2183,22 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne } - case SE_MitigateMeleeDamageSP: + case SE_MeleeThresholdGuard: { - if (newbon->MitigateMeleeRuneSP[0] < effect_value){ - newbon->MitigateMeleeRuneSP[0] = effect_value; - newbon->MitigateMeleeRuneSP[1] = buffslot; - newbon->MitigateMeleeRuneSP[2] = spells[spell_id].base2[i]; + if (newbon->MeleeThresholdGuard[0] < effect_value){ + newbon->MeleeThresholdGuard[0] = effect_value; + newbon->MeleeThresholdGuard[1] = buffslot; + newbon->MeleeThresholdGuard[2] = spells[spell_id].base2[i]; + } + break; + } + + case SE_SpellThresholdGuard: + { + if (newbon->SpellThresholdGuard[0] < effect_value){ + newbon->SpellThresholdGuard[0] = effect_value; + newbon->SpellThresholdGuard[1] = buffslot; + newbon->SpellThresholdGuard[2] = spells[spell_id].base2[i]; } break; } @@ -2201,12 +2221,22 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne break; } - case SE_SpellOnAmtDmgTaken: + case SE_TriggerMeleeThreshold: { - if (newbon->SpellOnAmtDmgTaken[2] < spells[spell_id].base2[i]){ - newbon->SpellOnAmtDmgTaken[0] = effect_value; - newbon->SpellOnAmtDmgTaken[1] = buffslot; - newbon->SpellOnAmtDmgTaken[2] = spells[spell_id].base2[i]; + if (newbon->TriggerMeleeThreshold[2] < spells[spell_id].base2[i]){ + newbon->TriggerMeleeThreshold[0] = effect_value; + newbon->TriggerMeleeThreshold[1] = buffslot; + newbon->TriggerMeleeThreshold[2] = spells[spell_id].base2[i]; + } + break; + } + + case SE_TriggerSpellThreshold: + { + if (newbon->TriggerSpellThreshold[2] < spells[spell_id].base2[i]){ + newbon->TriggerSpellThreshold[0] = effect_value; + newbon->TriggerSpellThreshold[1] = buffslot; + newbon->TriggerSpellThreshold[2] = spells[spell_id].base2[i]; } break; } @@ -2285,8 +2315,8 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->ArcheryDamageModifier += effect_value; break; - case SE_ArcheryDoubleAttack: - newbon->ArcheryDoubleAttack += effect_value; + case SE_DoubleRangedAttack: + newbon->DoubleRangedAttack += effect_value; break; case SE_SecondaryDmgInc: @@ -2732,14 +2762,18 @@ uint8 Mob::IsFocusEffect(uint16 spell_id,int effect_index, bool AA,uint32 aa_eff return focusImprovedDamage2; case SE_Empathy: return focusAdditionalDamage; - case SE_ReduceHeal: - return focusReduceHeal; + case SE_FcHealAmtIncoming: + return focusFcHealAmtIncoming; case SE_HealRate2: return focusHealRate; case SE_IncreaseSpellPower: return focusSpellEffectiveness; case SE_IncreaseNumHits: return focusIncreaseNumHits; + case SE_FcLimitUse: + return focusFcLimitUse; + case SE_FcMute: + return focusFcMute; case SE_CriticalHealRate: return focusCriticalHealRate; case SE_AdditionalHeal2: @@ -3318,14 +3352,12 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) itembonuses.DotCritDmgIncrease = effect_value; break; - case SE_CriticalHealChance2: case SE_CriticalHealChance: spellbonuses.CriticalHealChance = effect_value; aabonuses.CriticalHealChance = effect_value; itembonuses.CriticalHealChance = effect_value; break; - case SE_CriticalHealOverTime2: case SE_CriticalHealOverTime: spellbonuses.CriticalHealOverTime = effect_value; aabonuses.CriticalHealOverTime = effect_value; @@ -3458,10 +3490,16 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) spellbonuses.MitigateMeleeRune[1] = -1; break; - case SE_MitigateMeleeDamageSP: - spellbonuses.MitigateMeleeRuneSP[0] = effect_value; - spellbonuses.MitigateMeleeRuneSP[1] = -1; - spellbonuses.MitigateMeleeRuneSP[1] = effect_value; + case SE_MeleeThresholdGuard: + spellbonuses.MeleeThresholdGuard[0] = effect_value; + spellbonuses.MeleeThresholdGuard[1] = -1; + spellbonuses.MeleeThresholdGuard[1] = effect_value; + break; + + case SE_SpellThresholdGuard: + spellbonuses.SpellThresholdGuard[0] = effect_value; + spellbonuses.SpellThresholdGuard[1] = -1; + spellbonuses.SpellThresholdGuard[1] = effect_value; break; case SE_MitigateSpellDamage: @@ -3698,10 +3736,10 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) aabonuses.SlayUndead[1] = effect_value; break; - case SE_ArcheryDoubleAttack: - spellbonuses.ArcheryDoubleAttack = effect_value; - aabonuses.ArcheryDoubleAttack = effect_value; - itembonuses.ArcheryDoubleAttack = effect_value; + case SE_DoubleRangedAttack: + spellbonuses.DoubleRangedAttack = effect_value; + aabonuses.DoubleRangedAttack = effect_value; + itembonuses.DoubleRangedAttack = effect_value; break; case SE_ShieldEquipHateMod: @@ -3718,6 +3756,19 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) itembonuses.ShieldEquipDmgMod[0] = effect_value; itembonuses.ShieldEquipDmgMod[1] = effect_value; break; + + case SE_TriggerMeleeThreshold: + spellbonuses.TriggerMeleeThreshold[0] = effect_value; + spellbonuses.TriggerMeleeThreshold[1] = effect_value; + spellbonuses.TriggerMeleeThreshold[2] = effect_value; + break; + + case SE_TriggerSpellThreshold: + spellbonuses.TriggerSpellThreshold[0] = effect_value; + spellbonuses.TriggerSpellThreshold[1] = effect_value; + spellbonuses.TriggerSpellThreshold[2] = effect_value; + break; + } } } diff --git a/zone/client.h b/zone/client.h index 9d28d77a2..b26987eec 100644 --- a/zone/client.h +++ b/zone/client.h @@ -819,7 +819,7 @@ public: void LinkDead(); void Insight(uint32 t_id); bool CheckDoubleAttack(bool tripleAttack = false); - bool CheckArcheryDoubleAttack(); + bool CheckDoubleRangedAttack(); //remove charges/multiple objects from inventory: //bool DecreaseByType(uint32 type, uint8 amt); @@ -830,7 +830,7 @@ public: void RemoveDuplicateLore(bool client_update = true); void MoveSlotNotAllowed(bool client_update = true); virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); - virtual void ThrowingAttack(Mob* other); + virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); void SetZoneFlag(uint32 zone_id); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 4934ab19e..4a8de6146 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -303,7 +303,7 @@ bool Client::Process() { if(CheckLosFN(GetTarget())){ //client has built in los check, but auto fire does not.. done last. RangedAttack(GetTarget()); - if (CheckArcheryDoubleAttack()) + if (CheckDoubleRangedAttack()) RangedAttack(GetTarget(), true); } else diff --git a/zone/common.h b/zone/common.h index be9ce79f4..4dfb229d7 100644 --- a/zone/common.h +++ b/zone/common.h @@ -73,9 +73,11 @@ typedef enum { //focus types focusBlockNextSpell, focusHealRate, focusAdditionalDamage, - focusReduceHeal, + focusFcHealAmtIncoming, focusSpellEffectiveness, focusIncreaseNumHits, + focusFcLimitUse, + focusFcMute, focusCriticalHealRate, focusAdditionalHeal2, focusAdditionalHeal, @@ -251,7 +253,7 @@ struct StatBonuses { int16 DualWieldChance; //i int16 DoubleAttackChance; //i int16 TripleAttackChance; //i - int16 ArcheryDoubleAttack; //i + int16 DoubleRangedAttack; //i int16 ResistSpellChance; //i int16 ResistFearChance; //i bool Fearless; //i @@ -310,12 +312,17 @@ struct StatBonuses { int16 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage uint16 NegateAttacks[2]; // 0 = bool HasEffect 1 = Buff Slot uint16 MitigateMeleeRune[2]; // 0 = Mitigation value 1 = Buff Slot - uint16 MitigateMeleeRuneSP[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. + uint16 MeleeThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. + uint16 SpellThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. uint16 MitigateSpellRune[2]; // 0 = Mitigation value 1 = Buff Slot - uint32 SpellOnAmtDmgTaken[3]; // 0 = Spell Effect ID 1 = Buff slot 2 = Damage Amount to Trigger + uint32 TriggerMeleeThreshold[3]; // 0 = Spell Effect ID 1 = Buff slot 2 = Damage Amount to Trigger + uint32 TriggerSpellThreshold[3]; // 0 = Spell Effect ID 1 = Buff slot 2 = Damage Amount to Trigger uint16 ManaAbsorbPercentDamage[2]; // 0 = Mitigation value 1 = Buff Slot int16 ShieldBlock; // Chance to Shield Block int16 BlockBehind; // Chance to Block Behind (with our without shield) + bool CriticalRegenDecay; // increase critical regen chance, decays based on spell level cast + bool CriticalHealDecay; // increase critical heal chance, decays based on spell level cast + bool CriticalDotDecay; // increase critical dot chance, decays based on spell level cast //bool AbsorbMagicAtt; // Magic Rune *Need to be implemented for NegateEffect //bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect diff --git a/zone/effects.cpp b/zone/effects.cpp index 6760bef05..87b8f3742 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -205,6 +205,9 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value) { if (GetClass() == NECROMANCER && critChance > 0) critChance += 5; + if (spellbonuses.CriticalDotDecay) + critChance += GetDecayEffectValue(spell_id, SE_CriticalDotDecay); + if (critChance > 0){ if (MakeRandomInt(0, 99) < critChance){ modifier += modifier*ratio/100; @@ -237,7 +240,7 @@ int32 Client::Additional_Heal(uint16 spell_id) heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id); heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id); - heal_amt -= GetFocusEffect(focusReduceHeal, spell_id); + heal_amt -= GetFocusEffect(focusFcHealAmtIncoming, spell_id); if (heal_amt){ int duration = CalcBuffDuration(this, this, spell_id); @@ -275,6 +278,9 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value) { //Live AA - Healing Gift, Theft of Life chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance; + + if (spellbonuses.CriticalRegenDecay) + chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); if(MakeRandomInt(0,99) < chance) { entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s performs an exceptional heal! (%d)", GetName(), ((value * modifier / 50) + heal_amt*2)); @@ -286,7 +292,11 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value) { } // Hots else { - chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance; + chance += itembonuses.CriticalHealOverTime + spellbonuses.CriticalHealOverTime + aabonuses.CriticalHealOverTime; + + if (spellbonuses.CriticalRegenDecay) + chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); + if(MakeRandomInt(0,99) < chance) return ((value * modifier / 50) + heal_amt*2); } diff --git a/zone/merc.cpp b/zone/merc.cpp index e9e56b64d..82b4c7894 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2868,7 +2868,7 @@ int32 Merc::Additional_Heal(uint16 spell_id) heal_amt += GetFocusEffect(focusAdditionalHeal, spell_id); heal_amt += GetFocusEffect(focusAdditionalHeal2, spell_id); - heal_amt -= GetFocusEffect(focusReduceHeal, spell_id); + heal_amt += GetFocusEffect(focusFcHealAmtIncoming, spell_id); if (heal_amt){ int duration = CalcBuffDuration(this, this, spell_id); diff --git a/zone/mob.cpp b/zone/mob.cpp index d0c12586b..01146a4a2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3458,7 +3458,7 @@ bool Mob::TryFadeEffect(int slot) for(int i = 0; i < EFFECT_COUNT; i++) { if (spells[buffs[slot].spellid].effectid[i] == SE_CastOnWearoff || spells[buffs[slot].spellid].effectid[i] == SE_EffectOnFade - || spells[buffs[slot].spellid].effectid[i] == SE_SpellOnAmtDmgTaken) + || spells[buffs[slot].spellid].effectid[i] == SE_TriggerMeleeThreshold) { uint16 spell_id = spells[buffs[slot].spellid].base[i]; BuffFadeBySlot(slot); @@ -4611,10 +4611,10 @@ int Mob::SlowMitigation(bool slow_msg, Mob *caster, int slow_value) if ((int_slow_mitigation > 0.0f) && (int_slow_mitigation < 26.0f)) caster->Message(262, "Your spell was mostly successful"); - else if ((int_slow_mitigation > 26.0f) && (int_slow_mitigation < 74.0f)) + else if ((int_slow_mitigation >= 26.0f) && (int_slow_mitigation < 74.0f)) caster->Message(262, "Your spell was partially successful"); - else if ((int_slow_mitigation > 74.0f) && (int_slow_mitigation < 101.0f)) + else if ((int_slow_mitigation >= 74.0f) && (int_slow_mitigation < 101.0f)) caster->Message(262, "Your spell was slightly successful"); } return 0; @@ -4657,9 +4657,6 @@ bool Mob::PassLimitToSkill(uint16 spell_id, uint16 skill) { if (!IsValidSpell(spell_id)) return false; - if (!IsEffectInSpell(spell_id, SE_LimitToSkill)) - return false; - for (int i = 0; i < EFFECT_COUNT; i++) { if (spells[spell_id].effectid[i] == SE_LimitToSkill){ if (spells[spell_id].base[i] == skill){ @@ -4670,6 +4667,44 @@ bool Mob::PassLimitToSkill(uint16 spell_id, uint16 skill) { return false; } +int8 Mob::GetDecayEffectValue(uint16 spell_id, uint16 spelleffect) { + + if (!IsValidSpell(spell_id)) + return false; + + int spell_level = spells[spell_id].classes[(GetClass()%16) - 1]; + int effect_value = 0; + int lvlModifier = 100; + + int buff_count = GetMaxTotalSlots(); + for (int slot = 0; slot < buff_count; slot++){ + if (IsValidSpell(buffs[slot].spellid)){ + for (int i = 0; i < EFFECT_COUNT; i++){ + if(spells[buffs[slot].spellid].effectid[i] == spelleffect) { + + int critchance = spells[buffs[slot].spellid].base[i]; + int decay = spells[buffs[slot].spellid].base2[i]; + int lvldiff = spell_level - spells[buffs[slot].spellid].max[i]; + + if(lvldiff > 0 && decay > 0) + { + lvlModifier -= decay*lvldiff; + if (lvlModifier > 0){ + critchance = (critchance*lvlModifier)/100; + effect_value += critchance; + } + } + + else + effect_value += critchance; + } + } + } + } + + return effect_value; +} + // Faction Mods for Alliance type spells void Mob::AddFactionBonus(uint32 pFactionID,int32 bonus) { std::map :: const_iterator faction_bonus; diff --git a/zone/mob.h b/zone/mob.h index f6010a3d3..66246cd6b 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -570,6 +570,7 @@ public: bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } bool DoHPToManaCovert(uint16 mana_cost = 0); int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); + int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect); void ModSkillDmgTaken(SkillUseTypes skill_num, int value); int16 GetModSkillDmgTaken(const SkillUseTypes skill_num); @@ -655,7 +656,6 @@ public: int32 ReduceDamage(int32 damage); int32 AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTic, Mob* attacker); - int32 ReduceAllDamage(int32 damage); virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false); virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index a8200ead3..226f61c98 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -197,14 +197,15 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { if (ca_atk->m_skill == SkillThrowing) { SetAttackTimer(); ThrowingAttack(GetTarget()); + if (CheckDoubleRangedAttack()) + RangedAttack(GetTarget(), true); return; } //ranged attack (archery) if (ca_atk->m_skill == SkillArchery) { SetAttackTimer(); RangedAttack(GetTarget()); - bool test = CheckArcheryDoubleAttack(); - if (CheckArcheryDoubleAttack()) + if (CheckDoubleRangedAttack()) RangedAttack(GetTarget(), true); return; } @@ -1119,12 +1120,12 @@ uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) return MaxDmg; } -void Client::ThrowingAttack(Mob* other) { //old was 51 +void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //conditions to use an attack checked before we are called //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow - if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) { + if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { mlog(COMBAT__RANGED, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 78efc0079..1068667a3 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -178,8 +178,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int numhit = spells[spell_id].numhits; - if (caster && caster->IsClient()) + if (caster && caster->IsClient()){ + numhit += numhit*caster->CastToClient()->GetFocusEffect(focusFcLimitUse, spell_id)/100; numhit += caster->CastToClient()->GetFocusEffect(focusIncreaseNumHits, spell_id); + } buffs[buffslot].numhits = numhit; } @@ -1364,12 +1366,18 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - case SE_MitigateMeleeDamageSP: + case SE_MeleeThresholdGuard: { buffs[buffslot].melee_rune = spells[spell_id].max[i]; break; } + case SE_SpellThresholdGuard: + { + buffs[buffslot].magic_rune = spells[spell_id].max[i]; + break; + } + case SE_MitigateSpellDamage: { buffs[buffslot].magic_rune = GetPartialMagicRuneAmount(spell_id); @@ -1377,12 +1385,18 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - //Using the melee_rune variable, however it will be calculated for both spell and melee. - case SE_SpellOnAmtDmgTaken: + case SE_TriggerMeleeThreshold: { buffs[buffslot].melee_rune = spells[spell_id].base2[i]; break; } + + case SE_TriggerSpellThreshold: + { + buffs[buffslot].magic_rune = spells[spell_id].base2[i]; + break; + } + case SE_Levitate: { @@ -2859,8 +2873,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_ImprovedDamage2: case SE_AdditionalHeal2: case SE_HealRate2: - case SE_CriticalHealChance2: - case SE_CriticalHealOverTime2: + case SE_CriticalHealDecay: + case SE_CriticalRegenDecay: case SE_Empathy: case SE_LimitSpellSkill: case SE_MitigateDamageShield: @@ -2904,12 +2918,15 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_CriticalHealRate: case SE_IncreaseNumHits: case SE_CastonFocusEffect: - case SE_ReduceHeal: + case SE_FcHealAmtIncoming: case SE_IncreaseHitDmgTaken: - case SE_ArcheryDoubleAttack: + case SE_DoubleRangedAttack: case SE_ShieldEquipHateMod: case SE_ShieldEquipDmgMod: case SE_TriggerOnValueAmount: + case SE_LimitRace: + case SE_FcLimitUse: + case SE_FcMute: { break; } @@ -3931,6 +3948,8 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) int lvldiff = 0; bool LimitSpellSkill = false; bool SpellSkill_Found = false; + bool LimitSpellEffect = false; + bool SpellEffect_Found = false; uint32 effect = 0; int32 base1 = 0; int32 base2 = 0; @@ -3963,6 +3982,10 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) if (LimitFound){ value = 0; LimitFound = false; + LimitSpellSkill = false; + SpellSkill_Found = false; + LimitSpellEffect = false; + SpellEffect_Found = false; } else{ @@ -4036,11 +4059,14 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) if(IsEffectInSpell(spell_id,(base1*-1))) LimitFound = true; } - else { - // Include effect(only this) - if(!IsEffectInSpell(spell_id,base1)) - LimitFound = true; + + + else if(base1 >= 0){ + LimitSpellEffect = true; + if (IsEffectInSpell(spell_id,base1)) + SpellEffect_Found = true; } + break; case SE_LimitSpellType: switch(base1) @@ -4110,6 +4136,15 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) LimitFound = true; break; + case SE_LimitRace: + if (base1 != GetRace()) + LimitFound = true; + break; + + case SE_FfLimitUseMin: + if (base1 > spell.numhits) + LimitFound = true; + break; //Handle Focus Effects case SE_ImprovedDamage: @@ -4284,9 +4319,9 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) break; } - case SE_ReduceHeal: + case SE_FcHealAmtIncoming: { - if(type == focusReduceHeal) + if(type == focusFcHealAmtIncoming) value = base1; break; @@ -4347,17 +4382,36 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) break; } - //Check for spell skill limits. - if ((LimitSpellSkill) && (!SpellSkill_Found)) - return 0; + + case SE_FcLimitUse: + { + if(type == focusFcLimitUse) + value = base1; + + break; + } + + + case SE_FcMute: + { + if(type == focusFcMute) + value = base1; + + break; + } } } - if (LimitFound){ - return 0; - } + if (LimitSpellSkill && !SpellSkill_Found) + LimitFound = true; + if (LimitSpellEffect && !SpellEffect_Found) + LimitFound = true; + + if (LimitFound) + return 0; + return(value*lvlModifier/100); } @@ -4368,6 +4422,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo if(!IsValidSpell(focus_id) || !IsValidSpell(spell_id)) return 0; + const SPDat_Spell_Struct &focus_spell = spells[focus_id]; const SPDat_Spell_Struct &spell = spells[spell_id]; @@ -4377,6 +4432,8 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo int lvldiff = 0; bool LimitSpellSkill = false; bool SpellSkill_Found = false; + bool LimitSpellEffect = false; + bool SpellEffect_Found = false; uint32 Caston_spell_id = 0; for (int i = 0; i < EFFECT_COUNT; i++) { @@ -4385,7 +4442,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo case SE_Blank: break; //check limits - + case SE_LimitResist:{ if(focus_spell.base[i]){ if(spell.resisttype != focus_spell.base[i]) @@ -4465,10 +4522,17 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; } } - else if(!IsEffectInSpell(spell_id,focus_spell.base[i])){ //we limit this effect, must have - return 0; - } + //else if(!SpellEffect_Found && (!IsEffectInSpell(spell_id,focus_spell.base[i])){ //we limit this effect, must have + // return 0; + //} } + + if(focus_spell.base[i] >= 0){ + LimitSpellEffect = true; + if (IsEffectInSpell(spell_id,focus_spell.base[i])) + SpellEffect_Found = true; + } + break; @@ -4538,11 +4602,22 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; + case SE_LimitRace: + if (focus_spell.base[i] != GetRace()) + return 0; + break; + + case SE_FfLimitUseMin: + if (focus_spell.base[i] > spell.numhits) + return 0; + break; + case SE_CastonFocusEffect: if (focus_spell.base[i] > 0) Caston_spell_id = focus_spell.base[i]; break; + //handle effects case SE_ImprovedDamage: // No Spell used this, its handled by different spell effect IDs. @@ -4764,9 +4839,9 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo break; } - case SE_ReduceHeal: + case SE_FcHealAmtIncoming: { - if(type == focusReduceHeal) + if(type == focusFcHealAmtIncoming) value = focus_spell.base[i]; break; @@ -4827,6 +4902,23 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo break; } + + case SE_FcLimitUse: + { + if(type == focusFcLimitUse) + value = focus_spell.base[i]; + + break; + } + + case SE_FcMute: + { + if(type == focusFcMute) + value = focus_spell.base[i]; + + break; + } + #if EQDEBUG >= 6 //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. @@ -4836,9 +4928,12 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo } } //Check for spell skill limits. - if ((LimitSpellSkill) && (!SpellSkill_Found)) + if (LimitSpellSkill && !SpellSkill_Found) return 0; + if (LimitSpellEffect && !SpellEffect_Found) + return 0; + if (Caston_spell_id){ if(IsValidSpell(Caston_spell_id) && (Caston_spell_id != spell_id)) SpellFinished(Caston_spell_id, this, 10, 0, -1, spells[Caston_spell_id].ResistDiff); @@ -5180,6 +5275,23 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { bool Mob::CheckHitsRemaining(uint32 buff_slot, bool when_spell_done, bool negate, uint16 type, uint16 spell_id,bool use_skill,uint16 skill) { + + /* + TO DO: Rewrite code so it checks for numhits by type not after each specified spell effect is triggered... + Field 175 = numhits type + 1: [Incoming Hit Attempts] (323=SE_DefensiveProc, 172=SE_AvoidMeleeChance, 1=SE_ArmorClass, 40=SE_DivineAura) + 2: [Outgoing Hit Attempts] (184=SE_DamageModifer, 185=SE_HitChance) + 3: [Incoming Spells] (180=SE_ResistSpellChance, 296=SE_SpellVulnerability) + 4: NONE + 5: [Outgoing Hit Successes] (196=SE_SkillDamageAmount, 178=SE_MeleeLifetap, 121=SE_ReverseDS, ?373=SE_CastOnWearoff) + 6: [Incoming Hit Successes] (59=SE_DamageShield, 197=SE_SkillDamageTaken, 162=define SE_MitigateMeleeDamage) + 7: [Matching Spells] *When focus is triggered (focus effects) + 8: [Incoming Hits or Spells] (329=SE_ManaAbsorbPercentDamage) + 9: [Reflected Spells] + 10: [Defensive Procs] + 11: [Melee Procs] + */ + bool bDepleted = false; //Effects: Cast: SE_ResistSpellChance, SE_Reflect, SE_SpellDamageShield //Effects: Attack: SE_MeleeLifetap : SE_DamageShield, SE_AvoidMeleeChance, SE_SkillProc diff --git a/zone/spells.cpp b/zone/spells.cpp index 9a99a70ad..4fad23e5b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -193,6 +193,17 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, return(false); } + if(IsClient()){ + int chance = CastToClient()->GetFocusEffect(focusFcMute, spell_id); + + if (MakeRandomInt(0,99) < chance){ + Message_StringID(13, SILENCED_STRING); + if(IsClient()) + CastToClient()->SendSpellBarEnable(spell_id); + return(false); + } + } + if(IsDetrimentalSpell(spell_id) && !zone->CanDoCombat()){ Message_StringID(13, SPELL_WOULDNT_HOLD); if(IsClient()) From 4216627604f95f31c4154ad2c66264c60433e369 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 13 Jan 2014 22:14:02 -0500 Subject: [PATCH 3/9] Prefer prefix ++/-- on non-primitive types Postfix ++/-- might cause the creation of a tmp instance that might be optimized out. Mights are bad. Prefix doesn't have this problem. --- common/EQNetwork.cpp | 19 +++---- common/EQStream.cpp | 14 +++--- common/Item.cpp | 50 +++++++++---------- common/TCPServer.h | 4 +- common/guild_base.cpp | 6 +-- common/ptimer.cpp | 8 +-- common/shareddb.cpp | 2 +- common/timeoutmgr.cpp | 4 +- eqlaunch/eqlaunch.cpp | 6 +-- eqlaunch/worldserver.cpp | 2 +- loginserver/ClientManager.cpp | 10 ++-- loginserver/Config.cpp | 8 +-- loginserver/ServerManager.cpp | 24 ++++----- ucs/chatchannel.cpp | 14 +++--- ucs/clientlist.cpp | 18 +++---- world/Adventure.cpp | 16 +++--- world/AdventureManager.cpp | 90 +++++++++++++++++----------------- world/EQLConfig.cpp | 4 +- world/EQW.cpp | 4 +- world/LauncherLink.cpp | 2 +- world/LauncherList.cpp | 24 +++++---- zone/AA.cpp | 4 +- zone/MobAI.cpp | 26 +++++----- zone/QuestParserCollection.cpp | 46 ++++++++--------- zone/aggro.cpp | 2 +- zone/bot.cpp | 58 +++++++++++----------- zone/botspellsai.cpp | 42 ++++++++-------- zone/client.cpp | 18 +++---- zone/client_logs.cpp | 6 +-- zone/client_packet.cpp | 36 +++++++------- zone/client_process.cpp | 6 +-- zone/command.cpp | 16 +++--- zone/corpse.cpp | 26 +++++----- zone/embperl.h | 2 +- zone/entity.cpp | 32 ++++++------ zone/guild_mgr.cpp | 6 +-- zone/merc.cpp | 62 +++++++++++------------ zone/mob.cpp | 2 +- zone/npc.cpp | 24 ++++----- zone/pathing.cpp | 4 +- zone/spawn2.cpp | 10 ++-- zone/spawngroup.cpp | 8 +-- zone/spells.cpp | 4 +- zone/tasks.cpp | 14 +++--- zone/titles.cpp | 2 +- zone/tradeskills.cpp | 6 +-- zone/tribute.cpp | 4 +- zone/waypoints.cpp | 18 ++----- zone/zone.cpp | 12 ++--- zone/zonedb.cpp | 4 +- zone/zoning.cpp | 2 +- 51 files changed, 405 insertions(+), 426 deletions(-) diff --git a/common/EQNetwork.cpp b/common/EQNetwork.cpp index ac18851ef..c4ec019ea 100644 --- a/common/EQNetwork.cpp +++ b/common/EQNetwork.cpp @@ -229,25 +229,18 @@ void EQStreamServer::Process() { } std::map ::iterator connection; - for (connection = connection_list.begin( ); connection != connection_list.end( );) - { - if(!connection->second) - { - std::map ::iterator tmp=connection; - connection++; - connection_list.erase(tmp); + for (connection = connection_list.begin(); connection != connection_list.end();) { + if (!connection->second) { + connection = connection_list.erase(connection); continue; } EQStream* eqs_data = connection->second; if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) { - std::map ::iterator tmp=connection; - connection++; safe_delete(eqs_data); - connection_list.erase(tmp); - } - else if(!eqs_data->RunLoop) { + connection = connection_list.erase(connection); + } else if (!eqs_data->RunLoop) { eqs_data->Process(sock); - connection++; + ++connection; } } } diff --git a/common/EQStream.cpp b/common/EQStream.cpp index 962c2f69a..785c11ff3 100644 --- a/common/EQStream.cpp +++ b/common/EQStream.cpp @@ -747,7 +747,7 @@ void EQStream::Write(int eq_fd) // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); _log(NET__NET_COMBINE, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); - sitr++; + ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) @@ -765,7 +765,7 @@ void EQStream::Write(int eq_fd) } else { // Combine worked _log(NET__NET_COMBINE, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); - sitr++; + ++sitr; NextSequencedSend++; } } else { @@ -774,7 +774,7 @@ void EQStream::Write(int eq_fd) // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); _log(NET__NET_COMBINE, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); - sitr++; + ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) @@ -792,7 +792,7 @@ void EQStream::Write(int eq_fd) } else { // Combine worked _log(NET__NET_COMBINE, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); - sitr++; + ++sitr; NextSequencedSend++; } } @@ -1047,7 +1047,7 @@ EQApplicationPacket *p=nullptr; MInboundQueue.lock(); if (!InboundQueue.empty()) { std::vector::iterator itr; - for(itr=InboundQueue.begin();itr!=InboundQueue.end();itr++) { + for(itr=InboundQueue.begin();itr!=InboundQueue.end();++itr) { p=*itr; delete p; } @@ -1094,7 +1094,7 @@ EQProtocolPacket *p=nullptr; } if(!SequencedQueue.empty()) { std::deque::iterator itr; - for(itr=SequencedQueue.begin();itr!=SequencedQueue.end();itr++) { + for(itr=SequencedQueue.begin();itr!=SequencedQueue.end();++itr) { p=*itr; delete p; } @@ -1119,7 +1119,7 @@ EQProtocolPacket *p=nullptr; if(!PacketQueue.empty()) { std::map::iterator itr; - for(itr=PacketQueue.begin();itr!=PacketQueue.end();itr++) { + for(itr=PacketQueue.begin();itr!=PacketQueue.end();++itr) { p=itr->second; delete p; } diff --git a/common/Item.cpp b/common/Item.cpp index 9dd1071f6..2e43a6d75 100644 --- a/common/Item.cpp +++ b/common/Item.cpp @@ -101,7 +101,7 @@ ItemInstQueue::~ItemInstQueue() { iter_queue cur,end; cur = m_list.begin(); end = m_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ItemInst *tmp = * cur; safe_delete(tmp); } @@ -113,7 +113,7 @@ Inventory::~Inventory() { cur = m_worn.begin(); end = m_worn.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ItemInst *tmp = cur->second; safe_delete(tmp); } @@ -121,7 +121,7 @@ Inventory::~Inventory() { cur = m_inv.begin(); end = m_inv.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ItemInst *tmp = cur->second; safe_delete(tmp); } @@ -129,7 +129,7 @@ Inventory::~Inventory() { cur = m_bank.begin(); end = m_bank.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ItemInst *tmp = cur->second; safe_delete(tmp); } @@ -137,7 +137,7 @@ Inventory::~Inventory() { cur = m_shbank.begin(); end = m_shbank.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ItemInst *tmp = cur->second; safe_delete(tmp); } @@ -145,7 +145,7 @@ Inventory::~Inventory() { cur = m_trade.begin(); end = m_trade.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ItemInst *tmp = cur->second; safe_delete(tmp); } @@ -166,7 +166,7 @@ ItemInst::ItemInst(const ItemInst& copy) m_merchantcount=copy.m_merchantcount; // Copy container contents iter_contents it; - for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) { + for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); ++it) { ItemInst* inst_old = it->second; ItemInst* inst_new = nullptr; @@ -179,7 +179,7 @@ ItemInst::ItemInst(const ItemInst& copy) } } std::map::const_iterator iter; - for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) { + for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); ++iter) { m_custom_data[iter->first] = iter->second; } m_SerialNumber = copy.m_SerialNumber; @@ -428,7 +428,7 @@ void ItemInst::Clear() iter_contents cur, end; cur = m_contents.begin(); end = m_contents.end(); - for (; cur != end; cur++) { + for (; cur != end; ++cur) { ItemInst* inst = cur->second; safe_delete(inst); } @@ -446,7 +446,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) ItemInst* inst = cur->second; const Item_Struct* item = inst->GetItem(); del = cur; - cur++; + ++cur; switch(is_nodrop) { case byFlagSet: @@ -611,7 +611,7 @@ std::string ItemInst::GetCustomDataString() const { ret_val += iter->first; ret_val += "^"; ret_val += iter->second; - iter++; + ++iter; if(ret_val.length() > 0) { ret_val += "^"; @@ -1231,11 +1231,11 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo void Inventory::dumpBagContents(ItemInst *inst, iter_inst *it) { iter_contents itb; - if (!inst || !inst->IsType(ItemClassContainer)) + if (!inst || !inst->IsType(ItemClassContainer)) return; // Go through bag, if bag - for (itb=inst->_begin(); itb!=inst->_end(); itb++) { + for (itb=inst->_begin(); itb!=inst->_end(); ++itb) { ItemInst* baginst = itb->second; if(!baginst || !baginst->GetItem()) continue; @@ -1308,7 +1308,7 @@ void Inventory::dumpItemCollection(const std::map &collection) iter_contents itb; ItemInst* inst = nullptr; - for (it=collection.begin(); it!=collection.end(); it++) { + for (it=collection.begin(); it!=collection.end(); ++it) { inst = it->second; if(!inst || !inst->GetItem()) continue; @@ -1430,7 +1430,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, ui uint8 quantity_found = 0; // Check item: After failed checks, check bag contents (if bag) - for (it=bucket.begin(); it!=bucket.end(); it++) { + for (it=bucket.begin(); it!=bucket.end(); ++it) { inst = it->second; if (inst) { if (inst->GetID() == item_id) { @@ -1447,7 +1447,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, ui // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - for (itb=inst->_begin(); itb!=inst->_end(); itb++) { + for (itb=inst->_begin(); itb!=inst->_end(); ++itb) { ItemInst* baginst = itb->second; if (baginst->GetID() == item_id) { quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges(); @@ -1474,7 +1474,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) uint8 quantity_found = 0; // Read-only iteration of queue - for (it=iqueue.begin(); it!=iqueue.end(); it++) { + for (it=iqueue.begin(); it!=iqueue.end(); ++it) { ItemInst* inst = *it; if (inst) { @@ -1491,7 +1491,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - for (itb=inst->_begin(); itb!=inst->_end(); itb++) { + for (itb=inst->_begin(); itb!=inst->_end(); ++itb) { ItemInst* baginst = itb->second; if (baginst->GetID() == item_id) { quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges(); @@ -1520,7 +1520,7 @@ int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, ui uint8 quantity_found = 0; // Check item: After failed checks, check bag contents (if bag) - for (it=bucket.begin(); it!=bucket.end(); it++) { + for (it=bucket.begin(); it!=bucket.end(); ++it) { inst = it->second; if (inst && inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges()<=0) ? 1 : inst->GetCharges(); @@ -1554,7 +1554,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) uint8 quantity_found = 0; // Read-only iteration of queue - for (it=iqueue.begin(); it!=iqueue.end(); it++) { + for (it=iqueue.begin(); it!=iqueue.end(); ++it) { ItemInst* inst = *it; if (inst && inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges()<=0) ? 1 : inst->GetCharges(); @@ -1565,7 +1565,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - for (itb=inst->_begin(); itb!=inst->_end(); itb++) { + for (itb=inst->_begin(); itb!=inst->_end(); ++itb) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges(); @@ -1587,7 +1587,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 ItemInst* inst = nullptr; // Check item: After failed checks, check bag contents (if bag) - for (it=bucket.begin(); it!=bucket.end(); it++) { + for (it=bucket.begin(); it!=bucket.end(); ++it) { inst = it->second; if (inst) { if (inst->GetItem()->LoreGroup == loregroup) @@ -1603,7 +1603,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - for (itb=inst->_begin(); itb!=inst->_end(); itb++) { + for (itb=inst->_begin(); itb!=inst->_end(); ++itb) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(it->first, itb->first); @@ -1629,7 +1629,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) iter_contents itb; // Read-only iteration of queue - for (it=iqueue.begin(); it!=iqueue.end(); it++) { + for (it=iqueue.begin(); it!=iqueue.end(); ++it) { ItemInst* inst = *it; if (inst) { @@ -1646,7 +1646,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) // Go through bag, if bag if (inst && inst->IsType(ItemClassContainer)) { - for (itb=inst->_begin(); itb!=inst->_end(); itb++) { + for (itb=inst->_begin(); itb!=inst->_end(); ++itb) { ItemInst* baginst = itb->second; if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(SLOT_CURSOR, itb->first); diff --git a/common/TCPServer.h b/common/TCPServer.h index d3eef2e70..3e28a7ac7 100644 --- a/common/TCPServer.h +++ b/common/TCPServer.h @@ -65,7 +65,7 @@ public: vitr cur, end; cur = m_list.begin(); end = m_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { delete *cur; } } @@ -98,7 +98,7 @@ protected: } else { if (!data->Process()) data->Disconnect(); - cur++; + ++cur; } } } diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 46e058901..494139778 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -1113,7 +1113,7 @@ uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) co std::map::const_iterator cur, end; cur = m_guilds.begin(); end = m_guilds.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { pos = 64 + (64 * cur->first); strn0cpy((char *) buffer + pos, cur->second->name.c_str(), 64); } @@ -1218,7 +1218,7 @@ uint32 BaseGuildManager::FindGuildByLeader(uint32 leader) const { std::map::const_iterator cur, end; cur = m_guilds.begin(); end = m_guilds.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second->leader_char_id == leader) return(cur->first); } @@ -1297,7 +1297,7 @@ void BaseGuildManager::ClearGuilds() { std::map::iterator cur, end; cur = m_guilds.begin(); end = m_guilds.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { delete cur->second; } m_guilds.clear(); diff --git a/common/ptimer.cpp b/common/ptimer.cpp index 449b943c4..8e9f03dcf 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -294,7 +294,7 @@ PTimerList::~PTimerList() { while(s != _list.end()) { if(s->second != nullptr) delete s->second; - s++; + ++s; } } @@ -305,7 +305,7 @@ bool PTimerList::Load(Database *db) { while(s != _list.end()) { if(s->second != nullptr) delete s->second; - s++; + ++s; } _list.clear(); @@ -373,7 +373,7 @@ bool PTimerList::Store(Database *db) { if(!s->second->Store(db)) res = false; } - s++; + ++s; } return(res); } @@ -474,7 +474,7 @@ void PTimerList::ToVector(std::vector< std::pair p.second = s->second; out.push_back(p); } - s++; + ++s; } } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index f8a05e2cc..e047b761d 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -150,7 +150,7 @@ bool ret=true; char* query = 0; // Delete cursor items if ((ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND ( (slotid >=8000 and slotid<=8999) or slotid=30 or (slotid>=331 and slotid<=340))", char_id), errbuf))) { - for(it=start,i=8000;it!=end;it++,i++) { + for(it=start,i=8000;it!=end;++it,i++) { ItemInst *inst=*it; if (!(ret=SaveInventory(char_id,inst,(i==8000) ? 30 : i))) break; diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 5874fd3d8..ca436b093 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -39,7 +39,7 @@ void TimeoutManager::CheckTimeouts() { std::vector::iterator cur,end; cur = members.begin(); end = members.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG @@ -69,7 +69,7 @@ void TimeoutManager::DeleteMember(Timeoutable *who) { std::vector::iterator cur,end; cur = members.begin(); end = members.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(*cur == who) { members.erase(cur); return; diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index d0239e4e7..dafceaf30 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) { */ zone = zones.begin(); zend = zones.end(); - for(; zone != zend; zone++) { + for(; zone != zend; ++zone) { if(!zone->second->Process()) to_remove.insert(zone->first); } @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) { //try to be semi-nice about this... without waiting too long zone = zones.begin(); zend = zones.end(); - for(; zone != zend; zone++) { + for(; zone != zend; ++zone) { zone->second->Stop(); } Sleep(1); @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) { launch->Process(); //kill anybody left launch->TerminateAll(true); - for(; zone != zend; zone++) { + for(; zone != zend; ++zone) { delete zone->second; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 6588e1095..c6e44fccd 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -49,7 +49,7 @@ void WorldServer::OnConnected() { std::map::iterator cur, end; cur = m_zones.begin(); end = m_zones.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { cur->second->SendStatus(); } } diff --git a/loginserver/ClientManager.cpp b/loginserver/ClientManager.cpp index 06b44aaf4..cbf720f27 100644 --- a/loginserver/ClientManager.cpp +++ b/loginserver/ClientManager.cpp @@ -131,7 +131,7 @@ void ClientManager::Process() } else { - iter++; + ++iter; } } } @@ -150,7 +150,7 @@ void ClientManager::ProcessDisconnect() } else { - iter++; + ++iter; } } } @@ -161,7 +161,7 @@ void ClientManager::UpdateServerList() while(iter != clients.end()) { (*iter)->SendServerListPacket(); - iter++; + ++iter; } } @@ -178,7 +178,7 @@ void ClientManager::RemoveExistingClient(unsigned int account_id) } else { - iter++; + ++iter; } } } @@ -195,7 +195,7 @@ Client *ClientManager::GetClient(unsigned int account_id) cur = (*iter); count++; } - iter++; + ++iter; } if(count > 1) diff --git a/loginserver/Config.cpp b/loginserver/Config.cpp index 338378bc8..44906b889 100644 --- a/loginserver/Config.cpp +++ b/loginserver/Config.cpp @@ -68,7 +68,7 @@ void Config::Parse(const char *file_name) { title.clear(); bool first = true; - iter++; + ++iter; if(iter == tokens.end()) { server_log->Log(log_error, "Config::Parse(), EOF before title done parsing."); @@ -89,9 +89,9 @@ void Config::Parse(const char *file_name) } title += (*iter); - iter++; + ++iter; } - iter++; + ++iter; } if(mode == 0) @@ -127,7 +127,7 @@ void Config::Parse(const char *file_name) vars[title] = var_map; } } - iter++; + ++iter; } fclose(input); } diff --git a/loginserver/ServerManager.cpp b/loginserver/ServerManager.cpp index 042963c43..baa21aae2 100644 --- a/loginserver/ServerManager.cpp +++ b/loginserver/ServerManager.cpp @@ -87,7 +87,7 @@ void ServerManager::Process() } else { - iter++; + ++iter; } } } @@ -109,7 +109,7 @@ void ServerManager::ProcessDisconnect() } else { - iter++; + ++iter; } } } @@ -123,7 +123,7 @@ WorldServer* ServerManager::GetServerByAddress(unsigned int address) { return (*iter); } - iter++; + ++iter; } return nullptr; @@ -142,7 +142,7 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c) { if((*iter)->IsAuthorized() == false) { - iter++; + ++iter; continue; } @@ -163,7 +163,7 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c) } server_count++; - iter++; + ++iter; } EQApplicationPacket *outapp = new EQApplicationPacket(OP_ServerListResponse, packet_size); @@ -186,7 +186,7 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c) { if((*iter)->IsAuthorized() == false) { - iter++; + ++iter; continue; } @@ -260,7 +260,7 @@ EQApplicationPacket *ServerManager::CreateServerListPacket(Client *c) *(uint32*)data_ptr = (*iter)->GetPlayersOnline(); data_ptr += 4; - iter++; + ++iter; } return outapp; @@ -287,7 +287,7 @@ void ServerManager::SendUserToWorldRequest(unsigned int server_id, unsigned int } delete outapp; } - iter++; + ++iter; } if(!found && server.options.IsTraceOn()) @@ -303,7 +303,7 @@ bool ServerManager::ServerExists(string l_name, string s_name, WorldServer *igno { if((*iter) == ignore) { - iter++; + ++iter; continue; } @@ -312,7 +312,7 @@ bool ServerManager::ServerExists(string l_name, string s_name, WorldServer *igno return true; } - iter++; + ++iter; } return false; } @@ -324,7 +324,7 @@ void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServe { if((*iter) == ignore) { - iter++; + ++iter; } if((*iter)->GetLongName().compare(l_name) == 0 && (*iter)->GetShortName().compare(s_name) == 0) @@ -339,7 +339,7 @@ void ServerManager::DestroyServerByName(string l_name, string s_name, WorldServe iter = world_servers.erase(iter); } - iter++; + ++iter; } } diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index a5a6351be..a33ad65db 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -314,7 +314,7 @@ void ChatChannel::SendOPList(Client *c) { std::list::iterator Iterator; - for(Iterator = Moderators.begin(); Iterator != Moderators.end(); Iterator++) + for(Iterator = Moderators.begin(); Iterator != Moderators.end(); ++Iterator) c->GeneralChannelMessage((*Iterator)); } @@ -580,7 +580,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { std::list::iterator Iterator; - for(Iterator = Invitees.begin(); Iterator != Invitees.end(); Iterator++) { + for(Iterator = Invitees.begin(); Iterator != Invitees.end(); ++Iterator) { if((*Iterator) == Invitee) { @@ -597,7 +597,7 @@ bool ChatChannel::IsInvitee(std::string Invitee) { std::list::iterator Iterator; - for(Iterator = Invitees.begin(); Iterator != Invitees.end(); Iterator++) { + for(Iterator = Invitees.begin(); Iterator != Invitees.end(); ++Iterator) { if((*Iterator) == Invitee) return true; @@ -621,7 +621,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { std::list::iterator Iterator; - for(Iterator = Moderators.begin(); Iterator != Moderators.end(); Iterator++) { + for(Iterator = Moderators.begin(); Iterator != Moderators.end(); ++Iterator) { if((*Iterator) == Moderator) { @@ -638,7 +638,7 @@ bool ChatChannel::IsModerator(std::string Moderator) { std::list::iterator Iterator; - for(Iterator = Moderators.begin(); Iterator != Moderators.end(); Iterator++) { + for(Iterator = Moderators.begin(); Iterator != Moderators.end(); ++Iterator) { if((*Iterator) == Moderator) return true; @@ -662,7 +662,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { std::list::iterator Iterator; - for(Iterator = Voiced.begin(); Iterator != Voiced.end(); Iterator++) { + for(Iterator = Voiced.begin(); Iterator != Voiced.end(); ++Iterator) { if((*Iterator) == inVoiced) { @@ -679,7 +679,7 @@ bool ChatChannel::HasVoice(std::string inVoiced) { std::list::iterator Iterator; - for(Iterator = Voiced.begin(); Iterator != Voiced.end(); Iterator++) { + for(Iterator = Voiced.begin(); Iterator != Voiced.end(); ++Iterator) { if((*Iterator) == inVoiced) return true; diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index d8e31e8b2..c2b887ff0 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -190,11 +190,11 @@ std::vector ParseRecipients(std::string RecipientString) { (*Iterator) = Secret + (*Iterator); - Iterator++; + ++Iterator; } - for(Iterator = RecipientList.begin(); Iterator != RecipientList.end(); Iterator++) { + for(Iterator = RecipientList.begin(); Iterator != RecipientList.end(); ++Iterator) { if((*Iterator).length() > 0) { @@ -554,7 +554,7 @@ void Clientlist::CheckForStaleConnections(Client *c) { std::list::iterator Iterator; - for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) { + for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { @@ -596,7 +596,7 @@ void Clientlist::Process() { std::list::iterator Iterator; - for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) { + for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { (*Iterator)->AccountUpdate(); if((*Iterator)->ClientStream->CheckClosed()) { @@ -893,7 +893,7 @@ void Clientlist::CloseAllConnections() { std::list::iterator Iterator; - for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) { + for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { _log(UCS__TRACE, "Removing client %s", (*Iterator)->GetName().c_str()); @@ -953,7 +953,7 @@ Client *Clientlist::FindCharacter(std::string CharacterName) { std::list::iterator Iterator; - for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) { + for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { if((*Iterator)->GetName() == CharacterName) return ((*Iterator)); @@ -2243,7 +2243,7 @@ Client *Clientlist::IsCharacterOnline(std::string CharacterName) { // std::list::iterator Iterator; - for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) { + for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { if(!(*Iterator)->IsMailConnection()) continue; @@ -2352,7 +2352,7 @@ void Client::SendFriends() { safe_delete(outapp); - Iterator++; + ++Iterator; } Iterator = Ignorees.begin(); @@ -2375,7 +2375,7 @@ void Client::SendFriends() { safe_delete(outapp); - Iterator++; + ++Iterator; } } diff --git a/world/Adventure.cpp b/world/Adventure.cpp index d44b84d0e..83fd8fa2f 100644 --- a/world/Adventure.cpp +++ b/world/Adventure.cpp @@ -74,7 +74,7 @@ void Adventure::RemovePlayer(std::string character_name) players.erase(iter); return; } - iter++; + ++iter; } } @@ -87,7 +87,7 @@ bool Adventure::PlayerExists(std::string character_name) { return true; } - iter++; + ++iter; } return false; } @@ -214,7 +214,7 @@ void Adventure::SetStatus(AdventureStatus new_status) while(iter != players.end()) { adventure_manager.GetAdventureData((*iter).c_str()); - iter++; + ++iter; } } @@ -233,7 +233,7 @@ void Adventure::SendAdventureMessage(uint32 type, const char *msg) strcpy(sms->to, (*iter).c_str()); zoneserver_list.SendPacket(current->zone(), current->instance(), pack); } - iter++; + ++iter; } delete pack; } @@ -360,7 +360,7 @@ void Adventure::Finished(AdventureWinStatus ws) adventure_manager.AddFinishedEvent(afe); database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false); } - iter++; + ++iter; } adventure_manager.GetAdventureData(this); } @@ -411,7 +411,7 @@ void Adventure::MoveCorpsesToGraveyard() LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query, errbuf); safe_delete_array(query); } - iter++; + ++iter; } iter = dbid_list.begin(); @@ -433,8 +433,8 @@ void Adventure::MoveCorpsesToGraveyard() zoneserver_list.SendPacket(spc->zone_id, 0, pack); delete pack; - iter++; - c_iter++; + ++iter; + ++c_iter; } } diff --git a/world/AdventureManager.cpp b/world/AdventureManager.cpp index 44ff5bf94..4ce2fbc53 100644 --- a/world/AdventureManager.cpp +++ b/world/AdventureManager.cpp @@ -48,7 +48,7 @@ void AdventureManager::Process() delete adv; continue; } - iter++; + ++iter; } } @@ -118,7 +118,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } } } - iter++; + ++iter; } /** @@ -171,7 +171,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) ea_iter = eligible_adventures.erase(ea_iter); continue; } - ea_iter++; + ++ea_iter; } /** @@ -281,9 +281,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) ea_iter = eligible_adventures.erase(ea_iter); continue; } - ea_iter++; + ++ea_iter; } - ez_iter++; + ++ez_iter; } std::list::iterator ezi_iter = excluded_zone_ins.begin(); @@ -297,9 +297,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) ea_iter = eligible_adventures.erase(ea_iter); continue; } - ea_iter++; + ++ea_iter; } - ezi_iter++; + ++ezi_iter; } /** @@ -319,7 +319,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) ea_iter = eligible_adventures.erase(ea_iter); continue; } - ea_iter++; + ++ea_iter; } if(eligible_adventures.size() > 0) @@ -328,7 +328,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) int c_index = MakeRandomInt(0, (eligible_adventures.size()-1)); for(int i = 0; i < c_index; ++i) { - ea_iter++; + ++ea_iter; } ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestAccept, sizeof(ServerAdventureRequestAccept_Struct) + (sar->member_count * 64)); ServerAdventureRequestAccept_Struct *sra = (ServerAdventureRequestAccept_Struct*)pack->pBuffer; @@ -457,7 +457,7 @@ void AdventureManager::GetAdventureData(Adventure *adv) while(iter != player_list.end()) { GetAdventureData((*iter).c_str()); - iter++; + ++iter; } } @@ -537,7 +537,7 @@ bool AdventureManager::IsInExcludedZoneList(std::list excluded_z { return true; } - iter++; + ++iter; } return false; } @@ -551,7 +551,7 @@ bool AdventureManager::IsInExcludedZoneInList(std::list exclude { return true; } - iter++; + ++iter; } return false; } @@ -587,7 +587,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou count++; } } - iter++; + ++iter; } return ret; } @@ -601,7 +601,7 @@ Adventure *AdventureManager::GetActiveAdventure(const char *player) { return (*iter); } - iter++; + ++iter; } return nullptr; } @@ -621,7 +621,7 @@ AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id) { return (*l_iter); } - l_iter++; + ++l_iter; } return nullptr; } @@ -788,7 +788,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do return; } } - iter++; + ++iter; } ClientListEntry *pc = client_list.FindCharacter(player); @@ -855,7 +855,7 @@ void AdventureManager::IncrementCount(uint16 instance_id) current = (*iter); break; } - iter++; + ++iter; } if(current) @@ -877,7 +877,7 @@ void AdventureManager::IncrementCount(uint16 instance_id) strcpy(ac->player, (*siter).c_str()); zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack); } - siter++; + ++siter; } delete pack; @@ -895,7 +895,7 @@ void AdventureManager::IncrementAssassinationCount(uint16 instance_id) current = (*iter); break; } - iter++; + ++iter; } if(current) @@ -916,7 +916,7 @@ void AdventureManager::GetZoneData(uint16 instance_id) current = (*iter); break; } - iter++; + ++iter; } if(current) @@ -1302,7 +1302,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player) al->entries[i].failure = li.losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_wins.end()) @@ -1318,7 +1318,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1369,7 +1369,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player) al->entries[i].failure = li.losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_percentage.end()) @@ -1385,7 +1385,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1436,7 +1436,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player) al->entries[i].failure = li.guk_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_wins_guk.end()) @@ -1452,7 +1452,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1503,7 +1503,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player) al->entries[i].failure = li.guk_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_percentage_guk.end()) @@ -1519,7 +1519,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1570,7 +1570,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player) al->entries[i].failure = li.mir_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_wins_mir.end()) @@ -1586,7 +1586,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1637,7 +1637,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player) al->entries[i].failure = li.mir_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_percentage_mir.end()) @@ -1653,7 +1653,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1704,7 +1704,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player) al->entries[i].failure = li.mmc_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_wins_mmc.end()) @@ -1720,7 +1720,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1771,7 +1771,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player) al->entries[i].failure = li.mmc_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_percentage_mmc.end()) @@ -1787,7 +1787,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1838,7 +1838,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player) al->entries[i].failure = li.ruj_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_wins_ruj.end()) @@ -1854,7 +1854,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1905,7 +1905,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player) al->entries[i].failure = li.ruj_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_percentage_ruj.end()) @@ -1921,7 +1921,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player) break; } i++; - iter++; + ++iter; } } @@ -1972,7 +1972,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player) al->entries[i].failure = li.tak_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_wins_ruj.end()) @@ -1988,7 +1988,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player) break; } i++; - iter++; + ++iter; } } @@ -2039,7 +2039,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player) al->entries[i].failure = li.tak_losses; strcpy(al->entries[i].name, li.name.c_str()); i++; - iter++; + ++iter; } if(place == -1 && iter != leaderboard_info_percentage_tak.end()) @@ -2055,7 +2055,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player) break; } i++; - iter++; + ++iter; } } @@ -2093,7 +2093,7 @@ bool AdventureManager::PopFinishedEvent(const char *name, AdventureFinishEvent & Save(); return true; } - iter++; + ++iter; } return false; } diff --git a/world/EQLConfig.cpp b/world/EQLConfig.cpp index de5ed5753..90955a620 100644 --- a/world/EQLConfig.cpp +++ b/world/EQLConfig.cpp @@ -99,7 +99,7 @@ void EQLConfig::GetZones(std::vector &result) { std::map::iterator cur, end; cur = m_zones.begin(); end = m_zones.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { result.push_back(cur->second); } } @@ -112,7 +112,7 @@ std::vector EQLConfig::ListZones() { std::map::iterator cur, end; cur = m_zones.begin(); end = m_zones.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { res.push_back(cur->first); } } else { diff --git a/world/EQW.cpp b/world/EQW.cpp index 0e41f9e64..02196e49c 100644 --- a/world/EQW.cpp +++ b/world/EQW.cpp @@ -120,7 +120,7 @@ std::vector EQW::ListBootedZones() { std::vector::iterator cur, end; cur = zones.begin(); end = zones.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { res.push_back(itoa(*cur)); } @@ -170,7 +170,7 @@ std::vector EQW::ListPlayers(Const_char *zone_name) { std::vector::iterator cur, end; cur = list.begin(); end = list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { res.push_back((*cur)->name()); } return(res); diff --git a/world/LauncherLink.cpp b/world/LauncherLink.cpp index ddb634456..00d93da35 100644 --- a/world/LauncherLink.cpp +++ b/world/LauncherLink.cpp @@ -58,7 +58,7 @@ bool LauncherLink::Process() { std::map::iterator cur, end; cur = m_states.begin(); end = m_states.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(!cur->second.up) { StartZone(cur->first.c_str()); } diff --git a/world/LauncherList.cpp b/world/LauncherList.cpp index b939273c7..f22476343 100644 --- a/world/LauncherList.cpp +++ b/world/LauncherList.cpp @@ -32,28 +32,28 @@ LauncherList::~LauncherList() { std::vector::iterator cur, end; cur = m_pendingLaunchers.begin(); end = m_pendingLaunchers.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { delete *cur; } std::map::iterator curc, endc; curc = m_configs.begin(); endc = m_configs.end(); - for(; curc != endc; curc++) { + for(; curc != endc; ++curc) { delete curc->second; } std::map::iterator curl, endl; curl = m_launchers.begin(); endl = m_launchers.end(); - for(; curl != endl; curl++) { + for(; curl != endl; ++curl) { delete curl->second; } } void LauncherList::Process() { //process pending launchers.. - std::vector::iterator cur, end; + std::vector::iterator cur; cur = m_pendingLaunchers.begin(); while(cur != m_pendingLaunchers.end()) { LauncherLink *l = *cur; @@ -79,12 +79,12 @@ void LauncherList::Process() { //put the launcher in the list. m_launchers[name] = l; } else { - cur++; + ++cur; } } //process active launchers. - std::map::iterator curl, tmp; + std::map::iterator curl; curl = m_launchers.begin(); while(curl != m_launchers.end()) { LauncherLink *l = curl->second; @@ -92,12 +92,10 @@ void LauncherList::Process() { if(!l->Process()) { //launcher has died before it identified itself. _log(WORLD__LAUNCH, "Removing launcher %s (%d)", l->GetName(), l->GetID()); - tmp = curl; - curl++; - m_launchers.erase(tmp); + curl = m_launchers.erase(curl); delete l; } else { - curl++; + ++curl; } } } @@ -124,7 +122,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { std::map::iterator cur, end; cur = m_launchers.begin(); end = m_launchers.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second->ContainsZone(short_name)) return(cur->second); } @@ -146,7 +144,7 @@ void LauncherList::GetLauncherNameList(std::vector &res) { std::map::iterator cur, end; cur = m_configs.begin(); end = m_configs.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { res.push_back(cur->first); } } @@ -159,7 +157,7 @@ void LauncherList::LoadList() { std::vector::iterator cur, end; cur = launchers.begin(); end = launchers.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { m_configs[*cur] = new EQLConfig(cur->c_str()); } } diff --git a/zone/AA.cpp b/zone/AA.cpp index 3e692602d..87463247b 100644 --- a/zone/AA.cpp +++ b/zone/AA.cpp @@ -1103,7 +1103,7 @@ void Client::SendAATimers() { PTimerList::iterator c,e; c = p_timers.begin(); e = p_timers.end(); - for(; c != e; c++) { + for(; c != e; ++c) { PersistentTimer *cur = c->second; if(cur->GetType() < pTimerAAStart || cur->GetType() > pTimerAAEnd) continue; //not an AA timer @@ -1510,7 +1510,7 @@ void Client::ResetAA(){ aa[i]->value = 0; } std::map::iterator itr; - for(itr=aa_points.begin();itr!=aa_points.end();itr++) + for(itr=aa_points.begin();itr!=aa_points.end();++itr) aa_points[itr->first] = 0; for(int i = 0; i < _maxLeaderAA; ++i) diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index 24c7bd828..3852ae350 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -935,25 +935,25 @@ void Client::AI_Process() { if(AIfeignremember_timer->Check()) { std::set::iterator RememberedCharID, tmp; - RememberedCharID=feign_memory_list.begin(); + RememberedCharID = feign_memory_list.begin(); bool got_one = false; - while(RememberedCharID != feign_memory_list.end()) { + while (RememberedCharID != feign_memory_list.end()) { Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); - if(remember_client == nullptr) { + if (remember_client == nullptr) { //they are gone now... tmp = RememberedCharID; - RememberedCharID++; + ++RememberedCharID; feign_memory_list.erase(tmp); } else if (!remember_client->GetFeigned()) { AddToHateList(remember_client->CastToMob(),1); tmp = RememberedCharID; - RememberedCharID++; + ++RememberedCharID; feign_memory_list.erase(tmp); got_one = true; break; } else { //they are still feigned, carry on... - RememberedCharID++; + ++RememberedCharID; } } } @@ -1406,25 +1406,25 @@ void Mob::AI_Process() { // Improved Feign Death Memory // check to see if any of our previous feigned targets have gotten up. std::set::iterator RememberedCharID, tmp; - RememberedCharID=feign_memory_list.begin(); + RememberedCharID = feign_memory_list.begin(); bool got_one = false; - while(RememberedCharID != feign_memory_list.end()) { + while (RememberedCharID != feign_memory_list.end()) { Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); - if(remember_client == nullptr) { + if (remember_client == nullptr) { //they are gone now... tmp = RememberedCharID; - RememberedCharID++; + ++RememberedCharID; feign_memory_list.erase(tmp); } else if (!remember_client->GetFeigned()) { AddToHateList(remember_client->CastToMob(),1); tmp = RememberedCharID; - RememberedCharID++; + ++RememberedCharID; feign_memory_list.erase(tmp); got_one = true; break; } else { //they are still feigned, carry on... - RememberedCharID++; + ++RememberedCharID; } } } @@ -2406,7 +2406,7 @@ void NPC::RemoveSpellFromNPCList(int16 spell_id) iter = AIspells.erase(iter); continue; } - iter++; + ++iter; } } diff --git a/zone/QuestParserCollection.cpp b/zone/QuestParserCollection.cpp index efa9985a5..06e191b49 100644 --- a/zone/QuestParserCollection.cpp +++ b/zone/QuestParserCollection.cpp @@ -50,7 +50,7 @@ void QuestParserCollection::AddVar(std::string name, std::string val) { std::list::iterator iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { (*iter)->AddVar(name, val); - iter++; + ++iter; } } @@ -58,7 +58,7 @@ void QuestParserCollection::Init() { std::list::iterator iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { (*iter)->Init(); - iter++; + ++iter; } } @@ -78,7 +78,7 @@ void QuestParserCollection::ReloadQuests(bool reset_timers) { std::list::iterator iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { (*iter)->ReloadQuests(); - iter++; + ++iter; } } @@ -469,7 +469,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string return (*iter); } - iter++; + ++iter; } //second look for /quests/zone/npcname.ext (precedence) @@ -503,7 +503,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string return (*iter); } - iter++; + ++iter; } //third look for /quests/global/npcid.ext (precedence) @@ -524,7 +524,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string return (*iter); } - iter++; + ++iter; } //fourth look for /quests/global/npcname.ext (precedence) @@ -545,7 +545,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string return (*iter); } - iter++; + ++iter; } //fifth look for /quests/zone/default.ext (precedence) @@ -566,7 +566,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string return (*iter); } - iter++; + ++iter; } //last look for /quests/global/default.ext (precedence) @@ -587,7 +587,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string return (*iter); } - iter++; + ++iter; } return nullptr; @@ -620,8 +620,8 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename) return (*iter); } - iter++; - } + ++iter; + } //second look for /quests/zone/player.ext (precedence) filename = "quests/"; @@ -642,7 +642,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename) return (*iter); } - iter++; + ++iter; } //third look for /quests/global/player.ext (precedence) @@ -663,7 +663,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename) return (*iter); } - iter++; + ++iter; } return nullptr; @@ -691,7 +691,7 @@ QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filena return (*iter); } - iter++; + ++iter; } return nullptr; @@ -719,7 +719,7 @@ QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &fil return (*iter); } - iter++; + ++iter; } return nullptr; @@ -747,7 +747,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s return (*iter); } - iter++; + ++iter; } //second look for /quests/global/spells/spell_id.ext (precedence) @@ -769,7 +769,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s return (*iter); } - iter++; + ++iter; } //third look for /quests/zone/spells/default.ext (precedence) @@ -790,7 +790,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s return (*iter); } - iter++; + ++iter; } //last look for /quests/global/spells/default.ext (precedence) @@ -811,7 +811,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s return (*iter); } - iter++; + ++iter; } return nullptr; @@ -839,7 +839,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, return (*iter); } - iter++; + ++iter; } //second look for /quests/global/items/item_script.ext (precedence) @@ -861,7 +861,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, return (*iter); } - iter++; + ++iter; } //third look for /quests/zone/items/default.ext (precedence) @@ -882,7 +882,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, return (*iter); } - iter++; + ++iter; } //last look for /quests/global/items/default.ext (precedence) @@ -903,7 +903,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, return (*iter); } - iter++; + ++iter; } return nullptr; diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 5215e1706..5f4daea98 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -189,7 +189,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) { cur = faction_list.begin(); end = faction_list.end(); bool res = false; - for(; cur != end; cur++) { + for(; cur != end; ++cur) { struct NPCFaction* fac = *cur; if ((int32)fac->factionID == mob_primary) { if (fac->npc_value > 0) { diff --git a/zone/bot.cpp b/zone/bot.cpp index 3f9ce45ac..a87dd5878 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4774,7 +4774,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) { std::list ActiveBots = Bot::GetGroupedBotsByGroupId(botOwner->GetGroup()->GetID(), &errorMessage); if(errorMessage.empty() && !ActiveBots.empty()) { - for(std::list::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); itr++) { + for(std::list::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); ++itr) { Bot* activeBot = Bot::LoadBot(*itr, &errorMessage); if(!errorMessage.empty()) { @@ -8812,7 +8812,7 @@ void Bot::BotOrderCampAll(Client* c) { if(c) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { (*botListItr)->Camp(); } } @@ -11196,7 +11196,7 @@ Bot* Bot::GetBotByBotClientOwnerAndBotName(Client* c, std::string botName) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); if(!BotList.empty()) { - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { if(std::string((*botListItr)->GetCleanName()) == botName) { Result = (*botListItr); break; @@ -11255,7 +11255,7 @@ void Bot::ProcessClientZoneChange(Client* botOwner) { if(botOwner) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CharacterID()); - for(std::list::iterator itr = BotList.begin(); itr != BotList.end(); itr++) { + for(std::list::iterator itr = BotList.begin(); itr != BotList.end(); ++itr) { Bot* tempBot = *itr; if(tempBot) { @@ -11960,7 +11960,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } if(!AvailableBots.empty()) { - for(std::list::iterator TempAvailableBotsList = AvailableBots.begin(); TempAvailableBotsList != AvailableBots.end(); TempAvailableBotsList++) { + for(std::list::iterator TempAvailableBotsList = AvailableBots.begin(); TempAvailableBotsList != AvailableBots.end(); ++TempAvailableBotsList) { if(!listAll && TempAvailableBotsList->BotClass != iClass) continue; @@ -12004,7 +12004,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { std::list spawnedBots = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); if(!spawnedBots.empty()) { - for(std::list::iterator botsListItr = spawnedBots.begin(); botsListItr != spawnedBots.end(); botsListItr++) { + for(std::list::iterator botsListItr = spawnedBots.begin(); botsListItr != spawnedBots.end(); ++botsListItr) { Bot* tempBot = *botsListItr; if(tempBot) { if(tempBot->GetClass() != WARRIOR && tempBot->GetClass() != MONK && tempBot->GetClass() != BARD && tempBot->GetClass() != BERSERKER && tempBot->GetClass() != ROGUE) @@ -14719,7 +14719,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } if(!botGroupList.empty()) { - for(std::list::iterator botGroupListItr = botGroupList.begin(); botGroupListItr != botGroupList.end(); botGroupListItr++) { + for(std::list::iterator botGroupListItr = botGroupList.begin(); botGroupListItr != botGroupList.end(); ++botGroupListItr) { c->Message(0, "Bot Group Name: %s -- Bot Group Leader: %s", botGroupListItr->BotGroupName.c_str(), botGroupListItr->BotGroupLeaderName.c_str()); } } @@ -14859,7 +14859,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } std::list::iterator botGroupItr = botGroup.begin(); - for(botGroupItr; botGroupItr != botGroup.end(); botGroupItr++) { + for(botGroupItr; botGroupItr != botGroup.end(); ++botGroupItr) { // Don't try to re-spawn the botgroup's leader. if(botGroupItr->BotID == botGroupLeader->GetBotID()) { continue; } @@ -15195,7 +15195,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { std::list spawnedBots = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); if(!spawnedBots.empty()) { - for(std::list::iterator botsListItr = spawnedBots.begin(); botsListItr != spawnedBots.end(); botsListItr++) { + for(std::list::iterator botsListItr = spawnedBots.begin(); botsListItr != spawnedBots.end(); ++botsListItr) { Bot* tempBot = *botsListItr; if(tempBot) { tempBot->SetGroupMessagesOn(groupMessages); @@ -15545,7 +15545,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { return; } - Mob* target; + Mob* target = nullptr; std::string targetName = std::string(sep->arg[4]); if(!targetName.empty()) @@ -15635,7 +15635,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(!strcasecmp(sep->arg[3], "all")) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { Bot* leaderBot = *botListItr; if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) { //start all heal rotations @@ -15644,7 +15644,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { rotationMemberList = GetBotsInHealRotation(leaderBot); - for(std::list::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) { + for(std::list::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); ++rotationMemberItr) { Bot* tempBot = *rotationMemberItr; if(tempBot) { @@ -15681,7 +15681,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { botList = GetBotsInHealRotation(leaderBot); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot) { @@ -15712,7 +15712,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(!strcasecmp(sep->arg[3], "all")) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { Bot* leaderBot = *botListItr; if(leaderBot->GetInHealRotation() && leaderBot->GetHealRotationLeader() == leaderBot) { //start all heal rotations @@ -15720,7 +15720,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { rotationMemberList = GetBotsInHealRotation(leaderBot); - for(std::list::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); rotationMemberItr++) { + for(std::list::iterator rotationMemberItr = rotationMemberList.begin(); rotationMemberItr != rotationMemberList.end(); ++rotationMemberItr) { Bot* tempBot = *rotationMemberItr; if(tempBot) { @@ -15753,7 +15753,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { botList = GetBotsInHealRotation(leaderBot); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) { @@ -15785,7 +15785,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(!strcasecmp(sep->arg[3], "all")) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot->GetInHealRotation() && tempBot->GetHealRotationLeader() == tempBot) { //list leaders and number of bots per rotation @@ -15816,7 +15816,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { c->Message(0, "Bot Heal Rotation- Leader: %s", leaderBot->GetCleanName()); c->Message(0, "Bot Heal Rotation- Timer: %1.1f", ((float)leaderBot->GetHealRotationTimer()/1000.0f)); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) { @@ -15874,7 +15874,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { botList = GetBotsInHealRotation(leaderBot); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) @@ -15922,7 +15922,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { botList = GetBotsInHealRotation(leaderBot); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot->GetBotOwnerCharacterID() == c->CharacterID()) @@ -16238,7 +16238,7 @@ Bot* EntityList::GetBotByBotID(uint32 botID) { Bot* Result = 0; if(botID > 0) { - for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) { + for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot->GetBotID() == botID) { @@ -16255,7 +16255,7 @@ Bot* EntityList::GetBotByBotName(std::string botName) { Bot* Result = 0; if(!botName.empty()) { - for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) { + for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && std::string(tempBot->GetName()) == botName) { @@ -16303,7 +16303,7 @@ std::list EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacte std::list Result; if(botOwnerCharacterID > 0) { - for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) { + for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot->GetBotOwnerCharacterID() == botOwnerCharacterID) @@ -16366,7 +16366,7 @@ bool EntityList::RemoveBot(uint16 entityID) { bool Result = false; if(entityID > 0) { - for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); botListItr++) + for(std::list::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) { Bot* tempBot = *botListItr; @@ -16920,7 +16920,7 @@ bool Bot::AddHealRotationMember( Bot* healer ) { std::list botList = GetBotsInHealRotation(this); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot) @@ -16968,7 +16968,7 @@ bool Bot::RemoveHealRotationMember( Bot* healer ) { //update rotation data std::list botList = GetBotsInHealRotation(leader); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot) { @@ -17043,7 +17043,7 @@ bool Bot::AddHealRotationTarget( Mob* target ) { _healRotationTargets[i] = target->GetID(); - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot && tempBot != this) { @@ -17081,7 +17081,7 @@ bool Bot::RemoveHealRotationTarget( Mob* target ) { index = i; removed = true; - for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); botListItr++) { + for(std::list::iterator botListItr = botList.begin(); botListItr != botList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot) @@ -17220,7 +17220,7 @@ void Bot::BotHealRotationsClear(Client* c) { if(c) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(c->CharacterID()); - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot->GetInHealRotation()) { //clear all heal rotation data for bots in a heal rotation diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index bd2a5ad34..14f243d19 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -301,7 +301,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { if (tar->DontBuffMeBefore() < Timer::GetCurrentTime()) { std::list buffSpellList = GetBotSpellsBySpellType(this, SpellType_Buff); - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); itr++) { + for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { BotSpell selectedBotSpell = *itr; if(selectedBotSpell.SpellId == 0) @@ -560,7 +560,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { std::list inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff); - for(std::list::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); itr++) { + for(std::list::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); ++itr) { BotSpell selectedBotSpell = *itr; if(selectedBotSpell.SpellId == 0) @@ -588,7 +588,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { if (tar->DontBuffMeBefore() < Timer::GetCurrentTime()) { std::list inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff); - for(std::list::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); itr++) { + for(std::list::iterator itr = inCombatBuffList.begin(); itr != inCombatBuffList.end(); ++itr) { BotSpell selectedBotSpell = *itr; if(selectedBotSpell.SpellId == 0) @@ -727,7 +727,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { const int maxDotSelect = 5; int dotSelectCounter = 0; - for(std::list::iterator itr = dotList.begin(); itr != dotList.end(); itr++) { + for(std::list::iterator itr = dotList.begin(); itr != dotList.end(); ++itr) { BotSpell selectedBotSpell = *itr; if(selectedBotSpell.SpellId == 0) @@ -1450,7 +1450,7 @@ BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsFastHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1476,7 +1476,7 @@ BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster) { std::list botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime); std::vector botSpellList = botCaster->GetBotSpells(); - for(std::list::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsHealOverTimeSpell(botSpellListItr->SpellId)) { @@ -1542,7 +1542,7 @@ BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularSingleTargetHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1567,7 +1567,7 @@ BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((IsRegularSingleTargetHealSpell(botSpellListItr->SpellId) || IsFastHealSpell(botSpellListItr->SpellId)) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1592,7 +1592,7 @@ BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1618,7 +1618,7 @@ BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster) { std::list botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime); std::vector botSpellList = botCaster->GetBotSpells(); - for(std::list::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) { @@ -1654,7 +1654,7 @@ BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1679,7 +1679,7 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_Mez); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsMezSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1704,7 +1704,7 @@ BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_AttackSpeed); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsSlowSpell(botSpellListItr->SpellId) && spells[botSpellListItr->SpellId].resisttype == RESIST_MAGIC && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1729,7 +1729,7 @@ BotSpell Bot::GetBestBotSpellForDiseaseBasedSlow(Bot* botCaster) { if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_AttackSpeed); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsSlowSpell(botSpellListItr->SpellId) && spells[botSpellListItr->SpellId].resisttype == RESIST_DISEASE && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1752,7 +1752,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) { + for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; if(npc->DistNoRootNoZ(*botCaster) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) { @@ -1792,7 +1792,7 @@ BotSpell Bot::GetBestBotMagicianPetSpell(Bot *botCaster) { std::string petType = GetBotMagicianPetType(botCaster); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsSummonPetSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { if(!strncmp(spells[botSpellListItr->SpellId].teleport_zone, petType.c_str(), petType.length())) { @@ -1901,7 +1901,7 @@ BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType if(botCaster) { std::list botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, SE_CurrentHP, targetType); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(botSpellListItr->SpellId) && IsDamageSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) { result.SpellId = botSpellListItr->SpellId; @@ -1928,7 +1928,7 @@ BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType { std::list botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, SE_Stun, targetType); - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsStunSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) @@ -1967,7 +1967,7 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ firstWizardMagicNukeSpellFound.SpellIndex = 0; firstWizardMagicNukeSpellFound.ManaCost = 0; - for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) { + for(std::list::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); ++botSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order bool spellSelected = false; @@ -2139,7 +2139,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) { //Check for group cure first if(countNeedsCured > 2) { - for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); itr++) { + for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); ++itr) { BotSpell selectedBotSpell = *itr; if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) { @@ -2176,7 +2176,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) { //no group cure for target- try to find single target spell if(!spellSelected) { - for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); itr++) { + for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); ++itr) { BotSpell selectedBotSpell = *itr; if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) { diff --git a/zone/client.cpp b/zone/client.cpp index 97739921d..131ab260d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4748,7 +4748,7 @@ void Client::ShowSkillsWindow() Skills[SkillName[i]] = (SkillUseTypes)i; // print out all available skills - for(it = Skills.begin(); it != Skills.end(); it++) { + for(it = Skills.begin(); it != Skills.end(); ++it) { if(GetSkill(it->second) > 0 || MaxSkill(it->second) > 0) { WindowText += it->first; // line up the values @@ -5142,7 +5142,7 @@ void Client::SendRewards() { break; } - iter++; + ++iter; } if(iter != zone->VeteranRewards.end()) @@ -5232,7 +5232,7 @@ bool Client::TryReward(uint32 claim_id) { break; } - iter++; + ++iter; } if(iter == zone->VeteranRewards.end()) @@ -6606,7 +6606,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) for(std::map ::iterator iter = item_faction_bonuses.begin(); iter != item_faction_bonuses.end(); - iter++) + ++iter) { memset(&faction_buf, 0, sizeof(faction_buf)); @@ -6728,7 +6728,7 @@ void Client::SendAltCurrencies() { altc->entries[i].stack_size = 1000; } i++; - iter++; + ++iter; } FastQueuePacket(&outapp); @@ -6776,7 +6776,7 @@ void Client::SendAlternateCurrencyValues() std::list::iterator iter = zone->AlternateCurrencies.begin(); while(iter != zone->AlternateCurrencies.end()) { SendAlternateCurrencyValue((*iter).id, false); - iter++; + ++iter; } } @@ -7215,7 +7215,7 @@ void Client::SendMercPersonalInfo() mdus->MercData[i].Stances[stanceindex].StanceIndex = stanceindex; mdus->MercData[i].Stances[stanceindex].Stance = (iter->StanceID); stanceindex++; - iter++; + ++iter; } } @@ -7281,7 +7281,7 @@ void Client::SendMercPersonalInfo() mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex; mml->Mercs[i].Stances[stanceindex].Stance = (iter->StanceID); stanceindex++; - iter++; + ++iter; } } FastQueuePacket(&outapp); @@ -7898,7 +7898,7 @@ bool Client::RemoveRespawnOption(std::string option_name) opt = &(*itr); if (opt->name.compare(option_name) == 0) { - respawn_options.erase(itr); + itr = respawn_options.erase(itr); had = true; //could be more with the same name, so keep going... } diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index 66bfbf893..e51a51996 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -38,7 +38,7 @@ void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) { std::vector::iterator cur,end; cur = entries[id].begin(); end = entries[id].end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(*cur == c) { printf("%s was allready subscribed to %d\n", c->GetName(), id); return; @@ -58,7 +58,7 @@ void ClientLogs::unsubscribe(EQEMuLog::LogIDs id, Client *c) { std::vector::iterator cur,end; cur = entries[id].begin(); end = entries[id].end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(*cur == c) { entries[id].erase(cur); return; @@ -97,7 +97,7 @@ void ClientLogs::msg(EQEMuLog::LogIDs id, const char *buf) { std::vector::iterator cur,end; cur = entries[id].begin(); end = entries[id].end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(!(*cur)->InZone()) continue; (*cur)->Message(CLIENT_LOG_CHANNEL, buf); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c929a08c8..6d8715c0c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2215,7 +2215,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) const Item_Struct *item = 0; std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; - for(itr = merlist.begin();itr != merlist.end() && count<255;itr++){ + for(itr = merlist.begin();itr != merlist.end() && count<255;++itr){ const MerchantList &ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -2311,7 +2311,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; - for(itr = merlist.begin();itr != merlist.end();itr++){ + for(itr = merlist.begin();itr != merlist.end();++itr){ MerchantList ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -5505,7 +5505,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) uint32 item_id = 0; std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; - for(itr = merlist.begin();itr != merlist.end();itr++){ + for(itr = merlist.begin();itr != merlist.end();++itr){ MerchantList ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -5527,7 +5527,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) std::list tmp_merlist = zone->tmpmerchanttable[tmp->GetNPCTypeID()]; std::list::const_iterator tmp_itr; TempMerchantList ml; - for(tmp_itr = tmp_merlist.begin();tmp_itr != tmp_merlist.end();tmp_itr++){ + for(tmp_itr = tmp_merlist.begin();tmp_itr != tmp_merlist.end();++tmp_itr){ ml = *tmp_itr; if(mp->itemslot == ml.slot){ item_id = ml.item; @@ -9220,7 +9220,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) { // Send stuff on the cursor which isnt sent in bulk iter_queue it; - for (it=m_inv.cursor_begin();it!=m_inv.cursor_end();it++) { + for (it=m_inv.cursor_begin();it!=m_inv.cursor_end();++it) { // First item cursor is sent in bulk inventory packet if (it==m_inv.cursor_begin()) continue; @@ -12544,7 +12544,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app found = true; break; } - altc_iter++; + ++altc_iter; } if(!found) { @@ -12560,7 +12560,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end() && count < 255; itr++){ + for(itr = merlist.begin(); itr != merlist.end() && count < 255; ++itr){ const MerchantList &ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -12627,7 +12627,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) bool found = false; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); itr++) { + for(itr = merlist.begin(); itr != merlist.end(); ++itr) { MerchantList ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -12689,7 +12689,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) { bool found = false; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); itr++) { + for(itr = merlist.begin(); itr != merlist.end(); ++itr) { MerchantList ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -12751,7 +12751,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) { if((*iter).id == reclaim->currency_id) { item_id = (*iter).item_id; } - iter++; + ++iter; } if(item_id == 0) { @@ -12806,7 +12806,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) { bool found = false; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); itr++) { + for(itr = merlist.begin(); itr != merlist.end(); ++itr) { MerchantList ml = *itr; if(GetLevel() < ml.level_required) { continue; @@ -13498,10 +13498,10 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) int i = 0; int StanceCount = 0; - for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); mercListItr++) + for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { std::list::iterator siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); - for(siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); siter != zone->merc_stance_list[mercListItr->MercTemplateID].end(); siter++) + for(siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); siter != zone->merc_stance_list[mercListItr->MercTemplateID].end(); ++siter) { StanceCount++; } @@ -13513,7 +13513,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) mml->MercTypeCount = mercTypeCount; if(mercTypeCount > 0) { - for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); mercTypeListItr++) { + for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { mml->MercGrades[i] = mercTypeListItr->Type; // DBStringID for Type i++; } @@ -13523,7 +13523,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) if(mercCount > 0) { i = 0; - for(std::list::iterator mercListIter = mercDataList.begin(); mercListIter != mercDataList.end(); mercListIter++) + for(std::list::iterator mercListIter = mercDataList.begin(); mercListIter != mercDataList.end(); ++mercListIter) { mml->Mercs[i].MercID = mercListIter->MercTemplateID; mml->Mercs[i].MercType = mercListIter->MercType; @@ -13540,7 +13540,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) mml->Mercs[i].MercUnk02 = 1; int mercStanceCount = 0; std::list::iterator iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); - for(iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); iter != zone->merc_stance_list[mercListIter->MercTemplateID].end(); iter++) + for(iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); iter != zone->merc_stance_list[mercListIter->MercTemplateID].end(); ++iter) { mercStanceCount++; } @@ -13557,7 +13557,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex; mml->Mercs[i].Stances[stanceindex].Stance = (iter2->StanceID); stanceindex++; - iter2++; + ++iter2; } } i++; @@ -13692,7 +13692,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) std::list::iterator iter = mercStanceList.begin(); while(iter != mercStanceList.end()) { numStances++; - iter++; + ++iter; } MercTemplate* mercTemplate = zone->GetMercTemplate(GetMerc()->GetMercTemplateID()); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 4a8de6146..4bebec6db 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -904,7 +904,7 @@ void Client::BulkSendInventoryItems() { EQApplicationPacket* outapp = new EQApplicationPacket(OP_CharInventory, size); uchar* ptr = outapp->pBuffer; - for(itr = ser_items.begin(); itr != ser_items.end(); itr++){ + for(itr = ser_items.begin(); itr != ser_items.end(); ++itr){ int length = itr->second.length(); if(length > 5) { memcpy(ptr, itr->second.c_str(), length); @@ -978,7 +978,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { uint32 i=1; uint8 handychance = 0; - for(itr = merlist.begin();itr != merlist.end() && i origtmp_merlist = zone->tmpmerchanttable[npcid]; tmp_merlist.clear(); - for(tmp_itr = origtmp_merlist.begin();tmp_itr != origtmp_merlist.end() && i command_settings; std::map::iterator itr; database.GetCommandSettings(command_settings); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; @@ -526,7 +526,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::map::iterator cur,end,del; cur = commandlist.begin(); end = commandlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second->function == function) { int r; for(r = 1; r < CMDALIASES; r++) { @@ -782,7 +782,7 @@ void command_help(Client *c, const Seperator *sep) cur = commandlist.begin(); end = commandlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(sep->arg[1][0]) { if(cur->first.find(sep->arg[1]) == std::string::npos) { continue; @@ -2961,7 +2961,7 @@ void command_peekinv(Client *c, const Seperator *sep) } } else { - for(it=client->GetInv().cursor_begin();it!=client->GetInv().cursor_end();it++,i++) { + for(it=client->GetInv().cursor_begin();it!=client->GetInv().cursor_end();++it,i++) { const ItemInst* inst = *it; item = (inst) ? inst->GetItem() : nullptr; if (c->GetClientVersion() >= EQClientSoF) @@ -8299,7 +8299,7 @@ void command_rules(Client *c, const Seperator *sep) { std::map::iterator cur, end; cur = sets.begin(); end = sets.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { c->Message(0, "(%d) %s", cur->first, cur->second.c_str()); } } else if(!strcasecmp(sep->arg[1], "reload")) { @@ -8398,7 +8398,7 @@ void command_rules(Client *c, const Seperator *sep) { std::vector::iterator cur, end; cur = rule_list.begin(); end = rule_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { c->Message(0, " %s", *cur); } } else if(sep->argnum == 2) { @@ -8414,7 +8414,7 @@ void command_rules(Client *c, const Seperator *sep) { std::vector::iterator cur, end; cur = rule_list.begin(); end = rule_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { c->Message(0, " %s", *cur); } } else { @@ -8437,7 +8437,7 @@ void command_rules(Client *c, const Seperator *sep) { std::vector::iterator cur, end; cur = rule_list.begin(); end = rule_list.end(); - for(std::string tmp_value; cur != end; cur++) { + for(std::string tmp_value; cur != end; ++cur) { if (RuleManager::Instance()->GetRule(*cur, tmp_value)) c->Message(0, " %s - %s", *cur, tmp_value.c_str()); } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index b3ccfe48f..992649c03 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -389,7 +389,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) // this was mainly for client profile state reflection..should match db player inventory entries now. iter_queue it; - for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); it++,i++) { + for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); ++it,i++) { item = *it; if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { @@ -413,7 +413,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) ss << " OR "; } ss << "slotid=" << (*iter); - iter++; + ++iter; } ss << ")"; database.RunQuery(ss.str().c_str(), ss.str().length()); @@ -519,7 +519,7 @@ Corpse::~Corpse() { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; safe_delete(item); } @@ -598,7 +598,7 @@ bool Corpse::Save() { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; memcpy((char*) &dbpc->items[x++], (char*) item, sizeof(player_lootitem::ServerLootItem_Struct)); } @@ -675,7 +675,7 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if((*cur)->lootslot == lootslot) { sitem = *cur; @@ -689,7 +689,7 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { sitem2 = *cur; if(sitem2->equipSlot >= bagstart && sitem2->equipSlot < bagstart + 10) { @@ -705,7 +705,7 @@ uint32 Corpse::GetWornItem(int16 equipSlot) const { ItemList::const_iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; if (item->equipSlot == equipSlot) { @@ -725,7 +725,7 @@ void Corpse::RemoveItem(uint16 lootslot) ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; if (sitem->lootslot == lootslot) { @@ -742,7 +742,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data) ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; if (sitem == item_data) { @@ -1006,7 +1006,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a else if(client->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; } else { corpselootlimit = 30; } - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item_data->lootslot = 0xFFFF; @@ -1046,7 +1046,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); LogFile->write(EQEMuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); @@ -1337,7 +1337,7 @@ void Corpse::QueryLoot(Client* to) { else if (to->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; } else { corpselootlimit = 30; } - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; if (IsPlayerCorpse()) { @@ -1403,7 +1403,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { bool consented = false; std::list::iterator itr; - for(itr = client->consent_list.begin(); itr != client->consent_list.end(); itr++) + for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) { if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) { diff --git a/zone/embperl.h b/zone/embperl.h index 016676769..919664d0a 100644 --- a/zone/embperl.h +++ b/zone/embperl.h @@ -131,7 +131,7 @@ public: hv_clear(hv); // Iterate through key-value pairs, storing them in hash - for (it = vals.begin(); it != vals.end(); it++) + for (it = vals.begin(); it != vals.end(); ++it) { int keylen = static_cast(it->first.length()); diff --git a/zone/entity.cpp b/zone/entity.cpp index 29b417559..a9e104573 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -348,7 +348,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { std::list::iterator it; - for (it = group_list.begin(); it != group_list.end(); it++) + for (it = group_list.begin(); it != group_list.end(); ++it) { if (*it == nullptr) { @@ -394,7 +394,7 @@ void EntityList::QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPac while(iterator != group_list.end()) { (*iterator)->QueueHPPacketsForNPCHealthAA(sender, app); - iterator++; + ++iterator; } } @@ -410,7 +410,7 @@ void EntityList::RaidProcess() { { count++; (*iterator)->Process(); - iterator++; + ++iterator; } if(count == 0) net.raid_timer.Disable();//No groups in list, disable until one is added @@ -1938,7 +1938,7 @@ Group* EntityList::GetGroupByMob(Mob* mob) if ((*iterator)->IsGroupMember(mob)) { return *iterator; } - iterator++; + ++iterator; } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -1956,7 +1956,7 @@ Group* EntityList::GetGroupByLeaderName(const char* leader){ if (!strcmp((*iterator)->GetLeaderName(), leader)) { return *iterator; } - iterator++; + ++iterator; } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -1973,7 +1973,7 @@ Group* EntityList::GetGroupByID(uint32 group_id){ if ((*iterator)->GetID() == group_id) { return *iterator; } - iterator++; + ++iterator; } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -1991,7 +1991,7 @@ Group* EntityList::GetGroupByClient(Client* client) if ((*iterator)->IsGroupMember(client->CastToMob())) { return *iterator; } - iterator++; + ++iterator; } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -2011,7 +2011,7 @@ Raid* EntityList::GetRaidByLeaderName(const char *leader){ return *iterator; } } - iterator++; + ++iterator; } return 0; } @@ -2025,7 +2025,7 @@ Raid* EntityList::GetRaidByID(uint32 id){ if ((*iterator)->GetID() == id) { return *iterator; } - iterator++; + ++iterator; } return 0; } @@ -2045,7 +2045,7 @@ Raid* EntityList::GetRaidByClient(Client* client) return *iterator; } } - iterator++; + ++iterator; } return 0; } @@ -2065,7 +2065,7 @@ Raid* EntityList::GetRaidByMob(Mob* mob) { return *iterator; }*/ } - iterator++; + ++iterator; } return 0; } @@ -2507,7 +2507,7 @@ bool EntityList::RemoveGroup(uint32 delete_id){ #endif return true; } - iterator++; + ++iterator; } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -2526,7 +2526,7 @@ bool EntityList::RemoveRaid(uint32 delete_id){ raid_list.remove (*iterator); return true; } - iterator++; + ++iterator; } return false; } @@ -3821,7 +3821,7 @@ bool EntityList::LimitCheckType(uint32 npc_type, int count) { cur = npc_limit_list.begin(); end = npc_limit_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second.npc_type == npc_type) { count--; if(count == 0) { @@ -3842,7 +3842,7 @@ bool EntityList::LimitCheckGroup(uint32 spawngroup_id, int count) { cur = npc_limit_list.begin(); end = npc_limit_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second.spawngroup_id == spawngroup_id) { count--; if(count == 0) { @@ -3864,7 +3864,7 @@ bool EntityList::LimitCheckBoth(uint32 npc_type, uint32 spawngroup_id, int group cur = npc_limit_list.begin(); end = npc_limit_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second.npc_type == npc_type) { type_count--; if(type_count == 0) { diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 7c1210ba8..f6f57fe51 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -177,7 +177,7 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na end = members.end(); uint32 name_len = 0; uint32 note_len = 0; - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ci = *cur; name_len += ci->char_name.length(); note_len += ci->public_note.length(); @@ -205,7 +205,7 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na cur = members.begin(); end = members.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ci = *cur; //the order we set things here must match the struct @@ -247,7 +247,7 @@ void ZoneGuildManager::ListGuilds(Client *c) const { cur = m_guilds.begin(); end = m_guilds.end(); int r = 0; - for(; cur != end; cur++) { + for(; cur != end; ++cur) { leadername[0] = '\0'; database.GetCharName(cur->second->leader_char_id, leadername); if (leadername[0] == '\0') diff --git a/zone/merc.cpp b/zone/merc.cpp index 82b4c7894..9d5fbe94e 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2236,7 +2236,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_Buff); - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); itr++) { + for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(!((spells[selectedMercSpell.spellid].targettype == ST_Target || spells[selectedMercSpell.spellid].targettype == ST_Pet || @@ -2396,7 +2396,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_InCombatBuff); Mob* tar = this; - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); itr++) { + for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(!(spells[selectedMercSpell.spellid].targettype == ST_Self)) { @@ -2541,7 +2541,7 @@ void Merc::CheckHateList() { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) { + for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; float dist = npc->DistNoRootNoZ(*this); int radius = RuleI(Mercs, AggroRadius); @@ -2594,7 +2594,7 @@ bool Merc::CheckAENuke(Merc* caster, Mob* tar, uint16 spell_id, uint8 &numTarget std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) { + for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; if(npc->DistNoRootNoZ(*tar) <= spells[spell_id].aoerange * spells[spell_id].aoerange) { @@ -3311,7 +3311,7 @@ MercSpell Merc::GetBestMercSpellForVeryFastHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsVeryFastHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3343,7 +3343,7 @@ MercSpell Merc::GetBestMercSpellForFastHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsFastHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3375,7 +3375,7 @@ MercSpell Merc::GetBestMercSpellForHealOverTime(Merc* caster) { if(caster) { std::list mercHoTSpellList = GetMercSpellsForSpellEffect(caster, SE_HealOverTime); - for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsHealOverTimeSpell(mercSpellListItr->spellid)) { @@ -3415,7 +3415,7 @@ MercSpell Merc::GetBestMercSpellForPercentageHeal(Merc* caster) { if(caster && caster->AI_HasSpells()) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsCompleteHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3447,7 +3447,7 @@ MercSpell Merc::GetBestMercSpellForRegularSingleTargetHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularSingleTargetHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3479,7 +3479,7 @@ MercSpell Merc::GetFirstMercSpellForSingleTargetHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((IsRegularSingleTargetHealSpell(mercSpellListItr->spellid) || IsFastHealSpell(mercSpellListItr->spellid)) @@ -3512,7 +3512,7 @@ MercSpell Merc::GetBestMercSpellForGroupHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularGroupHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3544,7 +3544,7 @@ MercSpell Merc::GetBestMercSpellForGroupHealOverTime(Merc* caster) { if(caster) { std::list mercHoTSpellList = GetMercSpellsForSpellEffect(caster, SE_HealOverTime); - for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupHealOverTimeSpell(mercSpellListItr->spellid)) { @@ -3584,7 +3584,7 @@ MercSpell Merc::GetBestMercSpellForGroupCompleteHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CompleteHeal); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupCompleteHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3616,7 +3616,7 @@ MercSpell Merc::GetBestMercSpellForAETaunt(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Taunt); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((spells[mercSpellListItr->spellid].targettype == ST_AECaster || spells[mercSpellListItr->spellid].targettype == ST_AETarget @@ -3650,7 +3650,7 @@ MercSpell Merc::GetBestMercSpellForTaunt(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Taunt); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((spells[mercSpellListItr->spellid].targettype == ST_Target) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3682,7 +3682,7 @@ MercSpell Merc::GetBestMercSpellForHate(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Calm); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { result.spellid = mercSpellListItr->spellid; @@ -3738,7 +3738,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) { //Check for group cure first if(countNeedsCured > 2) { - for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); itr++) { + for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(IsGroupSpell(itr->spellid) && CheckSpellRecastTimers(caster, itr->spellid)) { @@ -3778,7 +3778,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) { //no group cure for target- try to find single target spell if(!spellSelected) { - for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); itr++) { + for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(CheckSpellRecastTimers(caster, itr->spellid)) { @@ -3834,7 +3834,7 @@ MercSpell Merc::GetBestMercSpellForStun(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Stun); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { result.spellid = mercSpellListItr->spellid; @@ -3929,7 +3929,7 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsAENukeSpell(mercSpellListItr->spellid) && !IsAERainNukeSpell(mercSpellListItr->spellid) && !IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3980,7 +3980,7 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; @@ -4030,7 +4030,7 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsAERainNukeSpell(mercSpellListItr->spellid) && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; @@ -4068,7 +4068,7 @@ MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid) && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -4111,7 +4111,7 @@ MercSpell Merc::GetBestMercSpellForNukeByTargetResists(Merc* caster, Mob* target std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); mercSpellListItr++) { + for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -4350,7 +4350,7 @@ bool Merc::CheckAETaunt() { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) { + for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; float dist = npc->DistNoRootNoZ(*this); int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range); @@ -4436,7 +4436,7 @@ bool Merc::CheckConfidence() { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) { + for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* mob = *itr; float ConRating = 1.0; int CurrentCon = 0; @@ -4920,7 +4920,7 @@ bool Merc::LoadMercSpells() { int16 attack_proc_spell = -1; int8 proc_chance = 0; - for (std::list::iterator mercSpellEntryItr = spellList.begin(); mercSpellEntryItr != spellList.end(); mercSpellEntryItr++) { + for (std::list::iterator mercSpellEntryItr = spellList.begin(); mercSpellEntryItr != spellList.end(); ++mercSpellEntryItr) { if (proficiency_id == mercSpellEntryItr->proficiencyid && GetLevel() >= mercSpellEntryItr->minlevel && GetLevel() <= mercSpellEntryItr->maxlevel && mercSpellEntryItr->spellid > 0) { MercSpell mercSpell; @@ -5932,7 +5932,7 @@ int NPC::GetNumMercTypes(uint32 clientVersion) int count = 0; std::list mercTypeList = GetMercTypesList(); - for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); mercTypeListItr++) { + for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { if(mercTypeListItr->ClientVersion <= clientVersion) count++; } @@ -5945,7 +5945,7 @@ int NPC::GetNumMercs(uint32 clientVersion) int count = 0; std::list mercDataList = GetMercsList(); - for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); mercListItr++) { + for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { if(mercListItr->ClientVersion <= clientVersion) count++; } @@ -5957,7 +5957,7 @@ std::list NPC::GetMercTypesList(uint32 clientVersion) { std::list result; if(GetNumMercTypes() > 0) { - for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); mercTypeListItr++) { + for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { if(mercTypeListItr->ClientVersion <= clientVersion) { MercType mercType; mercType.Type = mercTypeListItr->Type; @@ -5974,7 +5974,7 @@ std::list NPC::GetMercsList(uint32 clientVersion) { std::list result; if(GetNumMercs() > 0) { - for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); mercListItr++) { + for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { if(mercListItr->ClientVersion <= clientVersion) { MercTemplate *merc_template = zone->GetMercTemplate(mercListItr->MercTemplateID); diff --git a/zone/mob.cpp b/zone/mob.cpp index 01146a4a2..bd06b2788 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -4767,7 +4767,7 @@ int32 Mob::GetItemFactionBonus(uint32 pFactionID) { void Mob::ClearItemFactionBonuses() { std::map :: iterator itr; - for(itr = item_faction_bonuses.begin(); itr != item_faction_bonuses.end(); itr++) + for(itr = item_faction_bonuses.begin(); itr != item_faction_bonuses.end(); ++itr) { item_faction_bonuses.erase(itr->first); } diff --git a/zone/npc.cpp b/zone/npc.cpp index 58d632d1a..ccff8a768 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -280,12 +280,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float trap_list = trap_ent_iter->second; if(trap_list.size() > 0) { - uint16 count = MakeRandomInt(0, (trap_list.size()-1)); std::list::iterator trap_list_iter = trap_list.begin(); - for(int x = 0; x < count; ++x) - { - trap_list_iter++; - } + std::advance(trap_list_iter, MakeRandomInt(0, trap_list.size() - 1)); LDoNTrapTemplate* tt = (*trap_list_iter); if(tt) { @@ -374,7 +370,7 @@ NPC::~NPC() ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; safe_delete(item); } @@ -385,7 +381,7 @@ NPC::~NPC() std::list::iterator cur,end; cur = faction_list.begin(); end = faction_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { struct NPCFaction* fac = *cur; safe_delete(fac); } @@ -424,7 +420,7 @@ ServerLootItem_Struct* NPC::GetItem(int slot_id) { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; if (item->equipSlot == slot_id) { return item; @@ -437,7 +433,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; if (item->item_id == item_id && slot <= 0 && quantity <= 0) { itemlist.erase(cur); @@ -477,7 +473,7 @@ void NPC::CheckMinMaxLevel(Mob *them) cur = itemlist.erase(cur); continue; } - cur++; + ++cur; } } @@ -486,7 +482,7 @@ void NPC::ClearItemList() { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; safe_delete(item); } @@ -500,7 +496,7 @@ void NPC::QueryLoot(Client* to) { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item) if (to->GetClientVersion() >= EQClientRoF) @@ -1286,7 +1282,7 @@ void NPC::PickPocket(Client* thief) { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end && x < 49; cur++) { + for(; cur != end && x < 49; ++cur) { ServerLootItem_Struct* citem = *cur; const Item_Struct* item = database.GetItem(citem->item_id); if (item) @@ -2351,7 +2347,7 @@ FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) { std::list::iterator cur,end; cur = faction_list.begin(); end = faction_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { struct NPCFaction* fac = *cur; if ((int32)fac->factionID == other_faction) { if (fac->npc_value > 0) diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 96ad5b25a..404b3d898 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -1324,12 +1324,12 @@ void Client::SendPathPacket(std::vector &points) { cur = points.begin(); end = points.end(); unsigned int r; - for(r = 0; cur != end; cur++, r++) { + for(r = 0; cur != end; ++cur, r++) { fpr->path[r] = *cur; } //put the last element into the destination field - cur--; + --cur; fpr->path[r] = *cur; fpr->dest = *cur; diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index cf02fa21b..c1355b55a 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -566,7 +566,7 @@ void SpawnConditionManager::Process() { std::vector::iterator cur,end; cur = spawn_events.begin(); end = spawn_events.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEvent &cevent = *cur; if(!cevent.enabled) @@ -827,7 +827,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cur = spawn_events.begin(); end = spawn_events.end(); bool ran; - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEvent &cevent = *cur; if(!cevent.enabled) @@ -875,7 +875,7 @@ void SpawnConditionManager::FindNearestEvent() { cur = spawn_events.begin(); end = spawn_events.end(); int next_id = -1; - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEvent &cevent = *cur; if(!cevent.enabled) @@ -983,7 +983,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::vector::iterator cur,end; cur = spawn_events.begin(); end = spawn_events.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEvent &cevent = *cur; if(cevent.id == event_id) { @@ -1026,7 +1026,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool rese std::vector::iterator cur,end; cur = spawn_events.begin(); end = spawn_events.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEvent &cevent = *cur; if(cevent.id == event_id) { diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 29e82d028..85fba5c20 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -64,7 +64,7 @@ uint32 SpawnGroup::GetNPCType() { std::list possible; cur = list_.begin(); end = list_.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEntry *se = *cur; //check limits on this spawn group and npc type @@ -83,7 +83,7 @@ uint32 SpawnGroup::GetNPCType() { cur = possible.begin(); end = possible.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEntry *se = *cur; if (roll < se->chance) { npcType = se->NPCType; @@ -104,7 +104,7 @@ SpawnGroup::~SpawnGroup() { std::list::iterator cur,end; cur = list_.begin(); end = list_.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnEntry* tmp = *cur; safe_delete(tmp); } @@ -115,7 +115,7 @@ SpawnGroupList::~SpawnGroupList() { std::map::iterator cur,end; cur = groups.begin(); end = groups.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { SpawnGroup* tmp = cur->second; safe_delete(tmp); } diff --git a/zone/spells.cpp b/zone/spells.cpp index 4fad23e5b..eb5337719 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2058,7 +2058,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); } } - iter++; + ++iter; } break; } @@ -2940,7 +2940,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid std::vector::iterator cur, end; cur = overwrite_slots.begin(); end = overwrite_slots.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { // strip spell BuffFadeBySlot(*cur, false); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index bc347b9ba..eb1d06ace 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -829,7 +829,7 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) { // Our list of enabled tasks is sorted, so we can quit if we find a taskid higher than // the one we are looking for. if((*Iterator) > TaskList[i]) break; - Iterator++; + ++Iterator; } if(AddTask) { EnabledTasks.insert(Iterator, TaskList[i]); @@ -890,7 +890,7 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) { break; } if((*Iterator) > TaskList[i]) break; - Iterator++; + ++Iterator; } if(RemoveTask) { EnabledTasks.erase(Iterator); @@ -947,7 +947,7 @@ bool ClientTaskState::IsTaskEnabled(int TaskID) { while(Iterator != EnabledTasks.end()) { if((*Iterator) == TaskID) return true; if((*Iterator) > TaskID) break; - Iterator++; + ++Iterator; } return false; @@ -1021,7 +1021,7 @@ int TaskManager::FirstTaskInSet(int TaskSetID) { while(Iterator != TaskSets[TaskSetID].end()) { if((*Iterator) > 0) return (*Iterator); - Iterator++; + ++Iterator; } return 0; @@ -1087,7 +1087,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i (IsTaskRepeatable((*Iterator)) || !state->IsTaskCompleted((*Iterator)))) TaskList[TaskListIndex++] = (*Iterator); - Iterator++; + ++Iterator; } if(TaskListIndex > 0) { @@ -1497,7 +1497,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { ErasedElements++; } else - Iterator++; + ++Iterator; } _log(TASKS__UPDATE, "Erased Element count is %i", ErasedElements); if(ErasedElements) { @@ -1570,7 +1570,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { ErasedElements++; } else - Iterator++; + ++Iterator; } _log(TASKS__UPDATE, "Erased Element count is %i", ErasedElements); if(ErasedElements) { diff --git a/zone/titles.cpp b/zone/titles.cpp index 5e2484b39..de79fa8f0 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -165,7 +165,7 @@ std::string TitleManager::GetSuffix(int TitleID) if((*Iterator).TitleID == TitleID) return (*Iterator).Suffix; - Iterator++; + ++Iterator; } return ""; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index e308335cb..5df392fa3 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1082,7 +1082,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { } if(RuleB(TaskSystem, EnableTaskSystem)) UpdateTasksForItem(ActivityTradeSkill, itr->first, itr->second); - itr++; + ++itr; } return(true); } else { @@ -1103,7 +1103,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { while(itr != spec->onfail.end()) { //should we check these arguments? SummonItem(itr->first, itr->second); - itr++; + ++itr; } // Rolls on each item, is possible to return everything @@ -1116,7 +1116,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { for(sc = 0; sc < itr->second; sc++) if(MakeRandomInt(0,99) < SalvageChance) SummonItem(itr->first, 1); - itr++; + ++itr; } } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 5d2ceff4d..57b969add 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -308,7 +308,7 @@ void Client::SendTributes() { cur = tribute_list.begin(); end = tribute_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(cur->second.is_guild) continue; //skip guild tributes here int len = cur->second.name.length(); @@ -342,7 +342,7 @@ void Client::SendGuildTributes() { cur = tribute_list.begin(); end = tribute_list.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { if(!cur->second.is_guild) continue; //skip guild tributes here int len = cur->second.name.length(); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 64f8230a5..e9257d5a0 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -73,7 +73,7 @@ void NPC::DisplayWaypointInfo(Client *c) { std::vector::iterator cur, end; cur = Waypoints.begin(); end = Waypoints.end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { c->Message(0,"Waypoint %d: (%.2f,%.2f,%.2f,%.2f) pause %d", cur->index, cur->x, @@ -272,12 +272,8 @@ void NPC::CalculateNewWaypoint() std::list::iterator iter = closest.begin(); if(closest.size() != 0) { - int idx = MakeRandomInt(0, closest.size() - 1); iter = closest.begin(); - for(int i = 0; i < idx; ++i) - { - iter++; - } + std::advance(iter, MakeRandomInt(0, closest.size() - 1)); cur_wp = (*iter).index; } @@ -335,7 +331,7 @@ void NPC::CalculateNewWaypoint() { if(CheckLosFN((*iter).x, (*iter).y, (*iter).z, GetSize())) { - iter++; + ++iter; } else { @@ -345,12 +341,8 @@ void NPC::CalculateNewWaypoint() if(closest.size() != 0) { - int idx = MakeRandomInt(0, closest.size() - 1); iter = closest.begin(); - for(int i = 0; i < idx; ++i) - { - iter++; - } + std::advance(iter, MakeRandomInt(0, closest.size() - 1)); cur_wp = (*iter).index; } break; @@ -406,7 +398,7 @@ void NPC::GetClosestWaypoint(std::list &wp_list, int count, float m_x, f for(int i = 0; i < count; ++i) { wp_list.push_back(Waypoints[(*iter).index]); - iter++; + ++iter; } } diff --git a/zone/zone.cpp b/zone/zone.cpp index 7a48621c9..745401f5d 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -341,7 +341,7 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg std::list merlist = merchanttable[merchantid]; std::list::const_iterator itr; uint32 i = 1; - for(itr = merlist.begin();itr != merlist.end();itr++){ + for (itr = merlist.begin(); itr != merlist.end(); ++itr) { MerchantList ml = *itr; if(ml.item == item) return 0; @@ -357,7 +357,7 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg TempMerchantList ml; while(freeslot == 0 && !update_charges){ freeslot = i; - for(tmp_itr = tmp_merlist.begin();tmp_itr != tmp_merlist.end();tmp_itr++){ + for (tmp_itr = tmp_merlist.begin(); tmp_itr != tmp_merlist.end(); ++tmp_itr) { ml = *tmp_itr; if(ml.item == item){ update_charges = true; @@ -373,7 +373,7 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg if(update_charges){ tmp_merlist.clear(); std::list oldtmp_merlist = tmpmerchanttable[npcid]; - for(tmp_itr = oldtmp_merlist.begin();tmp_itr != oldtmp_merlist.end();tmp_itr++){ + for (tmp_itr = oldtmp_merlist.begin(); tmp_itr != oldtmp_merlist.end(); ++tmp_itr) { TempMerchantList ml2 = *tmp_itr; if(ml2.item != item) tmp_merlist.push_back(ml2); @@ -419,7 +419,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { std::list TmpMerchantList = tmpmerchanttable[NPCID]; std::list::const_iterator Iterator; - for(Iterator = TmpMerchantList.begin(); Iterator != TmpMerchantList.end(); Iterator++) + for (Iterator = TmpMerchantList.begin(); Iterator != TmpMerchantList.end(); ++Iterator) if((*Iterator).slot == Slot) return (*Iterator).charges; @@ -527,7 +527,7 @@ void Zone::LoadMerchantData_result(MYSQL_RES* result) { found = true; break; } - iter++; + ++iter; } if(found) { @@ -617,7 +617,7 @@ void Zone::LoadMercTemplates(){ tempMercTemplate.Stances[i] = 0; } - for(std::list::iterator mercStanceListItr = merc_stances.begin(); mercStanceListItr != merc_stances.end(); mercStanceListItr++) { + for (std::list::iterator mercStanceListItr = merc_stances.begin(); mercStanceListItr != merc_stances.end(); ++mercStanceListItr) { if(mercStanceListItr->ClassID == tempMercTemplate.ClassID && mercStanceListItr->ProficiencyID == tempMercTemplate.ProficiencyID) { zone->merc_stance_list[tempMercTemplate.MercTemplateID].push_back((*mercStanceListItr)); tempMercTemplate.Stances[stanceIndex] = mercStanceListItr->StanceID; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 0cf9d0da0..b95f86621 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3193,7 +3193,7 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list::iterator cur,end; cur = faction_list->begin(); end = faction_list->end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { struct NPCFaction* tmp = *cur; safe_delete(tmp); } @@ -3212,7 +3212,7 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list::iterator cur,end; cur = faction_list->begin(); end = faction_list->end(); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { struct NPCFaction* tmp = *cur; safe_delete(tmp); } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index ecd9c5ab7..f69598ce5 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -793,7 +793,7 @@ void Client::SendZoneFlagInfo(Client *to) const { to->Message(0, "Flags for %s:", GetName()); - for(; cur != end; cur++) { + for(; cur != end; ++cur) { uint32 zoneid = *cur; const char *short_name = database.GetZoneName(zoneid); From 53765ebc6218c7ab0b86b36e8b631beddd52d648 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 14 Jan 2014 02:38:49 -0500 Subject: [PATCH 4/9] Fix some potential null pointer dereferences I don't think there were any instances of these causing problems but it's better to be safe than sorry. --- zone/questmgr.cpp | 94 ++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index c78cca00d..34a2e6b01 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -648,31 +648,31 @@ void QuestManager::repopzone() { void QuestManager::settarget(const char *type, int target_id) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + Mob* tmp = nullptr; - if (!strcasecmp(type,"npctype")) { + if (!strcasecmp(type,"npctype")) tmp = entity_list.GetMobByNpcTypeID(target_id); - } - else if (!strcasecmp(type, "entity")) { + else if (!strcasecmp(type, "entity")) tmp = entity_list.GetMob(target_id); - } - if(tmp != nullptr) { + + if (tmp != nullptr) owner->SetTarget(tmp); - } } void QuestManager::follow(int entity_id, int distance) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + owner->SetFollowID(entity_id); owner->SetFollowDistance(distance * distance); } void QuestManager::sfollow() { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (owner == nullptr || !owner->IsNPC()) return; owner->SetFollowID(0); } @@ -1086,25 +1086,26 @@ void QuestManager::setallskill(int value) { void QuestManager::attack(const char *client_name) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + Client* getclient = entity_list.GetClientByName(client_name); - if(getclient && owner->IsAttackAllowed(getclient)) { + if (getclient && owner->IsAttackAllowed(getclient)) owner->AddToHateList(getclient,1); - } else { + else owner->Say("I am unable to attack %s.", client_name); - } } void QuestManager::attacknpc(int npc_entity_id) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + Mob *it = entity_list.GetMob(npc_entity_id); - if(it && owner->IsAttackAllowed(it)) { + if (it && owner->IsAttackAllowed(it)) { owner->AddToHateList(it,1); } else { - if(it) + if (it) owner->Say("I am unable to attack %s.", it->GetName()); else owner->Say("I am unable to locate NPC entity %i", npc_entity_id); @@ -1113,13 +1114,14 @@ void QuestManager::attacknpc(int npc_entity_id) { void QuestManager::attacknpctype(int npc_type_id) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + Mob *it = entity_list.GetMobByNpcTypeID(npc_type_id); - if(it && owner->IsAttackAllowed(it)) { + if (it && owner->IsAttackAllowed(it)) { owner->AddToHateList(it,1); } else { - if(it) + if (it) owner->Say("I am unable to attack %s.", it->GetName()); else owner->Say("I am unable to locate NPC type %i", npc_type_id); @@ -1176,7 +1178,7 @@ void QuestManager::CreateGuild(const char *guild_name, const char *leader) { uint32 tmp = guild_mgr.FindGuildByLeader(cid); if (tmp != GUILD_NONE) { - sprintf(hString, "Guild Creation: Error: %s already is the leader of DB# %i '%s'.", leader, tmp, guild_mgr.GetGuildName(tmp)); + sprintf(hString, "Guild Creation: Error: %s already is the leader of DB# %u '%s'.", leader, tmp, guild_mgr.GetGuildName(tmp)); worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", hString); } else { @@ -1184,7 +1186,7 @@ void QuestManager::CreateGuild(const char *guild_name, const char *leader) { if (gid == GUILD_NONE) worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Guild Creation: Guild creation failed"); else { - sprintf(hString, "Guild Creation: Guild created: Leader: %i, number %i: %s", cid, gid, leader); + sprintf(hString, "Guild Creation: Guild created: Leader: %u, number %u: %s", cid, gid, leader); worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", hString); if(!guild_mgr.SetGuild(cid, gid, GUILD_LEADER)) worldserver.SendEmoteMessage(0, 0, 80, 15, "%s", "Unable to set guild leader's guild in the database. Your going to have to run #guild set"); @@ -1200,12 +1202,15 @@ void QuestManager::settime(uint8 new_hour, uint8 new_min) { void QuestManager::itemlink(int item_id) { QuestManagerCurrentQuestVars(); - const ItemInst* inst = database.CreateItem(item_id); - char* link = 0; - if (initiator->MakeItemLink(link, inst)) - initiator->Message(0, "%s tells you, %c%s%s%c", owner->GetCleanName(), 0x12, link, inst->GetItem()->Name, 0x12); - safe_delete_array(link); - safe_delete(inst); + if (initiator) { + const ItemInst* inst = database.CreateItem(item_id); + char* link = 0; + if (initiator->MakeItemLink(link, inst)) + initiator->Message(0, "%s tells you, %c%s%s%c", owner->GetCleanName(), + 0x12, link, inst->GetItem()->Name, 0x12); + safe_delete_array(link); + safe_delete(inst); + } } void QuestManager::signalwith(int npc_id, int signal_id, int wait_ms) { @@ -1486,36 +1491,41 @@ void QuestManager::rebind(int zoneid, float x, float y, float z) { void QuestManager::start(int32 wp) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + owner->CastToNPC()->AssignWaypoints(wp); } void QuestManager::stop() { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + owner->CastToNPC()->StopWandering(); } void QuestManager::pause(int duration) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + owner->CastToNPC()->PauseWandering(duration); } void QuestManager::moveto(float x, float y, float z, float h, bool saveguardspot) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + owner->CastToNPC()->MoveTo(x, y, z, h, saveguardspot); } void QuestManager::resume() { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; + owner->CastToNPC()->ResumeWandering(); } @@ -1539,22 +1549,21 @@ void QuestManager::addldonloss(int32 losses, uint32 theme) { void QuestManager::setnexthpevent(int at) { QuestManagerCurrentQuestVars(); - owner->SetNextHPEvent( at ); + if (owner) + owner->SetNextHPEvent(at); } void QuestManager::setnextinchpevent(int at) { QuestManagerCurrentQuestVars(); - owner->SetNextIncHPEvent( at ); + if (owner) + owner->SetNextIncHPEvent(at); } void QuestManager::respawn(int npc_type, int grid) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; - //char tempa[100]; float x,y,z,h; - if ( !owner ) - return; x = owner->GetX(); y = owner->GetY(); @@ -1581,7 +1590,7 @@ void QuestManager::respawn(int npc_type, int grid) { void QuestManager::set_proximity(float minx, float maxx, float miny, float maxy, float minz, float maxz) { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if (!owner || !owner->IsNPC()) return; entity_list.AddProximity(owner->CastToNPC()); @@ -1596,8 +1605,9 @@ void QuestManager::set_proximity(float minx, float maxx, float miny, float maxy, void QuestManager::clear_proximity() { QuestManagerCurrentQuestVars(); - if(!owner->IsNPC()) + if(!owner || !owner->IsNPC()) return; + entity_list.RemoveProximity(owner->GetID()); safe_delete(owner->CastToNPC()->proximity); } @@ -1676,7 +1686,7 @@ void QuestManager::toggle_spawn_event(int event_id, bool enable, bool reset_base bool QuestManager::has_zone_flag(int zone_id) { QuestManagerCurrentQuestVars(); - return(initiator->HasZoneFlag(zone_id)); + return initiator ? initiator->HasZoneFlag(zone_id) : false; } void QuestManager::set_zone_flag(int zone_id) { @@ -2757,7 +2767,7 @@ void QuestManager::enabletitle(int titleset) { bool QuestManager::checktitle(int titleset) { QuestManagerCurrentQuestVars(); - return initiator->CheckTitle(titleset); + return initiator ? initiator->CheckTitle(titleset) : false; } void QuestManager::removetitle(int titleset) { From 497c10e513e0b7f8291484e78417a9da4a286a54 Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Tue, 14 Jan 2014 15:16:29 -0500 Subject: [PATCH 5/9] Updated URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e9d57436..edee03cca 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ EQEmu - Custom Game Implementation for EverQuest -Dependencies can be obtained at http://eqemu.github.com/ +Dependencies can be obtained at http://eqemu.github.io More Information: https://github.com/EQEmu/Server/wiki From 0a6d98b5e1e06ce3ef117753fd188c0f5b0e0167 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 14 Jan 2014 22:24:01 -0500 Subject: [PATCH 6/9] Fix mod rods --- zone/spell_effects.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 1068667a3..ce67926f7 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1223,6 +1223,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int charges; if (item->Stackable) charges = (spell.formula[i] > item->StackSize) ? item->StackSize : spell.formula[i]; + else if (item->MaxCharges) // mod rods etc + charges = (spell.formula[i] > item->MaxCharges) ? item->MaxCharges : spell.formula[i]; else charges = 1; @@ -1263,6 +1265,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (item->Stackable) charges = (spell.formula[i] > item->StackSize) ? item->StackSize : spell.formula[i]; + else if (item->MaxCharges) // mod rods, not sure if there are actual examples of this for IntoBag + charges = (spell.formula[i] > item->MaxCharges) ? item->MaxCharges : spell.formula[i]; else charges = 1; From d2e66214f4553947d0a483747627f517eb04f9ef Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 15 Jan 2014 01:19:03 -0500 Subject: [PATCH 7/9] Add numhitstype to the spell structure --- common/shareddb.cpp | 1 + common/spdat.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index e047b761d..132f3290b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1715,6 +1715,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].EndurTimerIndex=atoi(row[167]); sp[tempid].HateAdded=atoi(row[173]); sp[tempid].EndurUpkeep=atoi(row[174]); + sp[tempid].numhitstype = atoi(row[175]); sp[tempid].numhits = atoi(row[176]); sp[tempid].pvpresistbase=atoi(row[177]); sp[tempid].pvpresistcalc=atoi(row[178]); diff --git a/common/spdat.h b/common/spdat.h index e39ea22c2..13fc4bff1 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -694,7 +694,7 @@ struct SPDat_Spell_Struct /* 169 */ /* 173 */ int HateAdded; /* 174 */ int EndurUpkeep; -/* 175 */ //numhitstype; // defines which type of behavior will tick down the numhit counter. +/* 175 */ int numhitstype; // defines which type of behavior will tick down the numhit counter. /* 176 */ int numhits; /* 177 */ int pvpresistbase; /* 178 */ int pvpresistcalc; From a7a4f9373d8ade21a854a5d8f566f3114bd15918 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 15 Jan 2014 17:10:15 -0500 Subject: [PATCH 8/9] Revert change to SE_LimitEffect Also fix for SE_SummonItem for unstackable charged items (Still need to verify on live though) --- zone/spell_effects.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index ce67926f7..841abcac6 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1224,7 +1224,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (item->Stackable) charges = (spell.formula[i] > item->StackSize) ? item->StackSize : spell.formula[i]; else if (item->MaxCharges) // mod rods etc - charges = (spell.formula[i] > item->MaxCharges) ? item->MaxCharges : spell.formula[i]; + charges = item->MaxCharges; else charges = 1; @@ -1266,7 +1266,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (item->Stackable) charges = (spell.formula[i] > item->StackSize) ? item->StackSize : spell.formula[i]; else if (item->MaxCharges) // mod rods, not sure if there are actual examples of this for IntoBag - charges = (spell.formula[i] > item->MaxCharges) ? item->MaxCharges : spell.formula[i]; + charges = item->MaxCharges; else charges = 1; @@ -4058,19 +4058,15 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) LimitFound = true; break; case SE_LimitEffect: - // Exclude effect(any but this) - if(base1 < 0) { - if(IsEffectInSpell(spell_id,(base1*-1))) + // Exclude effect (any but this) + if (base1 < 0) { + if (IsEffectInSpell(spell_id, (base1 * -1))) + LimitFound = true; + } else { + // Include effect (only this) + if (!IsEffectInSpell(spell_id, base1)) LimitFound = true; } - - - else if(base1 >= 0){ - LimitSpellEffect = true; - if (IsEffectInSpell(spell_id,base1)) - SpellEffect_Found = true; - } - break; case SE_LimitSpellType: switch(base1) From 12681f46234262d3b05b092eff02b8c3efa5dee9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 15 Jan 2014 21:06:18 -0500 Subject: [PATCH 9/9] Improve feign_memory_list thanks to C++11 --- zone/MobAI.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index 3852ae350..5e6aad588 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -934,22 +934,16 @@ void Client::AI_Process() else { if(AIfeignremember_timer->Check()) { - std::set::iterator RememberedCharID, tmp; + std::set::iterator RememberedCharID; RememberedCharID = feign_memory_list.begin(); - bool got_one = false; while (RememberedCharID != feign_memory_list.end()) { Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); if (remember_client == nullptr) { //they are gone now... - tmp = RememberedCharID; - ++RememberedCharID; - feign_memory_list.erase(tmp); + RememberedCharID = feign_memory_list.erase(RememberedCharID); } else if (!remember_client->GetFeigned()) { AddToHateList(remember_client->CastToMob(),1); - tmp = RememberedCharID; - ++RememberedCharID; - feign_memory_list.erase(tmp); - got_one = true; + RememberedCharID = feign_memory_list.erase(RememberedCharID); break; } else { //they are still feigned, carry on... @@ -1405,22 +1399,16 @@ void Mob::AI_Process() { // EverHood - 6/14/06 // Improved Feign Death Memory // check to see if any of our previous feigned targets have gotten up. - std::set::iterator RememberedCharID, tmp; + std::set::iterator RememberedCharID; RememberedCharID = feign_memory_list.begin(); - bool got_one = false; while (RememberedCharID != feign_memory_list.end()) { Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); if (remember_client == nullptr) { //they are gone now... - tmp = RememberedCharID; - ++RememberedCharID; - feign_memory_list.erase(tmp); + RememberedCharID = feign_memory_list.erase(RememberedCharID); } else if (!remember_client->GetFeigned()) { AddToHateList(remember_client->CastToMob(),1); - tmp = RememberedCharID; - ++RememberedCharID; - feign_memory_list.erase(tmp); - got_one = true; + RememberedCharID = feign_memory_list.erase(RememberedCharID); break; } else { //they are still feigned, carry on...