From aa8a36afd48c47fff66c91abfa9ec99a73809982 Mon Sep 17 00:00:00 2001 From: zergtmn Date: Tue, 11 May 2010 16:18:18 +0300 Subject: [PATCH 001/172] [9873] Drop outdated code for 18788 Signed-off-by: Laise --- sql/mangos_spell_check.sql | 1 - src/game/SpellEffects.cpp | 51 -------------------------------------- src/shared/revision_nr.h | 2 +- 3 files changed, 1 insertion(+), 53 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index b612bd4f3..7eec1edcd 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -96,7 +96,6 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (17269,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Resonating Skull', 'Spell::EffectDummy'), (17270,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Bone Dust', 'Spell::EffectDummy'), (17271, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Test Fetid Skull', 'Spell::EffectDummy'), -(18788,-1, -1, -1, -1, -1, -1, 1, -1,-1,'Demonic Sacrifice', 'Spell::EffectInstaKill'), (18789,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), (18790,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), (18791,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index b4377560a..4176be11e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -269,26 +269,6 @@ void Spell::EffectInstaKill(SpellEffectIndex /*eff_idx*/) if( !unitTarget || !unitTarget->isAlive() ) return; - // Demonic Sacrifice - if(m_spellInfo->Id==18788 && unitTarget->GetTypeId()==TYPEID_UNIT) - { - uint32 entry = unitTarget->GetEntry(); - uint32 spellID; - switch(entry) - { - case 416: spellID=18789; break; //imp - case 417: spellID=18792; break; //fellhunter - case 1860: spellID=18790; break; //void - case 1863: spellID=18791; break; //succubus - case 17252: spellID=35701; break; //fellguard - default: - sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.", entry); - return; - } - - m_caster->CastSpell(m_caster, spellID, true); - } - if(m_caster == unitTarget) // prevent interrupt message finish(); @@ -4752,25 +4732,7 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) // petentry==0 for hunter "call pet" (current pet summoned if any) if(m_caster->GetTypeId() == TYPEID_PLAYER && NewSummon->LoadPetFromDB((Player*)m_caster, petentry)) - { - if(NewSummon->getPetType() == SUMMON_PET) - { - // Remove Demonic Sacrifice auras (known pet) - Unit::AuraList const& auraClassScripts = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if((*itr)->GetModifier()->m_miscvalue == 2228) - { - m_caster->RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - } - return; - } // not error in case fail hunter call pet if(!petentry) @@ -4855,19 +4817,6 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) if(NewSummon->getPetType() == SUMMON_PET) { - // Remove Demonic Sacrifice auras (new pet) - Unit::AuraList const& auraClassScripts = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if((*itr)->GetModifier()->m_miscvalue == 2228) - { - m_caster->RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - // generate new name for summon pet std::string new_name = sObjectMgr.GeneratePetName(petentry); if(!new_name.empty()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2e2cc2185..24a4aa6a6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9872" + #define REVISION_NR "9873" #endif // __REVISION_NR_H__ From 789f2f8167a168dc7dcc953df4e5737dbebf23f0 Mon Sep 17 00:00:00 2001 From: reeshack Date: Tue, 11 May 2010 22:19:52 +0300 Subject: [PATCH 002/172] [9874] Fix auras with custom periodic damage not entering spell/melee bonus damage done methods Signed-off-by: Laise --- src/game/SpellAuras.cpp | 34 +++------------------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b4cdd908b..54fcb1050 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4829,11 +4829,8 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) { // Pounce Bleed if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 ) - { // $AP*0.18/6 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); - return; - } break; } case SPELLFAMILY_WARRIOR: @@ -4851,7 +4848,6 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if (m_spellProto->CalculateSimpleValue(EFFECT_INDEX_1) !=0 && m_target->GetHealth() > m_target->GetMaxHealth() * m_spellProto->CalculateSimpleValue(EFFECT_INDEX_1) / 100) m_modifier.m_amount += m_modifier.m_amount * m_spellProto->CalculateSimpleValue(EFFECT_INDEX_2) / 100; - return; } break; } @@ -4859,24 +4855,18 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) { // Rake if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000001000) && m_spellProto->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_ADD_COMBO_POINTS) - { // $AP*0.18/3 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100); - return; - } // Lacerate if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000010000000000)) - { // $AP*0.05/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); - return; - } // Rip if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000800000)) { // 0.01*$AP*cp if (caster->GetTypeId() != TYPEID_PLAYER) - return; + break; uint8 cp = ((Player*)caster)->GetComboPoints(); @@ -4891,15 +4881,11 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) } } m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); - return; } // Lock Jaw if (m_spellProto->SpellFamilyFlags & UI64LIT(0x1000000000000000)) - { // 0.15*$AP m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100); - return; - } break; } case SPELLFAMILY_ROGUE: @@ -4908,7 +4894,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000100000)) { if (caster->GetTypeId() != TYPEID_PLAYER) - return; + break; //1 point : ${($m1+$b1*1+0.015*$AP)*4} damage over 8 secs //2 points: ${($m1+$b1*2+0.024*$AP)*5} damage over 10 secs //3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs @@ -4918,40 +4904,27 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) uint8 cp = ((Player*)caster)->GetComboPoints(); if (cp > 5) cp = 5; m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]); - return; } // Garrote if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000000100)) - { // $AP*0.07 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100); - return; - } // Deadly Poison if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000010000)) - { // 0.12*$AP / 4 * amount of stack m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 * GetStackAmount() / 100); - return; - } break; } case SPELLFAMILY_HUNTER: { // Serpent Sting if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) - { // $RAP*0.2/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.2 / 5); - return; - } // Immolation Trap if ((m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) && m_spellProto->SpellIconID == 678) - { // $RAP*0.1/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); - return; - } break; } case SPELLFAMILY_PALADIN: @@ -4965,7 +4938,6 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if (holy < 0) holy = 0; m_modifier.m_amount += int32(GetStackAmount()) * (int32(ap * 0.025f) + int32(holy * 13 / 1000)); - return; } break; } @@ -8343,4 +8315,4 @@ void Aura::HandleAllowOnlyAbility(bool apply, bool Real) m_target->UpdateDamagePhysical(BASE_ATTACK); m_target->UpdateDamagePhysical(RANGED_ATTACK); m_target->UpdateDamagePhysical(OFF_ATTACK); -} +} \ No newline at end of file diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 24a4aa6a6..d898da509 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9873" + #define REVISION_NR "9874" #endif // __REVISION_NR_H__ From 5a572b99914661e38762ee49df28bd71ff329ee1 Mon Sep 17 00:00:00 2001 From: Laise Date: Tue, 11 May 2010 22:35:17 +0300 Subject: [PATCH 003/172] [9875] Fix immunity ignoring for delayed spells --- src/game/Spell.cpp | 14 ++++++++++++-- src/game/Spell.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9c7a49b4a..0b76eb390 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -928,8 +928,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) unitTarget = unit; // Reset damage/healing counter - m_damage = 0; - m_healing = 0; + ResetEffectDamageAndHeal(); // Fill base trigger info uint32 procAttacker = m_procAttacker; @@ -1082,6 +1081,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) { if (realCaster) realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE); + + ResetEffectDamageAndHeal(); return; } @@ -1102,6 +1103,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) { realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); + ResetEffectDamageAndHeal(); return; } @@ -1112,6 +1114,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) !unit->isVisibleForOrDetect(m_caster, m_caster, false)) { realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); + ResetEffectDamageAndHeal(); return; } @@ -1150,6 +1153,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if (m_spellInfo->speed > 0.0f && !IsPositiveSpell(m_spellInfo->Id)) { realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); + ResetEffectDamageAndHeal(); return; } @@ -6505,3 +6509,9 @@ WorldObject* Spell::GetCastingObject() const else return m_caster; } + +void Spell::ResetEffectDamageAndHeal() +{ + m_damage = 0; + m_healing = 0; +} \ No newline at end of file diff --git a/src/game/Spell.h b/src/game/Spell.h index 739b32ec2..7cda2c8d1 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -611,6 +611,7 @@ class Spell void DoAllEffectOnTarget(TargetInfo *target); void HandleDelayedSpellLaunch(TargetInfo *target); void InitializeDamageMultipliers(); + void ResetEffectDamageAndHeal(); void DoSpellHitOnUnit(Unit *unit, uint32 effectMask); void DoAllEffectOnTarget(GOTargetInfo *target); void DoAllEffectOnTarget(ItemTargetInfo *target); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d898da509..d43087157 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9874" + #define REVISION_NR "9875" #endif // __REVISION_NR_H__ From d04dd4e5bf1cd841c2f2ad850ba8ba9fd9c7e9cf Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 12 May 2010 03:29:29 +0400 Subject: [PATCH 004/172] [9876] Fixed TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER work TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER expected seelction friendly targets for spell caster around spell caster (so ignore original caster faction). This meaning that for begative spell also selected friendly targets for spell caster object. --- src/game/SharedDefines.h | 2 +- src/game/Spell.cpp | 18 +++++++++++++++--- src/game/Spell.h | 10 ++++++---- src/game/SpellMgr.cpp | 3 ++- src/shared/revision_nr.h | 2 +- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 2a047d913..07a245494 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1055,7 +1055,7 @@ enum Targets TARGET_GAMEOBJECT_ITEM = 26, TARGET_MASTER = 27, TARGET_ALL_ENEMY_IN_AREA_CHANNELED = 28, - TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER = 30, // in TargetB used only with TARGET_ALL_AROUND_CASTER and in self casting range in TargetA + TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER = 30, // select friendly for caster object faction (in different original caster faction) in TargetB used only with TARGET_ALL_AROUND_CASTER and in self casting range in TargetA TARGET_ALL_FRIENDLY_UNITS_IN_AREA = 31, TARGET_MINION = 32, TARGET_ALL_PARTY = 33, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0b76eb390..8920349f4 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1862,7 +1862,8 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& FillRaidOrPartyManaPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 3, true, false, false); break; default: - FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); + // selected friendly units (for casting objects) around casting object + FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY, GetCastingObject()); break; } break; @@ -6401,13 +6402,24 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski return SPELL_CAST_OK; } -void Spell::FillAreaTargets(UnitList &targetUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets) +/* + * Fill target list by units around (x,y) points at radius distance + + * @param targetUnitMap Reference to target list that filled by function + * @param x X coordinates of center point for target search + * @param y Y coordinates of center point for target search + * @param radius Radius around (x,y) for target search + * @param pushType Additional rules for target area selection (in front, angle, etc) + * @param spellTargets Additional rules for target selection base at hostile/friendly state to original spell caster + * @param originalCaster If provided set alternative original caster, if =NULL then used Spell::GetAffectiveObject() return + */ +void Spell::FillAreaTargets(UnitList &targetUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster /*=NULL*/) { CellPair p(MaNGOS::ComputeCellPair(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, targetUnitMap, radius, pushType, spellTargets); + MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, targetUnitMap, radius, pushType, spellTargets, originalCaster); TypeContainerVisitor world_notifier(notifier); TypeContainerVisitor grid_notifier(notifier); cell.Visit(p, world_notifier, *m_caster->GetMap(), *m_caster, radius); diff --git a/src/game/Spell.h b/src/game/Spell.h index 7cda2c8d1..69c2dbcaf 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -411,7 +411,7 @@ class Spell void FillTargetMap(); void SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList &targetUnitMap); - void FillAreaTargets(UnitList &targetUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets); + void FillAreaTargets(UnitList &targetUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster = NULL); void FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster); void FillRaidOrPartyManaPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster); void FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster); @@ -695,10 +695,12 @@ namespace MaNGOS bool i_playerControled; SpellNotifierCreatureAndPlayer(Spell &spell, std::list &data, float radius, SpellNotifyPushType type, - SpellTargets TargetType = SPELL_TARGETS_NOT_FRIENDLY) - : i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType) + SpellTargets TargetType = SPELL_TARGETS_NOT_FRIENDLY, WorldObject* originalCaster = NULL) + : i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), + i_originalCaster(originalCaster) { - i_originalCaster = i_spell.GetAffectiveCasterObject(); + if (!i_originalCaster) + i_originalCaster = i_spell.GetAffectiveCasterObject(); i_playerControled = i_originalCaster ? i_originalCaster->IsControlledByPlayer() : false; } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index d8aa6bebf..fe14e20c4 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -411,9 +411,9 @@ bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific s bool IsPositiveTarget(uint32 targetA, uint32 targetB) { - // non-positive targets switch(targetA) { + // non-positive targets case TARGET_CHAIN_DAMAGE: case TARGET_ALL_ENEMY_IN_AREA: case TARGET_ALL_ENEMY_IN_AREA_INSTANT: @@ -423,6 +423,7 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB) case TARGET_SINGLE_ENEMY: case TARGET_IN_FRONT_OF_CASTER_30: return false; + // positive or dependent case TARGET_CASTER_COORDINATES: return (targetB == TARGET_ALL_PARTY || targetB == TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER); default: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d43087157..32d17a400 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9875" + #define REVISION_NR "9876" #endif // __REVISION_NR_H__ From 2edc375e487823012b9d956b2ac67cee32d0a8a0 Mon Sep 17 00:00:00 2001 From: Insider42 Date: Wed, 12 May 2010 05:25:27 +0400 Subject: [PATCH 005/172] [9877] One more meteor-like spell. Signed-off-by: VladimirMangos --- src/game/SpellEffects.cpp | 1 + src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 4176be11e..0b44785c9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -305,6 +305,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Meteor like spells (divided damage to targets) case 24340: case 26558: case 28884: // Meteor case 36837: case 38903: case 41276: // Meteor + case 57467: // Meteor case 26789: // Shard of the Fallen Star case 31436: // Malevolent Cleave case 35181: // Dive Bomb diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 32d17a400..0cc87881a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9876" + #define REVISION_NR "9877" #endif // __REVISION_NR_H__ From c4247ece32c91678348e56dbab792443f3072568 Mon Sep 17 00:00:00 2001 From: GriffonHeart Date: Wed, 12 May 2010 05:58:17 +0400 Subject: [PATCH 006/172] [9878] Set for client battleground weekend event world state. Signed-off-by: VladimirMangos --- src/game/DBCStructure.h | 2 +- src/game/DBCfmt.h | 2 +- src/game/Player.cpp | 17 +++++++++++++++++ src/game/Player.h | 1 + src/shared/revision_nr.h | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 73f4c936a..e63ae5ca9 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -574,7 +574,7 @@ struct BattlemasterListEntry char* name[16]; // 11-26 //uint32 nameFlags // 27 string flag, unused uint32 maxGroupSize; // 28 maxGroupSize, used for checking if queue as group - //uint32 HolidayWorldStateId; // 29 new 3.1 + uint32 HolidayWorldStateId; // 29 new 3.1 uint32 minLevel; // 30, min level (sync with PvPDifficulty.dbc content) uint32 maxLevel; // 31, max level (sync with PvPDifficulty.dbc content) }; diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index d4c265164..582494424 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -27,7 +27,7 @@ const char AreaTriggerEntryfmt[]="niffffffff"; const char AuctionHouseEntryfmt[]="niiixxxxxxxxxxxxxxxxx"; const char BankBagSlotPricesEntryfmt[]="ni"; const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii"; -const char BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxixii"; +const char BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxiiii"; const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi"; const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx"; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a7990115e..cbddde8f0 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -8369,6 +8369,23 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) break; } GetSession()->SendPacket(&data); + + SendBGWeekendWorldStates(); +} + +void Player::SendBGWeekendWorldStates() +{ + for(uint32 i = 1; i < sBattlemasterListStore.GetNumRows(); ++i) + { + BattlemasterListEntry const * bl = sBattlemasterListStore.LookupEntry(i); + if (bl && bl->HolidayWorldStateId) + { + if (BattleGroundMgr::IsBGWeekend(BattleGroundTypeId(bl->id))) + SendUpdateWorldState(bl->HolidayWorldStateId,1); + else + SendUpdateWorldState(bl->HolidayWorldStateId,0); + } + } } uint32 Player::GetXPRestBonus(uint32 xp) diff --git a/src/game/Player.h b/src/game/Player.h index 41b01354c..06d8882a8 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1990,6 +1990,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendInitWorldStates(uint32 zone, uint32 area); void SendUpdateWorldState(uint32 Field, uint32 Value); void SendDirectMessage(WorldPacket *data); + void SendBGWeekendWorldStates(); void SendAurasForTarget(Unit *target); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0cc87881a..33cf177e4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9877" + #define REVISION_NR "9878" #endif // __REVISION_NR_H__ From d3c34e93c9792103ab58c99b7666ae308753c739 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 12 May 2010 09:22:26 +0400 Subject: [PATCH 007/172] [9879] Update battleground weekend world state at start/stop event. --- src/game/BattleGroundMgr.cpp | 34 +++++++++++++++++++++++----------- src/game/BattleGroundMgr.h | 2 ++ src/game/GameEventMgr.cpp | 32 +++++++++++++++++++++++++++++--- src/game/GameEventMgr.h | 5 +++-- src/game/SharedDefines.h | 2 ++ src/shared/revision_nr.h | 2 +- 6 files changed, 60 insertions(+), 17 deletions(-) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 6cc0ab14a..923674296 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -2043,23 +2043,35 @@ void BattleGroundMgr::LoadBattleMastersEntry() sLog.outString( ">> Loaded %u battlemaster entries", count ); } -bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId) +HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId) { switch (bgTypeId) { - case BATTLEGROUND_AV: - return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_AV); - case BATTLEGROUND_EY: - return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_EY); - case BATTLEGROUND_WS: - return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_WS); - case BATTLEGROUND_SA: - return IsHolidayActive(HOLIDAY_CALL_TO_ARMS_SA); - default: - return false; + case BATTLEGROUND_AV: return HOLIDAY_CALL_TO_ARMS_AV; + case BATTLEGROUND_EY: return HOLIDAY_CALL_TO_ARMS_EY; + case BATTLEGROUND_WS: return HOLIDAY_CALL_TO_ARMS_WS; + case BATTLEGROUND_SA: return HOLIDAY_CALL_TO_ARMS_SA; + default: return HOLIDAY_NONE; } } +BattleGroundTypeId BattleGroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday) +{ + switch (holiday) + { + case HOLIDAY_CALL_TO_ARMS_AV: return BATTLEGROUND_AV; + case HOLIDAY_CALL_TO_ARMS_EY: return BATTLEGROUND_EY; + case HOLIDAY_CALL_TO_ARMS_WS: return BATTLEGROUND_WS; + case HOLIDAY_CALL_TO_ARMS_SA: return BATTLEGROUND_SA; + default: return BATTLEGROUND_TYPE_NONE; + } +} + +bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId) +{ + return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId)); +} + void BattleGroundMgr::LoadBattleEventIndexes() { BattleGroundEventIdx events; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 2c058d649..7273ddebd 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -272,6 +272,8 @@ class BattleGroundMgr static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId); static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId); + static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId); + static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday); static bool IsBGWeekend(BattleGroundTypeId bgTypeId); private: ACE_Thread_Mutex SchedulerLock; diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index a6994f6b8..04275c311 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -25,6 +25,7 @@ #include "Language.h" #include "Log.h" #include "MapManager.h" +#include "BattleGroundMgr.h" #include "Policies/SingletonImp.h" INSTANTIATE_SINGLETON_1(GameEventMgr); @@ -143,7 +144,7 @@ void GameEventMgr::LoadFromDB() pGameEvent.end = time_t(endtime); pGameEvent.occurence = fields[3].GetUInt32(); pGameEvent.length = fields[4].GetUInt32(); - pGameEvent.holiday_id = fields[5].GetUInt32(); + pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32()); if(pGameEvent.length==0) // length>0 is validity check @@ -152,12 +153,12 @@ void GameEventMgr::LoadFromDB() continue; } - if(pGameEvent.holiday_id) + if(pGameEvent.holiday_id != HOLIDAY_NONE) { if(!sHolidaysStore.LookupEntry(pGameEvent.holiday_id)) { sLog.outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id); - pGameEvent.holiday_id = 0; + pGameEvent.holiday_id = HOLIDAY_NONE; } } @@ -454,6 +455,7 @@ uint32 GameEventMgr::Update() // return the next e // disable any event specific quest (for cases where creature is spawned, but event not active). UpdateEventQuests(itr, false); + UpdateWorldStates(itr, false); } } } @@ -477,6 +479,7 @@ void GameEventMgr::UnApplyEvent(uint16 event_id) ChangeEquipOrModel(event_id, false); // Remove quests that are events only to non event npc UpdateEventQuests(event_id, false); + UpdateWorldStates(event_id, false); } void GameEventMgr::ApplyNewEvent(uint16 event_id) @@ -494,6 +497,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) ChangeEquipOrModel(event_id, true); // Add quests that are events only to non event npc UpdateEventQuests(event_id, true); + UpdateWorldStates(event_id, true); } void GameEventMgr::GameEventSpawn(int16 event_id) @@ -733,6 +737,25 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool Activate) } } +void GameEventMgr::UpdateWorldStates(uint16 event_id, bool Activate) +{ + GameEventData const& event = mGameEvent[event_id]; + if (event.holiday_id != HOLIDAY_NONE) + { + BattleGroundTypeId bgTypeId = BattleGroundMgr::WeekendHolidayIdToBGType(event.holiday_id); + if (bgTypeId != BATTLEGROUND_TYPE_NONE) + { + BattlemasterListEntry const * bl = sBattlemasterListStore.LookupEntry(bgTypeId); + if (bl && bl->HolidayWorldStateId) + { + WorldPacket data; + sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, bl->HolidayWorldStateId, Activate ? 1 : 0); + sWorld.SendGlobalMessage(&data); + } + } + } +} + GameEventMgr::GameEventMgr() { m_IsGameEventsInit = false; @@ -740,6 +763,9 @@ GameEventMgr::GameEventMgr() MANGOS_DLL_SPEC bool IsHolidayActive( HolidayIds id ) { + if (id == HOLIDAY_NONE) + return false; + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); GameEventMgr::ActiveEvents const& ae = sGameEventMgr.GetActiveEventList(); diff --git a/src/game/GameEventMgr.h b/src/game/GameEventMgr.h index 92428bd58..b02e75f0f 100644 --- a/src/game/GameEventMgr.h +++ b/src/game/GameEventMgr.h @@ -31,12 +31,12 @@ class GameObject; struct GameEventData { - GameEventData() : start(1),end(0),occurence(0),length(0) {} + GameEventData() : start(1),end(0),occurence(0),length(0), holiday_id(HOLIDAY_NONE) {} time_t start; time_t end; uint32 occurence; uint32 length; - uint32 holiday_id; + HolidayIds holiday_id; std::string description; bool isValid() const { return length > 0; } @@ -76,6 +76,7 @@ class GameEventMgr void GameEventUnspawn(int16 event_id); void ChangeEquipOrModel(int16 event_id, bool activate); void UpdateEventQuests(uint16 event_id, bool Activate); + void UpdateWorldStates(uint16 event_id, bool Activate); protected: typedef std::list GuidList; typedef std::list IdList; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 07a245494..749ec2c7e 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1942,6 +1942,8 @@ enum CreatureEliteType // values based at Holidays.dbc enum HolidayIds { + HOLIDAY_NONE = 0, + HOLIDAY_FIREWORKS_SPECTACULAR = 62, HOLIDAY_FEAST_OF_WINTER_VEIL = 141, HOLIDAY_NOBLEGARDEN = 181, diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 33cf177e4..712dad90e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9878" + #define REVISION_NR "9879" #endif // __REVISION_NR_H__ From fecf6fdb723ee1c03e5ce78f6c995cbf5afe5c1a Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 12 May 2010 09:24:57 +0400 Subject: [PATCH 008/172] [9880] Prepare world state inint packet data in more clean way. * Avoid use hardcoded field amount values * Avoid use world state update packets just after world state init packet * Attempt make code look less horrible in general. --- src/game/BattleGround.h | 42 ++- src/game/BattleGroundAB.cpp | 20 +- src/game/BattleGroundAB.h | 2 +- src/game/BattleGroundAV.cpp | 32 +- src/game/BattleGroundAV.h | 2 +- src/game/BattleGroundBE.cpp | 8 +- src/game/BattleGroundBE.h | 2 +- src/game/BattleGroundEY.cpp | 79 ++--- src/game/BattleGroundEY.h | 2 +- src/game/BattleGroundNA.cpp | 8 +- src/game/BattleGroundNA.h | 2 +- src/game/BattleGroundRL.cpp | 8 +- src/game/BattleGroundRL.h | 2 +- src/game/BattleGroundWS.cpp | 29 +- src/game/BattleGroundWS.h | 2 +- src/game/Player.cpp | 624 +++++++++++++++++------------------- src/game/Player.h | 2 +- src/shared/revision_nr.h | 2 +- 18 files changed, 441 insertions(+), 427 deletions(-) diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 3d5419a9e..32554e417 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -22,6 +22,7 @@ #include "Common.h" #include "SharedDefines.h" #include "Map.h" +#include "ByteBuffer.h" // magic event-numbers #define BG_EVENT_NONE 255 @@ -407,7 +408,7 @@ class BattleGround /* Packet Transfer */ // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) - virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {} void SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender = NULL, bool self = true); void SendPacketToAll(WorldPacket *packet); @@ -624,4 +625,43 @@ class BattleGround float m_TeamStartLocZ[BG_TEAMS_COUNT]; float m_TeamStartLocO[BG_TEAMS_COUNT]; }; + +// helper functions for world state list fill +inline void FillInitialWorldState(ByteBuffer& data, uint32& count, uint32 state, uint32 value) +{ + data << uint32(state); + data << uint32(value); + ++count; +} + +inline void FillInitialWorldState(ByteBuffer& data, uint32& count, uint32 state, int32 value) +{ + data << uint32(state); + data << int32(value); + ++count; +} + +inline void FillInitialWorldState(ByteBuffer& data, uint32& count, uint32 state, bool value) +{ + data << uint32(state); + data << uint32(value?1:0); + ++count; +} + +struct WorldStatePair +{ + uint32 state; + uint32 value; +}; + +inline void FillInitialWorldState(ByteBuffer& data, uint32& count, WorldStatePair const* array) +{ + for(WorldStatePair const* itr = array; itr->state; ++itr) + { + data << uint32(itr->state); + data << uint32(itr->value); + ++count; + } +} + #endif diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 7f19148ef..58934ec7e 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -257,18 +257,18 @@ int32 BattleGroundAB::_GetNodeNameId(uint8 node) return 0; } -void BattleGroundAB::FillInitialWorldStates(WorldPacket& data) +void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count) { const uint8 plusArray[] = {0, 2, 3, 0, 1}; // Node icons for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node) - data << uint32(BG_AB_OP_NODEICONS[node]) << uint32((m_Nodes[node]==0)?1:0); + FillInitialWorldState(data, count, BG_AB_OP_NODEICONS[node], m_Nodes[node]==0); // Node occupied states for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node) for (uint8 i = 1; i < BG_AB_NODES_MAX; ++i) - data << uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]) << uint32((m_Nodes[node]==i)?1:0); + FillInitialWorldState(data, count, BG_AB_OP_NODESTATES[node] + plusArray[i], m_Nodes[node]==i); // How many bases each team owns uint8 ally = 0, horde = 0; @@ -278,17 +278,17 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data) else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) ++horde; - data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally); - data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(horde); + FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally); + FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde); // Team scores - data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE); - data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE); - data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]); - data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]); + FillInitialWorldState(data, count, BG_AB_OP_RESOURCES_MAX, BG_AB_MAX_TEAM_SCORE); + FillInitialWorldState(data, count, BG_AB_OP_RESOURCES_WARNING, BG_AB_WARNING_NEAR_VICTORY_SCORE); + FillInitialWorldState(data, count, BG_AB_OP_RESOURCES_ALLY, m_TeamScores[BG_TEAM_ALLIANCE]); + FillInitialWorldState(data, count, BG_AB_OP_RESOURCES_HORDE, m_TeamScores[BG_TEAM_HORDE]); // other unknown - data << uint32(0x745) << uint32(0x2); // 37 1861 unk + FillInitialWorldState(data, count, 0x745, 0x2); // 37 1861 unk } void BattleGroundAB::_SendNodeUpdate(uint8 node) diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index d41526c68..63b1f7ec3 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -193,7 +193,7 @@ class BattleGroundAB : public BattleGround /* Scorekeeping */ virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - virtual void FillInitialWorldStates(WorldPacket& data); + virtual void FillInitialWorldStates(WorldPacket& data, uint32& count); /* Nodes occupying */ virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 8f45038f6..166ae8111 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -608,7 +608,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node) PlaySoundToAll((team == BG_TEAM_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_ASSAULTS : BG_AV_SOUND_HORDE_ASSAULTS); } -void BattleGroundAV::FillInitialWorldStates(WorldPacket& data) +void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count) { bool stateok; for (uint32 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) @@ -616,28 +616,36 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data) for (uint8 j = 0; j < BG_AV_MAX_STATES; j++) { stateok = (m_Nodes[i].State == j); - data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_ALLIANCE)]) << uint32((m_Nodes[i].Owner == BG_TEAM_ALLIANCE && stateok) ? 1 : 0); - data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_HORDE)]) << uint32((m_Nodes[i].Owner == BG_TEAM_HORDE && stateok) ? 1 : 0); + FillInitialWorldState(data, count, BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_ALLIANCE)], + m_Nodes[i].Owner == BG_TEAM_ALLIANCE && stateok); + FillInitialWorldState(data, count, BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_TEAM_HORDE)], + m_Nodes[i].Owner == BG_TEAM_HORDE && stateok); } } if( m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_NEUTRAL_TEAM ) // cause neutral teams aren't handled generic - data << uint32(AV_SNOWFALL_N) << uint32(1); + FillInitialWorldState(data, count, AV_SNOWFALL_N, 1); - data << uint32(BG_AV_Alliance_Score) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]); - data << uint32(BG_AV_Horde_Score) << uint32(m_TeamScores[BG_TEAM_HORDE]); + FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[BG_TEAM_ALLIANCE]); + FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[BG_TEAM_HORDE]); if( GetStatus() == STATUS_IN_PROGRESS ) // only if game is running the teamscores are displayed { - data << uint32(BG_AV_SHOW_A_SCORE) << uint32(1); - data << uint32(BG_AV_SHOW_H_SCORE) << uint32(1); + FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, 1); + FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, 1); } else { - data << uint32(BG_AV_SHOW_A_SCORE) << uint32(0); - data << uint32(BG_AV_SHOW_H_SCORE) << uint32(0); + FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, 0); + FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, 0); } - SendMineWorldStates(BG_AV_NORTH_MINE); - SendMineWorldStates(BG_AV_SOUTH_MINE); + + FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_Owner[BG_AV_NORTH_MINE]], 1); + if (m_Mine_Owner[BG_AV_NORTH_MINE] != m_Mine_PrevOwner[BG_AV_NORTH_MINE]) + FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], 0); + + FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_Owner[BG_AV_SOUTH_MINE]], 1); + if (m_Mine_Owner[BG_AV_SOUTH_MINE] != m_Mine_PrevOwner[BG_AV_SOUTH_MINE]) + FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], 0); } void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node) diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h index 7d55bec1a..863062d38 100644 --- a/src/game/BattleGroundAV.h +++ b/src/game/BattleGroundAV.h @@ -312,7 +312,7 @@ class BattleGroundAV : public BattleGround virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); // world states - virtual void FillInitialWorldStates(WorldPacket& data); + virtual void FillInitialWorldStates(WorldPacket& data, uint32& count); void RemovePlayer(Player *plr,uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 20538aac8..435109960 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -135,11 +135,11 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger) // HandleTriggerBuff(buff_guid,Source); } -void BattleGroundBE::FillInitialWorldStates(WorldPacket &data) +void BattleGroundBE::FillInitialWorldStates(WorldPacket &data, uint32& count) { - data << uint32(0x9f1) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 - data << uint32(0x9f0) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 - data << uint32(0x9f3) << uint32(1); // 9 + FillInitialWorldState(data, count, 0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); + FillInitialWorldState(data, count, 0x9f0, GetAlivePlayersCountByTeam(HORDE)); + FillInitialWorldState(data, count, 0x9f3, 1); } void BattleGroundBE::Reset() diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h index d58870062..8b2cc33df 100644 --- a/src/game/BattleGroundBE.h +++ b/src/game/BattleGroundBE.h @@ -45,7 +45,7 @@ class BattleGroundBE : public BattleGround void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + virtual void FillInitialWorldStates(WorldPacket &d, uint32& count); void HandleKillPlayer(Player* player, Player *killer); bool HandlePlayerUnderMap(Player * plr); diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 3651d3f53..2bbbec34c 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -660,54 +660,41 @@ void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value } } -void BattleGroundEY::FillInitialWorldStates(WorldPacket& data) +void BattleGroundEY::FillInitialWorldStates(WorldPacket& data, uint32& count) { - data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]); - data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_ALLIANCE]); - data << uint32(0xab6) << uint32(0x0); - data << uint32(0xab5) << uint32(0x0); - data << uint32(0xab4) << uint32(0x0); - data << uint32(0xab3) << uint32(0x0); - data << uint32(0xab2) << uint32(0x0); - data << uint32(0xab1) << uint32(0x0); - data << uint32(0xab0) << uint32(0x0); - data << uint32(0xaaf) << uint32(0x0); + FillInitialWorldState(data, count, EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]); + FillInitialWorldState(data, count, EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]); + FillInitialWorldState(data, count, 0xab6, 0x0); + FillInitialWorldState(data, count, 0xab5, 0x0); + FillInitialWorldState(data, count, 0xab4, 0x0); + FillInitialWorldState(data, count, 0xab3, 0x0); + FillInitialWorldState(data, count, 0xab2, 0x0); + FillInitialWorldState(data, count, 0xab1, 0x0); + FillInitialWorldState(data, count, 0xab0, 0x0); + FillInitialWorldState(data, count, 0xaaf, 0x0); - data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - - data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - - data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); - - data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - - data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - - data << uint32(MAGE_TOWER_UNCONTROL) << uint32(m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL); - - data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == HORDE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); - - data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == ALLIANCE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); - - data << uint32(FEL_REAVER_UNCONTROL) << uint32(m_PointState[FEL_REALVER] != EY_POINT_UNDER_CONTROL); - - data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - - data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - - data << uint32(BLOOD_ELF_UNCONTROL) << uint32(m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL); - - data << uint32(NETHERSTORM_FLAG) << uint32(m_FlagState == BG_EY_FLAG_STATE_ON_BASE); - - data << uint32(0xad2) << uint32(0x1); - data << uint32(0xad1) << uint32(0x1); - data << uint32(0xabe) << uint32(GetTeamScore(HORDE)); - data << uint32(0xabd) << uint32(GetTeamScore(ALLIANCE)); - data << uint32(0xa05) << uint32(0x8e); - data << uint32(0xaa0) << uint32(0x0); - data << uint32(0xa9f) << uint32(0x0); - data << uint32(0xa9e) << uint32(0x0); - data << uint32(0xc0d) << uint32(0x17b); + FillInitialWorldState(data, count, DRAENEI_RUINS_HORDE_CONTROL, m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, DRAENEI_RUINS_ALLIANCE_CONTROL, m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, DRAENEI_RUINS_UNCONTROL, m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, MAGE_TOWER_ALLIANCE_CONTROL, m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, MAGE_TOWER_HORDE_CONTROL, m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, MAGE_TOWER_UNCONTROL, m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, FEL_REAVER_HORDE_CONTROL, m_PointOwnedByTeam[FEL_REALVER] == HORDE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, FEL_REAVER_ALLIANCE_CONTROL, m_PointOwnedByTeam[FEL_REALVER] == ALLIANCE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, FEL_REAVER_UNCONTROL, m_PointState[FEL_REALVER] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, BLOOD_ELF_HORDE_CONTROL, m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, BLOOD_ELF_ALLIANCE_CONTROL, m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, BLOOD_ELF_UNCONTROL, m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, NETHERSTORM_FLAG, m_FlagState == BG_EY_FLAG_STATE_ON_BASE); + FillInitialWorldState(data, count, 0xad2, 0x1); + FillInitialWorldState(data, count, 0xad1, 0x1); + FillInitialWorldState(data, count, 0xabe, GetTeamScore(HORDE)); + FillInitialWorldState(data, count, 0xabd, GetTeamScore(ALLIANCE)); + FillInitialWorldState(data, count, 0xa05, 0x8e); + FillInitialWorldState(data, count, 0xaa0, 0x0); + FillInitialWorldState(data, count, 0xa9f, 0x0); + FillInitialWorldState(data, count, 0xa9e, 0x0); + FillInitialWorldState(data, count, 0xc0d, 0x17b); } WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player) diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 1887a73b3..36374ff4d 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -278,7 +278,7 @@ class BattleGroundEY : public BattleGround void UpdateTeamScore(uint32 Team); void EndBattleGround(uint32 winner); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - virtual void FillInitialWorldStates(WorldPacket& data); + virtual void FillInitialWorldStates(WorldPacket& data, uint32& count); void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;} uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index 02d30ba00..336dca557 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -131,11 +131,11 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger) // HandleTriggerBuff(buff_guid,Source); } -void BattleGroundNA::FillInitialWorldStates(WorldPacket &data) +void BattleGroundNA::FillInitialWorldStates(WorldPacket &data, uint32& count) { - data << uint32(0xa0f) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 - data << uint32(0xa10) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 - data << uint32(0xa11) << uint32(1); // 9 + FillInitialWorldState(data, count, 0xa0f, GetAlivePlayersCountByTeam(ALLIANCE)); + FillInitialWorldState(data, count, 0xa10, GetAlivePlayersCountByTeam(HORDE)); + FillInitialWorldState(data, count, 0xa11, 1); } void BattleGroundNA::Reset() diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h index 2bc9102e3..cc8cdad56 100644 --- a/src/game/BattleGroundNA.h +++ b/src/game/BattleGroundNA.h @@ -46,7 +46,7 @@ class BattleGroundNA : public BattleGround void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + virtual void FillInitialWorldStates(WorldPacket &d, uint32& count); void HandleKillPlayer(Player* player, Player *killer); bool HandlePlayerUnderMap(Player * plr); }; diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index eb4232081..d54a1195e 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -132,11 +132,11 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger) // HandleTriggerBuff(buff_guid,Source); } -void BattleGroundRL::FillInitialWorldStates(WorldPacket &data) +void BattleGroundRL::FillInitialWorldStates(WorldPacket &data, uint32& count) { - data << uint32(0xbb8) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 - data << uint32(0xbb9) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 - data << uint32(0xbba) << uint32(1); // 9 + FillInitialWorldState(data, count, 0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); + FillInitialWorldState(data, count, 0xbb9, GetAlivePlayersCountByTeam(HORDE)); + FillInitialWorldState(data, count, 0xbba, 1); } void BattleGroundRL::Reset() diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h index 10dce567d..8766a5b1e 100644 --- a/src/game/BattleGroundRL.h +++ b/src/game/BattleGroundRL.h @@ -40,7 +40,7 @@ class BattleGroundRL : public BattleGround /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + virtual void FillInitialWorldStates(WorldPacket &d, uint32& count); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index c6de4d032..ba2b6e411 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -596,35 +596,34 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player) } } -void BattleGroundWS::FillInitialWorldStates(WorldPacket& data) +void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count) { - data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE)); - data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE)); + FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(ALLIANCE)); + FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(HORDE)); if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) - data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); + FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, -1); else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1); + FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1); else - data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0); + FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0); if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) - data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1); + FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, -1); else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1); + FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1); else - data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0); + FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0); - data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); + FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE); if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2); + FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2); else - data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1); + FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1); if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2); + FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2); else - data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1); - + FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); } diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index 9cbfae22c..42d3d9817 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -134,7 +134,7 @@ class BattleGroundWS : public BattleGround void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;} uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} - virtual void FillInitialWorldStates(WorldPacket& data); + virtual void FillInitialWorldStates(WorldPacket& data, uint32& count); /* Scorekeeping */ uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index cbddde8f0..c0a905924 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7976,98 +7976,289 @@ void Player::SendUpdateWorldState(uint32 Field, uint32 Value) GetSession()->SendPacket(&data); } +static WorldStatePair AV_world_states[] = +{ + { 0x7ae, 0x1 }, // 7 snowfall n + { 0x532, 0x1 }, // 8 frostwolfhut hc + { 0x531, 0x0 }, // 9 frostwolfhut ac + { 0x52e, 0x0 }, // 10 stormpike firstaid a_a + { 0x571, 0x0 }, // 11 east frostwolf tower horde assaulted -unused + { 0x570, 0x0 }, // 12 west frostwolf tower horde assaulted - unused + { 0x567, 0x1 }, // 13 frostwolfe c + { 0x566, 0x1 }, // 14 frostwolfw c + { 0x550, 0x1 }, // 15 irondeep (N) ally + { 0x544, 0x0 }, // 16 ice grave a_a + { 0x536, 0x0 }, // 17 stormpike grave h_c + { 0x535, 0x1 }, // 18 stormpike grave a_c + { 0x518, 0x0 }, // 19 stoneheart grave a_a + { 0x517, 0x0 }, // 20 stoneheart grave h_a + { 0x574, 0x0 }, // 21 1396 unk + { 0x573, 0x0 }, // 22 iceblood tower horde assaulted -unused + { 0x572, 0x0 }, // 23 towerpoint horde assaulted - unused + { 0x56f, 0x0 }, // 24 1391 unk + { 0x56e, 0x0 }, // 25 iceblood a + { 0x56d, 0x0 }, // 26 towerp a + { 0x56c, 0x0 }, // 27 frostwolfe a + { 0x56b, 0x0 }, // 28 froswolfw a + { 0x56a, 0x1 }, // 29 1386 unk + { 0x569, 0x1 }, // 30 iceblood c + { 0x568, 0x1 }, // 31 towerp c + { 0x565, 0x0 }, // 32 stoneh tower a + { 0x564, 0x0 }, // 33 icewing tower a + { 0x563, 0x0 }, // 34 dunn a + { 0x562, 0x0 }, // 35 duns a + { 0x561, 0x0 }, // 36 stoneheart bunker alliance assaulted - unused + { 0x560, 0x0 }, // 37 icewing bunker alliance assaulted - unused + { 0x55f, 0x0 }, // 38 dunbaldar south alliance assaulted - unused + { 0x55e, 0x0 }, // 39 dunbaldar north alliance assaulted - unused + { 0x55d, 0x0 }, // 40 stone tower d + { 0x3c6, 0x0 }, // 41 966 unk + { 0x3c4, 0x0 }, // 42 964 unk + { 0x3c2, 0x0 }, // 43 962 unk + { 0x516, 0x1 }, // 44 stoneheart grave a_c + { 0x515, 0x0 }, // 45 stonheart grave h_c + { 0x3b6, 0x0 }, // 46 950 unk + { 0x55c, 0x0 }, // 47 icewing tower d + { 0x55b, 0x0 }, // 48 dunn d + { 0x55a, 0x0 }, // 49 duns d + { 0x559, 0x0 }, // 50 1369 unk + { 0x558, 0x0 }, // 51 iceblood d + { 0x557, 0x0 }, // 52 towerp d + { 0x556, 0x0 }, // 53 frostwolfe d + { 0x555, 0x0 }, // 54 frostwolfw d + { 0x554, 0x1 }, // 55 stoneh tower c + { 0x553, 0x1 }, // 56 icewing tower c + { 0x552, 0x1 }, // 57 dunn c + { 0x551, 0x1 }, // 58 duns c + { 0x54f, 0x0 }, // 59 irondeep (N) horde + { 0x54e, 0x0 }, // 60 irondeep (N) ally + { 0x54d, 0x1 }, // 61 mine (S) neutral + { 0x54c, 0x0 }, // 62 mine (S) horde + { 0x54b, 0x0 }, // 63 mine (S) ally + { 0x545, 0x0 }, // 64 iceblood h_a + { 0x543, 0x1 }, // 65 iceblod h_c + { 0x542, 0x0 }, // 66 iceblood a_c + { 0x540, 0x0 }, // 67 snowfall h_a + { 0x53f, 0x0 }, // 68 snowfall a_a + { 0x53e, 0x0 }, // 69 snowfall h_c + { 0x53d, 0x0 }, // 70 snowfall a_c + { 0x53c, 0x0 }, // 71 frostwolf g h_a + { 0x53b, 0x0 }, // 72 frostwolf g a_a + { 0x53a, 0x1 }, // 73 frostwolf g h_c + { 0x539, 0x0 }, // 74 frostwolf g a_c + { 0x538, 0x0 }, // 75 stormpike grave h_a + { 0x537, 0x0 }, // 76 stormpike grave a_a + { 0x534, 0x0 }, // 77 frostwolf hut h_a + { 0x533, 0x0 }, // 78 frostwolf hut a_a + { 0x530, 0x0 }, // 79 stormpike first aid h_a + { 0x52f, 0x0 }, // 80 stormpike first aid h_c + { 0x52d, 0x1 }, // 81 stormpike first aid a_c + { 0x0, 0x0 } +}; + +static WorldStatePair WS_world_states[] = +{ + { 0x62d, 0x0 }, // 7 1581 alliance flag captures + { 0x62e, 0x0 }, // 8 1582 horde flag captures + { 0x609, 0x0 }, // 9 1545 unk, set to 1 on alliance flag pickup... + { 0x60a, 0x0 }, // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1 + { 0x60b, 0x2 }, // 11 1547 unk + { 0x641, 0x3 }, // 12 1601 unk (max flag captures?) + { 0x922, 0x1 }, // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + { 0x923, 0x1 }, // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + { 0x0, 0x0 } +}; + +static WorldStatePair AB_world_states[] = +{ + { 0x6e7, 0x0 }, // 7 1767 stables alliance + { 0x6e8, 0x0 }, // 8 1768 stables horde + { 0x6e9, 0x0 }, // 9 1769 unk, ST? + { 0x6ea, 0x0 }, // 10 1770 stables (show/hide) + { 0x6ec, 0x0 }, // 11 1772 farm (0 - horde controlled, 1 - alliance controlled) + { 0x6ed, 0x0 }, // 12 1773 farm (show/hide) + { 0x6ee, 0x0 }, // 13 1774 farm color + { 0x6ef, 0x0 }, // 14 1775 gold mine color, may be FM? + { 0x6f0, 0x0 }, // 15 1776 alliance resources + { 0x6f1, 0x0 }, // 16 1777 horde resources + { 0x6f2, 0x0 }, // 17 1778 horde bases + { 0x6f3, 0x0 }, // 18 1779 alliance bases + { 0x6f4, 0x7d0 }, // 19 1780 max resources (2000) + { 0x6f6, 0x0 }, // 20 1782 blacksmith color + { 0x6f7, 0x0 }, // 21 1783 blacksmith (show/hide) + { 0x6f8, 0x0 }, // 22 1784 unk, bs? + { 0x6f9, 0x0 }, // 23 1785 unk, bs? + { 0x6fb, 0x0 }, // 24 1787 gold mine (0 - horde contr, 1 - alliance contr) + { 0x6fc, 0x0 }, // 25 1788 gold mine (0 - conflict, 1 - horde) + { 0x6fd, 0x0 }, // 26 1789 gold mine (1 - show/0 - hide) + { 0x6fe, 0x0 }, // 27 1790 gold mine color + { 0x700, 0x0 }, // 28 1792 gold mine color, wtf?, may be LM? + { 0x701, 0x0 }, // 29 1793 lumber mill color (0 - conflict, 1 - horde contr) + { 0x702, 0x0 }, // 30 1794 lumber mill (show/hide) + { 0x703, 0x0 }, // 31 1795 lumber mill color color + { 0x732, 0x1 }, // 32 1842 stables (1 - uncontrolled) + { 0x733, 0x1 }, // 33 1843 gold mine (1 - uncontrolled) + { 0x734, 0x1 }, // 34 1844 lumber mill (1 - uncontrolled) + { 0x735, 0x1 }, // 35 1845 farm (1 - uncontrolled) + { 0x736, 0x1 }, // 36 1846 blacksmith (1 - uncontrolled) + { 0x745, 0x2 }, // 37 1861 unk + { 0x7a3, 0x708 }, // 38 1955 warning limit (1800) + { 0x0, 0x0 } +}; + +static WorldStatePair EY_world_states[] = +{ + { 0xac1, 0x0 }, // 7 2753 Horde Bases + { 0xac0, 0x0 }, // 8 2752 Alliance Bases + { 0xab6, 0x0 }, // 9 2742 Mage Tower - Horde conflict + { 0xab5, 0x0 }, // 10 2741 Mage Tower - Alliance conflict + { 0xab4, 0x0 }, // 11 2740 Fel Reaver - Horde conflict + { 0xab3, 0x0 }, // 12 2739 Fel Reaver - Alliance conflict + { 0xab2, 0x0 }, // 13 2738 Draenei - Alliance conflict + { 0xab1, 0x0 }, // 14 2737 Draenei - Horde conflict + { 0xab0, 0x0 }, // 15 2736 unk // 0 at start + { 0xaaf, 0x0 }, // 16 2735 unk // 0 at start + { 0xaad, 0x0 }, // 17 2733 Draenei - Horde control + { 0xaac, 0x0 }, // 18 2732 Draenei - Alliance control + { 0xaab, 0x1 }, // 19 2731 Draenei uncontrolled (1 - yes, 0 - no) + { 0xaaa, 0x0 }, // 20 2730 Mage Tower - Alliance control + { 0xaa9, 0x0 }, // 21 2729 Mage Tower - Horde control + { 0xaa8, 0x1 }, // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) + { 0xaa7, 0x0 }, // 23 2727 Fel Reaver - Horde control + { 0xaa6, 0x0 }, // 24 2726 Fel Reaver - Alliance control + { 0xaa5, 0x1 }, // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) + { 0xaa4, 0x0 }, // 26 2724 Boold Elf - Horde control + { 0xaa3, 0x0 }, // 27 2723 Boold Elf - Alliance control + { 0xaa2, 0x1 }, // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) + { 0xac5, 0x1 }, // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way! + { 0xad2, 0x1 }, // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag + { 0xad1, 0x1 }, // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag + { 0xabe, 0x0 }, // 32 2750 Horde resources + { 0xabd, 0x0 }, // 33 2749 Alliance resources + { 0xa05, 0x8e }, // 34 2565 unk, constant? + { 0xaa0, 0x0 }, // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) + { 0xa9f, 0x0 }, // 36 2719 Capturing progress-bar (0 - left, 100 - right) + { 0xa9e, 0x0 }, // 37 2718 Capturing progress-bar (1 - show, 0 - hide) + { 0xc0d, 0x17b }, // 38 3085 unk + // and some more ... unknown + { 0x0, 0x0 } +}; + +static WorldStatePair HP_world_states[] = // Hellfire Peninsula +{ + { 0x9ba, 0x1 }, // 10 + { 0x9b9, 0x1 }, // 11 + { 0x9b5, 0x0 }, // 12 + { 0x9b4, 0x1 }, // 13 + { 0x9b3, 0x0 }, // 14 + { 0x9b2, 0x0 }, // 15 + { 0x9b1, 0x1 }, // 16 + { 0x9b0, 0x0 }, // 17 + { 0x9ae, 0x0 }, // 18 horde pvp objectives captured + { 0x9ac, 0x0 }, // 19 + { 0x9a8, 0x0 }, // 20 + { 0x9a7, 0x0 }, // 21 + { 0x9a6, 0x1 }, // 22 + { 0x0, 0x0 } +}; + +static WorldStatePair TF_world_states[] = // Terokkar Forest +{ + { 0xa41, 0x0 }, // 10 + { 0xa40, 0x14 }, // 11 + { 0xa3f, 0x0 }, // 12 + { 0xa3e, 0x0 }, // 13 + { 0xa3d, 0x5 }, // 14 + { 0xa3c, 0x0 }, // 15 + { 0xa87, 0x0 }, // 16 + { 0xa86, 0x0 }, // 17 + { 0xa85, 0x0 }, // 18 + { 0xa84, 0x0 }, // 19 + { 0xa83, 0x0 }, // 20 + { 0xa82, 0x0 }, // 21 + { 0xa81, 0x0 }, // 22 + { 0xa80, 0x0 }, // 23 + { 0xa7e, 0x0 }, // 24 + { 0xa7d, 0x0 }, // 25 + { 0xa7c, 0x0 }, // 26 + { 0xa7b, 0x0 }, // 27 + { 0xa7a, 0x0 }, // 28 + { 0xa79, 0x0 }, // 29 + { 0x9d0, 0x5 }, // 30 + { 0x9ce, 0x0 }, // 31 + { 0x9cd, 0x0 }, // 32 + { 0x9cc, 0x0 }, // 33 + { 0xa88, 0x0 }, // 34 + { 0xad0, 0x0 }, // 35 + { 0xacf, 0x1 }, // 36 + { 0x0, 0x0 } +}; + +static WorldStatePair ZM_world_states[] = // Terokkar Forest +{ + { 0x9e1, 0x0 }, // 10 + { 0x9e0, 0x0 }, // 11 + { 0x9df, 0x0 }, // 12 + { 0xa5d, 0x1 }, // 13 + { 0xa5c, 0x0 }, // 14 + { 0xa5b, 0x1 }, // 15 + { 0xa5a, 0x0 }, // 16 + { 0xa59, 0x1 }, // 17 + { 0xa58, 0x0 }, // 18 + { 0xa57, 0x0 }, // 19 + { 0xa56, 0x0 }, // 20 + { 0xa55, 0x1 }, // 21 + { 0xa54, 0x0 }, // 22 + { 0x9e7, 0x0 }, // 23 + { 0x9e6, 0x0 }, // 24 + { 0x9e5, 0x0 }, // 25 + { 0xa00, 0x0 }, // 26 + { 0x9ff, 0x1 }, // 27 + { 0x9fe, 0x0 }, // 28 + { 0x9fd, 0x0 }, // 29 + { 0x9fc, 0x1 }, // 30 + { 0x9fb, 0x0 }, // 31 + { 0xa62, 0x0 }, // 32 + { 0xa61, 0x1 }, // 33 + { 0xa60, 0x1 }, // 34 + { 0xa5f, 0x0 }, // 35 + { 0x0, 0x0 } +}; + void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) { // data depends on zoneid/mapid... BattleGround* bg = GetBattleGround(); - uint16 NumberOfFields = 0; uint32 mapid = GetMapId(); DEBUG_LOG("Sending SMSG_INIT_WORLD_STATES to Map:%u, Zone: %u", mapid, zoneid); - // may be exist better way to do this... - switch(zoneid) - { - case 0: - case 1: - case 4: - case 8: - case 10: - case 11: - case 12: - case 36: - case 38: - case 40: - case 41: - case 51: - case 267: - case 1519: - case 1537: - case 2257: - case 2918: - NumberOfFields = 8; - break; - case 139: - NumberOfFields = 41; - break; - case 1377: - NumberOfFields = 15; - break; - case 2597: - NumberOfFields = 83; - break; - case 3277: - NumberOfFields = 16; - break; - case 3358: - case 3820: - NumberOfFields = 40; - break; - case 3483: - NumberOfFields = 27; - break; - case 3518: - NumberOfFields = 39; - break; - case 3519: - NumberOfFields = 38; - break; - case 3521: - NumberOfFields = 37; - break; - case 3698: - case 3702: - case 3968: - NumberOfFields = 11; - break; - case 3703: - NumberOfFields = 11; - break; - default: - NumberOfFields = 12; - break; - } + uint32 count = 0; // count of world states in packet - WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+(NumberOfFields*8))); + WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+8*8));// guess data << uint32(mapid); // mapid data << uint32(zoneid); // zone id data << uint32(areaid); // area id, new 2.1.0 - data << uint16(NumberOfFields); // count of uint64 blocks - data << uint32(0x8d8) << uint32(0x0); // 1 - data << uint32(0x8d7) << uint32(0x0); // 2 - data << uint32(0x8d6) << uint32(0x0); // 3 - data << uint32(0x8d5) << uint32(0x0); // 4 - data << uint32(0x8d4) << uint32(0x0); // 5 - data << uint32(0x8d3) << uint32(0x0); // 6 + size_t count_pos = data.wpos(); + data << uint16(0); // count of uint64 blocks, placeholder + + // common fields + FillInitialWorldState(data, count, 0x8d8, 0x0); // 1 + FillInitialWorldState(data, count, 0x8d7, 0x0); // 2 + FillInitialWorldState(data, count, 0x8d6, 0x0); // 3 + FillInitialWorldState(data, count, 0x8d5, 0x0); // 4 + FillInitialWorldState(data, count, 0x8d4, 0x0); // 5 + FillInitialWorldState(data, count, 0x8d3, 0x0); // 6 // 7 1 - Arena season in progress, 0 - end of season - data << uint32(0xC77) << uint32(sWorld.getConfig(CONFIG_BOOL_ARENA_SEASON_IN_PROGRESS)); + FillInitialWorldState(data, count, 0xC77, sWorld.getConfig(CONFIG_BOOL_ARENA_SEASON_IN_PROGRESS)); // 8 Arena season id - data << uint32(0xF3D) << uint32(sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID)); + FillInitialWorldState(data, count, 0xF3D, sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID)); + if(mapid == 530) // Outland { - data << uint32(0x9bf) << uint32(0x0); // 7 - data << uint32(0x9bd) << uint32(0xF); // 8 - data << uint32(0x9bb) << uint32(0xF); // 9 + FillInitialWorldState(data, count, 0x9bf, 0x0); + FillInitialWorldState(data, count, 0x9bd, 0xF); + FillInitialWorldState(data, count, 0x9bb, 0xF); } switch(zoneid) { @@ -8083,297 +8274,86 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) break; case 2597: // AV if (bg && bg->GetTypeID() == BATTLEGROUND_AV) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else - { - data << uint32(0x7ae) << uint32(0x1); // 7 snowfall n - data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc - data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac - data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a - data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused - data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused - data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c - data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c - data << uint32(0x550) << uint32(0x1); // 15 irondeep (N) ally - data << uint32(0x544) << uint32(0x0); // 16 ice grave a_a - data << uint32(0x536) << uint32(0x0); // 17 stormpike grave h_c - data << uint32(0x535) << uint32(0x1); // 18 stormpike grave a_c - data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a - data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a - data << uint32(0x574) << uint32(0x0); // 21 1396 unk - data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused - data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused - data << uint32(0x56f) << uint32(0x0); // 24 1391 unk - data << uint32(0x56e) << uint32(0x0); // 25 iceblood a - data << uint32(0x56d) << uint32(0x0); // 26 towerp a - data << uint32(0x56c) << uint32(0x0); // 27 frostwolfe a - data << uint32(0x56b) << uint32(0x0); // 28 froswolfw a - data << uint32(0x56a) << uint32(0x1); // 29 1386 unk - data << uint32(0x569) << uint32(0x1); // 30 iceblood c - data << uint32(0x568) << uint32(0x1); // 31 towerp c - data << uint32(0x565) << uint32(0x0); // 32 stoneh tower a - data << uint32(0x564) << uint32(0x0); // 33 icewing tower a - data << uint32(0x563) << uint32(0x0); // 34 dunn a - data << uint32(0x562) << uint32(0x0); // 35 duns a - data << uint32(0x561) << uint32(0x0); // 36 stoneheart bunker alliance assaulted - unused - data << uint32(0x560) << uint32(0x0); // 37 icewing bunker alliance assaulted - unused - data << uint32(0x55f) << uint32(0x0); // 38 dunbaldar south alliance assaulted - unused - data << uint32(0x55e) << uint32(0x0); // 39 dunbaldar north alliance assaulted - unused - data << uint32(0x55d) << uint32(0x0); // 40 stone tower d - data << uint32(0x3c6) << uint32(0x0); // 41 966 unk - data << uint32(0x3c4) << uint32(0x0); // 42 964 unk - data << uint32(0x3c2) << uint32(0x0); // 43 962 unk - data << uint32(0x516) << uint32(0x1); // 44 stoneheart grave a_c - data << uint32(0x515) << uint32(0x0); // 45 stonheart grave h_c - data << uint32(0x3b6) << uint32(0x0); // 46 950 unk - data << uint32(0x55c) << uint32(0x0); // 47 icewing tower d - data << uint32(0x55b) << uint32(0x0); // 48 dunn d - data << uint32(0x55a) << uint32(0x0); // 49 duns d - data << uint32(0x559) << uint32(0x0); // 50 1369 unk - data << uint32(0x558) << uint32(0x0); // 51 iceblood d - data << uint32(0x557) << uint32(0x0); // 52 towerp d - data << uint32(0x556) << uint32(0x0); // 53 frostwolfe d - data << uint32(0x555) << uint32(0x0); // 54 frostwolfw d - data << uint32(0x554) << uint32(0x1); // 55 stoneh tower c - data << uint32(0x553) << uint32(0x1); // 56 icewing tower c - data << uint32(0x552) << uint32(0x1); // 57 dunn c - data << uint32(0x551) << uint32(0x1); // 58 duns c - data << uint32(0x54f) << uint32(0x0); // 59 irondeep (N) horde - data << uint32(0x54e) << uint32(0x0); // 60 irondeep (N) ally - data << uint32(0x54d) << uint32(0x1); // 61 mine (S) neutral - data << uint32(0x54c) << uint32(0x0); // 62 mine (S) horde - data << uint32(0x54b) << uint32(0x0); // 63 mine (S) ally - data << uint32(0x545) << uint32(0x0); // 64 iceblood h_a - data << uint32(0x543) << uint32(0x1); // 65 iceblod h_c - data << uint32(0x542) << uint32(0x0); // 66 iceblood a_c - data << uint32(0x540) << uint32(0x0); // 67 snowfall h_a - data << uint32(0x53f) << uint32(0x0); // 68 snowfall a_a - data << uint32(0x53e) << uint32(0x0); // 69 snowfall h_c - data << uint32(0x53d) << uint32(0x0); // 70 snowfall a_c - data << uint32(0x53c) << uint32(0x0); // 71 frostwolf g h_a - data << uint32(0x53b) << uint32(0x0); // 72 frostwolf g a_a - data << uint32(0x53a) << uint32(0x1); // 73 frostwolf g h_c - data << uint32(0x539) << uint32(0x0); // 74 frostwolf g a_c - data << uint32(0x538) << uint32(0x0); // 75 stormpike grave h_a - data << uint32(0x537) << uint32(0x0); // 76 stormpike grave a_a - data << uint32(0x534) << uint32(0x0); // 77 frostwolf hut h_a - data << uint32(0x533) << uint32(0x0); // 78 frostwolf hut a_a - data << uint32(0x530) << uint32(0x0); // 79 stormpike first aid h_a - data << uint32(0x52f) << uint32(0x0); // 80 stormpike first aid h_c - data << uint32(0x52d) << uint32(0x1); // 81 stormpike first aid a_c - } + FillInitialWorldState(data,count, AV_world_states); break; case 3277: // WS if (bg && bg->GetTypeID() == BATTLEGROUND_WS) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else - { - data << uint32(0x62d) << uint32(0x0); // 7 1581 alliance flag captures - data << uint32(0x62e) << uint32(0x0); // 8 1582 horde flag captures - data << uint32(0x609) << uint32(0x0); // 9 1545 unk, set to 1 on alliance flag pickup... - data << uint32(0x60a) << uint32(0x0); // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1 - data << uint32(0x60b) << uint32(0x2); // 11 1547 unk - data << uint32(0x641) << uint32(0x3); // 12 1601 unk (max flag captures?) - data << uint32(0x922) << uint32(0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - data << uint32(0x923) << uint32(0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - } + FillInitialWorldState(data,count, WS_world_states); break; case 3358: // AB if (bg && bg->GetTypeID() == BATTLEGROUND_AB) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else - { - data << uint32(0x6e7) << uint32(0x0); // 7 1767 stables alliance - data << uint32(0x6e8) << uint32(0x0); // 8 1768 stables horde - data << uint32(0x6e9) << uint32(0x0); // 9 1769 unk, ST? - data << uint32(0x6ea) << uint32(0x0); // 10 1770 stables (show/hide) - data << uint32(0x6ec) << uint32(0x0); // 11 1772 farm (0 - horde controlled, 1 - alliance controlled) - data << uint32(0x6ed) << uint32(0x0); // 12 1773 farm (show/hide) - data << uint32(0x6ee) << uint32(0x0); // 13 1774 farm color - data << uint32(0x6ef) << uint32(0x0); // 14 1775 gold mine color, may be FM? - data << uint32(0x6f0) << uint32(0x0); // 15 1776 alliance resources - data << uint32(0x6f1) << uint32(0x0); // 16 1777 horde resources - data << uint32(0x6f2) << uint32(0x0); // 17 1778 horde bases - data << uint32(0x6f3) << uint32(0x0); // 18 1779 alliance bases - data << uint32(0x6f4) << uint32(0x7d0); // 19 1780 max resources (2000) - data << uint32(0x6f6) << uint32(0x0); // 20 1782 blacksmith color - data << uint32(0x6f7) << uint32(0x0); // 21 1783 blacksmith (show/hide) - data << uint32(0x6f8) << uint32(0x0); // 22 1784 unk, bs? - data << uint32(0x6f9) << uint32(0x0); // 23 1785 unk, bs? - data << uint32(0x6fb) << uint32(0x0); // 24 1787 gold mine (0 - horde contr, 1 - alliance contr) - data << uint32(0x6fc) << uint32(0x0); // 25 1788 gold mine (0 - conflict, 1 - horde) - data << uint32(0x6fd) << uint32(0x0); // 26 1789 gold mine (1 - show/0 - hide) - data << uint32(0x6fe) << uint32(0x0); // 27 1790 gold mine color - data << uint32(0x700) << uint32(0x0); // 28 1792 gold mine color, wtf?, may be LM? - data << uint32(0x701) << uint32(0x0); // 29 1793 lumber mill color (0 - conflict, 1 - horde contr) - data << uint32(0x702) << uint32(0x0); // 30 1794 lumber mill (show/hide) - data << uint32(0x703) << uint32(0x0); // 31 1795 lumber mill color color - data << uint32(0x732) << uint32(0x1); // 32 1842 stables (1 - uncontrolled) - data << uint32(0x733) << uint32(0x1); // 33 1843 gold mine (1 - uncontrolled) - data << uint32(0x734) << uint32(0x1); // 34 1844 lumber mill (1 - uncontrolled) - data << uint32(0x735) << uint32(0x1); // 35 1845 farm (1 - uncontrolled) - data << uint32(0x736) << uint32(0x1); // 36 1846 blacksmith (1 - uncontrolled) - data << uint32(0x745) << uint32(0x2); // 37 1861 unk - data << uint32(0x7a3) << uint32(0x708); // 38 1955 warning limit (1800) - } + FillInitialWorldState(data,count, AB_world_states); break; case 3820: // EY if (bg && bg->GetTypeID() == BATTLEGROUND_EY) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else - { - data << uint32(0xac1) << uint32(0x0); // 7 2753 Horde Bases - data << uint32(0xac0) << uint32(0x0); // 8 2752 Alliance Bases - data << uint32(0xab6) << uint32(0x0); // 9 2742 Mage Tower - Horde conflict - data << uint32(0xab5) << uint32(0x0); // 10 2741 Mage Tower - Alliance conflict - data << uint32(0xab4) << uint32(0x0); // 11 2740 Fel Reaver - Horde conflict - data << uint32(0xab3) << uint32(0x0); // 12 2739 Fel Reaver - Alliance conflict - data << uint32(0xab2) << uint32(0x0); // 13 2738 Draenei - Alliance conflict - data << uint32(0xab1) << uint32(0x0); // 14 2737 Draenei - Horde conflict - data << uint32(0xab0) << uint32(0x0); // 15 2736 unk // 0 at start - data << uint32(0xaaf) << uint32(0x0); // 16 2735 unk // 0 at start - data << uint32(0xaad) << uint32(0x0); // 17 2733 Draenei - Horde control - data << uint32(0xaac) << uint32(0x0); // 18 2732 Draenei - Alliance control - data << uint32(0xaab) << uint32(0x1); // 19 2731 Draenei uncontrolled (1 - yes, 0 - no) - data << uint32(0xaaa) << uint32(0x0); // 20 2730 Mage Tower - Alliance control - data << uint32(0xaa9) << uint32(0x0); // 21 2729 Mage Tower - Horde control - data << uint32(0xaa8) << uint32(0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) - data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control - data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control - data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) - data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control - data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control - data << uint32(0xaa2) << uint32(0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) - data << uint32(0xac5) << uint32(0x1); // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way! - data << uint32(0xad2) << uint32(0x1); // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag - data << uint32(0xad1) << uint32(0x1); // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag - data << uint32(0xabe) << uint32(0x0); // 32 2750 Horde resources - data << uint32(0xabd) << uint32(0x0); // 33 2749 Alliance resources - data << uint32(0xa05) << uint32(0x8e); // 34 2565 unk, constant? - data << uint32(0xaa0) << uint32(0x0); // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) - data << uint32(0xa9f) << uint32(0x0); // 36 2719 Capturing progress-bar (0 - left, 100 - right) - data << uint32(0xa9e) << uint32(0x0); // 37 2718 Capturing progress-bar (1 - show, 0 - hide) - data << uint32(0xc0d) << uint32(0x17b); // 38 3085 unk - // and some more ... unknown - } + FillInitialWorldState(data,count, EY_world_states); break; case 3483: // Hellfire Peninsula - data << uint32(0x9ba) << uint32(0x1); // 10 - data << uint32(0x9b9) << uint32(0x1); // 11 - data << uint32(0x9b5) << uint32(0x0); // 12 - data << uint32(0x9b4) << uint32(0x1); // 13 - data << uint32(0x9b3) << uint32(0x0); // 14 - data << uint32(0x9b2) << uint32(0x0); // 15 - data << uint32(0x9b1) << uint32(0x1); // 16 - data << uint32(0x9b0) << uint32(0x0); // 17 - data << uint32(0x9ae) << uint32(0x0); // 18 horde pvp objectives captured - data << uint32(0x9ac) << uint32(0x0); // 19 - data << uint32(0x9a8) << uint32(0x0); // 20 - data << uint32(0x9a7) << uint32(0x0); // 21 - data << uint32(0x9a6) << uint32(0x1); // 22 + FillInitialWorldState(data,count, HP_world_states); break; case 3519: // Terokkar Forest - data << uint32(0xa41) << uint32(0x0); // 10 - data << uint32(0xa40) << uint32(0x14); // 11 - data << uint32(0xa3f) << uint32(0x0); // 12 - data << uint32(0xa3e) << uint32(0x0); // 13 - data << uint32(0xa3d) << uint32(0x5); // 14 - data << uint32(0xa3c) << uint32(0x0); // 15 - data << uint32(0xa87) << uint32(0x0); // 16 - data << uint32(0xa86) << uint32(0x0); // 17 - data << uint32(0xa85) << uint32(0x0); // 18 - data << uint32(0xa84) << uint32(0x0); // 19 - data << uint32(0xa83) << uint32(0x0); // 20 - data << uint32(0xa82) << uint32(0x0); // 21 - data << uint32(0xa81) << uint32(0x0); // 22 - data << uint32(0xa80) << uint32(0x0); // 23 - data << uint32(0xa7e) << uint32(0x0); // 24 - data << uint32(0xa7d) << uint32(0x0); // 25 - data << uint32(0xa7c) << uint32(0x0); // 26 - data << uint32(0xa7b) << uint32(0x0); // 27 - data << uint32(0xa7a) << uint32(0x0); // 28 - data << uint32(0xa79) << uint32(0x0); // 29 - data << uint32(0x9d0) << uint32(0x5); // 30 - data << uint32(0x9ce) << uint32(0x0); // 31 - data << uint32(0x9cd) << uint32(0x0); // 32 - data << uint32(0x9cc) << uint32(0x0); // 33 - data << uint32(0xa88) << uint32(0x0); // 34 - data << uint32(0xad0) << uint32(0x0); // 35 - data << uint32(0xacf) << uint32(0x1); // 36 + FillInitialWorldState(data,count, TF_world_states); break; case 3521: // Zangarmarsh - data << uint32(0x9e1) << uint32(0x0); // 10 - data << uint32(0x9e0) << uint32(0x0); // 11 - data << uint32(0x9df) << uint32(0x0); // 12 - data << uint32(0xa5d) << uint32(0x1); // 13 - data << uint32(0xa5c) << uint32(0x0); // 14 - data << uint32(0xa5b) << uint32(0x1); // 15 - data << uint32(0xa5a) << uint32(0x0); // 16 - data << uint32(0xa59) << uint32(0x1); // 17 - data << uint32(0xa58) << uint32(0x0); // 18 - data << uint32(0xa57) << uint32(0x0); // 19 - data << uint32(0xa56) << uint32(0x0); // 20 - data << uint32(0xa55) << uint32(0x1); // 21 - data << uint32(0xa54) << uint32(0x0); // 22 - data << uint32(0x9e7) << uint32(0x0); // 23 - data << uint32(0x9e6) << uint32(0x0); // 24 - data << uint32(0x9e5) << uint32(0x0); // 25 - data << uint32(0xa00) << uint32(0x0); // 26 - data << uint32(0x9ff) << uint32(0x1); // 27 - data << uint32(0x9fe) << uint32(0x0); // 28 - data << uint32(0x9fd) << uint32(0x0); // 29 - data << uint32(0x9fc) << uint32(0x1); // 30 - data << uint32(0x9fb) << uint32(0x0); // 31 - data << uint32(0xa62) << uint32(0x0); // 32 - data << uint32(0xa61) << uint32(0x1); // 33 - data << uint32(0xa60) << uint32(0x1); // 34 - data << uint32(0xa5f) << uint32(0x0); // 35 + FillInitialWorldState(data,count, ZM_world_states); break; case 3698: // Nagrand Arena if (bg && bg->GetTypeID() == BATTLEGROUND_NA) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else { - data << uint32(0xa0f) << uint32(0x0); // 7 - data << uint32(0xa10) << uint32(0x0); // 8 - data << uint32(0xa11) << uint32(0x0); // 9 show + FillInitialWorldState(data,count,0xa0f,0x0);// 7 + FillInitialWorldState(data,count,0xa10,0x0);// 8 + FillInitialWorldState(data,count,0xa11,0x0);// 9 show } break; case 3702: // Blade's Edge Arena if (bg && bg->GetTypeID() == BATTLEGROUND_BE) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else { - data << uint32(0x9f0) << uint32(0x0); // 7 gold - data << uint32(0x9f1) << uint32(0x0); // 8 green - data << uint32(0x9f3) << uint32(0x0); // 9 show + FillInitialWorldState(data,count,0x9f0,0x0);// 7 gold + FillInitialWorldState(data,count,0x9f1,0x0);// 8 green + FillInitialWorldState(data,count,0x9f3,0x0);// 9 show } break; case 3968: // Ruins of Lordaeron if (bg && bg->GetTypeID() == BATTLEGROUND_RL) - bg->FillInitialWorldStates(data); + bg->FillInitialWorldStates(data, count); else { - data << uint32(0xbb8) << uint32(0x0); // 7 gold - data << uint32(0xbb9) << uint32(0x0); // 8 green - data << uint32(0xbba) << uint32(0x0); // 9 show + FillInitialWorldState(data,count,0xbb8,0x0);// 7 gold + FillInitialWorldState(data,count,0xbb9,0x0);// 8 green + FillInitialWorldState(data,count,0xbba,0x0);// 9 show } break; case 3703: // Shattrath City break; default: - data << uint32(0x914) << uint32(0x0); // 7 - data << uint32(0x913) << uint32(0x0); // 8 - data << uint32(0x912) << uint32(0x0); // 9 - data << uint32(0x915) << uint32(0x0); // 10 + FillInitialWorldState(data,count, 0x914, 0x0); // 7 + FillInitialWorldState(data,count, 0x913, 0x0); // 8 + FillInitialWorldState(data,count, 0x912, 0x0); // 9 + FillInitialWorldState(data,count, 0x915, 0x0); // 10 break; } + + FillBGWeekendWorldStates(data,count); + + data.put(count_pos,count); // set actual world state amount + GetSession()->SendPacket(&data); - SendBGWeekendWorldStates(); } -void Player::SendBGWeekendWorldStates() +void Player::FillBGWeekendWorldStates(WorldPacket& data, uint32& count) { for(uint32 i = 1; i < sBattlemasterListStore.GetNumRows(); ++i) { @@ -8381,9 +8361,9 @@ void Player::SendBGWeekendWorldStates() if (bl && bl->HolidayWorldStateId) { if (BattleGroundMgr::IsBGWeekend(BattleGroundTypeId(bl->id))) - SendUpdateWorldState(bl->HolidayWorldStateId,1); + FillInitialWorldState(data, count, bl->HolidayWorldStateId, 1); else - SendUpdateWorldState(bl->HolidayWorldStateId,0); + FillInitialWorldState(data, count, bl->HolidayWorldStateId, 0); } } } diff --git a/src/game/Player.h b/src/game/Player.h index 06d8882a8..111108ddc 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1990,7 +1990,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendInitWorldStates(uint32 zone, uint32 area); void SendUpdateWorldState(uint32 Field, uint32 Value); void SendDirectMessage(WorldPacket *data); - void SendBGWeekendWorldStates(); + void FillBGWeekendWorldStates(WorldPacket& data, uint32& count); void SendAurasForTarget(Unit *target); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 712dad90e..c07bfea53 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9879" + #define REVISION_NR "9880" #endif // __REVISION_NR_H__ From faf3e287c7ab8d5f203746d38c1f1560f736ee0f Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Wed, 12 May 2010 12:00:19 +0200 Subject: [PATCH 009/172] [9881] Add additional fields to *_scripts tables for storage of more data. Currently not in use by any SCRIPT_COMMAND_* but we have secret plans to be revealed in the future! Signed-off-by: NoFantasy --- sql/mangos.sql | 20 +++++++++++++++++++- sql/updates/9881_01_mangos_scripts.sql | 25 +++++++++++++++++++++++++ sql/updates/Makefile.am | 2 ++ src/game/ObjectMgr.cpp | 25 ++++++++++++++----------- src/game/ObjectMgr.h | 3 +++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 7 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 sql/updates/9881_01_mangos_scripts.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 51eb08168..7259160e3 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9854_01_mangos_spell_bonus_data` bit(1) default NULL + `required_9881_01_mangos_scripts` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -1366,6 +1366,9 @@ CREATE TABLE `event_scripts` ( `command` mediumint(8) unsigned NOT NULL default '0', `datalong` mediumint(8) unsigned NOT NULL default '0', `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', `dataint` int(11) NOT NULL default '0', `x` float NOT NULL default '0', `y` float NOT NULL default '0', @@ -1843,6 +1846,9 @@ CREATE TABLE `gameobject_scripts` ( `command` mediumint(8) unsigned NOT NULL default '0', `datalong` mediumint(8) unsigned NOT NULL default '0', `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', `dataint` int(11) NOT NULL default '0', `x` float NOT NULL default '0', `y` float NOT NULL default '0', @@ -2013,6 +2019,9 @@ CREATE TABLE `gossip_scripts` ( `command` mediumint(8) unsigned NOT NULL default '0', `datalong` mediumint(8) unsigned NOT NULL default '0', `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', `dataint` int(11) NOT NULL default '0', `x` float NOT NULL default '0', `y` float NOT NULL default '0', @@ -13716,6 +13725,9 @@ CREATE TABLE `quest_end_scripts` ( `command` mediumint(8) unsigned NOT NULL default '0', `datalong` mediumint(8) unsigned NOT NULL default '0', `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', `dataint` int(11) NOT NULL default '0', `x` float NOT NULL default '0', `y` float NOT NULL default '0', @@ -13791,6 +13803,9 @@ CREATE TABLE `quest_start_scripts` ( `command` mediumint(8) unsigned NOT NULL default '0', `datalong` mediumint(8) unsigned NOT NULL default '0', `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', `dataint` int(11) NOT NULL default '0', `x` float NOT NULL default '0', `y` float NOT NULL default '0', @@ -18764,6 +18779,9 @@ CREATE TABLE `spell_scripts` ( `command` mediumint(8) unsigned NOT NULL default '0', `datalong` mediumint(8) unsigned NOT NULL default '0', `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', `dataint` int(11) NOT NULL default '0', `x` float NOT NULL default '0', `y` float NOT NULL default '0', diff --git a/sql/updates/9881_01_mangos_scripts.sql b/sql/updates/9881_01_mangos_scripts.sql new file mode 100644 index 000000000..276e9807b --- /dev/null +++ b/sql/updates/9881_01_mangos_scripts.sql @@ -0,0 +1,25 @@ +ALTER TABLE db_version CHANGE COLUMN required_9854_01_mangos_spell_bonus_data required_9881_01_mangos_scripts bit; + +ALTER TABLE event_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2; +ALTER TABLE event_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3; +ALTER TABLE event_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4; + +ALTER TABLE gameobject_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2; +ALTER TABLE gameobject_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3; +ALTER TABLE gameobject_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4; + +ALTER TABLE gossip_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2; +ALTER TABLE gossip_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3; +ALTER TABLE gossip_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4; + +ALTER TABLE quest_end_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2; +ALTER TABLE quest_end_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3; +ALTER TABLE quest_end_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4; + +ALTER TABLE quest_start_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2; +ALTER TABLE quest_start_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3; +ALTER TABLE quest_start_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4; + +ALTER TABLE spell_scripts ADD COLUMN datalong3 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong2; +ALTER TABLE spell_scripts ADD COLUMN datalong4 INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong3; +ALTER TABLE spell_scripts ADD COLUMN data_flags TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER datalong4; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 6da2e96e3..9c96d8bba 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -58,6 +58,7 @@ pkgdata_DATA = \ 9826_01_mangos_spell_script_target.sql \ 9849_01_characters_saved_variables.sql \ 9854_01_mangos_spell_bonus_data.sql \ + 9881_01_mangos_scripts.sql \ README ## Additional files to include when running 'make dist' @@ -96,4 +97,5 @@ EXTRA_DIST = \ 9826_01_mangos_spell_script_target.sql \ 9849_01_characters_saved_variables.sql \ 9854_01_mangos_spell_bonus_data.sql \ + 9881_01_mangos_scripts.sql \ README diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 81f0ced40..15fb472c5 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4159,7 +4159,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) scripts.clear(); // need for reload support - QueryResult *result = WorldDatabase.PQuery( "SELECT id,delay,command,datalong,datalong2,dataint, x, y, z, o FROM %s", tablename ); + QueryResult *result = WorldDatabase.PQuery( "SELECT id, delay, command, datalong, datalong2, datalong3, datalong4, data_flags, dataint, x, y, z, o FROM %s", tablename ); uint32 count = 0; @@ -4181,16 +4181,19 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) Field *fields = result->Fetch(); ScriptInfo tmp; - tmp.id = fields[0].GetUInt32(); - tmp.delay = fields[1].GetUInt32(); - tmp.command = fields[2].GetUInt32(); - tmp.datalong = fields[3].GetUInt32(); - tmp.datalong2 = fields[4].GetUInt32(); - tmp.dataint = fields[5].GetInt32(); - tmp.x = fields[6].GetFloat(); - tmp.y = fields[7].GetFloat(); - tmp.z = fields[8].GetFloat(); - tmp.o = fields[9].GetFloat(); + tmp.id = fields[0].GetUInt32(); + tmp.delay = fields[1].GetUInt32(); + tmp.command = fields[2].GetUInt32(); + tmp.datalong = fields[3].GetUInt32(); + tmp.datalong2 = fields[4].GetUInt32(); + tmp.datalong3 = fields[5].GetUInt32(); + tmp.datalong4 = fields[6].GetUInt32(); + tmp.data_flags = fields[7].GetUInt32(); + tmp.dataint = fields[8].GetInt32(); + tmp.x = fields[9].GetFloat(); + tmp.y = fields[10].GetFloat(); + tmp.z = fields[11].GetFloat(); + tmp.o = fields[12].GetFloat(); // generic command args check switch(tmp.command) diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index ec9e89369..837d7fc45 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -75,6 +75,9 @@ struct ScriptInfo uint32 command; uint32 datalong; uint32 datalong2; + uint32 datalong3; + uint32 datalong4; + uint32 data_flags; int32 dataint; float x; float y; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c07bfea53..ae1780dc8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9880" + #define REVISION_NR "9881" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index ba8bbf791..2060d1dc9 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9854_01_mangos_spell_bonus_data" + #define REVISION_DB_MANGOS "required_9881_01_mangos_scripts" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 41c58f3be9c4ff1427ae7be8efe1e58d3899c251 Mon Sep 17 00:00:00 2001 From: Laise Date: Wed, 12 May 2010 13:33:17 +0300 Subject: [PATCH 010/172] [9882] Add support for mounts dependent from riding skill and location --- sql/mangos_spell_check.sql | 19 +++++++++++++ src/game/Spell.cpp | 57 ++++++++++++++++++++++++++++++++++++++ src/game/Spell.h | 2 ++ src/game/SpellAuras.cpp | 12 ++++++++ src/shared/revision_nr.h | 2 +- 5 files changed, 91 insertions(+), 1 deletion(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index 7eec1edcd..322bc7d86 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -314,6 +314,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (47758,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Penance', 'Spell::EffectDummy'), (47897, 5,0x0001000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), (47960,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), +(48023,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), +(48024,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), +(48025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), (48301,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mind Trauma', 'Spell::EffectSchoolDMG'), (48542,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Revitalize', 'Spell::EffectEnergize'), (48743,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Death Pact', 'Spell::EffectHeal'), @@ -354,6 +357,8 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (51582, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::EffectDummy'), (51592, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'), (51593,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'), +(51617,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), +(51621,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), (51961, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Captured Chicken Cover', 'Spell::EffectDummy'), (52025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cleansing Totem Effect', 'Spell::EffectDummy'), (52032,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Mana Spring Totem', 'Spell::EffectDummy'), @@ -458,10 +463,24 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (70937,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Eternal Water', 'Spell::EffectDummy'), (71021,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Saber Lash', 'Spell::EffectWeaponDmg'), (71904, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Chaos Bane', 'Spell::EffectSchoolDMG'), +(72281, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), +(72282, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), +(72283, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), +(72284, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), +(72286, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), (72505, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'), (72624, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'), (72625, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'), (73422, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Chaos Bane', 'Spell::cast'), +(74854, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'), +(74855, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'), +(74856, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'), +(75614, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), +(75617, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), +(75618, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), +(75619, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), +(75620, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), +(76153, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 8920349f4..ec218d042 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6526,4 +6526,61 @@ void Spell::ResetEffectDamageAndHeal() { m_damage = 0; m_healing = 0; +} + +void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial) +{ + if (!target || target->GetTypeId() != TYPEID_PLAYER) + return; + + // Prevent stacking of mounts + target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); + uint16 skillval = ((Player*)target)->GetSkillValue(SKILL_RIDING); + if (!skillval) + return; + + if (skillval >= 225 && (spellId300 > 0 || spellId225 > 0)) + { + uint32 spellid = skillval >= 300 ? spellId300 : spellId225; + SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid); + // zone check + uint32 zone, area; + target->GetZoneAndAreaId(zone, area); + + SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself()); + if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId(),zone)) + target->CastSpell(target, spellId150, true); + else if (spellIdSpecial > 0) + { + for (PlayerSpellMap::const_iterator iter = ((Player*)target)->GetSpellMap().begin(); iter != ((Player*)target)->GetSpellMap().end(); ++iter) + { + if (iter->second.state != PLAYERSPELL_REMOVED) + { + bool changedSpeed = false; + SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first); + for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + { + if(spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) + { + int32 mountSpeed = spellInfo->CalculateSimpleValue(SpellEffectIndex(i)); + + // speed higher than 300 replace it + if (mountSpeed > 300) + target->CastSpell(target, spellIdSpecial, true); + return; + } + } + } + } + target->CastSpell(target, pSpell, true); + } + else + target->CastSpell(target, pSpell, true); + } + else if (skillval >= 150 && spellId150 > 0) + target->CastSpell(target, spellId150, true); + else if (spellId75 > 0) + target->CastSpell(target, spellId75, true); + + return; } \ No newline at end of file diff --git a/src/game/Spell.h b/src/game/Spell.h index 69c2dbcaf..5f48b1d31 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -497,6 +497,8 @@ class Spell void CastTriggerSpells(); void CleanupTargetList(); + + static void SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial); protected: void SendLoot(uint64 guid, LootType loottype); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 54fcb1050..0b231c847 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2290,6 +2290,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // not use ammo and not allow use ((Player*)m_target)->RemoveAmmo(); return; + case 48025: // Headless Horseman's Mount + Spell::SelectMountByAreaAndSkill(m_target, 51621, 48024, 51617, 48023, NULL); + return; case 62061: // Festive Holiday Mount if (m_target->HasAuraType(SPELL_AURA_MOUNTED)) // Reindeer Transformation @@ -2305,6 +2308,15 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (m_target->GetTypeId() == TYPEID_PLAYER) ((Player*)m_target)->removeSpell(63680); return; + case 72286: // Invincible + Spell::SelectMountByAreaAndSkill(m_target, 72281, 72282, 72283, 72284, NULL); + return; + case 74856: // Blazing Hippogryph + Spell::SelectMountByAreaAndSkill(m_target, NULL, NULL, 74854, 74855, NULL); + return; + case 75614: // Celestial Steed + Spell::SelectMountByAreaAndSkill(m_target, 75619, 75620, 75617, 75618, 76153); + return; } break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ae1780dc8..d86e330b6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9881" + #define REVISION_NR "9882" #endif // __REVISION_NR_H__ From b208effca6d15f9733454e3728bde02586d7ba3e Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Wed, 12 May 2010 14:08:32 +0200 Subject: [PATCH 011/172] [9883] Change SCRIPT_COMMAND_TALK to support CHAT_TYPE_* using enum ChatType Making data consistent with other, similar tables like EventAI's text tables. This convert existing data and also adds support for all chat types. Signed-off-by: NoFantasy --- sql/mangos.sql | 2 +- sql/updates/9883_01_mangos_scripts.sql | 25 ++++++++++++++++++ sql/updates/Makefile.am | 2 ++ src/game/Map.cpp | 35 ++++++++++++++++++-------- src/game/ObjectMgr.cpp | 4 +-- src/game/World.h | 2 +- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 8 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 sql/updates/9883_01_mangos_scripts.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 7259160e3..53e11d79d 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9881_01_mangos_scripts` bit(1) default NULL + `required_9883_01_mangos_scripts` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/updates/9883_01_mangos_scripts.sql b/sql/updates/9883_01_mangos_scripts.sql new file mode 100644 index 000000000..5252b3e9b --- /dev/null +++ b/sql/updates/9883_01_mangos_scripts.sql @@ -0,0 +1,25 @@ +ALTER TABLE db_version CHANGE COLUMN required_9881_01_mangos_scripts required_9883_01_mangos_scripts bit; + +-- convert to CHAT_TYPE_WHISPER +UPDATE event_scripts SET datalong=4 WHERE command=0 AND datalong=1; +UPDATE gameobject_scripts SET datalong=4 WHERE command=0 AND datalong=1; +UPDATE gossip_scripts SET datalong=4 WHERE command=0 AND datalong=1; +UPDATE quest_end_scripts SET datalong=4 WHERE command=0 AND datalong=1; +UPDATE quest_start_scripts SET datalong=4 WHERE command=0 AND datalong=1; +UPDATE spell_scripts SET datalong=4 WHERE command=0 AND datalong=1; + +-- convert to CHAT_TYPE_YELL +UPDATE event_scripts SET datalong=1 WHERE command=0 AND datalong=2; +UPDATE gameobject_scripts SET datalong=1 WHERE command=0 AND datalong=2; +UPDATE gossip_scripts SET datalong=1 WHERE command=0 AND datalong=2; +UPDATE quest_end_scripts SET datalong=1 WHERE command=0 AND datalong=2; +UPDATE quest_start_scripts SET datalong=1 WHERE command=0 AND datalong=2; +UPDATE spell_scripts SET datalong=1 WHERE command=0 AND datalong=2; + +-- convert to CHAT_TYPE_TEXT_EMOTE +UPDATE event_scripts SET datalong=2 WHERE command=0 AND datalong=3; +UPDATE gameobject_scripts SET datalong=2 WHERE command=0 AND datalong=3; +UPDATE gossip_scripts SET datalong=2 WHERE command=0 AND datalong=3; +UPDATE quest_end_scripts SET datalong=2 WHERE command=0 AND datalong=3; +UPDATE quest_start_scripts SET datalong=2 WHERE command=0 AND datalong=3; +UPDATE spell_scripts SET datalong=2 WHERE command=0 AND datalong=3; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 9c96d8bba..e1244127b 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -59,6 +59,7 @@ pkgdata_DATA = \ 9849_01_characters_saved_variables.sql \ 9854_01_mangos_spell_bonus_data.sql \ 9881_01_mangos_scripts.sql \ + 9883_01_mangos_scripts.sql \ README ## Additional files to include when running 'make dist' @@ -98,4 +99,5 @@ EXTRA_DIST = \ 9849_01_characters_saved_variables.sql \ 9854_01_mangos_spell_bonus_data.sql \ 9881_01_mangos_scripts.sql \ + 9883_01_mangos_scripts.sql \ README diff --git a/src/game/Map.cpp b/src/game/Map.cpp index c76dc16b8..d8ad165bb 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2860,7 +2860,7 @@ void Map::ScriptsProcess() break; } - if (source->GetTypeId()!=TYPEID_UNIT) + if (source->GetTypeId() != TYPEID_UNIT) { sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for non-creature (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); break; @@ -2868,25 +2868,38 @@ void Map::ScriptsProcess() uint64 unit_target = target ? target->GetGUID() : 0; - //datalong 0=normal say, 1=whisper, 2=yell, 3=emote text switch(step.script->datalong) { - case 0: // Say - ((Creature *)source)->Say(step.script->dataint, LANG_UNIVERSAL, unit_target); + case CHAT_TYPE_SAY: + ((Creature*)source)->Say(step.script->dataint, LANG_UNIVERSAL, unit_target); break; - case 1: // Whisper + case CHAT_TYPE_YELL: + ((Creature*)source)->Yell(step.script->dataint, LANG_UNIVERSAL, unit_target); + break; + case CHAT_TYPE_TEXT_EMOTE: + ((Creature*)source)->TextEmote(step.script->dataint, unit_target); + break; + case CHAT_TYPE_BOSS_EMOTE: + ((Creature*)source)->TextEmote(step.script->dataint, unit_target, true); + break; + case CHAT_TYPE_WHISPER: if (!unit_target) { - sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) NULL, skipping.", step.script->id, step.script->datalong); + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid, skipping.", step.script->id, step.script->datalong); break; } - ((Creature *)source)->Whisper(step.script->dataint, unit_target); + ((Creature*)source)->Whisper(step.script->dataint, unit_target); break; - case 2: // Yell - ((Creature *)source)->Yell(step.script->dataint, LANG_UNIVERSAL, unit_target); + case CHAT_TYPE_BOSS_WHISPER: + if (!unit_target) + { + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid, skipping.", step.script->id, step.script->datalong); + break; + } + ((Creature*)source)->Whisper(step.script->dataint, unit_target, true); break; - case 3: // Emote text - ((Creature *)source)->TextEmote(step.script->dataint, unit_target); + case CHAT_TYPE_ZONE_YELL: + ((Creature*)source)->YellToZone(step.script->dataint, LANG_UNIVERSAL, unit_target); break; default: break; // must be already checked at load diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 15fb472c5..aba985b86 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4200,9 +4200,9 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) { case SCRIPT_COMMAND_TALK: { - if(tmp.datalong > 3) + if(tmp.datalong > CHAT_TYPE_ZONE_YELL) { - sLog.outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id); + sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id); continue; } if(tmp.dataint==0) diff --git a/src/game/World.h b/src/game/World.h index ca241781b..fb95ac6b8 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -386,7 +386,7 @@ enum RealmZone }; // DB scripting commands -#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong ( 0=say, 1=whisper, 2=yell, 3=emote text) +#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong (see enum ChatType for supported CHAT_TYPE_'s) #define SCRIPT_COMMAND_EMOTE 1 // source = unit, datalong = anim_id #define SCRIPT_COMMAND_FIELD_SET 2 // source = any, datalong = field_id, datalog2 = value #define SCRIPT_COMMAND_MOVE_TO 3 // source = Creature, datalog2 = time, x/y/z diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d86e330b6..5b0b43ace 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9882" + #define REVISION_NR "9883" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 2060d1dc9..1dfd48da9 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9881_01_mangos_scripts" + #define REVISION_DB_MANGOS "required_9883_01_mangos_scripts" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 188db9691fc5418dae31329c69dd439218ea3b35 Mon Sep 17 00:00:00 2001 From: Laise Date: Wed, 12 May 2010 17:42:25 +0300 Subject: [PATCH 012/172] [9884] Code style fixes thx to hunuza & Wowka321 --- src/game/Spell.cpp | 5 ++--- src/game/SpellAuras.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ec218d042..bba20a898 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6556,7 +6556,6 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe { if (iter->second.state != PLAYERSPELL_REMOVED) { - bool changedSpeed = false; SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first); for(int i = 0; i < MAX_EFFECT_INDEX; ++i) { @@ -6564,8 +6563,8 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe { int32 mountSpeed = spellInfo->CalculateSimpleValue(SpellEffectIndex(i)); - // speed higher than 300 replace it - if (mountSpeed > 300) + // speed higher than 280 replace it + if (mountSpeed > 280) target->CastSpell(target, spellIdSpecial, true); return; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 0b231c847..fc05262e8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2291,7 +2291,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) ((Player*)m_target)->RemoveAmmo(); return; case 48025: // Headless Horseman's Mount - Spell::SelectMountByAreaAndSkill(m_target, 51621, 48024, 51617, 48023, NULL); + Spell::SelectMountByAreaAndSkill(m_target, 51621, 48024, 51617, 48023, 0); return; case 62061: // Festive Holiday Mount if (m_target->HasAuraType(SPELL_AURA_MOUNTED)) @@ -2309,10 +2309,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) ((Player*)m_target)->removeSpell(63680); return; case 72286: // Invincible - Spell::SelectMountByAreaAndSkill(m_target, 72281, 72282, 72283, 72284, NULL); + Spell::SelectMountByAreaAndSkill(m_target, 72281, 72282, 72283, 72284, 0); return; case 74856: // Blazing Hippogryph - Spell::SelectMountByAreaAndSkill(m_target, NULL, NULL, 74854, 74855, NULL); + Spell::SelectMountByAreaAndSkill(m_target, 0, 0, 74854, 74855, 0); return; case 75614: // Celestial Steed Spell::SelectMountByAreaAndSkill(m_target, 75619, 75620, 75617, 75618, 76153); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5b0b43ace..5588a7a2e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9883" + #define REVISION_NR "9884" #endif // __REVISION_NR_H__ From a3e61dc5607e85a51cff7656133b07f99198a16b Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Thu, 13 May 2010 05:26:06 +0400 Subject: [PATCH 013/172] [9885] Added VS2010 projects for maps extractor. (based on commit 211997d) --- contrib/extractor/.gitignore | 2 + contrib/extractor/VC100_AD.sln | 19 +++ contrib/extractor/VC100_ad.vcxproj | 185 +++++++++++++++++++++ contrib/extractor/VC100_ad.vcxproj.filters | 86 ++++++++++ src/shared/revision_nr.h | 2 +- 5 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 contrib/extractor/VC100_AD.sln create mode 100644 contrib/extractor/VC100_ad.vcxproj create mode 100644 contrib/extractor/VC100_ad.vcxproj.filters diff --git a/contrib/extractor/.gitignore b/contrib/extractor/.gitignore index 73cfdde63..c0dea6d25 100644 --- a/contrib/extractor/.gitignore +++ b/contrib/extractor/.gitignore @@ -14,8 +14,10 @@ *.ncb *.pdb *.suo +*.sdf debug release +ipch *.user *.ilk ad_debug.exe \ No newline at end of file diff --git a/contrib/extractor/VC100_AD.sln b/contrib/extractor/VC100_AD.sln new file mode 100644 index 000000000..0c148470f --- /dev/null +++ b/contrib/extractor/VC100_AD.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ad", "VC100_ad.vcxproj", "{D7552D4F-408F-4F8E-859B-366659150CF4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D7552D4F-408F-4F8E-859B-366659150CF4}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7552D4F-408F-4F8E-859B-366659150CF4}.Debug|Win32.Build.0 = Debug|Win32 + {D7552D4F-408F-4F8E-859B-366659150CF4}.Release|Win32.ActiveCfg = Release|Win32 + {D7552D4F-408F-4F8E-859B-366659150CF4}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/contrib/extractor/VC100_ad.vcxproj b/contrib/extractor/VC100_ad.vcxproj new file mode 100644 index 000000000..9b5bde66f --- /dev/null +++ b/contrib/extractor/VC100_ad.vcxproj @@ -0,0 +1,185 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + ad + {D7552D4F-408F-4F8E-859B-366659150CF4} + ad + + + + Application + false + MultiByte + + + Application + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\ + .\debug\ + + .\ + .\release\ + + AllRules.ruleset + + + AllRules.ruleset + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + ./ad.tlb + + + + + Disabled + libmpq;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + $(IntDir)ad.pch + $(IntDir) + $(IntDir) + $(IntDir) + $(IntDir) + true + $(IntDir) + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0419 + + + zlib.lib;%(AdditionalDependencies) + ad_debug.exe + true + ./debug/;%(AdditionalLibraryDirectories) + LIBCD.lib;%(IgnoreSpecificDefaultLibraries) + true + ./ad_debug.pdb + Console + false + + + MachineX86 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + ./ad.tlb + + + + + Full + OnlyExplicitInline + libmpq;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreaded + + + $(IntDir)ad.pch + $(IntDir) + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0419 + + + zlib.lib;%(AdditionalDependencies) + ./ad.exe + true + ./release/;%(AdditionalLibraryDirectories) + LIBC.lib;%(IgnoreSpecificDefaultLibraries) + ./ad.pdb + Console + false + + + MachineX86 + + + + + + + + + + + + + + + Disabled + %(PreprocessorDefinitions) + EnableFastChecks + true + Full + %(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/contrib/extractor/VC100_ad.vcxproj.filters b/contrib/extractor/VC100_ad.vcxproj.filters new file mode 100644 index 000000000..a32c32c76 --- /dev/null +++ b/contrib/extractor/VC100_ad.vcxproj.filters @@ -0,0 +1,86 @@ + + + + + {7748a821-40c1-4432-a07e-ff4da1273091} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {bd48cc48-7a79-4088-9e3f-8bf123692891} + h;hpp;hxx;hm;inl + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5588a7a2e..461a473d9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9884" + #define REVISION_NR "9885" #endif // __REVISION_NR_H__ From 080727cbfae0582bda36b7ef77c79f60d2bd6170 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 13 May 2010 11:10:00 +0400 Subject: [PATCH 014/172] [9886] Implement new commands for account search * .lookup account email, .lookup account ip, .lookup account name * For new commands and for .lookup player versions use first arg as part of email/ip/name search * Use similar output format for player/account lists. --- sql/mangos.sql | 19 ++- sql/updates/9886_01_mangos_mangos_string.sql | 8 + sql/updates/9886_02_mangos_command.sql | 10 ++ sql/updates/Makefile.am | 4 + src/game/Chat.cpp | 17 +- src/game/Chat.h | 7 +- src/game/Language.h | 15 +- src/game/Level2.cpp | 168 +++++++++++++++---- src/game/Level3.cpp | 62 ++++--- src/mangosd/CliRunnable.cpp | 48 +----- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 12 files changed, 249 insertions(+), 113 deletions(-) create mode 100644 sql/updates/9886_01_mangos_mangos_string.sql create mode 100644 sql/updates/9886_02_mangos_command.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 53e11d79d..30c3353e3 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9883_01_mangos_scripts` bit(1) default NULL + `required_9886_02_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -632,6 +632,9 @@ INSERT INTO `command` VALUES ('list object',3,'Syntax: .list object #gameobject_id [#max_count]\r\n\r\nOutput gameobjects with gameobject id #gameobject_id found in world. Output gameobject guids and coordinates sorted by distance from character. Will be output maximum #max_count gameobject. If #max_count not provided use 10 as default value.'), ('list talents',3,'Syntax: .list talents\r\n\r\nShow list all really known (as learned spells) talent rank spells for selected player or self.'), ('loadscripts',3,'Syntax: .loadscripts $scriptlibraryname\r\n\r\nUnload current and load the script library $scriptlibraryname or reload current if $scriptlibraryname omitted, in case you changed it while the server was running.'), +('lookup account email',2,'Syntax: .lookup account email $emailpart [#limit] \r\n\r\n Searchs accounts, which email including $emailpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup account ip',2,'Syntax: lookup account ip $ippart [#limit] \r\n\r\n Searchs accounts, which last used ip inluding $ippart (textual) with optional parametr #$limit of results. If #limit not provided expected 100.'), +('lookup account name',2,'Syntax: .lookup account name $accountpart [#limit] \r\n\r\n Searchs accounts, which username including $accountpart with optional parametr #limit of results. If #limit not provided expected 100.'), ('lookup area',1,'Syntax: .lookup area $namepart\r\n\r\nLooks up an area by $namepart, and returns all matches with their area ID\'s.'), ('lookup creature',3,'Syntax: .lookup creature $namepart\r\n\r\nLooks up a creature by $namepart, and returns all matches with their creature ID\'s.'), ('lookup event',2,'Syntax: .lookup event $name\r\nAttempts to find the ID of the event with the provided $name.'), @@ -639,9 +642,9 @@ INSERT INTO `command` VALUES ('lookup item',3,'Syntax: .lookup item $itemname\r\n\r\nLooks up an item by $itemname, and returns all matches with their Item ID\'s.'), ('lookup itemset',3,'Syntax: .lookup itemset $itemname\r\n\r\nLooks up an item set by $itemname, and returns all matches with their Item set ID\'s.'), ('lookup object',3,'Syntax: .lookup object $objname\r\n\r\nLooks up an gameobject by $objname, and returns all matches with their Gameobject ID\'s.'), -('lookup player account',2,'Syntax: .lookup player account $account ($limit) \r\n\r\n Searchs players, which account username is $account with optional parametr $limit of results.'), -('lookup player ip',2,'Syntax: .lookup player ip $ip ($limit) \r\n\r\n Searchs players, which account ast_ip is $ip with optional parametr $limit of results.'), -('lookup player email',2,'Syntax: .lookup player email $email ($limit) \r\n\r\n Searchs players, which account email is $email with optional parametr $limit of results.'), +('lookup player account',2,'Syntax: .lookup player account $accountpart [#limit] \r\n\r\n Searchs players, which account username including $accountpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup player email',2,'Syntax: .lookup player email $emailpart [#limit] \r\n\r\n Searchs players, which account email including $emailpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup player ip',2,'Syntax: .lookup player ip $ippart [#limit] \r\n\r\n Searchs players, which account last used ip inluding $ippart (textual) with optional parametr #limit of results. If #limit not provided expected 100.'), ('lookup quest',3,'Syntax: .lookup quest $namepart\r\n\r\nLooks up a quest by $namepart, and returns all matches with their quest ID\'s.'), ('lookup skill',3,'Syntax: .lookup skill $$namepart\r\n\r\nLooks up a skill by $namepart, and returns all matches with their skill ID\'s.'), ('lookup spell',3,'Syntax: .lookup spell $namepart\r\n\r\nLooks up a spell by $namepart, and returns all matches with their spell ID\'s.'), @@ -3585,10 +3588,9 @@ INSERT INTO `mangos_string` VALUES (1007,'Account %s NOT created (probably sql file format was updated)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1008,'Account %s NOT created (unknown error)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1009,'Player %s (Guid: %u) Account %s (Id: %u) deleted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1010,'| Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1011,'| | %20s | || |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1012,'===========================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1013,'|%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1010,'| ID | Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1012,'========================================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1013,'| %10u |%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1014,'No online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1015,'Used not fully typed quit command, need type it fully (quit), or command used not in RA command line.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1016, '| GUID | Name | Account | Delete Date |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -3644,6 +3646,7 @@ INSERT INTO `mangos_string` VALUES (1139, '| GUID | Name | Race | Class | Level |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1140, '| %10u | %20s | %15s | %15s | %5u |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1141, '%u - |cffffffff|Hplayer:%s|h[%s]|h|r %s %s %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1142,'%u - %s (Online:%s IP:%s GM:%u Expansion:%u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */; diff --git a/sql/updates/9886_01_mangos_mangos_string.sql b/sql/updates/9886_01_mangos_mangos_string.sql new file mode 100644 index 000000000..126aaf779 --- /dev/null +++ b/sql/updates/9886_01_mangos_mangos_string.sql @@ -0,0 +1,8 @@ +ALTER TABLE db_version CHANGE COLUMN required_9883_01_mangos_scripts required_9886_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN (1011,1010,1012,1013,1142); +INSERT INTO mangos_string VALUES +(1010,'| ID | Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1012,'========================================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1013,'| %10u |%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1142,'%u - %s (Online:%s IP:%s GM:%u Expansion:%u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/9886_02_mangos_command.sql b/sql/updates/9886_02_mangos_command.sql new file mode 100644 index 000000000..7d3c9c8de --- /dev/null +++ b/sql/updates/9886_02_mangos_command.sql @@ -0,0 +1,10 @@ +ALTER TABLE db_version CHANGE COLUMN required_9886_01_mangos_mangos_string required_9886_02_mangos_command bit; + +DELETE FROM command WHERE name IN('lookup account email','lookup account ip','lookup account name','lookup player account','lookup player ip','lookup player email'); +INSERT INTO command (name, security, help) VALUES +('lookup account email',2,'Syntax: .lookup account email $emailpart [#limit] \r\n\r\n Searchs accounts, which email including $emailpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup account ip',2,'Syntax: lookup account ip $ippart [#limit] \r\n\r\n Searchs accounts, which last used ip inluding $ippart (textual) with optional parametr #$limit of results. If #limit not provided expected 100.'), +('lookup account name',2,'Syntax: .lookup account name $accountpart [#limit] \r\n\r\n Searchs accounts, which username including $accountpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup player account',2,'Syntax: .lookup player account $accountpart [#limit] \r\n\r\n Searchs players, which account username including $accountpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup player email',2,'Syntax: .lookup player email $emailpart [#limit] \r\n\r\n Searchs players, which account email including $emailpart with optional parametr #limit of results. If #limit not provided expected 100.'), +('lookup player ip',2,'Syntax: .lookup player ip $ippart [#limit] \r\n\r\n Searchs players, which account last used ip inluding $ippart (textual) with optional parametr #limit of results. If #limit not provided expected 100.'); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index e1244127b..f55e50d2a 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -60,6 +60,8 @@ pkgdata_DATA = \ 9854_01_mangos_spell_bonus_data.sql \ 9881_01_mangos_scripts.sql \ 9883_01_mangos_scripts.sql \ + 9886_01_mangos_mangos_string.sql \ + 9886_02_mangos_command.sql \ README ## Additional files to include when running 'make dist' @@ -100,4 +102,6 @@ EXTRA_DIST = \ 9854_01_mangos_spell_bonus_data.sql \ 9881_01_mangos_scripts.sql \ 9883_01_mangos_scripts.sql \ + 9886_01_mangos_mangos_string.sql \ + 9886_02_mangos_command.sql \ README diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 1047447c2..3aa0f330b 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -285,16 +285,25 @@ ChatCommand * ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; + static ChatCommand lookupAccountCommandTable[] = + { + { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupAccountEmailCommand, "", NULL }, + { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupAccountIpCommand, "", NULL }, + { "name", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupAccountNameCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand lookupPlayerCommandTable[] = { - { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, - { "account", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, - { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { "account", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, + { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, + { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand lookupCommandTable[] = { + { "account", SEC_GAMEMASTER, true, NULL, "", lookupAccountCommandTable }, { "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL }, { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupCreatureCommand, "", NULL }, { "event", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupEventCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 88c24e92f..288725daa 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -233,6 +233,9 @@ class ChatHandler bool HandleListObjectCommand(const char* args); bool HandleListTalentsCommand(const char * args); + bool HandleLookupAccountEmailCommand(const char* args); + bool HandleLookupAccountIpCommand(const char* args); + bool HandleLookupAccountNameCommand(const char* args); bool HandleLookupAreaCommand(const char* args); bool HandleLookupCreatureCommand(const char* args); bool HandleLookupEventCommand(const char* args); @@ -544,7 +547,9 @@ class ChatHandler // Utility methods for commands void ShowTicket(uint64 guid, char const* text, char const* time); - bool LookupPlayerSearchCommand(QueryResult* result, int32 limit); + bool ShowAccountListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true); + bool ShowPlayerListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true); + bool LookupPlayerSearchCommand(QueryResult* result, uint32* limit = NULL); bool HandleBanListHelper(QueryResult* result); bool HandleBanHelper(BanMode mode,char const* args); bool HandleBanInfoHelper(uint32 accountid, char const* accountname); diff --git a/src/game/Language.h b/src/game/Language.h index d845f3700..1fab0ec32 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -776,9 +776,9 @@ enum MangosStrings LANG_ACCOUNT_NOT_CREATED = 1008, LANG_CHARACTER_DELETED = 1009, LANG_ACCOUNT_LIST_HEADER = 1010, - LANG_ACCOUNT_LIST_ERROR = 1011, + // = 1011, not used LANG_ACCOUNT_LIST_BAR = 1012, - LANG_ACCOUNT_LIST_LINE = 1013, + LANG_ACCOUNT_LIST_LINE_CONSOLE = 1013, LANG_ACCOUNT_LIST_EMPTY = 1014, LANG_QUIT_WRONG_USE_ERROR = 1015, LANG_CHARACTER_DELETED_LIST_HEADER = 1016, @@ -833,11 +833,12 @@ enum MangosStrings LANG_LIST_TALENTS_TITLE = 1135, LANG_LIST_TALENTS_COUNT = 1136, LANG_GO_LIST_CHAT = 1137, - LANG_ACCOUNT_CHARACTERS_LIST_BAR = 1138, - LANG_ACCOUNT_CHARACTERS_LIST_HEADER = 1139, - LANG_ACCOUNT_CHARACTERS_LIST_LINE_CONSOLE = 1140, - LANG_ACCOUNT_CHARACTERS_LIST_LINE_CHAT = 1141, - // Room for more level 3 1142-1199 not used + LANG_CHARACTERS_LIST_BAR = 1138, + LANG_CHARACTERS_LIST_HEADER = 1139, + LANG_CHARACTERS_LIST_LINE_CONSOLE = 1140, + LANG_CHARACTERS_LIST_LINE_CHAT = 1141, + LANG_ACCOUNT_LIST_LINE_CHAT = 1142, + // Room for more level 3 1143-1199 not used // Debug commands LANG_CINEMATIC_NOT_EXIST = 1200, diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 0f4beb3b1..ad9682fde 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -4092,6 +4092,112 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) return true; } +bool ChatHandler::HandleLookupAccountEmailCommand(const char* args) +{ + + if (!*args) + return false; + + std::string email = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + uint32 limit = limit_str ? atoi (limit_str) : 100; + + loginDatabase.escape_string (email); + // 0 1 2 3 4 + QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE email "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"), email.c_str ()); + + return ShowAccountListHelper(result,&limit); +} + +bool ChatHandler::HandleLookupAccountIpCommand(const char* args) +{ + + if (!*args) + return false; + + std::string ip = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + uint32 limit = limit_str ? atoi (limit_str) : 100; + + loginDatabase.escape_string (ip); + + // 0 1 2 3 4 + QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE last_ip "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"), ip.c_str ()); + + return ShowAccountListHelper(result,&limit); +} + +bool ChatHandler::HandleLookupAccountNameCommand(const char* args) +{ + if (!*args) + return false; + + std::string account = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + uint32 limit = limit_str ? atoi (limit_str) : 100; + + if (!AccountMgr::normalizeString (account)) + return false; + + loginDatabase.escape_string (account); + // 0 1 2 3 4 + QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE username "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"), account.c_str ()); + + return ShowAccountListHelper(result,&limit); +} + +bool ChatHandler::ShowAccountListHelper(QueryResult* result, uint32* limit, bool title, bool error) +{ + if (!result) + { + if (error) + SendSysMessage(LANG_ACCOUNT_LIST_EMPTY); + return true; + } + + ///- Display the list of account/characters online + if (!m_session && title) // not output header for online case + { + SendSysMessage(LANG_ACCOUNT_LIST_BAR); + SendSysMessage(LANG_ACCOUNT_LIST_HEADER); + SendSysMessage(LANG_ACCOUNT_LIST_BAR); + } + + ///- Circle through accounts + do + { + // check limit + if (limit) + { + if(*limit == 0) + break; + --*limit; + } + + Field *fields = result->Fetch(); + uint32 account = fields[0].GetUInt32(); + + WorldSession* session = sWorld.FindSession(account); + Player* player = session ? session->GetPlayer() : NULL; + char const* char_name = player ? player->GetName() : " - "; + + if(m_session) + PSendSysMessage(LANG_ACCOUNT_LIST_LINE_CHAT, + account,fields[1].GetString(),char_name,fields[2].GetString(),fields[3].GetUInt32(),fields[4].GetUInt32()); + else + PSendSysMessage(LANG_ACCOUNT_LIST_LINE_CONSOLE, + account,fields[1].GetString(),char_name,fields[2].GetString(),fields[3].GetUInt32(),fields[4].GetUInt32()); + + }while(result->NextRow()); + + delete result; + + if (!m_session) // not output header for online case + SendSysMessage(LANG_ACCOUNT_LIST_BAR); + + return true; +} + bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) { @@ -4100,13 +4206,13 @@ bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) std::string ip = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; + uint32 limit = limit_str ? atoi (limit_str) : 100; loginDatabase.escape_string (ip); - QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE last_ip = '%s'", ip.c_str ()); + QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE last_ip "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"), ip.c_str ()); - return LookupPlayerSearchCommand (result,limit); + return LookupPlayerSearchCommand (result,&limit); } bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) @@ -4116,16 +4222,16 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) std::string account = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; + uint32 limit = limit_str ? atoi (limit_str) : 100; if (!AccountMgr::normalizeString (account)) return false; loginDatabase.escape_string (account); - QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE username = '%s'", account.c_str ()); + QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE username "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"), account.c_str ()); - return LookupPlayerSearchCommand (result,limit); + return LookupPlayerSearchCommand (result,&limit); } bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) @@ -4136,57 +4242,57 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) std::string email = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; + uint32 limit = limit_str ? atoi (limit_str) : 100; loginDatabase.escape_string (email); - QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE email = '%s'", email.c_str ()); + QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE email "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"), email.c_str ()); - return LookupPlayerSearchCommand (result,limit); + return LookupPlayerSearchCommand (result,&limit); } -bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit) +bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, uint32* limit) { - if(!result) + if (!result) { PSendSysMessage(LANG_NO_PLAYERS_FOUND); SetSentErrorMessage(true); return false; } - int i =0; + uint32 limit_original = limit ? *limit : 100; + + uint32 limit_local = limit_original; + + if (!limit) + limit = &limit_local; + do { + if (limit && *limit == 0) + break; + Field* fields = result->Fetch(); uint32 acc_id = fields[0].GetUInt32(); std::string acc_name = fields[1].GetCppString(); - QueryResult* chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id); - if(chars) + ///- Get the characters for account id + QueryResult *chars = CharacterDatabase.PQuery( "SELECT guid, name, race, class, level FROM characters WHERE account = %u", acc_id); + if (chars) { - PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT,acc_name.c_str(),acc_id); - - uint64 guid = 0; - std::string name; - - do + if (chars->GetRowCount()) { - Field* charfields = chars->Fetch(); - guid = charfields[0].GetUInt64(); - name = charfields[1].GetCppString(); - - PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER,name.c_str(),guid); - ++i; - - } while( chars->NextRow() && ( limit == -1 || i < limit ) ); - - delete chars; + PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT,acc_name.c_str(),acc_id); + ShowPlayerListHelper(chars,limit,true,false); + } + else + delete chars; } } while(result->NextRow()); delete result; - if(i==0) // empty accounts only + if (*limit==limit_original) // empty accounts only { PSendSysMessage(LANG_NO_PLAYERS_FOUND); SetSentErrorMessage(true); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index e9e77ff1c..efb73972e 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -6136,24 +6136,23 @@ bool ChatHandler::HandleServerSetMotdCommand(const char* args) return true; } -/// Output list of character for account -bool ChatHandler::HandleAccountCharactersCommand(const char* args) +bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool title, bool error) { - ///- Get the command line arguments - std::string account_name; - Player* target = NULL; // only for triggering use targeted player account - uint32 account_id = extractAccountId((char*)args, &account_name, &target); - if (!account_id ) - return false; - - ///- Get the characters for account id - QueryResult *result = CharacterDatabase.PQuery( "SELECT guid, name, race, class, level FROM characters WHERE account = %u", account_id); - - if (!m_session) + if (!result) { - SendSysMessage(LANG_ACCOUNT_CHARACTERS_LIST_BAR); - SendSysMessage(LANG_ACCOUNT_CHARACTERS_LIST_HEADER); - SendSysMessage(LANG_ACCOUNT_CHARACTERS_LIST_BAR); + if (error) + { + PSendSysMessage(LANG_NO_PLAYERS_FOUND); + SetSentErrorMessage(true); + } + return false; + } + + if (!m_session && title) + { + SendSysMessage(LANG_CHARACTERS_LIST_BAR); + SendSysMessage(LANG_CHARACTERS_LIST_HEADER); + SendSysMessage(LANG_CHARACTERS_LIST_BAR); } if (result) @@ -6161,6 +6160,14 @@ bool ChatHandler::HandleAccountCharactersCommand(const char* args) ///- Circle through them. Display username and GM level do { + // check limit + if (limit) + { + if(*limit == 0) + break; + --*limit; + } + Field *fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); std::string name = fields[1].GetCppString(); @@ -6175,9 +6182,9 @@ bool ChatHandler::HandleAccountCharactersCommand(const char* args) char const* class_name = classEntry ? classEntry->name[GetSessionDbcLocale()] : ""; if (!m_session) - PSendSysMessage(LANG_ACCOUNT_CHARACTERS_LIST_LINE_CONSOLE, guid, name.c_str(), race_name, class_name, level); + PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CONSOLE, guid, name.c_str(), race_name, class_name, level); else - PSendSysMessage(LANG_ACCOUNT_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level); + PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level); }while( result->NextRow() ); @@ -6185,11 +6192,28 @@ bool ChatHandler::HandleAccountCharactersCommand(const char* args) } if (!m_session) - SendSysMessage(LANG_ACCOUNT_CHARACTERS_LIST_BAR); + SendSysMessage(LANG_CHARACTERS_LIST_BAR); return true; } + +/// Output list of character for account +bool ChatHandler::HandleAccountCharactersCommand(const char* args) +{ + ///- Get the command line arguments + std::string account_name; + Player* target = NULL; // only for triggering use targeted player account + uint32 account_id = extractAccountId((char*)args, &account_name, &target); + if (!account_id ) + return false; + + ///- Get the characters for account id + QueryResult *result = CharacterDatabase.PQuery( "SELECT guid, name, race, class, level FROM characters WHERE account = %u", account_id); + + return ShowPlayerListHelper(result); +} + /// Set/Unset the expansion level for an account bool ChatHandler::HandleAccountSetAddonCommand(const char* args) { diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index d93b3419d..1f11037e7 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -476,50 +476,16 @@ bool ChatHandler::HandleServerExitCommand(const char* /*args*/) } /// Display info on users currently in the realm -bool ChatHandler::HandleAccountOnlineListCommand(const char* /*args*/) +bool ChatHandler::HandleAccountOnlineListCommand(const char* args) { + char* limit_str = *args ? strtok((char*)args, " ") : NULL; + uint32 limit = limit_str ? atoi (limit_str) : 100; + ///- Get the list of accounts ID logged to the realm - QueryResult *resultDB = CharacterDatabase.Query("SELECT name,account FROM characters WHERE online > 0"); - if (!resultDB) - { - SendSysMessage(LANG_ACCOUNT_LIST_EMPTY); - return true; - } + // 0 1 2 3 4 + QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE realm = %u", realmID); - ///- Display the list of account/characters online - SendSysMessage(LANG_ACCOUNT_LIST_BAR); - SendSysMessage(LANG_ACCOUNT_LIST_HEADER); - SendSysMessage(LANG_ACCOUNT_LIST_BAR); - - ///- Circle through accounts - do - { - Field *fieldsDB = resultDB->Fetch(); - std::string name = fieldsDB[0].GetCppString(); - uint32 account = fieldsDB[1].GetUInt32(); - - ///- Get the username, last IP and GM level of each account - // No SQL injection. account is uint32. - // 0 1 2 3 - QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, expansion FROM account WHERE id = '%u'",account); - - if(resultLogin) - { - Field *fieldsLogin = resultLogin->Fetch(); - PSendSysMessage(LANG_ACCOUNT_LIST_LINE, - fieldsLogin[0].GetString(),name.c_str(),fieldsLogin[1].GetString(),fieldsLogin[2].GetUInt32(),fieldsLogin[3].GetUInt32()); - - delete resultLogin; - } - else - PSendSysMessage(LANG_ACCOUNT_LIST_ERROR,name.c_str()); - - }while(resultDB->NextRow()); - - delete resultDB; - - SendSysMessage(LANG_ACCOUNT_LIST_BAR); - return true; + return ShowAccountListHelper(result,&limit); } /// Create an account diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 461a473d9..da1bb2af7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9885" + #define REVISION_NR "9886" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 1dfd48da9..49604d255 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9883_01_mangos_scripts" + #define REVISION_DB_MANGOS "required_9886_02_mangos_command" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From a002f229165a5bff7d1ef57428d474ff4e089f24 Mon Sep 17 00:00:00 2001 From: Laise Date: Thu, 13 May 2010 14:40:39 +0300 Subject: [PATCH 015/172] [9887] Fix special mounts using in Dalaran --- src/game/Player.cpp | 9 +++++++-- src/game/Player.h | 2 +- src/game/Spell.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c0a905924..434e93904 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20906,11 +20906,16 @@ uint32 Player::CalculateTalentsPoints() const return uint32(talentPointsForLevel * sWorld.getConfig(CONFIG_FLOAT_RATE_TALENT)); } -bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone) const +bool Player::IsKnowHowFlyIn(uint32 mapid) const { + uint32 zone; + uint32 area; + GetZoneAndAreaId(zone, area); // continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone); - return v_map != 571 || HasSpell(54197); // Cold Weather Flying + + // don't allow flying in Dalaran except Krasus' Landing + return (v_map != 571 || HasSpell(54197)) && (zone != 4395 || area == 4564); // Cold Weather Flying } struct DoPlayerLearnSpell diff --git a/src/game/Player.h b/src/game/Player.h index 111108ddc..8ae6b0e22 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2150,7 +2150,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_CAN_FLY); } bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING); } - bool IsKnowHowFlyIn(uint32 mapid, uint32 zone) const; + bool IsKnowHowFlyIn(uint32 mapid) const; void SetClientControl(Unit* target, uint8 allowMove); void SetMover(Unit* target) { m_mover = target ? target : this; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index bba20a898..af4446247 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5113,7 +5113,7 @@ SpellCastResult Spell::CheckCast(bool strict) // allow always ghost flight spells if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isAlive()) { - if (!((Player*)m_caster)->IsKnowHowFlyIn(m_caster->GetMapId(),zone)) + if (!((Player*)m_caster)->IsKnowHowFlyIn(m_caster->GetMapId())) return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; } break; @@ -6548,7 +6548,7 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe target->GetZoneAndAreaId(zone, area); SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself()); - if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId(),zone)) + if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId())) target->CastSpell(target, spellId150, true); else if (spellIdSpecial > 0) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index da1bb2af7..20efc88ea 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9886" + #define REVISION_NR "9887" #endif // __REVISION_NR_H__ From 0344a8e838438d93124f4d97848958e657a9be42 Mon Sep 17 00:00:00 2001 From: Laise Date: Thu, 13 May 2010 15:14:58 +0300 Subject: [PATCH 016/172] [9888] Party restore IsKnowHowFlyIn and add area arg --- src/game/Player.cpp | 5 +---- src/game/Player.h | 2 +- src/game/Spell.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 434e93904..d4c8a5d3a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20906,11 +20906,8 @@ uint32 Player::CalculateTalentsPoints() const return uint32(talentPointsForLevel * sWorld.getConfig(CONFIG_FLOAT_RATE_TALENT)); } -bool Player::IsKnowHowFlyIn(uint32 mapid) const +bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone, uint32 area) const { - uint32 zone; - uint32 area; - GetZoneAndAreaId(zone, area); // continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone); diff --git a/src/game/Player.h b/src/game/Player.h index 8ae6b0e22..be072628c 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2150,7 +2150,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_CAN_FLY); } bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING); } - bool IsKnowHowFlyIn(uint32 mapid) const; + bool IsKnowHowFlyIn(uint32 mapid, uint32 zone, uint32 area) const; void SetClientControl(Unit* target, uint8 allowMove); void SetMover(Unit* target) { m_mover = target ? target : this; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index af4446247..99056f42e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5113,7 +5113,7 @@ SpellCastResult Spell::CheckCast(bool strict) // allow always ghost flight spells if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isAlive()) { - if (!((Player*)m_caster)->IsKnowHowFlyIn(m_caster->GetMapId())) + if (!((Player*)m_caster)->IsKnowHowFlyIn(m_caster->GetMapId(), zone, area)) return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; } break; @@ -6548,7 +6548,7 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe target->GetZoneAndAreaId(zone, area); SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself()); - if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId())) + if (locRes != SPELL_CAST_OK || !((Player*)target)->IsKnowHowFlyIn(target->GetMapId(), zone, area)) target->CastSpell(target, spellId150, true); else if (spellIdSpecial > 0) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 20efc88ea..9db420bb2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9887" + #define REVISION_NR "9888" #endif // __REVISION_NR_H__ From 31ec245b68d6dc1763237901498f1220bbdaa212 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 13 May 2010 16:38:15 +0200 Subject: [PATCH 017/172] [9889] Extend features available for SCRIPT_COMMAND_TALK * Allow other than Creature to talk. * Add "buddy-talk", using creature entry in datalong2 (the npc who will do the talk instead of the original source). Value in datalong3 is how far to look for the buddy. * Add data_flags making it possible to have conversations between units, controlling who does the talking and to whom, including make player do the talking when player is not already the source. Notes and details are added in the comments for SCRIPT_COMMAND_TALK Signed-off-by: NoFantasy --- src/game/Map.cpp | 73 ++++++++++++++++++++++++++++++++-------- src/game/ObjectMgr.cpp | 22 ++++++++---- src/game/World.h | 6 +++- src/shared/revision_nr.h | 2 +- 4 files changed, 81 insertions(+), 22 deletions(-) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d8ad165bb..b256ac60a 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2856,50 +2856,95 @@ void Map::ScriptsProcess() { if (!source) { - sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for NULL creature.", step.script->id); + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for NULL source.", step.script->id); break; } - if (source->GetTypeId() != TYPEID_UNIT) + WorldObject* pSource = dynamic_cast(source); + + if (!pSource) { - sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for non-creature (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); break; } + Creature* pBuddy = NULL; + + // flag_target_player_as_source 0x01 + // flag_original_source_as_target 0x02 + // flag_buddy_as_target 0x04 + + // If target is player (and not already the source) but should be the source + if (target && target->GetTypeId() == TYPEID_PLAYER && step.script->data_flags & 0x01) + { + if (source->GetTypeId() != TYPEID_PLAYER) + pSource = (WorldObject*)target; + } + + // If step has a buddy entry defined, search for it. + if (step.script->datalong2) + { + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->datalong2, true, step.script->datalong3); + MaNGOS::CreatureLastSearcher searcher(pSource, pBuddy, u_check); + + Cell::VisitGridObjects(pSource, searcher, step.script->datalong3); + } + + // If buddy found, then use it + if (pBuddy) + { + // pBuddy can be target of talk + if (step.script->data_flags & 0x04) + { + target = (Object*)pBuddy; + } + else + { + // If not target of talk, then set pBuddy as source + // Useless when source is already flagged to be player, and should maybe produce error. + if (!(step.script->data_flags & 0x01)) + pSource = (WorldObject*)pBuddy; + } + } + + // If we should talk to the original source instead of target + if (step.script->data_flags & 0x02) + target = source; + uint64 unit_target = target ? target->GetGUID() : 0; switch(step.script->datalong) { case CHAT_TYPE_SAY: - ((Creature*)source)->Say(step.script->dataint, LANG_UNIVERSAL, unit_target); + pSource->MonsterSay(step.script->dataint, LANG_UNIVERSAL, unit_target); break; case CHAT_TYPE_YELL: - ((Creature*)source)->Yell(step.script->dataint, LANG_UNIVERSAL, unit_target); + pSource->MonsterYell(step.script->dataint, LANG_UNIVERSAL, unit_target); break; case CHAT_TYPE_TEXT_EMOTE: - ((Creature*)source)->TextEmote(step.script->dataint, unit_target); + pSource->MonsterTextEmote(step.script->dataint, unit_target); break; case CHAT_TYPE_BOSS_EMOTE: - ((Creature*)source)->TextEmote(step.script->dataint, unit_target, true); + pSource->MonsterTextEmote(step.script->dataint, unit_target, true); break; case CHAT_TYPE_WHISPER: - if (!unit_target) + if (!unit_target || !IS_PLAYER_GUID(unit_target)) { - sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid, skipping.", step.script->id, step.script->datalong); + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid or non-player, skipping.", step.script->id, step.script->datalong); break; } - ((Creature*)source)->Whisper(step.script->dataint, unit_target); + pSource->MonsterWhisper(step.script->dataint, unit_target); break; case CHAT_TYPE_BOSS_WHISPER: - if (!unit_target) + if (!unit_target || !IS_PLAYER_GUID(unit_target)) { - sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid, skipping.", step.script->id, step.script->datalong); + sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid or non-player, skipping.", step.script->id, step.script->datalong); break; } - ((Creature*)source)->Whisper(step.script->dataint, unit_target, true); + pSource->MonsterWhisper(step.script->dataint, unit_target, true); break; case CHAT_TYPE_ZONE_YELL: - ((Creature*)source)->YellToZone(step.script->dataint, LANG_UNIVERSAL, unit_target); + pSource->MonsterYellToZone(step.script->dataint, LANG_UNIVERSAL, unit_target); break; default: break; // must be already checked at load diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index aba985b86..50c1c84a4 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4200,19 +4200,29 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) { case SCRIPT_COMMAND_TALK: { - if(tmp.datalong > CHAT_TYPE_ZONE_YELL) + if (tmp.datalong > CHAT_TYPE_ZONE_YELL) { - sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id); + sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.datalong, tmp.id); continue; } - if(tmp.dataint==0) + if (tmp.datalong2 && !GetCreatureTemplate(tmp.datalong2)) { - sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.dataint,tmp.id); + sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but this creature_template does not exist.", tablename, tmp.datalong2, tmp.id); continue; } - if(tmp.dataint < MIN_DB_SCRIPT_STRING_ID || tmp.dataint >= MAX_DB_SCRIPT_STRING_ID) + if (tmp.datalong2 && !tmp.datalong3) { - sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.dataint,MIN_DB_SCRIPT_STRING_ID,MAX_DB_SCRIPT_STRING_ID,tmp.id); + sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.datalong2, tmp.id, tmp.datalong3); + continue; + } + if (tmp.dataint == 0) + { + sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.dataint, tmp.id); + continue; + } + if (tmp.dataint < MIN_DB_SCRIPT_STRING_ID || tmp.dataint >= MAX_DB_SCRIPT_STRING_ID) + { + sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.dataint, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id); continue; } diff --git a/src/game/World.h b/src/game/World.h index fb95ac6b8..b3360e0ce 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -386,7 +386,11 @@ enum RealmZone }; // DB scripting commands -#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong (see enum ChatType for supported CHAT_TYPE_'s) +#define SCRIPT_COMMAND_TALK 0 // source = WorldObject, target = any/none, datalong (see enum ChatType for supported CHAT_TYPE_'s) + // datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius + // data_flags = flag_target_player_as_source = 0x01 + // flag_original_source_as_target = 0x02 + // flag_buddy_as_target = 0x04 #define SCRIPT_COMMAND_EMOTE 1 // source = unit, datalong = anim_id #define SCRIPT_COMMAND_FIELD_SET 2 // source = any, datalong = field_id, datalog2 = value #define SCRIPT_COMMAND_MOVE_TO 3 // source = Creature, datalog2 = time, x/y/z diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9db420bb2..92249a8b1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9888" + #define REVISION_NR "9889" #endif // __REVISION_NR_H__ From 5a72466935076da719da4676297e5ef09fd85c1d Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 13 May 2010 17:51:07 +0200 Subject: [PATCH 018/172] [9890] Add TYPEMASK_WORLDOBJECT to enum TypeMask Check typemask and replace a few dynamic_cast with more simple casts. Signed-off-by: NoFantasy --- src/game/Map.cpp | 23 +++++++++++------------ src/game/ObjectGuid.h | 2 ++ src/shared/revision_nr.h | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index b256ac60a..206af48f3 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2860,14 +2860,13 @@ void Map::ScriptsProcess() break; } - WorldObject* pSource = dynamic_cast(source); - - if (!pSource) + if (!source->isType(TYPEMASK_WORLDOBJECT)) { sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); break; } + WorldObject* pSource = (WorldObject*)source; Creature* pBuddy = NULL; // flag_target_player_as_source 0x01 @@ -3091,14 +3090,14 @@ void Map::ScriptsProcess() break; } - WorldObject* summoner = dynamic_cast(source); - - if (!summoner) + if (!source->isType(TYPEMASK_WORLDOBJECT)) { sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for non-WorldObject (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); break; } + WorldObject* summoner = (WorldObject*)source; + float x = step.script->x; float y = step.script->y; float z = step.script->z; @@ -3127,14 +3126,14 @@ void Map::ScriptsProcess() break; } - WorldObject* summoner = dynamic_cast(source); - - if (!summoner) + if (!source->isType(TYPEMASK_WORLDOBJECT)) { sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) call for non-WorldObject (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); break; } + WorldObject* summoner = (WorldObject*)source; + GameObject *go = NULL; int32 time_to_despawn = step.script->datalong2<5 ? 5 : (int32)step.script->datalong2; @@ -3428,14 +3427,14 @@ void Map::ScriptsProcess() break; } - WorldObject* pSource = dynamic_cast(source); - - if (!pSource) + if (!source->isType(TYPEMASK_WORLDOBJECT)) { sLog.outError("SCRIPT_COMMAND_PLAY_SOUND (script id %u) call for non-world object (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); break; } + WorldObject* pSource = (WorldObject*)source; + // bitmask: 0/1=anyone/target, 0/2=with distance dependent Player* pTarget = NULL; diff --git a/src/game/ObjectGuid.h b/src/game/ObjectGuid.h index 5ea26325f..21bbf105b 100644 --- a/src/game/ObjectGuid.h +++ b/src/game/ObjectGuid.h @@ -51,6 +51,8 @@ enum TypeMask TYPEMASK_CREATURE_OR_GAMEOBJECT = TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT, TYPEMASK_CREATURE_GAMEOBJECT_OR_ITEM = TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM, TYPEMASK_CREATURE_GAMEOBJECT_PLAYER_OR_ITEM = TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM | TYPEMASK_PLAYER, + + TYPEMASK_WORLDOBJECT = TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT | TYPEMASK_CORPSE, }; enum HighGuid diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 92249a8b1..3af863604 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9889" + #define REVISION_NR "9890" #endif // __REVISION_NR_H__ From 312a07649187ef818bf279b62bedc9a5a9491a92 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Fri, 14 May 2010 12:15:50 +0200 Subject: [PATCH 019/172] [9891] Implement *_scripts for creature_movement New field script_id in creature_movement can be filled for each waypoint point and run the corresponding script from creature_movement_scripts. Script_id can be any value and several points/creatures can share the same script (with limits of course, such as script depending on location and other factors). DB projects are advised to move current text, spells and emotes data in creature_movement fields as these fields are strictly no longer needed and may be fully removed in the future. Signed-off-by: NoFantasy --- sql/mangos.sql | 33 ++++++++++++++++++- .../9891_01_mangos_creature_movement.sql | 3 ++ ...91_02_mangos_creature_movement_scripts.sql | 18 ++++++++++ sql/updates/Makefile.am | 4 +++ src/game/ObjectMgr.cpp | 7 ++++ src/game/ObjectMgr.h | 2 ++ src/game/WaypointManager.cpp | 32 ++++++++++++++++-- src/game/WaypointManager.h | 7 ++-- src/game/WaypointMovementGenerator.cpp | 6 ++++ src/game/World.cpp | 3 ++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 12 files changed, 110 insertions(+), 9 deletions(-) create mode 100644 sql/updates/9891_01_mangos_creature_movement.sql create mode 100644 sql/updates/9891_02_mangos_creature_movement_scripts.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 30c3353e3..c561da1d2 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9886_02_mangos_command` bit(1) default NULL + `required_9891_02_mangos_creature_movement_scripts` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -984,6 +984,7 @@ CREATE TABLE `creature_movement` ( `position_y` float NOT NULL default '0', `position_z` float NOT NULL default '0', `waittime` int(10) unsigned NOT NULL default '0', + `script_id` int(10) unsigned NOT NULL default '0', `textid1` int(11) NOT NULL default '0', `textid2` int(11) NOT NULL default '0', `textid3` int(11) NOT NULL default '0', @@ -1007,6 +1008,36 @@ LOCK TABLES `creature_movement` WRITE; /*!40000 ALTER TABLE `creature_movement` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `creature_movement_scripts` +-- + +DROP TABLE IF EXISTS `creature_movement_scripts`; +CREATE TABLE `creature_movement_scripts` ( + `id` mediumint(8) unsigned NOT NULL default '0', + `delay` int(10) unsigned NOT NULL default '0', + `command` mediumint(8) unsigned NOT NULL default '0', + `datalong` mediumint(8) unsigned NOT NULL default '0', + `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', + `dataint` int(11) NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `z` float NOT NULL default '0', + `o` float NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `creature_movement_scripts` +-- + +LOCK TABLES `creature_movement_scripts` WRITE; +/*!40000 ALTER TABLE `creature_movement_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_movement_scripts` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `creature_onkill_reputation` -- diff --git a/sql/updates/9891_01_mangos_creature_movement.sql b/sql/updates/9891_01_mangos_creature_movement.sql new file mode 100644 index 000000000..89d38f270 --- /dev/null +++ b/sql/updates/9891_01_mangos_creature_movement.sql @@ -0,0 +1,3 @@ +ALTER TABLE db_version CHANGE COLUMN required_9886_02_mangos_command required_9891_01_mangos_creature_movement bit; + +ALTER TABLE creature_movement ADD COLUMN script_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER waittime; diff --git a/sql/updates/9891_02_mangos_creature_movement_scripts.sql b/sql/updates/9891_02_mangos_creature_movement_scripts.sql new file mode 100644 index 000000000..e37fba3ce --- /dev/null +++ b/sql/updates/9891_02_mangos_creature_movement_scripts.sql @@ -0,0 +1,18 @@ +ALTER TABLE db_version CHANGE COLUMN required_9891_01_mangos_creature_movement required_9891_02_mangos_creature_movement_scripts bit; + +DROP TABLE IF EXISTS `creature_movement_scripts`; +CREATE TABLE `creature_movement_scripts` ( + `id` mediumint(8) unsigned NOT NULL default '0', + `delay` int(10) unsigned NOT NULL default '0', + `command` mediumint(8) unsigned NOT NULL default '0', + `datalong` mediumint(8) unsigned NOT NULL default '0', + `datalong2` int(10) unsigned NOT NULL default '0', + `datalong3` int(10) unsigned NOT NULL default '0', + `datalong4` int(10) unsigned NOT NULL default '0', + `data_flags` tinyint(3) unsigned NOT NULL default '0', + `dataint` int(11) NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `z` float NOT NULL default '0', + `o` float NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index f55e50d2a..431455d86 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -62,6 +62,8 @@ pkgdata_DATA = \ 9883_01_mangos_scripts.sql \ 9886_01_mangos_mangos_string.sql \ 9886_02_mangos_command.sql \ + 9891_01_mangos_creature_movement.sql \ + 9891_02_mangos_creature_movement_scripts.sql \ README ## Additional files to include when running 'make dist' @@ -104,4 +106,6 @@ EXTRA_DIST = \ 9883_01_mangos_scripts.sql \ 9886_01_mangos_mangos_string.sql \ 9886_02_mangos_command.sql \ + 9891_01_mangos_creature_movement.sql \ + 9891_02_mangos_creature_movement_scripts.sql \ README diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 50c1c84a4..462688476 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -57,6 +57,7 @@ ScriptMapMap sSpellScripts; ScriptMapMap sGameObjectScripts; ScriptMapMap sEventScripts; ScriptMapMap sGossipScripts; +ScriptMapMap sCreatureMovementScripts; bool normalizePlayerName(std::string& name) { @@ -4579,6 +4580,11 @@ void ObjectMgr::LoadGossipScripts() // checks are done in LoadGossipMenuItems } +void ObjectMgr::LoadCreatureMovementScripts() +{ + LoadScripts(sCreatureMovementScripts, "creature_movement_scripts"); +} + void ObjectMgr::LoadPageTexts() { sPageTextStore.Free(); // for reload case @@ -8477,6 +8483,7 @@ void ObjectMgr::LoadDbScriptStrings() CheckScripts(sGameObjectScripts,ids); CheckScripts(sEventScripts,ids); CheckScripts(sGossipScripts,ids); + CheckScripts(sCreatureMovementScripts,ids); sWaypointMgr.CheckTextsExistance(ids); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 837d7fc45..7a60d017a 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -93,6 +93,7 @@ extern ScriptMapMap sSpellScripts; extern ScriptMapMap sGameObjectScripts; extern ScriptMapMap sEventScripts; extern ScriptMapMap sGossipScripts; +extern ScriptMapMap sCreatureMovementScripts; struct SpellClickInfo { @@ -595,6 +596,7 @@ class ObjectMgr void LoadEventScripts(); void LoadSpellScripts(); void LoadGossipScripts(); + void LoadCreatureMovementScripts(); bool LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); bool LoadMangosStrings() { return LoadMangosStrings(WorldDatabase,"mangos_string",MIN_MANGOS_STRING_ID,MAX_MANGOS_STRING_ID); } diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index 40ec6b814..528611dc6 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -85,8 +85,13 @@ void WaypointManager::Load() // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2," - // 6 7 8 9 10 11 12 13 14 15 - "waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement"); + // 6 7 8 9 10 11 12 13 14 15 16 + "waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point, script_id FROM creature_movement"); + + std::set movementScriptSet; + + for(ScriptMapMap::const_iterator itr = sCreatureMovementScripts.begin(); itr != sCreatureMovementScripts.end(); ++itr) + movementScriptSet.insert(itr->first); barGoLink bar( (int)result->GetRowCount() ); do @@ -111,6 +116,7 @@ void WaypointManager::Load() node.z = fields[2].GetFloat(); node.orientation = fields[3].GetFloat(); node.delay = fields[6].GetUInt32(); + node.script_id = fields[16].GetUInt32(); // prevent using invalid coordinates if(!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation)) @@ -132,6 +138,20 @@ void WaypointManager::Load() } WorldDatabase.PExecute("UPDATE creature_movement SET position_x = '%f', position_y = '%f', position_z = '%f' WHERE id = '%u' AND point = '%u'", node.x, node.y, node.z, id, point); } + + if (node.script_id) + { + if (sCreatureMovementScripts.find(node.script_id) == sCreatureMovementScripts.end()) + { + sLog.outErrorDb("Table creature_movement for id %u, point %u have script_id %u that does not exist in `creature_movement_scripts`, ignoring", id, point, node.script_id); + continue; + } + + movementScriptSet.erase(node.script_id); + } + + // WaypointBehavior can be dropped in time. Script_id added may 2010 and can handle all the below behavior. + WaypointBehavior be; be.model1 = fields[4].GetUInt32(); be.model2 = fields[5].GetUInt32(); @@ -173,6 +193,12 @@ void WaypointManager::Load() } while( result->NextRow() ); delete result; + if (!movementScriptSet.empty()) + { + for(std::set::const_iterator itr = movementScriptSet.begin(); itr != movementScriptSet.end(); ++itr) + sLog.outErrorDb("Table `creature_movement_scripts` contain unused script, id %u.", *itr); + } + sLog.outString(); sLog.outString( ">> Waypoints and behaviors loaded" ); sLog.outString(); @@ -233,7 +259,7 @@ void WaypointManager::_addNode(uint32 id, uint32 point, float x, float y, float WaypointPathMap::iterator itr = m_pathMap.find(id); if(itr == m_pathMap.end()) itr = m_pathMap.insert(WaypointPathMap::value_type(id, WaypointPath())).first; - itr->second.insert(itr->second.begin() + (point - 1), WaypointNode(x, y, z, o, delay, NULL)); + itr->second.insert(itr->second.begin() + (point - 1), WaypointNode(x, y, z, o, delay, 0, NULL)); } uint32 WaypointManager::GetLastPoint(uint32 id, uint32 default_notfound) diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index ae8375a6b..e0c0eb4f5 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -45,10 +45,11 @@ struct WaypointNode float z; float orientation; uint32 delay; + uint32 script_id; // Added may 2010. WaypointBehavior w/DB data should in time be removed. WaypointBehavior * behavior; - WaypointNode() : x(0.0f), y(0.0f), z(0.0f), orientation(0.0f), delay(0), behavior(NULL) {} - WaypointNode(float _x, float _y, float _z, float _o, uint32 _delay, WaypointBehavior * _behavior) - : x(_x), y(_y), z(_z), orientation(_o), delay(_delay), behavior(_behavior) {} + WaypointNode() : x(0.0f), y(0.0f), z(0.0f), orientation(0.0f), delay(0), script_id(0), behavior(NULL) {} + WaypointNode(float _x, float _y, float _z, float _o, uint32 _delay, uint32 _script_id, WaypointBehavior * _behavior) + : x(_x), y(_y), z(_z), orientation(_o), delay(_delay), script_id(_script_id), behavior(_behavior) {} }; typedef std::vector WaypointPath; diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 834e11bd4..ba6bd7e68 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -171,6 +171,12 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 if (i_path->at(idx).orientation != 100) creature.SetOrientation(i_path->at(idx).orientation); + if (i_path->at(idx).script_id) + { + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature movement start script %u at point %u for creature %u (entry %u).", i_path->at(idx).script_id, idx, creature.GetDBTableGUIDLow(), creature.GetEntry()); + creature.GetMap()->ScriptsStart(sCreatureMovementScripts, i_path->at(idx).script_id, &creature, &creature); + } + if (WaypointBehavior *behavior = i_path->at(idx).behavior) { if (behavior->emote != 0) diff --git a/src/game/World.cpp b/src/game/World.cpp index 87d4a1591..cffa722e5 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1185,6 +1185,9 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading Trainers..." ); sObjectMgr.LoadTrainerSpell(); // must be after load CreatureTemplate + sLog.outString( "Loading Waypoint scripts..." ); // before loading from creature_movement + sObjectMgr.LoadCreatureMovementScripts(); + sLog.outString( "Loading Waypoints..." ); sLog.outString(); sWaypointMgr.Load(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3af863604..36daf8dac 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9890" + #define REVISION_NR "9891" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 49604d255..ddeb2745b 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9886_02_mangos_command" + #define REVISION_DB_MANGOS "required_9891_02_mangos_creature_movement_scripts" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 19b5d777cd56ef5e58b817a9158244cd481c8381 Mon Sep 17 00:00:00 2001 From: j4r0d Date: Fri, 14 May 2010 23:14:23 +0400 Subject: [PATCH 020/172] [9892] Cleanups for BattleGroundEY code Signed-off-by: VladimirMangos Also prevent send uninitilized mark data in case BATTLEGROUND_EY end. Simplify related code. --- src/game/BattleGround.cpp | 28 ++++--------- src/game/BattleGroundEY.cpp | 80 ++++++++++++++++++------------------- src/game/BattleGroundEY.h | 59 ++++++++++++--------------- src/shared/revision_nr.h | 2 +- 4 files changed, 75 insertions(+), 94 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 8ed0a0420..eb6ba1b2e 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -855,42 +855,30 @@ uint32 BattleGround::GetBattlemasterEntry() const void BattleGround::RewardMark(Player *plr,uint32 count) { - BattleGroundMarks mark; - bool IsSpell; switch(GetTypeID()) { case BATTLEGROUND_AV: - IsSpell = true; if (count == ITEM_WINNER_COUNT) - mark = SPELL_AV_MARK_WINNER; + RewardSpellCast(plr,SPELL_AV_MARK_WINNER); else - mark = SPELL_AV_MARK_LOSER; + RewardSpellCast(plr,SPELL_AV_MARK_LOSER); break; case BATTLEGROUND_WS: - IsSpell = true; if (count == ITEM_WINNER_COUNT) - mark = SPELL_WS_MARK_WINNER; + RewardSpellCast(plr,SPELL_WS_MARK_WINNER); else - mark = SPELL_WS_MARK_LOSER; + RewardSpellCast(plr,SPELL_WS_MARK_LOSER); break; case BATTLEGROUND_AB: - IsSpell = true; if (count == ITEM_WINNER_COUNT) - mark = SPELL_AB_MARK_WINNER; + RewardSpellCast(plr,SPELL_AB_MARK_WINNER); else - mark = SPELL_AB_MARK_LOSER; - break; - case BATTLEGROUND_EY: - IsSpell = false; + RewardSpellCast(plr,SPELL_AB_MARK_LOSER); break; + case BATTLEGROUND_EY: // no rewards default: - return; + break; } - - if (IsSpell) - RewardSpellCast(plr,mark); - else - RewardItem(plr,mark,count); } void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id) diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 2bbbec34c..ea8e46677 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -33,10 +33,10 @@ BattleGroundEY::BattleGroundEY() m_BuffChange = true; m_BgObjects.resize(BG_EY_OBJECT_MAX); - m_Points_Trigger[FEL_REALVER] = TR_FEL_REALVER_BUFF; - m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; - m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; - m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; + m_Points_Trigger[BG_EY_NODE_FEL_REAVER] = TR_FEL_REAVER_BUFF; + m_Points_Trigger[BG_EY_NODE_BLOOD_ELF] = TR_BLOOD_ELF_BUFF; + m_Points_Trigger[BG_EY_NODE_DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; + m_Points_Trigger[BG_EY_NODE_MAGE_TOWER] = TR_MAGE_TOWER_BUFF; m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; @@ -107,7 +107,7 @@ void BattleGroundEY::StartingEventOpenDoors() { //randomly spawn buff uint8 buff = urand(0, 2); - SpawnBGObject(m_BgObjects[BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + buff + i * 3], RESPAWN_IMMEDIATELY); + SpawnBGObject(m_BgObjects[BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + buff + i * 3], RESPAWN_IMMEDIATELY); } } @@ -129,12 +129,12 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i) { uint8 j = 0; - while (j < m_PlayersNearPoint[BG_EY_NODES_MAX].size()) + while (j < m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].size()) { - Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_NODES_MAX][j]); + Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j]); if (!plr) { - sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[BG_EY_NODES_MAX][j])); + sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j])); ++j; continue; } @@ -147,9 +147,9 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], plr); UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, plr); //add player to point - m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[BG_EY_NODES_MAX][j]); + m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j]); //remove player from "free space" - m_PlayersNearPoint[BG_EY_NODES_MAX].erase(m_PlayersNearPoint[BG_EY_NODES_MAX].begin() + j); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].erase(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].begin() + j); } else ++j; @@ -172,7 +172,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() { sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug - m_PlayersNearPoint[BG_EY_NODES_MAX].push_back(m_PlayersNearPoint[i][j]); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); ++j; continue; @@ -181,7 +181,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() !plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS)) //move player out of point (add him to players that are out of points { - m_PlayersNearPoint[BG_EY_NODES_MAX].push_back(m_PlayersNearPoint[i][j]); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); } @@ -307,7 +307,7 @@ void BattleGroundEY::AddPlayer(Player *plr) //create score and add it to map BattleGroundEYScore* sc = new BattleGroundEYScore; - m_PlayersNearPoint[BG_EY_NODES_MAX].push_back(plr->GetGUID()); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(plr->GetGUID()); m_PlayerScores[plr->GetGUID()] = sc; } @@ -347,22 +347,22 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) switch(Trigger) { case TR_BLOOD_ELF_POINT: - if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam()) + if (m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == Source->GetTeam()) if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) EventPlayerCapturedFlag(Source, BG_EY_NODE_BLOOD_ELF); break; - case TR_FEL_REALVER_POINT: - if (m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam()) + case TR_FEL_REAVER_POINT: + if (m_PointState[BG_EY_NODE_FEL_REAVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_FEL_REAVER] == Source->GetTeam()) if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) - EventPlayerCapturedFlag(Source, BG_EY_NODE_FEL_REALVER); + EventPlayerCapturedFlag(Source, BG_EY_NODE_FEL_REAVER); break; case TR_MAGE_TOWER_POINT: - if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam()) + if (m_PointState[BG_EY_NODE_MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_MAGE_TOWER] == Source->GetTeam()) if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) EventPlayerCapturedFlag(Source, BG_EY_NODE_MAGE_TOWER); break; case TR_DRAENEI_RUINS_POINT: - if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam()) + if (m_PointState[BG_EY_NODE_DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_DRAENEI_RUINS] == Source->GetTeam()) if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) EventPlayerCapturedFlag(Source, BG_EY_NODE_DRAENEI_RUINS); break; @@ -376,6 +376,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) case 4569: case 4570: case 4571: + case 5866: break; default: sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); @@ -395,9 +396,9 @@ bool BattleGroundEY::SetupBattleGround() sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]); continue; } - if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) - || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) - || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) + if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) ) sLog.outError("BattleGroundEY: Cannot spawn buff"); } @@ -436,8 +437,8 @@ void BattleGroundEY::Reset() // the flag in the middle is spawned at beginning m_ActiveEvents[BG_EY_EVENT_CAPTURE_FLAG] = BG_EY_EVENT2_FLAG_CENTER; - m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].clear(); - m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].reserve(30); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].clear(); + m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].reserve(30); } void BattleGroundEY::RespawnFlag(bool send_message) @@ -673,18 +674,18 @@ void BattleGroundEY::FillInitialWorldStates(WorldPacket& data, uint32& count) FillInitialWorldState(data, count, 0xab0, 0x0); FillInitialWorldState(data, count, 0xaaf, 0x0); - FillInitialWorldState(data, count, DRAENEI_RUINS_HORDE_CONTROL, m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, DRAENEI_RUINS_ALLIANCE_CONTROL, m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, DRAENEI_RUINS_UNCONTROL, m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, MAGE_TOWER_ALLIANCE_CONTROL, m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, MAGE_TOWER_HORDE_CONTROL, m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, MAGE_TOWER_UNCONTROL, m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, FEL_REAVER_HORDE_CONTROL, m_PointOwnedByTeam[FEL_REALVER] == HORDE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, FEL_REAVER_ALLIANCE_CONTROL, m_PointOwnedByTeam[FEL_REALVER] == ALLIANCE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, FEL_REAVER_UNCONTROL, m_PointState[FEL_REALVER] != EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, BLOOD_ELF_HORDE_CONTROL, m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, BLOOD_ELF_ALLIANCE_CONTROL, m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - FillInitialWorldState(data, count, BLOOD_ELF_UNCONTROL, m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, DRAENEI_RUINS_HORDE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_DRAENEI_RUINS] == HORDE && m_PointState[BG_EY_NODE_DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, DRAENEI_RUINS_ALLIANCE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_DRAENEI_RUINS] == ALLIANCE && m_PointState[BG_EY_NODE_DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, DRAENEI_RUINS_UNCONTROL, m_PointState[BG_EY_NODE_DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, MAGE_TOWER_ALLIANCE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_MAGE_TOWER] == ALLIANCE && m_PointState[BG_EY_NODE_MAGE_TOWER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, MAGE_TOWER_HORDE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_MAGE_TOWER] == HORDE && m_PointState[BG_EY_NODE_MAGE_TOWER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, MAGE_TOWER_UNCONTROL, m_PointState[BG_EY_NODE_MAGE_TOWER] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, FEL_REAVER_HORDE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_FEL_REAVER] == HORDE && m_PointState[BG_EY_NODE_FEL_REAVER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, FEL_REAVER_ALLIANCE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_FEL_REAVER] == ALLIANCE && m_PointState[BG_EY_NODE_FEL_REAVER] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, FEL_REAVER_UNCONTROL, m_PointState[BG_EY_NODE_FEL_REAVER] != EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, BLOOD_ELF_HORDE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == HORDE && m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, BLOOD_ELF_ALLIANCE_CONTROL, m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == ALLIANCE && m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL); + FillInitialWorldState(data, count, BLOOD_ELF_UNCONTROL, m_PointState[BG_EY_NODE_BLOOD_ELF] != EY_POINT_UNDER_CONTROL); FillInitialWorldState(data, count, NETHERSTORM_FLAG, m_FlagState == BG_EY_FLAG_STATE_ON_BASE); FillInitialWorldState(data, count, 0xad2, 0x1); FillInitialWorldState(data, count, 0xad1, 0x1); @@ -753,10 +754,9 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player) bool BattleGroundEY::IsAllNodesConrolledByTeam(uint32 team) const { - uint32 count = 0; for(int i = 0; i < BG_EY_NODES_MAX; ++i) - if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EY_POINT_UNDER_CONTROL) - ++count; + if (m_PointState[i] != EY_POINT_UNDER_CONTROL || m_PointOwnedByTeam[i] != team) + return false; - return count == BG_EY_NODES_MAX; + return true; } diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 36374ff4d..bfd17a53f 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -86,11 +86,11 @@ enum BG_EY_Spells enum EYBattleGroundPointsTrigger { TR_BLOOD_ELF_POINT = 4476, - TR_FEL_REALVER_POINT = 4514, + TR_FEL_REAVER_POINT = 4514, TR_MAGE_TOWER_POINT = 4516, TR_DRAENEI_RUINS_POINT = 4518, TR_BLOOD_ELF_BUFF = 4568, - TR_FEL_REALVER_BUFF = 4569, + TR_FEL_REAVER_BUFF = 4569, TR_MAGE_TOWER_BUFF = 4570, TR_DRAENEI_RUINS_BUFF = 4571 }; @@ -99,54 +99,47 @@ enum EYBattleGroundGaveyards { EY_GRAVEYARD_MAIN_ALLIANCE = 1103, EY_GRAVEYARD_MAIN_HORDE = 1104, - EY_GRAVEYARD_FEL_REALVER = 1105, + EY_GRAVEYARD_FEL_REAVER = 1105, EY_GRAVEYARD_BLOOD_ELF = 1106, EY_GRAVEYARD_DRAENEI_RUINS = 1107, EY_GRAVEYARD_MAGE_TOWER = 1108 }; -// deprecated -enum EYBattleGroundPoints -{ - FEL_REALVER = 0, - BLOOD_ELF = 1, - DRAENEI_RUINS = 2, - MAGE_TOWER = 3, - - EY_PLAYERS_OUT_OF_POINTS = 4, -}; - enum BG_EY_Nodes { - BG_EY_NODE_FEL_REALVER = 0, - BG_EY_NODE_BLOOD_ELF = 1, - BG_EY_NODE_DRAENEI_RUINS = 2, - BG_EY_NODE_MAGE_TOWER = 3, - BG_EY_NODES_ERROR = 255 + BG_EY_NODE_FEL_REAVER = 0, + BG_EY_NODE_BLOOD_ELF = 1, + BG_EY_NODE_DRAENEI_RUINS = 2, + BG_EY_NODE_MAGE_TOWER = 3, + + // special internal node + BG_EY_PLAYERS_OUT_OF_POINTS = 4, // used for store out of node players data }; -#define BG_EY_NODES_MAX 4 + +#define BG_EY_NODES_MAX 4 +#define BG_EY_NODES_MAX_WITH_SPEIAL 5 // node-events work like this: event1:nodeid, event2:state (0alliance,1horde,2neutral) #define BG_EYE_NEUTRAL_TEAM 2 -#define BG_EY_EVENT_CAPTURE_FLAG 4 // event1=4, event2=nodeid or 4 for the default center spawn - #define BG_EY_EVENT2_FLAG_CENTER 4 // maximum node is 3 so 4 for center is ok - // all other event2 are just nodeids, i won't define something here +#define BG_EY_EVENT_CAPTURE_FLAG 4 // event1=4, event2=nodeid or 4 for the default center spawn +#define BG_EY_EVENT2_FLAG_CENTER 4 // maximum node is 3 so 4 for center is ok +// all other event2 are just nodeids, i won't define something here // x, y, z // used to check, when player is in range of a node -const float BG_EY_NodePositions[BG_EY_NODES_MAX][4] = { - {2024.600708f, 1742.819580f, 1195.157715f}, // FEL_REALVER - {2050.493164f, 1372.235962f, 1194.563477f}, // BLOOD_ELF - {2301.010498f, 1386.931641f, 1197.183472f}, // DRAENEI_RUINS - {2282.121582f, 1760.006958f, 1189.707153f} // MAGE_TOWER +const float BG_EY_NodePositions[BG_EY_NODES_MAX][3] = { + {2024.600708f, 1742.819580f, 1195.157715f}, // BG_EY_NODE_FEL_REAVER + {2050.493164f, 1372.235962f, 1194.563477f}, // BG_EY_NODE_BLOOD_ELF + {2301.010498f, 1386.931641f, 1197.183472f}, // BG_EY_NODE_DRAENEI_RUINS + {2282.121582f, 1760.006958f, 1189.707153f} // BG_EY_NODE_MAGE_TOWER }; enum EYBattleGroundObjectTypes { //buffs - BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER = 1, - BG_EY_OBJECT_REGENBUFF_FEL_REALVER = 2, - BG_EY_OBJECT_BERSERKBUFF_FEL_REALVER = 3, + BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER = 1, + BG_EY_OBJECT_REGENBUFF_FEL_REAVER = 2, + BG_EY_OBJECT_BERSERKBUFF_FEL_REAVER = 3, BG_EY_OBJECT_SPEEDBUFF_BLOOD_ELF = 4, BG_EY_OBJECT_REGENBUFF_BLOOD_ELF = 5, BG_EY_OBJECT_BERSERKBUFF_BLOOD_ELF = 6, @@ -232,7 +225,7 @@ const BattleGroundEYLoosingPointStruct LoosingPointTypes[BG_EY_NODES_MAX] = }; const BattleGroundEYCapturingPointStruct CapturingPointTypes[BG_EY_NODES_MAX] = { - BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_F_RUINS, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REALVER), + BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_F_RUINS, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REAVER), BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_B_TOWER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF), BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_D_RUINS, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), BattleGroundEYCapturingPointStruct(LANG_BG_EY_HAS_TAKEN_A_M_TOWER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER) @@ -323,7 +316,7 @@ class BattleGroundEY : public BattleGround uint8 m_PointState[BG_EY_NODES_MAX]; int32 m_PointBarStatus[BG_EY_NODES_MAX]; typedef std::vector PlayersNearPointType; - PlayersNearPointType m_PlayersNearPoint[BG_EY_NODES_MAX + 1]; + PlayersNearPointType m_PlayersNearPoint[BG_EY_NODES_MAX_WITH_SPEIAL]; uint8 m_CurrentPointPlayersCount[2*BG_EY_NODES_MAX]; int32 m_PointAddingTimer; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 36daf8dac..97d656d33 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9891" + #define REVISION_NR "9892" #endif // __REVISION_NR_H__ From 34a1cc31d07072f0fe0866a2680a528c75e51987 Mon Sep 17 00:00:00 2001 From: nos4r2zod Date: Sat, 15 May 2010 04:09:35 +0400 Subject: [PATCH 021/172] [9893] Fixed some spelling typos in function/structure names. Signed-off-by: VladimirMangos --- src/game/Level3.cpp | 2 +- src/game/SpellMgr.cpp | 8 ++++---- src/game/SpellMgr.h | 4 ++-- src/game/World.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index efb73972e..1df230f2d 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -579,7 +579,7 @@ bool ChatHandler::HandleReloadSpellProcEventCommand(const char*) bool ChatHandler::HandleReloadSpellBonusesCommand(const char*) { sLog.outString( "Re-Loading Spell Bonus Data..." ); - sSpellMgr.LoadSpellBonusess(); + sSpellMgr.LoadSpellBonuses(); SendGlobalSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fe14e20c4..fe5a05198 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1044,14 +1044,14 @@ void SpellMgr::LoadSpellProcItemEnchant() sLog.outString( ">> Loaded %u proc item enchant definitions", count ); } -struct DoSpellBonusess +struct DoSpellBonuses { - DoSpellBonusess(SpellBonusEntry const& _spellBonus) : spellBonus(_spellBonus) {} + DoSpellBonuses(SpellBonusEntry const& _spellBonus) : spellBonus(_spellBonus) {} void operator() (uint32 spell_id) { sSpellMgr.mSpellBonusMap[spell_id] = spellBonus; } SpellBonusEntry const& spellBonus; }; -void SpellMgr::LoadSpellBonusess() +void SpellMgr::LoadSpellBonuses() { mSpellBonusMap.clear(); // need for reload case uint32 count = 0; @@ -1098,7 +1098,7 @@ void SpellMgr::LoadSpellBonusess() mSpellBonusMap[entry] = sbe; // also add to high ranks - DoSpellBonusess worker(sbe); + DoSpellBonuses worker(sbe); doForHighRanks(entry,worker); ++count; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index e5b0bfec5..e9b8c5286 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -739,7 +739,7 @@ inline bool IsProfessionOrRidingSkill(uint32 skill) class SpellMgr { - friend struct DoSpellBonusess; + friend struct DoSpellBonuses; friend struct DoSpellProcEvent; friend struct DoSpellProcItemEnchant; @@ -1022,7 +1022,7 @@ class SpellMgr void LoadSpellElixirs(); void LoadSpellProcEvents(); void LoadSpellProcItemEnchant(); - void LoadSpellBonusess(); + void LoadSpellBonuses(); void LoadSpellTargetPositions(); void LoadSpellThreats(); void LoadSkillLineAbilityMap(); diff --git a/src/game/World.cpp b/src/game/World.cpp index cffa722e5..f8a076492 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -970,10 +970,10 @@ void World::SetInitialWorldSettings() sSpellMgr.LoadSpellProcEvents(); sLog.outString( "Loading Spell Bonus Data..." ); - sSpellMgr.LoadSpellBonusess(); + sSpellMgr.LoadSpellBonuses(); // must be after LoadSpellChains sLog.outString( "Loading Spell Proc Item Enchant..." ); - sSpellMgr.LoadSpellProcItemEnchant(); // must be after LoadSpellChains + sSpellMgr.LoadSpellProcItemEnchant(); // must be after LoadSpellChains sLog.outString( "Loading Aggro Spells Definitions..."); sSpellMgr.LoadSpellThreats(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 97d656d33..871efb5a6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9892" + #define REVISION_NR "9893" #endif // __REVISION_NR_H__ From 4951f846dd423af54d4cc42d29e72a3d5dba2584 Mon Sep 17 00:00:00 2001 From: nos4r2zod Date: Sat, 15 May 2010 05:23:51 +0400 Subject: [PATCH 022/172] [9894] Move GetCastingTimeForBonus and some other code to GetSpellCastTimeForBonus. Important changes: * Chaged way caluclation "-5% of total per any additional effect" to percent apply instead use raw value that correct only for 3500 cast time spells. * GetSpellCastTimeForBonus result now alwasy not applied to creature casted spells Before it not applied only to instant spells. Please test if this ok in all cases. * Leech effect modify spell casting time move into GetCastingTimeForBonus and then called also for melee spells. But only creature spells exist with melee class damage and its not affected by GetCastingTimeForBonus anyway now. Signed-off-by: VladimirMangos --- src/game/SpellMgr.cpp | 101 +++++++++++++++++++ src/game/SpellMgr.h | 1 + src/game/Unit.cpp | 204 +++++++++++---------------------------- src/game/Unit.h | 2 - src/shared/revision_nr.h | 2 +- 5 files changed, 157 insertions(+), 153 deletions(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fe5a05198..815284c7f 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -95,6 +95,107 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell) return (castTime > 0) ? uint32(castTime) : 0; } +uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype ) +{ + uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); + + if (CastingTime > 7000) CastingTime = 7000; + if (CastingTime < 1500) CastingTime = 1500; + + if(damagetype == DOT && !IsChanneledSpell(spellProto)) + CastingTime = 3500; + + int32 overTime = 0; + uint8 effects = 0; + bool DirectDamage = false; + bool AreaEffect = false; + + for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) + if (IsAreaEffectTarget(Targets(spellProto->EffectImplicitTargetA[i])) || IsAreaEffectTarget(Targets(spellProto->EffectImplicitTargetB[i]))) + AreaEffect = true; + + for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { + switch (spellProto->Effect[i]) + { + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_POWER_DRAIN: + case SPELL_EFFECT_HEALTH_LEECH: + case SPELL_EFFECT_ENVIRONMENTAL_DAMAGE: + case SPELL_EFFECT_POWER_BURN: + case SPELL_EFFECT_HEAL: + DirectDamage = true; + break; + case SPELL_EFFECT_APPLY_AURA: + switch (spellProto->EffectApplyAuraName[i]) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_PERIODIC_LEECH: + if ( GetSpellDuration(spellProto) ) + overTime = GetSpellDuration(spellProto); + break; + // Penalty for additional effects + case SPELL_AURA_DUMMY: + ++effects; + break; + case SPELL_AURA_MOD_DECREASE_SPEED: + ++effects; + break; + case SPELL_AURA_MOD_CONFUSE: + case SPELL_AURA_MOD_STUN: + case SPELL_AURA_MOD_ROOT: + // -10% per effect + effects += 2; + break; + default: + break; + } + default: + break; + } + } + + // Combined Spells with Both Over Time and Direct Damage + if (overTime > 0 && CastingTime > 0 && DirectDamage) + { + // mainly for DoTs which are 3500 here otherwise + uint32 OriginalCastTime = GetSpellCastTime(spellProto); + if (OriginalCastTime > 7000) OriginalCastTime = 7000; + if (OriginalCastTime < 1500) OriginalCastTime = 1500; + // Portion to Over Time + float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f)); + + if (damagetype == DOT) + CastingTime = uint32(CastingTime * PtOT); + else if (PtOT < 1.0f) + CastingTime = uint32(CastingTime * (1 - PtOT)); + else + CastingTime = 0; + } + + // Area Effect Spells receive only half of bonus + if (AreaEffect) + CastingTime /= 2; + + // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing + for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + { + if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || + spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) + { + CastingTime /= 2; + break; + } + } + + // -5% of total per any additional effect (multiplicative) + for (int i = 0; i < effects; ++i) + CastingTime *= 0.95f; + + return CastingTime; +} + uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo) { int32 DotDuration = GetSpellDuration(spellInfo); diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index e9b8c5286..b709b7ca5 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -110,6 +110,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId); // Different spell properties inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); } uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL); +uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype ); inline float GetSpellMinRange(SpellRangeEntry const *range, bool friendly = false) { if(!range) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3b3689239..ae2dd8d60 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9187,21 +9187,16 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u if (uint16 DotTicks = GetSpellAuraMaxTicks(spellProto)) DoneAdvertisedBenefit = DoneAdvertisedBenefit / DotTicks; } + // Distribute Damage over multiple effects, reduce by AoE - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) - { - if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - DoneTotal += int32(DoneAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty * SpellModSpellDamage); + // Not apply this to creature casted spells + float coeff; + if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) + coeff = 1.0f; + else + coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + DoneTotal += int32(DoneAdvertisedBenefit * coeff * DotFactor * LvlPenalty * SpellModSpellDamage); } float tmpDamage = (int32(pdamage) + DoneTotal * int32(stack)) * DoneTotalMod; @@ -9294,21 +9289,16 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto, if (uint16 DotTicks = GetSpellAuraMaxTicks(spellProto)) TakenAdvertisedBenefit = TakenAdvertisedBenefit / DotTicks; } + // Distribute Damage over multiple effects, reduce by AoE - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - CastingTime = pCaster->GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) - { - if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && - spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)) - { - CastingTime /= 2; - break; - } - } - TakenTotal+= int32(TakenAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty); + // Not apply this to creature casted spells + float coeff; + if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) + coeff = 1.0f; + else + coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + TakenTotal+= int32(TakenAdvertisedBenefit * coeff * DotFactor * LvlPenalty); } float tmpDamage = (int32(pdamage) + TakenTotal * int32(stack)) * TakenTotalMod; @@ -9744,20 +9734,16 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, if(DotTicks) DoneAdvertisedBenefit = DoneAdvertisedBenefit / DotTicks; } + // Distribute Damage over multiple effects, reduce by AoE - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) - { - if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH ) - { - CastingTime /= 2; - break; - } - } - DoneTotal += int32(DoneAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty * SpellModSpellDamage * 1.88f); + // Not apply this to creature casted spells + float coeff; + if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) + coeff = 1.0f; + else + coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + DoneTotal += int32(DoneAdvertisedBenefit * coeff * DotFactor * LvlPenalty * SpellModSpellDamage * 1.88f); } // use float as more appropriate for negative values and percent applying @@ -9827,20 +9813,16 @@ uint32 Unit::SpellHealingBonusTaken(Unit *pCaster, SpellEntry const *spellProto, if(DotTicks) TakenAdvertisedBenefit = TakenAdvertisedBenefit / DotTicks; } + // Distribute Damage over multiple effects, reduce by AoE - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - CastingTime = pCaster->GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) - { - if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH ) - { - CastingTime /= 2; - break; - } - } - TakenTotal += int32(TakenAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty * 1.88f); + // Not apply this to creature casted spells + float coeff; + if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) + coeff = 1.0f; + else + coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + TakenTotal += int32(TakenAdvertisedBenefit * coeff * DotFactor * LvlPenalty * 1.88f); } AuraList const& mHealingGet= GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); @@ -10249,10 +10231,16 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType if(DotTicks) DoneFlat = DoneFlat / DotTicks; } + // Distribute Damage over multiple effects, reduce by AoE - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - DoneFlat *= (CastingTime / 3500.0f) * DotFactor * LvlPenalty; + // Not apply this to creature casted spells + float coeff; + if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) + coeff = 1.0f; + else + coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + DoneFlat *= coeff * DotFactor * LvlPenalty; } } // weapon damage based spells @@ -10403,10 +10391,16 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp if(DotTicks) TakenFlat = TakenFlat / DotTicks; } + // Distribute Damage over multiple effects, reduce by AoE - uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - CastingTime = pCaster->GetCastingTimeForBonus( spellProto, damagetype, CastingTime ); - TakenFlat*= (CastingTime / 3500.0f) * DotFactor * LvlPenalty; + // Not apply this to creature casted spells + float coeff; + if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) + coeff = 1.0f; + else + coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + TakenFlat*= coeff * DotFactor * LvlPenalty; } } @@ -13253,96 +13247,6 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply ) ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED,-val,apply); } -uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime ) -{ - // Not apply this to creature casted spells with casttime==0 - if(CastingTime==0 && GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) - return 3500; - - if (CastingTime > 7000) CastingTime = 7000; - if (CastingTime < 1500) CastingTime = 1500; - - if(damagetype == DOT && !IsChanneledSpell(spellProto)) - CastingTime = 3500; - - int32 overTime = 0; - uint8 effects = 0; - bool DirectDamage = false; - bool AreaEffect = false; - - for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) - { - switch (spellProto->Effect[i]) - { - case SPELL_EFFECT_SCHOOL_DAMAGE: - case SPELL_EFFECT_POWER_DRAIN: - case SPELL_EFFECT_HEALTH_LEECH: - case SPELL_EFFECT_ENVIRONMENTAL_DAMAGE: - case SPELL_EFFECT_POWER_BURN: - case SPELL_EFFECT_HEAL: - DirectDamage = true; - break; - case SPELL_EFFECT_APPLY_AURA: - switch (spellProto->EffectApplyAuraName[i]) - { - case SPELL_AURA_PERIODIC_DAMAGE: - case SPELL_AURA_PERIODIC_HEAL: - case SPELL_AURA_PERIODIC_LEECH: - if ( GetSpellDuration(spellProto) ) - overTime = GetSpellDuration(spellProto); - break; - default: - // -5% per additional effect - ++effects; - break; - } - default: - break; - } - - if (IsAreaEffectTarget(Targets(spellProto->EffectImplicitTargetA[i])) || IsAreaEffectTarget(Targets(spellProto->EffectImplicitTargetB[i]))) - AreaEffect = true; - } - - // Combined Spells with Both Over Time and Direct Damage - if (overTime > 0 && CastingTime > 0 && DirectDamage) - { - // mainly for DoTs which are 3500 here otherwise - uint32 OriginalCastTime = GetSpellCastTime(spellProto); - if (OriginalCastTime > 7000) OriginalCastTime = 7000; - if (OriginalCastTime < 1500) OriginalCastTime = 1500; - // Portion to Over Time - float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f)); - - if (damagetype == DOT) - CastingTime = uint32(CastingTime * PtOT); - else if (PtOT < 1.0f) - CastingTime = uint32(CastingTime * (1 - PtOT)); - else - CastingTime = 0; - } - - // Area Effect Spells receive only half of bonus - if (AreaEffect) - CastingTime /= 2; - - // -5% of total per any additional effect - for (uint8 i = 0; i < effects; ++i) - { - if (CastingTime > 175) - { - CastingTime -= 175; - } - else - { - CastingTime = 0; - break; - } - } - - return CastingTime; -} - void Unit::UpdateAuraForGroup(uint8 slot) { if(GetTypeId() == TYPEID_PLAYER) diff --git a/src/game/Unit.h b/src/game/Unit.h index bd0593b63..bf255d84d 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1748,8 +1748,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SetContestedPvP(Player *attackedPlayer = NULL); - uint32 GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime ); - void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply); virtual bool IsImmunedToSpell(SpellEntry const* spellInfo); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 871efb5a6..b2b2e4d51 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9893" + #define REVISION_NR "9894" #endif // __REVISION_NR_H__ From e880e7d2368993f87b1bca1156cb476cc3cb39cc Mon Sep 17 00:00:00 2001 From: nos4r2zod Date: Sat, 15 May 2010 06:03:16 +0400 Subject: [PATCH 023/172] [9895] Move DotFactor+GetSpellCastTimeForBonus call to CalculateDefaultCoefficient * This coeff used if not spell_bonus_data provided for spell * Continue prev. commit line expected that creature casts not affected by DotFactor Signed-off-by: VladimirMangos --- src/game/SpellMgr.cpp | 19 +++++++++ src/game/SpellMgr.h | 1 + src/game/Unit.cpp | 90 ++++++---------------------------------- src/shared/revision_nr.h | 2 +- 4 files changed, 33 insertions(+), 79 deletions(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 815284c7f..aa575da8d 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -222,6 +222,25 @@ uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo) return 6; } +float CalculateDefaultCoefficient(SpellEntry const *spellProto, DamageEffectType const damagetype) +{ + // Damage over Time spells bonus calculation + float DotFactor = 1.0f; + if (damagetype == DOT) + { + if (!IsChanneledSpell(spellProto)) + DotFactor = GetSpellDuration(spellProto) / 15000.0f; + + if (uint16 DotTicks = GetSpellAuraMaxTicks(spellProto)) + DotFactor /= DotTicks; + } + + // Distribute Damage over multiple effects, reduce by AoE + float coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + + return coeff * DotFactor; +} + WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo) { if(!spellInfo) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index b709b7ca5..29b74ec88 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -111,6 +111,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId); inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); } uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL); uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype ); +float CalculateDefaultCoefficient(SpellEntry const *spellProto, DamageEffectType const damagetype); inline float GetSpellMinRange(SpellRangeEntry const *range, bool friendly = false) { if(!range) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index ae2dd8d60..b819b6d92 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9177,26 +9177,15 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u // Default calculation else if (DoneAdvertisedBenefit) { - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - if (!IsChanneledSpell(spellProto)) - DotFactor = GetSpellDuration(spellProto) / 15000.0f; - - if (uint16 DotTicks = GetSpellAuraMaxTicks(spellProto)) - DoneAdvertisedBenefit = DoneAdvertisedBenefit / DotTicks; - } - // Distribute Damage over multiple effects, reduce by AoE // Not apply this to creature casted spells float coeff; if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; else - coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneTotal += int32(DoneAdvertisedBenefit * coeff * DotFactor * LvlPenalty * SpellModSpellDamage); + DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage); } float tmpDamage = (int32(pdamage) + DoneTotal * int32(stack)) * DoneTotalMod; @@ -9279,26 +9268,15 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto, // Default calculation else if (TakenAdvertisedBenefit) { - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if (damagetype == DOT) - { - if (!IsChanneledSpell(spellProto)) - DotFactor = GetSpellDuration(spellProto) / 15000.0f; - - if (uint16 DotTicks = GetSpellAuraMaxTicks(spellProto)) - TakenAdvertisedBenefit = TakenAdvertisedBenefit / DotTicks; - } - // Distribute Damage over multiple effects, reduce by AoE // Not apply this to creature casted spells float coeff; if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) coeff = 1.0f; else - coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - TakenTotal+= int32(TakenAdvertisedBenefit * coeff * DotFactor * LvlPenalty); + TakenTotal+= int32(TakenAdvertisedBenefit * coeff * LvlPenalty); } float tmpDamage = (int32(pdamage) + TakenTotal * int32(stack)) * TakenTotalMod; @@ -9724,26 +9702,15 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, // Default calculation else if (DoneAdvertisedBenefit) { - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) - { - if(!IsChanneledSpell(spellProto)) - DotFactor = GetSpellDuration(spellProto) / 15000.0f; - uint16 DotTicks = GetSpellAuraMaxTicks(spellProto); - if(DotTicks) - DoneAdvertisedBenefit = DoneAdvertisedBenefit / DotTicks; - } - // Distribute Damage over multiple effects, reduce by AoE // Not apply this to creature casted spells float coeff; if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; else - coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneTotal += int32(DoneAdvertisedBenefit * coeff * DotFactor * LvlPenalty * SpellModSpellDamage * 1.88f); + DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage * 1.88f); } // use float as more appropriate for negative values and percent applying @@ -9803,26 +9770,15 @@ uint32 Unit::SpellHealingBonusTaken(Unit *pCaster, SpellEntry const *spellProto, // Default calculation else if (TakenAdvertisedBenefit) { - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) - { - if(!IsChanneledSpell(spellProto)) - DotFactor = GetSpellDuration(spellProto) / 15000.0f; - uint16 DotTicks = GetSpellAuraMaxTicks(spellProto); - if(DotTicks) - TakenAdvertisedBenefit = TakenAdvertisedBenefit / DotTicks; - } - // Distribute Damage over multiple effects, reduce by AoE // Not apply this to creature casted spells float coeff; if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; else - coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - TakenTotal += int32(TakenAdvertisedBenefit * coeff * DotFactor * LvlPenalty * 1.88f); + TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty * 1.88f); } AuraList const& mHealingGet= GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); @@ -10221,26 +10177,15 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType // Default calculation else if (DoneFlat) { - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) - { - if(!IsChanneledSpell(spellProto)) - DotFactor = GetSpellDuration(spellProto) / 15000.0f; - uint16 DotTicks = GetSpellAuraMaxTicks(spellProto); - if(DotTicks) - DoneFlat = DoneFlat / DotTicks; - } - // Distribute Damage over multiple effects, reduce by AoE // Not apply this to creature casted spells float coeff; if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; else - coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneFlat *= coeff * DotFactor * LvlPenalty; + DoneFlat *= coeff * LvlPenalty; } } // weapon damage based spells @@ -10381,26 +10326,15 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp // Default calculation else if (TakenFlat) { - // Damage over Time spells bonus calculation - float DotFactor = 1.0f; - if(damagetype == DOT) - { - if(!IsChanneledSpell(spellProto)) - DotFactor = GetSpellDuration(spellProto) / 15000.0f; - uint16 DotTicks = GetSpellAuraMaxTicks(spellProto); - if(DotTicks) - TakenFlat = TakenFlat / DotTicks; - } - // Distribute Damage over multiple effects, reduce by AoE // Not apply this to creature casted spells float coeff; if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) coeff = 1.0f; else - coeff = GetSpellCastTimeForBonus(spellProto, damagetype) / 3500.0f; + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - TakenFlat*= coeff * DotFactor * LvlPenalty; + TakenFlat*= coeff * LvlPenalty; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b2b2e4d51..79de91c3e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9894" + #define REVISION_NR "9895" #endif // __REVISION_NR_H__ From b2b8ca1d70bebc4980d9caafa9c91407daa58f7c Mon Sep 17 00:00:00 2001 From: nos4r2zod Date: Sat, 15 May 2010 07:44:37 +0400 Subject: [PATCH 024/172] [9896] Cleanup spell bonus coeff use code * Avoid coeff calculation if target value is 0.0f * Avoid use spell_bonus_data coeffs for creature damage. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 198 ++++++++++++++++----------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 81 insertions(+), 119 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b819b6d92..6c20371a1 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9153,39 +9153,35 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage(); - float LvlPenalty = CalculateLevelPenalty(spellProto); - // Spellmod SpellDamage - float SpellModSpellDamage = 100.0f; - if(Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE,SpellModSpellDamage); - SpellModSpellDamage /= 100.0f; - - // Check for table values - if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + if (DoneAdvertisedBenefit) { - float coeff; - if (damagetype == DOT) - coeff = bonus->dot_damage * LvlPenalty; - else - coeff = bonus->direct_damage * LvlPenalty; + float LvlPenalty = CalculateLevelPenalty(spellProto); - if (bonus->ap_bonus) - DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK)); + // Spellmod SpellDamage + float SpellModSpellDamage = 100.0f; + if(Player* modOwner = GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE,SpellModSpellDamage); + SpellModSpellDamage /= 100.0f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * SpellModSpellDamage); - } - // Default calculation - else if (DoneAdvertisedBenefit) - { // Distribute Damage over multiple effects, reduce by AoE - // Not apply this to creature casted spells float coeff; + + // Not apply this to creature casted spells if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; + // Check for table values + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + { + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; + + if (bonus->ap_bonus) + DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK)); + } + // Default calculation else coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage); + DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage); } float tmpDamage = (int32(pdamage) + DoneTotal * int32(stack)) * DoneTotalMod; @@ -9252,31 +9248,24 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto, // Taken fixed damage bonus auras int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(GetSpellSchoolMask(spellProto)); - float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - - // Check for table values - if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + if (TakenAdvertisedBenefit) { - float coeff; - if (damagetype == DOT) - coeff = bonus->dot_damage * LvlPenalty; - else - coeff = bonus->direct_damage * LvlPenalty; + float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - TakenTotal += int32(TakenAdvertisedBenefit * coeff); - } - // Default calculation - else if (TakenAdvertisedBenefit) - { // Distribute Damage over multiple effects, reduce by AoE - // Not apply this to creature casted spells float coeff; + + // Not apply this to creature casted spells if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) coeff = 1.0f; - else + // Check for table values + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; + // Default calculation + else coeff = CalculateDefaultCoefficient(spellProto, damagetype); - TakenTotal+= int32(TakenAdvertisedBenefit * coeff * LvlPenalty); + TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty); } float tmpDamage = (int32(pdamage) + TakenTotal * int32(stack)) * TakenTotalMod; @@ -9677,40 +9666,35 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, // Done fixed damage bonus auras int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(GetSpellSchoolMask(spellProto)); - float LvlPenalty = CalculateLevelPenalty(spellProto); - // Spellmod SpellDamage - float SpellModSpellDamage = 100.0f; - if(Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, SpellModSpellDamage); - SpellModSpellDamage /= 100.0f; - - // Check for table values - SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id); - if (bonus) + if (DoneAdvertisedBenefit) { - float coeff; - if (damagetype == DOT) - coeff = bonus->dot_damage * LvlPenalty; - else - coeff = bonus->direct_damage * LvlPenalty; + float LvlPenalty = CalculateLevelPenalty(spellProto); - if (bonus->ap_bonus) - DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK)); + // Spellmod SpellDamage + float SpellModSpellDamage = 100.0f; + if(Player* modOwner = GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, SpellModSpellDamage); + SpellModSpellDamage /= 100.0f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * SpellModSpellDamage); - } - // Default calculation - else if (DoneAdvertisedBenefit) - { // Distribute Damage over multiple effects, reduce by AoE - // Not apply this to creature casted spells float coeff; + + // Not apply this to creature casted spells if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype); + // Check for table values + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + { + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage * 1.88f); + if (bonus->ap_bonus) + DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK)); + } + // Default calculation + else + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * 1.88f; + + DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage); } // use float as more appropriate for negative values and percent applying @@ -9753,32 +9737,24 @@ uint32 Unit::SpellHealingBonusTaken(Unit *pCaster, SpellEntry const *spellProto, // Taken fixed damage bonus auras int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(GetSpellSchoolMask(spellProto)); - float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - - // Check for table values - SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id); - if (bonus) + if (TakenAdvertisedBenefit) { - float coeff; - if (damagetype == DOT) - coeff = bonus->dot_damage * LvlPenalty; - else - coeff = bonus->direct_damage * LvlPenalty; + float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - TakenTotal += int32(TakenAdvertisedBenefit * coeff); - } - // Default calculation - else if (TakenAdvertisedBenefit) - { // Distribute Damage over multiple effects, reduce by AoE - // Not apply this to creature casted spells float coeff; + + // Not apply this to creature casted spells if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) coeff = 1.0f; + // Check for table values + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; + // Default calculation else - coeff = CalculateDefaultCoefficient(spellProto, damagetype); + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * 1.88f; - TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty * 1.88f); + TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty); } AuraList const& mHealingGet= GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); @@ -10160,33 +10136,25 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType { float LvlPenalty = CalculateLevelPenalty(spellProto); + // Distribute Damage over multiple effects, reduce by AoE + float coeff = 0.0f; + + // Not apply this to creature casted spells + if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) + coeff = 1.0f; // Check for table values - if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) { - float coeff; - if (damagetype == DOT) - coeff = bonus->dot_damage * LvlPenalty; - else - coeff = bonus->direct_damage * LvlPenalty; + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; if (bonus->ap_bonus) DoneFlat += bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + APbonus); - - DoneFlat *= coeff; } // Default calculation else if (DoneFlat) - { - // Distribute Damage over multiple effects, reduce by AoE - // Not apply this to creature casted spells - float coeff; - if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) - coeff = 1.0f; - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype); + coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneFlat *= coeff * LvlPenalty; - } + DoneFlat *= coeff * LvlPenalty; } // weapon damage based spells else if( APbonus || DoneFlat ) @@ -10310,31 +10278,25 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp // scaling of non weapon based spells if (!isWeaponDamageBasedSpell) { - float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - // Check for table values - if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + if (TakenFlat) { - float coeff; - if (damagetype == DOT) - coeff = bonus->dot_damage * LvlPenalty; - else - coeff = bonus->direct_damage * LvlPenalty; + float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - TakenFlat *= coeff; - } - // Default calculation - else if (TakenFlat) - { // Distribute Damage over multiple effects, reduce by AoE - // Not apply this to creature casted spells float coeff; + + // Not apply this to creature casted spells if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) coeff = 1.0f; - else + // Check for table values + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; + // Default calculation + else if (TakenFlat) coeff = CalculateDefaultCoefficient(spellProto, damagetype); - TakenFlat*= coeff * LvlPenalty; + TakenFlat *= coeff * LvlPenalty; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 79de91c3e..ce95591bc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9895" + #define REVISION_NR "9896" #endif // __REVISION_NR_H__ From 6e92d43237b01b9a0ca7d216391219f3205d8bf3 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 15 May 2010 11:07:56 +0400 Subject: [PATCH 025/172] [9897] Avoid multiply AP bonus coeff. with spell power bonus. Problem exist in original code before recent commits. --- src/game/Unit.cpp | 14 +++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6c20371a1..4bd7a60a5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10131,6 +10131,8 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType // final calculation // ================= + float DoneTotal = 0.0f; + // scaling of non weapon based spells if (!isWeaponDamageBasedSpell) { @@ -10148,19 +10150,19 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; if (bonus->ap_bonus) - DoneFlat += bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + APbonus); + DoneTotal += bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + APbonus); } // Default calculation else if (DoneFlat) coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneFlat *= coeff * LvlPenalty; + DoneTotal += DoneFlat * coeff * LvlPenalty; } // weapon damage based spells else if( APbonus || DoneFlat ) { bool normalized = spellProto ? IsSpellHaveEffect(spellProto, SPELL_EFFECT_NORMALIZED_WEAPON_DMG) : false; - DoneFlat += int32(APbonus / 14.0f * GetAPMultiplier(attType,normalized)); + DoneTotal += int32(APbonus / 14.0f * GetAPMultiplier(attType,normalized)); // for weapon damage based spells we still have to apply damage done percent mods // (that are already included into pdamage) to not-yet included DoneFlat @@ -10174,10 +10176,12 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType case RANGED_ATTACK: unitMod = UNIT_MOD_DAMAGE_RANGED; break; } - DoneFlat *= GetModifierValue(unitMod, TOTAL_PCT); + DoneTotal += DoneFlat; + + DoneTotal *= GetModifierValue(unitMod, TOTAL_PCT); } - float tmpDamage = float(int32(pdamage) + DoneFlat * int32(stack)) * DonePercent; + float tmpDamage = float(int32(pdamage) + DoneTotal * int32(stack)) * DonePercent; // apply spellmod to Done damage if(spellProto) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ce95591bc..416cf6b67 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9896" + #define REVISION_NR "9897" #endif // __REVISION_NR_H__ From 1f741a16b38fc69563ef636d795ccaf1818f881c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 15 May 2010 11:21:24 +0400 Subject: [PATCH 026/172] [9898] Implement redundent values check in `spell_bonus_data` Also do table content cleanup base at added feature. Original check code provided by nos4r2zod. --- sql/mangos.sql | 31 +------ .../9999_01_mangos_spell_bonus_data.sql | 9 ++ src/game/SpellMgr.cpp | 91 +++++++++++++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 sql/updates/9999_01_mangos_spell_bonus_data.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index c561da1d2..71ac26679 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -14225,36 +14225,26 @@ INSERT INTO `spell_bonus_data` VALUES (8921, 0.1515, 0.13, 0, 'Druid - Moonfire'), (50464, 0.6611, 0, 0, 'Druid - Nourish'), (8936, 0.539, 0.188, 0, 'Druid - Regrowth'), -(774, 0, 0.37604, 0, 'Druid - Rejuvenation'), (50288, 0.05, 0, 0, 'Druid - Starfall'), (50294, 0.012, 0, 0, 'Druid - Starfall AOE'), -(2912, 1, 0, 0, 'Druid - Starfire'), (18562, 0, 0, 0, 'Druid - Swiftmend'), (44203, 0.538, 0, 0, 'Druid - Tranquility Triggered'), -(61391, 0.193, 0, 0, 'Druid - Typhoon'), (48438, 0, 0.11505, 0, 'Druid - Wild Growth'), (5176, 0.5714, 0, 0, 'Druid - Wrath'), /* Generic */ (54757, 0, 0, 0, 'Generic - Pyro Rocket'), /* Mage */ (44425, 0.714286,0, 0, 'Mage - Arcane Barrage'), -(30451, 0.7143, 0, 0, 'Mage - Arcane Blast'), -(1449, 0.2128, 0, 0, 'Mage - Arcane Explosion'), (7268, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell'), (42208, 0.1437, 0, 0, 'Mage - Blizzard Triggered'), -(2136, 0.4286, 0, 0, 'Mage - Fire Blast'), (133, 1, 0, 0, 'Mage - Fire Ball'), (2120, 0.2357, 0.122, 0, 'Mage - Flamestrike'), -(122, 0.193, 0, 0, 'Mage - Frost Nova'), (116, 0.8143, 0, 0, 'Mage - Frost Bolt'), (44614, 0.8571, 0, 0, 'Mage - Frostfire Bolt'), -(11426, 0.8053, 0, 0, 'Mage - Ice Barrier'), (30455, 0.1429, 0, 0, 'Mage - Ice Lance'), -(44457, 0.4, 0.2, 0, 'Mage - Living Bomb'), (1463, 0.8053, 0, 0, 'Mage - Mana Shield'), (34913, 0, 0, 0, 'Mage - Molten Armor Triggered'), (11366, 1.15, 0.05, 0, 'Mage - Pyroblast'), -(2948, 0.4286, 0, 0, 'Mage - Scorch'), /* Paladin */ (26573, 0, 0.04, 0.04, 'Paladin - Consecration'), (879, 0.15, 0, 0.15, 'Paladin - Exorcism'), @@ -14262,7 +14252,6 @@ INSERT INTO `spell_bonus_data` VALUES (19750, 1, 0, 0, 'Paladin - Flash of Light'), (53595, 0, 0, 0, 'Paladin - Hammer of the Righteous'), (635, 1.66, 0, 0, 'Paladin - Holy Light'), -(25912, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt'), (20925, 0.09, 0, 0.056, 'Paladin - Holy Shield'), (2812, 0.07, 0, 0.07, 'Paladin - Holy Wrath'), (54158, 0.25, 0, 0, 'Paladin - Judgement'), @@ -14271,34 +14260,24 @@ INSERT INTO `spell_bonus_data` VALUES (20267, 0.1, 0, 0.1, 'Paladin - Judgement of Light Proc'), (31804, 0, 0, 0, 'Paladin - Judgement of Vengeance'), (20424, 0, 0, 0, 'Paladin - Seal of Command Proc'), -(53739, 0, 0.00156, 0.003, 'Paladin - Seal of Corruption (full stack proc)'), +(53739, 0, 0, 0.003, 'Paladin - Seal of Corruption (full stack proc)'), (25742, 0.07, 0, 0.039, 'Paladin - Seal of Righteousness Dummy Proc'), -(42463, 0, 0.00156, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'), +(42463, 0, 0, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'), (53600, 0, 0, 0, 'Paladin - Shield of Righteousness'), /* Priest */ -(32546, 0.8068, 0, 0, 'Priest - Binding Heal'), (27813, 0, 0, 0, 'Priest - Blessed Recovery'), -(34861, 0.402, 0, 0, 'Priest - Circle of Healing'), -(19236, 0.8068, 0, 0, 'Priest - Desperate Prayer'), (2944, 0, 0.1849, 0, 'Priest - Devouring Plague'), (63544, 0, 0, 0, 'Priest - Empowered Renew Triggered'), (14914, 0.5711, 0.024, 0, 'Priest - Holy Fire'), (15237, 0.1606, 0, 0, 'Priest - Holy Nova Damage'), -(2061, 0.8068, 0, 0, 'Priest - Flash Heal'), -(2060, 1.6135, 0, 0, 'Priest - Greater Heal'), (23455, 0.3035, 0, 0, 'Priest - Holy Nova Heal'), (63675, 0, 0, 0, 'Priest - Improved Devouring Plague Triggered'), (8129, 0, 0, 0, 'Priest - Mana Burn'), (58381, 0.257143,0, 0, 'Priest - Mind Flay Triggered'), -(49821, 0.14286,0, 0, 'Priest - Mind Sear Trigger'), +(49821, 0.2857, 0, 0, 'Priest - Mind Sear Trigger'), (47666, 0.229, 0, 0, 'Priest - Penance dmg effect'), (47750, 0.537, 0, 0, 'Priest - Penance heal effect'), -(17, 0.8068, 0, 0, 'Priest - Power Word: Shield'), -(33110, 0.8068, 0, 0, 'Priest - Prayer of Mending Heal Proc'), (33619, 0, 0, 0, 'Priest - Reflective Shield'), -(139, 0, 0.376, 0, 'Priest - Renew'), -(32379, 0.4296, 0, 0, 'Priest - Shadow Word: Death'), -(589, 0, 0.1829, 0, 'Priest - Shadow Word: Pain'), (34433, 0.65, 0, 0, 'Priest - Shadowfiend'), (585, 0.714, 0, 0, 'Priest - Smite'), (34914, 0, 0.4, 0, 'Priest - Vampiric Touch'), @@ -14306,8 +14285,6 @@ INSERT INTO `spell_bonus_data` VALUES /* Shaman */ (974, 0.4762, 0, 0, 'Shaman - Earth Shield'), (379, 0, 0, 0, 'Shaman - Earth Shield Triggered'), -(1064, 1.34, 0, 0, 'Shaman - Chain Heal'), -(421, 0.57, 0, 0, 'Shaman - Chain Lightning'), (8042, 0.3858, 0, 0, 'Shaman - Earth Shock'), (8050, 0.2142, 0.1, 0, 'Shaman - Flame Shock'), (8026, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc'), @@ -14315,8 +14292,6 @@ INSERT INTO `spell_bonus_data` VALUES (8034, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 1'), (52042, 0.045, 0, 0, 'Shaman - Healing Stream Totem Triggered Heal'), (331, 1.6106, 0, 0, 'Shaman - Healing Wave'), -(51505, 0.5714, 0, 0, 'Shaman - Lava Burst'), -(8004, 0.8082, 0, 0, 'Shaman - Lesser Healing Wave'), (403, 0.7143, 0, 0, 'Shaman - Lightning Bolt'), (26364, 0.33, 0, 0, 'Shaman - Lightning Shield Proc'), (8188, 0.1, 0, 0, 'Shaman - Magma Totam Passive'), diff --git a/sql/updates/9999_01_mangos_spell_bonus_data.sql b/sql/updates/9999_01_mangos_spell_bonus_data.sql new file mode 100644 index 000000000..f5dfb4349 --- /dev/null +++ b/sql/updates/9999_01_mangos_spell_bonus_data.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN ( + 17,122,139,421,589,774,1064,1449,2060,2061,2136,2912,2948,8004, + 11426,19236,25912,30451,32379,32546,33110,34861,42463,44457, + 49821,51505,53739,61391); + +INSERT INTO `spell_bonus_data` VALUES +(53739, 0, 0, 0.003, 'Paladin - Seal of Corruption (full stack proc)'), +(42463, 0, 0, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'); +(49821, 0.2857,0, 0, 'Priest - Mind Sear Trigger'), diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index aa575da8d..9010f8608 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1215,6 +1215,97 @@ void SpellMgr::LoadSpellBonuses() sbe.dot_damage = fields[2].GetFloat(); sbe.ap_bonus = fields[3].GetFloat(); + bool need_dot = false; + bool need_direct = false; + uint32 x = 0; // count all, including empty, meaning: not all existed effect is DoTs/HoTs + for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + { + if (!spell->Effect[i]) + { + ++x; + continue; + } + + // DoTs/HoTs + switch(spell->EffectApplyAuraName[i]) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_OBS_MOD_HEALTH: + case SPELL_AURA_PERIODIC_MANA_LEECH: + case SPELL_AURA_OBS_MOD_MANA: + case SPELL_AURA_POWER_BURN_MANA: + need_dot = true; + ++x; + break; + default: + break; + } + } + + //TODO: maybe add explicit list possible direct damage spell effects... + if (x < MAX_EFFECT_INDEX) + need_direct = true; + + // Check if direct_bonus is needed in `spell_bonus_data` + float direct_calc; + float direct_diff = 1000.0f; // for have big diff if no DB field value + if (sbe.direct_damage) + { + bool isHeal = false; + for(int i = 0; i < 3; ++i) + { + // Heals (Also count Mana Shield and Absorb effects as heals) + if (spell->Effect[i] == SPELL_EFFECT_HEAL || spell->Effect[i] == SPELL_EFFECT_HEAL_MAX_HEALTH || + (spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spell->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)) ) + { + isHeal = true; + break; + } + } + direct_calc = CalculateDefaultCoefficient(spell, SPELL_DIRECT_DAMAGE) * (isHeal ? 1.88f : 1.0f); + direct_diff = std::abs(sbe.direct_damage - direct_calc); + } + + // Check if dot_bonus is needed in `spell_bonus_data` + float dot_calc; + float dot_diff = 1000.0f; // for have big diff if no DB field value + if (sbe.dot_damage) + { + bool isHeal = false; + for(int i = 0; i < 3; ++i) + { + // Periodic Heals + if (spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL) + { + isHeal = true; + break; + } + } + dot_calc = CalculateDefaultCoefficient(spell, DOT) * (isHeal ? 1.88f : 1.0f); + dot_diff = std::abs(sbe.dot_damage - dot_calc); + } + + if (direct_diff < 0.02f && !need_dot && !sbe.ap_bonus) + sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not needed (data from table: %f, calculated %f, difference of %f) and `dot_bonus` also not used", + entry, sbe.direct_damage, direct_calc, direct_diff); + else if (direct_diff < 0.02f && dot_diff < 0.02f && !sbe.ap_bonus) + { + sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not needed (data from table: %f, calculated %f, difference of %f) and ", + entry, sbe.direct_damage, direct_calc, direct_diff); + sLog.outErrorDb(" ... `dot_bonus` not needed (data from table: %f, calculated %f, difference of %f)", + sbe.dot_damage, dot_calc, dot_diff); + } + else if (!need_direct && dot_diff < 0.02f && !sbe.ap_bonus) + sLog.outErrorDb("`spell_bonus_data` entry for spell %u `dot_bonus` not needed (data from table: %f, calculated %f, difference of %f) and direct also not used", + entry, sbe.dot_damage, dot_calc, dot_diff); + else if (!need_direct && sbe.direct_damage) + sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not used (spell not have non-periodic affects)", entry); + else if (!need_dot && sbe.dot_damage) + sLog.outErrorDb("`spell_bonus_data` entry for spell %u `dot_bonus` not used (spell not have periodic affects)", entry); + mSpellBonusMap[entry] = sbe; // also add to high ranks diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 416cf6b67..78f78f726 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9897" + #define REVISION_NR "9898" #endif // __REVISION_NR_H__ From 3424dbf1fa13e543a36d3aba7cda72bdd00ad44c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 15 May 2010 11:36:55 +0400 Subject: [PATCH 027/172] [9899] Fixed sql update for ptrev. commit. --- sql/mangos.sql | 2 +- ...spell_bonus_data.sql => 9899_01_mangos_spell_bonus_data.sql} | 2 ++ sql/updates/Makefile.am | 2 ++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) rename sql/updates/{9999_01_mangos_spell_bonus_data.sql => 9899_01_mangos_spell_bonus_data.sql} (77%) diff --git a/sql/mangos.sql b/sql/mangos.sql index 71ac26679..2a17bb4b5 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9891_02_mangos_creature_movement_scripts` bit(1) default NULL + `required_9899_01_mangos_spell_bonus_data` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/updates/9999_01_mangos_spell_bonus_data.sql b/sql/updates/9899_01_mangos_spell_bonus_data.sql similarity index 77% rename from sql/updates/9999_01_mangos_spell_bonus_data.sql rename to sql/updates/9899_01_mangos_spell_bonus_data.sql index f5dfb4349..901933fa5 100644 --- a/sql/updates/9999_01_mangos_spell_bonus_data.sql +++ b/sql/updates/9899_01_mangos_spell_bonus_data.sql @@ -1,3 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_9891_02_mangos_creature_movement_scripts required_9899_01_mangos_spell_bonus_data bit; + DELETE FROM `spell_bonus_data` WHERE `entry` IN ( 17,122,139,421,589,774,1064,1449,2060,2061,2136,2912,2948,8004, 11426,19236,25912,30451,32379,32546,33110,34861,42463,44457, diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 431455d86..c852a0176 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -64,6 +64,7 @@ pkgdata_DATA = \ 9886_02_mangos_command.sql \ 9891_01_mangos_creature_movement.sql \ 9891_02_mangos_creature_movement_scripts.sql \ + 9899_01_mangos_spell_bonus_data.sql \ README ## Additional files to include when running 'make dist' @@ -108,4 +109,5 @@ EXTRA_DIST = \ 9886_02_mangos_command.sql \ 9891_01_mangos_creature_movement.sql \ 9891_02_mangos_creature_movement_scripts.sql \ + 9899_01_mangos_spell_bonus_data.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 78f78f726..dcfcb3829 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9898" + #define REVISION_NR "9899" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index ddeb2745b..6199f4502 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9891_02_mangos_creature_movement_scripts" + #define REVISION_DB_MANGOS "required_9899_01_mangos_spell_bonus_data" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 9fb36ed0213f89834534e0603ec7d7ed2d503832 Mon Sep 17 00:00:00 2001 From: darkstalker Date: Sat, 15 May 2010 11:28:00 +0300 Subject: [PATCH 028/172] [9900] Fix SPELL_MOD_SPELL_BONUS_DAMAGE applying Signed-off-by: Laise --- src/game/Unit.cpp | 64 +++++++++++++++++++++++++++++++--------- src/shared/revision_nr.h | 2 +- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 4bd7a60a5..858527566 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9157,12 +9157,6 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u { float LvlPenalty = CalculateLevelPenalty(spellProto); - // Spellmod SpellDamage - float SpellModSpellDamage = 100.0f; - if(Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE,SpellModSpellDamage); - SpellModSpellDamage /= 100.0f; - // Distribute Damage over multiple effects, reduce by AoE float coeff; @@ -9181,7 +9175,15 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u else coeff = CalculateDefaultCoefficient(spellProto, damagetype); - DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage); + // Spellmod SpellDamage + if(Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + + DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty); } float tmpDamage = (int32(pdamage) + DoneTotal * int32(stack)) * DoneTotalMod; @@ -9265,6 +9267,14 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto, else coeff = CalculateDefaultCoefficient(spellProto, damagetype); + // Spellmod SpellDamage + if(Player* modOwner = pCaster->GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty); } @@ -9670,12 +9680,6 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, { float LvlPenalty = CalculateLevelPenalty(spellProto); - // Spellmod SpellDamage - float SpellModSpellDamage = 100.0f; - if(Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, SpellModSpellDamage); - SpellModSpellDamage /= 100.0f; - // Distribute Damage over multiple effects, reduce by AoE float coeff; @@ -9694,7 +9698,15 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, else coeff = CalculateDefaultCoefficient(spellProto, damagetype) * 1.88f; - DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty * SpellModSpellDamage); + // Spellmod SpellDamage + if(Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + + DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty); } // use float as more appropriate for negative values and percent applying @@ -9754,6 +9766,14 @@ uint32 Unit::SpellHealingBonusTaken(Unit *pCaster, SpellEntry const *spellProto, else coeff = CalculateDefaultCoefficient(spellProto, damagetype) * 1.88f; + // Spellmod SpellDamage + if(Player* modOwner = pCaster->GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty); } @@ -10156,6 +10176,14 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType else if (DoneFlat) coeff = CalculateDefaultCoefficient(spellProto, damagetype); + // Spellmod SpellDamage + if(Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + DoneTotal += DoneFlat * coeff * LvlPenalty; } // weapon damage based spells @@ -10300,6 +10328,14 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp else if (TakenFlat) coeff = CalculateDefaultCoefficient(spellProto, damagetype); + // Spellmod SpellDamage + if(Player* modOwner = pCaster->GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + TakenFlat *= coeff * LvlPenalty; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index dcfcb3829..0a4b5f893 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9899" + #define REVISION_NR "9900" #endif // __REVISION_NR_H__ From efba75312d44d69cdfa878c6e93eda96794440b4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 15 May 2010 12:44:06 +0400 Subject: [PATCH 029/172] [9901] Second attempt fix sql update :/ --- sql/updates/9899_01_mangos_spell_bonus_data.sql | 4 ++-- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/updates/9899_01_mangos_spell_bonus_data.sql b/sql/updates/9899_01_mangos_spell_bonus_data.sql index 901933fa5..c481cbc06 100644 --- a/sql/updates/9899_01_mangos_spell_bonus_data.sql +++ b/sql/updates/9899_01_mangos_spell_bonus_data.sql @@ -7,5 +7,5 @@ DELETE FROM `spell_bonus_data` WHERE `entry` IN ( INSERT INTO `spell_bonus_data` VALUES (53739, 0, 0, 0.003, 'Paladin - Seal of Corruption (full stack proc)'), -(42463, 0, 0, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'); -(49821, 0.2857,0, 0, 'Priest - Mind Sear Trigger'), +(42463, 0, 0, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'), +(49821, 0.2857,0, 0, 'Priest - Mind Sear Trigger'); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0a4b5f893..df7e5f8e2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9900" + #define REVISION_NR "9901" #endif // __REVISION_NR_H__ From 5b5552112d1f583e85f7f770ec0b80e0815f2d29 Mon Sep 17 00:00:00 2001 From: KillerFrca Date: Sat, 15 May 2010 16:43:07 +0300 Subject: [PATCH 030/172] [9901] Implement 71342 mount selection --- src/game/SpellAuras.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index fc05262e8..c0aecd87f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2308,6 +2308,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (m_target->GetTypeId() == TYPEID_PLAYER) ((Player*)m_target)->removeSpell(63680); return; + case 71342: // Big Love Rocket + Spell::SelectMountByAreaAndSkill(m_target, 71344, 71345, 71346, 71347, 0); + return; case 72286: // Invincible Spell::SelectMountByAreaAndSkill(m_target, 72281, 72282, 72283, 72284, 0); return; From f492ee6794b7f4393c9231641b36f1c32ae2f5fa Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Sat, 15 May 2010 23:39:16 +0400 Subject: [PATCH 031/172] [9903] Fixed build problem at *nix. Signed-off-by: VladimirMangos --- src/game/SharedDefines.h | 10 ++++++++++ src/game/Unit.h | 10 ---------- src/shared/revision_nr.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 749ec2c7e..db9d17228 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1148,6 +1148,16 @@ enum SpellPreventionType SPELL_PREVENTION_TYPE_PACIFY = 2 }; +enum DamageEffectType +{ + DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells) + SPELL_DIRECT_DAMAGE = 1, // spell/class abilities damage + DOT = 2, + HEAL = 3, + NODAMAGE = 4, // used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc + SELF_DAMAGE = 5 +}; + enum GameobjectTypes { GAMEOBJECT_TYPE_DOOR = 0, diff --git a/src/game/Unit.h b/src/game/Unit.h index bf255d84d..b516aae77 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -510,16 +510,6 @@ enum CombatRating #define MAX_COMBAT_RATING 25 -enum DamageEffectType -{ - DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells) - SPELL_DIRECT_DAMAGE = 1, // spell/class abilities damage - DOT = 2, - HEAL = 3, - NODAMAGE = 4, // used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc - SELF_DAMAGE = 5 -}; - /// internal used flags for marking special auras - for example some dummy-auras enum UnitAuraFlags { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index df7e5f8e2..965ce8269 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9901" + #define REVISION_NR "9903" #endif // __REVISION_NR_H__ From aaa33d5385a4ef881e41d25c878d7b1526defc85 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 16 May 2010 02:01:01 +0400 Subject: [PATCH 032/172] [9904] Add new config option for wait mode at startup error. Note: it not applied to crashes and shutdowns after mangosd/relamd startup completed. You can continue without delay (as now) and fast exist, or wait , or some secs for continue. Last can be helpful for see for example not applied sql update revision data and etc. --- src/game/Player.cpp | 2 +- src/game/World.cpp | 8 ++------ src/mangosd/Main.cpp | 3 +++ src/mangosd/Master.cpp | 5 +++++ src/mangosd/mangosd.conf.dist.in | 7 +++++++ src/realmd/Main.cpp | 14 +++++++++++--- src/realmd/realmd.conf.dist.in | 7 +++++++ src/shared/Log.cpp | 28 ++++++++++++++++++++++++++++ src/shared/Log.h | 2 ++ src/shared/revision_nr.h | 2 +- 10 files changed, 67 insertions(+), 11 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d4c8a5d3a..5fce4ab06 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -4269,7 +4269,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) QueryResult *resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '" UI64FMTD "'", uint64(time(NULL) - time_t(keepDays * DAY))); if (resultChars) { - sLog.outString("Player::DeleteOldChars: Found %u character(s) to delete",resultChars->GetRowCount()); + sLog.outString("Player::DeleteOldChars: Found %u character(s) to delete",uint32(resultChars->GetRowCount())); do { Field *charFields = resultChars->Fetch(); diff --git a/src/game/World.cpp b/src/game/World.cpp index f8a076492..40e73595c 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -419,9 +419,7 @@ void World::LoadConfigSettings(bool reload) sLog.outError(" WARNING: mangosd.conf does not include a ConfVersion variable."); sLog.outError(" Your configuration file may be out of date!"); sLog.outError("*****************************************************************************"); - clock_t pause = 3000 + clock(); - while (pause > clock()) - ; // empty body + Log::WaitBeforeContinueIfNeed(); } else { @@ -432,9 +430,7 @@ void World::LoadConfigSettings(bool reload) sLog.outError(" Please check for updates, as your current default values may cause"); sLog.outError(" unexpected behavior."); sLog.outError("*****************************************************************************"); - clock_t pause = 3000 + clock(); - while (pause > clock()) - ; // empty body + Log::WaitBeforeContinueIfNeed(); } } diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index b3ac953e6..af5daf420 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -108,6 +108,7 @@ extern int main(int argc, char **argv) { sLog.outError("Runtime-Error: -s option requires an input argument"); usage(argv[0]); + Log::WaitBeforeContinueIfNeed(); return 1; } if( strcmp(argv[c],"install") == 0) @@ -126,6 +127,7 @@ extern int main(int argc, char **argv) { sLog.outError("Runtime-Error: unsupported option %s",argv[c]); usage(argv[0]); + Log::WaitBeforeContinueIfNeed(); return 1; } } @@ -141,6 +143,7 @@ extern int main(int argc, char **argv) if (!sConfig.SetSource(cfg_file)) { sLog.outError("Could not find configuration file %s.", cfg_file); + Log::WaitBeforeContinueIfNeed(); return 1; } diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 99f5836e7..9478a8d9d 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -194,6 +194,7 @@ int Master::Run() if( !pid ) { sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() ); + Log::WaitBeforeContinueIfNeed(); return 1; } @@ -202,7 +203,10 @@ int Master::Run() ///- Start the databases if (!_StartDB()) + { + Log::WaitBeforeContinueIfNeed(); return 1; + } ///- Initialize the World sWorld.SetInitialWorldSettings(); @@ -315,6 +319,7 @@ int Master::Run() if (sWorldSocketMgr->StartNetwork (wsport, bind_ip) == -1) { sLog.outError ("Failed to start network"); + Log::WaitBeforeContinueIfNeed(); World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index fbf9a2176..b0e66de69 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -669,6 +669,12 @@ LogColors = "" # Default: 1 (true) # 0 (false) # +# WaitAtStartupError +# After startup error report wait or some time before continue (and possible close console window) +# -1 (wait until press) +# Default: 0 (not wait) +# N (>0, wait N secs) +# # Motd # Message of the Day. Displayed at worldlogin for every user ('@' for a newline). # @@ -733,6 +739,7 @@ OffhandCheckAtTalentsReset = 0 ClientCacheVersion = 0 Event.Announce = 0 BeepAtStart = 1 +WaitAtStartupError = 0 Motd = "Welcome to the Massive Network Game Object Server." ################################################################################################################### diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 8462d1162..80000bc76 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -87,6 +87,7 @@ extern int main(int argc, char **argv) { sLog.outError("Runtime-Error: -c option requires an input argument"); usage(argv[0]); + Log::WaitBeforeContinueIfNeed(); return 1; } else @@ -109,6 +110,7 @@ extern int main(int argc, char **argv) { sLog.outError("Runtime-Error: -s option requires an input argument"); usage(argv[0]); + Log::WaitBeforeContinueIfNeed(); return 1; } if( strcmp(argv[c],"install") == 0) @@ -127,6 +129,7 @@ extern int main(int argc, char **argv) { sLog.outError("Runtime-Error: unsupported option %s",argv[c]); usage(argv[0]); + Log::WaitBeforeContinueIfNeed(); return 1; } } @@ -142,6 +145,7 @@ extern int main(int argc, char **argv) if (!sConfig.SetSource(cfg_file)) { sLog.outError("Could not find configuration file %s.", cfg_file); + Log::WaitBeforeContinueIfNeed(); return 1; } sLog.Initialize(); @@ -159,9 +163,7 @@ extern int main(int argc, char **argv) sLog.outError(" Please check for updates, as your current default values may cause"); sLog.outError(" strange behavior."); sLog.outError("*****************************************************************************"); - clock_t pause = 3000 + clock(); - - while (pause > clock()) {} + Log::WaitBeforeContinueIfNeed(); } DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); @@ -179,6 +181,7 @@ extern int main(int argc, char **argv) if( !pid ) { sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() ); + Log::WaitBeforeContinueIfNeed(); return 1; } @@ -187,13 +190,17 @@ extern int main(int argc, char **argv) ///- Initialize the database connection if(!StartDB()) + { + Log::WaitBeforeContinueIfNeed(); return 1; + } ///- Get the list of realms for the server sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); if (sRealmList.size() == 0) { sLog.outError("No valid realms specified."); + Log::WaitBeforeContinueIfNeed(); return 1; } @@ -206,6 +213,7 @@ extern int main(int argc, char **argv) if ( authListenSocket.Bind(bind_ip.c_str(),rmport)) { sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport ); + Log::WaitBeforeContinueIfNeed(); return 1; } diff --git a/src/realmd/realmd.conf.dist.in b/src/realmd/realmd.conf.dist.in index 66335b718..20e179217 100644 --- a/src/realmd/realmd.conf.dist.in +++ b/src/realmd/realmd.conf.dist.in @@ -76,6 +76,12 @@ ConfVersion=2007062001 # Default: 1 (HIGH) # 0 (Normal) # +# WaitAtStartupError +# After startup error report wait or some time before continue (and possible close console window) +# -1 (wait until press) +# Default: 0 (not wait) +# N (>0, wait N secs) +# # RealmsStateUpdateDelay # Realm list Update up delay (updated at realm list request if delay expired). # Default: 20 @@ -110,6 +116,7 @@ LogFileLevel = 0 LogColors = "" UseProcessors = 0 ProcessPriority = 1 +WaitAtStartupError = 0 RealmsStateUpdateDelay = 20 WrongPass.MaxCount = 0 WrongPass.BanTime = 600 diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 83d75a563..894574d90 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -22,8 +22,13 @@ #include "Config/ConfigEnv.h" #include "Util.h" #include "ByteBuffer.h" +#include "ProgressBar.h" #include +#include +#include + +#include "ace/OS_NS_unistd.h" INSTANTIATE_SINGLETON_1( Log ); @@ -815,6 +820,29 @@ void Log::outRALog( const char * str, ... ) fflush(stdout); } +void Log::WaitBeforeContinueIfNeed() +{ + int mode = sConfig.GetIntDefault("WaitAtStartupError",0); + + if (mode < 0) + { + printf("\nPress for continue\n"); + + std::string line; + std::getline (std::cin, line); + } + else if (mode > 0) + { + printf("\nWait %u secs for continue.\n",mode); + barGoLink bar(mode); + for(int i = 0; i < mode; ++i) + { + bar.step(); + ACE_OS::sleep(1); + } + } +} + void outstring_log(const char * str, ...) { if (!str) diff --git a/src/shared/Log.h b/src/shared/Log.h index 8cfb9f802..93815753b 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -140,6 +140,8 @@ class Log : public MaNGOS::Singleton= loglvl || (m_logFileLevel >= loglvl && logfile); } bool IsOutCharDump() const { return m_charLog_Dump; } bool IsIncludeTime() const { return m_includeTime; } + + static void WaitBeforeContinueIfNeed(); private: FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode); FILE* openGmlogPerAccount(uint32 account); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 965ce8269..a5af4178b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9903" + #define REVISION_NR "9904" #endif // __REVISION_NR_H__ From c0185636693ec5992cc6e0c4cf55c7b73ed011b4 Mon Sep 17 00:00:00 2001 From: darkstalker Date: Sun, 16 May 2010 00:31:49 +0200 Subject: [PATCH 033/172] [9905] Correct SMSG_INSTANCE_DIFFICULTY structure (fixes raid difficulty display). Signed-off-by: XTZGZoReX --- src/game/Player.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5fce4ab06..5f8aa6417 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19308,7 +19308,7 @@ void Player::SendInitialPacketsBeforeAddToMap() SendTalentsInfoData(false); data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4+4); - data << uint32(0); + data << uint32(GetMap()->GetDifficulty()); data << uint32(0); GetSession()->SendPacket(&data); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a5af4178b..4b9bf75d2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9904" + #define REVISION_NR "9905" #endif // __REVISION_NR_H__ From 2ee1bb5219cfe7c3aceec6c9ee5d78424028106b Mon Sep 17 00:00:00 2001 From: Patman128 Date: Sun, 16 May 2010 03:01:54 +0400 Subject: [PATCH 034/172] [9906] More user friendly output at DB version check fail. Signed-off-by: VladimirMangos --- sql/updates/README | 31 +++++++++++------- src/shared/Database/Database.cpp | 54 ++++++++++++++++++++++++++++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 71 insertions(+), 16 deletions(-) diff --git a/sql/updates/README b/sql/updates/README index 91f2a124b..588219e25 100644 --- a/sql/updates/README +++ b/sql/updates/README @@ -5,17 +5,23 @@ Copyright (c) 2005-2010 MaNGOS See the COPYING file for copying conditions. == Database Updates == + This folder contains SQL files which will apply required updates to your MySQL database, whenever the MaNGOS database structure has been changed or extended. To see if you need an update, the file names have been given a fixed structure that should enable you to see if you need an update or not. -=== File name descriptin === -File names are divided into two parts. First part is the revision+counter -that show commit revision that will be compatible with database after apply update. -Counter set order in sql updates apply for same revision. -The second part of the name of the database and the table that needs and update or has been added. +=== File Name Description === + +File names are divided into two parts. + +First part is the revision and counter that shows the commit revision that +will be compatible with the database after apply that particular update. +Counter sets the order to apply sql updates for the same revision. + +The second part of the name is the database and the table that needs an update or has been added. + See an example below: 6936_01_mangos_spell_chain.sql @@ -27,18 +33,19 @@ See an example below: | | Name of affected DB (default recommended name) | | Can be: characters, mangos, realmd | | - | Counter show number of sql update in updates list for provided revision + | Counter show number of sql updates in updates list for provided revision | and set proper order for sql updates for same revision | - MaNGOS commit revison related to sql update. + MaNGOS commit revision related to sql update. It included in commit description in form [6936] as you can see at http://github.com/mangos/mangos/commits/master -After appling this update DB compatiable with database that include this sql update. -SQL update include special protection against multiply and wrong order SQL updates apply. -So attempt apply sql update to more old DB without previous SQL update in list for targeted database -or to DB with already applied this or later SQL update will generate error and not applied. +After applying an update the DB is compatible with the mangos revision of this sql update. +SQL updates include special protection against multiple and wrong order of update application. -=== For commiters ==== +Attempts to apply sql updates to an older DB without previous SQL updates in list for the database +or to DB with already applied this or later SQL update will generate an error and not be applied. + +=== For Commiters ==== MaNGOS sources include special tool ( contrib/git_id ) for generation revision info in commit notes and in src/shared/revision_nr.h file. It have option '-s' that let set diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 32635c7b4..8bb729745 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -204,6 +204,18 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_ // check fail, prepare readabale error message // search current required_* field in DB + const char* db_name; + if(!strcmp(table_name, "db_version")) + db_name = "WORLD"; + else if(!strcmp(table_name, "character_db_version")) + db_name = "CHARACTER"; + else if(!strcmp(table_name, "realmd_db_version")) + db_name = "REALMD"; + else + db_name = "UNKNOWN"; + + char const* req_sql_update_name = required_name+strlen("required_"); + QueryNamedResult* result2 = PQueryNamed("SELECT * FROM %s LIMIT 1",table_name); if(result2) { @@ -220,13 +232,49 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_ delete result2; + std::string cur_sql_update_name = reqName.substr(strlen("required_"),reqName.npos); + if(!reqName.empty()) - sLog.outErrorDb("Table `%s` have field `%s` but expected `%s`! Not all sql updates applied?",table_name,reqName.c_str(),required_name); + { + sLog.outErrorDb("The table `%s` in your [%s] database indicates that this database is out of date!",table_name,db_name); + sLog.outErrorDb(""); + sLog.outErrorDb(" [A] You have: --> `%s.sql`",cur_sql_update_name.c_str()); + sLog.outErrorDb(""); + sLog.outErrorDb(" [B] You need: --> `%s.sql`",req_sql_update_name); + sLog.outErrorDb(""); + sLog.outErrorDb("You must apply all updates after [A] to [B] to use mangos with this database."); + sLog.outErrorDb("These updates are included in the sql/updates folder."); + sLog.outErrorDb("Please read the included [README] in sql/updates for instructions on updating."); + } else - sLog.outErrorDb("Table `%s` not have required_* field but expected `%s`! Not all sql updates applied?",table_name,required_name); + { + sLog.outErrorDb("The table `%s` in your [%s] database is missing its version info.",table_name,db_name); + sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.",table_name,db_name); + sLog.outErrorDb(""); + sLog.outErrorDb("This revision of MaNGOS requires a database updated to:"); + sLog.outErrorDb("`%s.sql`",req_sql_update_name); + sLog.outErrorDb(""); + + if(!strcmp(db_name, "WORLD")) + sLog.outErrorDb("Post this error to your database provider forum or find a solution there."); + else + sLog.outErrorDb("Reinstall your [%s] database with the included sql file in the sql folder.",db_name); + } } else - sLog.outErrorDb("Table `%s` fields list query fail but expected have `%s`! No records in `%s`?",table_name,required_name,table_name); + { + sLog.outErrorDb("The table `%s` in your [%s] database is missing or corrupt.",table_name,db_name); + sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.",table_name,db_name); + sLog.outErrorDb(""); + sLog.outErrorDb("This revision of mangos requires a database updated to:"); + sLog.outErrorDb("`%s.sql`",req_sql_update_name); + sLog.outErrorDb(""); + + if(!strcmp(db_name, "WORLD")) + sLog.outErrorDb("Post this error to your database provider forum or find a solution there."); + else + sLog.outErrorDb("Reinstall your [%s] database with the included sql file in the sql folder.",db_name); + } return false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4b9bf75d2..ece8f4dc6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9905" + #define REVISION_NR "9906" #endif // __REVISION_NR_H__ From ad1926585ed4e4679cc2e9ee8ad2231fba60ad77 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sun, 16 May 2010 03:31:51 +0400 Subject: [PATCH 035/172] [9907] Make comment really proccessed by doc generator. Signed-off-by: VladimirMangos --- src/game/Spell.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 99056f42e..f06574594 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6402,7 +6402,7 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski return SPELL_CAST_OK; } -/* +/** * Fill target list by units around (x,y) points at radius distance * @param targetUnitMap Reference to target list that filled by function diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ece8f4dc6..9dc5ad921 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9906" + #define REVISION_NR "9907" #endif // __REVISION_NR_H__ From 92b7920cbb8aed0c27180027ffac7263c68a7f51 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sun, 16 May 2010 03:38:11 +0400 Subject: [PATCH 036/172] [9908] Add missing break. Not affect current code work. Signed-off-by: VladimirMangos --- src/game/SpellMgr.cpp | 1 + src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 9010f8608..822158f7e 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -151,6 +151,7 @@ uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType default: break; } + break; default: break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9dc5ad921..98c319600 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9907" + #define REVISION_NR "9908" #endif // __REVISION_NR_H__ From df6bd3df303af4ce8c7d7769c37e7e51218216cb Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 16 May 2010 05:23:15 +0400 Subject: [PATCH 037/172] [9909] Prevent SQL injection in equipment sets code. Author of original verison: Machiavelli --- src/game/Player.cpp | 18 ++++++++++++++++-- src/shared/revision_nr.h | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5f8aa6417..09b974831 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -21700,19 +21700,33 @@ void Player::_SaveEquipmentSets() ++itr; break; // nothing do case EQUIPMENT_SET_CHANGED: + { + // prevent SQL injection + std::string db_IconName = eqset.IconName; + std::string db_Name = eqset.Name; + CharacterDatabase.escape_string(db_IconName); + CharacterDatabase.escape_string(db_Name); CharacterDatabase.PExecute("UPDATE character_equipmentsets SET name='%s', iconname='%s', item0='%u', item1='%u', item2='%u', item3='%u', item4='%u', item5='%u', item6='%u', item7='%u', item8='%u', item9='%u', item10='%u', item11='%u', item12='%u', item13='%u', item14='%u', item15='%u', item16='%u', item17='%u', item18='%u' WHERE guid='%u' AND setguid='"UI64FMTD"' AND setindex='%u'", - eqset.Name.c_str(), eqset.IconName.c_str(), eqset.Items[0], eqset.Items[1], eqset.Items[2], eqset.Items[3], eqset.Items[4], eqset.Items[5], eqset.Items[6], eqset.Items[7], + db_Name.c_str(), db_IconName.c_str(), eqset.Items[0], eqset.Items[1], eqset.Items[2], eqset.Items[3], eqset.Items[4], eqset.Items[5], eqset.Items[6], eqset.Items[7], eqset.Items[8], eqset.Items[9], eqset.Items[10], eqset.Items[11], eqset.Items[12], eqset.Items[13], eqset.Items[14], eqset.Items[15], eqset.Items[16], eqset.Items[17], eqset.Items[18], GetGUIDLow(), eqset.Guid, index); eqset.state = EQUIPMENT_SET_UNCHANGED; ++itr; break; + } case EQUIPMENT_SET_NEW: + { + // prevent SQL injection + std::string db_IconName = eqset.IconName; + std::string db_Name = eqset.Name; + CharacterDatabase.escape_string(db_IconName); + CharacterDatabase.escape_string(db_Name); CharacterDatabase.PExecute("INSERT INTO character_equipmentsets VALUES ('%u', '"UI64FMTD"', '%u', '%s', '%s', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), eqset.Guid, index, eqset.Name.c_str(), eqset.IconName.c_str(), eqset.Items[0], eqset.Items[1], eqset.Items[2], eqset.Items[3], eqset.Items[4], eqset.Items[5], eqset.Items[6], eqset.Items[7], + GetGUIDLow(), eqset.Guid, index, db_Name.c_str(), db_IconName.c_str(), eqset.Items[0], eqset.Items[1], eqset.Items[2], eqset.Items[3], eqset.Items[4], eqset.Items[5], eqset.Items[6], eqset.Items[7], eqset.Items[8], eqset.Items[9], eqset.Items[10], eqset.Items[11], eqset.Items[12], eqset.Items[13], eqset.Items[14], eqset.Items[15], eqset.Items[16], eqset.Items[17], eqset.Items[18]); eqset.state = EQUIPMENT_SET_UNCHANGED; ++itr; break; + } case EQUIPMENT_SET_DELETED: CharacterDatabase.PExecute("DELETE FROM character_equipmentsets WHERE setguid="UI64FMTD, eqset.Guid); m_EquipmentSets.erase(itr++); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 98c319600..7df376018 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9908" + #define REVISION_NR "9909" #endif // __REVISION_NR_H__ From 0828c3aa8146fa27e18d5f3ced5f706e6eaf30c6 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Sun, 16 May 2010 07:41:25 +0400 Subject: [PATCH 038/172] [9910] Implement expected from 3.2.x time limit for BattleGroundWS. With updates and fixes from zergtmn. Signed-off-by: VladimirMangos --- src/game/BattleGroundWS.cpp | 32 ++++++++++++++++++++++++++++++++ src/game/BattleGroundWS.h | 8 +++++++- src/game/Player.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index ba2b6e411..9a121e0da 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -86,6 +86,31 @@ void BattleGroundWS::Update(uint32 diff) RespawnFlagAfterDrop(HORDE); } } + + if (m_EndTimer <= diff) + { + uint32 allianceScore = GetTeamScore(ALLIANCE); + uint32 hordeScore = GetTeamScore(HORDE); + + if (allianceScore > hordeScore) + EndBattleGround(ALLIANCE); + else if (allianceScore < hordeScore) + EndBattleGround(HORDE); + else + { + // if 0 => tie + EndBattleGround(m_LastCapturedFlagTeam); + } + } + else + { + uint32 minutesLeftPrev = GetRemainingTimeInMinutes(); + m_EndTimer -= diff; + uint32 minutesLeft = GetRemainingTimeInMinutes(); + + if (minutesLeft != minutesLeftPrev) + UpdateWorldState(BG_WS_TIME_REMAINING, minutesLeft); + } } } @@ -165,6 +190,8 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) if (GetStatus() != STATUS_IN_PROGRESS) return; + m_LastCapturedFlagTeam = Source->GetTeam(); + uint32 winner = 0; Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); @@ -526,6 +553,8 @@ void BattleGroundWS::Reset() m_HonorWinKills = (isBGWeekend) ? 3 : 1; m_HonorEndKills = (isBGWeekend) ? 4 : 2; + m_EndTimer = BG_WS_TIME_LIMIT; + m_LastCapturedFlagTeam = 0; } void BattleGroundWS::EndBattleGround(uint32 winner) @@ -626,4 +655,7 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count) FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2); else FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); + + FillInitialWorldState(data, count, BG_WS_UNK1, 1); + FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes()); } diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index 42d3d9817..e6766b628 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -24,6 +24,7 @@ #define BG_WS_MAX_TEAM_SCORE 3 #define BG_WS_FLAG_RESPAWN_TIME (23*IN_MILLISECONDS) #define BG_WS_FLAG_DROP_TIME (10*IN_MILLISECONDS) +#define BG_WS_TIME_LIMIT (25*MINUTE*IN_MILLISECONDS) enum BG_WS_Sound { @@ -53,7 +54,9 @@ enum BG_WS_WorldStates BG_WS_FLAG_CAPTURES_HORDE = 1582, BG_WS_FLAG_CAPTURES_MAX = 1601, BG_WS_FLAG_STATE_HORDE = 2338, - BG_WS_FLAG_STATE_ALLIANCE = 2339 + BG_WS_FLAG_STATE_ALLIANCE = 2339, + BG_WS_UNK1 = 4247, // Show time limit? + BG_WS_TIME_REMAINING = 4248 }; enum BG_WS_FlagState @@ -128,6 +131,7 @@ class BattleGroundWS : public BattleGround virtual void Reset(); void EndBattleGround(uint32 winner); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + uint32 GetRemainingTimeInMinutes() { return m_EndTimer ? (m_EndTimer-1) / (MINUTE * IN_MILLISECONDS) + 1 : 0; } void UpdateFlagState(uint32 team, uint32 value); void UpdateTeamScore(uint32 team); @@ -152,5 +156,7 @@ class BattleGroundWS : public BattleGround uint32 m_ReputationCapture; uint32 m_HonorWinKills; uint32 m_HonorEndKills; + uint32 m_EndTimer; + uint32 m_LastCapturedFlagTeam; }; #endif diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 09b974831..f8c56e499 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -8066,6 +8066,8 @@ static WorldStatePair WS_world_states[] = { 0x641, 0x3 }, // 12 1601 unk (max flag captures?) { 0x922, 0x1 }, // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) { 0x923, 0x1 }, // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + { 0x1097,0x1 }, // 15 4247 show time limit? + { 0x1098,0x19 }, // 16 4248 time remaining in minutes { 0x0, 0x0 } }; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7df376018..144c2c2d4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9909" + #define REVISION_NR "9910" #endif // __REVISION_NR_H__ From 112afc260cde4e69f6cd64c861bc45980adf7da1 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 16 May 2010 09:22:45 +0400 Subject: [PATCH 039/172] [9911] Check script using and existance at `creature_movement_scripts` load. --- src/game/ObjectMgr.cpp | 26 ++++++++++++++++++-------- src/game/ObjectMgr.h | 2 +- src/game/WaypointManager.cpp | 24 ++++++++++++++++++++++++ src/game/WaypointManager.h | 1 + src/shared/revision_nr.h | 2 +- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 462688476..935d93f60 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4583,6 +4583,16 @@ void ObjectMgr::LoadGossipScripts() void ObjectMgr::LoadCreatureMovementScripts() { LoadScripts(sCreatureMovementScripts, "creature_movement_scripts"); + + std::set ids; + + for(ScriptMapMap::const_iterator itr = sCreatureMovementScripts.begin(); itr != sEventScripts.end(); ++itr) + ids.insert(itr->first); + + sWaypointMgr.CheckScriptExistance(ids); + + for(std::set::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) + sLog.outErrorDb("Table `creature_movement_scripts` has script (Id: %u) not referring to any waypoint.", *itr); } void ObjectMgr::LoadPageTexts() @@ -8446,7 +8456,7 @@ uint32 ObjectMgr::GetScriptId(const char *name) return uint32(itr - m_scriptNames.begin()); } -void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set& ids) +void ObjectMgr::CheckScriptTexts(ScriptMapMap const& scripts,std::set& ids) { for(ScriptMapMap::const_iterator itrMM = scripts.begin(); itrMM != scripts.end(); ++itrMM) { @@ -8477,13 +8487,13 @@ void ObjectMgr::LoadDbScriptStrings() if(GetMangosStringLocale(i)) ids.insert(i); - CheckScripts(sQuestEndScripts,ids); - CheckScripts(sQuestStartScripts,ids); - CheckScripts(sSpellScripts,ids); - CheckScripts(sGameObjectScripts,ids); - CheckScripts(sEventScripts,ids); - CheckScripts(sGossipScripts,ids); - CheckScripts(sCreatureMovementScripts,ids); + CheckScriptTexts(sQuestEndScripts,ids); + CheckScriptTexts(sQuestStartScripts,ids); + CheckScriptTexts(sSpellScripts,ids); + CheckScriptTexts(sGameObjectScripts,ids); + CheckScriptTexts(sEventScripts,ids); + CheckScriptTexts(sGossipScripts,ids); + CheckScriptTexts(sCreatureMovementScripts,ids); sWaypointMgr.CheckTextsExistance(ids); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 7a60d017a..d1819a77e 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -961,7 +961,7 @@ class ObjectMgr private: void LoadScripts(ScriptMapMap& scripts, char const* tablename); - void CheckScripts(ScriptMapMap const& scripts,std::set& ids); + void CheckScriptTexts(ScriptMapMap const& scripts,std::set& ids); void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment); void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); void LoadQuestRelationsHelper(QuestRelations& map,char const* table); diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index 528611dc6..65f81efe4 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -394,3 +394,27 @@ void WaypointManager::CheckTextsExistance(std::set& ids) } } } + +void WaypointManager::CheckScriptExistance(std::set& ids) +{ + WaypointPathMap::iterator pmItr = m_pathMap.begin(); + for ( ; pmItr != m_pathMap.end(); ++pmItr) + { + for (size_t i = 0; i < pmItr->second.size(); ++i) + { + uint32 script_id = pmItr->second[i].script_id; + if (!script_id) + continue; + + // Now we check text existence and put all zero texts ids to the end of array + if (sCreatureMovementScripts.find(script_id)==sCreatureMovementScripts.end()) + { + sLog.outErrorDb("Some waypoint has not existing scriptid %u.", script_id); + pmItr->second[i].script_id = 0; + continue; + } + else + ids.erase(script_id); + } + } +} diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index e0c0eb4f5..edc464cbb 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -79,6 +79,7 @@ class WaypointManager void SetNodePosition(uint32 id, uint32 point, float x, float y, float z); void SetNodeText(uint32 id, uint32 point, const char *text_field, const char *text); void CheckTextsExistance(std::set& ids); + void CheckScriptExistance(std::set& ids); private: void _addNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 144c2c2d4..a2132ae1f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9910" + #define REVISION_NR "9911" #endif // __REVISION_NR_H__ From 6d5d8778fa3b9cf8392f18ccd74ea3613ed0d297 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 16 May 2010 09:51:14 +0400 Subject: [PATCH 040/172] [9912] Partly revert [9911] :/ --- src/game/ObjectMgr.cpp | 10 +--------- src/game/WaypointManager.cpp | 24 ------------------------ src/game/WaypointManager.h | 1 - src/shared/revision_nr.h | 2 +- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 935d93f60..7beae97da 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4584,15 +4584,7 @@ void ObjectMgr::LoadCreatureMovementScripts() { LoadScripts(sCreatureMovementScripts, "creature_movement_scripts"); - std::set ids; - - for(ScriptMapMap::const_iterator itr = sCreatureMovementScripts.begin(); itr != sEventScripts.end(); ++itr) - ids.insert(itr->first); - - sWaypointMgr.CheckScriptExistance(ids); - - for(std::set::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) - sLog.outErrorDb("Table `creature_movement_scripts` has script (Id: %u) not referring to any waypoint.", *itr); + // checks are done in WaypointManager::Load } void ObjectMgr::LoadPageTexts() diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index 65f81efe4..528611dc6 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -394,27 +394,3 @@ void WaypointManager::CheckTextsExistance(std::set& ids) } } } - -void WaypointManager::CheckScriptExistance(std::set& ids) -{ - WaypointPathMap::iterator pmItr = m_pathMap.begin(); - for ( ; pmItr != m_pathMap.end(); ++pmItr) - { - for (size_t i = 0; i < pmItr->second.size(); ++i) - { - uint32 script_id = pmItr->second[i].script_id; - if (!script_id) - continue; - - // Now we check text existence and put all zero texts ids to the end of array - if (sCreatureMovementScripts.find(script_id)==sCreatureMovementScripts.end()) - { - sLog.outErrorDb("Some waypoint has not existing scriptid %u.", script_id); - pmItr->second[i].script_id = 0; - continue; - } - else - ids.erase(script_id); - } - } -} diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index edc464cbb..e0c0eb4f5 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -79,7 +79,6 @@ class WaypointManager void SetNodePosition(uint32 id, uint32 point, float x, float y, float z); void SetNodeText(uint32 id, uint32 point, const char *text_field, const char *text); void CheckTextsExistance(std::set& ids); - void CheckScriptExistance(std::set& ids); private: void _addNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a2132ae1f..a7bd53363 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9911" + #define REVISION_NR "9912" #endif // __REVISION_NR_H__ From fab9a3ae962f8c5c115268c68c91a12462817a28 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sun, 16 May 2010 09:29:12 +0200 Subject: [PATCH 041/172] [9913] Fix TARGET_SCRIPT searcher and also look for objects that are Pet* Pet (guardian, mini-pet) may also be the target of TARGET_SCRIPT, and are not considered a grid object. Signed-off-by: NoFantasy --- src/game/Spell.cpp | 3 ++- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f06574594..d2c843dba 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4491,7 +4491,8 @@ SpellCastResult Spell::CheckCast(bool strict) MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, i_spellST->second.targetEntry, i_spellST->second.type != SPELL_TARGET_TYPE_DEAD, range); MaNGOS::CreatureLastSearcher searcher(m_caster, p_Creature, u_check); - Cell::VisitGridObjects(m_caster, searcher, range); + // Visit all, need to find also Pet* objects + Cell::VisitAllObjects(m_caster, searcher, range); range = u_check.GetLastRange(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a7bd53363..8e4dcd985 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9912" + #define REVISION_NR "9913" #endif // __REVISION_NR_H__ From 628f11e1a75384928ade89dc1dbecc71d74abac7 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sun, 16 May 2010 13:52:17 +0200 Subject: [PATCH 042/172] [9914] Add script effect of spell 51864, 51889 and 51910 In addition, dummy effect of spell 51866 and 51872 and dummy aura effect of spell 51870. Dummy effect of 51866 might need additional work (see comments). Code expect additional spell cast by AI (summon dummy at death of related quest target creatures). Signed-off-by: NoFantasy --- src/game/SpellAuras.cpp | 10 ++++ src/game/SpellEffects.cpp | 100 ++++++++++++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c0aecd87f..58d81c827 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2488,6 +2488,16 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->CastSpell(m_target, 47287, true, NULL, this); return; } + case 51870: // Collect Hair Sample + { + if (Unit* pCaster = GetCaster()) + { + if (m_removeMode == AURA_REMOVE_BY_DEFAULT) + pCaster->CastSpell(m_target, 51872, true, NULL, this); + } + + return; + } case 58600: // Restricted Flight Area { // Remove Flight Auras diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 0b44785c9..a1ddddab7 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1507,6 +1507,64 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) ((Creature*)unitTarget)->ForcedDespawn(); return; } + case 51866: // Kick Nass + { + // It is possible that Nass Heartbeat (spell id 61438) is involved in this + // If so, unclear how it should work and using the below instead (even though it could be a bit hack-ish) + + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + return; + + // Only own guardian pet + if (m_caster != unitTarget->GetOwner()) + return; + + // This means we already set state (see below) and need to wait. + if (unitTarget->hasUnitState(UNIT_STAT_ROOT)) + return; + + // Expecting pTargetDummy to be summoned by AI at death of target creatures. + + Creature* pTargetDummy = NULL; + float fRange = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + + MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 28523, true, fRange*2); + MaNGOS::CreatureLastSearcher searcher(m_caster, pTargetDummy, u_check); + + Cell::VisitGridObjects(m_caster, searcher, fRange*2); + + if (pTargetDummy) + { + if (unitTarget->hasUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE)) + unitTarget->GetMotionMaster()->MovementExpired(); + + unitTarget->MonsterMove(pTargetDummy->GetPositionX(), pTargetDummy->GetPositionY(), pTargetDummy->GetPositionZ(), IN_MILLISECONDS); + + // Add state to temporarily prevent follow + unitTarget->addUnitState(UNIT_STAT_ROOT); + + // Collect Hair Sample + unitTarget->CastSpell(pTargetDummy, 51870, true); + } + + return; + } + case 51872: // Hair Sample Collected + { + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + return; + + // clear state to allow follow again + m_caster->clearUnitState(UNIT_STAT_ROOT); + + // Nass Kill Credit + m_caster->CastSpell(m_caster, 51871, true); + + // Despawn dummy creature + ((Creature*)unitTarget)->ForcedDespawn(); + + return; + } case 51964: // Tormentor's Incense { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) @@ -5708,6 +5766,48 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) caster->CastSpell(caster, damage, false); break; } + case 51864: // Player Summon Nass + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + // Summon Nass + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(51865)) + { + // Only if he is not already there + if (!m_caster->FindGuardianWithEntry(pSpell->EffectMiscValue[EFFECT_INDEX_0])) + { + m_caster->CastSpell(m_caster, pSpell, true); + + if (Pet* pPet = m_caster->FindGuardianWithEntry(pSpell->EffectMiscValue[EFFECT_INDEX_0])) + { + // Nass Periodic Say aura + pPet->CastSpell(pPet, 51868, true); + } + } + } + return; + } + case 51889: // Quest Accept Summon Nass + { + // This is clearly for quest accept, is spell 51864 then for gossip and does pretty much the same thing? + // Just "jumping" to what may be the "gossip-spell" for now, doing the same thing + m_caster->CastSpell(m_caster, 51864, true); + return; + } + case 51910: // Kickin' Nass: Quest Completion + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(51865)) + { + // Is this all to be done at completion? + if (Pet* pPet = m_caster->FindGuardianWithEntry(pSpell->EffectMiscValue[EFFECT_INDEX_0])) + ((Player*)m_caster)->RemovePet(pPet, PET_SAVE_NOT_IN_SLOT); + } + return; + } case 52751: // Death Gate { if (!unitTarget || unitTarget->getClass() != CLASS_DEATH_KNIGHT) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8e4dcd985..1f03772d1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9913" + #define REVISION_NR "9914" #endif // __REVISION_NR_H__ From ce761f492541be3edf9dac1c727b4baddd32e15d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 17 May 2010 01:55:35 +0400 Subject: [PATCH 043/172] [9915] Clarify game_event field values and fix typos. Thanks to BrightStone for pointing to ;) --- sql/mangos.sql | 4 ++-- src/game/GameEventMgr.h | 4 ++-- src/shared/revision_nr.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/mangos.sql b/sql/mangos.sql index 2a17bb4b5..550484a3f 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -1547,8 +1547,8 @@ CREATE TABLE `game_event` ( `entry` mediumint(8) unsigned NOT NULL COMMENT 'Entry of the game event', `start_time` timestamp NOT NULL default '0000-00-00 00:00:00' COMMENT 'Absolute start date, the event will never start before', `end_time` timestamp NOT NULL default '0000-00-00 00:00:00' COMMENT 'Absolute end date, the event will never start afler', - `occurence` bigint(20) unsigned NOT NULL default '86400' COMMENT 'Delay in hours between occurences of the event', - `length` bigint(20) unsigned NOT NULL default '43200' COMMENT 'Length in hours of the event', + `occurence` bigint(20) unsigned NOT NULL default '86400' COMMENT 'Delay in minutes between occurences of the event', + `length` bigint(20) unsigned NOT NULL default '43200' COMMENT 'Length in minutes of the event', `holiday` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Client side holiday id', `description` varchar(255) default NULL COMMENT 'Description of the event displayed in console', PRIMARY KEY (`entry`) diff --git a/src/game/GameEventMgr.h b/src/game/GameEventMgr.h index b02e75f0f..39480a9f4 100644 --- a/src/game/GameEventMgr.h +++ b/src/game/GameEventMgr.h @@ -34,8 +34,8 @@ struct GameEventData GameEventData() : start(1),end(0),occurence(0),length(0), holiday_id(HOLIDAY_NONE) {} time_t start; time_t end; - uint32 occurence; - uint32 length; + uint32 occurence; // Delay in minutes between occurences of the event + uint32 length; // Length in minutes of the event HolidayIds holiday_id; std::string description; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1f03772d1..3bb6b4839 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9914" + #define REVISION_NR "9915" #endif // __REVISION_NR_H__ From 0b7f090a37dc32b8406f6e81b136a7fcd88ac2a6 Mon Sep 17 00:00:00 2001 From: Darkruler Date: Mon, 17 May 2010 02:02:21 +0400 Subject: [PATCH 044/172] [9916] Fixed .account onlinelist work. Signed-off-by: VladimirMangos --- src/mangosd/CliRunnable.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index 1f11037e7..549d57809 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -483,7 +483,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* args) ///- Get the list of accounts ID logged to the realm // 0 1 2 3 4 - QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE realm = %u", realmID); + QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE active_realm_id = %u", realmID); return ShowAccountListHelper(result,&limit); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3bb6b4839..6e5f88bc4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9915" + #define REVISION_NR "9916" #endif // __REVISION_NR_H__ From 96d50bf55a2fa05946bce61a226371183e2fda20 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 17 May 2010 05:24:30 +0400 Subject: [PATCH 045/172] [9917] Fixes in loot roll timer work and related cleanups. * Changes include (in fact as part cleanup) fix got NeedBeforeGreed locked item after expire roll timer suggested by somedruid@mangos.lighthouseapp.com. * Added cancel rolling at creatuer corpse remove. * For NeedBeforeGreed and GroupLoot sued common code for prepare item roll. --- src/game/Creature.cpp | 36 +++++--- src/game/Creature.h | 8 +- src/game/Group.cpp | 180 ++++++++++++++++----------------------- src/game/Group.h | 7 +- src/game/Player.cpp | 6 +- src/shared/revision_nr.h | 2 +- 6 files changed, 112 insertions(+), 127 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 774f2454d..83601d13c 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -168,6 +168,10 @@ void Creature::RemoveCorpse() m_deathTimer = 0; setDeathState(DEAD); UpdateObjectVisibility(); + + // stop loot rolling before loot clear and for close client dialogs + StopGroupLoot(); + loot.clear(); uint32 respawnDelay = m_respawnDelay; if (AI()) @@ -413,19 +417,12 @@ void Creature::Update(uint32 diff) else { m_deathTimer -= diff; - if (m_groupLootTimer && m_groupLootId) + if (m_groupLootId) { - if(diff <= m_groupLootTimer) - { + if(diff < m_groupLootTimer) m_groupLootTimer -= diff; - } else - { - if (Group* group = sObjectMgr.GetGroupById(m_groupLootId)) - group->EndRoll(); - m_groupLootTimer = 0; - m_groupLootId = 0; - } + StopGroupLoot(); } } @@ -504,6 +501,25 @@ void Creature::Update(uint32 diff) } } + +void Creature::StartGroupLoot( Group* group, uint32 timer ) +{ + m_groupLootId = group->GetId(); + m_groupLootTimer = timer; +} + +void Creature::StopGroupLoot() +{ + if (!m_groupLootId) + return; + + if (Group* group = sObjectMgr.GetGroupById(m_groupLootId)) + group->EndRoll(); + + m_groupLootTimer = 0; + m_groupLootId = 0; +} + void Creature::RegenerateMana() { uint32 curValue = GetPower(POWER_MANA); diff --git a/src/game/Creature.h b/src/game/Creature.h index d8f74fbdf..cac8ff93b 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -33,6 +33,7 @@ struct SpellEntry; class CreatureAI; +class Group; class Quest; class Player; class WorldSession; @@ -583,8 +584,7 @@ class MANGOS_DLL_SPEC Creature : public Unit float GetRespawnRadius() const { return m_respawnradius; } void SetRespawnRadius(float dist) { m_respawnradius = dist; } - uint32 m_groupLootTimer; // (msecs)timer used for group loot - uint32 m_groupLootId; // used to find group which is looting corpse + void StartGroupLoot(Group* group, uint32 timer); void SendZoneUnderAttackMessage(Player* attacker); @@ -628,6 +628,10 @@ class MANGOS_DLL_SPEC Creature : public Unit bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); void RelocationNotify(); + uint32 m_groupLootTimer; // (msecs)timer used for group loot + uint32 m_groupLootId; // used to find group which is looting corpse + void StopGroupLoot(); + // vendor items VendorItemCounts m_vendorItemCounts; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 1433a0237..97c0143d2 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -34,6 +34,8 @@ #include "Util.h" #include "LootMgr.h" +#define LOOT_ROLL_TIMEOUT (1*MINUTE*IN_MILLISECONDS) + Group::Group() : m_Id(0), m_leaderGuid(0), m_mainTank(0), m_mainAssistant(0), m_groupType(GROUPTYPE_NORMAL), m_dungeonDifficulty(REGULAR_DIFFICULTY), m_raidDifficulty(REGULAR_DIFFICULTY), m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_looterGuid(0), m_lootThreshold(ITEM_QUALITY_UNCOMMON), @@ -538,134 +540,48 @@ void Group::SendLootAllPassed(Roll const& r) } } -void Group::GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature) +void Group::GroupLoot(Creature *creature, Loot *loot) { - std::vector::iterator i; - ItemPrototype const *item; - uint8 itemSlot = 0; - Player *player = sObjectMgr.GetPlayer(playerGUID); - Group *group = player->GetGroup(); - - for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) + for(uint8 itemSlot = 0; itemSlot < loot->items.size(); ++itemSlot) { - item = ObjectMgr::GetItemPrototype(i->itemid); - if (!item) + LootItem& lootItem = loot->items[itemSlot]; + ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(lootItem.itemid); + if (!itemProto) { - //DEBUG_LOG("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); + DEBUG_LOG("Group::GroupLoot: missing item prototype for item with id: %d", lootItem.itemid); continue; } //roll for over-threshold item if it's one-player loot - if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) - { - Roll* r = new Roll(creature->GetGUID(), *i); - - //a vector is filled with only near party members - for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player *member = itr->getSource(); - if(!member || !member->GetSession()) - continue; - if ( i->AllowedForPlayer(member) ) - { - if (member->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false)) - { - r->playerVote[member->GetGUID()] = ROLL_NOT_EMITED_YET; - ++r->totalPlayersRolling; - } - } - } - - if (r->totalPlayersRolling > 0) // has looters - { - r->setLoot(loot); - r->itemSlot = itemSlot; - - if (r->totalPlayersRolling == 1) // single looter - r->playerVote.begin()->second = ROLL_NEED; - else - { - group->SendLootStartRoll(60000, creature->GetMapId(), *r); - - loot->items[itemSlot].is_blocked = true; - - creature->m_groupLootTimer = 60000; - creature->m_groupLootId = GetId(); - } - - RollId.push_back(r); - } - else // no looters?? - delete r; - } + if (itemProto->Quality >= uint32(m_lootThreshold) && !lootItem.freeforall) + StartLootRool(creature,loot,itemSlot,false); else - i->is_underthreshold = 1; + lootItem.is_underthreshold = 1; } } -void Group::NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *creature) +void Group::NeedBeforeGreed(Creature *creature, Loot *loot) { - ItemPrototype const *item; - Player *player = sObjectMgr.GetPlayer(playerGUID); - Group *group = player->GetGroup(); - - uint8 itemSlot = 0; - for(std::vector::iterator i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) + for(uint8 itemSlot = 0; itemSlot < loot->items.size(); ++itemSlot) { - item = ObjectMgr::GetItemPrototype(i->itemid); + LootItem& lootItem = loot->items[itemSlot]; + ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(lootItem.itemid); + if (!itemProto) + { + DEBUG_LOG("Group::NeedBeforeGreed: missing item prototype for item with id: %d", lootItem.itemid); + continue; + } //only roll for one-player items, not for ones everyone can get - if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) - { - Roll* r = new Roll(creature->GetGUID(), *i); - - for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player *playerToRoll = itr->getSource(); - if(!playerToRoll || !playerToRoll->GetSession()) - continue; - - if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll) ) - { - if (playerToRoll->IsWithinDist(creature, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false)) - { - r->playerVote[playerToRoll->GetGUID()] = ROLL_NOT_EMITED_YET; - ++r->totalPlayersRolling; - } - } - } - - if (r->totalPlayersRolling > 0) // has looters - { - r->setLoot(loot); - r->itemSlot = itemSlot; - - if (r->totalPlayersRolling == 1) // single looter - r->playerVote.begin()->second = ROLL_NEED; - else - { - group->SendLootStartRoll(60000, creature->GetMapId(), *r); - loot->items[itemSlot].is_blocked = true; - } - - RollId.push_back(r); - } - else // no looters?? - delete r; - } + if (itemProto->Quality >= uint32(m_lootThreshold) && !lootItem.freeforall) + StartLootRool(creature, loot, itemSlot, true); else - i->is_underthreshold = 1; + lootItem.is_underthreshold = 1; } } -void Group::MasterLoot(ObjectGuid const& playerGUID, Loot* /*loot*/, Creature *creature) +void Group::MasterLoot(Creature *creature, Loot* /*loot*/) { - Player *player = sObjectMgr.GetPlayer(playerGUID); - if(!player) - return; - - DEBUG_LOG("Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330) player = [%s].", player->GetName()); - uint32 real_count = 0; WorldPacket data(SMSG_LOOT_MASTER_LIST, 330); @@ -763,6 +679,54 @@ bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI, return false; } +void Group::StartLootRool(Creature* lootTarget, Loot* loot, uint8 itemSlot, bool skipIfCanNotUse) +{ + if (itemSlot >= loot->items.size()) + return; + + LootItem const& lootItem = loot->items[itemSlot]; + + ItemPrototype const* item = ObjectMgr::GetItemPrototype(lootItem.itemid); + + Roll* r = new Roll(lootTarget->GetGUID(), lootItem); + + //a vector is filled with only near party members + for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *playerToRoll = itr->getSource(); + if(!playerToRoll || !playerToRoll->GetSession()) + continue; + + if ((!skipIfCanNotUse || playerToRoll->CanUseItem(item)) && lootItem.AllowedForPlayer(playerToRoll) ) + { + if (playerToRoll->IsWithinDist(lootTarget, sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE), false)) + { + r->playerVote[playerToRoll->GetGUID()] = ROLL_NOT_EMITED_YET; + ++r->totalPlayersRolling; + } + } + } + + if (r->totalPlayersRolling > 0) // has looters + { + r->setLoot(loot); + r->itemSlot = itemSlot; + + if (r->totalPlayersRolling == 1) // single looter + r->playerVote.begin()->second = ROLL_NEED; + else + { + SendLootStartRoll(LOOT_ROLL_TIMEOUT, lootTarget->GetMapId(), *r); + loot->items[itemSlot].is_blocked = true; + lootTarget->StartGroupLoot(this,LOOT_ROLL_TIMEOUT); + } + + RollId.push_back(r); + } + else // no looters?? + delete r; +} + // called when roll timer expires void Group::EndRoll() { diff --git a/src/game/Group.h b/src/game/Group.h index 94041dc21..63bdea8b0 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -331,10 +331,11 @@ class MANGOS_DLL_SPEC Group void SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r); void SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, RollVote rollType, const Roll &r); void SendLootAllPassed(const Roll &r); - void GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature); - void NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *creature); - void MasterLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature); + void GroupLoot(Creature *creature, Loot *loot); + void NeedBeforeGreed(Creature *creature, Loot *loot); + void MasterLoot(Creature *creature, Loot *loot); void CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, RollVote choise); + void StartLootRool(Creature* lootTarget, Loot* loot, uint8 itemSlot, bool skipIfCanNotUse); void EndRoll(); void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f8c56e499..eae1779e6 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7869,13 +7869,13 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) { case GROUP_LOOT: // GroupLoot delete items over threshold (threshold even not implemented), and roll them. Items with qualityGroupLoot(recipient->GetObjectGuid(), loot, creature); + group->GroupLoot(creature, loot); break; case NEED_BEFORE_GREED: - group->NeedBeforeGreed(recipient->GetObjectGuid(), loot, creature); + group->NeedBeforeGreed(creature, loot); break; case MASTER_LOOT: - group->MasterLoot(recipient->GetObjectGuid(), loot, creature); + group->MasterLoot(creature, loot); break; default: break; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6e5f88bc4..8c3bb9db9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9916" + #define REVISION_NR "9917" #endif // __REVISION_NR_H__ From 696a4b6db071b12a5685d5bc41feadf46c440960 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 17 May 2010 08:58:54 +0400 Subject: [PATCH 046/172] [9918] Fixed player's tapped creature loot access by group in diff cases * If player tap creature in group and leave then group will have access to creature loot if not disbanded * If player tap creature and after join to group then creature loot will accesable only by player * Also RewardPlayerAndGroupAtKill divided to simgle player and group reward versions used for group tap and single player tap cases. --- src/game/Creature.cpp | 67 ++++++++++++++++++--- src/game/Creature.h | 14 +++-- src/game/CreatureEventAI.cpp | 2 +- src/game/Group.cpp | 72 +++++++++++++++++++++++ src/game/Group.h | 2 + src/game/LootHandler.cpp | 7 +-- src/game/ObjectGuid.h | 1 + src/game/Player.cpp | 111 +++++++---------------------------- src/game/Player.h | 2 +- src/game/SpellEffects.cpp | 2 +- src/game/Unit.cpp | 65 ++++++++++++-------- src/game/debugcmds.cpp | 11 +++- src/shared/revision_nr.h | 2 +- 13 files changed, 223 insertions(+), 135 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 83601d13c..59ccdef8b 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -111,7 +111,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) Creature::Creature(CreatureSubtype subtype) : Unit(), i_AI(NULL), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), m_groupLootId(0), -m_lootMoney(0), m_lootRecipient(0), +m_lootMoney(0), m_lootGroupRecipientId(0), m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(5.0f), m_subtype(subtype), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), @@ -810,13 +810,59 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, Splin SendMonsterMove(x, y, z, type, flags, time); } -Player *Creature::GetLootRecipient() const +/** + * Return original player who tap creature, it can be different from player/group allowed to loot so not use it for loot code + */ +Player* Creature::GetOriginalLootRecipient() const { - if (!m_lootRecipient) - return NULL; - else return ObjectAccessor::FindPlayer(m_lootRecipient); + return !m_lootRecipientGuid.IsEmpty() ? ObjectAccessor::FindPlayer(m_lootRecipientGuid) : NULL; } +/** + * Return group if player tap creature as group member, independent is player after leave group or stil be group member + */ +Group* Creature::GetGroupLootRecipient() const +{ + // original recipient group if set and not disbanded + return m_lootGroupRecipientId ? sObjectMgr.GetGroupById(m_lootGroupRecipientId) : NULL; +} + +/** + * Return player who can loot tapped creature (member of group or single player) + * + * In case when original player tap creature as group member then group tap prefered. + * This is for example important if player after tap leave group. + * If group not exist or disbanded or player tap creature not as group member return player + */ +Player* Creature::GetLootRecipient() const +{ + // original recipient group if set and not disbanded + Group* group = GetGroupLootRecipient(); + + // original recipient player if online + Player* player = GetOriginalLootRecipient(); + + // if group not set or disbanded return original recipient player if any + if (!group) + return player; + + // group case + + // return player if it still be in original recipient group + if (player && player->GetGroup() == group) + return player; + + // find any in group + for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player *p = itr->getSource()) + return p; + + return NULL; +} + +/** + * Set player and group (if player group member) who tap creature + */ void Creature::SetLootRecipient(Unit *unit) { // set the player whose group should receive the right @@ -825,7 +871,8 @@ void Creature::SetLootRecipient(Unit *unit) if (!unit) { - m_lootRecipient = 0; + m_lootRecipientGuid.Clear(); + m_lootGroupRecipientId = 0; RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); return; } @@ -834,7 +881,13 @@ void Creature::SetLootRecipient(Unit *unit) if(!player) // normal creature, no player involved return; - m_lootRecipient = player->GetGUID(); + // set player for non group case or if group will disbanded + m_lootRecipientGuid = player->GetObjectGuid(); + + // set group for group existed case including if player will leave group at loot time + if (Group* group = player->GetGroup()) + m_lootGroupRecipientId = group->GetId(); + SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); } diff --git a/src/game/Creature.h b/src/game/Creature.h index cac8ff93b..6369a58bf 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -531,11 +531,16 @@ class MANGOS_DLL_SPEC Creature : public Unit Loot loot; bool lootForPickPocketed; bool lootForBody; - Player *GetLootRecipient() const; - bool hasLootRecipient() const { return m_lootRecipient!=0; } - void SetLootRecipient (Unit* unit); + ObjectGuid GetLootRecipientGuid() const { return m_lootRecipientGuid; } + uint32 GetLootGroupRecipientId() const { return m_lootGroupRecipientId; } + Player* GetLootRecipient() const; // use group cases as prefered + Group* GetGroupLootRecipient() const; + bool HasLootRecipient() const { return m_lootGroupRecipientId || !m_lootRecipientGuid.IsEmpty(); } + bool IsGroupLootRecipient() const { return m_lootGroupRecipientId; } + void SetLootRecipient(Unit* unit); void AllLootRemovedFromCorpse(); + Player* GetOriginalLootRecipient() const; // ignore group changes/etc, not for looting SpellEntry const *reachWithSpellAttack(Unit *pVictim); SpellEntry const *reachWithSpellCure(Unit *pVictim); @@ -641,7 +646,8 @@ class MANGOS_DLL_SPEC Creature : public Unit static float _GetDamageMod(int32 Rank); uint32 m_lootMoney; - uint64 m_lootRecipient; + ObjectGuid m_lootRecipientGuid; // player who will have rights for looting if m_lootGroupRecipient==0 or group disbanded + uint32 m_lootGroupRecipientId; // group who will have rights for looting if set and exist /// Timers uint32 m_deathTimer; // (msecs)timer for death or corpse disappearance diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index b7ba302d6..bbb12c602 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -698,7 +698,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; } case ACTION_T_KILLED_MONSTER: - //first attempt player who tapped creature + //first attempt player/group who tapped creature if (Player* pPlayer = m_creature->GetLootRecipient()) pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature); else diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 97c0143d2..c4cff2796 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1691,3 +1691,75 @@ void Group::_homebindIfInstance(Player *player) player->m_InstanceValid = false; } } + +void Group::RewardGroupAtKill(Unit* pVictim) +{ + // for creature case use tapped group (for avoid use group if not set and use if player switch group after tap + //Group* pGroup = pVictim->GetTypeId() == TYPEID_UNIT ? ((Creature*)pVictim)->GetGroupLootRecipient() : GetGroup(); + + bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); + + // prepare data for near group iteration (PvP and !PvP cases) + uint32 xp = 0; + + uint32 count = 0; + uint32 sum_level = 0; + Player* member_with_max_level = NULL; + Player* not_gray_member_with_max_level = NULL; + + GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level); + + if(member_with_max_level) + { + /// not get Xp in PvP or no not gray players in group + xp = (PvP || !not_gray_member_with_max_level) ? 0 : MaNGOS::XP::Gain(not_gray_member_with_max_level, pVictim); + + /// skip in check PvP case (for speed, not used) + bool is_raid = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup(); + bool is_dungeon = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsDungeon(); + float group_rate = MaNGOS::XP::xp_in_group_rate(count,is_raid); + + for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupGuy = itr->getSource(); + if(!pGroupGuy) + continue; + + if(!pGroupGuy->IsAtGroupRewardDistance(pVictim)) + continue; // member (alive or dead) or his corpse at req. distance + + // honor can be in PvP and !PvP (racial leader) cases (for alive) + if (pGroupGuy->isAlive()) + pGroupGuy->RewardHonor(pVictim,count); + + // xp and reputation only in !PvP case + if(!PvP) + { + float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level; + + // if is in dungeon then all receive full reputation at kill + // rewarded any alive/dead/near_corpse group member + pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate); + + // XP updated only for alive group member + if(pGroupGuy->isAlive() && not_gray_member_with_max_level && + pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) + { + uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1); + + pGroupGuy->GiveXP(itr_xp, pVictim); + if(Pet* pet = pGroupGuy->GetPet()) + pet->GivePetXP(itr_xp/2); + } + + // quest objectives updated only for alive group member or dead but with not released body + if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + { + // normal creature (not pet/etc) can be only in !PvP case + if(pVictim->GetTypeId()==TYPEID_UNIT) + pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); + } + } + } + } +} diff --git a/src/game/Group.h b/src/game/Group.h index 63bdea8b0..3b0204994 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -323,6 +323,8 @@ class MANGOS_DLL_SPEC Group void BroadcastReadyCheck(WorldPacket *packet); void OfflineReadyCheck(); + void RewardGroupAtKill(Unit* pVictim); + /*********************************************************/ /*** LOOT SYSTEM ***/ /*********************************************************/ diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 793b5c217..1f494841f 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -436,10 +436,9 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) loot = &pCreature->loot; // update next looter - if(Player *recipient = pCreature->GetLootRecipient()) - if(Group* group = recipient->GetGroup()) - if (group->GetLooterGuid() == player->GetGUID()) - group->UpdateLooterGuid(pCreature); + if(Group* group = pCreature->GetGroupLootRecipient()) + if (group->GetLooterGuid() == player->GetGUID()) + group->UpdateLooterGuid(pCreature); if (loot->isLooted()) { diff --git a/src/game/ObjectGuid.h b/src/game/ObjectGuid.h index 21bbf105b..777e75376 100644 --- a/src/game/ObjectGuid.h +++ b/src/game/ObjectGuid.h @@ -130,6 +130,7 @@ class MANGOS_DLL_SPEC ObjectGuid PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } void Set(uint64 const& guid) { m_guid = guid; } + void Clear() { m_guid = 0; } // Possible removed in future for more strict control type conversions void operator= (uint64 const& guid) { m_guid = guid; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index eae1779e6..7eaf696e6 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7861,7 +7861,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) loot->generateMoneyLoot(creature->GetCreatureInfo()->mingold,creature->GetCreatureInfo()->maxgold); - if (Group* group = recipient->GetGroup()) + if (Group* group = creature->GetGroupLootRecipient()) { group->UpdateLooterGuid(creature,true); @@ -7892,9 +7892,9 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) // set group rights only for loot_type != LOOT_SKINNING else { - if(Group* group = GetGroup()) + if(Group* group = creature->GetGroupLootRecipient()) { - if (group == recipient->GetGroup()) + if (group == GetGroup()) { if (group->GetLootMethod() == FREE_FOR_ALL) permission = ALL_PERMISSION; @@ -15452,18 +15452,20 @@ bool Player::isAllowedToLoot(Creature* creature) { if (recipient == this) return true; - if( Group* otherGroup = recipient->GetGroup()) + + if (Group* otherGroup = recipient->GetGroup()) { Group* thisGroup = GetGroup(); - if(!thisGroup) + if (!thisGroup) return false; + return thisGroup == otherGroup; } return false; } else // prevent other players from looting if the recipient got disconnected - return !creature->hasLootRecipient(); + return !creature->HasLootRecipient(); } void Player::_LoadActions(QueryResult *result) @@ -20099,99 +20101,28 @@ bool Player::isHonorOrXPTarget(Unit* pVictim) const return true; } -bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim) +bool Player::RewardSinglePlayerAtKill(Unit* pVictim) { bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); + uint32 xp = PvP ? 0 : MaNGOS::XP::Gain(this, pVictim); - // prepare data for near group iteration (PvP and !PvP cases) - uint32 xp = 0; - bool honored_kill = false; + // honor can be in PvP and !PvP (racial leader) cases + bool honored_kill = RewardHonor(pVictim,1); - if(Group *pGroup = GetGroup()) + // xp and reputation only in !PvP case + if(!PvP) { - uint32 count = 0; - uint32 sum_level = 0; - Player* member_with_max_level = NULL; - Player* not_gray_member_with_max_level = NULL; + RewardReputation(pVictim,1); + GiveXP(xp, pVictim); - pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level); + if(Pet* pet = GetPet()) + pet->GivePetXP(xp); - if(member_with_max_level) - { - /// not get Xp in PvP or no not gray players in group - xp = (PvP || !not_gray_member_with_max_level) ? 0 : MaNGOS::XP::Gain(not_gray_member_with_max_level, pVictim); - - /// skip in check PvP case (for speed, not used) - bool is_raid = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsRaid() && pGroup->isRaidGroup(); - bool is_dungeon = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsDungeon(); - float group_rate = MaNGOS::XP::xp_in_group_rate(count,is_raid); - - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* pGroupGuy = itr->getSource(); - if(!pGroupGuy) - continue; - - if(!pGroupGuy->IsAtGroupRewardDistance(pVictim)) - continue; // member (alive or dead) or his corpse at req. distance - - // honor can be in PvP and !PvP (racial leader) cases (for alive) - if(pGroupGuy->isAlive() && pGroupGuy->RewardHonor(pVictim,count) && pGroupGuy==this) - honored_kill = true; - - // xp and reputation only in !PvP case - if(!PvP) - { - float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level; - - // if is in dungeon then all receive full reputation at kill - // rewarded any alive/dead/near_corpse group member - pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate); - - // XP updated only for alive group member - if(pGroupGuy->isAlive() && not_gray_member_with_max_level && - pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) - { - uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1); - - pGroupGuy->GiveXP(itr_xp, pVictim); - if(Pet* pet = pGroupGuy->GetPet()) - pet->GivePetXP(itr_xp/2); - } - - // quest objectives updated only for alive group member or dead but with not released body - if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { - // normal creature (not pet/etc) can be only in !PvP case - if(pVictim->GetTypeId()==TYPEID_UNIT) - pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); - } - } - } - } + // normal creature (not pet/etc) can be only in !PvP case + if(pVictim->GetTypeId()==TYPEID_UNIT) + KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); } - else // if (!pGroup) - { - xp = PvP ? 0 : MaNGOS::XP::Gain(this, pVictim); - // honor can be in PvP and !PvP (racial leader) cases - if(RewardHonor(pVictim,1)) - honored_kill = true; - - // xp and reputation only in !PvP case - if(!PvP) - { - RewardReputation(pVictim,1); - GiveXP(xp, pVictim); - - if(Pet* pet = GetPet()) - pet->GivePetXP(xp); - - // normal creature (not pet/etc) can be only in !PvP case - if(pVictim->GetTypeId()==TYPEID_UNIT) - KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); - } - } return xp || honored_kill; } diff --git a/src/game/Player.h b/src/game/Player.h index be072628c..cdf20bb19 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1904,7 +1904,7 @@ class MANGOS_DLL_SPEC Player : public Unit void InitDisplayIds(); bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; - bool RewardPlayerAndGroupAtKill(Unit* pVictim); + bool RewardSinglePlayerAtKill(Unit* pVictim); void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource); bool isHonorOrXPTarget(Unit* pVictim) const; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index a1ddddab7..97b8e37b4 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5675,7 +5675,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() != TYPEID_UNIT) return; - Player* pPlayer = ((Creature*)m_caster)->GetLootRecipient(); + Player* pPlayer = ((Creature*)m_caster)->GetOriginalLootRecipient(); if (!pPlayer) return; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 858527566..eb54b76d8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -658,7 +658,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (pVictim->GetTypeId() == TYPEID_PLAYER) ((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); - if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->hasLootRecipient()) + if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->HasLootRecipient()) ((Creature*)pVictim)->SetLootRecipient(this); if (health <= damage) @@ -666,35 +666,50 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa DEBUG_LOG("DealDamage: victim just died"); // find player: owner of controlled `this` or `this` itself maybe - Player *player = GetCharmerOrOwnerPlayerOrPlayerItself(); + // for loot will be sued only if group_tap==NULL + Player *player_tap = GetCharmerOrOwnerPlayerOrPlayerItself(); + Group *group_tap = NULL; // find owner of pVictim, used for creature cases, AI calls Unit* pOwner = pVictim->GetCharmerOrOwner(); - if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient()) - player = ((Creature*)pVictim)->GetLootRecipient(); + if (pVictim->GetTypeId() == TYPEID_UNIT) + { + group_tap = ((Creature*)pVictim)->GetGroupLootRecipient(); + + if (Player* recipient = ((Creature*)pVictim)->GetOriginalLootRecipient()) + player_tap = recipient; + } if (pVictim->GetTypeId() == TYPEID_PLAYER) { ((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); - if (player) - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL,1,0,pVictim); + if (player_tap) + player_tap->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL,1,0,pVictim); + } + + // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) + if(player_tap && player_tap != pVictim) + { + player_tap->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0); + + WorldPacket data(SMSG_PARTYKILLLOG, (8+8)); //send event PARTY_KILL + data << player_tap->GetObjectGuid(); //player with killing blow + data << pVictim->GetObjectGuid(); //victim + + if (group_tap) + group_tap->BroadcastPacket(&data, false, group_tap->GetMemberGroup(player_tap->GetGUID()),player_tap->GetGUID()); + + player_tap->SendDirectMessage(&data); } // Reward player, his pets, and group/raid members - // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) - if(player && player!=pVictim) + if (player_tap != pVictim) { - player->RewardPlayerAndGroupAtKill(pVictim); - player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0); - - WorldPacket data(SMSG_PARTYKILLLOG, (8+8)); //send event PARTY_KILL - data << uint64(player->GetGUID()); //player with killing blow - data << uint64(pVictim->GetGUID()); //victim - if (Group *group = player->GetGroup()) - group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID())); - else - player->SendDirectMessage(&data); + if (group_tap) + group_tap->RewardGroupAtKill(pVictim); + else if (player_tap) + player_tap->RewardSinglePlayerAtKill(pVictim); } DEBUG_LOG("DealDamageAttackStop"); @@ -749,7 +764,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // remember victim PvP death for corpse type and corpse reclaim delay // at original death (not at SpiritOfRedemtionTalent timeout) if( pVictim->GetTypeId()==TYPEID_PLAYER && !damageFromSpiritOfRedemtionTalent ) - ((Player*)pVictim)->SetPvPDeath(player!=NULL); + ((Player*)pVictim)->SetPvPDeath(player_tap != NULL); // Call KilledUnit for creatures if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI()) @@ -769,7 +784,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (pVictim->GetTypeId() == TYPEID_PLAYER) { // only if not player and not controlled by player pet. And not at BG - if (durabilityLoss && !player && !((Player*)pVictim)->InBattleGround()) + if (durabilityLoss && !player_tap && !((Player*)pVictim)->InBattleGround()) { DEBUG_LOG("We are dead, loosing 10 percents durability"); ((Player*)pVictim)->DurabilityLossAll(0.10f,false); @@ -855,14 +870,14 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa { Player *killed = ((Player*)pVictim); if(BattleGround *bg = killed->GetBattleGround()) - if(player) - bg->HandleKillPlayer(killed, player); + if(player_tap) + bg->HandleKillPlayer(killed, player_tap); } else if(pVictim->GetTypeId() == TYPEID_UNIT) { - if (player) - if (BattleGround *bg = player->GetBattleGround()) - bg->HandleKillUnit((Creature*)pVictim, player); + if (player_tap) + if (BattleGround *bg = player_tap->GetBattleGround()) + bg->HandleKillUnit((Creature*)pVictim, player_tap); } } else // if (health <= damage) diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index c1668b117..6a48add66 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -344,7 +344,16 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(const char* /*args*/) if (!target) return false; - PSendSysMessage("loot recipient: %s", target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient"); + if (!target->HasLootRecipient()) + SendSysMessage("loot recipient: no loot recipient"); + else if(Player* recipient = target->GetLootRecipient()) + PSendSysMessage("loot recipient: %s with raw data %s from group %u", + recipient->GetObjectGuid().GetString().c_str(), + target->GetLootRecipientGuid().GetString().c_str(), + target->GetLootGroupRecipientId()); + else + SendSysMessage("loot recipient: offline "); + return true; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8c3bb9db9..2b8113512 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9917" + #define REVISION_NR "9918" #endif // __REVISION_NR_H__ From bfffc715e51f6b841466793ede9df3d12044c2c9 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 17 May 2010 12:58:33 +0400 Subject: [PATCH 047/172] [9919] Output player name in ObjectGuid player output string. --- src/game/ObjectGuid.cpp | 12 +++++++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/game/ObjectGuid.cpp b/src/game/ObjectGuid.cpp index 1c543bd0c..b8a41f0b1 100644 --- a/src/game/ObjectGuid.cpp +++ b/src/game/ObjectGuid.cpp @@ -19,6 +19,7 @@ #include "ObjectGuid.h" #include "World.h" +#include "ObjectMgr.h" #include @@ -44,7 +45,16 @@ char const* ObjectGuid::GetTypeName(HighGuid high) std::string ObjectGuid::GetString() const { std::ostringstream str; - str << GetTypeName() << " ("; + str << GetTypeName(); + + if (IsPlayer()) + { + std::string name; + if (sObjectMgr.GetPlayerNameByGUID(m_guid, name)) + str << " " << name; + } + + str << " ("; if (HasEntry()) str << "Entry: " << GetEntry() << " "; str << "Guid: " << GetCounter() << ")"; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2b8113512..817e09de3 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9918" + #define REVISION_NR "9919" #endif // __REVISION_NR_H__ From e5dc7a098c4faec90be1f31f9926ac5d75b3d0c6 Mon Sep 17 00:00:00 2001 From: KillerFrca Date: Tue, 18 May 2010 04:36:01 +0400 Subject: [PATCH 048/172] [9920] Restore group rewarding at player kill. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 7 +++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index eb54b76d8..37249b285 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -673,6 +673,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // find owner of pVictim, used for creature cases, AI calls Unit* pOwner = pVictim->GetCharmerOrOwner(); + // in creature kill case group/player tap stored for creature if (pVictim->GetTypeId() == TYPEID_UNIT) { group_tap = ((Creature*)pVictim)->GetGroupLootRecipient(); @@ -680,6 +681,12 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (Player* recipient = ((Creature*)pVictim)->GetOriginalLootRecipient()) player_tap = recipient; } + // in player kill case group tap selected by player_tap (killer-player itself, or charmer, or owner, etc) + else + { + if (player_tap) + group_tap = player_tap->GetGroup(); + } if (pVictim->GetTypeId() == TYPEID_PLAYER) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 817e09de3..571731cbd 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9919" + #define REVISION_NR "9920" #endif // __REVISION_NR_H__ From bed8794a752aa11c37d794b475bc9aee60055d92 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 18 May 2010 04:39:59 +0400 Subject: [PATCH 049/172] [9921] In case player who tap creature in group leave group it must anyway rewarded with group. --- src/game/CharacterHandler.cpp | 5 +- src/game/Group.cpp | 128 ++++++++++++++++++++++------------ src/game/Group.h | 6 +- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 5 files changed, 88 insertions(+), 55 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 7d5edd6cc..8357ede9e 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -720,11 +720,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) pCurrChar->SetInGameTime( getMSTime() ); // announce group about member online (must be after add to player list to receive announce to self) - if(Group *group = pCurrChar->GetGroup()) - { - //pCurrChar->groupInfo.group->SendInit(this); // useless + if (Group *group = pCurrChar->GetGroup()) group->SendUpdate(); - } // friend status sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index c4cff2796..b0909df4f 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -888,26 +888,44 @@ void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid) BroadcastPacket(&data, true); } -void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level) +static void GetDataForXPAtKill_helper(Player* player, Unit const* victim, uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level) +{ + sum_level += player->getLevel(); + if(!member_with_max_level || member_with_max_level->getLevel() < player->getLevel()) + member_with_max_level = player; + + uint32 gray_level = MaNGOS::XP::GetGrayLevel(player->getLevel()); + if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level + || not_gray_member_with_max_level->getLevel() < player->getLevel())) + not_gray_member_with_max_level = player; +} + +void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional) { for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* member = itr->getSource(); - if(!member || !member->isAlive()) // only for alive + if (!member || !member->isAlive()) // only for alive continue; - if(!member->IsAtGroupRewardDistance(victim)) // at req. distance + // will proccesed later + if (member = additional) + continue; + + if (!member->IsAtGroupRewardDistance(victim)) // at req. distance continue; ++count; - sum_level += member->getLevel(); - if(!member_with_max_level || member_with_max_level->getLevel() < member->getLevel()) - member_with_max_level = member; + GetDataForXPAtKill_helper(member,victim,sum_level,member_with_max_level,not_gray_member_with_max_level); + } - uint32 gray_level = MaNGOS::XP::GetGrayLevel(member->getLevel()); - if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level - || not_gray_member_with_max_level->getLevel() < member->getLevel())) - not_gray_member_with_max_level = member; + if (additional) + { + if (additional->IsAtGroupRewardDistance(victim)) // at req. distance + { + ++count; + GetDataForXPAtKill_helper(additional,victim,sum_level,member_with_max_level,not_gray_member_with_max_level); + } } } @@ -1692,11 +1710,51 @@ void Group::_homebindIfInstance(Player *player) } } -void Group::RewardGroupAtKill(Unit* pVictim) +static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp ) { - // for creature case use tapped group (for avoid use group if not set and use if player switch group after tap - //Group* pGroup = pVictim->GetTypeId() == TYPEID_UNIT ? ((Creature*)pVictim)->GetGroupLootRecipient() : GetGroup(); + // honor can be in PvP and !PvP (racial leader) cases (for alive) + if (pGroupGuy->isAlive()) + pGroupGuy->RewardHonor(pVictim,count); + // xp and reputation only in !PvP case + if(!PvP) + { + float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level; + + // if is in dungeon then all receive full reputation at kill + // rewarded any alive/dead/near_corpse group member + pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate); + + // XP updated only for alive group member + if(pGroupGuy->isAlive() && not_gray_member_with_max_level && + pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) + { + uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1); + + pGroupGuy->GiveXP(itr_xp, pVictim); + if(Pet* pet = pGroupGuy->GetPet()) + pet->GivePetXP(itr_xp/2); + } + + // quest objectives updated only for alive group member or dead but with not released body + if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + { + // normal creature (not pet/etc) can be only in !PvP case + if(pVictim->GetTypeId()==TYPEID_UNIT) + pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); + } + } +} + +/** Provide rewards to group members at unit kill + * + * @param pVictim Killed unit + * @param player_tap Player who tap unit if online, it can be group member or can be not if leaved after tap but before kill target + * + * Rewards received by group members and player_tap + */ +void Group::RewardGroupAtKill(Unit* pVictim, Player* player_tap) +{ bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); // prepare data for near group iteration (PvP and !PvP cases) @@ -1707,7 +1765,7 @@ void Group::RewardGroupAtKill(Unit* pVictim) Player* member_with_max_level = NULL; Player* not_gray_member_with_max_level = NULL; - GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level); + GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level,player_tap); if(member_with_max_level) { @@ -1725,41 +1783,21 @@ void Group::RewardGroupAtKill(Unit* pVictim) if(!pGroupGuy) continue; + // will proccessed later + if(pGroupGuy==player_tap) + continue; + if(!pGroupGuy->IsAtGroupRewardDistance(pVictim)) continue; // member (alive or dead) or his corpse at req. distance - // honor can be in PvP and !PvP (racial leader) cases (for alive) - if (pGroupGuy->isAlive()) - pGroupGuy->RewardHonor(pVictim,count); + RewardGroupAtKill_helper(pGroupGuy, pVictim, count, PvP, group_rate, sum_level, is_dungeon, not_gray_member_with_max_level, member_with_max_level, xp); + } - // xp and reputation only in !PvP case - if(!PvP) - { - float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level; - - // if is in dungeon then all receive full reputation at kill - // rewarded any alive/dead/near_corpse group member - pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate); - - // XP updated only for alive group member - if(pGroupGuy->isAlive() && not_gray_member_with_max_level && - pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) - { - uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1); - - pGroupGuy->GiveXP(itr_xp, pVictim); - if(Pet* pet = pGroupGuy->GetPet()) - pet->GivePetXP(itr_xp/2); - } - - // quest objectives updated only for alive group member or dead but with not released body - if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { - // normal creature (not pet/etc) can be only in !PvP case - if(pVictim->GetTypeId()==TYPEID_UNIT) - pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); - } - } + if(player_tap) + { + // member (alive or dead) or his corpse at req. distance + if(player_tap->IsAtGroupRewardDistance(pVictim)) + RewardGroupAtKill_helper(player_tap, pVictim, count, PvP, group_rate, sum_level, is_dungeon, not_gray_member_with_max_level, member_with_max_level, xp); } } } diff --git a/src/game/Group.h b/src/game/Group.h index 3b0204994..05848cacf 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -259,7 +259,7 @@ class MANGOS_DLL_SPEC Group MemberSlotList const& GetMemberSlots() const { return m_memberSlots; } GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); } uint32 GetMembersCount() const { return m_memberSlots.size(); } - void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level); + void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional = NULL); uint8 GetMemberGroup(uint64 guid) const { member_citerator mslot = _getMemberCSlot(guid); @@ -313,8 +313,6 @@ class MANGOS_DLL_SPEC Group bool InCombatToInstance(uint32 instanceId); void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo); - // -no description- - //void SendInit(WorldSession *session); void SendTargetIconList(WorldSession *session); void SendUpdate(); void UpdatePlayerOutOfRange(Player* pPlayer); @@ -323,7 +321,7 @@ class MANGOS_DLL_SPEC Group void BroadcastReadyCheck(WorldPacket *packet); void OfflineReadyCheck(); - void RewardGroupAtKill(Unit* pVictim); + void RewardGroupAtKill(Unit* pVictim, Player* player_tap); /*********************************************************/ /*** LOOT SYSTEM ***/ diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 37249b285..9c8ed0b9d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -714,7 +714,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (player_tap != pVictim) { if (group_tap) - group_tap->RewardGroupAtKill(pVictim); + group_tap->RewardGroupAtKill(pVictim, player_tap); else if (player_tap) player_tap->RewardSinglePlayerAtKill(pVictim); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 571731cbd..8c74a8f6e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9920" + #define REVISION_NR "9921" #endif // __REVISION_NR_H__ From 60bdbed8f424e27063b4d42977bf08145e761d23 Mon Sep 17 00:00:00 2001 From: LordJZ Date: Tue, 18 May 2010 04:59:31 +0400 Subject: [PATCH 050/172] [9922] Rename BG_WS_UNK1 -> BG_WS_TIME_ENABLED Signed-off-by: VladimirMangos --- src/game/BattleGroundWS.cpp | 2 +- src/game/BattleGroundWS.h | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 9a121e0da..88d25a72a 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -656,6 +656,6 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count) else FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); - FillInitialWorldState(data, count, BG_WS_UNK1, 1); + FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, 1); FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes()); } diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index e6766b628..7fe71e060 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -55,7 +55,7 @@ enum BG_WS_WorldStates BG_WS_FLAG_CAPTURES_MAX = 1601, BG_WS_FLAG_STATE_HORDE = 2338, BG_WS_FLAG_STATE_ALLIANCE = 2339, - BG_WS_UNK1 = 4247, // Show time limit? + BG_WS_TIME_ENABLED = 4247, BG_WS_TIME_REMAINING = 4248 }; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8c74a8f6e..ce9085bc0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9921" + #define REVISION_NR "9922" #endif // __REVISION_NR_H__ From ffd2cf874d5d324abc00cb87386b10a6f335978e Mon Sep 17 00:00:00 2001 From: zergtmn Date: Tue, 18 May 2010 10:34:46 +0400 Subject: [PATCH 051/172] [9923] Fixed typo in prev commit. Signed-off-by: VladimirMangos --- src/game/Group.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index b0909df4f..6a9a822b4 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -909,7 +909,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev continue; // will proccesed later - if (member = additional) + if (member == additional) continue; if (!member->IsAtGroupRewardDistance(victim)) // at req. distance diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ce9085bc0..9f9f38436 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9922" + #define REVISION_NR "9923" #endif // __REVISION_NR_H__ From b6d7365ac9e26e0389aef8894c821a2416d9f936 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 18 May 2010 11:58:21 +0400 Subject: [PATCH 052/172] [9924] Implement .server log filter and .server log level comamnds. * .server log filter comamnd let temporary (until config reload or restart) set log filters state. Or look at filters state. * .server log level renamed from .server set loglevel but now let look at log level also. --- sql/mangos.sql | 7 ++- sql/updates/9924_01_mangos_mangos_string.sql | 6 ++ sql/updates/9924_02_mangos_command.sql | 6 ++ sql/updates/Makefile.am | 4 ++ src/game/Chat.cpp | 39 +++++++----- src/game/Chat.h | 3 +- src/game/Language.h | 4 +- src/mangosd/CliRunnable.cpp | 62 ++++++++++++++++++-- src/shared/Log.cpp | 38 ++++++------ src/shared/Log.h | 15 ++++- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 12 files changed, 140 insertions(+), 48 deletions(-) create mode 100644 sql/updates/9924_01_mangos_mangos_string.sql create mode 100644 sql/updates/9924_02_mangos_command.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 550484a3f..869c1e5ae 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9899_01_mangos_spell_bonus_data` bit(1) default NULL + `required_9924_02_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -754,11 +754,12 @@ INSERT INTO `command` VALUES ('server idleshutdown cancel',3,'Syntax: .server idleshutdown cancel\r\n\r\nCancel the restart/shutdown timer if any.'), ('server idlerestart',3,'Syntax: .server idlerestart #delay\r\n\r\nRestart the server after #delay seconds if no active connections are present (no players). Use #exist_code or 2 as program exist code.'), ('server idlerestart cancel',3,'Syntax: .server idlerestart cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server log filter',4,'Syntax: .server log filter [($filtername|all) (on|off)]\r\n\r\nShow or set server log filters. If used "all" then all filters will be set to on/off state.'), +('server log level',4,'Syntax: .server log level [#level]\r\n\r\nShow or set server log level (0 - errors only, 1 - basic, 2 - detail, 3 - debug).'), ('server motd',0,'Syntax: .server motd\r\n\r\nShow server Message of the day.'), ('server plimit',3,'Syntax: .server plimit [#num|-1|-2|-3|reset|player|moderator|gamemaster|administrator]\r\n\r\nWithout arg show current player amount and security level limitations for login to server, with arg set player linit ($num > 0) or securiti limitation ($num < 0 or security leme name. With `reset` sets player limit to the one in the config file'), ('server restart',3,'Syntax: .server restart #delay\r\n\r\nRestart the server after #delay seconds. Use #exist_code or 2 as program exist code.'), ('server restart cancel',3,'Syntax: .server restart cancel\r\n\r\nCancel the restart/shutdown timer if any.'), -('server set loglevel',4,'Syntax: .server set loglevel #level\r\n\r\nSet server log level (0 - errors only, 1 - basic, 2 - detail, 3 - debug).'), ('server set motd',3,'Syntax: .server set motd $MOTD\r\n\r\nSet server Message of the day.'), ('server shutdown',3,'Syntax: .server shutdown #delay [#exit_code]\r\n\r\nShut the server down after #delay seconds. Use #exit_code or 0 as program exit code.'), ('server shutdown cancel',3,'Syntax: .server shutdown cancel\r\n\r\nCancel the restart/shutdown timer if any.'), @@ -3635,6 +3636,8 @@ INSERT INTO `mangos_string` VALUES (1024, 'Character \'%s\' (GUID: %u Account %u) can\'t be restored: account character list full!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1025, 'Character \'%s\' (GUID: %u Account %u) can\'t be restored: new name already used!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1026, 'GUID: %u Name: %s Account: %s (%u) Date: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1027, 'Log filters state:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1028, 'All log filters set to: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1100,'Account %s (Id: %u) have up to %u expansion allowed now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1101,'Message of the day changed to:\r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1102,'Message sent to %s: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/sql/updates/9924_01_mangos_mangos_string.sql b/sql/updates/9924_01_mangos_mangos_string.sql new file mode 100644 index 000000000..ee57f8dd8 --- /dev/null +++ b/sql/updates/9924_01_mangos_mangos_string.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_9899_01_mangos_spell_bonus_data required_9924_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN (1027,1028); +INSERT INTO mangos_string VALUES +(1027, 'Log filters state:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1028, 'All log filters set to: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/9924_02_mangos_command.sql b/sql/updates/9924_02_mangos_command.sql new file mode 100644 index 000000000..d0c0ab3ff --- /dev/null +++ b/sql/updates/9924_02_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_9924_01_mangos_mangos_string required_9924_02_mangos_command bit; + +DELETE FROM command WHERE name IN('server set loglevel','server log level','server log filter'); +INSERT INTO command (name, security, help) VALUES +('server log filter',4,'Syntax: .server log filter [($filtername|all) (on|off)]\r\n\r\nShow or set server log filters. If used "all" then all filters will be set to on/off state.'), +('server log level',4,'Syntax: .server log level [#level]\r\n\r\nShow or set server log level (0 - errors only, 1 - basic, 2 - detail, 3 - debug).'); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index c852a0176..d93037252 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -65,6 +65,8 @@ pkgdata_DATA = \ 9891_01_mangos_creature_movement.sql \ 9891_02_mangos_creature_movement_scripts.sql \ 9899_01_mangos_spell_bonus_data.sql \ + 9924_01_mangos_mangos_string.sql \ + 9924_02_mangos_command.sql \ README ## Additional files to include when running 'make dist' @@ -110,4 +112,6 @@ EXTRA_DIST = \ 9891_01_mangos_creature_movement.sql \ 9891_02_mangos_creature_movement_scripts.sql \ 9899_01_mangos_spell_bonus_data.sql \ + 9924_01_mangos_mangos_string.sql \ + 9924_02_mangos_command.sql \ README diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 3aa0f330b..97506963b 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -549,9 +549,15 @@ ChatCommand * ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; + static ChatCommand serverLogCommandTable[] = + { + { "filter", SEC_CONSOLE, true, &ChatHandler::HandleServerLogFilterCommand, "", NULL }, + { "level", SEC_CONSOLE, true, &ChatHandler::HandleServerLogLevelCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand serverSetCommandTable[] = { - { "loglevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogLevelCommand, "", NULL }, { "motd", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetMotdCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -563,6 +569,7 @@ ChatCommand * ChatHandler::getCommandTable() { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, { "info", SEC_PLAYER, true, &ChatHandler::HandleServerInfoCommand, "", NULL }, + { "log", SEC_CONSOLE, true, NULL, "", serverLogCommandTable }, { "motd", SEC_PLAYER, true, &ChatHandler::HandleServerMotdCommand, "", NULL }, { "plimit", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerPLimitCommand, "", NULL }, { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, @@ -611,29 +618,29 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand commandTable[] = { { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, - { "gm", SEC_MODERATOR, true, NULL, "", gmCommandTable }, - { "npc", SEC_MODERATOR, false, NULL, "", npcCommandTable }, - { "go", SEC_MODERATOR, false, NULL, "", goCommandTable }, - { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable }, - { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, - { "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable }, - { "tele", SEC_MODERATOR, true, NULL, "", teleCommandTable }, + { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable}, + { "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable }, { "event", SEC_GAMEMASTER, false, NULL, "", eventCommandTable }, - { "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable }, + { "gm", SEC_MODERATOR, true, NULL, "", gmCommandTable }, { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, - { "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, - { "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable }, - { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, - { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, + { "go", SEC_MODERATOR, false, NULL, "", goCommandTable }, + { "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable }, + { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, + { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, + { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable }, { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, + { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, + { "npc", SEC_MODERATOR, false, NULL, "", npcCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, - { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, - { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, + { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, + { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, - { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, + { "tele", SEC_MODERATOR, true, NULL, "", teleCommandTable }, + { "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable }, + { "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, { "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL }, { "unaura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnAuraCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 288725daa..87aa895cf 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -425,10 +425,11 @@ class ChatHandler bool HandleServerIdleRestartCommand(const char* args); bool HandleServerIdleShutDownCommand(const char* args); bool HandleServerInfoCommand(const char* args); + bool HandleServerLogFilterCommand(const char* args); + bool HandleServerLogLevelCommand(const char* args); bool HandleServerMotdCommand(const char* args); bool HandleServerPLimitCommand(const char* args); bool HandleServerRestartCommand(const char* args); - bool HandleServerSetLogLevelCommand(const char* args); bool HandleServerSetMotdCommand(const char* args); bool HandleServerShutDownCommand(const char* args); bool HandleServerShutDownCancelCommand(const char* args); diff --git a/src/game/Language.h b/src/game/Language.h index 1fab0ec32..38ec3467e 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -792,7 +792,9 @@ enum MangosStrings LANG_CHARACTER_DELETED_SKIP_FULL = 1024, LANG_CHARACTER_DELETED_SKIP_NAME = 1025, LANG_CHARACTER_DELETED_LIST_LINE_CHAT = 1026, - // Room for more level 4 1027-1099 not used + LANG_LOG_FILTERS_STATE_HEADER = 1027, + LANG_ALL_LOG_FILTERS_SET_TO_S = 1028, + // Room for more level 4 1029-1099 not used // Level 3 (continue) LANG_ACCOUNT_SETADDON = 1100, diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index 549d57809..9680afcfd 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -531,17 +531,69 @@ bool ChatHandler::HandleAccountCreateCommand(const char* args) return true; } -/// Set the level of logging -bool ChatHandler::HandleServerSetLogLevelCommand(const char *args) +/// Set the filters of logging +bool ChatHandler::HandleServerLogFilterCommand(const char* args) { if(!*args) + { + uint32 logfiler = sLog.getLogFilter(); + + SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER); + for(int i = 0; i < LOG_FILTER_COUNT; ++i) + PSendSysMessage(" %-20s = %s",logFilterData[i].name,(logfiler & (1 << i)) !=0 ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); + return true; + } + + char *filtername = strtok((char*)args, " "); + if (!filtername) return false; - char *NewLevel = strtok((char*)args, " "); - if (!NewLevel) + char *value_str = strtok(NULL, " "); + if (!value_str) return false; - sLog.SetLogLevel(NewLevel); + bool value; + if (strncmp(value_str, "on", 3) == 0) + value = true; + else if (strncmp(value_str, "off", 4) == 0) + value = false; + else + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + if (strncmp(filtername, "all", 4) == 0) + { + sLog.SetLogFilter(LogFilters(0xFFFFFFFF),value); + PSendSysMessage(LANG_ALL_LOG_FILTERS_SET_TO_S, value ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); + return true; + } + + for(int i = 0; i < LOG_FILTER_COUNT; ++i) + { + if (!strncmp(filtername,logFilterData[i].name,strlen(filtername))) + { + sLog.SetLogFilter(LogFilters(1 << i),value); + PSendSysMessage(" %-20s = %s",logFilterData[i].name,value ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); + return true; + } + } + + return false; +} + +/// Set the level of logging +bool ChatHandler::HandleServerLogLevelCommand(const char *args) +{ + if(!*args) + { + PSendSysMessage("Log level: %u"); + return true; + } + + sLog.SetLogLevel((char*)args); return true; } diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 894574d90..d2ca99ac5 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -32,6 +32,20 @@ INSTANTIATE_SINGLETON_1( Log ); +LogFilterData logFilterData[LOG_FILTER_COUNT] = +{ + { "transport_moves", "LogFilter_TransportMoves", true }, + { "creature_moves", "LogFilter_CreatureMoves", true }, + { "visibility_changes", "LogFilter_VisibilityChanges", true }, + { "achievement_updates", "LogFilter_AchievementUpdates", true }, + { "weather", "LogFilter_Weather", true }, + { "player_stats", "LogFilter_PlayerStats", false }, + { "sql_text", "LogFilter_SQLText", false }, + { "player_moves", "LogFilter_PlayerMoves", false }, + { "periodic_effects", "LogFilter_PeriodicAffects", false }, + { "ai_and_movegens", "LogFilter_AIAndMovegens", false }, +}; + enum LogType { LogNormal = 0, @@ -250,26 +264,10 @@ void Log::Initialize() InitColors(sConfig.GetStringDefault("LogColors", "")); m_logFilter = 0; - - if (sConfig.GetBoolDefault("LogFilter_TransportMoves", true)) - m_logFilter |= LOG_FILTER_TRANSPORT_MOVES; - if (sConfig.GetBoolDefault("LogFilter_CreatureMoves", true)) - m_logFilter |= LOG_FILTER_CREATURE_MOVES; - if (sConfig.GetBoolDefault("LogFilter_VisibilityChanges", true)) - m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES; - if (sConfig.GetBoolDefault("LogFilter_AchievementUpdates", true)) - m_logFilter |= LOG_FILTER_ACHIEVEMENT_UPDATES; - if (sConfig.GetBoolDefault("LogFilter_Weather", true)) - m_logFilter |= LOG_FILTER_WEATHER; - - if (sConfig.GetBoolDefault("LogFilter_SQLText", false)) - m_logFilter |= LOG_FILTER_SQL_TEXT; - if (sConfig.GetBoolDefault("LogFilter_PlayerMoves", false)) - m_logFilter |= LOG_FILTER_PLAYER_MOVES; - if (sConfig.GetBoolDefault("LogFilter_PeriodicAffects", false)) - m_logFilter |= LOG_FILTER_PERIODIC_AFFECTS; - if (sConfig.GetBoolDefault("LogFilter_AIAndMovegens", false)) - m_logFilter |= LOG_FILTER_AI_AND_MOVEGENSS; + for(int i = 0; i < LOG_FILTER_COUNT; ++i) + if (logFilterData[i].name) + if (sConfig.GetBoolDefault(logFilterData[i].configName, logFilterData[i].defaultState)) + m_logFilter |= (1 << i); // Char log settings m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false); diff --git a/src/shared/Log.h b/src/shared/Log.h index 93815753b..d4ece2149 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -33,7 +33,7 @@ enum LogLevel LOG_LVL_DEBUG = 3 }; -// bitmask +// bitmask (not forgot update logFilterData content) enum LogFilters { LOG_FILTER_TRANSPORT_MOVES = 0x0001, // any related to transport moves @@ -48,6 +48,17 @@ enum LogFilters LOG_FILTER_AI_AND_MOVEGENSS = 0x0200, // DoT/HoT apply trace }; +#define LOG_FILTER_COUNT 10 + +struct LogFilterData +{ + char const* name; + char const* configName; + bool defaultState; +}; + +extern LogFilterData logFilterData[LOG_FILTER_COUNT]; + enum Color { BLACK, @@ -129,6 +140,7 @@ class Log : public MaNGOS::Singleton= loglvl || (m_logFileLevel >= loglvl && logfile); } bool IsOutCharDump() const { return m_charLog_Dump; } bool IsIncludeTime() const { return m_includeTime; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9f9f38436..cc191d757 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9923" + #define REVISION_NR "9924" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 6199f4502..dcb4c5d5c 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9899_01_mangos_spell_bonus_data" + #define REVISION_DB_MANGOS "required_9924_02_mangos_command" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From d86dcd60d717ab4902decd378b5ccd5d9032174e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 18 May 2010 12:35:50 +0400 Subject: [PATCH 053/172] [9925] Add more log filters * damage - different direct damage calculation tracing * combat - combat state updates, roll attack result and etc * spell_cast - spell cast progress and aura apply --- src/game/CombatHandler.cpp | 2 +- src/game/Creature.cpp | 12 ++-- src/game/DuelHandler.cpp | 6 +- src/game/GameObject.cpp | 2 +- src/game/Item.cpp | 2 +- src/game/PetAI.cpp | 4 +- src/game/Spell.cpp | 13 ++--- src/game/SpellAuras.cpp | 6 +- src/game/SpellEffects.cpp | 14 ++--- src/game/SpellHandler.cpp | 2 +- src/game/Unit.cpp | 94 ++++++++++++++++---------------- src/mangosd/mangosd.conf.dist.in | 3 + src/shared/Log.cpp | 3 + src/shared/Log.h | 5 +- src/shared/revision_nr.h | 2 +- 15 files changed, 89 insertions(+), 81 deletions(-) diff --git a/src/game/CombatHandler.cpp b/src/game/CombatHandler.cpp index f71373fcd..ffedc632e 100644 --- a/src/game/CombatHandler.cpp +++ b/src/game/CombatHandler.cpp @@ -29,7 +29,7 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data ) ObjectGuid guid; recv_data >> guid; - DEBUG_LOG("WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str()); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str()); Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 59ccdef8b..14d473e50 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -366,7 +366,7 @@ void Creature::Update(uint32 diff) { if( m_respawnTime <= time(NULL) ) { - DEBUG_LOG("Respawning..."); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Respawning..."); m_respawnTime = 0; lootForPickPocketed = false; lootForBody = false; @@ -411,7 +411,7 @@ void Creature::Update(uint32 diff) if (IsInWorld()) // can be despawned by update pool { RemoveCorpse(); - DEBUG_LOG("Removing corpse... %u ", GetEntry()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Removing corpse... %u ", GetEntry()); } } else @@ -443,7 +443,7 @@ void Creature::Update(uint32 diff) if (IsInWorld()) // can be despawned by update pool { RemoveCorpse(); - DEBUG_LOG("Removing alive corpse... %u ", GetEntry()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Removing alive corpse... %u ", GetEntry()); } else return; @@ -606,7 +606,7 @@ bool Creature::AIM_Initialize() // make sure nothing can change the AI during AI update if(m_AI_locked) { - DEBUG_LOG("AIM_Initialize: failed to init, locked."); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "AIM_Initialize: failed to init, locked."); return false; } @@ -1595,7 +1595,7 @@ void Creature::SendAIReaction(AiReaction reactionType) ((WorldObject*)this)->SendMessageToSet(&data, true); - DEBUG_LOG("WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType); } void Creature::CallAssistance() @@ -1809,7 +1809,7 @@ bool Creature::LoadCreaturesAddon(bool reload) Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, cAura->effect_idx, NULL, this, this, 0); AddAura(AdditionalAura); - DEBUG_LOG("Spell: %u with Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[EFFECT_INDEX_0],GetGUIDLow(),GetEntry()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell: %u with Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[EFFECT_INDEX_0],GetGUIDLow(),GetEntry()); } } return true; diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp index da1f4ce03..d94a9a52d 100644 --- a/src/game/DuelHandler.cpp +++ b/src/game/DuelHandler.cpp @@ -41,9 +41,9 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) if(pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0) return; - //DEBUG_LOG( "WORLD: received CMSG_DUEL_ACCEPTED" ); - DEBUG_LOG("Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName()); - DEBUG_LOG("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName()); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: received CMSG_DUEL_ACCEPTED" ); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName()); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName()); time_t now = time(NULL); pl->duel->startTimer = now; diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 1d08d73d4..c6a4a00c9 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1022,7 +1022,7 @@ void GameObject::Use(Unit* user) if (info->goober.eventId) { - DEBUG_LOG("Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this); } diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 82dc9ffbb..b8d71b7e2 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -278,7 +278,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff) if (!GetUInt32Value(ITEM_FIELD_DURATION)) return; - DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)",GetEntry(),GetUInt32Value(ITEM_FIELD_DURATION),diff); + //DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)",GetEntry(),GetUInt32Value(ITEM_FIELD_DURATION),diff); if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff) { diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 820ca3d12..34980834a 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -107,7 +107,7 @@ void PetAI::_stopAttack() inCombat = false; if( !m_creature->isAlive() ) { - DEBUG_LOG("PetAI (guid = %u) stopped attack, he is dead.", m_creature->GetGUIDLow()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "PetAI (guid = %u) stopped attack, he is dead.", m_creature->GetGUIDLow()); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); @@ -152,7 +152,7 @@ void PetAI::UpdateAI(const uint32 diff) { if (_needToStop()) { - DEBUG_LOG("PetAI (guid = %u) is stopping attack.", m_creature->GetGUIDLow()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "PetAI (guid = %u) is stopping attack.", m_creature->GetGUIDLow()); _stopAttack(); return; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d2c843dba..6160a6acd 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3295,7 +3295,7 @@ void Spell::SendSpellStart() if (!IsNeedSendToClient()) return; - DEBUG_LOG("Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN1; if (IsRangedSpell()) @@ -3353,7 +3353,7 @@ void Spell::SendSpellGo() if(!IsNeedSendToClient()) return; - DEBUG_LOG("Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN3; if(IsRangedSpell()) @@ -4017,7 +4017,7 @@ void Spell::HandleThreatSpells(uint32 spellId) m_targets.getUnitTarget()->AddThreat(m_caster, float(threat), false, GetSpellSchoolMask(m_spellInfo), m_spellInfo); - DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, sSpellMgr.GetSpellRank(spellId), threat); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u, rank %u, added an additional %i threat", spellId, sSpellMgr.GetSpellRank(spellId), threat); } void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,SpellEffectIndex i, float DamageMultiplier) @@ -4030,11 +4030,10 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar damage = int32(CalculateDamage(i, unitTarget) * DamageMultiplier); - DEBUG_LOG("Spell %u Effect%d : %u", m_spellInfo->Id, i, eff); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u Effect%d : %u", m_spellInfo->Id, i, eff); if(eff < TOTAL_SPELL_EFFECTS) { - //DEBUG_LOG( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff); (*this.*SpellEffects[eff])(i); } else @@ -5987,7 +5986,7 @@ void Spell::Delayed() else m_timer += delaytime; - DETAIL_LOG("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); + DETAIL_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); WorldPacket data(SMSG_SPELL_DELAYED, 8+4); data << m_caster->GetPackGUID(); @@ -6022,7 +6021,7 @@ void Spell::DelayedChannel() else m_timer -= delaytime; - DEBUG_LOG("Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); for(std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 58d81c827..68f0b6b5e 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -447,7 +447,7 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false) m_duration = m_maxduration; - DEBUG_LOG("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage); SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage, m_spellProto->EffectAmplitude[eff], m_spellProto->EffectMiscValue[eff]); @@ -5795,7 +5795,7 @@ void Aura::HandleModDamageDone(bool apply, bool Real) void Aura::HandleModDamagePercentDone(bool apply, bool Real) { - DEBUG_LOG("AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1); // apply item specific bonuses for already equipped weapon if(Real && m_target->GetTypeId() == TYPEID_PLAYER) @@ -5858,7 +5858,7 @@ void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) if(!Real) return; - DEBUG_LOG("AURA MOD OFFHAND DAMAGE"); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "AURA MOD OFFHAND DAMAGE"); m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 97b8e37b4..cff9c474d 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2713,7 +2713,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffectIndex effect_idx) } if (m_CastItem) - DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); m_caster->CastSpell(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, spellInfo, true, m_CastItem, 0, m_originalCasterGUID); } @@ -2957,7 +2957,7 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx) return; } - DEBUG_LOG("Spell: Aura is: %u", m_spellInfo->EffectApplyAuraName[eff_idx]); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell: Aura is: %u", m_spellInfo->EffectApplyAuraName[eff_idx]); Aura* Aur = CreateAura(m_spellInfo, eff_idx, &m_currentBasePoints[eff_idx], unitTarget, caster, m_CastItem); @@ -3052,7 +3052,7 @@ void Spell::EffectSendEvent(SpellEffectIndex effectIndex) /* we do not handle a flag dropping or clicking on flag in battleground by sendevent system */ - DEBUG_LOG("Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->EffectMiscValue[effectIndex], m_spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->EffectMiscValue[effectIndex], m_spellInfo->Id); m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->EffectMiscValue[effectIndex], m_caster, focusObject); } @@ -3245,7 +3245,7 @@ void Spell::EffectHealthLeech(SpellEffectIndex eff_idx) if (damage < 0) return; - DEBUG_LOG("HealthLeech :%i", damage); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "HealthLeech :%i", damage); uint32 curHealth = unitTarget->GetHealth(); damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage ); @@ -4447,7 +4447,7 @@ void Spell::EffectAddHonor(SpellEffectIndex /*eff_idx*/) if (m_CastItem) { ((Player*)unitTarget)->RewardHonor(NULL, 1, float(damage / 10)); - DEBUG_LOG("SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),((Player*)unitTarget)->GetGUIDLow()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),((Player*)unitTarget)->GetGUIDLow()); return; } @@ -4456,7 +4456,7 @@ void Spell::EffectAddHonor(SpellEffectIndex /*eff_idx*/) { float honor_reward = MaNGOS::Honor::hk_honor_at_level(unitTarget->getLevel(), damage); ((Player*)unitTarget)->RewardHonor(NULL, 1, honor_reward); - DEBUG_LOG("SpellEffect::AddHonor (spell_id %u) rewards %f honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "SpellEffect::AddHonor (spell_id %u) rewards %f honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow()); } else { @@ -6346,7 +6346,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget) return; - DEBUG_LOG("Spell ScriptStart spellid %u in EffectScriptEffect ", m_spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell ScriptStart spellid %u in EffectScriptEffect ", m_spellInfo->Id); m_caster->GetMap()->ScriptsStart(sSpellScripts, m_spellInfo->Id, m_caster, unitTarget); } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index e3186a3bc..86ca9c7ba 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -535,7 +535,7 @@ void WorldSession::HandleTotemDestroyed( WorldPacket& recvPacket) void WorldSession::HandleSelfResOpcode( WorldPacket & /*recv_data*/ ) { - DEBUG_LOG("WORLD: CMSG_SELF_RES"); // empty opcode + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: CMSG_SELF_RES"); // empty opcode if(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)) { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9c8ed0b9d..cdd19e222 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -578,10 +578,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa return damage; } - DEBUG_LOG("DealDamageStart"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageStart"); uint32 health = pVictim->GetHealth(); - DETAIL_LOG("deal dmg:%d to health:%d ",damage,health); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"deal dmg:%d to health:%d ",damage,health); // duel ends when player has 1 or less hp bool duel_hasEnded = false; @@ -663,7 +663,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (health <= damage) { - DEBUG_LOG("DealDamage: victim just died"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamage: victim just died"); // find player: owner of controlled `this` or `this` itself maybe // for loot will be sued only if group_tap==NULL @@ -719,7 +719,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa player_tap->RewardSinglePlayerAtKill(pVictim); } - DEBUG_LOG("DealDamageAttackStop"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageAttackStop"); // stop combat pVictim->CombatStop(); @@ -743,11 +743,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } } - DEBUG_LOG("SET JUST_DIED"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"SET JUST_DIED"); if(!spiritOfRedemtionTalentReady) pVictim->setDeathState(JUST_DIED); - DEBUG_LOG("DealDamageHealth1"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageHealth1"); if(spiritOfRedemtionTalentReady) { @@ -802,7 +802,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } else // creature died { - DEBUG_LOG("DealDamageNotPlayer"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageNotPlayer"); Creature *cVictim = (Creature*)pVictim; if(!cVictim->isPet()) @@ -889,7 +889,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } else // if (health <= damage) { - DEBUG_LOG("DealDamageAlive"); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageAlive"); if (pVictim->GetTypeId() == TYPEID_PLAYER) ((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); @@ -1053,7 +1053,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } } - DEBUG_LOG("DealDamageEnd returned %d damage", damage); + DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE,"DealDamageEnd returned %d damage", damage); return damage; } @@ -1087,7 +1087,7 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, } if (castItem) - DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); if(originalCaster.IsEmpty() && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); @@ -1122,7 +1122,7 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 cons } if (castItem) - DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); if(originalCaster.IsEmpty() && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); @@ -1168,7 +1168,7 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, boo } if (castItem) - DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); if(originalCaster.IsEmpty() && triggeredByAura) originalCaster = triggeredByAura->GetCasterGUID(); @@ -1294,7 +1294,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID); if (spellProto == NULL) { - DEBUG_LOG("Unit::DealSpellDamage have wrong damageInfo->SpellID: %u", damageInfo->SpellID); + sLog.outError("Unit::DealSpellDamage have wrong damageInfo->SpellID: %u", damageInfo->SpellID); return; } @@ -2401,10 +2401,10 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex DealMeleeDamage(&damageInfo,true); if (GetTypeId() == TYPEID_PLAYER) - DEBUG_LOG("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT,"AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); else - DEBUG_LOG("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT,"AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); // if damage pVictim call AI reaction @@ -2439,7 +2439,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT float parry_chance = pVictim->GetUnitParryChance(); // Useful if want to specify crit & miss chances for melee, else it could be removed - DEBUG_LOG("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance,crit_chance,dodge_chance,parry_chance,block_chance); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT,"MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance,crit_chance,dodge_chance,parry_chance,block_chance); return RollMeleeOutcomeAgainst(pVictim, attType, int32(crit_chance*100), int32(miss_chance*100), int32(dodge_chance*100),int32(parry_chance*100),int32(block_chance*100)); } @@ -2460,22 +2460,22 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack int32 sum = 0, tmp = 0; int32 roll = urand (0, 10000); - DEBUG_LOG ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); - DEBUG_LOG ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance); tmp = miss_chance; if (tmp > 0 && roll < (sum += tmp )) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: MISS"); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: MISS"); return MELEE_HIT_MISS; } // always crit against a sitting target (except 0 crit chance) if( pVictim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !pVictim->IsStandState() ) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT (sitting victim)"); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRIT (sitting victim)"); return MELEE_HIT_CRIT; } @@ -2484,7 +2484,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack // only players can't dodge if attacker is behind if (pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->HasInArc(M_PI_F,this)) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); } else { @@ -2502,7 +2502,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack && ((tmp -= skillBonus) > 0) && roll < (sum += tmp)) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum); return MELEE_HIT_DODGE; } } @@ -2512,7 +2512,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack // check if attack comes from behind, nobody can parry or block if attacker is behind if (!pVictim->HasInArc(M_PI_F,this)) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: attack came from behind."); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: attack came from behind."); } else { @@ -2529,7 +2529,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack && ((tmp2 -= skillBonus) > 0) && (roll < (sum += tmp2))) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); return MELEE_HIT_PARRY; } } @@ -2541,7 +2541,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack && ((tmp -= skillBonus) > 0) && (roll < (sum += tmp))) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum); return MELEE_HIT_BLOCK; } } @@ -2552,7 +2552,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack if (tmp > 0 && roll < (sum += tmp)) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); return MELEE_HIT_CRIT; } @@ -2571,7 +2571,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack tmp = tmp > 4000 ? 4000 : tmp; if (roll < (sum += tmp)) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum); return MELEE_HIT_GLANCING; } } @@ -2596,13 +2596,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack tmp = tmp * 200 - 1500; if (roll < (sum += tmp)) { - DEBUG_LOG ("RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum); return MELEE_HIT_CRUSHING; } } } - DEBUG_LOG ("RollMeleeOutcomeAgainst: NORMAL"); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: NORMAL"); return MELEE_HIT_NORMAL; } @@ -2683,7 +2683,7 @@ void Unit::SendMeleeAttackStop(Unit* victim) data << victim->GetPackGUID(); // can be 0x00... data << uint32(0); // can be 0x1 SendMessageToSet(&data, true); - DETAIL_LOG("%s %u stopped attacking %s %u", (GetTypeId()==TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId()==TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow()); + DETAIL_FILTER_LOG(LOG_FILTER_COMBAT, "%s %u stopped attacking %s %u", (GetTypeId()==TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId()==TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow()); /*if(victim->GetTypeId() == TYPEID_UNIT) ((Creature*)victim)->AI().EnterEvadeMode(this);*/ @@ -3946,7 +3946,7 @@ bool Unit::AddAura(Aura *Aur) } Aur->ApplyModifier(true,true); - DEBUG_LOG("Aura %u now is in use", aurName); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura %u now is in use", aurName); // if aura deleted before boosts apply ignore // this can be possible it it removed indirectly by triggered spell effect at ApplyModifier @@ -4500,7 +4500,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) statue = ((Totem*)caster); - DEBUG_LOG("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode); // some auras also need to apply modifier (on caster) on remove if (mode != AURA_REMOVE_BY_DELETE || Aur->GetModifier()->m_auraname == SPELL_AURA_MOD_POSSESS) @@ -4582,7 +4582,7 @@ void Unit::DelayAura(uint32 spellId, SpellEffectIndex effindex, int32 delaytime) else iter->second->SetAuraDuration(iter->second->GetAuraDuration() - delaytime); iter->second->SendAuraUpdate(false); - DEBUG_LOG("Aura %u partially interrupted on unit %u, new duration: %u ms",iter->second->GetModifier()->m_auraname, GetGUIDLow(), iter->second->GetAuraDuration()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura %u partially interrupted on unit %u, new duration: %u ms",iter->second->GetModifier()->m_auraname, GetGUIDLow(), iter->second->GetAuraDuration()); } } @@ -4907,7 +4907,7 @@ void Unit::SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo) void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) { - DEBUG_LOG("WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); uint32 count = 1; WorldPacket data(SMSG_ATTACKERSTATEUPDATE, 16 + 45); // we guess size @@ -12591,7 +12591,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag { case SPELL_AURA_PROC_TRIGGER_SPELL: { - DEBUG_LOG("ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); // Don`t drop charge or add cooldown for not started trigger if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) { @@ -12602,7 +12602,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag } case SPELL_AURA_PROC_TRIGGER_DAMAGE: { - DEBUG_LOG("ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", auraModifier->m_amount, spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", auraModifier->m_amount, spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, spellInfo->SchoolMask); CalculateSpellDamage(&damageInfo, auraModifier->m_amount, spellInfo); damageInfo.target->CalculateAbsorbResistBlock(this, &damageInfo, spellInfo); @@ -12617,7 +12617,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag case SPELL_AURA_ADD_PCT_MODIFIER: case SPELL_AURA_DUMMY: { - DEBUG_LOG("ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleDummyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) { triggeredByAura->SetInUse(false); @@ -12627,7 +12627,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag } case SPELL_AURA_MOD_HASTE: { - DEBUG_LOG("ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleHasteAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) { triggeredByAura->SetInUse(false); @@ -12637,7 +12637,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag } case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS: { - DEBUG_LOG("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleOverrideClassScriptAuraProc(pTarget, damage, triggeredByAura, procSpell, cooldown)) { triggeredByAura->SetInUse(false); @@ -12647,7 +12647,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag } case SPELL_AURA_PRAYER_OF_MENDING: { - DEBUG_LOG("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId()); HandleMendingAuraProc(triggeredByAura); @@ -12655,7 +12655,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag } case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE: { - DEBUG_LOG("ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) { @@ -12721,7 +12721,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag triggeredByAura->SetInUse(false); continue; } - DEBUG_LOG("ProcDamageAndSpell: casting spell id %u (triggered by %s spell crit chance aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell id %u (triggered by %s spell crit chance aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (!HandleSpellCritChanceAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) { triggeredByAura->SetInUse(false); @@ -12729,7 +12729,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag } break; case SPELL_AURA_MAELSTROM_WEAPON: - DEBUG_LOG("ProcDamageAndSpell: casting spell id %u (triggered by %s maelstrom aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: casting spell id %u (triggered by %s maelstrom aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); // remove all stack; RemoveSpellsCausingAura(SPELL_AURA_MAELSTROM_WEAPON); @@ -13703,7 +13703,7 @@ void Unit::SendThreatUpdate() ThreatList const& tlist = getThreatManager().getThreatList(); if (uint32 count = tlist.size()) { - DEBUG_LOG( "WORLD: Send SMSG_THREAT_UPDATE Message" ); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_THREAT_UPDATE Message"); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); data << GetPackGUID(); data << uint32(count); @@ -13721,7 +13721,7 @@ void Unit::SendHighestThreatUpdate(HostileReference* pHostilReference) ThreatList const& tlist = getThreatManager().getThreatList(); if (uint32 count = tlist.size()) { - DEBUG_LOG( "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message" ); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); data << GetPackGUID(); data.appendPackGUID(pHostilReference->getUnitGuid()); @@ -13737,7 +13737,7 @@ void Unit::SendHighestThreatUpdate(HostileReference* pHostilReference) void Unit::SendThreatClear() { - DEBUG_LOG( "WORLD: Send SMSG_THREAT_CLEAR Message" ); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_THREAT_CLEAR Message"); WorldPacket data(SMSG_THREAT_CLEAR, 8); data << GetPackGUID(); SendMessageToSet(&data, false); @@ -13745,7 +13745,7 @@ void Unit::SendThreatClear() void Unit::SendThreatRemove(HostileReference* pHostileReference) { - DEBUG_LOG( "WORLD: Send SMSG_THREAT_REMOVE Message" ); + DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Send SMSG_THREAT_REMOVE Message"); WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); data << GetPackGUID(); data.appendPackGUID(pHostileReference->getUnitGuid()); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index b0e66de69..f61fb7b54 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -255,6 +255,9 @@ CleanCharacterDB = 1 # LogFilter_SQLText # LogFilter_AIAndMovegens # LogFilter_PlayerStats +# LogFilter_Damage +# LogFilter_Combat +# LogFilter_SpellCast # Log filters (disabled by default, mostly debug only output affected cases) # Default: 0 - include in log if log level permit # 1 - not include with any log level diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index d2ca99ac5..e89ee6b32 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -44,6 +44,9 @@ LogFilterData logFilterData[LOG_FILTER_COUNT] = { "player_moves", "LogFilter_PlayerMoves", false }, { "periodic_effects", "LogFilter_PeriodicAffects", false }, { "ai_and_movegens", "LogFilter_AIAndMovegens", false }, + { "damage", "LogFilter_Damage", false }, + { "combat", "LogFilter_Combat", false }, + { "spell_cast", "LogFilter_SpellCast", false }, }; enum LogType diff --git a/src/shared/Log.h b/src/shared/Log.h index d4ece2149..44dca6220 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -46,9 +46,12 @@ enum LogFilters LOG_FILTER_PLAYER_MOVES = 0x0080, // player moves by grid/cell LOG_FILTER_PERIODIC_AFFECTS = 0x0100, // DoT/HoT apply trace LOG_FILTER_AI_AND_MOVEGENSS = 0x0200, // DoT/HoT apply trace + LOG_FILTER_DAMAGE = 0x0400, // Direct/Area damage trace + LOG_FILTER_COMBAT = 0x0800, // attack states/roll attack results/etc + LOG_FILTER_SPELL_CAST = 0x1000, // spell cast/aura apply/spell proc events }; -#define LOG_FILTER_COUNT 10 +#define LOG_FILTER_COUNT 13 struct LogFilterData { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cc191d757..88829c20e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9924" + #define REVISION_NR "9925" #endif // __REVISION_NR_H__ From 611b53fab86ab93d06c2a7e00cc3377342fcba98 Mon Sep 17 00:00:00 2001 From: zergtmn Date: Tue, 18 May 2010 14:18:45 +0400 Subject: [PATCH 054/172] [9926] Typos in Unit::DealDamageMods Can be source very strange damage/absorb and any near stored/calculated in memory values. and crashes also. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index cdd19e222..5caee7242 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -495,7 +495,7 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb) if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) { if(absorb) - absorb += damage; + *absorb += damage; damage = 0; return; } @@ -508,7 +508,7 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb) if(area && area->flags & AREA_FLAG_SANCTUARY) //sanctuary { if(absorb) - absorb += damage; + *absorb += damage; damage = 0; } } @@ -523,7 +523,7 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb) ((Creature *)pVictim)->AI()->DamageTaken(this, damage); if(absorb && originalDamage > damage) - absorb += (originalDamage - damage); + *absorb += (originalDamage - damage); } uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 88829c20e..c53d0fb0d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9925" + #define REVISION_NR "9926" #endif // __REVISION_NR_H__ From d5c7e7b7d2301b1f08aec4c78d0f028d1d9991ca Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 18 May 2010 15:36:09 +0400 Subject: [PATCH 055/172] [9927] Support new raid allowed quest types. --- src/game/Player.cpp | 7 +++---- src/game/QuestDef.h | 1 + src/game/QuestHandler.cpp | 2 +- src/shared/revision_nr.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7eaf696e6..24790d47f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14271,7 +14271,7 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid ) continue; // just if !ingroup || !noraidgroup || raidgroup QuestStatusData& q_status = mQuestStatus[questid]; - if( q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->GetType() == QUEST_TYPE_RAID)) + if( q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()) { if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST) ) { @@ -14514,8 +14514,7 @@ bool Player::HasQuestForItem( uint32 itemid ) const continue; // hide quest if player is in raid-group and quest is no raid quest - if (GetGroup() && GetGroup()->isRaidGroup() && qinfo->GetType() != QUEST_TYPE_RAID - && !InBattleGround()) + if (GetGroup() && GetGroup()->isRaidGroup() && qinfo->IsAllowedInRaid() && !InBattleGround()) continue; // There should be no mixed ReqItem/ReqSource drop @@ -19805,7 +19804,7 @@ bool Player::HasQuestForGO(int32 GOId) const if(!qinfo) continue; - if(GetGroup() && GetGroup()->isRaidGroup() && qinfo->GetType() != QUEST_TYPE_RAID) + if(GetGroup() && GetGroup()->isRaidGroup() && qinfo->IsAllowedInRaid()) continue; for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 0fe16eec7..8639f9c52 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -242,6 +242,7 @@ class Quest bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; } bool IsDailyOrWeekly() const { return QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); } bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; } + bool IsAllowedInRaid() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25; } // multiple values std::string ObjectiveText[QUEST_OBJECTIVES_COUNT]; diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index d4fccd995..7520775c1 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -408,7 +408,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data) if (!pOriginalPlayer) return; - if (pQuest->GetType() == QUEST_TYPE_RAID) + if (pQuest->IsAllowedInRaid()) { if (!_player->IsInSameRaidWith(pOriginalPlayer)) return; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c53d0fb0d..47686f5f6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9926" + #define REVISION_NR "9927" #endif // __REVISION_NR_H__ From a457f35b2119ce96bddfacac2cc37ce11c8a325b Mon Sep 17 00:00:00 2001 From: bloutix Date: Wed, 19 May 2010 01:20:56 +0400 Subject: [PATCH 056/172] [9928] Fix build... Signed-off-by: VladimirMangos --- src/game/Player.cpp | 20 +++++++++++--------- src/shared/revision_nr.h | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 24790d47f..724dd5e34 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14267,38 +14267,40 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid ) continue; Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); - if( !qInfo ) + if (!qInfo) continue; // just if !ingroup || !noraidgroup || raidgroup QuestStatusData& q_status = mQuestStatus[questid]; - if( q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()) + if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid())) { - if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST) ) + if (qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST)) { for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip GO activate objective or none - if(qInfo->ReqCreatureOrGOId[j] <=0) + if (qInfo->ReqCreatureOrGOId[j] <=0) continue; // skip Cast at creature objective - if(qInfo->ReqSpell[j] !=0 ) + if (qInfo->ReqSpell[j] !=0 ) continue; uint32 reqkill = qInfo->ReqCreatureOrGOId[j]; - if ( reqkill == entry ) + if (reqkill == entry) { uint32 reqkillcount = qInfo->ReqCreatureOrGOCount[j]; uint32 curkillcount = q_status.m_creatureOrGOcount[j]; - if ( curkillcount < reqkillcount ) + if (curkillcount < reqkillcount) { q_status.m_creatureOrGOcount[j] = curkillcount + addkillcount; - if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED; + if (q_status.uState != QUEST_NEW) + q_status.uState = QUEST_CHANGED; SendQuestUpdateAddCreatureOrGo( qInfo, guid, j, curkillcount, addkillcount); } - if ( CanCompleteQuest( questid ) ) + + if (CanCompleteQuest( questid )) CompleteQuest( questid ); // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization). diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 47686f5f6..9ff3e1cae 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9927" + #define REVISION_NR "9928" #endif // __REVISION_NR_H__ From 54c2da8d53de09659f69037c316aa75880a2ea1e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 19 May 2010 02:26:13 +0400 Subject: [PATCH 057/172] [9929] Move apply spell coeffs and level penalties code to new function. * No reson have 6 copies near to exactly same code. * This fix problem with apply attack power bonus in some case. Thanks to Wowka321 for find and reseach problem. --- src/game/Unit.cpp | 226 +++++++++------------------------------ src/game/Unit.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 53 insertions(+), 176 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5caee7242..812e22013 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8880,6 +8880,45 @@ void Unit::EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers pVictim->ModifyPower(powertype, Damage); } +int32 Unit::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart, float defCoeffMod) +{ + // Distribute Damage over multiple effects, reduce by AoE + float coeff; + + // Not apply this to creature casted spells + if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) + coeff = 1.0f; + // Check for table values + else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) + { + coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; + + // apply ap bonus at done part calculation only (it flat total mod so common with taken) + if (donePart && bonus->ap_bonus) + total += int32(bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + ap_benefit)); + } + // Default calculation + else if (benefit) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * defCoeffMod; + + if (benefit) + { + float LvlPenalty = CalculateLevelPenalty(spellProto); + + // Spellmod SpellDamage + if(Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); + coeff /= 100.0f; + } + + total += int32(benefit * coeff * LvlPenalty); + } + + return total; +}; + /** * Calculates caster part of spell damage bonuses, * also includes different bonuses dependent from target auras @@ -9175,38 +9214,8 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) DoneAdvertisedBenefit += ((Pet*)this)->GetBonusDamage(); - if (DoneAdvertisedBenefit) - { - float LvlPenalty = CalculateLevelPenalty(spellProto); - - // Distribute Damage over multiple effects, reduce by AoE - float coeff; - - // Not apply this to creature casted spells - if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) - coeff = 1.0f; - // Check for table values - else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) - { - coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - - if (bonus->ap_bonus) - DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK)); - } - // Default calculation - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype); - - // Spellmod SpellDamage - if(Player* modOwner = GetSpellModOwner()) - { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); - coeff /= 100.0f; - } - - DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty); - } + // apply ap bonus and benefit affected by spell power implicit coeffs and spell level penalties + DoneTotal = SpellBonusWithCoeffs(spellProto, DoneTotal, DoneAdvertisedBenefit, 0, damagetype, true); float tmpDamage = (int32(pdamage) + DoneTotal * int32(stack)) * DoneTotalMod; // apply spellmod to Done damage (flat and pct) @@ -9272,33 +9281,8 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto, // Taken fixed damage bonus auras int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(GetSpellSchoolMask(spellProto)); - if (TakenAdvertisedBenefit) - { - float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - - // Distribute Damage over multiple effects, reduce by AoE - float coeff; - - // Not apply this to creature casted spells - if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) - coeff = 1.0f; - // Check for table values - else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) - coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - // Default calculation - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype); - - // Spellmod SpellDamage - if(Player* modOwner = pCaster->GetSpellModOwner()) - { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); - coeff /= 100.0f; - } - - TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty); - } + // apply benefit affected by spell power implicit coeffs and spell level penalties + TakenTotal = SpellBonusWithCoeffs(spellProto, TakenTotal, TakenAdvertisedBenefit, 0, damagetype, false); float tmpDamage = (int32(pdamage) + TakenTotal * int32(stack)) * TakenTotalMod; @@ -9698,38 +9682,8 @@ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, // Done fixed damage bonus auras int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(GetSpellSchoolMask(spellProto)); - if (DoneAdvertisedBenefit) - { - float LvlPenalty = CalculateLevelPenalty(spellProto); - - // Distribute Damage over multiple effects, reduce by AoE - float coeff; - - // Not apply this to creature casted spells - if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) - coeff = 1.0f; - // Check for table values - else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) - { - coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - - if (bonus->ap_bonus) - DoneTotal += int32(bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK)); - } - // Default calculation - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype) * 1.88f; - - // Spellmod SpellDamage - if(Player* modOwner = GetSpellModOwner()) - { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); - coeff /= 100.0f; - } - - DoneTotal += int32(DoneAdvertisedBenefit * coeff * LvlPenalty); - } + // apply ap bonus and benefit affected by spell power implicit coeffs and spell level penalties + DoneTotal = SpellBonusWithCoeffs(spellProto, DoneTotal, DoneAdvertisedBenefit, 0, damagetype, true, 1.88f); // use float as more appropriate for negative values and percent applying float heal = (healamount + DoneTotal * int32(stack))*DoneTotalMod; @@ -9771,33 +9725,8 @@ uint32 Unit::SpellHealingBonusTaken(Unit *pCaster, SpellEntry const *spellProto, // Taken fixed damage bonus auras int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(GetSpellSchoolMask(spellProto)); - if (TakenAdvertisedBenefit) - { - float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - - // Distribute Damage over multiple effects, reduce by AoE - float coeff; - - // Not apply this to creature casted spells - if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) - coeff = 1.0f; - // Check for table values - else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) - coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - // Default calculation - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype) * 1.88f; - - // Spellmod SpellDamage - if(Player* modOwner = pCaster->GetSpellModOwner()) - { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); - coeff /= 100.0f; - } - - TakenTotal += int32(TakenAdvertisedBenefit * coeff * LvlPenalty); - } + // apply benefit affected by spell power implicit coeffs and spell level penalties + TakenTotal = SpellBonusWithCoeffs(spellProto, TakenTotal, TakenAdvertisedBenefit, 0, damagetype, false, 1.88f); AuraList const& mHealingGet= GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); for(AuraList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) @@ -10178,35 +10107,8 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType // scaling of non weapon based spells if (!isWeaponDamageBasedSpell) { - float LvlPenalty = CalculateLevelPenalty(spellProto); - - // Distribute Damage over multiple effects, reduce by AoE - float coeff = 0.0f; - - // Not apply this to creature casted spells - if (GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet()) - coeff = 1.0f; - // Check for table values - else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) - { - coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - - if (bonus->ap_bonus) - DoneTotal += bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + APbonus); - } - // Default calculation - else if (DoneFlat) - coeff = CalculateDefaultCoefficient(spellProto, damagetype); - - // Spellmod SpellDamage - if(Player* modOwner = GetSpellModOwner()) - { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); - coeff /= 100.0f; - } - - DoneTotal += DoneFlat * coeff * LvlPenalty; + // apply ap bonus and benefit affected by spell power implicit coeffs and spell level penalties + DoneTotal = SpellBonusWithCoeffs(spellProto, DoneTotal, DoneFlat, APbonus, damagetype, true); } // weapon damage based spells else if( APbonus || DoneFlat ) @@ -10332,34 +10234,8 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp // scaling of non weapon based spells if (!isWeaponDamageBasedSpell) { - - if (TakenFlat) - { - float LvlPenalty = pCaster->CalculateLevelPenalty(spellProto); - - // Distribute Damage over multiple effects, reduce by AoE - float coeff; - - // Not apply this to creature casted spells - if (pCaster->GetTypeId()==TYPEID_UNIT && !((Creature*)pCaster)->isPet()) - coeff = 1.0f; - // Check for table values - else if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) - coeff = damagetype == DOT ? bonus->dot_damage : bonus->direct_damage; - // Default calculation - else if (TakenFlat) - coeff = CalculateDefaultCoefficient(spellProto, damagetype); - - // Spellmod SpellDamage - if(Player* modOwner = pCaster->GetSpellModOwner()) - { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_SPELL_BONUS_DAMAGE, coeff); - coeff /= 100.0f; - } - - TakenFlat *= coeff * LvlPenalty; - } + // apply benefit affected by spell power implicit coeffs and spell level penalties + TakenFlat = SpellBonusWithCoeffs(spellProto, 0, TakenFlat, 0, damagetype, false); } float tmpDamage = float(int32(pdamage) + TakenFlat * int32(stack)) * TakenPercent; diff --git a/src/game/Unit.h b/src/game/Unit.h index b516aae77..8555d5f75 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1709,6 +1709,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void UnsummonAllTotems(); Unit* SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo = NULL); + int32 SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart, float defCoeffMod = 1.0f); int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask); uint32 SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9ff3e1cae..94855bacf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9928" + #define REVISION_NR "9929" #endif // __REVISION_NR_H__ From adb09fd0f4ed3afbfc434df7ddf96d1cc0ac654c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 19 May 2010 04:28:48 +0400 Subject: [PATCH 058/172] [9930] Move enum QuestTypes to QuestDef.h where it only used. This is also fix build at GCC --- src/game/QuestDef.h | 16 ++++++++++++++++ src/game/SharedDefines.h | 16 ---------------- src/shared/revision_nr.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 8639f9c52..89abf8754 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -118,6 +118,22 @@ enum __QuestGiverStatus DIALOG_STATUS_REWARD = 10 // yellow dot on minimap }; +// values based at QuestInfo.dbc +enum QuestTypes +{ + QUEST_TYPE_ELITE = 1, + QUEST_TYPE_LIFE = 21, + QUEST_TYPE_PVP = 41, + QUEST_TYPE_RAID = 62, + QUEST_TYPE_DUNGEON = 81, + QUEST_TYPE_WORLD_EVENT = 82, + QUEST_TYPE_LEGENDARY = 83, + QUEST_TYPE_ESCORT = 84, + QUEST_TYPE_HEROIC = 85, + QUEST_TYPE_RAID_10 = 88, + QUEST_TYPE_RAID_25 = 89 +}; + enum __QuestFlags { // Flags used at server and sent to client diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index db9d17228..86e05e5e4 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1980,22 +1980,6 @@ enum HolidayIds HOLIDAY_CALL_TO_ARMS_ISLE_OF_C = 420 }; -// values based at QuestInfo.dbc -enum QuestTypes -{ - QUEST_TYPE_ELITE = 1, - QUEST_TYPE_LIFE = 21, - QUEST_TYPE_PVP = 41, - QUEST_TYPE_RAID = 62, - QUEST_TYPE_DUNGEON = 81, - QUEST_TYPE_WORLD_EVENT = 82, - QUEST_TYPE_LEGENDARY = 83, - QUEST_TYPE_ESCORT = 84, - QUEST_TYPE_HEROIC = 85, - QUEST_TYPE_RAID_10 = 88, - QUEST_TYPE_RAID_25 = 89 -}; - // values based at QuestSort.dbc enum QuestSort { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 94855bacf..6dc580d81 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9929" + #define REVISION_NR "9930" #endif // __REVISION_NR_H__ From b33dabea680d0f1a2d0ef459b334605f9a9a57e0 Mon Sep 17 00:00:00 2001 From: The_Game_Master Date: Wed, 19 May 2010 04:40:30 +0400 Subject: [PATCH 059/172] [9931] After 3.2.0 expected AllowTwoSide.Accounts = 1 for any realm type by default. Signed-off-by: VladimirMangos --- src/mangosd/mangosd.conf.dist.in | 6 +++--- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index f61fb7b54..ec88cfd8e 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -750,8 +750,8 @@ Motd = "Welcome to the Massive Network Game Object Server." # # AllowTwoSide.Accounts # Allow or not accounts to create characters in the 2 teams in any game type. -# Default: 0 (Not allowed) -# 1 (Allowed) +# 0 (Not allowed) +# Default: 1 (Allowed) # # AllowTwoSide.Interaction.Chat # AllowTwoSide.Interaction.Channel @@ -782,7 +782,7 @@ Motd = "Welcome to the Massive Network Game Object Server." # ################################################################################################################### -AllowTwoSide.Accounts = 0 +AllowTwoSide.Accounts = 1 AllowTwoSide.Interaction.Chat = 0 AllowTwoSide.Interaction.Channel = 0 AllowTwoSide.Interaction.Group = 0 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6dc580d81..782565947 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9930" + #define REVISION_NR "9931" #endif // __REVISION_NR_H__ From 49751e40f99fdb6fe1f13ed2aa1802eb7224bd8a Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 19 May 2010 04:43:51 +0400 Subject: [PATCH 060/172] [9932] Change AllowTwoSide.Accounts default in code also. And update config version. Also note: it not has been propertly updated in prev. time when config version in .conf.in changed. It must be sync changed in *.conf.in and in SystemConfig.h.in --- src/game/World.cpp | 2 +- src/mangosd/mangosd.conf.dist.in | 2 +- src/shared/SystemConfig.h.in | 2 +- src/shared/revision_nr.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/World.cpp b/src/game/World.cpp index 40e73595c..9d4d78735 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -541,7 +541,7 @@ void World::LoadConfigSettings(bool reload) if (configNoReload(reload, CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT)) setConfig(CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT); - setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ACCOUNTS, "AllowTwoSide.Accounts", false); + setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ACCOUNTS, "AllowTwoSide.Accounts", true); setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT, "AllowTwoSide.Interaction.Chat", false); setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL, "AllowTwoSide.Interaction.Channel", false); setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP, "AllowTwoSide.Interaction.Group", false); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index ec88cfd8e..f9088e304 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -1,7 +1,7 @@ ##################################### # MaNGOS Configuration file # ##################################### -ConfVersion=2010040601 +ConfVersion=2010051901 ################################################################################################################### # CONNECTIONS AND DIRECTORIES diff --git a/src/shared/SystemConfig.h.in b/src/shared/SystemConfig.h.in index 85d5f87d8..57f7e0b89 100644 --- a/src/shared/SystemConfig.h.in +++ b/src/shared/SystemConfig.h.in @@ -36,7 +36,7 @@ // Format is YYYYMMDDRR where RR is the change in the conf file // for that day. #ifndef _MANGOSDCONFVERSION -# define _MANGOSDCONFVERSION 2008022901 +# define _MANGOSDCONFVERSION 2010051901 #endif #ifndef _REALMDCONFVERSION # define _REALMDCONFVERSION 2007062001 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 782565947..cc43fadcc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9931" + #define REVISION_NR "9932" #endif // __REVISION_NR_H__ From cad8693819d8a95b5909ea6e4af1baae147f3f1d Mon Sep 17 00:00:00 2001 From: zergtmn Date: Wed, 19 May 2010 05:14:22 +0400 Subject: [PATCH 061/172] [9933] Call DealDamageMods for leech DoTs damage Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 68f0b6b5e..f13857fc3 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -7233,6 +7233,8 @@ void Aura::PeriodicTick() DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); + pCaster->DealDamageMods(m_target, pdamage, &absorb); + pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0, isCrit); float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()] > 0 ? GetSpellProto()->EffectMultipleValue[GetEffIndex()] : 1; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cc43fadcc..622ba1f05 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9932" + #define REVISION_NR "9933" #endif // __REVISION_NR_H__ From d4f1b510aef9070f225b1dde72a1a5b1de1c86a5 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 19 May 2010 14:40:20 +0400 Subject: [PATCH 062/172] [9934] Skinning related fixes * Show skinning tooltip only after creature loot (when creature can be explcitly skinned). * Allow reopen skinning loot if still have not looted items. --- src/game/Creature.cpp | 37 +++++++++++++++++++++++++++++++++---- src/game/Creature.h | 2 ++ src/game/LootHandler.cpp | 7 +++---- src/game/Player.cpp | 12 ++++++++++-- src/game/Spell.cpp | 2 +- src/game/Unit.cpp | 9 ++------- src/shared/revision_nr.h | 2 +- 7 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 14d473e50..a8dba28db 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -370,6 +370,7 @@ void Creature::Update(uint32 diff) m_respawnTime = 0; lootForPickPocketed = false; lootForBody = false; + lootForSkin = false; if(m_originalEntry != GetEntry()) UpdateEntry(m_originalEntry); @@ -810,6 +811,38 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, Splin SendMonsterMove(x, y, z, type, flags, time); } +void Creature::PrepareBodyLootState() +{ + loot.clear(); + + // if have normal loot then prepare it access + if (!isAlive() && GetCreatureInfo()->lootid && !lootForBody) + { + SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + return; + } + + // if not have normal loot allow skinning if need + if (!isAlive() && !lootForSkin) + { + lootForBody = true; // pass this loot mode + + if (GetCreatureInfo()->SkinLootId) + { + if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) + { + RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + return; + } + } + } + + RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); +} + + /** * Return original player who tap creature, it can be different from player/group allowed to loot so not use it for loot code */ @@ -1330,10 +1363,6 @@ void Creature::setDeathState(DeathState s) SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - if (!isPet() && GetCreatureInfo()->SkinLootId) - if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - if (canFly() && FallGround()) return; diff --git a/src/game/Creature.h b/src/game/Creature.h index 6369a58bf..3bb0591de 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -531,7 +531,9 @@ class MANGOS_DLL_SPEC Creature : public Unit Loot loot; bool lootForPickPocketed; bool lootForBody; + bool lootForSkin; + void PrepareBodyLootState(); ObjectGuid GetLootRecipientGuid() const { return m_lootRecipientGuid; } uint32 GetLootGroupRecipientId() const { return m_lootGroupRecipientId; } Player* GetLootRecipient() const; // use group cases as prefered diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 1f494841f..61fded607 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -442,12 +442,11 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) if (loot->isLooted()) { - // skip pickpocketing loot for speed, skinning timer redunction is no-op in fact + // for example skinning after normal loot + pCreature->PrepareBodyLootState(); + if(!pCreature->isAlive()) pCreature->AllLootRemovedFromCorpse(); - - pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - loot->clear(); } break; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 724dd5e34..1776d1953 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7886,8 +7886,16 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type) // possible only if creature->lootForBody && loot->empty() at spell cast check if (loot_type == LOOT_SKINNING) { - loot->clear(); - loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, this, false); + if (!creature->lootForSkin) + { + creature->lootForSkin = true; + loot->clear(); + loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, this, false); + + // let reopen skinning loot if will closed. + if (!loot->empty()) + creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } } // set group rights only for loot_type != LOOT_SKINNING else diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6160a6acd..9c8716e1e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4805,7 +4805,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_UNSKINNABLE; Creature* creature = (Creature*)m_targets.getUnitTarget(); - if ( creature->GetCreatureType() != CREATURE_TYPE_CRITTER && ( !creature->lootForBody || !creature->loot.empty() ) ) + if ( creature->GetCreatureType() != CREATURE_TYPE_CRITTER && ( !creature->lootForBody || creature->lootForSkin || !creature->loot.empty() ) ) { return SPELL_FAILED_TARGET_NOT_LOOTED; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 812e22013..55817ca8a 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -566,9 +566,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa pVictim->SetHealth(0); // allow loot only if has loot_id in creature_template - CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo(); - if(cInfo && cInfo->lootid) - pVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + ((Creature*)pVictim)->PrepareBodyLootState(); // some critters required for quests (need normal entry instead possible heroic in any cases) if(GetTypeId() == TYPEID_PLAYER) @@ -809,10 +807,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa { cVictim->DeleteThreatList(); // only lootable if it has loot or can drop gold - if(cVictim->GetCreatureInfo()->lootid || cVictim->GetCreatureInfo()->maxgold > 0) - cVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - else - cVictim->lootForBody = true; // needed for skinning + cVictim->PrepareBodyLootState(); } // Call creature just died function if (cVictim->AI()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 622ba1f05..81e745922 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9933" + #define REVISION_NR "9934" #endif // __REVISION_NR_H__ From 8a1fd9e086739c63b575a8a39022f8909da641b0 Mon Sep 17 00:00:00 2001 From: Derex Date: Wed, 19 May 2010 23:36:08 +0300 Subject: [PATCH 063/172] [9935] ACE realmd, thanks to Zor and Vladimir for windows. --- src/realmd/AuthCodes.h | 15 ++ src/realmd/AuthSocket.cpp | 434 ++++++++++------------------------ src/realmd/AuthSocket.h | 20 +- src/realmd/BufferedSocket.cpp | 265 +++++++++++++++++++++ src/realmd/BufferedSocket.h | 79 +++++++ src/realmd/Main.cpp | 47 ++-- src/realmd/Makefile.am | 9 +- src/realmd/PatchHandler.cpp | 194 +++++++++++++++ src/realmd/PatchHandler.h | 72 ++++++ src/shared/revision_nr.h | 2 +- win/VC100/realmd.vcxproj | 4 + win/VC80/realmd.vcproj | 16 ++ win/VC90/realmd.vcproj | 16 ++ 13 files changed, 835 insertions(+), 338 deletions(-) create mode 100644 src/realmd/BufferedSocket.cpp create mode 100644 src/realmd/BufferedSocket.h create mode 100644 src/realmd/PatchHandler.cpp create mode 100644 src/realmd/PatchHandler.h diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 274123e7b..37e6e8adb 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -23,6 +23,21 @@ #ifndef _AUTHCODES_H #define _AUTHCODES_H +enum eAuthCmd +{ + AUTH_LOGON_CHALLENGE = 0x00, + AUTH_LOGON_PROOF = 0x01, + AUTH_RECONNECT_CHALLENGE = 0x02, + AUTH_RECONNECT_PROOF = 0x03, + //update srv =4 + REALM_LIST = 0x10, + XFER_INITIATE = 0x30, + XFER_DATA = 0x31, + XFER_ACCEPT = 0x32, + XFER_RESUME = 0x33, + XFER_CANCEL = 0x34 +}; + enum AuthResult { WOW_SUCCESS = 0x00, diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 6d2e24746..6ca0fae93 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -27,28 +27,17 @@ #include "RealmList.h" #include "AuthSocket.h" #include "AuthCodes.h" +#include "PatchHandler.h" + #include //#include "Util.h" -- for commented utf8ToUpperOnlyLatin +#include +#include +#include + extern DatabaseType loginDatabase; -#define ChunkSize 2048 - -enum eAuthCmd -{ - AUTH_LOGON_CHALLENGE = 0x00, - AUTH_LOGON_PROOF = 0x01, - AUTH_RECONNECT_CHALLENGE = 0x02, - AUTH_RECONNECT_PROOF = 0x03, - //update srv =4 - REALM_LIST = 0x10, - XFER_INITIATE = 0x30, - XFER_DATA = 0x31, - XFER_ACCEPT = 0x32, - XFER_RESUME = 0x33, - XFER_CANCEL = 0x34 -}; - enum eStatus { STATUS_CONNECTED = 0, @@ -154,13 +143,6 @@ typedef struct XFER_INIT uint8 md5[MD5_DIGEST_LENGTH]; // MD5 }XFER_INIT; -typedef struct XFER_DATA -{ - uint8 opcode; - uint16 data_size; - uint8 data[ChunkSize]; -}XFER_DATA_STRUCT; - typedef struct AuthHandler { eAuthCmd cmd; @@ -175,39 +157,6 @@ typedef struct AuthHandler #pragma pack(pop) #endif -/// Launch a thread to transfer a patch to the client -class PatcherRunnable: public ACE_Based::Runnable -{ - public: - PatcherRunnable(class AuthSocket *); - void run(); - - private: - AuthSocket * mySocket; -}; - -typedef struct PATCH_INFO -{ - uint8 md5[MD5_DIGEST_LENGTH]; -}PATCH_INFO; - -/// Caches MD5 hash of client patches present on the server -class Patcher -{ - public: - typedef std::map Patches; - ~Patcher(); - Patcher(); - Patches::const_iterator begin() const { return _patches.begin(); } - Patches::const_iterator end() const { return _patches.end(); } - void LoadPatchMD5(char*); - bool GetHash(char * pat,uint8 mymd5[16]); - - private: - void LoadPatchesInfo(); - Patches _patches; -}; - const AuthHandler table[] = { { AUTH_LOGON_CHALLENGE, STATUS_CONNECTED, &AuthSocket::_HandleLogonChallenge }, @@ -222,67 +171,58 @@ const AuthHandler table[] = #define AUTH_TOTAL_COMMANDS sizeof(table)/sizeof(AuthHandler) -///Holds the MD5 hash of client patches present on the server -Patcher PatchesCache; - /// Constructor - set the N and g values for SRP6 -AuthSocket::AuthSocket(ISocketHandler &h) : TcpSocket(h) +AuthSocket::AuthSocket() { N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); g.SetDword(7); _authed = false; - pPatch = NULL; _accountSecurityLevel = SEC_PLAYER; _build = 0; + patch_ = ACE_INVALID_HANDLE; } /// Close patch file descriptor before leaving AuthSocket::~AuthSocket() { - ACE_Guard g(patcherLock); - - if(pPatch) - fclose(pPatch); + if(patch_ != ACE_INVALID_HANDLE) + ACE_OS::close(patch_); } /// Accept the connection and set the s random value for SRP6 void AuthSocket::OnAccept() { - BASIC_LOG("Accepting connection from '%s:%d'", - GetRemoteAddress().c_str(), GetRemotePort()); - + BASIC_LOG("Accepting connection from '%s'", get_remote_address().c_str()); } /// Read the packet from the client void AuthSocket::OnRead() { - ///- Read the packet - TcpSocket::OnRead(); uint8 _cmd; while (1) { - if (!ibuf.GetLength()) + if(!recv_soft((char *)&_cmd, 1)) return; - ///- Get the command out of it - ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ??? - size_t i; ///- Circle through known commands and call the correct command handler for (i = 0; i < AUTH_TOTAL_COMMANDS; ++i) { if ((uint8)table[i].cmd == _cmd && - (table[i].status == STATUS_CONNECTED || - (_authed && table[i].status == STATUS_AUTHED))) + (table[i].status == STATUS_CONNECTED || + (_authed && table[i].status == STATUS_AUTHED))) { - DEBUG_LOG("[Auth] got data for cmd %u ibuf length "SIZEFMTD" ", (uint32)_cmd, ibuf.GetLength()); + DEBUG_LOG("[Auth] got data for cmd %u recv length %u", + (uint32)_cmd, (uint32)recv_len()); if (!(*this.*table[i].handler)()) { - DEBUG_LOG("Command handler failed for cmd %u ibuf length "SIZEFMTD" ", (uint32)_cmd, ibuf.GetLength()); + DEBUG_LOG("Command handler failed for cmd %u recv length %u", + (uint32)_cmd, (uint32)recv_len()); + return; } break; @@ -343,7 +283,7 @@ void AuthSocket::SendProof(Sha1Hash sha) proof.error = 0; proof.unk2 = 0x00; - SendBuf((char *)&proof, sizeof(proof)); + send((char *)&proof, sizeof(proof)); break; } case 8606: // 2.4.3 @@ -361,7 +301,7 @@ void AuthSocket::SendProof(Sha1Hash sha) proof.unk2 = 0x00; proof.unk3 = 0x00; - SendBuf((char *)&proof, sizeof(proof)); + send((char *)&proof, sizeof(proof)); break; } } @@ -371,20 +311,20 @@ void AuthSocket::SendProof(Sha1Hash sha) bool AuthSocket::_HandleLogonChallenge() { DEBUG_LOG("Entering _HandleLogonChallenge"); - if (ibuf.GetLength() < sizeof(sAuthLogonChallenge_C)) + if (recv_len() < sizeof(sAuthLogonChallenge_C)) return false; ///- Read the first 4 bytes (header) to get the length of the remaining of the packet std::vector buf; buf.resize(4); - ibuf.Read((char *)&buf[0], 4); + recv((char *)&buf[0], 4); EndianConvert(*((uint16*)(buf[0]))); uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; DEBUG_LOG("[AuthChallenge] got header, body is %#04x bytes", remaining); - if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (ibuf.GetLength() < remaining)) + if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (recv_len() < remaining)) return false; //No big fear of memory outage (size is int16, i.e. < 65536) @@ -393,7 +333,7 @@ bool AuthSocket::_HandleLogonChallenge() sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; ///- Read the remaining of the packet - ibuf.Read((char *)&buf[4], remaining); + recv((char *)&buf[4], remaining); DEBUG_LOG("[AuthChallenge] got full packet, %#04x bytes", ch->size); DEBUG_LOG("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); @@ -425,7 +365,7 @@ bool AuthSocket::_HandleLogonChallenge() ///- Verify that this IP is not in the ip_banned table // No SQL injection possible (paste the IP address as passed by the socket) - std::string address = GetRemoteAddress(); + std::string address = get_remote_address(); loginDatabase.escape_string(address); QueryResult *result = loginDatabase.PQuery("SELECT unbandate FROM ip_banned WHERE " // permanent still banned @@ -433,7 +373,7 @@ bool AuthSocket::_HandleLogonChallenge() if (result) { pkt << (uint8)WOW_FAIL_BANNED; - BASIC_LOG("[AuthChallenge] Banned ip %s tries to login!", GetRemoteAddress().c_str()); + BASIC_LOG("[AuthChallenge] Banned ip %s tries to login!", get_remote_address().c_str()); delete result; } else @@ -449,8 +389,8 @@ bool AuthSocket::_HandleLogonChallenge() if((*result)[2].GetUInt8() == 1) // if ip is locked { DEBUG_LOG("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), (*result)[3].GetString()); - DEBUG_LOG("[AuthChallenge] Player address is '%s'", GetRemoteAddress().c_str()); - if ( strcmp((*result)[3].GetString(),GetRemoteAddress().c_str()) ) + DEBUG_LOG("[AuthChallenge] Player address is '%s'", get_remote_address().c_str()); + if ( strcmp((*result)[3].GetString(),get_remote_address().c_str()) ) { DEBUG_LOG("[AuthChallenge] Account IP differs"); pkt << (uint8) WOW_FAIL_SUSPENDED; @@ -566,7 +506,7 @@ bool AuthSocket::_HandleLogonChallenge() pkt<< (uint8) WOW_FAIL_UNKNOWN_ACCOUNT; } } - SendBuf((char const*)pkt.contents(), pkt.size()); + send((char const*)pkt.contents(), pkt.size()); return true; } @@ -575,10 +515,9 @@ bool AuthSocket::_HandleLogonProof() { DEBUG_LOG("Entering _HandleLogonProof"); ///- Read the packet - if (ibuf.GetLength() < sizeof(sAuthLogonProof_C)) - return false; sAuthLogonProof_C lp; - ibuf.Read((char *)&lp, sizeof(sAuthLogonProof_C)); + if(!recv((char *)&lp, sizeof(sAuthLogonProof_C))) + return false; ///- Check if the client has one of the expected version numbers bool valid_version = FindBuildInfo(_build) != NULL; @@ -586,55 +525,60 @@ bool AuthSocket::_HandleLogonProof() ///
  • If the client has no valid version if(!valid_version) { + if (this->patch_ != ACE_INVALID_HANDLE) + return false; + ///- Check if we have the apropriate patch on the disk + // file looks like: 65535enGB.mpq + char tmp[64]; - // 24 = len("./patches/65535enGB.mpq")+1 - char tmp[24]; - // No buffer overflow (fixed length of arguments) - sprintf(tmp, "./patches/%d%s.mpq", _build, _localizationName.c_str()); - // This will be closed at the destruction of the AuthSocket (client disconnection) - FILE *pFile = fopen(tmp, "rb"); + snprintf(tmp, 24, "./patches/%d%s.mpq", _build, _localizationName.c_str()); - if(!pFile) + char filename[PATH_MAX]; + if (ACE_OS::realpath(tmp, filename) != NULL) { + patch_ = ACE_OS::open(filename, GENERIC_READ | FILE_FLAG_SEQUENTIAL_SCAN); + } + + if (patch_ == ACE_INVALID_HANDLE) + { + // no patch found ByteBuffer pkt; pkt << (uint8) AUTH_LOGON_CHALLENGE; pkt << (uint8) 0x00; pkt << (uint8) WOW_FAIL_VERSION_INVALID; DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build); DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp); - SendBuf((char const*)pkt.contents(), pkt.size()); + send((char const*)pkt.contents(), pkt.size()); return true; } - else // have patch + + XFER_INIT xferh; + + ACE_OFF_T file_size = ACE_OS::filesize(this->patch_); + + if (file_size == -1) { - pPatch = pFile; - XFER_INIT xferh; - - ///- Get the MD5 hash of the patch file (get it from preloaded Patcher cache or calculate it) - if(PatchesCache.GetHash(tmp, (uint8*)&xferh.md5)) - { - DEBUG_LOG("\n[AuthChallenge] Found precached patch info for patch %s", tmp); - } - else - { // calculate patch md5 - printf("\n[AuthChallenge] Patch info for %s was not cached.", tmp); - PatchesCache.LoadPatchMD5(tmp); - PatchesCache.GetHash(tmp, (uint8*)&xferh.md5); - } - - ///- Send a packet to the client with the file length and MD5 hash - uint8 data[2] = { AUTH_LOGON_PROOF, WOW_FAIL_VERSION_UPDATE }; - SendBuf((const char*)data, sizeof(data)); - - memcpy(&xferh, "0\x05Patch", 7); - xferh.cmd = XFER_INITIATE; - fseek(pPatch, 0, SEEK_END); - xferh.file_size = ftell(pPatch); - - SendBuf((const char*)&xferh, sizeof(xferh)); - return true; + close_connection(); + return false; } + + if (!PatchCache::instance()->GetHash(tmp, (uint8*)&xferh.md5)) + { + // calculate patch md5, happens if patch was added while realmd was running + PatchCache::instance()->LoadPatchMD5(tmp); + PatchCache::instance()->GetHash(tmp, (uint8*)&xferh.md5); + } + + uint8 data[2] = { AUTH_LOGON_PROOF, WOW_FAIL_VERSION_UPDATE}; + send((const char*)data, sizeof(data)); + + memcpy(&xferh, "0\x05Patch", 7); + xferh.cmd = XFER_INITIATE; + xferh.file_size = file_size; + + send((const char*)&xferh, sizeof(xferh)); + return true; } ///
@@ -720,7 +664,7 @@ bool AuthSocket::_HandleLogonProof() ///- Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account // No SQL injection (escaped user name) and IP address as received by socket const char* K_hex = K.AsHexStr(); - loginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', failed_logins = 0 WHERE username = '%s'", K_hex, GetRemoteAddress().c_str(), GetLocaleByName(_localizationName), _safelogin.c_str() ); + loginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', failed_logins = 0 WHERE username = '%s'", K_hex, get_remote_address().c_str(), GetLocaleByName(_localizationName), _safelogin.c_str() ); OPENSSL_free((void*)K_hex); ///- Finish SRP6 and send the final result to the client @@ -736,7 +680,7 @@ bool AuthSocket::_HandleLogonProof() else { char data[4]= { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0}; - SendBuf(data, sizeof(data)); + send(data, sizeof(data)); BASIC_LOG("[AuthChallenge] account %s tried to login with wrong password!",_login.c_str ()); uint32 MaxWrongPassCount = sConfig.GetIntDefault("WrongPass.MaxCount", 0); @@ -765,7 +709,7 @@ bool AuthSocket::_HandleLogonProof() } else { - std::string current_ip = GetRemoteAddress(); + std::string current_ip = get_remote_address(); loginDatabase.escape_string(current_ip); loginDatabase.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','MaNGOS realmd','Failed login autoban')", current_ip.c_str(), WrongPassBanTime); @@ -784,20 +728,20 @@ bool AuthSocket::_HandleLogonProof() bool AuthSocket::_HandleReconnectChallenge() { DEBUG_LOG("Entering _HandleReconnectChallenge"); - if (ibuf.GetLength() < sizeof(sAuthLogonChallenge_C)) + if (recv_len() < sizeof(sAuthLogonChallenge_C)) return false; ///- Read the first 4 bytes (header) to get the length of the remaining of the packet std::vector buf; buf.resize(4); - ibuf.Read((char *)&buf[0], 4); + recv((char *)&buf[0], 4); EndianConvert(*((uint16*)(buf[0]))); uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; DEBUG_LOG("[ReconnectChallenge] got header, body is %#04x bytes", remaining); - if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (ibuf.GetLength() < remaining)) + if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (recv_len() < remaining)) return false; //No big fear of memory outage (size is int16, i.e. < 65536) @@ -806,7 +750,7 @@ bool AuthSocket::_HandleReconnectChallenge() sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; ///- Read the remaining of the packet - ibuf.Read((char *)&buf[4], remaining); + recv((char *)&buf[4], remaining); DEBUG_LOG("[ReconnectChallenge] got full packet, %#04x bytes", ch->size); DEBUG_LOG("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); @@ -816,13 +760,16 @@ bool AuthSocket::_HandleReconnectChallenge() _safelogin = _login; loginDatabase.escape_string(_safelogin); + EndianConvert(ch->build); + _build = ch->build; + QueryResult *result = loginDatabase.PQuery ("SELECT sessionkey FROM account WHERE username = '%s'", _safelogin.c_str ()); // Stop if the account is not found if (!result) { sLog.outError("[ERROR] user %s tried to login and we cannot find his session key in the database.", _login.c_str()); - SetCloseAndDelete(); + close_connection(); return false; } @@ -837,7 +784,7 @@ bool AuthSocket::_HandleReconnectChallenge() _reconnectProof.SetRand(16 * 8); pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros - SendBuf((char const*)pkt.contents(), pkt.size()); + send((char const*)pkt.contents(), pkt.size()); return true; } @@ -846,12 +793,12 @@ bool AuthSocket::_HandleReconnectProof() { DEBUG_LOG("Entering _HandleReconnectProof"); ///- Read the packet - if (ibuf.GetLength() < sizeof(sAuthReconnectProof_C)) + sAuthReconnectProof_C lp; + if(!recv((char *)&lp, sizeof(sAuthReconnectProof_C))) return false; + if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) return false; - sAuthReconnectProof_C lp; - ibuf.Read((char *)&lp, sizeof(sAuthReconnectProof_C)); BigNumber t1; t1.SetBinary(lp.R1, 16); @@ -869,7 +816,7 @@ bool AuthSocket::_HandleReconnectProof() pkt << (uint8) AUTH_RECONNECT_PROOF; pkt << (uint8) 0x00; pkt << (uint16) 0x00; // 2 bytes zeros - SendBuf((char const*)pkt.contents(), pkt.size()); + send((char const*)pkt.contents(), pkt.size()); ///- Set _authed to true! _authed = true; @@ -879,7 +826,7 @@ bool AuthSocket::_HandleReconnectProof() else { sLog.outError("[ERROR] user %s tried to login, but session invalid.", _login.c_str()); - SetCloseAndDelete(); + close_connection(); return false; } } @@ -888,10 +835,10 @@ bool AuthSocket::_HandleReconnectProof() bool AuthSocket::_HandleRealmList() { DEBUG_LOG("Entering _HandleRealmList"); - if (ibuf.GetLength() < 5) + if (recv_len() < 5) return false; - ibuf.Remove(5); + recv_skip(5); ///- Get the user id (else close the connection) // No SQL injection (escaped user name) @@ -900,7 +847,7 @@ bool AuthSocket::_HandleRealmList() if(!result) { sLog.outError("[ERROR] user %s tried to login and we cannot find him in the database.",_login.c_str()); - SetCloseAndDelete(); + close_connection(); return false; } @@ -920,7 +867,7 @@ bool AuthSocket::_HandleRealmList() hdr << (uint16)pkt.size(); hdr.append(pkt); - SendBuf((char const*)hdr.contents(), hdr.size()); + send((char const*)hdr.contents(), hdr.size()); return true; } @@ -1057,20 +1004,37 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid) bool AuthSocket::_HandleXferResume() { DEBUG_LOG("Entering _HandleXferResume"); - ///- Check packet length and patch existence - if (ibuf.GetLength() < 9 || !pPatch) + + if(recv_len() < 9) + return false; + + recv_skip(1); + + uint64 start_pos; + recv((char *)&start_pos, 8); + + if(patch_ == ACE_INVALID_HANDLE) { - sLog.outError("Error while resuming patch transfer (wrong packet)"); + close_connection(); return false; } - ///- Launch a PatcherRunnable thread starting at given patch file offset - uint64 start; - ibuf.Remove(1); - ibuf.Read((char*)&start,sizeof(start)); - fseek(pPatch, start, 0); + ACE_OFF_T file_size = ACE_OS::filesize(patch_); + + if(file_size == -1 || start_pos >= (uint64)file_size) + { + close_connection(); + return false; + } + + if(ACE_OS::lseek(patch_, start_pos, SEEK_SET) == -1) + { + close_connection(); + return false; + } + + InitPatch(); - ACE_Based::Thread u(new PatcherRunnable(this)); return true; } @@ -1079,10 +1043,8 @@ bool AuthSocket::_HandleXferCancel() { DEBUG_LOG("Entering _HandleXferCancel"); - ///- Close and delete the socket - ibuf.Remove(1); // clear input buffer - - SetCloseAndDelete(); + recv_skip(1); + close_connection(); return true; } @@ -1092,161 +1054,23 @@ bool AuthSocket::_HandleXferAccept() { DEBUG_LOG("Entering _HandleXferAccept"); - ///- Check packet length and patch existence - if (!pPatch) - { - sLog.outError("Error while accepting patch transfer (wrong packet)"); - return false; - } + recv_skip(1); - ///- Launch a PatcherRunnable thread, starting at the beginning of the patch file - ibuf.Remove(1); // clear input buffer - fseek(pPatch, 0, 0); + InitPatch(); - ACE_Based::Thread u(new PatcherRunnable(this)); return true; } -/// Check if there is lag on the connection to the client -bool AuthSocket::IsLag() +void AuthSocket::InitPatch() { - return (TCP_BUFSIZE_READ-GetOutputLength() < 2 * ChunkSize); -} + PatchHandler* handler = new PatchHandler(ACE_OS::dup(get_handle()), patch_); -PatcherRunnable::PatcherRunnable(class AuthSocket * as) -{ - mySocket = as; -} + patch_ = ACE_INVALID_HANDLE; -/// Send content of patch file to the client -void PatcherRunnable::run() -{ - ACE_Guard g(mySocket->patcherLock); - - XFER_DATA_STRUCT xfdata; - xfdata.opcode = XFER_DATA; - - while(!feof(mySocket->pPatch) && mySocket->Ready()) + if(handler->open() == -1) { - ///- Wait until output buffer is reasonably empty - while(mySocket->Ready() && mySocket->IsLag()) - { - ACE_Based::Thread::Sleep(1); - } - ///- And send content of the patch file to the client - xfdata.data_size = fread(&xfdata.data, 1, ChunkSize, mySocket->pPatch); - mySocket->SendBuf((const char*)&xfdata, xfdata.data_size + (sizeof(XFER_DATA_STRUCT) - ChunkSize)); + handler->close(); + close_connection(); } } -/// Preload MD5 hashes of existing patch files on server -#ifndef _WIN32 -#include -#include -void Patcher::LoadPatchesInfo() -{ - DIR * dirp; - //int errno; - struct dirent * dp; - dirp = opendir("./patches/"); - if(!dirp) - return; - while (dirp) - { - errno = 0; - if ((dp = readdir(dirp)) != NULL) - { - int l = strlen(dp->d_name); - if(l < 8) - continue; - if(!memcmp(&dp->d_name[l-4],".mpq",4)) - LoadPatchMD5(dp->d_name); - } - else - { - if(errno != 0) - { - closedir(dirp); - return; - } - break; - } - } - - if(dirp) - closedir(dirp); -} - -#else -void Patcher::LoadPatchesInfo() -{ - WIN32_FIND_DATA fil; - HANDLE hFil=FindFirstFile("./patches/*.mpq", &fil); - if(hFil == INVALID_HANDLE_VALUE) - return; // no patches were found - - do - { - LoadPatchMD5(fil.cFileName); - } - while(FindNextFile(hFil, &fil)); -} -#endif - -/// Calculate and store MD5 hash for a given patch file -void Patcher::LoadPatchMD5(char * szFileName) -{ - ///- Try to open the patch file - std::string path = "./patches/"; - path += szFileName; - FILE *pPatch = fopen(path.c_str(), "rb"); - DEBUG_LOG("Loading patch info from %s\n", path.c_str()); - if(!pPatch) - { - sLog.outError("Error loading patch %s\n", path.c_str()); - return; - } - - ///- Calculate the MD5 hash - MD5_CTX ctx; - MD5_Init(&ctx); - uint8* buf = new uint8[512*1024]; - - while (!feof(pPatch)) - { - size_t read = fread(buf, 1, 512*1024, pPatch); - MD5_Update(&ctx, buf, read); - } - delete [] buf; - fclose(pPatch); - - ///- Store the result in the internal patch hash map - _patches[path] = new PATCH_INFO; - MD5_Final((uint8 *)&_patches[path]->md5, &ctx); -} - -/// Get cached MD5 hash for a given patch file -bool Patcher::GetHash(char * pat, uint8 mymd5[16]) -{ - for( Patches::iterator i = _patches.begin(); i != _patches.end(); ++i ) - if(!stricmp(pat, i->first.c_str())) - { - memcpy(mymd5, i->second->md5, 16); - return true; - } - - return false; -} - -/// Launch the patch hashing mechanism on object creation -Patcher::Patcher() -{ - LoadPatchesInfo(); -} - -/// Empty and delete the patch map on termination -Patcher::~Patcher() -{ - for(Patches::iterator i = _patches.begin(); i != _patches.end(); ++i ) - delete i->second; -} diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index a3ce60d49..afd60231c 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -25,22 +25,18 @@ #include "Common.h" #include "Auth/BigNumber.h" -#include "sockets/TcpSocket.h" -#include "sockets/SocketHandler.h" -#include "sockets/ListenSocket.h" -#include "sockets/Utility.h" -#include "sockets/Parse.h" -#include "sockets/Socket.h" #include "Auth/Sha1.h" #include "ByteBuffer.h" +#include "BufferedSocket.h" + /// Handle login commands -class AuthSocket: public TcpSocket +class AuthSocket: public BufferedSocket { public: const static int s_BYTE_SIZE = 32; - AuthSocket(ISocketHandler& h); + AuthSocket(); ~AuthSocket(); void OnAccept(); @@ -61,10 +57,6 @@ class AuthSocket: public TcpSocket void _SetVSFields(const std::string& rI); - FILE *pPatch; - ACE_Thread_Mutex patcherLock; - bool IsLag(); - private: BigNumber N, s, g, v; @@ -82,6 +74,10 @@ class AuthSocket: public TcpSocket std::string _localizationName; uint16 _build; AccountTypes _accountSecurityLevel; + + ACE_HANDLE patch_; + + void InitPatch(); }; #endif /// @} diff --git a/src/realmd/BufferedSocket.cpp b/src/realmd/BufferedSocket.cpp new file mode 100644 index 000000000..993547811 --- /dev/null +++ b/src/realmd/BufferedSocket.cpp @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ + +#include "BufferedSocket.h" + +#include +#include +#include + +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + +BufferedSocket::BufferedSocket(void): + input_buffer_(4096), + remote_address_("") +{ +} + +/*virtual*/ BufferedSocket::~BufferedSocket(void) +{ +} + +/*virtual*/ int BufferedSocket::open(void * arg) +{ + if(Base::open(arg) == -1) + return -1; + + ACE_INET_Addr addr; + + if(peer().get_remote_addr(addr) == -1) + return -1; + + char address[1024]; + + addr.get_host_addr(address, 1024); + + this->remote_address_ = address; + + this->OnAccept(); + + return 0; +} + +const std::string& BufferedSocket::get_remote_address(void) const +{ + return this->remote_address_; +} + +size_t BufferedSocket::recv_len(void) const +{ + return this->input_buffer_.length(); +} + +bool BufferedSocket::recv_soft(char *buf, size_t len) +{ + if(this->input_buffer_.length() < len) + return false; + + ACE_OS::memcpy(buf, this->input_buffer_.rd_ptr(), len); + + return true; +} + +bool BufferedSocket::recv(char *buf, size_t len) +{ + bool ret = this->recv_soft(buf, len); + + if(ret) + this->recv_skip(len); + + return ret; +} + +void BufferedSocket::recv_skip(size_t len) +{ + this->input_buffer_.rd_ptr(len); +} + +ssize_t BufferedSocket::noblk_send(ACE_Message_Block &message_block) +{ + const size_t len = message_block.length(); + + if(len == 0) + return -1; + + // Try to send the message directly. + ssize_t n = this->peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL); + + if(n < 0) + { + if(errno == EWOULDBLOCK) + // Blocking signal + return 0; + else + // Error + return -1; + } + else if(n == 0) + { + // Can this happen ? + return -1; + } + + // return bytes transmitted + return n; +} + +bool BufferedSocket::send(const char *buf, size_t len) +{ + if(buf == NULL || len == 0) + return true; + + ACE_Data_Block db( + len, + ACE_Message_Block::MB_DATA, + (const char*)buf, + 0, + 0, + ACE_Message_Block::DONT_DELETE, + 0); + + ACE_Message_Block message_block( + &db, + ACE_Message_Block::DONT_DELETE, + 0); + + message_block.wr_ptr(len); + + if(this->msg_queue()->is_empty()) + { + // Try to send it directly. + ssize_t n = this->noblk_send(message_block); + + if(n < 0) + return false; + else if(n == len) + return true; + + // adjust how much bytes we sent + message_block.rd_ptr((size_t)n); + + // fall down + } + + // enqueue the message, note: clone is needed cause we cant enqueue stuff on the stack + ACE_Message_Block *mb = message_block.clone(); + + if(this->msg_queue()->enqueue_tail(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + { + mb->release(); + return false; + } + + // tell reactor to call handle_output() when we can send more data + if(this->reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) + return false; + + return true; +} + +/*virtual*/ int BufferedSocket::handle_output(ACE_HANDLE /*= ACE_INVALID_HANDLE*/) +{ + ACE_Message_Block *mb = 0; + + if(this->msg_queue()->is_empty()) + { + // if no more data to send, then cancel notification + this->reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK); + return 0; + } + + if(this->msg_queue()->dequeue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + return -1; + + ssize_t n = this->noblk_send(*mb); + + if(n < 0) + { + mb->release(); + return -1; + } + else if(n == mb->length()) + { + mb->release(); + return 1; + } + else + { + mb->rd_ptr(n); + + if(this->msg_queue()->enqueue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + { + mb->release(); + return -1; + } + + return 0; + } + + ACE_NOTREACHED(return -1); +} + +/*virtual*/ int BufferedSocket::handle_input(ACE_HANDLE /*= ACE_INVALID_HANDLE*/) +{ + const ssize_t space = this->input_buffer_.space(); + + ssize_t n = this->peer().recv(this->input_buffer_.wr_ptr(), space); + + if(n < 0) + { + // blocking signal or error + return errno == EWOULDBLOCK ? 0 : -1; + } + else if(n == 0) + { + // EOF + return -1; + } + + this->input_buffer_.wr_ptr((size_t)n); + + this->OnRead(); + + // move data in the buffer to the beginning of the buffer + this->input_buffer_.crunch(); + + // return 1 in case there might be more data to read from OS + return n == space ? 1 : 0; +} + +/*virtual*/ int BufferedSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask m) +{ + this->OnClose(); + + Base::handle_close(); + + return 0; +} + +void BufferedSocket::close_connection(void) +{ + this->peer().close_reader(); + this->peer().close_writer(); +} + diff --git a/src/realmd/BufferedSocket.h b/src/realmd/BufferedSocket.h new file mode 100644 index 000000000..57ee22171 --- /dev/null +++ b/src/realmd/BufferedSocket.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ + +#ifndef _BUFFEREDSOCKET_H_ +#define _BUFFEREDSOCKET_H_ + +#include +#include +#include +#include +#include +#include + +#include + +class BufferedSocket: public ACE_Svc_Handler +{ + protected: + typedef ACE_Svc_Handler Base; + + virtual void OnRead(void) { } + virtual void OnAccept(void) { } + virtual void OnClose(void) { } + + public: + BufferedSocket(void); + virtual ~BufferedSocket(void); + + size_t recv_len(void) const; + bool recv_soft(char *buf, size_t len); + bool recv(char *buf, size_t len); + void recv_skip(size_t len); + + bool send(const char *buf, size_t len); + + const std::string& get_remote_address(void) const; + + virtual int open(void *); + + void close_connection(void); + + virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE); + virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE); + + virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + private: + ssize_t noblk_send(ACE_Message_Block &message_block); + + private: + ACE_Message_Block input_buffer_; + + protected: + std::string remote_address_; + +}; + +#endif /* _BUFFEREDSOCKET_H_ */ + diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 80000bc76..98a27d9e1 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -26,7 +26,6 @@ #include "Config/ConfigEnv.h" #include "Log.h" -#include "sockets/ListenSocket.h" #include "AuthSocket.h" #include "SystemConfig.h" #include "revision.h" @@ -36,6 +35,11 @@ #include #include +#include +#include +#include +#include + #ifdef WIN32 #include "ServiceWin32.h" char serviceName[] = "realmd"; @@ -173,6 +177,12 @@ extern int main(int argc, char **argv) DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]"); } +#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) + ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); +#endif + + sLog.outBasic("Max allowed open files is %d", ACE::max_handles()); + /// realmd PID file creation std::string pidfile = sConfig.GetStringDefault("PidFile", ""); if(!pidfile.empty()) @@ -204,25 +214,25 @@ extern int main(int argc, char **argv) return 1; } - ///- Launch the listening network socket - port_t rmport = sConfig.GetIntDefault( "RealmServerPort", DEFAULT_REALMSERVER_PORT ); - std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0"); - - SocketHandler h; - ListenSocket authListenSocket(h); - if ( authListenSocket.Bind(bind_ip.c_str(),rmport)) - { - sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport ); - Log::WaitBeforeContinueIfNeed(); - return 1; - } - // cleanup query - //set expired bans to inactive + // set expired bans to inactive loginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); - h.Add(&authListenSocket); + ///- Launch the listening network socket + ACE_Acceptor acceptor; + + uint16 rmport = sConfig.GetIntDefault("RealmServerPort", DEFAULT_REALMSERVER_PORT); + std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0"); + + ACE_INET_Addr bind_addr(rmport, bind_ip.c_str()); + + if(acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) + { + sLog.outError("MaNGOS realmd can not bind to %s:%d", bind_ip.c_str(), rmport); + Log::WaitBeforeContinueIfNeed(); + return 1; + } ///- Catch termination signals HookSignals(); @@ -277,8 +287,11 @@ extern int main(int argc, char **argv) ///- Wait for termination signal while (!stopEvent) { + // dont move this outside the loop, the reactor will modify it + ACE_Time_Value interval(0, 100000); - h.Select(0, 100000); + if (ACE_Reactor::instance()->run_reactor_event_loop(interval) == -1) + break; if( (++loopCounter) == numLoops ) { diff --git a/src/realmd/Makefile.am b/src/realmd/Makefile.am index 259bf20b9..a660351ef 100644 --- a/src/realmd/Makefile.am +++ b/src/realmd/Makefile.am @@ -25,7 +25,11 @@ mangos_realmd_SOURCES = \ AuthCodes.h \ AuthSocket.cpp \ AuthSocket.h \ + BufferedSocket.h \ + BufferedSocket.cpp \ Main.cpp \ + PatchHandler.h \ + PatchHandler.cpp \ RealmList.cpp \ RealmList.h @@ -35,10 +39,9 @@ mangos_realmd_LDADD = \ ../shared/Config/libmangosconfig.a \ ../shared/Auth/libmangosauth.a \ ../shared/libmangosshared.a \ - ../framework/libmangosframework.a \ - ../../dep/src/sockets/libmangossockets.a + ../framework/libmangosframework.a -mangos_realmd_LDFLAGS = -L../../dep/src/sockets -L$(libdir) $(MANGOS_LIBS) +mangos_realmd_LDFLAGS = -L$(libdir) $(MANGOS_LIBS) ## Additional files to include when running 'make dist' # Include realm list daemon configuration diff --git a/src/realmd/PatchHandler.cpp b/src/realmd/PatchHandler.cpp new file mode 100644 index 000000000..e1b5413fe --- /dev/null +++ b/src/realmd/PatchHandler.cpp @@ -0,0 +1,194 @@ + +#include "PatchHandler.h" +#include "AuthCodes.h" +#include "Log.h" +#include "Common.h" + +#include +#include +#include +#include + +#include + +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + +#if defined( __GNUC__ ) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + +struct Chunk +{ + ACE_UINT8 cmd; + ACE_UINT16 data_size; + ACE_UINT8 data[4096]; // 4096 - page size on most arch +}; + +#if defined( __GNUC__ ) +#pragma pack() +#else +#pragma pack(pop) +#endif + +PatchHandler::PatchHandler(ACE_HANDLE socket, ACE_HANDLE patch) +{ + reactor(NULL); + set_handle(socket); + patch_fd_ = patch; +} + +PatchHandler::~PatchHandler() +{ + if(patch_fd_ != ACE_INVALID_HANDLE) + ACE_OS::close(patch_fd_); +} + +int PatchHandler::open(void*) +{ + if(get_handle() == ACE_INVALID_HANDLE || patch_fd_ == ACE_INVALID_HANDLE) + return -1; + + int nodelay = 0; + if (-1 == peer().set_option(ACE_IPPROTO_TCP, + TCP_NODELAY, + &nodelay, + sizeof(nodelay))) + { + return -1; + } + +#if defined(TCP_CORK) + int cork = 1; + if (-1 == peer().set_option(ACE_IPPROTO_TCP, + TCP_CORK, + &cork, + sizeof(cork))) + { + return -1; + } +#endif //TCP_CORK + + (void) peer().disable(ACE_NONBLOCK); + + return activate(THR_NEW_LWP | THR_DETACHED | THR_INHERIT_SCHED); +} + +int PatchHandler::svc(void) +{ + // Do 1 second sleep, similar to the one in game/WorldSocket.cpp + // Seems client have problems with too fast sends. + ACE_OS::sleep(1); + + int flags = MSG_NOSIGNAL; + + Chunk data; + data.cmd = XFER_DATA; + + ssize_t r; + + while((r = ACE_OS::read(patch_fd_, data.data, sizeof(data.data))) > 0) + { + data.data_size = (ACE_UINT16)r; + + if(peer().send((const char*)&data, + ((size_t) r) + sizeof(data) - sizeof(data.data), + flags) == -1) + { + return -1; + } + } + + if(r == -1) + { + return -1; + } + + return 0; +} + +PatchCache::~PatchCache() +{ + for (Patches::iterator i = patches_.begin (); i != patches_.end (); i++) + delete i->second; +} + +PatchCache::PatchCache() +{ + LoadPatchesInfo(); +} + +PatchCache* PatchCache::instance() +{ + return ACE_Singleton::instance(); +} + +void PatchCache::LoadPatchMD5(const char* szFileName) +{ + // Try to open the patch file + std::string path = "./patches/"; + path += szFileName; + FILE * pPatch = fopen(path.c_str (), "rb"); + sLog.outDebug("Loading patch info from %s", path.c_str()); + + if(!pPatch) + return; + + // Calculate the MD5 hash + MD5_CTX ctx; + MD5_Init(&ctx); + + const size_t check_chunk_size = 4*1024; + + ACE_UINT8 buf[check_chunk_size]; + + while(!feof (pPatch)) + { + size_t read = fread(buf, 1, check_chunk_size, pPatch); + MD5_Update(&ctx, buf, read); + } + + fclose(pPatch); + + // Store the result in the internal patch hash map + patches_[path] = new PATCH_INFO; + MD5_Final((ACE_UINT8 *) & patches_[path]->md5, &ctx); +} + +bool PatchCache::GetHash(const char * pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]) +{ + for (Patches::iterator i = patches_.begin (); i != patches_.end (); i++) + if (!stricmp(pat, i->first.c_str ())) + { + memcpy(mymd5, i->second->md5, MD5_DIGEST_LENGTH); + return true; + } + + return false; +} + +void PatchCache::LoadPatchesInfo() +{ + ACE_DIR* dirp = ACE_OS::opendir(ACE_TEXT("./patches/")); + + if(!dirp) + return; + + ACE_DIRENT* dp; + + while((dp = ACE_OS::readdir(dirp)) != NULL) + { + int l = strlen(dp->d_name); + if (l < 8) + continue; + + if(!memcmp(&dp->d_name[l - 4], ".mpq", 4)) + LoadPatchMD5(dp->d_name); + } + + ACE_OS::closedir(dirp); +} + diff --git a/src/realmd/PatchHandler.h b/src/realmd/PatchHandler.h new file mode 100644 index 000000000..0151b2079 --- /dev/null +++ b/src/realmd/PatchHandler.h @@ -0,0 +1,72 @@ +#ifndef _PATCHHANDLER_H_ +#define _PATCHHANDLER_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/** + * @brief Caches MD5 hash of client patches present on the server + */ +class PatchCache +{ + public: + ~PatchCache(); + PatchCache(); + + static PatchCache* instance(); + + struct PATCH_INFO + { + ACE_UINT8 md5[MD5_DIGEST_LENGTH]; + }; + + typedef std::map Patches; + + Patches::const_iterator begin() const + { + return patches_.begin(); + } + + Patches::const_iterator end() const + { + return patches_.end(); + } + + void LoadPatchMD5(const char*); + bool GetHash(const char * pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]); + + private: + void LoadPatchesInfo(); + Patches patches_; + +}; + +class PatchHandler: public ACE_Svc_Handler +{ + protected: + typedef ACE_Svc_Handler Base; + + public: + PatchHandler(ACE_HANDLE socket, ACE_HANDLE patch); + virtual ~PatchHandler(); + + int open(void* = 0); + + protected: + virtual int svc(void); + + private: + ACE_HANDLE patch_fd_; + +}; + +#endif /* _BK_PATCHHANDLER_H__ */ + diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 81e745922..a0f9c38bb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9934" + #define REVISION_NR "9935" #endif // __REVISION_NR_H__ diff --git a/win/VC100/realmd.vcxproj b/win/VC100/realmd.vcxproj index 8b8ce7b15..0329837ad 100644 --- a/win/VC100/realmd.vcxproj +++ b/win/VC100/realmd.vcxproj @@ -415,12 +415,16 @@ + + + + diff --git a/win/VC80/realmd.vcproj b/win/VC80/realmd.vcproj index e373ceac7..8670eb229 100644 --- a/win/VC80/realmd.vcproj +++ b/win/VC80/realmd.vcproj @@ -621,10 +621,26 @@ RelativePath="..\..\src\realmd\AuthSocket.h" > + + + + + + + + diff --git a/win/VC90/realmd.vcproj b/win/VC90/realmd.vcproj index 6665e35a7..f78a507dd 100644 --- a/win/VC90/realmd.vcproj +++ b/win/VC90/realmd.vcproj @@ -621,10 +621,26 @@ RelativePath="..\..\src\realmd\AuthSocket.h" > + + + + + + + + From 8814eec3eb0fbba7ce32bb85092afb77778d3ba3 Mon Sep 17 00:00:00 2001 From: Derex Date: Thu, 20 May 2010 00:14:31 +0300 Subject: [PATCH 064/172] [9936] Remove sockets library from UNIX build --- configure.ac | 1 - dep/include/Makefile.am | 28 ---------------------------- dep/src/Makefile.am | 2 +- src/shared/revision_nr.h | 2 +- 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/configure.ac b/configure.ac index 90b332abc..1fc4248ff 100644 --- a/configure.ac +++ b/configure.ac @@ -281,7 +281,6 @@ AC_CONFIG_FILES([ dep/lib/Makefile dep/src/Makefile dep/src/g3dlite/Makefile - dep/src/sockets/Makefile dep/src/zlib/Makefile dep/src/gsoap/Makefile dep/Makefile diff --git a/dep/include/Makefile.am b/dep/include/Makefile.am index 6e7289426..afdfa0122 100644 --- a/dep/include/Makefile.am +++ b/dep/include/Makefile.am @@ -160,34 +160,6 @@ EXTRA_DIST += \ postgre/pg_type.h \ postgre/postgres_ext.h -# Sockets header files for Win32 builds -EXTRA_DIST += \ - sockets\Base64.h \ - sockets\CircularBuffer.h \ - sockets\IFile.h \ - sockets\Ipv4Address.h \ - sockets\Ipv6Address.h \ - sockets\ISocketHandler.h \ - sockets\ListenSocket.h \ - sockets\Mutex.h \ - sockets\Parse.h \ - sockets\RandomNumber.h \ - sockets\ResolvServer.h \ - sockets\ResolvSocket.h \ - sockets\SctpSocket.h \ - sockets\Socket.h \ - sockets\socket_include.h \ - sockets\SocketAddress.h \ - sockets\SocketHandler.h \ - sockets\sockets-config.h \ - sockets\StdLog.h \ - sockets\StdoutLog.h \ - sockets\TcpSocket.h \ - sockets\Thread.h \ - sockets\UdpSocket.h \ - sockets\Uid.h \ - sockets\Utility.h - # VLD header files for Win32 builds EXTRA_DIST += \ vld/vld.h diff --git a/dep/src/Makefile.am b/dep/src/Makefile.am index ac4f90523..b5648b3cd 100644 --- a/dep/src/Makefile.am +++ b/dep/src/Makefile.am @@ -17,7 +17,7 @@ ## Process this file with automake to produce Makefile.in ## Sub-directories to parse -SUBDIRS = g3dlite sockets gsoap zlib +SUBDIRS = g3dlite gsoap zlib ## Additional files to include when running 'make dist' # Nothing yet. diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a0f9c38bb..5b410b9bc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9935" + #define REVISION_NR "9936" #endif // __REVISION_NR_H__ From 85e3100bc75d3cc2aa1e4170d0752386b2205a86 Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Thu, 20 May 2010 02:05:04 +0400 Subject: [PATCH 065/172] [9937] Added copyright notice. --- src/realmd/PatchHandler.cpp | 21 +++++++++++++++++++++ src/realmd/PatchHandler.h | 22 ++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/realmd/PatchHandler.cpp b/src/realmd/PatchHandler.cpp index e1b5413fe..0527c313c 100644 --- a/src/realmd/PatchHandler.cpp +++ b/src/realmd/PatchHandler.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ #include "PatchHandler.h" #include "AuthCodes.h" diff --git a/src/realmd/PatchHandler.h b/src/realmd/PatchHandler.h index 0151b2079..e32d928ae 100644 --- a/src/realmd/PatchHandler.h +++ b/src/realmd/PatchHandler.h @@ -1,3 +1,25 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ + #ifndef _PATCHHANDLER_H_ #define _PATCHHANDLER_H_ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5b410b9bc..c3421b700 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9936" + #define REVISION_NR "9937" #endif // __REVISION_NR_H__ From b881c061047fe0d307ac23327a4352e98272ce68 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 20 May 2010 00:06:09 +0200 Subject: [PATCH 066/172] [9938] Correct premature call of TalkedToCreature. Only use TalkedToCreature when gossip does not have any following sub menu (and of course when the prepared npc options does not include any gossip) Signed-off-by: NoFantasy --- src/game/NPCHandler.cpp | 1 - src/game/Player.cpp | 40 +++++++++++++++++++++++++--------------- src/shared/revision_nr.h | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 724d53c0b..95a869d88 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -278,7 +278,6 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) if (!Script->GossipHello(_player, pCreature)) { - _player->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); _player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId); _player->SendPreparedGossip(pCreature); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1776d1953..dd43dc533 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12564,9 +12564,11 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource)) pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(0); + bool canTalkToCredit = true; + for(GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { - bool bCanTalk = true; + bool hasMenuItem = true; if (itr->second.cond_1 && !sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_1)) continue; @@ -12590,14 +12592,14 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) { case GOSSIP_OPTION_QUESTGIVER: PrepareQuestMenu(pSource->GetGUID()); - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_ARMORER: - bCanTalk = false; // added in special mode + hasMenuItem = false; // added in special mode break; case GOSSIP_OPTION_SPIRITHEALER: if (!isDead()) - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_VENDOR: { @@ -12605,21 +12607,21 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (!vItems || vItems->Empty()) { sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", pCreature->GetGUIDLow(), pCreature->GetEntry()); - bCanTalk = false; + hasMenuItem = false; } break; } case GOSSIP_OPTION_TRAINER: if (!pCreature->isCanTrainingOf(this, false)) - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_UNLEARNTALENTS: if (!pCreature->isCanTrainingAndResetTalentsOf(this)) - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_UNLEARNPETSKILLS: if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER) - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_TAXIVENDOR: if (GetSession()->SendLearnNewTaxiNode(pCreature)) @@ -12627,13 +12629,16 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) break; case GOSSIP_OPTION_BATTLEFIELD: if (!pCreature->isCanInteractWithBattleMaster(this, false)) - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_STABLEPET: if (getClass() != CLASS_HUNTER) - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_GOSSIP: + if (itr->second.action_menu_id) // has sub menu, so do not "talk" with this NPC yet + canTalkToCredit = false; + break; case GOSSIP_OPTION_SPIRITGUIDE: case GOSSIP_OPTION_INNKEEPER: case GOSSIP_OPTION_BANKER: @@ -12643,7 +12648,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) break; // no checks default: sLog.outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", pCreature->GetEntry(), itr->second.option_id, itr->second.menu_id); - bCanTalk = false; + hasMenuItem = false; break; } } @@ -12651,24 +12656,26 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) { GameObject *pGo = (GameObject*)pSource; + canTalkToCredit = false; + switch(itr->second.option_id) { case GOSSIP_OPTION_QUESTGIVER: if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) PrepareQuestMenu(pSource->GetGUID()); - bCanTalk = false; + hasMenuItem = false; break; case GOSSIP_OPTION_GOSSIP: if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && pGo->GetGoType() != GAMEOBJECT_TYPE_GOOBER) - bCanTalk = false; + hasMenuItem = false; break; default: - bCanTalk = false; + hasMenuItem = false; break; } } - if (bCanTalk) + if (hasMenuItem) { std::string strOptionText = itr->second.option_text; std::string strBoxText = itr->second.box_text; @@ -12694,6 +12701,9 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) } } + if (canTalkToCredit) + TalkedToCreature(((Creature*)pSource)->GetEntry(), ((Creature*)pSource)->GetGUID()); + // some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) /*if (pMenu->Empty()) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c3421b700..69050f501 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9937" + #define REVISION_NR "9938" #endif // __REVISION_NR_H__ From 540edb5a81f37e2fa88b7bf8e9bdbcbe92350572 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 20 May 2010 02:54:31 +0400 Subject: [PATCH 067/172] [9939] Sockets library use finally dropped Specially thanks to Derex for make this possible! :) --- NEWS | 1 + dep/include/sockets/Base64.h | 77 -- dep/include/sockets/Exception.h | 58 - dep/include/sockets/File.h | 84 -- dep/include/sockets/IFile.h | 71 - dep/include/sockets/ISocketHandler.h | 232 ---- dep/include/sockets/Ipv4Address.h | 98 -- dep/include/sockets/Ipv6Address.h | 107 -- dep/include/sockets/ListenSocket.h | 420 ------ dep/include/sockets/Lock.h | 59 - dep/include/sockets/Mutex.h | 68 - dep/include/sockets/Parse.h | 101 -- dep/include/sockets/ResolvServer.h | 73 - dep/include/sockets/ResolvSocket.h | 106 -- dep/include/sockets/SctpSocket.h | 109 -- dep/include/sockets/Socket.h | 739 ---------- dep/include/sockets/SocketAddress.h | 95 -- dep/include/sockets/SocketHandler.h | 266 ---- dep/include/sockets/StdLog.h | 74 - dep/include/sockets/StdoutLog.h | 57 - dep/include/sockets/StreamSocket.h | 127 -- dep/include/sockets/TcpSocket.h | 358 ----- dep/include/sockets/Thread.h | 100 -- dep/include/sockets/UdpSocket.h | 215 --- dep/include/sockets/Utility.h | 186 --- dep/include/sockets/socket_include.h | 306 ----- dep/include/sockets/sockets-config.h | 101 -- dep/src/sockets/Base64.cpp | 272 ---- dep/src/sockets/Exception.cpp | 48 - dep/src/sockets/Ipv4Address.cpp | 214 --- dep/src/sockets/Ipv6Address.cpp | 270 ---- dep/src/sockets/Lock.cpp | 55 - dep/src/sockets/Makefile.am | 47 - dep/src/sockets/Mutex.cpp | 81 -- dep/src/sockets/Parse.cpp | 321 ----- dep/src/sockets/ResolvServer.cpp | 97 -- dep/src/sockets/ResolvSocket.cpp | 436 ------ dep/src/sockets/Socket.cpp | 1898 -------------------------- dep/src/sockets/SocketHandler.cpp | 1423 ------------------- dep/src/sockets/StdoutLog.cpp | 98 -- dep/src/sockets/StreamSocket.cpp | 169 --- dep/src/sockets/TcpSocket.cpp | 1746 ----------------------- dep/src/sockets/Thread.cpp | 166 --- dep/src/sockets/UdpSocket.cpp | 852 ------------ dep/src/sockets/Utility.cpp | 999 -------------- dep/src/sockets/network_kist.txt | 20 - dep/src/sockets/socket_include.cpp | 90 -- src/shared/revision_nr.h | 2 +- win/VC100/realmd.vcxproj | 3 - win/VC100/sockets.vcxproj | 373 ----- win/VC100/sockets.vcxproj.filters | 147 -- win/VC80/sockets.vcproj | 679 --------- win/VC90/sockets.vcproj | 683 --------- win/mangosdVC100.sln | 15 - win/mangosdVC80.sln | 15 - win/mangosdVC90.sln | 15 - 56 files changed, 2 insertions(+), 15520 deletions(-) delete mode 100644 dep/include/sockets/Base64.h delete mode 100644 dep/include/sockets/Exception.h delete mode 100644 dep/include/sockets/File.h delete mode 100644 dep/include/sockets/IFile.h delete mode 100644 dep/include/sockets/ISocketHandler.h delete mode 100644 dep/include/sockets/Ipv4Address.h delete mode 100644 dep/include/sockets/Ipv6Address.h delete mode 100644 dep/include/sockets/ListenSocket.h delete mode 100644 dep/include/sockets/Lock.h delete mode 100644 dep/include/sockets/Mutex.h delete mode 100644 dep/include/sockets/Parse.h delete mode 100644 dep/include/sockets/ResolvServer.h delete mode 100644 dep/include/sockets/ResolvSocket.h delete mode 100644 dep/include/sockets/SctpSocket.h delete mode 100644 dep/include/sockets/Socket.h delete mode 100644 dep/include/sockets/SocketAddress.h delete mode 100644 dep/include/sockets/SocketHandler.h delete mode 100644 dep/include/sockets/StdLog.h delete mode 100644 dep/include/sockets/StdoutLog.h delete mode 100644 dep/include/sockets/StreamSocket.h delete mode 100644 dep/include/sockets/TcpSocket.h delete mode 100644 dep/include/sockets/Thread.h delete mode 100644 dep/include/sockets/UdpSocket.h delete mode 100644 dep/include/sockets/Utility.h delete mode 100644 dep/include/sockets/socket_include.h delete mode 100644 dep/include/sockets/sockets-config.h delete mode 100644 dep/src/sockets/Base64.cpp delete mode 100644 dep/src/sockets/Exception.cpp delete mode 100644 dep/src/sockets/Ipv4Address.cpp delete mode 100644 dep/src/sockets/Ipv6Address.cpp delete mode 100644 dep/src/sockets/Lock.cpp delete mode 100644 dep/src/sockets/Makefile.am delete mode 100644 dep/src/sockets/Mutex.cpp delete mode 100644 dep/src/sockets/Parse.cpp delete mode 100644 dep/src/sockets/ResolvServer.cpp delete mode 100644 dep/src/sockets/ResolvSocket.cpp delete mode 100644 dep/src/sockets/Socket.cpp delete mode 100644 dep/src/sockets/SocketHandler.cpp delete mode 100644 dep/src/sockets/StdoutLog.cpp delete mode 100644 dep/src/sockets/StreamSocket.cpp delete mode 100644 dep/src/sockets/TcpSocket.cpp delete mode 100644 dep/src/sockets/Thread.cpp delete mode 100644 dep/src/sockets/UdpSocket.cpp delete mode 100644 dep/src/sockets/Utility.cpp delete mode 100644 dep/src/sockets/network_kist.txt delete mode 100644 dep/src/sockets/socket_include.cpp delete mode 100644 win/VC100/sockets.vcxproj delete mode 100644 win/VC100/sockets.vcxproj.filters delete mode 100644 win/VC80/sockets.vcproj delete mode 100644 win/VC90/sockets.vcproj diff --git a/NEWS b/NEWS index a9a9b0120..0a2d066ce 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ http://mangos.lighthouseapp.com/ Version 0.16 * Under discussion. * OpenSSL lib upgrade to OpenSSL 1.0.0. + * Sockets lib use dropped. * Upgrade to client version 3.3.3a (build 11723). Version 0.15 diff --git a/dep/include/sockets/Base64.h b/dep/include/sockets/Base64.h deleted file mode 100644 index a632bbec7..000000000 --- a/dep/include/sockets/Base64.h +++ /dev/null @@ -1,77 +0,0 @@ -/** \file Base64.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Base64_H -#define _SOCKETS_Base64_H - -#include "sockets-config.h" -#ifdef _MSC_VER -#pragma warning(disable:4514) -#endif - -#include -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -/** \defgroup util Utilities */ - -/** Base64 encode/decode. - \ingroup util */ -class Base64 -{ -public: - Base64(); - - void encode(FILE *, std::string& , bool add_crlf = true); - void encode(const std::string&, std::string& , bool add_crlf = true); - void encode(const char *, size_t, std::string& , bool add_crlf = true); - void encode(const unsigned char *, size_t, std::string& , bool add_crlf = true); - - void decode(const std::string&, std::string& ); - void decode(const std::string&, unsigned char *, size_t&); - - size_t decode_length(const std::string& ); - -private: - Base64(const Base64& ) {} - Base64& operator=(const Base64& ) { return *this; } -static const char *bstr; -static const char rstr[128]; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Base64_H - diff --git a/dep/include/sockets/Exception.h b/dep/include/sockets/Exception.h deleted file mode 100644 index 81ba7373d..000000000 --- a/dep/include/sockets/Exception.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - ** \file Exception.h - ** \date 2007-09-28 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _Sockets_Exception_H -#define _Sockets_Exception_H - -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - -class Exception -{ -public: - Exception(const std::string& description); - virtual ~Exception() {} - - virtual const std::string ToString() const; - - Exception(const Exception& ) {} // copy constructor - - Exception& operator=(const Exception& ) { return *this; } // assignment operator - -private: - std::string m_description; - -}; - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _Sockets_Exception_H - diff --git a/dep/include/sockets/File.h b/dep/include/sockets/File.h deleted file mode 100644 index 58a1b71bb..000000000 --- a/dep/include/sockets/File.h +++ /dev/null @@ -1,84 +0,0 @@ -/** \file File.h - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_File_H -#define _SOCKETS_File_H - -#include "sockets-config.h" -#include "IFile.h" -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/** IFile implementation of a disk file. - \ingroup file */ -class File : public IFile -{ -public: - File(); - ~File(); - - bool fopen(const std::string&, const std::string&); - void fclose(); - - size_t fread(char *, size_t, size_t) const; - size_t fwrite(const char *, size_t, size_t); - - char *fgets(char *, int) const; - void fprintf(const char *format, ...); - - off_t size() const; - bool eof() const; - - void reset_read() const; - void reset_write(); - -private: - File(const File& ) {} // copy constructor - File& operator=(const File& ) { return *this; } // assignment operator - - std::string m_path; - std::string m_mode; - FILE *m_fil; - mutable long m_rptr; - long m_wptr; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_File_H - diff --git a/dep/include/sockets/IFile.h b/dep/include/sockets/IFile.h deleted file mode 100644 index aecc50f59..000000000 --- a/dep/include/sockets/IFile.h +++ /dev/null @@ -1,71 +0,0 @@ -/** \file IFile.h - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IFile_H -#define _SOCKETS_IFile_H - -#include "sockets-config.h" -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -/** \defgroup file File handling */ -/** Pure virtual file I/O interface. - \ingroup file */ -class IFile -{ -public: - virtual ~IFile() {} - - virtual bool fopen(const std::string&, const std::string&) = 0; - virtual void fclose() = 0; - - virtual size_t fread(char *, size_t, size_t) const = 0; - virtual size_t fwrite(const char *, size_t, size_t) = 0; - - virtual char *fgets(char *, int) const = 0; - virtual void fprintf(const char *format, ...) = 0; - - virtual off_t size() const = 0; - virtual bool eof() const = 0; - - virtual void reset_read() const = 0; - virtual void reset_write() = 0; - -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_IFile_H - diff --git a/dep/include/sockets/ISocketHandler.h b/dep/include/sockets/ISocketHandler.h deleted file mode 100644 index 2667e2d22..000000000 --- a/dep/include/sockets/ISocketHandler.h +++ /dev/null @@ -1,232 +0,0 @@ -/** \file ISocketHandler.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ISocketHandler_H -#define _SOCKETS_ISocketHandler_H -#include "sockets-config.h" - -#include - -#include "socket_include.h" -#include "Socket.h" -#include "StdLog.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -typedef enum { - LIST_CALLONCONNECT = 0, -#ifdef ENABLE_DETACH - LIST_DETACH, -#endif - LIST_TIMEOUT, - LIST_RETRY, - LIST_CLOSE -} list_t; - -class SocketAddress; -class Mutex; - - -/** Socket container class, event generator. - \ingroup basic */ -class ISocketHandler -{ - friend class Socket; - -public: - /** Connection pool class for internal use by the ISocketHandler. - \ingroup internal */ -#ifdef ENABLE_POOL - class PoolSocket : public Socket - { - public: - PoolSocket(ISocketHandler& h,Socket *src) : Socket(h) { - CopyConnection( src ); - SetIsClient(); - } - - void OnRead() { - Handler().LogError(this, "OnRead", 0, "data on hibernating socket", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - void OnOptions(int,int,int,SOCKET) {} - - }; -#endif - -public: - virtual ~ISocketHandler() {} - - /** Get mutex reference for threadsafe operations. */ - virtual Mutex& GetMutex() const = 0; - - /** Register StdLog object for error callback. - \param log Pointer to log class */ - virtual void RegStdLog(StdLog *log) = 0; - - /** Log error to log class for print out / storage. */ - virtual void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING) = 0; - - // ------------------------------------------------------------------------- - // Socket stuff - // ------------------------------------------------------------------------- - /** Add socket instance to socket map. Removal is always automatic. */ - virtual void Add(Socket *) = 0; -private: - /** Remove socket from socket map, used by Socket class. */ - virtual void Remove(Socket *) = 0; -public: - /** Get status of read/write/exception file descriptor set for a socket. */ - virtual void Get(SOCKET s,bool& r,bool& w,bool& e) = 0; - /** Set read/write/exception file descriptor sets (fd_set). */ - virtual void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true) = 0; - - /** Wait for events, generate callbacks. */ - virtual int Select(long sec,long usec) = 0; - /** This method will not return until an event has been detected. */ - virtual int Select() = 0; - /** Wait for events, generate callbacks. */ - virtual int Select(struct timeval *tsel) = 0; - - /** Check that a socket really is handled by this socket handler. */ - virtual bool Valid(Socket *) = 0; - /** Return number of sockets handled by this handler. */ - virtual size_t GetCount() = 0; - - /** Override and return false to deny all incoming connections. - \param p ListenSocket class pointer (use GetPort to identify which one) */ - virtual bool OkToAccept(Socket *p) = 0; - - /** Called by Socket when a socket changes state. */ - virtual void AddList(SOCKET s,list_t which_one,bool add) = 0; - - // ------------------------------------------------------------------------- - // Connection pool - // ------------------------------------------------------------------------- -#ifdef ENABLE_POOL - /** Find available open connection (used by connection pool). */ - virtual ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&) = 0; - /** Enable connection pool (by default disabled). */ - virtual void EnablePool(bool = true) = 0; - /** Check pool status. - \return true if connection pool is enabled */ - virtual bool PoolEnabled() = 0; -#endif // ENABLE_POOL - - // ------------------------------------------------------------------------- - // Socks4 - // ------------------------------------------------------------------------- -#ifdef ENABLE_SOCKS4 - /** Set socks4 server ip that all new tcp sockets should use. */ - virtual void SetSocks4Host(ipaddr_t) = 0; - /** Set socks4 server hostname that all new tcp sockets should use. */ - virtual void SetSocks4Host(const std::string& ) = 0; - /** Set socks4 server port number that all new tcp sockets should use. */ - virtual void SetSocks4Port(port_t) = 0; - /** Set optional socks4 userid. */ - virtual void SetSocks4Userid(const std::string& ) = 0; - /** If connection to socks4 server fails, immediately try direct connection to final host. */ - virtual void SetSocks4TryDirect(bool = true) = 0; - /** Get socks4 server ip. - \return socks4 server ip */ - virtual ipaddr_t GetSocks4Host() = 0; - /** Get socks4 port number. - \return socks4 port number */ - virtual port_t GetSocks4Port() = 0; - /** Get socks4 userid (optional). - \return socks4 userid */ - virtual const std::string& GetSocks4Userid() = 0; - /** Check status of socks4 try direct flag. - \return true if direct connection should be tried if connection to socks4 server fails */ - virtual bool Socks4TryDirect() = 0; -#endif // ENABLE_SOCKS4 - - // ------------------------------------------------------------------------- - // DNS resolve server - // ------------------------------------------------------------------------- -#ifdef ENABLE_RESOLVER - /** Enable asynchronous DNS. - \param port Listen port of asynchronous dns server */ - virtual void EnableResolver(port_t = 16667) = 0; - /** Check resolver status. - \return true if resolver is enabled */ - virtual bool ResolverEnabled() = 0; - /** Queue a dns request. - \param host Hostname to be resolved - \param port Port number will be echoed in Socket::OnResolved callback */ - virtual int Resolve(Socket *,const std::string& host,port_t port) = 0; -#ifdef ENABLE_IPV6 - virtual int Resolve6(Socket *,const std::string& host,port_t port) = 0; -#endif - /** Do a reverse dns lookup. */ - virtual int Resolve(Socket *,ipaddr_t a) = 0; -#ifdef ENABLE_IPV6 - virtual int Resolve(Socket *,in6_addr& a) = 0; -#endif - /** Get listen port of asynchronous dns server. */ - virtual port_t GetResolverPort() = 0; - /** Resolver thread ready for queries. */ - virtual bool ResolverReady() = 0; - /** Returns true if socket waiting for a resolve event. */ - virtual bool Resolving(Socket *) = 0; -#endif // ENABLE_RESOLVER - -#ifdef ENABLE_TRIGGERS - /** Fetch unique trigger id. */ - virtual int TriggerID(Socket *src) = 0; - /** Subscribe socket to trigger id. */ - virtual bool Subscribe(int id, Socket *dst) = 0; - /** Unsubscribe socket from trigger id. */ - virtual bool Unsubscribe(int id, Socket *dst) = 0; - /** Execute OnTrigger for subscribed sockets. - \param id Trigger ID - \param data Data passed from source to destination - \param erase Empty trigger id source and destination maps if 'true', - Leave them in place if 'false' - if a trigger should be called many times */ - virtual void Trigger(int id, Socket::TriggerData& data, bool erase = true) = 0; -#endif // ENABLE_TRIGGERS - -#ifdef ENABLE_DETACH - /** Indicates that the handler runs under SocketThread. */ - virtual void SetSlave(bool x = true) = 0; - /** Indicates that the handler runs under SocketThread. */ - virtual bool IsSlave() = 0; -#endif // ENABLE_DETACH - -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_ISocketHandler_H - diff --git a/dep/include/sockets/Ipv4Address.h b/dep/include/sockets/Ipv4Address.h deleted file mode 100644 index b58c2ce94..000000000 --- a/dep/include/sockets/Ipv4Address.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - ** \file Ipv4Address.h - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Ipv4Address_H -#define _SOCKETS_Ipv4Address_H - -#include "sockets-config.h" -#include "SocketAddress.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/* Ipv4 address implementation. - \ingroup basic */ -class Ipv4Address : public SocketAddress -{ -public: - /** Create empty Ipv4 address structure. - \param port Port number */ - Ipv4Address(port_t port = 0); - /** Create Ipv4 address structure. - \param a Socket address in network byte order (as returned by Utility::u2ip) - \param port Port number in host byte order */ - Ipv4Address(ipaddr_t a,port_t port); - /** Create Ipv4 address structure. - \param a Socket address in network byte order - \param port Port number in host byte order */ - Ipv4Address(struct in_addr& a,port_t port); - /** Create Ipv4 address structure. - \param host Hostname to be resolved - \param port Port number in host byte order */ - Ipv4Address(const std::string& host,port_t port); - Ipv4Address(struct sockaddr_in&); - ~Ipv4Address(); - - // SocketAddress implementation - - operator struct sockaddr *(); - operator socklen_t(); - bool operator==(SocketAddress&); - - void SetPort(port_t port); - port_t GetPort(); - - void SetAddress(struct sockaddr *sa); - int GetFamily(); - - bool IsValid(); - std::auto_ptr GetCopy(); - - /** Convert address struct to text. */ - std::string Convert(bool include_port = false); - std::string Reverse(); - - /** Resolve hostname. */ -static bool Resolve(const std::string& hostname,struct in_addr& a); - /** Reverse resolve (IP to hostname). */ -static bool Reverse(struct in_addr& a,std::string& name); - /** Convert address struct to text. */ -static std::string Convert(struct in_addr& a); - -private: - Ipv4Address(const Ipv4Address& ) {} // copy constructor - Ipv4Address& operator=(const Ipv4Address& ) { return *this; } // assignment operator - struct sockaddr_in m_addr; - bool m_valid; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // _SOCKETS_Ipv4Address_H - diff --git a/dep/include/sockets/Ipv6Address.h b/dep/include/sockets/Ipv6Address.h deleted file mode 100644 index a07114179..000000000 --- a/dep/include/sockets/Ipv6Address.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - ** \file Ipv6Address.h - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Ipv6Address_H -#define _SOCKETS_Ipv6Address_H -#include "sockets-config.h" -#ifdef ENABLE_IPV6 - -#include "SocketAddress.h" -#ifdef IPPROTO_IPV6 -#if defined( _WIN32) && !defined(__CYGWIN__) -typedef unsigned __int32 uint32_t; -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/** Ipv6 address implementation. - \ingroup basic */ -class Ipv6Address : public SocketAddress -{ -public: - /** Create empty Ipv6 address structure. - \param port Port number */ - Ipv6Address(port_t port = 0); - /** Create Ipv6 address structure. - \param a Socket address in network byte order - \param port Port number in host byte order */ - Ipv6Address(struct in6_addr& a,port_t port); - /** Create Ipv6 address structure. - \param host Hostname to be resolved - \param port Port number in host byte order */ - Ipv6Address(const std::string& host,port_t port); - Ipv6Address(struct sockaddr_in6&); - ~Ipv6Address(); - - // SocketAddress implementation - - operator struct sockaddr *(); - operator socklen_t(); - bool operator==(SocketAddress&); - - void SetPort(port_t port); - port_t GetPort(); - - void SetAddress(struct sockaddr *sa); - int GetFamily(); - - bool IsValid(); - std::auto_ptr GetCopy(); - - /** Convert address struct to text. */ - std::string Convert(bool include_port = false); - std::string Reverse(); - - /** Resolve hostname. */ -static bool Resolve(const std::string& hostname,struct in6_addr& a); - /** Reverse resolve (IP to hostname). */ -static bool Reverse(struct in6_addr& a,std::string& name); - /** Convert address struct to text. */ -static std::string Convert(struct in6_addr& a,bool mixed = false); - - void SetFlowinfo(uint32_t); - uint32_t GetFlowinfo(); -#ifndef _WIN32 - void SetScopeId(uint32_t); - uint32_t GetScopeId(); -#endif - -private: - Ipv6Address(const Ipv6Address& ) {} // copy constructor - Ipv6Address& operator=(const Ipv6Address& ) { return *this; } // assignment operator - struct sockaddr_in6 m_addr; - bool m_valid; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // IPPROTO_IPV6 -#endif // ENABLE_IPV6 -#endif // _SOCKETS_Ipv6Address_H - diff --git a/dep/include/sockets/ListenSocket.h b/dep/include/sockets/ListenSocket.h deleted file mode 100644 index f4edc37d6..000000000 --- a/dep/include/sockets/ListenSocket.h +++ /dev/null @@ -1,420 +0,0 @@ -/** \file ListenSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ListenSocket_H -#define _SOCKETS_ListenSocket_H -#include "sockets-config.h" - -#ifdef _WIN32 -#include -#else -#include -#endif - -#include "ISocketHandler.h" -#include "Socket.h" -#include "Utility.h" -#include "SctpSocket.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/** Binds incoming port number to new Socket class X. - \ingroup basic */ -template -class ListenSocket : public Socket -{ -public: - /** Constructor. - \param h ISocketHandler reference - \param use_creator Optional use of creator (default true) */ - ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL) - ,m_bHasCreate(false) - { - if (use_creator) - { - m_creator = new X(h); - Socket *tmp = m_creator -> Create(); - if (tmp && dynamic_cast(tmp)) - { - m_bHasCreate = true; - } - if (tmp) - { - delete tmp; - } - } - } - ~ListenSocket() { - if (m_creator) - { - delete m_creator; - } - } - - /** Close file descriptor. */ - int Close() { - if (GetSocket() != INVALID_SOCKET) - { - closesocket(GetSocket()); - } - return 0; - } - - /** Bind and listen to any interface. - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(port_t port,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, depth); - } - else -#endif -#endif - { - Ipv4Address ad(port); - return Bind(ad, depth); - } - } - - int Bind(SocketAddress& ad,int depth) { -#ifdef USE_SCTP - if (dynamic_cast(m_creator)) - { - return Bind(ad, "sctp", depth); - } -#endif - return Bind(ad, "tcp", depth); - } - - /** Bind and listen to any interface, with optional protocol. - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(port_t port,const std::string& protocol,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, protocol, depth); - } - else -#endif -#endif - { - Ipv4Address ad(port); - return Bind(ad, protocol, depth); - } - } - - /** Bind and listen to specific interface. - \param intf Interface hostname - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(const std::string& intf,port_t port,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - else -#endif -#endif - { - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - } - - /** Bind and listen to specific interface. - \param intf Interface hostname - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(const std::string& intf,port_t port,const std::string& protocol,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, protocol, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - else -#endif -#endif - { - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, protocol, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - } - - /** Bind and listen to ipv4 interface. - \param a Ipv4 interface address - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(ipaddr_t a,port_t port,int depth = 20) { - Ipv4Address ad(a, port); -#ifdef USE_SCTP - if (dynamic_cast(m_creator)) - { - return Bind(ad, "sctp", depth); - } -#endif - return Bind(ad, "tcp", depth); - } - /** Bind and listen to ipv4 interface. - \param a Ipv4 interface address - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(ipaddr_t a,port_t port,const std::string& protocol,int depth) { - Ipv4Address ad(a, port); - return Bind(ad, protocol, depth); - } - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Bind and listen to ipv6 interface. - \param a Ipv6 interface address - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(in6_addr a,port_t port,int depth = 20) { - Ipv6Address ad(a, port); -#ifdef USE_SCTP - if (dynamic_cast(m_creator)) - { - return Bind(ad, "sctp", depth); - } -#endif - return Bind(ad, "tcp", depth); - } - /** Bind and listen to ipv6 interface. - \param a Ipv6 interface address - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(in6_addr a,port_t port,const std::string& protocol,int depth) { - Ipv6Address ad(a, port); - return Bind(ad, protocol, depth); - } -#endif -#endif - - /** Bind and listen to network interface. - \param ad Interface address - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(SocketAddress& ad,const std::string& protocol,int depth) { - SOCKET s; - if ( (s = CreateSocket(ad.GetFamily(), SOCK_STREAM, protocol)) == INVALID_SOCKET) - { - return -1; - } - if (bind(s, ad, ad) == -1) - { - Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); - closesocket(s); -#ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); -#endif - return -1; - } - if (listen(s, depth) == -1) - { - Handler().LogError(this, "listen", Errno, StrError(Errno), LOG_LEVEL_FATAL); - closesocket(s); -#ifdef ENABLE_EXCEPTIONS - throw Exception("listen() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); -#endif - return -1; - } - m_depth = depth; - Attach(s); - return 0; - } - - /** Return assigned port number. */ - port_t GetPort() - { - return GetSockPort(); - } - - /** Return listen queue depth. */ - int GetDepth() - { - return m_depth; - } - - /** OnRead on a ListenSocket receives an incoming connection. */ - void OnRead() - { - struct sockaddr sa; - socklen_t sa_len = sizeof(struct sockaddr); - SOCKET a_s = accept(GetSocket(), &sa, &sa_len); - - if (a_s == INVALID_SOCKET) - { - Handler().LogError(this, "accept", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return; - } - if (!Handler().OkToAccept(this)) - { - Handler().LogError(this, "accept", -1, "Not OK to accept", LOG_LEVEL_WARNING); - closesocket(a_s); - return; - } - if (Handler().GetCount() >= FD_SETSIZE) - { - Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler fd_set limit reached", LOG_LEVEL_FATAL); - closesocket(a_s); - return; - } - Socket *tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); -#ifdef ENABLE_IPV6 - tmp -> SetIpv6( IsIpv6() ); -#endif - tmp -> SetParent(this); - tmp -> Attach(a_s); - tmp -> SetNonblocking(true); - { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (sa_len == sizeof(struct sockaddr_in6)) - { - struct sockaddr_in6 *p = (struct sockaddr_in6 *)&sa; - if (p -> sin6_family == AF_INET6) - { - Ipv6Address ad(p -> sin6_addr,ntohs(p -> sin6_port)); - ad.SetFlowinfo(p -> sin6_flowinfo); -#ifndef _WIN32 - ad.SetScopeId(p -> sin6_scope_id); -#endif - tmp -> SetRemoteAddress(ad); - } - } -#endif -#endif - if (sa_len == sizeof(struct sockaddr_in)) - { - struct sockaddr_in *p = (struct sockaddr_in *)&sa; - if (p -> sin_family == AF_INET) - { - Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); - tmp -> SetRemoteAddress(ad); - } - } - } - tmp -> SetConnected(true); - tmp -> Init(); - tmp -> SetDeleteByHandler(true); - Handler().Add(tmp); -#ifdef HAVE_OPENSSL - if (tmp -> IsSSL()) // SSL Enabled socket - { - // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. - // %! If that happens and negotiation fails, the 'tmp' instance is - // %! still added to the list of active sockets in the sockethandler. - // %! See bugfix for this in SocketHandler::Select - don't Set rwx - // %! flags if CloseAndDelete() flag is true. - // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids - // %! the Add problem altogether, so ignore the above. - // %! (OnSSLAccept does no longer call SSLNegotiate().) - tmp -> OnSSLAccept(); - } - else -#endif - { - tmp -> OnAccept(); - } - } - - /** Please don't use this method. - "accept()" is handled automatically in the OnRead() method. */ - virtual SOCKET Accept(SOCKET socket, struct sockaddr *saptr, socklen_t *lenptr) - { - return accept(socket, saptr, lenptr); - } - - bool HasCreator() { return m_bHasCreate; } - - void OnOptions(int,int,int,SOCKET) { - SetSoReuseaddr(true); - } - -protected: - ListenSocket(const ListenSocket& s) : Socket(s) {} -private: - ListenSocket& operator=(const ListenSocket& ) { return *this; } - int m_depth; - X *m_creator; - bool m_bHasCreate; -}; - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_ListenSocket_H - diff --git a/dep/include/sockets/Lock.h b/dep/include/sockets/Lock.h deleted file mode 100644 index 71fdd5e73..000000000 --- a/dep/include/sockets/Lock.h +++ /dev/null @@ -1,59 +0,0 @@ -/** \file Lock.h - ** \date 2005-08-22 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005,2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Lock_H -#define _SOCKETS_Lock_H - -#include "sockets-config.h" -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -class Mutex; - -/** Mutex encapsulation class. - \ingroup threading */ -class Lock -{ -public: - Lock(Mutex&); - ~Lock(); - -private: - Mutex& m_mutex; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // _SOCKETS_Lock_H - diff --git a/dep/include/sockets/Mutex.h b/dep/include/sockets/Mutex.h deleted file mode 100644 index 1de27760a..000000000 --- a/dep/include/sockets/Mutex.h +++ /dev/null @@ -1,68 +0,0 @@ -/** \file Mutex.h - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Mutex_H -#define _SOCKETS_Mutex_H - -#include "sockets-config.h" -#ifndef _WIN32 -#include -#else -#include -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -/** Mutex container class, used by Lock. - \ingroup threading */ -class Mutex -{ - friend class Lock; -public: - Mutex(); - ~Mutex(); - - void Lock(); - void Unlock(); -private: -#ifdef _WIN32 - HANDLE m_mutex; -#else - pthread_mutex_t m_mutex; -#endif -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // _SOCKETS_Mutex_H - diff --git a/dep/include/sockets/Parse.h b/dep/include/sockets/Parse.h deleted file mode 100644 index 6961f3b1b..000000000 --- a/dep/include/sockets/Parse.h +++ /dev/null @@ -1,101 +0,0 @@ -/** \file Parse.h - parse a string - ** - ** Written: 1999-Feb-10 grymse@alhem.net - **/ - -/* -Copyright (C) 1999-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _SOCKETS_Parse_H -#define _SOCKETS_Parse_H - -#include "sockets-config.h" -#ifdef _MSC_VER -#pragma warning(disable:4514) -#endif - -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/***************************************************/ -/* interface of class Parse */ - -/** Splits a string whatever way you want. - \ingroup util */ -class Parse -{ -public: - Parse(); - Parse(const std::string&); - Parse(const std::string&,const std::string&); - Parse(const std::string&,const std::string&,short); - ~Parse(); - short issplit(const char); - void getsplit(); - void getsplit(std::string&); - std::string getword(); - void getword(std::string&); - void getword(std::string&,std::string&,int); - std::string getrest(); - void getrest(std::string&); - long getvalue(); - void setbreak(const char); - int getwordlen(); - int getrestlen(); - void enablebreak(const char c) { - pa_enable = c; - } - void disablebreak(const char c) { - pa_disable = c; - } - void getline(); - void getline(std::string&); - size_t getptr() { return pa_the_ptr; } - void EnableQuote(bool b) { pa_quote = b; } - -private: - std::string pa_the_str; - std::string pa_splits; - std::string pa_ord; - size_t pa_the_ptr; - char pa_breakchar; - char pa_enable; - char pa_disable; - short pa_nospace; - bool pa_quote; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Parse_H - diff --git a/dep/include/sockets/ResolvServer.h b/dep/include/sockets/ResolvServer.h deleted file mode 100644 index f8f8f5aad..000000000 --- a/dep/include/sockets/ResolvServer.h +++ /dev/null @@ -1,73 +0,0 @@ -/** \file ResolvServer.h - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ResolvServer_H -#define _SOCKETS_ResolvServer_H -#include "sockets-config.h" -#ifdef ENABLE_RESOLVER -#include "socket_include.h" -#include "Thread.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -/** \defgroup async Asynchronous DNS */ -/** Async DNS resolver thread. - \ingroup async */ -class ResolvServer : public Thread -{ -public: - ResolvServer(port_t); - ~ResolvServer(); - - void Run(); - void Quit(); - - bool Ready(); - -private: - ResolvServer(const ResolvServer& ) {} // copy constructor - ResolvServer& operator=(const ResolvServer& ) { return *this; } // assignment operator - - bool m_quit; - port_t m_port; - bool m_ready; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER -#endif // _SOCKETS_ResolvServer_H - diff --git a/dep/include/sockets/ResolvSocket.h b/dep/include/sockets/ResolvSocket.h deleted file mode 100644 index ff4b1a5a9..000000000 --- a/dep/include/sockets/ResolvSocket.h +++ /dev/null @@ -1,106 +0,0 @@ -/** \file ResolvSocket.h - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ResolvSocket_H -#define _SOCKETS_ResolvSocket_H -#include "sockets-config.h" -#ifdef ENABLE_RESOLVER -#include "TcpSocket.h" -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -class Mutex; - -/** Async DNS resolver socket. - \ingroup async */ -class ResolvSocket : public TcpSocket -{ - typedef std::map > cache_t; /* host, result */ - typedef std::map > timeout_t; /* host, time */ - -public: - ResolvSocket(ISocketHandler&); - ResolvSocket(ISocketHandler&, Socket *parent, const std::string& host, port_t port, bool ipv6 = false); - ResolvSocket(ISocketHandler&, Socket *parent, ipaddr_t); -#ifdef ENABLE_IPV6 - ResolvSocket(ISocketHandler&, Socket *parent, in6_addr&); -#endif - ~ResolvSocket(); - - void OnAccept() { m_bServer = true; } - void OnLine(const std::string& line); - void OnDetached(); - void OnDelete(); - - void SetId(int x) { m_resolv_id = x; } - int GetId() { return m_resolv_id; } - - void OnConnect(); - -#ifdef ENABLE_IPV6 - void SetResolveIpv6(bool x = true) { m_resolve_ipv6 = x; } -#endif - -private: - ResolvSocket(const ResolvSocket& s) : TcpSocket(s) {} // copy constructor - ResolvSocket& operator=(const ResolvSocket& ) { return *this; } // assignment operator - - std::string m_query; - std::string m_data; - bool m_bServer; - Socket *m_parent; - int m_resolv_id; - std::string m_resolv_host; - port_t m_resolv_port; - ipaddr_t m_resolv_address; -#ifdef ENABLE_IPV6 - bool m_resolve_ipv6; - in6_addr m_resolv_address6; -#endif - static cache_t m_cache; - static timeout_t m_cache_to; - static Mutex m_cache_mutex; - bool m_cached; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER -#endif // _SOCKETS_ResolvSocket_H - diff --git a/dep/include/sockets/SctpSocket.h b/dep/include/sockets/SctpSocket.h deleted file mode 100644 index d6d55f6be..000000000 --- a/dep/include/sockets/SctpSocket.h +++ /dev/null @@ -1,109 +0,0 @@ -/** - ** \file SctpSocket.h - ** \date 2006-09-04 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SctpSocket_H -#define _SOCKETS_SctpSocket_H -#include "sockets-config.h" - -#include "StreamSocket.h" -#ifdef USE_SCTP -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#define SCTP_BUFSIZE_READ 16400 - -class SocketAddress; - - -class SctpSocket : public StreamSocket -{ -public: - /** SctpSocket constructor. - \param h Owner - \param type SCTP_STREAM or SCTP_SEQPACKET */ - SctpSocket(ISocketHandler& h,int type); - ~SctpSocket(); - - /** bind() */ - int Bind(const std::string&,port_t); - int Bind(SocketAddress&); - /** sctp_bindx() */ - int AddAddress(const std::string&,port_t); - int AddAddress(SocketAddress&); - /** sctp_bindx() */ - int RemoveAddress(const std::string&,port_t); - int RemoveAddress(SocketAddress&); - - /** connect() */ - int Open(const std::string&,port_t); - int Open(SocketAddress&); - - /** Connect timeout callback. */ - void OnConnectTimeout(); -#ifdef _WIN32 - /** Connection failed reported as exception on win32 */ - void OnException(); -#endif - -#ifndef SOLARIS - /** sctp_connectx() */ - int AddConnection(const std::string&,port_t); - int AddConnection(SocketAddress&); -#endif - - /** Get peer addresses of an association. */ - int getpaddrs(sctp_assoc_t id,std::list&); - /** Get all bound addresses of an association. */ - int getladdrs(sctp_assoc_t id,std::list&); - - /** sctp_peeloff */ - int PeelOff(sctp_assoc_t id); - - /** recvmsg callback */ - virtual void OnReceiveMessage(const char *buf,size_t sz,struct sockaddr *sa,socklen_t sa_len,struct sctp_sndrcvinfo *sinfo,int msg_flags) = 0; - - void OnOptions(int,int,int,SOCKET) {} - - virtual int Protocol(); - -protected: - SctpSocket(const SctpSocket& s) : StreamSocket(s) {} - void OnRead(); - void OnWrite(); - -private: - SctpSocket& operator=(const SctpSocket& s) { return *this; } - int m_type; ///< SCTP_STREAM or SCTP_SEQPACKET - char *m_buf; ///< Temporary receive buffer -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE -#endif - -#endif // USE_SCTP -#endif // _SOCKETS_SctpSocket_H - diff --git a/dep/include/sockets/Socket.h b/dep/include/sockets/Socket.h deleted file mode 100644 index bdb5fc603..000000000 --- a/dep/include/sockets/Socket.h +++ /dev/null @@ -1,739 +0,0 @@ -/** \file Socket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This software is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Socket_H -#define _SOCKETS_Socket_H -#include "sockets-config.h" - -#include -#include -#include -#ifdef HAVE_OPENSSL -#include -#endif - -#include "socket_include.h" -#include -#include "SocketAddress.h" -#include "Thread.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -class ISocketHandler; -class SocketAddress; -class IFile; - - -/** \defgroup basic Basic sockets */ -/** Socket base class. - \ingroup basic */ -class Socket -{ - friend class ISocketHandler; -#ifdef ENABLE_DETACH - /** Detached socket run thread. - \ingroup internal */ - class SocketThread : public Thread - { - public: - SocketThread(Socket *p); - ~SocketThread(); - - void Run(); - - private: - Socket *GetSocket() const { return m_socket; } - SocketThread(const SocketThread& s) : m_socket(s.GetSocket()) {} - SocketThread& operator=(const SocketThread& ) { return *this; } - Socket *m_socket; - }; -#endif // ENABLE_DETACH - -#ifdef ENABLE_TRIGGERS -public: - /** Data pass class from source to destination. */ - class TriggerData - { - public: - TriggerData() : m_src(NULL) {} - virtual ~TriggerData() {} - - Socket *GetSource() const { return m_src; } - void SetSource(Socket *x) { m_src = x; } - - private: - Socket *m_src; - }; -#endif // ENABLE_TRIGGERS - - /** Socket mode flags. */ -/* - enum { - // Socket - SOCK_DEL = 0x01, ///< Delete by handler flag - SOCK_CLOSE = 0x02, ///< Close and delete flag - SOCK_DISABLE_READ = 0x04, ///< Disable checking for read events - SOCK_CONNECTED = 0x08, ///< Socket is connected (tcp/udp) - - SOCK_ERASED_BY_HANDLER = 0x10, ///< Set by handler before delete - // HAVE_OPENSSL - SOCK_ENABLE_SSL = 0x20, ///< Enable SSL for this TcpSocket - SOCK_SSL = 0x40, ///< ssl negotiation mode (TcpSocket) - SOCK_SSL_SERVER = 0x80, ///< True if this is an incoming ssl TcpSocket connection - - // ENABLE_IPV6 - SOCK_IPV6 = 0x0100, ///< This is an ipv6 socket if this one is true - // ENABLE_POOL - SOCK_CLIENT = 0x0200, ///< only client connections are pooled - SOCK_RETAIN = 0x0400, ///< keep connection on close - SOCK_LOST = 0x0800, ///< connection lost - - // ENABLE_SOCKS4 - SOCK_SOCKS4 = 0x1000, ///< socks4 negotiation mode (TcpSocket) - // ENABLE_DETACH - SOCK_DETACH = 0x2000, ///< Socket ordered to detach flag - SOCK_DETACHED = 0x4000, ///< Socket has been detached - // StreamSocket - STREAMSOCK_CONNECTING = 0x8000, ///< Flag indicating connection in progress - - STREAMSOCK_FLUSH_BEFORE_CLOSE = 0x010000L, ///< Send all data before closing (default true) - STREAMSOCK_CALL_ON_CONNECT = 0x020000L, ///< OnConnect will be called next ISocketHandler cycle if true - STREAMSOCK_RETRY_CONNECT = 0x040000L, ///< Try another connection attempt next ISocketHandler cycle - STREAMSOCK_LINE_PROTOCOL = 0x080000L, ///< Line protocol mode flag - - }; -*/ - -public: - /** "Default" constructor */ - Socket(ISocketHandler&); - - virtual ~Socket(); - - /** Socket class instantiation method. Used when a "non-standard" constructor - * needs to be used for the socket class. Note: the socket class still needs - * the "default" constructor with one ISocketHandler& as input parameter. - */ - virtual Socket *Create() { return NULL; } - - /** Returns reference to sockethandler that owns the socket. - If the socket is detached, this is a reference to the slave sockethandler. - */ - ISocketHandler& Handler() const; - - /** Returns reference to sockethandler that owns the socket. - This one always returns the reference to the original sockethandler, - even if the socket is detached. - */ - ISocketHandler& MasterHandler() const; - - /** Called by ListenSocket after accept but before socket is added to handler. - * CTcpSocket uses this to create its ICrypt member variable. - * The ICrypt member variable is created by a virtual method, therefore - * it can't be called directly from the CTcpSocket constructor. - * Also used to determine if incoming HTTP connection is normal (port 80) - * or ssl (port 443). - */ - virtual void Init(); - - /** Create a socket file descriptor. - \param af Address family AF_INET / AF_INET6 / ... - \param type SOCK_STREAM / SOCK_DGRAM / ... - \param protocol "tcp" / "udp" / ... */ - SOCKET CreateSocket(int af,int type,const std::string& protocol = ""); - - /** Assign this socket a file descriptor created - by a call to socket() or otherwise. */ - void Attach(SOCKET s); - - /** Return file descriptor assigned to this socket. */ - SOCKET GetSocket(); - - /** Close connection immediately - internal use. - \sa SetCloseAndDelete */ - virtual int Close(); - - /** Add file descriptor to sockethandler fd_set's. */ - void Set(bool bRead,bool bWrite,bool bException = true); - - /** Returns true when socket file descriptor is valid - and socket is not about to be closed. */ - virtual bool Ready(); - - /** Returns pointer to ListenSocket that created this instance - * on an incoming connection. */ - Socket *GetParent(); - - /** Used by ListenSocket to set parent pointer of newly created - * socket instance. */ - void SetParent(Socket *); - - /** Get listening port from ListenSocket<>. */ - virtual port_t GetPort(); - - /** Set socket non-block operation. */ - bool SetNonblocking(bool); - - /** Set socket non-block operation. */ - bool SetNonblocking(bool, SOCKET); - - /** Total lifetime of instance. */ - time_t Uptime(); - - /** Set address/port of last connect() call. */ - void SetClientRemoteAddress(SocketAddress&); - - /** Get address/port of last connect() call. */ - std::auto_ptr GetClientRemoteAddress(); - - /** Common interface for SendBuf used by Tcp and Udp sockets. */ - virtual void SendBuf(const char *,size_t,int = 0); - - /** Common interface for Send used by Tcp and Udp sockets. */ - virtual void Send(const std::string&,int = 0); - - /** Outgoing traffic counter. */ - virtual uint64_t GetBytesSent(bool clear = false); - - /** Incoming traffic counter. */ - virtual uint64_t GetBytesReceived(bool clear = false); - - // LIST_TIMEOUT - - /** Enable timeout control. 0=disable timeout check. */ - void SetTimeout(time_t secs); - - /** Check timeout. \return true if time limit reached */ - bool Timeout(time_t tnow); - - /** Used by ListenSocket. ipv4 and ipv6 */ - void SetRemoteAddress(SocketAddress&); - - /** \name Event callbacks */ - //@{ - - /** Called when there is something to be read from the file descriptor. */ - virtual void OnRead(); - /** Called when there is room for another write on the file descriptor. */ - virtual void OnWrite(); - /** Called on socket exception. */ - virtual void OnException(); - /** Called before a socket class is deleted by the ISocketHandler. */ - virtual void OnDelete(); - /** Called when a connection has completed. */ - virtual void OnConnect(); - /** Called when an incoming connection has been completed. */ - virtual void OnAccept(); - /** Called when a complete line has been read and the socket is in - * line protocol mode. */ - virtual void OnLine(const std::string& ); - /** Called on connect timeout (5s). */ - virtual void OnConnectFailed(); - /** Called when a client socket is created, to set socket options. - \param family AF_INET, AF_INET6, etc - \param type SOCK_STREAM, SOCK_DGRAM, etc - \param protocol Protocol number (tcp, udp, sctp, etc) - \param s Socket file descriptor - */ - virtual void OnOptions(int family,int type,int protocol,SOCKET s) = 0; - /** Connection retry callback - return false to abort connection attempts */ - virtual bool OnConnectRetry(); -#ifdef ENABLE_RECONNECT - /** a reconnect has been made */ - virtual void OnReconnect(); -#endif - /** TcpSocket: When a disconnect has been detected (recv/SSL_read returns 0 bytes). */ - virtual void OnDisconnect(); - /** Timeout callback. */ - virtual void OnTimeout(); - /** Connection timeout. */ - virtual void OnConnectTimeout(); - //@} - - /** \name Socket mode flags, set/reset */ - //@{ - /** Set delete by handler true when you want the sockethandler to - delete the socket instance after use. */ - void SetDeleteByHandler(bool = true); - /** Check delete by handler flag. - \return true if this instance should be deleted by the sockethandler */ - bool DeleteByHandler(); - - // LIST_CLOSE - conditional event queue - - /** Set close and delete to terminate the connection. */ - void SetCloseAndDelete(bool = true); - /** Check close and delete flag. - \return true if this socket should be closed and the instance removed */ - bool CloseAndDelete(); - - /** Return number of seconds since socket was ordered to close. \sa SetCloseAndDelete */ - time_t TimeSinceClose(); - - /** Ignore read events for an output only socket. */ - void DisableRead(bool x = true); - /** Check ignore read events flag. - \return true if read events should be ignored */ - bool IsDisableRead(); - - /** Set connected status. */ - void SetConnected(bool = true); - /** Check connected status. - \return true if connected */ - bool IsConnected(); - - /** Connection lost - error while reading/writing from a socket - TcpSocket only. */ - void SetLost(); - /** Check connection lost status flag, used by TcpSocket only. - \return true if there was an error while r/w causing the socket to close */ - bool Lost(); - - /** Set flag indicating the socket is being actively deleted by the sockethandler. */ - void SetErasedByHandler(bool x = true); - /** Get value of flag indicating socket is deleted by sockethandler. */ - bool ErasedByHandler(); - - //@} - - /** \name Information about remote connection */ - //@{ - /** Returns address of remote end. */ - std::auto_ptr GetRemoteSocketAddress(); - /** Returns address of remote end: ipv4. */ - ipaddr_t GetRemoteIP4(); -#ifdef ENABLE_IPV6 - /** Returns address of remote end: ipv6. */ -#ifdef IPPROTO_IPV6 - struct in6_addr GetRemoteIP6(); -#endif -#endif - /** Returns remote port number: ipv4 and ipv6. */ - port_t GetRemotePort(); - /** Returns remote ip as string? ipv4 and ipv6. */ - std::string GetRemoteAddress(); - /** ipv4 and ipv6(not implemented) */ - std::string GetRemoteHostname(); - //@} - - /** Returns local port number for bound socket file descriptor. */ - port_t GetSockPort(); - /** Returns local ipv4 address for bound socket file descriptor. */ - ipaddr_t GetSockIP4(); - /** Returns local ipv4 address as text for bound socket file descriptor. */ - std::string GetSockAddress(); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Returns local ipv6 address for bound socket file descriptor. */ - struct in6_addr GetSockIP6(); - /** Returns local ipv6 address as text for bound socket file descriptor. */ - std::string GetSockAddress6(); -#endif -#endif - // -------------------------------------------------------------------------- - /** @name IP options - When an ip or socket option is available on all of the operating systems - I'm testing on (linux 2.4.x, _win32, macosx, solaris9 intel) they are not - checked with an #ifdef below. - This might cause a compile error on other operating systems. */ - // -------------------------------------------------------------------------- - - // IP options - //@{ - - bool SetIpOptions(const void *p, socklen_t len); - bool SetIpTOS(unsigned char tos); - unsigned char IpTOS(); - bool SetIpTTL(int ttl); - int IpTTL(); - bool SetIpHdrincl(bool x = true); - bool SetIpMulticastTTL(int); - int IpMulticastTTL(); - bool SetMulticastLoop(bool x = true); - bool IpAddMembership(struct ip_mreq&); - bool IpDropMembership(struct ip_mreq&); - -#ifdef IP_PKTINFO - bool SetIpPktinfo(bool x = true); -#endif -#ifdef IP_RECVTOS - bool SetIpRecvTOS(bool x = true); -#endif -#ifdef IP_RECVTTL - bool SetIpRecvTTL(bool x = true); -#endif -#ifdef IP_RECVOPTS - bool SetIpRecvopts(bool x = true); -#endif -#ifdef IP_RETOPTS - bool SetIpRetopts(bool x = true); -#endif -#ifdef IP_RECVERR - bool SetIpRecverr(bool x = true); -#endif -#ifdef IP_MTU_DISCOVER - bool SetIpMtudiscover(bool x = true); -#endif -#ifdef IP_MTU - int IpMtu(); -#endif -#ifdef IP_ROUTER_ALERT - bool SetIpRouterAlert(bool x = true); -#endif -#ifdef LINUX - bool IpAddMembership(struct ip_mreqn&); -#endif -#ifdef LINUX - bool IpDropMembership(struct ip_mreqn&); -#endif - //@} - - // SOCKET options - /** @name Socket Options */ - //@{ - - bool SoAcceptconn(); - bool SetSoBroadcast(bool x = true); - bool SetSoDebug(bool x = true); - int SoError(); - bool SetSoDontroute(bool x = true); - bool SetSoLinger(int onoff, int linger); - bool SetSoOobinline(bool x = true); - bool SetSoRcvlowat(int); - bool SetSoSndlowat(int); - bool SetSoRcvtimeo(struct timeval&); - bool SetSoSndtimeo(struct timeval&); - bool SetSoRcvbuf(int); - int SoRcvbuf(); - bool SetSoSndbuf(int); - int SoSndbuf(); - int SoType(); - bool SetSoReuseaddr(bool x = true); - bool SetSoKeepalive(bool x = true); - -#ifdef SO_BSDCOMPAT - bool SetSoBsdcompat(bool x = true); -#endif -#ifdef SO_BINDTODEVICE - bool SetSoBindtodevice(const std::string& intf); -#endif -#ifdef SO_PASSCRED - bool SetSoPasscred(bool x = true); -#endif -#ifdef SO_PEERCRED - bool SoPeercred(struct ucred& ); -#endif -#ifdef SO_PRIORITY - bool SetSoPriority(int); -#endif -#ifdef SO_RCVBUFFORCE - bool SetSoRcvbufforce(int); -#endif -#ifdef SO_SNDBUFFORCE - bool SetSoSndbufforce(int); -#endif -#ifdef SO_TIMESTAMP - bool SetSoTimestamp(bool x = true); -#endif -#ifdef SO_NOSIGPIPE - bool SetSoNosigpipe(bool x = true); -#endif - //@} - - // TCP options in TcpSocket.h/TcpSocket.cpp - - -#ifdef HAVE_OPENSSL - /** @name SSL Support */ - //@{ - /** SSL client/server support - internal use. \sa TcpSocket */ - virtual void OnSSLConnect(); - /** SSL client/server support - internal use. \sa TcpSocket */ - virtual void OnSSLAccept(); - /** SSL negotiation failed for client connect. */ - virtual void OnSSLConnectFailed(); - /** SSL negotiation failed for server accept. */ - virtual void OnSSLAcceptFailed(); - /** new SSL support */ - virtual bool SSLNegotiate(); - /** Check if SSL is Enabled for this TcpSocket. - \return true if this is a TcpSocket with SSL enabled */ - bool IsSSL(); - /** Enable SSL operation for a TcpSocket. */ - void EnableSSL(bool x = true); - /** Still negotiating ssl connection. - \return true if ssl negotiating is still in progress */ - bool IsSSLNegotiate(); - /** Set flag indicating ssl handshaking still in progress. */ - void SetSSLNegotiate(bool x = true); - /** OnAccept called with SSL Enabled. - \return true if this is a TcpSocket with an incoming SSL connection */ - bool IsSSLServer(); - /** Set flag indicating that this is a TcpSocket with incoming SSL connection. */ - void SetSSLServer(bool x = true); - /** SSL; Get pointer to ssl context structure. */ - virtual SSL_CTX *GetSslContext() { return NULL; } - /** SSL; Get pointer to ssl structure. */ - virtual SSL *GetSsl() { return NULL; } - //@} -#endif // HAVE_OPENSSL - -#ifdef ENABLE_IPV6 - /** Enable ipv6 for this socket. */ - void SetIpv6(bool x = true); - /** Check ipv6 socket. - \return true if this is an ipv6 socket */ - bool IsIpv6(); -#endif - -#ifdef ENABLE_POOL - /** @name Connection Pool */ - //@{ - /** Client = connecting TcpSocket. */ - void SetIsClient(); - /** Socket type from socket() call. */ - void SetSocketType(int x); - /** Socket type from socket() call. */ - int GetSocketType(); - /** Protocol type from socket() call. */ - void SetSocketProtocol(const std::string& x); - /** Protocol type from socket() call. */ - const std::string& GetSocketProtocol(); - /** Instruct a client socket to stay open in the connection pool after use. - If you have connected to a server using tcp, you can call SetRetain - to leave the connection open after your socket instance has been deleted. - The next connection you make to the same server will reuse the already - opened connection, if it is still available. - */ - void SetRetain(); - /** Check retain flag. - \return true if the socket should be moved to connection pool after use */ - bool Retain(); - /** Copy connection parameters from sock. */ - void CopyConnection(Socket *sock); - //@} -#endif // ENABLE_POOL - -#ifdef ENABLE_SOCKS4 - /** \name Socks4 support */ - //@{ - /** Socks4 client support internal use. \sa TcpSocket */ - virtual void OnSocks4Connect(); - /** Socks4 client support internal use. \sa TcpSocket */ - virtual void OnSocks4ConnectFailed(); - /** Socks4 client support internal use. \sa TcpSocket */ - virtual bool OnSocks4Read(); - /** Called when the last write caused the tcp output buffer to - * become empty. */ - /** socket still in socks4 negotiation mode */ - bool Socks4(); - /** Set flag indicating Socks4 handshaking in progress */ - void SetSocks4(bool x = true); - - /** Set socks4 server host address to use */ - void SetSocks4Host(ipaddr_t a); - /** Set socks4 server hostname to use. */ - void SetSocks4Host(const std::string& ); - /** Socks4 server port to use. */ - void SetSocks4Port(port_t p); - /** Provide a socks4 userid if required by the socks4 server. */ - void SetSocks4Userid(const std::string& x); - /** Get the ip address of socks4 server to use. - \return socks4 server host address */ - ipaddr_t GetSocks4Host(); - /** Get the socks4 server port to use. - \return socks4 server port */ - port_t GetSocks4Port(); - /** Get socks4 userid. - \return Socks4 userid */ - const std::string& GetSocks4Userid(); - //@} -#endif // ENABLE_SOCKS4 - -#ifdef ENABLE_RESOLVER - /** \name Asynchronous Resolver */ - //@{ - /** Request an asynchronous dns resolution. - \param host hostname to be resolved - \param port port number passed along for the ride - \return Resolve ID */ - int Resolve(const std::string& host,port_t port = 0); -#ifdef ENABLE_IPV6 - int Resolve6(const std::string& host, port_t port = 0); -#endif - /** Callback returning a resolved address. - \param id Resolve ID from Resolve call - \param a resolved ip address - \param port port number passed to Resolve */ - virtual void OnResolved(int id,ipaddr_t a,port_t port); -#ifdef ENABLE_IPV6 - virtual void OnResolved(int id,in6_addr& a,port_t port); -#endif - /** Request asynchronous reverse dns lookup. - \param a in_addr to be translated */ - int Resolve(ipaddr_t a); -#ifdef ENABLE_IPV6 - int Resolve(in6_addr& a); -#endif - /** Callback returning reverse resolve results. - \param id Resolve ID - \param name Resolved hostname */ - virtual void OnReverseResolved(int id,const std::string& name); - /** Callback indicating failed dns lookup. - \param id Resolve ID */ - virtual void OnResolveFailed(int id); - //@} -#endif // ENABLE_RESOLVER - -#ifdef ENABLE_DETACH - /** \name Thread Support */ - //@{ - /** Callback fires when a new socket thread has started and this - socket is ready for operation again. - \sa ResolvSocket */ - virtual void OnDetached(); - - // LIST_DETACH - - /** Internal use. */ - void SetDetach(bool x = true); - /** Check detach flag. - \return true if the socket should detach to its own thread */ - bool IsDetach(); - - /** Internal use. */ - void SetDetached(bool x = true); - /** Check detached flag. - \return true if the socket runs in its own thread. */ - const bool IsDetached() const; - /** Order this socket to start its own thread and call OnDetached - when ready for operation. */ - bool Detach(); - /** Store the slave sockethandler pointer. */ - void SetSlaveHandler(ISocketHandler *); - /** Create new thread for this socket to run detached in. */ - void DetachSocket(); - //@} -#endif // ENABLE_DETACH - - /** Write traffic to an IFile. Socket will not delete this object. */ - void SetTrafficMonitor(IFile *p) { m_traffic_monitor = p; } - -#ifdef ENABLE_TRIGGERS - /** \name Triggers */ - //@{ - /** Subscribe to trigger id. */ - void Subscribe(int id); - /** Unsubscribe from trigger id. */ - void Unsubscribe(int id); - /** Trigger callback, with data passed from source to destination. */ - virtual void OnTrigger(int id, const TriggerData& data); - /** Trigger cancelled because source has been deleted (as in delete). */ - virtual void OnCancelled(int id); - //@} -#endif - -protected: - /** default constructor not available */ - Socket() : m_handler(m_handler) {} - /** copy constructor not available */ - Socket(const Socket& s) : m_handler(s.m_handler) {} - - /** assignment operator not available. */ - Socket& operator=(const Socket& ) { return *this; } - - /** All traffic will be written to this IFile, if set. */ - IFile *GetTrafficMonitor() { return m_traffic_monitor; } - -// unsigned long m_flags; ///< boolean flags, replacing old 'bool' members - -private: - ISocketHandler& m_handler; ///< Reference of ISocketHandler in control of this socket - SOCKET m_socket; ///< File descriptor - bool m_bDel; ///< Delete by handler flag - bool m_bClose; ///< Close and delete flag - time_t m_tCreate; ///< Time in seconds when this socket was created - Socket *m_parent; ///< Pointer to ListenSocket class, valid for incoming sockets - bool m_b_disable_read; ///< Disable checking for read events - bool m_connected; ///< Socket is connected (tcp/udp) - bool m_b_erased_by_handler; ///< Set by handler before delete - time_t m_tClose; ///< Time in seconds when ordered to close - std::auto_ptr m_client_remote_address; ///< Address of last connect() - std::auto_ptr m_remote_address; ///< Remote end address - IFile *m_traffic_monitor; - time_t m_timeout_start; ///< Set by SetTimeout - time_t m_timeout_limit; ///< Defined by SetTimeout - bool m_bLost; ///< connection lost - -#ifdef _WIN32 -static WSAInitializer m_winsock_init; ///< Winsock initialization singleton class -#endif - -#ifdef HAVE_OPENSSL - bool m_b_enable_ssl; ///< Enable SSL for this TcpSocket - bool m_b_ssl; ///< ssl negotiation mode (TcpSocket) - bool m_b_ssl_server; ///< True if this is an incoming ssl TcpSocket connection -#endif - -#ifdef ENABLE_IPV6 - bool m_ipv6; ///< This is an ipv6 socket if this one is true -#endif - -#ifdef ENABLE_POOL - int m_socket_type; ///< Type of socket, from socket() call - std::string m_socket_protocol; ///< Protocol, from socket() call - bool m_bClient; ///< only client connections are pooled - bool m_bRetain; ///< keep connection on close -#endif - -#ifdef ENABLE_SOCKS4 - bool m_bSocks4; ///< socks4 negotiation mode (TcpSocket) - ipaddr_t m_socks4_host; ///< socks4 server address - port_t m_socks4_port; ///< socks4 server port number - std::string m_socks4_userid; ///< socks4 server usedid -#endif - -#ifdef ENABLE_DETACH - bool m_detach; ///< Socket ordered to detach flag - bool m_detached; ///< Socket has been detached - SocketThread *m_pThread; ///< Detach socket thread class pointer - ISocketHandler *m_slave_handler; ///< Actual sockethandler while detached -#endif -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - - -#endif // _SOCKETS_Socket_H - diff --git a/dep/include/sockets/SocketAddress.h b/dep/include/sockets/SocketAddress.h deleted file mode 100644 index d5a56433b..000000000 --- a/dep/include/sockets/SocketAddress.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - ** \file SocketAddress.h - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SocketAddress_H -#define _SOCKETS_SocketAddress_H - -#include "sockets-config.h" -#include -#include -#include "socket_include.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/** - This class and its subclasses is intended to be used as replacement - for the internal data type 'ipaddr_t' and various implementations of - IPv6 addressing found throughout the library. - 'ipaddr_t' is an IPv4 address in network byte order. - 'port_t' is the portnumber in host byte order. - 'struct in6_addr' is an IPv6 address. - 'struct in_addr' is an IPv4 address. - \ingroup basic -*/ -class SocketAddress -{ -public: - virtual ~SocketAddress() {} - - /** Get a pointer to the address struct. */ - virtual operator struct sockaddr *() = 0; - - /** Get length of address struct. */ - virtual operator socklen_t() = 0; - - /** Compare two addresses. */ - virtual bool operator==(SocketAddress&) = 0; - - /** Set port number. - \param port Port number in host byte order */ - virtual void SetPort(port_t port) = 0; - - /** Get port number. - \return Port number in host byte order. */ - virtual port_t GetPort() = 0; - - /** Set socket address. - \param sa Pointer to either 'struct sockaddr_in' or 'struct sockaddr_in6'. */ - virtual void SetAddress(struct sockaddr *sa) = 0; - - /** Convert address to text. */ - virtual std::string Convert(bool include_port) = 0; - - /** Reverse lookup of address. */ - virtual std::string Reverse() = 0; - - /** Get address family. */ - virtual int GetFamily() = 0; - - /** Address structure is valid. */ - virtual bool IsValid() = 0; - - /** Get a copy of this SocketAddress object. */ - virtual std::auto_ptr GetCopy() = 0; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // _SOCKETS_SocketAddress_H - diff --git a/dep/include/sockets/SocketHandler.h b/dep/include/sockets/SocketHandler.h deleted file mode 100644 index c7e20dfde..000000000 --- a/dep/include/sockets/SocketHandler.h +++ /dev/null @@ -1,266 +0,0 @@ -/** \file SocketHandler.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SocketHandler_H -#define _SOCKETS_SocketHandler_H - -#include "sockets-config.h" -#include -#include - -#include "socket_include.h" -#include "ISocketHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -class Socket; -#ifdef ENABLE_RESOLVER -class ResolvServer; -#endif -class Mutex; - -/** Socket container class, event generator. - \ingroup basic */ -class SocketHandler : public ISocketHandler -{ -protected: - /** Map type for holding file descriptors/socket object pointers. */ - typedef std::map socket_m; - -public: - /** SocketHandler constructor. - \param log Optional log class pointer */ - SocketHandler(StdLog *log = NULL); - - /** SocketHandler threadsafe constructor. - \param mutex Externally declared mutex variable - \param log Optional log class pointer */ - SocketHandler(Mutex& mutex,StdLog *log = NULL); - - ~SocketHandler(); - - /** Get mutex reference for threadsafe operations. */ - Mutex& GetMutex() const; - - /** Register StdLog object for error callback. - \param log Pointer to log class */ - void RegStdLog(StdLog *log); - - /** Log error to log class for print out / storage. */ - void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING); - - /** Add socket instance to socket map. Removal is always automatic. */ - void Add(Socket *); - - /** Get status of read/write/exception file descriptor set for a socket. */ - void Get(SOCKET s,bool& r,bool& w,bool& e); - - /** Set read/write/exception file descriptor sets (fd_set). */ - void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true); - - /** Wait for events, generate callbacks. */ - int Select(long sec,long usec); - - /** This method will not return until an event has been detected. */ - int Select(); - - /** Wait for events, generate callbacks. */ - int Select(struct timeval *tsel); - - /** Check that a socket really is handled by this socket handler. */ - bool Valid(Socket *); - - /** Return number of sockets handled by this handler. */ - size_t GetCount(); - - /** Override and return false to deny all incoming connections. - \param p ListenSocket class pointer (use GetPort to identify which one) */ - bool OkToAccept(Socket *p); - - /** Called by Socket when a socket changes state. */ - void AddList(SOCKET s,list_t which_one,bool add); - - // Connection pool -#ifdef ENABLE_POOL - /** Find available open connection (used by connection pool). */ - ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&); - /** Enable connection pool (by default disabled). */ - void EnablePool(bool x = true); - /** Check pool status. - \return true if connection pool is enabled */ - bool PoolEnabled(); -#endif // ENABLE_POOL - - // Socks4 -#ifdef ENABLE_SOCKS4 - /** Set socks4 server ip that all new tcp sockets should use. */ - void SetSocks4Host(ipaddr_t); - /** Set socks4 server hostname that all new tcp sockets should use. */ - void SetSocks4Host(const std::string& ); - /** Set socks4 server port number that all new tcp sockets should use. */ - void SetSocks4Port(port_t); - /** Set optional socks4 userid. */ - void SetSocks4Userid(const std::string& ); - /** If connection to socks4 server fails, immediately try direct connection to final host. */ - void SetSocks4TryDirect(bool x = true); - /** Get socks4 server ip. - \return socks4 server ip */ - ipaddr_t GetSocks4Host(); - /** Get socks4 port number. - \return socks4 port number */ - port_t GetSocks4Port(); - /** Get socks4 userid (optional). - \return socks4 userid */ - const std::string& GetSocks4Userid(); - /** Check status of socks4 try direct flag. - \return true if direct connection should be tried if connection to socks4 server fails */ - bool Socks4TryDirect(); -#endif // ENABLE_SOCKS4 - - // DNS resolve server -#ifdef ENABLE_RESOLVER - /** Enable asynchronous DNS. - \param port Listen port of asynchronous dns server */ - void EnableResolver(port_t port = 16667); - /** Check resolver status. - \return true if resolver is enabled */ - bool ResolverEnabled(); - /** Queue a dns request. - \param host Hostname to be resolved - \param port Port number will be echoed in Socket::OnResolved callback */ - int Resolve(Socket *,const std::string& host,port_t port); -#ifdef ENABLE_IPV6 - int Resolve6(Socket *,const std::string& host,port_t port); -#endif - /** Do a reverse dns lookup. */ - int Resolve(Socket *,ipaddr_t a); -#ifdef ENABLE_IPV6 - int Resolve(Socket *,in6_addr& a); -#endif - /** Get listen port of asynchronous dns server. */ - port_t GetResolverPort(); - /** Resolver thread ready for queries. */ - bool ResolverReady(); - /** Returns true if the socket is waiting for a resolve event. */ - bool Resolving(Socket *); -#endif // ENABLE_RESOLVER - -#ifdef ENABLE_TRIGGERS - /** Fetch unique trigger id. */ - int TriggerID(Socket *src); - /** Subscribe socket to trigger id. */ - bool Subscribe(int id, Socket *dst); - /** Unsubscribe socket from trigger id. */ - bool Unsubscribe(int id, Socket *dst); - /** Execute OnTrigger for subscribed sockets. - \param id Trigger ID - \param data Data passed from source to destination - \param erase Empty trigger id source and destination maps if 'true', - Leave them in place if 'false' - if a trigger should be called many times */ - void Trigger(int id, Socket::TriggerData& data, bool erase = true); -#endif // ENABLE_TRIGGERS - -#ifdef ENABLE_DETACH - /** Indicates that the handler runs under SocketThread. */ - void SetSlave(bool x = true); - /** Indicates that the handler runs under SocketThread. */ - bool IsSlave(); -#endif - - /** Sanity check of those accursed lists. */ - void CheckSanity(); - -protected: - socket_m m_sockets; ///< Active sockets map - socket_m m_add; ///< Sockets to be added to sockets map - std::list m_delete; ///< Sockets to be deleted (failed when Add) - -protected: - StdLog *m_stdlog; ///< Registered log class, or NULL - Mutex& m_mutex; ///< Thread safety mutex - bool m_b_use_mutex; ///< Mutex correctly initialized - -private: - void CheckList(socket_v&,const std::string&); ///< Used by CheckSanity - /** Remove socket from socket map, used by Socket class. */ - void Remove(Socket *); - SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list - fd_set m_rfds; ///< file descriptor set monitored for read events - fd_set m_wfds; ///< file descriptor set monitored for write events - fd_set m_efds; ///< file descriptor set monitored for exceptions - int m_preverror; ///< debug select() error - int m_errcnt; ///< debug select() error - time_t m_tlast; ///< timeout control - - // state lists - socket_v m_fds; ///< Active file descriptor list - socket_v m_fds_erase; ///< File descriptors that are to be erased from m_sockets - socket_v m_fds_callonconnect; ///< checklist CallOnConnect -#ifdef ENABLE_DETACH - socket_v m_fds_detach; ///< checklist Detach -#endif - socket_v m_fds_timeout; ///< checklist timeout - socket_v m_fds_retry; ///< checklist retry client connect - socket_v m_fds_close; ///< checklist close and delete - -#ifdef ENABLE_SOCKS4 - ipaddr_t m_socks4_host; ///< Socks4 server host ip - port_t m_socks4_port; ///< Socks4 server port number - std::string m_socks4_userid; ///< Socks4 userid - bool m_bTryDirect; ///< Try direct connection if socks4 server fails -#endif -#ifdef ENABLE_RESOLVER - int m_resolv_id; ///< Resolver id counter - ResolvServer *m_resolver; ///< Resolver thread pointer - port_t m_resolver_port; ///< Resolver listen port - std::map m_resolve_q; ///< resolve queue -#endif -#ifdef ENABLE_POOL - bool m_b_enable_pool; ///< Connection pool enabled if true -#endif -#ifdef ENABLE_TRIGGERS - int m_next_trigger_id; ///< Unique trigger id counter - std::map m_trigger_src; ///< mapping trigger id to source socket - std::map > m_trigger_dst; ///< mapping trigger id to destination sockets -#endif -#ifdef ENABLE_DETACH - bool m_slave; ///< Indicates that this is a ISocketHandler run in SocketThread -#endif -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_SocketHandler_H - diff --git a/dep/include/sockets/StdLog.h b/dep/include/sockets/StdLog.h deleted file mode 100644 index c07037bbd..000000000 --- a/dep/include/sockets/StdLog.h +++ /dev/null @@ -1,74 +0,0 @@ -/** \file StdLog.h - ** \date 2004-06-01 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_StdLog_H -#define _SOCKETS_StdLog_H - -#include "sockets-config.h" -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -/** error level enum. */ -typedef enum -{ - LOG_LEVEL_WARNING = 0, - LOG_LEVEL_ERROR, - LOG_LEVEL_FATAL, - LOG_LEVEL_INFO -} loglevel_t; - - -class ISocketHandler; -class Socket; - -/** \defgroup logging Log help classes */ -/** Log class interface. - \ingroup logging */ -class StdLog -{ -public: - virtual ~StdLog() {} - - virtual void error(ISocketHandler *,Socket *, - const std::string& user_text, - int err, - const std::string& sys_err, - loglevel_t = LOG_LEVEL_WARNING) = 0; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_StdLog_H - diff --git a/dep/include/sockets/StdoutLog.h b/dep/include/sockets/StdoutLog.h deleted file mode 100644 index 5f96b340d..000000000 --- a/dep/include/sockets/StdoutLog.h +++ /dev/null @@ -1,57 +0,0 @@ -/** \file StdoutLog.h - ** \date 2004-06-01 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_StdoutLog_H -#define _SOCKETS_StdoutLog_H - -#include "sockets-config.h" -#include "StdLog.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/** StdLog implementation, logs to stdout. - \ingroup logging */ -class StdoutLog : public StdLog -{ -public: - void error(ISocketHandler *,Socket *,const std::string& call,int err,const std::string& sys_err,loglevel_t); -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_StdoutLog_H - diff --git a/dep/include/sockets/StreamSocket.h b/dep/include/sockets/StreamSocket.h deleted file mode 100644 index 3c248110b..000000000 --- a/dep/include/sockets/StreamSocket.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef _StreamSocket_H -#define _StreamSocket_H - -#include "Socket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/** SOCK_STREAM Socket base class. - \ingroup basic */ -class StreamSocket : public Socket -{ -public: - StreamSocket(ISocketHandler& ); - ~StreamSocket(); - - /** Socket should Check Connect on next write event from select(). */ - void SetConnecting(bool = true); - - /** Check connecting flag. - \return true if the socket is still trying to connect */ - bool Connecting(); - - /** Returns true when socket file descriptor is valid, - socket connection is established, and socket is not about to - be closed. */ - bool Ready(); - - /** Set timeout to use for connection attempt. - \param x Timeout in seconds */ - void SetConnectTimeout(int x); - - /** Return number of seconds to wait for a connection. - \return Connection timeout (seconds) */ - int GetConnectTimeout(); - - /** Set flush before close to make a tcp socket completely empty its - output buffer before closing the connection. */ - void SetFlushBeforeClose(bool = true); - - /** Check flush before status. - \return true if the socket should send all data before closing */ - bool GetFlushBeforeClose(); - - /** Define number of connection retries (tcp only). - n = 0 - no retry - n > 0 - number of retries - n = -1 - unlimited retries */ - void SetConnectionRetry(int n); - - /** Get number of maximum connection retries (tcp only). */ - int GetConnectionRetry(); - - /** Increase number of actual connection retries (tcp only). */ - void IncreaseConnectionRetries(); - - /** Get number of actual connection retries (tcp only). */ - int GetConnectionRetries(); - - /** Reset actual connection retries (tcp only). */ - void ResetConnectionRetries(); - - // LIST_CALLONCONNECT - - /** Instruct socket to call OnConnect callback next sockethandler cycle. */ - void SetCallOnConnect(bool x = true); - - /** Check call on connect flag. - \return true if OnConnect() should be called a.s.a.p */ - bool CallOnConnect(); - - // LIST_RETRY - - /** Set flag to initiate a connection attempt after a connection timeout. */ - void SetRetryClientConnect(bool x = true); - - /** Check if a connection attempt should be made. - \return true when another attempt should be made */ - bool RetryClientConnect(); - - /** Called after OnRead if socket is in line protocol mode. - \sa SetLineProtocol */ - /** Enable the OnLine callback. Do not create your own OnRead - * callback when using this. */ - virtual void SetLineProtocol(bool = true); - - /** Check line protocol mode. - \return true if socket is in line protocol mode */ - bool LineProtocol(); - - /** Set shutdown status. */ - void SetShutdown(int); - - /** Get shutdown status. */ - int GetShutdown(); - - /** Returns IPPROTO_TCP or IPPROTO_SCTP */ - virtual int Protocol() = 0; - -protected: - StreamSocket(const StreamSocket& ) {} // copy constructor - -private: - StreamSocket& operator=(const StreamSocket& ) { return *this; } // assignment operator - - bool m_bConnecting; ///< Flag indicating connection in progress - int m_connect_timeout; ///< Connection timeout (seconds) - bool m_flush_before_close; ///< Send all data before closing (default true) - int m_connection_retry; ///< Maximum connection retries (tcp) - int m_retries; ///< Actual number of connection retries (tcp) - bool m_call_on_connect; ///< OnConnect will be called next ISocketHandler cycle if true - bool m_b_retry_connect; ///< Try another connection attempt next ISocketHandler cycle - bool m_line_protocol; ///< Line protocol mode flag - int m_shutdown; ///< Shutdown status -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - -#endif // _StreamSocket_H - diff --git a/dep/include/sockets/TcpSocket.h b/dep/include/sockets/TcpSocket.h deleted file mode 100644 index 515f5aa6c..000000000 --- a/dep/include/sockets/TcpSocket.h +++ /dev/null @@ -1,358 +0,0 @@ -/** \file TcpSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_TcpSocket_H -#define _SOCKETS_TcpSocket_H -#include "sockets-config.h" -#include "StreamSocket.h" -#ifdef HAVE_OPENSSL -#include -#include "SSLInitializer.h" -#endif - -#include - -#define TCP_BUFSIZE_READ 16400 -#define TCP_OUTPUT_CAPACITY 1024000 - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -class SocketAddress; - - -/** Socket implementation for TCP. - \ingroup basic */ -class TcpSocket : public StreamSocket -{ - /** \defgroup internal Internal utility */ -protected: - /** Buffer class containing one read/write circular buffer. - \ingroup internal */ - class CircularBuffer - { - public: - CircularBuffer(size_t size); - ~CircularBuffer(); - - /** append l bytes from p to buffer */ - bool Write(const char *p,size_t l); - /** copy l bytes from buffer to dest */ - bool Read(char *dest,size_t l); - /** copy l bytes from buffer to dest, dont touch buffer pointers */ - bool SoftRead(char *dest, size_t l); - /** skip l bytes from buffer */ - bool Remove(size_t l); - /** read l bytes from buffer, returns as string. */ - std::string ReadString(size_t l); - - /** total buffer length */ - size_t GetLength(); - /** pointer to circular buffer beginning */ - const char *GetStart(); - /** return number of bytes from circular buffer beginning to buffer physical end */ - size_t GetL(); - /** return free space in buffer, number of bytes until buffer overrun */ - size_t Space(); - - /** return total number of bytes written to this buffer, ever */ - unsigned long ByteCounter(bool clear = false); - - private: - CircularBuffer(const CircularBuffer& /*s*/) {} - CircularBuffer& operator=(const CircularBuffer& ) { return *this; } - char *buf; - size_t m_max; - size_t m_q; - size_t m_b; - size_t m_t; - unsigned long m_count; - }; - /** Output buffer struct. - \ingroup internal */ - struct OUTPUT { - OUTPUT() : _b(0), _t(0), _q(0) {} - OUTPUT(const char *buf, size_t len) : _b(0), _t(len), _q(len) { - memcpy(_buf, buf, len); - } - size_t Space() { - return TCP_OUTPUT_CAPACITY - _t; - } - void Add(const char *buf, size_t len) { - memcpy(_buf + _t, buf, len); - _t += len; - _q += len; - } - size_t Remove(size_t len) { - _b += len; - _q -= len; - return _q; - } - const char *Buf() { - return _buf + _b; - } - size_t Len() { - return _q; - } - size_t _b; - size_t _t; - size_t _q; - char _buf[TCP_OUTPUT_CAPACITY]; - }; - typedef std::list output_l; - -public: - /** Constructor with standard values on input/output buffers. */ - TcpSocket(ISocketHandler& ); - /** Constructor with custom values for i/o buffer. - \param h ISocketHandler reference - \param isize Input buffer size - \param osize Output buffer size */ - TcpSocket(ISocketHandler& h,size_t isize,size_t osize); - ~TcpSocket(); - - /** Open a connection to a remote server. - If you want your socket to connect to a server, - always call Open before Add'ing a socket to the sockethandler. - If not, the connection attempt will not be monitored by the - socket handler... - \param ip IP address - \param port Port number - \param skip_socks Do not use socks4 even if configured */ - bool Open(ipaddr_t ip,port_t port,bool skip_socks = false); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Open connection. - \param ip Ipv6 address - \param port Port number - \param skip_socks Do not use socks4 even if configured */ - bool Open(in6_addr ip,port_t port,bool skip_socks = false); -#endif -#endif - bool Open(SocketAddress&,bool skip_socks = false); - bool Open(SocketAddress&,SocketAddress& bind_address,bool skip_socks = false); - /** Open connection. - \param host Hostname - \param port Port number */ - bool Open(const std::string &host,port_t port); - - /** Connect timeout callback. */ - void OnConnectTimeout(); -#ifdef _WIN32 - /** Connection failed reported as exception on win32 */ - void OnException(); -#endif - - /** Close file descriptor - internal use only. - \sa SetCloseAndDelete */ - int Close(); - - /** Send a string. - \param s String to send - \param f Dummy flags -- not used */ - void Send(const std::string &s,int f = 0); - /** Send string using printf formatting. */ - void Sendf(const char *format, ...); - /** Send buffer of bytes. - \param buf Buffer pointer - \param len Length of data - \param f Dummy flags -- not used */ - void SendBuf(const char *buf,size_t len,int f = 0); - /** This callback is executed after a successful read from the socket. - \param buf Pointer to the data - \param len Length of the data */ - virtual void OnRawData(const char *buf,size_t len); - - /** Called when output buffer has been sent. - Note: Will only be called IF the output buffer has been used. - Send's that was successful without needing the output buffer - will not generate a call to this method. */ - virtual void OnWriteComplete(); - /** Number of bytes in input buffer. */ - size_t GetInputLength(); - /** Number of bytes in output buffer. */ - size_t GetOutputLength(); - - /** Callback fires when a socket in line protocol has read one full line. - \param line Line read */ - void OnLine(const std::string& line); - /** Get counter of number of bytes received. */ - uint64_t GetBytesReceived(bool clear = false); - /** Get counter of number of bytes sent. */ - uint64_t GetBytesSent(bool clear = false); - - /** Socks4 specific callback. */ - void OnSocks4Connect(); - /** Socks4 specific callback. */ - void OnSocks4ConnectFailed(); - /** Socks4 specific callback. - \return 'need_more' */ - bool OnSocks4Read(); - -#ifdef ENABLE_RESOLVER - /** Callback executed when resolver thread has finished a resolve request. */ - void OnResolved(int id,ipaddr_t a,port_t port); -#ifdef ENABLE_IPV6 - void OnResolved(int id,in6_addr& a,port_t port); -#endif -#endif -#ifdef HAVE_OPENSSL - /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ - void OnSSLConnect(); - /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ - void OnSSLAccept(); - /** This method must be implemented to initialize - the ssl context for an outgoing connection. */ - virtual void InitSSLClient(); - /** This method must be implemented to initialize - the ssl context for an incoming connection. */ - virtual void InitSSLServer(); -#endif - -#ifdef ENABLE_RECONNECT - /** Flag that says a broken connection will try to reconnect. */ - void SetReconnect(bool = true); - /** Check reconnect on lost connection flag status. */ - bool Reconnect(); - /** Flag to determine if a reconnect is in progress. */ - void SetIsReconnect(bool x = true); - /** Socket is reconnecting. */ - bool IsReconnect(); -#endif - - void DisableInputBuffer(bool = true); - - void OnOptions(int,int,int,SOCKET); - - void SetLineProtocol(bool = true); - - // TCP options - bool SetTcpNodelay(bool = true); - - virtual int Protocol(); - - /** Trigger limit for callback OnTransferLimit. */ - void SetTransferLimit(size_t sz); - /** This callback fires when the output buffer drops below the value - set by SetTransferLimit. Default: 0 (disabled). */ - virtual void OnTransferLimit(); - -protected: - TcpSocket(const TcpSocket& ); - void OnRead(); - void OnRead( char *buf, size_t n ); - void OnWrite(); -#ifdef HAVE_OPENSSL - /** SSL; Initialize ssl context for a client socket. - \param meth_in SSL method */ - void InitializeContext(const std::string& context, SSL_METHOD *meth_in = NULL); - /** SSL; Initialize ssl context for a server socket. - \param keyfile Combined private key/certificate file - \param password Password for private key - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); - /** SSL; Initialize ssl context for a server socket. - \param certfile Separate certificate file - \param keyfile Combined private key/certificate file - \param password Password for private key - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const std::string& certfile, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); - /** SSL; Password callback method. */ -static int SSL_password_cb(char *buf,int num,int rwflag,void *userdata); - /** SSL; Get pointer to ssl context structure. */ - virtual SSL_CTX *GetSslContext(); - /** SSL; Get pointer to ssl structure. */ - virtual SSL *GetSsl(); - /** ssl; still negotiating connection. */ - bool SSLNegotiate(); - /** SSL; Get ssl password. */ - const std::string& GetPassword(); -#endif - - CircularBuffer ibuf; ///< Circular input buffer - -private: - TcpSocket& operator=(const TcpSocket& ) { return *this; } - - /** the actual send() */ - int TryWrite(const char *buf, size_t len); - /** add data to output buffer top */ - void Buffer(const char *buf, size_t len); - - // - bool m_b_input_buffer_disabled; - uint64_t m_bytes_sent; - uint64_t m_bytes_received; - bool m_skip_c; ///< Skip second char of CRLF or LFCR sequence in OnRead - char m_c; ///< First char in CRLF or LFCR sequence - std::string m_line; ///< Current line in line protocol mode -#ifdef SOCKETS_DYNAMIC_TEMP - char *m_buf; ///< temporary read buffer -#endif - output_l m_obuf; ///< output buffer - OUTPUT *m_obuf_top; ///< output buffer on top - size_t m_transfer_limit; - size_t m_output_length; - -#ifdef HAVE_OPENSSL -static SSLInitializer m_ssl_init; - SSL_CTX *m_ssl_ctx; ///< ssl context - SSL *m_ssl; ///< ssl 'socket' - BIO *m_sbio; ///< ssl bio - std::string m_password; ///< ssl password -#endif - -#ifdef ENABLE_SOCKS4 - int m_socks4_state; ///< socks4 support - char m_socks4_vn; ///< socks4 support, temporary variable - char m_socks4_cd; ///< socks4 support, temporary variable - unsigned short m_socks4_dstport; ///< socks4 support - unsigned long m_socks4_dstip; ///< socks4 support -#endif - -#ifdef ENABLE_RESOLVER - int m_resolver_id; ///< Resolver id (if any) for current Open call -#endif - -#ifdef ENABLE_RECONNECT - bool m_b_reconnect; ///< Reconnect on lost connection flag - bool m_b_is_reconnect; ///< Trying to reconnect -#endif - -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_TcpSocket_H - diff --git a/dep/include/sockets/Thread.h b/dep/include/sockets/Thread.h deleted file mode 100644 index d784a1594..000000000 --- a/dep/include/sockets/Thread.h +++ /dev/null @@ -1,100 +0,0 @@ -/** \file Thread.h - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Thread_H -#define _SOCKETS_Thread_H - -#include "sockets-config.h" -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _WIN32 -// to be -//typedef DWORD threadfunc_t; -//typedef LPVOID threadparam_t; -//#define STDPREFIX WINAPI -typedef unsigned threadfunc_t; -typedef void * threadparam_t; -#define STDPREFIX __stdcall -#else -#include - -typedef void * threadfunc_t; -typedef void * threadparam_t; -#define STDPREFIX -#endif - -/** \defgroup threading Threading */ -/** Thread base class. -The Thread class is used by the resolver (ResolvServer) and running a detached socket (SocketThread). -When you know some processing will take a long time and will freeze up a socket, there is always the -possibility to call Detach() on that socket before starting the processing. -When the OnDetached() callback is later called the processing can continue, now in its own thread. - \ingroup threading */ -class Thread -{ -public: - Thread(bool release = true); - virtual ~Thread(); - - static threadfunc_t STDPREFIX StartThread(threadparam_t); - - virtual void Run() = 0; - - bool IsRunning(); - void SetRunning(bool x); - bool IsReleased(); - void SetRelease(bool x); - bool DeleteOnExit(); - void SetDeleteOnExit(bool x = true); - bool IsDestructor(); - -private: - Thread(const Thread& ) {} - Thread& operator=(const Thread& ) { return *this; } -#ifdef _WIN32 - HANDLE m_thread; - unsigned m_dwThreadId; -#else - pthread_t m_thread; -#endif - bool m_running; - bool m_release; - bool m_b_delete_on_exit; - bool m_b_destructor; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Thread_H - diff --git a/dep/include/sockets/UdpSocket.h b/dep/include/sockets/UdpSocket.h deleted file mode 100644 index d32aabf67..000000000 --- a/dep/include/sockets/UdpSocket.h +++ /dev/null @@ -1,215 +0,0 @@ -/** \file UdpSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_UdpSocket_H -#define _SOCKETS_UdpSocket_H - -#include "sockets-config.h" -#include "Socket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -/** Socket implementation for UDP. - \ingroup basic */ -class UdpSocket : public Socket -{ -public: - /** Constructor. - \param h ISocketHandler reference - \param ibufsz Maximum size of receive message (extra bytes will be truncated) - \param ipv6 'true' if this is an ipv6 socket */ - UdpSocket(ISocketHandler& h,int ibufsz = 16384,bool ipv6 = false, int retries = 0); - ~UdpSocket(); - - /** Called when incoming data has been received. - \param buf Pointer to data - \param len Length of data - \param sa Pointer to sockaddr struct of sender - \param sa_len Length of sockaddr struct */ - virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len); - - /** Called when incoming data has been received and read timestamp is enabled. - \param buf Pointer to data - \param len Length of data - \param sa Pointer to sockaddr struct of sender - \param sa_len Length of sockaddr struct - \param ts Timestamp from message */ - virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len,struct timeval *ts); - - /** To receive incoming data, call Bind to setup an incoming port. - \param port Incoming port number - \param range Port range to try if ports already in use - \return 0 if bind succeeded */ - int Bind(port_t& port,int range = 1); - /** To receive data on a specific interface:port, use this. - \param intf Interface ip/hostname - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(const std::string& intf,port_t& port,int range = 1); - /** To receive data on a specific interface:port, use this. - \param a Ip address - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(ipaddr_t a,port_t& port,int range = 1); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** To receive data on a specific interface:port, use this. - \param a Ipv6 address - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(in6_addr a,port_t& port,int range = 1); -#endif -#endif - /** To receive data on a specific interface:port, use this. - \param ad Socket address - \param range Port range - \return 0 if bind succeeded */ - int Bind(SocketAddress& ad,int range = 1); - - /** Define remote host. - \param l Address of remote host - \param port Port of remote host - \return true if successful */ - bool Open(ipaddr_t l,port_t port); - /** Define remote host. - \param host Hostname - \param port Port number - \return true if successful */ - bool Open(const std::string& host,port_t port); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Define remote host. - \param a Address of remote host, ipv6 - \param port Port of remote host - \return true if successful */ - bool Open(struct in6_addr& a,port_t port); -#endif -#endif - /** Define remote host. - \param ad Socket address - \return true if successful */ - bool Open(SocketAddress& ad); - - /** Send to specified host */ - void SendToBuf(const std::string& ,port_t,const char *data,int len,int flags = 0); - /** Send to specified address */ - void SendToBuf(ipaddr_t,port_t,const char *data,int len,int flags = 0); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Send to specified ipv6 address */ - void SendToBuf(in6_addr,port_t,const char *data,int len,int flags = 0); -#endif -#endif - /** Send to specified socket address */ - void SendToBuf(SocketAddress& ad,const char *data,int len,int flags = 0); - - /** Send string to specified host */ - void SendTo(const std::string&,port_t,const std::string&,int flags = 0); - /** Send string to specified address */ - void SendTo(ipaddr_t,port_t,const std::string&,int flags = 0); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Send string to specified ipv6 address */ - void SendTo(in6_addr,port_t,const std::string&,int flags = 0); -#endif -#endif - /** Send string to specified socket address */ - void SendTo(SocketAddress& ad,const std::string&,int flags = 0); - - /** Send to connected address */ - void SendBuf(const char *data,size_t,int flags = 0); - /** Send string to connected address. */ - void Send(const std::string& ,int flags = 0); - - /** Set broadcast */ - void SetBroadcast(bool b = true); - /** Check broadcast flag. - \return true broadcast is enabled. */ - bool IsBroadcast(); - - /** multicast */ - void SetMulticastTTL(int ttl = 1); - int GetMulticastTTL(); - void SetMulticastLoop(bool = true); - bool IsMulticastLoop(); - void AddMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); - void DropMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** multicast, ipv6 only */ - void SetMulticastHops(int = -1); - /** multicast, ipv6 only */ - int GetMulticastHops(); -#endif -#endif - /** Returns true if Bind succeeded. */ - bool IsBound(); - /** Return Bind port number */ - port_t GetPort(); - - void OnOptions(int,int,int,SOCKET) {} - - int GetLastSizeWritten(); - - /** Also read timestamp information from incoming message */ - void SetTimestamp(bool = true); - -protected: - UdpSocket(const UdpSocket& s) : Socket(s) {} - void OnRead(); -#if defined(LINUX) || defined(MACOSX) - /** This method emulates socket recvfrom, but uses messages so we can get the timestamp */ - int ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts); -#endif - -private: - UdpSocket& operator=(const UdpSocket& ) { return *this; } - /** create before using sendto methods */ - void CreateConnection(); - char *m_ibuf; ///< Input buffer - int m_ibufsz; ///< Size of input buffer - bool m_bind_ok; ///< Bind completed successfully - port_t m_port; ///< Bind port number - int m_last_size_written; - int m_retries; - bool m_b_read_ts; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_UdpSocket_H - diff --git a/dep/include/sockets/Utility.h b/dep/include/sockets/Utility.h deleted file mode 100644 index 0fbccd3df..000000000 --- a/dep/include/sockets/Utility.h +++ /dev/null @@ -1,186 +0,0 @@ -/** \file Utility.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Utility_H -#define _SOCKETS_Utility_H - -#include "sockets-config.h" -#include -#include -#include -#include "socket_include.h" -#include -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#define TWIST_LEN 624 - -class SocketAddress; - -/** Conversion utilities. - \ingroup util */ -class Utility -{ - /** - The Mersenne Twister - http://www.math.keio.ac.jp/~matumoto/emt.html - */ - class Rng { - public: - Rng(unsigned long seed); - - unsigned long Get(); - - private: - int m_value; - unsigned long m_tmp[TWIST_LEN]; - }; - class ncmap_compare { - public: - bool operator()(const std::string& x, const std::string& y) const { - return strcasecmp(x.c_str(), y.c_str()) < 0; - } - }; -public: - template class ncmap : public std::map { - public: - ncmap() {} - }; -public: - static std::string base64(const std::string& str_in); - static std::string base64d(const std::string& str_in); - static std::string l2string(long l); - static std::string bigint2string(uint64_t l); - static uint64_t atoi64(const std::string& str); - static unsigned int hex2unsigned(const std::string& str); - static std::string rfc1738_encode(const std::string& src); - static std::string rfc1738_decode(const std::string& src); - - /** Checks whether a string is a valid ipv4/ipv6 ip number. */ - static bool isipv4(const std::string&); - /** Checks whether a string is a valid ipv4/ipv6 ip number. */ - static bool isipv6(const std::string&); - - /** Hostname to ip resolution ipv4, not asynchronous. */ - static bool u2ip(const std::string&, ipaddr_t&); - static bool u2ip(const std::string&, struct sockaddr_in& sa, int ai_flags = 0); - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Hostname to ip resolution ipv6, not asynchronous. */ - static bool u2ip(const std::string&, struct in6_addr&); - static bool u2ip(const std::string&, struct sockaddr_in6& sa, int ai_flags = 0); -#endif -#endif - - /** Reverse lookup of address to hostname */ - static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string&, int flags = 0); - static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags = 0); - - static bool u2service(const std::string& name, int& service, int ai_flags = 0); - - /** Convert binary ip address to string: ipv4. */ - static void l2ip(const ipaddr_t,std::string& ); - static void l2ip(const in_addr&,std::string& ); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Convert binary ip address to string: ipv6. */ - static void l2ip(const struct in6_addr&,std::string& ,bool mixed = false); - - /** ipv6 address compare. */ - static int in6_addr_compare(in6_addr,in6_addr); -#endif -#endif - /** ResolveLocal (hostname) - call once before calling any GetLocal method. */ - static void ResolveLocal(); - /** Returns local hostname, ResolveLocal must be called once before using. - \sa ResolveLocal */ - static const std::string& GetLocalHostname(); - /** Returns local ip, ResolveLocal must be called once before using. - \sa ResolveLocal */ - static ipaddr_t GetLocalIP(); - /** Returns local ip number as string. - \sa ResolveLocal */ - static const std::string& GetLocalAddress(); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Returns local ipv6 ip. - \sa ResolveLocal */ - static const struct in6_addr& GetLocalIP6(); - /** Returns local ipv6 address. - \sa ResolveLocal */ - static const std::string& GetLocalAddress6(); -#endif -#endif - /** Set environment variable. - \param var Name of variable to set - \param value Value */ - static void SetEnv(const std::string& var,const std::string& value); - /** Convert sockaddr struct to human readable string. - \param sa Ptr to sockaddr struct */ - static std::string Sa2String(struct sockaddr *sa); - - /** Get current time in sec/microseconds. */ - static void GetTime(struct timeval *); - - static std::auto_ptr CreateAddress(struct sockaddr *,socklen_t); - - static unsigned long ThreadID(); - - static std::string ToLower(const std::string& str); - static std::string ToUpper(const std::string& str); - - static std::string ToString(double d); - - /** Returns a random 32-bit integer */ - static unsigned long Rnd(); - -private: - static std::string m_host; ///< local hostname - static ipaddr_t m_ip; ///< local ip address - static std::string m_addr; ///< local ip address in string format -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - static struct in6_addr m_local_ip6; ///< local ipv6 address -#endif - static std::string m_local_addr6; ///< local ipv6 address in string format -#endif - static bool m_local_resolved; ///< ResolveLocal has been called if true -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Utility_H - diff --git a/dep/include/sockets/socket_include.h b/dep/include/sockets/socket_include.h deleted file mode 100644 index 5ffaebbff..000000000 --- a/dep/include/sockets/socket_include.h +++ /dev/null @@ -1,306 +0,0 @@ -/** \file socket_include.h - ** \date 2005-04-12 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_socket_include_H -#define _SOCKETS_socket_include_H -#include "sockets-config.h" - -#ifdef _MSC_VER -#pragma warning(disable:4514) -#endif - -// common defines affecting library and applications using library - -/* Define SOCKETS_DYNAMIC_TEMP to use dynamically allocated buffers - in read operations - helps on ECOS */ -#define SOCKETS_DYNAMIC_TEMP - - -// platform specific stuff -#if (defined(__unix__) || defined(unix)) && !defined(USG) -#include -#endif -#include - -// int64 -#ifdef _WIN32 -typedef unsigned __int64 uint64_t; -#else -#include -#ifdef SOLARIS -# include -#else -# include -#endif -#endif - -#ifndef _WIN32 -// ---------------------------------------- -// common unix includes / defines -#include -#include -#include -#include -#include -#include -//#include - -// all typedefs in this file will be declared outside the sockets namespace, -// because some os's will already have one or more of the type defined. -typedef int SOCKET; -#define Errno errno -#define StrError strerror - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// WIN32 adapt -#define closesocket close -#define INVALID_SOCKET -1 -#define SOCKET_ERROR -1 - -#ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long) -1) -#endif // INADDR_NONE - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // !_WIN32 - - -// ---------------------------------------- -// Generic -#ifndef SOL_IP -#define SOL_IP IPPROTO_IP -#endif - - -// ---------------------------------------- -// OS specific adaptions - -#ifdef SOLARIS -// ---------------------------------------- -// Solaris -typedef unsigned short port_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#define s6_addr16 _S6_un._S6_u8 -#define MSG_NOSIGNAL 0 - -#elif defined __FreeBSD__ -// ---------------------------------------- -// FreeBSD -# if __FreeBSD_version >= 400014 -# define s6_addr16 __u6_addr.__u6_addr16 -# if !defined(MSG_NOSIGNAL) -# define MSG_NOSIGNAL 0 -# endif -# include -typedef in_addr_t ipaddr_t; -typedef in_port_t port_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP -# else -# error FreeBSD versions prior to 400014 does not support ipv6 -# endif - -#elif defined (__NetBSD__) || defined (__OpenBSD__) -# if !defined(MSG_NOSIGNAL) -# define MSG_NOSIGNAL 0 -# endif -# include -typedef in_addr_t ipaddr_t; -typedef in_port_t port_t; -#elif defined MACOSX -// ---------------------------------------- -// Mac OS X -#include -#ifdef __DARWIN_UNIX03 -typedef unsigned short port_t; -#else -#include -#endif // __DARWIN_UNIX03 -typedef unsigned long ipaddr_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#define s6_addr16 __u6_addr.__u6_addr16 -#define MSG_NOSIGNAL 0 // oops - thanks Derek -#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP - -#elif defined _WIN32 -// ---------------------------------------- -// Win32 -#ifdef _MSC_VER -#pragma comment(lib, "wsock32.lib") -#endif -#define strcasecmp _stricmp - -typedef unsigned long ipaddr_t; -typedef unsigned short port_t; -typedef int socklen_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -// 1.8.6: define FD_SETSIZE to something bigger than 64 if there are a lot of -// simultaneous connections (must be done before including winsock.h) -#ifndef FD_SETSIZE -#define FD_SETSIZE 1024 -#endif - -// windows 2000 with ipv6 preview installed: -// http://msdn.microsoft.com/downloads/sdks/platform/tpipv6.asp -// see the FAQ on how to install -#define WIN32_LEAN_AND_MEAN -#include -#include -#if _MSC_VER < 1200 -#ifndef __CYGWIN__ -#ifdef ENABLE_IPV6 -#include // For IPv6 Tech Preview. -#endif -#endif -#endif // _MSC_VER < 1200 - - -#define MSG_NOSIGNAL 0 -//#define SHUT_RDWR 2 -#define SHUT_WR 1 - -#define Errno WSAGetLastError() -const char *StrError(int x); - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// class WSAInitializer is a part of the Socket class (on win32) -// as a static instance - so whenever an application uses a Socket, -// winsock is initialized -class WSAInitializer // Winsock Initializer -{ -public: - WSAInitializer() { - if (WSAStartup(0x101,&m_wsadata)) - { - exit(-1); - } - } - ~WSAInitializer() { - WSACleanup(); - } -private: - WSADATA m_wsadata; -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#elif defined(sun) || defined(__sun__) - -#define MSG_NOSIGNAL 0 -typedef unsigned short port_t; - -#else -// ---------------------------------------- -// LINUX -typedef unsigned long ipaddr_t; -typedef unsigned short port_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - - -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - /** List type containing file descriptors. */ - typedef std::list socket_v; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - -// getaddrinfo / getnameinfo replacements -#ifdef NO_GETADDRINFO -#ifndef AI_NUMERICHOST -#define AI_NUMERICHOST 1 -#endif -#ifndef NI_NUMERICHOST -#define NI_NUMERICHOST 1 -#endif -#endif - - -#endif // _SOCKETS_socket_include_H - diff --git a/dep/include/sockets/sockets-config.h b/dep/include/sockets/sockets-config.h deleted file mode 100644 index fffc2bbe7..000000000 --- a/dep/include/sockets/sockets-config.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - ** \file sockets-config.h - ** \date 2007-04-14 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_CONFIG_H -#define _SOCKETS_CONFIG_H - -#ifndef _RUN_DP -/* First undefine symbols if already defined. */ -#undef HAVE_OPENSSL -#undef ENABLE_IPV6 -#undef USE_SCTP -#undef NO_GETADDRINFO -#undef ENABLE_POOL -#undef ENABLE_SOCKS4 -#undef ENABLE_RESOLVER -#undef ENABLE_RECONNECT -#undef ENABLE_DETACH -#undef ENABLE_TRIGGERS -#undef ENABLE_EXCEPTIONS -#endif // _RUN_DP - -// define MACOSX for internal socket library checks -#if defined(__APPLE__) && defined(__MACH__) && !defined(MACOSX) -#define MACOSX -#endif - -/* OpenSSL support. */ -//#define HAVE_OPENSSL - - -/* Ipv6 support. */ -//#define ENABLE_IPV6 - - -/* SCTP support. */ -//#define USE_SCTP - - -/* Define NO_GETADDRINFO if your operating system does not support - the "getaddrinfo" and "getnameinfo" function calls. */ -#define NO_GETADDRINFO - - -/* Connection pool support. */ -#define ENABLE_POOL - - -/* Socks4 client support. */ -//#define ENABLE_SOCKS4 - - -/* Asynchronous resolver. */ -#define ENABLE_RESOLVER - - -/* Enable TCP reconnect on lost connection. - Socket::OnReconnect - Socket::OnDisconnect -*/ -#define ENABLE_RECONNECT - - -/* Enable socket thread detach functionality. */ -#define ENABLE_DETACH - - -/* Enable socket to socket triggers. Not yet in use. */ -//#define ENABLE_TRIGGERS - - -/* Enabled exceptions. */ -//#define ENABLE_EXCEPTIONS - - -/* Resolver uses the detach function so either enable both or disable both. */ -#ifndef ENABLE_DETACH -#undef ENABLE_RESOLVER -#endif - - -#endif // _SOCKETS_CONFIG_H - diff --git a/dep/src/sockets/Base64.cpp b/dep/src/sockets/Base64.cpp deleted file mode 100644 index b8cf12371..000000000 --- a/dep/src/sockets/Base64.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/** \file Base64.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Base64.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -const char *Base64::bstr = - "ABCDEFGHIJKLMNOPQ" - "RSTUVWXYZabcdefgh" - "ijklmnopqrstuvwxy" - "z0123456789+/"; - -const char Base64::rstr[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, - 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0}; - - -Base64::Base64() -{ -} - - -void Base64::encode(FILE *fil, std::string& output, bool add_crlf) -{ - size_t remain; - size_t i = 0; - size_t o = 0; - char input[4]; - - output = ""; - remain = fread(input,1,3,fil); - while (remain > 0) - { - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - // - remain = fread(input,1,3,fil); - } -} - - -void Base64::encode(const std::string& str_in, std::string& str_out, bool add_crlf) -{ - encode(str_in.c_str(), str_in.size(), str_out, add_crlf); -} - - -void Base64::encode(const char* input,size_t l,std::string& output, bool add_crlf) -{ - size_t i = 0; - size_t o = 0; - - output = ""; - while (i < l) - { - size_t remain = l - i; - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - i += 3; - } -} - - -void Base64::encode(const unsigned char* input,size_t l,std::string& output,bool add_crlf) -{ - size_t i = 0; - size_t o = 0; - - output = ""; - while (i < l) - { - size_t remain = l - i; - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - i += 3; - } -} - - -void Base64::decode(const std::string& input,std::string& output) -{ - size_t i = 0; - size_t l = input.size(); - - output = ""; - while (i < l) - { - while (i < l && (input[i] == 13 || input[i] == 10)) - i++; - if (i < l) - { - char b1 = (char)((rstr[(int)input[i]] << 2 & 0xfc) + - (rstr[(int)input[i + 1]] >> 4 & 0x03)); - output += b1; - if (input[i + 2] != '=') - { - char b2 = (char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + - (rstr[(int)input[i + 2]] >> 2 & 0x0f)); - output += b2; - } - if (input[i + 3] != '=') - { - char b3 = (char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + - rstr[(int)input[i + 3]]); - output += b3; - } - i += 4; - } - } -} - - -void Base64::decode(const std::string& input, unsigned char *output, size_t& sz) -{ - size_t i = 0; - size_t l = input.size(); - size_t j = 0; - - while (i < l) - { - while (i < l && (input[i] == 13 || input[i] == 10)) - i++; - if (i < l) - { - unsigned char b1 = (unsigned char)((rstr[(int)input[i]] << 2 & 0xfc) + - (rstr[(int)input[i + 1]] >> 4 & 0x03)); - if (output) - { - output[j] = b1; - } - j++; - if (input[i + 2] != '=') - { - unsigned char b2 = (unsigned char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + - (rstr[(int)input[i + 2]] >> 2 & 0x0f)); - if (output) - { - output[j] = b2; - } - j++; - } - if (input[i + 3] != '=') - { - unsigned char b3 = (unsigned char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + - rstr[(int)input[i + 3]]); - if (output) - { - output[j] = b3; - } - j++; - } - i += 4; - } - } - sz = j; -} - - -size_t Base64::decode_length(const std::string& str64) -{ - if (str64.empty() || str64.size() % 4) - return 0; - size_t l = 3 * (str64.size() / 4 - 1) + 1; - if (str64[str64.size() - 2] != '=') - l++; - if (str64[str64.size() - 1] != '=') - l++; - return l; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/dep/src/sockets/Exception.cpp b/dep/src/sockets/Exception.cpp deleted file mode 100644 index a005669e4..000000000 --- a/dep/src/sockets/Exception.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - ** \file Exception.cpp - ** \date 2007-09-28 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "Exception.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - -Exception::Exception(const std::string& description) : m_description(description) -{ -} - - -const std::string Exception::ToString() const -{ - return m_description; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/dep/src/sockets/Ipv4Address.cpp b/dep/src/sockets/Ipv4Address.cpp deleted file mode 100644 index 58f25e53b..000000000 --- a/dep/src/sockets/Ipv4Address.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/** - ** \file Ipv4Address.cpp - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Ipv4Address.h" -#include "Utility.h" -#include "Parse.h" -#ifndef _WIN32 -#include -#endif - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - -Ipv4Address::Ipv4Address(port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); -} - - -Ipv4Address::Ipv4Address(ipaddr_t a,port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); -} - - -Ipv4Address::Ipv4Address(struct in_addr& a,port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - m_addr.sin_addr = a; -} - - -Ipv4Address::Ipv4Address(const std::string& host,port_t port) : m_valid(false) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - { - ipaddr_t a; - if (Utility::u2ip(host, a)) - { - memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); - m_valid = true; - } - } -} - - -Ipv4Address::Ipv4Address(struct sockaddr_in& sa) -{ - m_addr = sa; - m_valid = sa.sin_family == AF_INET; -} - - -Ipv4Address::~Ipv4Address() -{ -} - - -Ipv4Address::operator struct sockaddr *() -{ - return (struct sockaddr *)&m_addr; -} - - -Ipv4Address::operator socklen_t() -{ - return sizeof(struct sockaddr_in); -} - - -void Ipv4Address::SetPort(port_t port) -{ - m_addr.sin_port = htons( port ); -} - - -port_t Ipv4Address::GetPort() -{ - return ntohs( m_addr.sin_port ); -} - - -bool Ipv4Address::Resolve(const std::string& hostname,struct in_addr& a) -{ - struct sockaddr_in sa; - memset(&a, 0, sizeof(a)); - if (Utility::isipv4(hostname)) - { - if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) - return false; - a = sa.sin_addr; - return true; - } - if (!Utility::u2ip(hostname, sa)) - return false; - a = sa.sin_addr; - return true; -} - - -bool Ipv4Address::Reverse(struct in_addr& a,std::string& name) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = a; - return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); -} - - -std::string Ipv4Address::Convert(bool include_port) -{ - if (include_port) - return Convert(m_addr.sin_addr) + ":" + Utility::l2string(GetPort()); - return Convert(m_addr.sin_addr); -} - - -std::string Ipv4Address::Convert(struct in_addr& a) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = a; - std::string name; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); - return name; -} - - -void Ipv4Address::SetAddress(struct sockaddr *sa) -{ - memcpy(&m_addr, sa, sizeof(struct sockaddr_in)); -} - - -int Ipv4Address::GetFamily() -{ - return m_addr.sin_family; -} - - -bool Ipv4Address::IsValid() -{ - return m_valid; -} - - -bool Ipv4Address::operator==(SocketAddress& a) -{ - if (a.GetFamily() != GetFamily()) - return false; - if ((socklen_t)a != sizeof(m_addr)) - return false; - struct sockaddr *sa = a; - struct sockaddr_in *p = (struct sockaddr_in *)sa; - if (p -> sin_port != m_addr.sin_port) - return false; - if (memcmp(&p -> sin_addr, &m_addr.sin_addr, 4)) - return false; - return true; -} - - -std::auto_ptr Ipv4Address::GetCopy() -{ - return std::auto_ptr(new Ipv4Address(m_addr)); -} - - -std::string Ipv4Address::Reverse() -{ - std::string tmp; - Reverse(m_addr.sin_addr, tmp); - return tmp; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/dep/src/sockets/Ipv6Address.cpp b/dep/src/sockets/Ipv6Address.cpp deleted file mode 100644 index 2e0f1e9ac..000000000 --- a/dep/src/sockets/Ipv6Address.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/** - ** \file Ipv6Address.cpp - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Ipv6Address.h" -#ifdef ENABLE_IPV6 - -#include "Utility.h" -#include "Parse.h" -#ifndef _WIN32 -#include -#endif -#ifdef IPPROTO_IPV6 - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Ipv6Address::Ipv6Address(port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); -} - - -Ipv6Address::Ipv6Address(struct in6_addr& a,port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); - m_addr.sin6_addr = a; -} - - -Ipv6Address::Ipv6Address(const std::string& host,port_t port) : m_valid(false) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); - { - struct in6_addr a; - if (Utility::u2ip(host, a)) - { - m_addr.sin6_addr = a; - m_valid = true; - } - } -} - - -Ipv6Address::Ipv6Address(struct sockaddr_in6& sa) -{ - m_addr = sa; - m_valid = sa.sin6_family == AF_INET6; -} - - -Ipv6Address::~Ipv6Address() -{ -} - - -Ipv6Address::operator struct sockaddr *() -{ - return (struct sockaddr *)&m_addr; -} - - -Ipv6Address::operator socklen_t() -{ - return sizeof(struct sockaddr_in6); -} - - -void Ipv6Address::SetPort(port_t port) -{ - m_addr.sin6_port = htons( port ); -} - - -port_t Ipv6Address::GetPort() -{ - return ntohs( m_addr.sin6_port ); -} - - -bool Ipv6Address::Resolve(const std::string& hostname,struct in6_addr& a) -{ - struct sockaddr_in6 sa; - memset(&a, 0, sizeof(a)); - if (Utility::isipv6(hostname)) - { - if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) - return false; - a = sa.sin6_addr; - return true; - } - if (!Utility::u2ip(hostname, sa)) - return false; - a = sa.sin6_addr; - return true; -} - - -bool Ipv6Address::Reverse(struct in6_addr& a,std::string& name) -{ - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = a; - return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); -} - - -std::string Ipv6Address::Convert(bool include_port) -{ - if (include_port) - return Convert(m_addr.sin6_addr) + ":" + Utility::l2string(GetPort()); - return Convert(m_addr.sin6_addr); -} - - -std::string Ipv6Address::Convert(struct in6_addr& a,bool mixed) -{ - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - if (mixed) - { - unsigned short x; - unsigned short addr16[8]; - memcpy(addr16, &a, sizeof(addr16)); - for (size_t i = 0; i < 6; i++) - { - x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - strcat(slask,":"); - if (x || !ok_to_skip) - { - sprintf(slask + strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - x = ntohs(addr16[6]); - sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); - x = ntohs(addr16[7]); - sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); - } - else - { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = a; - std::string name; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); - return name; - } - return slask; -} - - -void Ipv6Address::SetAddress(struct sockaddr *sa) -{ - memcpy(&m_addr, sa, sizeof(struct sockaddr_in6)); -} - - -int Ipv6Address::GetFamily() -{ - return m_addr.sin6_family; -} - - -void Ipv6Address::SetFlowinfo(uint32_t x) -{ - m_addr.sin6_flowinfo = x; -} - - -uint32_t Ipv6Address::GetFlowinfo() -{ - return m_addr.sin6_flowinfo; -} - - -#ifndef _WIN32 -void Ipv6Address::SetScopeId(uint32_t x) -{ - m_addr.sin6_scope_id = x; -} - - -uint32_t Ipv6Address::GetScopeId() -{ - return m_addr.sin6_scope_id; -} -#endif - - -bool Ipv6Address::IsValid() -{ - return m_valid; -} - - -bool Ipv6Address::operator==(SocketAddress& a) -{ - if (a.GetFamily() != GetFamily()) - return false; - if ((socklen_t)a != sizeof(m_addr)) - return false; - struct sockaddr *sa = a; - struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; - if (p -> sin6_port != m_addr.sin6_port) - return false; - if (memcmp(&p -> sin6_addr, &m_addr.sin6_addr, sizeof(struct in6_addr))) - return false; - return true; -} - - -std::auto_ptr Ipv6Address::GetCopy() -{ - return std::auto_ptr(new Ipv6Address(m_addr)); -} - - -std::string Ipv6Address::Reverse() -{ - std::string tmp; - Reverse(m_addr.sin6_addr, tmp); - return tmp; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // IPPROTO_IPV6 -#endif // ENABLE_IPV6 - diff --git a/dep/src/sockets/Lock.cpp b/dep/src/sockets/Lock.cpp deleted file mode 100644 index 3f7902e23..000000000 --- a/dep/src/sockets/Lock.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** \file Lock.cpp - ** \date 2005-08-22 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005,2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Mutex.h" -#include "Lock.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Lock::Lock(Mutex& m) : m_mutex(m) -{ - m_mutex.Lock(); -} - - -Lock::~Lock() -{ - m_mutex.Unlock(); -} - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/dep/src/sockets/Makefile.am b/dep/src/sockets/Makefile.am deleted file mode 100644 index d4f1ad21c..000000000 --- a/dep/src/sockets/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (C) 2005-2010 MaNGOS -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -## Process this file with automake to produce Makefile.in - -## Sub-directories to parse - -## CPP flags for includes, defines, etc. -AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../../include/sockets - -## Build MaNGOS shared library and its parts as convenience library. -# All libraries will be convenience libraries. Might be changed to shared -# later. -noinst_LIBRARIES = libmangossockets.a - -libmangossockets_a_SOURCES = \ - Base64.cpp \ - Exception.cpp \ - Ipv4Address.cpp \ - Ipv6Address.cpp \ - Lock.cpp \ - Mutex.cpp \ - Parse.cpp \ - ResolvServer.cpp \ - ResolvSocket.cpp \ - Socket.cpp \ - SocketHandler.cpp \ - StdoutLog.cpp \ - StreamSocket.cpp \ - TcpSocket.cpp \ - Thread.cpp \ - UdpSocket.cpp \ - Utility.cpp \ - socket_include.cpp diff --git a/dep/src/sockets/Mutex.cpp b/dep/src/sockets/Mutex.cpp deleted file mode 100644 index f7a03c7d9..000000000 --- a/dep/src/sockets/Mutex.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/** \file Mutex.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Mutex.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Mutex::Mutex() -{ -#ifdef _WIN32 - m_mutex = ::CreateMutex(NULL, FALSE, NULL); -#else - pthread_mutex_init(&m_mutex, NULL); -#endif -} - - -Mutex::~Mutex() -{ -#ifdef _WIN32 - ::CloseHandle(m_mutex); -#else - pthread_mutex_destroy(&m_mutex); -#endif -} - - -void Mutex::Lock() -{ -#ifdef _WIN32 - /*DWORD d =*/ WaitForSingleObject(m_mutex, INFINITE); - /// \todo check 'd' for result -#else - pthread_mutex_lock(&m_mutex); -#endif -} - - -void Mutex::Unlock() -{ -#ifdef _WIN32 - ::ReleaseMutex(m_mutex); -#else - pthread_mutex_unlock(&m_mutex); -#endif -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/dep/src/sockets/Parse.cpp b/dep/src/sockets/Parse.cpp deleted file mode 100644 index 58122c0c9..000000000 --- a/dep/src/sockets/Parse.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/** \file Parse.cpp - parse a string - ** - ** Written: 1999-Feb-10 grymse@alhem.net - **/ - -/* -Copyright (C) 1999-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include -#include - -#include "Parse.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/* implementation of class Parse */ - -Parse::Parse() -:pa_the_str("") -,pa_splits("") -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(0) -,pa_quote(false) -{ -} - -Parse::Parse(const std::string&s) -:pa_the_str(s) -,pa_splits("") -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(0) -,pa_quote(false) -{ -} - -Parse::Parse(const std::string&s,const std::string&sp) -:pa_the_str(s) -,pa_splits(sp) -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(0) -,pa_quote(false) -{ -} - -Parse::Parse(const std::string&s,const std::string&sp,short /*nospace*/) -:pa_the_str(s) -,pa_splits(sp) -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(1) -,pa_quote(false) -{ -} - - -Parse::~Parse() -{ -} - -#define C ((pa_the_ptr l(h); - - if (l.Bind("127.0.0.1", m_port)) - { - return; - } - h.Add(&l); - - m_ready = true; - while (!m_quit && IsRunning() ) - { - h.Select(0, 500000); - } - SetRunning(false); -} - - -void ResolvServer::Quit() -{ - m_quit = true; -} - - -bool ResolvServer::Ready() -{ - return m_ready; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER - diff --git a/dep/src/sockets/ResolvSocket.cpp b/dep/src/sockets/ResolvSocket.cpp deleted file mode 100644 index 2d9d31d5a..000000000 --- a/dep/src/sockets/ResolvSocket.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/** \file ResolvSocket.cpp - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#pragma warning(disable:4503) -#endif -#else -#include -#endif -#include "ResolvSocket.h" -#ifdef ENABLE_RESOLVER -#include "Utility.h" -#include "Parse.h" -#include "ISocketHandler.h" -#include "Lock.h" -#include "Mutex.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -//#ifdef _DEBUG -//#define DEB(x) x -//#else -#define DEB(x) -//#endif - - -// static -ResolvSocket::cache_t ResolvSocket::m_cache; -ResolvSocket::timeout_t ResolvSocket::m_cache_to; -Mutex ResolvSocket::m_cache_mutex; - - -ResolvSocket::ResolvSocket(ISocketHandler& h) -:TcpSocket(h) -,m_bServer(false) -,m_parent(NULL) -#ifdef ENABLE_IPV6 -,m_resolve_ipv6(false) -#endif -,m_cached(false) -{ - SetLineProtocol(); -} - - -ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, const std::string& host, port_t port, bool ipv6) -:TcpSocket(h) -,m_bServer(false) -,m_parent(parent) -,m_resolv_host(host) -,m_resolv_port(port) -#ifdef ENABLE_IPV6 -,m_resolve_ipv6(ipv6) -#endif -,m_cached(false) -{ - SetLineProtocol(); -} - - -ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, ipaddr_t a) -:TcpSocket(h) -,m_bServer(false) -,m_parent(parent) -,m_resolv_port(0) -,m_resolv_address(a) -#ifdef ENABLE_IPV6 -,m_resolve_ipv6(false) -#endif -,m_cached(false) -{ - SetLineProtocol(); -} - - -#ifdef ENABLE_IPV6 -ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, in6_addr& a) -:TcpSocket(h) -,m_bServer(false) -,m_parent(parent) -,m_resolv_port(0) -,m_resolve_ipv6(true) -,m_resolv_address6(a) -,m_cached(false) -{ - SetLineProtocol(); -} -#endif - - -ResolvSocket::~ResolvSocket() -{ -} - - -void ResolvSocket::OnLine(const std::string& line) -{ - Parse pa(line, ":"); - if (m_bServer) - { - m_query = pa.getword(); - m_data = pa.getrest(); -DEB( fprintf(stderr, " *** ResolvSocket server; query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) - // %! check cache - { - Lock lock(m_cache_mutex); - if (m_cache[m_query].find(m_data) != m_cache[m_query].end()) - { - if (time(NULL) - m_cache_to[m_query][m_data] < 3600) // ttl - { - std::string result = m_cache[m_query][m_data]; -DEB(fprintf(stderr, " *** Returning cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), result.c_str());) - Send("Cached\n"); - if (!result.size()) /* failed */ - { - Send("Failed\n\n"); - SetCloseAndDelete(); - return; - } - else - if (m_query == "gethostbyname") - { - Send("A: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - else -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (m_query == "gethostbyname2") - { - Send("AAAA: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - else -#endif -#endif - if (m_query == "gethostbyaddr") - { - Send("Name: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - } - } - } - if (!Detach()) // detach failed? - { - SetCloseAndDelete(); - } - return; - } - std::string key = pa.getword(); - std::string value = pa.getrest(); -DEB( fprintf(stderr, " *** ResolvSocket response; %s: %s\n", key.c_str(), value.c_str());) - - if (key == "Cached") - { - m_cached = true; - } - else - if (key == "Failed" && m_parent) - { -DEB( fprintf(stderr, " ************ Resolve failed\n");) - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - m_parent -> OnResolveFailed(m_resolv_id); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } - else - if (key == "Name" && !m_resolv_host.size() && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - m_parent -> OnReverseResolved(m_resolv_id, value); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } - else - if (key == "A" && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - ipaddr_t l; - Utility::u2ip(value, l); // ip2ipaddr_t - m_parent -> OnResolved(m_resolv_id, l, m_resolv_port); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; // always use first ip in case there are several - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - else - if (key == "AAAA" && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - in6_addr a; - Utility::u2ip(value, a); - m_parent -> OnResolved(m_resolv_id, a, m_resolv_port); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } -#endif -#endif -} - - -void ResolvSocket::OnDetached() -{ -DEB( fprintf(stderr, " *** ResolvSocket::OnDetached(); query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) - if (m_query == "gethostbyname") - { - struct sockaddr_in sa; - if (Utility::u2ip(m_data, sa)) - { - std::string ip; - Utility::l2ip(sa.sin_addr, ip); - Send("A: " + ip + "\n"); - } - else - { - Send("Failed\n"); - } - Send("\n"); - } - else -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (m_query == "gethostbyname2") - { - struct sockaddr_in6 sa; - if (Utility::u2ip(m_data, sa)) - { - std::string ip; - Utility::l2ip(sa.sin6_addr, ip); - Send("AAAA: " + ip + "\n"); - } - else - { - Send("Failed\n"); - } - Send("\n"); - } - else -#endif -#endif - if (m_query == "gethostbyaddr") - { - if (Utility::isipv4( m_data )) - { - struct sockaddr_in sa; - if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) - { - Send("Failed: convert to sockaddr_in failed\n"); - } - else - { - std::string name; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) - { - Send("Failed: ipv4 reverse lookup of " + m_data + "\n"); - } - else - { - Send("Name: " + name + "\n"); - } - } - } - else -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (Utility::isipv6( m_data )) - { - struct sockaddr_in6 sa; - if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) - { - Send("Failed: convert to sockaddr_in6 failed\n"); - } - else - { - std::string name; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) - { - Send("Failed: ipv6 reverse lookup of " + m_data + "\n"); - } - else - { - Send("Name: " + name + "\n"); - } - } - } - else -#endif -#endif - { - Send("Failed: malformed address\n"); - } - Send("\n"); - } - else - { - std::string msg = "Unknown query type: " + m_query; - Handler().LogError(this, "OnDetached", 0, msg); - Send("Unknown\n\n"); - } - SetCloseAndDelete(); -} - - -void ResolvSocket::OnConnect() -{ - if (!m_resolv_host.empty()) - { -#ifdef ENABLE_IPV6 - std::string msg = (m_resolve_ipv6 ? "gethostbyname2 " : "gethostbyname ") + m_resolv_host + "\n"; - m_query = m_resolve_ipv6 ? "gethostbyname2" : "gethostbyname"; -#else - std::string msg = "gethostbyname " + m_resolv_host + "\n"; - m_query = "gethostbyname"; -#endif - m_data = m_resolv_host; - Send( msg ); - return; - } -#ifdef ENABLE_IPV6 - if (m_resolve_ipv6) - { - std::string tmp; - Utility::l2ip(m_resolv_address6, tmp); - m_query = "gethostbyaddr"; - m_data = tmp; - std::string msg = "gethostbyaddr " + tmp + "\n"; - Send( msg ); - } -#endif - std::string tmp; - Utility::l2ip(m_resolv_address, tmp); - m_query = "gethostbyaddr"; - m_data = tmp; - std::string msg = "gethostbyaddr " + tmp + "\n"; - Send( msg ); -} - - -void ResolvSocket::OnDelete() -{ - if (m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - m_parent -> OnResolveFailed(m_resolv_id); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); - std::string value; -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER - diff --git a/dep/src/sockets/Socket.cpp b/dep/src/sockets/Socket.cpp deleted file mode 100644 index 883363eb1..000000000 --- a/dep/src/sockets/Socket.cpp +++ /dev/null @@ -1,1898 +0,0 @@ -/** \file Socket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Socket.h" -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include -#else -#include -#include -#endif -#include -#include - -#include "ISocketHandler.h" -#include "Utility.h" - -#include "SocketAddress.h" -#include "SocketHandler.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif -#include "Ipv4Address.h" - -//#ifdef _DEBUG -//#define DEB(x) x; fflush(stderr); -//#else -#define DEB(x) -//#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// statics -#ifdef _WIN32 -WSAInitializer Socket::m_winsock_init; -#endif - - -Socket::Socket(ISocketHandler& h) -//:m_flags(0) -:m_handler(h) -,m_socket( INVALID_SOCKET ) -,m_bDel(false) -,m_bClose(false) -,m_tCreate(time(NULL)) -,m_parent(NULL) -,m_b_disable_read(false) -,m_connected(false) -,m_b_erased_by_handler(false) -,m_tClose(0) -,m_client_remote_address(NULL) -,m_remote_address(NULL) -,m_traffic_monitor(NULL) -,m_bLost(false) -#ifdef HAVE_OPENSSL -,m_b_enable_ssl(false) -,m_b_ssl(false) -,m_b_ssl_server(false) -#endif -#ifdef ENABLE_IPV6 -,m_ipv6(false) -#endif -#ifdef ENABLE_POOL -,m_socket_type(0) -,m_bClient(false) -,m_bRetain(false) -#endif -#ifdef ENABLE_SOCKS4 -,m_bSocks4(false) -,m_socks4_host(h.GetSocks4Host()) -,m_socks4_port(h.GetSocks4Port()) -,m_socks4_userid(h.GetSocks4Userid()) -#endif -#ifdef ENABLE_DETACH -,m_detach(false) -,m_detached(false) -,m_pThread(NULL) -,m_slave_handler(NULL) -#endif -{ -} - - -Socket::~Socket() -{ - Handler().Remove(this); - if (m_socket != INVALID_SOCKET -#ifdef ENABLE_POOL - && !m_bRetain -#endif - ) - { - Close(); - } -} - - -void Socket::Init() -{ -} - - -void Socket::OnRead() -{ -} - - -void Socket::OnWrite() -{ -} - - -void Socket::OnException() -{ - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} - - -void Socket::OnDelete() -{ -} - - -void Socket::OnConnect() -{ -} - - -void Socket::OnAccept() -{ -} - - -int Socket::Close() -{ - if (m_socket == INVALID_SOCKET) // this could happen - { - Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); - return 0; - } - int n; - if ((n = closesocket(m_socket)) == -1) - { - // failed... - Handler().LogError(this, "close", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - Handler().Set(m_socket, false, false, false); // remove from fd_set's - Handler().AddList(m_socket, LIST_CALLONCONNECT, false); -#ifdef ENABLE_DETACH - Handler().AddList(m_socket, LIST_DETACH, false); -#endif - Handler().AddList(m_socket, LIST_TIMEOUT, false); - Handler().AddList(m_socket, LIST_RETRY, false); - Handler().AddList(m_socket, LIST_CLOSE, false); - m_socket = INVALID_SOCKET; - return n; -} - - -SOCKET Socket::CreateSocket(int af,int type, const std::string& protocol) -{ - struct protoent *p = NULL; - SOCKET s; - -#ifdef ENABLE_POOL - m_socket_type = type; - m_socket_protocol = protocol; -#endif - if (!protocol.empty()) - { - p = getprotobyname( protocol.c_str() ); - if (!p) - { - Handler().LogError(this, "getprotobyname", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -#ifdef ENABLE_EXCEPTIONS - throw Exception(std::string("getprotobyname() failed: ") + StrError(Errno)); -#endif - return INVALID_SOCKET; - } - } - int protno = p ? p -> p_proto : 0; - - s = socket(af, type, protno); - if (s == INVALID_SOCKET) - { - Handler().LogError(this, "socket", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -#ifdef ENABLE_EXCEPTIONS - throw Exception(std::string("socket() failed: ") + StrError(Errno)); -#endif - return INVALID_SOCKET; - } - Attach(s); - OnOptions(af, type, protno, s); - Attach(INVALID_SOCKET); - return s; -} - - -void Socket::Attach(SOCKET s) -{ - m_socket = s; -} - - -SOCKET Socket::GetSocket() -{ - return m_socket; -} - - -void Socket::SetDeleteByHandler(bool x) -{ - m_bDel = x; -} - - -bool Socket::DeleteByHandler() -{ - return m_bDel; -} - - -void Socket::SetCloseAndDelete(bool x) -{ - if (x != m_bClose) - { - Handler().AddList(m_socket, LIST_CLOSE, x); - m_bClose = x; - if (x) - { - m_tClose = time(NULL); - } - } -} - - -bool Socket::CloseAndDelete() -{ - return m_bClose; -} - - -void Socket::SetRemoteAddress(SocketAddress& ad) //struct sockaddr* sa, socklen_t l) -{ - m_remote_address = ad.GetCopy(); -} - - -std::auto_ptr Socket::GetRemoteSocketAddress() -{ - return m_remote_address -> GetCopy(); -} - - -ISocketHandler& Socket::Handler() const -{ -#ifdef ENABLE_DETACH - if (IsDetached()) - return *m_slave_handler; -#endif - return m_handler; -} - - -ISocketHandler& Socket::MasterHandler() const -{ - return m_handler; -} - - -ipaddr_t Socket::GetRemoteIP4() -{ - ipaddr_t l = 0; -#ifdef ENABLE_IPV6 - if (m_ipv6) - { - Handler().LogError(this, "GetRemoteIP4", 0, "get ipv4 address for ipv6 socket", LOG_LEVEL_WARNING); - } -#endif - if (m_remote_address.get() != NULL) - { - struct sockaddr *p = *m_remote_address; - struct sockaddr_in *sa = (struct sockaddr_in *)p; - memcpy(&l, &sa -> sin_addr, sizeof(struct in_addr)); - } - return l; -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -struct in6_addr Socket::GetRemoteIP6() -{ - if (!m_ipv6) - { - Handler().LogError(this, "GetRemoteIP6", 0, "get ipv6 address for ipv4 socket", LOG_LEVEL_WARNING); - } - struct sockaddr_in6 fail; - if (m_remote_address.get() != NULL) - { - struct sockaddr *p = *m_remote_address; - memcpy(&fail, p, sizeof(struct sockaddr_in6)); - } - else - { - memset(&fail, 0, sizeof(struct sockaddr_in6)); - } - return fail.sin6_addr; -} -#endif -#endif - - -port_t Socket::GetRemotePort() -{ - if (!m_remote_address.get()) - { - return 0; - } - return m_remote_address -> GetPort(); -} - - -std::string Socket::GetRemoteAddress() -{ - if (!m_remote_address.get()) - { - return ""; - } - return m_remote_address -> Convert(false); -} - - -std::string Socket::GetRemoteHostname() -{ - if (!m_remote_address.get()) - { - return ""; - } - return m_remote_address -> Reverse(); -} - - -bool Socket::SetNonblocking(bool bNb) -{ -#ifdef _WIN32 - unsigned long l = bNb ? 1 : 0; - int n = ioctlsocket(m_socket, FIONBIO, &l); - if (n != 0) - { - Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); - return false; - } - return true; -#else - if (bNb) - { - if (fcntl(m_socket, F_SETFL, O_NONBLOCK) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - else - { - if (fcntl(m_socket, F_SETFL, 0) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - return true; -#endif -} - - -bool Socket::SetNonblocking(bool bNb, SOCKET s) -{ -#ifdef _WIN32 - unsigned long l = bNb ? 1 : 0; - int n = ioctlsocket(s, FIONBIO, &l); - if (n != 0) - { - Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); - return false; - } - return true; -#else - if (bNb) - { - if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - else - { - if (fcntl(s, F_SETFL, 0) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - return true; -#endif -} - - -void Socket::Set(bool bRead, bool bWrite, bool bException) -{ - Handler().Set(m_socket, bRead, bWrite, bException); -} - - -bool Socket::Ready() -{ - if (m_socket != INVALID_SOCKET && !CloseAndDelete()) - return true; - return false; -} - - -void Socket::OnLine(const std::string& ) -{ -} - - -void Socket::OnConnectFailed() -{ -} - - -Socket *Socket::GetParent() -{ - return m_parent; -} - - -void Socket::SetParent(Socket *x) -{ - m_parent = x; -} - - -port_t Socket::GetPort() -{ - Handler().LogError(this, "GetPort", 0, "GetPort only implemented for ListenSocket", LOG_LEVEL_WARNING); - return 0; -} - - -bool Socket::OnConnectRetry() -{ - return true; -} - - -#ifdef ENABLE_RECONNECT -void Socket::OnReconnect() -{ -} -#endif - - -time_t Socket::Uptime() -{ - return time(NULL) - m_tCreate; -} - - -#ifdef ENABLE_IPV6 -void Socket::SetIpv6(bool x) -{ - m_ipv6 = x; -} - - -bool Socket::IsIpv6() -{ - return m_ipv6; -} -#endif - - -void Socket::DisableRead(bool x) -{ - m_b_disable_read = x; -} - - -bool Socket::IsDisableRead() -{ - return m_b_disable_read; -} - - -void Socket::SendBuf(const char *,size_t,int) -{ -} - - -void Socket::Send(const std::string&,int) -{ -} - - -void Socket::SetConnected(bool x) -{ - m_connected = x; -} - - -bool Socket::IsConnected() -{ - return m_connected; -} - - -void Socket::OnDisconnect() -{ -} - - -void Socket::SetLost() -{ - m_bLost = true; -} - - -bool Socket::Lost() -{ - return m_bLost; -} - - -void Socket::SetErasedByHandler(bool x) -{ - m_b_erased_by_handler = x; -} - - -bool Socket::ErasedByHandler() -{ - return m_b_erased_by_handler; -} - - -time_t Socket::TimeSinceClose() -{ - return time(NULL) - m_tClose; -} - - -void Socket::SetClientRemoteAddress(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SetClientRemoteAddress", 0, "remote address not valid", LOG_LEVEL_ERROR); - } - m_client_remote_address = ad.GetCopy(); -} - - -std::auto_ptr Socket::GetClientRemoteAddress() -{ - if (!m_client_remote_address.get()) - { - Handler().LogError(this, "GetClientRemoteAddress", 0, "remote address not yet set", LOG_LEVEL_ERROR); - } - return m_client_remote_address -> GetCopy(); -} - - -uint64_t Socket::GetBytesSent(bool) -{ - return 0; -} - - -uint64_t Socket::GetBytesReceived(bool) -{ - return 0; -} - - -#ifdef HAVE_OPENSSL -void Socket::OnSSLConnect() -{ -} - - -void Socket::OnSSLAccept() -{ -} - - -bool Socket::SSLNegotiate() -{ - return false; -} - - -bool Socket::IsSSL() -{ - return m_b_enable_ssl; -} - - -void Socket::EnableSSL(bool x) -{ - m_b_enable_ssl = x; -} - - -bool Socket::IsSSLNegotiate() -{ - return m_b_ssl; -} - - -void Socket::SetSSLNegotiate(bool x) -{ - m_b_ssl = x; -} - - -bool Socket::IsSSLServer() -{ - return m_b_ssl_server; -} - - -void Socket::SetSSLServer(bool x) -{ - m_b_ssl_server = x; -} - - -void Socket::OnSSLConnectFailed() -{ -} - - -void Socket::OnSSLAcceptFailed() -{ -} -#endif // HAVE_OPENSSL - - -#ifdef ENABLE_POOL -void Socket::CopyConnection(Socket *sock) -{ - Attach( sock -> GetSocket() ); -#ifdef ENABLE_IPV6 - SetIpv6( sock -> IsIpv6() ); -#endif - SetSocketType( sock -> GetSocketType() ); - SetSocketProtocol( sock -> GetSocketProtocol() ); - - SetClientRemoteAddress( *sock -> GetClientRemoteAddress() ); - SetRemoteAddress( *sock -> GetRemoteSocketAddress() ); -} - - -void Socket::SetIsClient() -{ - m_bClient = true; -} - - -void Socket::SetSocketType(int x) -{ - m_socket_type = x; -} - - -int Socket::GetSocketType() -{ - return m_socket_type; -} - - -void Socket::SetSocketProtocol(const std::string& x) -{ - m_socket_protocol = x; -} - - -const std::string& Socket::GetSocketProtocol() -{ - return m_socket_protocol; -} - - -void Socket::SetRetain() -{ - if (m_bClient) m_bRetain = true; -} - - -bool Socket::Retain() -{ - return m_bRetain; -} - - -#endif // ENABLE_POOL - - -#ifdef ENABLE_SOCKS4 -void Socket::OnSocks4Connect() -{ - Handler().LogError(this, "OnSocks4Connect", 0, "Use with TcpSocket only"); -} - - -void Socket::OnSocks4ConnectFailed() -{ - Handler().LogError(this, "OnSocks4ConnectFailed", 0, "Use with TcpSocket only"); -} - - -bool Socket::OnSocks4Read() -{ - Handler().LogError(this, "OnSocks4Read", 0, "Use with TcpSocket only"); - return true; -} - - -void Socket::SetSocks4Host(const std::string& host) -{ - Utility::u2ip(host, m_socks4_host); -} - - -bool Socket::Socks4() -{ - return m_bSocks4; -} - - -void Socket::SetSocks4(bool x) -{ - m_bSocks4 = x; -} - - -void Socket::SetSocks4Host(ipaddr_t a) -{ - m_socks4_host = a; -} - - -void Socket::SetSocks4Port(port_t p) -{ - m_socks4_port = p; -} - - -void Socket::SetSocks4Userid(const std::string& x) -{ - m_socks4_userid = x; -} - - -ipaddr_t Socket::GetSocks4Host() -{ - return m_socks4_host; -} - - -port_t Socket::GetSocks4Port() -{ - return m_socks4_port; -} - - -const std::string& Socket::GetSocks4Userid() -{ - return m_socks4_userid; -} -#endif // ENABLE_SOCKS4 - - -#ifdef ENABLE_DETACH -bool Socket::Detach() -{ - if (!DeleteByHandler()) - return false; - if (m_pThread) - return false; - if (m_detached) - return false; - SetDetach(); - return true; -} - - -void Socket::DetachSocket() -{ - SetDetached(); - m_pThread = new SocketThread(this); - m_pThread -> SetRelease(true); -} - - -void Socket::OnDetached() -{ -} - - -void Socket::SetDetach(bool x) -{ - Handler().AddList(m_socket, LIST_DETACH, x); - m_detach = x; -} - - -bool Socket::IsDetach() -{ - return m_detach; -} - - -void Socket::SetDetached(bool x) -{ - m_detached = x; -} - - -const bool Socket::IsDetached() const -{ - return m_detached; -} - - -void Socket::SetSlaveHandler(ISocketHandler *p) -{ - m_slave_handler = p; -} - - -Socket::SocketThread::SocketThread(Socket *p) -:Thread(false) -,m_socket(p) -{ - // Creator will release -} - - -Socket::SocketThread::~SocketThread() -{ - if (IsRunning()) - { - SetRelease(true); - SetRunning(false); -#ifdef _WIN32 - Sleep(1000); -#else - sleep(1); -#endif - } -} - - -void Socket::SocketThread::Run() -{ - SocketHandler h; - h.SetSlave(); - h.Add(m_socket); - m_socket -> SetSlaveHandler(&h); - m_socket -> OnDetached(); - while (h.GetCount() && IsRunning()) - { - h.Select(0, 500000); - } - // m_socket now deleted oops - // yeah oops m_socket delete its socket thread, that means this - // so Socket will no longer delete its socket thread, instead we do this: - SetDeleteOnExit(); -} -#endif // ENABLE_DETACH - - -#ifdef ENABLE_RESOLVER -int Socket::Resolve(const std::string& host,port_t port) -{ - return Handler().Resolve(this, host, port); -} - - -#ifdef ENABLE_IPV6 -int Socket::Resolve6(const std::string& host,port_t port) -{ - return Handler().Resolve6(this, host, port); -} -#endif - - -int Socket::Resolve(ipaddr_t a) -{ - return Handler().Resolve(this, a); -} - - -#ifdef ENABLE_IPV6 -int Socket::Resolve(in6_addr& a) -{ - return Handler().Resolve(this, a); -} -#endif - - -void Socket::OnResolved(int,ipaddr_t,port_t) -{ -} - - -#ifdef ENABLE_IPV6 -void Socket::OnResolved(int,in6_addr&,port_t) -{ -} -#endif - - -void Socket::OnReverseResolved(int,const std::string&) -{ -} - - -void Socket::OnResolveFailed(int) -{ -} -#endif // ENABLE_RESOLVER - - -/* IP options */ - - -bool Socket::SetIpOptions(const void *p, socklen_t len) -{ -#ifdef IP_OPTIONS - if (setsockopt(GetSocket(), IPPROTO_IP, IP_OPTIONS, (char *)p, len) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_OPTIONS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_OPTIONS", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef IP_PKTINFO -bool Socket::SetIpPktinfo(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_PKTINFO, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_PKTINFO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RECVTOS -bool Socket::SetIpRecvTOS(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTOS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RECVTTL -bool Socket::SetIpRecvTTL(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTTL, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RECVOPTS -bool Socket::SetIpRecvopts(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVOPTS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RETOPTS -bool Socket::SetIpRetopts(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RETOPTS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RETOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetIpTOS(unsigned char tos) -{ -#ifdef IP_TOS - if (setsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(tos)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); - return false; -#endif -} - - -unsigned char Socket::IpTOS() -{ - unsigned char tos = 0; -#ifdef IP_TOS - socklen_t len = sizeof(tos); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); -#endif - return tos; -} - - -bool Socket::SetIpTTL(int ttl) -{ -#ifdef IP_TTL - if (setsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, sizeof(ttl)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::IpTTL() -{ - int ttl = 0; -#ifdef IP_TTL - socklen_t len = sizeof(ttl); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); -#endif - return ttl; -} - - -bool Socket::SetIpHdrincl(bool x) -{ -#ifdef IP_HDRINCL - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_HDRINCL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_HDRINCL", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef IP_RECVERR -bool Socket::SetIpRecverr(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVERR, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVERR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_MTU_DISCOVER -bool Socket::SetIpMtudiscover(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MTU_DISCOVER, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MTU_DISCOVER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_MTU -int Socket::IpMtu() -{ - int mtu = 0; - socklen_t len = sizeof(mtu); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_MTU, (char *)&mtu, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MTU)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } - return mtu; -} -#endif - - -#ifdef IP_ROUTER_ALERT -bool Socket::SetIpRouterAlert(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ROUTER_ALERT, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ROUTER_ALERT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetIpMulticastTTL(int ttl) -{ -#ifdef IP_MULTICAST_TTL - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::IpMulticastTTL() -{ - int ttl = 0; -#ifdef IP_MULTICAST_TTL - socklen_t len = sizeof(ttl); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); -#endif - return ttl; -} - - -bool Socket::SetMulticastLoop(bool x) -{ -#ifdef IP_MULTICAST_LOOP - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_LOOP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_LOOP", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef LINUX -bool Socket::IpAddMembership(struct ip_mreqn& ref) -{ -#ifdef IP_ADD_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} -#endif - - -bool Socket::IpAddMembership(struct ip_mreq& ref) -{ -#ifdef IP_ADD_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef LINUX -bool Socket::IpDropMembership(struct ip_mreqn& ref) -{ -#ifdef IP_DROP_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} -#endif - - -bool Socket::IpDropMembership(struct ip_mreq& ref) -{ -#ifdef IP_DROP_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} - - -/* SOCKET options */ - - -bool Socket::SetSoReuseaddr(bool x) -{ -#ifdef SO_REUSEADDR - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_REUSEADDR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_REUSEADDR", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoKeepalive(bool x) -{ -#ifdef SO_KEEPALIVE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_KEEPALIVE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_KEEPALIVE", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef SO_NOSIGPIPE -bool Socket::SetSoNosigpipe(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_NOSIGPIPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SoAcceptconn() -{ - int value = 0; -#ifdef SO_ACCEPTCONN - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_ACCEPTCONN, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ACCEPTCONN)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_ACCEPTCONN", LOG_LEVEL_INFO); -#endif - return value ? true : false; -} - - -#ifdef SO_BSDCOMPAT -bool Socket::SetSoBsdcompat(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BSDCOMPAT, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BSDCOMPAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_BINDTODEVICE -bool Socket::SetSoBindtodevice(const std::string& intf) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BINDTODEVICE, (char *)intf.c_str(), intf.size()) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BINDTODEVICE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetSoBroadcast(bool x) -{ -#ifdef SO_BROADCAST - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BROADCAST)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_BROADCAST", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoDebug(bool x) -{ -#ifdef SO_DEBUG - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_DEBUG, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DEBUG)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_DEBUG", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::SoError() -{ - int value = 0; -#ifdef SO_ERROR - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_ERROR, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ERROR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_ERROR", LOG_LEVEL_INFO); -#endif - return value; -} - - -bool Socket::SetSoDontroute(bool x) -{ -#ifdef SO_DONTROUTE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_DONTROUTE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DONTROUTE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_DONTROUTE", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoLinger(int onoff, int linger) -{ -#ifdef SO_LINGER - struct linger stl; - stl.l_onoff = onoff; - stl.l_linger = linger; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_LINGER, (char *)&stl, sizeof(stl)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_LINGER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_LINGER", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoOobinline(bool x) -{ -#ifdef SO_OOBINLINE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_OOBINLINE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_OOBINLINE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_OOBINLINE", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef SO_PASSCRED -bool Socket::SetSoPasscred(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PASSCRED, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PASSCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_PEERCRED -bool Socket::SoPeercred(struct ucred& ucr) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PEERCRED, (char *)&ucr, sizeof(ucr)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PEERCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_PRIORITY -bool Socket::SetSoPriority(int x) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PRIORITY, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PRIORITY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetSoRcvlowat(int x) -{ -#ifdef SO_RCVLOWAT - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVLOWAT, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVLOWAT", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoSndlowat(int x) -{ -#ifdef SO_SNDLOWAT - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDLOWAT, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDLOWAT", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoRcvtimeo(struct timeval& tv) -{ -#ifdef SO_RCVTIMEO - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVTIMEO", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoSndtimeo(struct timeval& tv) -{ -#ifdef SO_SNDTIMEO - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDTIMEO", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoRcvbuf(int x) -{ -#ifdef SO_RCVBUF - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::SoRcvbuf() -{ - int value = 0; -#ifdef SO_RCVBUF - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); -#endif - return value; -} - - -#ifdef SO_RCVBUFFORCE -bool Socket::SetSoRcvbufforce(int x) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUFFORCE, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetSoSndbuf(int x) -{ -#ifdef SO_SNDBUF - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::SoSndbuf() -{ - int value = 0; -#ifdef SO_SNDBUF - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); -#endif - return value; -} - - -#ifdef SO_SNDBUFFORCE -bool Socket::SetSoSndbufforce(int x) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUFFORCE, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_TIMESTAMP -bool Socket::SetSoTimestamp(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_TIMESTAMP, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_TIMESTAMP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -int Socket::SoType() -{ - int value = 0; -#ifdef SO_TYPE - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_TYPE, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_TYPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_TYPE", LOG_LEVEL_INFO); -#endif - return value; -} - - -#ifdef ENABLE_TRIGGERS -void Socket::Subscribe(int id) -{ - Handler().Subscribe(id, this); -} - - -void Socket::Unsubscribe(int id) -{ - Handler().Unsubscribe(id, this); -} - - -void Socket::OnTrigger(int, const TriggerData&) -{ -} - - -void Socket::OnCancelled(int) -{ -} -#endif - - -void Socket::SetTimeout(time_t secs) -{ - if (!secs) - { - Handler().AddList(m_socket, LIST_TIMEOUT, false); - return; - } - Handler().AddList(m_socket, LIST_TIMEOUT, true); - m_timeout_start = time(NULL); - m_timeout_limit = secs; -} - - -void Socket::OnTimeout() -{ -} - - -void Socket::OnConnectTimeout() -{ -} - - -bool Socket::Timeout(time_t tnow) -{ - if (tnow - m_timeout_start > m_timeout_limit) - return true; - return false; -} - - -/** Returns local port number for bound socket file descriptor. */ -port_t Socket::GetSockPort() -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return ntohs(sa.sin6_port); - } -#endif -#endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return ntohs(sa.sin_port); -} - - -/** Returns local ipv4 address for bound socket file descriptor. */ -ipaddr_t Socket::GetSockIP4() -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - return 0; - } -#endif -#endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - ipaddr_t a; - memcpy(&a, &sa.sin_addr, 4); - return a; -} - - -/** Returns local ipv4 address as text for bound socket file descriptor. */ -std::string Socket::GetSockAddress() -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - return ""; - } -#endif -#endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - Ipv4Address addr( sa ); - return addr.Convert(); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -/** Returns local ipv6 address for bound socket file descriptor. */ -struct in6_addr Socket::GetSockIP6() -{ - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return sa.sin6_addr; - } - struct in6_addr a; - memset(&a, 0, sizeof(a)); - return a; -} - - -/** Returns local ipv6 address as text for bound socket file descriptor. */ -std::string Socket::GetSockAddress6() -{ - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - Ipv6Address addr( sa ); - return addr.Convert(); - } - return ""; -} -#endif -#endif - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/dep/src/sockets/SocketHandler.cpp b/dep/src/sockets/SocketHandler.cpp deleted file mode 100644 index f2a4f7c30..000000000 --- a/dep/src/sockets/SocketHandler.cpp +++ /dev/null @@ -1,1423 +0,0 @@ -/** \file SocketHandler.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#endif -#include -#include -#include - -#include "SocketHandler.h" -#include "UdpSocket.h" -#include "ResolvSocket.h" -#include "ResolvServer.h" -#include "TcpSocket.h" -#include "Mutex.h" -#include "Utility.h" -#include "SocketAddress.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -//#ifdef _DEBUG -//#define DEB(x) x; fflush(stderr); -//#else -#define DEB(x) -//#endif - - -SocketHandler::SocketHandler(StdLog *p) -:m_stdlog(p) -,m_mutex(m_mutex) -,m_b_use_mutex(false) -,m_maxsock(0) -,m_preverror(-1) -,m_errcnt(0) -,m_tlast(0) -#ifdef ENABLE_SOCKS4 -,m_socks4_host(0) -,m_socks4_port(0) -,m_bTryDirect(false) -#endif -#ifdef ENABLE_RESOLVER -,m_resolv_id(0) -,m_resolver(NULL) -#endif -#ifdef ENABLE_POOL -,m_b_enable_pool(false) -#endif -#ifdef ENABLE_TRIGGERS -,m_next_trigger_id(0) -#endif -#ifdef ENABLE_DETACH -,m_slave(false) -#endif -{ - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); -} - - -SocketHandler::SocketHandler(Mutex& mutex,StdLog *p) -:m_stdlog(p) -,m_mutex(mutex) -,m_b_use_mutex(true) -,m_maxsock(0) -,m_preverror(-1) -,m_errcnt(0) -,m_tlast(0) -#ifdef ENABLE_SOCKS4 -,m_socks4_host(0) -,m_socks4_port(0) -,m_bTryDirect(false) -#endif -#ifdef ENABLE_RESOLVER -,m_resolv_id(0) -,m_resolver(NULL) -#endif -#ifdef ENABLE_POOL -,m_b_enable_pool(false) -#endif -#ifdef ENABLE_TRIGGERS -,m_next_trigger_id(0) -#endif -#ifdef ENABLE_DETACH -,m_slave(false) -#endif -{ - m_mutex.Lock(); - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); -} - - -SocketHandler::~SocketHandler() -{ -#ifdef ENABLE_RESOLVER - if (m_resolver) - { - m_resolver -> Quit(); - } -#endif - { - while (m_sockets.size()) - { -DEB( fprintf(stderr, "Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) - socket_m::iterator it = m_sockets.begin(); - Socket *p = it -> second; - if (p) - { -DEB( fprintf(stderr, " fd %d\n", p -> GetSocket());) - p -> Close(); -DEB( fprintf(stderr, " fd closed %d\n", p -> GetSocket());) -// p -> OnDelete(); // hey, I turn this back on. what's the worst that could happen??!! - // MinionSocket breaks, calling MinderHandler methods in OnDelete - - // MinderHandler is already gone when that happens... - - // only delete socket when controlled - // ie master sockethandler can delete non-detached sockets - // and a slave sockethandler can only delete a detach socket - if (p -> DeleteByHandler() -#ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) -#endif - ) - { - p -> SetErasedByHandler(); - delete p; - } - m_sockets.erase(it); - } - else - { - m_sockets.erase(it); - } -DEB( fprintf(stderr, "next\n");) - } -DEB( fprintf(stderr, "/Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) - } -#ifdef ENABLE_RESOLVER - if (m_resolver) - { - delete m_resolver; - } -#endif - if (m_b_use_mutex) - { - m_mutex.Unlock(); - } -} - - -Mutex& SocketHandler::GetMutex() const -{ - return m_mutex; -} - - -#ifdef ENABLE_DETACH -void SocketHandler::SetSlave(bool x) -{ - m_slave = x; -} - - -bool SocketHandler::IsSlave() -{ - return m_slave; -} -#endif - - -void SocketHandler::RegStdLog(StdLog *log) -{ - m_stdlog = log; -} - - -void SocketHandler::LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t) -{ - if (m_stdlog) - { - m_stdlog -> error(this, p, user_text, err, sys_err, t); - } -} - - -void SocketHandler::Add(Socket *p) -{ - if (p -> GetSocket() == INVALID_SOCKET) - { - LogError(p, "Add", -1, "Invalid socket", LOG_LEVEL_WARNING); - if (p -> CloseAndDelete()) - { - m_delete.push_back(p); - } - return; - } - if (m_add.find(p -> GetSocket()) != m_add.end()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in add queue", LOG_LEVEL_FATAL); - m_delete.push_back(p); - return; - } - m_add[p -> GetSocket()] = p; -} - - -void SocketHandler::Get(SOCKET s,bool& r,bool& w,bool& e) -{ - if (s >= 0) - { - r = FD_ISSET(s, &m_rfds) ? true : false; - w = FD_ISSET(s, &m_wfds) ? true : false; - e = FD_ISSET(s, &m_efds) ? true : false; - } -} - - -void SocketHandler::Set(SOCKET s,bool bRead,bool bWrite,bool bException) -{ -DEB( fprintf(stderr, "Set(%d, %s, %s, %s)\n", s, bRead ? "true" : "false", bWrite ? "true" : "false", bException ? "true" : "false");) - if (s >= 0) - { - if (bRead) - { - if (!FD_ISSET(s, &m_rfds)) - { - FD_SET(s, &m_rfds); - } - } - else - { - FD_CLR(s, &m_rfds); - } - if (bWrite) - { - if (!FD_ISSET(s, &m_wfds)) - { - FD_SET(s, &m_wfds); - } - } - else - { - FD_CLR(s, &m_wfds); - } - if (bException) - { - if (!FD_ISSET(s, &m_efds)) - { - FD_SET(s, &m_efds); - } - } - else - { - FD_CLR(s, &m_efds); - } - } -} - - -int SocketHandler::Select(long sec,long usec) -{ - struct timeval tv; - tv.tv_sec = sec; - tv.tv_usec = usec; - return Select(&tv); -} - - -int SocketHandler::Select() -{ - if (!m_fds_callonconnect.empty() || -#ifdef ENABLE_DETACH - (!m_slave && !m_fds_detach.empty()) || -#endif - !m_fds_timeout.empty() || - !m_fds_retry.empty() || - !m_fds_close.empty() || - !m_fds_erase.empty()) - { - return Select(0, 200000); - } - return Select(NULL); -} - - -int SocketHandler::Select(struct timeval *tsel) -{ - size_t ignore = 0; - while (m_add.size() > ignore) - { - if (m_sockets.size() >= FD_SETSIZE) - { - LogError(NULL, "Select", (int)m_sockets.size(), "FD_SETSIZE reached", LOG_LEVEL_WARNING); - break; - } - socket_m::iterator it = m_add.begin(); - SOCKET s = it -> first; - Socket *p = it -> second; -DEB( fprintf(stderr, "Trying to add fd %d, m_add.size() %d, ignore %d\n", (int)s, (int)m_add.size(), (int)ignore);) - // - if (m_sockets.find(p -> GetSocket()) != m_sockets.end()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in controlled queue", LOG_LEVEL_FATAL); - // %! it's a dup, don't add to delete queue, just ignore it - m_delete.push_back(p); - m_add.erase(it); -// ignore++; - continue; - } - if (!p -> CloseAndDelete()) - { - StreamSocket *scp = dynamic_cast(p); - if (scp && scp -> Connecting()) // 'Open' called before adding socket - { - Set(s,false,true); - } - else - { - TcpSocket *tcp = dynamic_cast(p); - bool bWrite = tcp ? tcp -> GetOutputLength() != 0 : false; - if (p -> IsDisableRead()) - { - Set(s, false, bWrite); - } - else - { - Set(s, true, bWrite); - } - } - m_maxsock = (s > m_maxsock) ? s : m_maxsock; - } - else - { - LogError(p, "Add", (int)p -> GetSocket(), "Trying to add socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); - } - // only add to m_fds (process fd_set events) if - // slave handler and detached/detaching socket - // master handler and non-detached socket -#ifdef ENABLE_DETACH - if (!(m_slave ^ p -> IsDetach())) -#endif - { - m_fds.push_back(s); - } - m_sockets[s] = p; - // - m_add.erase(it); - } -#ifdef MACOSX - fd_set rfds; - fd_set wfds; - fd_set efds; - FD_COPY(&m_rfds, &rfds); - FD_COPY(&m_wfds, &wfds); - FD_COPY(&m_efds, &efds); -#else - fd_set rfds = m_rfds; - fd_set wfds = m_wfds; - fd_set efds = m_efds; -#endif - int n; - if (m_b_use_mutex) - { - m_mutex.Unlock(); - n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); - m_mutex.Lock(); - } - else - { - n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); - } - if (n == -1) - { - /* - EBADF An invalid file descriptor was given in one of the sets. - EINTR A non blocked signal was caught. - EINVAL n is negative. Or struct timeval contains bad time values (<0). - ENOMEM select was unable to allocate memory for internal tables. - */ - if (Errno != m_preverror || m_errcnt++ % 10000 == 0) - { - LogError(NULL, "select", Errno, StrError(Errno)); -DEB( fprintf(stderr, "m_maxsock: %d\n", m_maxsock); - fprintf(stderr, "%s\n", Errno == EINVAL ? "EINVAL" : - Errno == EINTR ? "EINTR" : - Errno == EBADF ? "EBADF" : - Errno == ENOMEM ? "ENOMEM" : ""); - // test bad fd - for (SOCKET i = 0; i <= m_maxsock; i++) - { - bool t = false; - FD_ZERO(&rfds); - FD_ZERO(&wfds); - FD_ZERO(&efds); - if (FD_ISSET(i, &m_rfds)) - { - FD_SET(i, &rfds); - t = true; - } - if (FD_ISSET(i, &m_wfds)) - { - FD_SET(i, &wfds); - t = true; - } - if (FD_ISSET(i, &m_efds)) - { - FD_SET(i, &efds); - t = true; - } - if (t && m_sockets.find(i) == m_sockets.end()) - { - fprintf(stderr, "Bad fd in fd_set: %d\n", i); - } - } -) // DEB - m_preverror = Errno; - } - /// \todo rebuild fd_set's from active sockets list (m_sockets) here - } - else - if (!n) - { - m_preverror = -1; - } - else - if (n > 0) - { - for (socket_v::iterator it2 = m_fds.begin(); it2 != m_fds.end() && n; it2++) - { - SOCKET i = *it2; - if (FD_ISSET(i, &rfds)) - { - socket_m::iterator itmp = m_sockets.find(i); - if (itmp != m_sockets.end()) // found - { - Socket *p = itmp -> second; - // new SSL negotiate method -#ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else -#endif - { - p -> OnRead(); - } - } - else - { - LogError(NULL, "GetSocket/handler/1", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - n--; - } - if (FD_ISSET(i, &wfds)) - { - socket_m::iterator itmp = m_sockets.find(i); - if (itmp != m_sockets.end()) // found - { - Socket *p = itmp -> second; - // new SSL negotiate method -#ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else -#endif - { - p -> OnWrite(); - } - } - else - { - LogError(NULL, "GetSocket/handler/2", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - n--; - } - if (FD_ISSET(i, &efds)) - { - socket_m::iterator itmp = m_sockets.find(i); - if (itmp != m_sockets.end()) // found - { - Socket *p = itmp -> second; - p -> OnException(); - } - else - { - LogError(NULL, "GetSocket/handler/3", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - n--; - } - } // m_fds loop - m_preverror = -1; - } // if (n > 0) - - // check CallOnConnect - EVENT - if (!m_fds_callonconnect.empty()) - { - socket_v tmp = m_fds_callonconnect; - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/4", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - if (p) - { -// if (p -> CallOnConnect() && p -> Ready() ) - { - p -> SetConnected(); // moved here from inside if (tcp) check below -#ifdef HAVE_OPENSSL - if (p -> IsSSL()) // SSL Enabled socket - p -> OnSSLConnect(); - else -#endif -#ifdef ENABLE_SOCKS4 - if (p -> Socks4()) - p -> OnSocks4Connect(); - else -#endif - { - TcpSocket *tcp = dynamic_cast(p); - if (tcp) - { - if (tcp -> GetOutputLength()) - { - p -> OnWrite(); - } - } -#ifdef ENABLE_RECONNECT - if (tcp && tcp -> IsReconnect()) - p -> OnReconnect(); - else -#endif - { -// LogError(p, "Calling OnConnect", 0, "Because CallOnConnect", LOG_LEVEL_INFO); - p -> OnConnect(); - } - } -// p -> SetCallOnConnect( false ); - AddList(p -> GetSocket(), LIST_CALLONCONNECT, false); - } - } - } - } -#ifdef ENABLE_DETACH - // check detach of socket if master handler - EVENT - if (!m_slave && !m_fds_detach.empty()) - { - // %! why not using tmp list here??!? - for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/5", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - if (p) - { -// if (p -> IsDetach()) - { - Set(p -> GetSocket(), false, false, false); - // After DetachSocket(), all calls to Handler() will return a reference - // to the new slave SocketHandler running in the new thread. - p -> DetachSocket(); - // Adding the file descriptor to m_fds_erase will now also remove the - // socket from the detach queue - tnx knightmad - m_fds_erase.push_back(p -> GetSocket()); - } - } - } - } -#endif - // check Connecting - connection timeout - conditional event - if (m_fds_timeout.size()) - { - time_t tnow = time(NULL); - if (tnow != m_tlast) - { - socket_v tmp = m_fds_timeout; -DEB( fprintf(stderr, "Checking %d socket(s) for timeout\n", tmp.size());) - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - itmp = m_add.find(*it); - if (itmp != m_add.end()) - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/6", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - } - if (p) - { - if (p -> Timeout(tnow)) - { - StreamSocket *scp = dynamic_cast(p); - if (scp && scp -> Connecting()) - p -> OnConnectTimeout(); - else - p -> OnTimeout(); - p -> SetTimeout(0); - } - } - } - m_tlast = tnow; - } // tnow != tlast - } - // check retry client connect - EVENT - if (!m_fds_retry.empty()) - { - socket_v tmp = m_fds_retry; - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/7", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - if (p) - { -// if (p -> RetryClientConnect()) - { - TcpSocket *tcp = dynamic_cast(p); - SOCKET nn = *it; //(*it3).first; - tcp -> SetRetryClientConnect(false); -DEB( fprintf(stderr, "Close() before retry client connect\n");) - p -> Close(); // removes from m_fds_retry - std::auto_ptr ad = p -> GetClientRemoteAddress(); - if (ad.get()) - { - tcp -> Open(*ad); - } - else - { - LogError(p, "RetryClientConnect", 0, "no address", LOG_LEVEL_ERROR); - } - Add(p); - m_fds_erase.push_back(nn); - } - } - } - } - // check close and delete - conditional event - if (!m_fds_close.empty()) - { - socket_v tmp = m_fds_close; -DEB( fprintf(stderr, "m_fds_close.size() == %d\n", (int)m_fds_close.size());) - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - itmp = m_add.find(*it); - if (itmp != m_add.end()) - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/8", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - } - if (p) - { -// if (p -> CloseAndDelete() ) - { - TcpSocket *tcp = dynamic_cast(p); - // new graceful tcp - flush and close timeout 5s - if (tcp && p -> IsConnected() && tcp -> GetFlushBeforeClose() && -#ifdef HAVE_OPENSSL - !tcp -> IsSSL() && -#endif - p -> TimeSinceClose() < 5) - { -DEB( fprintf(stderr, " close(1)\n");) - if (tcp -> GetOutputLength()) - { - LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Sending all data before closing", LOG_LEVEL_INFO); - } - else // shutdown write when output buffer is empty - if (!(tcp -> GetShutdown() & SHUT_WR)) - { - SOCKET nn = *it; - if (nn != INVALID_SOCKET && shutdown(nn, SHUT_WR) == -1) - { - LogError(p, "graceful shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - tcp -> SetShutdown(SHUT_WR); - } - } - else -#ifdef ENABLE_RECONNECT - if (tcp && p -> IsConnected() && tcp -> Reconnect()) - { - SOCKET nn = *it; //(*it3).first; -DEB( fprintf(stderr, " close(2) fd %d\n", nn);) - p -> SetCloseAndDelete(false); - tcp -> SetIsReconnect(); - p -> SetConnected(false); -DEB( fprintf(stderr, "Close() before reconnect\n");) - p -> Close(); // dispose of old file descriptor (Open creates a new) - p -> OnDisconnect(); - std::auto_ptr ad = p -> GetClientRemoteAddress(); - if (ad.get()) - { - tcp -> Open(*ad); - } - else - { - LogError(p, "Reconnect", 0, "no address", LOG_LEVEL_ERROR); - } - tcp -> ResetConnectionRetries(); - Add(p); - m_fds_erase.push_back(nn); - } - else -#endif - { - SOCKET nn = *it; //(*it3).first; -DEB( fprintf(stderr, " close(3) fd %d GetSocket() %d\n", nn, p -> GetSocket());) - if (tcp && p -> IsConnected() && tcp -> GetOutputLength()) - { - LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Closing socket while data still left to send", LOG_LEVEL_WARNING); - } -#ifdef ENABLE_POOL - if (p -> Retain() && !p -> Lost()) - { - PoolSocket *p2 = new PoolSocket(*this, p); - p2 -> SetDeleteByHandler(); - Add(p2); - // - p -> SetCloseAndDelete(false); // added - remove from m_fds_close - } - else -#endif // ENABLE_POOL - { - Set(p -> GetSocket(),false,false,false); -DEB( fprintf(stderr, "Close() before OnDelete\n");) - p -> Close(); - } - p -> OnDelete(); - if (p -> DeleteByHandler()) - { - p -> SetErasedByHandler(); - } - m_fds_erase.push_back(nn); - } - } - } - } - } - - // check erased sockets - bool check_max_fd = false; - while (!m_fds_erase.empty()) - { - socket_v::iterator it = m_fds_erase.begin(); - SOCKET nn = *it; -#ifdef ENABLE_DETACH - { - for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) - { - if (*it == nn) - { - m_fds_detach.erase(it); - break; - } - } - } -#endif - { - for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) - { - if (*it == nn) - { - m_fds.erase(it); - break; - } - } - } - { - socket_m::iterator it = m_sockets.find(nn); - if (it != m_sockets.end()) - { - Socket *p = it -> second; - /* Sometimes a SocketThread class can finish its run before the master - sockethandler gets here. In that case, the SocketThread has set the - 'ErasedByHandler' flag on the socket which will make us end up with a - double delete on the socket instance. - The fix is to make sure that the master sockethandler only can delete - non-detached sockets, and a slave sockethandler only can delete - detach sockets. */ - if (p -> ErasedByHandler() -#ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) -#endif - ) - { -#ifdef ENABLE_TRIGGERS - bool again = false; - do - { - again = false; - for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) - { - int id = it -> first; - Socket *src = it -> second; - if (src == p) - { - for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) - { - Socket *dst = it -> first; - if (Valid(dst)) - { - dst -> OnCancelled(id); - } - } - m_trigger_src.erase(m_trigger_src.find(id)); - m_trigger_dst.erase(m_trigger_dst.find(id)); - again = true; - break; - } - } - } while (again); -#endif - delete p; - } - m_sockets.erase(it); - } - } - m_fds_erase.erase(it); - check_max_fd = true; - } - // calculate max file descriptor for select() call - if (check_max_fd) - { - m_maxsock = 0; - for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) - { - SOCKET s = *it; - m_maxsock = s > m_maxsock ? s : m_maxsock; - } - } - // remove Add's that fizzed - while (!m_delete.empty()) - { - std::list::iterator it = m_delete.begin(); - Socket *p = *it; - p -> OnDelete(); - m_delete.erase(it); - if (p -> DeleteByHandler() -#ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) -#endif - ) - { - p -> SetErasedByHandler(); -#ifdef ENABLE_TRIGGERS - bool again = false; - do - { - again = false; - for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) - { - int id = it -> first; - Socket *src = it -> second; - if (src == p) - { - for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) - { - Socket *dst = it -> first; - if (Valid(dst)) - { - dst -> OnCancelled(id); - } - } - m_trigger_src.erase(m_trigger_src.find(id)); - m_trigger_dst.erase(m_trigger_dst.find(id)); - again = true; - break; - } - } - } while (again); -#endif - delete p; - } - } - return n; -} - - -#ifdef ENABLE_RESOLVER -bool SocketHandler::Resolving(Socket *p0) -{ - std::map::iterator it = m_resolve_q.find(p0); - return it != m_resolve_q.end(); -} -#endif - - -bool SocketHandler::Valid(Socket *p0) -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p0 == p) - return true; - } - return false; -} - - -bool SocketHandler::OkToAccept(Socket *) -{ - return true; -} - - -size_t SocketHandler::GetCount() -{ -/* -printf(" m_sockets : %d\n", m_sockets.size()); -printf(" m_add : %d\n", m_add.size()); -printf(" m_delete : %d\n", m_delete.size()); -*/ - return m_sockets.size() + m_add.size() + m_delete.size(); -} - - -#ifdef ENABLE_SOCKS4 -void SocketHandler::SetSocks4Host(ipaddr_t a) -{ - m_socks4_host = a; -} - - -void SocketHandler::SetSocks4Host(const std::string& host) -{ - Utility::u2ip(host, m_socks4_host); -} - - -void SocketHandler::SetSocks4Port(port_t port) -{ - m_socks4_port = port; -} - - -void SocketHandler::SetSocks4Userid(const std::string& id) -{ - m_socks4_userid = id; -} -#endif - - -#ifdef ENABLE_RESOLVER -int SocketHandler::Resolve(Socket *p,const std::string& host,port_t port) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, host, port); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; -DEB( fprintf(stderr, " *** Resolve '%s:%d' id#%d m_resolve_q size: %d p: %p\n", host.c_str(), port, resolv -> GetId(), m_resolve_q.size(), p);) - return resolv -> GetId(); -} - - -#ifdef ENABLE_IPV6 -int SocketHandler::Resolve6(Socket *p,const std::string& host,port_t port) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, host, port, true); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; - return resolv -> GetId(); -} -#endif - - -int SocketHandler::Resolve(Socket *p,ipaddr_t a) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, a); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; - return resolv -> GetId(); -} - - -#ifdef ENABLE_IPV6 -int SocketHandler::Resolve(Socket *p,in6_addr& a) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, a); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; - return resolv -> GetId(); -} -#endif - - -void SocketHandler::EnableResolver(port_t port) -{ - if (!m_resolver) - { - m_resolver_port = port; - m_resolver = new ResolvServer(port); - } -} - - -bool SocketHandler::ResolverReady() -{ - return m_resolver ? m_resolver -> Ready() : false; -} -#endif // ENABLE_RESOLVER - - -#ifdef ENABLE_SOCKS4 -void SocketHandler::SetSocks4TryDirect(bool x) -{ - m_bTryDirect = x; -} - - -ipaddr_t SocketHandler::GetSocks4Host() -{ - return m_socks4_host; -} - - -port_t SocketHandler::GetSocks4Port() -{ - return m_socks4_port; -} - - -const std::string& SocketHandler::GetSocks4Userid() -{ - return m_socks4_userid; -} - - -bool SocketHandler::Socks4TryDirect() -{ - return m_bTryDirect; -} -#endif - - -#ifdef ENABLE_RESOLVER -bool SocketHandler::ResolverEnabled() -{ - return m_resolver ? true : false; -} - - -port_t SocketHandler::GetResolverPort() -{ - return m_resolver_port; -} -#endif // ENABLE_RESOLVER - - -#ifdef ENABLE_POOL -ISocketHandler::PoolSocket *SocketHandler::FindConnection(int type,const std::string& protocol,SocketAddress& ad) -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end() && !m_sockets.empty(); it++) - { - PoolSocket *pools = dynamic_cast(it -> second); - if (pools) - { - if (pools -> GetSocketType() == type && - pools -> GetSocketProtocol() == protocol && -// %! pools -> GetClientRemoteAddress() && - *pools -> GetClientRemoteAddress() == ad) - { - m_sockets.erase(it); - pools -> SetRetain(); // avoid Close in Socket destructor - return pools; // Caller is responsible that this socket is deleted - } - } - } - return NULL; -} - - -void SocketHandler::EnablePool(bool x) -{ - m_b_enable_pool = x; -} - - -bool SocketHandler::PoolEnabled() -{ - return m_b_enable_pool; -} -#endif - - -void SocketHandler::Remove(Socket *p) -{ -#ifdef ENABLE_RESOLVER - std::map::iterator it4 = m_resolve_q.find(p); - if (it4 != m_resolve_q.end()) - m_resolve_q.erase(it4); -#endif - if (p -> ErasedByHandler()) - { - return; - } - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - if (it -> second == p) - { - LogError(p, "Remove", -1, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_sockets.erase(it); - return; - } - } - for (socket_m::iterator it2 = m_add.begin(); it2 != m_add.end(); it2++) - { - if ((*it2).second == p) - { - LogError(p, "Remove", -2, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_add.erase(it2); - return; - } - } - for (std::list::iterator it3 = m_delete.begin(); it3 != m_delete.end(); it3++) - { - if (*it3 == p) - { - LogError(p, "Remove", -3, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_delete.erase(it3); - return; - } - } -} - - -void SocketHandler::CheckSanity() -{ - CheckList(m_fds, "active sockets"); // active sockets - CheckList(m_fds_erase, "sockets to be erased"); // should always be empty anyway - CheckList(m_fds_callonconnect, "checklist CallOnConnect"); -#ifdef ENABLE_DETACH - CheckList(m_fds_detach, "checklist Detach"); -#endif - CheckList(m_fds_timeout, "checklist Timeout"); - CheckList(m_fds_retry, "checklist retry client connect"); - CheckList(m_fds_close, "checklist close and delete"); -} - - -void SocketHandler::CheckList(socket_v& ref,const std::string& listname) -{ - for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) - { - SOCKET s = *it; - if (m_sockets.find(s) != m_sockets.end()) - continue; - if (m_add.find(s) != m_add.end()) - continue; - bool found = false; - for (std::list::iterator it = m_delete.begin(); it != m_delete.end(); it++) - { - Socket *p = *it; - if (p -> GetSocket() == s) - { - found = true; - break; - } - } - if (!found) - { - fprintf(stderr, "CheckList failed for \"%s\": fd %d\n", listname.c_str(), s); - } - } -} - - -void SocketHandler::AddList(SOCKET s,list_t which_one,bool add) -{ - if (s == INVALID_SOCKET) - { -DEB( fprintf(stderr, "AddList: invalid_socket\n");) - return; - } - socket_v& ref = - (which_one == LIST_CALLONCONNECT) ? m_fds_callonconnect : -#ifdef ENABLE_DETACH - (which_one == LIST_DETACH) ? m_fds_detach : -#endif - (which_one == LIST_TIMEOUT) ? m_fds_timeout : - (which_one == LIST_RETRY) ? m_fds_retry : - (which_one == LIST_CLOSE) ? m_fds_close : m_fds_close; - if (add) - { -#ifdef ENABLE_DETACH -DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : - (which_one == LIST_DETACH) ? "Detach" : - (which_one == LIST_TIMEOUT) ? "Timeout" : - (which_one == LIST_RETRY) ? "Retry" : - (which_one == LIST_CLOSE) ? "Close" : "", - add ? "Add" : "Remove");) -#else -DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : - (which_one == LIST_TIMEOUT) ? "Timeout" : - (which_one == LIST_RETRY) ? "Retry" : - (which_one == LIST_CLOSE) ? "Close" : "", - add ? "Add" : "Remove");) -#endif - } - if (add) - { - for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) - { - if (*it == s) // already there - { - return; - } - } - ref.push_back(s); - return; - } - // remove - for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) - { - if (*it == s) - { - ref.erase(it); - break; - } - } -//DEB( fprintf(stderr, "/AddList\n");) -} - - -#ifdef ENABLE_TRIGGERS -int SocketHandler::TriggerID(Socket *src) -{ - int id = m_next_trigger_id++; - m_trigger_src[id] = src; - return id; -} - - -bool SocketHandler::Subscribe(int id, Socket *dst) -{ - if (m_trigger_src.find(id) != m_trigger_src.end()) - { - std::map::iterator it = m_trigger_dst[id].find(dst); - if (it != m_trigger_dst[id].end()) - { - m_trigger_dst[id][dst] = true; - return true; - } - LogError(dst, "Subscribe", id, "Already subscribed", LOG_LEVEL_INFO); - return false; - } - LogError(dst, "Subscribe", id, "Trigger id not found", LOG_LEVEL_INFO); - return false; -} - - -bool SocketHandler::Unsubscribe(int id, Socket *dst) -{ - if (m_trigger_src.find(id) != m_trigger_src.end()) - { - std::map::iterator it = m_trigger_dst[id].find(dst); - if (it != m_trigger_dst[id].end()) - { - m_trigger_dst[id].erase(it); - return true; - } - LogError(dst, "Unsubscribe", id, "Not subscribed", LOG_LEVEL_INFO); - return false; - } - LogError(dst, "Unsubscribe", id, "Trigger id not found", LOG_LEVEL_INFO); - return false; -} - - -void SocketHandler::Trigger(int id, Socket::TriggerData& data, bool erase) -{ - if (m_trigger_src.find(id) != m_trigger_src.end()) - { - data.SetSource( m_trigger_src[id] ); - for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) - { - Socket *dst = it -> first; - if (Valid(dst)) - { - dst -> OnTrigger(id, data); - } - } - if (erase) - { - m_trigger_src.erase(m_trigger_src.find(id)); - m_trigger_dst.erase(m_trigger_dst.find(id)); - } - } - else - { - LogError(NULL, "Trigger", id, "Trigger id not found", LOG_LEVEL_INFO); - } -} -#endif // ENABLE_TRIGGERS - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/dep/src/sockets/StdoutLog.cpp b/dep/src/sockets/StdoutLog.cpp deleted file mode 100644 index f9251c326..000000000 --- a/dep/src/sockets/StdoutLog.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/** \file StdoutLog.cpp - ** \date 2004-06-01 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include - -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "ISocketHandler.h" -#include "Socket.h" -#include "StdoutLog.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - - -void StdoutLog::error(ISocketHandler *,Socket *sock,const std::string& call,int err,const std::string& sys_err,loglevel_t lvl) -{ - time_t t = time(NULL); - struct tm tp; -#ifdef _WIN32 - memcpy(&tp, localtime(&t), sizeof(tp)); -#else - localtime_r(&t, &tp); -#endif - std::string level; - - switch (lvl) - { - case LOG_LEVEL_WARNING: - level = "Warning"; - break; - case LOG_LEVEL_ERROR: - level = "Error"; - break; - case LOG_LEVEL_FATAL: - level = "Fatal"; - break; - case LOG_LEVEL_INFO: - level = "Info"; - break; - } - if (sock) - { - printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n", - tp.tm_year + 1900, - tp.tm_mon + 1, - tp.tm_mday, - tp.tm_hour,tp.tm_min,tp.tm_sec, - sock -> GetSocket(), - call.c_str(),err,sys_err.c_str(),level.c_str()); - } - else - { - printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n", - tp.tm_year + 1900, - tp.tm_mon + 1, - tp.tm_mday, - tp.tm_hour,tp.tm_min,tp.tm_sec, - call.c_str(),err,sys_err.c_str(),level.c_str()); - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/dep/src/sockets/StreamSocket.cpp b/dep/src/sockets/StreamSocket.cpp deleted file mode 100644 index 5c5780e30..000000000 --- a/dep/src/sockets/StreamSocket.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "StreamSocket.h" -#include "ISocketHandler.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -StreamSocket::StreamSocket(ISocketHandler& h) : Socket(h) -,m_bConnecting(false) -,m_connect_timeout(5) -,m_flush_before_close(true) -,m_connection_retry(0) -,m_retries(0) -,m_call_on_connect(false) -,m_b_retry_connect(false) -,m_line_protocol(false) -,m_shutdown(0) -{ -} - - -StreamSocket::~StreamSocket() -{ -} - - -void StreamSocket::SetConnecting(bool x) -{ - if (x != m_bConnecting) - { - m_bConnecting = x; - if (x) - { - SetTimeout( GetConnectTimeout() ); - } - else - { - SetTimeout( 0 ); - } - } -} - - -bool StreamSocket::Connecting() -{ - return m_bConnecting; -} - - -bool StreamSocket::Ready() -{ - if (GetSocket() != INVALID_SOCKET && !Connecting() && !CloseAndDelete()) - return true; - return false; -} - - -void StreamSocket::SetConnectTimeout(int x) -{ - m_connect_timeout = x; -} - - -int StreamSocket::GetConnectTimeout() -{ - return m_connect_timeout; -} - - -void StreamSocket::SetFlushBeforeClose(bool x) -{ - m_flush_before_close = x; -} - - -bool StreamSocket::GetFlushBeforeClose() -{ - return m_flush_before_close; -} - - -int StreamSocket::GetConnectionRetry() -{ - return m_connection_retry; -} - - -void StreamSocket::SetConnectionRetry(int x) -{ - m_connection_retry = x; -} - - -int StreamSocket::GetConnectionRetries() -{ - return m_retries; -} - - -void StreamSocket::IncreaseConnectionRetries() -{ - m_retries++; -} - - -void StreamSocket::ResetConnectionRetries() -{ - m_retries = 0; -} - - -void StreamSocket::SetCallOnConnect(bool x) -{ - Handler().AddList(GetSocket(), LIST_CALLONCONNECT, x); - m_call_on_connect = x; -} - - -bool StreamSocket::CallOnConnect() -{ - return m_call_on_connect; -} - - -void StreamSocket::SetRetryClientConnect(bool x) -{ - Handler().AddList(GetSocket(), LIST_RETRY, x); - m_b_retry_connect = x; -} - - -bool StreamSocket::RetryClientConnect() -{ - return m_b_retry_connect; -} - - -void StreamSocket::SetLineProtocol(bool x) -{ - m_line_protocol = x; -} - - -bool StreamSocket::LineProtocol() -{ - return m_line_protocol; -} - - -void StreamSocket::SetShutdown(int x) -{ - m_shutdown = x; -} - - -int StreamSocket::GetShutdown() -{ - return m_shutdown; -} - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/dep/src/sockets/TcpSocket.cpp b/dep/src/sockets/TcpSocket.cpp deleted file mode 100644 index 64bb1009e..000000000 --- a/dep/src/sockets/TcpSocket.cpp +++ /dev/null @@ -1,1746 +0,0 @@ -/** \file TcpSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include -#else -#include -#endif -#include "ISocketHandler.h" -#include -#include -#include -#include -#ifdef HAVE_OPENSSL -#include -#include -#endif -#include - -#include "TcpSocket.h" -#include "Utility.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#include "Mutex.h" -#include "IFile.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -//#ifdef _DEBUG -//#define DEB(x) x -//#else -#define DEB(x) -//#endif - - -// statics -#ifdef HAVE_OPENSSL -SSLInitializer TcpSocket::m_ssl_init; -#endif - - -// thanks, q -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif -TcpSocket::TcpSocket(ISocketHandler& h) : StreamSocket(h) -,ibuf(TCP_BUFSIZE_READ) -,m_b_input_buffer_disabled(false) -,m_bytes_sent(0) -,m_bytes_received(0) -,m_skip_c(false) -#ifdef SOCKETS_DYNAMIC_TEMP -,m_buf(new char[TCP_BUFSIZE_READ + 1]) -#endif -,m_obuf_top(NULL) -,m_transfer_limit(0) -,m_output_length(0) -#ifdef HAVE_OPENSSL -,m_ssl_ctx(NULL) -,m_ssl(NULL) -,m_sbio(NULL) -#endif -#ifdef ENABLE_SOCKS4 -,m_socks4_state(0) -#endif -#ifdef ENABLE_RESOLVER -,m_resolver_id(0) -#endif -#ifdef ENABLE_RECONNECT -,m_b_reconnect(false) -,m_b_is_reconnect(false) -#endif -{ -} -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif -TcpSocket::TcpSocket(ISocketHandler& h,size_t isize,size_t osize) : StreamSocket(h) -,ibuf(isize) -,m_b_input_buffer_disabled(false) -,m_bytes_sent(0) -,m_bytes_received(0) -,m_skip_c(false) -#ifdef SOCKETS_DYNAMIC_TEMP -,m_buf(new char[TCP_BUFSIZE_READ + 1]) -#endif -,m_obuf_top(NULL) -,m_transfer_limit(0) -,m_output_length(0) -#ifdef HAVE_OPENSSL -,m_ssl_ctx(NULL) -,m_ssl(NULL) -,m_sbio(NULL) -#endif -#ifdef ENABLE_SOCKS4 -,m_socks4_state(0) -#endif -#ifdef ENABLE_RESOLVER -,m_resolver_id(0) -#endif -#ifdef ENABLE_RECONNECT -,m_b_reconnect(false) -,m_b_is_reconnect(false) -#endif -{ -} -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - - -TcpSocket::~TcpSocket() -{ -#ifdef SOCKETS_DYNAMIC_TEMP - delete[] m_buf; -#endif - // %! empty m_obuf - while (m_obuf.size()) - { - output_l::iterator it = m_obuf.begin(); - OUTPUT *p = *it; - delete p; - m_obuf.erase(it); - } -#ifdef HAVE_OPENSSL - if (m_ssl) - { - SSL_free(m_ssl); - } -#endif -} - - -bool TcpSocket::Open(ipaddr_t ip,port_t port,bool skip_socks) -{ - Ipv4Address ad(ip, port); - Ipv4Address local; - return Open(ad, local, skip_socks); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -bool TcpSocket::Open(in6_addr ip,port_t port,bool skip_socks) -{ - Ipv6Address ad(ip, port); - return Open(ad, skip_socks); -} -#endif -#endif - - -bool TcpSocket::Open(SocketAddress& ad,bool skip_socks) -{ - Ipv4Address bind_ad("0.0.0.0", 0); - return Open(ad, bind_ad, skip_socks); -} - - -bool TcpSocket::Open(SocketAddress& ad,SocketAddress& bind_ad,bool skip_socks) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "Open", 0, "Invalid SocketAddress", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - if (Handler().GetCount() >= FD_SETSIZE) - { - Handler().LogError(this, "Open", 0, "no space left in fd_set", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - SetConnecting(false); -#ifdef ENABLE_SOCKS4 - SetSocks4(false); -#endif - // check for pooling -#ifdef ENABLE_POOL - if (Handler().PoolEnabled()) - { - ISocketHandler::PoolSocket *pools = Handler().FindConnection(SOCK_STREAM, "tcp", ad); - if (pools) - { - CopyConnection( pools ); - delete pools; - - SetIsClient(); - SetCallOnConnect(); // ISocketHandler must call OnConnect - Handler().LogError(this, "SetCallOnConnect", 0, "Found pooled connection", LOG_LEVEL_INFO); - return true; - } - } -#endif - // if not, create new connection - SOCKET s = CreateSocket(ad.GetFamily(), SOCK_STREAM, "tcp"); - if (s == INVALID_SOCKET) - { - return false; - } - // socket must be nonblocking for async connect - if (!SetNonblocking(true, s)) - { - SetCloseAndDelete(); - closesocket(s); - return false; - } -#ifdef ENABLE_POOL - SetIsClient(); // client because we connect -#endif - SetClientRemoteAddress(ad); - int n = 0; - if (bind_ad.GetPort() != 0) - { - bind(s, bind_ad, bind_ad); - } -#ifdef ENABLE_SOCKS4 - if (!skip_socks && GetSocks4Host() && GetSocks4Port()) - { - Ipv4Address sa(GetSocks4Host(), GetSocks4Port()); - { - std::string sockshost; - Utility::l2ip(GetSocks4Host(), sockshost); - Handler().LogError(this, "Open", 0, "Connecting to socks4 server @ " + sockshost + ":" + - Utility::l2string(GetSocks4Port()), LOG_LEVEL_INFO); - } - SetSocks4(); - n = connect(s, sa, sa); - SetRemoteAddress(sa); - } - else -#endif - { - n = connect(s, ad, ad); - SetRemoteAddress(ad); - } - if (n == -1) - { - // check error code that means a connect is in progress -#ifdef _WIN32 - if (Errno == WSAEWOULDBLOCK) -#else - if (Errno == EINPROGRESS) -#endif - { - Attach(s); - SetConnecting( true ); // this flag will control fd_set's - } - else -#ifdef ENABLE_SOCKS4 - if (Socks4() && Handler().Socks4TryDirect() ) // retry - { - closesocket(s); - return Open(ad, true); - } - else -#endif -#ifdef ENABLE_RECONNECT - if (Reconnect()) - { - Handler().LogError(this, "connect: failed, reconnect pending", Errno, StrError(Errno), LOG_LEVEL_INFO); - Attach(s); - SetConnecting( true ); // this flag will control fd_set's - } - else -#endif - { - Handler().LogError(this, "connect: failed", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - closesocket(s); - return false; - } - } - else - { - Attach(s); - SetCallOnConnect(); // ISocketHandler must call OnConnect - } - - // 'true' means connected or connecting(not yet connected) - // 'false' means something failed - return true; //!Connecting(); -} - - -bool TcpSocket::Open(const std::string &host,port_t port) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { -#ifdef ENABLE_RESOLVER - if (!Handler().ResolverEnabled() || Utility::isipv6(host) ) - { -#endif - in6_addr a; - if (!Utility::u2ip(host, a)) - { - SetCloseAndDelete(); - return false; - } - Ipv6Address ad(a, port); - Ipv6Address local; - return Open(ad, local); -#ifdef ENABLE_RESOLVER - } - m_resolver_id = Resolve6(host, port); - return true; -#endif - } -#endif -#endif -#ifdef ENABLE_RESOLVER - if (!Handler().ResolverEnabled() || Utility::isipv4(host) ) - { -#endif - ipaddr_t l; - if (!Utility::u2ip(host,l)) - { - SetCloseAndDelete(); - return false; - } - Ipv4Address ad(l, port); - Ipv4Address local; - return Open(ad, local); -#ifdef ENABLE_RESOLVER - } - // resolve using async resolver thread - m_resolver_id = Resolve(host, port); - return true; -#endif -} - - -#ifdef ENABLE_RESOLVER -void TcpSocket::OnResolved(int id,ipaddr_t a,port_t port) -{ -DEB( fprintf(stderr, "TcpSocket::OnResolved id %d addr %x port %d\n", id, a, port);) - if (id == m_resolver_id) - { - if (a && port) - { - Ipv4Address ad(a, port); - Ipv4Address local; - if (Open(ad, local)) - { - if (!Handler().Valid(this)) - { - Handler().Add(this); - } - } - } - else - { - Handler().LogError(this, "OnResolved", 0, "Resolver failed", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } - else - { - Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } -} - - -#ifdef ENABLE_IPV6 -void TcpSocket::OnResolved(int id,in6_addr& a,port_t port) -{ - if (id == m_resolver_id) - { - Ipv6Address ad(a, port); - if (ad.IsValid()) - { - Ipv6Address local; - if (Open(ad, local)) - { - if (!Handler().Valid(this)) - { - Handler().Add(this); - } - } - } - } - else - { - Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } -} -#endif -#endif - - -void TcpSocket::OnRead() -{ - int n = 0; -#ifdef SOCKETS_DYNAMIC_TEMP - char *buf = m_buf; -#else - char buf[TCP_BUFSIZE_READ]; -#endif -#ifdef HAVE_OPENSSL - if (IsSSL()) - { - if (!Ready()) - return; - n = SSL_read(m_ssl, buf, TCP_BUFSIZE_READ); - if (n == -1) - { - n = SSL_get_error(m_ssl, n); - switch (n) - { - case SSL_ERROR_NONE: - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - break; - case SSL_ERROR_ZERO_RETURN: -DEB( fprintf(stderr, "SSL_read() returns zero - closing socket\n");) - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - break; - default: -DEB( fprintf(stderr, "SSL read problem, errcode = %d\n",n);) - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - return; - } - else - if (!n) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - SetShutdown(SHUT_WR); - return; - } - else - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - m_bytes_received += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) - { - Handler().LogError(this, "OnRead(ssl)", 0, "ibuf overflow", LOG_LEVEL_WARNING); - } - } - else - { - Handler().LogError(this, "OnRead(ssl)", n, "abnormal value from SSL_read", LOG_LEVEL_ERROR); - } - } - else -#endif // HAVE_OPENSSL - { - n = recv(GetSocket(), buf, TCP_BUFSIZE_READ, MSG_NOSIGNAL); - if (n == -1) - { - Handler().LogError(this, "read", Errno, StrError(Errno), LOG_LEVEL_FATAL); - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - return; - } - else - if (!n) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - SetShutdown(SHUT_WR); - return; - } - else - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - m_bytes_received += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) - { - Handler().LogError(this, "OnRead", 0, "ibuf overflow", LOG_LEVEL_WARNING); - } - } - else - { - Handler().LogError(this, "OnRead", n, "abnormal value from recv", LOG_LEVEL_ERROR); - } - } - // - OnRead( buf, n ); -} - - -void TcpSocket::OnRead( char *buf, size_t n ) -{ - // unbuffered - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - if (LineProtocol()) - { - buf[n] = 0; - size_t i = 0; - if (m_skip_c && (buf[i] == 13 || buf[i] == 10) && buf[i] != m_c) - { - m_skip_c = false; - i++; - } - size_t x = i; - for (; i < n && LineProtocol(); i++) - { - while ((buf[i] == 13 || buf[i] == 10) && LineProtocol()) - { - char c = buf[i]; - buf[i] = 0; - if (buf[x]) - { - m_line += (buf + x); - } - OnLine( m_line ); - i++; - m_skip_c = true; - m_c = c; - if (i < n && (buf[i] == 13 || buf[i] == 10) && buf[i] != c) - { - m_skip_c = false; - i++; - } - x = i; - m_line = ""; - } - if (!LineProtocol()) - { - break; - } - } - if (!LineProtocol()) - { - if (i < n) - { - OnRawData(buf + i, n - i); - } - } - else - if (buf[x]) - { - m_line += (buf + x); - } - } - else - { - OnRawData(buf, n); - } - } - if (m_b_input_buffer_disabled) - { - return; - } - // further processing: socks4 -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - bool need_more = false; - while (GetInputLength() && !need_more && !CloseAndDelete()) - { - need_more = OnSocks4Read(); - } - } -#endif -} - - -void TcpSocket::OnWriteComplete() -{ -} - - -void TcpSocket::OnWrite() -{ - if (Connecting()) - { - int err = SoError(); - - // don't reset connecting flag on error here, we want the OnConnectFailed timeout later on - if (!err) // ok - { - Set(!IsDisableRead(), false); - SetConnecting(false); - SetCallOnConnect(); - return; - } - Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); - Set(false, false); // no more monitoring because connection failed - - // failed -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - // %! leave 'Connecting' flag set? - OnSocks4ConnectFailed(); - return; - } -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - // even though the connection failed at once, only retry after - // the connection timeout. - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - return; - } - SetConnecting(false); - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - return; - } - // try send next block in buffer - // if full block is sent, repeat - // if all blocks are sent, reset m_wfds - - bool repeat = false; - size_t sz = m_transfer_limit ? GetOutputLength() : 0; - do - { - output_l::iterator it = m_obuf.begin(); - OUTPUT *p = *it; - repeat = false; - int n = TryWrite(p -> Buf(), p -> Len()); - if (n > 0) - { - size_t left = p -> Remove(n); - m_output_length -= n; - if (!left) - { - delete p; - m_obuf.erase(it); - if (!m_obuf.size()) - { - m_obuf_top = NULL; - OnWriteComplete(); - } - else - { - repeat = true; - } - } - } - } while (repeat); - - if (m_transfer_limit && sz > m_transfer_limit && GetOutputLength() < m_transfer_limit) - { - OnTransferLimit(); - } - - // check output buffer set, set/reset m_wfds accordingly - { - bool br; - bool bw; - bool bx; - Handler().Get(GetSocket(), br, bw, bx); - if (m_obuf.size()) - Set(br, true); - else - Set(br, false); - } -} - - -int TcpSocket::TryWrite(const char *buf, size_t len) -{ - int n = 0; -#ifdef HAVE_OPENSSL - if (IsSSL()) - { - n = SSL_write(m_ssl, buf, (int)len); - if (n == -1) - { - int errnr = SSL_get_error(m_ssl, n); - if ( errnr != SSL_ERROR_WANT_READ && errnr != SSL_ERROR_WANT_WRITE ) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - const char *errbuf = ERR_error_string(errnr, NULL); - Handler().LogError(this, "OnWrite/SSL_write", errnr, errbuf, LOG_LEVEL_FATAL); - } - return 0; - } - else - if (!n) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); -DEB( int errnr = SSL_get_error(m_ssl, n); - const char *errbuf = ERR_error_string(errnr, NULL); - fprintf(stderr, "SSL_write() returns 0: %d : %s\n",errnr, errbuf);) - } - } - else -#endif // HAVE_OPENSSL - { - n = send(GetSocket(), buf, (int)len, MSG_NOSIGNAL); - if (n == -1) - { - // normal error codes: - // WSAEWOULDBLOCK - // EAGAIN or EWOULDBLOCK -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - { - Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_FATAL); - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - return 0; - } - } - if (n > 0) - { - m_bytes_sent += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - } - return n; -} - - -void TcpSocket::Buffer(const char *buf, size_t len) -{ - size_t ptr = 0; - m_output_length += len; - while (ptr < len) - { - // buf/len => pbuf/sz - size_t space = 0; - if (m_obuf_top && (space = m_obuf_top -> Space()) > 0) - { - const char *pbuf = buf + ptr; - size_t sz = len - ptr; - if (space >= sz) - { - m_obuf_top -> Add(pbuf, sz); - ptr += sz; - } - else - { - m_obuf_top -> Add(pbuf, space); - ptr += space; - } - } - else - { - m_obuf_top = new OUTPUT; - m_obuf.push_back( m_obuf_top ); - } - } -} - - -void TcpSocket::Send(const std::string &str,int i) -{ - SendBuf(str.c_str(),str.size(),i); -} - - -void TcpSocket::SendBuf(const char *buf,size_t len,int) -{ - if (!Ready() && !Connecting()) - { - Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-ready socket" ); // warning - if (GetSocket() == INVALID_SOCKET) - Handler().LogError(this, "SendBuf", 0, " * GetSocket() == INVALID_SOCKET", LOG_LEVEL_INFO); - if (Connecting()) - Handler().LogError(this, "SendBuf", 0, " * Connecting()", LOG_LEVEL_INFO); - if (CloseAndDelete()) - Handler().LogError(this, "SendBuf", 0, " * CloseAndDelete()", LOG_LEVEL_INFO); - return; - } - if (!IsConnected()) - { - Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-connected socket, will be sent on connect" ); // warning - Buffer(buf, len); - return; - } - if (m_obuf_top) - { - Buffer(buf, len); - return; - } - int n = TryWrite(buf, len); - if (n >= 0 && n < (int)len) - { - Buffer(buf + n, len - n); - } - // if ( data in buffer || !IsConnected ) - // { - // add to buffer - // } - // else - // try_send - // if any data is unsent, buffer it and set m_wfds - - // check output buffer set, set/reset m_wfds accordingly - { - bool br; - bool bw; - bool bx; - Handler().Get(GetSocket(), br, bw, bx); - if (m_obuf.size()) - Set(br, true); - else - Set(br, false); - } -} - - -void TcpSocket::OnLine(const std::string& ) -{ -} - - -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif -TcpSocket::TcpSocket(const TcpSocket& s) -:StreamSocket(s) -,ibuf(0) -{ -} -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - - -#ifdef ENABLE_SOCKS4 -void TcpSocket::OnSocks4Connect() -{ - char request[1000]; - memset(request, 0, sizeof(request)); - request[0] = 4; // socks v4 - request[1] = 1; // command code: CONNECT - { - std::auto_ptr ad = GetClientRemoteAddress(); - if (ad.get()) - { - struct sockaddr *p0 = (struct sockaddr *)*ad; - struct sockaddr_in *p = (struct sockaddr_in *)p0; - if (p -> sin_family == AF_INET) - { - memcpy(request + 2, &p -> sin_port, 2); // nwbo is ok here - memcpy(request + 4, &p -> sin_addr, sizeof(struct in_addr)); - } - else - { - /// \todo warn - } - } - else - { - /// \todo warn - } - } - strcpy(request + 8, GetSocks4Userid().c_str()); - size_t length = GetSocks4Userid().size() + 8 + 1; - SendBuf(request, length); - m_socks4_state = 0; -} - - -void TcpSocket::OnSocks4ConnectFailed() -{ - Handler().LogError(this,"OnSocks4ConnectFailed",0,"connection to socks4 server failed, trying direct connection",LOG_LEVEL_WARNING); - if (!Handler().Socks4TryDirect()) - { - SetConnecting(false); - SetCloseAndDelete(); - OnConnectFailed(); // just in case - } - else - { - SetRetryClientConnect(); - } -} - - -bool TcpSocket::OnSocks4Read() -{ - switch (m_socks4_state) - { - case 0: - ibuf.Read(&m_socks4_vn, 1); - m_socks4_state = 1; - break; - case 1: - ibuf.Read(&m_socks4_cd, 1); - m_socks4_state = 2; - break; - case 2: - if (GetInputLength() > 1) - { - ibuf.Read( (char *)&m_socks4_dstport, 2); - m_socks4_state = 3; - } - else - { - return true; - } - break; - case 3: - if (GetInputLength() > 3) - { - ibuf.Read( (char *)&m_socks4_dstip, 4); - SetSocks4(false); - - switch (m_socks4_cd) - { - case 90: - OnConnect(); - Handler().LogError(this, "OnSocks4Read", 0, "Connection established", LOG_LEVEL_INFO); - break; - case 91: - case 92: - case 93: - Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server reports connect failed",LOG_LEVEL_FATAL); - SetConnecting(false); - SetCloseAndDelete(); - OnConnectFailed(); - break; - default: - Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server unrecognized response",LOG_LEVEL_FATAL); - SetCloseAndDelete(); - break; - } - } - else - { - return true; - } - break; - } - return false; -} -#endif - - -void TcpSocket::Sendf(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - char slask[5000]; // vsprintf / vsnprintf temporary -#ifdef _WIN32 - vsprintf(slask, format, ap); -#else - vsnprintf(slask, 5000, format, ap); -#endif - va_end(ap); - Send( slask ); -} - - -#ifdef HAVE_OPENSSL -void TcpSocket::OnSSLConnect() -{ - SetNonblocking(true); - { - if (m_ssl_ctx) - { -DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) - SetCloseAndDelete(true); - return; - } - InitSSLClient(); - } - if (m_ssl_ctx) - { - /* Connect the SSL socket */ - m_ssl = SSL_new(m_ssl_ctx); - if (!m_ssl) - { -DEB( fprintf(stderr, " m_ssl is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); - m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); - if (!m_sbio) - { -DEB( fprintf(stderr, " m_sbio is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_bio(m_ssl, m_sbio, m_sbio); - if (!SSLNegotiate()) - { - SetSSLNegotiate(); - } - } - else - { - SetCloseAndDelete(); - } -} - - -void TcpSocket::OnSSLAccept() -{ - SetNonblocking(true); - { - if (m_ssl_ctx) - { -DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) - SetCloseAndDelete(true); - return; - } - InitSSLServer(); - SetSSLServer(); - } - if (m_ssl_ctx) - { - m_ssl = SSL_new(m_ssl_ctx); - if (!m_ssl) - { -DEB( fprintf(stderr, " m_ssl is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); - m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); - if (!m_sbio) - { -DEB( fprintf(stderr, " m_sbio is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_bio(m_ssl, m_sbio, m_sbio); -// if (!SSLNegotiate()) - { - SetSSLNegotiate(); - } - } -} - - -bool TcpSocket::SSLNegotiate() -{ - if (!IsSSLServer()) // client - { - int r = SSL_connect(m_ssl); - if (r > 0) - { - SetSSLNegotiate(false); - /// \todo: resurrect certificate check... client -// CheckCertificateChain( "");//ServerHOST); - SetNonblocking(false); - // - { - SetConnected(); - if (GetOutputLength()) - { - OnWrite(); - } - } -#ifdef ENABLE_RECONNECT - if (IsReconnect()) - OnReconnect(); - else -#endif - { - OnConnect(); - } - Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection established", LOG_LEVEL_INFO); - return true; - } - else - if (!r) - { - Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection failed", LOG_LEVEL_INFO); - SetSSLNegotiate(false); - SetCloseAndDelete(); - OnSSLConnectFailed(); - } - else - { - r = SSL_get_error(m_ssl, r); - if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) - { - Handler().LogError(this, "SSLNegotiate/SSL_connect", -1, "Connection failed", LOG_LEVEL_INFO); -DEB( fprintf(stderr, "SSL_connect() failed - closing socket, return code: %d\n",r);) - SetSSLNegotiate(false); - SetCloseAndDelete(true); - OnSSLConnectFailed(); - } - } - } - else // server - { - int r = SSL_accept(m_ssl); - if (r > 0) - { - SetSSLNegotiate(false); - /// \todo: resurrect certificate check... server -// CheckCertificateChain( "");//ClientHOST); - SetNonblocking(false); - // - { - SetConnected(); - if (GetOutputLength()) - { - OnWrite(); - } - } - OnAccept(); - Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection established", LOG_LEVEL_INFO); - return true; - } - else - if (!r) - { - Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection failed", LOG_LEVEL_INFO); - SetSSLNegotiate(false); - SetCloseAndDelete(); - OnSSLAcceptFailed(); - } - else - { - r = SSL_get_error(m_ssl, r); - if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) - { - Handler().LogError(this, "SSLNegotiate/SSL_accept", -1, "Connection failed", LOG_LEVEL_INFO); -DEB( fprintf(stderr, "SSL_accept() failed - closing socket, return code: %d\n",r);) - SetSSLNegotiate(false); - SetCloseAndDelete(true); - OnSSLAcceptFailed(); - } - } - } - return false; -} - - -void TcpSocket::InitSSLClient() -{ - InitializeContext("", SSLv23_method()); -} - - -void TcpSocket::InitSSLServer() -{ - Handler().LogError(this, "InitSSLServer", 0, "You MUST implement your own InitSSLServer method", LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} - - -void TcpSocket::InitializeContext(const std::string& context, SSL_METHOD *meth_in) -{ - /* Create our context*/ - static std::map client_contexts; - if (client_contexts.find(context) == client_contexts.end()) - { - SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); - m_ssl_ctx = client_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); - } - else - { - m_ssl_ctx = client_contexts[context]; - } -} - - -void TcpSocket::InitializeContext(const std::string& context,const std::string& keyfile,const std::string& password,SSL_METHOD *meth_in) -{ - /* Create our context*/ - static std::map server_contexts; - if (server_contexts.find(context) == server_contexts.end()) - { - SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); - m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); - // session id - if (!context.empty()) - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); - else - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); - } - else - { - m_ssl_ctx = server_contexts[context]; - } - - /* Load our keys and certificates*/ - if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); - } - - m_password = password; - SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); - SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); - if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); - } -} - - -void TcpSocket::InitializeContext(const std::string& context,const std::string& certfile,const std::string& keyfile,const std::string& password,SSL_METHOD *meth_in) -{ - /* Create our context*/ - static std::map server_contexts; - if (server_contexts.find(context) == server_contexts.end()) - { - SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); - m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); - // session id - if (context.size()) - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); - else - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); - } - else - { - m_ssl_ctx = server_contexts[context]; - } - - /* Load our keys and certificates*/ - if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, certfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); - } - - m_password = password; - SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); - SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); - if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); - } -} - - -int TcpSocket::SSL_password_cb(char *buf,int num,int rwflag,void *userdata) -{ - Socket *p0 = static_cast(userdata); - TcpSocket *p = dynamic_cast(p0); - std::string pw = p ? p -> GetPassword() : ""; - if ( (size_t)num < pw.size() + 1) - { - return 0; - } - strcpy(buf,pw.c_str()); - return (int)pw.size(); -} -#endif // HAVE_OPENSSL - - -int TcpSocket::Close() -{ - if (GetSocket() == INVALID_SOCKET) // this could happen - { - Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); - return 0; - } - int n; - SetNonblocking(true); - if (!Lost() && IsConnected() && !(GetShutdown() & SHUT_WR)) - { - if (shutdown(GetSocket(), SHUT_WR) == -1) - { - // failed... - Handler().LogError(this, "shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - } - // - char tmp[1000]; - if (!Lost() && (n = recv(GetSocket(),tmp,1000,0)) >= 0) - { - if (n) - { - Handler().LogError(this, "read() after shutdown", n, "bytes read", LOG_LEVEL_WARNING); - } - } -#ifdef HAVE_OPENSSL - if (IsSSL() && m_ssl) - SSL_shutdown(m_ssl); - if (m_ssl) - { - SSL_free(m_ssl); - m_ssl = NULL; - } -#endif - return Socket::Close(); -} - - -#ifdef HAVE_OPENSSL -SSL_CTX *TcpSocket::GetSslContext() -{ - if (!m_ssl_ctx) - Handler().LogError(this, "GetSslContext", 0, "SSL Context is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); - return m_ssl_ctx; -} - -SSL *TcpSocket::GetSsl() -{ - if (!m_ssl) - Handler().LogError(this, "GetSsl", 0, "SSL is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); - return m_ssl; -} -#endif - - -#ifdef ENABLE_RECONNECT -void TcpSocket::SetReconnect(bool x) -{ - m_b_reconnect = x; -} -#endif - - -void TcpSocket::OnRawData(const char *buf_in,size_t len) -{ -} - - -size_t TcpSocket::GetInputLength() -{ - return ibuf.GetLength(); -} - - -size_t TcpSocket::GetOutputLength() -{ - return m_output_length; -} - - -uint64_t TcpSocket::GetBytesReceived(bool clear) -{ - uint64_t z = m_bytes_received; - if (clear) - m_bytes_received = 0; - return z; -} - - -uint64_t TcpSocket::GetBytesSent(bool clear) -{ - uint64_t z = m_bytes_sent; - if (clear) - m_bytes_sent = 0; - return z; -} - - -#ifdef ENABLE_RECONNECT -bool TcpSocket::Reconnect() -{ - return m_b_reconnect; -} - - -void TcpSocket::SetIsReconnect(bool x) -{ - m_b_is_reconnect = x; -} - - -bool TcpSocket::IsReconnect() -{ - return m_b_is_reconnect; -} -#endif - - -#ifdef HAVE_OPENSSL -const std::string& TcpSocket::GetPassword() -{ - return m_password; -} -#endif - - -void TcpSocket::DisableInputBuffer(bool x) -{ - m_b_input_buffer_disabled = x; -} - - -void TcpSocket::OnOptions(int family,int type,int protocol,SOCKET s) -{ -DEB( fprintf(stderr, "Socket::OnOptions()\n");) -#ifdef SO_NOSIGPIPE - SetSoNosigpipe(true); -#endif - SetSoReuseaddr(true); - SetSoKeepalive(true); -} - - -void TcpSocket::SetLineProtocol(bool x) -{ - StreamSocket::SetLineProtocol(x); - DisableInputBuffer(x); -} - - -bool TcpSocket::SetTcpNodelay(bool x) -{ -#ifdef TCP_NODELAY - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_TCP, TCP_NODELAY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "TCP_NODELAY", LOG_LEVEL_INFO); - return false; -#endif -} - - -TcpSocket::CircularBuffer::CircularBuffer(size_t size) -:buf(new char[2 * size]) -,m_max(size) -,m_q(0) -,m_b(0) -,m_t(0) -,m_count(0) -{ -} - - -TcpSocket::CircularBuffer::~CircularBuffer() -{ - delete[] buf; -} - - -bool TcpSocket::CircularBuffer::Write(const char *s,size_t l) -{ - if (m_q + l > m_max) - { - return false; // overflow - } - m_count += (unsigned long)l; - if (m_t + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_t; // size left until circular border crossing - // always copy full block to buffer(buf) + top pointer(m_t) - // because we have doubled the buffer size for performance reasons - memcpy(buf + m_t, s, l); - memcpy(buf, s + l1, l - l1); - m_t = l - l1; - m_q += l; - } - else - { - memcpy(buf + m_t, s, l); - memcpy(buf + m_max + m_t, s, l); - m_t += l; - if (m_t >= m_max) - m_t -= m_max; - m_q += l; - } - return true; -} - - -bool TcpSocket::CircularBuffer::Read(char *s,size_t l) -{ - if (l > m_q) - { - return false; // not enough chars - } - if (m_b + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_b; - if (s) - { - memcpy(s, buf + m_b, l1); - memcpy(s + l1, buf, l - l1); - } - m_b = l - l1; - m_q -= l; - } - else - { - if (s) - { - memcpy(s, buf + m_b, l); - } - m_b += l; - if (m_b >= m_max) - m_b -= m_max; - m_q -= l; - } - if (!m_q) - { - m_b = m_t = 0; - } - return true; -} - -bool TcpSocket::CircularBuffer::SoftRead(char *s, size_t l) -{ - if (l > m_q) - { - return false; - } - if (m_b + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_b; - if (s) - { - memcpy(s, buf + m_b, l1); - memcpy(s + l1, buf, l - l1); - } - } - else - { - if (s) - { - memcpy(s, buf + m_b, l); - } - } - return true; -} - -bool TcpSocket::CircularBuffer::Remove(size_t l) -{ - return Read(NULL, l); -} - - -size_t TcpSocket::CircularBuffer::GetLength() -{ - return m_q; -} - - -const char *TcpSocket::CircularBuffer::GetStart() -{ - return buf + m_b; -} - - -size_t TcpSocket::CircularBuffer::GetL() -{ - return (m_b + m_q > m_max) ? m_max - m_b : m_q; -} - - -size_t TcpSocket::CircularBuffer::Space() -{ - return m_max - m_q; -} - - -unsigned long TcpSocket::CircularBuffer::ByteCounter(bool clear) -{ - if (clear) - { - unsigned long x = m_count; - m_count = 0; - return x; - } - return m_count; -} - - -std::string TcpSocket::CircularBuffer::ReadString(size_t l) -{ - char *sz = new char[l + 1]; - if (!Read(sz, l)) // failed, debug printout in Read() method - { - delete[] sz; - return ""; - } - sz[l] = 0; - std::string tmp = sz; - delete[] sz; - return tmp; -} - - -void TcpSocket::OnConnectTimeout() -{ - Handler().LogError(this, "connect", -1, "connect timeout", LOG_LEVEL_FATAL); -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - OnSocks4ConnectFailed(); - // retry direct connection - } - else -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - IncreaseConnectionRetries(); - // ask socket via OnConnectRetry callback if we should continue trying - if (OnConnectRetry()) - { - SetRetryClientConnect(); - } - else - { - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - } - } - else - { - SetCloseAndDelete(true); - /// \todo state reason why connect failed - OnConnectFailed(); - } - // - SetConnecting(false); -} - - -#ifdef _WIN32 -void TcpSocket::OnException() -{ - if (Connecting()) - { -#ifdef ENABLE_SOCKS4 - if (Socks4()) - OnSocks4ConnectFailed(); - else -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && - GetConnectionRetries() < GetConnectionRetry() )) - { - // even though the connection failed at once, only retry after - // the connection timeout - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - } - else - { - SetConnecting(false); // tnx snibbe - SetCloseAndDelete(); - OnConnectFailed(); - } - return; - } - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} -#endif // _WIN32 - - -int TcpSocket::Protocol() -{ - return IPPROTO_TCP; -} - - -void TcpSocket::SetTransferLimit(size_t sz) -{ - m_transfer_limit = sz; -} - - -void TcpSocket::OnTransferLimit() -{ -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/dep/src/sockets/Thread.cpp b/dep/src/sockets/Thread.cpp deleted file mode 100644 index 2717e32d0..000000000 --- a/dep/src/sockets/Thread.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/** \file Thread.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include -#ifdef _WIN32 -#include -#include "socket_include.h" -#else -#include -#endif - -#include "Thread.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Thread::Thread(bool release) -:m_thread(0) -,m_running(true) -,m_release(false) -,m_b_delete_on_exit(false) -,m_b_destructor(false) -{ -#ifdef _WIN32 -// m_thread = ::CreateThread(NULL, 0, StartThread, this, 0, &m_dwThreadId); - m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId); -#else - pthread_attr_t attr; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); - if (pthread_create(&m_thread,&attr, StartThread,this) == -1) - { - perror("Thread: create failed"); - SetRunning(false); - } -// pthread_attr_destroy(&attr); -#endif - m_release = release; -} - - -Thread::~Thread() -{ - m_b_destructor = true; - if (m_running) - { - SetRelease(true); - SetRunning(false); -#ifdef _WIN32 - Sleep(1000); -#else - sleep(1); -#endif - } -#ifdef _WIN32 - if (m_thread) - ::CloseHandle(m_thread); -#endif -} - - -threadfunc_t STDPREFIX Thread::StartThread(threadparam_t zz) -{ - Thread *p = (Thread *)zz; - - while (p -> m_running && !p -> m_release) - { -#ifdef _WIN32 - Sleep(1000); -#else - sleep(1); -#endif - } - if (p -> m_running) - { - p -> Run(); - } - p -> SetRunning(false); // if return - if (p -> DeleteOnExit() && !p -> IsDestructor()) - { - delete p; - } -#ifdef _WIN32 - _endthreadex(0); -#endif - return (threadfunc_t)NULL; -} - - -bool Thread::IsRunning() -{ - return m_running; -} - - -void Thread::SetRunning(bool x) -{ - m_running = x; -} - - -bool Thread::IsReleased() -{ - return m_release; -} - - -void Thread::SetRelease(bool x) -{ - m_release = x; -} - - -bool Thread::DeleteOnExit() -{ - return m_b_delete_on_exit; -} - - -void Thread::SetDeleteOnExit(bool x) -{ - m_b_delete_on_exit = x; -} - - -bool Thread::IsDestructor() -{ - return m_b_destructor; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/dep/src/sockets/UdpSocket.cpp b/dep/src/sockets/UdpSocket.cpp deleted file mode 100644 index 5d949496b..000000000 --- a/dep/src/sockets/UdpSocket.cpp +++ /dev/null @@ -1,852 +0,0 @@ -/** \file UdpSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include -#else -#include -#endif - -#include "ISocketHandler.h" -#include "UdpSocket.h" -#include "Utility.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif -// include this to see strange sights -//#include - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : Socket(h) -, m_ibuf(new char[ibufsz]) -, m_ibufsz(ibufsz) -, m_bind_ok(false) -, m_port(0) -, m_last_size_written(-1) -, m_retries(retries) -, m_b_read_ts(false) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - SetIpv6(ipv6); -#endif -#endif -} - - -UdpSocket::~UdpSocket() -{ - Close(); - delete[] m_ibuf; -} - - -int UdpSocket::Bind(port_t &port, int range) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, range); - } -#endif -#endif - Ipv4Address ad(port); - return Bind(ad, range); -} - - -int UdpSocket::Bind(const std::string& intf, port_t &port, int range) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, range); - } - SetCloseAndDelete(); - return -1; - } -#endif -#endif - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, range); - } - SetCloseAndDelete(); - return -1; -} - - -int UdpSocket::Bind(ipaddr_t a, port_t &port, int range) -{ - Ipv4Address ad(a, port); - return Bind(ad, range); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -int UdpSocket::Bind(in6_addr a, port_t &port, int range) -{ - Ipv6Address ad(a, port); - return Bind(ad, range); -} -#endif -#endif - - -int UdpSocket::Bind(SocketAddress& ad, int range) -{ - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - int n = bind(GetSocket(), ad, ad); - int tries = range; - while (n == -1 && tries--) - { - ad.SetPort(ad.GetPort() + 1); - n = bind(GetSocket(), ad, ad); - } - if (n == -1) - { - Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -#ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for UdpSocket, port:range: " + Utility::l2string(ad.GetPort()) + ":" + Utility::l2string(range)); -#endif - return -1; - } - m_bind_ok = true; - m_port = ad.GetPort(); - return 0; - } - return -1; -} - - -/** if you wish to use Send, first Open a connection */ -bool UdpSocket::Open(ipaddr_t l, port_t port) -{ - Ipv4Address ad(l, port); - return Open(ad); -} - - -bool UdpSocket::Open(const std::string& host, port_t port) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(host, port); - if (ad.IsValid()) - { - return Open(ad); - } - return false; - } -#endif -#endif - Ipv4Address ad(host, port); - if (ad.IsValid()) - { - return Open(ad); - } - return false; -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -bool UdpSocket::Open(struct in6_addr& a, port_t port) -{ - Ipv6Address ad(a, port); - return Open(ad); -} -#endif -#endif - - -bool UdpSocket::Open(SocketAddress& ad) -{ - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - if (connect(GetSocket(), ad, ad) == -1) - { - Handler().LogError(this, "connect", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - SetConnected(); - return true; - } - return false; -} - - -void UdpSocket::CreateConnection() -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - if (GetSocket() == INVALID_SOCKET) - { - SOCKET s = CreateSocket(AF_INET6, SOCK_DGRAM, "udp"); - if (s == INVALID_SOCKET) - { - return; - } - SetNonblocking(true, s); - Attach(s); - } - return; - } -#endif -#endif - if (GetSocket() == INVALID_SOCKET) - { - SOCKET s = CreateSocket(AF_INET, SOCK_DGRAM, "udp"); - if (s == INVALID_SOCKET) - { - return; - } - SetNonblocking(true, s); - Attach(s); - } -} - - -/** send to specified address */ -void UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int len, int flags) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(h, p); - if (ad.IsValid()) - { - SendToBuf(ad, data, len, flags); - } - return; - } -#endif -#endif - Ipv4Address ad(h, p); - if (ad.IsValid()) - { - SendToBuf(ad, data, len, flags); - } -} - - -/** send to specified address */ -void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int flags) -{ - Ipv4Address ad(a, p); - SendToBuf(ad, data, len, flags); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int flags) -{ - Ipv6Address ad(a, p); - SendToBuf(ad, data, len, flags); -} -#endif -#endif - - -void UdpSocket::SendToBuf(SocketAddress& ad, const char *data, int len, int flags) -{ - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - if ((m_last_size_written = sendto(GetSocket(), data, len, flags, ad, ad)) == -1) - { - Handler().LogError(this, "sendto", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - } -} - - -void UdpSocket::SendTo(const std::string& a, port_t p, const std::string& str, int flags) -{ - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); -} - - -void UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags) -{ - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags) -{ - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); -} -#endif -#endif - - -void UdpSocket::SendTo(SocketAddress& ad, const std::string& str, int flags) -{ - SendToBuf(ad, str.c_str(), (int)str.size(), flags); -} - - -/** send to connected address */ -void UdpSocket::SendBuf(const char *data, size_t len, int flags) -{ - if (!IsConnected()) - { - Handler().LogError(this, "SendBuf", 0, "not connected", LOG_LEVEL_ERROR); - return; - } - if ((m_last_size_written = send(GetSocket(), data, (int)len, flags)) == -1) - { - Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } -} - - -void UdpSocket::Send(const std::string& str, int flags) -{ - SendBuf(str.c_str(), (int)str.size(), flags); -} - - -#if defined(LINUX) || defined(MACOSX) -int UdpSocket::ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts) -{ - struct msghdr msg; - struct iovec vec[1]; - union { - struct cmsghdr cm; -#ifdef MACOSX -#ifdef __DARWIN_UNIX03 -#define ALIGNBYTES __DARWIN_ALIGNBYTES -#endif -#define myALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES) -#define myCMSG_SPACE(l) (myALIGN(sizeof(struct cmsghdr)) + myALIGN(l)) - char data[ myCMSG_SPACE(sizeof(struct timeval)) ]; -#else - char data[ CMSG_SPACE(sizeof(struct timeval)) ]; -#endif - } cmsg_un; - struct cmsghdr *cmsg; - struct timeval *tv; - - vec[0].iov_base = ioBuf; - vec[0].iov_len = inBufSize; - - memset(&msg, 0, sizeof(msg)); - memset(from, 0, fromlen); - memset(ioBuf, 0, inBufSize); - memset(&cmsg_un, 0, sizeof(cmsg_un)); - - msg.msg_name = (caddr_t)from; - msg.msg_namelen = fromlen; - msg.msg_iov = vec; - msg.msg_iovlen = 1; - msg.msg_control = cmsg_un.data; - msg.msg_controllen = sizeof(cmsg_un.data); - msg.msg_flags = 0; - - // Original version - for reference only - //int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - - int n = recvmsg(GetSocket(), &msg, MSG_DONTWAIT); - - // now ioBuf will contain the data, as if we used recvfrom - - // Now get the time - if(n != -1 && msg.msg_controllen >= sizeof(struct cmsghdr) && !(msg.msg_flags & MSG_CTRUNC)) - { - tv = 0; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) - { - tv = (struct timeval *)CMSG_DATA(cmsg); - } - } - if (tv) - { - memcpy(ts, tv, sizeof(struct timeval)); - } - } - // The address is in network order, but that's OK right now - return n; -} -#endif - - -void UdpSocket::OnRead() -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sa_len = sizeof(sa); - if (m_b_read_ts) - { - struct timeval ts; - Utility::GetTime(&ts); -#if !defined(LINUX) && !defined(MACOSX) - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); -#else - int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); -#endif - if (n > 0) - { - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); - } - else - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int q = m_retries; // receive max 10 at one cycle - while (n > 0) - { - if (sa_len != sizeof(sa)) - { - Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); - } - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); - if (!q--) - break; - // - n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - } - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } -#endif -#endif - struct sockaddr_in sa; - socklen_t sa_len = sizeof(sa); - if (m_b_read_ts) - { - struct timeval ts; - Utility::GetTime(&ts); -#if !defined(LINUX) && !defined(MACOSX) - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); -#else - int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); -#endif - if (n > 0) - { - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); - } - else - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int q = m_retries; - while (n > 0) - { - if (sa_len != sizeof(sa)) - { - Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); - } - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); - if (!q--) - break; - // - n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - } - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } -} - - -void UdpSocket::SetBroadcast(bool b) -{ - int one = 1; - int zero = 0; - - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (b) - { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof(one)) == -1) - { - Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - else - { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &zero, sizeof(zero)) == -1) - { - Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } -} - - -bool UdpSocket::IsBroadcast() -{ - int is_broadcast = 0; - socklen_t size; - - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (getsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, &size) == -1) - { - Handler().LogError(this, "IsBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_broadcast != 0; -} - - -void UdpSocket::SetMulticastTTL(int ttl) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -int UdpSocket::GetMulticastTTL() -{ - int ttl = 0; - socklen_t size = sizeof(int); - - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, &size) == -1) - { - Handler().LogError(this, "GetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return ttl; -} - - -void UdpSocket::SetMulticastLoop(bool x) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - int val = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return; - } -#endif -#endif - int val = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -bool UdpSocket::IsMulticastLoop() -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - int is_loop = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) - { - Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_loop ? true : false; - } -#endif -#endif - int is_loop = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) - { - Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_loop ? true : false; -} - - -void UdpSocket::AddMulticastMembership(const std::string& group, const std::string& local_if, int if_index) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct ipv6_mreq x; - struct in6_addr addr; - if (Utility::u2ip( group, addr )) - { - x.ipv6mr_multiaddr = addr; - x.ipv6mr_interface = if_index; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) - { - Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - return; - } -#endif -#endif - struct ip_mreq x; // ip_mreqn - ipaddr_t addr; - if (Utility::u2ip( group, addr )) - { - memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); - Utility::u2ip( local_if, addr); - memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); -// x.imr_ifindex = if_index; - if (setsockopt(GetSocket(), SOL_IP, IP_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } -} - - -void UdpSocket::DropMulticastMembership(const std::string& group, const std::string& local_if, int if_index) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct ipv6_mreq x; - struct in6_addr addr; - if (Utility::u2ip( group, addr )) - { - x.ipv6mr_multiaddr = addr; - x.ipv6mr_interface = if_index; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) - { - Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - return; - } -#endif -#endif - struct ip_mreq x; // ip_mreqn - ipaddr_t addr; - if (Utility::u2ip( group, addr )) - { - memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); - Utility::u2ip( local_if, addr); - memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); -// x.imr_ifindex = if_index; - if (setsockopt(GetSocket(), SOL_IP, IP_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -void UdpSocket::SetMulticastHops(int hops) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (!IsIpv6()) - { - Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); - return; - } - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -int UdpSocket::GetMulticastHops() -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (!IsIpv6()) - { - Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); - return -1; - } - int hops = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, &size) == -1) - { - Handler().LogError(this, "GetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return hops; -} -#endif // IPPROTO_IPV6 -#endif - - -bool UdpSocket::IsBound() -{ - return m_bind_ok; -} - - -void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len) -{ -} - - -void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len, struct timeval *ts) -{ -} - - -port_t UdpSocket::GetPort() -{ - return m_port; -} - - -int UdpSocket::GetLastSizeWritten() -{ - return m_last_size_written; -} - - -void UdpSocket::SetTimestamp(bool x) -{ - m_b_read_ts = x; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/dep/src/sockets/Utility.cpp b/dep/src/sockets/Utility.cpp deleted file mode 100644 index c1327035d..000000000 --- a/dep/src/sockets/Utility.cpp +++ /dev/null @@ -1,999 +0,0 @@ -/** \file Utility.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Utility.h" -#include "Parse.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#include "Base64.h" -#include -#ifdef _WIN32 -#include -#else -#include -#include -#endif -#include - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// defines for the random number generator -#define TWIST_IA 397 -#define TWIST_IB (TWIST_LEN - TWIST_IA) -#define UMASK 0x80000000 -#define LMASK 0x7FFFFFFF -#define MATRIX_A 0x9908B0DF -#define TWIST(b,i,j) ((b)[i] & UMASK) | ((b)[j] & LMASK) -#define MAGIC_TWIST(s) (((s) & 1) * MATRIX_A) - - -// statics -std::string Utility::m_host; -bool Utility::m_local_resolved = false; -ipaddr_t Utility::m_ip = 0; -std::string Utility::m_addr; -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -struct in6_addr Utility::m_local_ip6; -std::string Utility::m_local_addr6; -#endif -#endif - - -std::string Utility::base64(const std::string& str_in) -{ - std::string str; - Base64 m_b; - m_b.encode(str_in, str, false); // , false == do not add cr/lf - return str; -} - - -std::string Utility::base64d(const std::string& str_in) -{ - std::string str; - Base64 m_b; - m_b.decode(str_in, str); - return str; -} - - -std::string Utility::l2string(long l) -{ - std::string str; - char tmp[100]; - sprintf(tmp,"%ld",l); - str = tmp; - return str; -} - - -std::string Utility::bigint2string(uint64_t l) -{ - std::string str; - uint64_t tmp = l; - while (tmp) - { - uint64_t a = tmp % 10; - str = (char)(a + 48) + str; - tmp /= 10; - } - if (str.empty()) - { - str = "0"; - } - return str; -} - - -uint64_t Utility::atoi64(const std::string& str) -{ - uint64_t l = 0; - for (size_t i = 0; i < str.size(); i++) - { - l = l * 10 + str[i] - 48; - } - return l; -} - - -unsigned int Utility::hex2unsigned(const std::string& str) -{ - unsigned int r = 0; - for (size_t i = 0; i < str.size(); i++) - { - r = r * 16 + str[i] - 48 - ((str[i] >= 'A') ? 7 : 0) - ((str[i] >= 'a') ? 32 : 0); - } - return r; -} - - -/* -* Encode string per RFC1738 URL encoding rules -* tnx rstaveley -*/ -std::string Utility::rfc1738_encode(const std::string& src) -{ -static char hex[] = "0123456789ABCDEF"; - std::string dst; - for (size_t i = 0; i < src.size(); i++) - { - if (isalnum(src[i])) - { - dst += src[i]; - } - else - if (src[i] == ' ') - { - dst += '+'; - } - else - { - unsigned char c = static_cast(src[i]); - dst += '%'; - dst += hex[c / 16]; - dst += hex[c % 16]; - } - } - return dst; -} // rfc1738_encode - - -/* -* Decode string per RFC1738 URL encoding rules -* tnx rstaveley -*/ -std::string Utility::rfc1738_decode(const std::string& src) -{ - std::string dst; - for (size_t i = 0; i < src.size(); i++) - { - if (src[i] == '%' && isxdigit(src[i + 1]) && isxdigit(src[i + 2])) - { - char c1 = src[++i]; - char c2 = src[++i]; - c1 = c1 - 48 - ((c1 >= 'A') ? 7 : 0) - ((c1 >= 'a') ? 32 : 0); - c2 = c2 - 48 - ((c2 >= 'A') ? 7 : 0) - ((c2 >= 'a') ? 32 : 0); - dst += (char)(c1 * 16 + c2); - } - else - if (src[i] == '+') - { - dst += ' '; - } - else - { - dst += src[i]; - } - } - return dst; -} // rfc1738_decode - - -bool Utility::isipv4(const std::string& str) -{ - int dots = 0; - // %! ignore :port? - for (size_t i = 0; i < str.size(); i++) - { - if (str[i] == '.') - dots++; - else - if (!isdigit(str[i])) - return false; - } - if (dots != 3) - return false; - return true; -} - - -bool Utility::isipv6(const std::string& str) -{ - size_t qc = 0; - size_t qd = 0; - for (size_t i = 0; i < str.size(); i++) - { - qc += (str[i] == ':') ? 1 : 0; - qd += (str[i] == '.') ? 1 : 0; - } - if (qc > 7) - { - return false; - } - if (qd && qd != 3) - { - return false; - } - Parse pa(str,":."); - std::string tmp = pa.getword(); - while (!tmp.empty()) - { - if (tmp.size() > 4) - { - return false; - } - for (size_t i = 0; i < tmp.size(); i++) - { - if (tmp[i] < '0' || (tmp[i] > '9' && tmp[i] < 'A') || - (tmp[i] > 'F' && tmp[i] < 'a') || tmp[i] > 'f') - { - return false; - } - } - // - tmp = pa.getword(); - } - return true; -} - - -bool Utility::u2ip(const std::string& str, ipaddr_t& l) -{ - struct sockaddr_in sa; - bool r = Utility::u2ip(str, sa); - memcpy(&l, &sa.sin_addr, sizeof(l)); - return r; -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -bool Utility::u2ip(const std::string& str, struct in6_addr& l) -{ - struct sockaddr_in6 sa; - bool r = Utility::u2ip(str, sa); - l = sa.sin6_addr; - return r; -} -#endif -#endif - - -void Utility::l2ip(const ipaddr_t ip, std::string& str) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - memcpy(&sa.sin_addr, &ip, sizeof(sa.sin_addr)); - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); -} - - -void Utility::l2ip(const in_addr& ip, std::string& str) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = ip; - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -void Utility::l2ip(const struct in6_addr& ip, std::string& str,bool mixed) -{ - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - if (mixed) - { - unsigned short x; - unsigned short addr16[8]; - memcpy(addr16, &ip, sizeof(addr16)); - for (size_t i = 0; i < 6; i++) - { - x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - strcat(slask,":"); - if (x || !ok_to_skip) - { - sprintf(slask + strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - x = ntohs(addr16[6]); - sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); - x = ntohs(addr16[7]); - sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); - } - else - { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = ip; - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); - return; - } - str = slask; -} - - -int Utility::in6_addr_compare(in6_addr a,in6_addr b) -{ - for (size_t i = 0; i < 16; i++) - { - if (a.s6_addr[i] < b.s6_addr[i]) - return -1; - if (a.s6_addr[i] > b.s6_addr[i]) - return 1; - } - return 0; -} -#endif -#endif - - -void Utility::ResolveLocal() -{ - char h[256]; - - // get local hostname and translate into ip-address - *h = 0; - gethostname(h,255); - { - if (Utility::u2ip(h, m_ip)) - { - Utility::l2ip(m_ip, m_addr); - } - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - memset(&m_local_ip6, 0, sizeof(m_local_ip6)); - { - if (Utility::u2ip(h, m_local_ip6)) - { - Utility::l2ip(m_local_ip6, m_local_addr6); - } - } -#endif -#endif - m_host = h; - m_local_resolved = true; -} - - -const std::string& Utility::GetLocalHostname() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_host; -} - - -ipaddr_t Utility::GetLocalIP() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_ip; -} - - -const std::string& Utility::GetLocalAddress() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_addr; -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -const struct in6_addr& Utility::GetLocalIP6() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_local_ip6; -} - - -const std::string& Utility::GetLocalAddress6() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_local_addr6; -} -#endif -#endif - - -void Utility::SetEnv(const std::string& var,const std::string& value) -{ -#if (defined(SOLARIS8) || defined(SOLARIS)) - { - static std::map vmap; - if (vmap.find(var) != vmap.end()) - { - delete[] vmap[var]; - } - vmap[var] = new char[var.size() + 1 + value.size() + 1]; - sprintf(vmap[var], "%s=%s", var.c_str(), value.c_str()); - putenv( vmap[var] ); - } -#elif defined _WIN32 - { - std::string slask = var + "=" + value; - _putenv( (char *)slask.c_str()); - } -#else - setenv(var.c_str(), value.c_str(), 1); -#endif -} - - -std::string Utility::Sa2String(struct sockaddr *sa) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (sa -> sa_family == AF_INET6) - { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; - std::string tmp; - Utility::l2ip(sa6 -> sin6_addr, tmp); - return tmp + ":" + Utility::l2string(ntohs(sa6 -> sin6_port)); - } -#endif -#endif - if (sa -> sa_family == AF_INET) - { - struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; - ipaddr_t a; - memcpy(&a, &sa4 -> sin_addr, 4); - std::string tmp; - Utility::l2ip(a, tmp); - return tmp + ":" + Utility::l2string(ntohs(sa4 -> sin_port)); - } - return ""; -} - - -void Utility::GetTime(struct timeval *p) -{ -#ifdef _WIN32 - FILETIME ft; // Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). - GetSystemTimeAsFileTime(&ft); - uint64_t tt; - memcpy(&tt, &ft, sizeof(tt)); - tt /= 10; // make it usecs - p->tv_sec = (long)tt / 1000000; - p->tv_usec = (long)tt % 1000000; -#else - gettimeofday(p, NULL); -#endif -} - - -std::auto_ptr Utility::CreateAddress(struct sockaddr *sa,socklen_t sa_len) -{ - switch (sa -> sa_family) - { - case AF_INET: - if (sa_len == sizeof(struct sockaddr_in)) - { - struct sockaddr_in *p = (struct sockaddr_in *)sa; - return std::auto_ptr(new Ipv4Address(*p)); - } - break; -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - case AF_INET6: - if (sa_len == sizeof(struct sockaddr_in6)) - { - struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; - return std::auto_ptr(new Ipv6Address(*p)); - } - break; -#endif -#endif - } - return std::auto_ptr(NULL); -} - - -bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags) -{ - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; -#ifdef NO_GETADDRINFO - if ((ai_flags & AI_NUMERICHOST) != 0 || isipv4(host)) - { - Parse pa((char *)host.c_str(), "."); - union { - struct { - unsigned char b1; - unsigned char b2; - unsigned char b3; - unsigned char b4; - } a; - ipaddr_t l; - } u; - u.a.b1 = static_cast(pa.getvalue()); - u.a.b2 = static_cast(pa.getvalue()); - u.a.b3 = static_cast(pa.getvalue()); - u.a.b4 = static_cast(pa.getvalue()); - memcpy(&sa.sin_addr, &u.l, sizeof(sa.sin_addr)); - return true; - } -#ifndef LINUX - struct hostent *he = gethostbyname( host.c_str() ); - if (!he) - { - return false; - } - memcpy(&sa.sin_addr, he -> h_addr, sizeof(sa.sin_addr)); -#else - struct hostent he; - struct hostent *result = NULL; - int myerrno = 0; - char buf[2000]; - int n = gethostbyname_r(host.c_str(), &he, buf, sizeof(buf), &result, &myerrno); - if (n || !result) - { - return false; - } - if (he.h_addr_list && he.h_addr_list[0]) - memcpy(&sa.sin_addr, he.h_addr, 4); - else - return false; -#endif - return true; -#else - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - // AI_NUMERICHOST - // AI_CANONNAME - // AI_PASSIVE - server - // AI_ADDRCONFIG - // AI_V4MAPPED - // AI_ALL - // AI_NUMERICSERV - hints.ai_flags = ai_flags; - hints.ai_family = AF_INET; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - if (Utility::isipv4(host)) - hints.ai_flags |= AI_NUMERICHOST; - int n = getaddrinfo(host.c_str(), NULL, &hints, &res); - if (!n) - { - std::vector vec; - struct addrinfo *ai = res; - while (ai) - { - if (ai -> ai_addrlen == sizeof(sa)) - vec.push_back( ai ); - ai = ai -> ai_next; - } - if (vec.empty()) - return false; - ai = vec[Utility::Rnd() % vec.size()]; - { - memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); - } - freeaddrinfo(res); - return true; - } - std::string error = "Error: "; -#ifndef __CYGWIN__ - error += gai_strerror(n); -#endif - return false; -#endif // NO_GETADDRINFO -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flags) -{ - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; -#ifdef NO_GETADDRINFO - if ((ai_flags & AI_NUMERICHOST) != 0 || isipv6(host)) - { - std::list vec; - size_t x = 0; - for (size_t i = 0; i <= host.size(); i++) - { - if (i == host.size() || host[i] == ':') - { - std::string s = host.substr(x, i - x); - // - if (strstr(s.c_str(),".")) // x.x.x.x - { - Parse pa(s,"."); - char slask[100]; // u2ip temporary hex2string conversion - unsigned long b0 = static_cast(pa.getvalue()); - unsigned long b1 = static_cast(pa.getvalue()); - unsigned long b2 = static_cast(pa.getvalue()); - unsigned long b3 = static_cast(pa.getvalue()); - sprintf(slask,"%lx",b0 * 256 + b1); - vec.push_back(slask); - sprintf(slask,"%lx",b2 * 256 + b3); - vec.push_back(slask); - } - else - { - vec.push_back(s); - } - // - x = i + 1; - } - } - size_t sz = vec.size(); // number of byte pairs - size_t i = 0; // index in in6_addr.in6_u.u6_addr16[] ( 0 .. 7 ) - unsigned short addr16[8]; - for (std::list::iterator it = vec.begin(); it != vec.end(); it++) - { - std::string bytepair = *it; - if (!bytepair.empty()) - { - addr16[i++] = htons(Utility::hex2unsigned(bytepair)); - } - else - { - addr16[i++] = 0; - while (sz++ < 8) - { - addr16[i++] = 0; - } - } - } - memcpy(&sa.sin6_addr, addr16, sizeof(addr16)); - return true; - } -#ifdef SOLARIS - int errnum = 0; - struct hostent *he = getipnodebyname( host.c_str(), AF_INET6, 0, &errnum ); -#else - struct hostent *he = gethostbyname2( host.c_str(), AF_INET6 ); -#endif - if (!he) - { - return false; - } - memcpy(&sa.sin6_addr,he -> h_addr_list[0],he -> h_length); -#ifdef SOLARIS - free(he); -#endif - return true; -#else - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = ai_flags; - hints.ai_family = AF_INET6; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - if (Utility::isipv6(host)) - hints.ai_flags |= AI_NUMERICHOST; - int n = getaddrinfo(host.c_str(), NULL, &hints, &res); - if (!n) - { - std::vector vec; - struct addrinfo *ai = res; - while (ai) - { - if (ai -> ai_addrlen == sizeof(sa)) - vec.push_back( ai ); - ai = ai -> ai_next; - } - if (vec.empty()) - return false; - ai = vec[Utility::Rnd() % vec.size()]; - { - memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); - } - freeaddrinfo(res); - return true; - } - std::string error = "Error: "; -#ifndef __CYGWIN__ - error += gai_strerror(n); -#endif - return false; -#endif // NO_GETADDRINFO -} -#endif // IPPROTO_IPV6 -#endif // ENABLE_IPV6 - - -bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, int flags) -{ - std::string service; - return Utility::reverse(sa, sa_len, hostname, service, flags); -} - - -bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags) -{ - hostname = ""; - service = ""; -#ifdef NO_GETADDRINFO - switch (sa -> sa_family) - { - case AF_INET: - if (flags & NI_NUMERICHOST) - { - union { - struct { - unsigned char b1; - unsigned char b2; - unsigned char b3; - unsigned char b4; - } a; - ipaddr_t l; - } u; - struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; - memcpy(&u.l, &sa_in -> sin_addr, sizeof(u.l)); - char tmp[100]; - sprintf(tmp, "%u.%u.%u.%u", u.a.b1, u.a.b2, u.a.b3, u.a.b4); - hostname = tmp; - return true; - } - else - { - struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; - struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin_addr, sizeof(sa_in -> sin_addr), AF_INET); - if (h) - { - hostname = h -> h_name; - return true; - } - } - break; -#ifdef ENABLE_IPV6 - case AF_INET6: - if (flags & NI_NUMERICHOST) - { - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - { - unsigned short addr16[8]; - struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa; - memcpy(addr16, &sa_in6 -> sin6_addr, sizeof(addr16)); - for (size_t i = 0; i < 8; i++) - { - unsigned short x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - strcat(slask,":"); - if (x || !ok_to_skip) - { - sprintf(slask + strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - } - if (!*slask) - strcpy(slask, "::"); - hostname = slask; - return true; - } - else - { - // %! TODO: ipv6 reverse lookup - struct sockaddr_in6 *sa_in = (struct sockaddr_in6 *)sa; - struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin6_addr, sizeof(sa_in -> sin6_addr), AF_INET6); - if (h) - { - hostname = h -> h_name; - return true; - } - } - break; -#endif - } - return false; -#else - char host[NI_MAXHOST]; - char serv[NI_MAXSERV]; - // NI_NOFQDN - // NI_NUMERICHOST - // NI_NAMEREQD - // NI_NUMERICSERV - // NI_DGRAM - int n = getnameinfo(sa, sa_len, host, sizeof(host), serv, sizeof(serv), flags); - if (n) - { - // EAI_AGAIN - // EAI_BADFLAGS - // EAI_FAIL - // EAI_FAMILY - // EAI_MEMORY - // EAI_NONAME - // EAI_OVERFLOW - // EAI_SYSTEM - return false; - } - hostname = host; - service = serv; - return true; -#endif // NO_GETADDRINFO -} - - -bool Utility::u2service(const std::string& name, int& service, int ai_flags) -{ -#ifdef NO_GETADDRINFO - // %! - return false; -#else - struct addrinfo hints; - service = 0; - memset(&hints, 0, sizeof(hints)); - // AI_NUMERICHOST - // AI_CANONNAME - // AI_PASSIVE - server - // AI_ADDRCONFIG - // AI_V4MAPPED - // AI_ALL - // AI_NUMERICSERV - hints.ai_flags = ai_flags; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - int n = getaddrinfo(NULL, name.c_str(), &hints, &res); - if (!n) - { - service = res -> ai_protocol; - freeaddrinfo(res); - return true; - } - return false; -#endif // NO_GETADDRINFO -} - - -unsigned long Utility::ThreadID() -{ -#ifdef _WIN32 - return GetCurrentThreadId(); -#else - return (unsigned long)pthread_self(); -#endif -} - - -std::string Utility::ToLower(const std::string& str) -{ - std::string r; - for (size_t i = 0; i < str.size(); i++) - { - if (str[i] >= 'A' && str[i] <= 'Z') - r += str[i] | 32; - else - r += str[i]; - } - return r; -} - - -std::string Utility::ToUpper(const std::string& str) -{ - std::string r; - for (size_t i = 0; i < str.size(); i++) - { - if (str[i] >= 'a' && str[i] <= 'z') - r += (char)(str[i] - 32); - else - r += str[i]; - } - return r; -} - - -std::string Utility::ToString(double d) -{ - char tmp[100]; - sprintf(tmp, "%f", d); - return tmp; -} - - -unsigned long Utility::Rnd() -{ -static Utility::Rng generator( (unsigned long)time(NULL) ); - return generator.Get(); -} - - -Utility::Rng::Rng(unsigned long seed) : m_value( 0 ) -{ - m_tmp[0]= seed & 0xffffffffUL; - for (int i = 1; i < TWIST_LEN; i++) - { - m_tmp[i] = (1812433253UL * (m_tmp[i - 1] ^ (m_tmp[i - 1] >> 30)) + i); - } -} - - -unsigned long Utility::Rng::Get() -{ - unsigned long val = m_tmp[m_value]; - ++m_value; - if (m_value == TWIST_LEN) - { - for (int i = 0; i < TWIST_IB; ++i) - { - unsigned long s = TWIST(m_tmp, i, i + 1); - m_tmp[i] = m_tmp[i + TWIST_IA] ^ (s >> 1) ^ MAGIC_TWIST(s); - } - { - for (int i = 0; i < TWIST_LEN - 1; ++i) - { - unsigned long s = TWIST(m_tmp, i, i + 1); - m_tmp[i] = m_tmp[i - TWIST_IB] ^ (s >> 1) ^ MAGIC_TWIST(s); - } - } - unsigned long s = TWIST(m_tmp, TWIST_LEN - 1, 0); - m_tmp[TWIST_LEN - 1] = m_tmp[TWIST_IA - 1] ^ (s >> 1) ^ MAGIC_TWIST(s); - - m_value = 0; - } - return val; -} - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/dep/src/sockets/network_kist.txt b/dep/src/sockets/network_kist.txt deleted file mode 100644 index f6597bf9c..000000000 --- a/dep/src/sockets/network_kist.txt +++ /dev/null @@ -1,20 +0,0 @@ -The following are the only .cpp files used from the new network library (v2.2.8) This file is just for future reference. - -Base64.cpp -Exception.cpp -Ipv4Address.cpp -Ipv6Address.cpp -Lock.cpp -Mutex.cpp -Parse.cpp -ResolvServer.cpp -ResolvSocket.cpp -Socket.cpp -SocketHandler.cpp -socket_include.cpp -StdoutLog.cpp -StreamSocket.cpp -TcpSocket.cpp -Thread.cpp -UdpSocket.cpp -Utility.cpp diff --git a/dep/src/sockets/socket_include.cpp b/dep/src/sockets/socket_include.cpp deleted file mode 100644 index 07b986b02..000000000 --- a/dep/src/sockets/socket_include.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/** \file socket_include.cpp - ** \date 2004-11-28 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2007 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include - -// only to be included in win32 projects -const char *StrError(int x) -{ -static char tmp[100]; - switch (x) - { - case 10004: return "Interrupted function call."; - case 10013: return "Permission denied."; - case 10014: return "Bad address."; - case 10022: return "Invalid argument."; - case 10024: return "Too many open files."; - case 10035: return "Resource temporarily unavailable."; - case 10036: return "Operation now in progress."; - case 10037: return "Operation already in progress."; - case 10038: return "Socket operation on nonsocket."; - case 10039: return "Destination address required."; - case 10040: return "Message too long."; - case 10041: return "Protocol wrong type for socket."; - case 10042: return "Bad protocol option."; - case 10043: return "Protocol not supported."; - case 10044: return "Socket type not supported."; - case 10045: return "Operation not supported."; - case 10046: return "Protocol family not supported."; - case 10047: return "Address family not supported by protocol family."; - case 10048: return "Address already in use."; - case 10049: return "Cannot assign requested address."; - case 10050: return "Network is down."; - case 10051: return "Network is unreachable."; - case 10052: return "Network dropped connection on reset."; - case 10053: return "Software caused connection abort."; - case 10054: return "Connection reset by peer."; - case 10055: return "No buffer space available."; - case 10056: return "Socket is already connected."; - case 10057: return "Socket is not connected."; - case 10058: return "Cannot send after socket shutdown."; - case 10060: return "Connection timed out."; - case 10061: return "Connection refused."; - case 10064: return "Host is down."; - case 10065: return "No route to host."; - case 10067: return "Too many processes."; - case 10091: return "Network subsystem is unavailable."; - case 10092: return "Winsock.dll version out of range."; - case 10093: return "Successful WSAStartup not yet performed."; - case 10101: return "Graceful shutdown in progress."; - case 10109: return "Class type not found."; - case 11001: return "Host not found."; - case 11002: return "Nonauthoritative host not found."; - case 11003: return "This is a nonrecoverable error."; - case 11004: return "Valid name, no data record of requested type."; - - default: - break; - } - sprintf(tmp, "Winsock error code: %d", x); - return tmp; -} - - - diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 69050f501..691aef8cc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9938" + #define REVISION_NR "9939" #endif // __REVISION_NR_H__ diff --git a/win/VC100/realmd.vcxproj b/win/VC100/realmd.vcxproj index 0329837ad..45cea0c36 100644 --- a/win/VC100/realmd.vcxproj +++ b/win/VC100/realmd.vcxproj @@ -435,9 +435,6 @@ {90297c34-f231-4df4-848e-a74bcc0e40ed} - - {04baf755-0d67-46f8-b1c6-77ae5368f3cb} - diff --git a/win/VC100/sockets.vcxproj b/win/VC100/sockets.vcxproj deleted file mode 100644 index aa8e9a518..000000000 --- a/win/VC100/sockets.vcxproj +++ /dev/null @@ -1,373 +0,0 @@ - - - - Debug_NoPCH - Win32 - - - Debug_NoPCH - Win32 - - - Debug_NoPCH - x64 - - - Debug_NoPCH - x64 - - - Debug - Win32 - - - Debug - Win32 - - - Debug - x64 - - - Debug - x64 - - - Release - Win32 - - - Release - Win32 - - - Release - x64 - - - Release - x64 - - - - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} - sockets - Win32Proj - - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - sockets - .lib - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - sockets - .lib - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - sockets - .lib - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - sockets - .lib - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - sockets - .lib - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - sockets - .lib - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - /MP %(AdditionalOptions) - OnlyExplicitInline - ..\..\dep\include\sockets;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - StreamingSIMDExtensions - true - - - .\sockets__$(Platform)_$(Configuration)/sockets.pch - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - Level3 - true - ProgramDatabase - Cdecl - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - - - - - /MP %(AdditionalOptions) - OnlyExplicitInline - ..\..\dep\include\sockets;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - NotSet - true - - - .\sockets__$(Platform)_$(Configuration)/sockets.pch - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - Level3 - true - ProgramDatabase - Cdecl - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - - - - - /MP %(AdditionalOptions) - Disabled - ..\..\dep\include\sockets;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;MANGOS_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - true - - - .\sockets__$(Platform)_$(Configuration)\sockets.pch - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - Level3 - true - ProgramDatabase - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - - - - - /MP %(AdditionalOptions) - Disabled - ..\..\dep\include\sockets;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;MANGOS_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - true - - - .\sockets__$(Platform)_$(Configuration)\sockets.pch - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - Level3 - true - ProgramDatabase - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - - - - - /MP %(AdditionalOptions) - Disabled - ..\..\dep\include\sockets;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;MANGOS_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - true - - - .\sockets__$(Platform)_$(Configuration)\sockets.pch - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - Level3 - true - ProgramDatabase - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - - - - - /MP %(AdditionalOptions) - Disabled - ..\..\dep\include\sockets;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;MANGOS_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - true - true - - - .\sockets__$(Platform)_$(Configuration)\sockets.pch - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - .\sockets__$(Platform)_$(Configuration)\ - Level3 - true - ProgramDatabase - Cdecl - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/VC100/sockets.vcxproj.filters b/win/VC100/sockets.vcxproj.filters deleted file mode 100644 index 5bda46517..000000000 --- a/win/VC100/sockets.vcxproj.filters +++ /dev/null @@ -1,147 +0,0 @@ - - - - - {5492dc55-e812-4298-9858-9034cd13e99d} - - - {d2011f92-6bd4-4149-9c70-66433c115994} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/win/VC80/sockets.vcproj b/win/VC80/sockets.vcproj deleted file mode 100644 index 9d057f5dd..000000000 --- a/win/VC80/sockets.vcproj +++ /dev/null @@ -1,679 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win/VC90/sockets.vcproj b/win/VC90/sockets.vcproj deleted file mode 100644 index 175f23a68..000000000 --- a/win/VC90/sockets.vcproj +++ /dev/null @@ -1,683 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win/mangosdVC100.sln b/win/mangosdVC100.sln index 02dbd0595..6d5ae1457 100644 --- a/win/mangosdVC100.sln +++ b/win/mangosdVC100.sln @@ -32,7 +32,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "realmd", "VC100\realmd.vcxproj", "{563E9905-3657-460C-AE63-0AC39D162E23}" ProjectSection(ProjectDependencies) = postProject {90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED} - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} = {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "VC100\script.vcxproj", "{4205C8A9-79B7-4354-8064-F05FB9CA0C96}" @@ -42,8 +41,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "VC100\script.vcxp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC100\g3dlite.vcxproj", "{8072769E-CF10-48BF-B9E1-12752A5DAC6E}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC100\sockets.vcxproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genrevision", "VC100\genrevision.vcxproj", "{803F488E-4C5A-4866-8D5C-1E6C03C007C2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACE_Wrappers", "VC100\ACE_vc10.vcxproj", "{BD537C9A-FECA-1BAD-6757-8A6348EA12C8}" @@ -161,18 +158,6 @@ Global {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|Win32.Build.0 = Release|Win32 {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.ActiveCfg = Release|X64 {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.Build.0 = Release|X64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|Win32.ActiveCfg = Debug_NoPCH|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|Win32.Build.0 = Debug_NoPCH|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|x64.ActiveCfg = Debug_NoPCH|X64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|x64.Build.0 = Debug_NoPCH|X64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|Win32.ActiveCfg = Debug|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|Win32.Build.0 = Debug|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|x64.ActiveCfg = Debug|X64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|x64.Build.0 = Debug|X64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.ActiveCfg = Release|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.Build.0 = Release|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.ActiveCfg = Release|X64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.Build.0 = Release|X64 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|Win32.ActiveCfg = Debug_NoPCH|Win32 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|Win32.Build.0 = Debug_NoPCH|Win32 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|x64.ActiveCfg = Debug_NoPCH|Win32 diff --git a/win/mangosdVC80.sln b/win/mangosdVC80.sln index ea59b29bd..e9568a73e 100644 --- a/win/mangosdVC80.sln +++ b/win/mangosdVC80.sln @@ -29,7 +29,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "realmd", "VC80\realmd.vcproj", "{563E9905-3657-460C-AE63-0AC39D162E23}" ProjectSection(ProjectDependencies) = postProject {90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED} - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} = {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "VC80\script.vcproj", "{4205C8A9-79B7-4354-8064-F05FB9CA0C96}" @@ -39,8 +38,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "VC80\script.vcpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC80\g3dlite.vcproj", "{8072769E-CF10-48BF-B9E1-12752A5DAC6E}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC80\sockets.vcproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genrevision", "VC80\genrevision.vcproj", "{803F488E-4C5A-4866-8D5C-1E6C03C007C2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACE_Wrappers", "VC80\ACE_vc8.vcproj", "{AD537C9A-FECA-1BAD-6757-8A6348EA12C8}" @@ -158,18 +155,6 @@ Global {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|Win32.Build.0 = Release|Win32 {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.ActiveCfg = Release|x64 {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.Build.0 = Release|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|Win32.ActiveCfg = Debug_NoPCH|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|Win32.Build.0 = Debug_NoPCH|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|x64.ActiveCfg = Debug_NoPCH|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|x64.Build.0 = Debug_NoPCH|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|Win32.ActiveCfg = Debug|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|Win32.Build.0 = Debug|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|x64.ActiveCfg = Debug|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|x64.Build.0 = Debug|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.ActiveCfg = Release|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.Build.0 = Release|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.ActiveCfg = Release|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.Build.0 = Release|x64 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|Win32.ActiveCfg = Debug_NoPCH|Win32 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|Win32.Build.0 = Debug_NoPCH|Win32 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|x64.ActiveCfg = Debug_NoPCH|Win32 diff --git a/win/mangosdVC90.sln b/win/mangosdVC90.sln index 0a4983991..73b3a47b5 100644 --- a/win/mangosdVC90.sln +++ b/win/mangosdVC90.sln @@ -31,7 +31,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "realmd", "VC90\realmd.vcproj", "{563E9905-3657-460C-AE63-0AC39D162E23}" ProjectSection(ProjectDependencies) = postProject {90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED} - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} = {04BAF755-0D67-46F8-B1C6-77AE5368F3CB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "VC90\script.vcproj", "{4205C8A9-79B7-4354-8064-F05FB9CA0C96}" @@ -41,8 +40,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "script", "VC90\script.vcpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC90\g3dlite.vcproj", "{8072769E-CF10-48BF-B9E1-12752A5DAC6E}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC90\sockets.vcproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genrevision", "VC90\genrevision.vcproj", "{803F488E-4C5A-4866-8D5C-1E6C03C007C2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACE_Wrappers", "VC90\ACE_vc9.vcproj", "{BD537C9A-FECA-1BAD-6757-8A6348EA12C8}" @@ -160,18 +157,6 @@ Global {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|Win32.Build.0 = Release|Win32 {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.ActiveCfg = Release|x64 {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.Build.0 = Release|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|Win32.ActiveCfg = Debug_NoPCH|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|Win32.Build.0 = Debug_NoPCH|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|x64.ActiveCfg = Debug_NoPCH|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug_NoPCH|x64.Build.0 = Debug_NoPCH|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|Win32.ActiveCfg = Debug|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|Win32.Build.0 = Debug|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|x64.ActiveCfg = Debug|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Debug|x64.Build.0 = Debug|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.ActiveCfg = Release|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|Win32.Build.0 = Release|Win32 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.ActiveCfg = Release|x64 - {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}.Release|x64.Build.0 = Release|x64 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|Win32.ActiveCfg = Debug_NoPCH|Win32 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|Win32.Build.0 = Debug_NoPCH|Win32 {803F488E-4C5A-4866-8D5C-1E6C03C007C2}.Debug_NoPCH|x64.ActiveCfg = Debug_NoPCH|Win32 From 47186c05ecdc5809e0c2fd68166e09be45c77937 Mon Sep 17 00:00:00 2001 From: Derex Date: Thu, 20 May 2010 02:10:06 +0300 Subject: [PATCH 068/172] [9940] Fix typo in AuthSocket.cpp --- src/realmd/AuthSocket.cpp | 1 - src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 6ca0fae93..848579b97 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -755,7 +755,6 @@ bool AuthSocket::_HandleReconnectChallenge() DEBUG_LOG("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); _login = (const char*)ch->I; - _build = ch->build; _safelogin = _login; loginDatabase.escape_string(_safelogin); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 691aef8cc..aae7db8f4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9939" + #define REVISION_NR "9940" #endif // __REVISION_NR_H__ From f14c0e319f9502e0572aede1c68df89edbfec31e Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 20 May 2010 09:28:36 +0200 Subject: [PATCH 069/172] [9941] Add additional check for UNIT_NPC_FLAG_GOSSIP before using TalkedToCreature Signed-off-by: NoFantasy --- src/game/Player.cpp | 13 ++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index dd43dc533..55fee16a2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12590,6 +12590,10 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) switch(itr->second.option_id) { + case GOSSIP_OPTION_GOSSIP: + if (itr->second.action_menu_id) // has sub menu, so do not "talk" with this NPC yet + canTalkToCredit = false; + break; case GOSSIP_OPTION_QUESTGIVER: PrepareQuestMenu(pSource->GetGUID()); hasMenuItem = false; @@ -12635,10 +12639,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (getClass() != CLASS_HUNTER) hasMenuItem = false; break; - case GOSSIP_OPTION_GOSSIP: - if (itr->second.action_menu_id) // has sub menu, so do not "talk" with this NPC yet - canTalkToCredit = false; - break; case GOSSIP_OPTION_SPIRITGUIDE: case GOSSIP_OPTION_INNKEEPER: case GOSSIP_OPTION_BANKER: @@ -12702,7 +12702,10 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) } if (canTalkToCredit) - TalkedToCreature(((Creature*)pSource)->GetEntry(), ((Creature*)pSource)->GetGUID()); + { + if (pSource->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + TalkedToCreature(((Creature*)pSource)->GetEntry(), ((Creature*)pSource)->GetGUID()); + } // some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) /*if (pMenu->Empty()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index aae7db8f4..60468c070 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9940" + #define REVISION_NR "9941" #endif // __REVISION_NR_H__ From 4f4bf7f45dbb1bae92c1b6ea17a4bf9ef9adfd36 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 21 May 2010 01:25:10 +0400 Subject: [PATCH 070/172] [9942] Output ACE version at realmd start. --- src/realmd/Main.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 98a27d9e1..351542ebf 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -177,6 +177,8 @@ extern int main(int argc, char **argv) DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]"); } + DETAIL_LOG("Using ACE: %s", ACE_VERSION); + #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 60468c070..9c18af725 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9941" + #define REVISION_NR "9942" #endif // __REVISION_NR_H__ From bca866cd8c9da697e1096a4497c3e8abb9d864fe Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Fri, 21 May 2010 00:14:19 +0200 Subject: [PATCH 071/172] [9943] Add a small delay for npc despawn related to spell 51840 This will solve problem with summoned GO that does not appear before later, but does not solve problem with visual effects (which is a generic problem with many spells). Signed-off-by: NoFantasy --- src/game/SpellEffects.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index cff9c474d..63602595b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1504,7 +1504,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } } - ((Creature*)unitTarget)->ForcedDespawn(); + ((Creature*)unitTarget)->ForcedDespawn(5000); return; } case 51866: // Kick Nass diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9c18af725..d1d8d0656 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9942" + #define REVISION_NR "9943" #endif // __REVISION_NR_H__ From 36a76e38a9fe0b29c3c01b6ffd8b895e28c4236f Mon Sep 17 00:00:00 2001 From: j4r0d Date: Fri, 21 May 2010 05:34:59 +0400 Subject: [PATCH 072/172] [9944] Implement spell 633 and ranks self casting restrictions in 3.3.x Signed-off-by: VladimirMangos --- src/game/Spell.cpp | 33 +++++++++++++++++++++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9c8716e1e..1c5d9bd1c 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2775,7 +2775,15 @@ void Spell::cast(bool skipCheck) AddPrecastSpell(25771); // Forbearance AddPrecastSpell(61987); // Avenging Wrath Marker } - else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x200000000000)) + // Lay on Hands + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) + { + // only for self cast + if (m_caster == m_targets.getUnitTarget()) + AddPrecastSpell(25771); // Forbearance + } + // Avenging Wrath + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000200000000000)) AddPrecastSpell(61987); // Avenging Wrath Marker break; } @@ -2790,6 +2798,7 @@ void Spell::cast(bool skipCheck) // Spirit Walk else if (m_spellInfo->Id == 58875) AddPrecastSpell(58876); + // Totem of Wrath else if (m_spellInfo->Effect[EFFECT_INDEX_0]==SPELL_EFFECT_APPLY_AREA_AURA_RAID && m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) // only for main totem spell cast AddTriggeredSpell(30708); // Totem of Wrath @@ -4247,6 +4256,16 @@ SpellCastResult Spell::CheckCast(bool strict) // Focus Magic (main spell) if (m_spellInfo->Id == 54646) return SPELL_FAILED_BAD_TARGETS; + + // Lay on Hands (self cast) + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && + m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) + { + if (target->HasAura(25771)) // Forbearance + return SPELL_FAILED_CASTER_AURASTATE; + if (target->HasAura(61987)) // Avenging Wrath Marker + return SPELL_FAILED_CASTER_AURASTATE; + } } // check pet presents @@ -4914,7 +4933,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK) { - if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player) + if (strict) //Summoning Disorientation, trigger pet stun (cast by pet so it doesn't attack player) pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID()); } else @@ -4992,7 +5011,7 @@ SpellCastResult Spell::CheckCast(bool strict) //custom check switch(m_spellInfo->Id) { - case 61336: + case 61336: // Survival Instincts if(m_caster->GetTypeId() != TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm()) return SPELL_FAILED_ONLY_SHAPESHIFT; break; @@ -5217,7 +5236,9 @@ SpellCastResult Spell::CheckCasterAuras() const // Flag drop spells totally immuned to caster auras // FIXME: find more nice check for all totally immuned spells // AttributesEx3 & 0x10000000? - if(m_spellInfo->Id == 23336 || m_spellInfo->Id == 23334 || m_spellInfo->Id == 34991) + if (m_spellInfo->Id == 23336 || // Alliance Flag Drop + m_spellInfo->Id == 23334 || // Horde Flag Drop + m_spellInfo->Id == 34991) // Summon Netherstorm Flag return SPELL_CAST_OK; uint8 school_immune = 0; @@ -5240,7 +5261,7 @@ SpellCastResult Spell::CheckCasterAuras() const dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); } // immune movement impairment and loss of control - if (m_spellInfo->Id == 42292) + if (m_spellInfo->Id == 42292) // PvP Trinket mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } @@ -6072,7 +6093,7 @@ bool Spell::CheckTargetCreatureType(Unit* target) const { uint32 spellCreatureTargetMask = m_spellInfo->TargetCreatureType; - // Curse of Doom & Exorcism: not find another way to fix spell target check :/ + // Curse of Doom: not find another way to fix spell target check :/ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == 1179) { // not allow cast at player diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d1d8d0656..1ac7b92de 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9943" + #define REVISION_NR "9944" #endif // __REVISION_NR_H__ From 33c9af577c4dbbd629eb661bc9190437b40297d5 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 21 May 2010 05:49:26 +0400 Subject: [PATCH 073/172] [9945] Update mangos_spell_check.sql * Add all data from Spell.cpp * Add missing data from recent commist for added parts of SpellEffect.cpp --- sql/mangos_spell_check.sql | 191 ++++++++++++++++++++++++++++++++----- src/game/SpellEffects.cpp | 24 ++--- src/shared/revision_nr.h | 2 +- 3 files changed, 180 insertions(+), 37 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index 322bc7d86..ff06b3859 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -16,8 +16,9 @@ /* re-adding before command use. So need just adding new line to file. */ /* Current table fill progress state: */ -/* SpellEffect.cpp from start until end of Spell::EffectTameCreature */ -/* at 9ba5ff723a68e397a53b3ffe5ec8d749e8ba3eab [9690] state */ +/* SpellEffect.cpp from start until end of Spell::EffectTameCreature */ +/* Spell.cpp */ +/* at 6ee669d1d52581d4707c6475b512e6cc53844121 [9944] state */ DROP TABLE IF EXISTS spell_check; CREATE TABLE `spell_check` ( @@ -39,11 +40,13 @@ CREATE TABLE `spell_check` ( INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code) VALUES /* sorted by spell ids */ /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ -(1454, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), -(1455, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), -(1456, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (1535, 11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), +(1784, 8, -1, -1, -1, -1, -1, -1, -1,-1,'Stealth', 'Spell::EffectTriggerSpell'), (2584, -1, -1, -1, -1, -1, -1, -1, 4,-1,'Waiting to Resurrect', 'Spell::EffectSpiritHeal'), +(2641, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Dismiss Pet', 'Spell::CheckTargetCreatureType'), +(2764, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Throw', 'Spell::CheckCast'), +(2825, 11, -1, -1, -1, -1, -1, -1, -1,-1,'Bloodlust', 'Spell::cast'), +(6788, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Weakened Soul', 'Spell::cast'), (9512, -1, -1, -1, -1, -1, -1, 30, -1,-1,'Restore Energy', 'Spell::EffectEnergize'), (4073, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Mechanical Dragonling', 'Spell::EffectDummy'), (5938, 8, -1, -1, -1, -1, -1, 3, -1,-1,'Shiv', 'Spell::EffectDummy'), @@ -73,9 +76,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (11307,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (11314,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (11315,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), -(11687, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), -(11688, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), -(11689, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), +(11196,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Recently Bandaged', 'Spell::cast'), (11958, 3, -1, -1, -1, -1, -1, 3, -1,-1,'Cold Snap', 'Spell::EffectDummy'), (12749,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mithril Mechanical Dragonling', 'Spell::EffectDummy'), (12975, 4, -1, -1, -1, -1, -1, 3, -1,-1,'Last Stand', 'Spell::EffectDummy'), @@ -86,29 +87,33 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (13166,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Gnomish Battle Chicken', 'Spell::EffectDummy'), (13567, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Dummy Trigger', 'Spell::EffectDummy'), (14185, 8, -1, -1, -1, -1, -1, 3, -1,-1,'Preparation', 'Spell::EffectDummy'), +(15237, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(15430, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(15431, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (15998, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Capture Worg Pup', 'Spell::EffectDummy'), (16566,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Net-o-Matic', 'Spell::EffectDummy'), (16589, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Noggenfogger Elixir', 'Spell::EffectDummy'), (16591,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Noggenfogger Elixir', 'Spell::EffectDummy'), (16593,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Noggenfogger Elixir', 'Spell::EffectDummy'), (16595,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Noggenfogger Elixir', 'Spell::EffectDummy'), +(16857, 7, -1, -1, -1, -1, -1, -1, -1,-1,'Faerie Fire', 'Spell::cast'), (17251, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Spirit Healer Res', 'Spell::EffectDummy'), (17269,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Resonating Skull', 'Spell::EffectDummy'), (17270,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Bone Dust', 'Spell::EffectDummy'), (17271, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Test Fetid Skull', 'Spell::EffectDummy'), -(18789,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), -(18790,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), -(18791,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), -(18792,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), (19658,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Devour Magic Effect', 'Spell::EffectDispel'), (19804,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Arcanite Dragonling', 'Spell::EffectDummy'), (19823,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova Visual', 'Spell::EffectDummy'), (20167,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Seal of Light', 'Spell::EffectHeal'), (20187,10, -1, -1, -1, -1, -1, 2, -1,-1,'Judgement of Righteousness', 'Spell::EffectSchoolDMG'), (20253, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Intercept', 'Spell::EffectSchoolDMG'), +(20424,10, -1, -1, -1, -1, -1, -1, -1,-1,'Seal of Command', 'Spell::SetTargetMap'), (20473,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), +(20577,-1, -1, -1, -1, -1, -1, 3, -1,-1,'Cannibalize', 'Spell::CheckTarget'), (20577, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Cannibalize', 'Spell::EffectDummy'), +(20577,-1, -1, -1, -1, -1, -1, 3, -1,-1,'Cannibalize', 'Spell::SetTargetMap'), (20578,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cannibalize', 'Spell::EffectDummy'), +(20594, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Stoneskin', 'Spell::cast'), (20647,-1, -1, -1, -1, -1, -1, 2, -1, 0,'Execute', 'Spell::EffectDummy'), (20929,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (20930,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), @@ -121,6 +126,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (23076, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Mechanical Dragonling', 'Spell::EffectDummy'), (23133, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Gnomish Battle Chicken', 'Spell::EffectDummy'), (23170,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Brood Affliction: Bronze', 'Spell::EffectDummy'), +(23334,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Horde Flag Drop', 'Spell::CheckCasterAuras'), +(23336,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Alliance Flag Drop', 'Spell::CheckCasterAuras'), +(23356,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Taming Lesson', 'Spell::CheckTargetCreatureType'), (23441,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Gadgetzan Transporter', 'Spell::EffectDummy'), (23442,-1, -1, -1, -1, -1, -1, 5, -1,-1,'Everlook Transporter', 'Spell::EffectTeleportUnits'), (23444,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Transporter Malfunction', 'Spell::EffectDummy'), @@ -130,6 +138,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (23448, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Transporter Arrival', 'Spell::EffectDummy'), (23449,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Transporter Malfunction', 'Spell::EffectTeleportUnits'), (23453, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Gnomish Transporter', 'Spell::EffectDummy'), +(23455,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(23458,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(23459,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (23645, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Hourglass Sand', 'Spell::EffectDummy'), (23725, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Gift of Life', 'Spell::EffectDummy'), (23782,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Gift of Life', 'Spell::EffectDummy'), @@ -141,11 +152,15 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (24532,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Burst of Energy', 'Spell::EffectEnergize'), (24571,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Blood Fury', 'Spell::EffectEnergize'), (24575,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Brittle Armor', 'Spell::EffectTriggerSpell'), +(25329,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(25331, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (25535,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (25537,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (25546,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (25547,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (25599, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Thundercrash', 'Spell::EffectSchoolDMG'), +(25771,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Forbearance', 'Spell::cast'), +(25771,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Forbearance', 'Spell::CheckCast'), (25858,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Reindeer', 'Spell::EffectDummy'), (25859,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Reindeer', 'Spell::EffectDummy'), (25860, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Reindeer Transformation', 'Spell::EffectDummy'), @@ -155,6 +170,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (25912,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (25913,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (25914,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), +(25991, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Poison Bolt Volley (Pincess Huhuran)','Spell::SetTargetMap'), (26074, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Holiday Cheer', 'Spell::EffectDummy'), (26464,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mercurial Shield', 'Spell::EffectTriggerSpell'), (26467,-1, -1, -1, -1, -1, -1, 6, 42, 0,'Persistent Shield', 'Spell::EffectDummy'), @@ -163,11 +179,19 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (27174,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (27175,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (27176,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), -(27222, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), +(27799, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(27800, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(27801, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(27803,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(27804,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(27805,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (28006, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Arcane Cloaking', 'Spell::EffectDummy'), (28305,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mana Leech', 'Spell::EffectTriggerSpell'), +(28542, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Life Drain', 'Spell::SetTargetMap'), +(28796, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Poison Bolt Volley', 'Spell::SetTargetMap'), (28884, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), (29142, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Eyesore Blaster', 'Spell::EffectSchoolDMG'), +(29213, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Curse of the Plaguebringer', 'Spell::SetTargetMap'), (29294,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Naxxramas Entry Flag Effect DND', 'Spell::EffectDummy'), (29200, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Purify Helboar Meat', 'Spell::EffectDummy'), (29277,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Purified Helboar Meat', 'Spell::EffectDummy'), @@ -182,8 +206,12 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (30501,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Poultryized!', 'Spell::EffectDummy'), (30504,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Poultryized!', 'Spell::EffectDummy'), (30507, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Poultryizer', 'Spell::EffectDummy'), +(30708,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Totem of Wrath', 'Spell::cast'), +(30843, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Enfeeble', 'Spell::SetTargetMap'), (31225, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Shimmering Vessel', 'Spell::EffectDummy'), (31231, 8, -1, -1, -1, -1, -1, 3, -1,-1,'Cheat Death', 'Spell::EffectDummy'), +(31298, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Sleep', 'Spell::SetTargetMap'), +(31347, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Doom', 'Spell::SetTargetMap'), (31436, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Malevolent Cleave', 'Spell::EffectSchoolDMG'), (31687, 3, -1, -1, -1, -1, -1, 3, -1,-1,'Summon Water Elemental', 'Spell::EffectDummy'), (31789,10, -1, -1, -1, -1, -1, 3, -1, 0,'Righteous Defense', 'Spell::EffectDummy'), @@ -191,8 +219,10 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (31803,-1, -1, -1, -1, -1, -1, 6, 3,-1,'Holy Vengeance', 'Spell::EffectSchoolDMG'), (31818,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Life Tap', 'Spell::EffectDummy'), (31930,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Judgements of the Wise', 'Spell::EffectEnergize'), +(32182,11, -1, -1, -1, -1, -1, -1, -1,-1,'Heroism', 'Spell::cast'), (32409,-1, -1, -1, -1, -1, -1, 6, 3,-1,'Shadow Word: Death', 'Spell::EffectSchoolDMG'), (32553,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Life Tap', 'Spell::EffectDummy'), +(32752,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Summoning Disorientation', 'Spell::CheckCast'), (32813,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Squirrel Form', 'Spell::EffectDummy'), (32816,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Giraffe Form', 'Spell::EffectDummy'), (32817,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Serpent Form', 'Spell::EffectDummy'), @@ -210,10 +240,11 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (33072,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (33073,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (33074,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), +(33711, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Murmur\'s Touch', 'Spell::SetTargetMap'), (34846,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Charge', 'Spell::EffectDummy'), +(34991,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Netherstorm Flag', 'Spell::CheckCasterAuras'), (35139, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Throw Boom\'s Doom', 'Spell::EffectSchoolDMG'), (35181, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Dive Bomb', 'Spell::EffectSchoolDMG'), -(35701,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), (35743,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Socrethar Portal', 'Spell::EffectDummy'), (35744,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Socrethar Portal', 'Spell::EffectDummy'), (35745, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Socrethar\'s Stone', 'Spell::EffectDummy'), @@ -249,16 +280,24 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (37881,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Blessing of Lower City', 'Spell::EffectDummy'), (38441, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Cataclysmic Bolt', 'Spell::EffectSchoolDMG'), (38615,-1, -1, -1, -1, -1, -1, 54, -1,-1,'Poison', 'Spell::EffectEnchantItemTmp'), +(38794, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Murmur\'s Touch (h)', 'Spell::SetTargetMap'), (38903, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), (39609,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Mana Tide Totem', 'Spell::EffectDummy'), (39610,11, -1, -1, -1, -1, -1, 3, -1,-1,'Mana Tide Totem effect', 'Spell::EffectDummy'), (40802, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Mingo\'s Fortune Generator', 'Spell::EffectDummy'), (40810, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Saber Lash', 'Spell::EffectSchoolDMG'), (41276, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), +(41425,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hypothermia', 'Spell::cast'), +(41617,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cenarion Mana Salve', 'Spell::SendCastResult'), +(41618,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Bottled Nethergon Energy', 'Spell::SendCastResult'), +(41619,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cenarion Healing Salve', 'Spell::SendCastResult'), +(41620,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Bottled Nethergon Vapor', 'Spell::SendCastResult'), (41637,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Prayer of Mending', 'Spell::cast'), +(42005, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Bloodboil', 'Spell::SetTargetMap'), (42287, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Salvage Wreckage', 'Spell::EffectDummy'), (42288,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Salvage Wreckage', 'Spell::EffectDummy'), (42289,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Salvage Wreckage', 'Spell::EffectDummy'), +(42292,-1, -1, -1, -1, -1, -1, -1, -1,-1,'PvP Trinket', 'Spell::CheckCasterAuras'), (42337,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Raptor Capture Credit', 'Spell::EffectDummy'), (42384, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Brutal Swipe', 'Spell::EffectSchoolDMG'), (43036, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Dismembering Corpse', 'Spell::EffectDummy'), @@ -276,6 +315,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (43900,-1, -1, -1, -1, -1, -1, -1, 78,-1,'Swift Brewfest Ram', 'Spell::EffectDummy'), (44454, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Tasty Reef Fish', 'Spell::EffectDummy'), (44455,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Tasty Reef Fish', 'Spell::EffectDummy'), +(44462, 0, -1, -1, -1, -1, -1, 77, -1,-1,'The Way to His Heart...: Cast Quest Complete on Master','Spell::EffectScriptEffect'), (44824,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flying Reindeer', 'Spell::EffectDummy'), (44825,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flying Reindeer', 'Spell::EffectDummy'), (44827,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flying Reindeer', 'Spell::EffectDummy'), @@ -288,6 +328,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (45088,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Emissary of Hate Credit', 'Spell::EffectDummy'), (45150, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor Slash', 'Spell::EffectSchoolDMG'), (45182,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cheat Death', 'Spell::EffectDummy'), +(45373,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Bloodberry Elixir', 'Spell::SendCastResult'), (45470,-1, -1, -1, -1, -1, -1, 10, -1, 0,'Intercept', 'Spell::EffectDummy'), (45672,-1, -1, -1, -1, -1, -1, -1, 61,-1,'Shrunk', 'Spell::EffectDummy'), (45673,-1, -1, -1, -1, -1, -1, -1, 61,-1,'Bigger!', 'Spell::EffectDummy'), @@ -303,11 +344,21 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (46167, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Planning for the Future: Create Snowfall Glade Pup Cover','Spell::EffectDummy'), (46485, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Greatmother\'s Soulcatcher', 'Spell::EffectDummy'), (46486,-1, -1, -1, -1, -1, -1, -1, -1, 0,'Greatmother\'s Soulcatcher', 'Spell::EffectDummy'), +(46699,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Requires No Ammo', 'Spell::CheckItems'), (46606, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Plague Canister Dummy', 'Spell::EffectDummy'), (46773,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Planning for the Future: Create Snowfall Glade Pup Cover','Spell::EffectDummy'), (46797, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Quest - Borean Tundra - Set Explosives Cart','Spell::EffectDummy'), (46798,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Quest - Borean Tundra - Summon Explosives Cart','Spell::EffectDummy'), +(47390,-1, -1, -1, -1, -1, -1, -1, -1,-1,'The Focus on the Beach: Ley Line Focus Bunny Beam','Spell::EffectDummy'), +(47391, 0, -1, -1, -1, -1, -1, -1, 4,-1,'Ley Line Information', 'Spell::EffectScriptEffect'), +(47393, 0, -1, -1, -1, -1, -1, 77, -1,-1,'The Focus on the Beach: Ley Line Focus Bunny Beam','Spell::EffectScriptEffect'), +(47472,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Atop the Woodlands: Ley Line Focus Bunny Beam','Spell::EffectDummy'), +(47473, 0, -1, -1, -1, -1, -1, -1, 4,-1,'Ley Line Information', 'Spell::EffectScriptEffect'), (47540, 6,0x0080000000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Penance', 'Spell::EffectDummy'), +(47615, 0, -1, -1, -1, -1, -1, 77, -1,-1,'The End of the Line: Ley Line Focus Bunny Beam','Spell::EffectScriptEffect'), +(47635,-1, -1, -1, -1, -1, -1, -1, -1,-1,'The End of the Line: Ley Line Focus Bunny Beam','Spell::EffectDummy'), +(47636, 0, -1, -1, -1, -1, -1, -1, 4,-1,'Ley Line Information', 'Spell::EffectScriptEffect'), +(47638, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Atop the Woodlands: Ley Line Focus Bunny Beam','Spell::EffectScriptEffect'), (47632,-1, -1, -1, -1, -1, -1, 2, -1, 0,'Death Coil', 'Spell::EffectDummy'), (47633,-1, -1, -1, -1, -1, -1, 10, -1, 0,'Death Coil', 'Spell::EffectDummy'), (47757,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Penance', 'Spell::EffectDummy'), @@ -317,9 +368,15 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (48023,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), (48024,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), (48025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), +(48075,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(48076,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(48077, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), +(48078, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (48301,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mind Trauma', 'Spell::EffectSchoolDMG'), (48542,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Revitalize', 'Spell::EffectEnergize'), +(48743,-1, -1, -1, -1, -1, -1, 1, -1,-1,'Death Pact', 'Spell::CheckCast'), (48743,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Death Pact', 'Spell::EffectHeal'), +(48743,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Death Pact', 'Spell::SetTargetMap'), (48820,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (48821,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (48822,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Shock', 'Spell::EffectDummy'), @@ -336,6 +393,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (50246,-1, -1, -1, -1, -1, -1, -1, -1,-1,'01001000', 'Spell::EffectDummy'), (50286, 7,0x0000000000000000,0x00000100, -1, -1, -1, 3, -1,-1,'Starfall', 'Spell::EffectDummy'), (50288,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Starfall', 'Spell::EffectDummy'), +(50546, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Ley Line Focus Control Ring Effect', 'Spell::EffectDummy'), +(50547, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Ley Line Focus Control Amulet Effect','Spell::EffectDummy'), +(50548, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Ley Line Focus Control Talisman Effect','Spell::EffectDummy'), (50737,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Drakkari Medallion Cover', 'Spell::EffectDummy'), (50782,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Slam', 'Spell::EffectDummy'), (50926, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Gluttonous Lurkers: Create Zul\'Drak Rat Cover','Spell::EffectDummy'), @@ -355,20 +415,39 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (51366,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Shoot RJR', 'Spell::EffectDummy'), (51370,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Dig For Treasure', 'Spell::EffectDummy'), (51582, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::EffectDummy'), +(51582,-1, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::CheckCast'), (51592, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'), (51593,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'), (51617,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), (51621,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'), +(51723, 8, -1, -1, -1, -1, -1, -1, -1,-1,'Fan of Knives', 'Spell::cast'), +(51836,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Bananas Fall to Ground', 'Spell::EffectDummy'), +(51837,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Orange Falls to Ground', 'Spell::EffectDummy'), +(51839,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Papaya Falls to Ground', 'Spell::EffectDummy'), +(51840, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Despawn Fruit Tosser', 'Spell::EffectDummy'), +(51866, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Kick Nass', 'Spell::EffectDummy'), +(51870,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Collect Hair Sample', 'Spell::EffectDummy'), +(51871,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Nass Kill Credit', 'Spell::EffectDummy'), +(51872, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Hair Sample Collected', 'Spell::EffectDummy'), (51961, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Captured Chicken Cover', 'Spell::EffectDummy'), +(51964, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Tormentor\'s Incense', 'Spell::EffectDummy'), +(51967, 0, -1, -1, -1, -1, -1, -1,168,-1,'Mojo of Rhunok', 'Spell::EffectScriptEffect'), (52025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cleansing Totem Effect', 'Spell::EffectDummy'), (52032,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Mana Spring Totem', 'Spell::EffectDummy'), (52042,-1, -1, -1, -1, -1, -1, 10, -1, 0,'Healing Stream Totem', 'Spell::EffectDummy'), +(52070,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Adventurous Dwarf', 'Spell::EffectDummy'), (52308, 0, -1, -1, -1, -1, -1, 3, -1, 0,'Take Sputum Sample', 'Spell::EffectDummy'), (52308, 0, -1, -1, -1, -1, -1, 3, -1, 1,'Take Sputum Sample', 'Spell::EffectDummy'), (52437,-1, -1, -1, -1, -1, -1, 6, -1, 0,'Sudden Death', 'Spell::EffectDummy'), (52752,-1, -1, -1, -1, -1, -1, 10, -1, 0,'Ancestral Awakening', 'Spell::EffectDummy'), (52759, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Ancestral Awakening', 'Spell::EffectDummy'), +(52759,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Ancestral Awakening', 'Spell::SetTargetMap'), (52845,-1, -1, -1, -1, -1, -1, 3, -1,-1,'Brewfest Mount Transformation (Faction Swap)','Spell::EffectDummy'), +(52874,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fan of Knives', 'Spell::cast'), +(52941, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Song of Cleansing', 'Spell::EffectScriptEffect'), +(52954, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Spirit', 'Spell::EffectScriptEffect'), +(52958, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Spirit', 'Spell::EffectScriptEffect'), +(52959, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Spirit', 'Spell::EffectScriptEffect'), (52986,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Penance', 'Spell::EffectDummy'), (52987,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Penance', 'Spell::EffectDummy'), (52988,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Penance', 'Spell::EffectDummy'), @@ -390,14 +469,23 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (53343, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rune of Razorice', 'Spell::EffectDummy'), (53478, 9, -1, -1, -1, -1, -1, 3, -1,-1,'Last Stand', 'Spell::EffectDummy'), (53479,-1, -1, -1, -1, -1, -1, -1, 34, 0,'Last Stand', 'Spell::EffectDummy'), +(53563,-1, -1, -1, -1, -1, -1, -1, 23,-1,'Beacon of Light', 'Aura::HandlePeriodicTriggerSpell'), +(53563,-1, -1, -1, -1, -1, -1, -1, 23,-1,'Beacon of Light', 'Unit::HandleDummyAuraProc'), +(53805, 0, -1, -1, -1, -1, -1, -1,239,-1,'Pygmy Oil', 'Spell::EffectDummy'), +(53806,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Pygmy Oil', 'Spell::EffectDummy'), +(53808,-1, -1, -1, -1, -1, -1, 3, -1,-1,'Pygmy Oil', 'Spell::EffectDummy'), (54049, 5,0x0040000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadow Bite', 'Spell::EffectSchoolDMG'), (54050, 5,0x0040000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadow Bite', 'Spell::EffectSchoolDMG'), (54051, 5,0x0040000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadow Bite', 'Spell::EffectSchoolDMG'), (54052, 5,0x0040000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadow Bite', 'Spell::EffectSchoolDMG'), (54053, 5,0x0040000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadow Bite', 'Spell::EffectSchoolDMG'), +(54098, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Poison Bolt Volley (h)', 'Spell::SetTargetMap'), +(54182, 0, -1, -1, -1, -1, -1, 77, -1,-1,'An End to the Suffering: Quest Completion Script','Spell::EffectScriptEffect'), (54216,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Master''s Call', 'Spell::EffectDummy'), (54586,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Runeforging Credit', 'Spell::EffectDummy'), +(54646,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Focus Magic', 'Spell::CheckCast'), (54824,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Swiftmend', 'Spell::EffectHeal'), +(54835, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Curse of the Plaguebringer (h)', 'Spell::SetTargetMap'), (54861,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Nitro Boosts', 'Spell::EffectDummy'), (55004, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Nitro Boosts', 'Spell::EffectDummy'), (55078,-1, -1, -1, -1, -1, -1, -1, 3,-1,'Blood Plague', 'Spell::EffectScriptEffect'), @@ -411,28 +499,38 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (55441,11, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Mana Tide', 'Spell::EffectDummy'), (55456,11, -1, -1, -1, -1, -1, -1, -1,-1,'Glyph of Healing Stream Totem', 'Spell::EffectDummy'), (55528,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hurl Boulder', 'Spell::EffectDummy'), +(55665, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Life Drain (h)', 'Spell::SetTargetMap'), +(55675,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Circle of Healing', 'Spell::SetTargetMap'), (55818, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Hurl Boulder', 'Spell::EffectDummy'), +(56153,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Guardian Aura - Ahn\'Kahet', 'Spell::SetTargetMap'), (56235,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Glyph of Conflagrate', 'Spell::EffectSchoolDMG'), (56446,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Disengage', 'Spell::EffectDummy'), +(57467, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), (57627,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Charge', 'Spell::EffectSchoolDMG'), (57635, 9, -1, -1, -1, -1, -1, 3, -1,-1,'Disengage', 'Spell::EffectDummy'), (57636,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Disengage', 'Spell::EffectDummy'), -(57946, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), +(57669,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Replenishment', 'Spell::SetTargetMap'), +(57723,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Exhaustion', 'Spell::cast'), +(57724,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Sated', 'Spell::cast'), (58367,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Execution', 'Spell::EffectDummy'), (58418, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Portal to Orgrimmar', 'Spell::EffectDummy'), (58420, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Portal to Stormwind', 'Spell::EffectDummy'), (58601, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Remove Flight Auras', 'Spell::EffectDummy'), (58657,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Plague Strike', 'Spell::EffectWeaponDmg'), +(58875,11, -1, -1, -1, -1, -1, -1, -1,-1,'Spirit Walk', 'Spell::cast'), +(58876,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Spirit Walk', 'Spell::cast'), (59336,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Death Strike', 'Spell::EffectWeaponDmg'), (59332,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Blood Strike', 'Spell::EffectWeaponDmg'), (59640, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Underbelly Elixir', 'Spell::EffectDummy'), (59645,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Underbelly Elixir', 'Spell::EffectDummy'), (59831,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Underbelly Elixir', 'Spell::EffectDummy'), (59843,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Underbelly Elixir', 'Spell::EffectDummy'), +(60089,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Faerie Fire', 'Spell::cast'), (60932, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Disengage', 'Spell::EffectDummy'), (60934,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Disengage', 'Spell::EffectDummy'), (61290, 5,0x0001000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), (61291,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), +(61336,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Survival Instincts', 'Spell::CheckCast'), (61491, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Intercept', 'Spell::EffectSchoolDMG'), (61507, 9, -1, -1, -1, -1, -1, 3, -1,-1,'Disengage', 'Spell::EffectDummy'), (61508,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Disengage', 'Spell::EffectDummy'), @@ -440,6 +538,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (61650,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (61654,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (61657,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), +(61987,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Avenging Wrath Marker', 'Spell::cast'), +(61987,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Avenging Wrath Marker', 'Spell::CheckCast'), +(62124,10, -1, -1, -1, -1, -1, -1, -1,-1,'Hand of Reckoning', 'Spell::cast'), (62305,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Master''s Call', 'Spell::EffectScriptEffect'), (62775, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Tympanic Tantrum', 'Spell::EffectSchoolDMG'), (63334,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Disease', 'Spell::EffectScriptEffect'), @@ -448,6 +549,10 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (64688, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor Slash', 'Spell::EffectSchoolDMG'), (66765,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Meteor Fists', 'Spell::EffectWeaponDmg'), (66809,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Meteor Fists', 'Spell::EffectWeaponDmg'), +(64844,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Divine Hymn', 'Spell::SetTargetMap'), +(64904,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hymn of Hope', 'Spell::SetTargetMap'), +(65116,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Stoneskin', 'Spell::cast'), +(66013, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Penetrating Cold', 'Spell::SetTargetMap'), (67016,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flask of the North', 'Spell::EffectDummy'), (67017,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flask of the North', 'Spell::EffectDummy'), (67018,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flask of the North', 'Spell::EffectDummy'), @@ -455,7 +560,11 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (67331,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Meteor Fists', 'Spell::EffectWeaponDmg'), (67333,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Meteor Fists', 'Spell::EffectWeaponDmg'), (67485, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Hand of Rekoning', 'Spell::EffectSchoolDMG'), +(67485,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hand of Rekoning', 'Spell::cast'), +(67700, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Penetrating Cold', 'Spell::SetTargetMap'), (68082,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Glyph of Seal of Command', 'Spell::EffectEnergize'), +(68509, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Penetrating Cold', 'Spell::SetTargetMap'), +(68510, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Penetrating Cold', 'Spell::SetTargetMap'), (69055,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Bone Slice', 'Spell::EffectWeaponDmg'), (70492, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'), (70907,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Summon Water Elemental', 'Spell::EffectDummy'), @@ -463,6 +572,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (70937,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Eternal Water', 'Spell::EffectDummy'), (71021,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Saber Lash', 'Spell::EffectWeaponDmg'), (71904, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Chaos Bane', 'Spell::EffectSchoolDMG'), +(71904, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Chaos Bane', 'Spell::cast'), (72281, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), (72282, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), (72283, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'), @@ -472,6 +582,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (72624, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'), (72625, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'), (73422, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Chaos Bane', 'Spell::cast'), +(73422,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Chaos Bane', 'Spell::cast'), (74854, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'), (74855, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'), (74856, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'), @@ -481,13 +592,22 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (75619, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), (75620, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), (76153, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), - /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ + + + +(61832, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rifle the Bodies: Create Magehunter Personal Effects Cover','Spell::EffectDummy'), + + + + /* sorted by spell names */ /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ ( 0, 3,0x0000000020000000,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Blast', 'Spell::EffectSchoolDMG'), +( 0, 3,0x0000000000200080,0x00000000, -1, -1, -1, -1, -1,-1,'Arcane Missles / Blizzard', 'Spell::prepareDataForTriggerSystem'), ( 0, 9,0x0000000000000800,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Shot', 'Spell::EffectSchoolDMG'), +( 0,10,0x0000200000000000,0x00000000, -1, -1, -1, -1, -1,-1,'Avenging Wrath', 'Spell::cast'), ( 0,15,0x0000000000400000,0x00000000, -1, -1, -1, 31, -1,-1,'Blood Strike', 'Spell::EffectWeaponDmg'), ( 0,15, -1, -1,1736, -1, -1, 31, -1,-1,'Blood-Caked Strike', 'Spell::EffectWeaponDmg'), ( 0, 5,0x0000000000004000,0x00000000, -1, -1, -1, -1, -1,-1,'Drain Soul', 'Unit::SpellDamageBonus'), @@ -495,32 +615,47 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 4,0x0000040000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Bloodthirst', 'Spell::EffectSchoolDMG'), ( 0,11,0x0000000000000100,0x00000000, -1, -1, -1, 10, -1,-1,'Chain Healing', 'Spell::EffectHeal'), ( 0, 4,0x0000000000000001,0x00000000, -1, 867, -1, 3, -1,-1,'Charge', 'Spell::EffectDummy'), +( 0, 6, -1, -1, -1,8253, -1, -1, -1,-1,'Circle of Healing', 'Spell::SetTargetMap'), ( 0,11,0x0000000004000000,0x00000000,1673, -1, -1, 3, -1,-1,'Cleansing Totem', 'Spell::EffectDummy'), +( 0, 3,0x0000000200000000,0x00000008, -1, -1, -1, -1, -1,-1,'Clearcasting', 'Spell::prepareDataForTriggerSystem'), ( 0, 4,0x0000000004000000,0x00000000, -1, -1, -1, 3, -1,-1,'Concussion Blow', 'Spell::EffectDummy'), ( 0, 3, -1, -1, -1, -1, -1, 3, -1, 1,'Conjure Mana Gem', 'Spell::EffectDummy'), /*part 1*/ ( 0, 3, -1, -1, -1, -1, -1, 24, -1, 0,'Conjure Mana Gem', 'Spell::EffectDummy'), /*part 2*/ +( 0, 3, -1, -1, -1, -1, -1, 24, -1, 0,'Conjure Mana Gem', 'Spell::CheckItems'), ( 0, 9,0x0008000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Counterattack', 'Spell::EffectSchoolDMG'), +( 0, 5, -1, -1, -1, -1,1179, -1, -1,-1,'Curse of Doom', 'Spell::CheckTargetCreatureType'), ( 0, 8,0x0000000000010000,0x00000000, -1, -1, -1, -1, 3,-1,'Deadly poison', 'Spell::EffectSchoolDMG'), ( 0,15,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Death Coil', 'Spell::EffectDummy'), ( 0,15,0x0000000000000010,0x00000000, -1, -1, -1, 31, -1, 1,'Death Strike', 'Spell::EffectWeaponDmg'), ( 0,15,0x0000000000000010,0x00000000, -1, -1, -1, 3, -1, 2,'Death Strike', 'Spell::EffectDummy'), ( 0, 5, -1, -1, -1, -1, 12, 38, -1,-1,'Devour Magic', 'Spell::EffectDispel'), ( 0, 9,0x0000400000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Disengage', 'Spell::EffectDummy'), +( 0,10,0x0000000000400080,0x00000000, -1, -1, -1, -1, -1,-1,'Divine Shield, Divine Protection or Hand of Protection','Spell::cast'), ( 0, 8,0x0000000800000000,0x00000000, -1, -1, -1, 2, -1,-1,'Envenom', 'Spell::EffectSchoolDMG'), ( 0, 8,0x0000000000020000,0x00000000, -1, -1, -1, 2, -1,-1,'Eviscerate', 'Spell::EffectSchoolDMG'), ( 0, 4,0x0000000020000000,0x00000000, -1, -1, -1, 3, -1,-1,'Execute', 'Spell::EffectDummy'), +( 0,-1, -1, -1,1648, -1, -1, 3, -1,-1,'Execute', 'Spell::CheckCast'), ( 0, 9,0x0000000000000004,0x00000000, -1, -1, -1, 2, -1,-1,'Explosive Trap Effect', 'Spell::EffectSchoolDMG'), ( 0, 7,0x0000000000800000,0x00000000, -1,6587, -1, 2, -1,-1,'Ferocious Bite', 'Spell::EffectSchoolDMG'), +( 0,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::CheckCast'), +( 0, 5, -1, -1, 16, -1, -1, -1, -1,-1,'Fire Shield', 'Spell::CheckCast'), ( 0,11,0x0000000000200000,0x00000000, -1, -1, -1, -1, -1,-1,'Flametongue', 'Spell::EffectDummy'), ( 0, 9, -1, -1,1578, -1, -1, 2, -1,-1,'Gore', 'Spell::EffectSchoolDMG'), ( 0, 8,0x0000000000000008,0x00000000, -1, -1, -1, 2, -1,-1,'Gouge', 'Spell::EffectSchoolDMG'), ( 0,10,0x0000008000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Hammer of Wrath', 'Spell::EffectSchoolDMG'), +( 0,-1, -1, -1, -1,7250, -1, 2, -1,-1,'Hammer of Wrath', 'Spell::CheckCast'), ( 0,10,0x0004000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Hammer of the Righteous', 'Spell::EffectSchoolDMG'), +( 0, 5,0x0004000000000000,0x00000000,3172, -1, -1, -1, 4,-1,'Haunt', 'Spell::DoAllEffectOnTarget'), ( 0,11,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Healing Stream Totem', 'Spell::EffectDummy'), +( 0, 4,0x0000800000000060,0x00000000, -1, -1, -1, -1, -1,-1,'Hellfire Effect / Rain of Fire / Seed of Corruption','Spell::prepareDataForTriggerSystem'), ( 0, 4,0x0000000100000000,0x00000000, -1, -1, -1, 2, -1,-1,'Heroic Throw', 'Spell::EffectSchoolDMG'), ( 0,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), +( 0,-1, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::CheckCast'), ( 0,15,0x0000100000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Hungering Cold', 'Spell::EffectDummy'), +( 0, 9,0x0100200000000214,0x00000200, -1, -1, -1, -1, -1,-1,'Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect/Explosive Shot', 'Spell::prepareDataForTriggerSystem'), +( 0, 3,0x0000008000000000,0x00000000, -1, -1, -1, -1, -1,-1,'Ice Block', 'Spell::cast'), ( 0, 5,0x0000000000000004,0x00000000, -1, -1, -1, -1, 3,-1,'Immolate', 'Spell::EffectSchoolDMG'), +( 0, 9,0x000020000000001C,0x00000000, -1, -1, -1, -1, -1,-1,'Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap','Spell::prepareDataForTriggerSystem'), ( 0,15, -1, -1,2751, -1, -1, -1,107, 1,'Improved Death Strike', 'Spell::EffectDummy'), ( 0,15, -1, -1,2751, -1, -1, 0, 0, 2,'Improved Death Strike', 'Spell::EffectDummy'), ( 0, 5, -1, -1, 208, -1, -1, -1, 4,-1,'Improved Life Tap', 'Spell::EffectDummy'), @@ -529,8 +664,11 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 8,0x0000000000002000,0x00000000, -1, -1, -1, 2, -1,-1,'Instant Poison', 'Spell::EffectSchoolDMG'), ( 0,10, -1, -1, 561, -1, -1, 3, -1,-1,'Judgement of command', 'Spell::EffectDummy'), ( 0,10,0x0000000800000000,0x00000000,2292, -1, -1, 2, -1,-1,'Judgement of Vengeance', 'Spell::EffectSchoolDMG'), +( 0,10,0x0001000900B80400,0x00000000, -1, -1, -1, -1, -1,-1,'Judgements (all) / Holy Shock', 'Spell::prepareDataForTriggerSystem'), ( 0, 7,0x0000010000000000,0x00000000,2246, -1, -1, 2, -1,-1,'Lacerate', 'Spell::EffectSchoolDMG'), ( 0,11,0x0000000000000000,0x00000004, -1, -1, -1, 3, -1,-1,'Lava Lash', 'Spell::EffectDummy'), +( 0,10,0x0000000000008000,0x00000000, -1, -1, -1, -1, -1,-1,'Lay on Hands', 'Spell::cast'), +( 0,10,0x0000000000008000,0x00000000, -1, -1, -1, -1, -1,-1,'Lay on Hands', 'Spell::CheckCast'), ( 0, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), ( 0, 5, -1, -1,1982, -1, -1, -1,107,-1,'Mana Feed', 'Spell::EffectDummy'), ( 0,11,0x0000000000004000,0x00000000, -1, -1, -1, 3, -1,-1,'Mana Spring Totem', 'Spell::EffectDummy'), @@ -538,16 +676,23 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 8, -1, -1,1960, -1, -1, 0,246,-1,'Master Poisoner', 'Spell::EffectSchoolDMG'), ( 0, 6,0x0000000000002000,0x00000000, -1, -1, -1, 2, -1,-1,'Mind Blast', 'Spell::EffectSchoolDMG'), ( 0, 9,0x0000000000000002,0x00000000, -1, 342, -1, 2, -1,-1,'Mongoose Bite', 'Spell::EffectSchoolDMG'), +( 0, 8,0x0020000000000000,0x00000000, -1, -1, -1, -1, -1,-1,'Mutilate', 'Spell::CheckCast'), ( 0, 6,0x0080000000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Penance', 'Spell::EffectDummy'), +( 0, 6,0x0001800000800000,0x00000040, -1, -1, -1, -1, -1,-1,'Penance,Mind Sear,Mind Flay', 'Spell::prepareDataForTriggerSystem'), ( 0,15,0x0000000000000001,0x00000000, -1, -1, -1, 31, -1,-1,'Plague Strike', 'Spell::EffectWeaponDmg'), +( 0, 8,0x000000101001E000,0x00000000, -1, -1, -1, -1, -1,-1,'poisons', 'Spell::prepareDataForTriggerSystem'), +( 0, 7,0x0000000000020000,0x00000000, -1, -1, -1, -1, -1,-1,'Pounce', 'Spell::CheckCast'), +( 0, 6,0x0000000000000001,0x00000000, -1, -1, -1, -1, -1,-1,'Power Word: Shield', 'Spell::cast'), +( 0, 6,0x0000002000000000,0x00000000, -1, -1, -1, -1, -1,-1,'Prayer of Mending', 'Spell::cast'), ( 0, 6,0x0000002000000000,0x00000000, -1, -1, -1, 6, -1,-1,'Prayer of Mending', 'Spell::cast'), ( 0, 8,0x0000024000000860,0x00000000, -1, -1, -1, -1, -1,-1,'Preparation (affected spells)', 'Spell::EffectDummy'), -( 0, 7,0x0000000000000040,0x00000000, -1, -1, -1, -1, 8,-1,'Regrowth', 'Spell::EffectHeal'), -( 0, 7,0x0000000000000010,0x00000000, -1, -1, -1, -1, 8,-1,'Rejuvenation', 'Spell::EffectHeal'), ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, 2, -1,-1,'Rake', 'Spell::EffectSchoolDMG'), /* used in */ ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, 80, -1, 2,'Rake', 'Spell::EffectSchoolDMG'), /* exactly selected */ ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, -1, 3,-1,'Rake', 'Aura::HandlePeriodicDamage'), /* used in */ ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, 80, -1, 2,'Rake', 'Aura::HandlePeriodicDamage'), /* exactly selected */ +( 0, 7,0x0000000000000040,0x00000000, -1, -1, -1, -1, 8,-1,'Regrowth', 'Spell::EffectHeal'), +( 0, 7,0x0000000000000010,0x00000000, -1, -1, -1, -1, 8,-1,'Rejuvenation', 'Spell::EffectHeal'), +( 0, 3,0x0000010000000000,0x00000000, -1, -1, -1, -1, -1,-1,'Replenish Mana', 'Spell::prepareDataForTriggerSystem'), ( 0,11,0x0000000000000000,0x00000010, -1, -1, -1, -1, 8,-1,'Riptide', 'Spell::EffectHeal'), ( 0,11, -1, -1, 338, -1, -1, -1, 4, 1,'Restorative Totems', 'Spell::EffectSchoolDMG'), /*part 1*/ ( 0, 4,0x0000000000000400,0x00000000, -1, -1, -1, 2, -1,-1,'Revenge', 'Spell::EffectSchoolDMG'), @@ -564,16 +709,14 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 7,0x0000000000008000,0x00000000, -1, -1, -1, -1, -1,-1,'Shred', 'Unit::MeleeDamageBonus'), ( 0, 4,0x0000000000200000,0x00000000, -1, -1, -1, 3, -1,-1,'Slam', 'Spell::EffectDummy'), ( 0, 7,0x0000000000000000,0x00000100, -1, -1, -1, 3, -1,-1,'Starfall', 'Spell::EffectDummy'), +( 0, 7,0x0000000000000000,0x00000100, -1, -1, -1, -1, -1,-1,'Starfall', 'Spell::SetTargetMap'), ( 0, 9,0x0000000100000000,0x00000000, -1, -1, -1, 2, -1,-1,'Steady Shot', 'Spell::EffectSchoolDMG'), ( 0, 9,0x0000000100000000,0x00000000, -1, -1, -1, 3, -1,-1,'Steady Shot', 'Spell::EffectDummy'), -( 0, 8,0x0000000000400000,0x00000000, -1, -1, -1, -1, -1,-1,'Stealth', 'Spell::EffectTriggerSpell'), ( 0,-1, -1, -1,1989, -1, -1, -1, 42, 0,'Sudden Death', 'Spell::EffectDummy'), ( 0, 7,0x0010000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Swipe', 'Spell::EffectSchoolDMG'), ( 0, 4,0x0000000000000080,0x00000000, -1, -1, -1, 2, -1,-1,'Thunder Clap', 'Spell::EffectSchoolDMG'), +( 0,11,0x0000000004000000,0x00000000, -1, -1, -1, -1, -1,-1,'Totem of Wrath', 'Spell::cast'), ( 0, 4,0x0000010000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Victory Rush', 'Spell::EffectSchoolDMG'), -( 0, 8,0x0000000010000000,0x00000000, -1, -1, -1, 2, -1,-1,'Wound Poison', 'Spell::EffectSchoolDMG'), - -/* some random spells from not proccessed files sorted by spell ids */ +( 0, 7, -1, -1,2864, -1, -1, 0, -1, 2,'Wild Growth', 'Spell::SetTargetMap'), +( 0, 8,0x0000000010000000,0x00000000, -1, -1, -1, 2, -1,-1,'Wound Poison', 'Spell::EffectSchoolDMG'); /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ -(53563,-1, -1, -1, -1, -1, -1, -1, 23,-1,'Beacon of Light', 'Aura::HandlePeriodicTriggerSpell'), -(53563,-1, -1, -1, -1, -1, -1, -1, 23,-1,'Beacon of Light', 'Unit::HandleDummyAuraProc'); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 63602595b..df518f6c4 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1504,7 +1504,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } } - ((Creature*)unitTarget)->ForcedDespawn(5000); + ((Creature*)unitTarget)->ForcedDespawn(); return; } case 51866: // Kick Nass @@ -1642,29 +1642,26 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case 53808: // Pygmy Oil { - const SpellEntry *pSpellShrink = sSpellStore.LookupEntry(53805); - const SpellEntry *pSpellTransf = sSpellStore.LookupEntry(53806); + const uint32 spellShrink = 53805; + const uint32 spellTransf = 53806; - if (!pSpellTransf || !pSpellShrink) - return; - - if (Aura* pAura = m_caster->GetAura(pSpellShrink->Id, EFFECT_INDEX_0)) + if (Aura* pAura = m_caster->GetAura(spellShrink, EFFECT_INDEX_0)) { uint8 stackNum = pAura->GetStackAmount(); // chance to become pygmified (5, 10, 15 etc) if (roll_chance_i(stackNum*5)) { - m_caster->RemoveAurasDueToSpell(pSpellShrink->Id); - m_caster->CastSpell(m_caster, pSpellTransf, true); + m_caster->RemoveAurasDueToSpell(spellShrink); + m_caster->CastSpell(m_caster, spellTransf, true); return; } } - if (m_caster->HasAura(pSpellTransf->Id, EFFECT_INDEX_0)) + if (m_caster->HasAura(spellTransf, EFFECT_INDEX_0)) return; - m_caster->CastSpell(m_caster, pSpellShrink, true); + m_caster->CastSpell(m_caster, spellShrink, true); return; } case 55004: // Nitro Boosts @@ -5728,6 +5725,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget) return; + // Ley Line Information if (unitTarget->HasAura(47391, EFFECT_INDEX_0)) unitTarget->RemoveAurasDueToSpell(47391); @@ -5738,6 +5736,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget) return; + // Ley Line Information if (unitTarget->HasAura(47473, EFFECT_INDEX_0)) unitTarget->RemoveAurasDueToSpell(47473); @@ -5748,6 +5747,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget) return; + // Ley Line Information if (unitTarget->HasAura(47636, EFFECT_INDEX_0)) unitTarget->RemoveAurasDueToSpell(47636); @@ -5839,7 +5839,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Remove aura given at quest accept / gossip - if (unitTarget->HasAura(51967)) + if (unitTarget->HasAura(51967)) // Mojo of Rhunok unitTarget->RemoveAurasDueToSpell(51967); return; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1ac7b92de..a2fcad7d6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9944" + #define REVISION_NR "9945" #endif // __REVISION_NR_H__ From c2fc89c86c2d8d288d57f4c0bdd83f542dfda1ef Mon Sep 17 00:00:00 2001 From: j4r0d Date: Fri, 21 May 2010 07:53:54 +0400 Subject: [PATCH 074/172] [9946] Prevent remove unexpected for remove spell at cast 35729. Also drop removed spell call for spells 19574/34471. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 10 +--------- src/game/SpellEffects.cpp | 10 +++++----- src/shared/revision_nr.h | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index f13857fc3..ffcfff32f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6374,16 +6374,8 @@ void Aura::HandleSpellSpecificBoosts(bool apply) break; case SPELLFAMILY_HUNTER: { - // The Beast Within and Bestial Wrath - immunity - if (GetId() == 19574 || GetId() == 34471) - { - spellId1 = 24395; - spellId2 = 24396; - spellId3 = 24397; - spellId4 = 26592; - } // Freezing Trap Effect - else if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000008)) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000008)) { if(!apply) { diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index df518f6c4..da0b9d631 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2622,11 +2622,11 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) Unit::AuraMap& Auras = unitTarget->GetAuras(); for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter) { - // remove all harmful spells on you... - if( // ignore positive and passive auras - !iter->second->IsPositive() && !iter->second->IsPassive() && - // ignore physical auras - (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL)==0 ) + // Remove all harmful spells on you except positive/passive/physical auras + if( !iter->second->IsPositive() + && !iter->second->IsPassive() + && !iter->second->IsDeathPersistent() + && (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0 ) { m_caster->RemoveAurasDueToSpell(iter->second->GetSpellProto()->Id); iter = Auras.begin(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a2fcad7d6..26a031315 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9945" + #define REVISION_NR "9946" #endif // __REVISION_NR_H__ From 2591a2333a6d85fcc206d1c134bf5c07cb980add Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 21 May 2010 09:47:58 +0400 Subject: [PATCH 075/172] [9947] More skinning fixes. * Restore work with money loot. * Old code sometime generate empty loot windows for normal loot and sometime skip its. Code changed to be more consistent. Added new option Corpse.EmptyLootShow that control show empty normal loot window in some cases enabled by default: - if creature expected to be lootable but loot generated empty by some reasons. - if creature can be skinnable If option disabled thne code attempt avoid empty normal loot windows for empty cases. * Possible fixed case instant despawn non-skinable creature after normal loot complete. --- src/game/Creature.cpp | 30 +++++++++++++++--------------- src/game/SpellEffects.cpp | 8 ++++---- src/game/World.cpp | 1 + src/game/World.h | 1 + src/mangosd/mangosd.conf.dist.in | 6 ++++++ src/shared/revision_nr.h | 2 +- 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index a8dba28db..3c58d47a6 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -816,26 +816,26 @@ void Creature::PrepareBodyLootState() loot.clear(); // if have normal loot then prepare it access - if (!isAlive() && GetCreatureInfo()->lootid && !lootForBody) + if (!isAlive() && !lootForBody) { - SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - return; + // have normal loot + if (GetCreatureInfo()->maxgold > 0 || GetCreatureInfo()->lootid || + // ... or can have skinning after + GetCreatureInfo()->SkinLootId && sWorld.getConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW)) + { + SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + return; + } } // if not have normal loot allow skinning if need - if (!isAlive() && !lootForSkin) + if (!isAlive() && !lootForSkin && GetCreatureInfo()->SkinLootId) { lootForBody = true; // pass this loot mode - if (GetCreatureInfo()->SkinLootId) - { - if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) - { - RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - return; - } - } + RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + return; } RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); @@ -2031,14 +2031,14 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* void Creature::AllLootRemovedFromCorpse() { - if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) + if (lootForBody && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) { uint32 nDeathTimer; CreatureInfo const *cinfo = GetCreatureInfo(); // corpse was not skinnable -> apply corpse looted timer - if (!cinfo || !cinfo->SkinLootId) + if (!cinfo->SkinLootId) nDeathTimer = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED)); // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update else diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index da0b9d631..e41c4dd48 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2623,10 +2623,10 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter) { // Remove all harmful spells on you except positive/passive/physical auras - if( !iter->second->IsPositive() - && !iter->second->IsPassive() - && !iter->second->IsDeathPersistent() - && (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0 ) + if (!iter->second->IsPositive() && + !iter->second->IsPassive() && + !iter->second->IsDeathPersistent() && + (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0) { m_caster->RemoveAurasDueToSpell(iter->second->GetSpellProto()->Id); iter = Auras.begin(); diff --git a/src/game/World.cpp b/src/game/World.cpp index 9d4d78735..abf273dce 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -691,6 +691,7 @@ void World::LoadConfigSettings(bool reload) setConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY, "ChatStrictLinkChecking.Severity", 0); setConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK, "ChatStrictLinkChecking.Kick", 0); + setConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW, "Corpse.EmptyLootShow", true); setConfigPos(CONFIG_UINT32_CORPSE_DECAY_NORMAL, "Corpse.Decay.NORMAL", 60); setConfigPos(CONFIG_UINT32_CORPSE_DECAY_RARE, "Corpse.Decay.RARE", 300); setConfigPos(CONFIG_UINT32_CORPSE_DECAY_ELITE, "Corpse.Decay.ELITE", 300); diff --git a/src/game/World.h b/src/game/World.h index b3360e0ce..b289b9154 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -297,6 +297,7 @@ enum eConfigBoolValues CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_SEVERITY, CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_KICK, CONFIG_BOOL_ADDON_CHANNEL, + CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW, CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_BOOL_DEATH_BONES_WORLD, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index f9088e304..673ed2a12 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -829,6 +829,11 @@ TalentsInspecting = 1 # Difference for boss dynamic level with target # Default: 3 # +# Corpse.EmptyLootShow +# If target can have loot (or can be skining after loot) but no loot generated still show loot window +# Default: 1 (show) +# 0 (not show) +# # Corpse.Decay.NORMAL # Corpse.Decay.RARE # Corpse.Decay.ELITE @@ -886,6 +891,7 @@ CreatureFamilyAssistanceRadius = 10 CreatureFamilyAssistanceDelay = 1500 CreatureFamilyFleeDelay = 7000 WorldBossLevelDiff = 3 +Corpse.EmptyLootShow = 1 Corpse.Decay.NORMAL = 60 Corpse.Decay.RARE = 300 Corpse.Decay.ELITE = 300 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 26a031315..69e900aa6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9946" + #define REVISION_NR "9947" #endif // __REVISION_NR_H__ From 7151b4e538b31bf31738b8f17d81c2327e9c3461 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Fri, 21 May 2010 09:27:55 +0200 Subject: [PATCH 076/172] [9948] Remove a few not needed checks in spell script effect Signed-off-by: NoFantasy --- src/game/SpellEffects.cpp | 20 ++++++-------------- src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index e41c4dd48..99ee0a93d 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1504,7 +1504,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } } - ((Creature*)unitTarget)->ForcedDespawn(); + ((Creature*)unitTarget)->ForcedDespawn(5000); return; } case 51866: // Kick Nass @@ -5726,9 +5726,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Ley Line Information - if (unitTarget->HasAura(47391, EFFECT_INDEX_0)) - unitTarget->RemoveAurasDueToSpell(47391); - + unitTarget->RemoveAurasDueToSpell(47391); return; } case 47615: // Atop the Woodlands: Quest Completion Script @@ -5737,9 +5735,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Ley Line Information - if (unitTarget->HasAura(47473, EFFECT_INDEX_0)) - unitTarget->RemoveAurasDueToSpell(47473); - + unitTarget->RemoveAurasDueToSpell(47473); return; } case 47638: // The End of the Line: Quest Completion Script @@ -5748,9 +5744,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Ley Line Information - if (unitTarget->HasAura(47636, EFFECT_INDEX_0)) - unitTarget->RemoveAurasDueToSpell(47636); - + unitTarget->RemoveAurasDueToSpell(47636); return; } case 48603: // High Executor's Branding Iron @@ -5838,10 +5832,8 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget) return; - // Remove aura given at quest accept / gossip - if (unitTarget->HasAura(51967)) // Mojo of Rhunok - unitTarget->RemoveAurasDueToSpell(51967); - + // Remove aura (Mojo of Rhunok) given at quest accept / gossip + unitTarget->RemoveAurasDueToSpell(51967); return; } case 54729: // Winged Steed of the Ebon Blade diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 69e900aa6..aeb7df4f1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9947" + #define REVISION_NR "9948" #endif // __REVISION_NR_H__ From d740b2f167bdd8f0e7a25e8e868261d893dff657 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 10:16:28 +0400 Subject: [PATCH 077/172] [9949] Add target for TARGET_DUELVSPLAYER_COORDINATES only if not provided by another way. This fix for exmple unexpected empry heal if targeted by spell 48438 and ranks. --- src/game/Spell.cpp | 18 +++++++++++++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 1c5d9bd1c..3f496cf5a 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -593,6 +593,21 @@ void Spell::FillTargetMap() break; } break; + case TARGET_DUELVSPLAYER_COORDINATES: + switch(m_spellInfo->EffectImplicitTargetB[i]) + { + case 0: + case TARGET_EFFECT_SELECT: + SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + if (Unit* currentTarget = m_targets.getUnitTarget()) + tmpUnitMap.push_back(currentTarget); + break; + default: + SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); + break; + } + break; default: switch(m_spellInfo->EffectImplicitTargetB[i]) { @@ -1799,10 +1814,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_DUELVSPLAYER_COORDINATES: { if(Unit* currentTarget = m_targets.getUnitTarget()) - { m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); - targetUnitMap.push_back(currentTarget); - } break; } case TARGET_ALL_PARTY_AROUND_CASTER: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index aeb7df4f1..3ff2ca20c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9948" + #define REVISION_NR "9949" #endif // __REVISION_NR_H__ From 5940bd7d0798b069cd0289f83cce7f1699957a6f Mon Sep 17 00:00:00 2001 From: Hantet Date: Sat, 22 May 2010 11:00:04 +0400 Subject: [PATCH 078/172] [9950] Fixed crash at .gobject turn command (at *nix at least) Signed-off-by: VladimirMangos --- src/game/Level2.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index ad9682fde..944950e8f 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -607,7 +607,7 @@ bool ChatHandler::HandleGameObjectTurnCommand(const char* args) obj->SaveToDB(); obj->Refresh(); - PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow(), o); + PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow()); return true; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3ff2ca20c..c3596fe23 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9949" + #define REVISION_NR "9950" #endif // __REVISION_NR_H__ From 29c0efe9b43527a206e5712784bd7758575e9258 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 11:31:27 +0400 Subject: [PATCH 079/172] [9951] Fixed bug with raid subgroup size update at move member to another. Also some code cleanups --- src/game/Group.cpp | 49 +++++++++++++++++++++++----------------- src/game/Group.h | 27 +++++++++++----------- src/shared/revision_nr.h | 2 +- 3 files changed, 43 insertions(+), 35 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 6a9a822b4..08f7d616b 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -41,7 +41,7 @@ Group::Group() : m_Id(0), m_leaderGuid(0), m_mainTank(0), m_mainAssistant(0), m m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_looterGuid(0), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_subGroupsCounts(NULL) { - for (int i = 0; i < TARGETICONCOUNT; ++i) + for (int i = 0; i < TARGET_ICON_COUNT; ++i) m_targetIcons[i] = 0; } @@ -159,7 +159,7 @@ bool Group::LoadGroupFromDB(Field* fields) m_looterGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER); m_lootThreshold = (ItemQualities)fields[4].GetUInt16(); - for(int i = 0; i < TARGETICONCOUNT; ++i) + for(int i = 0; i < TARGET_ICON_COUNT; ++i) m_targetIcons[i] = fields[5+i].GetUInt64(); return true; @@ -869,12 +869,12 @@ void Group::CountTheRoll(Rolls::iterator& rollI) void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid) { - if(id >= TARGETICONCOUNT) + if(id >= TARGET_ICON_COUNT) return; // clean other icons if( targetGuid != 0 ) - for(int i = 0; i < TARGETICONCOUNT; ++i) + for(int i = 0; i < TARGET_ICON_COUNT; ++i) if( m_targetIcons[i] == targetGuid ) SetTargetIcon(i, 0, 0); @@ -934,10 +934,10 @@ void Group::SendTargetIconList(WorldSession *session) if(!session) return; - WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9)); + WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGET_ICON_COUNT*9)); data << uint8(1); // list targets - for(int i = 0; i < TARGETICONCOUNT; ++i) + for(int i = 0; i < TARGET_ICON_COUNT; ++i) { if(m_targetIcons[i] == 0) continue; @@ -1066,9 +1066,9 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant) if (m_subGroupsCounts) { bool groupFound = false; - for (; groupid < MAXRAIDSIZE / MAXGROUPSIZE; ++groupid) + for (; groupid < MAX_RAID_SUBGROUPS; ++groupid) { - if (m_subGroupsCounts[groupid] < MAXGROUPSIZE) + if (m_subGroupsCounts[groupid] < MAX_GROUP_SIZE) { groupFound = true; break; @@ -1121,7 +1121,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u if(!isRaidGroup()) // reset targetIcons for non-raid-groups { - for(int i = 0; i < TARGETICONCOUNT; ++i) + for(int i = 0; i < TARGET_ICON_COUNT; ++i) m_targetIcons[i] = 0; } @@ -1260,7 +1260,7 @@ void Group::_removeRolls(const uint64 &guid) } } -bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group) +bool Group::_setMembersGroup(const uint64 &guid, uint8 group) { member_witerator slot = _getMemberWSlot(guid); if(slot == m_memberSlots.end()) @@ -1327,21 +1327,24 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const } // allows setting subgroup for offline members -void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group) +void Group::ChangeMembersGroup(const uint64 &guid, uint8 group) { - if(!isRaidGroup()) + if (!isRaidGroup()) return; + Player *player = sObjectMgr.GetPlayer(guid); if (!player) { - uint8 prevSubGroup; - prevSubGroup = GetMemberGroup(guid); - - SubGroupCounterDecrease(prevSubGroup); + uint8 prevSubGroup = GetMemberGroup(guid); + if (prevSubGroup == group) + return; if(_setMembersGroup(guid, group)) + { + SubGroupCounterDecrease(prevSubGroup); SendUpdate(); + } } else // This methods handles itself groupcounter decrease @@ -1349,14 +1352,18 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group) } // only for online members -void Group::ChangeMembersGroup(Player *player, const uint8 &group) +void Group::ChangeMembersGroup(Player *player, uint8 group) { - if(!player || !isRaidGroup()) + if (!player || !isRaidGroup()) return; - if(_setMembersGroup(player->GetGUID(), group)) + + uint8 prevSubGroup = player->GetSubGroup(); + if (prevSubGroup == group) + return; + + if (_setMembersGroup(player->GetGUID(), group)) { - uint8 prevSubGroup = player->GetSubGroup(); - if( player->GetGroup() == this ) + if (player->GetGroup() == this) player->GetGroupRef().setSubGroup(group); //if player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference else diff --git a/src/game/Group.h b/src/game/Group.h index 05848cacf..d43f3b68b 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -28,9 +28,10 @@ #include #include -#define MAXGROUPSIZE 5 -#define MAXRAIDSIZE 40 -#define TARGETICONCOUNT 8 +#define MAX_GROUP_SIZE 5 +#define MAX_RAID_SIZE 40 +#define MAX_RAID_SUBGROUPS (MAX_RAID_SIZE / MAX_GROUP_SIZE) +#define TARGET_ICON_COUNT 8 enum LootMethod { @@ -196,7 +197,7 @@ class MANGOS_DLL_SPEC Group // properties accessories uint32 GetId() const { return m_Id; } - bool IsFull() const { return (m_groupType == GROUPTYPE_NORMAL) ? (m_memberSlots.size() >= MAXGROUPSIZE) : (m_memberSlots.size() >= MAXRAIDSIZE); } + bool IsFull() const { return (m_groupType == GROUPTYPE_NORMAL) ? (m_memberSlots.size() >= MAX_GROUP_SIZE) : (m_memberSlots.size() >= MAX_RAID_SIZE); } bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; } bool isBGGroup() const { return m_bgGroup != NULL; } bool IsCreated() const { return GetMembersCount() > 0; } @@ -251,7 +252,7 @@ class MANGOS_DLL_SPEC Group bool HasFreeSlotSubGroup(uint8 subgroup) const { - return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); + return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE); } bool SameSubGroup(Player const* member1, Player const* member2) const; @@ -264,7 +265,7 @@ class MANGOS_DLL_SPEC Group { member_citerator mslot = _getMemberCSlot(guid); if(mslot==m_memberSlots.end()) - return (MAXRAIDSIZE/MAXGROUPSIZE+1); + return MAX_RAID_SUBGROUPS + 1; return mslot->group; } @@ -275,10 +276,10 @@ class MANGOS_DLL_SPEC Group void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; } GroupJoinBattlegroundResult CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); - void ChangeMembersGroup(const uint64 &guid, const uint8 &group); - void ChangeMembersGroup(Player *player, const uint8 &group); + void ChangeMembersGroup(const uint64 &guid, uint8 group); + void ChangeMembersGroup(Player *player, uint8 group); - void SetAssistant(uint64 guid, const bool &state) + void SetAssistant(uint64 guid, bool state) { if(!isRaidGroup()) return; @@ -355,7 +356,7 @@ class MANGOS_DLL_SPEC Group void _removeRolls(const uint64 &guid); - bool _setMembersGroup(const uint64 &guid, const uint8 &group); + bool _setMembersGroup(const uint64 &guid, uint8 group); bool _setAssistantFlag(const uint64 &guid, const bool &state); bool _setMainTank(const uint64 &guid); bool _setMainAssistant(const uint64 &guid); @@ -366,9 +367,9 @@ class MANGOS_DLL_SPEC Group { // Sub group counters initialization if (!m_subGroupsCounts) - m_subGroupsCounts = new uint8[MAXRAIDSIZE / MAXGROUPSIZE]; + m_subGroupsCounts = new uint8[MAX_RAID_SUBGROUPS]; - memset((void*)m_subGroupsCounts, 0, (MAXRAIDSIZE / MAXGROUPSIZE)*sizeof(uint8)); + memset((void*)m_subGroupsCounts, 0, MAX_RAID_SUBGROUPS * sizeof(uint8)); for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) ++m_subGroupsCounts[itr->group]; @@ -421,7 +422,7 @@ class MANGOS_DLL_SPEC Group Difficulty m_dungeonDifficulty; Difficulty m_raidDifficulty; BattleGround* m_bgGroup; - uint64 m_targetIcons[TARGETICONCOUNT]; + uint64 m_targetIcons[TARGET_ICON_COUNT]; LootMethod m_lootMethod; ItemQualities m_lootThreshold; uint64 m_looterGuid; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c3596fe23..f6b287b43 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9950" + #define REVISION_NR "9951" #endif // __REVISION_NR_H__ From f758fac6f710139b7e94051f99248659b4100533 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 11:47:46 +0400 Subject: [PATCH 080/172] [9952] Allow update subgroup in raid for offline players. Also prevent crash and wrong subgroup number send from client. --- src/game/GroupHandler.cpp | 8 +++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index db463a6bf..d1347e505 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -510,6 +510,9 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) recv_data >> groupNr; + if (groupNr >= MAX_RAID_SUBGROUPS) + return; + // we will get correct pointer for group here, so we don't have to check if group is BG raid Group *group = GetPlayer()->GetGroup(); if(!group) @@ -524,7 +527,10 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) /********************/ // everything is fine, do it - group->ChangeMembersGroup(sObjectMgr.GetPlayer(name.c_str()), groupNr); + if (Player* player = sObjectMgr.GetPlayer(name.c_str())) + group->ChangeMembersGroup(player, groupNr); + else + group->ChangeMembersGroup(sObjectMgr.GetPlayerGUIDByName(name.c_str()), groupNr); } void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f6b287b43..5d3a27779 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9951" + #define REVISION_NR "9952" #endif // __REVISION_NR_H__ From 0aac44e091c3a2be7b91b9135efe1d4af9deea3f Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 22 May 2010 12:03:49 +0200 Subject: [PATCH 081/172] [9953] Remove two not needed cast to Creature* and make code more safe Signed-off-by: NoFantasy --- src/game/Player.cpp | 6 ++---- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 55fee16a2..2f7134713 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12564,7 +12564,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource)) pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(0); - bool canTalkToCredit = true; + bool canTalkToCredit = pSource->GetTypeId() == TYPEID_UNIT; for(GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { @@ -12656,8 +12656,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) { GameObject *pGo = (GameObject*)pSource; - canTalkToCredit = false; - switch(itr->second.option_id) { case GOSSIP_OPTION_QUESTGIVER: @@ -12704,7 +12702,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (canTalkToCredit) { if (pSource->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - TalkedToCreature(((Creature*)pSource)->GetEntry(), ((Creature*)pSource)->GetGUID()); + TalkedToCreature(pSource->GetEntry(), pSource->GetGUID()); } // some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5d3a27779..a63281af0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9952" + #define REVISION_NR "9953" #endif // __REVISION_NR_H__ From 182fda8f3e22381ba14c24923a7da36a7c6e7479 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 15:56:30 +0400 Subject: [PATCH 082/172] [9954] Lost socket.vcxproj referecne in VS projects. Thanks to j4r0d for catch this. --- src/shared/revision_nr.h | 2 +- win/VC100/mangosd.vcxproj | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a63281af0..0e3aa611c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9953" + #define REVISION_NR "9954" #endif // __REVISION_NR_H__ diff --git a/win/VC100/mangosd.vcxproj b/win/VC100/mangosd.vcxproj index c9f0e3a5a..d8488deef 100644 --- a/win/VC100/mangosd.vcxproj +++ b/win/VC100/mangosd.vcxproj @@ -494,9 +494,6 @@ {90297c34-f231-4df4-848e-a74bcc0e40ed} - - {04baf755-0d67-46f8-b1c6-77ae5368f3cb} - From de454d6ff893e5111f5d72a870600327fffebbf7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 16:12:53 +0400 Subject: [PATCH 083/172] [9955] Prevent negetive proc events from possitive effects of negative spells. Some negative spells have positive effects with targets not affected by negative effects of spell. For example spell 45524 cast negative effecst to target and possitive effect to caster self. For like possitive only target of negetive spell will not triggered negative proc events. In last cases will avoid triggering glyph 43537 at caster at spell 43537 cast. --- src/game/Spell.cpp | 20 ++++++++++++++++++-- src/game/Spell.h | 13 +++++++------ src/game/SpellMgr.h | 6 ++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3f496cf5a..c098c6293 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -760,6 +760,14 @@ void Spell::prepareDataForTriggerSystem() } break; } + + // some negative spells have positive effects to another or same targets + // avoid triggering negative hit for only positive targets + m_negativeEffectMask = 0x0; + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + if (!IsPositiveEffect(m_spellInfo->Id, SpellEffectIndex(i))) + m_negativeEffectMask |= (1<SpellFamilyName == SPELLFAMILY_HUNTER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x000020000000001C))) @@ -950,6 +958,14 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) uint32 procVictim = m_procVictim; uint32 procEx = PROC_EX_NONE; + // drop proc flags in case target not affected negative effects in negative spell + // for example caster bonus or animation + if (((procAttacker | procVictim) & NEGATIVE_TRIGGER_MASK) && !(target->effectMask & m_negativeEffectMask)) + { + procAttacker = PROC_FLAG_NONE; + procVictim = PROC_FLAG_NONE; + } + if (m_spellInfo->speed > 0) { // mark effects that were already handled in Spell::HandleDelayedSpellLaunch on spell launch as processed @@ -1053,8 +1069,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) } } } - // Passive spell hits/misses or active spells only misses (only triggers) - else + // Passive spell hits/misses or active spells only misses (only triggers if proc flags set) + else if (procAttacker || procVictim) { // Fill base damage struct (unitTarget - is real spell target) SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); diff --git a/src/game/Spell.h b/src/game/Spell.h index 5f48b1d31..c6a372e1a 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -559,16 +559,17 @@ class Spell GameObject* focusObject; // Damage and healing in effects need just calculate - int32 m_damage; // Damge in effects count here - int32 m_healing; // Healing in effects count here - int32 m_healthLeech; // Health leech in effects for all targets count here + int32 m_damage; // Damage in effects count here + int32 m_healing; // Healing in effects count here + int32 m_healthLeech; // Health leech in effects for all targets count here //****************************************** // Spell trigger system //****************************************** - bool m_canTrigger; // Can start trigger (m_IsTriggeredSpell can`t use for this) - uint32 m_procAttacker; // Attacker trigger flags - uint32 m_procVictim; // Victim trigger flags + bool m_canTrigger; // Can start trigger (m_IsTriggeredSpell can`t use for this) + uint8 m_negativeEffectMask; // Use for avoid sent negative spell procs for additional positive effects only targets + uint32 m_procAttacker; // Attacker trigger flags + uint32 m_procVictim; // Victim trigger flags void prepareDataForTriggerSystem(); //***************************************** diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 29b74ec88..ff2b8b3f7 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -502,6 +502,12 @@ enum ProcFlags PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT | \ PROC_FLAG_TAKEN_RANGED_SPELL_HIT) +#define NEGATIVE_TRIGGER_MASK (MELEE_BASED_TRIGGER_MASK | \ + PROC_FLAG_SUCCESSFUL_AOE_SPELL_HIT | \ + PROC_FLAG_TAKEN_AOE_SPELL_HIT | \ + PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT | \ + PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT) + enum ProcFlagsEx { PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0e3aa611c..79b86a9f5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9954" + #define REVISION_NR "9955" #endif // __REVISION_NR_H__ From 94f7a7709deb9b51050a6cc0f13f9f37b04d6a2d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 16:18:29 +0400 Subject: [PATCH 084/172] [9956] Spell 45524 expected apply debuf 55095 to target at cast. --- src/game/SpellAuras.cpp | 8 ++++++++ src/game/SpellEffects.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ffcfff32f..843ef5c7c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6460,6 +6460,14 @@ void Aura::HandleSpellSpecificBoosts(bool apply) // second part of spell apply switch (GetId()) { + case 45524: // Chains of Ice + { + if (apply) + spellId1 = 55095; // Frost Fever + else + return; + break; + } case 49039: spellId1 = 50397; break; // Lichborne case 48263: // Frost Presence diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 99ee0a93d..9ee6095fe 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2421,7 +2421,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (m_caster->IsFriendlyTo(unitTarget)) { - if (unitTarget->GetCreatureType() != CREATURE_TYPE_UNDEAD) + if (!unitTarget || unitTarget->GetCreatureType() != CREATURE_TYPE_UNDEAD) return; int32 bp = int32(damage * 1.5f); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 79b86a9f5..fcf73e013 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9955" + #define REVISION_NR "9956" #endif // __REVISION_NR_H__ From 67b8ca03b5c01557b07d321776fb3a1f8f33b3e5 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 19:38:11 +0400 Subject: [PATCH 085/172] [9957] Alow sell item for money and extanded coset without momey in same time. npc_vendor.ExtandedCost can be negative now that meaning: price excluded default item BuyPrice and use only abs(ExtandedCost) items). For example expected used for item 36908. --- sql/mangos.sql | 6 +++--- sql/updates/9957_01_mangos_mangos_string.sql | 5 +++++ sql/updates/9957_02_mangos_npc_vendor.sql | 4 ++++ sql/updates/Makefile.am | 4 ++++ src/game/Creature.cpp | 2 +- src/game/Creature.h | 12 ++++++++---- src/game/ItemHandler.cpp | 4 ++-- src/game/Level2.cpp | 2 +- src/game/ObjectMgr.cpp | 16 +++++++++------- src/game/ObjectMgr.h | 4 ++-- src/game/Player.cpp | 19 ++++++++++--------- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 13 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 sql/updates/9957_01_mangos_mangos_string.sql create mode 100644 sql/updates/9957_02_mangos_npc_vendor.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 869c1e5ae..cdda41786 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9924_02_mangos_command` bit(1) default NULL + `required_9957_02_mangos_npc_vendor` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -3116,7 +3116,7 @@ INSERT INTO `mangos_string` VALUES (207,'Item \'%i\' not found in database.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (208,'Item \'%i\' \'%s\' deleted from vendor list',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (209,'Item \'%i\' not found in vendor list.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(210,'Item \'%i\' (with extended cost %u) already in vendor list.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(210,'Item \'%i\' (with extended cost %i) already in vendor list.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (211,'Spells of %s reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (212,'Spells of %s will reset at next login.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (213,'Talents of %s reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -3889,7 +3889,7 @@ CREATE TABLE `npc_vendor` ( `item` mediumint(8) unsigned NOT NULL default '0', `maxcount` tinyint(3) unsigned NOT NULL default '0', `incrtime` int(10) unsigned NOT NULL default '0', - `ExtendedCost` mediumint(8) unsigned NOT NULL default '0', + `ExtendedCost` mediumint(8) NOT NULL default '0' COMMENT 'negative if cost must exclude normal money cost', PRIMARY KEY (`entry`,`item`,`ExtendedCost`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Npc System'; diff --git a/sql/updates/9957_01_mangos_mangos_string.sql b/sql/updates/9957_01_mangos_mangos_string.sql new file mode 100644 index 000000000..cc3c99285 --- /dev/null +++ b/sql/updates/9957_01_mangos_mangos_string.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_9924_02_mangos_command required_9957_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN (210); +INSERT INTO mangos_string VALUES +(210,'Item \'%i\' (with extended cost %i) already in vendor list.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/9957_02_mangos_npc_vendor.sql b/sql/updates/9957_02_mangos_npc_vendor.sql new file mode 100644 index 000000000..25c829702 --- /dev/null +++ b/sql/updates/9957_02_mangos_npc_vendor.sql @@ -0,0 +1,4 @@ +ALTER TABLE db_version CHANGE COLUMN required_9957_01_mangos_mangos_string required_9957_02_mangos_npc_vendor bit; + +ALTER TABLE npc_vendor + CHANGE COLUMN `ExtendedCost` `ExtendedCost` mediumint(8) NOT NULL default '0' COMMENT 'negative if cost must exclude normal money cost'; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index d93037252..1b392463f 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -67,6 +67,8 @@ pkgdata_DATA = \ 9899_01_mangos_spell_bonus_data.sql \ 9924_01_mangos_mangos_string.sql \ 9924_02_mangos_command.sql \ + 9957_01_mangos_mangos_string.sql \ + 9957_02_mangos_npc_vendor.sql \ README ## Additional files to include when running 'make dist' @@ -114,4 +116,6 @@ EXTRA_DIST = \ 9899_01_mangos_spell_bonus_data.sql \ 9924_01_mangos_mangos_string.sql \ 9924_02_mangos_command.sql \ + 9957_01_mangos_mangos_string.sql \ + 9957_02_mangos_npc_vendor.sql \ README diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 3c58d47a6..9664e250d 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -74,7 +74,7 @@ bool VendorItemData::RemoveItem( uint32 item_id ) return found; } -VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extendedCost) const +VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, int32 extendedCost) const { for(VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i ) if((*i)->item == item_id && (*i)->ExtendedCost == extendedCost) diff --git a/src/game/Creature.h b/src/game/Creature.h index 3bb0591de..c6dff5dfc 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -276,13 +276,17 @@ enum AttackingTarget // Vendors struct VendorItem { - VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost) + VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, int32 _ExtendedCost) : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {} uint32 item; uint32 maxcount; // 0 for infinity item amount uint32 incrtime; // time for restore items amount if maxcount != 0 - uint32 ExtendedCost; + int32 ExtendedCost; // negative if need exclude normal item money cost + + // helpers + uint32 IsExcludeMoneyPrice() const { return ExtendedCost < 0; } + uint32 GetExtendedCostId() const { return std::abs(ExtendedCost); } }; typedef std::vector VendorItemList; @@ -297,12 +301,12 @@ struct VendorItemData } bool Empty() const { return m_items.empty(); } uint8 GetItemCount() const { return m_items.size(); } - void AddItem( uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost) + void AddItem( uint32 item, uint32 maxcount, uint32 ptime, int32 ExtendedCost) { m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost)); } bool RemoveItem( uint32 item_id ); - VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const; + VendorItem const* FindItemCostPair(uint32 item_id, int32 extendedCost) const; void Clear() { diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 1d04c1460..f6935004e 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -760,7 +760,7 @@ void WorldSession::SendListInventory(uint64 vendorguid) ++count; // reputation discount - uint32 price = uint32(floor(pProto->BuyPrice * discountMod)); + uint32 price = crItem->IsExcludeMoneyPrice() ? 0 : uint32(floor(pProto->BuyPrice * discountMod)); data << uint32(vendorslot +1); // client size expected counting from 1 data << uint32(crItem->item); @@ -769,7 +769,7 @@ void WorldSession::SendListInventory(uint64 vendorguid) data << uint32(price); data << uint32(pProto->MaxDurability); data << uint32(pProto->BuyCount); - data << uint32(crItem->ExtendedCost); + data << uint32(crItem->GetExtendedCostId()); } } } diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 944950e8f..bba39a064 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1129,7 +1129,7 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(const char* args) incrtime = atol(fincrtime); char* fextendedcost = strtok(NULL, " "); //add ExtendedCost, default: 0 - uint32 extendedcost = fextendedcost ? atol(fextendedcost) : 0; + int32 extendedcost = fextendedcost ? atol(fextendedcost) : 0; Creature* vendor = getSelectedCreature(); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 7beae97da..e2ecc13e8 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -8012,7 +8012,7 @@ void ObjectMgr::LoadVendors() uint32 item_id = fields[1].GetUInt32(); uint32 maxcount = fields[2].GetUInt32(); uint32 incrtime = fields[3].GetUInt32(); - uint32 ExtendedCost = fields[4].GetUInt32(); + int32 ExtendedCost = fields[4].GetInt32(); if(!IsVendorItemValid(entry,item_id,maxcount,incrtime,ExtendedCost,NULL,&skip_vendors)) continue; @@ -8290,12 +8290,12 @@ void ObjectMgr::LoadGossipMenuItems() sLog.outString(">> Loaded %u gossip_menu_option entries", count); } -void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost ) +void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, int32 extendedcost ) { VendorItemData& vList = m_mCacheVendorItemMap[entry]; vList.AddItem(item,maxcount,incrtime,extendedcost); - WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); + WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%i')",entry, item, maxcount,incrtime,extendedcost); } bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item ) @@ -8311,7 +8311,7 @@ bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item ) return true; } -bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set* skip_vendors ) const +bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, int32 ExtendedCost, Player* pl, std::set* skip_vendors ) const { CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry); if(!cInfo) @@ -8347,12 +8347,14 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m return false; } - if(ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost)) + uint32 extCostId = std::abs(ExtendedCost); // negative exclude for vendor price money part + + if(extCostId && !sItemExtendedCostStore.LookupEntry(extCostId)) { if(pl) - ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost); + ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,extCostId); else - sLog.outErrorDb("Table `npc_vendor` contain item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignoring",item_id,ExtendedCost,vendor_entry); + sLog.outErrorDb("Table `npc_vendor` contain item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignoring",item_id,extCostId,vendor_entry); return false; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index d1819a77e..2793b7709 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -863,9 +863,9 @@ class ObjectMgr return &iter->second; } - void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost); + void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, int32 ExtendedCost); bool RemoveVendorItem(uint32 entry,uint32 item); - bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set* skip_vendors = NULL ) const; + bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, int32 ExtendedCost, Player* pl = NULL, std::set* skip_vendors = NULL ) const; void LoadScriptNames(); ScriptNameMap &GetScriptNames() { return m_scriptNames; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2f7134713..2e40e867a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18426,12 +18426,12 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 return false; } - if (crItem->ExtendedCost) + if (uint32 extendedCostId = crItem->GetExtendedCostId()) { - ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId); if (!iece) { - sLog.outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); + sLog.outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, extendedCostId); return false; } @@ -18468,10 +18468,11 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } } - uint32 price = pProto->BuyPrice * count; + uint32 price = crItem->IsExcludeMoneyPrice() ? 0 : pProto->BuyPrice * count; // reputation discount - price = uint32(floor(price * GetReputationPriceDiscount(pCreature))); + if (price) + price = uint32(floor(price * GetReputationPriceDiscount(pCreature))); if (GetMoney() < price) { @@ -18490,9 +18491,9 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } ModifyMoney( -(int32)price ); - if (crItem->ExtendedCost) // case for new honor system + if (uint32 extendedCostId = crItem->GetExtendedCostId()) { - ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId); if (iece->reqhonorpoints) ModifyHonorPoints( - int32(iece->reqhonorpoints * count)); if (iece->reqarenapoints) @@ -18535,9 +18536,9 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } ModifyMoney( -(int32)price ); - if (crItem->ExtendedCost) // case for new honor system + if (uint32 extendedCostId = crItem->GetExtendedCostId()) { - ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId); if (iece->reqhonorpoints) ModifyHonorPoints( - int32(iece->reqhonorpoints)); if (iece->reqarenapoints) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fcf73e013..fdd7f9174 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9956" + #define REVISION_NR "9957" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index dcb4c5d5c..5f6ed998d 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9924_02_mangos_command" + #define REVISION_DB_MANGOS "required_9957_02_mangos_npc_vendor" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From f0b1c5bd7410aa790117a9e18f6a3cc54316a3b7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 23 May 2010 00:21:18 +0400 Subject: [PATCH 086/172] [9958] Implement item 34753, 43015, 43478, 43480, 46887. --- sql/mangos_spell_check.sql | 19 +++++++++++-------- src/game/SpellEffects.cpp | 34 ++++++++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index ff06b3859..d2ede6f9c 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -505,6 +505,10 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (56153,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Guardian Aura - Ahn\'Kahet', 'Spell::SetTargetMap'), (56235,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Glyph of Conflagrate', 'Spell::EffectSchoolDMG'), (56446,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Disengage', 'Spell::EffectDummy'), +(57085,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Refreshment', 'Spell::EffectScriptEffect'), +(57292,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Refreshment', 'Spell::EffectScriptEffect'), +(57337, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Great Feast', 'Spell::EffectScriptEffect'), +(57397, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Fish Feast', 'Spell::EffectScriptEffect'), (57467, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), (57627,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Charge', 'Spell::EffectSchoolDMG'), (57635, 9, -1, -1, -1, -1, -1, 3, -1,-1,'Disengage', 'Spell::EffectDummy'), @@ -512,9 +516,12 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (57669,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Replenishment', 'Spell::SetTargetMap'), (57723,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Exhaustion', 'Spell::cast'), (57724,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Sated', 'Spell::cast'), +(58067,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Refreshment', 'Spell::EffectScriptEffect'), (58367,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Execution', 'Spell::EffectDummy'), (58418, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Portal to Orgrimmar', 'Spell::EffectDummy'), (58420, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Portal to Stormwind', 'Spell::EffectDummy'), +(58466, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Gigantic Feast', 'Spell::EffectScriptEffect'), +(58475, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Small Feast', 'Spell::EffectScriptEffect'), (58601, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Remove Flight Auras', 'Spell::EffectDummy'), (58657,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Plague Strike', 'Spell::EffectWeaponDmg'), (58875,11, -1, -1, -1, -1, -1, -1, -1,-1,'Spirit Walk', 'Spell::cast'), @@ -538,6 +545,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (61650,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (61654,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Fire Nova', 'Spell::EffectDummy'), (61657,11, -1, -1, 33, -1, -1, 3, -1,-1,'Fire Nova', 'Spell::EffectDummy'), +(61832, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rifle the Bodies: Create Magehunter Personal Effects Cover','Spell::EffectDummy'), (61987,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Avenging Wrath Marker', 'Spell::cast'), (61987,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Avenging Wrath Marker', 'Spell::CheckCast'), (62124,10, -1, -1, -1, -1, -1, -1, -1,-1,'Hand of Reckoning', 'Spell::cast'), @@ -552,7 +560,10 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (64844,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Divine Hymn', 'Spell::SetTargetMap'), (64904,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hymn of Hope', 'Spell::SetTargetMap'), (65116,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Stoneskin', 'Spell::cast'), +(65422,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Food', 'Spell::EffectScriptEffect'), (66013, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Penetrating Cold', 'Spell::SetTargetMap'), +(66477, 0, -1, -1, -1, -1, -1, 77, -1,-1,'Bountiful Feast', 'Spell::EffectScriptEffect'), +(66622,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Refreshment', 'Spell::EffectScriptEffect'), (67016,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flask of the North', 'Spell::EffectDummy'), (67017,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flask of the North', 'Spell::EffectDummy'), (67018,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Flask of the North', 'Spell::EffectDummy'), @@ -594,14 +605,6 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (76153, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'), /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ - - - -(61832, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rifle the Bodies: Create Magehunter Personal Effects Cover','Spell::EffectDummy'), - - - - /* sorted by spell names */ /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ ( 0, 3,0x0000000020000000,0x00000000, -1, -1, -1, 2, -1,-1,'Arcane Blast', 'Spell::EffectSchoolDMG'), diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 9ee6095fe..2b01e0f71 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5873,6 +5873,31 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) unitTarget->RemoveAurasDueToSpell(m_spellInfo->CalculateSimpleValue(eff_idx)); break; } + case 57337: // Great Feast + { + if (!unitTarget) + return; + + unitTarget->CastSpell(unitTarget, 58067, true); + break; + } + case 57397: // Fish Feast + { + if (!unitTarget) + return; + + unitTarget->CastSpell(unitTarget, 57292, true); + break; + } + case 58466: // Gigantic Feast + case 58475: // Small Feast + { + if (!unitTarget) + return; + + unitTarget->CastSpell(unitTarget, 57085, true); + break; + } case 58418: // Portal to Orgrimmar case 58420: // Portal to Stormwind { @@ -5916,6 +5941,15 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; } + case 66477: // Bountiful Feast + { + if (!unitTarget) + return; + + unitTarget->CastSpell(unitTarget, 65422, true); + unitTarget->CastSpell(unitTarget, 66622, true); + break; + } case 69377: // Fortitude { if (!unitTarget) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fdd7f9174..3d6b31bb4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9957" + #define REVISION_NR "9958" #endif // __REVISION_NR_H__ From fcf996b4fd6d732db3f29746fa4247d4d24b1b55 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 23 May 2010 11:44:33 +0400 Subject: [PATCH 087/172] [9959] Fixed resent radnom problem with looting related to skinning code changes. Thanks to boxa for help in research problem. --- src/game/Creature.cpp | 8 ++++---- src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 9664e250d..6e984a990 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -110,7 +110,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) Creature::Creature(CreatureSubtype subtype) : Unit(), i_AI(NULL), -lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), m_groupLootId(0), +lootForPickPocketed(false), lootForBody(false), lootForSkin(false), m_groupLootTimer(0), m_groupLootId(0), m_lootMoney(0), m_lootGroupRecipientId(0), m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(5.0f), m_subtype(subtype), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), @@ -2037,10 +2037,10 @@ void Creature::AllLootRemovedFromCorpse() CreatureInfo const *cinfo = GetCreatureInfo(); - // corpse was not skinnable -> apply corpse looted timer - if (!cinfo->SkinLootId) + // corpse was not skinned -> apply corpse looted timer + if (!lootForSkin) nDeathTimer = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED)); - // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update + // corpse was skinned, corpse will despawn next update else nDeathTimer = 0; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3d6b31bb4..428ebd4a5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9958" + #define REVISION_NR "9959" #endif // __REVISION_NR_H__ From 3f4544df9dd63c95f7d0aaa75312a58f3e860c7c Mon Sep 17 00:00:00 2001 From: DonTomika Date: Sun, 23 May 2010 14:39:30 +0400 Subject: [PATCH 088/172] [9960] Implement glyph 43390. Chance unknown and seelcted by more recent comments. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 24 ++++++++++++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 843ef5c7c..cb7b90b1c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3515,11 +3515,15 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - // Soul Shard only from non-grey units - if( spellInfo->EffectItemType[m_effIndex] == 6265 && - (victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) || - victim->GetTypeId()==TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim)) ) - return; + // Soul Shard (target req.) + if (spellInfo->EffectItemType[m_effIndex] == 6265) + { + // Only from non-grey units + if ((victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) || + victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim))) + return; + } + //Adding items uint32 noSpaceForCount = 0; uint32 count = m_modifier.m_amount; @@ -3535,7 +3539,15 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) } Item* newitem = ((Player*)caster)->StoreNewItem(dest, spellInfo->EffectItemType[m_effIndex], true); - ((Player*)caster)->SendNewItem(newitem, count, true, false); + ((Player*)caster)->SendNewItem(newitem, count, true, true); + + // Soul Shard (glyph bonus) + if (spellInfo->EffectItemType[m_effIndex] == 6265) + { + // Glyph of Soul Shard + if (caster->HasAura(58070) && roll_chance_i(40)) + caster->CastSpell(caster, 58068, true, NULL, this); + } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 428ebd4a5..05f9363cc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9959" + #define REVISION_NR "9960" #endif // __REVISION_NR_H__ From 2c396da82b2395286d0a45511b6e8484eece0714 Mon Sep 17 00:00:00 2001 From: pasdVn Date: Sun, 23 May 2010 15:03:01 +0400 Subject: [PATCH 089/172] [9961] Restore work talent 18213 and ranks. Thanks also to insider42 for updating. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 12 +++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 55817ca8a..c65f5f4b5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7393,13 +7393,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB // Drain Soul if (auraSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { - Unit::AuraList const& mAddFlatModifier = GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); - for(Unit::AuraList::const_iterator i = mAddFlatModifier.begin(); i != mAddFlatModifier.end(); ++i) + // search for "Improved Drain Soul" dummy aura + Unit::AuraList const& mDummyAura = GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator i = mDummyAura.begin(); i != mDummyAura.end(); ++i) { - if ((*i)->GetModifier()->m_miscvalue == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113) + if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (*i)->GetSpellProto()->SpellIconID == 113) { - // Drain Soul - CastCustomSpell(this, 18371, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura); + // basepoints of trigger spell stored in dummyeffect of spellProto + int32 basepoints = GetMaxPower(POWER_MANA) * (*i)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_2) / 100; + CastCustomSpell(this, 18371, &basepoints, NULL, NULL, true, castItem, triggeredByAura); break; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 05f9363cc..1a1d651fb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9960" + #define REVISION_NR "9961" #endif // __REVISION_NR_H__ From c7ea2be1d1dc31cc0d105a723f22e7f10f5e3053 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 23 May 2010 15:24:47 +0400 Subject: [PATCH 090/172] [9962] Modify way 4x damage bonus claculated for spell 1120 and ranks. * Now apply 4x bonus dependent from target health in time spell cast, not from current health in tick. * 4x bonus applied to own spell damage value, not to total taken damage. --- src/game/SpellAuras.cpp | 10 ++++++++++ src/game/Unit.cpp | 8 -------- src/shared/revision_nr.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index cb7b90b1c..64607c7f4 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4888,6 +4888,16 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) } break; } + case SPELLFAMILY_WARLOCK: + { + // Drain Soul + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + { + if (m_target->GetHealth() * 100 / m_target->GetMaxHealth() <= 25) + m_modifier.m_amount *= 4; + } + break; + } case SPELLFAMILY_DRUID: { // Rake diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c65f5f4b5..962414e6a 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9125,15 +9125,7 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u break; } case SPELLFAMILY_WARLOCK: - { - // Drain Soul - if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) - { - if (pVictim->GetHealth() * 100 / pVictim->GetMaxHealth() <= 25) - DoneTotalMod *= 4; - } break; - } case SPELLFAMILY_PRIEST: { // Glyph of Smite diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1a1d651fb..ff8fbf761 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9961" + #define REVISION_NR "9962" #endif // __REVISION_NR_H__ From 702d368114572de5e0304e0d02dbc9ce87b437ea Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 23 May 2010 17:36:35 +0400 Subject: [PATCH 091/172] [9963] Implement per-tick chance for shard for spell 1120 and ranks. --- src/game/SpellAuras.cpp | 15 ++++++++++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 64607c7f4..7a0c0d21f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -7168,7 +7168,7 @@ void Aura::PeriodicTick() // only from players // FIXME: need use SpellDamageBonus instead? - if (IS_PLAYER_GUID(m_caster_guid)) + if (pCaster->GetTypeId() == TYPEID_PLAYER) pdamage -= m_target->GetSpellDamageReduction(pdamage); m_target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)); @@ -7192,6 +7192,19 @@ void Aura::PeriodicTick() pCaster->ProcDamageAndSpell(m_target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, GetSpellProto()); pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true); + + // Drain Soul (chance soul shard) + if (pCaster->GetTypeId() == TYPEID_PLAYER && m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + { + // Only from non-grey units + if (roll_chance_i(10) && // 1-2 from drain with final and without glyph, 0-1 from damage + m_target->getLevel() > MaNGOS::XP::GetGrayLevel(pCaster->getLevel()) && + (m_target->GetTypeId() != TYPEID_UNIT || ((Player*)pCaster)->isAllowedToLoot((Creature*)m_target))) + { + pCaster->CastSpell(pCaster, 43836, true, NULL, this); + } + } + break; } case SPELL_AURA_PERIODIC_LEECH: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ff8fbf761..9161d2d7b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9962" + #define REVISION_NR "9963" #endif // __REVISION_NR_H__ From 8a424642e65fbc448915e984ba4f1d188763eb0d Mon Sep 17 00:00:00 2001 From: Emme Date: Sun, 23 May 2010 18:14:39 +0400 Subject: [PATCH 092/172] [9964] Implement Treshold in Masterloot. Signed-off-by: VladimirMangos --- src/game/Group.cpp | 11 ++++++++++- src/game/LootMgr.cpp | 2 +- src/game/LootMgr.h | 6 ++++-- src/shared/revision_nr.h | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 08f7d616b..c2c83e3fc 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -580,8 +580,17 @@ void Group::NeedBeforeGreed(Creature *creature, Loot *loot) } } -void Group::MasterLoot(Creature *creature, Loot* /*loot*/) +void Group::MasterLoot(Creature *creature, Loot* loot) { + for (LootItemList::iterator i=loot->items.begin(); i != loot->items.end(); ++i) + { + ItemPrototype const *item = ObjectMgr::GetItemPrototype(i->itemid); + if (!item) + continue; + if (item->Quality < uint32(m_lootThreshold)) + i->is_underthreshold = 1; + } + uint32 real_count = 0; WorldPacket data(SMSG_LOOT_MASTER_LIST, 330); diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index abd73ca34..6002f4cd3 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -724,11 +724,11 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) case ALL_PERMISSION: case MASTER_PERMISSION: { - uint8 slot_type = (lv.permission==MASTER_PERMISSION) ? 2 : 0; for (uint8 i = 0; i < l.items.size(); ++i) { if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer)) { + uint8 slot_type = (lv.permission==MASTER_PERMISSION && !l.items[i].is_underthreshold) ? 2 : 0; b << uint8(i) << l.items[i]; //only send one-player loot items now, free for all will be sent later b << uint8(slot_type); // 0 - get 2 - master selection ++itemsShown; diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 35662044a..455195942 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -101,6 +101,8 @@ struct LootItem bool AllowedForPlayer(Player const * player) const; }; +typedef std::vector LootItemList; + struct QuestItem { uint8 index; // position in quest_items; @@ -220,7 +222,7 @@ struct Loot QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; } QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; } - std::vector items; + LootItemList items; uint32 gold; uint8 unlootedCount; LootType loot_type; // required for achievement system @@ -281,7 +283,7 @@ struct Loot QuestItemList* FillQuestLoot(Player* player); QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player); - std::vector quest_items; + LootItemList quest_items; std::set PlayersLooting; QuestItemMap PlayerQuestItems; QuestItemMap PlayerFFAItems; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9161d2d7b..0009a2f59 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9963" + #define REVISION_NR "9964" #endif // __REVISION_NR_H__ From ff9990a7772349e10f8a61699747de37e0daebfb Mon Sep 17 00:00:00 2001 From: Insider42 Date: Sun, 23 May 2010 18:24:38 +0400 Subject: [PATCH 093/172] [9965] Fixed triggering of spell 55095 by 45524. (based on insider42's repo commit 90de00d) Signed-off-by: VladimirMangos It include reverts commit ca99760e884d82219fff63ecf5f2ca87b02b5924 with less clean implemetation. [patch 155] Fixed triggering of spell 55095 by 45524. Patch provided by me (based on commit 90de00d) --- src/game/Spell.cpp | 7 +++++++ src/game/SpellAuras.cpp | 8 -------- src/shared/revision_nr.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c098c6293..e8b45296f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2832,6 +2832,13 @@ void Spell::cast(bool skipCheck) AddTriggeredSpell(30708); // Totem of Wrath break; } + case SPELLFAMILY_DEATHKNIGHT: + { + // Chains of Ice + if (m_spellInfo->Id == 45524) + AddTriggeredSpell(55095); // Frost Fever + break; + } default: break; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 7a0c0d21f..a82653051 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6482,14 +6482,6 @@ void Aura::HandleSpellSpecificBoosts(bool apply) // second part of spell apply switch (GetId()) { - case 45524: // Chains of Ice - { - if (apply) - spellId1 = 55095; // Frost Fever - else - return; - break; - } case 49039: spellId1 = 50397; break; // Lichborne case 48263: // Frost Presence diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0009a2f59..a193a04c5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9964" + #define REVISION_NR "9965" #endif // __REVISION_NR_H__ From fe226f897b153dfdb1131269897ce09a4087d89c Mon Sep 17 00:00:00 2001 From: zergtmn Date: Sun, 23 May 2010 19:46:55 +0400 Subject: [PATCH 094/172] [9966] Add CharacterDatabaseCleaner to VS2010 filters. Signed-off-by: VladimirMangos --- src/shared/revision_nr.h | 2 +- win/VC100/game.vcxproj.filters | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a193a04c5..1556dce7f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9965" + #define REVISION_NR "9966" #endif // __REVISION_NR_H__ diff --git a/win/VC100/game.vcxproj.filters b/win/VC100/game.vcxproj.filters index dd5903ade..0e1ae5581 100644 --- a/win/VC100/game.vcxproj.filters +++ b/win/VC100/game.vcxproj.filters @@ -436,6 +436,9 @@ References + + Tool + @@ -820,5 +823,8 @@ References + + Tool + \ No newline at end of file From 628531933d18870426de9789d07969b3a5a68cba Mon Sep 17 00:00:00 2001 From: Laise Date: Sun, 23 May 2010 19:51:38 +0300 Subject: [PATCH 095/172] [9967] Fix 16164 proc conditions --- sql/mangos.sql | 4 ++-- sql/updates/9967_01_mangos_spell_proc_event.sql | 4 ++++ sql/updates/Makefile.am | 2 ++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 sql/updates/9967_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index cdda41786..bf37113a0 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9957_02_mangos_npc_vendor` bit(1) default NULL + `required_9967_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -18027,7 +18027,7 @@ INSERT INTO `spell_proc_event` VALUES (15362, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (15363, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (15600, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), -(16164, 0x00000000, 11, 0x901000C3, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16164, 0x0000001C, 11, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000002, 0.000000, 0.000000, 0), (16176, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16180, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16196, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), diff --git a/sql/updates/9967_01_mangos_spell_proc_event.sql b/sql/updates/9967_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..2fb01cafa --- /dev/null +++ b/sql/updates/9967_01_mangos_spell_proc_event.sql @@ -0,0 +1,4 @@ +ALTER TABLE db_version CHANGE COLUMN required_9957_02_mangos_npc_vendor required_9967_01_mangos_spell_proc_event bit; + +delete from `spell_proc_event` where entry = 16164; +insert into `spell_proc_event` values (16164, 0x0000001C, 11, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000002, 0.000000, 0.000000, 0); \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 1b392463f..c46a4b53b 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -69,6 +69,7 @@ pkgdata_DATA = \ 9924_02_mangos_command.sql \ 9957_01_mangos_mangos_string.sql \ 9957_02_mangos_npc_vendor.sql \ + 9967_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -118,4 +119,5 @@ EXTRA_DIST = \ 9924_02_mangos_command.sql \ 9957_01_mangos_mangos_string.sql \ 9957_02_mangos_npc_vendor.sql \ + 9967_01_mangos_spell_proc_event.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1556dce7f..50677248f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9966" + #define REVISION_NR "9967" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 5f6ed998d..506bdf907 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" - #define REVISION_DB_MANGOS "required_9957_02_mangos_npc_vendor" + #define REVISION_DB_MANGOS "required_9967_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From e3955bbc596b6867ff3d30412328f518e55e9232 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 24 May 2010 00:10:06 +0400 Subject: [PATCH 096/172] [9968] Allow have reserved entries with empty names in log filters table. --- src/mangosd/CliRunnable.cpp | 6 +++++- src/shared/Log.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index 9680afcfd..0f23f71e9 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -540,7 +540,8 @@ bool ChatHandler::HandleServerLogFilterCommand(const char* args) SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER); for(int i = 0; i < LOG_FILTER_COUNT; ++i) - PSendSysMessage(" %-20s = %s",logFilterData[i].name,(logfiler & (1 << i)) !=0 ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); + if (*logFilterData[i].name) + PSendSysMessage(" %-20s = %s",logFilterData[i].name,(logfiler & (1 << i)) !=0 ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); return true; } @@ -573,6 +574,9 @@ bool ChatHandler::HandleServerLogFilterCommand(const char* args) for(int i = 0; i < LOG_FILTER_COUNT; ++i) { + if (!*logFilterData[i].name) + continue; + if (!strncmp(filtername,logFilterData[i].name,strlen(filtername))) { sLog.SetLogFilter(LogFilters(1 << i),value); diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index e89ee6b32..05fe2525b 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -268,7 +268,7 @@ void Log::Initialize() m_logFilter = 0; for(int i = 0; i < LOG_FILTER_COUNT; ++i) - if (logFilterData[i].name) + if (*logFilterData[i].name) if (sConfig.GetBoolDefault(logFilterData[i].configName, logFilterData[i].defaultState)) m_logFilter |= (1 << i); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 50677248f..480d73566 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9967" + #define REVISION_NR "9968" #endif // __REVISION_NR_H__ From e55551013d951ed736b6b54a844f40554d14281b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 24 May 2010 11:29:38 +0400 Subject: [PATCH 097/172] [9969] Additional check for HandleAutoBankItemOpcode. --- src/game/ItemHandler.cpp | 8 ++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index f6935004e..2501be9c9 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -905,6 +905,14 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) return; } + // no-op: placed in same slot + if(dest.size() == 1 && dest[0].pos == pItem->GetPos()) + { + // just remove gray item state + _player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL ); + return; + } + _player->RemoveItem(srcbag, srcslot, true); _player->BankItem( dest, pItem, true ); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 480d73566..32aa9705f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9968" + #define REVISION_NR "9969" #endif // __REVISION_NR_H__ From 99586392027e7d812b6b680ecfa6252ef03fea43 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 24 May 2010 14:36:28 +0400 Subject: [PATCH 098/172] [9970] Fixed array free in vmap code --- src/shared/revision_nr.h | 2 +- src/shared/vmap/TileAssembler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 32aa9705f..8e3342018 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9969" + #define REVISION_NR "9970" #endif // __REVISION_NR_H__ diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index 7d4342b93..1d2c382cb 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -540,7 +540,7 @@ namespace VMAP if(vectorarray != 0) { - delete vectorarray; + delete[] vectorarray; } if(gtree->size() >0) From 25922d1e9b1f02bc14e7dbafac392732208770e8 Mon Sep 17 00:00:00 2001 From: Insider42 Date: Tue, 25 May 2010 13:43:01 +0400 Subject: [PATCH 099/172] [9971] Typo in BattleGroundQueue::AddGroup arg name Signed-off-by: VladimirMangos --- src/game/BattleGroundMgr.cpp | 8 ++++---- src/game/BattleGroundMgr.h | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 923674296..e8717296d 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -148,9 +148,9 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de /*********************************************************/ // add group or player (grp == NULL) to bg queue with the given leader and bg specifications -GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid) +GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid) { - BattleGroundBracketId bracketId = backetEntry->GetBracketId(); + BattleGroundBracketId bracketId = bracketEntry->GetBracketId(); // create new ginfo GroupQueueInfo* ginfo = new GroupQueueInfo; @@ -220,8 +220,8 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG uint32 MinPlayers = bg->GetMinPlayersPerTeam(); uint32 qHorde = 0; uint32 qAlliance = 0; - uint32 q_min_level = backetEntry->minLevel; - uint32 q_max_level = backetEntry->maxLevel; + uint32 q_min_level = bracketEntry->minLevel; + uint32 q_max_level = bracketEntry->maxLevel; GroupsQueueType::const_iterator itr; for(itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) if (!(*itr)->IsInvitedToBGInstanceGUID) diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 7273ddebd..a77def119 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -82,7 +82,7 @@ class BattleGroundQueue bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam); bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers); bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam); - GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); + GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8e3342018..9fd1ccd1a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9970" + #define REVISION_NR "9971" #endif // __REVISION_NR_H__ From fcbaafb2f59fe206dff5f0515be68a9bbdafeb1e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 25 May 2010 13:50:26 +0400 Subject: [PATCH 100/172] [9972] Move CharacterDatabaseCleaner.* to Tools group as for VS100 done. --- src/shared/revision_nr.h | 2 +- win/VC80/game.vcproj | 16 ++++++++-------- win/VC90/game.vcproj | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9fd1ccd1a..74776f7a5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9971" + #define REVISION_NR "9972" #endif // __REVISION_NR_H__ diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index 006d2d084..dff181fcc 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -697,14 +697,6 @@ RelativePath="..\..\src\game\ChannelMgr.h" > - - - - @@ -1541,6 +1533,14 @@ + + + + diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index dcad9f1b5..4003b3dba 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -698,14 +698,6 @@ RelativePath="..\..\src\game\ChannelMgr.h" > - - - - @@ -1542,6 +1534,14 @@ + + + + From dc82105963aa87faa690c5ecbb60e68232561173 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 25 May 2010 17:02:28 +0400 Subject: [PATCH 101/172] [9973] Fixed selection BG map difficulty. Thanks to insider42 for help in research problem. --- src/game/BattleGroundMgr.cpp | 4 +++- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index e8717296d..a7354174e 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1535,6 +1535,9 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI return 0; } + // set before Map creating for let use proper difficulty + bg->SetBracket(bracketEntry); + // will also set m_bgMap, instanceid sMapMgr.CreateBgMap(bg->GetMapId(), bg); @@ -1545,7 +1548,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI // start the joining of the bg bg->SetStatus(STATUS_WAIT_JOIN); - bg->SetBracket(bracketEntry); bg->SetArenaType(arenaType); bg->SetRated(isRated); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 74776f7a5..a7e0d2176 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9972" + #define REVISION_NR "9973" #endif // __REVISION_NR_H__ From 94888e52cd3c407731b659c578a6ebd575bc1691 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 26 May 2010 00:01:58 +0400 Subject: [PATCH 102/172] [9974] Restore raid functionality broken after one from 3.3.x switches. * Fixed typo in raid converting code that triggering raid disband at server restart. * Fixed current subgroup show for character and update group memebers data at move its in diff subgroups. --- sql/characters.sql | 4 ++-- sql/updates/9974_01_characters_group.sql | 8 ++++++++ sql/updates/Makefile.am | 2 ++ src/game/Group.cpp | 19 +++++++++---------- src/game/Group.h | 19 +++++++++++++++++++ src/game/ObjectMgr.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 8 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 sql/updates/9974_01_characters_group.sql diff --git a/sql/characters.sql b/sql/characters.sql index 10442ba6c..b9a158d18 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `character_db_version`; CREATE TABLE `character_db_version` ( - `required_9849_01_characters_saved_variables` bit(1) default NULL + `required_9974_01_characters_group` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -1033,7 +1033,7 @@ CREATE TABLE `groups` ( `icon6` int(11) unsigned NOT NULL, `icon7` int(11) unsigned NOT NULL, `icon8` int(11) unsigned NOT NULL, - `isRaid` tinyint(1) unsigned NOT NULL, + `groupType` tinyint(1) unsigned NOT NULL, `difficulty` tinyint(3) unsigned NOT NULL default '0', `raiddifficulty` int(11) UNSIGNED NOT NULL default '0', PRIMARY KEY (`groupId`), diff --git a/sql/updates/9974_01_characters_group.sql b/sql/updates/9974_01_characters_group.sql new file mode 100644 index 000000000..9bdc5ada8 --- /dev/null +++ b/sql/updates/9974_01_characters_group.sql @@ -0,0 +1,8 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_9849_01_characters_saved_variables required_9974_01_characters_group bit; + +ALTER TABLE groups + CHANGE COLUMN isRaid groupType tinyint(1) unsigned NOT NULL; + +/* now fixed bug in past can save raids as 1 (BG group) */ +UPDATE groups + SET groupType = 2 WHERE groupType = 1; \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index c46a4b53b..ee757a86d 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -70,6 +70,7 @@ pkgdata_DATA = \ 9957_01_mangos_mangos_string.sql \ 9957_02_mangos_npc_vendor.sql \ 9967_01_mangos_spell_proc_event.sql \ + 9974_01_characters_group.sql \ README ## Additional files to include when running 'make dist' @@ -120,4 +121,5 @@ EXTRA_DIST = \ 9957_01_mangos_mangos_string.sql \ 9957_02_mangos_npc_vendor.sql \ 9967_01_mangos_spell_proc_event.sql \ + 9974_01_characters_group.sql \ README diff --git a/src/game/Group.cpp b/src/game/Group.cpp index c2c83e3fc..7438b234b 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -111,10 +111,10 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id); - CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " + CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) " "VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", m_Id, GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), - GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), m_raidDifficulty); + GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), uint32(m_raidDifficulty)); } if(!AddMember(guid, name)) @@ -128,8 +128,8 @@ bool Group::Create(const uint64 &guid, const char * name) bool Group::LoadGroupFromDB(Field* fields) { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - // result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid, groupId FROM groups"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 + // result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups"); m_Id = fields[17].GetUInt32(); m_leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER); @@ -190,7 +190,7 @@ void Group::ConvertToRaid() _initRaidSubGroupsCounter(); if(!isBGGroup()) - CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE groupId='%u'", m_Id); + CharacterDatabase.PExecute("UPDATE groups SET groupType = %u WHERE groupId='%u'", uint8(m_groupType), m_Id); SendUpdate(); // update quest related GO states (quest activity dependent from raid membership) @@ -970,9 +970,9 @@ void Group::SendUpdate() // guess size WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+8+4+GetMembersCount()*20)); data << uint8(m_groupType); // group type (flags in 3.3) - data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup? data << uint8(citr->group); // groupid - data << uint8(citr->assistant ? 0x01 : 0x00); // 0x2 main assist, 0x4 main tank + data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup? + data << uint8(GetFlags(*citr)); // group flags if(m_groupType & GROUPTYPE_LFD) { data << uint8(0); @@ -991,10 +991,9 @@ void Group::SendUpdate() data << citr2->name; data << uint64(citr2->guid); - // online-state - data << uint8(onlineState); + data << uint8(onlineState); // online-state data << uint8(citr2->group); // groupid - data << uint8(citr2->assistant?0x01:0); // 0x2 main assist, 0x4 main tank + data << uint8(GetFlags(*citr2)); // group flags data << uint8(0); // 3.3, role? } diff --git a/src/game/Group.h b/src/game/Group.h index d43f3b68b..6b7229272 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -82,6 +82,13 @@ enum GroupType // group type flags? // 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group }; +enum GroupFlagMask +{ + GROUP_ASSISTENT = 0x01, + GROUP_MAIN_ASSISTENT = 0x02, + GROUP_MAIN_TANK = 0x04, +}; + class BattleGround; enum GroupUpdateFlags @@ -410,6 +417,18 @@ class MANGOS_DLL_SPEC Group void CountTheRoll(Rolls::iterator& roll); // iterator update to next, in CountRollVote if true bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, RollVote choise); + GroupFlagMask GetFlags(MemberSlot const& slot) const + { + uint8 flags = 0; + if (slot.assistant) + flags |= GROUP_ASSISTENT; + if (slot.guid == m_mainAssistant) + flags |= GROUP_MAIN_ASSISTENT; + if (slot.guid == m_mainTank) + flags |= GROUP_MAIN_TANK; + return GroupFlagMask(flags); + } + uint32 m_Id; // 0 for not created or BG groups MemberSlotList m_memberSlots; GroupRefManager m_memberMgr; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index e2ecc13e8..eea0b4495 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3159,8 +3159,8 @@ void ObjectMgr::LoadGroups() { // -- loading groups -- uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid, groupId FROM groups"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 + QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups"); if (!result) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a7e0d2176..81f397c23 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9973" + #define REVISION_NR "9974" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 506bdf907..96c21c6b0 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ - #define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" + #define REVISION_DB_CHARACTERS "required_9974_01_characters_group" #define REVISION_DB_MANGOS "required_9967_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From e6c874db138c27c1151b0896ae5840f607bbb340 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 26 May 2010 19:10:13 +0400 Subject: [PATCH 103/172] [9975] Use special function for honored/xp kill check --- src/game/SpellAuras.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a82653051..5eeba59c5 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3519,8 +3519,8 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) if (spellInfo->EffectItemType[m_effIndex] == 6265) { // Only from non-grey units - if ((victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) || - victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim))) + if (!((Player*)caster)->isHonorOrXPTarget(victim) || + victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim)) return; } @@ -7190,7 +7190,7 @@ void Aura::PeriodicTick() { // Only from non-grey units if (roll_chance_i(10) && // 1-2 from drain with final and without glyph, 0-1 from damage - m_target->getLevel() > MaNGOS::XP::GetGrayLevel(pCaster->getLevel()) && + ((Player*)pCaster)->isHonorOrXPTarget(m_target) && (m_target->GetTypeId() != TYPEID_UNIT || ((Player*)pCaster)->isAllowedToLoot((Creature*)m_target))) { pCaster->CastSpell(pCaster, 43836, true, NULL, this); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 81f397c23..39fb7e86c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9974" + #define REVISION_NR "9975" #endif // __REVISION_NR_H__ From 9dd2ccecf9c35dda870f5d2493916935444becf8 Mon Sep 17 00:00:00 2001 From: Olynn Date: Wed, 26 May 2010 19:15:46 +0400 Subject: [PATCH 104/172] [9976] Fixed typo in recently added group enums. Signed-off-by: VladimirMangos --- src/game/Group.h | 8 ++++---- src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/Group.h b/src/game/Group.h index 6b7229272..979d03a7a 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -84,8 +84,8 @@ enum GroupType // group type flags? enum GroupFlagMask { - GROUP_ASSISTENT = 0x01, - GROUP_MAIN_ASSISTENT = 0x02, + GROUP_ASSISTANT = 0x01, + GROUP_MAIN_ASSISTANT = 0x02, GROUP_MAIN_TANK = 0x04, }; @@ -421,9 +421,9 @@ class MANGOS_DLL_SPEC Group { uint8 flags = 0; if (slot.assistant) - flags |= GROUP_ASSISTENT; + flags |= GROUP_ASSISTANT; if (slot.guid == m_mainAssistant) - flags |= GROUP_MAIN_ASSISTENT; + flags |= GROUP_MAIN_ASSISTANT; if (slot.guid == m_mainTank) flags |= GROUP_MAIN_TANK; return GroupFlagMask(flags); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 39fb7e86c..b0fcecfd9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9975" + #define REVISION_NR "9976" #endif // __REVISION_NR_H__ From fe69843ce7fb52cadd6b822e381b19f2eecf56b4 Mon Sep 17 00:00:00 2001 From: insider42 Date: Wed, 26 May 2010 22:07:16 +0400 Subject: [PATCH 105/172] [9977] Update talent 16180 and ranks work. Signed-off-by: VladimirMangos --- sql/mangos.sql | 8 ++++---- sql/updates/9977_01_mangos_spell_proc_event.sql | 7 +++++++ sql/updates/Makefile.am | 2 ++ src/game/Unit.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 sql/updates/9977_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index bf37113a0..b56ecce55 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9967_01_mangos_spell_proc_event` bit(1) default NULL + `required_9977_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -18029,9 +18029,9 @@ INSERT INTO `spell_proc_event` VALUES (15600, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), (16164, 0x0000001C, 11, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000002, 0.000000, 0.000000, 0), (16176, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16180, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16196, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16198, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16180, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16196, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16198, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16235, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16240, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16256, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), diff --git a/sql/updates/9977_01_mangos_spell_proc_event.sql b/sql/updates/9977_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..9627bfd86 --- /dev/null +++ b/sql/updates/9977_01_mangos_spell_proc_event.sql @@ -0,0 +1,7 @@ +ALTER TABLE db_version CHANGE COLUMN required_9967_01_mangos_spell_proc_event required_9977_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (16180,16196,16198); +INSERT INTO `spell_proc_event` VALUES +(16180,0x00000000,11,0x000001C0,0x00000000,0x00000010,0x00000000,0x00000002,0.000000,0.000000, 0), +(16196,0x00000000,11,0x000001C0,0x00000000,0x00000010,0x00000000,0x00000002,0.000000,0.000000, 0), +(16198,0x00000000,11,0x000001C0,0x00000000,0x00000010,0x00000000,0x00000002,0.000000,0.000000, 0); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index ee757a86d..1bb5fe57b 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -71,6 +71,7 @@ pkgdata_DATA = \ 9957_02_mangos_npc_vendor.sql \ 9967_01_mangos_spell_proc_event.sql \ 9974_01_characters_group.sql \ + 9977_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -122,4 +123,5 @@ EXTRA_DIST = \ 9957_02_mangos_npc_vendor.sql \ 9967_01_mangos_spell_proc_event.sql \ 9974_01_characters_group.sql \ + 9977_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 962414e6a..241089e34 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6835,6 +6835,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Lesser Healing Wave need aditional 60% roll if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) && !roll_chance_i(60)) return false; + // Chain Heal needs additional 30% roll + if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000100)) && !roll_chance_i(30)) + return false; // lookup water shield AuraList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL); for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr) @@ -6844,13 +6847,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()]; CastSpell(this, spell, true, castItem, triggeredByAura); - if ((*itr)->DropAuraCharge()) - RemoveSingleSpellAurasFromStack((*itr)->GetId()); return true; } } return false; - break; } // Lightning Overload if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b0fcecfd9..59c8ee1b6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9976" + #define REVISION_NR "9977" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 96c21c6b0..9643bf7e6 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9974_01_characters_group" - #define REVISION_DB_MANGOS "required_9967_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_9977_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 4e716c67dabaabbf7d6f5d9303f6adec8f79d84c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 27 May 2010 00:00:51 +0400 Subject: [PATCH 106/172] [9978] Add explicit AP damage bonus for spells 55095, 55095. Original patch provided johonson. --- sql/mangos.sql | 4 +--- sql/updates/9978_01_mangos_spell_bonus_data.sql | 3 +++ sql/updates/Makefile.am | 2 ++ src/game/SpellAuras.cpp | 9 +++++++++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 sql/updates/9978_01_mangos_spell_bonus_data.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index b56ecce55..cb41b9181 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9977_01_mangos_spell_proc_event` bit(1) default NULL + `required_9978_01_mangos_spell_bonus_data` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -14204,12 +14204,10 @@ LOCK TABLES `spell_bonus_data` WRITE; INSERT INTO `spell_bonus_data` VALUES /* Death Knight */ (48721, 0, 0, 0.04, 'Death Knight - Blood Boil'), -(55078, 0, 0, 0.055, 'Death Knight - Blood Plague Dummy Proc'), (50444, 0, 0, 0.105, 'Death Knight - Corpse Explosion Triggered'), (52212, 0, 0, 0.0475,'Death Knight - Death and Decay Triggered'), (47632, 0, 0, 0.15, 'Death Knight - Death Coil Damage'), (47633, 0, 0, 0.15, 'Death Knight - Death Coil Heal'), -(55095, 0, 0, 0.055, 'Death Knight - Frost Fever'), (49184, 0, 0, 0.1, 'Death Knight - Howling Blast'), (45477, 0, 0, 0.1, 'Death Knight - Icy Touch'), (56903, 0, 0, 0, 'Death Knight - Lichflame'), diff --git a/sql/updates/9978_01_mangos_spell_bonus_data.sql b/sql/updates/9978_01_mangos_spell_bonus_data.sql new file mode 100644 index 000000000..d873ebd2e --- /dev/null +++ b/sql/updates/9978_01_mangos_spell_bonus_data.sql @@ -0,0 +1,3 @@ +ALTER TABLE db_version CHANGE COLUMN required_9977_01_mangos_spell_proc_event required_9978_01_mangos_spell_bonus_data bit; + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (55078,55095); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 1bb5fe57b..1aa945d73 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -72,6 +72,7 @@ pkgdata_DATA = \ 9967_01_mangos_spell_proc_event.sql \ 9974_01_characters_group.sql \ 9977_01_mangos_spell_proc_event.sql \ + 9978_01_mangos_spell_bonus_data.sql \ README ## Additional files to include when running 'make dist' @@ -124,4 +125,5 @@ EXTRA_DIST = \ 9967_01_mangos_spell_proc_event.sql \ 9974_01_characters_group.sql \ 9977_01_mangos_spell_proc_event.sql \ + 9978_01_mangos_spell_bonus_data.sql \ README diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 5eeba59c5..6af56f269 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4988,6 +4988,15 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) } break; } + case SPELLFAMILY_DEATHKNIGHT: + { + //Frost Fever and Blood Plague AP scale + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x400080000000000)) + { + m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.055f * 1.15f); + }; + break; + } default: break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 59c8ee1b6..87862dd7e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9977" + #define REVISION_NR "9978" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 9643bf7e6..f1a8a8506 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9974_01_characters_group" - #define REVISION_DB_MANGOS "required_9977_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_9978_01_mangos_spell_bonus_data" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 2681cd7de7b62ba224fa89f2105c485074986372 Mon Sep 17 00:00:00 2001 From: insider42 Date: Thu, 27 May 2010 00:32:09 +0400 Subject: [PATCH 107/172] [9979] Update max cooldown length req. for spell casting at arena. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 2 +- src/game/SpellMgr.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6af56f269..be54aa6c8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4994,7 +4994,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if (m_spellProto->SpellFamilyFlags & UI64LIT(0x400080000000000)) { m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.055f * 1.15f); - }; + } break; } default: diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 822158f7e..6a8a777f5 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -3212,9 +3212,9 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell // do not allow spells to be cast in arenas // - with SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA flag - // - with greater than 15 min CD + // - with greater than 10 min CD if ((spellInfo->AttributesEx4 & SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA) || - (GetSpellRecoveryTime(spellInfo) > 15 * MINUTE * IN_MILLISECONDS && !(spellInfo->AttributesEx4 & SPELL_ATTR_EX4_USABLE_IN_ARENA))) + (GetSpellRecoveryTime(spellInfo) > 10 * MINUTE * IN_MILLISECONDS && !(spellInfo->AttributesEx4 & SPELL_ATTR_EX4_USABLE_IN_ARENA))) if (player && player->InArena()) return SPELL_FAILED_NOT_IN_ARENA; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 87862dd7e..9050f64f5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9978" + #define REVISION_NR "9979" #endif // __REVISION_NR_H__ From afc9b281033b975455def9de0b9cc87b9b369178 Mon Sep 17 00:00:00 2001 From: zergtmn Date: Thu, 27 May 2010 10:00:59 +0200 Subject: [PATCH 108/172] [9980] Remove target guid in spell with TARGET_FLAG_DEST_LOCATION Corrects spell animations and visual going in weird directions for these kind of spells Signed-off-by: NoFantasy --- src/game/Spell.cpp | 6 +----- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e8b45296f..e79c4c548 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -300,11 +300,7 @@ void SpellCastTargets::write( ByteBuffer& data ) const if( m_targetMask & TARGET_FLAG_DEST_LOCATION ) { - if(m_unitTarget) - data << m_unitTarget->GetPackGUID(); - else - data << uint8(0); - + data << uint8(0); // no known cases with target pguid data << m_destX << m_destY << m_destZ; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9050f64f5..bdabb2268 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9979" + #define REVISION_NR "9980" #endif // __REVISION_NR_H__ From ce85076033641c163e3cab407e40519e67140927 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 27 May 2010 14:15:28 +0400 Subject: [PATCH 109/172] [9981] For non-player at "offline" delete hostile references. This must fix porblem with call message broadcast from unit destructor. --- src/game/Unit.cpp | 5 ++++- src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 241089e34..43fb20a08 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12020,7 +12020,10 @@ void Unit::CleanupsBeforeDelete() CombatStop(); ClearComboPointHolders(); DeleteThreatList(); - getHostileRefManager().setOnlineOfflineState(false); + if (GetTypeId()==TYPEID_PLAYER) + getHostileRefManager().setOnlineOfflineState(false); + else + getHostileRefManager().deleteReferences(); RemoveAllAuras(AURA_REMOVE_BY_DELETE); GetMotionMaster()->Clear(false); // remove different non-standard movement generators. } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bdabb2268..86fdf9e2f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9980" + #define REVISION_NR "9981" #endif // __REVISION_NR_H__ From d0398b94f6850dec0c1a7f5d4f1b416f7c5a8425 Mon Sep 17 00:00:00 2001 From: SilverIce Date: Thu, 27 May 2010 17:20:51 +0400 Subject: [PATCH 110/172] [9982] Group out of range member must based at client existances. Signed-off-by: VladimirMangos Also move empty mask check from build function to caller. --- src/game/Group.cpp | 12 ++++++------ src/game/GroupHandler.cpp | 7 +++---- src/shared/revision_nr.h | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 7438b234b..d53dfd52b 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1016,16 +1016,16 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer) if(!pPlayer || !pPlayer->IsInWorld()) return; - Player *player; + if (pPlayer->GetGroupUpdateFlag() == GROUP_UPDATE_FLAG_NONE) + return; + WorldPacket data; pPlayer->GetSession()->BuildPartyMemberStatsChangedPacket(pPlayer, &data); for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) - { - player = itr->getSource(); - if (player && player != pPlayer && !pPlayer->isVisibleFor(player,player->GetViewPoint())) - player->GetSession()->SendPacket(&data); - } + if (Player *player = itr->getSource()) + if (player != pPlayer && !player->HaveAtClient(pPlayer)) + player->GetSession()->SendPacket(&data); } void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int group, uint64 ignore) diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index d1347e505..42c14ed44 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -632,13 +632,10 @@ void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data // Is any reaction need? } -void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data) +bool WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data) { uint32 mask = player->GetGroupUpdateFlag(); - if (mask == GROUP_UPDATE_FLAG_NONE) - return; - if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER); @@ -789,6 +786,8 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke else *data << uint64(0); } + + return true; } /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 86fdf9e2f..f355953d2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9981" + #define REVISION_NR "9982" #endif // __REVISION_NR_H__ From 6ce82e491468963895d02146f76376c726828e0b Mon Sep 17 00:00:00 2001 From: Wowka321 Date: Thu, 27 May 2010 17:32:23 +0400 Subject: [PATCH 111/172] [9983] Leave at AFK applied only to battlegrounds (not arena) Signed-off-by: VladimirMangos Also restore build... --- src/game/GroupHandler.cpp | 4 +--- src/game/Player.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 42c14ed44..47fede5c2 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -632,7 +632,7 @@ void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data // Is any reaction need? } -bool WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data) +void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data) { uint32 mask = player->GetGroupUpdateFlag(); @@ -786,8 +786,6 @@ bool WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke else *data << uint64(0); } - - return true; } /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/ diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2e40e867a..fadd58cd8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1586,7 +1586,7 @@ bool Player::ToggleAFK() bool state = HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); // afk player not allowed in battleground - if(state && InBattleGround()) + if (state && InBattleGround() && !InArena()) LeaveBattleground(); return state; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f355953d2..b9c58413c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9982" + #define REVISION_NR "9983" #endif // __REVISION_NR_H__ From 86bef7ace55aea4204eb53016821c304f03d972c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 27 May 2010 19:08:24 +0400 Subject: [PATCH 112/172] [9984] Implement item 43214 work. * Original version suggested by timmit. * Required DB support for target requirement. --- sql/mangos_spell_check.sql | 2 ++ src/game/Spell.cpp | 13 +++++++++---- src/game/Spell.h | 1 + src/game/SpellEffects.cpp | 26 ++++++++++++++------------ src/shared/revision_nr.h | 2 +- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index d2ede6f9c..8ad7399d5 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -516,6 +516,8 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (57669,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Replenishment', 'Spell::SetTargetMap'), (57723,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Exhaustion', 'Spell::cast'), (57724,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Sated', 'Spell::cast'), +(57908, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Stain Cloth', 'Spell::EffectDummy'), +(57915,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Cloth', 'Spell::EffectDummy'), (58067,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Refreshment', 'Spell::EffectScriptEffect'), (58367,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Execution', 'Spell::EffectDummy'), (58418, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Portal to Orgrimmar', 'Spell::EffectDummy'), diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e79c4c548..0c1d69b8c 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3857,10 +3857,7 @@ void Spell::TakeCastItem() ((Player*)m_caster)->DestroyItemCount(m_CastItem, count, true); // prevent crash at access to deleted m_targets.getItemTarget - if(m_CastItem == m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); } } @@ -6634,4 +6631,12 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe target->CastSpell(target, spellId75, true); return; +} + +void Spell::ClearCastItem() +{ + if (m_CastItem==m_targets.getItemTarget()) + m_targets.setItemTarget(NULL); + + m_CastItem = NULL; } \ No newline at end of file diff --git a/src/game/Spell.h b/src/game/Spell.h index c6a372e1a..ebd8c03e1 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -497,6 +497,7 @@ class Spell void CastTriggerSpells(); void CleanupTargetList(); + void ClearCastItem(); static void SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial); protected: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2b01e0f71..3d55cb640 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1686,6 +1686,17 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; } + case 57908: // Stain Cloth + { + // nothing do more + finish(); + + m_caster->CastSpell(m_caster, 57915, false, m_CastItem); + + // cast item deleted + ClearCastItem(); + break; + } case 58418: // Portal to Orgrimmar case 58420: // Portal to Stormwind return; // implemented in EffectScript[0] @@ -3719,10 +3730,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if (m_CastItem==m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); player->StoreItem( dest, pNewItem, true); return; @@ -3737,10 +3745,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if (m_CastItem==m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); player->BankItem( dest, pNewItem, true); return; @@ -3755,10 +3760,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if (m_CastItem==m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); player->EquipItem( dest, pNewItem, true); player->AutoUnequipOffhandIfNeed(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b9c58413c..eff6bd626 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9983" + #define REVISION_NR "9984" #endif // __REVISION_NR_H__ From 4e61280466af2665521315cac5ecc571949499b1 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 27 May 2010 20:59:20 +0200 Subject: [PATCH 113/172] Send SMSG_CORPSE_NOT_IN_INSTANCE if player in ghost form tries to enter an instance without player's corpse. Signed-off-by: XTZGZoReX --- src/game/MapManager.cpp | 4 +++- src/game/Opcodes.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 1efe572ce..379aee55a 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -217,7 +217,9 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) if (!instance_map) { - player->GetSession()->SendAreaTriggerMessage("You cannot enter %s while in a ghost mode", mapName); + WorldPacket data(SMSG_CORPSE_IS_NOT_IN_INSTANCE); + player->GetSession()->SendPacket(&data); + DEBUG_LOG("MAP: Player '%s' doesn't has a corpse in instance '%s' and can't enter", player->GetName(), mapName); return false; } diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 47d77ffe3..e1c0c7ddb 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1312,7 +1312,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x503*/ { "UMSG_UNKNOWN_1283", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x504*/ { "UMSG_UNKNOWN_1284", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x505*/ { "UMSG_UNKNOWN_1285", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x506*/ { "UMSG_UNKNOWN_1286", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x506*/ { "SMSG_CORPSE_IS_NOT_IN_INSTANCE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x507*/ { "UMSG_UNKNOWN_1287", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x508*/ { "CMSG_SET_ALLOW_LOW_LEVEL_RAID1", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x509*/ { "CMSG_SET_ALLOW_LOW_LEVEL_RAID2", STATUS_NEVER, &WorldSession::Handle_NULL }, diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index eff6bd626..a041fe019 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9984" + #define REVISION_NR "9985" #endif // __REVISION_NR_H__ From 5a8c84a2ec174109eed8edd0c119df96f0f077bd Mon Sep 17 00:00:00 2001 From: insider42 Date: Fri, 28 May 2010 00:08:08 +0400 Subject: [PATCH 114/172] [9986] Talent 51459 and ranks affect only melee auto-attacks. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 4 ++++ src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 43fb20a08..3644450ac 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7007,6 +7007,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Necrosis if (dummySpell->SpellIconID == 2709) { + // only melee auto attack affected + if (!(procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT)) + return false; + basepoints[0] = triggerAmount * damage / 100; triggered_spell_id = 51460; break; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a041fe019..d6fdea40c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9985" + #define REVISION_NR "9986" #endif // __REVISION_NR_H__ From 4d61fba28f26d42f307e9a4dd61156bee8a7dd0b Mon Sep 17 00:00:00 2001 From: Tassadar Date: Fri, 28 May 2010 00:44:48 +0400 Subject: [PATCH 115/172] [9987] Restore work talent 12311 and ranks. Thanks to insider42 for prepare patch for mangos. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 6 ++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3644450ac..ddf3e35ad 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5691,6 +5691,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu triggered_spell_id = 22858; break; } + // Gag Order + if (dummySpell->SpellIconID == 280) + { + triggered_spell_id = 18498; // Silenced - Gag Order + break; + } // Second Wind if (dummySpell->SpellIconID == 1697) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d6fdea40c..e75ab0603 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9986" + #define REVISION_NR "9987" #endif // __REVISION_NR_H__ From 2cd5a6bbf2a48cd2f8510301bf39dbbf050c35cd Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 28 May 2010 01:48:39 +0400 Subject: [PATCH 116/172] [9988] Add correct spell chain data for 61024 and 61316. --- sql/mangos.sql | 6 +++++- sql/updates/9988_01_mangos_spell_chain.sql | 8 ++++++++ sql/updates/Makefile.am | 2 ++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 sql/updates/9988_01_mangos_spell_chain.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index cb41b9181..a8481455c 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9978_01_mangos_spell_bonus_data` bit(1) default NULL + `required_9988_01_mangos_spell_chain` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -15838,6 +15838,10 @@ INSERT INTO spell_chain VALUES (10140,10139,5504,7,0), (37420,10140,5504,8,0), (27090,37420,5504,9,0), +/*Dalaran Intellect*/ +(61024,61024,61024,1,27126), +/*Dalaran Brilliance*/ +(61316,61316,61316,1,27127), /*DampenMagic*/ (604,0,604,1,0), (8450,604,604,2,0), diff --git a/sql/updates/9988_01_mangos_spell_chain.sql b/sql/updates/9988_01_mangos_spell_chain.sql new file mode 100644 index 000000000..bf9c62735 --- /dev/null +++ b/sql/updates/9988_01_mangos_spell_chain.sql @@ -0,0 +1,8 @@ +ALTER TABLE db_version CHANGE COLUMN required_9978_01_mangos_spell_bonus_data required_9988_01_mangos_spell_chain bit; + +DELETE FROM `spell_chain` WHERE `spell_id` IN (61024,61316); +INSERT INTO `spell_chain` (`spell_id`, `prev_spell`, `first_spell`, `rank`, `req_spell`) VALUES +/*Dalaran Intellect*/ +(61024,61024,61024,1,27126), +/*Dalaran Brilliance*/ +(61316,61316,61316,1,27127); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 1aa945d73..6a9839ad9 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -73,6 +73,7 @@ pkgdata_DATA = \ 9974_01_characters_group.sql \ 9977_01_mangos_spell_proc_event.sql \ 9978_01_mangos_spell_bonus_data.sql \ + 9988_01_mangos_spell_chain.sql \ README ## Additional files to include when running 'make dist' @@ -126,4 +127,5 @@ EXTRA_DIST = \ 9974_01_characters_group.sql \ 9977_01_mangos_spell_proc_event.sql \ 9978_01_mangos_spell_bonus_data.sql \ + 9988_01_mangos_spell_chain.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e75ab0603..f0a2a4541 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9987" + #define REVISION_NR "9988" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index f1a8a8506..b2baaa9a2 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9974_01_characters_group" - #define REVISION_DB_MANGOS "required_9978_01_mangos_spell_bonus_data" + #define REVISION_DB_MANGOS "required_9988_01_mangos_spell_chain" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 5cd5462e17a1b88a2a335d7d73570221e526fc64 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 28 May 2010 02:26:00 +0400 Subject: [PATCH 117/172] [9989] Use unix styoe line ends in soem files --- .../doc/The MoPaQ File Format.txt | 636 +++++++++--------- .../vmap_extractor_v2/stormdll/StormDll.def | 48 +- .../stormlib/bzip2/dlltest.dsp | 186 ++--- .../stormlib/bzip2/libbz2.def | 54 +- .../stormlib/bzip2/libbz2.dsp | 260 +++---- .../stormlib/bzip2/makefile.msc | 126 ++-- src/shared/revision_nr.h | 2 +- 7 files changed, 656 insertions(+), 656 deletions(-) diff --git a/contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt b/contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt index 3a8f964cf..ce8d8f701 100644 --- a/contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt +++ b/contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt @@ -1,318 +1,318 @@ -THE MOPAQ ARCHIVE FORMAT -v0.9 (Thursday, June 30, 2005) -by Justin Olbrantz(Quantam) - -Distribution and reproduction of this specification are allowed without limitation, as long as it is not altered. Quoting -in other works is freely allowed, as long as the source and author of the quote is stated. - -TABLE OF CONTENTS -1. Introduction to the MoPaQ Format -2. The MoPaQ Format - 2.1 General Archive Layout - 2.2 Archive Header - 2.3 Block Table - 2.4 Hash Table - 2.5 File Data - 2.6 Listfile - 2.7 Extended Attributes - 2.8 Weak (Old) Digital Signature - 2.9 Strong (New) Digital Signature -3. Algorithm Source Code - 3.1 Encryption/Decryption - 3.2 Hashing - 3.3 Conversion of FILETIME and time_t - -1. INTRODUCTION TO THE MOPAQ FORMAT -The MoPaQ (or MPQ) format is an archive file format designed by Mike O'Brien (hence the name Mike O'brien PaCK) at Blizzard -Entertainment. The format has been used in all Blizzard games since (and including) Diablo. It is heavily optimized to be -a read-only game archive format, and excels at this role. - -The Blizzard MoPaQ-reading functions are contained in the Storm module, which my be either statically or dynamically linked. -The Blizzard MoPaQ-writing functions are contained in the MPQAPI module, which is always statically linked. - -2. THE MOPAQ FORMAT -All numbers in the MoPaQ format are in little endian. Data types are listed either as int (integer, the number of bits specified), -byte (8 bits), and char (bytes which contain ASCII characters). All sizes and offsets are in bytes, unless specified otherwise. -Structure members are listed in the following general form: -offset from the beginning of the structure: data type(array size) member name : member description - -2.1 GENERAL ARCHIVE LAYOUT -- Archive Header -- File Data -- File Data - Special Files -- Hash Table -- Block Table -- Strong Digital signature - -This is the usual archive format, and is not absolutely essential. Some archives have been observed placing the hash table -and file table after the archive header, and before the file data. - -2.2 ARCHIVE HEADER -00h: char(4) Magic : Indicates that the file is a MoPaQ archive. Must be ASCII "MPQ" 1Ah. -04h: int32 HeaderSize : Size of the archive header. Should be 32. -08h: int32 ArchiveSize : Size of the whole archive, including the header. Does not include the strong digital signature, if present. -This size is used, among other things, for determining the region to hash in computing the digital signature. -0Ch: int16 Unknown : Unknown -0Eh: int8 SectorSizeShift : Power of two exponent specifying the number of 512-byte disk sectors in each logical sector -in the archive. The size of each logical sector the archive is 512 * 2^SectorSizeShift. Bugs in the Storm library dictate -that this should always be 3 (4096 byte sectors). -10h: int32 HashTableOffset : Offset to the beginning of the hash table, relative to the beginning of the archive. -14h: int32 BlockTableOffset : Offset to the beginning of the block table, relative to the beginning of the archive. -18h: int32 HashTableEntries : Number of entries in the hash table. Must be a power of two, and must be less than 2^16. -1Ch: int32 BlockTableEntries : Number of entries in the block table. - -The archive header is the first structure in the archive, at archive offset 0, but the archive does not need to be at offset -0 of the containing file. The offset of the archive in the file is referred to here as ArchiveOffset. If the archive is not -at the beginning of the file, it must begin at a disk sector boundary (512 bytes). Early versions of Storm require that the -archive be at the end of the containing file (ArchiveOffset + ArchiveSize = file size), but this is not required in newer -versions (due to the strong digital signature not being considered a part of the archive). - -2.3 BLOCK TABLE -The block table contains entries for each region in the archive. Regions may be either files or empty space, which may be -overwritten by new files (typically this space is from deleted file data). The block table is encrypted, using the hash -of "(block table)" as the key. Each entry is structured as follows: - -00h: int32 BlockOffset : Offset of the beginning of the block, relative to the beginning of the archive. Meaningless if the block size is 0. -04h: int32 BlockSize : Size of the block in the archive. -08h: int32 FileSize : Size of the file data stored in the block. Only valid if the block is a file, otherwise meaningless, and should be 0. If the file is compressed, this is the size of the uncompressed file data. -0Ch: int32 Flags : Bit mask of the flags for the block. The following values are conclusively identified: - 80000000h: Block is a file, and follows the file data format; otherwise, block is free space, and may be overwritten. If the block is not a file, all other flags should be cleared. - 01000000h: File is stored as a single unit, rather than split into sectors. - 00020000h: The file's encryption key is adjusted by the block offset and file size (explained in detail in the File Data section). File must be encrypted. - 00010000h: File is encrypted. - 00000200h: File is compressed. Mutually exclusive to file imploded. - 00000100h: File is imploded. Mutually exclusive to file compressed. - -2.4 HASH TABLE -Instead of storing file names, for quick access MoPaQs use a fixed, power of two-size hash table of files in the archive. A file is uniquely identified by its file path, its language, and its platform. The home entry for a file in the hash table is computed as a hash of the file path. In the event of a collision (the home entry is occupied by another file), progressive overflow is used, and the file is placed in the next available hash table entry. Searches for a desired file in the hash table proceed from the home entry for the file until either the file is found, the entire hash table is searched, or an empty hash table entry (FileBlockIndex of FFFFFFFFh) is encountered. The hash table is encrypted using the hash of "(hash table)" as the key. Each entry is structured as follows: - -00h: int32 FilePathHashA : The hash of the file path, using method A. -04h: int32 FilePathHashB : The hash of the file path, using method B. -08h: int16 Language : The language of the file. This is a Windows LANGID data type, and uses the same values. 0 indicates the default language (American English), or that the file is language-neutral. -0Ah: int8 Platform : The platform the file is used for. 0 indicates the default platform. No other values have been observed. -0Ch: int32 FileBlockIndex : If the hash table entry is valid, this is the index into the block table of the file. Otherwise, one of the following two values: - FFFFFFFFh: Hash table entry is empty, and has always been empty. Terminates searches for a given file. - FFFFFFFEh: Hash table entry is empty, but was valid at some point (in other words, the file was deleted). Does not terminate searches for a given file. - -2.5 FILE DATA -00h: int32(SectorsInFile + 1) SectorOffsetTable : Offsets to the start of each sector's data, relative to the beginning of the file data. Not present if this information is calculatable (see details below). -immediately following SectorOffsetTable: SectorData : Data of each sector in the file, packed end to end (see details below). - -Normally, file data is split up into sectors, for simple streaming. All sectors, save for the last, will contain as many bytes of file data as specified in the archive header's SectorSizeShift; the last sector may be smaller than this, depending on the size of the file data. This sector size is the size of the raw file data; if the file is compressed, the compressed sector will be smaller or the same size as the uncompressed sector size. Individual sectors in a compressed file may be stored uncompressed; this occurs if and only if the sector could not be compressed by the algorithm used (if the compressed sector size was greater than or equal to the size of the raw data), and is indicated by the sector's compressed size in SectorOffsetTable being equal to the uncompressed size of the sector (which may be calculated from the FileSize). - -If the sector is compressed (but not imploded), a bit mask byte of the compression algorithm(s) used to compress the sector is appended to the beginning of the compressed sector data. This additional byte counts towards the total size of the sector; if the size of the sector (including this byte) exceeds or matches the uncompressed size of the sector data, the sector will be stored uncompressed, and this byte omitted. Multiple compression algorithms may be used on the same sector; in this case, successive compression occurs in the order the algorithms are listed below, and decompression occurs in the opposite order. For implimentations of all of these algorithms, see StormLib. - 40h: IMA ADPCM mono - 80h: IMA ADPCM stereo - 01h: Huffman encoded - 02h: Deflated (see ZLib) - 08h: Imploded (see PKWare Data Compression Library) - 10h: BZip2 compressed (see BZip2) - -If the file is stored as a single unit (indicated in the file's Flags), there is effectively only a single sector, which -contains the entire file. - -If the file is encrypted, each sector (after compression and appendage of the compression type byte, if applicable) -is encrypted with the file's key. The base key for a file is determined by a hash of the file name stripped of the -directory (i.e. the key for a file named "directory\file" would be computed as the hash of "file"). If this key is -adjusted, as indicated in the file's Flags, the final key is calculated as ((base key + BlockOffset - ArchiveOffset) -XOR FileSize) (StormLib - an open-source implementation of the MoPaQ reading and writing functions, -by Ladislav Zezula - incorrectly uses an AND in place of the XOR). Each sector is encrypted using the key + the -0-based index of the sector in the file. The SectorOffsetTable, if present, is encrypted using the key - 1. - -The SectorOffsetTable is omitted when the sizes and offsets of all sectors in the file are calculatable from the FileSize. -This can happen in several circumstances. If the file is not compressed/imploded, then the size and offset of all sectors -is known, based on the archive's SectorSizeShift. If the file is stored as a single unit compressed/imploded, then the -SectorOffsetTable is omitted, as the single file "sector" corresponds to BlockSize and FileSize, as mentioned previously. -Note that the SectorOffsetTable will always be present if the file is compressed/imploded and the file is not stored as -a single unit, even if there is only a single sector in the file (the size of the file is less than or equal to the -archive's sector size). - -2.6 LISTFILE -The listfile is a very simple extension to the MoPaQ format that contains the file paths of (most) files in the archive. -The languages and platforms of the files are not stored in the listfile. The listfile is contained in the file "(listfile)", -and is simply a non-Unix-style text file with one file path on each line, lines terminated with the bytes 0Dh 0Ah. The file -"(listfile)" may not be listed in the listfile. - -2.7 EXTENDED ATTRIBUTES -The extended attributes are optional file attributes for files in the block table. These attributes were added at times after -the MoPaQ format was already finalized, and it is not necessary for every archive to have all (or any) of the extended attributes. -If an archive contains a given attribute, there will be an instance of that attribute for every block in the block table, although -the attribute will be meaningless if the block is not a file. The order of the attributes for blocks correspond to the order of the -blocks in the block table, and are of the same number. The attributes are stored in parallel arrays in the "(attributes)" file, -in the archive. The attributes corresponding to this file need not be valid (and logically cannot be). Unlike all the other -structures in the MoPaQ format, entries in the extended attributes are NOT guaranteed to be aligned. Also note that in some -archives, malicious zeroing of the attributes has been observed, perhaps with the intent of breaking archive viewers. This -file is structured as follows: - -00h: int32 Version : Specifies the extended attributes format version. For now, must be 100. -04h: int32 AttributesPresent : Bit mask of the extended attributes present in the archive: - 00000001h: File CRC32s. - 00000002h: File timestamps. - 00000004h: File MD5s. -08h: int32(BlockTableEntries) CRC32s : CRC32s of the (uncompressed) file data for each block in the archive. Omitted if the -archive does not have CRC32s. immediately after CRC32s: FILETIME(BlockTableEntries) Timestamps : Timestamps for each block -in the archive. The format is that of the Windows FILETIME structure. Omitted if the archive does not have timestamps. -immediately after Timestamps: MD5(BlockTableEntries) MD5s : MD5s of the (uncompressed) file data for each block in the archive. -Omitted if the archive does not have MD5s. - -2.8 WEAK DIGITAL SIGNATURE -The weak digital signature is a digital signature using Microsoft CryptoAPI. It is an implimentation of the RSASSA-PKCS1-v1_5 -digital signature protocol, using the MD5 hashing algorithm and a 512-bit (weak) RSA key (for more information about this -protocol, see the RSA Labs PKCS1 specification). The public key and exponent are stored in a resource in Storm. The signature -is stored uncompressed, unencrypted in the file "(signature)" in the archive. The archive is hashed from the beginning of the -archive (ArchiveOffset in the containing file) to the end of the archive (the length indicated by ArchiveSize); the signature -file is added to the archive before signing, and the space occupied by the file is considered to be all binary 0s during -signing/verification. This file is structured as follows: - -00h: int32 Unknown : Must be 0. -04h: int32 Unknown : must be 0. -08h: int512 Signature : The digital signature. Like all other numbers in the MoPaQ format, this is stored in little-endian order. - -2.9 STRONG DIGITAL SIGNATURE -The strong digital signature uses a simple proprietary implementation of RSA signing, using the SHA-1 hashing algorithm and -a 2048-bit (strong) RSA key. The default public key and exponent are stored in Storm, but other keys may be used as well. -The strong digital signature is stored immediately after the archive, in the containing file; the entire archive (ArchiveSize -bytes, starting at ArchiveOffset in the containing file) is hashed as a single block. The signature has the following format: - -00h: char(4) Magic : Indicates the presence of a digital signature. Must be "NGIS" ("SIGN" backwards). -04h: int2048 Signature : The digital signature, stored in little-endian format. - -When the Signature field is decrypted with the public key and exponent, and the result stored in little-endian order, it is structured as follows: - -00h: byte Padding : Must be 0Bh. -01h: byte(235) Padding : Must be BBh. -ECh: byte(20) SHA-1 : SHA-1 hash of the archive, in standard SHA-1 format. - -3. ALGORITHM SOURCE CODE -3.1 ENCRYPTION/DECRYPTION -I believe this was derived at some point from code in StormLib. Assumes the long type to be 32 bits, and the machine to be little endian order. - -unsigned long dwCryptTable[0x500]; - -void InitializeCryptTable() -{ - unsigned long seed = 0x00100001; - unsigned long index1 = 0; - unsigned long index2 = 0; - int i; - - for (index1 = 0; index1 < 0x100; index1++) - { - for (index2 = index1, i = 0; i < 5; i++, index2 += 0x100) - { - unsigned long temp1, temp2; - - seed = (seed * 125 + 3) % 0x2AAAAB; - temp1 = (seed & 0xFFFF) << 0x10; - - seed = (seed * 125 + 3) % 0x2AAAAB; - temp2 = (seed & 0xFFFF); - - dwCryptTable[index2] = (temp1 | temp2); - } - } -} - -void EncryptData(void *lpbyBuffer, unsigned long dwLength, unsigned long dwKey) -{ - unsigned long *lpdwBuffer = (unsigned long *)lpbyBuffer; - unsigned long seed = 0xEEEEEEEE; - unsigned long ch; - - assert(lpbyBuffer); - - dwLength /= sizeof(unsigned long); - - while(dwLength-- > 0) - { - seed += dwCryptTable[0x400 + (dwKey & 0xFF)]; - ch = *lpdwBuffer ^ (dwKey + seed); - - dwKey = ((~dwKey << 0x15) + 0x11111111) | (dwKey >> 0x0B); - seed = *lpdwBuffer + seed + (seed << 5) + 3; - - *lpdwBuffer++ = ch; - } -} - -void DecryptData(void *lpbyBuffer, unsigned long dwLength, unsigned long dwKey) -{ - unsigned long *lpdwBuffer = (unsigned long *)lpbyBuffer; - unsigned long seed = 0xEEEEEEEE; - unsigned long ch; - - assert(lpbyBuffer); - - dwLength /= sizeof(unsigned long); - - while(dwLength-- > 0) - { - seed += dwCryptTable[0x400 + (dwKey & 0xFF)]; - ch = *lpdwBuffer ^ (dwKey + seed); - - dwKey = ((~dwKey << 0x15) + 0x11111111) | (dwKey >> 0x0B); - seed = ch + seed + (seed << 5) + 3; - - *lpdwBuffer++ = ch; - } -} - -3.2 HASHING -Based on code from StormLib. - -// Different types of hashes to make with HashString -#define MPQ_HASH_TABLE_OFFSET 0 -#define MPQ_HASH_NAME_A 1 -#define MPQ_HASH_NAME_B 2 -#define MPQ_HASH_FILE_KEY 3 - -unsigned long HashString(const char *lpszString, unsigned long dwHashType) -{ - unsigned long seed1 = 0x7FED7FED; - unsigned long seed2 = 0xEEEEEEEE; - int ch; - - while (*lpszString != 0) - { - ch = toupper(*lpszString++); - - seed1 = dwCryptTable[(dwHashType * 0xFF) + ch] ^ (seed1 + seed2); - seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; - } - return seed1; -} - -3.3 CONVERSION OF FILETIME AND time_t - -#define EPOCH_OFFSET 116444736000000000ULL // Number of 100 ns units between 01/01/1601 and 01/01/1970 - -bool GetTimeFromFileTime(FILETIME &fileTime, time_t &time) -{ - // The FILETIME represents a 64-bit integer: the number of 100 ns units since January 1, 1601 - unsigned long long nTime = ((unsigned long long)fileTime.dwHighDateTime << 32) + fileTime.dwLowDateTime; - - if (nTime < EPOCH_OFFSET) - return false; - - nTime -= EPOCH_OFFSET; // Convert the time base from 01/01/1601 to 01/01/1970 - nTime /= 10000000ULL; // Convert 100 ns to sec - - time = (time_t)nTime; - - // Test for overflow (FILETIME is 64 bits, time_t is 32 bits) - if ((nTime - (unsigned long long)time) > 0) - return false; - - return true; -} - -void GetFileTimeFromTime(time_t &time, FILETIME &fileTime) -{ - unsigned long long nTime = (unsigned long long)time; - - nTime *= 10000000ULL; - nTime += EPOCH_OFFSET; - - fileTime.dwLowDateTime = (DWORD)nTime; - fileTime.dwHighDateTime = (DWORD)(nTime >> 32); -} +THE MOPAQ ARCHIVE FORMAT +v0.9 (Thursday, June 30, 2005) +by Justin Olbrantz(Quantam) + +Distribution and reproduction of this specification are allowed without limitation, as long as it is not altered. Quoting +in other works is freely allowed, as long as the source and author of the quote is stated. + +TABLE OF CONTENTS +1. Introduction to the MoPaQ Format +2. The MoPaQ Format + 2.1 General Archive Layout + 2.2 Archive Header + 2.3 Block Table + 2.4 Hash Table + 2.5 File Data + 2.6 Listfile + 2.7 Extended Attributes + 2.8 Weak (Old) Digital Signature + 2.9 Strong (New) Digital Signature +3. Algorithm Source Code + 3.1 Encryption/Decryption + 3.2 Hashing + 3.3 Conversion of FILETIME and time_t + +1. INTRODUCTION TO THE MOPAQ FORMAT +The MoPaQ (or MPQ) format is an archive file format designed by Mike O'Brien (hence the name Mike O'brien PaCK) at Blizzard +Entertainment. The format has been used in all Blizzard games since (and including) Diablo. It is heavily optimized to be +a read-only game archive format, and excels at this role. + +The Blizzard MoPaQ-reading functions are contained in the Storm module, which my be either statically or dynamically linked. +The Blizzard MoPaQ-writing functions are contained in the MPQAPI module, which is always statically linked. + +2. THE MOPAQ FORMAT +All numbers in the MoPaQ format are in little endian. Data types are listed either as int (integer, the number of bits specified), +byte (8 bits), and char (bytes which contain ASCII characters). All sizes and offsets are in bytes, unless specified otherwise. +Structure members are listed in the following general form: +offset from the beginning of the structure: data type(array size) member name : member description + +2.1 GENERAL ARCHIVE LAYOUT +- Archive Header +- File Data +- File Data - Special Files +- Hash Table +- Block Table +- Strong Digital signature + +This is the usual archive format, and is not absolutely essential. Some archives have been observed placing the hash table +and file table after the archive header, and before the file data. + +2.2 ARCHIVE HEADER +00h: char(4) Magic : Indicates that the file is a MoPaQ archive. Must be ASCII "MPQ" 1Ah. +04h: int32 HeaderSize : Size of the archive header. Should be 32. +08h: int32 ArchiveSize : Size of the whole archive, including the header. Does not include the strong digital signature, if present. +This size is used, among other things, for determining the region to hash in computing the digital signature. +0Ch: int16 Unknown : Unknown +0Eh: int8 SectorSizeShift : Power of two exponent specifying the number of 512-byte disk sectors in each logical sector +in the archive. The size of each logical sector the archive is 512 * 2^SectorSizeShift. Bugs in the Storm library dictate +that this should always be 3 (4096 byte sectors). +10h: int32 HashTableOffset : Offset to the beginning of the hash table, relative to the beginning of the archive. +14h: int32 BlockTableOffset : Offset to the beginning of the block table, relative to the beginning of the archive. +18h: int32 HashTableEntries : Number of entries in the hash table. Must be a power of two, and must be less than 2^16. +1Ch: int32 BlockTableEntries : Number of entries in the block table. + +The archive header is the first structure in the archive, at archive offset 0, but the archive does not need to be at offset +0 of the containing file. The offset of the archive in the file is referred to here as ArchiveOffset. If the archive is not +at the beginning of the file, it must begin at a disk sector boundary (512 bytes). Early versions of Storm require that the +archive be at the end of the containing file (ArchiveOffset + ArchiveSize = file size), but this is not required in newer +versions (due to the strong digital signature not being considered a part of the archive). + +2.3 BLOCK TABLE +The block table contains entries for each region in the archive. Regions may be either files or empty space, which may be +overwritten by new files (typically this space is from deleted file data). The block table is encrypted, using the hash +of "(block table)" as the key. Each entry is structured as follows: + +00h: int32 BlockOffset : Offset of the beginning of the block, relative to the beginning of the archive. Meaningless if the block size is 0. +04h: int32 BlockSize : Size of the block in the archive. +08h: int32 FileSize : Size of the file data stored in the block. Only valid if the block is a file, otherwise meaningless, and should be 0. If the file is compressed, this is the size of the uncompressed file data. +0Ch: int32 Flags : Bit mask of the flags for the block. The following values are conclusively identified: + 80000000h: Block is a file, and follows the file data format; otherwise, block is free space, and may be overwritten. If the block is not a file, all other flags should be cleared. + 01000000h: File is stored as a single unit, rather than split into sectors. + 00020000h: The file's encryption key is adjusted by the block offset and file size (explained in detail in the File Data section). File must be encrypted. + 00010000h: File is encrypted. + 00000200h: File is compressed. Mutually exclusive to file imploded. + 00000100h: File is imploded. Mutually exclusive to file compressed. + +2.4 HASH TABLE +Instead of storing file names, for quick access MoPaQs use a fixed, power of two-size hash table of files in the archive. A file is uniquely identified by its file path, its language, and its platform. The home entry for a file in the hash table is computed as a hash of the file path. In the event of a collision (the home entry is occupied by another file), progressive overflow is used, and the file is placed in the next available hash table entry. Searches for a desired file in the hash table proceed from the home entry for the file until either the file is found, the entire hash table is searched, or an empty hash table entry (FileBlockIndex of FFFFFFFFh) is encountered. The hash table is encrypted using the hash of "(hash table)" as the key. Each entry is structured as follows: + +00h: int32 FilePathHashA : The hash of the file path, using method A. +04h: int32 FilePathHashB : The hash of the file path, using method B. +08h: int16 Language : The language of the file. This is a Windows LANGID data type, and uses the same values. 0 indicates the default language (American English), or that the file is language-neutral. +0Ah: int8 Platform : The platform the file is used for. 0 indicates the default platform. No other values have been observed. +0Ch: int32 FileBlockIndex : If the hash table entry is valid, this is the index into the block table of the file. Otherwise, one of the following two values: + FFFFFFFFh: Hash table entry is empty, and has always been empty. Terminates searches for a given file. + FFFFFFFEh: Hash table entry is empty, but was valid at some point (in other words, the file was deleted). Does not terminate searches for a given file. + +2.5 FILE DATA +00h: int32(SectorsInFile + 1) SectorOffsetTable : Offsets to the start of each sector's data, relative to the beginning of the file data. Not present if this information is calculatable (see details below). +immediately following SectorOffsetTable: SectorData : Data of each sector in the file, packed end to end (see details below). + +Normally, file data is split up into sectors, for simple streaming. All sectors, save for the last, will contain as many bytes of file data as specified in the archive header's SectorSizeShift; the last sector may be smaller than this, depending on the size of the file data. This sector size is the size of the raw file data; if the file is compressed, the compressed sector will be smaller or the same size as the uncompressed sector size. Individual sectors in a compressed file may be stored uncompressed; this occurs if and only if the sector could not be compressed by the algorithm used (if the compressed sector size was greater than or equal to the size of the raw data), and is indicated by the sector's compressed size in SectorOffsetTable being equal to the uncompressed size of the sector (which may be calculated from the FileSize). + +If the sector is compressed (but not imploded), a bit mask byte of the compression algorithm(s) used to compress the sector is appended to the beginning of the compressed sector data. This additional byte counts towards the total size of the sector; if the size of the sector (including this byte) exceeds or matches the uncompressed size of the sector data, the sector will be stored uncompressed, and this byte omitted. Multiple compression algorithms may be used on the same sector; in this case, successive compression occurs in the order the algorithms are listed below, and decompression occurs in the opposite order. For implimentations of all of these algorithms, see StormLib. + 40h: IMA ADPCM mono + 80h: IMA ADPCM stereo + 01h: Huffman encoded + 02h: Deflated (see ZLib) + 08h: Imploded (see PKWare Data Compression Library) + 10h: BZip2 compressed (see BZip2) + +If the file is stored as a single unit (indicated in the file's Flags), there is effectively only a single sector, which +contains the entire file. + +If the file is encrypted, each sector (after compression and appendage of the compression type byte, if applicable) +is encrypted with the file's key. The base key for a file is determined by a hash of the file name stripped of the +directory (i.e. the key for a file named "directory\file" would be computed as the hash of "file"). If this key is +adjusted, as indicated in the file's Flags, the final key is calculated as ((base key + BlockOffset - ArchiveOffset) +XOR FileSize) (StormLib - an open-source implementation of the MoPaQ reading and writing functions, +by Ladislav Zezula - incorrectly uses an AND in place of the XOR). Each sector is encrypted using the key + the +0-based index of the sector in the file. The SectorOffsetTable, if present, is encrypted using the key - 1. + +The SectorOffsetTable is omitted when the sizes and offsets of all sectors in the file are calculatable from the FileSize. +This can happen in several circumstances. If the file is not compressed/imploded, then the size and offset of all sectors +is known, based on the archive's SectorSizeShift. If the file is stored as a single unit compressed/imploded, then the +SectorOffsetTable is omitted, as the single file "sector" corresponds to BlockSize and FileSize, as mentioned previously. +Note that the SectorOffsetTable will always be present if the file is compressed/imploded and the file is not stored as +a single unit, even if there is only a single sector in the file (the size of the file is less than or equal to the +archive's sector size). + +2.6 LISTFILE +The listfile is a very simple extension to the MoPaQ format that contains the file paths of (most) files in the archive. +The languages and platforms of the files are not stored in the listfile. The listfile is contained in the file "(listfile)", +and is simply a non-Unix-style text file with one file path on each line, lines terminated with the bytes 0Dh 0Ah. The file +"(listfile)" may not be listed in the listfile. + +2.7 EXTENDED ATTRIBUTES +The extended attributes are optional file attributes for files in the block table. These attributes were added at times after +the MoPaQ format was already finalized, and it is not necessary for every archive to have all (or any) of the extended attributes. +If an archive contains a given attribute, there will be an instance of that attribute for every block in the block table, although +the attribute will be meaningless if the block is not a file. The order of the attributes for blocks correspond to the order of the +blocks in the block table, and are of the same number. The attributes are stored in parallel arrays in the "(attributes)" file, +in the archive. The attributes corresponding to this file need not be valid (and logically cannot be). Unlike all the other +structures in the MoPaQ format, entries in the extended attributes are NOT guaranteed to be aligned. Also note that in some +archives, malicious zeroing of the attributes has been observed, perhaps with the intent of breaking archive viewers. This +file is structured as follows: + +00h: int32 Version : Specifies the extended attributes format version. For now, must be 100. +04h: int32 AttributesPresent : Bit mask of the extended attributes present in the archive: + 00000001h: File CRC32s. + 00000002h: File timestamps. + 00000004h: File MD5s. +08h: int32(BlockTableEntries) CRC32s : CRC32s of the (uncompressed) file data for each block in the archive. Omitted if the +archive does not have CRC32s. immediately after CRC32s: FILETIME(BlockTableEntries) Timestamps : Timestamps for each block +in the archive. The format is that of the Windows FILETIME structure. Omitted if the archive does not have timestamps. +immediately after Timestamps: MD5(BlockTableEntries) MD5s : MD5s of the (uncompressed) file data for each block in the archive. +Omitted if the archive does not have MD5s. + +2.8 WEAK DIGITAL SIGNATURE +The weak digital signature is a digital signature using Microsoft CryptoAPI. It is an implimentation of the RSASSA-PKCS1-v1_5 +digital signature protocol, using the MD5 hashing algorithm and a 512-bit (weak) RSA key (for more information about this +protocol, see the RSA Labs PKCS1 specification). The public key and exponent are stored in a resource in Storm. The signature +is stored uncompressed, unencrypted in the file "(signature)" in the archive. The archive is hashed from the beginning of the +archive (ArchiveOffset in the containing file) to the end of the archive (the length indicated by ArchiveSize); the signature +file is added to the archive before signing, and the space occupied by the file is considered to be all binary 0s during +signing/verification. This file is structured as follows: + +00h: int32 Unknown : Must be 0. +04h: int32 Unknown : must be 0. +08h: int512 Signature : The digital signature. Like all other numbers in the MoPaQ format, this is stored in little-endian order. + +2.9 STRONG DIGITAL SIGNATURE +The strong digital signature uses a simple proprietary implementation of RSA signing, using the SHA-1 hashing algorithm and +a 2048-bit (strong) RSA key. The default public key and exponent are stored in Storm, but other keys may be used as well. +The strong digital signature is stored immediately after the archive, in the containing file; the entire archive (ArchiveSize +bytes, starting at ArchiveOffset in the containing file) is hashed as a single block. The signature has the following format: + +00h: char(4) Magic : Indicates the presence of a digital signature. Must be "NGIS" ("SIGN" backwards). +04h: int2048 Signature : The digital signature, stored in little-endian format. + +When the Signature field is decrypted with the public key and exponent, and the result stored in little-endian order, it is structured as follows: + +00h: byte Padding : Must be 0Bh. +01h: byte(235) Padding : Must be BBh. +ECh: byte(20) SHA-1 : SHA-1 hash of the archive, in standard SHA-1 format. + +3. ALGORITHM SOURCE CODE +3.1 ENCRYPTION/DECRYPTION +I believe this was derived at some point from code in StormLib. Assumes the long type to be 32 bits, and the machine to be little endian order. + +unsigned long dwCryptTable[0x500]; + +void InitializeCryptTable() +{ + unsigned long seed = 0x00100001; + unsigned long index1 = 0; + unsigned long index2 = 0; + int i; + + for (index1 = 0; index1 < 0x100; index1++) + { + for (index2 = index1, i = 0; i < 5; i++, index2 += 0x100) + { + unsigned long temp1, temp2; + + seed = (seed * 125 + 3) % 0x2AAAAB; + temp1 = (seed & 0xFFFF) << 0x10; + + seed = (seed * 125 + 3) % 0x2AAAAB; + temp2 = (seed & 0xFFFF); + + dwCryptTable[index2] = (temp1 | temp2); + } + } +} + +void EncryptData(void *lpbyBuffer, unsigned long dwLength, unsigned long dwKey) +{ + unsigned long *lpdwBuffer = (unsigned long *)lpbyBuffer; + unsigned long seed = 0xEEEEEEEE; + unsigned long ch; + + assert(lpbyBuffer); + + dwLength /= sizeof(unsigned long); + + while(dwLength-- > 0) + { + seed += dwCryptTable[0x400 + (dwKey & 0xFF)]; + ch = *lpdwBuffer ^ (dwKey + seed); + + dwKey = ((~dwKey << 0x15) + 0x11111111) | (dwKey >> 0x0B); + seed = *lpdwBuffer + seed + (seed << 5) + 3; + + *lpdwBuffer++ = ch; + } +} + +void DecryptData(void *lpbyBuffer, unsigned long dwLength, unsigned long dwKey) +{ + unsigned long *lpdwBuffer = (unsigned long *)lpbyBuffer; + unsigned long seed = 0xEEEEEEEE; + unsigned long ch; + + assert(lpbyBuffer); + + dwLength /= sizeof(unsigned long); + + while(dwLength-- > 0) + { + seed += dwCryptTable[0x400 + (dwKey & 0xFF)]; + ch = *lpdwBuffer ^ (dwKey + seed); + + dwKey = ((~dwKey << 0x15) + 0x11111111) | (dwKey >> 0x0B); + seed = ch + seed + (seed << 5) + 3; + + *lpdwBuffer++ = ch; + } +} + +3.2 HASHING +Based on code from StormLib. + +// Different types of hashes to make with HashString +#define MPQ_HASH_TABLE_OFFSET 0 +#define MPQ_HASH_NAME_A 1 +#define MPQ_HASH_NAME_B 2 +#define MPQ_HASH_FILE_KEY 3 + +unsigned long HashString(const char *lpszString, unsigned long dwHashType) +{ + unsigned long seed1 = 0x7FED7FED; + unsigned long seed2 = 0xEEEEEEEE; + int ch; + + while (*lpszString != 0) + { + ch = toupper(*lpszString++); + + seed1 = dwCryptTable[(dwHashType * 0xFF) + ch] ^ (seed1 + seed2); + seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; + } + return seed1; +} + +3.3 CONVERSION OF FILETIME AND time_t + +#define EPOCH_OFFSET 116444736000000000ULL // Number of 100 ns units between 01/01/1601 and 01/01/1970 + +bool GetTimeFromFileTime(FILETIME &fileTime, time_t &time) +{ + // The FILETIME represents a 64-bit integer: the number of 100 ns units since January 1, 1601 + unsigned long long nTime = ((unsigned long long)fileTime.dwHighDateTime << 32) + fileTime.dwLowDateTime; + + if (nTime < EPOCH_OFFSET) + return false; + + nTime -= EPOCH_OFFSET; // Convert the time base from 01/01/1601 to 01/01/1970 + nTime /= 10000000ULL; // Convert 100 ns to sec + + time = (time_t)nTime; + + // Test for overflow (FILETIME is 64 bits, time_t is 32 bits) + if ((nTime - (unsigned long long)time) > 0) + return false; + + return true; +} + +void GetFileTimeFromTime(time_t &time, FILETIME &fileTime) +{ + unsigned long long nTime = (unsigned long long)time; + + nTime *= 10000000ULL; + nTime += EPOCH_OFFSET; + + fileTime.dwLowDateTime = (DWORD)nTime; + fileTime.dwHighDateTime = (DWORD)(nTime >> 32); +} diff --git a/contrib/vmap_extractor_v2/stormdll/StormDll.def b/contrib/vmap_extractor_v2/stormdll/StormDll.def index e5cfea38c..8de88f5db 100644 --- a/contrib/vmap_extractor_v2/stormdll/StormDll.def +++ b/contrib/vmap_extractor_v2/stormdll/StormDll.def @@ -1,25 +1,25 @@ -; Storm definition file with alternate Storm.dll names -LIBRARY "Storm" - -EXPORTS - StormCloseArchive @252 ; 0x0FC - StormCloseFile @253 ; 0x0FD - StormDestroy @262 ; 0x106 - StormGetFileArchive @264 ; 0x108 - StormGetFileSize @265 ; 0x109 - StormOpenArchive @266 ; 0x10A - StormOpenFile @267 ; 0x10B - StormOpenFileEx @268 ; 0x10C - StormReadFile @269 ; 0x10D - StormSetBasePath @270 ; 0x10E - StormSetFilePointer @271 ; 0x10F - StormSetLocale @272 ; 0x110 - StormGetBasePath @273 ; 0x111 - StormGetArchiveName @275 ; 0x113 - StormGetFileName @276 ; 0x114 - -; StormSetLastError @465 ; 0x - - StormCompress @551 ; 0x227 - StormDecompress @552 ; 0x228 +; Storm definition file with alternate Storm.dll names +LIBRARY "Storm" + +EXPORTS + StormCloseArchive @252 ; 0x0FC + StormCloseFile @253 ; 0x0FD + StormDestroy @262 ; 0x106 + StormGetFileArchive @264 ; 0x108 + StormGetFileSize @265 ; 0x109 + StormOpenArchive @266 ; 0x10A + StormOpenFile @267 ; 0x10B + StormOpenFileEx @268 ; 0x10C + StormReadFile @269 ; 0x10D + StormSetBasePath @270 ; 0x10E + StormSetFilePointer @271 ; 0x10F + StormSetLocale @272 ; 0x110 + StormGetBasePath @273 ; 0x111 + StormGetArchiveName @275 ; 0x113 + StormGetFileName @276 ; 0x114 + +; StormSetLastError @465 ; 0x + + StormCompress @551 ; 0x227 + StormDecompress @552 ; 0x228 \ No newline at end of file diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.dsp b/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.dsp index 4b1615edc..04819a495 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.dsp +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.dsp @@ -1,93 +1,93 @@ -# Microsoft Developer Studio Project File - Name="dlltest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** •ÒW‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=dlltest - Win32 Debug -!MESSAGE ‚±‚ê‚Í—LŒø‚ÈÒ²¸Ì§²Ù‚ł͂ ‚è‚Ü‚¹‚ñB ‚±‚ÌÌßÛ¼Þª¸Ä‚ðËÞÙÄÞ‚·‚邽‚ß‚É‚Í NMAKE ‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢B -!MESSAGE [Ò²¸Ì§²Ù‚Ì´¸½Îß°Ä] ºÏÝÄÞ‚ðŽg—p‚µ‚ÄŽÀs‚µ‚Ä‚­‚¾‚³‚¢ -!MESSAGE -!MESSAGE NMAKE /f "dlltest.mak". -!MESSAGE -!MESSAGE NMAKE ‚ÌŽÀsŽž‚É\¬‚ðŽw’è‚Å‚«‚Ü‚· -!MESSAGE ºÏÝÄÞ ×²Ýã‚ÅϸۂÌÝ’è‚ð’è‹`‚µ‚Ü‚·B—á: -!MESSAGE -!MESSAGE NMAKE /f "dlltest.mak" CFG="dlltest - Win32 Debug" -!MESSAGE -!MESSAGE ‘I‘ð‰Â”\‚ÈËÞÙÄÞ Ó°ÄÞ: -!MESSAGE -!MESSAGE "dlltest - Win32 Release" ("Win32 (x86) Console Application" —p) -!MESSAGE "dlltest - Win32 Debug" ("Win32 (x86) Console Application" —p) -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "dlltest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"minibz2.exe" - -!ELSEIF "$(CFG)" == "dlltest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "dlltest_" -# PROP BASE Intermediate_Dir "dlltest_" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "dlltest_" -# PROP Intermediate_Dir "dlltest_" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"minibz2.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "dlltest - Win32 Release" -# Name "dlltest - Win32 Debug" -# Begin Source File - -SOURCE=.\bzlib.h -# End Source File -# Begin Source File - -SOURCE=.\dlltest.c -# End Source File -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="dlltest" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** •ÒW‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=dlltest - Win32 Debug +!MESSAGE ‚±‚ê‚Í—LŒø‚ÈÒ²¸Ì§²Ù‚ł͂ ‚è‚Ü‚¹‚ñB ‚±‚ÌÌßÛ¼Þª¸Ä‚ðËÞÙÄÞ‚·‚邽‚ß‚É‚Í NMAKE ‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢B +!MESSAGE [Ò²¸Ì§²Ù‚Ì´¸½Îß°Ä] ºÏÝÄÞ‚ðŽg—p‚µ‚ÄŽÀs‚µ‚Ä‚­‚¾‚³‚¢ +!MESSAGE +!MESSAGE NMAKE /f "dlltest.mak". +!MESSAGE +!MESSAGE NMAKE ‚ÌŽÀsŽž‚É\¬‚ðŽw’è‚Å‚«‚Ü‚· +!MESSAGE ºÏÝÄÞ ×²Ýã‚ÅϸۂÌÝ’è‚ð’è‹`‚µ‚Ü‚·B—á: +!MESSAGE +!MESSAGE NMAKE /f "dlltest.mak" CFG="dlltest - Win32 Debug" +!MESSAGE +!MESSAGE ‘I‘ð‰Â”\‚ÈËÞÙÄÞ Ó°ÄÞ: +!MESSAGE +!MESSAGE "dlltest - Win32 Release" ("Win32 (x86) Console Application" —p) +!MESSAGE "dlltest - Win32 Debug" ("Win32 (x86) Console Application" —p) +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dlltest - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x411 /d "NDEBUG" +# ADD RSC /l 0x411 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"minibz2.exe" + +!ELSEIF "$(CFG)" == "dlltest - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dlltest_" +# PROP BASE Intermediate_Dir "dlltest_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "dlltest_" +# PROP Intermediate_Dir "dlltest_" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x411 /d "_DEBUG" +# ADD RSC /l 0x411 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"minibz2.exe" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "dlltest - Win32 Release" +# Name "dlltest - Win32 Debug" +# Begin Source File + +SOURCE=.\bzlib.h +# End Source File +# Begin Source File + +SOURCE=.\dlltest.c +# End Source File +# End Target +# End Project diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.def b/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.def index 2dc0dd891..4f83fcc61 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.def +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.def @@ -1,27 +1,27 @@ -LIBRARY LIBBZ2 -DESCRIPTION "libbzip2: library for data compression" -EXPORTS - BZ2_bzCompressInit - BZ2_bzCompress - BZ2_bzCompressEnd - BZ2_bzDecompressInit - BZ2_bzDecompress - BZ2_bzDecompressEnd - BZ2_bzReadOpen - BZ2_bzReadClose - BZ2_bzReadGetUnused - BZ2_bzRead - BZ2_bzWriteOpen - BZ2_bzWrite - BZ2_bzWriteClose - BZ2_bzWriteClose64 - BZ2_bzBuffToBuffCompress - BZ2_bzBuffToBuffDecompress - BZ2_bzlibVersion - BZ2_bzopen - BZ2_bzdopen - BZ2_bzread - BZ2_bzwrite - BZ2_bzflush - BZ2_bzclose - BZ2_bzerror +LIBRARY LIBBZ2 +DESCRIPTION "libbzip2: library for data compression" +EXPORTS + BZ2_bzCompressInit + BZ2_bzCompress + BZ2_bzCompressEnd + BZ2_bzDecompressInit + BZ2_bzDecompress + BZ2_bzDecompressEnd + BZ2_bzReadOpen + BZ2_bzReadClose + BZ2_bzReadGetUnused + BZ2_bzRead + BZ2_bzWriteOpen + BZ2_bzWrite + BZ2_bzWriteClose + BZ2_bzWriteClose64 + BZ2_bzBuffToBuffCompress + BZ2_bzBuffToBuffDecompress + BZ2_bzlibVersion + BZ2_bzopen + BZ2_bzdopen + BZ2_bzread + BZ2_bzwrite + BZ2_bzflush + BZ2_bzclose + BZ2_bzerror diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.dsp b/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.dsp index a21a20f75..06c1d3762 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.dsp +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.dsp @@ -1,130 +1,130 @@ -# Microsoft Developer Studio Project File - Name="libbz2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** •ÒW‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libbz2 - Win32 Debug -!MESSAGE ‚±‚ê‚Í—LŒø‚ÈÒ²¸Ì§²Ù‚ł͂ ‚è‚Ü‚¹‚ñB ‚±‚ÌÌßÛ¼Þª¸Ä‚ðËÞÙÄÞ‚·‚邽‚ß‚É‚Í NMAKE ‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢B -!MESSAGE [Ò²¸Ì§²Ù‚Ì´¸½Îß°Ä] ºÏÝÄÞ‚ðŽg—p‚µ‚ÄŽÀs‚µ‚Ä‚­‚¾‚³‚¢ -!MESSAGE -!MESSAGE NMAKE /f "libbz2.mak". -!MESSAGE -!MESSAGE NMAKE ‚ÌŽÀsŽž‚É\¬‚ðŽw’è‚Å‚«‚Ü‚· -!MESSAGE ºÏÝÄÞ ×²Ýã‚ÅϸۂÌÝ’è‚ð’è‹`‚µ‚Ü‚·B—á: -!MESSAGE -!MESSAGE NMAKE /f "libbz2.mak" CFG="libbz2 - Win32 Debug" -!MESSAGE -!MESSAGE ‘I‘ð‰Â”\‚ÈËÞÙÄÞ Ó°ÄÞ: -!MESSAGE -!MESSAGE "libbz2 - Win32 Release" ("Win32 (x86) Dynamic-Link Library" —p) -!MESSAGE "libbz2 - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" —p) -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libbz2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"libbz2.dll" - -!ELSEIF "$(CFG)" == "libbz2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"libbz2.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "libbz2 - Win32 Release" -# Name "libbz2 - Win32 Debug" -# Begin Source File - -SOURCE=.\blocksort.c -# End Source File -# Begin Source File - -SOURCE=.\bzlib.c -# End Source File -# Begin Source File - -SOURCE=.\bzlib.h -# End Source File -# Begin Source File - -SOURCE=.\bzlib_private.h -# End Source File -# Begin Source File - -SOURCE=.\compress.c -# End Source File -# Begin Source File - -SOURCE=.\crctable.c -# End Source File -# Begin Source File - -SOURCE=.\decompress.c -# End Source File -# Begin Source File - -SOURCE=.\huffman.c -# End Source File -# Begin Source File - -SOURCE=.\libbz2.def -# End Source File -# Begin Source File - -SOURCE=.\randtable.c -# End Source File -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="libbz2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** •ÒW‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=libbz2 - Win32 Debug +!MESSAGE ‚±‚ê‚Í—LŒø‚ÈÒ²¸Ì§²Ù‚ł͂ ‚è‚Ü‚¹‚ñB ‚±‚ÌÌßÛ¼Þª¸Ä‚ðËÞÙÄÞ‚·‚邽‚ß‚É‚Í NMAKE ‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢B +!MESSAGE [Ò²¸Ì§²Ù‚Ì´¸½Îß°Ä] ºÏÝÄÞ‚ðŽg—p‚µ‚ÄŽÀs‚µ‚Ä‚­‚¾‚³‚¢ +!MESSAGE +!MESSAGE NMAKE /f "libbz2.mak". +!MESSAGE +!MESSAGE NMAKE ‚ÌŽÀsŽž‚É\¬‚ðŽw’è‚Å‚«‚Ü‚· +!MESSAGE ºÏÝÄÞ ×²Ýã‚ÅϸۂÌÝ’è‚ð’è‹`‚µ‚Ü‚·B—á: +!MESSAGE +!MESSAGE NMAKE /f "libbz2.mak" CFG="libbz2 - Win32 Debug" +!MESSAGE +!MESSAGE ‘I‘ð‰Â”\‚ÈËÞÙÄÞ Ó°ÄÞ: +!MESSAGE +!MESSAGE "libbz2 - Win32 Release" ("Win32 (x86) Dynamic-Link Library" —p) +!MESSAGE "libbz2 - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" —p) +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libbz2 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x411 /d "NDEBUG" +# ADD RSC /l 0x411 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"libbz2.dll" + +!ELSEIF "$(CFG)" == "libbz2 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x411 /d "_DEBUG" +# ADD RSC /l 0x411 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"libbz2.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "libbz2 - Win32 Release" +# Name "libbz2 - Win32 Debug" +# Begin Source File + +SOURCE=.\blocksort.c +# End Source File +# Begin Source File + +SOURCE=.\bzlib.c +# End Source File +# Begin Source File + +SOURCE=.\bzlib.h +# End Source File +# Begin Source File + +SOURCE=.\bzlib_private.h +# End Source File +# Begin Source File + +SOURCE=.\compress.c +# End Source File +# Begin Source File + +SOURCE=.\crctable.c +# End Source File +# Begin Source File + +SOURCE=.\decompress.c +# End Source File +# Begin Source File + +SOURCE=.\huffman.c +# End Source File +# Begin Source File + +SOURCE=.\libbz2.def +# End Source File +# Begin Source File + +SOURCE=.\randtable.c +# End Source File +# End Target +# End Project diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/makefile.msc b/contrib/vmap_extractor_v2/stormlib/bzip2/makefile.msc index 799a18a5f..6a628a753 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/makefile.msc +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/makefile.msc @@ -1,63 +1,63 @@ -# Makefile for Microsoft Visual C++ 6.0 -# usage: nmake -f makefile.msc -# K.M. Syring (syring@gsf.de) -# Fixed up by JRS for bzip2-0.9.5d release. - -CC=cl -CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo - -OBJS= blocksort.obj \ - huffman.obj \ - crctable.obj \ - randtable.obj \ - compress.obj \ - decompress.obj \ - bzlib.obj - -all: lib bzip2 test - -bzip2: lib - $(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj - $(CC) $(CFLAGS) -o bzip2recover bzip2recover.c - -lib: $(OBJS) - lib /out:libbz2.lib $(OBJS) - -test: bzip2 - type words1 - .\\bzip2 -1 < sample1.ref > sample1.rb2 - .\\bzip2 -2 < sample2.ref > sample2.rb2 - .\\bzip2 -3 < sample3.ref > sample3.rb2 - .\\bzip2 -d < sample1.bz2 > sample1.tst - .\\bzip2 -d < sample2.bz2 > sample2.tst - .\\bzip2 -ds < sample3.bz2 > sample3.tst - @echo All six of the fc's should find no differences. - @echo If fc finds an error on sample3.bz2, this could be - @echo because WinZip's 'TAR file smart CR/LF conversion' - @echo is too clever for its own good. Disable this option. - @echo The correct size for sample3.ref is 120,244. If it - @echo is 150,251, WinZip has messed it up. - fc sample1.bz2 sample1.rb2 - fc sample2.bz2 sample2.rb2 - fc sample3.bz2 sample3.rb2 - fc sample1.tst sample1.ref - fc sample2.tst sample2.ref - fc sample3.tst sample3.ref - - - -clean: - del *.obj - del libbz2.lib - del bzip2.exe - del bzip2recover.exe - del sample1.rb2 - del sample2.rb2 - del sample3.rb2 - del sample1.tst - del sample2.tst - del sample3.tst - -.c.obj: - $(CC) $(CFLAGS) -c $*.c -o $*.obj - +# Makefile for Microsoft Visual C++ 6.0 +# usage: nmake -f makefile.msc +# K.M. Syring (syring@gsf.de) +# Fixed up by JRS for bzip2-0.9.5d release. + +CC=cl +CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo + +OBJS= blocksort.obj \ + huffman.obj \ + crctable.obj \ + randtable.obj \ + compress.obj \ + decompress.obj \ + bzlib.obj + +all: lib bzip2 test + +bzip2: lib + $(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj + $(CC) $(CFLAGS) -o bzip2recover bzip2recover.c + +lib: $(OBJS) + lib /out:libbz2.lib $(OBJS) + +test: bzip2 + type words1 + .\\bzip2 -1 < sample1.ref > sample1.rb2 + .\\bzip2 -2 < sample2.ref > sample2.rb2 + .\\bzip2 -3 < sample3.ref > sample3.rb2 + .\\bzip2 -d < sample1.bz2 > sample1.tst + .\\bzip2 -d < sample2.bz2 > sample2.tst + .\\bzip2 -ds < sample3.bz2 > sample3.tst + @echo All six of the fc's should find no differences. + @echo If fc finds an error on sample3.bz2, this could be + @echo because WinZip's 'TAR file smart CR/LF conversion' + @echo is too clever for its own good. Disable this option. + @echo The correct size for sample3.ref is 120,244. If it + @echo is 150,251, WinZip has messed it up. + fc sample1.bz2 sample1.rb2 + fc sample2.bz2 sample2.rb2 + fc sample3.bz2 sample3.rb2 + fc sample1.tst sample1.ref + fc sample2.tst sample2.ref + fc sample3.tst sample3.ref + + + +clean: + del *.obj + del libbz2.lib + del bzip2.exe + del bzip2recover.exe + del sample1.rb2 + del sample2.rb2 + del sample3.rb2 + del sample1.tst + del sample2.tst + del sample3.tst + +.c.obj: + $(CC) $(CFLAGS) -c $*.c -o $*.obj + diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f0a2a4541..1cfb27cd8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9988" + #define REVISION_NR "9989" #endif // __REVISION_NR_H__ From 2d81f31afc72b2ab1c7f45b9a147aca4f9979675 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 28 May 2010 04:23:29 +0400 Subject: [PATCH 118/172] [9990] Use more correct data for prev. sql update. --- sql/mangos.sql | 6 +++--- sql/updates/9990_01_mangos_spell_chain.sql | 8 ++++++++ sql/updates/Makefile.am | 2 ++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 sql/updates/9990_01_mangos_spell_chain.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index a8481455c..6cc73d850 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9988_01_mangos_spell_chain` bit(1) default NULL + `required_9990_01_mangos_spell_chain` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -15839,9 +15839,9 @@ INSERT INTO spell_chain VALUES (37420,10140,5504,8,0), (27090,37420,5504,9,0), /*Dalaran Intellect*/ -(61024,61024,61024,1,27126), +(61024,0,61024,1,27126), /*Dalaran Brilliance*/ -(61316,61316,61316,1,27127), +(61316,0,61316,1,27127); /*DampenMagic*/ (604,0,604,1,0), (8450,604,604,2,0), diff --git a/sql/updates/9990_01_mangos_spell_chain.sql b/sql/updates/9990_01_mangos_spell_chain.sql new file mode 100644 index 000000000..83f09ba96 --- /dev/null +++ b/sql/updates/9990_01_mangos_spell_chain.sql @@ -0,0 +1,8 @@ +ALTER TABLE db_version CHANGE COLUMN required_9988_01_mangos_spell_chain required_9990_01_mangos_spell_chain bit; + +DELETE FROM `spell_chain` WHERE `spell_id` IN (61024,61316); +INSERT INTO `spell_chain` (`spell_id`, `prev_spell`, `first_spell`, `rank`, `req_spell`) VALUES +/*Dalaran Intellect*/ +(61024,0,61024,1,27126), +/*Dalaran Brilliance*/ +(61316,0,61316,1,27127); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 6a9839ad9..3c7da0495 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -74,6 +74,7 @@ pkgdata_DATA = \ 9977_01_mangos_spell_proc_event.sql \ 9978_01_mangos_spell_bonus_data.sql \ 9988_01_mangos_spell_chain.sql \ + 9990_01_mangos_spell_chain.sql \ README ## Additional files to include when running 'make dist' @@ -128,4 +129,5 @@ EXTRA_DIST = \ 9977_01_mangos_spell_proc_event.sql \ 9978_01_mangos_spell_bonus_data.sql \ 9988_01_mangos_spell_chain.sql \ + 9990_01_mangos_spell_chain.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1cfb27cd8..0bd2b1faf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9989" + #define REVISION_NR "9990" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index b2baaa9a2..3355116d9 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9974_01_characters_group" - #define REVISION_DB_MANGOS "required_9988_01_mangos_spell_chain" + #define REVISION_DB_MANGOS "required_9990_01_mangos_spell_chain" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 4206230f0da8453e3ecb7dada481af3b1e755663 Mon Sep 17 00:00:00 2001 From: vipertv Date: Fri, 28 May 2010 04:35:06 +0400 Subject: [PATCH 119/172] [9991] Next step in fix SMSG_GROUP_LIST structure. Now assistant/main tank/main assistant show properly for viewer character also. Thanks to insider42 for posting patch in Under review section. Signed-off-by: VladimirMangos --- src/game/Group.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index d53dfd52b..29d5a345b 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -971,8 +971,8 @@ void Group::SendUpdate() WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+8+4+GetMembersCount()*20)); data << uint8(m_groupType); // group type (flags in 3.3) data << uint8(citr->group); // groupid - data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup? data << uint8(GetFlags(*citr)); // group flags + data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup? if(m_groupType & GROUPTYPE_LFD) { data << uint8(0); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0bd2b1faf..d2573cacf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9990" + #define REVISION_NR "9991" #endif // __REVISION_NR_H__ From db93e78f50a0d89369d35ad62f1988f47dfd92d1 Mon Sep 17 00:00:00 2001 From: Revils Date: Fri, 28 May 2010 05:02:42 +0400 Subject: [PATCH 120/172] [9992] Fixed MSG_PARTY_ASSIGNMENT processing. Signed-off-by: VladimirMangos --- src/game/Group.cpp | 34 ++++++++++++++++++++++++++-------- src/game/Group.h | 3 +++ src/game/GroupHandler.cpp | 30 +++++++++++++++++++----------- src/shared/revision_nr.h | 2 +- 4 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 29d5a345b..7aa97e10b 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1298,29 +1298,47 @@ bool Group::_setAssistantFlag(const uint64 &guid, const bool &state) bool Group::_setMainTank(const uint64 &guid) { - member_citerator slot = _getMemberCSlot(guid); - if(slot == m_memberSlots.end()) + if (m_mainTank == guid) return false; - if(m_mainAssistant == guid) - _setMainAssistant(0); + if (guid) + { + member_citerator slot = _getMemberCSlot(guid); + if(slot == m_memberSlots.end()) + return false; + + if(m_mainAssistant == guid) + _setMainAssistant(0); + } + m_mainTank = guid; + if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE groupId='%u'", GUID_LOPART(m_mainTank), m_Id); + return true; } bool Group::_setMainAssistant(const uint64 &guid) { - member_witerator slot = _getMemberWSlot(guid); - if(slot == m_memberSlots.end()) + if (m_mainAssistant == guid) return false; - if(m_mainTank == guid) - _setMainTank(0); + if (guid) + { + member_witerator slot = _getMemberWSlot(guid); + if(slot == m_memberSlots.end()) + return false; + + if(m_mainTank == guid) + _setMainTank(0); + } + m_mainAssistant = guid; + if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE groupId='%u'", GUID_LOPART(m_mainAssistant), m_Id); + return true; } diff --git a/src/game/Group.h b/src/game/Group.h index 979d03a7a..c9cffe335 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -286,6 +286,9 @@ class MANGOS_DLL_SPEC Group void ChangeMembersGroup(const uint64 &guid, uint8 group); void ChangeMembersGroup(Player *player, uint8 group); + uint64 const& GetMainTank() const { return m_mainTank; } + uint64 const& GetMainAssistant() const { return m_mainAssistant; } + void SetAssistant(uint64 guid, bool state) { if(!isRaidGroup()) diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 47fede5c2..d73b2330d 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -555,9 +555,10 @@ void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data ) { - uint8 flag1, flag2; + uint8 role; + uint8 apply; uint64 guid; - recv_data >> flag1 >> flag2; + recv_data >> role >> apply; // role 0 = Main Tank, 1 = Main Assistant recv_data >> guid; DEBUG_LOG("MSG_PARTY_ASSIGNMENT"); @@ -566,21 +567,28 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data ) if(!group) return; - // if(flag1) Main Assist - // 0x4 - // if(flag2) Main Tank - // 0x2 - /** error handling **/ if(!group->IsLeader(GetPlayer()->GetGUID())) return; /********************/ // everything is fine, do it - if(flag1 == 1) - group->SetMainAssistant(guid); - if(flag2 == 1) - group->SetMainTank(guid); + if (apply) + { + switch(role) + { + case 0: group->SetMainTank(guid); break; + case 1: group->SetMainAssistant(guid); break; + default: break; + } + } + else + { + if (group->GetMainTank() == guid) + group->SetMainTank(0); + if (group->GetMainAssistant() == guid) + group->SetMainAssistant(0); + } } void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data ) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d2573cacf..8408222e5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9991" + #define REVISION_NR "9992" #endif // __REVISION_NR_H__ From 2e7a009b01d4cbc331c530834b1747d994e9c3e6 Mon Sep 17 00:00:00 2001 From: MaxXx2021 Date: Fri, 28 May 2010 14:35:47 +0400 Subject: [PATCH 121/172] [9993] Limit spell 50988, 59870 targets amounts to expected. Signed-off-by: VladimirMangos --- src/game/Spell.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0c1d69b8c..966f07454 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1448,6 +1448,8 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case 31347: // Doom TODO: exclude top threat target from target selection case 33711: // Murmur's Touch case 38794: // Murmur's Touch (h) + case 50988: // Glare of the Tribunal (Halls of Stone) + case 59870: // Glare of the Tribunal (h) (Halls of Stone) unMaxTargets = 1; break; case 28542: // Life Drain diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8408222e5..e53e78914 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9992" + #define REVISION_NR "9993" #endif // __REVISION_NR_H__ From ee31661bb893b96ea27c9c6be60832b23555a444 Mon Sep 17 00:00:00 2001 From: Revils Date: Fri, 28 May 2010 15:04:17 +0400 Subject: [PATCH 122/172] [9994] Fixed a bug/typo that prevent to summon a special flying mount. Signed-off-by: VladimirMangos --- src/game/Spell.cpp | 4 +++- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 966f07454..85fb3b658 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6616,8 +6616,10 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe // speed higher than 280 replace it if (mountSpeed > 280) + { target->CastSpell(target, spellIdSpecial, true); - return; + return; + } } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e53e78914..d84e0e677 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9993" + #define REVISION_NR "9994" #endif // __REVISION_NR_H__ From 28c3de50932278fec75cf6b1fb7c0fbe13dd601a Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Fri, 28 May 2010 13:33:04 +0200 Subject: [PATCH 123/172] [9995] Move GridMap class (and related structs/enums) to separate cpp/h. Also rename some structs/enums and fix some code style. --- src/game/GridMap.cpp | 616 +++++++++++++++++++++++++++++++++ src/game/GridMap.h | 183 ++++++++++ src/game/Level1.cpp | 8 +- src/game/Makefile.am | 2 + src/game/Map.cpp | 567 +----------------------------- src/game/Map.h | 150 +------- src/game/MapManager.cpp | 2 +- src/game/Player.cpp | 4 +- src/shared/revision_nr.h | 2 +- win/VC100/game.vcxproj | 2 + win/VC100/game.vcxproj.filters | 6 + win/VC80/game.vcproj | 8 + win/VC90/game.vcproj | 8 + 13 files changed, 838 insertions(+), 720 deletions(-) create mode 100644 src/game/GridMap.cpp create mode 100644 src/game/GridMap.h diff --git a/src/game/GridMap.cpp b/src/game/GridMap.cpp new file mode 100644 index 000000000..17e5c26a4 --- /dev/null +++ b/src/game/GridMap.cpp @@ -0,0 +1,616 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "MapManager.h" +#include "Log.h" +#include "GridStates.h" +#include "CellImpl.h" +#include "Map.h" +#include "Config/ConfigEnv.h" +#include "DBCEnums.h" +#include "GridMap.h" +#include "VMapFactory.h" +#include "World.h" + +char const* MAP_MAGIC = "MAPS"; +char const* MAP_VERSION_MAGIC = "v1.1"; +char const* MAP_AREA_MAGIC = "AREA"; +char const* MAP_HEIGHT_MAGIC = "MHGT"; +char const* MAP_LIQUID_MAGIC = "MLIQ"; + +GridMap::GridMap() +{ + m_flags = 0; + + // Area data + m_gridArea = 0; + m_area_map = NULL; + + // Height level data + m_gridHeight = INVALID_HEIGHT; + m_gridGetHeight = &GridMap::getHeightFromFlat; + m_V9 = NULL; + m_V8 = NULL; + + // Liquid data + m_liquidType = 0; + m_liquid_offX = 0; + m_liquid_offY = 0; + m_liquid_width = 0; + m_liquid_height = 0; + m_liquidLevel = INVALID_HEIGHT; + m_liquid_type = NULL; + m_liquid_map = NULL; +} + +GridMap::~GridMap() +{ + unloadData(); +} + +bool GridMap::loadData(char *filename) +{ + // Unload old data if exist + unloadData(); + + GridMapFileHeader header; + // Not return error if file not found + FILE *in = fopen(filename, "rb"); + if (!in) + return true; + + fread(&header, sizeof(header),1,in); + if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) && + header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)) || + !IsAcceptableClientBuild(header.buildMagic)) + { + // loadup area data + if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) + { + sLog.outError("Error loading map area data\n"); + fclose(in); + return false; + } + + // loadup height data + if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize)) + { + sLog.outError("Error loading map height data\n"); + fclose(in); + return false; + } + + // loadup liquid data + if (header.liquidMapOffset && !loadGridMapLiquidData(in, header.liquidMapOffset, header.liquidMapSize)) + { + sLog.outError("Error loading map liquids data\n"); + fclose(in); + return false; + } + + fclose(in); + return true; + } + + sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.", filename); + fclose(in); + return false; +} + +void GridMap::unloadData() +{ + if (m_area_map) + delete[] m_area_map; + + if (m_V9) + delete[] m_V9; + + if (m_V8) + delete[] m_V8; + + if (m_liquid_type) + delete[] m_liquid_type; + + if (m_liquid_map) + delete[] m_liquid_map; + + m_area_map = NULL; + m_V9 = NULL; + m_V8 = NULL; + m_liquid_type = NULL; + m_liquid_map = NULL; + m_gridGetHeight = &GridMap::getHeightFromFlat; +} + +bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/) +{ + GridMapAreaHeader header; + fseek(in, offset, SEEK_SET); + fread(&header, sizeof(header), 1, in); + if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC))) + return false; + + m_gridArea = header.gridArea; + if (!(header.flags & MAP_AREA_NO_AREA)) + { + m_area_map = new uint16 [16*16]; + fread(m_area_map, sizeof(uint16), 16*16, in); + } + + return true; +} + +bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 /*size*/) +{ + GridMapHeightHeader header; + fseek(in, offset, SEEK_SET); + fread(&header, sizeof(header), 1, in); + if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC))) + return false; + + m_gridHeight = header.gridHeight; + if (!(header.flags & MAP_HEIGHT_NO_HEIGHT)) + { + if ((header.flags & MAP_HEIGHT_AS_INT16)) + { + m_uint16_V9 = new uint16 [129*129]; + m_uint16_V8 = new uint16 [128*128]; + fread(m_uint16_V9, sizeof(uint16), 129*129, in); + fread(m_uint16_V8, sizeof(uint16), 128*128, in); + m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535; + m_gridGetHeight = &GridMap::getHeightFromUint16; + } + else if ((header.flags & MAP_HEIGHT_AS_INT8)) + { + m_uint8_V9 = new uint8 [129*129]; + m_uint8_V8 = new uint8 [128*128]; + fread(m_uint8_V9, sizeof(uint8), 129*129, in); + fread(m_uint8_V8, sizeof(uint8), 128*128, in); + m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255; + m_gridGetHeight = &GridMap::getHeightFromUint8; + } + else + { + m_V9 = new float [129*129]; + m_V8 = new float [128*128]; + fread(m_V9, sizeof(float), 129*129, in); + fread(m_V8, sizeof(float), 128*128, in); + m_gridGetHeight = &GridMap::getHeightFromFloat; + } + } + else + m_gridGetHeight = &GridMap::getHeightFromFlat; + + return true; +} + +bool GridMap::loadGridMapLiquidData(FILE *in, uint32 offset, uint32 /*size*/) +{ + GridMapLiquidHeader header; + fseek(in, offset, SEEK_SET); + fread(&header, sizeof(header), 1, in); + if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC))) + return false; + + m_liquidType = header.liquidType; + m_liquid_offX = header.offsetX; + m_liquid_offY = header.offsetY; + m_liquid_width = header.width; + m_liquid_height = header.height; + m_liquidLevel = header.liquidLevel; + + if (!(header.flags & MAP_LIQUID_NO_TYPE)) + { + m_liquid_type = new uint8 [16*16]; + fread(m_liquid_type, sizeof(uint8), 16*16, in); + } + + if (!(header.flags & MAP_LIQUID_NO_HEIGHT)) + { + m_liquid_map = new float [m_liquid_width*m_liquid_height]; + fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in); + } + + return true; +} + +uint16 GridMap::getArea(float x, float y) +{ + if (!m_area_map) + return m_gridArea; + + x = 16 * (32 - x/SIZE_OF_GRIDS); + y = 16 * (32 - y/SIZE_OF_GRIDS); + int lx = (int)x & 15; + int ly = (int)y & 15; + return m_area_map[lx*16 + ly]; +} + +float GridMap::getHeightFromFlat(float /*x*/, float /*y*/) const +{ + return m_gridHeight; +} + +float GridMap::getHeightFromFloat(float x, float y) const +{ + if (!m_V8 || !m_V9) + return m_gridHeight; + + x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); + y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); + + int x_int = (int)x; + int y_int = (int)y; + x -= x_int; + y -= y_int; + x_int &= (MAP_RESOLUTION - 1); + y_int &= (MAP_RESOLUTION - 1); + + // Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid + // +--------------> X + // | h1-------h2 Coordinates is: + // | | \ 1 / | h1 0,0 + // | | \ / | h2 0,1 + // | | 2 h5 3 | h3 1,0 + // | | / \ | h4 1,1 + // | | / 4 \ | h5 1/2,1/2 + // | h3-------h4 + // V Y + // For find height need + // 1 - detect triangle + // 2 - solve linear equation from triangle points + // Calculate coefficients for solve h = a*x + b*y + c + + float a,b,c; + // Select triangle: + if (x+y < 1) + { + if (x > y) + { + // 1 triangle (h1, h2, h5 points) + float h1 = m_V9[(x_int )*129 + y_int]; + float h2 = m_V9[(x_int+1)*129 + y_int]; + float h5 = 2 * m_V8[x_int*128 + y_int]; + a = h2-h1; + b = h5-h1-h2; + c = h1; + } + else + { + // 2 triangle (h1, h3, h5 points) + float h1 = m_V9[x_int*129 + y_int ]; + float h3 = m_V9[x_int*129 + y_int+1]; + float h5 = 2 * m_V8[x_int*128 + y_int]; + a = h5 - h1 - h3; + b = h3 - h1; + c = h1; + } + } + else + { + if (x > y) + { + // 3 triangle (h2, h4, h5 points) + float h2 = m_V9[(x_int+1)*129 + y_int ]; + float h4 = m_V9[(x_int+1)*129 + y_int+1]; + float h5 = 2 * m_V8[x_int*128 + y_int]; + a = h2 + h4 - h5; + b = h4 - h2; + c = h5 - h4; + } + else + { + // 4 triangle (h3, h4, h5 points) + float h3 = m_V9[(x_int )*129 + y_int+1]; + float h4 = m_V9[(x_int+1)*129 + y_int+1]; + float h5 = 2 * m_V8[x_int*128 + y_int]; + a = h4 - h3; + b = h3 + h4 - h5; + c = h5 - h4; + } + } + // Calculate height + return a * x + b * y + c; +} + +float GridMap::getHeightFromUint8(float x, float y) const +{ + if (!m_uint8_V8 || !m_uint8_V9) + return m_gridHeight; + + x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); + y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); + + int x_int = (int)x; + int y_int = (int)y; + x -= x_int; + y -= y_int; + x_int &= (MAP_RESOLUTION - 1); + y_int &= (MAP_RESOLUTION - 1); + + int32 a, b, c; + uint8 *V9_h1_ptr = &m_uint8_V9[x_int*128 + x_int + y_int]; + if (x+y < 1) + { + if (x > y) + { + // 1 triangle (h1, h2, h5 points) + int32 h1 = V9_h1_ptr[ 0]; + int32 h2 = V9_h1_ptr[129]; + int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; + a = h2-h1; + b = h5-h1-h2; + c = h1; + } + else + { + // 2 triangle (h1, h3, h5 points) + int32 h1 = V9_h1_ptr[0]; + int32 h3 = V9_h1_ptr[1]; + int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; + a = h5 - h1 - h3; + b = h3 - h1; + c = h1; + } + } + else + { + if (x > y) + { + // 3 triangle (h2, h4, h5 points) + int32 h2 = V9_h1_ptr[129]; + int32 h4 = V9_h1_ptr[130]; + int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; + a = h2 + h4 - h5; + b = h4 - h2; + c = h5 - h4; + } + else + { + // 4 triangle (h3, h4, h5 points) + int32 h3 = V9_h1_ptr[ 1]; + int32 h4 = V9_h1_ptr[130]; + int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; + a = h4 - h3; + b = h3 + h4 - h5; + c = h5 - h4; + } + } + + // Calculate height + return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight; +} + +float GridMap::getHeightFromUint16(float x, float y) const +{ + if (!m_uint16_V8 || !m_uint16_V9) + return m_gridHeight; + + x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); + y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); + + int x_int = (int)x; + int y_int = (int)y; + x -= x_int; + y -= y_int; + x_int &= (MAP_RESOLUTION - 1); + y_int &= (MAP_RESOLUTION - 1); + + int32 a, b, c; + uint16 *V9_h1_ptr = &m_uint16_V9[x_int*128 + x_int + y_int]; + if (x+y < 1) + { + if (x > y) + { + // 1 triangle (h1, h2, h5 points) + int32 h1 = V9_h1_ptr[ 0]; + int32 h2 = V9_h1_ptr[129]; + int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; + a = h2-h1; + b = h5-h1-h2; + c = h1; + } + else + { + // 2 triangle (h1, h3, h5 points) + int32 h1 = V9_h1_ptr[0]; + int32 h3 = V9_h1_ptr[1]; + int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; + a = h5 - h1 - h3; + b = h3 - h1; + c = h1; + } + } + else + { + if (x > y) + { + // 3 triangle (h2, h4, h5 points) + int32 h2 = V9_h1_ptr[129]; + int32 h4 = V9_h1_ptr[130]; + int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; + a = h2 + h4 - h5; + b = h4 - h2; + c = h5 - h4; + } + else + { + // 4 triangle (h3, h4, h5 points) + int32 h3 = V9_h1_ptr[ 1]; + int32 h4 = V9_h1_ptr[130]; + int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; + a = h4 - h3; + b = h3 + h4 - h5; + c = h5 - h4; + } + } + + // Calculate height + return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight; +} + +float GridMap::getLiquidLevel(float x, float y) +{ + if (!m_liquid_map) + return m_liquidLevel; + + x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); + y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); + + int cx_int = ((int)x & (MAP_RESOLUTION-1)) - m_liquid_offY; + int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX; + + if (cx_int < 0 || cx_int >=m_liquid_height) + return INVALID_HEIGHT; + + if (cy_int < 0 || cy_int >=m_liquid_width ) + return INVALID_HEIGHT; + + return m_liquid_map[cx_int*m_liquid_width + cy_int]; +} + +uint8 GridMap::getTerrainType(float x, float y) +{ + if (!m_liquid_type) + return (uint8)m_liquidType; + + x = 16 * (32 - x/SIZE_OF_GRIDS); + y = 16 * (32 - y/SIZE_OF_GRIDS); + int lx = (int)x & 15; + int ly = (int)y & 15; + return m_liquid_type[lx*16 + ly]; +} + +// Get water state on map +GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data) +{ + // Check water type (if no water return) + if (!m_liquid_type && !m_liquidType) + return LIQUID_MAP_NO_WATER; + + // Get cell + float cx = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); + float cy = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); + + int x_int = (int)cx & (MAP_RESOLUTION-1); + int y_int = (int)cy & (MAP_RESOLUTION-1); + + // Check water type in cell + uint8 type = m_liquid_type ? m_liquid_type[(x_int>>3)*16 + (y_int>>3)] : m_liquidType; + if (type == 0) + return LIQUID_MAP_NO_WATER; + + // Check req liquid type mask + if (ReqLiquidType && !(ReqLiquidType&type)) + return LIQUID_MAP_NO_WATER; + + // Check water level: + // Check water height map + int lx_int = x_int - m_liquid_offY; + if (lx_int < 0 || lx_int >=m_liquid_height) + return LIQUID_MAP_NO_WATER; + + int ly_int = y_int - m_liquid_offX; + if (ly_int < 0 || ly_int >=m_liquid_width ) + return LIQUID_MAP_NO_WATER; + + // Get water level + float liquid_level = m_liquid_map ? m_liquid_map[lx_int*m_liquid_width + ly_int] : m_liquidLevel; + + // Get ground level (sub 0.2 for fix some errors) + float ground_level = getHeight(x, y); + + // Check water level and ground level + if (liquid_level < ground_level || z < ground_level - 2) + return LIQUID_MAP_NO_WATER; + + // All ok in water -> store data + if (data) + { + data->type = type; + data->level = liquid_level; + data->depth_level = ground_level; + } + + // For speed check as int values + int delta = int((liquid_level - z) * 10); + + // Get position delta + if (delta > 20) // Under water + return LIQUID_MAP_UNDER_WATER; + + if (delta > 0 ) // In water + return LIQUID_MAP_IN_WATER; + + if (delta > -1) // Walk on water + return LIQUID_MAP_WATER_WALK; + // Above water + return LIQUID_MAP_ABOVE_WATER; +} + +bool GridMap::ExistMap(uint32 mapid,int gx,int gy) +{ + int len = sWorld.GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1; + char* tmp = new char[len]; + snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy); + + FILE *pf=fopen(tmp,"rb"); + + if(!pf) + { + sLog.outError("Check existing of map file '%s': not exist!",tmp); + delete[] tmp; + return false; + } + + GridMapFileHeader header; + fread(&header, sizeof(header), 1, pf); + if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) || + header.versionMagic != *((uint32 const*)(MAP_VERSION_MAGIC)) || + !IsAcceptableClientBuild(header.buildMagic)) + { + sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.",tmp); + delete [] tmp; + fclose(pf); //close file before return + return false; + } + + delete [] tmp; + fclose(pf); + return true; +} + +bool GridMap::ExistVMap(uint32 mapid,int gx,int gy) +{ + if(VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager()) + { + if(vmgr->isMapLoadingEnabled()) + { + // x and y are swapped !! => fixed now + bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(), mapid, gx,gy); + if(!exists) + { + std::string name = vmgr->getDirFileName(mapid,gx,gy); + sLog.outError("VMap file '%s' is missing or point to wrong version vmap file, redo vmaps with latest vmap_assembler.exe program", (sWorld.GetDataPath()+"vmaps/"+name).c_str()); + return false; + } + } + } + + return true; +} diff --git a/src/game/GridMap.h b/src/game/GridMap.h new file mode 100644 index 000000000..adc3421fd --- /dev/null +++ b/src/game/GridMap.h @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef MANGOS_GRIDMAP_H +#define MANGOS_GRIDMAP_H + +#include "Platform/Define.h" +#include "DBCStructure.h" +#include "GridDefines.h" +#include "Object.h" +#include "SharedDefines.h" + +#include +#include + +class Creature; +class Unit; +class WorldPacket; +class InstanceData; +class Group; +class InstanceSave; +struct ScriptInfo; +struct ScriptAction; +class BattleGround; + +struct GridMapFileHeader +{ + uint32 mapMagic; + uint32 versionMagic; + uint32 buildMagic; + uint32 areaMapOffset; + uint32 areaMapSize; + uint32 heightMapOffset; + uint32 heightMapSize; + uint32 liquidMapOffset; + uint32 liquidMapSize; +}; + +#define MAP_AREA_NO_AREA 0x0001 + +struct GridMapAreaHeader +{ + uint32 fourcc; + uint16 flags; + uint16 gridArea; +}; + +#define MAP_HEIGHT_NO_HEIGHT 0x0001 +#define MAP_HEIGHT_AS_INT16 0x0002 +#define MAP_HEIGHT_AS_INT8 0x0004 + +struct GridMapHeightHeader +{ + uint32 fourcc; + uint32 flags; + float gridHeight; + float gridMaxHeight; +}; + +#define MAP_LIQUID_NO_TYPE 0x0001 +#define MAP_LIQUID_NO_HEIGHT 0x0002 + +struct GridMapLiquidHeader +{ + uint32 fourcc; + uint16 flags; + uint16 liquidType; + uint8 offsetX; + uint8 offsetY; + uint8 width; + uint8 height; + float liquidLevel; +}; + +enum GridMapLiquidStatus +{ + LIQUID_MAP_NO_WATER = 0x00000000, + LIQUID_MAP_ABOVE_WATER = 0x00000001, + LIQUID_MAP_WATER_WALK = 0x00000002, + LIQUID_MAP_IN_WATER = 0x00000004, + LIQUID_MAP_UNDER_WATER = 0x00000008 +}; + +#define MAP_LIQUID_TYPE_NO_WATER 0x00 +#define MAP_LIQUID_TYPE_WATER 0x01 +#define MAP_LIQUID_TYPE_OCEAN 0x02 +#define MAP_LIQUID_TYPE_MAGMA 0x04 +#define MAP_LIQUID_TYPE_SLIME 0x08 + +#define MAP_ALL_LIQUIDS (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME) + +#define MAP_LIQUID_TYPE_DARK_WATER 0x10 +#define MAP_LIQUID_TYPE_WMO_WATER 0x20 + +struct GridMapLiquidData +{ + uint32 type; + float level; + float depth_level; +}; + +class GridMap +{ + private: + + uint32 m_flags; + + // Area data + uint16 m_gridArea; + uint16 *m_area_map; + + // Height level data + float m_gridHeight; + float m_gridIntHeightMultiplier; + union + { + float *m_V9; + uint16 *m_uint16_V9; + uint8 *m_uint8_V9; + }; + union + { + float *m_V8; + uint16 *m_uint16_V8; + uint8 *m_uint8_V8; + }; + + // Liquid data + uint16 m_liquidType; + uint8 m_liquid_offX; + uint8 m_liquid_offY; + uint8 m_liquid_width; + uint8 m_liquid_height; + float m_liquidLevel; + uint8 *m_liquid_type; + float *m_liquid_map; + + bool loadAreaData(FILE *in, uint32 offset, uint32 size); + bool loadHeightData(FILE *in, uint32 offset, uint32 size); + bool loadGridMapLiquidData(FILE *in, uint32 offset, uint32 size); + + // Get height functions and pointers + typedef float (GridMap::*pGetHeightPtr) (float x, float y) const; + pGetHeightPtr m_gridGetHeight; + float getHeightFromFloat(float x, float y) const; + float getHeightFromUint16(float x, float y) const; + float getHeightFromUint8(float x, float y) const; + float getHeightFromFlat(float x, float y) const; + + public: + + GridMap(); + ~GridMap(); + + bool loadData(char *filaname); + void unloadData(); + + static bool ExistMap(uint32 mapid, int gx, int gy); + static bool ExistVMap(uint32 mapid, int gx, int gy); + + uint16 getArea(float x, float y); + float getHeight(float x, float y) { return (this->*m_gridGetHeight)(x, y); } + float getLiquidLevel(float x, float y); + uint8 getTerrainType(float x, float y); + GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data = 0); +}; + +#endif diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index cebb448a0..603032f13 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -310,8 +310,8 @@ bool ChatHandler::HandleGPSCommand(const char* args) int gx=63-p.x_coord; int gy=63-p.y_coord; - uint32 have_map = Map::ExistMap(obj->GetMapId(),gx,gy) ? 1 : 0; - uint32 have_vmap = Map::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0; + uint32 have_map = GridMap::ExistMap(obj->GetMapId(),gx,gy) ? 1 : 0; + uint32 have_vmap = GridMap::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0; PSendSysMessage(LANG_MAP_POSITION, obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "" ), @@ -336,8 +336,8 @@ bool ChatHandler::HandleGPSCommand(const char* args) cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(), zone_x, zone_y, ground_z, floor_z, have_map, have_vmap ); - LiquidData liquid_status; - ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status); + GridMapLiquidData liquid_status; + GridMapLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status); if (res) { PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res); diff --git a/src/game/Makefile.am b/src/game/Makefile.am index b9022daf0..f4ef7892f 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -132,6 +132,8 @@ libmangosgame_a_SOURCES = \ GossipDef.cpp \ GossipDef.h \ GridDefines.h \ + GridMap.cpp \ + GridMap.h \ GridNotifiers.cpp \ GridNotifiers.h \ GridNotifiersImpl.h \ diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 206af48f3..15ff06b36 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -35,7 +35,6 @@ #include "Group.h" #include "MapRefManager.h" #include "DBCEnums.h" - #include "MapInstanced.h" #include "InstanceSaveMgr.h" #include "VMapFactory.h" @@ -43,12 +42,6 @@ GridState* si_GridStates[MAX_GRID_STATE]; -static char const* MAP_MAGIC = "MAPS"; -static char const* MAP_VERSION_MAGIC = "v1.1"; -static char const* MAP_AREA_MAGIC = "AREA"; -static char const* MAP_HEIGHT_MAGIC = "MHGT"; -static char const* MAP_LIQUID_MAGIC = "MLIQ"; - struct ScriptAction { uint64 sourceGUID; @@ -66,58 +59,6 @@ Map::~Map() sWorld.DecreaseScheduledScriptCount(m_scriptSchedule.size()); } -bool Map::ExistMap(uint32 mapid,int gx,int gy) -{ - int len = sWorld.GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1; - char* tmp = new char[len]; - snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy); - - FILE *pf=fopen(tmp,"rb"); - - if(!pf) - { - sLog.outError("Check existing of map file '%s': not exist!",tmp); - delete[] tmp; - return false; - } - - map_fileheader header; - fread(&header, sizeof(header), 1, pf); - if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) || - header.versionMagic != *((uint32 const*)(MAP_VERSION_MAGIC)) || - !IsAcceptableClientBuild(header.buildMagic)) - { - sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.",tmp); - delete [] tmp; - fclose(pf); //close file before return - return false; - } - - delete [] tmp; - fclose(pf); - return true; -} - -bool Map::ExistVMap(uint32 mapid,int gx,int gy) -{ - if(VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager()) - { - if(vmgr->isMapLoadingEnabled()) - { - // x and y are swapped !! => fixed now - bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(), mapid, gx,gy); - if(!exists) - { - std::string name = vmgr->getDirFileName(mapid,gx,gy); - sLog.outError("VMap file '%s' is missing or point to wrong version vmap file, redo vmaps with latest vmap_assembler.exe program", (sWorld.GetDataPath()+"vmaps/"+name).c_str()); - return false; - } - } - } - - return true; -} - void Map::LoadVMap(int gx,int gy) { // x and y are swapped !! @@ -1066,510 +1007,6 @@ uint32 Map::GetMaxResetDelay() const return mapDiff ? mapDiff->resetTime : 0; } -//***************************** -// Grid function -//***************************** -GridMap::GridMap() -{ - m_flags = 0; - // Area data - m_gridArea = 0; - m_area_map = NULL; - // Height level data - m_gridHeight = INVALID_HEIGHT; - m_gridGetHeight = &GridMap::getHeightFromFlat; - m_V9 = NULL; - m_V8 = NULL; - // Liquid data - m_liquidType = 0; - m_liquid_offX = 0; - m_liquid_offY = 0; - m_liquid_width = 0; - m_liquid_height = 0; - m_liquidLevel = INVALID_HEIGHT; - m_liquid_type = NULL; - m_liquid_map = NULL; -} - -GridMap::~GridMap() -{ - unloadData(); -} - -bool GridMap::loadData(char *filename) -{ - // Unload old data if exist - unloadData(); - - map_fileheader header; - // Not return error if file not found - FILE *in = fopen(filename, "rb"); - if (!in) - return true; - fread(&header, sizeof(header),1,in); - if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) && - header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)) || - !IsAcceptableClientBuild(header.buildMagic)) - { - // loadup area data - if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) - { - sLog.outError("Error loading map area data\n"); - fclose(in); - return false; - } - // loadup height data - if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize)) - { - sLog.outError("Error loading map height data\n"); - fclose(in); - return false; - } - // loadup liquid data - if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize)) - { - sLog.outError("Error loading map liquids data\n"); - fclose(in); - return false; - } - fclose(in); - return true; - } - sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.", filename); - fclose(in); - return false; -} - -void GridMap::unloadData() -{ - if (m_area_map) delete[] m_area_map; - if (m_V9) delete[] m_V9; - if (m_V8) delete[] m_V8; - if (m_liquid_type) delete[] m_liquid_type; - if (m_liquid_map) delete[] m_liquid_map; - m_area_map = NULL; - m_V9 = NULL; - m_V8 = NULL; - m_liquid_type = NULL; - m_liquid_map = NULL; - m_gridGetHeight = &GridMap::getHeightFromFlat; -} - -bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/) -{ - map_areaHeader header; - fseek(in, offset, SEEK_SET); - fread(&header, sizeof(header), 1, in); - if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC))) - return false; - - m_gridArea = header.gridArea; - if (!(header.flags & MAP_AREA_NO_AREA)) - { - m_area_map = new uint16 [16*16]; - fread(m_area_map, sizeof(uint16), 16*16, in); - } - return true; -} - -bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 /*size*/) -{ - map_heightHeader header; - fseek(in, offset, SEEK_SET); - fread(&header, sizeof(header), 1, in); - if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC))) - return false; - - m_gridHeight = header.gridHeight; - if (!(header.flags & MAP_HEIGHT_NO_HEIGHT)) - { - if ((header.flags & MAP_HEIGHT_AS_INT16)) - { - m_uint16_V9 = new uint16 [129*129]; - m_uint16_V8 = new uint16 [128*128]; - fread(m_uint16_V9, sizeof(uint16), 129*129, in); - fread(m_uint16_V8, sizeof(uint16), 128*128, in); - m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535; - m_gridGetHeight = &GridMap::getHeightFromUint16; - } - else if ((header.flags & MAP_HEIGHT_AS_INT8)) - { - m_uint8_V9 = new uint8 [129*129]; - m_uint8_V8 = new uint8 [128*128]; - fread(m_uint8_V9, sizeof(uint8), 129*129, in); - fread(m_uint8_V8, sizeof(uint8), 128*128, in); - m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255; - m_gridGetHeight = &GridMap::getHeightFromUint8; - } - else - { - m_V9 = new float [129*129]; - m_V8 = new float [128*128]; - fread(m_V9, sizeof(float), 129*129, in); - fread(m_V8, sizeof(float), 128*128, in); - m_gridGetHeight = &GridMap::getHeightFromFloat; - } - } - else - m_gridGetHeight = &GridMap::getHeightFromFlat; - return true; -} - -bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/) -{ - map_liquidHeader header; - fseek(in, offset, SEEK_SET); - fread(&header, sizeof(header), 1, in); - if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC))) - return false; - - m_liquidType = header.liquidType; - m_liquid_offX = header.offsetX; - m_liquid_offY = header.offsetY; - m_liquid_width = header.width; - m_liquid_height= header.height; - m_liquidLevel = header.liquidLevel; - - if (!(header.flags & MAP_LIQUID_NO_TYPE)) - { - m_liquid_type = new uint8 [16*16]; - fread(m_liquid_type, sizeof(uint8), 16*16, in); - } - if (!(header.flags & MAP_LIQUID_NO_HEIGHT)) - { - m_liquid_map = new float [m_liquid_width*m_liquid_height]; - fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in); - } - return true; -} - -uint16 GridMap::getArea(float x, float y) -{ - if (!m_area_map) - return m_gridArea; - - x = 16 * (32 - x/SIZE_OF_GRIDS); - y = 16 * (32 - y/SIZE_OF_GRIDS); - int lx = (int)x & 15; - int ly = (int)y & 15; - return m_area_map[lx*16 + ly]; -} - -float GridMap::getHeightFromFlat(float /*x*/, float /*y*/) const -{ - return m_gridHeight; -} - -float GridMap::getHeightFromFloat(float x, float y) const -{ - if (!m_V8 || !m_V9) - return m_gridHeight; - - x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); - y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); - - int x_int = (int)x; - int y_int = (int)y; - x -= x_int; - y -= y_int; - x_int&=(MAP_RESOLUTION - 1); - y_int&=(MAP_RESOLUTION - 1); - - // Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid - // +--------------> X - // | h1-------h2 Coordinates is: - // | | \ 1 / | h1 0,0 - // | | \ / | h2 0,1 - // | | 2 h5 3 | h3 1,0 - // | | / \ | h4 1,1 - // | | / 4 \ | h5 1/2,1/2 - // | h3-------h4 - // V Y - // For find height need - // 1 - detect triangle - // 2 - solve linear equation from triangle points - // Calculate coefficients for solve h = a*x + b*y + c - - float a,b,c; - // Select triangle: - if (x+y < 1) - { - if (x > y) - { - // 1 triangle (h1, h2, h5 points) - float h1 = m_V9[(x_int )*129 + y_int]; - float h2 = m_V9[(x_int+1)*129 + y_int]; - float h5 = 2 * m_V8[x_int*128 + y_int]; - a = h2-h1; - b = h5-h1-h2; - c = h1; - } - else - { - // 2 triangle (h1, h3, h5 points) - float h1 = m_V9[x_int*129 + y_int ]; - float h3 = m_V9[x_int*129 + y_int+1]; - float h5 = 2 * m_V8[x_int*128 + y_int]; - a = h5 - h1 - h3; - b = h3 - h1; - c = h1; - } - } - else - { - if (x > y) - { - // 3 triangle (h2, h4, h5 points) - float h2 = m_V9[(x_int+1)*129 + y_int ]; - float h4 = m_V9[(x_int+1)*129 + y_int+1]; - float h5 = 2 * m_V8[x_int*128 + y_int]; - a = h2 + h4 - h5; - b = h4 - h2; - c = h5 - h4; - } - else - { - // 4 triangle (h3, h4, h5 points) - float h3 = m_V9[(x_int )*129 + y_int+1]; - float h4 = m_V9[(x_int+1)*129 + y_int+1]; - float h5 = 2 * m_V8[x_int*128 + y_int]; - a = h4 - h3; - b = h3 + h4 - h5; - c = h5 - h4; - } - } - // Calculate height - return a * x + b * y + c; -} - -float GridMap::getHeightFromUint8(float x, float y) const -{ - if (!m_uint8_V8 || !m_uint8_V9) - return m_gridHeight; - - x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); - y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); - - int x_int = (int)x; - int y_int = (int)y; - x -= x_int; - y -= y_int; - x_int&=(MAP_RESOLUTION - 1); - y_int&=(MAP_RESOLUTION - 1); - - int32 a, b, c; - uint8 *V9_h1_ptr = &m_uint8_V9[x_int*128 + x_int + y_int]; - if (x+y < 1) - { - if (x > y) - { - // 1 triangle (h1, h2, h5 points) - int32 h1 = V9_h1_ptr[ 0]; - int32 h2 = V9_h1_ptr[129]; - int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; - a = h2-h1; - b = h5-h1-h2; - c = h1; - } - else - { - // 2 triangle (h1, h3, h5 points) - int32 h1 = V9_h1_ptr[0]; - int32 h3 = V9_h1_ptr[1]; - int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; - a = h5 - h1 - h3; - b = h3 - h1; - c = h1; - } - } - else - { - if (x > y) - { - // 3 triangle (h2, h4, h5 points) - int32 h2 = V9_h1_ptr[129]; - int32 h4 = V9_h1_ptr[130]; - int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; - a = h2 + h4 - h5; - b = h4 - h2; - c = h5 - h4; - } - else - { - // 4 triangle (h3, h4, h5 points) - int32 h3 = V9_h1_ptr[ 1]; - int32 h4 = V9_h1_ptr[130]; - int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int]; - a = h4 - h3; - b = h3 + h4 - h5; - c = h5 - h4; - } - } - // Calculate height - return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight; -} - -float GridMap::getHeightFromUint16(float x, float y) const -{ - if (!m_uint16_V8 || !m_uint16_V9) - return m_gridHeight; - - x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); - y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); - - int x_int = (int)x; - int y_int = (int)y; - x -= x_int; - y -= y_int; - x_int&=(MAP_RESOLUTION - 1); - y_int&=(MAP_RESOLUTION - 1); - - int32 a, b, c; - uint16 *V9_h1_ptr = &m_uint16_V9[x_int*128 + x_int + y_int]; - if (x+y < 1) - { - if (x > y) - { - // 1 triangle (h1, h2, h5 points) - int32 h1 = V9_h1_ptr[ 0]; - int32 h2 = V9_h1_ptr[129]; - int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; - a = h2-h1; - b = h5-h1-h2; - c = h1; - } - else - { - // 2 triangle (h1, h3, h5 points) - int32 h1 = V9_h1_ptr[0]; - int32 h3 = V9_h1_ptr[1]; - int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; - a = h5 - h1 - h3; - b = h3 - h1; - c = h1; - } - } - else - { - if (x > y) - { - // 3 triangle (h2, h4, h5 points) - int32 h2 = V9_h1_ptr[129]; - int32 h4 = V9_h1_ptr[130]; - int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; - a = h2 + h4 - h5; - b = h4 - h2; - c = h5 - h4; - } - else - { - // 4 triangle (h3, h4, h5 points) - int32 h3 = V9_h1_ptr[ 1]; - int32 h4 = V9_h1_ptr[130]; - int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int]; - a = h4 - h3; - b = h3 + h4 - h5; - c = h5 - h4; - } - } - // Calculate height - return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight; -} - -float GridMap::getLiquidLevel(float x, float y) -{ - if (!m_liquid_map) - return m_liquidLevel; - - x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); - y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); - - int cx_int = ((int)x & (MAP_RESOLUTION-1)) - m_liquid_offY; - int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX; - - if (cx_int < 0 || cx_int >=m_liquid_height) - return INVALID_HEIGHT; - if (cy_int < 0 || cy_int >=m_liquid_width ) - return INVALID_HEIGHT; - - return m_liquid_map[cx_int*m_liquid_width + cy_int]; -} - -uint8 GridMap::getTerrainType(float x, float y) -{ - if (!m_liquid_type) - return (uint8)m_liquidType; - - x = 16 * (32 - x/SIZE_OF_GRIDS); - y = 16 * (32 - y/SIZE_OF_GRIDS); - int lx = (int)x & 15; - int ly = (int)y & 15; - return m_liquid_type[lx*16 + ly]; -} - -// Get water state on map -inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data) -{ - // Check water type (if no water return) - if (!m_liquid_type && !m_liquidType) - return LIQUID_MAP_NO_WATER; - - // Get cell - float cx = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); - float cy = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); - - int x_int = (int)cx & (MAP_RESOLUTION-1); - int y_int = (int)cy & (MAP_RESOLUTION-1); - - // Check water type in cell - uint8 type = m_liquid_type ? m_liquid_type[(x_int>>3)*16 + (y_int>>3)] : m_liquidType; - if (type == 0) - return LIQUID_MAP_NO_WATER; - - // Check req liquid type mask - if (ReqLiquidType && !(ReqLiquidType&type)) - return LIQUID_MAP_NO_WATER; - - // Check water level: - // Check water height map - int lx_int = x_int - m_liquid_offY; - int ly_int = y_int - m_liquid_offX; - if (lx_int < 0 || lx_int >=m_liquid_height) - return LIQUID_MAP_NO_WATER; - if (ly_int < 0 || ly_int >=m_liquid_width ) - return LIQUID_MAP_NO_WATER; - - // Get water level - float liquid_level = m_liquid_map ? m_liquid_map[lx_int*m_liquid_width + ly_int] : m_liquidLevel; - // Get ground level (sub 0.2 for fix some errors) - float ground_level = getHeight(x, y); - - // Check water level and ground level - if (liquid_level < ground_level || z < ground_level - 2) - return LIQUID_MAP_NO_WATER; - - // All ok in water -> store data - if (data) - { - data->type = type; - data->level = liquid_level; - data->depth_level = ground_level; - } - - // For speed check as int values - int delta = int((liquid_level - z) * 10); - - // Get position delta - if (delta > 20) // Under water - return LIQUID_MAP_UNDER_WATER; - if (delta > 0 ) // In water - return LIQUID_MAP_IN_WATER; - if (delta > -1) // Walk on water - return LIQUID_MAP_WATER_WALK; - // Above water - return LIQUID_MAP_ABOVE_WATER; -} - inline GridMap *Map::GetGrid(float x, float y) { // half opt method @@ -1899,7 +1336,7 @@ uint8 Map::GetTerrainType(float x, float y ) const return 0; } -ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data) const +GridMapLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data) const { if(GridMap* gmap = const_cast(this)->GetGrid(x, y)) return gmap->getLiquidStatus(x, y, z, ReqLiquidType, data); @@ -1948,7 +1385,7 @@ bool Map::IsInWater(float x, float y, float pZ) const // Check surface in x, y point for liquid if (const_cast(this)->GetGrid(x, y)) { - LiquidData liquid_status; + GridMapLiquidData liquid_status; if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, &liquid_status)) { if (liquid_status.level - liquid_status.depth_level > 2) diff --git a/src/game/Map.h b/src/game/Map.h index 3acb8813f..7607b49da 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -30,6 +30,7 @@ #include "Object.h" #include "Timer.h" #include "SharedDefines.h" +#include "GridMap.h" #include "GameSystem/GridRefManager.h" #include "MapRefManager.h" #include "Utilities/TypeList.h" @@ -46,139 +47,7 @@ class InstanceSave; struct ScriptInfo; struct ScriptAction; class BattleGround; - -//****************************************** -// Map file format defines -//****************************************** -struct map_fileheader -{ - uint32 mapMagic; - uint32 versionMagic; - uint32 buildMagic; - uint32 areaMapOffset; - uint32 areaMapSize; - uint32 heightMapOffset; - uint32 heightMapSize; - uint32 liquidMapOffset; - uint32 liquidMapSize; -}; - -#define MAP_AREA_NO_AREA 0x0001 - -struct map_areaHeader -{ - uint32 fourcc; - uint16 flags; - uint16 gridArea; -}; - -#define MAP_HEIGHT_NO_HEIGHT 0x0001 -#define MAP_HEIGHT_AS_INT16 0x0002 -#define MAP_HEIGHT_AS_INT8 0x0004 - -struct map_heightHeader -{ - uint32 fourcc; - uint32 flags; - float gridHeight; - float gridMaxHeight; -}; - -#define MAP_LIQUID_NO_TYPE 0x0001 -#define MAP_LIQUID_NO_HEIGHT 0x0002 - -struct map_liquidHeader -{ - uint32 fourcc; - uint16 flags; - uint16 liquidType; - uint8 offsetX; - uint8 offsetY; - uint8 width; - uint8 height; - float liquidLevel; -}; - -enum ZLiquidStatus -{ - LIQUID_MAP_NO_WATER = 0x00000000, - LIQUID_MAP_ABOVE_WATER = 0x00000001, - LIQUID_MAP_WATER_WALK = 0x00000002, - LIQUID_MAP_IN_WATER = 0x00000004, - LIQUID_MAP_UNDER_WATER = 0x00000008 -}; - -#define MAP_LIQUID_TYPE_NO_WATER 0x00 -#define MAP_LIQUID_TYPE_WATER 0x01 -#define MAP_LIQUID_TYPE_OCEAN 0x02 -#define MAP_LIQUID_TYPE_MAGMA 0x04 -#define MAP_LIQUID_TYPE_SLIME 0x08 - -#define MAP_ALL_LIQUIDS (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME) - -#define MAP_LIQUID_TYPE_DARK_WATER 0x10 -#define MAP_LIQUID_TYPE_WMO_WATER 0x20 - -struct LiquidData -{ - uint32 type; - float level; - float depth_level; -}; - -class GridMap -{ - uint32 m_flags; - // Area data - uint16 m_gridArea; - uint16 *m_area_map; - // Height level data - float m_gridHeight; - float m_gridIntHeightMultiplier; - union{ - float *m_V9; - uint16 *m_uint16_V9; - uint8 *m_uint8_V9; - }; - union{ - float *m_V8; - uint16 *m_uint16_V8; - uint8 *m_uint8_V8; - }; - // Liquid data - uint16 m_liquidType; - uint8 m_liquid_offX; - uint8 m_liquid_offY; - uint8 m_liquid_width; - uint8 m_liquid_height; - float m_liquidLevel; - uint8 *m_liquid_type; - float *m_liquid_map; - - bool loadAreaData(FILE *in, uint32 offset, uint32 size); - bool loadHeightData(FILE *in, uint32 offset, uint32 size); - bool loadLiquidData(FILE *in, uint32 offset, uint32 size); - - // Get height functions and pointers - typedef float (GridMap::*pGetHeightPtr) (float x, float y) const; - pGetHeightPtr m_gridGetHeight; - float getHeightFromFloat(float x, float y) const; - float getHeightFromUint16(float x, float y) const; - float getHeightFromUint8(float x, float y) const; - float getHeightFromFlat(float x, float y) const; - -public: - GridMap(); - ~GridMap(); - bool loadData(char *filaname); - void unloadData(); - - uint16 getArea(float x, float y); - inline float getHeight(float x, float y) {return (this->*m_gridGetHeight)(x, y);} - float getLiquidLevel(float x, float y); - uint8 getTerrainType(float x, float y); - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data = 0); -}; +class GridMap; // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform #if defined( __GNUC__ ) @@ -275,9 +144,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj time_t GetGridExpiry(void) const { return i_gridExpiry; } uint32 GetId(void) const { return i_id; } - static bool ExistMap(uint32 mapid, int gx, int gy); - static bool ExistVMap(uint32 mapid, int gx, int gy); - static void InitStateMachine(); static void DeleteStateMachine(); @@ -288,7 +154,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj float GetHeight(float x, float y, float z, bool pCheckVMap=true) const; bool IsInWater(float x, float y, float z) const; // does not use z pos. This is for future use - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data = 0) const; + GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data = 0) const; uint16 GetAreaFlag(float x, float y, float z) const; uint8 GetTerrainType(float x, float y ) const; @@ -573,16 +439,6 @@ class MANGOS_DLL_SPEC BattleGroundMap : public Map BattleGround* m_bg; }; -/*inline -uint64 -Map::CalculateGridMask(const uint32 &y) const -{ - uint64 mask = 1; - mask <<= y; - return mask; -} -*/ - template inline void Map::Visit(const Cell& cell, TypeContainerVisitor &visitor) diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 379aee55a..7feb5ece6 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -283,7 +283,7 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x,float y) int gx=63-p.x_coord; int gy=63-p.y_coord; - return Map::ExistMap(mapid,gx,gy) && Map::ExistVMap(mapid,gx,gy); + return GridMap::ExistMap(mapid,gx,gy) && GridMap::ExistVMap(mapid,gx,gy); } bool MapManager::IsValidMAP(uint32 mapid) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index fadd58cd8..7513657d7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20427,8 +20427,8 @@ void Player::SetOriginalGroup(Group *group, int8 subgroup) void Player::UpdateUnderwaterState( Map* m, float x, float y, float z ) { - LiquidData liquid_status; - ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); + GridMapLiquidData liquid_status; + GridMapLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); if (!res) { m_MirrorTimerFlags &= ~(UNDERWATER_INWATER|UNDERWATER_INLAVA|UNDERWATER_INSLIME|UNDERWATER_INDARKWATER); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d84e0e677..f50169e36 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9994" + #define REVISION_NR "9995" #endif // __REVISION_NR_H__ diff --git a/win/VC100/game.vcxproj b/win/VC100/game.vcxproj index 4be936d3e..575fef41e 100644 --- a/win/VC100/game.vcxproj +++ b/win/VC100/game.vcxproj @@ -398,6 +398,7 @@ + @@ -547,6 +548,7 @@ + diff --git a/win/VC100/game.vcxproj.filters b/win/VC100/game.vcxproj.filters index 0e1ae5581..44940f527 100644 --- a/win/VC100/game.vcxproj.filters +++ b/win/VC100/game.vcxproj.filters @@ -120,6 +120,9 @@ World/Handlers + + World/Handlers + World/Handlers @@ -516,6 +519,9 @@ World/Handlers + + World/Handlers + World/Handlers diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index dff181fcc..409c26ffa 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -745,6 +745,14 @@ RelativePath="..\..\src\game\GridDefines.h" > + + + + diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index 4003b3dba..b8d61586e 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -746,6 +746,14 @@ RelativePath="..\..\src\game\GridDefines.h" > + + + + From aa62225c68dd4eba49d2675311580b96f8c29c01 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Fri, 28 May 2010 15:00:52 +0200 Subject: [PATCH 124/172] [9996] Remove grid state debugging code and move state machine to MapManager. --- src/game/GridStates.h | 17 ++------- src/game/Map.cpp | 20 +---------- src/game/Map.h | 3 -- src/game/MapManager.cpp | 74 ++++++++++++++++------------------------ src/game/MapManager.h | 11 ++++-- src/shared/revision_nr.h | 2 +- 6 files changed, 42 insertions(+), 85 deletions(-) diff --git a/src/game/GridStates.h b/src/game/GridStates.h index c41853c5b..503b9df15 100644 --- a/src/game/GridStates.h +++ b/src/game/GridStates.h @@ -24,21 +24,7 @@ class MANGOS_DLL_DECL GridState { public: -#ifdef MANGOS_DEBUG -#define MAGIC_TESTVAL 0xFBE823BA - GridState() { i_Magic = MAGIC_TESTVAL; } - bool checkMagic() - { - if(i_Magic != MAGIC_TESTVAL) - { - sLog.outError("!!! GridState: Magic value gone !!!"); - return false; - } - return true; - } - void setMagic() { i_Magic = MAGIC_TESTVAL; } - unsigned int i_Magic; -#endif + virtual void Update(Map &, NGridType&, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const = 0; }; @@ -69,4 +55,5 @@ class MANGOS_DLL_DECL RemovalState : public GridState void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; + #endif diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 15ff06b36..bca4cca36 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -40,8 +40,6 @@ #include "VMapFactory.h" #include "BattleGroundMgr.h" -GridState* si_GridStates[MAX_GRID_STATE]; - struct ScriptAction { uint64 sourceGUID; @@ -126,22 +124,6 @@ void Map::LoadMapAndVMap(int gx,int gy) LoadVMap(gx, gy); // Only load the data for the base map } -void Map::InitStateMachine() -{ - si_GridStates[GRID_STATE_INVALID] = new InvalidState; - si_GridStates[GRID_STATE_ACTIVE] = new ActiveState; - si_GridStates[GRID_STATE_IDLE] = new IdleState; - si_GridStates[GRID_STATE_REMOVAL] = new RemovalState; -} - -void Map::DeleteStateMachine() -{ - delete si_GridStates[GRID_STATE_INVALID]; - delete si_GridStates[GRID_STATE_ACTIVE]; - delete si_GridStates[GRID_STATE_IDLE]; - delete si_GridStates[GRID_STATE_REMOVAL]; -} - Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent) : i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), @@ -648,7 +630,7 @@ void Map::Update(const uint32 &t_diff) GridInfo *info = i->getSource()->getGridInfoRef(); ++i; // The update might delete the map and we need the next map before the iterator gets invalid ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE); - si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, grid->getX(), grid->getY(), t_diff); + sMapMgr.UpdateGridState(grid->GetGridState(), *this, *grid, *info, grid->getX(), grid->getY(), t_diff); } } diff --git a/src/game/Map.h b/src/game/Map.h index 7607b49da..5193d2c7b 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -144,9 +144,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj time_t GetGridExpiry(void) const { return i_gridExpiry; } uint32 GetId(void) const { return i_id; } - static void InitStateMachine(); - static void DeleteStateMachine(); - Map const * GetParent() const { return m_parentMap; } // some calls like isInWater should not use vmaps due to processor power diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 7feb5ece6..5f9622d2f 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -34,9 +34,8 @@ INSTANTIATE_SINGLETON_2(MapManager, CLASS_LOCK); INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Thread_Mutex); -extern GridState* si_GridStates[]; // debugging code, should be deleted some day - -MapManager::MapManager() : i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN)) +MapManager::MapManager() + : i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN)) { i_timer.SetInterval(sWorld.getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE)); } @@ -49,59 +48,47 @@ MapManager::~MapManager() for(TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i) delete *i; - Map::DeleteStateMachine(); + DeleteStateMachine(); } void MapManager::Initialize() { - Map::InitStateMachine(); - - // debugging code, should be deleted some day - { - for(int i=0;iUpdate(map, ngrid, ginfo, x, y, t_diff); +} + void MapManager::InitializeVisibilityDistanceInfo() { for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter) (*iter).second->InitVisibilityDistance(); } -// debugging code, should be deleted some day -void MapManager::checkAndCorrectGridStatesArray() -{ - bool ok = true; - for(int i=0;icheckMagic()) - { - ok = false; - si_GridStates[i]->setMagic(); - } - #endif - } - if(!ok) - ++i_GridStateErrorCount; - if(i_GridStateErrorCount > 2) - ASSERT(false); // force a crash. Too many errors -} - Map* MapManager::_createBaseMap(uint32 id) { @@ -259,10 +246,7 @@ MapManager::Update(uint32 diff) return; for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter) - { - checkAndCorrectGridStatesArray(); // debugging code, should be deleted some day iter->second->Update((uint32)i_timer.GetCurrent()); - } for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter) (*iter)->Update(i_timer.GetCurrent()); diff --git a/src/game/MapManager.h b/src/game/MapManager.h index c07a7c11a..c48f821ba 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -43,6 +43,8 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton(this)->_createBaseMap(id); } Map* FindMap(uint32 mapid, uint32 instanceId = 0) const; + void UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid, GridInfo& ginfo, const uint32 &x, const uint32 &y, const uint32 &t_diff); + // only const version for outer users void DeleteInstance(uint32 mapid, uint32 instanceId); @@ -130,17 +132,22 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton Date: Fri, 28 May 2010 15:30:23 +0200 Subject: [PATCH 125/172] [9997] Some changes in HashMapHolder. * Use ACE_RW_Thread_Mutex, since there's much more reading than writing. * Use read lock in Find(), and write lock in Insert() and Remove(). * Correctly lock the hashmap on outside calls. --- src/game/Level0.cpp | 24 +++++++++++++----------- src/game/ObjectAccessor.cpp | 17 ++++++++--------- src/game/ObjectAccessor.h | 20 ++++++++++++++------ src/shared/revision_nr.h | 2 +- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index d0a4effd1..d95043931 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -153,21 +153,23 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) { bool first = true; - HashMapHolder::MapType &m = HashMapHolder::GetContainer(); - HashMapHolder::MapType::const_iterator itr = m.begin(); - for(; itr != m.end(); ++itr) { - AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) && - (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) + HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); + HashMapHolder::MapType &m = sObjectAccessor.GetPlayers(); + for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { - if(first) + AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); + if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) && + (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) { - SendSysMessage(LANG_GMS_ON_SRV); - first = false; - } + if(first) + { + SendSysMessage(LANG_GMS_ON_SRV); + first = false; + } - SendSysMessage(GetNameLink(itr->second).c_str()); + SendSysMessage(GetNameLink(itr->second).c_str()); + } } } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 53e4d828e..6b12b85d6 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -92,22 +92,21 @@ ObjectAccessor::FindPlayer(ObjectGuid guid) Player* ObjectAccessor::FindPlayerByName(const char *name) { - //TODO: Player Guard - HashMapHolder::MapType& m = HashMapHolder::GetContainer(); - HashMapHolder::MapType::iterator iter = m.begin(); - for(; iter != m.end(); ++iter) + HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); + HashMapHolder::MapType& m = sObjectAccessor.GetPlayers(); + for(HashMapHolder::MapType::iterator iter = m.begin(); iter != m.end(); ++iter) if(iter->second->IsInWorld() && ( ::strcmp(name, iter->second->GetName()) == 0 )) return iter->second; + return NULL; } void ObjectAccessor::SaveAllPlayers() { - Guard guard(*HashMapHolder::GetLock()); - HashMapHolder::MapType& m = HashMapHolder::GetContainer(); - HashMapHolder::MapType::iterator itr = m.begin(); - for(; itr != m.end(); ++itr) + HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); + HashMapHolder::MapType& m = sObjectAccessor.GetPlayers(); + for(HashMapHolder::MapType::iterator itr = m.begin(); itr != m.end(); ++itr) itr->second->SaveToDB(); } @@ -277,7 +276,7 @@ void ObjectAccessor::RemoveOldCorpses() /// Define the static member of HashMapHolder template UNORDERED_MAP< uint64, T* > HashMapHolder::m_objectMap; -template ACE_Thread_Mutex HashMapHolder::i_lock; +template ACE_RW_Thread_Mutex HashMapHolder::i_lock; /// Global definitions for the hashmap storage diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 2853d6097..161deb60f 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -22,6 +22,7 @@ #include "Platform/Define.h" #include "Policies/Singleton.h" #include +#include #include "Utilities/UnorderedMap.h" #include "Policies/ThreadingModel.h" @@ -47,26 +48,33 @@ class HashMapHolder public: typedef UNORDERED_MAP< uint64, T* > MapType; - typedef ACE_Thread_Mutex LockType; - typedef MaNGOS::GeneralLock Guard; + typedef ACE_RW_Thread_Mutex LockType; + typedef ACE_Read_Guard ReadGuard; + typedef ACE_Write_Guard WriteGuard; - static void Insert(T* o) { m_objectMap[o->GetGUID()] = o; } + static void Insert(T* o) + { + WriteGuard guard(i_lock); + m_objectMap[o->GetGUID()] = o; + } static void Remove(T* o) { - Guard guard(i_lock); + WriteGuard guard(i_lock); m_objectMap.erase(o->GetGUID()); } static T* Find(ObjectGuid guid) { + ReadGuard guard(i_lock); typename MapType::iterator itr = m_objectMap.find(guid.GetRawValue()); return (itr != m_objectMap.end()) ? itr->second : NULL; } static MapType& GetContainer() { return m_objectMap; } - static LockType* GetLock() { return &i_lock; } + static LockType& GetLock() { return i_lock; } + private: //Non instanceable only static @@ -78,8 +86,8 @@ class HashMapHolder class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton > { - friend class MaNGOS::OperatorNew; + ObjectAccessor(); ~ObjectAccessor(); ObjectAccessor(const ObjectAccessor &); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 56cc0a89f..69e344530 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9996" + #define REVISION_NR "9997" #endif // __REVISION_NR_H__ From d5dfbd0bfc3b2d4e99fb9e390543aa7ab58accef Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Fri, 28 May 2010 17:25:48 +0200 Subject: [PATCH 126/172] [9998] Fix *nix build. --- src/game/GridMap.cpp | 1 + src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/GridMap.cpp b/src/game/GridMap.cpp index 17e5c26a4..ce6e459e4 100644 --- a/src/game/GridMap.cpp +++ b/src/game/GridMap.cpp @@ -23,6 +23,7 @@ #include "Map.h" #include "Config/ConfigEnv.h" #include "DBCEnums.h" +#include "DBCStores.h" #include "GridMap.h" #include "VMapFactory.h" #include "World.h" diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 69e344530..c9239efda 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9997" + #define REVISION_NR "9998" #endif // __REVISION_NR_H__ From d6ea8e35abb96becbcf0543c7b5fe45330df6f4f Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Fri, 28 May 2010 17:53:13 +0200 Subject: [PATCH 127/172] [9999] Remove a piece of trailing whitespace. --- src/game/SpellEffects.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 3d55cb640..324436441 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4991,7 +4991,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) case 71021: // Saber Lash { uint32 count = 0; - for(std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for(std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) if(ihit->effectMask & (1< Date: Fri, 28 May 2010 20:39:15 +0400 Subject: [PATCH 128/172] [10000] Redundent empty line. --- Makefile.am | 1 - src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2ac42231e..c9165d444 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,4 +54,3 @@ EXTRA_DIST += \ win/VC100/g3dlite.vcxproj ACLOCAL_AMFLAGS = -I m4 - diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d057eb439..93ad08339 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9999" + #define REVISION_NR "10000" #endif // __REVISION_NR_H__ From cd5d598bd6e0e0f5011a4ebfe9e0436b25fbfd31 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 28 May 2010 23:44:07 +0400 Subject: [PATCH 129/172] [10001] Rename current version sql updates (0.16/root dir) to 5 digits format rev. * order guards not affected in sql updates so this not affect sql guards work. * TO DEVS: in next sql update commit please check carefully generated by git_is -s sql guards for correctness --- ...rs_account_data.sql => 09136_01_characters_account_data.sql} | 0 ...36_02_mangos_quest_poi.sql => 09136_02_mangos_quest_poi.sql} | 0 ...cter_ticket.sql => 09136_03_characters_character_ticket.sql} | 0 ...4_mangos_spell_chain.sql => 09136_04_mangos_spell_chain.sql} | 0 ...pell_bonus_data.sql => 09136_05_mangos_spell_bonus_data.sql} | 0 ...pell_proc_event.sql => 09136_06_mangos_spell_proc_event.sql} | 0 ...acters_characters.sql => 09136_07_characters_characters.sql} | 0 ...pell_bonus_data.sql => 09148_01_mangos_spell_bonus_data.sql} | 0 ...pell_bonus_data.sql => 09149_01_mangos_spell_bonus_data.sql} | 0 ...pell_bonus_data.sql => 09150_01_mangos_spell_bonus_data.sql} | 0 ...pell_bonus_data.sql => 09153_01_mangos_spell_bonus_data.sql} | 0 ...pell_proc_event.sql => 09155_01_mangos_spell_proc_event.sql} | 0 ...1_mangos_spell_chain.sql => 09156_01_mangos_spell_chain.sql} | 0 ...pell_proc_event.sql => 09156_02_mangos_spell_proc_event.sql} | 0 ...pell_proc_event.sql => 09160_01_mangos_spell_proc_event.sql} | 0 ...2_mangos_spell_chain.sql => 09160_02_mangos_spell_chain.sql} | 0 ...ngos_mangos_string.sql => 09198_01_mangos_mangos_string.sql} | 0 ...pell_proc_event.sql => 09220_01_mangos_spell_proc_event.sql} | 0 ...2_mangos_spell_chain.sql => 09220_02_mangos_spell_chain.sql} | 0 ...nfo_spell.sql => 09222_01_mangos_playercreateinfo_spell.sql} | 0 ...pell_proc_event.sql => 09244_01_mangos_spell_proc_event.sql} | 0 ...2_mangos_spell_chain.sql => 09244_02_mangos_spell_chain.sql} | 0 ...aracters_character.sql => 09246_01_characters_character.sql} | 0 ...aracters_character.sql => 09250_01_characters_character.sql} | 0 ...os_quest_template.sql => 09262_01_mangos_quest_template.sql} | 0 ...pell_bonus_data.sql => 09277_01_mangos_spell_bonus_data.sql} | 0 ...pell_bonus_data.sql => 09288_01_mangos_spell_bonus_data.sql} | 0 ...pell_proc_event.sql => 09289_01_mangos_spell_proc_event.sql} | 0 ...os_quest_template.sql => 09291_01_mangos_quest_template.sql} | 0 ...ngos_locales_quest.sql => 09291_02_mangos_locales_quest.sql} | 0 ...1_mangos_spell_chain.sql => 09296_01_mangos_spell_chain.sql} | 0 ...ngos_item_template.sql => 09297_01_mangos_item_template.sql} | 0 ...os_quest_template.sql => 09309_01_mangos_quest_template.sql} | 0 ...mangos_spell_elixir.sql => 09310_01_mangos_spell_elixir.sql} | 0 ...os_quest_template.sql => 09312_01_mangos_quest_template.sql} | 0 ...1_mangos_spell_chain.sql => 09329_01_mangos_spell_chain.sql} | 0 ...os_quest_template.sql => 09331_01_mangos_quest_template.sql} | 0 ...39_01_characters_group.sql => 09339_01_characters_group.sql} | 0 ...cter_action.sql => 09349_01_characters_character_action.sql} | 0 ...cter_action.sql => 09354_01_characters_character_action.sql} | 0 ...acters_characters.sql => 09359_01_characters_characters.sql} | 0 ...pell_bonus_data.sql => 09366_01_mangos_spell_bonus_data.sql} | 0 ...pell_proc_event.sql => 09366_02_mangos_spell_proc_event.sql} | 0 ...cter_glyphs.sql => 09374_01_characters_character_glyphs.sql} | 0 ...cter_glyphs.sql => 09375_01_characters_character_glyphs.sql} | 0 ...pell_proc_event.sql => 09379_01_mangos_spell_proc_event.sql} | 0 .../{9380_01_mangos_command.sql => 09380_01_mangos_command.sql} | 0 .../{9382_01_mangos_command.sql => 09382_01_mangos_command.sql} | 0 .../{9385_01_mangos_command.sql => 09385_01_mangos_command.sql} | 0 ...pell_proc_event.sql => 09450_01_mangos_spell_proc_event.sql} | 0 ...pell_bonus_data.sql => 09460_01_mangos_spell_bonus_data.sql} | 0 ...2_mangos_spell_chain.sql => 09460_02_mangos_spell_chain.sql} | 0 ...pell_proc_event.sql => 09464_01_mangos_spell_proc_event.sql} | 0 ...ngos_mangos_string.sql => 09466_01_mangos_mangos_string.sql} | 0 ...pell_proc_event.sql => 09477_01_mangos_spell_proc_event.sql} | 0 ...pell_proc_event.sql => 09482_01_mangos_spell_proc_event.sql} | 0 ...ngos_item_template.sql => 09509_01_mangos_item_template.sql} | 0 ...pell_proc_event.sql => 09512_01_mangos_spell_proc_event.sql} | 0 ...pell_proc_event.sql => 09526_01_mangos_spell_proc_event.sql} | 0 ...pell_bonus_data.sql => 09528_01_mangos_spell_bonus_data.sql} | 0 ...pell_bonus_data.sql => 09539_01_mangos_spell_bonus_data.sql} | 0 ...ature_template.sql => 09589_01_mangos_creature_template.sql} | 0 ...b_script_string.sql => 09590_01_mangos_db_script_string.sql} | 0 .../0.16/{9611_01_characters.sql => 09611_01_characters.sql} | 0 ..._01_mangos_gameobject.sql => 09622_01_mangos_gameobject.sql} | 0 ...acters_characters.sql => 09630_01_characters_characters.sql} | 0 ...acters_characters.sql => 09632_01_characters_characters.sql} | 0 ..._01_characters_corpse.sql => 09634_01_characters_corpse.sql} | 0 ...acters_characters.sql => 09635_01_characters_characters.sql} | 0 ...ngos_item_template.sql => 09636_01_mangos_item_template.sql} | 0 ...acters_characters.sql => 09646_01_characters_characters.sql} | 0 ...51_01_mangos_quest_poi.sql => 09651_01_mangos_quest_poi.sql} | 0 .../{9656_01_mangos_command.sql => 09656_01_mangos_command.sql} | 0 ...ngos_mangos_string.sql => 09656_02_mangos_mangos_string.sql} | 0 ...cter_talent.sql => 09661_01_characters_character_talent.sql} | 0 ...ngos_mangos_string.sql => 09663_01_mangos_mangos_string.sql} | 0 ...racter_stats.sql => 09680_01_characters_character_stats.sql} | 0 ...sql => 09686_01_characters_character_queststatus_weekly.sql} | 0 ....sql => 09687_01_characters_character_queststatus_daily.sql} | 0 ...pell_proc_event.sql => 09690_01_mangos_spell_proc_event.sql} | 0 ...10_01_realmd_realmlist.sql => 09010_01_realmd_realmlist.sql} | 0 ...9692_01_characters_mail.sql => 09692_01_characters_mail.sql} | 0 ...9692_02_characters_mail.sql => 09692_02_characters_mail.sql} | 0 ...pell_proc_event.sql => 09692_03_mangos_spell_proc_event.sql} | 0 ...9702_01_characters_item.sql => 09702_01_characters_item.sql} | 0 ...vement_reward.sql => 09704_01_mangos_achievement_reward.sql} | 0 .../{9710_01_mangos_command.sql => 09710_01_mangos_command.sql} | 0 ..._01_mangos_npc_vendor.sql => 09716_01_mangos_npc_vendor.sql} | 0 ...ngos_mangos_string.sql => 09716_02_mangos_mangos_string.sql} | 0 ...pell_proc_event.sql => 09720_01_mangos_spell_proc_event.sql} | 0 ...p_menu_option.sql => 09728_01_mangos_gossip_menu_option.sql} | 0 ...pell_proc_event.sql => 09735_01_mangos_spell_proc_event.sql} | 0 ...2_mangos_spell_chain.sql => 09735_02_mangos_spell_chain.sql} | 0 ...46_01_realmd_realmlist.sql => 09746_01_realmd_realmlist.sql} | 0 ...d_template.sql => 09747_01_mangos_battleground_template.sql} | 0 ...48_01_realmd_realmlist.sql => 09748_01_realmd_realmlist.sql} | 0 sql/updates/{9751_01_characters.sql => 09751_01_characters.sql} | 0 ...ect_template.sql => 09752_01_mangos_gameobject_template.sql} | 0 ...tance_template.sql => 09753_01_mangos_instance_template.sql} | 0 ...tance_template.sql => 09755_01_mangos_instance_template.sql} | 0 ...ngos_mangos_string.sql => 09761_01_mangos_mangos_string.sql} | 0 ...d_template.sql => 09763_01_mangos_battleground_template.sql} | 0 ...pell_proc_event.sql => 09766_01_mangos_spell_proc_event.sql} | 0 ...ngos_mangos_string.sql => 09767_01_mangos_mangos_string.sql} | 0 .../{9767_02_mangos_command.sql => 09767_02_mangos_command.sql} | 0 ...acters_characters.sql => 09767_03_characters_characters.sql} | 0 .../{9768_01_mangos_command.sql => 09768_01_mangos_command.sql} | 0 ...ngos_mangos_string.sql => 09794_01_mangos_mangos_string.sql} | 0 .../{9794_02_mangos_command.sql => 09794_02_mangos_command.sql} | 0 ...pell_bonus_data.sql => 09803_01_mangos_spell_bonus_data.sql} | 0 ...cript_target.sql => 09826_01_mangos_spell_script_target.sql} | 0 ...ed_variables.sql => 09849_01_characters_saved_variables.sql} | 0 ...pell_bonus_data.sql => 09854_01_mangos_spell_bonus_data.sql} | 0 .../{9881_01_mangos_scripts.sql => 09881_01_mangos_scripts.sql} | 0 .../{9883_01_mangos_scripts.sql => 09883_01_mangos_scripts.sql} | 0 ...ngos_mangos_string.sql => 09886_01_mangos_mangos_string.sql} | 0 .../{9886_02_mangos_command.sql => 09886_02_mangos_command.sql} | 0 ...ature_movement.sql => 09891_01_mangos_creature_movement.sql} | 0 ...cripts.sql => 09891_02_mangos_creature_movement_scripts.sql} | 0 ...pell_bonus_data.sql => 09899_01_mangos_spell_bonus_data.sql} | 0 ...ngos_mangos_string.sql => 09924_01_mangos_mangos_string.sql} | 0 .../{9924_02_mangos_command.sql => 09924_02_mangos_command.sql} | 0 ...ngos_mangos_string.sql => 09957_01_mangos_mangos_string.sql} | 0 ..._02_mangos_npc_vendor.sql => 09957_02_mangos_npc_vendor.sql} | 0 ...pell_proc_event.sql => 09967_01_mangos_spell_proc_event.sql} | 0 ...74_01_characters_group.sql => 09974_01_characters_group.sql} | 0 ...pell_proc_event.sql => 09977_01_mangos_spell_proc_event.sql} | 0 ...pell_bonus_data.sql => 09978_01_mangos_spell_bonus_data.sql} | 0 ...1_mangos_spell_chain.sql => 09988_01_mangos_spell_chain.sql} | 0 ...1_mangos_spell_chain.sql => 09990_01_mangos_spell_chain.sql} | 0 src/shared/revision_nr.h | 2 +- 131 files changed, 1 insertion(+), 1 deletion(-) rename sql/updates/0.16/{9136_01_characters_account_data.sql => 09136_01_characters_account_data.sql} (100%) rename sql/updates/0.16/{9136_02_mangos_quest_poi.sql => 09136_02_mangos_quest_poi.sql} (100%) rename sql/updates/0.16/{9136_03_characters_character_ticket.sql => 09136_03_characters_character_ticket.sql} (100%) rename sql/updates/0.16/{9136_04_mangos_spell_chain.sql => 09136_04_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9136_05_mangos_spell_bonus_data.sql => 09136_05_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9136_06_mangos_spell_proc_event.sql => 09136_06_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9136_07_characters_characters.sql => 09136_07_characters_characters.sql} (100%) rename sql/updates/0.16/{9148_01_mangos_spell_bonus_data.sql => 09148_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9149_01_mangos_spell_bonus_data.sql => 09149_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9150_01_mangos_spell_bonus_data.sql => 09150_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9153_01_mangos_spell_bonus_data.sql => 09153_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9155_01_mangos_spell_proc_event.sql => 09155_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9156_01_mangos_spell_chain.sql => 09156_01_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9156_02_mangos_spell_proc_event.sql => 09156_02_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9160_01_mangos_spell_proc_event.sql => 09160_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9160_02_mangos_spell_chain.sql => 09160_02_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9198_01_mangos_mangos_string.sql => 09198_01_mangos_mangos_string.sql} (100%) rename sql/updates/0.16/{9220_01_mangos_spell_proc_event.sql => 09220_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9220_02_mangos_spell_chain.sql => 09220_02_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9222_01_mangos_playercreateinfo_spell.sql => 09222_01_mangos_playercreateinfo_spell.sql} (100%) rename sql/updates/0.16/{9244_01_mangos_spell_proc_event.sql => 09244_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9244_02_mangos_spell_chain.sql => 09244_02_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9246_01_characters_character.sql => 09246_01_characters_character.sql} (100%) rename sql/updates/0.16/{9250_01_characters_character.sql => 09250_01_characters_character.sql} (100%) rename sql/updates/0.16/{9262_01_mangos_quest_template.sql => 09262_01_mangos_quest_template.sql} (100%) rename sql/updates/0.16/{9277_01_mangos_spell_bonus_data.sql => 09277_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9288_01_mangos_spell_bonus_data.sql => 09288_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9289_01_mangos_spell_proc_event.sql => 09289_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9291_01_mangos_quest_template.sql => 09291_01_mangos_quest_template.sql} (100%) rename sql/updates/0.16/{9291_02_mangos_locales_quest.sql => 09291_02_mangos_locales_quest.sql} (100%) rename sql/updates/0.16/{9296_01_mangos_spell_chain.sql => 09296_01_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9297_01_mangos_item_template.sql => 09297_01_mangos_item_template.sql} (100%) rename sql/updates/0.16/{9309_01_mangos_quest_template.sql => 09309_01_mangos_quest_template.sql} (100%) rename sql/updates/0.16/{9310_01_mangos_spell_elixir.sql => 09310_01_mangos_spell_elixir.sql} (100%) rename sql/updates/0.16/{9312_01_mangos_quest_template.sql => 09312_01_mangos_quest_template.sql} (100%) rename sql/updates/0.16/{9329_01_mangos_spell_chain.sql => 09329_01_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9331_01_mangos_quest_template.sql => 09331_01_mangos_quest_template.sql} (100%) rename sql/updates/0.16/{9339_01_characters_group.sql => 09339_01_characters_group.sql} (100%) rename sql/updates/0.16/{9349_01_characters_character_action.sql => 09349_01_characters_character_action.sql} (100%) rename sql/updates/0.16/{9354_01_characters_character_action.sql => 09354_01_characters_character_action.sql} (100%) rename sql/updates/0.16/{9359_01_characters_characters.sql => 09359_01_characters_characters.sql} (100%) rename sql/updates/0.16/{9366_01_mangos_spell_bonus_data.sql => 09366_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9366_02_mangos_spell_proc_event.sql => 09366_02_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9374_01_characters_character_glyphs.sql => 09374_01_characters_character_glyphs.sql} (100%) rename sql/updates/0.16/{9375_01_characters_character_glyphs.sql => 09375_01_characters_character_glyphs.sql} (100%) rename sql/updates/0.16/{9379_01_mangos_spell_proc_event.sql => 09379_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9380_01_mangos_command.sql => 09380_01_mangos_command.sql} (100%) rename sql/updates/0.16/{9382_01_mangos_command.sql => 09382_01_mangos_command.sql} (100%) rename sql/updates/0.16/{9385_01_mangos_command.sql => 09385_01_mangos_command.sql} (100%) rename sql/updates/0.16/{9450_01_mangos_spell_proc_event.sql => 09450_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9460_01_mangos_spell_bonus_data.sql => 09460_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9460_02_mangos_spell_chain.sql => 09460_02_mangos_spell_chain.sql} (100%) rename sql/updates/0.16/{9464_01_mangos_spell_proc_event.sql => 09464_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9466_01_mangos_mangos_string.sql => 09466_01_mangos_mangos_string.sql} (100%) rename sql/updates/0.16/{9477_01_mangos_spell_proc_event.sql => 09477_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9482_01_mangos_spell_proc_event.sql => 09482_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9509_01_mangos_item_template.sql => 09509_01_mangos_item_template.sql} (100%) rename sql/updates/0.16/{9512_01_mangos_spell_proc_event.sql => 09512_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9526_01_mangos_spell_proc_event.sql => 09526_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/0.16/{9528_01_mangos_spell_bonus_data.sql => 09528_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9539_01_mangos_spell_bonus_data.sql => 09539_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/0.16/{9589_01_mangos_creature_template.sql => 09589_01_mangos_creature_template.sql} (100%) rename sql/updates/0.16/{9590_01_mangos_db_script_string.sql => 09590_01_mangos_db_script_string.sql} (100%) rename sql/updates/0.16/{9611_01_characters.sql => 09611_01_characters.sql} (100%) rename sql/updates/0.16/{9622_01_mangos_gameobject.sql => 09622_01_mangos_gameobject.sql} (100%) rename sql/updates/0.16/{9630_01_characters_characters.sql => 09630_01_characters_characters.sql} (100%) rename sql/updates/0.16/{9632_01_characters_characters.sql => 09632_01_characters_characters.sql} (100%) rename sql/updates/0.16/{9634_01_characters_corpse.sql => 09634_01_characters_corpse.sql} (100%) rename sql/updates/0.16/{9635_01_characters_characters.sql => 09635_01_characters_characters.sql} (100%) rename sql/updates/0.16/{9636_01_mangos_item_template.sql => 09636_01_mangos_item_template.sql} (100%) rename sql/updates/0.16/{9646_01_characters_characters.sql => 09646_01_characters_characters.sql} (100%) rename sql/updates/0.16/{9651_01_mangos_quest_poi.sql => 09651_01_mangos_quest_poi.sql} (100%) rename sql/updates/0.16/{9656_01_mangos_command.sql => 09656_01_mangos_command.sql} (100%) rename sql/updates/0.16/{9656_02_mangos_mangos_string.sql => 09656_02_mangos_mangos_string.sql} (100%) rename sql/updates/0.16/{9661_01_characters_character_talent.sql => 09661_01_characters_character_talent.sql} (100%) rename sql/updates/0.16/{9663_01_mangos_mangos_string.sql => 09663_01_mangos_mangos_string.sql} (100%) rename sql/updates/0.16/{9680_01_characters_character_stats.sql => 09680_01_characters_character_stats.sql} (100%) rename sql/updates/0.16/{9686_01_characters_character_queststatus_weekly.sql => 09686_01_characters_character_queststatus_weekly.sql} (100%) rename sql/updates/0.16/{9687_01_characters_character_queststatus_daily.sql => 09687_01_characters_character_queststatus_daily.sql} (100%) rename sql/updates/0.16/{9690_01_mangos_spell_proc_event.sql => 09690_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9010_01_realmd_realmlist.sql => 09010_01_realmd_realmlist.sql} (100%) rename sql/updates/{9692_01_characters_mail.sql => 09692_01_characters_mail.sql} (100%) rename sql/updates/{9692_02_characters_mail.sql => 09692_02_characters_mail.sql} (100%) rename sql/updates/{9692_03_mangos_spell_proc_event.sql => 09692_03_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9702_01_characters_item.sql => 09702_01_characters_item.sql} (100%) rename sql/updates/{9704_01_mangos_achievement_reward.sql => 09704_01_mangos_achievement_reward.sql} (100%) rename sql/updates/{9710_01_mangos_command.sql => 09710_01_mangos_command.sql} (100%) rename sql/updates/{9716_01_mangos_npc_vendor.sql => 09716_01_mangos_npc_vendor.sql} (100%) rename sql/updates/{9716_02_mangos_mangos_string.sql => 09716_02_mangos_mangos_string.sql} (100%) rename sql/updates/{9720_01_mangos_spell_proc_event.sql => 09720_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9728_01_mangos_gossip_menu_option.sql => 09728_01_mangos_gossip_menu_option.sql} (100%) rename sql/updates/{9735_01_mangos_spell_proc_event.sql => 09735_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9735_02_mangos_spell_chain.sql => 09735_02_mangos_spell_chain.sql} (100%) rename sql/updates/{9746_01_realmd_realmlist.sql => 09746_01_realmd_realmlist.sql} (100%) rename sql/updates/{9747_01_mangos_battleground_template.sql => 09747_01_mangos_battleground_template.sql} (100%) rename sql/updates/{9748_01_realmd_realmlist.sql => 09748_01_realmd_realmlist.sql} (100%) rename sql/updates/{9751_01_characters.sql => 09751_01_characters.sql} (100%) rename sql/updates/{9752_01_mangos_gameobject_template.sql => 09752_01_mangos_gameobject_template.sql} (100%) rename sql/updates/{9753_01_mangos_instance_template.sql => 09753_01_mangos_instance_template.sql} (100%) rename sql/updates/{9755_01_mangos_instance_template.sql => 09755_01_mangos_instance_template.sql} (100%) rename sql/updates/{9761_01_mangos_mangos_string.sql => 09761_01_mangos_mangos_string.sql} (100%) rename sql/updates/{9763_01_mangos_battleground_template.sql => 09763_01_mangos_battleground_template.sql} (100%) rename sql/updates/{9766_01_mangos_spell_proc_event.sql => 09766_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9767_01_mangos_mangos_string.sql => 09767_01_mangos_mangos_string.sql} (100%) rename sql/updates/{9767_02_mangos_command.sql => 09767_02_mangos_command.sql} (100%) rename sql/updates/{9767_03_characters_characters.sql => 09767_03_characters_characters.sql} (100%) rename sql/updates/{9768_01_mangos_command.sql => 09768_01_mangos_command.sql} (100%) rename sql/updates/{9794_01_mangos_mangos_string.sql => 09794_01_mangos_mangos_string.sql} (100%) rename sql/updates/{9794_02_mangos_command.sql => 09794_02_mangos_command.sql} (100%) rename sql/updates/{9803_01_mangos_spell_bonus_data.sql => 09803_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/{9826_01_mangos_spell_script_target.sql => 09826_01_mangos_spell_script_target.sql} (100%) rename sql/updates/{9849_01_characters_saved_variables.sql => 09849_01_characters_saved_variables.sql} (100%) rename sql/updates/{9854_01_mangos_spell_bonus_data.sql => 09854_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/{9881_01_mangos_scripts.sql => 09881_01_mangos_scripts.sql} (100%) rename sql/updates/{9883_01_mangos_scripts.sql => 09883_01_mangos_scripts.sql} (100%) rename sql/updates/{9886_01_mangos_mangos_string.sql => 09886_01_mangos_mangos_string.sql} (100%) rename sql/updates/{9886_02_mangos_command.sql => 09886_02_mangos_command.sql} (100%) rename sql/updates/{9891_01_mangos_creature_movement.sql => 09891_01_mangos_creature_movement.sql} (100%) rename sql/updates/{9891_02_mangos_creature_movement_scripts.sql => 09891_02_mangos_creature_movement_scripts.sql} (100%) rename sql/updates/{9899_01_mangos_spell_bonus_data.sql => 09899_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/{9924_01_mangos_mangos_string.sql => 09924_01_mangos_mangos_string.sql} (100%) rename sql/updates/{9924_02_mangos_command.sql => 09924_02_mangos_command.sql} (100%) rename sql/updates/{9957_01_mangos_mangos_string.sql => 09957_01_mangos_mangos_string.sql} (100%) rename sql/updates/{9957_02_mangos_npc_vendor.sql => 09957_02_mangos_npc_vendor.sql} (100%) rename sql/updates/{9967_01_mangos_spell_proc_event.sql => 09967_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9974_01_characters_group.sql => 09974_01_characters_group.sql} (100%) rename sql/updates/{9977_01_mangos_spell_proc_event.sql => 09977_01_mangos_spell_proc_event.sql} (100%) rename sql/updates/{9978_01_mangos_spell_bonus_data.sql => 09978_01_mangos_spell_bonus_data.sql} (100%) rename sql/updates/{9988_01_mangos_spell_chain.sql => 09988_01_mangos_spell_chain.sql} (100%) rename sql/updates/{9990_01_mangos_spell_chain.sql => 09990_01_mangos_spell_chain.sql} (100%) diff --git a/sql/updates/0.16/9136_01_characters_account_data.sql b/sql/updates/0.16/09136_01_characters_account_data.sql similarity index 100% rename from sql/updates/0.16/9136_01_characters_account_data.sql rename to sql/updates/0.16/09136_01_characters_account_data.sql diff --git a/sql/updates/0.16/9136_02_mangos_quest_poi.sql b/sql/updates/0.16/09136_02_mangos_quest_poi.sql similarity index 100% rename from sql/updates/0.16/9136_02_mangos_quest_poi.sql rename to sql/updates/0.16/09136_02_mangos_quest_poi.sql diff --git a/sql/updates/0.16/9136_03_characters_character_ticket.sql b/sql/updates/0.16/09136_03_characters_character_ticket.sql similarity index 100% rename from sql/updates/0.16/9136_03_characters_character_ticket.sql rename to sql/updates/0.16/09136_03_characters_character_ticket.sql diff --git a/sql/updates/0.16/9136_04_mangos_spell_chain.sql b/sql/updates/0.16/09136_04_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9136_04_mangos_spell_chain.sql rename to sql/updates/0.16/09136_04_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9136_05_mangos_spell_bonus_data.sql b/sql/updates/0.16/09136_05_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9136_05_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09136_05_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9136_06_mangos_spell_proc_event.sql b/sql/updates/0.16/09136_06_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9136_06_mangos_spell_proc_event.sql rename to sql/updates/0.16/09136_06_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9136_07_characters_characters.sql b/sql/updates/0.16/09136_07_characters_characters.sql similarity index 100% rename from sql/updates/0.16/9136_07_characters_characters.sql rename to sql/updates/0.16/09136_07_characters_characters.sql diff --git a/sql/updates/0.16/9148_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09148_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9148_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09148_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9149_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09149_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9149_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09149_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9150_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09150_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9150_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09150_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9153_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09153_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9153_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09153_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9155_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09155_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9155_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09155_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9156_01_mangos_spell_chain.sql b/sql/updates/0.16/09156_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9156_01_mangos_spell_chain.sql rename to sql/updates/0.16/09156_01_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9156_02_mangos_spell_proc_event.sql b/sql/updates/0.16/09156_02_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9156_02_mangos_spell_proc_event.sql rename to sql/updates/0.16/09156_02_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9160_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09160_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9160_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09160_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9160_02_mangos_spell_chain.sql b/sql/updates/0.16/09160_02_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9160_02_mangos_spell_chain.sql rename to sql/updates/0.16/09160_02_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9198_01_mangos_mangos_string.sql b/sql/updates/0.16/09198_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/0.16/9198_01_mangos_mangos_string.sql rename to sql/updates/0.16/09198_01_mangos_mangos_string.sql diff --git a/sql/updates/0.16/9220_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09220_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9220_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09220_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9220_02_mangos_spell_chain.sql b/sql/updates/0.16/09220_02_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9220_02_mangos_spell_chain.sql rename to sql/updates/0.16/09220_02_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9222_01_mangos_playercreateinfo_spell.sql b/sql/updates/0.16/09222_01_mangos_playercreateinfo_spell.sql similarity index 100% rename from sql/updates/0.16/9222_01_mangos_playercreateinfo_spell.sql rename to sql/updates/0.16/09222_01_mangos_playercreateinfo_spell.sql diff --git a/sql/updates/0.16/9244_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09244_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9244_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09244_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9244_02_mangos_spell_chain.sql b/sql/updates/0.16/09244_02_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9244_02_mangos_spell_chain.sql rename to sql/updates/0.16/09244_02_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9246_01_characters_character.sql b/sql/updates/0.16/09246_01_characters_character.sql similarity index 100% rename from sql/updates/0.16/9246_01_characters_character.sql rename to sql/updates/0.16/09246_01_characters_character.sql diff --git a/sql/updates/0.16/9250_01_characters_character.sql b/sql/updates/0.16/09250_01_characters_character.sql similarity index 100% rename from sql/updates/0.16/9250_01_characters_character.sql rename to sql/updates/0.16/09250_01_characters_character.sql diff --git a/sql/updates/0.16/9262_01_mangos_quest_template.sql b/sql/updates/0.16/09262_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/0.16/9262_01_mangos_quest_template.sql rename to sql/updates/0.16/09262_01_mangos_quest_template.sql diff --git a/sql/updates/0.16/9277_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09277_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9277_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09277_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9288_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09288_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9288_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09288_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9289_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09289_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9289_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09289_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9291_01_mangos_quest_template.sql b/sql/updates/0.16/09291_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/0.16/9291_01_mangos_quest_template.sql rename to sql/updates/0.16/09291_01_mangos_quest_template.sql diff --git a/sql/updates/0.16/9291_02_mangos_locales_quest.sql b/sql/updates/0.16/09291_02_mangos_locales_quest.sql similarity index 100% rename from sql/updates/0.16/9291_02_mangos_locales_quest.sql rename to sql/updates/0.16/09291_02_mangos_locales_quest.sql diff --git a/sql/updates/0.16/9296_01_mangos_spell_chain.sql b/sql/updates/0.16/09296_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9296_01_mangos_spell_chain.sql rename to sql/updates/0.16/09296_01_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9297_01_mangos_item_template.sql b/sql/updates/0.16/09297_01_mangos_item_template.sql similarity index 100% rename from sql/updates/0.16/9297_01_mangos_item_template.sql rename to sql/updates/0.16/09297_01_mangos_item_template.sql diff --git a/sql/updates/0.16/9309_01_mangos_quest_template.sql b/sql/updates/0.16/09309_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/0.16/9309_01_mangos_quest_template.sql rename to sql/updates/0.16/09309_01_mangos_quest_template.sql diff --git a/sql/updates/0.16/9310_01_mangos_spell_elixir.sql b/sql/updates/0.16/09310_01_mangos_spell_elixir.sql similarity index 100% rename from sql/updates/0.16/9310_01_mangos_spell_elixir.sql rename to sql/updates/0.16/09310_01_mangos_spell_elixir.sql diff --git a/sql/updates/0.16/9312_01_mangos_quest_template.sql b/sql/updates/0.16/09312_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/0.16/9312_01_mangos_quest_template.sql rename to sql/updates/0.16/09312_01_mangos_quest_template.sql diff --git a/sql/updates/0.16/9329_01_mangos_spell_chain.sql b/sql/updates/0.16/09329_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9329_01_mangos_spell_chain.sql rename to sql/updates/0.16/09329_01_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9331_01_mangos_quest_template.sql b/sql/updates/0.16/09331_01_mangos_quest_template.sql similarity index 100% rename from sql/updates/0.16/9331_01_mangos_quest_template.sql rename to sql/updates/0.16/09331_01_mangos_quest_template.sql diff --git a/sql/updates/0.16/9339_01_characters_group.sql b/sql/updates/0.16/09339_01_characters_group.sql similarity index 100% rename from sql/updates/0.16/9339_01_characters_group.sql rename to sql/updates/0.16/09339_01_characters_group.sql diff --git a/sql/updates/0.16/9349_01_characters_character_action.sql b/sql/updates/0.16/09349_01_characters_character_action.sql similarity index 100% rename from sql/updates/0.16/9349_01_characters_character_action.sql rename to sql/updates/0.16/09349_01_characters_character_action.sql diff --git a/sql/updates/0.16/9354_01_characters_character_action.sql b/sql/updates/0.16/09354_01_characters_character_action.sql similarity index 100% rename from sql/updates/0.16/9354_01_characters_character_action.sql rename to sql/updates/0.16/09354_01_characters_character_action.sql diff --git a/sql/updates/0.16/9359_01_characters_characters.sql b/sql/updates/0.16/09359_01_characters_characters.sql similarity index 100% rename from sql/updates/0.16/9359_01_characters_characters.sql rename to sql/updates/0.16/09359_01_characters_characters.sql diff --git a/sql/updates/0.16/9366_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09366_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9366_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09366_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9366_02_mangos_spell_proc_event.sql b/sql/updates/0.16/09366_02_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9366_02_mangos_spell_proc_event.sql rename to sql/updates/0.16/09366_02_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9374_01_characters_character_glyphs.sql b/sql/updates/0.16/09374_01_characters_character_glyphs.sql similarity index 100% rename from sql/updates/0.16/9374_01_characters_character_glyphs.sql rename to sql/updates/0.16/09374_01_characters_character_glyphs.sql diff --git a/sql/updates/0.16/9375_01_characters_character_glyphs.sql b/sql/updates/0.16/09375_01_characters_character_glyphs.sql similarity index 100% rename from sql/updates/0.16/9375_01_characters_character_glyphs.sql rename to sql/updates/0.16/09375_01_characters_character_glyphs.sql diff --git a/sql/updates/0.16/9379_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09379_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9379_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09379_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9380_01_mangos_command.sql b/sql/updates/0.16/09380_01_mangos_command.sql similarity index 100% rename from sql/updates/0.16/9380_01_mangos_command.sql rename to sql/updates/0.16/09380_01_mangos_command.sql diff --git a/sql/updates/0.16/9382_01_mangos_command.sql b/sql/updates/0.16/09382_01_mangos_command.sql similarity index 100% rename from sql/updates/0.16/9382_01_mangos_command.sql rename to sql/updates/0.16/09382_01_mangos_command.sql diff --git a/sql/updates/0.16/9385_01_mangos_command.sql b/sql/updates/0.16/09385_01_mangos_command.sql similarity index 100% rename from sql/updates/0.16/9385_01_mangos_command.sql rename to sql/updates/0.16/09385_01_mangos_command.sql diff --git a/sql/updates/0.16/9450_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09450_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9450_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09450_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9460_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09460_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9460_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09460_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9460_02_mangos_spell_chain.sql b/sql/updates/0.16/09460_02_mangos_spell_chain.sql similarity index 100% rename from sql/updates/0.16/9460_02_mangos_spell_chain.sql rename to sql/updates/0.16/09460_02_mangos_spell_chain.sql diff --git a/sql/updates/0.16/9464_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09464_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9464_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09464_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9466_01_mangos_mangos_string.sql b/sql/updates/0.16/09466_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/0.16/9466_01_mangos_mangos_string.sql rename to sql/updates/0.16/09466_01_mangos_mangos_string.sql diff --git a/sql/updates/0.16/9477_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09477_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9477_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09477_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9482_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09482_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9482_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09482_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9509_01_mangos_item_template.sql b/sql/updates/0.16/09509_01_mangos_item_template.sql similarity index 100% rename from sql/updates/0.16/9509_01_mangos_item_template.sql rename to sql/updates/0.16/09509_01_mangos_item_template.sql diff --git a/sql/updates/0.16/9512_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09512_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9512_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09512_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9526_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09526_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9526_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09526_01_mangos_spell_proc_event.sql diff --git a/sql/updates/0.16/9528_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09528_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9528_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09528_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9539_01_mangos_spell_bonus_data.sql b/sql/updates/0.16/09539_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/0.16/9539_01_mangos_spell_bonus_data.sql rename to sql/updates/0.16/09539_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/0.16/9589_01_mangos_creature_template.sql b/sql/updates/0.16/09589_01_mangos_creature_template.sql similarity index 100% rename from sql/updates/0.16/9589_01_mangos_creature_template.sql rename to sql/updates/0.16/09589_01_mangos_creature_template.sql diff --git a/sql/updates/0.16/9590_01_mangos_db_script_string.sql b/sql/updates/0.16/09590_01_mangos_db_script_string.sql similarity index 100% rename from sql/updates/0.16/9590_01_mangos_db_script_string.sql rename to sql/updates/0.16/09590_01_mangos_db_script_string.sql diff --git a/sql/updates/0.16/9611_01_characters.sql b/sql/updates/0.16/09611_01_characters.sql similarity index 100% rename from sql/updates/0.16/9611_01_characters.sql rename to sql/updates/0.16/09611_01_characters.sql diff --git a/sql/updates/0.16/9622_01_mangos_gameobject.sql b/sql/updates/0.16/09622_01_mangos_gameobject.sql similarity index 100% rename from sql/updates/0.16/9622_01_mangos_gameobject.sql rename to sql/updates/0.16/09622_01_mangos_gameobject.sql diff --git a/sql/updates/0.16/9630_01_characters_characters.sql b/sql/updates/0.16/09630_01_characters_characters.sql similarity index 100% rename from sql/updates/0.16/9630_01_characters_characters.sql rename to sql/updates/0.16/09630_01_characters_characters.sql diff --git a/sql/updates/0.16/9632_01_characters_characters.sql b/sql/updates/0.16/09632_01_characters_characters.sql similarity index 100% rename from sql/updates/0.16/9632_01_characters_characters.sql rename to sql/updates/0.16/09632_01_characters_characters.sql diff --git a/sql/updates/0.16/9634_01_characters_corpse.sql b/sql/updates/0.16/09634_01_characters_corpse.sql similarity index 100% rename from sql/updates/0.16/9634_01_characters_corpse.sql rename to sql/updates/0.16/09634_01_characters_corpse.sql diff --git a/sql/updates/0.16/9635_01_characters_characters.sql b/sql/updates/0.16/09635_01_characters_characters.sql similarity index 100% rename from sql/updates/0.16/9635_01_characters_characters.sql rename to sql/updates/0.16/09635_01_characters_characters.sql diff --git a/sql/updates/0.16/9636_01_mangos_item_template.sql b/sql/updates/0.16/09636_01_mangos_item_template.sql similarity index 100% rename from sql/updates/0.16/9636_01_mangos_item_template.sql rename to sql/updates/0.16/09636_01_mangos_item_template.sql diff --git a/sql/updates/0.16/9646_01_characters_characters.sql b/sql/updates/0.16/09646_01_characters_characters.sql similarity index 100% rename from sql/updates/0.16/9646_01_characters_characters.sql rename to sql/updates/0.16/09646_01_characters_characters.sql diff --git a/sql/updates/0.16/9651_01_mangos_quest_poi.sql b/sql/updates/0.16/09651_01_mangos_quest_poi.sql similarity index 100% rename from sql/updates/0.16/9651_01_mangos_quest_poi.sql rename to sql/updates/0.16/09651_01_mangos_quest_poi.sql diff --git a/sql/updates/0.16/9656_01_mangos_command.sql b/sql/updates/0.16/09656_01_mangos_command.sql similarity index 100% rename from sql/updates/0.16/9656_01_mangos_command.sql rename to sql/updates/0.16/09656_01_mangos_command.sql diff --git a/sql/updates/0.16/9656_02_mangos_mangos_string.sql b/sql/updates/0.16/09656_02_mangos_mangos_string.sql similarity index 100% rename from sql/updates/0.16/9656_02_mangos_mangos_string.sql rename to sql/updates/0.16/09656_02_mangos_mangos_string.sql diff --git a/sql/updates/0.16/9661_01_characters_character_talent.sql b/sql/updates/0.16/09661_01_characters_character_talent.sql similarity index 100% rename from sql/updates/0.16/9661_01_characters_character_talent.sql rename to sql/updates/0.16/09661_01_characters_character_talent.sql diff --git a/sql/updates/0.16/9663_01_mangos_mangos_string.sql b/sql/updates/0.16/09663_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/0.16/9663_01_mangos_mangos_string.sql rename to sql/updates/0.16/09663_01_mangos_mangos_string.sql diff --git a/sql/updates/0.16/9680_01_characters_character_stats.sql b/sql/updates/0.16/09680_01_characters_character_stats.sql similarity index 100% rename from sql/updates/0.16/9680_01_characters_character_stats.sql rename to sql/updates/0.16/09680_01_characters_character_stats.sql diff --git a/sql/updates/0.16/9686_01_characters_character_queststatus_weekly.sql b/sql/updates/0.16/09686_01_characters_character_queststatus_weekly.sql similarity index 100% rename from sql/updates/0.16/9686_01_characters_character_queststatus_weekly.sql rename to sql/updates/0.16/09686_01_characters_character_queststatus_weekly.sql diff --git a/sql/updates/0.16/9687_01_characters_character_queststatus_daily.sql b/sql/updates/0.16/09687_01_characters_character_queststatus_daily.sql similarity index 100% rename from sql/updates/0.16/9687_01_characters_character_queststatus_daily.sql rename to sql/updates/0.16/09687_01_characters_character_queststatus_daily.sql diff --git a/sql/updates/0.16/9690_01_mangos_spell_proc_event.sql b/sql/updates/0.16/09690_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/0.16/9690_01_mangos_spell_proc_event.sql rename to sql/updates/0.16/09690_01_mangos_spell_proc_event.sql diff --git a/sql/updates/9010_01_realmd_realmlist.sql b/sql/updates/09010_01_realmd_realmlist.sql similarity index 100% rename from sql/updates/9010_01_realmd_realmlist.sql rename to sql/updates/09010_01_realmd_realmlist.sql diff --git a/sql/updates/9692_01_characters_mail.sql b/sql/updates/09692_01_characters_mail.sql similarity index 100% rename from sql/updates/9692_01_characters_mail.sql rename to sql/updates/09692_01_characters_mail.sql diff --git a/sql/updates/9692_02_characters_mail.sql b/sql/updates/09692_02_characters_mail.sql similarity index 100% rename from sql/updates/9692_02_characters_mail.sql rename to sql/updates/09692_02_characters_mail.sql diff --git a/sql/updates/9692_03_mangos_spell_proc_event.sql b/sql/updates/09692_03_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/9692_03_mangos_spell_proc_event.sql rename to sql/updates/09692_03_mangos_spell_proc_event.sql diff --git a/sql/updates/9702_01_characters_item.sql b/sql/updates/09702_01_characters_item.sql similarity index 100% rename from sql/updates/9702_01_characters_item.sql rename to sql/updates/09702_01_characters_item.sql diff --git a/sql/updates/9704_01_mangos_achievement_reward.sql b/sql/updates/09704_01_mangos_achievement_reward.sql similarity index 100% rename from sql/updates/9704_01_mangos_achievement_reward.sql rename to sql/updates/09704_01_mangos_achievement_reward.sql diff --git a/sql/updates/9710_01_mangos_command.sql b/sql/updates/09710_01_mangos_command.sql similarity index 100% rename from sql/updates/9710_01_mangos_command.sql rename to sql/updates/09710_01_mangos_command.sql diff --git a/sql/updates/9716_01_mangos_npc_vendor.sql b/sql/updates/09716_01_mangos_npc_vendor.sql similarity index 100% rename from sql/updates/9716_01_mangos_npc_vendor.sql rename to sql/updates/09716_01_mangos_npc_vendor.sql diff --git a/sql/updates/9716_02_mangos_mangos_string.sql b/sql/updates/09716_02_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9716_02_mangos_mangos_string.sql rename to sql/updates/09716_02_mangos_mangos_string.sql diff --git a/sql/updates/9720_01_mangos_spell_proc_event.sql b/sql/updates/09720_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/9720_01_mangos_spell_proc_event.sql rename to sql/updates/09720_01_mangos_spell_proc_event.sql diff --git a/sql/updates/9728_01_mangos_gossip_menu_option.sql b/sql/updates/09728_01_mangos_gossip_menu_option.sql similarity index 100% rename from sql/updates/9728_01_mangos_gossip_menu_option.sql rename to sql/updates/09728_01_mangos_gossip_menu_option.sql diff --git a/sql/updates/9735_01_mangos_spell_proc_event.sql b/sql/updates/09735_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/9735_01_mangos_spell_proc_event.sql rename to sql/updates/09735_01_mangos_spell_proc_event.sql diff --git a/sql/updates/9735_02_mangos_spell_chain.sql b/sql/updates/09735_02_mangos_spell_chain.sql similarity index 100% rename from sql/updates/9735_02_mangos_spell_chain.sql rename to sql/updates/09735_02_mangos_spell_chain.sql diff --git a/sql/updates/9746_01_realmd_realmlist.sql b/sql/updates/09746_01_realmd_realmlist.sql similarity index 100% rename from sql/updates/9746_01_realmd_realmlist.sql rename to sql/updates/09746_01_realmd_realmlist.sql diff --git a/sql/updates/9747_01_mangos_battleground_template.sql b/sql/updates/09747_01_mangos_battleground_template.sql similarity index 100% rename from sql/updates/9747_01_mangos_battleground_template.sql rename to sql/updates/09747_01_mangos_battleground_template.sql diff --git a/sql/updates/9748_01_realmd_realmlist.sql b/sql/updates/09748_01_realmd_realmlist.sql similarity index 100% rename from sql/updates/9748_01_realmd_realmlist.sql rename to sql/updates/09748_01_realmd_realmlist.sql diff --git a/sql/updates/9751_01_characters.sql b/sql/updates/09751_01_characters.sql similarity index 100% rename from sql/updates/9751_01_characters.sql rename to sql/updates/09751_01_characters.sql diff --git a/sql/updates/9752_01_mangos_gameobject_template.sql b/sql/updates/09752_01_mangos_gameobject_template.sql similarity index 100% rename from sql/updates/9752_01_mangos_gameobject_template.sql rename to sql/updates/09752_01_mangos_gameobject_template.sql diff --git a/sql/updates/9753_01_mangos_instance_template.sql b/sql/updates/09753_01_mangos_instance_template.sql similarity index 100% rename from sql/updates/9753_01_mangos_instance_template.sql rename to sql/updates/09753_01_mangos_instance_template.sql diff --git a/sql/updates/9755_01_mangos_instance_template.sql b/sql/updates/09755_01_mangos_instance_template.sql similarity index 100% rename from sql/updates/9755_01_mangos_instance_template.sql rename to sql/updates/09755_01_mangos_instance_template.sql diff --git a/sql/updates/9761_01_mangos_mangos_string.sql b/sql/updates/09761_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9761_01_mangos_mangos_string.sql rename to sql/updates/09761_01_mangos_mangos_string.sql diff --git a/sql/updates/9763_01_mangos_battleground_template.sql b/sql/updates/09763_01_mangos_battleground_template.sql similarity index 100% rename from sql/updates/9763_01_mangos_battleground_template.sql rename to sql/updates/09763_01_mangos_battleground_template.sql diff --git a/sql/updates/9766_01_mangos_spell_proc_event.sql b/sql/updates/09766_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/9766_01_mangos_spell_proc_event.sql rename to sql/updates/09766_01_mangos_spell_proc_event.sql diff --git a/sql/updates/9767_01_mangos_mangos_string.sql b/sql/updates/09767_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9767_01_mangos_mangos_string.sql rename to sql/updates/09767_01_mangos_mangos_string.sql diff --git a/sql/updates/9767_02_mangos_command.sql b/sql/updates/09767_02_mangos_command.sql similarity index 100% rename from sql/updates/9767_02_mangos_command.sql rename to sql/updates/09767_02_mangos_command.sql diff --git a/sql/updates/9767_03_characters_characters.sql b/sql/updates/09767_03_characters_characters.sql similarity index 100% rename from sql/updates/9767_03_characters_characters.sql rename to sql/updates/09767_03_characters_characters.sql diff --git a/sql/updates/9768_01_mangos_command.sql b/sql/updates/09768_01_mangos_command.sql similarity index 100% rename from sql/updates/9768_01_mangos_command.sql rename to sql/updates/09768_01_mangos_command.sql diff --git a/sql/updates/9794_01_mangos_mangos_string.sql b/sql/updates/09794_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9794_01_mangos_mangos_string.sql rename to sql/updates/09794_01_mangos_mangos_string.sql diff --git a/sql/updates/9794_02_mangos_command.sql b/sql/updates/09794_02_mangos_command.sql similarity index 100% rename from sql/updates/9794_02_mangos_command.sql rename to sql/updates/09794_02_mangos_command.sql diff --git a/sql/updates/9803_01_mangos_spell_bonus_data.sql b/sql/updates/09803_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/9803_01_mangos_spell_bonus_data.sql rename to sql/updates/09803_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/9826_01_mangos_spell_script_target.sql b/sql/updates/09826_01_mangos_spell_script_target.sql similarity index 100% rename from sql/updates/9826_01_mangos_spell_script_target.sql rename to sql/updates/09826_01_mangos_spell_script_target.sql diff --git a/sql/updates/9849_01_characters_saved_variables.sql b/sql/updates/09849_01_characters_saved_variables.sql similarity index 100% rename from sql/updates/9849_01_characters_saved_variables.sql rename to sql/updates/09849_01_characters_saved_variables.sql diff --git a/sql/updates/9854_01_mangos_spell_bonus_data.sql b/sql/updates/09854_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/9854_01_mangos_spell_bonus_data.sql rename to sql/updates/09854_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/9881_01_mangos_scripts.sql b/sql/updates/09881_01_mangos_scripts.sql similarity index 100% rename from sql/updates/9881_01_mangos_scripts.sql rename to sql/updates/09881_01_mangos_scripts.sql diff --git a/sql/updates/9883_01_mangos_scripts.sql b/sql/updates/09883_01_mangos_scripts.sql similarity index 100% rename from sql/updates/9883_01_mangos_scripts.sql rename to sql/updates/09883_01_mangos_scripts.sql diff --git a/sql/updates/9886_01_mangos_mangos_string.sql b/sql/updates/09886_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9886_01_mangos_mangos_string.sql rename to sql/updates/09886_01_mangos_mangos_string.sql diff --git a/sql/updates/9886_02_mangos_command.sql b/sql/updates/09886_02_mangos_command.sql similarity index 100% rename from sql/updates/9886_02_mangos_command.sql rename to sql/updates/09886_02_mangos_command.sql diff --git a/sql/updates/9891_01_mangos_creature_movement.sql b/sql/updates/09891_01_mangos_creature_movement.sql similarity index 100% rename from sql/updates/9891_01_mangos_creature_movement.sql rename to sql/updates/09891_01_mangos_creature_movement.sql diff --git a/sql/updates/9891_02_mangos_creature_movement_scripts.sql b/sql/updates/09891_02_mangos_creature_movement_scripts.sql similarity index 100% rename from sql/updates/9891_02_mangos_creature_movement_scripts.sql rename to sql/updates/09891_02_mangos_creature_movement_scripts.sql diff --git a/sql/updates/9899_01_mangos_spell_bonus_data.sql b/sql/updates/09899_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/9899_01_mangos_spell_bonus_data.sql rename to sql/updates/09899_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/9924_01_mangos_mangos_string.sql b/sql/updates/09924_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9924_01_mangos_mangos_string.sql rename to sql/updates/09924_01_mangos_mangos_string.sql diff --git a/sql/updates/9924_02_mangos_command.sql b/sql/updates/09924_02_mangos_command.sql similarity index 100% rename from sql/updates/9924_02_mangos_command.sql rename to sql/updates/09924_02_mangos_command.sql diff --git a/sql/updates/9957_01_mangos_mangos_string.sql b/sql/updates/09957_01_mangos_mangos_string.sql similarity index 100% rename from sql/updates/9957_01_mangos_mangos_string.sql rename to sql/updates/09957_01_mangos_mangos_string.sql diff --git a/sql/updates/9957_02_mangos_npc_vendor.sql b/sql/updates/09957_02_mangos_npc_vendor.sql similarity index 100% rename from sql/updates/9957_02_mangos_npc_vendor.sql rename to sql/updates/09957_02_mangos_npc_vendor.sql diff --git a/sql/updates/9967_01_mangos_spell_proc_event.sql b/sql/updates/09967_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/9967_01_mangos_spell_proc_event.sql rename to sql/updates/09967_01_mangos_spell_proc_event.sql diff --git a/sql/updates/9974_01_characters_group.sql b/sql/updates/09974_01_characters_group.sql similarity index 100% rename from sql/updates/9974_01_characters_group.sql rename to sql/updates/09974_01_characters_group.sql diff --git a/sql/updates/9977_01_mangos_spell_proc_event.sql b/sql/updates/09977_01_mangos_spell_proc_event.sql similarity index 100% rename from sql/updates/9977_01_mangos_spell_proc_event.sql rename to sql/updates/09977_01_mangos_spell_proc_event.sql diff --git a/sql/updates/9978_01_mangos_spell_bonus_data.sql b/sql/updates/09978_01_mangos_spell_bonus_data.sql similarity index 100% rename from sql/updates/9978_01_mangos_spell_bonus_data.sql rename to sql/updates/09978_01_mangos_spell_bonus_data.sql diff --git a/sql/updates/9988_01_mangos_spell_chain.sql b/sql/updates/09988_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/9988_01_mangos_spell_chain.sql rename to sql/updates/09988_01_mangos_spell_chain.sql diff --git a/sql/updates/9990_01_mangos_spell_chain.sql b/sql/updates/09990_01_mangos_spell_chain.sql similarity index 100% rename from sql/updates/9990_01_mangos_spell_chain.sql rename to sql/updates/09990_01_mangos_spell_chain.sql diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 93ad08339..46bdc4173 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10000" + #define REVISION_NR "10001" #endif // __REVISION_NR_H__ From 1997cf2769a39faef0c986137d0920caf6833d1a Mon Sep 17 00:00:00 2001 From: patman128 Date: Sat, 29 May 2010 04:43:12 +0400 Subject: [PATCH 130/172] [10002] Fixed map loading .map build checks. Bug exist long time before recent code moves. But it not affect in cases proper .map files. Signed-off-by: VladimirMangos --- src/game/GridMap.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/GridMap.cpp b/src/game/GridMap.cpp index ce6e459e4..4df4083b6 100644 --- a/src/game/GridMap.cpp +++ b/src/game/GridMap.cpp @@ -77,8 +77,8 @@ bool GridMap::loadData(char *filename) fread(&header, sizeof(header),1,in); if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) && - header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)) || - !IsAcceptableClientBuild(header.buildMagic)) + header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)) && + IsAcceptableClientBuild(header.buildMagic)) { // loadup area data if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 46bdc4173..5813fb483 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10001" + #define REVISION_NR "10002" #endif // __REVISION_NR_H__ From 8988f0f609436436446558b3634dcdc5a7a00b14 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 29 May 2010 05:56:49 +0400 Subject: [PATCH 131/172] [10003] Fixed unix* install. I forgot update sql updatenames in Makefile.am after its rename. --- sql/updates/Makefile.am | 200 +++++++++++++++++++-------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 101 insertions(+), 101 deletions(-) diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 3c7da0495..be20abbcf 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -25,109 +25,109 @@ pkgdatadir = $(datadir)/mangos/sql/updates ## Files to be installed # Install basic SQL files to datadir pkgdata_DATA = \ - 9010_01_realmd_realmlist.sql \ - 9692_01_characters_mail.sql \ - 9692_02_characters_mail.sql \ - 9692_03_mangos_spell_proc_event.sql \ - 9702_01_characters_item.sql \ - 9704_01_mangos_achievement_reward.sql \ - 9710_01_mangos_command.sql \ - 9716_01_mangos_npc_vendor.sql \ - 9716_02_mangos_mangos_string.sql \ - 9720_01_mangos_spell_proc_event.sql \ - 9728_01_mangos_gossip_menu_option.sql \ - 9735_01_mangos_spell_proc_event.sql \ - 9735_02_mangos_spell_chain.sql \ - 9746_01_realmd_realmlist.sql \ - 9747_01_mangos_battleground_template.sql \ - 9748_01_realmd_realmlist.sql \ - 9751_01_characters.sql \ - 9752_01_mangos_gameobject_template.sql \ - 9753_01_mangos_instance_template.sql \ - 9755_01_mangos_instance_template.sql \ - 9761_01_mangos_mangos_string.sql \ - 9763_01_mangos_battleground_template.sql \ - 9766_01_mangos_spell_proc_event.sql \ - 9767_01_mangos_mangos_string.sql \ - 9767_02_mangos_command.sql \ - 9767_03_characters_characters.sql \ - 9768_01_mangos_command.sql \ - 9794_01_mangos_mangos_string.sql \ - 9794_02_mangos_command.sql \ - 9803_01_mangos_spell_bonus_data.sql \ - 9826_01_mangos_spell_script_target.sql \ - 9849_01_characters_saved_variables.sql \ - 9854_01_mangos_spell_bonus_data.sql \ - 9881_01_mangos_scripts.sql \ - 9883_01_mangos_scripts.sql \ - 9886_01_mangos_mangos_string.sql \ - 9886_02_mangos_command.sql \ - 9891_01_mangos_creature_movement.sql \ - 9891_02_mangos_creature_movement_scripts.sql \ - 9899_01_mangos_spell_bonus_data.sql \ - 9924_01_mangos_mangos_string.sql \ - 9924_02_mangos_command.sql \ - 9957_01_mangos_mangos_string.sql \ - 9957_02_mangos_npc_vendor.sql \ - 9967_01_mangos_spell_proc_event.sql \ - 9974_01_characters_group.sql \ - 9977_01_mangos_spell_proc_event.sql \ - 9978_01_mangos_spell_bonus_data.sql \ - 9988_01_mangos_spell_chain.sql \ - 9990_01_mangos_spell_chain.sql \ + 09010_01_realmd_realmlist.sql \ + 09692_01_characters_mail.sql \ + 09692_02_characters_mail.sql \ + 09692_03_mangos_spell_proc_event.sql \ + 09702_01_characters_item.sql \ + 09704_01_mangos_achievement_reward.sql \ + 09710_01_mangos_command.sql \ + 09716_01_mangos_npc_vendor.sql \ + 09716_02_mangos_mangos_string.sql \ + 09720_01_mangos_spell_proc_event.sql \ + 09728_01_mangos_gossip_menu_option.sql \ + 09735_01_mangos_spell_proc_event.sql \ + 09735_02_mangos_spell_chain.sql \ + 09746_01_realmd_realmlist.sql \ + 09747_01_mangos_battleground_template.sql \ + 09748_01_realmd_realmlist.sql \ + 09751_01_characters.sql \ + 09752_01_mangos_gameobject_template.sql \ + 09753_01_mangos_instance_template.sql \ + 09755_01_mangos_instance_template.sql \ + 09761_01_mangos_mangos_string.sql \ + 09763_01_mangos_battleground_template.sql \ + 09766_01_mangos_spell_proc_event.sql \ + 09767_01_mangos_mangos_string.sql \ + 09767_02_mangos_command.sql \ + 09767_03_characters_characters.sql \ + 09768_01_mangos_command.sql \ + 09794_01_mangos_mangos_string.sql \ + 09794_02_mangos_command.sql \ + 09803_01_mangos_spell_bonus_data.sql \ + 09826_01_mangos_spell_script_target.sql \ + 09849_01_characters_saved_variables.sql \ + 09854_01_mangos_spell_bonus_data.sql \ + 09881_01_mangos_scripts.sql \ + 09883_01_mangos_scripts.sql \ + 09886_01_mangos_mangos_string.sql \ + 09886_02_mangos_command.sql \ + 09891_01_mangos_creature_movement.sql \ + 09891_02_mangos_creature_movement_scripts.sql \ + 09899_01_mangos_spell_bonus_data.sql \ + 09924_01_mangos_mangos_string.sql \ + 09924_02_mangos_command.sql \ + 09957_01_mangos_mangos_string.sql \ + 09957_02_mangos_npc_vendor.sql \ + 09967_01_mangos_spell_proc_event.sql \ + 09974_01_characters_group.sql \ + 09977_01_mangos_spell_proc_event.sql \ + 09978_01_mangos_spell_bonus_data.sql \ + 09988_01_mangos_spell_chain.sql \ + 09990_01_mangos_spell_chain.sql \ README ## Additional files to include when running 'make dist' # SQL update files, to upgrade database schema from older revisions EXTRA_DIST = \ - 9010_01_realmd_realmlist.sql \ - 9692_01_characters_mail.sql \ - 9692_02_characters_mail.sql \ - 9692_03_mangos_spell_proc_event.sql \ - 9702_01_characters_item.sql \ - 9704_01_mangos_achievement_reward.sql \ - 9710_01_mangos_command.sql \ - 9716_01_mangos_npc_vendor.sql \ - 9716_02_mangos_mangos_string.sql \ - 9720_01_mangos_spell_proc_event.sql \ - 9728_01_mangos_gossip_menu_option.sql \ - 9735_01_mangos_spell_proc_event.sql \ - 9735_02_mangos_spell_chain.sql \ - 9746_01_realmd_realmlist.sql \ - 9747_01_mangos_battleground_template.sql \ - 9748_01_realmd_realmlist.sql \ - 9751_01_characters.sql \ - 9752_01_mangos_gameobject_template.sql \ - 9753_01_mangos_instance_template.sql \ - 9755_01_mangos_instance_template.sql \ - 9761_01_mangos_mangos_string.sql \ - 9763_01_mangos_battleground_template.sql \ - 9766_01_mangos_spell_proc_event.sql \ - 9767_01_mangos_mangos_string.sql \ - 9767_02_mangos_command.sql \ - 9767_03_characters_characters.sql \ - 9768_01_mangos_command.sql \ - 9794_01_mangos_mangos_string.sql \ - 9794_02_mangos_command.sql \ - 9803_01_mangos_spell_bonus_data.sql \ - 9826_01_mangos_spell_script_target.sql \ - 9849_01_characters_saved_variables.sql \ - 9854_01_mangos_spell_bonus_data.sql \ - 9881_01_mangos_scripts.sql \ - 9883_01_mangos_scripts.sql \ - 9886_01_mangos_mangos_string.sql \ - 9886_02_mangos_command.sql \ - 9891_01_mangos_creature_movement.sql \ - 9891_02_mangos_creature_movement_scripts.sql \ - 9899_01_mangos_spell_bonus_data.sql \ - 9924_01_mangos_mangos_string.sql \ - 9924_02_mangos_command.sql \ - 9957_01_mangos_mangos_string.sql \ - 9957_02_mangos_npc_vendor.sql \ - 9967_01_mangos_spell_proc_event.sql \ - 9974_01_characters_group.sql \ - 9977_01_mangos_spell_proc_event.sql \ - 9978_01_mangos_spell_bonus_data.sql \ - 9988_01_mangos_spell_chain.sql \ - 9990_01_mangos_spell_chain.sql \ + 09010_01_realmd_realmlist.sql \ + 09692_01_characters_mail.sql \ + 09692_02_characters_mail.sql \ + 09692_03_mangos_spell_proc_event.sql \ + 09702_01_characters_item.sql \ + 09704_01_mangos_achievement_reward.sql \ + 09710_01_mangos_command.sql \ + 09716_01_mangos_npc_vendor.sql \ + 09716_02_mangos_mangos_string.sql \ + 09720_01_mangos_spell_proc_event.sql \ + 09728_01_mangos_gossip_menu_option.sql \ + 09735_01_mangos_spell_proc_event.sql \ + 09735_02_mangos_spell_chain.sql \ + 09746_01_realmd_realmlist.sql \ + 09747_01_mangos_battleground_template.sql \ + 09748_01_realmd_realmlist.sql \ + 09751_01_characters.sql \ + 09752_01_mangos_gameobject_template.sql \ + 09753_01_mangos_instance_template.sql \ + 09755_01_mangos_instance_template.sql \ + 09761_01_mangos_mangos_string.sql \ + 09763_01_mangos_battleground_template.sql \ + 09766_01_mangos_spell_proc_event.sql \ + 09767_01_mangos_mangos_string.sql \ + 09767_02_mangos_command.sql \ + 09767_03_characters_characters.sql \ + 09768_01_mangos_command.sql \ + 09794_01_mangos_mangos_string.sql \ + 09794_02_mangos_command.sql \ + 09803_01_mangos_spell_bonus_data.sql \ + 09826_01_mangos_spell_script_target.sql \ + 09849_01_characters_saved_variables.sql \ + 09854_01_mangos_spell_bonus_data.sql \ + 09881_01_mangos_scripts.sql \ + 09883_01_mangos_scripts.sql \ + 09886_01_mangos_mangos_string.sql \ + 09886_02_mangos_command.sql \ + 09891_01_mangos_creature_movement.sql \ + 09891_02_mangos_creature_movement_scripts.sql \ + 09899_01_mangos_spell_bonus_data.sql \ + 09924_01_mangos_mangos_string.sql \ + 09924_02_mangos_command.sql \ + 09957_01_mangos_mangos_string.sql \ + 09957_02_mangos_npc_vendor.sql \ + 09967_01_mangos_spell_proc_event.sql \ + 09974_01_characters_group.sql \ + 09977_01_mangos_spell_proc_event.sql \ + 09978_01_mangos_spell_bonus_data.sql \ + 09988_01_mangos_spell_chain.sql \ + 09990_01_mangos_spell_chain.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5813fb483..5a5dc6c42 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10002" + #define REVISION_NR "10003" #endif // __REVISION_NR_H__ From 716afa0e4b60b09dbadec575b41893312ed78cff Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 29 May 2010 15:50:30 +0200 Subject: [PATCH 132/172] [10004] Add script effect of spell 43365, 50217, 50218 and 50238. Signed-off-by: NoFantasy --- src/game/SpellEffects.cpp | 63 +++++++++++++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 324436441..5ad1104d1 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5557,6 +5557,15 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) unitTarget->CastSpell(unitTarget, 41131, true); break; } + case 43365: // The Cleansing: Shrine Cast + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + // Script Effect Player Cast Mirror Image + m_caster->CastSpell(m_caster, 50217, true); + return; + } case 44455: // Character Script Effect Reverse Cast { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) @@ -5753,6 +5762,60 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // Torture the Torturer: High Executor's Branding Iron Impact unitTarget->CastSpell(unitTarget, 48614, true); return; + case 50217: // The Cleansing: Script Effect Player Cast Mirror Image + { + // Summon Your Inner Turmoil + m_caster->CastSpell(m_caster, 50167, true); + + // Spell 50218 has TARGET_SCRIPT, but other wild summons near may exist, and then target can become wrong + // Only way to make this safe is to get the actual summoned by m_caster + + // Your Inner Turmoil's Mirror Image Aura + m_caster->CastSpell(m_caster, 50218, true); + + return; + } + case 50218: // The Cleansing: Your Inner Turmoil's Mirror Image Aura + { + if (!m_originalCaster || m_originalCaster->GetTypeId() != TYPEID_PLAYER || !unitTarget) + return; + + // determine if and what weapons can be copied + switch(eff_idx) + { + case EFFECT_INDEX_1: + if (((Player*)m_originalCaster)->GetWeaponForAttack(BASE_ATTACK)) + unitTarget->CastSpell(m_originalCaster, m_spellInfo->CalculateSimpleValue(eff_idx), true); + + return; + case EFFECT_INDEX_2: + if (((Player*)m_originalCaster)->GetWeaponForAttack(OFF_ATTACK)) + unitTarget->CastSpell(m_originalCaster, m_spellInfo->CalculateSimpleValue(eff_idx), true); + + return; + default: + return; + } + return; + } + case 50238: // The Cleansing: Your Inner Turmoil's On Death Cast on Master + { + if (m_caster->GetTypeId() != TYPEID_UNIT) + return; + + if (((Creature*)m_caster)->isTemporarySummon()) + { + TemporarySummon* pSummon = (TemporarySummon*)m_caster; + + if (pSummon->GetSummonerGuid().IsPlayer()) + { + if (Player* pSummoner = sObjectMgr.GetPlayer(pSummon->GetSummonerGuid())) + pSummoner->CastSpell(pSummoner, m_spellInfo->CalculateSimpleValue(eff_idx), true); + } + } + + return; + } case 51770: // Emblazon Runeblade { Unit* caster = GetAffectiveCaster(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5a5dc6c42..93795537c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10003" + #define REVISION_NR "10004" #endif // __REVISION_NR_H__ From e0ccfef7efa45f35678fedb40ccb01bd868c29e4 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 29 May 2010 15:55:25 +0200 Subject: [PATCH 133/172] [10005] Add script effect of spell 41055 and 45206. Signed-off-by: NoFantasy --- src/game/SpellEffects.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 5ad1104d1..109e9b3b6 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5549,6 +5549,24 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) unitTarget->RemoveAurasAtMechanicImmunity(IMMUNE_TO_ROOT_AND_SNARE_MASK,30918,true); break; } + case 41055: // Copy Weapon + { + if (m_caster->GetTypeId() != TYPEID_UNIT || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + return; + + if (Item* pItem = ((Player*)unitTarget)->GetWeaponForAttack(BASE_ATTACK)) + { + if (const ItemEntry *dbcitem = sItemStore.LookupEntry(pItem->GetProto()->ItemId)) + { + m_caster->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, dbcitem->ID); + + // Unclear what this spell should do + unitTarget->CastSpell(m_caster, m_spellInfo->CalculateSimpleValue(eff_idx), true); + } + } + + return; + } case 41126: // Flame Crash { if (!unitTarget) @@ -5646,6 +5664,24 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) unitTarget->CastSpell(unitTarget, 44870, true); break; } + case 45206: // Copy Off-hand Weapon + { + if (m_caster->GetTypeId() != TYPEID_UNIT || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + return; + + if (Item* pItem = ((Player*)unitTarget)->GetWeaponForAttack(OFF_ATTACK)) + { + if (const ItemEntry *dbcitem = sItemStore.LookupEntry(pItem->GetProto()->ItemId)) + { + m_caster->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, dbcitem->ID); + + // Unclear what this spell should do + unitTarget->CastSpell(m_caster, m_spellInfo->CalculateSimpleValue(eff_idx), true); + } + } + + return; + } case 45668: // Ultra-Advanced Proto-Typical Shortening Blaster { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 93795537c..a24923543 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10004" + #define REVISION_NR "10005" #endif // __REVISION_NR_H__ From b98691501bcb1986b032e4306d624100477fdb44 Mon Sep 17 00:00:00 2001 From: patman128 Date: Sat, 29 May 2010 23:20:03 +0400 Subject: [PATCH 134/172] [10006] Fixed typo in mangos.sql Signed-off-by: VladimirMangos --- sql/mangos.sql | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/mangos.sql b/sql/mangos.sql index 6cc73d850..2c3656066 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -15841,7 +15841,7 @@ INSERT INTO spell_chain VALUES /*Dalaran Intellect*/ (61024,0,61024,1,27126), /*Dalaran Brilliance*/ -(61316,0,61316,1,27127); +(61316,0,61316,1,27127), /*DampenMagic*/ (604,0,604,1,0), (8450,604,604,2,0), diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a24923543..8b77e8824 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10005" + #define REVISION_NR "10006" #endif // __REVISION_NR_H__ From 6551671f6db5387647e21b92337d6152dfa39fbe Mon Sep 17 00:00:00 2001 From: Laise Date: Sun, 30 May 2010 23:38:38 +0300 Subject: [PATCH 135/172] [10007] Fix wrongly initialized value --- sql/characters.sql | 2 +- sql/mangos.sql | 2 +- sql/realmd.sql | 2 +- sql/updates/10007_01_characters_pet_aura.sql | 3 +++ sql/updates/Makefile.am | 2 ++ src/game/Pet.cpp | 2 +- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 6 +++--- 8 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 sql/updates/10007_01_characters_pet_aura.sql diff --git a/sql/characters.sql b/sql/characters.sql index b9a158d18..7df7f57d4 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `character_db_version`; CREATE TABLE `character_db_version` ( - `required_9974_01_characters_group` bit(1) default NULL + `required_10007_01_characters_pet_aura` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- diff --git a/sql/mangos.sql b/sql/mangos.sql index 2c3656066..c5c646bf9 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9990_01_mangos_spell_chain` bit(1) default NULL + `required_09990_01_mangos_spell_chain` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/realmd.sql b/sql/realmd.sql index e9d5bf478..0416a9a62 100644 --- a/sql/realmd.sql +++ b/sql/realmd.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `realmd_db_version`; CREATE TABLE `realmd_db_version` ( - `required_9748_01_realmd_realmlist` bit(1) default NULL + `required_09748_01_realmd_realmlist` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- diff --git a/sql/updates/10007_01_characters_pet_aura.sql b/sql/updates/10007_01_characters_pet_aura.sql new file mode 100644 index 000000000..ef948a7e1 --- /dev/null +++ b/sql/updates/10007_01_characters_pet_aura.sql @@ -0,0 +1,3 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_09974_01_characters_group required_10007_01_characters_pet_aura bit; + +UPDATE `pet_aura` SET remaincharges = 0 WHERE remaincharges = 255; \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index be20abbcf..f862700e2 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -75,6 +75,7 @@ pkgdata_DATA = \ 09978_01_mangos_spell_bonus_data.sql \ 09988_01_mangos_spell_chain.sql \ 09990_01_mangos_spell_chain.sql \ + 10007_01_characters_pet_aura.sql \ README ## Additional files to include when running 'make dist' @@ -130,4 +131,5 @@ EXTRA_DIST = \ 09978_01_mangos_spell_bonus_data.sql \ 09988_01_mangos_spell_chain.sql \ 09990_01_mangos_spell_chain.sql \ + 10007_01_characters_pet_aura.sql \ README diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 95a5b4f8b..c077d0a4b 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1188,7 +1188,7 @@ void Pet::_LoadAuras(uint32 timediff) remaincharges = spellproto->procCharges; } else - remaincharges = -1; + remaincharges = 0; /// do not load single target auras (unless they were cast by the player) if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8b77e8824..cdb4db5fc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10006" + #define REVISION_NR "10007" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 3355116d9..049c9e04f 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ - #define REVISION_DB_CHARACTERS "required_9974_01_characters_group" - #define REVISION_DB_MANGOS "required_9990_01_mangos_spell_chain" - #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" + #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" + #define REVISION_DB_MANGOS "required_09990_01_mangos_spell_chain" + #define REVISION_DB_REALMD "required_09748_01_realmd_realmlist" #endif // __REVISION_SQL_H__ From 57623491c0f9c7d67f6c521d05fa929b6ca3ba4a Mon Sep 17 00:00:00 2001 From: Laise Date: Sun, 30 May 2010 23:58:27 +0300 Subject: [PATCH 136/172] [10008] Fix sqls --- sql/mangos.sql | 2 +- sql/realmd.sql | 2 +- sql/updates/10007_01_characters_pet_aura.sql | 2 +- sql/updates/10008_01_mangos_db_verison.sql | 2 ++ sql/updates/10008_01_realmd_realmd_db_version.sql | 2 ++ sql/updates/Makefile.am | 4 ++++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 4 ++-- 8 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 sql/updates/10008_01_mangos_db_verison.sql create mode 100644 sql/updates/10008_01_realmd_realmd_db_version.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index c5c646bf9..4010d6029 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_09990_01_mangos_spell_chain` bit(1) default NULL + `required_10008_01_mangos_db_verison` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/realmd.sql b/sql/realmd.sql index 0416a9a62..c25bfa4de 100644 --- a/sql/realmd.sql +++ b/sql/realmd.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `realmd_db_version`; CREATE TABLE `realmd_db_version` ( - `required_09748_01_realmd_realmlist` bit(1) default NULL + `required_10008_01_realmd_realmd_db_version` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- diff --git a/sql/updates/10007_01_characters_pet_aura.sql b/sql/updates/10007_01_characters_pet_aura.sql index ef948a7e1..cc8b44ae2 100644 --- a/sql/updates/10007_01_characters_pet_aura.sql +++ b/sql/updates/10007_01_characters_pet_aura.sql @@ -1,3 +1,3 @@ -ALTER TABLE character_db_version CHANGE COLUMN required_09974_01_characters_group required_10007_01_characters_pet_aura bit; +ALTER TABLE character_db_version CHANGE COLUMN required_9974_01_characters_group required_10007_01_characters_pet_aura bit; UPDATE `pet_aura` SET remaincharges = 0 WHERE remaincharges = 255; \ No newline at end of file diff --git a/sql/updates/10008_01_mangos_db_verison.sql b/sql/updates/10008_01_mangos_db_verison.sql new file mode 100644 index 000000000..5ea62ce67 --- /dev/null +++ b/sql/updates/10008_01_mangos_db_verison.sql @@ -0,0 +1,2 @@ +ALTER TABLE db_version CHANGE COLUMN required_9990_01_mangos_spell_chain required_10008_01_mangos_db_verison bit; + diff --git a/sql/updates/10008_01_realmd_realmd_db_version.sql b/sql/updates/10008_01_realmd_realmd_db_version.sql new file mode 100644 index 000000000..ca60b3f0c --- /dev/null +++ b/sql/updates/10008_01_realmd_realmd_db_version.sql @@ -0,0 +1,2 @@ +ALTER TABLE realmd_db_version CHANGE COLUMN required_9748_01_realmd_realmlist required_10008_01_realmd_realmd_db_version bit; + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index f862700e2..3dc93c0c7 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -76,6 +76,8 @@ pkgdata_DATA = \ 09988_01_mangos_spell_chain.sql \ 09990_01_mangos_spell_chain.sql \ 10007_01_characters_pet_aura.sql \ + 10008_01_mangos_db_verison.sql \ + 10008_01_realmd_realmd_db_version.sql \ README ## Additional files to include when running 'make dist' @@ -132,4 +134,6 @@ EXTRA_DIST = \ 09988_01_mangos_spell_chain.sql \ 09990_01_mangos_spell_chain.sql \ 10007_01_characters_pet_aura.sql \ + 10008_01_mangos_db_verison.sql \ + 10008_01_realmd_realmd_db_version.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cdb4db5fc..5d1423dd8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10007" + #define REVISION_NR "10008" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 049c9e04f..23f5416ef 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_09990_01_mangos_spell_chain" - #define REVISION_DB_REALMD "required_09748_01_realmd_realmlist" + #define REVISION_DB_MANGOS "required_10008_01_mangos_db_verison" + #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ From b23fd66aa662f4d4c3d296ee12dc9f72a0752fba Mon Sep 17 00:00:00 2001 From: Derex Date: Mon, 31 May 2010 03:19:23 +0400 Subject: [PATCH 137/172] [10009] Fix realmd to accept more than 64 connections on windows. Signed-off-by: VladimirMangos --- src/realmd/Main.cpp | 3 +++ src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 351542ebf..1807b165f 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -181,6 +182,8 @@ extern int main(int argc, char **argv) #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); +#else + ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true); #endif sLog.outBasic("Max allowed open files is %d", ACE::max_handles()); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5d1423dd8..8e77d48c4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10008" + #define REVISION_NR "10009" #endif // __REVISION_NR_H__ From 59cf9c1dbd18763fa5c7619f4c8153bf04d3df0c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 31 May 2010 08:06:49 +0400 Subject: [PATCH 138/172] [10010] Use schoolmask enum in struct SpellNonMeleeDamage, some indents fix. --- src/game/SpellAuras.cpp | 2 +- src/game/SpellMgr.h | 88 ++++++++++++++++++++-------------------- src/game/Unit.cpp | 8 ++-- src/game/Unit.h | 4 +- src/shared/revision_nr.h | 2 +- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index be54aa6c8..876526a10 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -7562,7 +7562,7 @@ void Aura::PeriodicTick() SpellEntry const* spellProto = GetSpellProto(); // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG - SpellNonMeleeDamage damageInfo(pCaster, m_target, spellProto->Id, spellProto->SchoolMask); + SpellNonMeleeDamage damageInfo(pCaster, m_target, spellProto->Id, SpellSchoolMask(spellProto->SchoolMask)); pCaster->CalculateSpellDamage(&damageInfo, gain, spellProto); damageInfo.target->CalculateAbsorbResistBlock(pCaster, &damageInfo, spellProto); diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index ff2b8b3f7..2956bb2e8 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -454,43 +454,43 @@ SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty); // Spell proc event related declarations (accessed using SpellMgr functions) enum ProcFlags { - PROC_FLAG_NONE = 0x00000000, + PROC_FLAG_NONE = 0x00000000, - PROC_FLAG_KILLED = 0x00000001, // 00 Killed by agressor - PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward) + PROC_FLAG_KILLED = 0x00000001, // 00 Killed by aggressor + PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward) - PROC_FLAG_SUCCESSFUL_MELEE_HIT = 0x00000004, // 02 Successful melee auto attack - PROC_FLAG_TAKEN_MELEE_HIT = 0x00000008, // 03 Taken damage from melee auto attack hit + PROC_FLAG_SUCCESSFUL_MELEE_HIT = 0x00000004, // 02 Successful melee auto attack + PROC_FLAG_TAKEN_MELEE_HIT = 0x00000008, // 03 Taken damage from melee auto attack hit - PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT = 0x00000010, // 04 Successful attack by Spell that use melee weapon - PROC_FLAG_TAKEN_MELEE_SPELL_HIT = 0x00000020, // 05 Taken damage by Spell that use melee weapon + PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT = 0x00000010, // 04 Successful attack by Spell that use melee weapon + PROC_FLAG_TAKEN_MELEE_SPELL_HIT = 0x00000020, // 05 Taken damage by Spell that use melee weapon - PROC_FLAG_SUCCESSFUL_RANGED_HIT = 0x00000040, // 06 Successful Ranged auto attack - PROC_FLAG_TAKEN_RANGED_HIT = 0x00000080, // 07 Taken damage from ranged auto attack + PROC_FLAG_SUCCESSFUL_RANGED_HIT = 0x00000040, // 06 Successful Ranged auto attack + PROC_FLAG_TAKEN_RANGED_HIT = 0x00000080, // 07 Taken damage from ranged auto attack - PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT = 0x00000100, // 08 Successful Ranged attack by Spell that use ranged weapon - PROC_FLAG_TAKEN_RANGED_SPELL_HIT = 0x00000200, // 09 Taken damage by Spell that use ranged weapon + PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT = 0x00000100, // 08 Successful Ranged attack by Spell that use ranged weapon + PROC_FLAG_TAKEN_RANGED_SPELL_HIT = 0x00000200, // 09 Taken damage by Spell that use ranged weapon - PROC_FLAG_SUCCESSFUL_POSITIVE_AOE_HIT = 0x00000400, // 10 Successful AoE (not 100% shure unused) - PROC_FLAG_TAKEN_POSITIVE_AOE = 0x00000800, // 11 Taken AoE (not 100% shure unused) + PROC_FLAG_SUCCESSFUL_POSITIVE_AOE_HIT = 0x00000400, // 10 Successful AoE (not 100% shure unused) + PROC_FLAG_TAKEN_POSITIVE_AOE = 0x00000800, // 11 Taken AoE (not 100% shure unused) - PROC_FLAG_SUCCESSFUL_AOE_SPELL_HIT = 0x00001000, // 12 Successful AoE damage spell hit (not 100% shure unused) - PROC_FLAG_TAKEN_AOE_SPELL_HIT = 0x00002000, // 13 Taken AoE damage spell hit (not 100% shure unused) + PROC_FLAG_SUCCESSFUL_AOE_SPELL_HIT = 0x00001000, // 12 Successful AoE damage spell hit (not 100% shure unused) + PROC_FLAG_TAKEN_AOE_SPELL_HIT = 0x00002000, // 13 Taken AoE damage spell hit (not 100% shure unused) - PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL = 0x00004000, // 14 Successful cast positive spell (by default only on healing) - PROC_FLAG_TAKEN_POSITIVE_SPELL = 0x00008000, // 15 Taken positive spell hit (by default only on healing) + PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL = 0x00004000, // 14 Successful cast positive spell (by default only on healing) + PROC_FLAG_TAKEN_POSITIVE_SPELL = 0x00008000, // 15 Taken positive spell hit (by default only on healing) - PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT = 0x00010000, // 16 Successful negative spell cast (by default only on damage) - PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT = 0x00020000, // 17 Taken negative spell (by default only on damage) + PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT = 0x00010000, // 16 Successful negative spell cast (by default only on damage) + PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT = 0x00020000, // 17 Taken negative spell (by default only on damage) - PROC_FLAG_ON_DO_PERIODIC = 0x00040000, // 18 Successful do periodic (damage / healing, determined from 14-17 flags) - PROC_FLAG_ON_TAKE_PERIODIC = 0x00080000, // 19 Taken spell periodic (damage / healing, determined from 14-17 flags) + PROC_FLAG_ON_DO_PERIODIC = 0x00040000, // 18 Successful do periodic (damage / healing, determined from 14-17 flags) + PROC_FLAG_ON_TAKE_PERIODIC = 0x00080000, // 19 Taken spell periodic (damage / healing, determined from 14-17 flags) - PROC_FLAG_TAKEN_ANY_DAMAGE = 0x00100000, // 20 Taken any damage - PROC_FLAG_ON_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation + PROC_FLAG_TAKEN_ANY_DAMAGE = 0x00100000, // 20 Taken any damage + PROC_FLAG_ON_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation - PROC_FLAG_TAKEN_OFFHAND_HIT = 0x00400000, // 22 Taken off-hand melee attacks(not used) - PROC_FLAG_SUCCESSFUL_OFFHAND_HIT = 0x00800000 // 23 Successful off-hand melee attacks + PROC_FLAG_TAKEN_OFFHAND_HIT = 0x00400000, // 22 Taken off-hand melee attacks(not used) + PROC_FLAG_SUCCESSFUL_OFFHAND_HIT = 0x00800000 // 23 Successful off-hand melee attacks }; #define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_SUCCESSFUL_MELEE_HIT | \ @@ -510,25 +510,25 @@ enum ProcFlags enum ProcFlagsEx { - PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag) - PROC_EX_NORMAL_HIT = 0x0000001, // If set only from normal hit (only damage spells) - PROC_EX_CRITICAL_HIT = 0x0000002, - PROC_EX_MISS = 0x0000004, - PROC_EX_RESIST = 0x0000008, - PROC_EX_DODGE = 0x0000010, - PROC_EX_PARRY = 0x0000020, - PROC_EX_BLOCK = 0x0000040, - PROC_EX_EVADE = 0x0000080, - PROC_EX_IMMUNE = 0x0000100, - PROC_EX_DEFLECT = 0x0000200, - PROC_EX_ABSORB = 0x0000400, - PROC_EX_REFLECT = 0x0000800, - PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used) - PROC_EX_FULL_BLOCK = 0x0002000, // block al attack damage - PROC_EX_RESERVED2 = 0x0004000, - PROC_EX_RESERVED3 = 0x0008000, - PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges - PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000 // If set trigger always but only one time (not used) + PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag) + PROC_EX_NORMAL_HIT = 0x0000001, // If set only from normal hit (only damage spells) + PROC_EX_CRITICAL_HIT = 0x0000002, + PROC_EX_MISS = 0x0000004, + PROC_EX_RESIST = 0x0000008, + PROC_EX_DODGE = 0x0000010, + PROC_EX_PARRY = 0x0000020, + PROC_EX_BLOCK = 0x0000040, + PROC_EX_EVADE = 0x0000080, + PROC_EX_IMMUNE = 0x0000100, + PROC_EX_DEFLECT = 0x0000200, + PROC_EX_ABSORB = 0x0000400, + PROC_EX_REFLECT = 0x0000800, + PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used) + PROC_EX_FULL_BLOCK = 0x0002000, // block al attack damage + PROC_EX_RESERVED2 = 0x0004000, + PROC_EX_RESERVED3 = 0x0008000, + PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges + PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000 // If set trigger always but only one time (not used) }; struct SpellProcEventEntry diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index ddf3e35ad..e35ab4fa2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1180,7 +1180,7 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, boo uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID); - SpellNonMeleeDamage damageInfo(this, pVictim, spellInfo->Id, spellInfo->SchoolMask); + SpellNonMeleeDamage damageInfo(this, pVictim, spellInfo->Id, SpellSchoolMask(spellInfo->SchoolMask)); CalculateSpellDamage(&damageInfo, damage, spellInfo); damageInfo.target->CalculateAbsorbResistBlock(this, &damageInfo, spellInfo); DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb); @@ -1191,7 +1191,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType) { - SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask); + SpellSchoolMask damageSchoolMask = damageInfo->schoolMask; Unit *pVictim = damageInfo->target; if (damage < 0) @@ -1304,7 +1304,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) // Call default DealDamage (send critical in hit info for threat calculation) CleanDamage cleanDamage(0, BASE_ATTACK, damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT ? MELEE_HIT_CRIT : MELEE_HIT_NORMAL); - DealDamage(pVictim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss); + DealDamage(pVictim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, damageInfo->schoolMask, spellProto, durabilityLoss); } //TODO for melee need create structure as in @@ -12481,7 +12481,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag case SPELL_AURA_PROC_TRIGGER_DAMAGE: { DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", auraModifier->m_amount, spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); - SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, spellInfo->SchoolMask); + SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, SpellSchoolMask(spellInfo->SchoolMask)); CalculateSpellDamage(&damageInfo, auraModifier->m_amount, spellInfo); damageInfo.target->CalculateAbsorbResistBlock(this, &damageInfo, spellInfo); DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb); diff --git a/src/game/Unit.h b/src/game/Unit.h index 8555d5f75..9f5440fdb 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -878,7 +878,7 @@ struct CalcDamageInfo // Spell damage info structure based on structure sending in SMSG_SPELLNONMELEEDAMAGELOG opcode struct SpellNonMeleeDamage{ - SpellNonMeleeDamage(Unit *_attacker, Unit *_target, uint32 _SpellID, uint32 _schoolMask) + SpellNonMeleeDamage(Unit *_attacker, Unit *_target, uint32 _SpellID, SpellSchoolMask _schoolMask) : target(_target), attacker(_attacker), SpellID(_SpellID), damage(0), overkill(0), schoolMask(_schoolMask), absorb(0), resist(0), physicalLog(false), unused(false), blocked(0), HitInfo(0) {} @@ -888,7 +888,7 @@ struct SpellNonMeleeDamage{ uint32 SpellID; uint32 damage; uint32 overkill; - uint32 schoolMask; + SpellSchoolMask schoolMask; uint32 absorb; uint32 resist; bool physicalLog; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8e77d48c4..8cf9e75f1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10009" + #define REVISION_NR "10010" #endif // __REVISION_NR_H__ From 93624bb4964183613234c6c0f00a144c69d502e4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 31 May 2010 12:24:16 +0400 Subject: [PATCH 139/172] [10011] Check redundent procFlags value in `spell_proc_event`. --- sql/mangos.sql | 6 +++--- sql/updates/10011_01_mangos_spell_proc_event.sql | 6 ++++++ sql/updates/Makefile.am | 2 ++ src/game/SpellMgr.cpp | 13 +++++++++++-- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 6 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 sql/updates/10011_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 4010d6029..d25e5ae3c 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10008_01_mangos_db_verison` bit(1) default NULL + `required_10011_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -18591,7 +18591,7 @@ INSERT INTO `spell_proc_event` VALUES (54488, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54489, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54490, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54646, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00015400, 0x00000002, 0.000000, 0.000000, 0), +(54646, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (54695, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (54707, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), (54738, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), @@ -18713,7 +18713,7 @@ INSERT INTO `spell_proc_event` VALUES (63108, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63156, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(63280, 0x00000000, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0x000000, 0.000000, 0), +(63280, 0x00000000, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), (63320, 0x00000000, 5, 0x00040000, 0x00000000, 0x00008000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), (63373, 0x00000000, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), (63534, 0x00000000, 6, 0x00000040, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), diff --git a/sql/updates/10011_01_mangos_spell_proc_event.sql b/sql/updates/10011_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..a13492ecc --- /dev/null +++ b/sql/updates/10011_01_mangos_spell_proc_event.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_10008_01_mangos_db_verison required_10011_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (54646,63280); +INSERT INTO `spell_proc_event` VALUES +(54646, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(63280, 0x00000000, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 3dc93c0c7..dd95f026b 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -78,6 +78,7 @@ pkgdata_DATA = \ 10007_01_characters_pet_aura.sql \ 10008_01_mangos_db_verison.sql \ 10008_01_realmd_realmd_db_version.sql \ + 10011_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -136,4 +137,5 @@ EXTRA_DIST = \ 10007_01_characters_pet_aura.sql \ 10008_01_mangos_db_verison.sql \ 10008_01_realmd_realmd_db_version.sql \ + 10011_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 6a8a777f5..8635fa1e6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1074,15 +1074,24 @@ void SpellMgr::LoadSpellProcEvents() DoSpellProcEvent worker(spe); doForHighRanks(entry,worker); - if (spell->procFlags==0) + if (spe.procFlags == 0) { - if (spe.procFlags == 0) + if (spell->procFlags==0) { sLog.outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry); continue; } customProc++; } + else + { + if (spell->procFlags==spe.procFlags) + { + sLog.outErrorDb("Spell %u listed in `spell_proc_event` have exactly same proc flags as in spell.dbc, field value redundent", entry); + continue; + } + } + ++count; } while( result->NextRow() ); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8cf9e75f1..765601897 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10010" + #define REVISION_NR "10011" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 23f5416ef..e63c1943d 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_10008_01_mangos_db_verison" + #define REVISION_DB_MANGOS "required_10011_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ From f9df9d6226b939f596cbe3754d9e117a37a47edb Mon Sep 17 00:00:00 2001 From: Laise Date: Mon, 31 May 2010 22:02:02 +0300 Subject: [PATCH 140/172] [10012] Fix charges taking for 16246 --- sql/mangos.sql | 2 +- sql/updates/10012_01_mangos_spell_proc_event.sql | 4 ++++ sql/updates/Makefile.am | 2 ++ src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 sql/updates/10012_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index d25e5ae3c..5e7733223 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10011_01_mangos_spell_proc_event` bit(1) default NULL + `required_10012_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/updates/10012_01_mangos_spell_proc_event.sql b/sql/updates/10012_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..a966067e9 --- /dev/null +++ b/sql/updates/10012_01_mangos_spell_proc_event.sql @@ -0,0 +1,4 @@ +ALTER TABLE db_version CHANGE COLUMN required_10011_01_mangos_spell_proc_event required_10012_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` = 16246; +INSERT INTO `spell_proc_event` VALUES (16246, 0x00000000, 11, 0x981001C3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index dd95f026b..15554b96a 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -79,6 +79,7 @@ pkgdata_DATA = \ 10008_01_mangos_db_verison.sql \ 10008_01_realmd_realmd_db_version.sql \ 10011_01_mangos_spell_proc_event.sql \ + 10012_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -138,4 +139,5 @@ EXTRA_DIST = \ 10008_01_mangos_db_verison.sql \ 10008_01_realmd_realmd_db_version.sql \ 10011_01_mangos_spell_proc_event.sql \ + 10012_01_mangos_spell_proc_event.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 765601897..a9c90131d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10011" + #define REVISION_NR "10012" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index e63c1943d..1dfe683fe 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_10011_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_10012_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ From 59367bc19f620aa2863dd3ebde6da70a299ee46d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 1 Jun 2010 01:10:51 +0400 Subject: [PATCH 141/172] [10013] Implement CONDITION_QUESTTARGET For cases when loot dependent from some quest objective complete state. --- src/game/ObjectMgr.cpp | 29 +++++++++++++++++++++++++++++ src/game/ObjectMgr.h | 3 ++- src/game/Player.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/game/Player.h | 1 + src/shared/revision_nr.h | 2 +- 5 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index eea0b4495..2afe1ccd0 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7409,6 +7409,10 @@ bool PlayerCondition::Meets(Player const * player) const return data->CheckConditionCriteriaMeet(player, value1, value2); return false; } + case CONDITION_QUESTTARGET: + { + return player->HasQuestObjectiveForTarget(int32(value1), !bool(value2)); + } default: return false; } @@ -7633,6 +7637,31 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val break; } + case CONDITION_QUESTTARGET: + { + if (int32(value1) > 0) + { + if (!sObjectMgr.GetCreatureTemplate(value1)) + { + sLog.outErrorDb("Quest target condition has not existed creature entry %u as first arg, skipped", value1); + return false; + } + } + else if (int32(value1) < 0) + { + if (!sObjectMgr.GetGameObjectInfo(-int32(value1))) + { + sLog.outErrorDb("Quest target condition has not existed gameobject entry %u as first arg, skipped", -int32(value1)); + return false; + } + } + else + { + sLog.outErrorDb("Quest target condition has not existed entry 0 as first arg, skipped"); + return false; + } + break; + } case CONDITION_NONE: break; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 2793b7709..d0b584bf7 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -317,9 +317,10 @@ enum ConditionType CONDITION_NOITEM = 16, // item_id count CONDITION_SPELL = 17, // spell_id 0, 1 (0: has spell, 1: hasn't spell) CONDITION_INSTANCE_SCRIPT = 18, // map_id instance_condition_id (instance script specific enum) + CONDITION_QUESTTARGET = 19, // entry complete,for condition true entry (positive - creature entry, negative (-entry) - gameobject entry) is not rewarded quest objective in (completed, bool) state. }; -#define MAX_CONDITION 19 // maximum value in ConditionType enum +#define MAX_CONDITION 20 // maximum value in ConditionType enum struct PlayerCondition { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7513657d7..dccd7240f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19842,6 +19842,44 @@ bool Player::HasQuestForGO(int32 GOId) const return false; } +bool Player::HasQuestObjectiveForTarget(int32 creatureOrGOId, bool incomplete /*= true*/) const +{ + for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i ) + { + uint32 questid = GetQuestSlotQuestId(i); + if ( questid == 0 ) + continue; + + QuestStatusMap::const_iterator qs_itr = mQuestStatus.find(questid); + if(qs_itr == mQuestStatus.end()) + continue; + + QuestStatusData const& qs = qs_itr->second; + + // for incopmplete objective we need incomplete quests, for complete objective it can be complete/incomplete + if (qs.m_status == QUEST_STATUS_INCOMPLETE || !incomplete && qs.m_status == QUEST_STATUS_COMPLETE) + { + Quest const* qinfo = sObjectMgr.GetQuestTemplate(questid); + if (!qinfo) + continue; + + if (GetGroup() && GetGroup()->isRaidGroup() && qinfo->IsAllowedInRaid()) + continue; + + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) + { + // creatureOrGOId have expected signs for creature/go cases, comparison signed + if (qinfo->ReqCreatureOrGOId[j] != creatureOrGOId) + continue; + + if (incomplete == (qs.m_creatureOrGOcount[j] < qinfo->ReqCreatureOrGOCount[j])) + return true; + } + } + } + return false; +} + void Player::UpdateForQuestWorldObjects() { if(m_clientGUIDs.empty()) diff --git a/src/game/Player.h b/src/game/Player.h index cdf20bb19..b7034247d 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1410,6 +1410,7 @@ class MANGOS_DLL_SPEC Player : public Unit void ReputationChanged(FactionEntry const* factionEntry ); bool HasQuestForItem( uint32 itemid ) const; bool HasQuestForGO(int32 GOId) const; + bool HasQuestObjectiveForTarget(int32 creatureOrGOId, bool incomplete = true) const; void UpdateForQuestWorldObjects(); bool CanShareQuest(uint32 quest_id) const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a9c90131d..4f2847d3f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10012" + #define REVISION_NR "10013" #endif // __REVISION_NR_H__ From 5e526ef0d937f45026e57578f140ed576c0a07eb Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 1 Jun 2010 02:23:37 +0400 Subject: [PATCH 142/172] [10014] Revert "[10013] Implement CONDITION_QUESTTARGET" This reverts commit 4e460746c0947f6cfc1f1150a8eb90257819eae2. --- src/game/ObjectMgr.cpp | 29 ----------------------------- src/game/ObjectMgr.h | 3 +-- src/game/Player.cpp | 38 -------------------------------------- src/game/Player.h | 1 - src/shared/revision_nr.h | 2 +- 5 files changed, 2 insertions(+), 71 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 2afe1ccd0..eea0b4495 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7409,10 +7409,6 @@ bool PlayerCondition::Meets(Player const * player) const return data->CheckConditionCriteriaMeet(player, value1, value2); return false; } - case CONDITION_QUESTTARGET: - { - return player->HasQuestObjectiveForTarget(int32(value1), !bool(value2)); - } default: return false; } @@ -7637,31 +7633,6 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val break; } - case CONDITION_QUESTTARGET: - { - if (int32(value1) > 0) - { - if (!sObjectMgr.GetCreatureTemplate(value1)) - { - sLog.outErrorDb("Quest target condition has not existed creature entry %u as first arg, skipped", value1); - return false; - } - } - else if (int32(value1) < 0) - { - if (!sObjectMgr.GetGameObjectInfo(-int32(value1))) - { - sLog.outErrorDb("Quest target condition has not existed gameobject entry %u as first arg, skipped", -int32(value1)); - return false; - } - } - else - { - sLog.outErrorDb("Quest target condition has not existed entry 0 as first arg, skipped"); - return false; - } - break; - } case CONDITION_NONE: break; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index d0b584bf7..2793b7709 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -317,10 +317,9 @@ enum ConditionType CONDITION_NOITEM = 16, // item_id count CONDITION_SPELL = 17, // spell_id 0, 1 (0: has spell, 1: hasn't spell) CONDITION_INSTANCE_SCRIPT = 18, // map_id instance_condition_id (instance script specific enum) - CONDITION_QUESTTARGET = 19, // entry complete,for condition true entry (positive - creature entry, negative (-entry) - gameobject entry) is not rewarded quest objective in (completed, bool) state. }; -#define MAX_CONDITION 20 // maximum value in ConditionType enum +#define MAX_CONDITION 19 // maximum value in ConditionType enum struct PlayerCondition { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index dccd7240f..7513657d7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19842,44 +19842,6 @@ bool Player::HasQuestForGO(int32 GOId) const return false; } -bool Player::HasQuestObjectiveForTarget(int32 creatureOrGOId, bool incomplete /*= true*/) const -{ - for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i ) - { - uint32 questid = GetQuestSlotQuestId(i); - if ( questid == 0 ) - continue; - - QuestStatusMap::const_iterator qs_itr = mQuestStatus.find(questid); - if(qs_itr == mQuestStatus.end()) - continue; - - QuestStatusData const& qs = qs_itr->second; - - // for incopmplete objective we need incomplete quests, for complete objective it can be complete/incomplete - if (qs.m_status == QUEST_STATUS_INCOMPLETE || !incomplete && qs.m_status == QUEST_STATUS_COMPLETE) - { - Quest const* qinfo = sObjectMgr.GetQuestTemplate(questid); - if (!qinfo) - continue; - - if (GetGroup() && GetGroup()->isRaidGroup() && qinfo->IsAllowedInRaid()) - continue; - - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) - { - // creatureOrGOId have expected signs for creature/go cases, comparison signed - if (qinfo->ReqCreatureOrGOId[j] != creatureOrGOId) - continue; - - if (incomplete == (qs.m_creatureOrGOcount[j] < qinfo->ReqCreatureOrGOCount[j])) - return true; - } - } - } - return false; -} - void Player::UpdateForQuestWorldObjects() { if(m_clientGUIDs.empty()) diff --git a/src/game/Player.h b/src/game/Player.h index b7034247d..cdf20bb19 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1410,7 +1410,6 @@ class MANGOS_DLL_SPEC Player : public Unit void ReputationChanged(FactionEntry const* factionEntry ); bool HasQuestForItem( uint32 itemid ) const; bool HasQuestForGO(int32 GOId) const; - bool HasQuestObjectiveForTarget(int32 creatureOrGOId, bool incomplete = true) const; void UpdateForQuestWorldObjects(); bool CanShareQuest(uint32 quest_id) const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4f2847d3f..4d5d0b7d1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10013" + #define REVISION_NR "10014" #endif // __REVISION_NR_H__ From 86439e14ad5b99c779cee4e3eb4f01cc4d9c873b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 1 Jun 2010 04:45:05 +0400 Subject: [PATCH 143/172] [10015] More redundant data check in `spell_proc_event` --- sql/mangos.sql | 8 +--- .../10015_01_mangos_spell_proc_event.sql | 7 ++++ sql/updates/Makefile.am | 2 + src/game/SpellMgr.cpp | 40 ++++++++++++++----- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 6 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 sql/updates/10015_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 5e7733223..1ddbf87e2 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10012_01_mangos_spell_proc_event` bit(1) default NULL + `required_10015_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -17935,7 +17935,6 @@ LOCK TABLES `spell_proc_event` WRITE; INSERT INTO `spell_proc_event` VALUES ( 324, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), ( 974, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -( 1463, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), ( 3232, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), ( 5952, 0x00000000, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), ( 6346, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), @@ -18001,7 +18000,6 @@ INSERT INTO `spell_proc_event` VALUES (13046, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (13047, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (13048, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13163, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), (13165, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (13754, 0x00000000, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (13867, 0x00000000, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -18229,7 +18227,6 @@ INSERT INTO `spell_proc_event` VALUES (31878, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), (31904, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (32385, 0x00000000, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(32409, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (32587, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (32642, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (32734, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), @@ -18301,7 +18298,6 @@ INSERT INTO `spell_proc_event` VALUES (35100, 0x00000000, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), (35121, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (36096, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(36111, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (36541, 0x00000004, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (37165, 0x00000000, 8, 0x00200400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (37168, 0x00000000, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -18731,7 +18727,7 @@ INSERT INTO `spell_proc_event` VALUES (67672, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 50), (67702, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (67771, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(70664, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 2.000000, 0), +(70664, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), (70748, 0x00000000, 3, 0x00000000, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0); /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; diff --git a/sql/updates/10015_01_mangos_spell_proc_event.sql b/sql/updates/10015_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..7d4fb7967 --- /dev/null +++ b/sql/updates/10015_01_mangos_spell_proc_event.sql @@ -0,0 +1,7 @@ +ALTER TABLE db_version CHANGE COLUMN required_10012_01_mangos_spell_proc_event required_10015_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (1463, 13163, 32409, 36111, 70664); + +INSERT INTO `spell_proc_event` VALUES +(70664, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0); + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 15554b96a..6828d4515 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -80,6 +80,7 @@ pkgdata_DATA = \ 10008_01_realmd_realmd_db_version.sql \ 10011_01_mangos_spell_proc_event.sql \ 10012_01_mangos_spell_proc_event.sql \ + 10015_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -140,4 +141,5 @@ EXTRA_DIST = \ 10008_01_realmd_realmd_db_version.sql \ 10011_01_mangos_spell_proc_event.sql \ 10012_01_mangos_spell_proc_event.sql \ + 10015_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 8635fa1e6..3d7133f7f 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1070,6 +1070,8 @@ void SpellMgr::LoadSpellProcEvents() mSpellProcEventMap[entry] = spe; + bool isCustom = false; + // also add to high ranks DoSpellProcEvent worker(spe); doForHighRanks(entry,worker); @@ -1077,22 +1079,42 @@ void SpellMgr::LoadSpellProcEvents() if (spe.procFlags == 0) { if (spell->procFlags==0) - { - sLog.outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry); - continue; - } - customProc++; + sLog.outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell (no proc flags)", entry); } else { if (spell->procFlags==spe.procFlags) - { sLog.outErrorDb("Spell %u listed in `spell_proc_event` have exactly same proc flags as in spell.dbc, field value redundent", entry); - continue; - } + else + isCustom = true; } - ++count; + if (spe.customChance == 0) + { + /* enable for re-check cases, 0 chance ok for some cases because in some cases it set by another spell/talent spellmod) + if (spell->procChance==0 && !spe.ppmRate) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell (no chance or ppm)", entry); + */ + } + else + { + if (spell->procChance==spe.customChance) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` have exactly same custom chance as in spell.dbc, field value redundent", entry); + else + isCustom = true; + } + + // totally redundant record + if (!spe.schoolMask && !spe.spellFamilyMask && !spe.spellFamilyMask2 && !spe.procFlags && + !spe.procEx && !spe.ppmRate && !spe.customChance && !spe.cooldown) + { + sLog.outErrorDb("Spell %u listed in `spell_proc_event` not have any useful data", entry); + } + + if (isCustom) + ++customProc; + else + ++count; } while( result->NextRow() ); delete result; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4d5d0b7d1..3eb7cf511 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10014" + #define REVISION_NR "10015" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 1dfe683fe..6c809c056 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_10012_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_10015_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ From 0a24a170d182da13bef0722e6adab4435f65e03d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 1 Jun 2010 05:16:22 +0400 Subject: [PATCH 144/172] [10016] Remove unused RewardSinglePlayerAtKill result. --- src/game/Player.cpp | 6 ++---- src/game/Player.h | 2 +- src/game/SpellMgr.h | 2 +- src/shared/revision_nr.h | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7513657d7..bccc778ae 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -20122,13 +20122,13 @@ bool Player::isHonorOrXPTarget(Unit* pVictim) const return true; } -bool Player::RewardSinglePlayerAtKill(Unit* pVictim) +void Player::RewardSinglePlayerAtKill(Unit* pVictim) { bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); uint32 xp = PvP ? 0 : MaNGOS::XP::Gain(this, pVictim); // honor can be in PvP and !PvP (racial leader) cases - bool honored_kill = RewardHonor(pVictim,1); + RewardHonor(pVictim,1); // xp and reputation only in !PvP case if(!PvP) @@ -20143,8 +20143,6 @@ bool Player::RewardSinglePlayerAtKill(Unit* pVictim) if(pVictim->GetTypeId()==TYPEID_UNIT) KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetObjectGuid()); } - - return xp || honored_kill; } void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource) diff --git a/src/game/Player.h b/src/game/Player.h index cdf20bb19..0e4f35e90 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1904,7 +1904,7 @@ class MANGOS_DLL_SPEC Player : public Unit void InitDisplayIds(); bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; - bool RewardSinglePlayerAtKill(Unit* pVictim); + void RewardSinglePlayerAtKill(Unit* pVictim); void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource); bool isHonorOrXPTarget(Unit* pVictim) const; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 2956bb2e8..0108e78d3 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -457,7 +457,7 @@ enum ProcFlags PROC_FLAG_NONE = 0x00000000, PROC_FLAG_KILLED = 0x00000001, // 00 Killed by aggressor - PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward) + PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward, see Unit::IsTriggeredAtSpellProcEvent for additinoal check) PROC_FLAG_SUCCESSFUL_MELEE_HIT = 0x00000004, // 02 Successful melee auto attack PROC_FLAG_TAKEN_MELEE_HIT = 0x00000008, // 03 Taken damage from melee auto attack hit diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3eb7cf511..ac4949acf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10015" + #define REVISION_NR "10016" #endif // __REVISION_NR_H__ From e4adbc29e614b137e112af8a9ccf11e695da4500 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 1 Jun 2010 06:25:05 +0400 Subject: [PATCH 145/172] [10017] Make spell_proc_event.SchoolMask unsigned. Also use byte length hex for school mask in mangos.sql data. --- sql/mangos.sql | 1596 ++++++++--------- .../10017_01_mangos_spell_proc_event.sql | 6 + sql/updates/Makefile.am | 2 + src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 5 files changed, 808 insertions(+), 800 deletions(-) create mode 100644 sql/updates/10017_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 1ddbf87e2..3ac9c85fa 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10015_01_mangos_spell_proc_event` bit(1) default NULL + `required_10017_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -17913,7 +17913,7 @@ UNLOCK TABLES; DROP TABLE IF EXISTS `spell_proc_event`; CREATE TABLE `spell_proc_event` ( `entry` mediumint(8) unsigned NOT NULL default '0', - `SchoolMask` tinyint(4) NOT NULL default '0', + `SchoolMask` tinyint(4) unsigned NOT NULL default '0', `SpellFamilyName` smallint(5) unsigned NOT NULL default '0', `SpellFamilyMask0` int(10) unsigned NOT NULL default '0', `SpellFamilyMask1` int(10) unsigned NOT NULL default '0', @@ -17933,802 +17933,802 @@ CREATE TABLE `spell_proc_event` ( LOCK TABLES `spell_proc_event` WRITE; /*!40000 ALTER TABLE `spell_proc_event` DISABLE KEYS */; INSERT INTO `spell_proc_event` VALUES -( 324, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -( 974, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -( 3232, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -( 5952, 0x00000000, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -( 6346, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), -( 7383, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), -( 7434, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -( 8178, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -( 9452, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -( 9782, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -( 9784, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -( 9799, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(11095, 0x00000000, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(11119, 0x00000004, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(11120, 0x00000004, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(11129, 0x00000004, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(11180, 0x00000010, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(11185, 0x00000000, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), -(11255, 0x00000000, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12169, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12281, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12289, 0x00000000, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12298, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12311, 0x00000000, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12317, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12319, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12322, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(12487, 0x00000000, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), -(12488, 0x00000000, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), -(12598, 0x00000000, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12668, 0x00000000, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12724, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12725, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12726, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12727, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12797, 0x00000000, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12799, 0x00000000, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12812, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12813, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12814, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12815, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12834, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12846, 0x00000004, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12847, 0x00000004, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12848, 0x00000004, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12849, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12867, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12872, 0x00000000, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12873, 0x00000000, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12958, 0x00000000, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12966, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(12967, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(12968, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(12969, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(12970, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(12971, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12972, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12973, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12974, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12999, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), -(13000, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), -(13001, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 8.000000, 0.000000, 0), -(13002, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,10.000000, 0.000000, 0), -(13045, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13046, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13047, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13048, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13165, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(13754, 0x00000000, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(13867, 0x00000000, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(13983, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), -(14070, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), -(14071, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), -(14156, 0x00000000, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(14160, 0x00000000, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(14161, 0x00000000, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(14186, 0x00000000, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14190, 0x00000000, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14193, 0x00000000, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14194, 0x00000000, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14195, 0x00000000, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14531, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14774, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14892, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15088, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15128, 0x00000004, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(15277, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), -(15286, 0x00000020, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(15337, 0x00000000, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15338, 0x00000000, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15346, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), -(15362, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15363, 0x00000000, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15600, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), -(16164, 0x0000001C, 11, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000002, 0.000000, 0.000000, 0), -(16176, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16180, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16196, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16198, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16235, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16240, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16256, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16257, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(16277, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(16278, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(16279, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(16280, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(16281, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16282, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16283, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16284, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16487, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16489, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16492, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16550, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16620, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(16624, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(16850, 0x00000000, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(16864, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(16880, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16923, 0x00000000, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(16924, 0x00000000, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(16952, 0x00000000, 7, 0x00039000, 0x00000400, 0x00040000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16954, 0x00000000, 7, 0x00039000, 0x00000400, 0x00040000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16958, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16961, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17106, 0x00000000, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(17107, 0x00000000, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(17108, 0x00000000, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(17364, 0x00000008, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(17495, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(17793, 0x00000000, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17796, 0x00000000, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17801, 0x00000000, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17802, 0x00000000, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17803, 0x00000000, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(18073, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(18094, 0x00000000, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(18095, 0x00000000, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(18096, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(18119, 0x00000000, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(18120, 0x00000000, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(18820, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(19184, 0x00000000, 9, 0x00000010, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(19572, 0x00000000, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(19573, 0x00000000, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(20049, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20056, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20057, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20128, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(20131, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(20132, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(20164, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5.000000, 0.000000, 0), -(20165, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,20.000000, 0.000000, 0), -(20166, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,15.000000, 0.000000, 0), -(20182, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(20210, 0x00000000, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20212, 0x00000000, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20213, 0x00000000, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20214, 0x00000000, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20215, 0x00000000, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20234, 0x00000000, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(20235, 0x00000000, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(20335, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000008, 0x00000100, 0x00000000, 0.000000, 100.000000,0), -(20375, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), -(20500, 0x00000000, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(20501, 0x00000000, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(20705, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20784, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20911, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(20925, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(21084, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(21185, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(21882, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(21890, 0x00000000, 4, 0x2A764EEF, 0x0000036C, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(22007, 0x00000000, 3, 0x00200021, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(22618, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(22648, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(23547, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), -(23548, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(23551, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(23552, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(23572, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(23578, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(23581, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(23602, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(23686, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(23688, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(23689, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), -(23695, 0x00000000, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(23721, 0x00000000, 9, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(23920, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(24353, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(24389, 0x00000000, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(24658, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00014110, 0x00000000, 0.000000, 0.000000, 0), -(24905, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,15.000000, 0.000000, 0), -(24932, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), -(25050, 0x00000004, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(25669, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), -(25988, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(26016, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(26107, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000064, 0.000000, 0.000000, 0), -(26119, 0x00000000, 10, 0x90100003, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(26128, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), -(26135, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(26480, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(26605, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(27419, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(27498, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(27521, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(27656, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(27774, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(27787, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(27811, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(27815, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(27816, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(28592, 0x00000010, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(28593, 0x00000010, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(28716, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00048000, 0x00000000, 0.000000, 0.000000, 0), -(28719, 0x00000000, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(28744, 0x00000000, 7, 0x00000040, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0.000000, 0.000000, 0), -(28752, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(28789, 0x00000000, 10, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(28802, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(28809, 0x00000000, 6, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(28812, 0x00000000, 8, 0x02000006, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(28816, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(28823, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(28847, 0x00000000, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(28849, 0x00000000, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(29074, 0x00000014, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29075, 0x00000014, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29076, 0x00000014, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29150, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29179, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29180, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29385, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), -(29441, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 1), -(29444, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 1), -(29455, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(29501, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29593, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(29594, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(29624, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29625, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29626, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29632, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29633, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29634, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29635, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29636, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29637, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29834, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(29838, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(29977, 0x00000000, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30003, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(30160, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(30293, 0x00000000, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30295, 0x00000000, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30296, 0x00000000, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30299, 0x0000007E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30301, 0x0000007E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30302, 0x0000007E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30675, 0x00000000, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30678, 0x00000000, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30679, 0x00000000, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30701, 0x0000001C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30705, 0x0000001C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30823, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10.500000, 0.000000, 0), -(30881, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30883, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30884, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30885, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30886, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30937, 0x00000020, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31124, 0x00000000, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31126, 0x00000000, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31244, 0x00000000, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00002034, 0.000000, 0.000000, 0), -(31394, 0x00000020, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31569, 0x00000000, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31570, 0x00000000, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31785, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00008800, 0x00000000, 0.000000, 0.000000, 0), -(31794, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(31801, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31833, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31835, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31836, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31871, 0x00000000, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(31872, 0x00000000, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(31876, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), -(31877, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), -(31878, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), -(31904, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(32385, 0x00000000, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(32587, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(32642, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(32734, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(32748, 0x00000000, 8, 0x00000000, 0x00000001, 0x00000000, 0x00000140, 0x00000000, 0.000000, 0.000000, 0), -(32776, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(32777, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(32837, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 45), -(32844, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(32885, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33076, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), -(33089, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(33127, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), -(33142, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33145, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33146, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33150, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33151, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33154, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33191, 0x00000000, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(33192, 0x00000000, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(33193, 0x00000000, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(33297, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(33299, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(33510, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5.000000, 0.000000, 0), -(33648, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33719, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(33746, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(33757, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(33759, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(33881, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33882, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33883, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33953, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 45), -(34074, 0x00000000, 9, 0x0007FA43, 0x00881081, 0x00000201, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(34080, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), -(34138, 0x00000000, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(34139, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(34258, 0x00000000, 10, 0x00000400, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(34262, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(34320, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), -(34355, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(34497, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34498, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34499, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34500, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34502, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34503, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34506, 0x00000000, 9, 0x0007FA01, 0x00801081, 0x08000201, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(34584, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(34586, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 0), -(34598, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(34749, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), -(34753, 0x00000000, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34774, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 20), -(34783, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(34827, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(34859, 0x00000000, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34860, 0x00000000, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34914, 0x00000000, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(34935, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), -(34938, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), -(34939, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), -(34950, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34954, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(35077, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(35080, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 60), -(35083, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(35086, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(35100, 0x00000000, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), -(35121, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(36096, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(36541, 0x00000004, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37165, 0x00000000, 8, 0x00200400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37168, 0x00000000, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37170, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), -(37173, 0x00000000, 8, 0x2CBC0598, 0x00000106, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(37189, 0x00000000, 10, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 60), -(37193, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(37195, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37197, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 45), -(37213, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(37214, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(37227, 0x00000000, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 60), -(37237, 0x00000000, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(37247, 0x00000008, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 45), -(37377, 0x00000020, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(37379, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37384, 0x00000000, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37443, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(37514, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), -(37516, 0x00000000, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37519, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0.000000, 0.000000, 0), -(37523, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(37528, 0x00000000, 4, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37536, 0x00000000, 4, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37568, 0x00000000, 6, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37594, 0x00000000, 6, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37600, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(37601, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(37603, 0x00000000, 6, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(37655, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(37657, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 3), -(38026, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), -(38031, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(38290, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.600000, 0.000000, 0), -(38299, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 12), -(38326, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(38327, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(38334, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(38347, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), -(38350, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(38394, 0x00000000, 5, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(38857, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(39027, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(39372, 0x00000030, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(39437, 0x00000004, 5, 0x00001364, 0x000000C0, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(39442, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0), -(39443, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(39530, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(39958, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.700000, 0.000000, 40), -(40407, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), -(40438, 0x00000000, 6, 0x00008040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40442, 0x00000000, 7, 0x00000014, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40444, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(40458, 0x00000000, 4, 0x02000000, 0x00000601, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40463, 0x00000000, 11, 0x00000081, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40470, 0x00000000, 10, 0xC0800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40475, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(40478, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40482, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(40485, 0x00000000, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(40899, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(41034, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), -(41260, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(41262, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(41381, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), -(41393, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), -(41434, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 45), -(41469, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), -(41635, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), -(41989, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.500000, 0.000000, 0), -(42083, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), -(42135, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 90), -(42136, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 90), -(42368, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(42370, 0x00000000, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(42770, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(43338, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(43443, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(43726, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43728, 0x00000000, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43737, 0x00000000, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(43739, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43741, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43745, 0x00000000, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43748, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43750, 0x00000000, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(43819, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(44404, 0x00000000, 3, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44442, 0x00000000, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), -(44443, 0x00000000, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), -(44445, 0x00000000, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44446, 0x00000000, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44448, 0x00000000, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44449, 0x00000000, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44469, 0x00000000, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44470, 0x00000000, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44471, 0x00000000, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44472, 0x00000000, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44546, 0x00000000, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44548, 0x00000000, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44549, 0x00000000, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44835, 0x00000000, 7, 0x00000000, 0x00000080, 0x00000000, 0x00000010, 0x00000000, 0.000000, 0.000000, 0), -(45054, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), -(45057, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(45234, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(45243, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(45244, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(45354, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(45355, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(45481, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(45482, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(45483, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(45484, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 45), -(46025, 0x00000020, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46092, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46098, 0x00000000, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46569, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(46662, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 20), -(46832, 0x00000000, 7, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(46854, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(46855, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(46867, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(46913, 0x00000000, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46916, 0x00000000, 4, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(46951, 0x00000000, 4, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46952, 0x00000000, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46953, 0x00000000, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47195, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(47196, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(47197, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(47201, 0x00000000, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47202, 0x00000000, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47203, 0x00000000, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47204, 0x00000000, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47205, 0x00000000, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47245, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47246, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47247, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47258, 0x00000000, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47259, 0x00000000, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47260, 0x00000000, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47263, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), -(47264, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), -(47265, 0x00000020, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), -(47509, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(47511, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(47515, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(47516, 0x00000000, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47517, 0x00000000, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47569, 0x00000000, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(47580, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47581, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47582, 0x00000000, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(48110, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), -(48111, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), -(48483, 0x00000000, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48484, 0x00000000, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48485, 0x00000000, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48496, 0x00000000, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(48499, 0x00000000, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(48500, 0x00000000, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(48506, 0x00000000, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48510, 0x00000000, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48511, 0x00000000, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48516, 0x00000000, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), -(48521, 0x00000000, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), -(48525, 0x00000000, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), -(48539, 0x00000000, 7, 0x00000010, 0x04000000, 0x00000000, 0x00040000, 0x00000000, 0.000000, 0.000000, 0), -(48833, 0x00000000, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48835, 0x00000000, 10, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48837, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48988, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(49018, 0x00000000, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(49188, 0x00000000, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(49208, 0x00000000, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(49222, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(49503, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(49504, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(49529, 0x00000000, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(49530, 0x00000000, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(49622, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(50781, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), -(50880, 0x00000010, 15, 0x00000000, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51123, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51127, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51128, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51129, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51130, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51346, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(51349, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(51352, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(51359, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), -(51414, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(51470, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51474, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(51478, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(51479, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(51521, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), -(51528, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,12.500000, 0.000000, 0), -(51556, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51557, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51558, 0x00000000, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51562, 0x00000000, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51563, 0x00000000, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51564, 0x00000000, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51565, 0x00000000, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51566, 0x00000000, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51625, 0x00000000, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51626, 0x00000000, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51627, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(51628, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(51629, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(51634, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51635, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51636, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51664, 0x00000000, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51665, 0x00000000, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51667, 0x00000000, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51668, 0x00000000, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51669, 0x00000000, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51672, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 1), -(51674, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 1), -(51679, 0x00000000, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51692, 0x00000000, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51696, 0x00000000, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51698, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), -(51700, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), -(51701, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), -(51940, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), -(51989, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), -(52004, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), -(52005, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), -(52007, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), -(52008, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), -(52020, 0x00000000, 7, 0x00008000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52127, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(52420, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(52423, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), -(53527, 0x00000000, 10, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52795, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52797, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52798, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52799, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52800, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52898, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53215, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53216, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53217, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53221, 0x00000000, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53222, 0x00000000, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53224, 0x00000000, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53228, 0x00000000, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53232, 0x00000000, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53234, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53237, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53238, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53256, 0x00000000, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53259, 0x00000000, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53260, 0x00000000, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53290, 0x00000000, 9, 0x00000800, 0x00000001, 0x00000200, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53380, 0x00000000, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53397, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53486, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53501, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53502, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53503, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53551, 0x00000000, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53552, 0x00000000, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53553, 0x00000000, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53569, 0x00000000, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53576, 0x00000000, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53601, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 6), -(53646, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53671, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53673, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53709, 0x00000000, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), -(53817, 0x00000000, 11, 0x000001C3, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54149, 0x00000000, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(54151, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54154, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54155, 0x00000000, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54278, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(54486, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54488, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54489, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54490, 0x00000000, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54646, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(54695, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(54707, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(54738, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), -(54747, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(54749, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(54754, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54808, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), -(54838, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(54841, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 3), -(54937, 0x00000000, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54939, 0x00000000, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(55166, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(55380, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(55440, 0x00000000, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(55640, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(55666, 0x00000000, 15, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(55677, 0x00000000, 6, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(55680, 0x00000000, 6, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(55689, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(55747, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(55768, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(55776, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(56218, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56342, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56343, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56344, 0x00000000, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56355, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(56364, 0x00000000, 3, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56372, 0x00000000, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(56375, 0x00000000, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), -(56451, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(56611, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56612, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56613, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56614, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56636, 0x00000000, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(56816, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0.000000, 0.000000, 0), -(56821, 0x00000000, 8, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56834, 0x00000000, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56835, 0x00000000, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(57345, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(57352, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00010154, 0x00000003, 0.000000, 0.000000, 45), -(57470, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(57472, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(57499, 0x00000000, 4, 0x40000001, 0x00010000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0), -(57870, 0x00000000, 9, 0x00800000, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0.000000, 0.000000, 0), -(57878, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), -(57880, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), -(57881, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), -(57989, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0.000000, 0.000000, 0), -(58357, 0x00000000, 4, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(58364, 0x00000000, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58372, 0x00000000, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58386, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), -(58442, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), -(58444, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(58597, 0x00000000, 10, 0x40000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000, 0.000000, 100.000000,6), -(58616, 0x00000000, 15, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58620, 0x00000000, 15, 0x00000000, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58626, 0x00000000, 15, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58644, 0x00000000, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58647, 0x00000000, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(58677, 0x00000000, 15, 0x00002000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(58872, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(58874, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(58901, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), -(59176, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(59327, 0x00000000, 15, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(59345, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(59630, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(59725, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), -(60061, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60063, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60066, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60132, 0x00000000, 15, 0x00000000, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60170, 0x00000000, 5, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60172, 0x00000000, 5, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(60221, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60301, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60306, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60317, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60436, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60442, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60473, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60482, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60487, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), -(60490, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60493, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60503, 0x00000000, 4, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60519, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60529, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(60537, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), -(60564, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60571, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60572, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60573, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60574, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60575, 0x00000000, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60617, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), -(60710, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60717, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60719, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60722, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60724, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60726, 0x00000000, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60770, 0x00000000, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60818, 0x00000000, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(60826, 0x00000000, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(61062, 0x00000000, 3, 0x00000000, 0x00000100, 0x00000000, 0x00004000, 0x00010000, 0.000000, 0.000000, 0), -(61188, 0x00000000, 5, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(61257, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000202A8, 0x00010000, 0.000000, 0.000000, 0), -(61324, 0x00000000, 10, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(61345, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(61346, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(61356, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x000002A8, 0x00000002, 0.000000, 0.000000, 45), -(61618, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(61846, 0x00000000, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(62600, 0x00000000, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(63108, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(63156, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(63280, 0x00000000, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), -(63320, 0x00000000, 5, 0x00040000, 0x00000000, 0x00008000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), -(63373, 0x00000000, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), -(63534, 0x00000000, 6, 0x00000040, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(63611, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00050014, 0x00000000, 0.000000, 0.000000, 0), -(63625, 0x00000000, 6, 0x02000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), -(63730, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(64928, 0x00000000, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(64976, 0x00000000, 4, 0x00000001, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), -(65661, 0x00000000, 15, 0x00400011 ,0x20020004 ,0x00000000, 0x00000010, 0x00000000, 0.000000, 100.000000,0), -(64127, 0x00000000, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(67228, 0x00000004, 11, 0x00000000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(67353, 0x00000000, 7, 0x00008000, 0x00100500, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(67361, 0x00000040, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(67667, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(67672, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 50), -(67702, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(67771, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(70664, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), -(70748, 0x00000000, 3, 0x00000000, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0); +( 324, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +( 974, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +( 3232, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +( 5952, 0x00, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +( 6346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), +( 7383, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), +( 7434, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +( 8178, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +( 9452, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +( 9782, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +( 9784, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +( 9799, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(11095, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(11119, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(11120, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(11129, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(11180, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(11185, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), +(11255, 0x00, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12169, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(12281, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(12289, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12298, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(12311, 0x00, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12317, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12319, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12322, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(12487, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), +(12488, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), +(12598, 0x00, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12668, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12724, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(12725, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(12726, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(12727, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(12797, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12799, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12812, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(12813, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(12814, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(12815, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(12834, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12846, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12847, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12848, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12849, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12867, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12872, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12873, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12958, 0x00, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(12966, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(12967, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(12968, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(12969, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(12970, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(12971, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12972, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12973, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12974, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(12999, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), +(13000, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), +(13001, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 8.000000, 0.000000, 0), +(13002, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,10.000000, 0.000000, 0), +(13045, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(13046, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(13047, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(13048, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(13165, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(13754, 0x00, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(13867, 0x00, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(13983, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), +(14070, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), +(14071, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), +(14156, 0x00, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(14160, 0x00, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(14161, 0x00, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(14186, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14190, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14193, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14194, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14195, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14531, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(14892, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(15088, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(15128, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(15277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), +(15286, 0x20, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(15337, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(15338, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(15346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), +(15362, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(15363, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(15600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), +(16164, 0x1C, 11, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000002, 0.000000, 0.000000, 0), +(16176, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16180, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16196, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16235, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16240, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16256, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(16277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(16278, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(16279, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(16280, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(16281, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16282, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16283, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16284, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16487, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16489, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16492, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16550, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16620, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(16624, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(16850, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(16864, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(16880, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16923, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(16924, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(16952, 0x00, 7, 0x00039000, 0x00000400, 0x00040000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16954, 0x00, 7, 0x00039000, 0x00000400, 0x00040000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16958, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16961, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(17106, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(17107, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(17108, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(17364, 0x08, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(17495, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(17793, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(17796, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(17801, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(17802, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(17803, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(18073, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(18094, 0x00, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(18095, 0x00, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(18096, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(18119, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(18120, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(18820, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(19184, 0x00, 9, 0x00000010, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(19572, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(19573, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(20049, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20056, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(20131, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(20132, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(20164, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5.000000, 0.000000, 0), +(20165, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,20.000000, 0.000000, 0), +(20166, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,15.000000, 0.000000, 0), +(20182, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(20210, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20212, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20213, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20214, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20215, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20234, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(20235, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(20335, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00000100, 0x00000000, 0.000000, 100.000000,0), +(20375, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), +(20500, 0x00, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(20501, 0x00, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(20705, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20784, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(20911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(20925, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(21084, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(21185, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(21882, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(21890, 0x00, 4, 0x2A764EEF, 0x0000036C, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(22007, 0x00, 3, 0x00200021, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(22618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(22648, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(23547, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), +(23548, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(23551, 0x00, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(23552, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(23572, 0x00, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(23578, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(23581, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(23602, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(23686, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(23688, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(23689, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), +(23695, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(23721, 0x00, 9, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(23920, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(24353, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(24389, 0x00, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(24658, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00014110, 0x00000000, 0.000000, 0.000000, 0), +(24905, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,15.000000, 0.000000, 0), +(24932, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), +(25050, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(25669, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), +(25988, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(26016, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(26107, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000064, 0.000000, 0.000000, 0), +(26119, 0x00, 10, 0x90100003, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(26128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), +(26135, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(26480, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(26605, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(27419, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(27498, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(27521, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(27656, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(27774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(27787, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(27811, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(27815, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(27816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(28592, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(28593, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(28716, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00048000, 0x00000000, 0.000000, 0.000000, 0), +(28719, 0x00, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(28744, 0x00, 7, 0x00000040, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0.000000, 0.000000, 0), +(28752, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(28789, 0x00, 10, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(28802, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(28809, 0x00, 6, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(28812, 0x00, 8, 0x02000006, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(28816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(28823, 0x00, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(28847, 0x00, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(28849, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(29074, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(29075, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(29076, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(29150, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29179, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(29180, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(29385, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), +(29441, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 1), +(29444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 1), +(29455, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(29501, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29593, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(29594, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(29624, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29625, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29626, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29632, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29633, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29634, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29636, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29637, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(29834, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(29838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(29977, 0x00, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30003, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(30160, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(30293, 0x00, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30295, 0x00, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30296, 0x00, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30299, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30301, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30302, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30675, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30678, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30679, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30701, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30705, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(30823, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10.500000, 0.000000, 0), +(30881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(30883, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(30884, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(30885, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(30886, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(30937, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31124, 0x00, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31126, 0x00, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31244, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00002034, 0.000000, 0.000000, 0), +(31394, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31569, 0x00, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31570, 0x00, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31785, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00008800, 0x00000000, 0.000000, 0.000000, 0), +(31794, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(31801, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31833, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31835, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31836, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31871, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(31872, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(31876, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), +(31877, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), +(31878, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), +(31904, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(32385, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(32587, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(32642, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(32734, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(32748, 0x00, 8, 0x00000000, 0x00000001, 0x00000000, 0x00000140, 0x00000000, 0.000000, 0.000000, 0), +(32776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(32777, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(32837, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 45), +(32844, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), +(32885, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33076, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), +(33089, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(33127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), +(33142, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33145, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33146, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33150, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33151, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33154, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33191, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(33192, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(33193, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(33297, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(33299, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(33510, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5.000000, 0.000000, 0), +(33648, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33719, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(33746, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(33757, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(33759, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(33881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33882, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33883, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(33953, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 45), +(34074, 0x00, 9, 0x0007FA43, 0x00881081, 0x00000201, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(34080, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), +(34138, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(34139, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(34258, 0x00, 10, 0x00000400, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(34262, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(34320, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), +(34355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(34497, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34498, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34499, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34500, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34502, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34506, 0x00, 9, 0x0007FA01, 0x00801081, 0x08000201, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(34584, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(34586, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 0), +(34598, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(34749, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), +(34753, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 20), +(34783, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(34827, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(34859, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34860, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34914, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(34935, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), +(34938, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), +(34939, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), +(34950, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(34954, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(35077, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(35080, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 60), +(35083, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(35086, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(35100, 0x00, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), +(35121, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(36096, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(36541, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37165, 0x00, 8, 0x00200400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37168, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37170, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), +(37173, 0x00, 8, 0x2CBC0598, 0x00000106, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(37189, 0x00, 10, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 60), +(37193, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(37195, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37197, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 45), +(37213, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(37214, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(37227, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 60), +(37237, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(37247, 0x08, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 45), +(37377, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(37379, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37384, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37443, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(37514, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), +(37516, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37519, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0.000000, 0.000000, 0), +(37523, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(37528, 0x00, 4, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37536, 0x00, 4, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37568, 0x00, 6, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37594, 0x00, 6, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(37601, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(37603, 0x00, 6, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(37655, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(37657, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 3), +(38026, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), +(38031, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(38290, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.600000, 0.000000, 0), +(38299, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 12), +(38326, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(38327, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(38334, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(38347, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), +(38350, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(38394, 0x00, 5, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(38857, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(39027, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(39372, 0x30, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(39437, 0x04, 5, 0x00001364, 0x000000C0, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(39442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0), +(39443, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(39530, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(39958, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.700000, 0.000000, 40), +(40407, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), +(40438, 0x00, 6, 0x00008040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40442, 0x00, 7, 0x00000014, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(40458, 0x00, 4, 0x02000000, 0x00000601, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40463, 0x00, 11, 0x00000081, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40470, 0x00, 10, 0xC0800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40475, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), +(40478, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(40485, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(40899, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(41034, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), +(41260, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(41262, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(41381, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), +(41393, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), +(41434, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 45), +(41469, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), +(41635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), +(41989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.500000, 0.000000, 0), +(42083, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), +(42135, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 90), +(42136, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 90), +(42368, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(42370, 0x00, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(42770, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(43338, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(43443, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(43726, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43728, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43737, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(43739, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43741, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43745, 0x00, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43748, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43750, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(43819, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(44404, 0x00, 3, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44442, 0x00, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), +(44443, 0x00, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), +(44445, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44446, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44448, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44449, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(44469, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(44470, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(44471, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(44472, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(44546, 0x00, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44548, 0x00, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44549, 0x00, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(44835, 0x00, 7, 0x00000000, 0x00000080, 0x00000000, 0x00000010, 0x00000000, 0.000000, 0.000000, 0), +(45054, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), +(45057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(45234, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(45243, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(45244, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(45354, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(45355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(45481, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(45482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(45483, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(45484, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 45), +(46025, 0x20, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(46092, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(46098, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(46569, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(46662, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 20), +(46832, 0x00, 7, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(46854, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(46855, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(46867, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(46913, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(46916, 0x00, 4, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(46951, 0x00, 4, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(46952, 0x00, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(46953, 0x00, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47195, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(47196, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(47197, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(47201, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(47202, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47203, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47204, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47205, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47245, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47246, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47247, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47258, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(47259, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(47260, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(47263, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), +(47264, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), +(47265, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), +(47509, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(47511, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(47515, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(47516, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47517, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(47580, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(47581, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(47582, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(48110, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), +(48111, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), +(48483, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48484, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48485, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48496, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(48499, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(48500, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(48506, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48510, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48511, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48516, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), +(48521, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), +(48525, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), +(48539, 0x00, 7, 0x00000010, 0x04000000, 0x00000000, 0x00040000, 0x00000000, 0.000000, 0.000000, 0), +(48833, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48835, 0x00, 10, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48837, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(48988, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(49018, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(49188, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(49208, 0x00, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(49222, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(49503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(49504, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(49529, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(49530, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(49622, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(50781, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), +(50880, 0x10, 15, 0x00000000, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51123, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51129, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51130, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(51349, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(51352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(51359, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), +(51414, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(51470, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51474, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(51478, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(51479, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(51483, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(51485, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(51486, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(51521, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), +(51528, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,12.500000, 0.000000, 0), +(51556, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51557, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51558, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51562, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51563, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51564, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51565, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51566, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51625, 0x00, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51626, 0x00, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51627, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(51628, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(51629, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(51634, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51636, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51664, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51665, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51667, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51668, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51669, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 1), +(51674, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 1), +(51679, 0x00, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(51692, 0x00, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51696, 0x00, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(51698, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), +(51700, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), +(51701, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), +(51940, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), +(51989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), +(52004, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), +(52005, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), +(52007, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), +(52008, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), +(52020, 0x00, 7, 0x00008000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(52420, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), +(52423, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), +(53527, 0x00, 10, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52795, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52797, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52798, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52799, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52800, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(52898, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53215, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53216, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53217, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53221, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53222, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53224, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53228, 0x00, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53232, 0x00, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53234, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53237, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53238, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53256, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53259, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53260, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53290, 0x00, 9, 0x00000800, 0x00000001, 0x00000200, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53380, 0x00, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53397, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53486, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53501, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53502, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53551, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53552, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53553, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53569, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53576, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53601, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 6), +(53646, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53671, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53673, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(53709, 0x00, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), +(53817, 0x00, 11, 0x000001C3, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(54151, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54154, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54155, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54278, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(54486, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54488, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54489, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54490, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54646, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(54695, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(54707, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(54738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), +(54747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(54749, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54808, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(54838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(54841, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 3), +(54937, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54939, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55166, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(55380, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(55440, 0x00, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55640, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(55666, 0x00, 15, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55677, 0x00, 6, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55680, 0x00, 6, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(55689, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(55747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(55768, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(55776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(56218, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56342, 0x00, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56343, 0x00, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56344, 0x00, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(56364, 0x00, 3, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56372, 0x00, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(56375, 0x00, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), +(56451, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), +(56611, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(56612, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(56613, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(56614, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(56636, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(56816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0.000000, 0.000000, 0), +(56821, 0x00, 8, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(56834, 0x00, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(56835, 0x00, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(57345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(57352, 0x00, 0, 0x00000001, 0x00000040, 0x00000000, 0x00010154, 0x00000003, 0.000000, 0.000000, 45), +(57470, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(57472, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(57499, 0x00, 4, 0x40000001, 0x00010000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0), +(57870, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0.000000, 0.000000, 0), +(57878, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), +(57880, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), +(57881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), +(57989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0.000000, 0.000000, 0), +(58357, 0x00, 4, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(58364, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58372, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58386, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), +(58442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), +(58444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(58597, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000, 0.000000, 100.000000,6), +(58616, 0x00, 15, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58620, 0x00, 15, 0x00000000, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58626, 0x00, 15, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58644, 0x00, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58647, 0x00, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(58677, 0x00, 15, 0x00002000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(58872, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(58874, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), +(58901, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), +(59176, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(59327, 0x00, 15, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(59345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(59630, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(59725, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(60061, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60063, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60066, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60132, 0x00, 15, 0x00000000, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60170, 0x00, 5, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60172, 0x00, 5, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(60221, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60301, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60306, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60317, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60436, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60473, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60487, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), +(60490, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60493, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60503, 0x00, 4, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60519, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60529, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60537, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), +(60564, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60571, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60572, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60573, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60574, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60575, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60617, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), +(60710, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60717, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60719, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60722, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60724, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60726, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60770, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60818, 0x00, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60826, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(61062, 0x00, 3, 0x00000000, 0x00000100, 0x00000000, 0x00004000, 0x00010000, 0.000000, 0.000000, 0), +(61188, 0x00, 5, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(61257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000202A8, 0x00010000, 0.000000, 0.000000, 0), +(61324, 0x00, 10, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(61345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000002A8, 0x00000002, 0.000000, 0.000000, 45), +(61618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(61846, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(62600, 0x00, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(63108, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(63156, 0x00, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(63245, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(63280, 0x00, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), +(63320, 0x00, 5, 0x00040000, 0x00000000, 0x00008000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), +(63373, 0x00, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), +(63534, 0x00, 6, 0x00000040, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(63611, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00050014, 0x00000000, 0.000000, 0.000000, 0), +(63625, 0x00, 6, 0x02000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), +(63730, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(64928, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(64976, 0x00, 4, 0x00000001, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), +(65661, 0x00, 15, 0x00400011 ,0x20020004 ,0x00000000, 0x00000010, 0x00000000, 0.000000, 100.000000,0), +(64127, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(67228, 0x04, 11, 0x00000000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(67353, 0x00, 7, 0x00008000, 0x00100500, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(67361, 0x40, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), +(67667, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(67672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 50), +(67702, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(67771, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(70664, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), +(70748, 0x00, 3, 0x00000000, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0); /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/10017_01_mangos_spell_proc_event.sql b/sql/updates/10017_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..e00c87e4a --- /dev/null +++ b/sql/updates/10017_01_mangos_spell_proc_event.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_10015_01_mangos_spell_proc_event required_10017_01_mangos_spell_proc_event bit; + +ALTER TABLE spell_proc_event + CHANGE COLUMN `SchoolMask` `SchoolMask` tinyint(4) unsigned NOT NULL default '0'; + + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 6828d4515..a65e1a199 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -81,6 +81,7 @@ pkgdata_DATA = \ 10011_01_mangos_spell_proc_event.sql \ 10012_01_mangos_spell_proc_event.sql \ 10015_01_mangos_spell_proc_event.sql \ + 10017_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -142,4 +143,5 @@ EXTRA_DIST = \ 10011_01_mangos_spell_proc_event.sql \ 10012_01_mangos_spell_proc_event.sql \ 10015_01_mangos_spell_proc_event.sql \ + 10017_01_mangos_spell_proc_event.sql \ README diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ac4949acf..06fd95777 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10016" + #define REVISION_NR "10017" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 6c809c056..2164cc3d0 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_10015_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_10017_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ From 1750f61d739a960e48dd062a87a7df052efa1768 Mon Sep 17 00:00:00 2001 From: Laise Date: Tue, 1 Jun 2010 09:01:46 +0300 Subject: [PATCH 146/172] [10018] Add 16246 proc to mangos.sql --- sql/mangos.sql | 7 ++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sql/mangos.sql b/sql/mangos.sql index 3ac9c85fa..48efb3c3d 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -18034,6 +18034,7 @@ INSERT INTO `spell_proc_event` VALUES (16198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16235, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16240, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(16246, 0x00, 11, 0x981001C3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (16256, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (16277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), @@ -18709,7 +18710,7 @@ INSERT INTO `spell_proc_event` VALUES (63108, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63156, 0x00, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63245, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(63280, 0x00, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), +(63280, 0x00, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63320, 0x00, 5, 0x00040000, 0x00000000, 0x00008000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), (63373, 0x00, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), (63534, 0x00, 6, 0x00000040, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), @@ -18727,8 +18728,8 @@ INSERT INTO `spell_proc_event` VALUES (67672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 50), (67702, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (67771, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(70664, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0), -(70748, 0x00, 3, 0x00000000, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 0.000000, 0); +(70664, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(70748, 0x00, 3, 0x00000000, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; UNLOCK TABLES; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 06fd95777..9ca350f38 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10017" + #define REVISION_NR "10018" #endif // __REVISION_NR_H__ From 57ca730a2ff3ef5834f299a1090f81aa66833d4e Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 2 Jun 2010 03:42:12 +0400 Subject: [PATCH 147/172] [10019] Implement glyph 45623. Thanks to Most_Mangos, DonTomika, darkstalker for dollution research. --- src/game/SpellAuras.cpp | 9 +++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 876526a10..ff6cb5885 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6391,6 +6391,15 @@ void Aura::HandleSpellSpecificBoosts(bool apply) } break; } + case SPELLFAMILY_DRUID: + { + // Barkskin + if (GetId()==22812 && m_target->HasAura(63057)) // Glyph of Barkskin + spellId1 = 63058; // Glyph - Barkskin 01 + else + return; + break; + } case SPELLFAMILY_ROGUE: // Sprint (skip non player casted spells by category) if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000040) && GetSpellProto()->Category == 44) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9ca350f38..6e0e71efb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10018" + #define REVISION_NR "10019" #endif // __REVISION_NR_H__ From d6c5207867221f1b5125a8d8d4f613ce9d0b560c Mon Sep 17 00:00:00 2001 From: SilverIce Date: Wed, 2 Jun 2010 09:36:52 +0400 Subject: [PATCH 148/172] [10020] Drop unused member in VisibleNotifier structure and related functions (based on SilverIce's repo commit e678555) Signed-off-by: VladimirMangos Also applied mangos code style to GridNotifiersImpl.h --- src/game/GridNotifiers.cpp | 13 +- src/game/GridNotifiers.h | 1 - src/game/GridNotifiersImpl.h | 242 +++++++++++++++++------------------ src/game/Player.cpp | 12 +- src/game/Player.h | 2 +- src/shared/revision_nr.h | 2 +- 6 files changed, 127 insertions(+), 145 deletions(-) diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index 390ac7121..30d977c40 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -53,7 +53,7 @@ VisibleNotifier::Notify() { // ignore far sight case (*itr)->UpdateVisibilityOf((*itr),&i_player); - i_player.UpdateVisibilityOf(&i_player,(*itr),i_data,i_data_updates,i_visibleNow); + i_player.UpdateVisibilityOf(&i_player,(*itr),i_data,i_visibleNow); i_clientGUIDs.erase((*itr)->GetGUID()); } } @@ -68,17 +68,6 @@ VisibleNotifier::Notify() DEBUG_FILTER_LOG(LOG_FILTER_VISIBILITY_CHANGES, "%s is out of range (no in active cells set) now for player %u",itr->GetString().c_str(),i_player.GetGUIDLow()); } - // send update to other players (except player updates that already sent using SendUpdateToPlayer) - for(UpdateDataMapType::iterator iter = i_data_updates.begin(); iter != i_data_updates.end(); ++iter) - { - if(iter->first==&i_player) - continue; - - WorldPacket packet; - iter->second.BuildPacket(&packet); - iter->first->GetSession()->SendPacket(&packet); - } - if( i_data.HasData() ) { // send create/outofrange packet to player (except player create updates that already sent using SendUpdateToPlayer) diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 46b51eb95..cd7614352 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -40,7 +40,6 @@ namespace MaNGOS { Player &i_player; UpdateData i_data; - UpdateDataMapType i_data_updates; ObjectGuidSet i_clientGUIDs; std::set i_visibleNow; diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 10f6daf1b..192d52f5d 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -29,39 +29,36 @@ #include "DBCEnums.h" template -inline void -MaNGOS::VisibleNotifier::Visit(GridRefManager &m) +inline void MaNGOS::VisibleNotifier::Visit(GridRefManager &m) { WorldObject const* viewPoint = i_player.GetViewPoint(); for(typename GridRefManager::iterator iter = m.begin(); iter != m.end(); ++iter) { - i_player.UpdateVisibilityOf(viewPoint,iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_player.UpdateVisibilityOf(viewPoint,iter->getSource(), i_data, i_visibleNow); i_clientGUIDs.erase(iter->getSource()->GetGUID()); } } -inline void -MaNGOS::ObjectUpdater::Visit(CreatureMapType &m) +inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType &m) { - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) iter->getSource()->Update(i_timeDiff); } -inline void -MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m) +inline void MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m) { - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - if(&i_player==iter->getSource()) + if (&i_player==iter->getSource()) continue; // visibility for players updated by ObjectAccessor::UpdateVisibilityFor calls in appropriate places // Cancel Trade - if(i_player.GetTrader()==iter->getSource()) + if (i_player.GetTrader()==iter->getSource()) // iteraction distance - if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) + if (!i_player.IsWithinDistInMap(iter->getSource(), INTERACTION_DISTANCE)) i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows } } @@ -72,44 +69,42 @@ inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPo pl->UpdateVisibilityOf(viewPoint,c); // Creature AI reaction - if(!c->hasUnitState(UNIT_STAT_FLEEING)) + if (!c->hasUnitState(UNIT_STAT_FLEEING)) { - if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() ) + if (c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode()) c->AI()->MoveInLineOfSight(pl); } } inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) { - if(!c1->hasUnitState(UNIT_STAT_FLEEING)) + if (!c1->hasUnitState(UNIT_STAT_FLEEING)) { - if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() ) + if (c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode()) c1->AI()->MoveInLineOfSight(c2); } - if(!c2->hasUnitState(UNIT_STAT_FLEEING)) + if (!c2->hasUnitState(UNIT_STAT_FLEEING)) { - if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() ) + if (c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode()) c2->AI()->MoveInLineOfSight(c1); } } -inline void -MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) +inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) { - if(!i_player.isAlive() || i_player.isInFlight()) + if (!i_player.isAlive() || i_player.isInFlight()) return; WorldObject const* viewPoint = i_player.GetViewPoint(); - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->getSource()->isAlive()) - PlayerCreatureRelocationWorker(&i_player,viewPoint,iter->getSource()); + PlayerCreatureRelocationWorker(&i_player, viewPoint, iter->getSource()); } template<> -inline void -MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) +inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) { if(!i_creature.isAlive()) return; @@ -121,26 +116,25 @@ MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) } template<> -inline void -MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m) +inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m) { - if(!i_creature.isAlive()) + if (!i_creature.isAlive()) return; - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->getSource(); - if( c != &i_creature && c->isAlive()) + if (c != &i_creature && c->isAlive()) CreatureCreatureRelocationWorker(c, &i_creature); } } inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) { - if(!target->isAlive() || target->isInFlight() ) + if (!target->isAlive() || target->isInFlight() ) return; - if(target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isTotem()) + if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem()) return; if (!i_dynobject.IsWithinDistInMap(target, i_dynobject.GetRadius())) @@ -151,14 +145,14 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) return; // Evade target - if( target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->IsInEvadeMode() ) + if (target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->IsInEvadeMode()) return; //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) - if( target->GetTypeId()==TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) ) + if (target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility() == VISIBILITY_OFF)) return; - if (i_check->GetTypeId()==TYPEID_PLAYER ) + if (i_check->GetTypeId() == TYPEID_PLAYER ) { if (i_check->IsFriendlyTo( target )) return; @@ -174,9 +168,11 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId()); SpellEffectIndex eff_index = i_dynobject.GetEffIndex(); + // Check target immune to spell or aura if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index)) return; + // Apply PersistentAreaAura on target PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster()); target->AddAura(Aur); @@ -184,18 +180,16 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) } template<> -inline void -MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m) +inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) VisitHelper(itr->getSource()); } template<> -inline void -MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m) +inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m) { - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) VisitHelper(itr->getSource()); } @@ -207,12 +201,12 @@ template void MaNGOS::WorldObjectSearcher::Visit(GameObjectMapType &m) { // already found - if(i_object) + if (i_object) return; - for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; if (i_check(itr->getSource())) @@ -227,15 +221,15 @@ template void MaNGOS::WorldObjectSearcher::Visit(PlayerMapType &m) { // already found - if(i_object) + if (i_object) return; - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -247,15 +241,15 @@ template void MaNGOS::WorldObjectSearcher::Visit(CreatureMapType &m) { // already found - if(i_object) + if (i_object) return; - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -267,15 +261,15 @@ template void MaNGOS::WorldObjectSearcher::Visit(CorpseMapType &m) { // already found - if(i_object) + if (i_object) return; - for(CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -287,15 +281,15 @@ template void MaNGOS::WorldObjectSearcher::Visit(DynamicObjectMapType &m) { // already found - if(i_object) + if (i_object) return; - for(DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -306,45 +300,45 @@ void MaNGOS::WorldObjectSearcher::Visit(DynamicObjectMapType &m) template void MaNGOS::WorldObjectListSearcher::Visit(PlayerMapType &m) { - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } template void MaNGOS::WorldObjectListSearcher::Visit(CreatureMapType &m) { - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } template void MaNGOS::WorldObjectListSearcher::Visit(CorpseMapType &m) { - for(CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } template void MaNGOS::WorldObjectListSearcher::Visit(GameObjectMapType &m) { - for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } template void MaNGOS::WorldObjectListSearcher::Visit(DynamicObjectMapType &m) { - for(DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } @@ -354,15 +348,15 @@ template void MaNGOS::GameObjectSearcher::Visit(GameObjectMapType &m) { // already found - if(i_object) + if (i_object) return; - for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -373,12 +367,12 @@ void MaNGOS::GameObjectSearcher::Visit(GameObjectMapType &m) template void MaNGOS::GameObjectLastSearcher::Visit(GameObjectMapType &m) { - for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) i_object = itr->getSource(); } } @@ -386,9 +380,9 @@ void MaNGOS::GameObjectLastSearcher::Visit(GameObjectMapType &m) template void MaNGOS::GameObjectListSearcher::Visit(GameObjectMapType &m) { - for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } @@ -398,15 +392,15 @@ template void MaNGOS::UnitSearcher::Visit(CreatureMapType &m) { // already found - if(i_object) + if (i_object) return; - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -418,15 +412,15 @@ template void MaNGOS::UnitSearcher::Visit(PlayerMapType &m) { // already found - if(i_object) + if (i_object) return; - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -437,12 +431,12 @@ void MaNGOS::UnitSearcher::Visit(PlayerMapType &m) template void MaNGOS::UnitLastSearcher::Visit(CreatureMapType &m) { - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) i_object = itr->getSource(); } } @@ -450,12 +444,12 @@ void MaNGOS::UnitLastSearcher::Visit(CreatureMapType &m) template void MaNGOS::UnitLastSearcher::Visit(PlayerMapType &m) { - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) i_object = itr->getSource(); } } @@ -463,18 +457,18 @@ void MaNGOS::UnitLastSearcher::Visit(PlayerMapType &m) template void MaNGOS::UnitListSearcher::Visit(PlayerMapType &m) { - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } template void MaNGOS::UnitListSearcher::Visit(CreatureMapType &m) { - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if(i_check(itr->getSource())) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } @@ -484,15 +478,15 @@ template void MaNGOS::CreatureSearcher::Visit(CreatureMapType &m) { // already found - if(i_object) + if (i_object) return; - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -503,12 +497,12 @@ void MaNGOS::CreatureSearcher::Visit(CreatureMapType &m) template void MaNGOS::CreatureLastSearcher::Visit(CreatureMapType &m) { - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) i_object = itr->getSource(); } } @@ -516,9 +510,9 @@ void MaNGOS::CreatureLastSearcher::Visit(CreatureMapType &m) template void MaNGOS::CreatureListSearcher::Visit(CreatureMapType &m) { - for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) - if(itr->getSource()->InSamePhase(i_phaseMask)) - if( i_check(itr->getSource())) + for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(i_phaseMask)) + if (i_check(itr->getSource())) i_objects.push_back(itr->getSource()); } @@ -526,15 +520,15 @@ template void MaNGOS::PlayerSearcher::Visit(PlayerMapType &m) { // already found - if(i_object) + if (i_object) return; - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) { - if(!itr->getSource()->InSamePhase(i_phaseMask)) + if (!itr->getSource()->InSamePhase(i_phaseMask)) continue; - if(i_check(itr->getSource())) + if (i_check(itr->getSource())) { i_object = itr->getSource(); return; @@ -550,14 +544,14 @@ void MaNGOS::LocalizedPacketDo::operator()( Player* p ) WorldPacket* data; // create if not cached yet - if(i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx]) + if (i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx]) { - if(i_data_cache.size() < cache_idx+1) + if (i_data_cache.size() < cache_idx+1) i_data_cache.resize(cache_idx+1); data = new WorldPacket(SMSG_MESSAGECHAT, 200); - i_builder(*data,loc_idx); + i_builder(*data, loc_idx); i_data_cache[cache_idx] = data; } @@ -575,14 +569,14 @@ void MaNGOS::LocalizedPacketListDo::operator()( Player* p ) WorldPacketList* data_list; // create if not cached yet - if(i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty()) + if (i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty()) { - if(i_data_cache.size() < cache_idx+1) + if (i_data_cache.size() < cache_idx+1) i_data_cache.resize(cache_idx+1); data_list = &i_data_cache[cache_idx]; - i_builder(*data_list,loc_idx); + i_builder(*data_list, loc_idx); } else data_list = &i_data_cache[cache_idx]; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index bccc778ae..ebccec773 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19202,7 +19202,7 @@ inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, GameObject* target) } template -void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, UpdateDataMapType& /*data_updates*/, std::set& visibleNow) +void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, std::set& visibleNow) { if(HaveAtClient(target)) { @@ -19231,11 +19231,11 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateD } } -template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Player* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Player* target, UpdateData& data, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Creature* target, UpdateData& data, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse* target, UpdateData& data, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, std::set& visibleNow); void Player::InitPrimaryProfessions() { diff --git a/src/game/Player.h b/src/game/Player.h index 0e4f35e90..371ed886f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2201,7 +2201,7 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* target); template - void UpdateVisibilityOf(WorldObject const* viewPoint,T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); + void UpdateVisibilityOf(WorldObject const* viewPoint,T* target, UpdateData& data, std::set& visibleNow); // Stealth detection system void HandleStealthedUnitsDetection(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6e0e71efb..396d5b0f7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10019" + #define REVISION_NR "10020" #endif // __REVISION_NR_H__ From e823b30f4f8013072e84b761ea43b7d5d63d4b28 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 2 Jun 2010 14:55:47 +0400 Subject: [PATCH 149/172] [10021] Move item disenchanting static req. checks to server start. --- src/game/ItemHandler.cpp | 14 +++++++------- src/game/ItemPrototype.h | 2 +- src/game/ObjectMgr.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/game/Spell.cpp | 17 ++++++----------- src/shared/revision_nr.h | 2 +- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 2501be9c9..41796a76b 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -414,13 +414,13 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) data << pProto->Socket[s].Color; data << pProto->Socket[s].Content; } - data << pProto->socketBonus; - data << pProto->GemProperties; - data << pProto->RequiredDisenchantSkill; - data << pProto->ArmorDamageModifier; - data << pProto->Duration; // added in 2.4.2.8209, duration (seconds) - data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory - data << pProto->HolidayId; // Holiday.dbc? + data << uint32(pProto->socketBonus); + data << uint32(pProto->GemProperties); + data << int32(pProto->RequiredDisenchantSkill); + data << float(pProto->ArmorDamageModifier); + data << uint32(pProto->Duration); // added in 2.4.2.8209, duration (seconds) + data << uint32(pProto->ItemLimitCategory); // WotLK, ItemLimitCategory + data << uint32(pProto->HolidayId); // Holiday.dbc? SendPacket( &data ); } else diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 97300d914..053c68e7d 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -586,7 +586,7 @@ struct ItemPrototype _Socket Socket[MAX_ITEM_PROTO_SOCKETS]; uint32 socketBonus; // id from SpellItemEnchantment.dbc uint32 GemProperties; // id from GemProperties.dbc - uint32 RequiredDisenchantSkill; + int32 RequiredDisenchantSkill; float ArmorDamageModifier; uint32 Duration; // negative = realtime, positive = ingame time uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index eea0b4495..a59fc8857 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -2058,6 +2058,44 @@ void ObjectMgr::LoadItemPrototypes() if(proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties)) sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)",i,proto->GemProperties); + if (proto->RequiredDisenchantSkill < -1) + { + sLog.outErrorDb("Item (Entry: %u) has wrong RequiredDisenchantSkill (%i), set to (-1).",i,proto->RequiredDisenchantSkill); + const_cast(proto)->RequiredDisenchantSkill = -1; + } + else if (proto->RequiredDisenchantSkill != -1) + { + if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON) + { + sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality); + const_cast(proto)->RequiredDisenchantSkill = -1; + } + else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR) + { + sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class); + const_cast(proto)->RequiredDisenchantSkill = -1; + } + } + + if (proto->DisenchantID) + { + if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON) + { + sLog.outErrorDb("Item (Entry: %u) has wrong quality (%u) for disenchanting, remove disenchanting loot id.",i,proto->Quality); + const_cast(proto)->DisenchantID = 0; + } + else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR) + { + sLog.outErrorDb("Item (Entry: %u) has wrong item class (%u) for disenchanting, remove disenchanting loot id.",i,proto->Class); + const_cast(proto)->DisenchantID = 0; + } + else if (proto->RequiredDisenchantSkill < 0) + { + sLog.outErrorDb("Item (Entry: %u) marked as non-disenchantable by RequiredDisenchantSkill == -1, remove disenchanting loot id.",i); + const_cast(proto)->DisenchantID = 0; + } + } + if(proto->FoodType >= MAX_PET_DIET) { sLog.outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)",i,proto->FoodType); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 85fb3b658..c06273bb0 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5871,19 +5871,14 @@ SpellCastResult Spell::CheckItems() if(!itemProto) return SPELL_FAILED_CANT_BE_DISENCHANTED; - uint32 item_quality = itemProto->Quality; - // 2.0.x addon: Check player enchanting level against the item disenchanting requirements - uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill; - if (item_disenchantskilllevel == uint32(-1)) - return SPELL_FAILED_CANT_BE_DISENCHANTED; - if (item_disenchantskilllevel > p_caster->GetSkillValue(SKILL_ENCHANTING)) - return SPELL_FAILED_LOW_CASTLEVEL; - if(item_quality > 4 || item_quality < 2) - return SPELL_FAILED_CANT_BE_DISENCHANTED; - if(itemProto->Class != ITEM_CLASS_WEAPON && itemProto->Class != ITEM_CLASS_ARMOR) - return SPELL_FAILED_CANT_BE_DISENCHANTED; + // must have disenchant loot (other static req. checked at item prototype loading) if (!itemProto->DisenchantID) return SPELL_FAILED_CANT_BE_DISENCHANTED; + + // 2.0.x addon: Check player enchanting level against the item disenchanting requirements + int32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill; + if (item_disenchantskilllevel > int32(p_caster->GetSkillValue(SKILL_ENCHANTING))) + return SPELL_FAILED_LOW_CASTLEVEL; break; } case SPELL_EFFECT_PROSPECTING: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 396d5b0f7..01d913377 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10020" + #define REVISION_NR "10021" #endif // __REVISION_NR_H__ From 7ed98198a7e74b3ca575f757b00154957b02e9f7 Mon Sep 17 00:00:00 2001 From: Ceris Date: Wed, 2 Jun 2010 18:39:24 +0300 Subject: [PATCH 150/172] [10022] Fix damage for 14278 and 16511 and ranks when dagger is equipped Signed-off-by: Laise --- sql/mangos_spell_check.sql | 2 ++ src/game/SpellEffects.cpp | 14 ++++++++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index 8ad7399d5..17c1a618d 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -87,6 +87,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (13166,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Gnomish Battle Chicken', 'Spell::EffectDummy'), (13567, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Dummy Trigger', 'Spell::EffectDummy'), (14185, 8, -1, -1, -1, -1, -1, 3, -1,-1,'Preparation', 'Spell::EffectDummy'), +(14278, 8, -1, -1, -1, -1, -1, -1, -1,-1,'Ghostly Strike', 'Spell::EffectWeaponDmg'), (15237, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (15430, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), (15431, 6, -1, -1, -1, -1, -1, -1, -1,-1,'Holy Nova', 'Spell::cast'), @@ -653,6 +654,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 5,0x0004000000000000,0x00000000,3172, -1, -1, -1, 4,-1,'Haunt', 'Spell::DoAllEffectOnTarget'), ( 0,11,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Healing Stream Totem', 'Spell::EffectDummy'), ( 0, 4,0x0000800000000060,0x00000000, -1, -1, -1, -1, -1,-1,'Hellfire Effect / Rain of Fire / Seed of Corruption','Spell::prepareDataForTriggerSystem'), +( 0, 8,0x0000000002800000,0x00000000, -1, -1, -1, -1, -1,-1,'Hemorrhage', 'Spell::EffectWeaponDmg'), ( 0, 4,0x0000000100000000,0x00000000, -1, -1, -1, 2, -1,-1,'Heroic Throw', 'Spell::EffectSchoolDMG'), ( 0,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), ( 0,-1, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::CheckCast'), diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 109e9b3b6..d0cc3873b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5064,6 +5064,20 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) if (weapon && weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER) totalDamagePercentMod *= 1.5f; // 150% to daggers } + // Ghostly Strike + else if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 14278) + { + Item* weapon = ((Player*)m_caster)->GetWeaponForAttack(m_attackType,true,true); + if (weapon && weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER) + totalDamagePercentMod *= 1.44f; // 144% to daggers + } + // Hemorrhage + else if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x2000000))) + { + Item* weapon = ((Player*)m_caster)->GetWeaponForAttack(m_attackType,true,true); + if (weapon && weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER) + totalDamagePercentMod *= 1.45f; // 145% to daggers + } break; } case SPELLFAMILY_PALADIN: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 01d913377..044bb38ad 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10021" + #define REVISION_NR "10022" #endif // __REVISION_NR_H__ From d8479debbbabe0aee1dedf589c6246e49ef3ad22 Mon Sep 17 00:00:00 2001 From: Laise Date: Wed, 2 Jun 2010 19:29:20 +0300 Subject: [PATCH 151/172] [10023] Change HandleLearnAllMySpellsCommand to learn only player's spells --- src/game/Level3.cpp | 10 +++++++--- src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 1df230f2d..6ed7809e3 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -1832,9 +1832,13 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) return true; uint32 family = clsEntry->spellfamily; - for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) + for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(i); + SkillLineAbilityEntry const *entry = sSkillLineAbilityStore.LookupEntry(i); + if (!entry) + continue; + + SpellEntry const *spellInfo = sSpellStore.LookupEntry(entry->spellId); if(!spellInfo) continue; @@ -1859,7 +1863,7 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) if(!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) continue; - m_session->GetPlayer()->learnSpell(i, false); + m_session->GetPlayer()->learnSpell(spellInfo->Id, false); } SendSysMessage(LANG_COMMAND_LEARN_CLASS_SPELLS); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 044bb38ad..74b5e1649 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10022" + #define REVISION_NR "10023" #endif // __REVISION_NR_H__ From 54f2f507cfb1588a92dc23945eda859b09c13397 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 3 Jun 2010 14:28:13 +0400 Subject: [PATCH 152/172] [10024] New LogFilter_DbStrictedCheck filter for DB devs It's enable by default (prevent show related output) but in disbled case allow show useful for DB developers different more stricted DB check output at server loading, including * Absent GO trap template referecned in some another GO template * Not set (0) unit class in creature_template * Absent disenchanting loot for items marked as disanchantble This all cases can or hard fixed in one step or show false cases y different reasons. That why filter active by default. --- src/game/ObjectMgr.cpp | 20 ++++++++++++++------ src/mangosd/mangosd.conf.dist.in | 11 +++++++++++ src/shared/Log.cpp | 1 + src/shared/Log.h | 10 +++++++++- src/shared/revision_nr.h | 2 +- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a59fc8857..ca0b9184e 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -671,7 +671,9 @@ void ObjectMgr::LoadCreatureTemplates() } // use below code for 0-checks for unit_class - if (/*!cInfo->unit_class ||*/cInfo->unit_class && ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) + if (!cInfo->unit_class) + ERROR_DB_STRICT_LOG("Creature (Entry: %u) not has proper unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class); + else if (((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) sLog.outErrorDb("Creature (Entry: %u) has invalid unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class); if(cInfo->dmgschool >= MAX_SPELL_SCHOOL) @@ -2067,12 +2069,13 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON) { - sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality); + ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality); const_cast(proto)->RequiredDisenchantSkill = -1; } else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR) { - sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class); + // some wrong data in wdb for unused items + ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class); const_cast(proto)->RequiredDisenchantSkill = -1; } } @@ -2095,6 +2098,12 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->DisenchantID = 0; } } + else + { + // lot DB cases + if (proto->RequiredDisenchantSkill >= 0) + ERROR_DB_STRICT_LOG("Item (Entry: %u) marked as disenchantable by RequiredDisenchantSkill, but not have disenchanting loot id.",i); + } if(proto->FoodType >= MAX_PET_DIET) { @@ -5930,11 +5939,10 @@ inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo,uint32 dataN,uint32 sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", goInfo->id,goInfo->type,N,dataN,dataN,GAMEOBJECT_TYPE_TRAP); } - /* disable check for while (too many error reports baout not existed in trap templates else - sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but trap GO (Entry %u) not exist in `gameobject_template`.", + // too many error reports about not existed trap templates + ERROR_DB_STRICT_LOG("Gameobject (Entry: %u GoType: %u) have data%d=%u but trap GO (Entry %u) not exist in `gameobject_template`.", goInfo->id,goInfo->type,N,dataN,dataN); - */ } inline void CheckGOSpellId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N) diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 673ed2a12..f5ba807ed 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -246,6 +246,7 @@ CleanCharacterDB = 1 # LogFilter_TransportMoves # LogFilter_VisibilityChanges # LogFilter_Weather +# LogFilter_DbStrictedCheck # Log filters (active by default) # Default: 1 - not include with any log level # 0 - include in log if log level permit @@ -333,6 +334,16 @@ LogFilter_AchievementUpdates = 1 LogFilter_CreatureMoves = 1 LogFilter_TransportMoves = 1 LogFilter_VisibilityChanges = 1 +LogFilter_Weather = 1 +LogFilter_DbStrictedCheck = 1 +LogFilter_PeriodicAffects = 0 +LogFilter_PlayerMoves = 0 +LogFilter_SQLText = 0 +LogFilter_AIAndMovegens = 0 +LogFilter_PlayerStats = 0 +LogFilter_Damage = 0 +LogFilter_Combat = 0 +LogFilter_SpellCast = 0 WorldLogFile = "" WorldLogTimestamp = 0 DBErrorLogFile = "DBErrors.log" diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 05fe2525b..ebeee267d 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -47,6 +47,7 @@ LogFilterData logFilterData[LOG_FILTER_COUNT] = { "damage", "LogFilter_Damage", false }, { "combat", "LogFilter_Combat", false }, { "spell_cast", "LogFilter_SpellCast", false }, + { "db_stricted_check", "LogFilter_DbStrictedCheck", true }, }; enum LogType diff --git a/src/shared/Log.h b/src/shared/Log.h index 44dca6220..e1eb66a1b 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -49,9 +49,10 @@ enum LogFilters LOG_FILTER_DAMAGE = 0x0400, // Direct/Area damage trace LOG_FILTER_COMBAT = 0x0800, // attack states/roll attack results/etc LOG_FILTER_SPELL_CAST = 0x1000, // spell cast/aura apply/spell proc events + LOG_FILTER_DB_STRICTED_CHECK = 0x2000, // stricted DB data checks output (with possible false reports) for DB devs }; -#define LOG_FILTER_COUNT 13 +#define LOG_FILTER_COUNT 14 struct LogFilterData { @@ -212,6 +213,13 @@ class Log : public MaNGOS::Singleton Date: Thu, 3 Jun 2010 16:45:38 +0400 Subject: [PATCH 153/172] [10025] Fixed unexpected C++ code parsing with *FILTER_LOG in 'if' --- src/shared/Database/Field.h | 1 + src/shared/Log.h | 59 ++++++++++++++++++++++++------------- src/shared/revision_nr.h | 2 +- 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index 8f23311aa..3f89b5886 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -39,6 +39,7 @@ class Field ~Field(); enum DataTypes GetType() const { return mType; } + bool IsNULL() const { return mValue == NULL; } const char *GetString() const { return mValue; } std::string GetCppString() const diff --git a/src/shared/Log.h b/src/shared/Log.h index e1eb66a1b..1e9eb435f 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -192,30 +192,47 @@ class Log : public MaNGOS::Singleton::Instance() -#define BASIC_LOG(...) \ - if (sLog.HasLogLevelOrHigher(LOG_LVL_BASIC)) \ - sLog.outBasic(__VA_ARGS__) -#define BASIC_FILTER_LOG(F,...) \ - if (sLog.HasLogLevelOrHigher(LOG_LVL_BASIC) && (sLog.getLogFilter() & (F))==0) \ - sLog.outBasic(__VA_ARGS__) +#define BASIC_LOG(...) \ + do { \ + if (sLog.HasLogLevelOrHigher(LOG_LVL_BASIC)) \ + sLog.outBasic(__VA_ARGS__); \ + } while(0) -#define DETAIL_LOG(...) \ - if (sLog.HasLogLevelOrHigher(LOG_LVL_DETAIL)) \ - sLog.outDetail(__VA_ARGS__) -#define DETAIL_FILTER_LOG(F,...) \ - if (sLog.HasLogLevelOrHigher(LOG_LVL_DETAIL) && (sLog.getLogFilter() & (F))==0) \ - sLog.outDetail(__VA_ARGS__) +#define BASIC_FILTER_LOG(F,...) \ + do { \ + if (sLog.HasLogLevelOrHigher(LOG_LVL_BASIC) && (sLog.getLogFilter() & (F))==0) \ + sLog.outBasic(__VA_ARGS__); \ + } while(0) -#define DEBUG_LOG(...) \ - if (sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) \ - sLog.outDebug(__VA_ARGS__) -#define DEBUG_FILTER_LOG(F,...) \ - if (sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG) && (sLog.getLogFilter() & (F))==0) \ - sLog.outDebug(__VA_ARGS__) +#define DETAIL_LOG(...) \ + do { \ + if (sLog.HasLogLevelOrHigher(LOG_LVL_DETAIL)) \ + sLog.outDetail(__VA_ARGS__); \ + } while(0) -#define ERROR_DB_FILTER_LOG(F,...) \ - if ((sLog.getLogFilter() & (F))==0) \ - sLog.outErrorDb(__VA_ARGS__) +#define DETAIL_FILTER_LOG(F,...) \ + do { \ + if (sLog.HasLogLevelOrHigher(LOG_LVL_DETAIL) && (sLog.getLogFilter() & (F))==0) \ + sLog.outDetail(__VA_ARGS__); \ + } while(0) + +#define DEBUG_LOG(...) \ + do { \ + if (sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) \ + sLog.outDebug(__VA_ARGS__); \ + } while(0) + +#define DEBUG_FILTER_LOG(F,...) \ + do { \ + if (sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG) && (sLog.getLogFilter() & (F))==0) \ + sLog.outDebug(__VA_ARGS__); \ + } while(0) + +#define ERROR_DB_FILTER_LOG(F,...) \ + do { \ + if ((sLog.getLogFilter() & (F))==0) \ + sLog.outErrorDb(__VA_ARGS__); \ + } while(0) #define ERROR_DB_STRICT_LOG(...) \ ERROR_DB_FILTER_LOG(LOG_FILTER_DB_STRICTED_CHECK, __VA_ARGS__) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1dc065b59..92187b2cb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10024" + #define REVISION_NR "10025" #endif // __REVISION_NR_H__ From cf5c1c45d66260e2cec806cf33b3020ca5d902bc Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 3 Jun 2010 17:01:28 +0400 Subject: [PATCH 154/172] [10026] PDump code fixes and cleanups * At pdump creating will propertly saved NULL field values. * At pdump loading will skipped adding `character_declinedname` if name in some way will be changed (explicly or at loading) --- src/game/PlayerDump.cpp | 125 ++++++++++++++++++++++++--------------- src/game/PlayerDump.h | 6 +- src/shared/revision_nr.h | 2 +- 3 files changed, 83 insertions(+), 50 deletions(-) diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 9adf233f2..ae46b64d5 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -36,13 +36,13 @@ struct DumpTable static DumpTable dumpTables[] = { - { "characters", DTT_CHARACTER }, // -> guid + { "characters", DTT_CHARACTER }, // -> guid, must be first for name check { "character_account_data", DTT_CHAR_TABLE }, { "character_achievement", DTT_CHAR_TABLE }, { "character_achievement_progress", DTT_CHAR_TABLE }, { "character_action", DTT_CHAR_TABLE }, { "character_aura", DTT_CHAR_TABLE }, - { "character_declinedname", DTT_CHAR_TABLE }, + { "character_declinedname", DTT_CHAR_NAME_TABLE }, { "character_equipmentsets", DTT_EQSET_TABLE}, { "character_glyphs", DTT_CHAR_TABLE }, { "character_homebind", DTT_CHAR_TABLE }, @@ -83,7 +83,7 @@ static bool findtoknth(std::string &str, int n, std::string::size_type &s, std:: std::string gettoknth(std::string &str, int n) { std::string::size_type s = 0, e = 0; - if(!findtoknth(str, n, s, e)) + if (!findtoknth(str, n, s, e)) return ""; return str.substr(s, e-s); @@ -92,12 +92,14 @@ std::string gettoknth(std::string &str, int n) bool findnth(std::string &str, int n, std::string::size_type &s, std::string::size_type &e) { s = str.find("VALUES ('")+9; - if (s == std::string::npos) return false; + if (s == std::string::npos) + return false; do { e = str.find("'",s); - if (e == std::string::npos) return false; + if (e == std::string::npos) + return false; } while(str[e-1] == '\\'); for(int i = 1; i < n; ++i) @@ -106,7 +108,8 @@ bool findnth(std::string &str, int n, std::string::size_type &s, std::string::si { s = e+4; e = str.find("'",s); - if (e == std::string::npos) return false; + if (e == std::string::npos) + return false; } while (str[e-1] == '\\'); } return true; @@ -125,12 +128,12 @@ std::string gettablename(std::string &str) bool changenth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false) { std::string::size_type s, e; - if(!findnth(str,n,s,e)) + if (!findnth(str,n,s,e)) return false; - if(nonzero && str.substr(s,e-s) == "0") + if (nonzero && str.substr(s,e-s) == "0") return true; // not an error - if(!insert) + if (!insert) str.replace(s,e-s, with); else str.insert(s, with); @@ -141,7 +144,7 @@ bool changenth(std::string &str, int n, const char *with, bool insert = false, b std::string getnth(std::string &str, int n) { std::string::size_type s, e; - if(!findnth(str,n,s,e)) + if (!findnth(str,n,s,e)) return ""; return str.substr(s, e-s); @@ -150,11 +153,11 @@ std::string getnth(std::string &str, int n) bool changetoknth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false) { std::string::size_type s = 0, e = 0; - if(!findtoknth(str, n, s, e)) + if (!findtoknth(str, n, s, e)) return false; - if(nonzero && str.substr(s,e-s) == "0") + if (nonzero && str.substr(s,e-s) == "0") return true; // not an error - if(!insert) + if (!insert) str.replace(s, e-s, with); else str.insert(s, with); @@ -165,7 +168,7 @@ bool changetoknth(std::string &str, int n, const char *with, bool insert = false uint32 registerNewGuid(uint32 oldGuid, std::map &guidMap, uint32 hiGuid) { std::map::const_iterator itr = guidMap.find(oldGuid); - if(itr != guidMap.end()) + if (itr != guidMap.end()) return itr->second; uint32 newguid = hiGuid + guidMap.size(); @@ -201,20 +204,26 @@ bool changetokGuid(std::string &str, int n, std::map &guidMap, u std::string CreateDumpString(char const* tableName, QueryResult *result) { - if(!tableName || !result) return ""; + if (!tableName || !result) + return ""; + std::ostringstream ss; ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES ("; Field *fields = result->Fetch(); for(uint32 i = 0; i < result->GetFieldCount(); ++i) { - if (i == 0) ss << "'"; - else ss << ", '"; + if (i != 0) + ss << ", "; - std::string s = fields[i].GetCppString(); - CharacterDatabase.escape_string(s); - ss << s; + if (fields[i].IsNULL()) + ss << "NULL"; + else + { + std::string s = fields[i].GetCppString(); + CharacterDatabase.escape_string(s); - ss << "'"; + ss << "'" << s << "'"; + } } ss << ");"; return ss.str(); @@ -235,14 +244,14 @@ std::string PlayerDumpWriter::GenerateWhereStr(char const* field, GUIDs const& g { wherestr << *itr; - if(wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query + if (wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query { ++itr; break; } GUIDs::const_iterator itr2 = itr; - if(++itr2 != guids.end()) + if (++itr2 != guids.end()) wherestr << "','"; } wherestr << "')"; @@ -253,7 +262,7 @@ void StoreGUID(QueryResult *result,uint32 field,std::set& guids) { Field* fields = result->Fetch(); uint32 guid = fields[field].GetUInt32(); - if(guid) + if (guid) guids.insert(guid); } @@ -262,7 +271,7 @@ void StoreGUID(QueryResult *result,uint32 data,uint32 field, std::set& g Field* fields = result->Fetch(); std::string dataStr = fields[data].GetCppString(); uint32 guid = atoi(gettoknth(dataStr, field).c_str()); - if(guid) + if (guid) guids.insert(guid); } @@ -285,25 +294,25 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con } // for guid set stop if set is empty - if(guids && guids->empty()) + if (guids && guids->empty()) return; // nothing to do // setup for guids case start position GUIDs::const_iterator guids_itr; - if(guids) + if (guids) guids_itr = guids->begin(); do { std::string wherestr; - if(guids) // set case, get next guids string + if (guids) // set case, get next guids string wherestr = GenerateWhereStr(fieldname,*guids,guids_itr); else // not set case, get single guid string wherestr = GenerateWhereStr(fieldname,guid); QueryResult *result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str()); - if(!result) + if (!result) return; do @@ -341,20 +350,20 @@ std::string PlayerDumpWriter::GetDump(uint32 guid) // revision check guard QueryNamedResult* result = CharacterDatabase.QueryNamed("SELECT * FROM character_db_version LIMIT 1"); - if(result) + if (result) { QueryFieldNames const& namesMap = result->GetFieldNames(); std::string reqName; for(QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr) { - if(itr->substr(0,9)=="required_") + if (itr->substr(0,9)=="required_") { reqName = *itr; break; } } - if(!reqName.empty()) + if (!reqName.empty()) { // this will fail at wrong character DB version dump += "UPDATE character_db_version SET "+reqName+" = 1 WHERE FALSE;\n\n"; @@ -394,6 +403,8 @@ DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid) DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid) { + bool nameInvalidated = false; // set when name changed or will requested changed at next login + // check character count uint32 charcount = sAccountMgr.GetCharactersCount(account); if (charcount >= 10) @@ -457,7 +468,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s CharacterDatabase.BeginTransaction(); while(!feof(fin)) { - if(!fgets(buf, 32000, fin)) + if (!fgets(buf, 32000, fin)) { if(feof(fin)) break; ROLLBACK(DUMP_FILE_BROKEN); @@ -467,17 +478,17 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s // skip empty strings size_t nw_pos = line.find_first_not_of(" \t\n\r\7"); - if(nw_pos==std::string::npos) + if (nw_pos==std::string::npos) continue; // skip NOTE - if(line.substr(nw_pos,15)=="IMPORTANT NOTE:") + if (line.substr(nw_pos,15)=="IMPORTANT NOTE:") continue; // add required_ check - if(line.substr(nw_pos,41)=="UPDATE character_db_version SET required_") + if (line.substr(nw_pos,41)=="UPDATE character_db_version SET required_") { - if(!CharacterDatabase.Execute(line.c_str())) + if (!CharacterDatabase.Execute(line.c_str())) ROLLBACK(DUMP_FILE_BROKEN); continue; @@ -485,7 +496,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s // determine table name and load type std::string tn = gettablename(line); - if(tn.empty()) + if (tn.empty()) { sLog.outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); ROLLBACK(DUMP_FILE_BROKEN); @@ -508,20 +519,33 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s ROLLBACK(DUMP_FILE_BROKEN); } + bool execute_ok = true; // false, if need skip soem query + // change the data to server values switch(type) { case DTT_CHAR_TABLE: - if(!changenth(line, 1, newguid)) // character_*.guid update + if (!changenth(line, 1, newguid)) // character_*.guid update + ROLLBACK(DUMP_FILE_BROKEN); + break; + + case DTT_CHAR_NAME_TABLE: + if (nameInvalidated) // ignore declined names if name will changed in some way + { + execute_ok = false; + break; + } + + if (!changenth(line, 1, newguid)) // character_*.guid update ROLLBACK(DUMP_FILE_BROKEN); break; case DTT_CHARACTER: { - if(!changenth(line, 1, newguid)) // characters.guid update + if (!changenth(line, 1, newguid)) // characters.guid update ROLLBACK(DUMP_FILE_BROKEN); - if(!changenth(line, 2, chraccount)) // characters.account update + if (!changenth(line, 2, chraccount)) // characters.account update ROLLBACK(DUMP_FILE_BROKEN); if (name == "") @@ -535,12 +559,19 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s { delete result; - if(!changenth(line, 36, "1")) // characters.at_login set to "rename on login" + if (!changenth(line, 36, "1")) // characters.at_login set to "rename on login" ROLLBACK(DUMP_FILE_BROKEN); + + nameInvalidated = true; } } - else if(!changenth(line, 3, name.c_str())) // characters.name update - ROLLBACK(DUMP_FILE_BROKEN); + else + { + if (!changenth(line, 3, name.c_str())) // characters.name update + ROLLBACK(DUMP_FILE_BROKEN); + + nameInvalidated = true; + } break; } @@ -660,7 +691,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s break; } case DTT_EQSET_TABLE: - if(!changenth(line, 1, newguid)) // character_equipmentsets.guid update + if (!changenth(line, 1, newguid)) // character_equipmentsets.guid update ROLLBACK(DUMP_FILE_BROKEN); if (!changeGuid(line, 2, eqsets, sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed())) ROLLBACK(DUMP_FILE_BROKEN); // character_equipmentsets.setguid @@ -674,7 +705,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s break; } - if(!CharacterDatabase.Execute(line.c_str())) + if (execute_ok && !CharacterDatabase.Execute(line.c_str())) ROLLBACK(DUMP_FILE_BROKEN); } @@ -685,7 +716,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s sObjectMgr.m_MailIds.Set(sObjectMgr.m_MailIds.GetNextAfterMaxUsed() + mails.size()); sObjectMgr.m_EquipmentSetIds.Set(sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed() + eqsets.size()); - if(incHighest) + if (incHighest) sObjectMgr.m_CharGuids.Set(sObjectMgr.m_CharGuids.GetNextAfterMaxUsed()+1); fclose(fin); diff --git a/src/game/PlayerDump.h b/src/game/PlayerDump.h index 9183a75d7..acaa08769 100644 --- a/src/game/PlayerDump.h +++ b/src/game/PlayerDump.h @@ -25,15 +25,17 @@ enum DumpTableType { - DTT_CHARACTER, // // characters + DTT_CHARACTER, // -> guid, name // characters DTT_CHAR_TABLE, // // character_account_data, character_achievement, // character_achievement_progress, character_action, - // character_aura, character_declinedname, character_glyphs, + // character_aura, character_glyphs, // character_homebind, character_queststatus, // character_reputation, character_skills, character_spell, // character_spell_cooldown, character_talent, character_ticket + DTT_CHAR_NAME_TABLE,// <- guid, name // character_declinedname + DTT_EQSET_TABLE, // <- guid // character_equipmentsets DTT_INVENTORY, // -> item guids collection // character_inventory diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 92187b2cb..ce44d2027 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10025" + #define REVISION_NR "10026" #endif // __REVISION_NR_H__ From ff3fb9b727baa5849909732dc40eb9a4ee5936fa Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 3 Jun 2010 23:37:46 +0400 Subject: [PATCH 155/172] [10027] SPELL_AURA_ADD_TARGET_TRIGGER long time not use spellmod for work. Drop dead code. --- src/game/SpellAuras.cpp | 25 +------------------------ src/game/SpellAuras.h | 1 - src/shared/revision_nr.h | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ff6cb5885..bd3099300 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -159,7 +159,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraHover, //106 SPELL_AURA_HOVER &Aura::HandleAddModifier, //107 SPELL_AURA_ADD_FLAT_MODIFIER &Aura::HandleAddModifier, //108 SPELL_AURA_ADD_PCT_MODIFIER - &Aura::HandleAddTargetTrigger, //109 SPELL_AURA_ADD_TARGET_TRIGGER + &Aura::HandleNoImmediateEffect, //109 SPELL_AURA_ADD_TARGET_TRIGGER &Aura::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT &Aura::HandleNoImmediateEffect, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER implemented in Unit::SelectMagnetTarget &Aura::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS implemented in diff functions. @@ -1474,29 +1474,6 @@ void Aura::HandleAddModifier(bool apply, bool Real) ReapplyAffectedPassiveAuras(); } -void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) -{ - // Use SpellModifier structure for check - // used only fields: - // spellId, mask, mask2 - if (apply) - { - SpellModifier *mod = new SpellModifier; - mod->spellId = GetId(); - - uint32 const *ptr = m_spellProto->GetEffectSpellClassMask(m_effIndex); - - mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32; - mod->mask2= ptr[2]; - m_spellmod = mod; - } - else - { - delete m_spellmod; - m_spellmod = NULL; - } -} - void Aura::TriggerSpell() { const uint64& casterGUID = GetCasterGUID(); diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index ecc81fcc1..412dfeee3 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -95,7 +95,6 @@ class MANGOS_DLL_SPEC Aura void HandleAuraHover(bool Apply, bool Real); void HandleAddModifier(bool Apply, bool Real); - void HandleAddTargetTrigger(bool Apply, bool Real); void HandleAuraModStun(bool Apply, bool Real); void HandleModDamageDone(bool Apply, bool Real); void HandleAuraUntrackable(bool Apply, bool Real); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ce44d2027..3c7c66877 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10026" + #define REVISION_NR "10027" #endif // __REVISION_NR_H__ From 6ebbcd8dbbd522ea5044c477e67f3b3fe5258fb6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 4 Jun 2010 18:37:27 +0400 Subject: [PATCH 156/172] [10028] Reward group for shareable quests at cast event to creature/go. --- src/game/GameObject.cpp | 3 +- src/game/Player.cpp | 125 ++++++++++++++++++++++++--------------- src/game/Player.h | 3 +- src/game/Spell.cpp | 8 +-- src/shared/revision_nr.h | 2 +- 5 files changed, 85 insertions(+), 56 deletions(-) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index c6a4a00c9..a446784bb 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1034,7 +1034,8 @@ void GameObject::Use(Unit* user) break; } - player->CastedCreatureOrGO(info->id, GetObjectGuid(), 0); + player->RewardPlayerAndGroupAtCast(this); + } if (uint32 trapEntry = info->goober.linkedTrapId) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ebccec773..830836da6 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14331,71 +14331,75 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid ) } } -void Player::CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id ) +void Player::CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id, bool original_caster ) { bool isCreature = guid.IsCreature(); uint32 addCastCount = 1; - for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i) + for(int i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { uint32 questid = GetQuestSlotQuestId(i); - if(!questid) + if (!questid) continue; Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); - if ( !qInfo ) + if (!qInfo) + continue; + + if (!original_caster && !qInfo->HasFlag(QUEST_FLAGS_SHARABLE)) + continue; + + if (!qInfo->HasFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST)) continue; QuestStatusData& q_status = mQuestStatus[questid]; - if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) + if (q_status.m_status != QUEST_STATUS_INCOMPLETE) + continue; + + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { - if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST ) ) + // skip kill creature objective (0) or wrong spell casts + if (qInfo->ReqSpell[j] != spell_id) + continue; + + uint32 reqTarget = 0; + + if (isCreature) { - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) - { - // skip kill creature objective (0) or wrong spell casts - if(qInfo->ReqSpell[j] != spell_id ) - continue; - - uint32 reqTarget = 0; - - if(isCreature) - { - // creature activate objectives - if(qInfo->ReqCreatureOrGOId[j] > 0) - // checked at quest_template loading - reqTarget = qInfo->ReqCreatureOrGOId[j]; - } - else - { - // GO activate objective - if(qInfo->ReqCreatureOrGOId[j] < 0) - // checked at quest_template loading - reqTarget = - qInfo->ReqCreatureOrGOId[j]; - } - - // other not this creature/GO related objectives - if( reqTarget != entry ) - continue; - - uint32 reqCastCount = qInfo->ReqCreatureOrGOCount[j]; - uint32 curCastCount = q_status.m_creatureOrGOcount[j]; - if ( curCastCount < reqCastCount ) - { - q_status.m_creatureOrGOcount[j] = curCastCount + addCastCount; - if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED; - - SendQuestUpdateAddCreatureOrGo( qInfo, guid, j, curCastCount, addCastCount); - } - - if ( CanCompleteQuest( questid ) ) - CompleteQuest( questid ); - - // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization). - break; - } + // creature activate objectives + if (qInfo->ReqCreatureOrGOId[j] > 0) + // checked at quest_template loading + reqTarget = qInfo->ReqCreatureOrGOId[j]; } + else + { + // GO activate objective + if (qInfo->ReqCreatureOrGOId[j] < 0) + // checked at quest_template loading + reqTarget = - qInfo->ReqCreatureOrGOId[j]; + } + + // other not this creature/GO related objectives + if (reqTarget != entry) + continue; + + uint32 reqCastCount = qInfo->ReqCreatureOrGOCount[j]; + uint32 curCastCount = q_status.m_creatureOrGOcount[j]; + if (curCastCount < reqCastCount) + { + q_status.m_creatureOrGOcount[j] = curCastCount + addCastCount; + if (q_status.uState != QUEST_NEW) + q_status.uState = QUEST_CHANGED; + + SendQuestUpdateAddCreatureOrGo( qInfo, guid, j, curCastCount, addCastCount); + } + + if (CanCompleteQuest(questid)) + CompleteQuest(questid); + + // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization). + break; } } } @@ -20170,6 +20174,29 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar KilledMonsterCredit(creature_id, creature_guid); } +void Player::RewardPlayerAndGroupAtCast(WorldObject* pRewardSource, uint32 spellid) +{ + // prepare data for near group iteration + if(Group *pGroup = GetGroup()) + { + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupGuy = itr->getSource(); + if(!pGroupGuy) + continue; + + if(!pGroupGuy->IsAtGroupRewardDistance(pRewardSource)) + continue; // member (alive or dead) or his corpse at req. distance + + // quest objectives updated only for alive group member or dead but with not released body + if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + pGroupGuy->CastedCreatureOrGO(pRewardSource->GetEntry(), pRewardSource->GetObjectGuid(), spellid, pGroupGuy == this); + } + } + else // if (!pGroup) + CastedCreatureOrGO(pRewardSource->GetEntry(), pRewardSource->GetObjectGuid(), spellid); +} + bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const { if (pRewardSource->IsWithinDistInMap(this,sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE))) diff --git a/src/game/Player.h b/src/game/Player.h index 371ed886f..ebb629571 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1404,7 +1404,7 @@ class MANGOS_DLL_SPEC Player : public Unit void ItemRemovedQuestCheck( uint32 entry, uint32 count ); void KilledMonster( CreatureInfo const* cInfo, ObjectGuid guid ); void KilledMonsterCredit( uint32 entry, ObjectGuid guid ); - void CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id ); + void CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id, bool original_caster = true ); void TalkedToCreature( uint32 entry, ObjectGuid guid ); void MoneyChanged( uint32 value ); void ReputationChanged(FactionEntry const* factionEntry ); @@ -1906,6 +1906,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; void RewardSinglePlayerAtKill(Unit* pVictim); void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource); + void RewardPlayerAndGroupAtCast(WorldObject* pRewardSource, uint32 spellid = 0); bool isHonorOrXPTarget(Unit* pVictim) const; ReputationMgr& GetReputationMgr() { return m_reputationMgr; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c06273bb0..994d5fe26 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1083,7 +1083,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) if (real_caster && !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) if (Player* p = real_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) - p->CastedCreatureOrGO(unit->GetEntry(), unit->GetObjectGuid(), m_spellInfo->Id); + p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); if(((Creature*)unit)->AI()) ((Creature*)unit)->AI()->SpellHit(m_caster, m_spellInfo); @@ -1249,7 +1249,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) { if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) - p->CastedCreatureOrGO(go->GetEntry(), go->GetObjectGuid(), m_spellInfo->Id); + p->RewardPlayerAndGroupAtCast(go, m_spellInfo->Id); } } @@ -3147,7 +3147,7 @@ void Spell::update(uint32 difftime) if (unit == NULL) continue; - p->CastedCreatureOrGO(unit->GetEntry(), unit->GetObjectGuid(), m_spellInfo->Id); + p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); } for(std::list::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) @@ -3158,7 +3158,7 @@ void Spell::update(uint32 difftime) if(!go) continue; - p->CastedCreatureOrGO(go->GetEntry(), go->GetObjectGuid(), m_spellInfo->Id); + p->RewardPlayerAndGroupAtCast(go, m_spellInfo->Id); } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3c7c66877..7f993ed97 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10027" + #define REVISION_NR "10028" #endif // __REVISION_NR_H__ From fc3e0463489c025334571b1c2b3fe0af4e09467c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 5 Jun 2010 00:20:02 +0400 Subject: [PATCH 157/172] [10029] Clarify client dependence for some MeleeHitOutcome values --- src/game/Unit.h | 12 ++++++++++-- src/shared/revision_nr.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/game/Unit.h b/src/game/Unit.h index 9f5440fdb..141c8a66a 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -838,10 +838,18 @@ struct DiminishingReturn uint32 hitCount; }; +// At least some values expected fixed and used in auras field, other custom enum MeleeHitOutcome { - MELEE_HIT_EVADE, MELEE_HIT_MISS, MELEE_HIT_DODGE, MELEE_HIT_BLOCK, MELEE_HIT_PARRY, - MELEE_HIT_GLANCING, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_NORMAL + MELEE_HIT_EVADE = 0, + MELEE_HIT_MISS = 1, + MELEE_HIT_DODGE = 2, // used as misc in SPELL_AURA_IGNORE_COMBAT_RESULT + MELEE_HIT_BLOCK = 3, // used as misc in SPELL_AURA_IGNORE_COMBAT_RESULT + MELEE_HIT_PARRY = 4, // used as misc in SPELL_AURA_IGNORE_COMBAT_RESULT + MELEE_HIT_GLANCING = 5, + MELEE_HIT_CRIT = 6, + MELEE_HIT_CRUSHING = 7, + MELEE_HIT_NORMAL = 8, }; struct CleanDamage diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7f993ed97..90f08bd0f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10028" + #define REVISION_NR "10029" #endif // __REVISION_NR_H__ From f94175f90faa06f81c9ccb2a2c25a0bda6d28cfc Mon Sep 17 00:00:00 2001 From: Laise Date: Sat, 5 Jun 2010 09:11:27 +0300 Subject: [PATCH 158/172] [10030] Add aura remove modes for expire and absorb shield break cases and use GetTarget()/GetSpellProto() instead of m_target/m_spellProto --- src/game/SpellAuras.cpp | 2177 ++++++++++++++++++++------------------ src/game/Unit.cpp | 12 +- src/game/Unit.h | 7 +- src/shared/revision_nr.h | 2 +- 4 files changed, 1145 insertions(+), 1053 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index bd3099300..c692c0461 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1366,7 +1366,7 @@ struct ReapplyAffectedPassiveAurasHelper void Aura::ReapplyAffectedPassiveAuras() { // not reapply spell mods with charges (use original value because processed and at remove) - if (m_spellProto->procCharges) + if (GetSpellProto()->procCharges) return; // not reapply some spell mods ops (mostly speedup case) @@ -1384,19 +1384,20 @@ void Aura::ReapplyAffectedPassiveAuras() } // reapply talents to own passive persistent auras - ReapplyAffectedPassiveAuras(m_target, true); + ReapplyAffectedPassiveAuras(GetTarget(), true); // re-apply talents/passives/area auras applied to pet/totems (it affected by player spellmods) - m_target->CallForAllControlledUnits(ReapplyAffectedPassiveAurasHelper(this),true,false,false); + GetTarget()->CallForAllControlledUnits(ReapplyAffectedPassiveAurasHelper(this),true,false,false); // re-apply talents/passives/area auras applied to group members (it affected by player spellmods) - if (Group* group = ((Player*)m_target)->GetGroup()) + if (Group* group = ((Player*)GetTarget())->GetGroup()) for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) - if (member != m_target && member->IsInMap(m_target)) + if (member != GetTarget() && member->IsInMap(GetTarget())) ReapplyAffectedPassiveAuras(member, false); } + bool Aura::isWeaponBuffCoexistableWith(Aura* ref) { // Exclude Debuffs @@ -1433,7 +1434,7 @@ bool Aura::isWeaponBuffCoexistableWith(Aura* ref) /*********************************************************/ void Aura::HandleAddModifier(bool apply, bool Real) { - if(m_target->GetTypeId() != TYPEID_PLAYER || !Real) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER || !Real) return; if(m_modifier.m_miscvalue >= MAX_SPELLMOD) @@ -1442,7 +1443,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) if (apply) { // Add custom charges for some mod aura - switch (m_spellProto->Id) + switch (GetSpellProto()->Id) { case 17941: // Shadow Trance case 22008: // Netherwind Focus @@ -1466,10 +1467,10 @@ void Aura::HandleAddModifier(bool apply, bool Real) this, // prevent expire spell mods with (charges > 0 && m_stackAmount > 1) // all this spell expected expire not at use but at spell proc event check - m_spellProto->StackAmount > 1 ? 0 : m_procCharges); + GetSpellProto()->StackAmount > 1 ? 0 : m_procCharges); } - ((Player*)m_target)->AddSpellMod(m_spellmod, apply); + ((Player*)GetTarget())->AddSpellMod(m_spellmod, apply); ReapplyAffectedPassiveAuras(); } @@ -1477,9 +1478,9 @@ void Aura::HandleAddModifier(bool apply, bool Real) void Aura::TriggerSpell() { const uint64& casterGUID = GetCasterGUID(); - Unit* target = GetTriggerTarget(); + Unit* triggerTarget = GetTriggerTarget(); - if(!casterGUID || !target) + if(!casterGUID || !triggerTarget) return; // generic casting code with custom spells and target/caster customs @@ -1488,6 +1489,7 @@ void Aura::TriggerSpell() SpellEntry const *triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); SpellEntry const *auraSpellInfo = GetSpellProto(); uint32 auraId = auraSpellInfo->Id; + Unit* target = GetTarget(); // specific code for cases with no trigger spell provided in field if (triggeredSpellInfo == NULL) @@ -1521,7 +1523,7 @@ void Aura::TriggerSpell() // Brood Affliction: Bronze case 23170: { - m_target->CastSpell(m_target, 23171, true, NULL, this); + target->CastSpell(target, 23171, true, NULL, this); return; } // // Mark of Frost @@ -1529,13 +1531,13 @@ void Aura::TriggerSpell() // Restoration case 23493: { - int32 heal = target->GetMaxHealth() / 10; - target->DealHeal(target, heal, auraSpellInfo); + int32 heal = triggerTarget->GetMaxHealth() / 10; + triggerTarget->DealHeal(triggerTarget, heal, auraSpellInfo); - if (int32 mana = target->GetMaxPower(POWER_MANA)) + if (int32 mana = triggerTarget->GetMaxPower(POWER_MANA)) { mana /= 10; - target->EnergizeBySpell(target, 23493, mana, POWER_MANA); + triggerTarget->EnergizeBySpell(triggerTarget, 23493, mana, POWER_MANA); } return; } @@ -1563,11 +1565,11 @@ void Aura::TriggerSpell() trigger_spell_id = spellForTick[tick]; // casted in left/right (but triggered spell have wide forward cone) - float forward = m_target->GetOrientation(); - float angle = m_target->GetOrientation() + ( tick % 2 == 0 ? M_PI_F / 2 : - M_PI_F / 2); - m_target->SetOrientation(angle); - target->CastSpell(target, trigger_spell_id, true, NULL, this, casterGUID); - m_target->SetOrientation(forward); + float forward = target->GetOrientation(); + float angle = target->GetOrientation() + ( tick % 2 == 0 ? M_PI_F / 2 : - M_PI_F / 2); + target->SetOrientation(angle); + triggerTarget->CastSpell(triggerTarget, trigger_spell_id, true, NULL, this, casterGUID); + target->SetOrientation(forward); } return; } @@ -1580,8 +1582,8 @@ void Aura::TriggerSpell() // Consume case 25371: { - int32 bpDamage = target->GetMaxHealth()*10/100; - target->CastCustomSpell(target, 25373, &bpDamage, NULL, NULL, true, NULL, this, casterGUID); + int32 bpDamage = triggerTarget->GetMaxHealth()*10/100; + triggerTarget->CastCustomSpell(triggerTarget, 25373, &bpDamage, NULL, NULL, true, NULL, this, casterGUID); return; } // // Pain Spike @@ -1607,8 +1609,8 @@ void Aura::TriggerSpell() // Frost Blast case 27808: { - int32 bpDamage = target->GetMaxHealth()*26/100; - target->CastCustomSpell(target, 29879, &bpDamage, NULL, NULL, true, NULL, this, casterGUID); + int32 bpDamage = triggerTarget->GetMaxHealth()*26/100; + triggerTarget->CastCustomSpell(triggerTarget, 29879, &bpDamage, NULL, NULL, true, NULL, this, casterGUID); return; } // // Detonate Mana @@ -1633,7 +1635,7 @@ void Aura::TriggerSpell() // case 29519: break; // Inoculate Nestlewood Owlkin case 29528: - if(target->GetTypeId() != TYPEID_UNIT)// prevent error reports in case ignored player target + if(triggerTarget->GetTypeId() != TYPEID_UNIT)// prevent error reports in case ignored player target return; break; // // Overload @@ -1664,11 +1666,11 @@ void Aura::TriggerSpell() return; // move loot to player inventory and despawn target if(caster->GetTypeId() ==TYPEID_PLAYER && - target->GetTypeId() == TYPEID_UNIT && - ((Creature*)target)->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD) + triggerTarget->GetTypeId() == TYPEID_UNIT && + ((Creature*)triggerTarget)->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD) { Player* player = (Player*)caster; - Creature* creature = (Creature*)target; + Creature* creature = (Creature*)triggerTarget; // missing lootid has been reported on startup - just return if (!creature->GetCreatureInfo()->SkinLootId) return; @@ -1697,15 +1699,15 @@ void Aura::TriggerSpell() // Doom case 31347: { - m_target->CastSpell(m_target,31350,true); - m_target->DealDamage(m_target, m_target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + target->CastSpell(target,31350,true); + target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; } // Spellcloth case 31373: { // Summon Elemental after create item - target->SummonCreature(17870, 0, 0, 0, target->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); + triggerTarget->SummonCreature(17870, 0, 0, 0, triggerTarget->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); return; } // // Bloodmyst Tesla @@ -1714,7 +1716,7 @@ void Aura::TriggerSpell() case 31944: { int32 damage = m_modifier.m_amount * ((GetAuraDuration() + m_modifier.periodictime) / GetAuraMaxDuration()); - target->CastCustomSpell(target, 31969, &damage, NULL, NULL, true, NULL, this, casterGUID); + triggerTarget->CastCustomSpell(triggerTarget, 31969, &damage, NULL, NULL, true, NULL, this, casterGUID); return; } // // Teleport Test @@ -1732,9 +1734,9 @@ void Aura::TriggerSpell() { // cast 24 spells 34269-34289, 34314-34316 for(uint32 spell_id = 34269; spell_id != 34290; ++spell_id) - target->CastSpell(target, spell_id, true, NULL, this, casterGUID); + triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); for(uint32 spell_id = 34314; spell_id != 34317; ++spell_id) - target->CastSpell(target, spell_id, true, NULL, this, casterGUID); + triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); return; } // // Gravity Lapse @@ -1816,13 +1818,13 @@ void Aura::TriggerSpell() // Eye of Grillok case 38495: { - m_target->CastSpell(m_target, 38530, true); + target->CastSpell(target, 38530, true); return; } // Absorb Eye of Grillok (Zezzak's Shard) case 38554: { - if(m_target->GetTypeId() != TYPEID_UNIT) + if(target->GetTypeId() != TYPEID_UNIT) return; if (Unit* caster = GetCaster()) @@ -1830,7 +1832,7 @@ void Aura::TriggerSpell() else return; - Creature* creatureTarget = (Creature*)m_target; + Creature* creatureTarget = (Creature*)target; creatureTarget->ForcedDespawn(); return; @@ -1961,11 +1963,11 @@ void Aura::TriggerSpell() case 53302: case 53303: case 53304: - if (target->GetTypeId() != TYPEID_PLAYER) + if (triggerTarget->GetTypeId() != TYPEID_PLAYER) return; // Reset reapply counter at move - if (((Player*)target)->isMoving()) + if (((Player*)triggerTarget)->isMoving()) { m_modifier.m_amount = 6; return; @@ -1987,7 +1989,7 @@ void Aura::TriggerSpell() } // If aura is active - no need to continue - if (target->HasAura(trigger_spell_id)) + if (triggerTarget->HasAura(trigger_spell_id)) return; break; @@ -2012,12 +2014,12 @@ void Aura::TriggerSpell() { int32 LifePerRage = GetModifier()->m_amount; - int32 lRage = m_target->GetPower(POWER_RAGE); + int32 lRage = target->GetPower(POWER_RAGE); if(lRage > 100) // rage stored as rage*10 lRage = 100; - m_target->ModifyPower(POWER_RAGE, -lRage); + target->ModifyPower(POWER_RAGE, -lRage); int32 FRTriggerBasePoints = int32(lRage*LifePerRage/10); - m_target->CastCustomSpell(m_target, 22845, &FRTriggerBasePoints, NULL, NULL, true, NULL, this); + target->CastCustomSpell(target, 22845, &FRTriggerBasePoints, NULL, NULL, true, NULL, this); return; } default: @@ -2069,7 +2071,7 @@ void Aura::TriggerSpell() case 28820: { // Need remove self if Lightning Shield not active - Unit::AuraMap const& auras = target->GetAuras(); + Unit::AuraMap const& auras = triggerTarget->GetAuras(); for(Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { SpellEntry const* spell = itr->second->GetSpellProto(); @@ -2077,16 +2079,16 @@ void Aura::TriggerSpell() (spell->SpellFamilyFlags & UI64LIT(0x0000000000000400))) return; } - target->RemoveAurasDueToSpell(28820); + triggerTarget->RemoveAurasDueToSpell(28820); return; } // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus) case 38443: { - if(target->IsAllTotemSlotsUsed()) - target->CastSpell(target, 38437, true, NULL, this); + if(triggerTarget->IsAllTotemSlotsUsed()) + triggerTarget->CastSpell(triggerTarget, 38437, true, NULL, this); else - target->RemoveAurasDueToSpell(38437); + triggerTarget->RemoveAurasDueToSpell(38437); return; } default: @@ -2116,14 +2118,14 @@ void Aura::TriggerSpell() // 2) maybe aura must be replace by new with accumulative stat mods instead stacking // prevent cast by triggered auras - if(casterGUID == target->GetGUID()) + if(casterGUID == triggerTarget->GetGUID()) return; // stop triggering after each affected stats lost > 90 int32 intelectLoss = 0; int32 spiritLoss = 0; - Unit::AuraList const& mModStat = target->GetAurasByType(SPELL_AURA_MOD_STAT); + Unit::AuraList const& mModStat = triggerTarget->GetAurasByType(SPELL_AURA_MOD_STAT); for(Unit::AuraList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i) { if ((*i)->GetId() == 1010) @@ -2145,18 +2147,18 @@ void Aura::TriggerSpell() // Mana Tide case 16191: { - target->CastCustomSpell(target, trigger_spell_id, &m_modifier.m_amount, NULL, NULL, true, NULL, this); + triggerTarget->CastCustomSpell(triggerTarget, trigger_spell_id, &m_modifier.m_amount, NULL, NULL, true, NULL, this); return; } // Ground Slam case 33525: - target->CastSpell(target, trigger_spell_id, true, NULL, this, casterGUID); + triggerTarget->CastSpell(triggerTarget, trigger_spell_id, true, NULL, this, casterGUID); return; // Rod of Purification - for quest 10839 (Veil Skith: Darkstone of Terokk) case 38736: { if(Unit* caster = GetCaster()) - caster->CastSpell(target, trigger_spell_id, true, NULL, this); + caster->CastSpell(triggerTarget, trigger_spell_id, true, NULL, this); return; } // Beacon of Light @@ -2168,8 +2170,8 @@ void Aura::TriggerSpell() case 56654: case 58882: { - int32 mana = m_target->GetMaxPower(POWER_MANA) * m_modifier.m_amount / 100; - target->CastCustomSpell(target, trigger_spell_id, &mana, NULL, NULL, true, NULL, this); + int32 mana = target->GetMaxPower(POWER_MANA) * m_modifier.m_amount / 100; + triggerTarget->CastCustomSpell(triggerTarget, trigger_spell_id, &mana, NULL, NULL, true, NULL, this); return; } } @@ -2177,12 +2179,12 @@ void Aura::TriggerSpell() // All ok cast by default case if(triggeredSpellInfo) - target->CastSpell(target, triggeredSpellInfo, true, NULL, this, casterGUID); + triggerTarget->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this, casterGUID); else { if (Unit* caster = GetCaster()) { - if(target->GetTypeId() != TYPEID_UNIT || !Script->EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)target)) + if(triggerTarget->GetTypeId() != TYPEID_UNIT || !Script->EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)triggerTarget)) sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex()); } } @@ -2198,7 +2200,7 @@ void Aura::TriggerSpellWithValue() // generic casting code with custom spells and target/caster customs uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; - int32 basepoints0 = this->GetModifier()->m_amount; + int32 basepoints0 = GetModifier()->m_amount; target->CastCustomSpell(target, trigger_spell_id, &basepoints0, NULL, NULL, true, NULL, this, casterGUID); } @@ -2213,10 +2215,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (!Real) return; + Unit *target = GetTarget(); + // AT APPLY if (apply) { - switch(m_spellProto->SpellFamilyName) + switch(GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { @@ -2224,9 +2228,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { case 1515: // Tame beast // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness - if (m_target->CanHaveThreatList()) + if (target->CanHaveThreatList()) if (Unit* caster = GetCaster()) - m_target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto()); + target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto()); return; case 7057: // Haunting Spirits // expected to tick with 30 sec period (tick part see in Aura::PeriodicTick) @@ -2241,10 +2245,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; case 39850: // Rocket Blast if (roll_chance_i(20)) // backfire stun - m_target->CastSpell(m_target, 51581, true, NULL, this); + target->CastSpell(target, 51581, true, NULL, this); return; case 43873: // Headless Horseman Laugh - m_target->PlayDistanceSound(11965); + target->PlayDistanceSound(11965); return; case 46354: // Blood Elf Illusion if (Unit* caster = GetCaster()) @@ -2252,10 +2256,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) switch(caster->getGender()) { case GENDER_FEMALE: - caster->CastSpell(m_target, 46356, true, NULL, this); + caster->CastSpell(target, 46356, true, NULL, this); break; case GENDER_MALE: - caster->CastSpell(m_target, 46355, true, NULL, this); + caster->CastSpell(target, 46355, true, NULL, this); break; default: break; @@ -2263,39 +2267,39 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } return; case 46699: // Requires No Ammo - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) // not use ammo and not allow use - ((Player*)m_target)->RemoveAmmo(); + ((Player*)target)->RemoveAmmo(); return; case 48025: // Headless Horseman's Mount - Spell::SelectMountByAreaAndSkill(m_target, 51621, 48024, 51617, 48023, 0); + Spell::SelectMountByAreaAndSkill(target, 51621, 48024, 51617, 48023, 0); return; case 62061: // Festive Holiday Mount - if (m_target->HasAuraType(SPELL_AURA_MOUNTED)) + if (target->HasAuraType(SPELL_AURA_MOUNTED)) // Reindeer Transformation - m_target->CastSpell(m_target, 25860, true, NULL, this); + target->CastSpell(target, 25860, true, NULL, this); return; case 63624: // Learn a Second Talent Specialization // Teach Learn Talent Specialization Switches, required for client triggered casts, allow after 30 sec delay - if (m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->learnSpell(63680, false); + if (target->GetTypeId() == TYPEID_PLAYER) + ((Player*)target)->learnSpell(63680, false); return; case 63651: // Revert to One Talent Specialization // Teach Learn Talent Specialization Switches, remove - if (m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->removeSpell(63680); + if (target->GetTypeId() == TYPEID_PLAYER) + ((Player*)target)->removeSpell(63680); return; case 71342: // Big Love Rocket - Spell::SelectMountByAreaAndSkill(m_target, 71344, 71345, 71346, 71347, 0); + Spell::SelectMountByAreaAndSkill(target, 71344, 71345, 71346, 71347, 0); return; case 72286: // Invincible - Spell::SelectMountByAreaAndSkill(m_target, 72281, 72282, 72283, 72284, 0); + Spell::SelectMountByAreaAndSkill(target, 72281, 72282, 72283, 72284, 0); return; case 74856: // Blazing Hippogryph - Spell::SelectMountByAreaAndSkill(m_target, 0, 0, 74854, 74855, 0); + Spell::SelectMountByAreaAndSkill(target, 0, 0, 74854, 74855, 0); return; case 75614: // Celestial Steed - Spell::SelectMountByAreaAndSkill(m_target, 75619, 75620, 75617, 75618, 76153); + Spell::SelectMountByAreaAndSkill(target, 75619, 75620, 75617, 75618, 76153); return; } break; @@ -2303,10 +2307,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case SPELLFAMILY_WARRIOR: { // Overpower - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) + if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000004)) { // Must be casting target - if (!m_target->IsNonMeleeSpellCasted(false)) + if (!target->IsNonMeleeSpellCasted(false)) return; Unit* caster = GetCaster(); @@ -2322,10 +2326,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) switch ((*itr)->GetSpellProto()->Id) { case 46859: // Unrelenting Assault, rank 1 - m_target->CastSpell(m_target,64849,true,NULL,(*itr)); + target->CastSpell(target,64849,true,NULL,(*itr)); break; case 46860: // Unrelenting Assault, rank 2 - m_target->CastSpell(m_target,64850,true,NULL,(*itr)); + target->CastSpell(target,64850,true,NULL,(*itr)); break; default: break; @@ -2348,18 +2352,18 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; for(uint32 k = 0; k < buffEntry->StackAmount; ++k) - m_target->CastSpell(m_target, buffEntry, true, NULL, this); + target->CastSpell(target, buffEntry, true, NULL, this); } // Earth Shield else if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000))) { // prevent double apply bonuses - if (m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) + if (target->GetTypeId() != TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { if (Unit* caster = GetCaster()) { - m_modifier.m_amount = caster->SpellHealingBonusDone(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); - m_modifier.m_amount = m_target->SpellHealingBonusTaken(caster, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); + m_modifier.m_amount = caster->SpellHealingBonusDone(target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); + m_modifier.m_amount = target->SpellHealingBonusTaken(caster, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); } } return; @@ -2371,18 +2375,18 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // AT REMOVE else { - if (m_target->GetTypeId() == TYPEID_PLAYER && + if (target->GetTypeId() == TYPEID_PLAYER && (GetSpellProto()->Effect[EFFECT_INDEX_0] == 72 || GetSpellProto()->Effect[EFFECT_INDEX_0] == 6 && (GetSpellProto()->EffectApplyAuraName[EFFECT_INDEX_0] == 1 || GetSpellProto()->EffectApplyAuraName[EFFECT_INDEX_0] == 128))) { // spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425 - ((Player*)m_target)->SetFarSightGUID(0); + ((Player*)target)->SetFarSightGUID(0); WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0); - ((Player*)m_target)->GetSession()->SendPacket(&data); + ((Player*)target)->GetSession()->SendPacket(&data); return; } - if (IsQuestTameSpell(GetId()) && m_target->isAlive()) + if (IsQuestTameSpell(GetId()) && target->isAlive()) { Unit* caster = GetCaster(); if (!caster || !caster->isAlive()) @@ -2412,7 +2416,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } if (finalSpelId) - caster->CastSpell(m_target, finalSpelId, true, NULL, this); + caster->CastSpell(target, finalSpelId, true, NULL, this); return; } @@ -2420,35 +2424,35 @@ void Aura::HandleAuraDummy(bool apply, bool Real) switch(GetId()) { case 12479: // Hex of Jammal'an - m_target->CastSpell(m_target, 12480, true, NULL, this); + target->CastSpell(target, 12480, true, NULL, this); return; case 28169: // Mutating Injection { // Mutagen Explosion - m_target->CastSpell(m_target, 28206, true, NULL, this); + target->CastSpell(target, 28206, true, NULL, this); // Poison Cloud - m_target->CastSpell(m_target, 28240, true, NULL, this); + target->CastSpell(target, 28240, true, NULL, this); return; } case 32286: // Focus Target Visual { if (m_removeMode == AURA_REMOVE_BY_DEFAULT) - m_target->CastSpell(m_target, 32301, true, NULL, this); + target->CastSpell(target, 32301, true, NULL, this); return; } case 36730: // Flame Strike { - m_target->CastSpell(m_target, 36731, true, NULL, this); + target->CastSpell(target, 36731, true, NULL, this); return; } case 44191: // Flame Strike { - if (m_target->GetMap()->IsDungeon()) + if (target->GetMap()->IsDungeon()) { - uint32 spellId = m_target->GetMap()->IsRegularDifficulty() ? 44190 : 46163; + uint32 spellId = target->GetMap()->IsRegularDifficulty() ? 44190 : 46163; - m_target->CastSpell(m_target, spellId, true, NULL, this); + target->CastSpell(target, spellId, true, NULL, this); } return; } @@ -2456,13 +2460,13 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { // Kill target if dispelled if (m_removeMode==AURA_REMOVE_BY_DISPEL) - m_target->DealDamage(m_target, m_target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; } case 46308: // Burning Winds { // casted only at creatures at spawn - m_target->CastSpell(m_target, 47287, true, NULL, this); + target->CastSpell(target, 47287, true, NULL, this); return; } case 51870: // Collect Hair Sample @@ -2470,7 +2474,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (Unit* pCaster = GetCaster()) { if (m_removeMode == AURA_REMOVE_BY_DEFAULT) - pCaster->CastSpell(m_target, 51872, true, NULL, this); + pCaster->CastSpell(target, 51872, true, NULL, this); } return; @@ -2478,20 +2482,20 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case 58600: // Restricted Flight Area { // Remove Flight Auras - m_target->CastSpell(m_target, 58601, true); + target->CastSpell(target, 58601, true); // Parachute - m_target->CastSpell(m_target, 45472, true); + target->CastSpell(target, 45472, true); return; } } // Living Bomb - if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellProto->SpellFamilyFlags & UI64LIT(0x2000000000000))) + if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x2000000000000))) { // Zero duration is equal to AURA_REMOVE_BY_DEFAULT. We can't use it directly, as it is set even // when removing aura from one target due to casting Living Bomb at other. if (m_duration == 0 || m_removeMode == AURA_REMOVE_BY_DISPEL) - m_target->CastSpell(m_target,m_modifier.m_amount,true,NULL,this); + target->CastSpell(target,m_modifier.m_amount,true,NULL,this); return; } @@ -2499,7 +2503,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (m_removeMode == AURA_REMOVE_BY_DEATH) { // Stop caster Arcane Missle chanelling on death - if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000800))) + if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000800))) { if (Unit* caster = GetCaster()) caster->InterruptSpell(CURRENT_CHANNELED_SPELL); @@ -2511,14 +2515,14 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // AT APPLY & REMOVE - switch(m_spellProto->SpellFamilyName) + switch(GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { switch(GetId()) { case 11196: // Recently Bandaged - m_target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, GetMiscValue(), apply); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, GetMiscValue(), apply); return; case 24658: // Unstable Power { @@ -2531,11 +2535,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; for (uint32 i = 0; i < spell->StackAmount; ++i) - caster->CastSpell(m_target, spellId, true, NULL, NULL, GetCasterGUID()); + caster->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID()); return; } - m_target->RemoveAurasDueToSpell(spellId); + target->RemoveAurasDueToSpell(spellId); return; } case 24661: // Restless Strength @@ -2549,11 +2553,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; for (uint32 i=0; i < spell->StackAmount; ++i) - caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); + caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID()); return; } - m_target->RemoveAurasDueToSpell(spellId); + target->RemoveAurasDueToSpell(spellId); return; } case 29266: // Permanent Feign Death @@ -2578,8 +2582,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // Some has effect1 that makes the difference, however not all. // Some appear to be used depending on creature location, in water, at solid ground, in air/suspended, etc // For now, just handle all the same way - if (m_target->GetTypeId() == TYPEID_UNIT) - m_target->SetFeignDeath(apply); + if (target->GetTypeId() == TYPEID_UNIT) + target->SetFeignDeath(apply); return; } @@ -2587,24 +2591,24 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case 35357: // Spawn Feign Death case 42557: // Feign Death { - if (m_target->GetTypeId() == TYPEID_UNIT) + if (target->GetTypeId() == TYPEID_UNIT) { // Flags not set like it's done in SetFeignDeath() and apparently always applied at spawn of creature // All three does however have SPELL_EFFECT_SPAWN(46) as effect1 // It is possible this effect will remove some flags, and then the three here can be handled "normally" if (apply) { - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - m_target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - m_target->addUnitState(UNIT_STAT_DIED); + target->addUnitState(UNIT_STAT_DIED); } else { - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - m_target->clearUnitState(UNIT_STAT_DIED); + target->clearUnitState(UNIT_STAT_DIED); } } return; @@ -2645,44 +2649,44 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { if (apply) { - m_target->CastSpell(m_target, 40216, true); - m_target->CastSpell(m_target, 42016, true); + target->CastSpell(target, 40216, true); + target->CastSpell(target, 42016, true); } else { - m_target->RemoveAurasDueToSpell(40216); - m_target->RemoveAurasDueToSpell(42016); + target->RemoveAurasDueToSpell(40216); + target->RemoveAurasDueToSpell(42016); } return; } case 58204: // LK Intro VO (1) - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { // Play part 1 if (apply) - m_target->PlayDirectSound(14970, (Player *)m_target); + target->PlayDirectSound(14970, (Player *)target); // continue in 58205 else - m_target->CastSpell(m_target, 58205, true); + target->CastSpell(target, 58205, true); } return; case 58205: // LK Intro VO (2) - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { // Play part 2 if (apply) - m_target->PlayDirectSound(14971, (Player *)m_target); + target->PlayDirectSound(14971, (Player *)target); // Play part 3 else - m_target->PlayDirectSound(14972, (Player *)m_target); + target->PlayDirectSound(14972, (Player *)target); } return; case 40131: case 27978: if (apply) - m_target->m_AuraFlags |= UNIT_AURAFLAG_ALIVE_INVISIBLE; + target->m_AuraFlags |= UNIT_AURAFLAG_ALIVE_INVISIBLE; else - m_target->m_AuraFlags |= ~UNIT_AURAFLAG_ALIVE_INVISIBLE; + target->m_AuraFlags |= ~UNIT_AURAFLAG_ALIVE_INVISIBLE; return; } break; @@ -2702,7 +2706,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) int32 bp0 = m_modifier.m_amount; if (Unit* caster = GetCaster()) - m_target->CastCustomSpell(caster,48210,&bp0,NULL,NULL,true); + target->CastCustomSpell(caster,48210,&bp0,NULL,NULL,true); } } break; @@ -2710,7 +2714,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case SPELLFAMILY_PRIEST: { // Pain and Suffering - if (m_spellProto->SpellIconID == 2874 && m_target->GetTypeId()==TYPEID_PLAYER) + if (GetSpellProto()->SpellIconID == 2874 && target->GetTypeId()==TYPEID_PLAYER) { if (apply) { @@ -2718,7 +2722,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // aura have wrong effectclassmask, so use hardcoded value m_spellmod = new SpellModifier(SPELLMOD_DOT,SPELLMOD_PCT,m_modifier.m_amount,GetId(),UI64LIT(0x0000200000000000)); } - ((Player*)m_target)->AddSpellMod(m_spellmod, apply); + ((Player*)target)->AddSpellMod(m_spellmod, apply); return; } break; @@ -2730,41 +2734,41 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case 34246: // Idol of the Emerald Queen case 60779: // Idol of Lush Moss { - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return; if (apply) // dummy not have proper effectclassmask m_spellmod = new SpellModifier(SPELLMOD_DOT,SPELLMOD_FLAT,m_modifier.m_amount/7,GetId(),UI64LIT(0x001000000000)); - ((Player*)m_target)->AddSpellMod(m_spellmod, apply); + ((Player*)target)->AddSpellMod(m_spellmod, apply); return; } case 52610: // Savage Roar { if (apply) { - if (m_target->m_form != FORM_CAT) + if (target->m_form != FORM_CAT) return; - m_target->CastSpell(m_target, 62071, true); + target->CastSpell(target, 62071, true); } else - m_target-> RemoveAurasDueToSpell(62071); + target->RemoveAurasDueToSpell(62071); return; } case 61336: // Survival Instincts { if(apply) { - if (!m_target->IsInFeralForm()) + if (!target->IsInFeralForm()) return; - int32 bp0 = int32(m_target->GetMaxHealth() * m_modifier.m_amount / 100); - m_target->CastCustomSpell(m_target, 50322, &bp0, NULL, NULL, true); + int32 bp0 = int32(target->GetMaxHealth() * m_modifier.m_amount / 100); + target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true); } else - m_target-> RemoveAurasDueToSpell(50322); + target->RemoveAurasDueToSpell(50322); return; } } @@ -2777,10 +2781,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (Unit* caster = GetCaster()) { // prevent double apply bonuses - if (m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) + if (target->GetTypeId() != TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { - m_modifier.m_amount = caster->SpellHealingBonusDone(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); - m_modifier.m_amount = m_target->SpellHealingBonusTaken(caster, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); + m_modifier.m_amount = caster->SpellHealingBonusDone(target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); + m_modifier.m_amount = target->SpellHealingBonusTaken(caster, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); } } } @@ -2791,21 +2795,21 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; // have a look if there is still some other Lifebloom dummy aura - Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& auras = target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000))) return; // final heal - if (m_target->IsInWorld() && m_stackAmount > 0) + if (target->IsInWorld() && GetStackAmount() > 0) { - int32 amount = m_modifier.m_amount / m_stackAmount; - m_target->CastCustomSpell(m_target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGUID()); + int32 amount = m_modifier.m_amount / GetStackAmount(); + target->CastCustomSpell(target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGUID()); if (Unit* caster = GetCaster()) { - int32 returnmana = (GetSpellProto()->ManaCostPercentage * caster->GetCreateMana() / 100) * m_stackAmount / 2; + int32 returnmana = (GetSpellProto()->ManaCostPercentage * caster->GetCreateMana() / 100) * GetStackAmount() / 2; caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID()); } } @@ -2814,9 +2818,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } // Predatory Strikes - if (m_target->GetTypeId()==TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563) + if (target->GetTypeId()==TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563) { - ((Player*)m_target)->UpdateAttackPowerAndDamage(); + ((Player*)target)->UpdateAttackPowerAndDamage(); return; } @@ -2836,13 +2840,13 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (apply) { - if (m_target->m_form != FORM_MOONKIN) + if (target->m_form != FORM_MOONKIN) return; - m_target->CastSpell(m_target, spell_id, true); + target->CastSpell(target, spell_id, true); } else - m_target-> RemoveAurasDueToSpell(spell_id); + target->RemoveAurasDueToSpell(spell_id); return; } break; @@ -2856,9 +2860,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case 25899: // Greater Blessing of Sanctuary { if (apply) - m_target->CastSpell(m_target, 67480, true, NULL, this); + target->CastSpell(target, 67480, true, NULL, this); else - m_target->RemoveAurasDueToSpell(67480); + target->RemoveAurasDueToSpell(67480); return; } } @@ -2871,37 +2875,37 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (PetAura const* petSpell = sSpellMgr.GetPetAura(GetId(), m_effIndex)) { if (apply) - m_target->AddPetAura(petSpell); + target->AddPetAura(petSpell); else - m_target->RemovePetAura(petSpell); + target->RemovePetAura(petSpell); return; } - if (GetEffIndex() == EFFECT_INDEX_0 && m_target->GetTypeId() == TYPEID_PLAYER) + if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER) { SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); if (saBounds.first != saBounds.second) { uint32 zone, area; - m_target->GetZoneAndAreaId(zone, area); + target->GetZoneAndAreaId(zone, area); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove - if (!itr->second->IsFitToRequirements((Player*)m_target, zone, area)) - m_target->RemoveAurasDueToSpell(itr->second->spellId); + if (!itr->second->IsFitToRequirements((Player*)target, zone, area)) + target->RemoveAurasDueToSpell(itr->second->spellId); // some auras applied at aura apply else if (itr->second->autocast) { - if (!m_target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) - m_target->CastSpell(m_target, itr->second->spellId, true); + if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) + target->CastSpell(target, itr->second->spellId, true); } } } } // script has to "handle with care", only use where data are not ok to use in the above code. - if (m_target->GetTypeId() == TYPEID_UNIT) + if (target->GetTypeId() == TYPEID_UNIT) Script->EffectAuraDummy(this, apply); } @@ -2911,6 +2915,8 @@ void Aura::HandleAuraMounted(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + if(apply) { CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); @@ -2921,19 +2927,19 @@ void Aura::HandleAuraMounted(bool apply, bool Real) } uint32 team = 0; - if (m_target->GetTypeId()==TYPEID_PLAYER) - team = ((Player*)m_target)->GetTeam(); + if (target->GetTypeId()==TYPEID_PLAYER) + team = ((Player*)target)->GetTeam(); uint32 display_id = sObjectMgr.ChooseDisplayId(team,ci); CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; - m_target->Mount(display_id, m_spellProto->Id); + target->Mount(display_id, GetId()); } else { - m_target->Unmount(); + target->Unmount(); } } @@ -2948,9 +2954,9 @@ void Aura::HandleAuraWaterWalk(bool apply, bool Real) data.Initialize(SMSG_MOVE_WATER_WALK, 8+4); else data.Initialize(SMSG_MOVE_LAND_WALK, 8+4); - data << m_target->GetPackGUID(); + data << GetTarget()->GetPackGUID(); data << uint32(0); - m_target->SendMessageToSet(&data, true); + GetTarget()->SendMessageToSet(&data, true); } void Aura::HandleAuraFeatherFall(bool apply, bool Real) @@ -2958,19 +2964,19 @@ void Aura::HandleAuraFeatherFall(bool apply, bool Real) // only at real add/remove aura if(!Real) return; - + Unit *target = GetTarget(); WorldPacket data; if(apply) data.Initialize(SMSG_MOVE_FEATHER_FALL, 8+4); else data.Initialize(SMSG_MOVE_NORMAL_FALL, 8+4); - data << m_target->GetPackGUID(); + data << target->GetPackGUID(); data << uint32(0); - m_target->SendMessageToSet(&data, true); + target->SendMessageToSet(&data, true); // start fall from current height - if(!apply && m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->SetFallInformation(0, m_target->GetPositionZ()); + if(!apply && target->GetTypeId() == TYPEID_PLAYER) + ((Player*)target)->SetFallInformation(0, target->GetPositionZ()); } void Aura::HandleAuraHover(bool apply, bool Real) @@ -2984,16 +2990,16 @@ void Aura::HandleAuraHover(bool apply, bool Real) data.Initialize(SMSG_MOVE_SET_HOVER, 8+4); else data.Initialize(SMSG_MOVE_UNSET_HOVER, 8+4); - data << m_target->GetPackGUID(); + data << GetTarget()->GetPackGUID(); data << uint32(0); - m_target->SendMessageToSet(&data, true); + GetTarget()->SendMessageToSet(&data, true); } void Aura::HandleWaterBreathing(bool /*apply*/, bool /*Real*/) { // update timers in client - if(m_target->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_target)->UpdateMirrorTimers(); + if(GetTarget()->GetTypeId()==TYPEID_PLAYER) + ((Player*)GetTarget())->UpdateMirrorTimers(); } void Aura::HandleAuraModShapeshift(bool apply, bool Real) @@ -3005,6 +3011,8 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) Powers PowerType = POWER_MANA; ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue); + Unit *target = GetTarget(); + SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form); if (!ssEntry) { @@ -3017,19 +3025,19 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // i will asume that creatures will always take the defined model from the dbc // since no field in creature_templates describes wether an alliance or // horde modelid should be used at shapeshifting - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) modelid = ssEntry->modelID_A; else { // players are a bit difficult since the dbc has seldomly an horde modelid // so we add hacks here to set the right model - if (Player::TeamForRace(m_target->getRace()) == ALLIANCE) + if (Player::TeamForRace(target->getRace()) == ALLIANCE) modelid = ssEntry->modelID_A; else // 3.2.3 only the moonkin form has this information modelid = ssEntry->modelID_H; // no model found, if player is horde we look here for our hardcoded modelids - if (!modelid && Player::TeamForRace(m_target->getRace()) == HORDE) + if (!modelid && Player::TeamForRace(target->getRace()) == HORDE) { switch(form) @@ -3088,8 +3096,8 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) case FORM_MOONKIN: { // remove movement affects - m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); - Unit::AuraList const& slowingAuras = m_target->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); + target->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); + Unit::AuraList const& slowingAuras = target->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); for (Unit::AuraList::const_iterator iter = slowingAuras.begin(); iter != slowingAuras.end();) { SpellEntry const* aurSpellInfo = (*iter)->GetSpellProto(); @@ -3107,13 +3115,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) } // All OK, remove aura now - m_target->RemoveAurasDueToSpellByCancel(aurSpellInfo->Id); + target->RemoveAurasDueToSpellByCancel(aurSpellInfo->Id); iter = slowingAuras.begin(); } // and polymorphic affects - if(m_target->IsPolymorphed()) - m_target->RemoveAurasDueToSpell(m_target->getTransForm()); + if(target->IsPolymorphed()) + target->RemoveAurasDueToSpell(target->getTransForm()); break; } @@ -3124,19 +3132,19 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if(apply) { // remove other shapeshift before applying a new one - if(m_target->m_ShapeShiftFormSpellId) - m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId, this); + if(target->m_ShapeShiftFormSpellId) + target->RemoveAurasDueToSpell(target->m_ShapeShiftFormSpellId, this); - m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form); + target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form); if(modelid > 0) - m_target->SetDisplayId(modelid); + target->SetDisplayId(modelid); if(PowerType != POWER_MANA) { // reset power to default values only at power change - if(m_target->getPowerType() != PowerType) - m_target->setPowerType(PowerType); + if(target->getPowerType() != PowerType) + target->setPowerType(PowerType); switch(form) { @@ -3146,7 +3154,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) { // get furor proc chance int32 furorChance = 0; - Unit::AuraList const& mDummy = m_target->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& mDummy = target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 238) @@ -3160,17 +3168,17 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) { // Furor chance is now amount allowed to save energy for cat form // without talent it reset to 0 - if ((int32)m_target->GetPower(POWER_ENERGY) > furorChance) + if ((int32)target->GetPower(POWER_ENERGY) > furorChance) { - m_target->SetPower(POWER_ENERGY, 0); - m_target->CastCustomSpell(m_target, 17099, &furorChance, NULL, NULL, this); + target->SetPower(POWER_ENERGY, 0); + target->CastCustomSpell(target, 17099, &furorChance, NULL, NULL, this); } } else if(furorChance) // only if talent known { - m_target->SetPower(POWER_RAGE, 0); + target->SetPower(POWER_RAGE, 0); if(irand(1,100) <= furorChance) - m_target->CastSpell(m_target, 17057, true, NULL, this); + target->CastSpell(target, 17057, true, NULL, this); } break; } @@ -3180,20 +3188,20 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) { uint32 Rage_val = 0; // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { - PlayerSpellMap const& sp_list = ((Player *)m_target)->GetSpellMap(); + PlayerSpellMap const& sp_list = ((Player *)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if(itr->second.state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) - Rage_val += m_target->CalculateSpellDamage(m_target, spellInfo, EFFECT_INDEX_0) * 10; + Rage_val += target->CalculateSpellDamage(target, spellInfo, EFFECT_INDEX_0) * 10; } } - if (m_target->GetPower(POWER_RAGE) > Rage_val) - m_target->SetPower(POWER_RAGE, Rage_val); + if (target->GetPower(POWER_RAGE) > Rage_val) + target->SetPower(POWER_RAGE, Rage_val); break; } default: @@ -3201,26 +3209,26 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) } } - m_target->m_ShapeShiftFormSpellId = GetId(); - m_target->m_form = form; + target->m_ShapeShiftFormSpellId = GetId(); + target->m_form = form; // a form can give the player a new castbar with some spells.. this is a clientside process.. // serverside just needs to register the new spells so that player isn't kicked as cheater - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) for (uint32 i = 0; i < 8; ++i) if (ssEntry->spellId[i]) - ((Player*)m_target)->addSpell(ssEntry->spellId[i], true, false, false, false); + ((Player*)target)->addSpell(ssEntry->spellId[i], true, false, false, false); } else { if(modelid > 0) - m_target->SetDisplayId(m_target->GetNativeDisplayId()); - m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, FORM_NONE); - if(m_target->getClass() == CLASS_DRUID) - m_target->setPowerType(POWER_MANA); - m_target->m_ShapeShiftFormSpellId = 0; - m_target->m_form = FORM_NONE; + target->SetDisplayId(target->GetNativeDisplayId()); + target->SetByteValue(UNIT_FIELD_BYTES_2, 3, FORM_NONE); + if(target->getClass() == CLASS_DRUID) + target->setPowerType(POWER_MANA); + target->m_ShapeShiftFormSpellId = 0; + target->m_form = FORM_NONE; switch(form) { @@ -3228,23 +3236,23 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: - if(Aura* dummy = m_target->GetDummyAura(37315) ) - m_target->CastSpell(m_target, 37316, true, NULL, dummy); + if(Aura* dummy = target->GetDummyAura(37315) ) + target->CastSpell(target, 37316, true, NULL, dummy); break; // Nordrassil Regalia - bonus case FORM_MOONKIN: - if(Aura* dummy = m_target->GetDummyAura(37324) ) - m_target->CastSpell(m_target, 37325, true, NULL, dummy); + if(Aura* dummy = target->GetDummyAura(37324) ) + target->CastSpell(target, 37325, true, NULL, dummy); break; default: break; } // look at the comment in apply-part - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) for (uint32 i = 0; i < 8; ++i) if (ssEntry->spellId[i]) - ((Player*)m_target)->removeSpell(ssEntry->spellId[i], false, false, false); + ((Player*)target)->removeSpell(ssEntry->spellId[i], false, false, false); } @@ -3252,19 +3260,20 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // add/remove the shapeshift aura's boosts HandleShapeshiftBoosts(apply); - if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->InitDataForForm(); + if(target->GetTypeId() == TYPEID_PLAYER) + ((Player*)target)->InitDataForForm(); } void Aura::HandleAuraTransform(bool apply, bool Real) { + Unit *target = GetTarget(); if (apply) { // special case (spell specific functionality) if (m_modifier.m_miscvalue == 0) { // player applied only - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return; switch (GetId()) @@ -3272,67 +3281,67 @@ void Aura::HandleAuraTransform(bool apply, bool Real) // Orb of Deception case 16739: { - uint32 orb_model = m_target->GetNativeDisplayId(); + uint32 orb_model = target->GetNativeDisplayId(); switch(orb_model) { // Troll Female - case 1479: m_target->SetDisplayId(10134); break; + case 1479: target->SetDisplayId(10134); break; // Troll Male - case 1478: m_target->SetDisplayId(10135); break; + case 1478: target->SetDisplayId(10135); break; // Tauren Male - case 59: m_target->SetDisplayId(10136); break; + case 59: target->SetDisplayId(10136); break; // Human Male - case 49: m_target->SetDisplayId(10137); break; + case 49: target->SetDisplayId(10137); break; // Human Female - case 50: m_target->SetDisplayId(10138); break; + case 50: target->SetDisplayId(10138); break; // Orc Male - case 51: m_target->SetDisplayId(10139); break; + case 51: target->SetDisplayId(10139); break; // Orc Female - case 52: m_target->SetDisplayId(10140); break; + case 52: target->SetDisplayId(10140); break; // Dwarf Male - case 53: m_target->SetDisplayId(10141); break; + case 53: target->SetDisplayId(10141); break; // Dwarf Female - case 54: m_target->SetDisplayId(10142); break; + case 54: target->SetDisplayId(10142); break; // NightElf Male - case 55: m_target->SetDisplayId(10143); break; + case 55: target->SetDisplayId(10143); break; // NightElf Female - case 56: m_target->SetDisplayId(10144); break; + case 56: target->SetDisplayId(10144); break; // Undead Female - case 58: m_target->SetDisplayId(10145); break; + case 58: target->SetDisplayId(10145); break; // Undead Male - case 57: m_target->SetDisplayId(10146); break; + case 57: target->SetDisplayId(10146); break; // Tauren Female - case 60: m_target->SetDisplayId(10147); break; + case 60: target->SetDisplayId(10147); break; // Gnome Male - case 1563: m_target->SetDisplayId(10148); break; + case 1563: target->SetDisplayId(10148); break; // Gnome Female - case 1564: m_target->SetDisplayId(10149); break; + case 1564: target->SetDisplayId(10149); break; // BloodElf Female - case 15475: m_target->SetDisplayId(17830); break; + case 15475: target->SetDisplayId(17830); break; // BloodElf Male - case 15476: m_target->SetDisplayId(17829); break; + case 15476: target->SetDisplayId(17829); break; // Dranei Female - case 16126: m_target->SetDisplayId(17828); break; + case 16126: target->SetDisplayId(17828); break; // Dranei Male - case 16125: m_target->SetDisplayId(17827); break; + case 16125: target->SetDisplayId(17827); break; default: break; } break; } // Murloc costume - case 42365: m_target->SetDisplayId(21723); break; + case 42365: target->SetDisplayId(21723); break; // Honor the Dead case 65386: case 65495: { - switch(m_target->getGender()) + switch(target->getGender()) { case GENDER_MALE: - m_target->SetDisplayId(29203); // Chapman + target->SetDisplayId(29203); // Chapman break; case GENDER_FEMALE: case GENDER_NONE: - m_target->SetDisplayId(29204); // Catrina + target->SetDisplayId(29204); // Catrina break; } break; @@ -3359,46 +3368,46 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (caster->HasAura(52648)) // Glyph of the Penguin model_id = 26452; - m_target->SetDisplayId(model_id); + target->SetDisplayId(model_id); // creature case, need to update equipment - if (ci && m_target->GetTypeId() == TYPEID_UNIT) - ((Creature*)m_target)->LoadEquipment(ci->equipmentId, true); + if (ci && target->GetTypeId() == TYPEID_UNIT) + ((Creature*)target)->LoadEquipment(ci->equipmentId, true); // Dragonmaw Illusion (set mount model also) - if(GetId()==42016 && m_target->GetMountID() && !m_target->GetAurasByType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED).empty()) - m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); + if(GetId()==42016 && target->GetMountID() && !target->GetAurasByType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED).empty()) + target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); } // update active transform spell only not set or not overwriting negative by positive case - if (!m_target->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(m_target->getTransForm())) - m_target->setTransForm(GetId()); + if (!target->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(target->getTransForm())) + target->setTransForm(GetId()); // polymorph case - if (Real && m_target->GetTypeId() == TYPEID_PLAYER && m_target->IsPolymorphed()) + if (Real && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed()) { // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) if (IS_PLAYER_GUID(GetCasterGUID()) ) - ((Player*)m_target)->setRegenTimer(1*IN_MILLISECONDS); + ((Player*)target)->setRegenTimer(1*IN_MILLISECONDS); //dismount polymorphed target (after patch 2.4.2) - if (m_target->IsMounted()) - m_target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); + if (target->IsMounted()) + target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); } } else { // ApplyModifier(true) will reapply it if need - m_target->setTransForm(0); - m_target->SetDisplayId(m_target->GetNativeDisplayId()); + target->setTransForm(0); + target->SetDisplayId(target->GetNativeDisplayId()); // apply default equipment for creature case - if (m_target->GetTypeId() == TYPEID_UNIT) - ((Creature*)m_target)->LoadEquipment(((Creature*)m_target)->GetCreatureInfo()->equipmentId, true); + if (target->GetTypeId() == TYPEID_UNIT) + ((Creature*)target)->LoadEquipment(((Creature*)target)->GetCreatureInfo()->equipmentId, true); // re-apply some from still active with preference negative cases - Unit::AuraList const& otherTransforms = m_target->GetAurasByType(SPELL_AURA_TRANSFORM); + Unit::AuraList const& otherTransforms = target->GetAurasByType(SPELL_AURA_TRANSFORM); if (!otherTransforms.empty()) { // look for other transform auras @@ -3416,23 +3425,23 @@ void Aura::HandleAuraTransform(bool apply, bool Real) } // Dragonmaw Illusion (restore mount model) - if (GetId() == 42016 && m_target->GetMountID() == 16314) + if (GetId() == 42016 && target->GetMountID() == 16314) { - if (!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) + if (!target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) { - uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue; + uint32 cr_id = target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue; if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id)) { uint32 team = 0; - if (m_target->GetTypeId() == TYPEID_PLAYER) - team = ((Player*)m_target)->GetTeam(); + if (target->GetTypeId() == TYPEID_PLAYER) + team = ((Player*)target)->GetTeam(); uint32 display_id = sObjectMgr.ChooseDisplayId(team, ci); CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; - m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, display_id); + target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, display_id); } } } @@ -3441,13 +3450,13 @@ void Aura::HandleAuraTransform(bool apply, bool Real) void Aura::HandleForceReaction(bool apply, bool Real) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if(!Real) return; - Player* player = (Player*)m_target; + Player* player = (Player*)GetTarget(); uint32 faction_id = m_modifier.m_miscvalue; ReputationRank faction_rank = ReputationRank(m_modifier.m_amount); @@ -3462,15 +3471,15 @@ void Aura::HandleForceReaction(bool apply, bool Real) void Aura::HandleAuraModSkill(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; uint32 prot=GetSpellProto()->EffectMiscValue[m_effIndex]; int32 points = GetModifier()->m_amount; - ((Player*)m_target)->ModifySkillBonus(prot, (apply ? points: -points), m_modifier.m_auraname == SPELL_AURA_MOD_SKILL_TALENT); + ((Player*)GetTarget())->ModifySkillBonus(prot, (apply ? points: -points), m_modifier.m_auraname == SPELL_AURA_MOD_SKILL_TALENT); if(prot == SKILL_DEFENSE) - ((Player*)m_target)->UpdateDefenseBonusesMod(); + ((Player*)GetTarget())->UpdateDefenseBonusesMod(); } void Aura::HandleChannelDeathItem(bool apply, bool Real) @@ -3534,7 +3543,7 @@ void Aura::HandleBindSight(bool apply, bool /*Real*/) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)caster)->SetFarSightGUID(apply ? m_target->GetGUID() : 0); + ((Player*)caster)->SetFarSightGUID(apply ? GetTarget()->GetGUID() : 0); } void Aura::HandleFarSight(bool apply, bool /*Real*/) @@ -3543,43 +3552,43 @@ void Aura::HandleFarSight(bool apply, bool /*Real*/) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)caster)->SetFarSightGUID(apply ? m_target->GetGUID() : 0); + ((Player*)caster)->SetFarSightGUID(apply ? GetTarget()->GetGUID() : 0); } void Aura::HandleAuraTrackCreatures(bool apply, bool /*Real*/) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(GetTarget()->GetTypeId()!=TYPEID_PLAYER) return; if(apply) - m_target->RemoveNoStackAurasDueToAura(this); - m_target->SetUInt32Value(PLAYER_TRACK_CREATURES, apply ? ((uint32)1)<<(m_modifier.m_miscvalue-1) : 0 ); + GetTarget()->RemoveNoStackAurasDueToAura(this); + GetTarget()->SetUInt32Value(PLAYER_TRACK_CREATURES, apply ? ((uint32)1)<<(m_modifier.m_miscvalue-1) : 0 ); } void Aura::HandleAuraTrackResources(bool apply, bool /*Real*/) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(GetTarget()->GetTypeId()!=TYPEID_PLAYER) return; if(apply) - m_target->RemoveNoStackAurasDueToAura(this); - m_target->SetUInt32Value(PLAYER_TRACK_RESOURCES, apply ? ((uint32)1)<<(m_modifier.m_miscvalue-1): 0 ); + GetTarget()->RemoveNoStackAurasDueToAura(this); + GetTarget()->SetUInt32Value(PLAYER_TRACK_RESOURCES, apply ? ((uint32)1)<<(m_modifier.m_miscvalue-1): 0 ); } void Aura::HandleAuraTrackStealthed(bool apply, bool /*Real*/) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(GetTarget()->GetTypeId()!=TYPEID_PLAYER) return; if(apply) - m_target->RemoveNoStackAurasDueToAura(this); + GetTarget()->RemoveNoStackAurasDueToAura(this); - m_target->ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_TRACK_STEALTHED, apply); + GetTarget()->ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_TRACK_STEALTHED, apply); } void Aura::HandleAuraModScale(bool apply, bool /*Real*/) { - m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X, float(m_modifier.m_amount), apply); + GetTarget()->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X, float(m_modifier.m_amount), apply); } void Aura::HandleModPossess(bool apply, bool Real) @@ -3587,8 +3596,10 @@ void Aura::HandleModPossess(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + // not possess yourself - if(GetCasterGUID() == m_target->GetGUID()) + if(GetCasterGUID() == target->GetGUID()) return; Unit* caster = GetCaster(); @@ -3600,32 +3611,32 @@ void Aura::HandleModPossess(bool apply, bool Real) if( apply ) { - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); - m_target->SetCharmerGUID(p_caster->GetGUID()); - m_target->setFaction(p_caster->getFaction()); + target->SetCharmerGUID(p_caster->GetGUID()); + target->setFaction(p_caster->getFaction()); - p_caster->SetCharm(m_target); + p_caster->SetCharm(target); - p_caster->SetFarSightGUID(m_target->GetGUID()); - p_caster->SetClientControl(m_target, 1); - p_caster->SetMover(m_target); + p_caster->SetFarSightGUID(target->GetGUID()); + p_caster->SetClientControl(target, 1); + p_caster->SetMover(target); - m_target->CombatStop(); - m_target->DeleteThreatList(); + target->CombatStop(); + target->DeleteThreatList(); - if(m_target->GetTypeId() == TYPEID_UNIT) + if(target->GetTypeId() == TYPEID_UNIT) { - m_target->StopMoving(); - m_target->GetMotionMaster()->Clear(); - m_target->GetMotionMaster()->MoveIdle(); + target->StopMoving(); + target->GetMotionMaster()->Clear(); + target->GetMotionMaster()->MoveIdle(); } - else if(m_target->GetTypeId() == TYPEID_PLAYER) + else if(target->GetTypeId() == TYPEID_PLAYER) { - ((Player*)m_target)->SetClientControl(m_target, 0); + ((Player*)target)->SetClientControl(target, 0); } - if(CharmInfo *charmInfo = m_target->InitCharmInfo(m_target)) + if(CharmInfo *charmInfo = target->InitCharmInfo(target)) charmInfo->InitPossessCreateSpells(); p_caster->PossessSpellInitialize(); @@ -3636,7 +3647,7 @@ void Aura::HandleModPossess(bool apply, bool Real) p_caster->SetCharm(NULL); p_caster->SetFarSightGUID(0); - p_caster->SetClientControl(m_target, 0); + p_caster->SetClientControl(target, 0); p_caster->SetMover(NULL); p_caster->RemovePetActionBar(); @@ -3645,27 +3656,27 @@ void Aura::HandleModPossess(bool apply, bool Real) if(m_removeMode == AURA_REMOVE_BY_DELETE) return; - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); - m_target->SetCharmerGUID(0); + target->SetCharmerGUID(0); - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { - ((Player*)m_target)->setFactionForRace(m_target->getRace()); - ((Player*)m_target)->SetClientControl(m_target, 1); + ((Player*)target)->setFactionForRace(target->getRace()); + ((Player*)target)->SetClientControl(target, 1); } - else if(m_target->GetTypeId() == TYPEID_UNIT) + else if(target->GetTypeId() == TYPEID_UNIT) { - CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); - m_target->setFaction(cinfo->faction_A); + CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); + target->setFaction(cinfo->faction_A); } - if(m_target->GetTypeId() == TYPEID_UNIT) + if(target->GetTypeId() == TYPEID_UNIT) { - ((Creature*)m_target)->AIM_Initialize(); + ((Creature*)target)->AIM_Initialize(); - if (((Creature*)m_target)->AI()) - ((Creature*)m_target)->AI()->AttackedBy(caster); + if (((Creature*)target)->AI()) + ((Creature*)target)->AI()->AttackedBy(caster); } } } @@ -3680,7 +3691,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real) return; Pet *pet = caster->GetPet(); - if(!pet || pet != m_target) + if(!pet || pet != GetTarget()) return; Player* p_caster = (Player*)caster; @@ -3715,7 +3726,7 @@ void Aura::HandleAuraModPetTalentsPoints(bool /*Apply*/, bool Real) return; // Recalculate pet talent points - if (Pet *pet=m_target->GetPet()) + if (Pet *pet=GetTarget()->GetPet()) pet->InitTalentForLevel(); } @@ -3724,8 +3735,10 @@ void Aura::HandleModCharm(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + // not charm yourself - if(GetCasterGUID() == m_target->GetGUID()) + if(GetCasterGUID() == target->GetGUID()) return; Unit* caster = GetCaster(); @@ -3734,47 +3747,47 @@ void Aura::HandleModCharm(bool apply, bool Real) if( apply ) { - if (m_target->GetCharmerGUID()) + if (target->GetCharmerGUID()) { - m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); - m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); + target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); + target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); } - m_target->SetCharmerGUID(GetCasterGUID()); - m_target->setFaction(caster->getFaction()); - m_target->CastStop(m_target == caster ? GetId() : 0); - caster->SetCharm(m_target); + target->SetCharmerGUID(GetCasterGUID()); + target->setFaction(caster->getFaction()); + target->CastStop(target == caster ? GetId() : 0); + caster->SetCharm(target); - m_target->CombatStop(); - m_target->DeleteThreatList(); + target->CombatStop(); + target->DeleteThreatList(); - if(m_target->GetTypeId() == TYPEID_UNIT) + if(target->GetTypeId() == TYPEID_UNIT) { - ((Creature*)m_target)->AIM_Initialize(); - CharmInfo *charmInfo = m_target->InitCharmInfo(m_target); + ((Creature*)target)->AIM_Initialize(); + CharmInfo *charmInfo = target->InitCharmInfo(target); charmInfo->InitCharmCreateSpells(); charmInfo->SetReactState( REACT_DEFENSIVE ); if(caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK) { - CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); + CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); if(cinfo && cinfo->type == CREATURE_TYPE_DEMON) { // creature with pet number expected have class set - if(m_target->GetByteValue(UNIT_FIELD_BYTES_0, 1)==0) + if(target->GetByteValue(UNIT_FIELD_BYTES_0, 1)==0) { if(cinfo->unit_class==0) sLog.outErrorDb("Creature (Entry: %u) have unit_class = 0 but used in charmed spell, that will be result client crash.",cinfo->Entry); else sLog.outError("Creature (Entry: %u) have unit_class = %u but at charming have class 0!!! that will be result client crash.",cinfo->Entry,cinfo->unit_class); - m_target->SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_MAGE); + target->SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_MAGE); } //just to enable stat window charmInfo->SetPetNumber(sObjectMgr.GeneratePetNumber(), true); //if charmed two demons the same session, the 2nd gets the 1st one's name - m_target->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); + target->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); } } } @@ -3784,24 +3797,24 @@ void Aura::HandleModCharm(bool apply, bool Real) } else { - m_target->SetCharmerGUID(0); + target->SetCharmerGUID(0); - if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->setFactionForRace(m_target->getRace()); + if(target->GetTypeId() == TYPEID_PLAYER) + ((Player*)target)->setFactionForRace(target->getRace()); else { - CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); + CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); // restore faction - if(((Creature*)m_target)->isPet()) + if(((Creature*)target)->isPet()) { - if(Unit* owner = m_target->GetOwner()) - m_target->setFaction(owner->getFaction()); + if(Unit* owner = target->GetOwner()) + target->setFaction(owner->getFaction()); else if(cinfo) - m_target->setFaction(cinfo->faction_A); + target->setFaction(cinfo->faction_A); } else if(cinfo) // normal creature - m_target->setFaction(cinfo->faction_A); + target->setFaction(cinfo->faction_A); // restore UNIT_FIELD_BYTES_0 if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) @@ -3809,10 +3822,10 @@ void Aura::HandleModCharm(bool apply, bool Real) // DB must have proper class set in field at loading, not req. restore, including workaround case at apply // m_target->SetByteValue(UNIT_FIELD_BYTES_0, 1, cinfo->unit_class); - if(m_target->GetCharmInfo()) - m_target->GetCharmInfo()->SetPetNumber(0, true); + if(target->GetCharmInfo()) + target->GetCharmInfo()->SetPetNumber(0, true); else - sLog.outError("Aura::HandleModCharm: target (GUID: %u TypeId: %u) has a charm aura but no charm info!", m_target->GetGUIDLow(), m_target->GetTypeId()); + sLog.outError("Aura::HandleModCharm: target (GUID: %u TypeId: %u) has a charm aura but no charm info!", target->GetGUIDLow(), target->GetTypeId()); } } @@ -3821,11 +3834,11 @@ void Aura::HandleModCharm(bool apply, bool Real) if(caster->GetTypeId() == TYPEID_PLAYER) ((Player*)caster)->RemovePetActionBar(); - if(m_target->GetTypeId() == TYPEID_UNIT) + if(target->GetTypeId() == TYPEID_UNIT) { - ((Creature*)m_target)->AIM_Initialize(); - if (((Creature*)m_target)->AI()) - ((Creature*)m_target)->AI()->AttackedBy(caster); + ((Creature*)target)->AIM_Initialize(); + if (((Creature*)target)->AI()) + ((Creature*)target)->AI()->AttackedBy(caster); } } } @@ -3835,7 +3848,7 @@ void Aura::HandleModConfuse(bool apply, bool Real) if(!Real) return; - m_target->SetConfused(apply, GetCasterGUID(), GetId()); + GetTarget()->SetConfused(apply, GetCasterGUID(), GetId()); } void Aura::HandleModFear(bool apply, bool Real) @@ -3843,7 +3856,7 @@ void Aura::HandleModFear(bool apply, bool Real) if (!Real) return; - m_target->SetFeared(apply, GetCasterGUID(), GetId()); + GetTarget()->SetFeared(apply, GetCasterGUID(), GetId()); } void Aura::HandleFeignDeath(bool apply, bool Real) @@ -3851,7 +3864,7 @@ void Aura::HandleFeignDeath(bool apply, bool Real) if(!Real) return; - m_target->SetFeignDeath(apply, GetCasterGUID(), GetId()); + GetTarget()->SetFeignDeath(apply, GetCasterGUID(), GetId()); } void Aura::HandleAuraModDisarm(bool apply, bool Real) @@ -3859,29 +3872,31 @@ void Aura::HandleAuraModDisarm(bool apply, bool Real) if(!Real) return; - if(!apply && m_target->HasAuraType(SPELL_AURA_MOD_DISARM)) + Unit *target = GetTarget(); + + if(!apply && target->HasAuraType(SPELL_AURA_MOD_DISARM)) return; // not sure for it's correctness if(apply) - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); else - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); // only at real add/remove aura - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return; // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove. - if (m_target->IsInFeralForm()) + if (target->IsInFeralForm()) return; if (apply) - m_target->SetAttackTime(BASE_ATTACK,BASE_ATTACK_TIME); + target->SetAttackTime(BASE_ATTACK,BASE_ATTACK_TIME); else - ((Player *)m_target)->SetRegularAttackTime(); + ((Player *)target)->SetRegularAttackTime(); - m_target->UpdateDamagePhysical(BASE_ATTACK); + target->UpdateDamagePhysical(BASE_ATTACK); } void Aura::HandleAuraModStun(bool apply, bool Real) @@ -3889,43 +3904,45 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + if (apply) { // Frost stun aura -> freeze/unfreeze target - if (GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST) - m_target->ModifyAuraState(AURA_STATE_FROZEN, apply); + if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) + target->ModifyAuraState(AURA_STATE_FROZEN, apply); - m_target->addUnitState(UNIT_STAT_STUNNED); - m_target->SetTargetGUID(0); + target->addUnitState(UNIT_STAT_STUNNED); + target->SetTargetGUID(0); - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - m_target->CastStop(m_target->GetGUID() == GetCasterGUID() ? GetId() : 0); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + target->CastStop(target->GetGUID() == GetCasterGUID() ? GetId() : 0); // Creature specific - if(m_target->GetTypeId() != TYPEID_PLAYER) - m_target->StopMoving(); + if(target->GetTypeId() != TYPEID_PLAYER) + target->StopMoving(); else { - ((Player*)m_target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE); - m_target->SetStandState(UNIT_STAND_STATE_STAND);// in 1.5 client + ((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE); + target->SetStandState(UNIT_STAND_STATE_STAND);// in 1.5 client } WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8); - data << m_target->GetPackGUID(); + data << target->GetPackGUID(); data << uint32(0); - m_target->SendMessageToSet(&data, true); + target->SendMessageToSet(&data, true); // Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine if(GetId() == 39837) { GameObject* pObj = new GameObject; - if(pObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, m_target->GetMap(), m_target->GetPhaseMask(), - m_target->GetPositionX(), m_target->GetPositionY(), m_target->GetPositionZ(), m_target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) + if(pObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, target->GetMap(), target->GetPhaseMask(), + target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { pObj->SetRespawnTime(GetAuraDuration()/IN_MILLISECONDS); pObj->SetSpellId(GetId()); - m_target->AddGameObject(pObj); - m_target->GetMap()->Add(pObj); + target->AddGameObject(pObj); + target->GetMap()->Add(pObj); } else delete pObj; @@ -3934,12 +3951,12 @@ void Aura::HandleAuraModStun(bool apply, bool Real) else { // Frost stun aura -> freeze/unfreeze target - if (GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST) + if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) { bool found_another = false; for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) { - Unit::AuraList const& auras = m_target->GetAurasByType(*itr); + Unit::AuraList const& auras = target->GetAurasByType(*itr); for(Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { if( GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) @@ -3953,29 +3970,29 @@ void Aura::HandleAuraModStun(bool apply, bool Real) } if(!found_another) - m_target->ModifyAuraState(AURA_STATE_FROZEN, apply); + target->ModifyAuraState(AURA_STATE_FROZEN, apply); } // Real remove called after current aura remove from lists, check if other similar auras active - if(m_target->HasAuraType(SPELL_AURA_MOD_STUN)) + if(target->HasAuraType(SPELL_AURA_MOD_STUN)) return; - m_target->clearUnitState(UNIT_STAT_STUNNED); - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + target->clearUnitState(UNIT_STAT_STUNNED); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if(!m_target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect + if(!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect { - if(m_target->getVictim() && m_target->isAlive()) - m_target->SetTargetGUID(m_target->getVictim()->GetGUID()); + if(target->getVictim() && target->isAlive()) + target->SetTargetGUID(target->getVictim()->GetGUID()); WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); - data << m_target->GetPackGUID(); + data << target->GetPackGUID(); data << uint32(0); - m_target->SendMessageToSet(&data, true); + target->SendMessageToSet(&data, true); } // Wyvern Sting - if (m_spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags & UI64LIT(0x0000100000000000)) + if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000100000000000)) { Unit* caster = GetCaster(); if( !caster || caster->GetTypeId()!=TYPEID_PLAYER ) @@ -4001,7 +4018,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(!spellInfo) return; - caster->CastSpell(m_target,spellInfo,true,NULL,this); + caster->CastSpell(target,spellInfo,true,NULL,this); return; } } @@ -4009,44 +4026,46 @@ void Aura::HandleAuraModStun(bool apply, bool Real) void Aura::HandleModStealth(bool apply, bool Real) { + Unit *target = GetTarget(); + if (apply) { // drop flag at stealth in bg - m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); // only at real aura add if (Real) { - m_target->SetStandFlags(UNIT_STAND_FLAGS_CREEP); + target->SetStandFlags(UNIT_STAND_FLAGS_CREEP); - if (m_target->GetTypeId()==TYPEID_PLAYER) - m_target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000); + if (target->GetTypeId()==TYPEID_PLAYER) + target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000); // apply only if not in GM invisibility (and overwrite invisibility state) - if (m_target->GetVisibility()!=VISIBILITY_OFF) + if (target->GetVisibility()!=VISIBILITY_OFF) { - m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); - m_target->SetVisibility(VISIBILITY_GROUP_STEALTH); + target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); + target->SetVisibility(VISIBILITY_GROUP_STEALTH); } // apply full stealth period bonuses only at first stealth aura in stack - if(m_target->GetAurasByType(SPELL_AURA_MOD_STEALTH).size()<=1) + if(target->GetAurasByType(SPELL_AURA_MOD_STEALTH).size()<=1) { - Unit::AuraList const& mDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& mDummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) { - m_target->RemoveAurasDueToSpell(31666); + target->RemoveAurasDueToSpell(31666); int32 bp = (*i)->GetModifier()->m_amount; - m_target->CastCustomSpell(m_target,31665,&bp,NULL,NULL,true); + target->CastCustomSpell(target,31665,&bp,NULL,NULL,true); } // Overkill else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000400000)) { - m_target->RemoveAurasDueToSpell(58428); - m_target->CastSpell(m_target, 58427, true); + target->RemoveAurasDueToSpell(58428); + target->CastSpell(target, 58427, true); } } } @@ -4055,36 +4074,36 @@ void Aura::HandleModStealth(bool apply, bool Real) else { // only at real aura remove of _last_ SPELL_AURA_MOD_STEALTH - if (Real && !m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) + if (Real && !target->HasAuraType(SPELL_AURA_MOD_STEALTH)) { // if no GM invisibility - if (m_target->GetVisibility()!=VISIBILITY_OFF) + if (target->GetVisibility()!=VISIBILITY_OFF) { - m_target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP); + target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP); - if (m_target->GetTypeId()==TYPEID_PLAYER) - m_target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000); + if (target->GetTypeId()==TYPEID_PLAYER) + target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000); // restore invisibility if any - if (m_target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) + if (target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) { - m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); - m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); + target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); + target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); } else - m_target->SetVisibility(VISIBILITY_ON); + target->SetVisibility(VISIBILITY_ON); } // apply delayed talent bonus remover at last stealth aura remove - Unit::AuraList const& mDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& mDummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) - m_target->CastSpell(m_target, 31666, true); + target->CastSpell(target, 31666, true); // Overkill else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000400000)) - m_target->CastSpell(m_target, 58428, true); + target->CastSpell(target, 58428, true); } } } @@ -4092,48 +4111,50 @@ void Aura::HandleModStealth(bool apply, bool Real) void Aura::HandleInvisibility(bool apply, bool Real) { + Unit *target = GetTarget(); + if(apply) { - m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); + target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); - m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); - if(Real && m_target->GetTypeId()==TYPEID_PLAYER) + if(Real && target->GetTypeId()==TYPEID_PLAYER) { // apply glow vision - m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); + target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); } // apply only if not in GM invisibility and not stealth - if(m_target->GetVisibility() == VISIBILITY_ON) + if(target->GetVisibility() == VISIBILITY_ON) { // Aura not added yet but visibility code expect temporary add aura - m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); - m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); + target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); + target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); } } else { // recalculate value at modifier remove (current aura already removed) - m_target->m_invisibilityMask = 0; - Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY); + target->m_invisibilityMask = 0; + Unit::AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY); for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); + target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); // only at real aura remove and if not have different invisibility auras. - if(Real && m_target->m_invisibilityMask == 0) + if(Real && target->m_invisibilityMask == 0) { // remove glow vision - if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->RemoveFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); + if(target->GetTypeId() == TYPEID_PLAYER) + target->RemoveFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); // apply only if not in GM invisibility & not stealthed while invisible - if(m_target->GetVisibility() != VISIBILITY_OFF) + if(target->GetVisibility() != VISIBILITY_OFF) { // if have stealth aura then already have stealth visibility - if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) - m_target->SetVisibility(VISIBILITY_ON); + if(!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) + target->SetVisibility(VISIBILITY_ON); } } } @@ -4141,20 +4162,22 @@ void Aura::HandleInvisibility(bool apply, bool Real) void Aura::HandleInvisibilityDetect(bool apply, bool Real) { + Unit *target = GetTarget(); + if(apply) { - m_target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue); + target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue); } else { // recalculate value at modifier remove (current aura already removed) - m_target->m_detectInvisibilityMask = 0; - Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); + target->m_detectInvisibilityMask = 0; + Unit::AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - m_target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue); + target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue); } - if(Real && m_target->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_target)->UpdateVisibilityForPlayer(); + if(Real && target->GetTypeId()==TYPEID_PLAYER) + ((Player*)target)->UpdateVisibilityForPlayer(); } void Aura::HandleAuraModRoot(bool apply, bool Real) @@ -4163,41 +4186,43 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + if (apply) { // Frost root aura -> freeze/unfreeze target - if (GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST) - m_target->ModifyAuraState(AURA_STATE_FROZEN, apply); + if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) + target->ModifyAuraState(AURA_STATE_FROZEN, apply); - m_target->addUnitState(UNIT_STAT_ROOT); - m_target->SetTargetGUID(0); + target->addUnitState(UNIT_STAT_ROOT); + target->SetTargetGUID(0); //Save last orientation - if( m_target->getVictim() ) - m_target->SetOrientation(m_target->GetAngle(m_target->getVictim())); + if( target->getVictim() ) + target->SetOrientation(target->GetAngle(target->getVictim())); - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10); - data << m_target->GetPackGUID(); + data << target->GetPackGUID(); data << (uint32)2; - m_target->SendMessageToSet(&data, true); + target->SendMessageToSet(&data, true); //Clear unit movement flags - ((Player*)m_target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE); + ((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE); } else - m_target->StopMoving(); + target->StopMoving(); } else { // Frost root aura -> freeze/unfreeze target - if (GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST) + if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) { bool found_another = false; for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) { - Unit::AuraList const& auras = m_target->GetAurasByType(*itr); + Unit::AuraList const& auras = target->GetAurasByType(*itr); for(Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { if( GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) @@ -4211,26 +4236,26 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) } if(!found_another) - m_target->ModifyAuraState(AURA_STATE_FROZEN, apply); + target->ModifyAuraState(AURA_STATE_FROZEN, apply); } // Real remove called after current aura remove from lists, check if other similar auras active - if(m_target->HasAuraType(SPELL_AURA_MOD_ROOT)) + if(target->HasAuraType(SPELL_AURA_MOD_ROOT)) return; - m_target->clearUnitState(UNIT_STAT_ROOT); + target->clearUnitState(UNIT_STAT_ROOT); - if(!m_target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect + if(!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect { - if(m_target->getVictim() && m_target->isAlive()) - m_target->SetTargetGUID(m_target->getVictim()->GetGUID()); + if(target->getVictim() && target->isAlive()) + target->SetTargetGUID(target->getVictim()->GetGUID()); - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 10); - data << m_target->GetPackGUID(); + data << target->GetPackGUID(); data << (uint32)2; - m_target->SendMessageToSet(&data, true); + target->SendMessageToSet(&data, true); } } } @@ -4242,23 +4267,25 @@ void Aura::HandleAuraModSilence(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + if(apply) { - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) - if (Spell* spell = m_target->GetCurrentSpell(CurrentSpellTypes(i))) + if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) if(spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) // Stop spells on prepare or casting state - m_target->InterruptSpell(CurrentSpellTypes(i), false); + target->InterruptSpell(CurrentSpellTypes(i), false); } else { // Real remove called after current aura remove from lists, check if other similar auras active - if(m_target->HasAuraType(SPELL_AURA_MOD_SILENCE)) + if(target->HasAuraType(SPELL_AURA_MOD_SILENCE)) return; - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); } } @@ -4268,7 +4295,9 @@ void Aura::HandleModThreat(bool apply, bool Real) if (!Real) return; - if (!m_target->isAlive()) + Unit *target = GetTarget(); + + if (!target->isAlive()) return; Unit* caster = GetCaster(); @@ -4282,12 +4311,12 @@ void Aura::HandleModThreat(bool apply, bool Real) { // Arcane Shroud case 26400: - level_diff = m_target->getLevel() - 60; + level_diff = target->getLevel() - 60; multiplier = 2; break; // The Eye of Diminution case 28862: - level_diff = m_target->getLevel() - 60; + level_diff = target->getLevel() - 60; multiplier = 1; break; } @@ -4295,10 +4324,10 @@ void Aura::HandleModThreat(bool apply, bool Real) if (level_diff > 0) m_modifier.m_amount += multiplier * level_diff; - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) if (m_modifier.m_miscvalue & int32(1<m_threatModifier[x], float(m_modifier.m_amount), apply); + ApplyPercentModFloatVar(target->m_threatModifier[x], float(m_modifier.m_amount), apply); } void Aura::HandleAuraModTotalThreat(bool apply, bool Real) @@ -4307,7 +4336,9 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) if (!Real) return; - if (!m_target->isAlive() || m_target->GetTypeId() != TYPEID_PLAYER) + Unit *target = GetTarget(); + + if (!target->isAlive() || target->GetTypeId() != TYPEID_PLAYER) return; Unit* caster = GetCaster(); @@ -4317,7 +4348,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount); - m_target->getHostileRefManager().threatAssist(caster, threatMod, GetSpellProto()); + target->getHostileRefManager().threatAssist(caster, threatMod, GetSpellProto()); } void Aura::HandleModTaunt(bool apply, bool Real) @@ -4325,8 +4356,10 @@ void Aura::HandleModTaunt(bool apply, bool Real) // only at real add/remove aura if (!Real) return; + + Unit *target = GetTarget(); - if (!m_target->isAlive() || !m_target->CanHaveThreatList()) + if (!target->isAlive() || !target->CanHaveThreatList()) return; Unit* caster = GetCaster(); @@ -4335,11 +4368,11 @@ void Aura::HandleModTaunt(bool apply, bool Real) return; if (apply) - m_target->TauntApply(caster); + target->TauntApply(caster); else { // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat - m_target->TauntFadeOut(caster); + target->TauntFadeOut(caster); } } @@ -4352,7 +4385,7 @@ void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real) if(!Real) return; - m_target->UpdateSpeed(MOVE_RUN, true); + GetTarget()->UpdateSpeed(MOVE_RUN, true); } void Aura::HandleAuraModIncreaseMountedSpeed(bool apply, bool Real) @@ -4361,12 +4394,14 @@ void Aura::HandleAuraModIncreaseMountedSpeed(bool apply, bool Real) if(!Real) return; - m_target->UpdateSpeed(MOVE_RUN, true); + Unit *target = GetTarget(); + + target->UpdateSpeed(MOVE_RUN, true); // Festive Holiday Mount - if (apply && GetSpellProto()->SpellIconID != 1794 && m_target->HasAura(62061)) + if (apply && GetSpellProto()->SpellIconID != 1794 && target->HasAura(62061)) // Reindeer Transformation - m_target->CastSpell(m_target, 25860, true, NULL, this); + target->CastSpell(target, 25860, true, NULL, this); } void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) @@ -4375,6 +4410,8 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + // Enable Fly mode for flying mounts if (m_modifier.m_auraname == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) { @@ -4383,28 +4420,28 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12); else data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12); - data << m_target->GetPackGUID(); + data << target->GetPackGUID(); data << uint32(0); // unknown - m_target->SendMessageToSet(&data, true); + target->SendMessageToSet(&data, true); //Players on flying mounts must be immune to polymorph - if (m_target->GetTypeId()==TYPEID_PLAYER) - m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply); + if (target->GetTypeId()==TYPEID_PLAYER) + target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply); // Dragonmaw Illusion (overwrite mount model, mounted aura already applied) - if (apply && m_target->HasAura(42016, EFFECT_INDEX_0) && m_target->GetMountID()) - m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); + if (apply && target->HasAura(42016, EFFECT_INDEX_0) && target->GetMountID()) + target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); // Festive Holiday Mount - if (apply && GetSpellProto()->SpellIconID != 1794 && m_target->HasAura(62061)) + if (apply && GetSpellProto()->SpellIconID != 1794 && target->HasAura(62061)) // Reindeer Transformation - m_target->CastSpell(m_target, 25860, true, NULL, this); + target->CastSpell(target, 25860, true, NULL, this); } // Swift Flight Form check for higher speed flying mounts - if (apply && m_target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->Id == 40121) + if (apply && target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->Id == 40121) { - for (PlayerSpellMap::const_iterator iter = ((Player*)m_target)->GetSpellMap().begin(); iter != ((Player*)m_target)->GetSpellMap().end(); ++iter) + for (PlayerSpellMap::const_iterator iter = ((Player*)target)->GetSpellMap().begin(); iter != ((Player*)target)->GetSpellMap().end(); ++iter) { if (iter->second.state != PLAYERSPELL_REMOVED) { @@ -4429,7 +4466,7 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) } } - m_target->UpdateSpeed(MOVE_FLIGHT, true); + target->UpdateSpeed(MOVE_FLIGHT, true); } void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real) @@ -4438,7 +4475,7 @@ void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real) if(!Real) return; - m_target->UpdateSpeed(MOVE_SWIM, true); + GetTarget()->UpdateSpeed(MOVE_SWIM, true); } void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) @@ -4447,19 +4484,21 @@ void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + if (apply) { // Gronn Lord's Grasp, becomes stoned if (GetId() == 33572) { - if (GetStackAmount() >= 5 && !m_target->HasAura(33652)) - m_target->CastSpell(m_target, 33652, true); + if (GetStackAmount() >= 5 && !target->HasAura(33652)) + target->CastSpell(target, 33652, true); } } - m_target->UpdateSpeed(MOVE_RUN, true); - m_target->UpdateSpeed(MOVE_SWIM, true); - m_target->UpdateSpeed(MOVE_FLIGHT, true); + target->UpdateSpeed(MOVE_RUN, true); + target->UpdateSpeed(MOVE_SWIM, true); + target->UpdateSpeed(MOVE_FLIGHT, true); } void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) @@ -4468,9 +4507,11 @@ void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) if(!Real) return; - m_target->UpdateSpeed(MOVE_RUN, true); - m_target->UpdateSpeed(MOVE_SWIM, true); - m_target->UpdateSpeed(MOVE_FLIGHT, true); + Unit *target = GetTarget(); + + target->UpdateSpeed(MOVE_RUN, true); + target->UpdateSpeed(MOVE_SWIM, true); + target->UpdateSpeed(MOVE_FLIGHT, true); } /*********************************************************/ @@ -4485,6 +4526,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) if (GetId() == 25771) misc = MECHANIC_IMMUNE_SHIELD; + Unit *target = GetTarget(); if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { @@ -4494,16 +4536,16 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) if(GetId()==42292 || GetId()==59752) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; - m_target->RemoveAurasAtMechanicImmunity(mechanic,GetId()); + target->RemoveAurasAtMechanicImmunity(mechanic,GetId()); } - m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,misc,apply); + target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,misc,apply); // Bestial Wrath if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellIconID == 1680) { // The Beast Within cast on owner if talent present - if (Unit* owner = m_target->GetOwner()) + if (Unit* owner = target->GetOwner()) { // Search talent The Beast Within Unit::AuraList const& dummyAuras = owner->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); @@ -4521,8 +4563,8 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) } } // Heroic Fury (Intercept cooldown remove) - else if (apply && GetSpellProto()->Id == 60970 && m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->RemoveSpellCooldown(20252, true); + else if (apply && GetSpellProto()->Id == 60970 && target->GetTypeId() == TYPEID_PLAYER) + ((Player*)target)->RemoveSpellCooldown(20252, true); } void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/) @@ -4530,7 +4572,7 @@ void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/) uint32 mechanic = m_modifier.m_miscvalue; if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) - m_target->RemoveAurasAtMechanicImmunity(mechanic,GetId()); + GetTarget()->RemoveAurasAtMechanicImmunity(mechanic,GetId()); // check implemented in Unit::IsImmunedToSpell and Unit::IsImmunedToSpellEffect } @@ -4538,27 +4580,29 @@ void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/) //this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect void Aura::HandleAuraModEffectImmunity(bool apply, bool /*Real*/) { + Unit *target = GetTarget(); + // when removing flag aura, handle flag drop - if( !apply && m_target->GetTypeId() == TYPEID_PLAYER + if( !apply && target->GetTypeId() == TYPEID_PLAYER && (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION) ) { - if( BattleGround *bg = ((Player*)m_target)->GetBattleGround() ) - bg->EventPlayerDroppedFlag(((Player*)m_target)); + if( BattleGround *bg = ((Player*)target)->GetBattleGround() ) + bg->EventPlayerDroppedFlag(((Player*)target)); } - m_target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, m_modifier.m_miscvalue, apply); + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, m_modifier.m_miscvalue, apply); } void Aura::HandleAuraModStateImmunity(bool apply, bool Real) { if(apply && Real && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { - Unit::AuraList const& auraList = m_target->GetAurasByType(AuraType(m_modifier.m_miscvalue)); + Unit::AuraList const& auraList = GetTarget()->GetAurasByType(AuraType(m_modifier.m_miscvalue)); for(Unit::AuraList::const_iterator itr = auraList.begin(); itr != auraList.end();) { if (auraList.front() != this) // skip itself aura (it already added) { - m_target->RemoveAurasDueToSpell(auraList.front()->GetId()); + GetTarget()->RemoveAurasDueToSpell(auraList.front()->GetId()); itr = auraList.begin(); } else @@ -4566,17 +4610,18 @@ void Aura::HandleAuraModStateImmunity(bool apply, bool Real) } } - m_target->ApplySpellImmune(GetId(), IMMUNITY_STATE, m_modifier.m_miscvalue, apply); + GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_STATE, m_modifier.m_miscvalue, apply); } void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) { - m_target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, m_modifier.m_miscvalue, apply); + Unit* target = GetTarget(); + target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, m_modifier.m_miscvalue, apply); // remove all flag auras (they are positive, but they must be removed when you are immune) - if( this->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY - && this->GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD ) - m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + if( GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY + && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD ) + target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); // TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else if( Real && apply @@ -4584,7 +4629,7 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) && IsPositiveSpell(GetId()) ) //Only positive immunity removes auras { uint32 school_mask = m_modifier.m_miscvalue; - Unit::AuraMap& Auras = m_target->GetAuras(); + Unit::AuraMap& Auras = target->GetAuras(); for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) { next = iter; @@ -4595,7 +4640,7 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) && !iter->second->IsPositive() //Don't remove positive spells && spell->Id != GetId() ) //Don't remove self { - m_target->RemoveAurasDueToSpell(spell->Id); + target->RemoveAurasDueToSpell(spell->Id); if(Auras.empty()) break; else @@ -4606,15 +4651,15 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) if( Real && GetSpellProto()->Mechanic == MECHANIC_BANISH ) { if( apply ) - m_target->addUnitState(UNIT_STAT_ISOLATED); + target->addUnitState(UNIT_STAT_ISOLATED); else - m_target->clearUnitState(UNIT_STAT_ISOLATED); + target->clearUnitState(UNIT_STAT_ISOLATED); } } void Aura::HandleAuraModDmgImmunity(bool apply, bool /*Real*/) { - m_target->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, m_modifier.m_miscvalue, apply); + GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, m_modifier.m_miscvalue, apply); } void Aura::HandleAuraModDispelImmunity(bool apply, bool Real) @@ -4623,7 +4668,7 @@ void Aura::HandleAuraModDispelImmunity(bool apply, bool Real) if(!Real) return; - m_target->ApplySpellDispelImmunity(m_spellProto, DispelType(m_modifier.m_miscvalue), apply); + GetTarget()->ApplySpellDispelImmunity(GetSpellProto(), DispelType(m_modifier.m_miscvalue), apply); } void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real) @@ -4648,9 +4693,9 @@ void Aura::HandleAuraModStalked(bool apply, bool /*Real*/) { // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND if(apply) - m_target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT); + GetTarget()->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT); else - m_target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT); + GetTarget()->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT); } /*********************************************************/ @@ -4661,24 +4706,26 @@ void Aura::HandlePeriodicTriggerSpell(bool apply, bool /*Real*/) { m_isPeriodic = apply; + Unit *target = GetTarget(); + if (!apply) { - switch(m_spellProto->Id) + switch(GetId()) { case 66: // Invisibility - if (m_removeMode == AURA_REMOVE_BY_DEFAULT && m_duration<=0) - m_target->CastSpell(m_target, 32612, true, NULL, this); + if (m_removeMode == AURA_REMOVE_BY_EXPIRE) + target->CastSpell(target, 32612, true, NULL, this); return; case 42783: //Wrath of the Astrom... if (m_removeMode == AURA_REMOVE_BY_DEFAULT && GetEffIndex() + 1 < MAX_EFFECT_INDEX) - m_target->CastSpell(m_target, m_spellProto->CalculateSimpleValue(SpellEffectIndex(GetEffIndex()+1)), true); + target->CastSpell(target, GetSpellProto()->CalculateSimpleValue(SpellEffectIndex(GetEffIndex()+1)), true); return; case 51912: // Ultra-Advanced Proto-Typical Shortening Blaster - if (m_removeMode == AURA_REMOVE_BY_DEFAULT && m_duration <= 0) + if (m_removeMode == AURA_REMOVE_BY_EXPIRE) { if (Unit* pCaster = GetCaster()) - pCaster->CastSpell(m_target, m_spellProto->EffectTriggerSpell[GetEffIndex()], true, NULL, this); + pCaster->CastSpell(target, GetSpellProto()->EffectTriggerSpell[GetEffIndex()], true, NULL, this); } return; @@ -4698,8 +4745,10 @@ void Aura::HandlePeriodicEnergize(bool apply, bool Real) if (!Real) return; + Unit *target = GetTarget(); + // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); + bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); if (apply && !loading) { @@ -4725,11 +4774,11 @@ void Aura::HandlePeriodicEnergize(bool apply, bool Real) break; } case 48391: // Owlkin Frenzy 2% base mana - m_modifier.m_amount = m_target->GetCreateMana() * 2 / 100; + m_modifier.m_amount = target->GetCreateMana() * 2 / 100; break; case 57669: // Replenishment (0.2% from max) case 61782: // Infinite Replenishment - m_modifier.m_amount = m_target->GetMaxPower(POWER_MANA) * 2 / 1000; + m_modifier.m_amount = target->GetMaxPower(POWER_MANA) * 2 / 1000; break; default: break; @@ -4750,8 +4799,10 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); + bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); SpellEntry const*spell = GetSpellProto(); switch( spell->SpellFamilyName) @@ -4763,9 +4814,9 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real) switch(spell->Id) { // Master of Subtlety - case 31666: m_target->RemoveAurasDueToSpell(31665); break; + case 31666: target->RemoveAurasDueToSpell(31665); break; // Overkill - case 58428: m_target->RemoveAurasDueToSpell(58427); break; + case 58428: target->RemoveAurasDueToSpell(58427); break; } } break; @@ -4788,8 +4839,10 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) { m_isPeriodic = apply; + Unit *target = GetTarget(); + // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); + bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) @@ -4802,17 +4855,17 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) return; // Gift of the Naaru (have diff spellfamilies) - if (m_spellProto->SpellIconID == 329 && m_spellProto->SpellVisual[0] == 7625) + if (GetSpellProto()->SpellIconID == 329 && GetSpellProto()->SpellVisual[0] == 7625) { int32 ap = int32 (0.22f * caster->GetTotalAttackPowerValue(BASE_ATTACK)); - int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)); + int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(GetSpellProto())); if (holy < 0) holy = 0; holy = int32(holy * 377 / 1000); m_modifier.m_amount += ap > holy ? ap : holy; } - m_modifier.m_amount = caster->SpellHealingBonusDone(m_target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); + m_modifier.m_amount = caster->SpellHealingBonusDone(target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); } } @@ -4824,8 +4877,11 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) m_isPeriodic = apply; + Unit *target = GetTarget(); + SpellEntry const* spellProto = GetSpellProto(); + // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); + bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) @@ -4837,12 +4893,12 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if (!caster) return; - switch (m_spellProto->SpellFamilyName) + switch (spellProto->SpellFamilyName) { case SPELLFAMILY_GENERIC: { // Pounce Bleed - if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 ) + if (spellProto->SpellIconID == 147 && spellProto->SpellVisual[0] == 0) // $AP*0.18/6 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100); break; @@ -4850,7 +4906,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_WARRIOR: { // Rend - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000020)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000020)) { // $0.2*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); @@ -4859,18 +4915,18 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE); m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f); // If used while target is above 75% health, Rend does 35% more damage - if (m_spellProto->CalculateSimpleValue(EFFECT_INDEX_1) !=0 && - m_target->GetHealth() > m_target->GetMaxHealth() * m_spellProto->CalculateSimpleValue(EFFECT_INDEX_1) / 100) - m_modifier.m_amount += m_modifier.m_amount * m_spellProto->CalculateSimpleValue(EFFECT_INDEX_2) / 100; + if (spellProto->CalculateSimpleValue(EFFECT_INDEX_1) !=0 && + target->GetHealth() > target->GetMaxHealth() * spellProto->CalculateSimpleValue(EFFECT_INDEX_1) / 100) + m_modifier.m_amount += m_modifier.m_amount * spellProto->CalculateSimpleValue(EFFECT_INDEX_2) / 100; } break; } case SPELLFAMILY_WARLOCK: { // Drain Soul - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { - if (m_target->GetHealth() * 100 / m_target->GetMaxHealth() <= 25) + if (target->GetHealth() * 100 / target->GetMaxHealth() <= 25) m_modifier.m_amount *= 4; } break; @@ -4878,15 +4934,15 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_DRUID: { // Rake - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000001000) && m_spellProto->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_ADD_COMBO_POINTS) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000001000) && spellProto->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_ADD_COMBO_POINTS) // $AP*0.18/3 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100); // Lacerate - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000010000000000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x000000010000000000)) // $AP*0.05/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); // Rip - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000800000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x000000000000800000)) { // 0.01*$AP*cp if (caster->GetTypeId() != TYPEID_PLAYER) @@ -4907,7 +4963,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100); } // Lock Jaw - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x1000000000000000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x1000000000000000)) // 0.15*$AP m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100); break; @@ -4915,7 +4971,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_ROGUE: { // Rupture - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000100000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x000000000000100000)) { if (caster->GetTypeId() != TYPEID_PLAYER) break; @@ -4930,11 +4986,11 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]); } // Garrote - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000000100)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x000000000000000100)) // $AP*0.07 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100); // Deadly Poison - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000010000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000010000)) // 0.12*$AP / 4 * amount of stack m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 * GetStackAmount() / 100); break; @@ -4942,11 +4998,11 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_HUNTER: { // Serpent Sting - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) // $RAP*0.2/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.2 / 5); // Immolation Trap - if ((m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) && m_spellProto->SpellIconID == 678) + if ((spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) && spellProto->SpellIconID == 678) // $RAP*0.1/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); break; @@ -4954,11 +5010,11 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_PALADIN: { // Holy Vengeance / Blood Corruption - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000080000000000) && m_spellProto->SpellVisual[0] == 7902) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000080000000000) && spellProto->SpellVisual[0] == 7902) { // AP * 0.025 + SPH * 0.013 bonus per tick float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); - int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)); + int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)); if (holy < 0) holy = 0; m_modifier.m_amount += int32(GetStackAmount()) * (int32(ap * 0.025f) + int32(holy * 13 / 1000)); @@ -4968,7 +5024,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_DEATHKNIGHT: { //Frost Fever and Blood Plague AP scale - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x400080000000000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x400080000000000)) { m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.055f * 1.15f); } @@ -4981,13 +5037,13 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) { // SpellDamageBonusDone for magic spells - if(GetSpellProto()->DmgClass == SPELL_DAMAGE_CLASS_NONE || GetSpellProto()->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) - m_modifier.m_amount = caster->SpellDamageBonusDone(m_target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); + if(spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) + m_modifier.m_amount = caster->SpellDamageBonusDone(target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); // MeleeDamagebonusDone for weapon based spells else { WeaponAttackType attackType = GetWeaponAttackType(GetSpellProto()); - m_modifier.m_amount = caster->MeleeDamageBonusDone(m_target, m_modifier.m_amount, attackType, GetSpellProto(), DOT, GetStackAmount()); + m_modifier.m_amount = caster->MeleeDamageBonusDone(target, m_modifier.m_amount, attackType, GetSpellProto(), DOT, GetStackAmount()); } } } @@ -4995,8 +5051,8 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) else { // Parasitic Shadowfiend - handle summoning of two Shadowfiends on DoT expire - if(m_spellProto->Id == 41917) - m_target->CastSpell(m_target, 41915, true); + if(spellProto->Id == 41917) + target->CastSpell(target, 41915, true); } } @@ -5010,7 +5066,7 @@ void Aura::HandlePeriodicLeech(bool apply, bool /*Real*/) m_isPeriodic = apply; // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); + bool loading = (GetTarget()->GetTypeId() == TYPEID_PLAYER && ((Player*)GetTarget())->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) @@ -5022,7 +5078,7 @@ void Aura::HandlePeriodicLeech(bool apply, bool /*Real*/) if (!caster) return; - m_modifier.m_amount = caster->SpellDamageBonusDone(m_target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); + m_modifier.m_amount = caster->SpellDamageBonusDone(GetTarget(), GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); } } @@ -5036,7 +5092,7 @@ void Aura::HandlePeriodicHealthFunnel(bool apply, bool /*Real*/) m_isPeriodic = apply; // For prevent double apply bonuses - bool loading = (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()); + bool loading = (GetTarget()->GetTypeId() == TYPEID_PLAYER && ((Player*)GetTarget())->GetSession()->PlayerLoading()); // Custom damage calculation after if (apply) @@ -5048,7 +5104,7 @@ void Aura::HandlePeriodicHealthFunnel(bool apply, bool /*Real*/) if (!caster) return; - m_modifier.m_amount = caster->SpellDamageBonusDone(m_target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); + m_modifier.m_amount = caster->SpellDamageBonusDone(GetTarget(), GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); } } @@ -5066,9 +5122,9 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/) { if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); - if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + GetTarget()->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); } } } @@ -5079,9 +5135,9 @@ void Aura::HandleAuraModResistance(bool apply, bool /*Real*/) { if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); - if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->isPet()) + GetTarget()->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); } } } @@ -5089,33 +5145,35 @@ void Aura::HandleAuraModResistance(bool apply, bool /*Real*/) void Aura::HandleAuraModBaseResistancePCT(bool apply, bool /*Real*/) { // only players have base stats - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) { //pets only have base armor - if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); + if(((Creature*)GetTarget())->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) + GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); } else { for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) { if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); } } } void Aura::HandleModResistancePercent(bool apply, bool /*Real*/) { + Unit *target = GetTarget(); + for(int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) { if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); - if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) + target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); + if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet()) { - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, float(m_modifier.m_amount), apply); - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, float(m_modifier.m_amount), apply); + target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, float(m_modifier.m_amount), apply); + target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, float(m_modifier.m_amount), apply); } } } @@ -5124,17 +5182,17 @@ void Aura::HandleModResistancePercent(bool apply, bool /*Real*/) void Aura::HandleModBaseResistance(bool apply, bool /*Real*/) { // only players have base stats - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) { //only pets have base stats - if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); + if(((Creature*)GetTarget())->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) + GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { for(int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) if(m_modifier.m_miscvalue & (1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); } } @@ -5156,9 +5214,9 @@ void Aura::HandleAuraModStat(bool apply, bool /*Real*/) if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i) { //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); - if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->isPet()) + GetTarget()->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply); } } } @@ -5172,34 +5230,34 @@ void Aura::HandleModPercentStat(bool apply, bool /*Real*/) } // only players have base stats - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); } } void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Magic damage modifiers implemented in Unit::SpellDamageBonusDone // This information for client side use only // Recalculate bonus - ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); } void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Recalculate bonus - ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); } void Aura::HandleAuraModDispelResist(bool apply, bool Real) @@ -5208,36 +5266,36 @@ void Aura::HandleAuraModDispelResist(bool apply, bool Real) return; if(GetId() == 33206) - m_target->CastSpell(m_target, 44416, true, NULL, this, GetCasterGUID()); + GetTarget()->CastSpell(GetTarget(), 44416, true, NULL, this, GetCasterGUID()); } void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Magic damage modifiers implemented in Unit::SpellDamageBonusDone // This information for client side use only // Recalculate bonus - ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); } void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Recalculate bonus - ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); } void Aura::HandleModHealingDone(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // implemented in Unit::SpellHealingBonusDone // this information is for client side only - ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); + ((Player*)GetTarget())->UpdateSpellDamageAndHealingBonus(); } void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/) @@ -5248,32 +5306,34 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/) return; } + Unit *target = GetTarget(); + //save current and max HP before applying aura - uint32 curHPValue = m_target->GetHealth(); - uint32 maxHPValue = m_target->GetMaxHealth(); + uint32 curHPValue = target->GetHealth(); + uint32 maxHPValue = target->GetMaxHealth(); for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) { if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) { - m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); - if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply ); + target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); + if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet()) + target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply ); } } //recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag) - if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (m_spellProto->Attributes & 0x10)) + if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (GetSpellProto()->Attributes & 0x10)) { // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed - uint32 newHPValue = (m_target->GetMaxHealth() * curHPValue) / maxHPValue; - m_target->SetHealth(newHPValue); + uint32 newHPValue = (target->GetMaxHealth() * curHPValue) / maxHPValue; + target->SetHealth(newHPValue); } } void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if(m_modifier.m_miscvalue != SPELL_SCHOOL_MASK_NORMAL) @@ -5285,7 +5345,7 @@ void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool /*Real*/) } // Recalculate Armor - m_target->UpdateArmor(); + GetTarget()->UpdateArmor(); } /********************************/ @@ -5319,7 +5379,7 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking if (!Real) return; - Powers pt = m_target->getPowerType(); + Powers pt = GetTarget()->getPowerType(); if(m_modifier.periodictime == 0) { // Anger Management (only spell use this aura for rage) @@ -5331,8 +5391,8 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking m_periodicTimer = 5000; - if (m_target->GetTypeId() == TYPEID_PLAYER && m_modifier.m_miscvalue == POWER_MANA) - ((Player*)m_target)->UpdateManaRegen(); + if (GetTarget()->GetTypeId() == TYPEID_PLAYER && m_modifier.m_miscvalue == POWER_MANA) + ((Player*)GetTarget())->UpdateManaRegen(); m_isPeriodic = apply; } @@ -5343,12 +5403,12 @@ void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real) if(!Real) return; - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Update manaregen value if (m_modifier.m_miscvalue == POWER_MANA) - ((Player*)m_target)->UpdateManaRegen(); + ((Player*)GetTarget())->UpdateManaRegen(); } void Aura::HandleModManaRegen(bool /*apply*/, bool Real) @@ -5357,23 +5417,25 @@ void Aura::HandleModManaRegen(bool /*apply*/, bool Real) if(!Real) return; - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; //Note: an increase in regen does NOT cause threat. - ((Player*)m_target)->UpdateManaRegen(); + ((Player*)GetTarget())->UpdateManaRegen(); } void Aura::HandleComprehendLanguage(bool apply, bool /*Real*/) { if(apply) - m_target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG); + GetTarget()->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG); else - m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG); + GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG); } void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { + Unit *target = GetTarget(); + // Special case with temporary increase max/current health switch(GetId()) { @@ -5393,18 +5455,18 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) // Demonic Empowerment (Voidwalker) & Vampiric Blood - special cases, store percent in data // recalculate to full amount at apply for proper remove if (GetId() == 54443 || GetId() == 55233) - m_modifier.m_amount = m_target->GetMaxHealth() * m_modifier.m_amount / 100; + m_modifier.m_amount = target->GetMaxHealth() * m_modifier.m_amount / 100; - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); - m_target->ModifyHealth(m_modifier.m_amount); + target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->ModifyHealth(m_modifier.m_amount); } else { - if (int32(m_target->GetHealth()) > m_modifier.m_amount) - m_target->ModifyHealth(-m_modifier.m_amount); + if (int32(target->GetHealth()) > m_modifier.m_amount) + target->ModifyHealth(-m_modifier.m_amount); else - m_target->SetHealth(1); - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->SetHealth(1); + target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); } } return; @@ -5412,30 +5474,32 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) } // generic case - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModIncreaseMaxHealth(bool apply, bool /*Real*/) { - uint32 oldhealth = m_target->GetHealth(); - double healthPercentage = (double)oldhealth / (double)m_target->GetMaxHealth(); + Unit *target = GetTarget(); + uint32 oldhealth = target->GetHealth(); + double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth(); - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); // refresh percentage if(oldhealth > 0) { - uint32 newhealth = uint32(ceil((double)m_target->GetMaxHealth() * healthPercentage)); + uint32 newhealth = uint32(ceil((double)target->GetMaxHealth() * healthPercentage)); if(newhealth==0) newhealth = 1; - m_target->SetHealth(newhealth); + target->SetHealth(newhealth); } } void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) { - Powers powerType = m_target->getPowerType(); + Unit *target = GetTarget(); + Powers powerType = target->getPowerType(); if(int32(powerType) != m_modifier.m_miscvalue) return; @@ -5446,36 +5510,36 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) { if(Real) { - uint32 val = m_target->GetPower(powerType); - m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); - m_target->SetPower(powerType, apply ? val*(100+m_modifier.m_amount)/100 : val*100/(100+m_modifier.m_amount)); + uint32 val = target->GetPower(powerType); + target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); + target->SetPower(powerType, apply ? val*(100+m_modifier.m_amount)/100 : val*100/(100+m_modifier.m_amount)); } return; } // generic flat case - m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) { - Powers powerType = m_target->getPowerType(); + Powers powerType = GetTarget()->getPowerType(); if(int32(powerType) != m_modifier.m_miscvalue) return; UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); - m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/) { - m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/) { - m_target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(m_modifier.m_amount), apply); } /********************************/ @@ -5484,27 +5548,27 @@ void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->UpdateParryPercentage(); + ((Player*)GetTarget())->UpdateParryPercentage(); } void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->UpdateDodgePercentage(); + ((Player*)GetTarget())->UpdateDodgePercentage(); //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount)); } void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->UpdateBlockPercentage(); + ((Player*)GetTarget())->UpdateBlockPercentage(); //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount)); } @@ -5514,23 +5578,25 @@ void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->UpdateManaRegen(); + ((Player*)GetTarget())->UpdateManaRegen(); } void Aura::HandleAuraModCritPercent(bool apply, bool Real) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + Unit *target = GetTarget(); + + if(target->GetTypeId() != TYPEID_PLAYER) return; // apply item specific bonuses for already equipped weapon if(Real) { for(int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) - ((Player*)m_target)->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply); + if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) + ((Player*)target)->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply); } // mods must be applied base at equipped weapon class and subclass comparison @@ -5539,9 +5605,9 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) if (GetSpellProto()->EquippedItemClass == -1) { - ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); } else { @@ -5551,27 +5617,29 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) void Aura::HandleModHitChance(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() == TYPEID_PLAYER) + Unit *target = GetTarget(); + + if(target->GetTypeId() == TYPEID_PLAYER) { - ((Player*)m_target)->UpdateMeleeHitChances(); - ((Player*)m_target)->UpdateRangedHitChances(); + ((Player*)target)->UpdateMeleeHitChances(); + ((Player*)target)->UpdateRangedHitChances(); } else { - m_target->m_modMeleeHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); - m_target->m_modRangedHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); + target->m_modMeleeHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); + target->m_modRangedHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount); } } void Aura::HandleModSpellHitChance(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(GetTarget()->GetTypeId() == TYPEID_PLAYER) { - ((Player*)m_target)->UpdateSpellHitChances(); + ((Player*)GetTarget())->UpdateSpellHitChances(); } else { - m_target->m_modSpellHitChance += apply ? m_modifier.m_amount: (-m_modifier.m_amount); + GetTarget()->m_modSpellHitChance += apply ? m_modifier.m_amount: (-m_modifier.m_amount); } } @@ -5581,13 +5649,13 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real) if(!Real) return; - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(GetTarget()->GetTypeId() == TYPEID_PLAYER) { - ((Player*)m_target)->UpdateAllSpellCritChances(); + ((Player*)GetTarget())->UpdateAllSpellCritChances(); } else { - m_target->m_baseSpellCritChance += apply ? m_modifier.m_amount:(-m_modifier.m_amount); + GetTarget()->m_baseSpellCritChance += apply ? m_modifier.m_amount:(-m_modifier.m_amount); } } @@ -5597,12 +5665,12 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for(int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school) if (m_modifier.m_miscvalue & (1<UpdateSpellCritChance(school); + ((Player*)GetTarget())->UpdateSpellCritChance(school); } /********************************/ @@ -5611,46 +5679,49 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) void Aura::HandleModCastingSpeed(bool apply, bool /*Real*/) { - m_target->ApplyCastTimePercentMod(float(m_modifier.m_amount),apply); + GetTarget()->ApplyCastTimePercentMod(float(m_modifier.m_amount),apply); } void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool /*Real*/) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); + Unit *target = GetTarget(); + target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::HandleModCombatSpeedPct(bool apply, bool /*Real*/) { - m_target->ApplyCastTimePercentMod(float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); + Unit *target = GetTarget(); + target->ApplyCastTimePercentMod(float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::HandleModAttackSpeed(bool apply, bool /*Real*/) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,float(m_modifier.m_amount),apply); + GetTarget()->ApplyAttackTimePercentMod(BASE_ATTACK,float(m_modifier.m_amount),apply); } void Aura::HandleHaste(bool apply, bool /*Real*/) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); + Unit *target = GetTarget(); + target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedHaste(bool apply, bool /*Real*/) { - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); + GetTarget()->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); } void Aura::HandleRangedAmmoHaste(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); + GetTarget()->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); } /********************************/ @@ -5659,30 +5730,30 @@ void Aura::HandleRangedAmmoHaste(bool apply, bool /*Real*/) void Aura::HandleAuraModAttackPower(bool apply, bool /*Real*/) { - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedAttackPower(bool apply, bool /*Real*/) { - if((m_target->getClassMask() & CLASSMASK_WAND_USERS)!=0) + if((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)!=0) return; - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModAttackPowerPercent(bool apply, bool /*Real*/) { //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1 - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool /*Real*/) { - if((m_target->getClassMask() & CLASSMASK_WAND_USERS)!=0) + if((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)!=0) return; //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1 - m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); } void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool /*apply*/, bool Real) @@ -5692,8 +5763,8 @@ void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool /*apply*/, bool Real return; // Recalculate bonus - if(m_target->GetTypeId() == TYPEID_PLAYER && !(m_target->getClassMask() & CLASSMASK_WAND_USERS)) - ((Player*)m_target)->UpdateAttackPowerAndDamage(true); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER && !(GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)) + ((Player*)GetTarget())->UpdateAttackPowerAndDamage(true); } void Aura::HandleAuraModAttackPowerOfStatPercent(bool /*apply*/, bool Real) @@ -5703,8 +5774,8 @@ void Aura::HandleAuraModAttackPowerOfStatPercent(bool /*apply*/, bool Real) return; // Recalculate bonus - if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->UpdateAttackPowerAndDamage(false); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + ((Player*)GetTarget())->UpdateAttackPowerAndDamage(false); } void Aura::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real) @@ -5714,20 +5785,22 @@ void Aura::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real) return; // Recalculate bonus - if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->UpdateAttackPowerAndDamage(false); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + ((Player*)GetTarget())->UpdateAttackPowerAndDamage(false); } /********************************/ /*** DAMAGE BONUS ***/ /********************************/ void Aura::HandleModDamageDone(bool apply, bool Real) { + Unit *target = GetTarget(); + // apply item specific bonuses for already equipped weapon - if(Real && m_target->GetTypeId() == TYPEID_PLAYER) + if(Real && target->GetTypeId() == TYPEID_PLAYER) { for(int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) - ((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); + if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) + ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } // m_modifier.m_miscvalue is bitmask of spell schools @@ -5742,23 +5815,23 @@ void Aura::HandleModDamageDone(bool apply, bool Real) if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0) { // apply generic physical damage bonuses including wand case - if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER) + if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER) { - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { // done in Player::_ApplyWeaponDependentAuraMods } - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { if(m_positive) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, m_modifier.m_amount, apply); + target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, m_modifier.m_amount, apply); else - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, m_modifier.m_amount, apply); + target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, m_modifier.m_amount, apply); } } @@ -5777,14 +5850,14 @@ void Aura::HandleModDamageDone(bool apply, bool Real) // Magic damage modifiers implemented in Unit::SpellDamageBonusDone // This information for client side use only - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { if(m_positive) { for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { if((m_modifier.m_miscvalue & (1<ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, m_modifier.m_amount, apply); + target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, m_modifier.m_amount, apply); } } else @@ -5792,10 +5865,10 @@ void Aura::HandleModDamageDone(bool apply, bool Real) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { if((m_modifier.m_miscvalue & (1<ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, m_modifier.m_amount, apply); + target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, m_modifier.m_amount, apply); } } - Pet* pet = m_target->GetPet(); + Pet* pet = target->GetPet(); if(pet) pet->UpdateAttackPowerAndDamage(); } @@ -5804,13 +5877,14 @@ void Aura::HandleModDamageDone(bool apply, bool Real) void Aura::HandleModDamagePercentDone(bool apply, bool Real) { DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1); + Unit *target = GetTarget(); // apply item specific bonuses for already equipped weapon - if(Real && m_target->GetTypeId() == TYPEID_PLAYER) + if(Real && target->GetTypeId() == TYPEID_PLAYER) { for(int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) - ((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); + if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) + ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } // m_modifier.m_miscvalue is bitmask of spell schools @@ -5825,19 +5899,19 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0) { // apply generic physical damage bonuses including wand case - if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER) + if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER) { - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); + target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply); } else { // done in Player::_ApplyWeaponDependentAuraMods } // For show in client - if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, m_modifier.m_amount/100.0f, apply); + if(target->GetTypeId() == TYPEID_PLAYER) + target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, m_modifier.m_amount/100.0f, apply); } // Skip non magic case for speedup @@ -5855,9 +5929,9 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // Magic damage percent modifiers implemented in Unit::SpellDamageBonusDone // Send info to client - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, m_modifier.m_amount/100.0f, apply); + target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, m_modifier.m_amount/100.0f, apply); } void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) @@ -5868,7 +5942,7 @@ void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "AURA MOD OFFHAND DAMAGE"); - m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); + GetTarget()->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply); } /********************************/ @@ -5884,7 +5958,7 @@ void Aura::HandleModPowerCostPCT(bool apply, bool Real) float amount = m_modifier.m_amount/100.0f; for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply); + GetTarget()->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply); } void Aura::HandleModPowerCost(bool apply, bool Real) @@ -5895,7 +5969,7 @@ void Aura::HandleModPowerCost(bool apply, bool Real) for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + i, m_modifier.m_amount, apply); + GetTarget()->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + i, m_modifier.m_amount, apply); } void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) @@ -5903,10 +5977,12 @@ void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) // spells required only Real aura add/remove if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + Unit *target = GetTarget(); + if(target->GetTypeId() != TYPEID_PLAYER) return; + uint32 mask[3] = {0, 0, 0}; - Unit::AuraList const& noReagent = m_target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE); + Unit::AuraList const& noReagent = target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE); for(Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) { uint32 const *ptr = (*i)->getAuraSpellClassMask(); @@ -5915,9 +5991,9 @@ void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) mask[2] |= ptr[2]; } - m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+0, mask[0]); - m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]); - m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask[2]); + target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+0, mask[0]); + target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]); + target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask[2]); } /*********************************************************/ @@ -5933,6 +6009,8 @@ void Aura::HandleShapeshiftBoosts(bool apply) uint32 form = GetModifier()->m_miscvalue; + Unit *target = GetTarget(); + switch(form) { case FORM_CAT: @@ -5995,8 +6073,8 @@ void Aura::HandleShapeshiftBoosts(bool apply) case FORM_SHADOW: spellId1 = 49868; - if(m_target->GetTypeId() == TYPEID_PLAYER) // Spell 49868 have same category as main form spell and share cooldown - ((Player*)m_target)->RemoveSpellCooldown(49868); + if(target->GetTypeId() == TYPEID_PLAYER) // Spell 49868 have same category as main form spell and share cooldown + ((Player*)target)->RemoveSpellCooldown(49868); break; case FORM_GHOSTWOLF: spellId1 = 67116; @@ -6012,13 +6090,13 @@ void Aura::HandleShapeshiftBoosts(bool apply) if(apply) { if (spellId1) - m_target->CastSpell(m_target, spellId1, true, NULL, this ); + target->CastSpell(target, spellId1, true, NULL, this ); if (spellId2) - m_target->CastSpell(m_target, spellId2, true, NULL, this); + target->CastSpell(target, spellId2, true, NULL, this); - if (m_target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { - const PlayerSpellMap& sp_list = ((Player *)m_target)->GetSpellMap(); + const PlayerSpellMap& sp_list = ((Player *)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) continue; @@ -6027,40 +6105,40 @@ void Aura::HandleShapeshiftBoosts(bool apply) if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) continue; if (spellInfo->Stances & (1<<(form-1))) - m_target->CastSpell(m_target, itr->first, true, NULL, this); + target->CastSpell(target, itr->first, true, NULL, this); } // Master Shapeshifter if (MasterShaperSpellId) { - Unit::AuraList const& ShapeShifterAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& ShapeShifterAuras = target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = ShapeShifterAuras.begin(); i != ShapeShifterAuras.end(); i++) { if ((*i)->GetSpellProto()->SpellIconID == 2851) { int32 ShiftMod = (*i)->GetModifier()->m_amount; - m_target->CastCustomSpell(m_target, MasterShaperSpellId, &ShiftMod, NULL, NULL, true); + target->CastCustomSpell(target, MasterShaperSpellId, &ShiftMod, NULL, NULL, true); break; } } } // Leader of the Pack - if (((Player*)m_target)->HasSpell(17007)) + if (((Player*)target)->HasSpell(17007)) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(24932); if (spellInfo && spellInfo->Stances & (1<<(form-1))) - m_target->CastSpell(m_target, 24932, true, NULL, this); + target->CastSpell(target, 24932, true, NULL, this); } // Savage Roar - if (form == FORM_CAT && ((Player*)m_target)->HasAura(52610)) - m_target->CastSpell(m_target, 62071, true); + if (form == FORM_CAT && ((Player*)target)->HasAura(52610)) + target->CastSpell(target, 62071, true); // Improved Moonkin Form if (form == FORM_MOONKIN) { - Unit::AuraList const& dummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); + Unit::AuraList const& dummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); i++) { if ((*i)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_DRUID && @@ -6078,7 +6156,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) } if(spell_id) - m_target->CastSpell(m_target, spell_id, true, NULL, this); + target->CastSpell(target, spell_id, true, NULL, this); break; } } @@ -6087,7 +6165,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) // Heart of the Wild if (HotWSpellId) { - Unit::AuraList const& mModTotalStatPct = m_target->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); + Unit::AuraList const& mModTotalStatPct = target->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); for(Unit::AuraList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetModifier()->m_miscvalue == 3) @@ -6096,7 +6174,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) if(GetModifier()->m_miscvalue == FORM_CAT) HotWMod /= 2; - m_target->CastCustomSpell(m_target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this); + target->CastCustomSpell(target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this); break; } } @@ -6106,11 +6184,11 @@ void Aura::HandleShapeshiftBoosts(bool apply) else { if(spellId1) - m_target->RemoveAurasDueToSpell(spellId1); + target->RemoveAurasDueToSpell(spellId1); if(spellId2) - m_target->RemoveAurasDueToSpell(spellId2); + target->RemoveAurasDueToSpell(spellId2); if(MasterShaperSpellId) - m_target->RemoveAurasDueToSpell(MasterShaperSpellId); + target->RemoveAurasDueToSpell(MasterShaperSpellId); Unit::AuraMap& tAuras = m_target->GetAuras(); for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();) @@ -6153,7 +6231,7 @@ void Aura::HandleSpellSpecificBoosts(bool apply) // Ice Barrier (non stacking from one caster) if (m_spellProto->SpellIconID == 32) { - if (!apply && (m_removeMode == AURA_REMOVE_BY_DISPEL || (m_removeMode == AURA_REMOVE_BY_DEFAULT && !GetModifier()->m_amount))) + if (!apply && (m_removeMode == AURA_REMOVE_BY_DISPEL || m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK)) { Unit::AuraList const& dummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) @@ -6197,7 +6275,7 @@ void Aura::HandleSpellSpecificBoosts(bool apply) case 57761: // Fireball! (Brain Freeze triggered) { // consumed aura - if (!apply && m_removeMode == AURA_REMOVE_BY_DEFAULT && m_duration != 0) + if (!apply && m_removeMode != AURA_REMOVE_BY_EXPIRE) { Unit* caster = GetCaster(); // Item - Mage T10 2P Bonus @@ -6686,31 +6764,31 @@ void Aura::HandleSpellSpecificBoosts(bool apply) void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_UNIT) + if(GetTarget()->GetTypeId() != TYPEID_UNIT) return; - CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(m_target->GetEntry()); + CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(GetTarget()->GetEntry()); if(ci && ci->type == CREATURE_TYPE_BEAST) - m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); + GetTarget()->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); } void Aura::HandleAuraUntrackable(bool apply, bool /*Real*/) { if(apply) - m_target->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE); + GetTarget()->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE); else - m_target->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE); + GetTarget()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE); } void Aura::HandleAuraModPacify(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if(apply) - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + GetTarget()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); else - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); } void Aura::HandleAuraModPacifyAndSilence(bool apply, bool Real) @@ -6721,16 +6799,16 @@ void Aura::HandleAuraModPacifyAndSilence(bool apply, bool Real) void Aura::HandleAuraGhost(bool apply, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if(apply) { - m_target->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); + GetTarget()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); } else { - m_target->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); + GetTarget()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); } } @@ -6746,9 +6824,9 @@ void Aura::HandleAuraAllowFlight(bool apply, bool Real) data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12); else data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12); - data << m_target->GetPackGUID(); + data << GetTarget()->GetPackGUID(); data << uint32(0); // unk - m_target->SendMessageToSet(&data, true); + GetTarget()->SendMessageToSet(&data, true); } void Aura::HandleModRating(bool apply, bool Real) @@ -6757,12 +6835,12 @@ void Aura::HandleModRating(bool apply, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) if (m_modifier.m_miscvalue & (1 << rating)) - ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply); + ((Player*)GetTarget())->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply); } void Aura::HandleModRatingFromStat(bool apply, bool Real) @@ -6771,31 +6849,31 @@ void Aura::HandleModRatingFromStat(bool apply, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Just recalculate ratings for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) if (m_modifier.m_miscvalue & (1 << rating)) - ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), 0, apply); + ((Player*)GetTarget())->ApplyRatingMod(CombatRating(rating), 0, apply); } void Aura::HandleForceMoveForward(bool apply, bool Real) { - if(!Real || m_target->GetTypeId() != TYPEID_PLAYER) + if(!Real || GetTarget()->GetTypeId() != TYPEID_PLAYER) return; if(apply) - m_target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); + GetTarget()->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); else - m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); + GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); } void Aura::HandleAuraModExpertise(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->UpdateExpertise(BASE_ATTACK); - ((Player*)m_target)->UpdateExpertise(OFF_ATTACK); + ((Player*)GetTarget())->UpdateExpertise(BASE_ATTACK); + ((Player*)GetTarget())->UpdateExpertise(OFF_ATTACK); } void Aura::HandleModTargetResistance(bool apply, bool Real) @@ -6803,15 +6881,15 @@ void Aura::HandleModTargetResistance(bool apply, bool Real) // spells required only Real aura add/remove if(!Real) return; + Unit *target = GetTarget(); // applied to damage as HandleNoImmediateEffect in Unit::CalculateAbsorbAndResist and Unit::CalcArmorReducedDamage - // show armor penetration - if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, m_modifier.m_amount, apply); + if (target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) + target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, m_modifier.m_amount, apply); // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy - if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, m_modifier.m_amount, apply); + if (target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL) + target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, m_modifier.m_amount, apply); } void Aura::HandleShieldBlockValue(bool apply, bool /*Real*/) @@ -6820,8 +6898,8 @@ void Aura::HandleShieldBlockValue(bool apply, bool /*Real*/) if(m_modifier.m_auraname == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT) modType = PCT_MOD; - if(m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply); + if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + ((Player*)GetTarget())->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply); } void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) @@ -6830,15 +6908,15 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - Player *target = (Player*)m_target; + Player *target = (Player*)GetTarget(); // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost) if( !apply && m_duration==0 && target->GetComboTarget()) - if(Unit* unit = ObjectAccessor::GetUnit(*m_target,target->GetComboTarget())) + if(Unit* unit = ObjectAccessor::GetUnit(*GetTarget(),target->GetComboTarget())) target->AddComboPoints(unit, -m_modifier.m_amount); } @@ -6846,10 +6924,10 @@ void Aura::HandleModUnattackable( bool Apply, bool Real ) { if(Real && Apply) { - m_target->CombatStop(); - m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + GetTarget()->CombatStop(); + GetTarget()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); } - m_target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE,Apply); + GetTarget()->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE,Apply); } void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) @@ -6858,24 +6936,26 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) if(!Real) return; + Unit *target = GetTarget(); + // prepare spirit state if(apply) { - if(m_target->GetTypeId()==TYPEID_PLAYER) + if(target->GetTypeId()==TYPEID_PLAYER) { // disable breath/etc timers - ((Player*)m_target)->StopMirrorTimers(); + ((Player*)target)->StopMirrorTimers(); // set stand state (expected in this form) - if(!m_target->IsStandState()) - m_target->SetStandState(UNIT_STAND_STATE_STAND); + if(!target->IsStandState()) + target->SetStandState(UNIT_STAND_STATE_STAND); } - m_target->SetHealth(1); + target->SetHealth(1); } // die at aura end else - m_target->DealDamage(m_target, m_target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, GetSpellProto(), false); + target->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, GetSpellProto(), false); } void Aura::CleanupTriggeredSpells() @@ -6908,20 +6988,22 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) if(!caster) return; + Unit *target = GetTarget(); + SpellEntry const* spellProto = GetSpellProto(); if (apply) { // prevent double apply bonuses - if (m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) + if (target->GetTypeId()!=TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { float DoneActualBenefit = 0.0f; - switch(m_spellProto->SpellFamilyName) + switch(spellProto->SpellFamilyName) { case SPELLFAMILY_PRIEST: // Power Word: Shield - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) { //+80.68% from +spell bonus - DoneActualBenefit = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(m_spellProto)) * 0.8068f; + DoneActualBenefit = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(spellProto)) * 0.8068f; //Borrowed Time Unit::AuraList const& borrowedTime = caster->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = borrowedTime.begin(); itr != borrowedTime.end(); ++itr) @@ -6938,27 +7020,27 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) break; case SPELLFAMILY_MAGE: // Frost Ward, Fire Ward - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108)) //+10% from +spell bonus - DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)) * 0.1f; + DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)) * 0.1f; // Ice Barrier - else if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000)) + else if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000)) //+80.67% from +spell bonus - DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)) * 0.8067f; + DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)) * 0.8067f; break; case SPELLFAMILY_WARLOCK: // Shadow Ward - if (m_spellProto->SpellFamilyFlags2 & 0x00000040) + if (spellProto->SpellFamilyFlags2 & 0x00000040) //+30% from +spell bonus - DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)) * 0.30f; + DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(spellProto)) * 0.30f; break; case SPELLFAMILY_PALADIN: // Sacred Shield // (check not strictly needed, only Sacred Shield has SPELL_AURA_SCHOOL_ABSORB in SPELLFAMILY_PALADIN at this time) - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0008000000000000)) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0008000000000000)) { // +75% from spell power - DoneActualBenefit = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(m_spellProto)) * 0.75f; + DoneActualBenefit = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(spellProto)) * 0.75f; } break; default: @@ -6974,10 +7056,10 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) { if (caster && // Power Word: Shield - m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellProto->Mechanic == MECHANIC_SHIELD && - (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) && + spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->Mechanic == MECHANIC_SHIELD && + (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) && // completely absorbed or dispelled - ((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL)) + (m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK || m_removeMode == AURA_REMOVE_BY_DISPEL)) { Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr) @@ -7003,25 +7085,25 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) if (!roll_chance_i((*itr)->GetModifier()->m_amount) || caster->HasAura(63853)) break; - switch(m_target->getPowerType()) + switch(target->getPowerType()) { - case POWER_RUNIC_POWER: - m_target->CastSpell(m_target, 63652, true, NULL, NULL, m_caster_guid); - break; - case POWER_RAGE: - m_target->CastSpell(m_target, 63653, true, NULL, NULL, m_caster_guid); - break; - case POWER_MANA: - { - int32 basepoints0 = m_target->GetMaxPower(POWER_MANA) * 2 / 100; - m_target->CastCustomSpell(m_target, 63654, &basepoints0, NULL, NULL, true); + case POWER_RUNIC_POWER: + target->CastSpell(target, 63652, true, NULL, NULL, GetCasterGUID()); + break; + case POWER_RAGE: + target->CastSpell(target, 63653, true, NULL, NULL, GetCasterGUID()); + break; + case POWER_MANA: + { + int32 basepoints0 = target->GetMaxPower(POWER_MANA) * 2 / 100; + target->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true); + break; + } + case POWER_ENERGY: + target->CastSpell(target, 63655, true, NULL, NULL, GetCasterGUID()); + break; + default: break; - } - case POWER_ENERGY: - m_target->CastSpell(m_target, 63655, true, NULL, NULL, m_caster_guid); - break; - default: - break; } //cooldwon aura @@ -7040,25 +7122,28 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) void Aura::PeriodicTick() { + Unit *target = GetTarget(); + SpellEntry const* spellProto = GetSpellProto(); + switch(m_modifier.m_auraname) { case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: { // don't damage target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; Unit *pCaster = GetCaster(); if(!pCaster) return; - if( GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(m_target, GetSpellProto(), false) != SPELL_MISS_NONE) + if( spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && + pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) - if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto()))) + if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; // some auras remove at specific health level or more @@ -7070,9 +7155,9 @@ void Aura::PeriodicTick() case 35321: case 38363: case 39215: case 48920: { - if(m_target->GetHealth() == m_target->GetMaxHealth() ) + if(target->GetHealth() == target->GetMaxHealth() ) { - m_target->RemoveAurasDueToSpell(GetId()); + target->RemoveAurasDueToSpell(GetId()); return; } break; @@ -7080,12 +7165,12 @@ void Aura::PeriodicTick() case 38772: { uint32 percent = - GetEffIndex() < EFFECT_INDEX_2 && GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? - pCaster->CalculateSpellDamage(m_target, GetSpellProto(), SpellEffectIndex(GetEffIndex() + 1)) : + GetEffIndex() < EFFECT_INDEX_2 && spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? + pCaster->CalculateSpellDamage(target, spellProto, SpellEffectIndex(GetEffIndex() + 1)) : 100; - if(m_target->GetHealth() * 100 >= m_target->GetMaxHealth() * percent ) + if(target->GetHealth() * 100 >= target->GetMaxHealth() * percent ) { - m_target->RemoveAurasDueToSpell(GetId()); + target->RemoveAurasDueToSpell(GetId()); return; } break; @@ -7107,31 +7192,31 @@ void Aura::PeriodicTick() if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) pdamage = amount; else - pdamage = uint32(m_target->GetMaxHealth()*amount/100); + pdamage = uint32(target->GetMaxHealth()*amount/100); // SpellDamageBonus for magic spells - if(GetSpellProto()->DmgClass == SPELL_DAMAGE_CLASS_NONE || GetSpellProto()->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) - pdamage = m_target->SpellDamageBonusTaken(pCaster, GetSpellProto(), pdamage, DOT, GetStackAmount()); + if(spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) + pdamage = target->SpellDamageBonusTaken(pCaster, spellProto, pdamage, DOT, GetStackAmount()); // MeleeDamagebonus for weapon based spells else { - WeaponAttackType attackType = GetWeaponAttackType(GetSpellProto()); - pdamage = m_target->MeleeDamageBonusTaken(pCaster, pdamage, attackType, GetSpellProto(), DOT, GetStackAmount()); + WeaponAttackType attackType = GetWeaponAttackType(spellProto); + pdamage = target->MeleeDamageBonusTaken(pCaster, pdamage, attackType, spellProto, DOT, GetStackAmount()); } // Calculate armor mitigation if it is a physical spell // But not for bleed mechanic spells - if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL && - GetEffectMechanic(GetSpellProto(), m_effIndex) != MECHANIC_BLEED) + if (GetSpellSchoolMask(spellProto) & SPELL_SCHOOL_MASK_NORMAL && + GetEffectMechanic(spellProto, m_effIndex) != MECHANIC_BLEED) { - uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(m_target, pdamage); + uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(target, pdamage); cleanDamage.damage += pdamage - pdamageReductedArmor; pdamage = pdamageReductedArmor; } // Curse of Agony damage-per-tick calculation - if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000400)) && GetSpellProto()->SpellIconID==544) + if (spellProto->SpellFamilyName==SPELLFAMILY_WARLOCK && (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000400)) && spellProto->SpellIconID==544) { // 1..4 ticks, 1/2 from normal tick damage if (GetAuraTicks() <= 4) @@ -7150,20 +7235,20 @@ void Aura::PeriodicTick() { cleanDamage.hitOutCome = MELEE_HIT_CRIT; // Resilience - reduce crit damage - pdamage -= m_target->GetSpellCritDamageReduction(pdamage); + pdamage -= target->GetSpellCritDamageReduction(pdamage); } // only from players // FIXME: need use SpellDamageBonus instead? if (pCaster->GetTypeId() == TYPEID_PLAYER) - pdamage -= m_target->GetSpellDamageReduction(pdamage); + pdamage -= target->GetSpellDamageReduction(pdamage); - m_target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)); + target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId(),absorb); - pCaster->DealDamageMods(m_target, pdamage, &absorb); + pCaster->DealDamageMods(target, pdamage, &absorb); // Set trigger flag uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC; // | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT; @@ -7171,22 +7256,22 @@ void Aura::PeriodicTick() pdamage = (pdamage <= absorb + resist) ? 0 : (pdamage - absorb - resist); SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f, isCrit); - m_target->SendPeriodicAuraLog(&pInfo); + target->SendPeriodicAuraLog(&pInfo); if (pdamage) procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE; - pCaster->ProcDamageAndSpell(m_target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, GetSpellProto()); + pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); - pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true); + pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, true); // Drain Soul (chance soul shard) - if (pCaster->GetTypeId() == TYPEID_PLAYER && m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + if (pCaster->GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { // Only from non-grey units if (roll_chance_i(10) && // 1-2 from drain with final and without glyph, 0-1 from damage - ((Player*)pCaster)->isHonorOrXPTarget(m_target) && - (m_target->GetTypeId() != TYPEID_UNIT || ((Player*)pCaster)->isAllowedToLoot((Creature*)m_target))) + ((Player*)pCaster)->isHonorOrXPTarget(target) && + (target->GetTypeId() != TYPEID_UNIT || ((Player*)pCaster)->isAllowedToLoot((Creature*)target))) { pCaster->CastSpell(pCaster, 43836, true, NULL, this); } @@ -7198,7 +7283,7 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: { // don't damage target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; Unit *pCaster = GetCaster(); @@ -7208,12 +7293,12 @@ void Aura::PeriodicTick() if(!pCaster->isAlive()) return; - if( GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(m_target, GetSpellProto(), false) != SPELL_MISS_NONE) + if( spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && + pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune - if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto()))) + if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; uint32 absorb=0; @@ -7223,14 +7308,14 @@ void Aura::PeriodicTick() uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; //Calculate armor mitigation if it is a physical spell - if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) + if (GetSpellSchoolMask(spellProto) & SPELL_SCHOOL_MASK_NORMAL) { - uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(m_target, pdamage); + uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(target, pdamage); cleanDamage.damage += pdamage - pdamageReductedArmor; pdamage = pdamageReductedArmor; } - pdamage = m_target->SpellDamageBonusTaken(pCaster, GetSpellProto(), pdamage, DOT, GetStackAmount()); + pdamage = target->SpellDamageBonusTaken(pCaster, spellProto, pdamage, DOT, GetStackAmount()); bool isCrit = IsCritFromAbilityAura(pCaster, pdamage); @@ -7239,27 +7324,27 @@ void Aura::PeriodicTick() { cleanDamage.hitOutCome = MELEE_HIT_CRIT; // Resilience - reduce crit damage - pdamage -= m_target->GetSpellCritDamageReduction(pdamage); + pdamage -= target->GetSpellCritDamageReduction(pdamage); } // only from players // FIXME: need use SpellDamageBonus instead? - if (IS_PLAYER_GUID(m_caster_guid)) - pdamage -= m_target->GetSpellDamageReduction(pdamage); + if (IS_PLAYER_GUID(GetCasterGUID())) + pdamage -= target->GetSpellDamageReduction(pdamage); - m_target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)); + target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)); - if(m_target->GetHealth() < pdamage) - pdamage = uint32(m_target->GetHealth()); + if(target->GetHealth() < pdamage) + pdamage = uint32(target->GetHealth()); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId(),absorb); - pCaster->DealDamageMods(m_target, pdamage, &absorb); + pCaster->DealDamageMods(target, pdamage, &absorb); - pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0, isCrit); + pCaster->SendSpellNonMeleeDamageLog(target, GetId(), pdamage, GetSpellSchoolMask(spellProto), absorb, resist, false, 0, isCrit); - float multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()] > 0 ? GetSpellProto()->EffectMultipleValue[GetEffIndex()] : 1; + float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1; // Set trigger flag uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC; // | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT; @@ -7267,10 +7352,10 @@ void Aura::PeriodicTick() pdamage = (pdamage <= absorb + resist) ? 0 : (pdamage-absorb-resist); if (pdamage) procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE; - pCaster->ProcDamageAndSpell(m_target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, GetSpellProto()); - int32 new_damage = pCaster->DealDamage(m_target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), false); + pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); + int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false); - if (!m_target->isAlive() && pCaster->IsNonMeleeSpellCasted(false)) + if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false)) for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->Id == GetId()) @@ -7280,17 +7365,17 @@ void Aura::PeriodicTick() if(Player *modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, multiplier); - int32 heal = pCaster->SpellHealingBonusTaken(pCaster, GetSpellProto(), int32(new_damage * multiplier), DOT, GetStackAmount()); + int32 heal = pCaster->SpellHealingBonusTaken(pCaster, spellProto, int32(new_damage * multiplier), DOT, GetStackAmount()); - int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto()); - pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto()); + int32 gain = pCaster->DealHeal(pCaster, heal, spellProto); + pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f, spellProto); break; } case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_OBS_MOD_HEALTH: { // don't heal target if not alive, mostly death persistent effects from items - if (!m_target->isAlive()) + if (!target->isAlive()) return; Unit *pCaster = GetCaster(); @@ -7298,7 +7383,7 @@ void Aura::PeriodicTick() return; // heal for caster damage (must be alive) - if(m_target != pCaster && GetSpellProto()->SpellVisual[0] == 163 && !pCaster->isAlive()) + if(target != pCaster && spellProto->SpellVisual[0] == 163 && !pCaster->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage @@ -7307,13 +7392,13 @@ void Aura::PeriodicTick() uint32 pdamage; if(m_modifier.m_auraname==SPELL_AURA_OBS_MOD_HEALTH) - pdamage = uint32(m_target->GetMaxHealth() * amount / 100); + pdamage = uint32(target->GetMaxHealth() * amount / 100); else { pdamage = amount; // Wild Growth (1/7 - 6 + 2*ramainTicks) % - if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864) + if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellIconID == 2864) { int32 ticks = GetAuraMaxTicks(); int32 remainingTicks = ticks - GetAuraTicks(); @@ -7328,34 +7413,32 @@ void Aura::PeriodicTick() } } - pdamage = m_target->SpellHealingBonusTaken(pCaster, GetSpellProto(), pdamage, DOT, GetStackAmount()); + pdamage = target->SpellHealingBonusTaken(pCaster, spellProto, pdamage, DOT, GetStackAmount()); // This method can modify pdamage bool isCrit = IsCritFromAbilityAura(pCaster, pdamage); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId()); - int32 gain = m_target->ModifyHealth(pdamage); + int32 gain = target->ModifyHealth(pdamage); SpellPeriodicAuraLogInfo pInfo(this, pdamage, (pdamage - uint32(gain)), 0, 0, 0.0f, isCrit); - m_target->SendPeriodicAuraLog(&pInfo); + target->SendPeriodicAuraLog(&pInfo); // Set trigger flag uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC; uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC; - pCaster->ProcDamageAndSpell(m_target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, gain, BASE_ATTACK, m_spellProto); + pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, gain, BASE_ATTACK, spellProto); // add HoTs to amount healed in bgs if( pCaster->GetTypeId() == TYPEID_PLAYER ) if( BattleGround *bg = ((Player*)pCaster)->GetBattleGround() ) bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain); - m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); - - SpellEntry const* spellProto = GetSpellProto(); + target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, spellProto); // heal for caster damage - if(m_target != pCaster && spellProto->SpellVisual[0] == 163) + if(target != pCaster && spellProto->SpellVisual[0] == 163) { uint32 dmg = spellProto->manaPerSecond; if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER) @@ -7371,10 +7454,10 @@ void Aura::PeriodicTick() uint32 damage = gain; uint32 absorb = 0; pCaster->DealDamageMods(pCaster, damage, &absorb); - pCaster->SendSpellNonMeleeDamageLog(pCaster, GetId(), damage, GetSpellSchoolMask(GetSpellProto()), absorb, 0, false, 0, false); + pCaster->SendSpellNonMeleeDamageLog(pCaster, GetId(), damage, GetSpellSchoolMask(spellProto), absorb, 0, false, 0, false); CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); - pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true); + pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(spellProto), spellProto, true); } } @@ -7388,7 +7471,7 @@ void Aura::PeriodicTick() case SPELL_AURA_PERIODIC_MANA_LEECH: { // don't damage target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) @@ -7397,7 +7480,7 @@ void Aura::PeriodicTick() Powers power = Powers(m_modifier.m_miscvalue); // power type might have changed between aura applying and tick (druid's shapeshift) - if(m_target->getPowerType() != power) + if(target->getPowerType() != power) return; Unit *pCaster = GetCaster(); @@ -7408,11 +7491,11 @@ void Aura::PeriodicTick() return; if( GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(m_target, GetSpellProto(), false) != SPELL_MISS_NONE) + pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) - if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto()))) + if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; // ignore non positive values (can be result apply spellmods to aura damage @@ -7420,107 +7503,107 @@ void Aura::PeriodicTick() // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana) // It's mana percent cost spells, m_modifier.m_amount is percent drain from target - if (m_spellProto->ManaCostPercentage) + if (spellProto->ManaCostPercentage) { // max value uint32 maxmana = pCaster->GetMaxPower(power) * pdamage * 2 / 100; - pdamage = m_target->GetMaxPower(power) * pdamage / 100; + pdamage = target->GetMaxPower(power) * pdamage / 100; if(pdamage > maxmana) pdamage = maxmana; } DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId()); - int32 drain_amount = m_target->GetPower(power) > pdamage ? pdamage : m_target->GetPower(power); + int32 drain_amount = target->GetPower(power) > pdamage ? pdamage : target->GetPower(power); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (power == POWER_MANA) - drain_amount -= m_target->GetSpellCritDamageReduction(drain_amount); + drain_amount -= target->GetSpellCritDamageReduction(drain_amount); - m_target->ModifyPower(power, -drain_amount); + target->ModifyPower(power, -drain_amount); float gain_multiplier = 0; if(pCaster->GetMaxPower(power) > 0) { - gain_multiplier = GetSpellProto()->EffectMultipleValue[GetEffIndex()]; + gain_multiplier = spellProto->EffectMultipleValue[GetEffIndex()]; if(Player *modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier); } SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier); - m_target->SendPeriodicAuraLog(&pInfo); + target->SendPeriodicAuraLog(&pInfo); int32 gain_amount = int32(drain_amount * gain_multiplier); if(gain_amount) { int32 gain = pCaster->ModifyPower(power, gain_amount); - m_target->AddThreat(pCaster, float(gain) * 0.5f, pInfo.critical, GetSpellSchoolMask(GetSpellProto()), GetSpellProto()); + target->AddThreat(pCaster, float(gain) * 0.5f, pInfo.critical, GetSpellSchoolMask(spellProto), spellProto); } break; } case SPELL_AURA_PERIODIC_ENERGIZE: { // don't energize target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId()); if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) break; Powers power = Powers(m_modifier.m_miscvalue); - if(m_target->GetMaxPower(power) == 0) + if(target->GetMaxPower(power) == 0) break; SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f); - m_target->SendPeriodicAuraLog(&pInfo); + target->SendPeriodicAuraLog(&pInfo); - int32 gain = m_target->ModifyPower(power,pdamage); + int32 gain = target->ModifyPower(power,pdamage); if(Unit* pCaster = GetCaster()) - m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); + target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, spellProto); break; } case SPELL_AURA_OBS_MOD_MANA: { // don't energize target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; - uint32 pdamage = uint32(m_target->GetMaxPower(POWER_MANA) * amount / 100); + uint32 pdamage = uint32(target->GetMaxPower(POWER_MANA) * amount / 100); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u mana inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId()); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId()); - if(m_target->GetMaxPower(POWER_MANA) == 0) + if(target->GetMaxPower(POWER_MANA) == 0) break; SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f); - m_target->SendPeriodicAuraLog(&pInfo); + target->SendPeriodicAuraLog(&pInfo); - int32 gain = m_target->ModifyPower(POWER_MANA, pdamage); + int32 gain = target->ModifyPower(POWER_MANA, pdamage); if(Unit* pCaster = GetCaster()) - m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); + target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, spellProto); break; } case SPELL_AURA_POWER_BURN_MANA: { // don't mana burn target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; Unit *pCaster = GetCaster(); @@ -7528,27 +7611,26 @@ void Aura::PeriodicTick() return; // Check for immune (not use charges) - if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto()))) + if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; int32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; Powers powerType = Powers(m_modifier.m_miscvalue); - if(!m_target->isAlive() || m_target->getPowerType() != powerType) + if(!target->isAlive() || target->getPowerType() != powerType) return; // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (powerType == POWER_MANA) - pdamage -= m_target->GetSpellCritDamageReduction(pdamage); + pdamage -= target->GetSpellCritDamageReduction(pdamage); - uint32 gain = uint32(-m_target->ModifyPower(powerType, -pdamage)); + uint32 gain = uint32(-target->ModifyPower(powerType, -pdamage)); - gain = uint32(gain * GetSpellProto()->EffectMultipleValue[GetEffIndex()]); + gain = uint32(gain * spellProto->EffectMultipleValue[GetEffIndex()]); - SpellEntry const* spellProto = GetSpellProto(); // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG - SpellNonMeleeDamage damageInfo(pCaster, m_target, spellProto->Id, SpellSchoolMask(spellProto->SchoolMask)); + SpellNonMeleeDamage damageInfo(pCaster, target, spellProto->Id, SpellSchoolMask(spellProto->SchoolMask)); pCaster->CalculateSpellDamage(&damageInfo, gain, spellProto); damageInfo.target->CalculateAbsorbResistBlock(pCaster, &damageInfo, spellProto); @@ -7572,40 +7654,40 @@ void Aura::PeriodicTick() case SPELL_AURA_MOD_REGEN: { // don't heal target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; - int32 gain = m_target->ModifyHealth(m_modifier.m_amount); + int32 gain = target->ModifyHealth(m_modifier.m_amount); if (Unit *caster = GetCaster()) - m_target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); + target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, spellProto); break; } case SPELL_AURA_MOD_POWER_REGEN: { // don't energize target if not alive, possible death persistent effects - if (!m_target->isAlive()) + if (!target->isAlive()) return; - Powers pt = m_target->getPowerType(); + Powers pt = target->getPowerType(); if(int32(pt) != m_modifier.m_miscvalue) return; - if ( GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED ) + if ( spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED ) { // eating anim - m_target->HandleEmoteCommand(EMOTE_ONESHOT_EAT); + target->HandleEmoteCommand(EMOTE_ONESHOT_EAT); } else if( GetId() == 20577 ) { // cannibalize anim - m_target->HandleEmoteCommand(EMOTE_STATE_CANNIBALIZE); + target->HandleEmoteCommand(EMOTE_STATE_CANNIBALIZE); } // Anger Management // amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3 // so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec if(pt == POWER_RAGE) - m_target->ModifyPower(pt, m_modifier.m_amount * 3 / 5); + target->ModifyPower(pt, m_modifier.m_amount * 3 / 5); break; } // Here tick dummy auras @@ -7633,6 +7715,7 @@ void Aura::PeriodicTick() void Aura::PeriodicDummyTick() { SpellEntry const* spell = GetSpellProto(); + Unit *target = GetTarget(); switch (spell->SpellFamilyName) { case SPELLFAMILY_GENERIC: @@ -7657,16 +7740,16 @@ void Aura::PeriodicDummyTick() case 57073: case 61830: { - if (m_target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return; // Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus - Unit::AuraList const& aura = m_target->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN); + Unit::AuraList const& aura = target->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN); for(Unit::AuraList::const_iterator i = aura.begin(); i != aura.end(); ++i) { if ((*i)->GetId() == GetId()) { (*i)->GetModifier()->m_amount = m_modifier.m_amount; - ((Player*)m_target)->UpdateManaRegen(); + ((Player*)target)->UpdateManaRegen(); // Disable continue m_isPeriodic = false; return; @@ -7697,7 +7780,7 @@ void Aura::PeriodicDummyTick() } case 7057: // Haunting Spirits if (roll_chance_i(33)) - m_target->CastSpell(m_target,m_modifier.m_amount,true,NULL,this); + target->CastSpell(target,m_modifier.m_amount,true,NULL,this); return; // // Panda // case 19230: break; @@ -7814,9 +7897,9 @@ void Aura::PeriodicDummyTick() // // Darkness // case 45996: break; case 46041: // Summon Blood Elves Periodic - m_target->CastSpell(m_target, 46037, true, NULL, this); - m_target->CastSpell(m_target, roll_chance_i(50) ? 46038 : 46039, true, NULL, this); - m_target->CastSpell(m_target, 46040, true, NULL, this); + target->CastSpell(target, 46037, true, NULL, this); + target->CastSpell(target, roll_chance_i(50) ? 46038 : 46039, true, NULL, this); + target->CastSpell(target, 46040, true, NULL, this); return; // // Transform Visual Missile Periodic // case 46205: break; @@ -7849,12 +7932,12 @@ void Aura::PeriodicDummyTick() { bool chance = roll_chance_i(50); - m_target->CastSpell(m_target, chance ? 48631 : 48632, true, NULL, this); + target->CastSpell(target, chance ? 48631 : 48632, true, NULL, this); if (GetAuraTicks() % 2) // which doctor at odd tick - m_target->CastSpell(m_target, chance ? 48636 : 48635, true, NULL, this); + target->CastSpell(target, chance ? 48636 : 48635, true, NULL, this); else // or harponeer, at even tick - m_target->CastSpell(m_target, chance ? 48634 : 48633, true, NULL, this); + target->CastSpell(target, chance ? 48634 : 48633, true, NULL, this); return; } @@ -7871,32 +7954,32 @@ void Aura::PeriodicDummyTick() // case 50530: break; case 50789: // Summon iron dwarf (left or right) case 59860: - m_target->CastSpell(m_target, roll_chance_i(50) ? 50790 : 50791, true, NULL, this); + target->CastSpell(target, roll_chance_i(50) ? 50790 : 50791, true, NULL, this); return; case 50792: // Summon iron trogg (left or right) case 59859: - m_target->CastSpell(m_target, roll_chance_i(50) ? 50793 : 50794, true, NULL, this); + target->CastSpell(target, roll_chance_i(50) ? 50793 : 50794, true, NULL, this); return; case 50801: // Summon malformed ooze (left or right) case 59858: - m_target->CastSpell(m_target, roll_chance_i(50) ? 50802 : 50803, true, NULL, this); + target->CastSpell(target, roll_chance_i(50) ? 50802 : 50803, true, NULL, this); return; case 50824: // Summon earthen dwarf - m_target->CastSpell(m_target, roll_chance_i(50) ? 50825 : 50826, true, NULL, this); + target->CastSpell(target, roll_chance_i(50) ? 50825 : 50826, true, NULL, this); return; case 52441: // Cool Down - m_target->CastSpell(m_target, 52443, true); + target->CastSpell(target, 52443, true); return; case 53520: // Carrion Beetles - m_target->CastSpell(m_target, 53521, true, NULL, this); - m_target->CastSpell(m_target, 53521, true, NULL, this); + target->CastSpell(target, 53521, true, NULL, this); + target->CastSpell(target, 53521, true, NULL, this); return; case 55592: // Clean switch(urand(0,2)) { - case 0: m_target->CastSpell(m_target, 55731, true); break; - case 1: m_target->CastSpell(m_target, 55738, true); break; - case 2: m_target->CastSpell(m_target, 55739, true); break; + case 0: target->CastSpell(target, 55731, true); break; + case 1: target->CastSpell(target, 55738, true); break; + case 2: target->CastSpell(target, 55739, true); break; } return; // Exist more after, need add later @@ -7906,17 +7989,17 @@ void Aura::PeriodicDummyTick() // Prey on the Weak if (spell->SpellIconID == 2983) { - Unit *target=m_target->getVictim(); - if (target && (m_target->GetHealth() * 100 / m_target->GetMaxHealth() > target->GetHealth() * 100 / target->GetMaxHealth())) + Unit *victim = target->getVictim(); + if (victim && (target->GetHealth() * 100 / target->GetMaxHealth() > victim->GetHealth() * 100 / victim->GetMaxHealth())) { - if(!m_target->HasAura(58670)) + if(!target->HasAura(58670)) { int32 basepoints = GetBasePoints(); - m_target->CastCustomSpell(m_target, 58670, &basepoints, 0, 0, true); + target->CastCustomSpell(target, 58670, &basepoints, 0, 0, true); } } else - m_target->RemoveAurasDueToSpell(58670); + target->RemoveAurasDueToSpell(58670); } break; case SPELLFAMILY_MAGE: @@ -7935,17 +8018,17 @@ void Aura::PeriodicDummyTick() { // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health. // Should be manauser - if (m_target->getPowerType() != POWER_RAGE) + if (target->getPowerType() != POWER_RAGE) return; - uint32 rage = m_target->GetPower(POWER_RAGE); + uint32 rage = target->GetPower(POWER_RAGE); // Nothing todo if (rage == 0) return; int32 mod = (rage < 100) ? rage : 100; - int32 points = m_target->CalculateSpellDamage(m_target, spell, EFFECT_INDEX_1); - int32 regen = m_target->GetMaxHealth() * (mod * points / 10) / 1000; - m_target->CastCustomSpell(m_target, 22845, ®en, NULL, NULL, true, NULL, this); - m_target->SetPower(POWER_RAGE, rage-mod); + int32 points = target->CalculateSpellDamage(target, spell, EFFECT_INDEX_1); + int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000; + target->CastCustomSpell(target, 22845, ®en, NULL, NULL, true, NULL, this); + target->SetPower(POWER_RAGE, rage-mod); return; } // Force of Nature @@ -7963,7 +8046,7 @@ void Aura::PeriodicDummyTick() // Killing Spree case 51690: { - if (m_target->hasUnitState(UNIT_STAT_STUNNED) || m_target->isFeared()) + if (target->hasUnitState(UNIT_STAT_STUNNED) || target->isFeared()) return; std::list targets; @@ -7971,9 +8054,9 @@ void Aura::PeriodicDummyTick() // eff_radius ==0 float radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spell->rangeIndex)); - MaNGOS::AnyUnfriendlyVisibleUnitInObjectRangeCheck u_check(m_target, m_target, radius); - MaNGOS::UnitListSearcher checker(m_target, targets, u_check); - Cell::VisitAllObjects(m_target, checker, radius); + MaNGOS::AnyUnfriendlyVisibleUnitInObjectRangeCheck u_check(target, target, radius); + MaNGOS::UnitListSearcher checker(target, targets, u_check); + Cell::VisitAllObjects(target, checker, radius); } if(targets.empty()) @@ -7981,10 +8064,10 @@ void Aura::PeriodicDummyTick() std::list::const_iterator itr = targets.begin(); std::advance(itr, rand()%targets.size()); - Unit* target = *itr; + Unit* victim = *itr; - m_target->CastSpell(target, 57840, true); - m_target->CastSpell(target, 57841, true); + target->CastSpell(victim, 57840, true); + target->CastSpell(victim, 57841, true); return; } default: @@ -7997,7 +8080,7 @@ void Aura::PeriodicDummyTick() // Explosive Shot if (spell->SpellFamilyFlags & UI64LIT(0x8000000000000000)) { - m_target->CastCustomSpell(m_target, 53352, &m_modifier.m_amount, 0, 0, true, 0, this, GetCasterGUID()); + target->CastCustomSpell(target, 53352, &m_modifier.m_amount, 0, 0, true, 0, this, GetCasterGUID()); return; } switch (spell->Id) @@ -8009,9 +8092,9 @@ void Aura::PeriodicDummyTick() case 53511: case 53512: { - Unit* victim = m_target->getVictim(); + Unit* victim = target->getVictim(); if( victim && victim->GetHealth() * 100 < victim->GetMaxHealth() * 35 ) - m_target->CastSpell(m_target, spell->Id == 53511 ? 60096 : 60097, true, NULL, this); + target->CastSpell(target, spell->Id == 53511 ? 60096 : 60097, true, NULL, this); return; } default: @@ -8025,8 +8108,8 @@ void Aura::PeriodicDummyTick() if (spell->Id == 52179) { // Periodic need for remove visual on stun/fear/silence lost - if (!(m_target->GetUInt32Value(UNIT_FIELD_FLAGS)&(UNIT_FLAG_STUNNED|UNIT_FLAG_FLEEING|UNIT_FLAG_SILENCED))) - m_target->RemoveAurasDueToSpell(52179); + if (!(target->GetUInt32Value(UNIT_FIELD_FLAGS)&(UNIT_FLAG_STUNNED|UNIT_FLAG_FLEEING|UNIT_FLAG_SILENCED))) + target->RemoveAurasDueToSpell(52179); return; } break; @@ -8037,7 +8120,7 @@ void Aura::PeriodicDummyTick() if (spell->SpellFamilyFlags & UI64LIT(0x0000000000000020)) { if (Unit *caster = GetCaster()) - caster->CastCustomSpell(m_target, 52212, &m_modifier.m_amount, NULL, NULL, true, NULL, this); + caster->CastCustomSpell(target, 52212, &m_modifier.m_amount, NULL, NULL, true, NULL, this); return; } // Raise Dead @@ -8047,7 +8130,7 @@ void Aura::PeriodicDummyTick() if (spell->SpellFamilyFlags & UI64LIT(0x0000400000000000)) { // Get 0 effect aura - Aura *slow = m_target->GetAura(GetId(), EFFECT_INDEX_0); + Aura *slow = target->GetAura(GetId(), EFFECT_INDEX_0); if (slow) { slow->ApplyModifier(false, true); @@ -8069,8 +8152,8 @@ void Aura::PeriodicDummyTick() { // Increases your attack power by $s1 for every $s2 armor value you have. // Calculate AP bonus (from 1 efect of this spell) - int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(m_target, spell, EFFECT_INDEX_1); - m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, NULL, true, NULL, this); + int32 apBonus = m_modifier.m_amount * target->GetArmor() / target->CalculateSpellDamage(target, spell, EFFECT_INDEX_1); + target->CastCustomSpell(target, 61217, &apBonus, &apBonus, NULL, true, NULL, this); return; } // Reaping @@ -8091,13 +8174,13 @@ void Aura::HandlePreventFleeing(bool apply, bool Real) if(!Real) return; - Unit::AuraList const& fearAuras = m_target->GetAurasByType(SPELL_AURA_MOD_FEAR); + Unit::AuraList const& fearAuras = GetTarget()->GetAurasByType(SPELL_AURA_MOD_FEAR); if( !fearAuras.empty() ) { if (apply) - m_target->SetFeared(false, fearAuras.front()->GetCasterGUID()); + GetTarget()->SetFeared(false, fearAuras.front()->GetCasterGUID()); else - m_target->SetFeared(true); + GetTarget()->SetFeared(true); } } @@ -8107,19 +8190,19 @@ void Aura::HandleManaShield(bool apply, bool Real) return; // prevent double apply bonuses - if(apply && (m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())) + if(apply && (GetTarget()->GetTypeId()!=TYPEID_PLAYER || !((Player*)GetTarget())->GetSession()->PlayerLoading())) { if(Unit* caster = GetCaster()) { float DoneActualBenefit = 0.0f; - switch(m_spellProto->SpellFamilyName) + switch(GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_MAGE: - if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000008000)) + if(GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000008000)) { // Mana Shield // +50% from +spd bonus - DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellProto)) * 0.5f; + DoneActualBenefit = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(GetSpellProto())) * 0.5f; break; } break; @@ -8140,9 +8223,9 @@ void Aura::HandleArenaPreparation(bool apply, bool Real) return; if(apply) - m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); + GetTarget()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); else - m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); + GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); } /** @@ -8155,7 +8238,7 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real) return; Unit *player = GetCaster(); - Vehicle *vehicle = dynamic_cast(m_target); + Vehicle *vehicle = dynamic_cast(GetTarget()); if(!player || player->GetTypeId() != TYPEID_PLAYER || !vehicle) return; @@ -8181,10 +8264,10 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - Player *plr = (Player*)m_target; + Player *plr = (Player*)GetTarget(); if(plr->getClass() != CLASS_DEATH_KNIGHT) return; @@ -8221,29 +8304,31 @@ void Aura::HandlePhase(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + // always non stackable if(apply) { - Unit::AuraList const& phases = m_target->GetAurasByType(SPELL_AURA_PHASE); + Unit::AuraList const& phases = target->GetAurasByType(SPELL_AURA_PHASE); if(!phases.empty()) - m_target->RemoveAurasDueToSpell(phases.front()->GetId(), this); + target->RemoveAurasDueToSpell(phases.front()->GetId(), this); } // no-phase is also phase state so same code for apply and remove // phase auras normally not expected at BG but anyway better check - if(m_target->GetTypeId() == TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) { // drop flag at invisible in bg - if(((Player*)m_target)->InBattleGround()) - if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) - bg->EventPlayerDroppedFlag((Player*)m_target); + if(((Player*)target)->InBattleGround()) + if(BattleGround *bg = ((Player*)target)->GetBattleGround()) + bg->EventPlayerDroppedFlag((Player*)target); // GM-mode have mask 0xFFFFFFFF - if(!((Player*)m_target)->isGameMaster()) - m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); + if(!((Player*)target)->isGameMaster()) + target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); - ((Player*)m_target)->GetSession()->SendSetPhaseShift(apply ? GetMiscValue() : PHASEMASK_NORMAL); + ((Player*)target)->GetSession()->SendSetPhaseShift(apply ? GetMiscValue() : PHASEMASK_NORMAL); if (GetEffIndex() == EFFECT_INDEX_0) { @@ -8251,29 +8336,29 @@ void Aura::HandlePhase(bool apply, bool Real) if(saBounds.first != saBounds.second) { uint32 zone, area; - m_target->GetZoneAndAreaId(zone, area); + target->GetZoneAndAreaId(zone, area); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove - if(!itr->second->IsFitToRequirements((Player*)m_target, zone, area)) - m_target->RemoveAurasDueToSpell(itr->second->spellId); + if(!itr->second->IsFitToRequirements((Player*)target, zone, area)) + target->RemoveAurasDueToSpell(itr->second->spellId); // some auras applied at aura apply else if(itr->second->autocast) { - if (!m_target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) - m_target->CastSpell(m_target, itr->second->spellId, true); + if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) + target->CastSpell(target, itr->second->spellId, true); } } } } } else - m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); + target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) - if(m_target->GetVisibility() != VISIBILITY_OFF) - m_target->SetVisibility(m_target->GetVisibility()); + if(target->GetVisibility() != VISIBILITY_OFF) + target->SetVisibility(target->GetVisibility()); } void Aura::UnregisterSingleCastAura() @@ -8298,8 +8383,8 @@ void Aura::HandleAuraSafeFall( bool Apply, bool Real ) // implemented in WorldSession::HandleMovementOpcodes // only special case - if(Apply && Real && GetId() == 32474 && m_target->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_target)->ActivateTaxiPathTo(506, GetId()); + if(Apply && Real && GetId() == 32474 && GetTarget()->GetTypeId() == TYPEID_PLAYER) + ((Player*)GetTarget())->ActivateTaxiPathTo(506, GetId()); } bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage) @@ -8307,12 +8392,12 @@ bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage) Unit::AuraList const& auras = caster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - if (!(*itr)->isAffectedOnSpell(m_spellProto)) + if (!(*itr)->isAffectedOnSpell(GetSpellProto())) continue; - if (!caster->IsSpellCrit(m_target, m_spellProto, GetSpellSchoolMask(m_spellProto))) + if (!caster->IsSpellCrit(GetTarget(), GetSpellProto(), GetSpellSchoolMask(GetSpellProto()))) break; - damage = caster->SpellCriticalDamageBonus(m_spellProto, damage, m_target); + damage = caster->SpellCriticalDamageBonus(GetSpellProto(), damage, GetTarget()); return true; } return false; @@ -8320,10 +8405,10 @@ bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage) void Aura::HandleModTargetArmorPct(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId() != TYPEID_PLAYER) + if(GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->UpdateArmorPenetration(); + ((Player*)GetTarget())->UpdateArmorPenetration(); } void Aura::HandleAuraModAllCritChance(bool apply, bool Real) @@ -8332,15 +8417,17 @@ void Aura::HandleAuraModAllCritChance(bool apply, bool Real) if(!Real) return; - if(m_target->GetTypeId() != TYPEID_PLAYER) + Unit *target = GetTarget(); + + if(target->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); // included in Player::UpdateSpellCritChance calculation - ((Player*)m_target)->UpdateAllSpellCritChances(); + ((Player*)target)->UpdateAllSpellCritChances(); } void Aura::HandleAllowOnlyAbility(bool apply, bool Real) @@ -8348,20 +8435,22 @@ void Aura::HandleAllowOnlyAbility(bool apply, bool Real) if(!Real) return; + Unit *target = GetTarget(); + if(apply) { - m_target->setAttackTimer(BASE_ATTACK,m_duration); - m_target->setAttackTimer(RANGED_ATTACK,m_duration); - m_target->setAttackTimer(OFF_ATTACK,m_duration); + target->setAttackTimer(BASE_ATTACK,m_duration); + target->setAttackTimer(RANGED_ATTACK,m_duration); + target->setAttackTimer(OFF_ATTACK,m_duration); } else { - m_target->resetAttackTimer(BASE_ATTACK); - m_target->resetAttackTimer(RANGED_ATTACK); - m_target->resetAttackTimer(OFF_ATTACK); + target->resetAttackTimer(BASE_ATTACK); + target->resetAttackTimer(RANGED_ATTACK); + target->resetAttackTimer(OFF_ATTACK); } - m_target->UpdateDamagePhysical(BASE_ATTACK); - m_target->UpdateDamagePhysical(RANGED_ATTACK); - m_target->UpdateDamagePhysical(OFF_ATTACK); + target->UpdateDamagePhysical(BASE_ATTACK); + target->UpdateDamagePhysical(RANGED_ATTACK); + target->UpdateDamagePhysical(OFF_ATTACK); } \ No newline at end of file diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e35ab4fa2..0bab7ea9b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2132,7 +2132,7 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D { if ((*i)->GetModifier()->m_amount<=0) { - RemoveAurasDueToSpell((*i)->GetId()); + RemoveAurasDueToSpell((*i)->GetId(), NULL, AURA_REMOVE_BY_SHIELD_BREAK); i = vSchoolAbsorb.begin(); } else @@ -3312,7 +3312,7 @@ void Unit::_UpdateSpells( uint32 time ) if ((*i).second) { if ( !(*i).second->GetAuraDuration() && !((*i).second->IsPermanent() || ((*i).second->IsPassive())) ) - RemoveAura(i); + RemoveAura(i, AURA_REMOVE_BY_EXPIRE); else ++i; } @@ -4139,14 +4139,14 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) return true; } -void Unit::RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except) +void Unit::RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except, AuraRemoveMode mode) { spellEffectPair spair = spellEffectPair(spellId, effindex); for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);) { if(iter->second!=except) { - RemoveAura(iter); + RemoveAura(iter, mode); iter = m_Auras.lower_bound(spair); } else @@ -4373,10 +4373,10 @@ void Unit::RemoveSingleAuraByCasterSpell(uint32 spellId, SpellEffectIndex effind } -void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except) +void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except, AuraRemoveMode mode) { for (int i = 0; i < MAX_EFFECT_INDEX; ++i) - RemoveAura(spellId,SpellEffectIndex(i),except); + RemoveAura(spellId,SpellEffectIndex(i),except, mode); } void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId) diff --git a/src/game/Unit.h b/src/game/Unit.h index 141c8a66a..b4b407727 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -341,6 +341,9 @@ enum AuraRemoveMode AURA_REMOVE_BY_DISPEL, AURA_REMOVE_BY_DEATH, AURA_REMOVE_BY_DELETE, // use for speedup and prevent unexpected effects at player logout/pet unsummon (must be used _only_ after save), delete. + AURA_REMOVE_BY_SHIELD_BREAK, // when absorb shield is removed by damage + AURA_REMOVE_BY_EXPIRE, // at duration end + }; enum UnitMods @@ -1483,10 +1486,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject // removing specific aura stack void RemoveAura(Aura* aura, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except = NULL); + void RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except = NULL, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); // removing specific aura stacks by diff reasons and selections - void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL); + void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID); void RemoveAurasByCasterSpell(uint32 spellId, SpellEffectIndex effindex, uint64 casterGUID); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 90f08bd0f..2b0e92321 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10029" + #define REVISION_NR "10030" #endif // __REVISION_NR_H__ From 2760e7d353a2c5280c88274a9e26a4e4a0e55e80 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 5 Jun 2010 11:58:22 +0200 Subject: [PATCH 159/172] [10031] Replace hard coded quest dialog status value with enum value Some minor code cleanup for readability. Signed-off-by: NoFantasy --- src/game/QuestHandler.cpp | 45 ++++++++++++++++++++++++++------------- src/shared/revision_nr.h | 2 +- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 7520775c1..71c57b424 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -38,9 +38,10 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) uint8 defstatus = DIALOG_STATUS_NONE; Object* questgiver = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT); - if(!questgiver) + + if (!questgiver) { - DETAIL_LOG("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)",GuidHigh2TypeId(GUID_HIPART(guid)),GUID_LOPART(guid)); + DETAIL_LOG("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); return; } @@ -48,23 +49,29 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) { case TYPEID_UNIT: { - DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u",uint32(GUID_LOPART(guid)) ); - Creature* cr_questgiver=(Creature*)questgiver; - if( !cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies + DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid))); + + Creature* cr_questgiver = (Creature*)questgiver; + + if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies { questStatus = Script->NPCDialogStatus(_player, cr_questgiver); - if( questStatus > 6 ) + + if (questStatus > DIALOG_STATUS_REWARD_REP) questStatus = getDialogStatus(_player, cr_questgiver, defstatus); } break; } case TYPEID_GAMEOBJECT: { - DEBUG_LOG( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u",uint32(GUID_LOPART(guid)) ); - GameObject* go_questgiver=(GameObject*)questgiver; + DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid))); + + GameObject* go_questgiver = (GameObject*)questgiver; questStatus = Script->GODialogStatus(_player, go_questgiver); - if( questStatus > 6 ) + + if (questStatus > DIALOG_STATUS_REWARD_REP) questStatus = getDialogStatus(_player, go_questgiver, defstatus); + break; } default: @@ -648,12 +655,16 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket { // need also pet quests case support Creature *questgiver = GetPlayer()->GetMap()->GetCreatureOrPetOrVehicle(*itr); - if(!questgiver || questgiver->IsHostileTo(_player)) + + if (!questgiver || questgiver->IsHostileTo(_player)) continue; - if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) + + if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) continue; + questStatus = Script->NPCDialogStatus(_player, questgiver); - if( questStatus > 6 ) + + if (questStatus > DIALOG_STATUS_REWARD_REP) questStatus = getDialogStatus(_player, questgiver, defstatus); data << uint64(questgiver->GetGUID()); @@ -663,12 +674,16 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket else if (itr->IsGameobject()) { GameObject *questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); - if(!questgiver) + + if (!questgiver) continue; - if(questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) + + if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) continue; + questStatus = Script->GODialogStatus(_player, questgiver); - if( questStatus > 6 ) + + if (questStatus > DIALOG_STATUS_REWARD_REP) questStatus = getDialogStatus(_player, questgiver, defstatus); data << uint64(questgiver->GetGUID()); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2b0e92321..3c258e4a1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10030" + #define REVISION_NR "10031" #endif // __REVISION_NR_H__ From c0be5c092661a53a7f7181b5ab4ea49ceb98afb5 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 5 Jun 2010 13:21:10 +0200 Subject: [PATCH 160/172] [10032] Remove not needed local declaration of dialog status and rename some to clarify. Additional cleanup for readability. Signed-off-by: NoFantasy --- src/game/QuestHandler.cpp | 123 ++++++++++++++++++++------------------ src/shared/revision_nr.h | 2 +- 2 files changed, 65 insertions(+), 60 deletions(-) diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 71c57b424..a0b787299 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -34,8 +34,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) { uint64 guid; recv_data >> guid; - uint8 questStatus = DIALOG_STATUS_NONE; - uint8 defstatus = DIALOG_STATUS_NONE; + uint8 dialogStatus = DIALOG_STATUS_NONE; Object* questgiver = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT); @@ -55,10 +54,10 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies { - questStatus = Script->NPCDialogStatus(_player, cr_questgiver); + dialogStatus = Script->NPCDialogStatus(_player, cr_questgiver); - if (questStatus > DIALOG_STATUS_REWARD_REP) - questStatus = getDialogStatus(_player, cr_questgiver, defstatus); + if (dialogStatus > DIALOG_STATUS_REWARD_REP) + dialogStatus = getDialogStatus(_player, cr_questgiver, DIALOG_STATUS_NONE); } break; } @@ -67,10 +66,10 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid))); GameObject* go_questgiver = (GameObject*)questgiver; - questStatus = Script->GODialogStatus(_player, go_questgiver); + dialogStatus = Script->GODialogStatus(_player, go_questgiver); - if (questStatus > DIALOG_STATUS_REWARD_REP) - questStatus = getDialogStatus(_player, go_questgiver, defstatus); + if (dialogStatus > DIALOG_STATUS_REWARD_REP) + dialogStatus = getDialogStatus(_player, go_questgiver, DIALOG_STATUS_NONE); break; } @@ -80,7 +79,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data ) } //inform client about status of quest - _player->PlayerTalkClass->SendQuestGiverStatus(questStatus, guid); + _player->PlayerTalkClass->SendQuestGiverStatus(dialogStatus, guid); } void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) @@ -550,7 +549,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 defstatus) { - uint32 result = defstatus; + uint32 dialogStatus = defstatus; QuestRelations const* qir; QuestRelations const* qr; @@ -575,66 +574,73 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 return DIALOG_STATUS_NONE; } - for(QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i ) + for(QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i) { - uint32 result2 = 0; + uint32 dialogStatusNew = 0; uint32 quest_id = i->second; Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id); - if ( !pQuest ) continue; - QuestStatus status = pPlayer->GetQuestStatus( quest_id ); - if( (status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) || - (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)) ) - { - if ( pQuest->IsAutoComplete() && pQuest->IsRepeatable() ) - result2 = DIALOG_STATUS_REWARD_REP; - else - result2 = DIALOG_STATUS_REWARD; - } - else if ( status == QUEST_STATUS_INCOMPLETE ) - result2 = DIALOG_STATUS_INCOMPLETE; - - if (result2 > result) - result = result2; - } - - for(QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i ) - { - uint32 result2 = 0; - uint32 quest_id = i->second; - Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id); - if ( !pQuest ) + if (!pQuest) continue; - QuestStatus status = pPlayer->GetQuestStatus( quest_id ); - if ( status == QUEST_STATUS_NONE ) + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) || + (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false))) { - if ( pPlayer->CanSeeStartQuest( pQuest ) ) + if (pQuest->IsAutoComplete() && pQuest->IsRepeatable()) + dialogStatusNew = DIALOG_STATUS_REWARD_REP; + else + dialogStatusNew = DIALOG_STATUS_REWARD; + } + else if (status == QUEST_STATUS_INCOMPLETE) + dialogStatusNew = DIALOG_STATUS_INCOMPLETE; + + if (dialogStatusNew > dialogStatus) + dialogStatus = dialogStatusNew; + } + + for(QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i) + { + uint32 dialogStatusNew = 0; + uint32 quest_id = i->second; + Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id); + + if (!pQuest) + continue; + + QuestStatus status = pPlayer->GetQuestStatus(quest_id); + + if (status == QUEST_STATUS_NONE) + { + if (pPlayer->CanSeeStartQuest(pQuest)) { - if ( pPlayer->SatisfyQuestLevel(pQuest, false) ) + if (pPlayer->SatisfyQuestLevel(pQuest, false)) { - if ( pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->getQuestStatusMap()[quest_id].m_rewarded)) - result2 = DIALOG_STATUS_REWARD_REP; - else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_UINT32_QUEST_LOW_LEVEL_HIDE_DIFF) ) + if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->getQuestStatusMap()[quest_id].m_rewarded)) + { + dialogStatusNew = DIALOG_STATUS_REWARD_REP; + } + else if (pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + sWorld.getConfig(CONFIG_UINT32_QUEST_LOW_LEVEL_HIDE_DIFF)) { if (pQuest->HasFlag(QUEST_FLAGS_DAILY) || pQuest->HasFlag(QUEST_FLAGS_WEEKLY)) - result2 = DIALOG_STATUS_AVAILABLE_REP; + dialogStatusNew = DIALOG_STATUS_AVAILABLE_REP; else - result2 = DIALOG_STATUS_AVAILABLE; + dialogStatusNew = DIALOG_STATUS_AVAILABLE; } else - result2 = DIALOG_STATUS_LOW_LEVEL_AVAILABLE; + dialogStatusNew = DIALOG_STATUS_LOW_LEVEL_AVAILABLE; } else - result2 = DIALOG_STATUS_UNAVAILABLE; + dialogStatusNew = DIALOG_STATUS_UNAVAILABLE; } } - if (result2 > result) - result = result2; + if (dialogStatusNew > dialogStatus) + dialogStatus = dialogStatusNew; } - return result; + return dialogStatus; } void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/) @@ -648,8 +654,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket for(ObjectGuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) { - uint8 questStatus = DIALOG_STATUS_NONE; - uint8 defstatus = DIALOG_STATUS_NONE; + uint8 dialogStatus = DIALOG_STATUS_NONE; if (itr->IsCreatureOrPet()) { @@ -662,13 +667,13 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) continue; - questStatus = Script->NPCDialogStatus(_player, questgiver); + dialogStatus = Script->NPCDialogStatus(_player, questgiver); - if (questStatus > DIALOG_STATUS_REWARD_REP) - questStatus = getDialogStatus(_player, questgiver, defstatus); + if (dialogStatus > DIALOG_STATUS_REWARD_REP) + dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); data << uint64(questgiver->GetGUID()); - data << uint8(questStatus); + data << uint8(dialogStatus); ++count; } else if (itr->IsGameobject()) @@ -681,13 +686,13 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) continue; - questStatus = Script->GODialogStatus(_player, questgiver); + dialogStatus = Script->GODialogStatus(_player, questgiver); - if (questStatus > DIALOG_STATUS_REWARD_REP) - questStatus = getDialogStatus(_player, questgiver, defstatus); + if (dialogStatus > DIALOG_STATUS_REWARD_REP) + dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); data << uint64(questgiver->GetGUID()); - data << uint8(questStatus); + data << uint8(dialogStatus); ++count; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3c258e4a1..2a6f283a6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10031" + #define REVISION_NR "10032" #endif // __REVISION_NR_H__ From 63018ccc4a3f35da92f7ce11e71360f3e4a60908 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 6 Jun 2010 17:28:30 +0400 Subject: [PATCH 161/172] [10033] Use sometime stored in spell data triggred spell info for dummy auras. --- src/game/Unit.cpp | 21 +++++++++------------ src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 0bab7ea9b..08e46b046 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2204,12 +2204,14 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D int32 amount = int32(incanterAbsorption * (*itr)->GetModifier()->m_amount / 100); + uint32 triggered_id = itr_spellProto->EffectTriggerSpell[(*itr)->GetEffIndex()]; + // apply normalized part of already accumulated amount in aura - if (Aura* spdAura = GetAura(44413, EFFECT_INDEX_0)) + if (Aura* spdAura = GetAura(triggered_id, EFFECT_INDEX_0)) amount += spdAura->GetModifier()->m_amount * spdAura->GetAuraDuration() / spdAura->GetAuraMaxDuration(); // Incanter's Absorption (triggered absorb based spell power, will replace existed if any) - CastCustomSpell(this, 44413, &amount, NULL, NULL, true); + CastCustomSpell(this, triggered_id, &amount, NULL, NULL, true, NULL, *itr); break; } } @@ -5113,7 +5115,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; - uint32 triggered_spell_id = 0; + // some dummy spells have trigger spell in spell data already (from 3.0.3) + uint32 triggered_spell_id = dummySpell->EffectApplyAuraName[effIndex] == SPELL_AURA_DUMMY ? dummySpell->EffectTriggerSpell[effIndex] : 0; Unit* target = pVictim; int32 basepoints[MAX_EFFECT_INDEX] = {0, 0, 0}; @@ -5691,12 +5694,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu triggered_spell_id = 22858; break; } - // Gag Order - if (dummySpell->SpellIconID == 280) - { - triggered_spell_id = 18498; // Silenced - Gag Order - break; - } // Second Wind if (dummySpell->SpellIconID == 1697) { @@ -5998,7 +5995,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; basepoints[0] = int32(target->GetMaxHealth() * triggerAmount / 100); - triggered_spell_id = 56131; + // triggered_spell_id in spell data break; } } @@ -6585,7 +6582,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Sacred Shield (talent rank) case 53601: { - triggered_spell_id = 58597; + // triggered_spell_id in spell data target = this; break; } @@ -7125,7 +7122,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Blood-Caked Blade if (dummySpell->SpellIconID == 138) { - triggered_spell_id = dummySpell->EffectTriggerSpell[effIndex]; + // triggered_spell_id in spell data break; } break; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2a6f283a6..e08f10e15 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10032" + #define REVISION_NR "10033" #endif // __REVISION_NR_H__ From ea9dd78d3502566f1695e0cee3e7e5b3e5e57a9d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 6 Jun 2010 17:45:53 +0400 Subject: [PATCH 162/172] [10034] In case unknown triggered spell output more known info for location problem. --- src/game/Unit.cpp | 30 ++++++++++++++++++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 08e46b046..772308465 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1066,7 +1066,10 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castIte if(!spellInfo) { - sLog.outError("CastSpell: unknown spell id %i by caster: %s", spellId, GetObjectGuid().GetString().c_str()); + if (triggeredByAura) + sLog.outError("CastSpell: unknown spell id %i by caster: %s triggered by aura %u (eff %u)", spellId, GetObjectGuid().GetString().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); + else + sLog.outError("CastSpell: unknown spell id %i by caster: %s", spellId, GetObjectGuid().GetString().c_str()); return; } @@ -1077,7 +1080,10 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, { if(!spellInfo) { - sLog.outError("CastSpell: unknown spell by caster: %s", GetObjectGuid().GetString().c_str()); + if (triggeredByAura) + sLog.outError("CastSpell: unknown spell by caster: %s triggered by aura %u (eff %u)", GetObjectGuid().GetString().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); + else + sLog.outError("CastSpell: unknown spell by caster: %s", GetObjectGuid().GetString().c_str()); return; } @@ -1101,7 +1107,10 @@ void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 if(!spellInfo) { - sLog.outError("CastCustomSpell: unknown spell id %i by caster: %s", spellId, GetObjectGuid().GetString().c_str()); + if (triggeredByAura) + sLog.outError("CastCustomSpell: unknown spell id %i by caster: %s triggered by aura %u (eff %u)", spellId, GetObjectGuid().GetString().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); + else + sLog.outError("CastCustomSpell: unknown spell id %i by caster: %s", spellId, GetObjectGuid().GetString().c_str()); return; } @@ -1112,7 +1121,10 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 cons { if(!spellInfo) { - sLog.outError("CastCustomSpell: unknown spell by caster: %s", GetObjectGuid().GetString().c_str()); + if (triggeredByAura) + sLog.outError("CastCustomSpell: unknown spell by caster: %s triggered by aura %u (eff %u)", GetObjectGuid().GetString().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); + else + sLog.outError("CastCustomSpell: unknown spell by caster: %s", GetObjectGuid().GetString().c_str()); return; } @@ -1146,7 +1158,10 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, if(!spellInfo) { - sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s", spellId, GetObjectGuid().GetString().c_str()); + if (triggeredByAura) + sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s triggered by aura %u (eff %u)", spellId, GetObjectGuid().GetString().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); + else + sLog.outError("CastSpell(x,y,z): unknown spell id %i by caster: %s", spellId, GetObjectGuid().GetString().c_str()); return; } @@ -1158,7 +1173,10 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, boo { if(!spellInfo) { - sLog.outError("CastSpell(x,y,z): unknown spell by caster: %s", GetObjectGuid().GetString().c_str()); + if (triggeredByAura) + sLog.outError("CastSpell(x,y,z): unknown spell by caster: %s triggered by aura %u (eff %u)", GetObjectGuid().GetString().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); + else + sLog.outError("CastSpell(x,y,z): unknown spell by caster: %s", GetObjectGuid().GetString().c_str()); return; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e08f10e15..4fd5c8c3b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10033" + #define REVISION_NR "10034" #endif // __REVISION_NR_H__ From 18ffffd379180a40dadab6ca84a94d8a3c74ba2b Mon Sep 17 00:00:00 2001 From: Insider42 Date: Sun, 6 Jun 2010 18:04:38 +0400 Subject: [PATCH 163/172] [10035] Additinal reqs for spell 49219/51459 and ranks triggering. * Only at melee attack or spell 56815 hit. * Spell 49219 and ranks also ignore offhand attack. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 9 +++++++-- src/shared/revision_nr.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 772308465..f3d1dface 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7028,8 +7028,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Necrosis if (dummySpell->SpellIconID == 2709) { - // only melee auto attack affected - if (!(procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT)) + // only melee auto attack affected and Rune Strike + if (!(procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) && procSpell->Id != 56815) return false; basepoints[0] = triggerAmount * damage / 100; @@ -7140,6 +7140,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Blood-Caked Blade if (dummySpell->SpellIconID == 138) { + // only main hand melee auto attack affected and Rune Strike + if ((procFlag & PROC_FLAG_SUCCESSFUL_OFFHAND_HIT) || + !(procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) && procSpell->Id != 56815) + return false; + // triggered_spell_id in spell data break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4fd5c8c3b..72ffa03f8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10034" + #define REVISION_NR "10035" #endif // __REVISION_NR_H__ From 32bed90aa98a54740f514ac796e44de71bc9a444 Mon Sep 17 00:00:00 2001 From: AbsoluteZero Date: Sun, 6 Jun 2010 18:37:53 +0400 Subject: [PATCH 164/172] [10036] Fixed health restore and triggering cooldown for talent 30881 and ranks. Signed-off-by: VladimirMangos --- sql/mangos.sql | 14 ++++++++------ sql/updates/10036_01_mangos_spell_chain.sql | 11 +++++++++++ sql/updates/10036_01_mangos_spell_proc_event.sql | 5 +++++ sql/updates/Makefile.am | 4 ++++ src/game/SpellAuras.cpp | 1 + src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 7 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 sql/updates/10036_01_mangos_spell_chain.sql create mode 100644 sql/updates/10036_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 48efb3c3d..dff2f8e7b 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10017_01_mangos_spell_proc_event` bit(1) default NULL + `required_10036_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -16576,6 +16576,12 @@ INSERT INTO spell_chain VALUES (58771,25570,5675,6,0), (58773,58771,5675,7,0), (58774,58773,5675,8,0), +/*Nature's Guardian*/ +(30881,0,30881,1,0), +(30883,30881,30881,2,0), +(30884,30883,30881,3,0), +(30885,30884,30881,4,0), +(30886,30885,30881,5,0), /*Riptide*/ (61295,0,61295,1,0), (61299,61295,61295,2,0), @@ -18203,11 +18209,7 @@ INSERT INTO `spell_proc_event` VALUES (30701, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30705, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30823, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10.500000, 0.000000, 0), -(30881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30883, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30884, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30885, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), -(30886, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 5), +(30881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), (30937, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31124, 0x00, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31126, 0x00, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), diff --git a/sql/updates/10036_01_mangos_spell_chain.sql b/sql/updates/10036_01_mangos_spell_chain.sql new file mode 100644 index 000000000..7414f40f8 --- /dev/null +++ b/sql/updates/10036_01_mangos_spell_chain.sql @@ -0,0 +1,11 @@ +ALTER TABLE db_version CHANGE COLUMN required_10017_01_mangos_spell_proc_event required_10036_01_mangos_spell_chain bit; + +DELETE FROM `spell_chain` WHERE `spell_id` IN (30881,30883,30884,30885,30886); + +INSERT INTO `spell_chain` (`spell_id`, `prev_spell`, `first_spell`, `rank`, `req_spell`) VALUES +/*Nature's Guardian*/ +(30881,0,30881,1,0), +(30883,30881,30881,2,0), +(30884,30883,30881,3,0), +(30885,30884,30881,4,0), +(30886,30885,30881,5,0); diff --git a/sql/updates/10036_01_mangos_spell_proc_event.sql b/sql/updates/10036_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..626155c04 --- /dev/null +++ b/sql/updates/10036_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_10036_01_mangos_spell_chain required_10036_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN (30881,30883,30884,30885,30886); +INSERT INTO `spell_proc_event` VALUES +(30881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index a65e1a199..630c62c75 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -82,6 +82,8 @@ pkgdata_DATA = \ 10012_01_mangos_spell_proc_event.sql \ 10015_01_mangos_spell_proc_event.sql \ 10017_01_mangos_spell_proc_event.sql \ + 10036_01_mangos_spell_chain.sql \ + 10036_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -144,4 +146,6 @@ EXTRA_DIST = \ 10012_01_mangos_spell_proc_event.sql \ 10015_01_mangos_spell_proc_event.sql \ 10017_01_mangos_spell_proc_event.sql \ + 10036_01_mangos_spell_chain.sql \ + 10036_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c692c0461..970d1d221 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5441,6 +5441,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { case 12976: // Warrior Last Stand triggered spell case 28726: // Nightmare Seed ( Nightmare Seed ) + case 31616: // Nature's Guardian case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings) case 44055: case 55915: case 55917: case 67596: // Tremendous Fortitude (Battlemaster's Alacrity) case 50322: // Survival Instincts diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 72ffa03f8..86ae0b099 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10035" + #define REVISION_NR "10036" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 2164cc3d0..82a31ac05 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_10017_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_10036_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__ From 2ca1b3fceaae4035afd1d7244d6f258d383ace86 Mon Sep 17 00:00:00 2001 From: sixsixnine Date: Sun, 6 Jun 2010 19:00:02 +0400 Subject: [PATCH 165/172] [10037] Fixed poison consume by spell 32645 and ranks. It will consume only caster casted poisons. Signed-off-by: VladimirMangos --- src/game/SpellEffects.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index d0cc3873b..1f34ca59f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -596,15 +596,15 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) } } - if(needConsume) + if (needConsume) for (uint32 i = 0; i < doses; ++i) - unitTarget->RemoveSingleSpellAurasFromStack(spellId); + unitTarget->RemoveSingleSpellAurasByCasterSpell(spellId, m_caster->GetGUID()); damage *= doses; damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses); } // Eviscerate and Envenom Bonus Damage (item set effect) - if(m_caster->GetDummyAura(37169)) + if (m_caster->GetDummyAura(37169)) damage += ((Player*)m_caster)->GetComboPoints()*40; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 86ae0b099..4b75e4ff9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10036" + #define REVISION_NR "10037" #endif // __REVISION_NR_H__ From ff2f722f49cfdcf7762a124c78fd532f68c9b94f Mon Sep 17 00:00:00 2001 From: zergtmn Date: Sun, 6 Jun 2010 21:29:11 +0400 Subject: [PATCH 166/172] [10038] Prevent double triggering heal from 63534 and ranks. Signed-off-by: VladimirMangos Also use more simple and safe checks for added in [10035]. --- src/game/Unit.cpp | 13 +++++++++---- src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f3d1dface..d27a80bd5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5919,7 +5919,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell) return false; - Aura* healingAura = pVictim->GetAura(procSpell->Id, EFFECT_INDEX_0); + // avoid double triggering from 2 auras + if (triggeredByAura->GetEffIndex() != EFFECT_INDEX_1) + return false; + + + // Renew + Aura* healingAura = pVictim->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_PRIEST, UI64LIT(0x40), 0, GetGUID()); if (!healingAura) return false; @@ -7029,7 +7035,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 2709) { // only melee auto attack affected and Rune Strike - if (!(procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) && procSpell->Id != 56815) + if (procSpell && procSpell->Id != 56815) return false; basepoints[0] = triggerAmount * damage / 100; @@ -7141,8 +7147,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 138) { // only main hand melee auto attack affected and Rune Strike - if ((procFlag & PROC_FLAG_SUCCESSFUL_OFFHAND_HIT) || - !(procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) && procSpell->Id != 56815) + if ((procFlag & PROC_FLAG_SUCCESSFUL_OFFHAND_HIT) || procSpell && procSpell->Id != 56815) return false; // triggered_spell_id in spell data diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4b75e4ff9..354a05135 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10037" + #define REVISION_NR "10038" #endif // __REVISION_NR_H__ From 7f8ad960388d2f140883b79537abaff5a35ea70f Mon Sep 17 00:00:00 2001 From: zergtmn Date: Sun, 6 Jun 2010 22:00:54 +0400 Subject: [PATCH 167/172] [10039] Partly revert [10033] for spell 44394 and ranks related code. Not all ranks of spell have proper triggered spell info. Return to old more explicit code. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 6 ++---- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d27a80bd5..3d1793db7 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2222,14 +2222,12 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D int32 amount = int32(incanterAbsorption * (*itr)->GetModifier()->m_amount / 100); - uint32 triggered_id = itr_spellProto->EffectTriggerSpell[(*itr)->GetEffIndex()]; - // apply normalized part of already accumulated amount in aura - if (Aura* spdAura = GetAura(triggered_id, EFFECT_INDEX_0)) + if (Aura* spdAura = GetAura(44413, EFFECT_INDEX_0)) amount += spdAura->GetModifier()->m_amount * spdAura->GetAuraDuration() / spdAura->GetAuraMaxDuration(); // Incanter's Absorption (triggered absorb based spell power, will replace existed if any) - CastCustomSpell(this, triggered_id, &amount, NULL, NULL, true, NULL, *itr); + CastCustomSpell(this, 44413, &amount, NULL, NULL, true); break; } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 354a05135..e4c13e21f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10038" + #define REVISION_NR "10039" #endif // __REVISION_NR_H__ From d757ba2a735fb27c68da1d2cbd4f5946f83c1826 Mon Sep 17 00:00:00 2001 From: Insider42 Date: Sun, 6 Jun 2010 22:14:19 +0400 Subject: [PATCH 168/172] [10040] Expected RAP bonus to damage for spell 1510 and ranks. Signed-off-by: VladimirMangos --- src/game/SpellEffects.cpp | 5 +++++ src/shared/revision_nr.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1f34ca59f..e1db8016f 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -672,6 +672,11 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f); } + // Volley + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00002000)) + { + damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.0837f); + } break; } case SPELLFAMILY_PALADIN: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e4c13e21f..111e3d48a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10039" + #define REVISION_NR "10040" #endif // __REVISION_NR_H__ From 5ea6815ea196dbd07bda501ece1fd5603bd392ce Mon Sep 17 00:00:00 2001 From: tehmarto Date: Sun, 6 Jun 2010 22:23:16 +0400 Subject: [PATCH 169/172] [10041] Use for spell 49145 and ranks for decrease SPELL_DIRECT_DAMAGE damage. Signed-off-by: VladimirMangos --- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3d1793db7..f54cca264 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1968,7 +1968,7 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D if (spellProto->SpellIconID == 3006) { // You have a chance equal to your Parry chance - if (damagetype == DIRECT_DAMAGE && // Only for direct damage + if (damagetype == SPELL_DIRECT_DAMAGE && // Only for direct spell damage roll_chance_f(GetUnitParryChance())) // Roll chance RemainingDamage -= RemainingDamage * currentAbsorb / 100; continue; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 111e3d48a..8bc36d8c8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10040" + #define REVISION_NR "10041" #endif // __REVISION_NR_H__ From 5eabf121113450f86e1d6ce712b37fe0459f56be Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 7 Jun 2010 22:21:28 +0400 Subject: [PATCH 170/172] [10042] Implement CONDITION_QUESTAVAILABLE. Also do come constatification of quest status check functions and fix one unsafe use std::map operator[]. Never never use std::map operator [] for _read_ access. Good chance corrupt related structure state ;) Not in found case but in general. --- src/game/ObjectMgr.cpp | 8 + src/game/ObjectMgr.h | 3 +- src/game/Player.cpp | 311 ++++++++++++++++++++------------------- src/game/Player.h | 46 +++--- src/game/QuestDef.h | 2 +- src/shared/revision_nr.h | 2 +- 6 files changed, 193 insertions(+), 179 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index ca0b9184e..1e7e2b0f2 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7455,6 +7455,13 @@ bool PlayerCondition::Meets(Player const * player) const return data->CheckConditionCriteriaMeet(player, value1, value2); return false; } + case CONDITION_QUESTAVAILABLE: + { + if (Quest const* quest = sObjectMgr.GetQuestTemplate(value1)) + return player->CanTakeQuest(quest, false); + else + false; + } default: return false; } @@ -7563,6 +7570,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val } case CONDITION_QUESTREWARDED: case CONDITION_QUESTTAKEN: + case CONDITION_QUESTAVAILABLE: { Quest const *Quest = sObjectMgr.GetQuestTemplate(value1); if (!Quest) diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 2793b7709..7e51ba98e 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -317,9 +317,10 @@ enum ConditionType CONDITION_NOITEM = 16, // item_id count CONDITION_SPELL = 17, // spell_id 0, 1 (0: has spell, 1: hasn't spell) CONDITION_INSTANCE_SCRIPT = 18, // map_id instance_condition_id (instance script specific enum) + CONDITION_QUESTAVAILABLE = 19, // quest_id 0 for case when loot/gossip possible only if player can start quest }; -#define MAX_CONDITION 19 // maximum value in ConditionType enum +#define MAX_CONDITION 20 // maximum value in ConditionType enum struct PlayerCondition { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 830836da6..1ca0a2abf 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -11922,7 +11922,7 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) } } -void Player::SendEquipError( uint8 msg, Item* pItem, Item *pItem2, uint32 itemid /*= 0*/ ) +void Player::SendEquipError( uint8 msg, Item* pItem, Item *pItem2, uint32 itemid /*= 0*/ ) const { DEBUG_LOG( "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); WorldPacket data(SMSG_INVENTORY_CHANGE_FAILURE, 1+8+8+1); @@ -13125,12 +13125,12 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) return NULL; } -bool Player::CanSeeStartQuest( Quest const *pQuest ) +bool Player::CanSeeStartQuest( Quest const *pQuest ) const { - if( SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) && + if (SatisfyQuestRace( pQuest, false ) && SatisfyQuestSkillOrClass( pQuest, false ) && SatisfyQuestExclusiveGroup( pQuest, false ) && SatisfyQuestReputation( pQuest, false ) && SatisfyQuestPreviousQuest( pQuest, false ) && SatisfyQuestNextChain( pQuest, false ) && - SatisfyQuestPrevChain( pQuest, false ) && SatisfyQuestDay( pQuest, false ) && SatisfyQuestWeek( pQuest, false ) ) + SatisfyQuestPrevChain( pQuest, false ) && SatisfyQuestDay( pQuest, false ) && SatisfyQuestWeek( pQuest, false )) { return getLevel() + sWorld.getConfig(CONFIG_UINT32_QUEST_HIGH_LEVEL_HIDE_DIFF) >= pQuest->GetMinLevel(); } @@ -13138,7 +13138,7 @@ bool Player::CanSeeStartQuest( Quest const *pQuest ) return false; } -bool Player::CanTakeQuest( Quest const *pQuest, bool msg ) +bool Player::CanTakeQuest( Quest const *pQuest, bool msg ) const { return SatisfyQuestStatus( pQuest, msg ) && SatisfyQuestExclusiveGroup( pQuest, msg ) && SatisfyQuestRace( pQuest, msg ) && SatisfyQuestLevel( pQuest, msg ) @@ -13148,22 +13148,22 @@ bool Player::CanTakeQuest( Quest const *pQuest, bool msg ) && SatisfyQuestDay( pQuest, msg ) && SatisfyQuestWeek( pQuest, msg ); } -bool Player::CanAddQuest( Quest const *pQuest, bool msg ) +bool Player::CanAddQuest( Quest const *pQuest, bool msg ) const { - if( !SatisfyQuestLog( msg ) ) + if (!SatisfyQuestLog( msg )) return false; uint32 srcitem = pQuest->GetSrcItemId(); - if( srcitem > 0 ) + if (srcitem > 0) { uint32 count = pQuest->GetSrcItemCount(); ItemPosCountVec dest; uint8 msg2 = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, srcitem, count ); // player already have max number (in most case 1) source item, no additional item needed and quest can be added. - if( msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + if (msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) return true; - else if( msg2 != EQUIP_ERR_OK ) + else if (msg2 != EQUIP_ERR_OK) { SendEquipError(msg2, NULL, NULL, srcitem); return false; @@ -13172,89 +13172,94 @@ bool Player::CanAddQuest( Quest const *pQuest, bool msg ) return true; } -bool Player::CanCompleteQuest( uint32 quest_id ) +bool Player::CanCompleteQuest( uint32 quest_id ) const { - if( quest_id ) - { - QuestStatusData& q_status = mQuestStatus[quest_id]; - if( q_status.m_status == QUEST_STATUS_COMPLETE ) - return false; // not allow re-complete quest - - Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); - - if(!qInfo) - return false; - - // auto complete quest - if (qInfo->IsAutoComplete() && CanTakeQuest(qInfo, false)) - return true; - - if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) - { - - if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) - { - for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - { - if( qInfo->ReqItemCount[i] != 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i] ) - return false; - } - } - - if ( qInfo->HasFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO) ) - { - for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - { - if( qInfo->ReqCreatureOrGOId[i] == 0 ) - continue; - - if( qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i] ) - return false; - } - } - - if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT ) && !q_status.m_explored ) - return false; - - if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) && q_status.m_timer == 0 ) - return false; - - if ( qInfo->GetRewOrReqMoney() < 0 ) - { - if ( GetMoney() < uint32(-qInfo->GetRewOrReqMoney()) ) - return false; - } - - uint32 repFacId = qInfo->GetRepObjectiveFaction(); - if ( repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue() ) - return false; - - return true; - } - } - return false; -} - -bool Player::CanCompleteRepeatableQuest( Quest const *pQuest ) -{ - // Solve problem that player don't have the quest and try complete it. - // if repeatable she must be able to complete event if player don't have it. - // Seem that all repeatable quest are DELIVER Flag so, no need to add more. - if( !CanTakeQuest(pQuest, false) ) + if (!quest_id) return false; - if (pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER) ) - for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - if( pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i], pQuest->ReqItemCount[i]) ) - return false; + QuestStatusMap::const_iterator q_itr = mQuestStatus.find(quest_id); - if( !CanRewardQuest(pQuest, false) ) + // some quests can be auto taken and auto completed in one step + QuestStatus status = q_itr != mQuestStatus.end() ? q_itr->second.m_status : QUEST_STATUS_NONE; + + if (status == QUEST_STATUS_COMPLETE) + return false; // not allow re-complete quest + + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); + + if (!qInfo) + return false; + + // auto complete quest + if (qInfo->IsAutoComplete() && CanTakeQuest(qInfo, false)) + return true; + + if (status != QUEST_STATUS_INCOMPLETE) + return false; + + // incomplete quest have status data + QuestStatusData const& q_status = q_itr->second; + + if (qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER )) + { + for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + { + if (qInfo->ReqItemCount[i] != 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i]) + return false; + } + } + + if (qInfo->HasFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO)) + { + for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + { + if (qInfo->ReqCreatureOrGOId[i] == 0) + continue; + + if (qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i]) + return false; + } + } + + if (qInfo->HasFlag( QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT ) && !q_status.m_explored) + return false; + + if (qInfo->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) && q_status.m_timer == 0) + return false; + + if (qInfo->GetRewOrReqMoney() < 0) + { + if (GetMoney() < uint32(-qInfo->GetRewOrReqMoney())) + return false; + } + + uint32 repFacId = qInfo->GetRepObjectiveFaction(); + if (repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue()) return false; return true; } -bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) +bool Player::CanCompleteRepeatableQuest( Quest const *pQuest ) const +{ + // Solve problem that player don't have the quest and try complete it. + // if repeatable she must be able to complete event if player don't have it. + // Seem that all repeatable quest are DELIVER Flag so, no need to add more. + if (!CanTakeQuest(pQuest, false)) + return false; + + if (pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER) ) + for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + if (pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i], pQuest->ReqItemCount[i])) + return false; + + if (!CanRewardQuest(pQuest, false)) + return false; + + return true; +} + +bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) const { // not auto complete quest and not completed quest (only cheating case, then ignore without message) if (!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE) @@ -13269,14 +13274,14 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) return false; // prevent receive reward with quest items in bank - if ( pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if (pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER )) { for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - if( pQuest->ReqItemCount[i] != 0 && - GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i] ) + if (pQuest->ReqItemCount[i] != 0 && + GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i]) { - if(msg) + if (msg) SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, pQuest->ReqItemId[i]); return false; } @@ -13284,25 +13289,25 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) } // prevent receive reward with low money and GetRewOrReqMoney() < 0 - if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()) ) + if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney())) return false; return true; } -bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ) +bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ) const { // prevent receive reward with quest items in bank or for not completed quest - if(!CanRewardQuest(pQuest,msg)) + if (!CanRewardQuest(pQuest,msg)) return false; - if ( pQuest->GetRewChoiceItemsCount() > 0 ) + if (pQuest->GetRewChoiceItemsCount() > 0) { - if( pQuest->RewChoiceItemId[reward] ) + if (pQuest->RewChoiceItemId[reward]) { ItemPosCountVec dest; uint8 res = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward] ); - if( res != EQUIP_ERR_OK ) + if (res != EQUIP_ERR_OK) { SendEquipError( res, NULL, NULL, pQuest->RewChoiceItemId[reward] ); return false; @@ -13310,15 +13315,15 @@ bool Player::CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ) } } - if ( pQuest->GetRewItemsCount() > 0 ) + if (pQuest->GetRewItemsCount() > 0) { for (uint32 i = 0; i < pQuest->GetRewItemsCount(); ++i) { - if( pQuest->RewItemId[i] ) + if (pQuest->RewItemId[i]) { ItemPosCountVec dest; uint8 res = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i] ); - if( res != EQUIP_ERR_OK ) + if (res != EQUIP_ERR_OK) { SendEquipError( res, NULL, NULL ); return false; @@ -13633,22 +13638,22 @@ void Player::FailQuest(uint32 questId) } } -bool Player::SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ) const { int32 zoneOrSort = qInfo->GetZoneOrSort(); int32 skillOrClass = qInfo->GetSkillOrClass(); // skip zone zoneOrSort and 0 case skillOrClass - if( zoneOrSort >= 0 && skillOrClass == 0 ) + if (zoneOrSort >= 0 && skillOrClass == 0) return true; int32 questSort = -zoneOrSort; uint8 reqSortClass = ClassByQuestSort(questSort); // check class sort cases in zoneOrSort - if( reqSortClass != 0 && getClass() != reqSortClass) + if (reqSortClass != 0 && getClass() != reqSortClass) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13679,24 +13684,24 @@ bool Player::SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestLevel( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestLevel( Quest const* qInfo, bool msg ) const { - if( getLevel() < qInfo->GetMinLevel() ) + if (getLevel() < qInfo->GetMinLevel()) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } return true; } -bool Player::SatisfyQuestLog( bool msg ) +bool Player::SatisfyQuestLog( bool msg ) const { // exist free slot - if( FindQuestSlot(0) < MAX_QUEST_LOG_SIZE ) + if (FindQuestSlot(0) < MAX_QUEST_LOG_SIZE) return true; - if( msg ) + if (msg) { WorldPacket data( SMSG_QUESTLOG_FULL, 0 ); GetSession()->SendPacket( &data ); @@ -13705,10 +13710,10 @@ bool Player::SatisfyQuestLog( bool msg ) return false; } -bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const { // No previous quest (might be first quest in a series) - if( qInfo->prevQuests.empty()) + if (qInfo->prevQuests.empty()) return true; for(Quest::PrevQuests::const_iterator iter = qInfo->prevQuests.begin(); iter != qInfo->prevQuests.end(); ++iter ) @@ -13718,13 +13723,13 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); Quest const* qPrevInfo = sObjectMgr.GetQuestTemplate(prevId); - if( qPrevInfo && i_prevstatus != mQuestStatus.end() ) + if (qPrevInfo && i_prevstatus != mQuestStatus.end()) { // If any of the positive previous quests completed, return true - if( *iter > 0 && i_prevstatus->second.m_rewarded ) + if (*iter > 0 && i_prevstatus->second.m_rewarded) { // skip one-from-all exclusive group - if(qPrevInfo->GetExclusiveGroup() >= 0) + if (qPrevInfo->GetExclusiveGroup() >= 0) return true; // each-from-all exclusive group ( < 0) @@ -13739,15 +13744,15 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) uint32 exclude_Id = iter2->second; // skip checked quest id, only state of other quests in group is interesting - if(exclude_Id == prevId) + if (exclude_Id == prevId) continue; QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id ); // alternative quest from group also must be completed and rewarded(reported) - if( i_exstatus == mQuestStatus.end() || !i_exstatus->second.m_rewarded ) + if (i_exstatus == mQuestStatus.end() || !i_exstatus->second.m_rewarded) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13755,11 +13760,11 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) return true; } // If any of the negative previous quests active, return true - if( *iter < 0 && (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE + if (*iter < 0 && (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE || (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId)))) { // skip one-from-all exclusive group - if(qPrevInfo->GetExclusiveGroup() >= 0) + if (qPrevInfo->GetExclusiveGroup() >= 0) return true; // each-from-all exclusive group ( < 0) @@ -13774,17 +13779,17 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) uint32 exclude_Id = iter2->second; // skip checked quest id, only state of other quests in group is interesting - if(exclude_Id == prevId) + if (exclude_Id == prevId) continue; QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id ); // alternative quest from group also must be active - if( i_exstatus == mQuestStatus.end() || + if (i_exstatus == mQuestStatus.end() || i_exstatus->second.m_status != QUEST_STATUS_INCOMPLETE && - (i_prevstatus->second.m_status != QUEST_STATUS_COMPLETE || GetQuestRewardStatus(prevId)) ) + (i_prevstatus->second.m_status != QUEST_STATUS_COMPLETE || GetQuestRewardStatus(prevId))) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13796,40 +13801,40 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // Has only positive prev. quests in non-rewarded state // and negative prev. quests in non-active state - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } -bool Player::SatisfyQuestRace( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestRace( Quest const* qInfo, bool msg ) const { uint32 reqraces = qInfo->GetRequiredRaces(); - if ( reqraces == 0 ) + if (reqraces == 0) return true; - if( (reqraces & getRaceMask()) == 0 ) + if ((reqraces & getRaceMask()) == 0) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_QUEST_FAILED_WRONG_RACE ); return false; } return true; } -bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) const { uint32 fIdMin = qInfo->GetRequiredMinRepFaction(); //Min required rep - if(fIdMin && GetReputationMgr().GetReputation(fIdMin) < qInfo->GetRequiredMinRepValue()) + if (fIdMin && GetReputationMgr().GetReputation(fIdMin) < qInfo->GetRequiredMinRepValue()) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } uint32 fIdMax = qInfo->GetRequiredMaxRepFaction(); //Max required rep - if(fIdMax && GetReputationMgr().GetReputation(fIdMax) >= qInfo->GetRequiredMaxRepValue()) + if (fIdMax && GetReputationMgr().GetReputation(fIdMax) >= qInfo->GetRequiredMaxRepValue()) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13837,19 +13842,19 @@ bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg ) const { QuestStatusMap::const_iterator itr = mQuestStatus.find( qInfo->GetQuestId() ); - if ( itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE ) + if (itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_QUEST_ALREADY_ON ); return false; } return true; } -bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) +bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) const { if (!m_timedquests.empty() && qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED)) { @@ -13861,7 +13866,7 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) return true; } -bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) const { // non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed if (qInfo->GetExclusiveGroup() <= 0) @@ -13889,13 +13894,13 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) return false; } - QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id ); + QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id ); // alternative quest already started or completed if (i_exstatus != mQuestStatus.end() && (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE)) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13903,17 +13908,17 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg ) const { - if(!qInfo->GetNextQuestInChain()) + if (!qInfo->GetNextQuestInChain()) return true; // next quest in chain already started or completed QuestStatusMap::const_iterator itr = mQuestStatus.find( qInfo->GetNextQuestInChain() ); - if( itr != mQuestStatus.end() - && (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE) ) + if (itr != mQuestStatus.end() + && (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE)) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13924,10 +13929,10 @@ bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) const { // No previous quest in chain - if( qInfo->prevChainQuests.empty()) + if (qInfo->prevChainQuests.empty()) return true; for(Quest::PrevChainQuests::const_iterator iter = qInfo->prevChainQuests.begin(); iter != qInfo->prevChainQuests.end(); ++iter ) @@ -13936,13 +13941,13 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); - if( i_prevstatus != mQuestStatus.end() ) + if (i_prevstatus != mQuestStatus.end()) { // If any of the previous quests in chain active, return false - if( i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE + if (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE || (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId))) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); return false; } @@ -13958,7 +13963,7 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) const { if (!qInfo->IsDaily()) return true; @@ -13970,13 +13975,13 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) if (qInfo->GetQuestId()==id) return false; - if(!id) + if (!id) have_slot = true; } if (!have_slot) { - if( msg ) + if (msg) SendCanTakeQuestResponse( INVALIDREASON_DAILY_QUESTS_REMAINING ); return false; } @@ -13984,7 +13989,7 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) return true; } -bool Player::SatisfyQuestWeek( Quest const* qInfo, bool msg ) +bool Player::SatisfyQuestWeek( Quest const* qInfo, bool msg ) const { if (!qInfo->IsWeekly() || m_weeklyquests.empty()) return true; @@ -14636,7 +14641,7 @@ void Player::SendQuestTimerFailed( uint32 quest_id ) } } -void Player::SendCanTakeQuestResponse( uint32 msg ) +void Player::SendCanTakeQuestResponse( uint32 msg ) const { WorldPacket data( SMSG_QUESTGIVER_QUEST_INVALID, 4 ); data << uint32(msg); diff --git a/src/game/Player.h b/src/game/Player.h index ebb629571..73777085d 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1259,7 +1259,7 @@ class MANGOS_DLL_SPEC Player : public Unit Item* GetItemFromBuyBackSlot( uint32 slot ); void RemoveItemFromBuyBackSlot( uint32 slot, bool del ); uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } - void SendEquipError( uint8 msg, Item* pItem, Item *pItem2 = NULL, uint32 itemid = 0 ); + void SendEquipError( uint8 msg, Item* pItem, Item *pItem2 = NULL, uint32 itemid = 0 ) const; void SendBuyError( uint8 msg, Creature* pCreature, uint32 item, uint32 param ); void SendSellError( uint8 msg, Creature* pCreature, uint64 guid, uint32 param ); void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } @@ -1326,32 +1326,32 @@ class MANGOS_DLL_SPEC Player : public Unit void SendPreparedQuest( uint64 guid ); bool IsActiveQuest( uint32 quest_id ) const; Quest const *GetNextQuest( uint64 guid, Quest const *pQuest ); - bool CanSeeStartQuest( Quest const *pQuest ); - bool CanTakeQuest( Quest const *pQuest, bool msg ); - bool CanAddQuest( Quest const *pQuest, bool msg ); - bool CanCompleteQuest( uint32 quest_id ); - bool CanCompleteRepeatableQuest(Quest const *pQuest); - bool CanRewardQuest( Quest const *pQuest, bool msg ); - bool CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ); + bool CanSeeStartQuest( Quest const *pQuest ) const; + bool CanTakeQuest( Quest const *pQuest, bool msg ) const; + bool CanAddQuest( Quest const *pQuest, bool msg ) const; + bool CanCompleteQuest( uint32 quest_id ) const; + bool CanCompleteRepeatableQuest(Quest const *pQuest) const; + bool CanRewardQuest( Quest const *pQuest, bool msg ) const; + bool CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ) const; void AddQuest( Quest const *pQuest, Object *questGiver ); void CompleteQuest( uint32 quest_id ); void IncompleteQuest( uint32 quest_id ); void RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver, bool announce = true ); void FailQuest( uint32 quest_id ); - bool SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ); - bool SatisfyQuestLevel( Quest const* qInfo, bool msg ); - bool SatisfyQuestLog( bool msg ); - bool SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ); - bool SatisfyQuestRace( Quest const* qInfo, bool msg ); - bool SatisfyQuestReputation( Quest const* qInfo, bool msg ); - bool SatisfyQuestStatus( Quest const* qInfo, bool msg ); - bool SatisfyQuestTimed( Quest const* qInfo, bool msg ); - bool SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ); - bool SatisfyQuestNextChain( Quest const* qInfo, bool msg ); - bool SatisfyQuestPrevChain( Quest const* qInfo, bool msg ); - bool SatisfyQuestDay( Quest const* qInfo, bool msg ); - bool SatisfyQuestWeek( Quest const* qInfo, bool msg ); + bool SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestLevel( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestLog( bool msg ) const; + bool SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestRace( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestReputation( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestStatus( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestTimed( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestNextChain( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestDay( Quest const* qInfo, bool msg ) const; + bool SatisfyQuestWeek( Quest const* qInfo, bool msg ) const; bool GiveQuestSourceItem( Quest const *pQuest ); bool TakeQuestSourceItem( uint32 quest_id, bool msg ); bool GetQuestRewardStatus( uint32 quest_id ) const; @@ -1417,7 +1417,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendQuestReward( Quest const *pQuest, uint32 XP, Object* questGiver ); void SendQuestFailed( uint32 quest_id ); void SendQuestTimerFailed( uint32 quest_id ); - void SendCanTakeQuestResponse( uint32 msg ); + void SendCanTakeQuestResponse( uint32 msg ) const; void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver); void SendPushToPartyResponse( Player *pPlayer, uint32 msg ); void SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ); @@ -1474,7 +1474,7 @@ class MANGOS_DLL_SPEC Player : public Unit void setRegenTimer(uint32 time) {m_regenTimer = time;} void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} - uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); } + uint32 GetMoney() const { return GetUInt32Value (PLAYER_FIELD_COINAGE); } void ModifyMoney( int32 d ) { if(d < 0) diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 89abf8754..8d6a44df5 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -98,7 +98,7 @@ enum QuestStatus QUEST_STATUS_COMPLETE = 1, QUEST_STATUS_UNAVAILABLE = 2, QUEST_STATUS_INCOMPLETE = 3, - QUEST_STATUS_AVAILABLE = 4, + QUEST_STATUS_AVAILABLE = 4, // unused in fact QUEST_STATUS_FAILED = 5, MAX_QUEST_STATUS }; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8bc36d8c8..07922f557 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10041" + #define REVISION_NR "10042" #endif // __REVISION_NR_H__ From a7b80733df4a0ad50cb612c864a4cbb10bac653d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 7 Jun 2010 23:40:08 +0400 Subject: [PATCH 171/172] [10043] Fixed share quest in case completed objectives. * Also fixed CONDITION_QUESTTAKEN for same case. * Aslo fixed exclusive prev quests check. --- src/game/ObjectMgr.cpp | 3 +-- src/game/Player.cpp | 45 ++++++++++++++++++---------------------- src/game/Player.h | 3 ++- src/shared/revision_nr.h | 2 +- 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 1e7e2b0f2..dad541015 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7397,8 +7397,7 @@ bool PlayerCondition::Meets(Player const * player) const return player->GetQuestRewardStatus(value1); case CONDITION_QUESTTAKEN: { - QuestStatus status = player->GetQuestStatus(value1); - return (status == QUEST_STATUS_INCOMPLETE); + return player->IsCurrentQuest(value1); } case CONDITION_AD_COMMISSION_AURA: { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1ca0a2abf..1dbdefb23 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13086,6 +13086,15 @@ bool Player::IsActiveQuest( uint32 quest_id ) const return itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE; } +bool Player::IsCurrentQuest( uint32 quest_id ) const +{ + QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id); + if (itr == mQuestStatus.end()) + return false; + + return itr->second.m_status == QUEST_STATUS_INCOMPLETE || itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded; +} + Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) { Object *pObject; @@ -13760,8 +13769,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const return true; } // If any of the negative previous quests active, return true - if (*iter < 0 && (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE - || (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId)))) + if (*iter < 0 && IsCurrentQuest(prevId)) { // skip one-from-all exclusive group if (qPrevInfo->GetExclusiveGroup() >= 0) @@ -13782,12 +13790,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const if (exclude_Id == prevId) continue; - QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id ); - // alternative quest from group also must be active - if (i_exstatus == mQuestStatus.end() || - i_exstatus->second.m_status != QUEST_STATUS_INCOMPLETE && - (i_prevstatus->second.m_status != QUEST_STATUS_COMPLETE || GetQuestRewardStatus(prevId))) + if (!IsCurrentQuest(exclude_Id)) { if (msg) SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); @@ -13939,18 +13943,12 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) const { uint32 prevId = *iter; - QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); - - if (i_prevstatus != mQuestStatus.end()) + // If any of the previous quests in chain active, return false + if (IsCurrentQuest(prevId)) { - // If any of the previous quests in chain active, return false - if (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE - || (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId))) - { - if (msg) - SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); - return false; - } + if (msg) + SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); + return false; } // check for all quests further down the chain @@ -14083,13 +14081,10 @@ QuestStatus Player::GetQuestStatus( uint32 quest_id ) const bool Player::CanShareQuest(uint32 quest_id) const { - Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); - if( qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE) ) - { - QuestStatusMap::const_iterator itr = mQuestStatus.find( quest_id ); - if( itr != mQuestStatus.end() ) - return itr->second.m_status == QUEST_STATUS_NONE || itr->second.m_status == QUEST_STATUS_INCOMPLETE; - } + if (Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id)) + if (qInfo->HasFlag(QUEST_FLAGS_SHARABLE)) + return IsCurrentQuest(quest_id); + return false; } diff --git a/src/game/Player.h b/src/game/Player.h index 73777085d..7567e4570 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1324,7 +1324,8 @@ class MANGOS_DLL_SPEC Player : public Unit void PrepareQuestMenu( uint64 guid ); void SendPreparedQuest( uint64 guid ); - bool IsActiveQuest( uint32 quest_id ) const; + bool IsActiveQuest( uint32 quest_id ) const; // can be taken or taken + bool IsCurrentQuest( uint32 quest_id ) const; // taken and not yet rewarded Quest const *GetNextQuest( uint64 guid, Quest const *pQuest ); bool CanSeeStartQuest( Quest const *pQuest ) const; bool CanTakeQuest( Quest const *pQuest, bool msg ) const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 07922f557..be125c81e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10042" + #define REVISION_NR "10043" #endif // __REVISION_NR_H__ From 8e9a201ea02bcf1c54903b0cce814249559b4006 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 8 Jun 2010 01:17:32 +0400 Subject: [PATCH 172/172] [10044] Generate talent related spell_chain data instead storing its in table. * Drop now redundant part of data from `spell_chain`. * Allow store in spell_proc_event cusom ranks data for ppm for chained ranks. * Drop now redundant part of data from `spell_proc_event`. --- sql/mangos.sql | 421 +----------------- sql/updates/10044_01_mangos_spell_chain.sql | 25 ++ .../10044_02_mangos_spell_proc_event.sql | 38 ++ sql/updates/Makefile.am | 4 + src/game/SpellMgr.cpp | 168 +++++-- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 7 files changed, 211 insertions(+), 449 deletions(-) create mode 100644 sql/updates/10044_01_mangos_spell_chain.sql create mode 100644 sql/updates/10044_02_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index dff2f8e7b..d6de4e8d6 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10036_01_mangos_spell_proc_event` bit(1) default NULL + `required_10044_02_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -14562,9 +14562,6 @@ INSERT INTO spell_chain VALUES (38692,27070,133,14,0), (42832,38692,133,15,0), (42833,42832,133,16,0), -/*Fiery Payback*/ -(64353,0,64353,1,0), -(64357,64353,64353,2,0), /*Flamestrike*/ (2120,0,2120,1,0), (2121,2120,2120,2,0), @@ -14656,10 +14653,6 @@ INSERT INTO spell_chain VALUES (25208,11574,772,8,0), (46845,25208,772,9,0), (47465,46845,772,10,0), -/*Taste for Blood*/ -(56636,0,56636,1,0), -(56637,56636,56636,2,0), -(56638,56637,56636,3,0), /*Thunder Clap*/ (6343,0,6343,1,0), (8198,6343,6343,2,0), @@ -14790,10 +14783,6 @@ INSERT INTO spell_chain VALUES (27067,20910,19306,4,0), (48998,27067,19306,5,0), (48999,48998,19306,6,0), -/*Entrapment*/ -(19184,0,19184,1,0), -(19387,19184,19184,2,0), -(19388,19387,19184,3,0), /*Explosive Shot*/ (53301,0,53301,1,0), (60051,53301,53301,2,0), @@ -14810,10 +14799,6 @@ INSERT INTO spell_chain VALUES (1499,0,1499,1,0), (14310,1499,1499,2,0), (14311,14310,1499,3,0), -/*Hunting Party*/ -(53290,0,53290,1,0), -(53291,53290,53290,2,0), -(53292,53291,53290,3,0), /*Immolation Trap*/ (13795,0,13795,1,0), (14302,13795,13795,2,0), @@ -14823,12 +14808,6 @@ INSERT INTO spell_chain VALUES (27023,14305,13795,6,0), (49055,27023,13795,7,0), (49056,49055,13795,8,0), -/**Master Tactician*/ -(34506,0,34506,1,0), -(34507,34506,34506,2,0), -(34508,34507,34506,3,0), -(34838,34508,34506,4,0), -(34839,34838,34506,5,0), /*Mongoose Bite*/ (1495,0,1495,1,0), (14269,1495,1495,2,0), @@ -14862,9 +14841,6 @@ INSERT INTO spell_chain VALUES (32546,0,32546,1,0), (48119,32546,32546,2,0), (48120,48119,32546,3,0), -/*Body and Soul*/ -(64127,0,64127,1,0), -(64129,64127,64127,2,0), /*Blessed Recovery Proc*/ (27813,0,27813,1,0), (27817,27813,27813,2,0), @@ -14887,10 +14863,6 @@ INSERT INTO spell_chain VALUES (25437,19243,19236,7,0), (48172,25437,19236,8,0), (48173,48172,19236,9,0), -/*Empowered Renew*/ -(63534,0,63534,1,0), -(63542,63534,63534,2,0), -(63543,63542,63534,3,0), /*Flash Heal*/ (2061,0,2061,1,0), (9472,2061,2061,2,0), @@ -14994,10 +14966,6 @@ INSERT INTO spell_chain VALUES (20770,10881,2006,5,0), (25435,20770,2006,6,0), (48171,25435,2006,7,0), -/*Serendipity*/ -(63730,0,63730,1,0), -(63733,63730,63730,2,0), -(63737,63733,63730,3,0), /*Smite*/ (585,0,585,1,0), (591,585,585,2,0), @@ -15024,13 +14992,6 @@ INSERT INTO spell_chain VALUES (25467,19280,2944,7,0), (48299,25467,2944,8,0), (48300,48299,2944,9,0), -/*Improved Devouring Plague*/ -(63625,0,63625,1,0), -(63626,63625,63625,2,0), -(63627,63626,63625,3,0), -/*Improved Shadowform*/ -(47569,0,47569,1,0), -(47570,47569,47569,2,0), /*Mind Blast*/ (8092,0,8092,1,0), (8102,8092,8092,2,0), @@ -15281,9 +15242,6 @@ INSERT INTO spell_chain VALUES (27019,14287,3044,9,0), (49044,27019,3044,10,0), (49045,49044,3044,11,0), -/*Concussive Barrage*/ -(35100,0,35100,1,0), -(35102,35100,35100,2,0), /*Hunter's Mark*/ (1130,0,1130,1,0), (14323,1130,1130,2,0), @@ -15413,10 +15371,6 @@ INSERT INTO spell_chain VALUES (27180,24239,24275,4,0), (48805,27180,24275,5,0), (48806,48805,24275,6,0), -/*Heart of the Crusader*/ -(20335, 0, 20335, 1, 0), -(20336, 20335, 20335, 2, 0), -(20337, 20336, 20335, 3, 0), /*Retribution Aura*/ (7294,0,7294,1,0), (10298,7294,7294,2,0), @@ -15425,13 +15379,6 @@ INSERT INTO spell_chain VALUES (10301,10300,7294,5,0), (27150,10301,7294,6,0), (54043,27150,7294,7,0), -/*Righteous Vengeance*/ -(53380,0,53380,1,0), -(53381,53380,53380,2,0), -(53382,53381,53380,3,0), -/*The Art of War*/ -(53486,0,53486,1,0), -(53488,53486,53486,2,0), /*------------------ -- (185) Cooking ------------------*/ @@ -15940,9 +15887,6 @@ INSERT INTO spell_chain VALUES (34413,34412,1329,4,0), (48663,34413,1329,5,0), (48666,48663,1329,6,0), -/*Quick Recovery*/ -(31244,0,31244,1,0), -(31245,31244,31244,2,0), /*Rupture*/ (1943,0,1943,1,0), (8639,1943,1943,2,0), @@ -15969,10 +15913,6 @@ INSERT INTO spell_chain VALUES (25289,11551,6673,7,0), (2048,25289,6673,8,0), (47436,2048,6673,9,0), -/*Bloodsurge*/ -(46913,0,46913,1,0), -(46914,46913,46913,2,0), -(46915,46914,46913,3,0), /*Cleave*/ (845,0,845,1,0), (7369,845,845,2,0), @@ -16051,15 +15991,6 @@ INSERT INTO spell_chain VALUES (32700,32699,31935,3,0), (48826,32700,31935,4,0), (48827,48826,31935,5,0), -/*Divine Guardian*/ -(53527,0,53527,1,0), -(53530,53527,53527,2, 0), -/*Divinity*/ -(63646,0,63646,1,0), -(63647,63646,63646,2,0), -(63648,63647,63646,3,0), -(63649,63648,63646,4,0), -(63650,63649,63646,5,0), /*Devotion Aura*/ (465,0,465,1,0), (10290,465,465,2,0), @@ -16114,13 +16045,6 @@ INSERT INTO spell_chain VALUES /*Shield of Righteousness*/ (53600,0,53600,1,0), (61411,53600,53600,2,0), -/*Spiritual Attunement*/ -(31785,0,31785,1,0), -(33776,31785,31785,2,0), -/*Shield of the Templar*/ -(53709,0,53709,1,0), -(53710,53709,53709,2,0), -(53711,53710,53709,3,0), /*------------------ --(270)Pet-GenericHunter ------------------*/ @@ -16132,10 +16056,6 @@ INSERT INTO spell_chain VALUES (1756,1755,1742,5,0), (16697,1756,1742,6,0), (27048,16697,1742,7,0), -/*Great Resistance*/ -(53427,0,53427,1,0), -(53429,53427,53427,2,0), -(53430,53429,53427,3,0), /*Growl*/ (2649,0,2649,1,0), (14916,2649,2649,2,0), @@ -16146,15 +16066,6 @@ INSERT INTO spell_chain VALUES (14921,14920,2649,7,0), (27047,14921,2649,8,0), (61676,27047,2649,9,0), -/*Shark Attack*/ -(62759,0,62759,1,0), -(62760,62759,62759,2,0), -/*Silverback*/ -(62764,0,62764,1,0), -(62765,62764,62764,2,0), -/*Wild Hunt*/ -(62758,0,62758,1,0), -(62762,62758,62758,2,0), /*------------------ -- (333) Enchanting ------------------*/ @@ -16203,9 +16114,6 @@ INSERT INTO spell_chain VALUES (28172,17728,2362,4,0), (47886,28172,2362,5,0), (47888,47886,2362,6,0), -/*Decimation*/ -(63156,0,63156,1,0), -(63158,63156,63156,2,0), /*DemonArmor*/ (706,0,706,1,0), (1086,706,706,2,0), @@ -16238,10 +16146,6 @@ INSERT INTO spell_chain VALUES (11695,11694,755,7,0), (27259,11695,755,8,0), (47856,27259,755,9,0), -/*Nemesis*/ -(63117,0,63117,1,0), -(63121,63117,63117,2,0), -(63123,63121,63117,3,0), /*RitualofSouls*/ (29893,0,29893,1,0), (58887,29893,29893,2,0), @@ -16345,12 +16249,6 @@ INSERT INTO spell_chain VALUES (27243,0,27243,1,0), (47835,27243,27243,2,0), (47836,47835,27243,3,0), -/* Shadow embrace */ -(32385,0,32385,1,0), -(32387,32385,32385,2,0), -(32392,32387,32385,3,0), -(32393,32392,32385,4,0), -(32394,32393,32385,5,0), /*Unstable Affliction*/ (30108,0,30108,1,0), (30404,30108,30108,2,0), @@ -16414,12 +16312,6 @@ INSERT INTO spell_chain VALUES (58794,25500,8033,7,0), (58795,58794,8033,8,0), (58796,58795,8033,9,0), -/*Frozen Power*/ -(63373,0,63373,1,0), -(63374,63373,63373,2,0), -/*Improved Stormstrike*/ -(51521,0,51521,1,0), -(51522,51521,51521,2,0), /*Life Tap*/ (1454,0,1454,1,0), (1455,1454,1454,2,0), @@ -16453,12 +16345,6 @@ INSERT INTO spell_chain VALUES (26372,26371,26364,9,0), (49278,26372,26364,10,0), (49279,49278,26364,11,0), -/*Maelstrom Weapon*/ -(51528,0,51528,1,0), -(51529,51528,51528,2,0), -(51530,51529,51528,3,0), -(51531,51530,51528,4,0), -(51532,51531,51528,5,0), /*Nature Resistance Totem*/ (10595,0,10595,1,0), (10600,10595,10595,2,0), @@ -16576,12 +16462,6 @@ INSERT INTO spell_chain VALUES (58771,25570,5675,6,0), (58773,58771,5675,7,0), (58774,58773,5675,8,0), -/*Nature's Guardian*/ -(30881,0,30881,1,0), -(30883,30881,30881,2,0), -(30884,30883,30881,3,0), -(30885,30884,30881,4,0), -(30886,30885,30881,5,0), /*Riptide*/ (61295,0,61295,1,0), (61299,61295,61295,2,0), @@ -16600,9 +16480,6 @@ INSERT INTO spell_chain VALUES /*------------------ -- (375) Elemental Combat ------------------*/ -/*Booming Echoes*/ -(63370,0,63370,1,0), -(63372,63370,63370,2,0), /*Chain Lightning*/ (421,0,421,1,0), (930,421,421,2,0), @@ -16753,9 +16630,6 @@ INSERT INTO spell_chain VALUES (26979,26978,5185,13,0), (48377,26979,5185,14,0), (48378,48377,5185,15,0), -/*Improved Barkskin*/ -(63410,0,63410,1,0), -(63411,63410,63410,2,0), /*Lifebloom*/ (33763,0,33763,1,0), (48450,33763,33763,2,0), @@ -16809,10 +16683,6 @@ INSERT INTO spell_chain VALUES (26982,26981,774,13,0), (48440,26982,774,14,0), (48441,48440,774,15,0), -/*Revitalize*/ -(48539,0,48539,1,0), -(48544,48539,48539,2,0), -(48545,48544,48539,3,0), /*Revive*/ (50769,0,50769,1,0), (50768,50769,50769,2,0), @@ -16990,10 +16860,6 @@ INSERT INTO spell_chain VALUES (32231,29722,29722,2,0), (47837,32231,29722,3,0), (47838,47837,29722,4,0), -/*Molten Skin*/ -(63349,0,63349,1,0), -(63350,63349,63349,2,0), -(63351,63350,63349,3,0), /*Rain of Fire*/ (5740,0,5740,1,0), (6219,5740,5740,2,0), @@ -17181,10 +17047,6 @@ INSERT INTO spell_chain VALUES (27841,14819,14752,4,0), (25312,27841,14752,5,0), (48073,25312,14752,6,0), -/*Improved Flash Heal*/ -(63504,0,63504,1,0), -(63505,63504,63504,2,0), -(63506,63505,63504,3,0), /*InnerFire*/ (588,0,588,1,0), (7128,588,588,2,0), @@ -17243,10 +17105,6 @@ INSERT INTO spell_chain VALUES (27681,14752,14752,2,0), (32999,27681,14752,3,0), (48074,32999,14752,4,0), -/*Rapture*/ -(47535,0,47535,1,0), -(47536,47535,47535,2,0), -(47537,47536,47535,3,0), /*ShackleUndead*/ (9484,0,9484,1,0), (9485,9484,9484,2,0), @@ -17396,16 +17254,6 @@ INSERT INTO spell_chain VALUES (55260,55259,55050,4,0), (55261,55260,55050,5,0), (55262,55261,55050,6,0), -/*Improved Blood Presence*/ -(50365,0,50365,1,0), -(50371,50365,50365,2,0), -/*Improved Death Strike*/ -(62905,0,62905,1,0), -(62908,62905,62905,2,0), -/*Improved Rune Tap*/ -(48985,0,48985,1,0), -(49488,48985,48985,2,0), -(49489,49488,48985,3,0), /*Pestilence*/ (50842,0,50842,1,0), (51426,50842,50842,2,0), @@ -17418,10 +17266,6 @@ INSERT INTO spell_chain VALUES (49914,49913,47476,3,0), (49915,49914,47476,4,0), (49916,49915,47476,5,0), -/*Vendetta*/ -(49015,0,49015,1,0), -(50154,49015,49015,2,0), -(55136,50154,49015,3,0), /*------------------ --(771)Frost ------------------*/ @@ -17440,38 +17284,17 @@ INSERT INTO spell_chain VALUES (51409,49184,49184,2,0), (51410,51409,49184,3,0), (51411,51410,49184,4,0), -/*IcyTalons*/ -(50880,0,50880,1,0), -(50884,50880,50880,2,0), -(50885,50884,50880,3,0), -(50886,50885,50880,4,0), -(50887,50886,50880,5,0), /*IcyTouch*/ (45477,0,45477,1,0), (49896,45477,45477,2,0), (49903,49896,45477,3,0), (49904,49903,45477,4,0), (49909,49904,45477,5,0), -/*Improved Frost Presence*/ -(50384,0,50384,1,0), -(50385,50384,50384,2,0), -/*Improved Icy Touch*/ -(49175,0,49175,1,0), -(50031,49175,49175,2,0), -(51456,50031,49175,3,0), /*Obliterate*/ (49020,0,49020,1,0), (51423,49020,49020,2,0), (51424,51423,49020,3,0), (51425,51424,49020,4,0), -/*Rime*/ -(49188,0,49188,1,0), -(56822,49188,49188,2,0), -(59057,56822,49188,3,0), -/*Threat of Thassarian*/ -(65661,0,65661,1,0), -(66191,65661,65661,2,0), -(66192,66191,65661,3,0), /*------------------ --(772)Unholy ------------------*/ @@ -17498,20 +17321,6 @@ INSERT INTO spell_chain VALUES (45463,49999,49998,3,0), (49923,45463,49998,4,0), (49924,49923,49998,5,0), -/* Desecration */ -(55666,0,55666,1,0), -(55667,55666,55666,2,0), -/*Improved Unholy Presence*/ -(50391,0,50391,1,0), -(50392,50391,50391,2,0), -/*Magic Suppression*/ -(49224,0,49224,1,0), -(49610,49224,49224,2,0), -(49611,49610,49224,3,0), -/*Outbreak*/ -(49013,0,49013,1,0), -(55236,49013,49013,2,0), -(55237,55236,49013,3,0), /*PlagueStrike*/ (45462,0,45462,1,0), (49917,45462,45462,2,0), @@ -17953,7 +17762,6 @@ INSERT INTO `spell_proc_event` VALUES ( 9799, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (11095, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (11119, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(11120, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (11129, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (11180, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (11185, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), @@ -17966,80 +17774,34 @@ INSERT INTO `spell_proc_event` VALUES (12317, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (12319, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (12322, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), -(12487, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), -(12488, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0.000000, 0.000000, 0), -(12598, 0x00, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12668, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12724, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12725, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12726, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(12727, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (12797, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12799, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12812, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12813, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12814, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), -(12815, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), (12834, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12846, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12847, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12848, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12849, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12867, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12872, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12873, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(12958, 0x00, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (12966, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (12967, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (12968, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (12969, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (12970, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(12971, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12972, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12973, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(12974, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (12999, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), (13000, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), (13001, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 8.000000, 0.000000, 0), (13002, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,10.000000, 0.000000, 0), -(13045, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13046, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13047, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(13048, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (13165, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (13754, 0x00, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(13867, 0x00, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (13983, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), -(14070, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), -(14071, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0.000000, 0.000000, 0), (14156, 0x00, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(14160, 0x00, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(14161, 0x00, 8, 0x003E0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (14186, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14190, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14193, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14194, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14195, 0x00, 8, 0x40800508, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (14531, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(14774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (14892, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (15088, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (15128, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (15277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), (15286, 0x20, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (15337, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15338, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (15346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6.000000, 0.000000, 0), -(15362, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(15363, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (15600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), (16164, 0x1C, 11, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000002, 0.000000, 0.000000, 0), (16176, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16180, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16196, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16235, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16240, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16246, 0x00, 11, 0x981001C3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (16256, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), @@ -18047,66 +17809,39 @@ INSERT INTO `spell_proc_event` VALUES (16278, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (16279, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (16280, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(16281, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16282, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16283, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16284, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16487, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16489, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16492, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16550, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16620, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), (16624, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (16850, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (16864, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), (16880, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(16923, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(16924, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (16952, 0x00, 7, 0x00039000, 0x00000400, 0x00040000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16954, 0x00, 7, 0x00039000, 0x00000400, 0x00040000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16958, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (16961, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (17106, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(17107, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(17108, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (17364, 0x08, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (17495, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (17793, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17796, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17801, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17802, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(17803, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(18073, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (18094, 0x00, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(18095, 0x00, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (18096, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (18119, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(18120, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (18820, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (19184, 0x00, 9, 0x00000010, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (19572, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(19573, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), (20049, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20056, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (20128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (20131, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (20132, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (20164, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5.000000, 0.000000, 0), (20165, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,20.000000, 0.000000, 0), (20166, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,15.000000, 0.000000, 0), -(20182, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (20210, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20212, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20213, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20214, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(20215, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (20234, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(20235, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (20335, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00000100, 0x00000000, 0.000000, 100.000000,0), (20375, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), (20500, 0x00, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(20501, 0x00, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (20705, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (20784, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (20911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), @@ -18129,7 +17864,6 @@ INSERT INTO `spell_proc_event` VALUES (23686, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), (23688, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (23689, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), -(23695, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (23721, 0x00, 9, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (23920, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), (24353, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), @@ -18139,7 +17873,6 @@ INSERT INTO `spell_proc_event` VALUES (24932, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), (25050, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (25669, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 0), -(25988, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (26016, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.000000, 0.000000, 0), (26107, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000064, 0.000000, 0.000000, 0), (26119, 0x00, 10, 0x90100003, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), @@ -18154,10 +17887,6 @@ INSERT INTO `spell_proc_event` VALUES (27774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (27787, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), (27811, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(27815, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(27816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(28592, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(28593, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (28716, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00048000, 0x00000000, 0.000000, 0.000000, 0), (28719, 0x00, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (28744, 0x00, 7, 0x00000040, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0.000000, 0.000000, 0), @@ -18171,18 +17900,12 @@ INSERT INTO `spell_proc_event` VALUES (28847, 0x00, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (28849, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (29074, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29075, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29076, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (29150, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), -(29179, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(29180, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (29385, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), (29441, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 1), -(29444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 1), (29455, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (29501, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), (29593, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(29594, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), (29624, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), (29625, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), (29626, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), @@ -18193,41 +17916,27 @@ INSERT INTO `spell_proc_event` VALUES (29636, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), (29637, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3.000000, 0.000000, 0), (29834, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(29838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (29977, 0x00, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30003, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), (30160, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (30293, 0x00, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30295, 0x00, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30296, 0x00, 5, 0x00000181, 0x008200C0, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30299, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30301, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30302, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30675, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30678, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(30679, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30701, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30705, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (30823, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10.500000, 0.000000, 0), (30881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), (30937, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31124, 0x00, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31126, 0x00, 8, 0x2000000E, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31244, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00002034, 0.000000, 0.000000, 0), (31394, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31569, 0x00, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31570, 0x00, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31785, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00008800, 0x00000000, 0.000000, 0.000000, 0), (31794, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (31801, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31833, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31835, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(31836, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (31871, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(31872, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), (31876, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), -(31877, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), -(31878, 0x00, 10, 0x00800000, 0x00000000, 0x00000008, 0x00004110, 0x00000000, 0.000000, 0.000000, 0), (31904, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (32385, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (32587, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), @@ -18243,14 +17952,9 @@ INSERT INTO `spell_proc_event` VALUES (33089, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (33127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.000000, 0.000000, 0), (33142, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33145, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33146, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (33150, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (33151, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33154, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (33191, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(33192, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(33193, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (33297, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (33299, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (33510, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5.000000, 0.000000, 0), @@ -18260,8 +17964,6 @@ INSERT INTO `spell_proc_event` VALUES (33757, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (33759, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (33881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33882, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(33883, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (33953, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 45), (34074, 0x00, 9, 0x0007FA43, 0x00881081, 0x00000201, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (34080, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0.000000, 0.000000, 0), @@ -18272,11 +17974,7 @@ INSERT INTO `spell_proc_event` VALUES (34320, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), (34355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (34497, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34498, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34499, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (34500, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34502, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (34506, 0x00, 9, 0x0007FA01, 0x00801081, 0x08000201, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (34584, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), (34586, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 0), @@ -18286,14 +17984,9 @@ INSERT INTO `spell_proc_event` VALUES (34774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 20), (34783, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), (34827, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(34859, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34860, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (34914, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (34935, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), -(34938, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), -(34939, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), (34950, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(34954, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (35077, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), (35080, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.000000, 0.000000, 60), (35083, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), @@ -18390,24 +18083,13 @@ INSERT INTO `spell_proc_event` VALUES (43819, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (44404, 0x00, 3, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (44442, 0x00, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), -(44443, 0x00, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 1), (44445, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44446, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44448, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (44449, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44469, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44470, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44471, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(44472, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (44546, 0x00, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44548, 0x00, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(44549, 0x00, 3, 0x020002A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (44835, 0x00, 7, 0x00000000, 0x00000080, 0x00000000, 0x00000010, 0x00000000, 0.000000, 0.000000, 0), (45054, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 15), (45057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), (45234, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(45243, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(45244, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (45354, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (45355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (45481, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), @@ -18421,53 +18103,27 @@ INSERT INTO `spell_proc_event` VALUES (46662, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 20), (46832, 0x00, 7, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (46854, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(46855, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (46867, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (46913, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (46916, 0x00, 4, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (46951, 0x00, 4, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46952, 0x00, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(46953, 0x00, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (47195, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(47196, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), -(47197, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 30), (47201, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47202, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47203, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47204, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47205, 0x00, 5, 0x00000008, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (47245, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47246, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47247, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (47258, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47259, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47260, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (47263, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), (47264, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), (47265, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 20), (47509, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(47511, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(47515, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (47516, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(47517, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), (47580, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47581, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(47582, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (48110, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), (48111, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 0), (48483, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48484, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48485, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (48496, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(48499, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(48500, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (48506, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48510, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(48511, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (48516, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), -(48521, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), -(48525, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 30), (48539, 0x00, 7, 0x00000010, 0x04000000, 0x00000000, 0x00040000, 0x00000000, 0.000000, 0.000000, 0), (48833, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (48835, 0x00, 10, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -18477,61 +18133,28 @@ INSERT INTO `spell_proc_event` VALUES (49188, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (49208, 0x00, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (49222, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(49503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(49504, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(49529, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(49530, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (49622, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), (50781, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), (50880, 0x10, 15, 0x00000000, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (51123, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51129, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51130, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (51346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (51349, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (51352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (51359, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (51414, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(51470, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (51474, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(51478, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(51479, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (51483, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(51485, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), -(51486, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), (51521, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), (51528, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,12.500000, 0.000000, 0), (51556, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51557, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51558, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (51562, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51563, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51564, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51565, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51566, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (51625, 0x00, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51626, 0x00, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (51627, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(51628, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), -(51629, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), (51634, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51636, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (51664, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51665, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51667, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51668, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(51669, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (51672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 1), -(51674, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 1), -(51679, 0x00, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (51692, 0x00, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(51696, 0x00, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (51698, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), -(51700, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), -(51701, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 1), (51940, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), (51989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), (52004, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000,20.000000, 0), @@ -18544,58 +18167,31 @@ INSERT INTO `spell_proc_event` VALUES (52423, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0), (53527, 0x00, 10, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (52795, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52797, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52798, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52799, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(52800, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (52898, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53215, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53216, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53217, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53221, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53222, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53224, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53228, 0x00, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53232, 0x00, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53234, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53237, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53238, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53256, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53259, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53260, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53290, 0x00, 9, 0x00000800, 0x00000001, 0x00000200, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53380, 0x00, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53397, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53486, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53501, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53502, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53551, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53552, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53553, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53569, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(53576, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53601, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0.000000, 0.000000, 6), (53646, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53671, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(53673, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53709, 0x00, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), (53817, 0x00, 11, 0x000001C3, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(54151, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54154, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54155, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54278, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(54486, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54488, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54489, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(54490, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54646, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (54695, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (54707, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), (54738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), (54747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), -(54749, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (54808, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), (54838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), @@ -18615,31 +18211,20 @@ INSERT INTO `spell_proc_event` VALUES (55776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (56218, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56342, 0x00, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56343, 0x00, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56344, 0x00, 9, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (56364, 0x00, 3, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (56372, 0x00, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), (56375, 0x00, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), (56451, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), -(56611, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56612, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56613, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56614, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (56636, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 6), (56816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0.000000, 0.000000, 0), (56821, 0x00, 8, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(56834, 0x00, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(56835, 0x00, 15, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (57345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (57352, 0x00, 0, 0x00000001, 0x00000040, 0x00000000, 0x00010154, 0x00000003, 0.000000, 0.000000, 45), (57470, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(57472, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (57499, 0x00, 4, 0x40000001, 0x00010000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0), (57870, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0.000000, 0.000000, 0), (57878, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), -(57880, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), -(57881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0.000000, 0.000000, 0), (57989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0.000000, 0.000000, 0), (58357, 0x00, 4, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (58364, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -18655,7 +18240,6 @@ INSERT INTO `spell_proc_event` VALUES (58647, 0x00, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (58677, 0x00, 15, 0x00002000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), (58872, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), -(58874, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0), (58901, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45), (59176, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (59327, 0x00, 15, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -18703,15 +18287,12 @@ INSERT INTO `spell_proc_event` VALUES (61188, 0x00, 5, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (61257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000202A8, 0x00010000, 0.000000, 0.000000, 0), (61324, 0x00, 10, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(61345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -(61346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000002A8, 0x00000002, 0.000000, 0.000000, 45), (61618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (61846, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (62600, 0x00, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (63108, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63156, 0x00, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), -(63245, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (63280, 0x00, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63320, 0x00, 5, 0x00040000, 0x00000000, 0x00008000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), (63373, 0x00, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), diff --git a/sql/updates/10044_01_mangos_spell_chain.sql b/sql/updates/10044_01_mangos_spell_chain.sql new file mode 100644 index 000000000..e860b745d --- /dev/null +++ b/sql/updates/10044_01_mangos_spell_chain.sql @@ -0,0 +1,25 @@ +ALTER TABLE db_version CHANGE COLUMN required_10036_01_mangos_spell_proc_event required_10044_01_mangos_spell_chain bit; + +DELETE FROM `spell_chain` WHERE `spell_id` IN ( + 62908, 62905, 50371, 50365, 63506, 63505, 63504, + 31785, 33776, 53427, 53429, 53430, 63351, 63350, + 63349, 63411, 63410, 63372, 63370, 63374, 63373, + 63123, 63121, 63117, 63158, 63156, 62762, 62758, + 62765, 62764, 62760, 62759, 63650, 63649, 63648, + 63647, 63646, 63627, 63626, 63625, 48985, 49488, + 49489, 49015, 50154, 55136, 63737, 63733, 63730, + 63543, 63542, 50880, 50884, 50885, 50886, 50887, + 49175, 50031, 51456, 63534, 64129, 64127, 64357, + 64353, 49013, 55236, 55237, 50384, 50385, 50391, + 50392, 49224, 49610, 49611, 47535, 47536, 47537, + 49188, 53530, 53527, 31245, 31244, 55667, 55666, + 32385, 32387, 32392, 32393, 32394, 51528, 51529, + 51530, 51531, 51532, 47569, 47570, 65661, 66191, + 66192, 20335, 20336, 20337, 56636, 56637, 56638, + 34506, 34507, 34508, 34838, 34839, 53290, 53291, + 53292, 46913, 46914, 46915, 19184, 19387, 19388, + 35100, 35102, 51521, 51522, 48539, 48544, 48545, + 53380, 53381, 53382, 53486, 53488, 56822, 59057, + 53709, 53710, 53711, 30881, 30883, 30884, 30885, + 30886 +); diff --git a/sql/updates/10044_02_mangos_spell_proc_event.sql b/sql/updates/10044_02_mangos_spell_proc_event.sql new file mode 100644 index 000000000..03370f87c --- /dev/null +++ b/sql/updates/10044_02_mangos_spell_proc_event.sql @@ -0,0 +1,38 @@ +ALTER TABLE db_version CHANGE COLUMN required_10044_01_mangos_spell_chain required_10044_02_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` IN ( + 11120, 12487, 12488, 12598, 12668, 12724, 12725, + 12726, 12727, 12799, 12812, 12813, 12814, 12815, + 12846, 12847, 12848, 12849, 12867, 12872, 12873, + 12958, 12971, 12972, 12973, 12974, 13045, 13046, + 13047, 13048, 13867, 14070, 14071, 14160, 14161, + 14190, 14193, 14194, 14195, 14774, 15338, 15362, + 15363, 16196, 16198, 16235, 16240, 16281, 16282, + 16283, 16284, 16489, 16492, 16923, 16924, 17107, + 17108, 17796, 17801, 17802, 17803, 18073, 18095, + 18120, 19573, 20056, 20057, 20182, 20212, 20213, + 20214, 20215, 20235, 20501, 23695, 25988, 27815, + 27816, 28592, 28593, 29075, 29076, 29179, 29180, + 29444, 29594, 29838, 30295, 30296, 30301, 30302, + 30678, 30679, 31126, 31570, 31835, 31836, 31872, + 31877, 31878, 33145, 33146, 33154, 33192, 33193, + 33882, 33883, 34498, 34499, 34502, 34503, 34859, + 34860, 34938, 34939, 34954, 44443, 44446, 44448, + 44469, 44470, 44471, 44472, 44548, 44549, 45243, + 45244, 46855, 46952, 46953, 47196, 47197, 47202, + 47203, 47204, 47205, 47246, 47247, 47259, 47260, + 47511, 47515, 47517, 47581, 47582, 48484, 48485, + 48499, 48500, 48510, 48511, 48521, 48525, 49503, + 49504, 49529, 49530, 51127, 51128, 51129, 51130, + 51470, 51478, 51479, 51485, 51486, 51557, 51558, + 51563, 51564, 51565, 51566, 51626, 51628, 51629, + 51635, 51636, 51665, 51667, 51668, 51669, 51674, + 51679, 51696, 51700, 51701, 52797, 52798, 52799, + 52800, 53216, 53217, 53222, 53224, 53232, 53237, + 53238, 53259, 53260, 53502, 53503, 53552, 53553, + 53576, 53673, 54151, 54154, 54155, 54486, 54488, + 54489, 54490, 54749, 56343, 56344, 56611, 56612, + 56613, 56614, 56834, 56835, 57472, 57880, 57881, + 58874, 61345, 61346, 63245 +); + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 630c62c75..1b15eca02 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -84,6 +84,8 @@ pkgdata_DATA = \ 10017_01_mangos_spell_proc_event.sql \ 10036_01_mangos_spell_chain.sql \ 10036_01_mangos_spell_proc_event.sql \ + 10044_01_mangos_spell_chain.sql \ + 10044_02_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -148,4 +150,6 @@ EXTRA_DIST = \ 10017_01_mangos_spell_proc_event.sql \ 10036_01_mangos_spell_chain.sql \ 10036_01_mangos_spell_proc_event.sql \ + 10044_01_mangos_spell_chain.sql \ + 10044_02_mangos_spell_proc_event.sql \ README diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 3d7133f7f..bd59bf15c 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1008,8 +1008,46 @@ void SpellMgr::LoadSpellTargetPositions() struct DoSpellProcEvent { - DoSpellProcEvent(SpellProcEventEntry const& _spe) : spe(_spe) {} - void operator() (uint32 spell_id) { sSpellMgr.mSpellProcEventMap[spell_id] = spe; } + DoSpellProcEvent(SpellProcEventMap& _spe_map, SpellProcEventEntry const& _spe) : spe_map(_spe_map), spe(_spe) {} + void operator() (uint32 spell_id) + { + // add ranks only for not filled data (some ranks have ppm data different for ranks for example) + SpellProcEventMap::const_iterator spellItr = spe_map.find(spell_id); + if (spellItr == spe_map.end()) + spe_map[spell_id] = spe; + // if custom rank data added then it must be same except ppm + else + { + SpellProcEventEntry const& r_spe = spellItr->second; + if (spe.schoolMask != r_spe.schoolMask) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different schoolMask from first rank in chain", spell_id); + + if (spe.spellFamilyName != r_spe.spellFamilyName) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyName from first rank in chain", spell_id); + + if (spe.spellFamilyMask != r_spe.spellFamilyMask) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask from first rank in chain", spell_id); + + if (spe.spellFamilyMask2 != r_spe.spellFamilyMask2) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask2 from first rank in chain", spell_id); + + if (spe.procFlags != r_spe.procFlags) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different procFlags from first rank in chain", spell_id); + + if (spe.procEx != r_spe.procEx) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different procEx from first rank in chain", spell_id); + + // only ppm allowed has been different from first rank + + if (spe.customChance != r_spe.customChance) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different customChance from first rank in chain", spell_id); + + if (spe.cooldown != r_spe.cooldown) + sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different cooldown from first rank in chain", spell_id); + } + } + + SpellProcEventMap& spe_map; SpellProcEventEntry const& spe; }; @@ -1030,8 +1068,12 @@ void SpellMgr::LoadSpellProcEvents() return; } + std::set firstRankSpells; + std::set firstRankSpellsWithCustomRanks; + barGoLink bar( (int)result->GetRowCount() ); uint32 customProc = 0; + uint32 customRank = 0; do { Field *fields = result->Fetch(); @@ -1047,15 +1089,6 @@ void SpellMgr::LoadSpellProcEvents() continue; } - uint32 first_id = GetFirstSpellInChain(entry); - - if ( first_id != entry ) - { - sLog.outErrorDb("Spell %u listed in `spell_proc_event` is not first rank (%u) in chain", entry, first_id); - // prevent loading since it won't have an effect anyway - continue; - } - SpellProcEventEntry spe; spe.schoolMask = fields[1].GetUInt32(); @@ -1068,14 +1101,35 @@ void SpellMgr::LoadSpellProcEvents() spe.customChance = fields[9].GetFloat(); spe.cooldown = fields[10].GetUInt32(); + uint32 first_id = GetFirstSpellInChain(entry); + + // most spell ranks expected same data + if(first_id) + { + firstRankSpells.insert(first_id); + + if ( first_id != entry) + { + // let have independent data in table for spells with ppm rates (exist rank dependent ppm rate spells) + if (!spe.ppmRate) + { + sLog.outErrorDb("Spell %u listed in `spell_proc_event` is not first rank (%u) in chain", entry, first_id); + // prevent loading since it won't have an effect anyway + continue; + } + // for later check that first rank als added + else + { + firstRankSpellsWithCustomRanks.insert(first_id); + ++customRank; + } + } + } + mSpellProcEventMap[entry] = spe; bool isCustom = false; - // also add to high ranks - DoSpellProcEvent worker(spe); - doForHighRanks(entry,worker); - if (spe.procFlags == 0) { if (spell->procFlags==0) @@ -1117,13 +1171,26 @@ void SpellMgr::LoadSpellProcEvents() ++count; } while( result->NextRow() ); + // check that first rank added for custom ranks + for(std::set::const_iterator itr = firstRankSpellsWithCustomRanks.begin(); itr != firstRankSpellsWithCustomRanks.end(); ++itr) + if (mSpellProcEventMap.find(*itr) == mSpellProcEventMap.end()) + sLog.outErrorDb("Spell %u must be listed in `spell_proc_event` as first rank for listed custom ranks of spell but not found!", *itr); + + // fill absent non first ranks data base at first rank data + for(std::set::const_iterator itr = firstRankSpells.begin(); itr != firstRankSpells.end(); ++itr) + { + SpellProcEventMap::const_iterator speItr = mSpellProcEventMap.find(*itr); + if (speItr != mSpellProcEventMap.end()) + { + DoSpellProcEvent worker(mSpellProcEventMap, speItr->second); + doForHighRanks(speItr->first,worker); + } + } + delete result; sLog.outString(); - if (customProc) - sLog.outString( ">> Loaded %u extra spell proc event conditions +%u custom", count, customProc ); - else - sLog.outString( ">> Loaded %u extra spell proc event conditions", count ); + sLog.outString( ">> Loaded %u extra spell proc event conditions +%u custom proc (inc. +%u custom ranks)", count, customProc, customRank ); } struct DoSpellProcItemEnchant @@ -2179,8 +2246,42 @@ void SpellMgr::LoadSpellChains() mSpellChains.clear(); // need for reload case mSpellChainsNext.clear(); // need for reload case + // load known data for talents + for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) + { + TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + if (!talentInfo) + continue; + + // not add ranks for 1 ranks talents (if exist non ranks spells then it will included in table data) + if (!talentInfo->RankID[1]) + continue; + + for (int j = 0; j < MAX_TALENT_RANK; j++) + { + uint32 spell_id = talentInfo->RankID[j]; + if (!spell_id) + continue; + + if (!sSpellStore.LookupEntry(spell_id)) + { + //sLog.outErrorDb("Talent %u not exist as spell",spell_id); + continue; + } + + SpellChainNode node; + node.prev = (j > 0) ? talentInfo->RankID[j-1] : 0; + node.first = talentInfo->RankID[0]; + node.rank = j+1; + node.req = 0; + + mSpellChains[spell_id] = node; + } + } + + // load custom case QueryResult *result = WorldDatabase.Query("SELECT spell_id, prev_spell, first_spell, rank, req_spell FROM spell_chain"); - if(result == NULL) + if (!result) { barGoLink bar( 1 ); bar.step(); @@ -2207,12 +2308,18 @@ void SpellMgr::LoadSpellChains() node.rank = fields[3].GetUInt8(); node.req = fields[4].GetUInt32(); - if(!sSpellStore.LookupEntry(spell_id)) + if (!sSpellStore.LookupEntry(spell_id)) { sLog.outErrorDb("Spell %u listed in `spell_chain` does not exist",spell_id); continue; } + if (mSpellChains.find(spell_id) != mSpellChains.end()) + { + sLog.outErrorDb("Spell %u already added (talent?) and non need in `spell_chain`",spell_id); + continue; + } + if(node.prev!=0 && !sSpellStore.LookupEntry(node.prev)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not existed previous rank spell.", @@ -2281,12 +2388,6 @@ void SpellMgr::LoadSpellChains() mSpellChains[spell_id] = node; - if(node.prev) - mSpellChainsNext.insert(SpellChainMapNext::value_type(node.prev,spell_id)); - - if(node.req) - mSpellChainsNext.insert(SpellChainMapNext::value_type(node.req,spell_id)); - ++count; } while( result->NextRow() ); @@ -2340,6 +2441,19 @@ void SpellMgr::LoadSpellChains() } } + // fill next rank cache + for(SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) + { + uint32 spell_id = i->first; + SpellChainNode const& node = i->second; + + if(node.prev) + mSpellChainsNext.insert(SpellChainMapNext::value_type(node.prev,spell_id)); + + if(node.req) + mSpellChainsNext.insert(SpellChainMapNext::value_type(node.req,spell_id)); + } + sLog.outString(); sLog.outString( ">> Loaded %u spell chain records", count ); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index be125c81e..86d57390a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10043" + #define REVISION_NR "10044" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 82a31ac05..4cbac181e 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10007_01_characters_pet_aura" - #define REVISION_DB_MANGOS "required_10036_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_10044_02_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__