From 9dc06f8bd9004c5a387287b1ef8612b12356d1ca Mon Sep 17 00:00:00 2001 From: Gacko Date: Tue, 20 Nov 2012 13:26:17 +0100 Subject: Core/DB: Some script to creature text conversions... --- .../EasternKingdoms/Karazhan/boss_curator.cpp | 52 ++-- .../Karazhan/boss_maiden_of_virtue.cpp | 34 +-- .../EasternKingdoms/Karazhan/boss_midnight.cpp | 65 +++-- .../EasternKingdoms/Karazhan/boss_moroes.cpp | 35 +-- .../EasternKingdoms/Karazhan/boss_netherspite.cpp | 30 ++- .../Karazhan/boss_prince_malchezaar.cpp | 81 +++--- .../Karazhan/boss_shade_of_aran.cpp | 105 ++++---- .../Karazhan/boss_terestian_illhoof.cpp | 69 ++--- .../EasternKingdoms/Karazhan/bosses_opera.cpp | 279 +++++++++++---------- .../scripts/EasternKingdoms/Karazhan/karazhan.cpp | 27 +- .../ScarletMonastery/boss_arcanist_doan.cpp | 8 +- .../ScarletMonastery/boss_bloodmage_thalnos.cpp | 12 +- .../ScarletMonastery/boss_headless_horseman.cpp | 33 ++- .../ScarletMonastery/boss_herod.cpp | 24 +- .../ScarletMonastery/boss_houndmaster_loksey.cpp | 4 +- .../ScarletMonastery/boss_interrogator_vishas.cpp | 22 +- .../boss_mograine_and_whitemane.cpp | 24 +- .../ShadowfangKeep/instance_shadowfang_keep.cpp | 12 +- .../ShadowfangKeep/shadowfang_keep.cpp | 28 +-- .../SunwellPlateau/boss_kalecgos.cpp | 108 ++++---- .../EasternKingdoms/Uldaman/boss_ironaya.cpp | 14 +- src/server/scripts/EasternKingdoms/undercity.cpp | 8 +- 22 files changed, 551 insertions(+), 523 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 2c7e1b9c48a..13c70630c7a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -26,23 +26,27 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#define SAY_AGGRO -1532057 -#define SAY_SUMMON1 -1532058 -#define SAY_SUMMON2 -1532059 -#define SAY_EVOCATE -1532060 -#define SAY_ENRAGE -1532061 -#define SAY_KILL1 -1532062 -#define SAY_KILL2 -1532063 -#define SAY_DEATH -1532064 - -//Flare spell info -#define SPELL_ASTRAL_FLARE_PASSIVE 30234 //Visual effect + Flare damage - -//Curator spell info -#define SPELL_HATEFUL_BOLT 30383 -#define SPELL_EVOCATION 30254 -#define SPELL_ENRAGE 30403 //Arcane Infusion: Transforms Curator and adds damage. -#define SPELL_BERSERK 26662 +enum Curator +{ + SAY_AGGRO = 0, + SAY_SUMMON = 1, + SAY_EVOCATE = 2, + SAY_ENRAGE = 3, + SAY_KILL = 4, + SAY_DEATH = 5, + + //Flare spell info + SPELL_ASTRAL_FLARE_PASSIVE = 30234, //Visual effect + Flare damage + + //Curator spell info + SPELL_HATEFUL_BOLT = 30383, + SPELL_EVOCATION = 30254, + SPELL_ENRAGE = 30403, //Arcane Infusion: Transforms Curator and adds damage. + SPELL_BERSERK = 26662, +}; + + + class boss_curator : public CreatureScript { @@ -78,17 +82,17 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -109,7 +113,7 @@ public: } //may not be correct SAY (generic hard enrage) - DoScriptText(SAY_ENRAGE, me); + Talk(SAY_ENRAGE); me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_BERSERK); @@ -151,7 +155,7 @@ public: //if this get's us below 10%, then we evocate (the 10th should be summoned now) if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) { - DoScriptText(SAY_EVOCATE, me); + Talk(SAY_EVOCATE); me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_EVOCATION); Evocating = true; @@ -162,7 +166,7 @@ public: { if (urand(0, 1) == 0) { - DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); + Talk(SAY_SUMMON); } } } @@ -174,7 +178,7 @@ public: { Enraged = true; DoCast(me, SPELL_ENRAGE); - DoScriptText(SAY_ENRAGE, me); + Talk(SAY_ENRAGE); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 5f974a890bf..026524108b3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -26,19 +26,19 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#define SAY_AGGRO -1532018 -#define SAY_SLAY1 -1532019 -#define SAY_SLAY2 -1532020 -#define SAY_SLAY3 -1532021 -#define SAY_REPENTANCE1 -1532022 -#define SAY_REPENTANCE2 -1532023 -#define SAY_DEATH -1532024 - -#define SPELL_REPENTANCE 29511 -#define SPELL_HOLYFIRE 29522 -#define SPELL_HOLYWRATH 32445 -#define SPELL_HOLYGROUND 29512 -#define SPELL_BERSERK 26662 +enum MaidenOfVirtue +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_REPENTANCE = 2, + SAY_DEATH = 3, + + SPELL_REPENTANCE = 29511, + SPELL_HOLYFIRE = 29522, + SPELL_HOLYWRATH = 32445, + SPELL_HOLYGROUND = 29512, + SPELL_BERSERK = 26662, +}; class boss_maiden_of_virtue : public CreatureScript { @@ -76,17 +76,17 @@ public: void KilledUnit(Unit* /*Victim*/) { if (urand(0, 1) == 0) - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -109,7 +109,7 @@ public: if (Repentance_Timer <= diff) { DoCast(me->getVictim(), SPELL_REPENTANCE); - DoScriptText(RAND(SAY_REPENTANCE1, SAY_REPENTANCE2), me); + Talk(SAY_REPENTANCE); Repentance_Timer = urand(25000, 35000); //A little randomness on that spell } else Repentance_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 580acf2c489..73fefe210df 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -27,26 +27,25 @@ EndScriptData */ #include "ScriptedCreature.h" #include "SpellInfo.h" -#define SAY_MIDNIGHT_KILL -1532000 -#define SAY_APPEAR1 -1532001 -#define SAY_APPEAR2 -1532002 -#define SAY_APPEAR3 -1532003 -#define SAY_MOUNT -1532004 -#define SAY_KILL1 -1532005 -#define SAY_KILL2 -1532006 -#define SAY_DISARMED -1532007 -#define SAY_DEATH -1532008 -#define SAY_RANDOM1 -1532009 -#define SAY_RANDOM2 -1532010 - -#define SPELL_SHADOWCLEAVE 29832 -#define SPELL_INTANGIBLE_PRESENCE 29833 -#define SPELL_BERSERKER_CHARGE 26561 //Only when mounted - -#define MOUNTED_DISPLAYID 16040 - -//Attumen (TODO: Use the summoning spell instead of Creature id. It works, but is not convenient for us) -#define SUMMON_ATTUMEN 15550 +enum Midnight +{ + SAY_MIDNIGHT_KILL = 0, + SAY_APPEAR = 1, + SAY_MOUNT = 2, + SAY_KILL = 3, + SAY_DISARMED = 4, + SAY_DEATH = 5, + SAY_RANDOM = 6, + + SPELL_SHADOWCLEAVE = 29832, + SPELL_INTANGIBLE_PRESENCE = 29833, + SPELL_BERSERKER_CHARGE = 26561, //Only when mounted + + MOUNTED_DISPLAYID = 16040, + + //Attumen (TODO: Use the summoning spell instead of Creature id. It works, but is not convenient for us) + SUMMON_ATTUMEN = 15550, +}; class boss_attumen : public CreatureScript { @@ -94,14 +93,14 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); - if (Unit* pMidnight = Unit::GetUnit(*me, Midnight)) - pMidnight->Kill(pMidnight); + Talk(SAY_DEATH); + if (Unit* midnight = Unit::GetUnit(*me, Midnight)) + midnight->Kill(midnight); } void UpdateAI(const uint32 diff); @@ -109,7 +108,7 @@ public: void SpellHit(Unit* /*source*/, const SpellInfo* spell) { if (spell->Mechanic == MECHANIC_DISARM) - DoScriptText(SAY_DISARMED, me); + Talk(SAY_DISARMED); } }; }; @@ -149,7 +148,7 @@ public: if (Phase == 2) { if (Unit* unit = Unit::GetUnit(*me, Attumen)) - DoScriptText(SAY_MIDNIGHT_KILL, unit); + Talk(SAY_MIDNIGHT_KILL, unit->GetGUID()); } } @@ -161,12 +160,12 @@ public: if (Phase == 1 && HealthBelowPct(95)) { Phase = 2; - if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) + if (Creature* attumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) { - Attumen = pAttumen->GetGUID(); - pAttumen->AI()->AttackStart(me->getVictim()); - SetMidnight(pAttumen, me->GetGUID()); - DoScriptText(RAND(SAY_APPEAR1, SAY_APPEAR2, SAY_APPEAR3), pAttumen); + Attumen = attumen->GetGUID(); + attumen->AI()->AttackStart(me->getVictim()); + SetMidnight(attumen, me->GetGUID()); + Talk(SAY_APPEAR, Attumen); } } else if (Phase == 2 && HealthBelowPct(25)) @@ -204,7 +203,7 @@ public: void Mount(Unit* pAttumen) { - DoScriptText(SAY_MOUNT, pAttumen); + Talk(SAY_MOUNT, pAttumen->GetGUID()); Phase = 3; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -274,7 +273,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) if (RandomYellTimer <= diff) { - DoScriptText(RAND(SAY_RANDOM1, SAY_RANDOM2), me); + Talk(SAY_RANDOM); RandomYellTimer = urand(30000, 60000); } else RandomYellTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 99f2cb51c85..38eb3289ec4 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -27,19 +27,20 @@ EndScriptData */ #include "ScriptedCreature.h" #include "karazhan.h" -#define SAY_AGGRO -1532011 -#define SAY_SPECIAL_1 -1532012 -#define SAY_SPECIAL_2 -1532013 -#define SAY_KILL_1 -1532014 -#define SAY_KILL_2 -1532015 -#define SAY_KILL_3 -1532016 -#define SAY_DEATH -1532017 - -#define SPELL_VANISH 29448 -#define SPELL_GARROTE 37066 -#define SPELL_BLIND 34694 -#define SPELL_GOUGE 29425 -#define SPELL_FRENZY 37023 +enum Moroes +{ + SAY_AGGRO = 0, + SAY_SPECIAL = 1, + SAY_KILL = 2, + SAY_DEATH = 3, + + SPELL_VANISH = 29448, + SPELL_GARROTE = 37066, + SPELL_BLIND = 34694, + SPELL_GOUGE = 29425, + SPELL_FRENZY = 37023, +}; + #define POS_Z 81.73f @@ -124,19 +125,19 @@ public: { StartEvent(); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); AddsAttack(); DoZoneInCombat(); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2, SAY_KILL_3), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(TYPE_MOROES, DONE); @@ -294,7 +295,7 @@ public: { if (Wait_Timer <= diff) { - DoScriptText(RAND(SAY_SPECIAL_1, SAY_SPECIAL_2), me); + Talk(SAY_SPECIAL); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) target->CastSpell(target, SPELL_GARROTE, true); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index c3e571ad376..37506d9fd0e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -28,17 +28,21 @@ EndScriptData */ #include "karazhan.h" #include "Player.h" -#define EMOTE_PHASE_PORTAL -1532089 -#define EMOTE_PHASE_BANISH -1532090 - -#define SPELL_NETHERBURN_AURA 30522 -#define SPELL_VOIDZONE 37063 -#define SPELL_NETHER_INFUSION 38688 -#define SPELL_NETHERBREATH 38523 -#define SPELL_BANISH_VISUAL 39833 -#define SPELL_BANISH_ROOT 42716 -#define SPELL_EMPOWERMENT 38549 -#define SPELL_NETHERSPITE_ROAR 38684 +enum Netherspite +{ + EMOTE_PHASE_PORTAL = 0, + EMOTE_PHASE_BANISH = 1, + + SPELL_NETHERBURN_AURA = 30522, + SPELL_VOIDZONE = 37063, + SPELL_NETHER_INFUSION = 38688, + SPELL_NETHERBREATH = 38523, + SPELL_BANISH_VISUAL = 39833, + SPELL_BANISH_ROOT = 42716, + SPELL_EMPOWERMENT = 38549, + SPELL_NETHERSPITE_ROAR = 38684, +}; + const float PortalCoord[3][3] = { @@ -229,7 +233,7 @@ public: PortalPhase = true; PortalTimer = 10000; EmpowermentTimer = 10000; - DoScriptText(EMOTE_PHASE_PORTAL, me); + Talk(EMOTE_PHASE_PORTAL); } void SwitchToBanishPhase() @@ -241,7 +245,7 @@ public: DestroyPortals(); PhaseTimer = 30000; PortalPhase = false; - DoScriptText(EMOTE_PHASE_BANISH, me); + Talk(EMOTE_PHASE_BANISH); for (int i=0; i<3; ++i) me->RemoveAurasDueToSpell(NetherBuff[i]); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 242940bd5e7..845a773c108 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -28,19 +28,6 @@ EndScriptData */ #include "karazhan.h" #include "SpellInfo.h" -#define SAY_AGGRO -1532091 -#define SAY_AXE_TOSS1 -1532092 -#define SAY_AXE_TOSS2 -1532093 -#define SAY_SPECIAL1 -1532094 -#define SAY_SPECIAL2 -1532095 -#define SAY_SPECIAL3 -1532096 -#define SAY_SLAY1 -1532097 -#define SAY_SLAY2 -1532098 -#define SAY_SLAY3 -1532099 -#define SAY_SUMMON1 -1532100 -#define SAY_SUMMON2 -1532101 -#define SAY_DEATH -1532102 - // 18 Coordinates for Infernal spawns struct InfernalPoint { @@ -71,31 +58,43 @@ static InfernalPoint InfernalPoints[] = {-10935.7f, -1996.0f} }; -#define TOTAL_INFERNAL_POINTS 18 - //Enfeeble is supposed to reduce hp to 1 and then heal player back to full when it ends //Along with reducing healing and regen while enfeebled to 0% //This spell effect will only reduce healing - -#define SPELL_ENFEEBLE 30843 //Enfeeble during phase 1 and 2 -#define SPELL_ENFEEBLE_EFFECT 41624 - -#define SPELL_SHADOWNOVA 30852 //Shadownova used during all phases -#define SPELL_SW_PAIN 30854 //Shadow word pain during phase 1 and 3 (different targeting rules though) -#define SPELL_THRASH_PASSIVE 12787 //Extra attack chance during phase 2 -#define SPELL_SUNDER_ARMOR 30901 //Sunder armor during phase 2 -#define SPELL_THRASH_AURA 12787 //Passive proc chance for thrash -#define SPELL_EQUIP_AXES 30857 //Visual for axe equiping -#define SPELL_AMPLIFY_DAMAGE 39095 //Amplifiy during phase 3 -#define SPELL_CLEAVE 30131 //Same as Nightbane. -#define SPELL_HELLFIRE 30859 //Infenals' hellfire aura -#define NETHERSPITE_INFERNAL 17646 //The netherspite infernal creature -#define MALCHEZARS_AXE 17650 //Malchezar's axes (creatures), summoned during phase 3 - -#define INFERNAL_MODEL_INVISIBLE 11686 //Infernal Effects -#define SPELL_INFERNAL_RELAY 30834 - -#define EQUIP_ID_AXE 33542 //Axes info +enum PrinceMalchezaar +{ + SAY_AGGRO = 0, + SAY_AXE_TOSS1 = 1, + SAY_AXE_TOSS2 = 2, +// SAY_SPECIAL1 = 3, Not used, needs to be implemented, but I don't know where it should be used. +// SAY_SPECIAL2 = 4, Not used, needs to be implemented, but I don't know where it should be used. +// SAY_SPECIAL3 = 5, Not used, needs to be implemented, but I don't know where it should be used. + SAY_SLAY = 6, + SAY_SUMMON = 7, + SAY_DEATH = 8, + + TOTAL_INFERNAL_POINTS = 18, + + SPELL_ENFEEBLE = 30843, //Enfeeble during phase 1 and 2 + SPELL_ENFEEBLE_EFFECT = 41624, + + SPELL_SHADOWNOVA = 30852, //Shadownova used during all phases + SPELL_SW_PAIN = 30854, //Shadow word pain during phase 1 and 3 (different targeting rules though) + SPELL_THRASH_PASSIVE = 12787, //Extra attack chance during phase 2 + SPELL_SUNDER_ARMOR = 30901, //Sunder armor during phase 2 + SPELL_THRASH_AURA = 12787, //Passive proc chance for thrash + SPELL_EQUIP_AXES = 30857, //Visual for axe equiping + SPELL_AMPLIFY_DAMAGE = 39095, //Amplifiy during phase 3 + SPELL_CLEAVE = 30131, //Same as Nightbane. + SPELL_HELLFIRE = 30859, //Infenals' hellfire aura + NETHERSPITE_INFERNAL = 17646, //The netherspite infernal creature + MALCHEZARS_AXE = 17650, //Malchezar's axes (creatures), summoned during phase 3 + + INFERNAL_MODEL_INVISIBLE = 11686, //Infernal Effects + SPELL_INFERNAL_RELAY = 30834, + + EQUIP_ID_AXE = 33542, //Axes info +}; //---------Infernal code first class netherspite_infernal : public CreatureScript @@ -245,12 +244,12 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); AxesCleanup(); ClearWeapons(); @@ -266,7 +265,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); if (instance) instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in @@ -384,7 +383,7 @@ public: DoCast(Infernal, SPELL_INFERNAL_RELAY); } - DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); + Talk(SAY_SUMMON); } void UpdateAI(const uint32 diff) @@ -416,7 +415,7 @@ public: DoCast(me, SPELL_EQUIP_AXES); //text - DoScriptText(SAY_AXE_TOSS1, me); + Talk(SAY_AXE_TOSS1); //passive thrash aura DoCast(me, SPELL_THRASH_AURA, true); @@ -452,7 +451,7 @@ public: //remove thrash me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); - DoScriptText(SAY_AXE_TOSS2, me); + Talk(SAY_AXE_TOSS2); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); for (uint8 i = 0; i < 2; ++i) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 8eecc5618ee..843220663b7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -29,51 +29,48 @@ EndScriptData */ #include "GameObject.h" #include "SpellInfo.h" -#define SAY_AGGRO1 -1532073 -#define SAY_AGGRO2 -1532074 -#define SAY_AGGRO3 -1532075 -#define SAY_FLAMEWREATH1 -1532076 -#define SAY_FLAMEWREATH2 -1532077 -#define SAY_BLIZZARD1 -1532078 -#define SAY_BLIZZARD2 -1532079 -#define SAY_EXPLOSION1 -1532080 -#define SAY_EXPLOSION2 -1532081 -#define SAY_DRINK -1532082 //Low Mana / AoE Pyroblast -#define SAY_ELEMENTALS -1532083 -#define SAY_KILL1 -1532084 -#define SAY_KILL2 -1532085 -#define SAY_TIMEOVER -1532086 -#define SAY_DEATH -1532087 -#define SAY_ATIESH -1532088 //Atiesh is equipped by a raid member - -//Spells -#define SPELL_FROSTBOLT 29954 -#define SPELL_FIREBALL 29953 -#define SPELL_ARCMISSLE 29955 -#define SPELL_CHAINSOFICE 29991 -#define SPELL_DRAGONSBREATH 29964 -#define SPELL_MASSSLOW 30035 -#define SPELL_FLAME_WREATH 29946 -#define SPELL_AOE_CS 29961 -#define SPELL_PLAYERPULL 32265 -#define SPELL_AEXPLOSION 29973 -#define SPELL_MASS_POLY 29963 -#define SPELL_BLINK_CENTER 29967 -#define SPELL_ELEMENTALS 29962 -#define SPELL_CONJURE 29975 -#define SPELL_DRINK 30024 -#define SPELL_POTION 32453 -#define SPELL_AOE_PYROBLAST 29978 - -//Creature Spells -#define SPELL_CIRCULAR_BLIZZARD 29951 //29952 is the REAL circular blizzard that leaves persistant blizzards that last for 10 seconds -#define SPELL_WATERBOLT 31012 -#define SPELL_SHADOW_PYRO 29978 - -//Creatures -#define CREATURE_WATER_ELEMENTAL 17167 -#define CREATURE_SHADOW_OF_ARAN 18254 -#define CREATURE_ARAN_BLIZZARD 17161 +enum ShadeOfAran +{ + SAY_AGGRO = 0, + SAY_FLAMEWREATH = 1, + SAY_BLIZZARD = 2, + SAY_EXPLOSION = 3, + SAY_DRINK = 4, + SAY_ELEMENTALS = 5, + SAY_KILL = 6, + SAY_TIMEOVER = 7, + SAY_DEATH = 8, +// SAY_ATIESH = 9, Unused + + //Spells + SPELL_FROSTBOLT = 29954, + SPELL_FIREBALL = 29953, + SPELL_ARCMISSLE = 29955, + SPELL_CHAINSOFICE = 29991, + SPELL_DRAGONSBREATH = 29964, + SPELL_MASSSLOW = 30035, + SPELL_FLAME_WREATH = 29946, + SPELL_AOE_CS = 29961, + SPELL_PLAYERPULL = 32265, + SPELL_AEXPLOSION = 29973, + SPELL_MASS_POLY = 29963, + SPELL_BLINK_CENTER = 29967, + SPELL_ELEMENTALS = 29962, + SPELL_CONJURE = 29975, + SPELL_DRINK = 30024, + SPELL_POTION = 32453, + SPELL_AOE_PYROBLAST = 29978, + + //Creature Spells + SPELL_CIRCULAR_BLIZZARD = 29951, + SPELL_WATERBOLT = 31012, + SPELL_SHADOW_PYRO = 29978, + + //Creatures + CREATURE_WATER_ELEMENTAL = 17167, + CREATURE_SHADOW_OF_ARAN = 18254, + CREATURE_ARAN_BLIZZARD = 17161, +}; enum SuperSpell { @@ -160,12 +157,12 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) { @@ -176,7 +173,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me); + Talk(SAY_AGGRO); if (instance) { @@ -264,7 +261,7 @@ public: Drinking = true; me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_DRINK, me); + Talk(SAY_DRINK); if (!DrinkInturrupted) { @@ -384,7 +381,7 @@ public: switch (LastSuperSpell) { case SUPER_AE: - DoScriptText(RAND(SAY_EXPLOSION1, SAY_EXPLOSION2), me); + Talk(SAY_EXPLOSION); DoCast(me, SPELL_BLINK_CENTER, true); DoCast(me, SPELL_PLAYERPULL, true); @@ -393,7 +390,7 @@ public: break; case SUPER_FLAME: - DoScriptText(RAND(SAY_FLAMEWREATH1, SAY_FLAMEWREATH2), me); + Talk(SAY_FLAMEWREATH); FlameWreathTimer = 20000; FlameWreathCheckTime = 500; @@ -406,7 +403,7 @@ public: break; case SUPER_BLIZZARD: - DoScriptText(RAND(SAY_BLIZZARD1, SAY_BLIZZARD2), me); + Talk(SAY_BLIZZARD); if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) { @@ -432,7 +429,7 @@ public: } } - DoScriptText(SAY_ELEMENTALS, me); + Talk(SAY_ELEMENTALS); } if (BerserkTimer <= diff) @@ -446,7 +443,7 @@ public: } } - DoScriptText(SAY_TIMEOVER, me); + Talk(SAY_TIMEOVER); BerserkTimer = 60000; } else BerserkTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 688a678060f..cb5a1b7b914 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -28,35 +28,36 @@ EndScriptData */ #include "karazhan.h" #include "PassiveAI.h" -#define SAY_SLAY1 -1532065 -#define SAY_SLAY2 -1532066 -#define SAY_DEATH -1532067 -#define SAY_AGGRO -1532068 -#define SAY_SACRIFICE1 -1532069 -#define SAY_SACRIFICE2 -1532070 -#define SAY_SUMMON1 -1532071 -#define SAY_SUMMON2 -1532072 - -#define SPELL_SUMMON_DEMONCHAINS 30120 // Summons demonic chains that maintain the ritual of sacrifice. -#define SPELL_DEMON_CHAINS 30206 // Instant - Visual Effect -#define SPELL_ENRAGE 23537 // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min. -#define SPELL_SHADOW_BOLT 30055 // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage. -#define SPELL_SACRIFICE 30115 // Teleports and adds the debuff -#define SPELL_BERSERK 32965 // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. -#define SPELL_SUMMON_FIENDISIMP 30184 // Summons a Fiendish Imp. -#define SPELL_SUMMON_IMP 30066 // Summons Kil'rek - -#define SPELL_FIENDISH_PORTAL 30171 // Opens portal and summons Fiendish Portal, 2 sec cast -#define SPELL_FIENDISH_PORTAL_1 30179 // Opens portal and summons Fiendish Portal, instant cast - -#define SPELL_FIREBOLT 30050 // Blasts a target for 150 Fire damage. -#define SPELL_BROKEN_PACT 30065 // All damage taken increased by 25%. -#define SPELL_AMPLIFY_FLAMES 30053 // Increases the Fire damage taken by an enemy by 500 for 25 sec. - -#define CREATURE_DEMONCHAINS 17248 -#define CREATURE_FIENDISHIMP 17267 -#define CREATURE_PORTAL 17265 -#define CREATURE_KILREK 17229 +enum TerestianIllhoof +{ + SAY_SLAY = 1, + SAY_DEATH = 2, + SAY_AGGRO = 3, + SAY_SACRIFICE = 4, + SAY_SUMMON = 5, + + SPELL_SUMMON_DEMONCHAINS = 30120, // Summons demonic chains that maintain the ritual of sacrifice. + SPELL_DEMON_CHAINS = 30206, // Instant - Visual Effect + SPELL_ENRAGE = 23537, // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min. + SPELL_SHADOW_BOLT = 30055, // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage. + SPELL_SACRIFICE = 30115, // Teleports and adds the debuff + SPELL_BERSERK = 32965, // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. + SPELL_SUMMON_FIENDISIMP = 30184, // Summons a Fiendish Imp. + SPELL_SUMMON_IMP = 30066, // Summons Kil'rek + + SPELL_FIENDISH_PORTAL = 30171, // Opens portal and summons Fiendish Portal, 2 sec cast + SPELL_FIENDISH_PORTAL_1 = 30179, // Opens portal and summons Fiendish Portal, instant cast + + SPELL_FIREBOLT = 30050, // Blasts a target for 150 Fire damage. + SPELL_BROKEN_PACT = 30065, // All damage taken increased by 25%. + SPELL_AMPLIFY_FLAMES = 30053, // Increases the Fire damage taken by an enemy by 500 for 25 sec. + + CREATURE_DEMONCHAINS = 17248, + CREATURE_FIENDISHIMP = 17267, + CREATURE_PORTAL = 17265, + CREATURE_KILREK = 17229, +}; + class mob_kilrek : public CreatureScript { @@ -319,7 +320,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void JustSummoned(Creature* summoned) @@ -331,7 +332,7 @@ public: if (summoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) { - DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); + Talk(SAY_SUMMON); SummonedPortals = true; } } @@ -339,7 +340,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -355,7 +356,7 @@ public: } } - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(TYPE_TERESTIAN, DONE); @@ -378,7 +379,7 @@ public: { CAST_AI(mob_demon_chain::mob_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID(); Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); - DoScriptText(RAND(SAY_SACRIFICE1, SAY_SACRIFICE2), me); + Talk(SAY_SACRIFICE); SacrificeTimer = 30000; } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index cd1a803e478..7053cbb3ed7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -33,64 +33,69 @@ EndScriptData */ /***********************************/ /*** OPERA WIZARD OF OZ EVENT *****/ /*********************************/ +enum Says +{ + SAY_DOROTHEE_DEATH = 0, + SAY_DOROTHEE_SUMMON = 1, + SAY_DOROTHEE_TITO_DEATH = 2, + SAY_DOROTHEE_AGGRO = 3, + + SAY_ROAR_AGGRO = 0, + SAY_ROAR_DEATH = 1, + SAY_ROAR_SLAY = 2, + + SAY_STRAWMAN_AGGRO = 0, + SAY_STRAWMAN_DEATH = 1, + SAY_STRAWMAN_SLAY = 2, + + SAY_TINHEAD_AGGRO = 0, + SAY_TINHEAD_DEATH = 1, + SAY_TINHEAD_SLAY = 2, + EMOTE_RUST = 3, + + SAY_CRONE_AGGRO = 0, + SAY_CRONE_DEATH = 1, + SAY_CRONE_SLAY = 2, +}; -#define SAY_DOROTHEE_DEATH -1532025 -#define SAY_DOROTHEE_SUMMON -1532026 -#define SAY_DOROTHEE_TITO_DEATH -1532027 -#define SAY_DOROTHEE_AGGRO -1532028 - -#define SAY_ROAR_AGGRO -1532029 -#define SAY_ROAR_DEATH -1532030 -#define SAY_ROAR_SLAY -1532031 - -#define SAY_STRAWMAN_AGGRO -1532032 -#define SAY_STRAWMAN_DEATH -1532033 -#define SAY_STRAWMAN_SLAY -1532034 - -#define SAY_TINHEAD_AGGRO -1532035 -#define SAY_TINHEAD_DEATH -1532036 -#define SAY_TINHEAD_SLAY -1532037 -#define EMOTE_RUST -1532038 - -#define SAY_CRONE_AGGRO -1532039 -#define SAY_CRONE_AGGRO2 -1532040 -#define SAY_CRONE_DEATH -1532041 -#define SAY_CRONE_SLAY -1532042 - -/**** Spells ****/ -// Dorothee -#define SPELL_WATERBOLT 31012 -#define SPELL_SCREAM 31013 -#define SPELL_SUMMONTITO 31014 - -// Tito -#define SPELL_YIPPING 31015 - -// Strawman -#define SPELL_BRAIN_BASH 31046 -#define SPELL_BRAIN_WIPE 31069 -#define SPELL_BURNING_STRAW 31075 - -// Tinhead -#define SPELL_CLEAVE 31043 -#define SPELL_RUST 31086 - -// Roar -#define SPELL_MANGLE 31041 -#define SPELL_SHRED 31042 -#define SPELL_FRIGHTENED_SCREAM 31013 - -// Crone -#define SPELL_CHAIN_LIGHTNING 32337 - -// Cyclone -#define SPELL_KNOCKBACK 32334 -#define SPELL_CYCLONE_VISUAL 32332 +enum Spells +{ + // Dorothee + SPELL_WATERBOLT = 31012, + SPELL_SCREAM = 31013, + SPELL_SUMMONTITO = 31014, + + // Tito + SPELL_YIPPING = 31015, + + // Strawman + SPELL_BRAIN_BASH = 31046, + SPELL_BRAIN_WIPE = 31069, + SPELL_BURNING_STRAW = 31075, + + // Tinhead + SPELL_CLEAVE = 31043, + SPELL_RUST = 31086, + + // Roar + SPELL_MANGLE = 31041, + SPELL_SHRED = 31042, + SPELL_FRIGHTENED_SCREAM = 31013, + + // Crone + SPELL_CHAIN_LIGHTNING = 32337, + + // Cyclone + SPELL_KNOCKBACK = 32334, + SPELL_CYCLONE_VISUAL = 32332, +}; -/** Creature Entries **/ -#define CREATURE_TITO 17548 -#define CREATURE_CYCLONE 18412 -#define CREATURE_CRONE 18168 +enum Creatures +{ + CREATURE_TITO = 17548, + CREATURE_CYCLONE = 18412, + CREATURE_CRONE = 18168, +}; void SummonCroneIfReady(InstanceScript* instance, Creature* creature) { @@ -148,7 +153,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_DOROTHEE_AGGRO, me); + Talk(SAY_DOROTHEE_AGGRO); } void JustReachedHome() @@ -160,7 +165,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DOROTHEE_DEATH, me); + Talk(SAY_DOROTHEE_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -253,7 +258,7 @@ public: if (Dorothee && Dorothee->isAlive()) { CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; - DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + Talk(SAY_DOROTHEE_TITO_DEATH, Dorothee->GetGUID()); } } } @@ -278,7 +283,7 @@ void boss_dorothee::boss_dorotheeAI::SummonTito() { if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { - DoScriptText(SAY_DOROTHEE_SUMMON, me); + Talk(SAY_DOROTHEE_SUMMON); CAST_AI(mob_tito::mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); pTito->AI()->AttackStart(me->getVictim()); SummonedTito = true; @@ -334,7 +339,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_STRAWMAN_AGGRO, me); + Talk(SAY_STRAWMAN_AGGRO); } void JustReachedHome() @@ -357,7 +362,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_STRAWMAN_DEATH, me); + Talk(SAY_STRAWMAN_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -365,7 +370,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_STRAWMAN_SLAY, me); + Talk(SAY_STRAWMAN_SLAY); } void UpdateAI(const uint32 diff) @@ -436,7 +441,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_TINHEAD_AGGRO, me); + Talk(SAY_TINHEAD_AGGRO); } void JustReachedHome() @@ -462,7 +467,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_TINHEAD_DEATH, me); + Talk(SAY_TINHEAD_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -470,7 +475,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_TINHEAD_SLAY, me); + Talk(SAY_TINHEAD_SLAY); } void UpdateAI(const uint32 diff) @@ -498,7 +503,7 @@ public: if (RustTimer <= diff) { ++RustCount; - DoScriptText(EMOTE_RUST, me); + Talk(EMOTE_RUST); DoCast(me, SPELL_RUST); RustTimer = 6000; } else RustTimer -= diff; @@ -559,7 +564,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_ROAR_AGGRO, me); + Talk(SAY_ROAR_AGGRO); } void JustReachedHome() @@ -569,7 +574,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_ROAR_DEATH, me); + Talk(SAY_ROAR_DEATH); if (instance) SummonCroneIfReady(instance, me); @@ -577,7 +582,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_ROAR_SLAY, me); + Talk(SAY_ROAR_SLAY); } void UpdateAI(const uint32 diff) @@ -650,16 +655,21 @@ public: me->DespawnOrUnsummon(); } + void KilledUnit(Unit* /*victim*/) + { + Talk(SAY_CRONE_SLAY); + } + void EnterCombat(Unit* /*who*/) { - DoScriptText(RAND(SAY_CRONE_AGGRO, SAY_CRONE_AGGRO2), me); + Talk(SAY_CRONE_AGGRO); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_CRONE_DEATH, me); + Talk(SAY_CRONE_DEATH); if (instance) { @@ -744,22 +754,24 @@ public: /**************************************/ /**** Opera Red Riding Hood Event* ***/ /************************************/ +enum RedRidingHood +{ + SAY_WOLF_AGGRO = 0, + SAY_WOLF_SLAY = 1, + SAY_WOLF_HOOD = 2, + SOUND_WOLF_DEATH = 9275, -/**** Yells for the Wolf ****/ -#define SAY_WOLF_AGGRO -1532043 -#define SAY_WOLF_SLAY -1532044 -#define SAY_WOLF_HOOD -1532045 -#define SOUND_WOLF_DEATH 9275 //Only sound on death, no text. + SPELL_LITTLE_RED_RIDING_HOOD = 30768, + SPELL_TERRIFYING_HOWL = 30752, + SPELL_WIDE_SWIPE = 30761, + + CREATURE_BIG_BAD_WOLF = 17521, +}; -/**** Spells For The Wolf ****/ -#define SPELL_LITTLE_RED_RIDING_HOOD 30768 -#define SPELL_TERRIFYING_HOWL 30752 -#define SPELL_WIDE_SWIPE 30761 #define GOSSIP_GRANDMA "What phat lewtz you have grandmother?" -/**** The Wolf's Entry* ***/ -#define CREATURE_BIG_BAD_WOLF 17521 + class npc_grandmother : public CreatureScript { @@ -831,7 +843,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_WOLF_AGGRO, me); + Talk(SAY_WOLF_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) + { + Talk(SAY_WOLF_SLAY); } void JustReachedHome() @@ -867,7 +884,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - DoScriptText(SAY_WOLF_HOOD, me); + Talk(SAY_WOLF_HOOD); DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true); TempThreat = DoGetThreat(target); if (TempThreat) @@ -917,41 +934,41 @@ public: /******** Opera Romeo and Juliet Event* ******/ /********************************************/ -/**** Speech *****/ -#define SAY_JULIANNE_AGGRO -1532046 -#define SAY_JULIANNE_ENTER -1532047 -#define SAY_JULIANNE_DEATH01 -1532048 -#define SAY_JULIANNE_DEATH02 -1532049 -#define SAY_JULIANNE_RESURRECT -1532050 -#define SAY_JULIANNE_SLAY -1532051 - -#define SAY_ROMULO_AGGRO -1532052 -#define SAY_ROMULO_DEATH -1532053 -#define SAY_ROMULO_ENTER -1532054 -#define SAY_ROMULO_RESURRECT -1532055 -#define SAY_ROMULO_SLAY -1532056 - -/***** Spells For Julianne *****/ -#define SPELL_BLINDING_PASSION 30890 -#define SPELL_DEVOTION 30887 -#define SPELL_ETERNAL_AFFECTION 30878 -#define SPELL_POWERFUL_ATTRACTION 30889 -#define SPELL_DRINK_POISON 30907 - -/***** Spells For Romulo ****/ -#define SPELL_BACKWARD_LUNGE 30815 -#define SPELL_DARING 30841 -#define SPELL_DEADLY_SWATHE 30817 -#define SPELL_POISON_THRUST 30822 - -/**** Other Misc. Spells ****/ -#define SPELL_UNDYING_LOVE 30951 -#define SPELL_RES_VISUAL 24171 - -/*** Misc. Information ****/ -#define CREATURE_ROMULO 17533 -#define ROMULO_X -10900 -#define ROMULO_Y -1758 +enum JulianneRomulo +{ + /**** Speech *****/ + SAY_JULIANNE_AGGRO = 0, + SAY_JULIANNE_ENTER = 1, + SAY_JULIANNE_DEATH01 = 2, + SAY_JULIANNE_DEATH02 = 3, + SAY_JULIANNE_RESURRECT = 4, + SAY_JULIANNE_SLAY = 5, + + SAY_ROMULO_AGGRO = 0, + SAY_ROMULO_DEATH = 1, + SAY_ROMULO_ENTER = 2, + SAY_ROMULO_RESURRECT = 3, + SAY_ROMULO_SLAY = 4, + + SPELL_BLINDING_PASSION = 30890, + SPELL_DEVOTION = 30887, + SPELL_ETERNAL_AFFECTION = 30878, + SPELL_POWERFUL_ATTRACTION = 30889, + SPELL_DRINK_POISON = 30907, + + SPELL_BACKWARD_LUNGE = 30815, + SPELL_DARING = 30841, + SPELL_DEADLY_SWATHE = 30817, + SPELL_POISON_THRUST = 30822, + + SPELL_UNDYING_LOVE = 30951, + SPELL_RES_VISUAL = 24171, + + CREATURE_ROMULO = 17533, + ROMULO_X = -10900, + ROMULO_Y = -1758, +}; + enum RAJPhase { @@ -1078,7 +1095,7 @@ public: { if (Spell->Id == SPELL_DRINK_POISON) { - DoScriptText(SAY_JULIANNE_DEATH01, me); + Talk(SAY_JULIANNE_DEATH01); DrinkPoisonTimer = 2500; } } @@ -1087,7 +1104,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_JULIANNE_DEATH02, me); + Talk(SAY_JULIANNE_DEATH02); if (instance) { @@ -1101,7 +1118,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_JULIANNE_SLAY, me); + Talk(SAY_JULIANNE_SLAY); } void UpdateAI(const uint32 diff); @@ -1172,7 +1189,7 @@ public: if (Phase == PHASE_ROMULO) { - DoScriptText(SAY_ROMULO_DEATH, me); + Talk(SAY_ROMULO_DEATH); PretendToDie(me); IsFakingDeath = true; Phase = PHASE_BOTH; @@ -1219,7 +1236,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_ROMULO_AGGRO, me); + Talk(SAY_ROMULO_AGGRO); if (JulianneGUID) { Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); @@ -1241,7 +1258,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_ROMULO_DEATH, me); + Talk(SAY_ROMULO_DEATH); if (instance) { @@ -1256,7 +1273,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_ROMULO_SLAY, me); + Talk(SAY_ROMULO_SLAY); } void UpdateAI(const uint32 diff) @@ -1271,7 +1288,7 @@ public: Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) { - DoScriptText(SAY_ROMULO_RESURRECT, me); + Talk(SAY_ROMULO_RESURRECT); Resurrect(Julianne); CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false; JulianneDead = false; @@ -1320,7 +1337,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) { if (EntryYellTimer <= diff) { - DoScriptText(SAY_JULIANNE_ENTER, me); + Talk(SAY_JULIANNE_ENTER); EntryYellTimer = 0; } else EntryYellTimer -= diff; } @@ -1329,7 +1346,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) { if (AggroYellTimer <= diff) { - DoScriptText(SAY_JULIANNE_AGGRO, me); + Talk(SAY_JULIANNE_AGGRO); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->setFaction(16); AggroYellTimer = 0; @@ -1391,7 +1408,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) { - DoScriptText(SAY_JULIANNE_RESURRECT, me); + Talk(SAY_JULIANNE_RESURRECT); Resurrect(Romulo); CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false; RomuloDead = false; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index d2b83c6ac54..660b8f6c460 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -63,26 +63,26 @@ struct Dialogue static Dialogue OzDialogue[]= { - {-1532103, 6000}, - {-1532104, 18000}, - {-1532105, 9000}, - {-1532106, 15000} + {0, 6000}, + {1, 18000}, + {2, 9000}, + {3, 15000} }; static Dialogue HoodDialogue[]= { - {-1532107, 6000}, - {-1532108, 10000}, - {-1532109, 14000}, - {-1532110, 15000} + {4, 6000}, + {5, 10000}, + {6, 14000}, + {7, 15000} }; static Dialogue RAJDialogue[]= { - {-1532111, 5000}, - {-1532112, 7000}, - {-1532113, 14000}, - {-1532114, 14000} + {8, 5000}, + {9, 7000}, + {10, 14000}, + {11, 14000} }; // Entries and spawn locations for creatures in Oz event @@ -225,7 +225,8 @@ public: } if (text) - DoScriptText(text, me); + CreatureAI::Talk(text); + } void PrepareEncounter() diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp index c39a647d5e1..33335c32d05 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp @@ -28,8 +28,8 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1189019, - SAY_SPECIALAE = -1189020, + SAY_AGGRO = 0, + SAY_SPECIALAE = 1, SPELL_POLYMORPH = 13323, SPELL_AOESILENCE = 8988, @@ -69,7 +69,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) @@ -93,7 +93,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) return; - DoScriptText(SAY_SPECIALAE, me); + Talk(SAY_SPECIALAE); DoCast(me, SPELL_ARCANEBUBBLE); bCanDetonate = true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index ff1a0867de0..b97e1d15dc0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -28,9 +28,9 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1189016, - SAY_HEALTH = -1189017, - SAY_KILL = -1189018, + SAY_AGGRO = 0, + SAY_HEALTH = 1, + SAY_KILL = 2, SPELL_FLAMESHOCK = 8053, SPELL_SHADOWBOLT = 1106, @@ -69,12 +69,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void KilledUnit(Unit* /*Victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void UpdateAI(const uint32 diff) @@ -85,7 +85,7 @@ public: //If we are <35% hp if (!HpYell && !HealthAbovePct(35)) { - DoScriptText(SAY_HEALTH, me); + Talk(SAY_HEALTH); HpYell = true; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index fe67245b7a9..255b6d4bf85 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -34,13 +34,14 @@ EndScriptData */ //this texts are already used by 3975 and 3976 enum Says { - SAY_ENTRANCE = -1189001, - SAY_REJOINED = -1189002, - SAY_LOST_HEAD = -1189003, - SAY_CONFLAGRATION = -1189004, - SAY_SPROUTING_PUMPKINS = -1189005, - SAY_PLAYER_DEATH = -1189006, - SAY_DEATH = -1189007 + SAY_LOST_HEAD = 0, + SAY_PLAYER_DEATH = 1, + + SAY_ENTRANCE = 0, + SAY_REJOINED = 1, + SAY_CONFLAGRATION = 2, + SAY_SPROUTING_PUMPKINS = 3, + SAY_DEATH = 4, }; uint32 RandomLaugh[] = {11965, 11975, 11976}; @@ -254,7 +255,14 @@ public: void EnterCombat(Unit* /*who*/) {} void SaySound(int32 textEntry, Unit* target = 0) { - DoScriptText(textEntry, me, target); + if (target) + { + Talk(textEntry, target->GetGUID()); + } + else + { + Talk(textEntry); + } //DoCast(me, SPELL_HEAD_SPEAKS, true); Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000); if (speaker) @@ -519,7 +527,14 @@ public: void SaySound(int32 textEntry, Unit* target = 0) { - DoScriptText(textEntry, me, target); + if (target) + { + Talk(textEntry, target->GetGUID()); + } + else + { + Talk(textEntry); + } laugh += 4000; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index dbbbb7fb0dd..8c1b22e9871 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -29,15 +29,11 @@ EndScriptData */ enum Says { - SAY_AGGRO = -1189000, - SAY_WHIRLWIND = -1189001, - SAY_ENRAGE = -1189002, - SAY_KILL = -1189003 -}; - -enum Emotes -{ - EMOTE_ENRAGE = -1189004 + SAY_AGGRO = 0, + SAY_WHIRLWIND = 1, + SAY_ENRAGE = 2, + SAY_KILL = 3, + EMOTE_ENRAGE = 4 }; enum Spells @@ -82,13 +78,13 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); DoCast(me, SPELL_RUSHINGCHARGE); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -105,8 +101,8 @@ public: //If we are <30% hp goes Enraged if (!Enrage && !HealthAbovePct(30) && !me->IsNonMeleeSpellCasted(false)) { - DoScriptText(EMOTE_ENRAGE, me); - DoScriptText(SAY_ENRAGE, me); + Talk(EMOTE_ENRAGE); + Talk(SAY_ENRAGE); DoCast(me, SPELL_FRENZY); Enrage = true; } @@ -122,7 +118,7 @@ public: // Whirlwind_Timer if (Whirlwind_Timer <= diff) { - DoScriptText(SAY_WHIRLWIND, me); + Talk(SAY_WHIRLWIND); DoCast(me->getVictim(), SPELL_WHIRLWIND); Whirlwind_Timer = 30000; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp index 9a66c9ba728..0d08431d39c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp @@ -28,7 +28,7 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1189021, + SAY_AGGRO = 0, SPELL_SUMMONSCARLETHOUND = 17164, SPELL_BLOODLUST = 6742 }; @@ -56,7 +56,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 diff) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index 07b5ec5d584..f0e7ac94703 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -29,11 +29,11 @@ EndScriptData */ enum Says { - SAY_AGGRO = -1189011, - SAY_HEALTH1 = -1189012, - SAY_HEALTH2 = -1189013, - SAY_KILL = -1189014, - SAY_TRIGGER_VORREL = -1189015 + SAY_AGGRO = 0, + SAY_HEALTH1 = 1, + SAY_HEALTH2 = 2, + SAY_KILL = 3, + SAY_TRIGGER_VORREL = 0 }; enum Spells @@ -71,12 +71,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void KilledUnit(Unit* /*Victim*/) { - DoScriptText(SAY_KILL, me); + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -85,8 +85,8 @@ public: return; //Any other Actions to do with vorrel? setStandState? - if (Unit* vorrel = Unit::GetUnit(*me, instance->GetData64(DATA_VORREL))) - DoScriptText(SAY_TRIGGER_VORREL, vorrel); + if (Creature* vorrel = Creature::GetCreature(*me, instance->GetData64(DATA_VORREL))) + vorrel->AI()->Talk(SAY_TRIGGER_VORREL); } void UpdateAI(const uint32 diff) @@ -97,13 +97,13 @@ public: //If we are low on hp Do sayings if (!Yell60 && !HealthAbovePct(60)) { - DoScriptText(SAY_HEALTH1, me); + Talk(SAY_HEALTH1); Yell60 = true; } if (!Yell30 && !HealthAbovePct(30)) { - DoScriptText(SAY_HEALTH2, me); + Talk(SAY_HEALTH2); Yell30 = true; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 4b3c8f2160e..651ca453916 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -31,14 +31,14 @@ EndScriptData */ enum Says { //Mograine says - SAY_MO_AGGRO = -1189005, - SAY_MO_KILL = -1189006, - SAY_MO_RESSURECTED = -1189007, + SAY_MO_AGGRO = 0, + SAY_MO_KILL = 1, + SAY_MO_RESSURECTED = 2, //Whitemane says - SAY_WH_INTRO = -1189008, - SAY_WH_KILL = -1189009, - SAY_WH_RESSURECT = -1189010, + SAY_WH_INTRO = 0, + SAY_WH_KILL = 1, + SAY_WH_RESSURECT = 2, }; enum Spells @@ -114,7 +114,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_MO_AGGRO, me); + Talk(SAY_MO_AGGRO); DoCast(me, SPELL_RETRIBUTIONAURA); me->CallForHelp(VISIBLE_RANGE); @@ -122,7 +122,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_MO_KILL, me); + Talk(SAY_MO_KILL); } void DamageTaken(Unit* /*doneBy*/, uint32 &damage) @@ -167,7 +167,7 @@ public: //When hit with ressurection say text if (spell->Id == SPELL_SCARLETRESURRECTION) { - DoScriptText(SAY_MO_RESSURECTED, me); + Talk(SAY_MO_RESSURECTED); _bFakeDeath = false; if (instance) @@ -276,12 +276,12 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_WH_INTRO, me); + Talk(SAY_WH_INTRO); } void KilledUnit(Unit* /*victim*/) { - DoScriptText(SAY_WH_KILL, me); + Talk(SAY_WH_KILL); } void DamageTaken(Unit* /*attacker*/, uint32& damage) @@ -303,7 +303,7 @@ public: if (Unit* Mograine = Unit::GetUnit(*me, instance->GetData64(DATA_MOGRAINE))) { DoCast(Mograine, SPELL_SCARLETRESURRECTION); - DoScriptText(SAY_WH_RESSURECT, me); + Talk(SAY_WH_RESSURECT); _bCanResurrect = false; } } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 509fcdd845e..84de4af1595 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -32,9 +32,9 @@ EndScriptData */ enum eEnums { - SAY_BOSS_DIE_AD = -1033007, - SAY_BOSS_DIE_AS = -1033008, - SAY_ARCHMAGE = -1033009, + SAY_BOSS_DIE_AD = 0, + SAY_BOSS_DIE_AS = 0, + SAY_ARCHMAGE = 0, NPC_ASH = 3850, NPC_ADA = 3849, @@ -139,8 +139,8 @@ public: if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) { - DoScriptText(SAY_BOSS_DIE_AD, pAda); - DoScriptText(SAY_BOSS_DIE_AS, pAsh); + pAda->AI()->Talk(SAY_BOSS_DIE_AD); + pAsh->AI()->Talk(SAY_BOSS_DIE_AS); } } @@ -257,7 +257,7 @@ public: summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); summon->SetReactState(REACT_DEFENSIVE); summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true); - DoScriptText(SAY_ARCHMAGE, summon); + summon->AI()->Talk(SAY_ARCHMAGE); uiTimer = 2000; uiPhase = 2; break; diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 5fc41b3b267..c98148e645b 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -42,13 +42,13 @@ EndContentData */ enum eEnums { - SAY_FREE_AS = -1033000, - SAY_OPEN_DOOR_AS = -1033001, - SAY_POST_DOOR_AS = -1033002, - SAY_FREE_AD = -1033003, - SAY_OPEN_DOOR_AD = -1033004, - SAY_POST1_DOOR_AD = -1033005, - SAY_POST2_DOOR_AD = -1033006, + SAY_FREE_AS = 0, + SAY_OPEN_DOOR_AS = 1, + SAY_POST_DOOR_AS = 2, + SAY_FREE_AD = 0, + SAY_OPEN_DOOR_AD = 1, + SAY_POST1_DOOR_AD = 2, + SAY_POST2_DOOR_AD = 3, SPELL_UNLOCK = 6421, NPC_ASH = 3850, @@ -110,15 +110,15 @@ public: { case 0: if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_FREE_AS, me); + Talk(SAY_FREE_AS); else - DoScriptText(SAY_FREE_AD, me); + Talk(SAY_FREE_AD); break; case 10: if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_OPEN_DOOR_AS, me); + Talk(SAY_OPEN_DOOR_AS); else - DoScriptText(SAY_OPEN_DOOR_AD, me); + Talk(SAY_OPEN_DOOR_AD); break; case 11: if (uiNpcEntry == NPC_ASH) @@ -126,16 +126,16 @@ public: break; case 12: if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_POST_DOOR_AS, me); + Talk(SAY_POST_DOOR_AS); else - DoScriptText(SAY_POST1_DOOR_AD, me); + Talk(SAY_POST1_DOOR_AD); if (instance) instance->SetData(TYPE_FREE_NPC, DONE); break; case 13: if (uiNpcEntry != NPC_ASH) - DoScriptText(SAY_POST2_DOOR_AD, me); + Talk(SAY_POST2_DOOR_AD); break; } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 1239ca88d03..c7db80c7f22 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -31,60 +31,52 @@ EndScriptData */ enum Yells { - //Kalecgos dragon form - SAY_EVIL_AGGRO = -1580000, - SAY_EVIL_SPELL1 = -1580001, - SAY_EVIL_SPELL2 = -1580002, - SAY_EVIL_SLAY1 = -1580003, - SAY_EVIL_SLAY2 = -1580004, - SAY_EVIL_ENRAGE = -1580005, - - //Kalecgos humanoid form - SAY_GOOD_AGGRO = -1580006, - SAY_GOOD_NEAR_DEATH = -1580007, - SAY_GOOD_NEAR_DEATH2 = -1580008, - SAY_GOOD_PLRWIN = -1580009, - - //Sathrovarr - SAY_SATH_AGGRO = -1580010, - SAY_SATH_DEATH = -1580011, - SAY_SATH_SPELL1 = -1580012, - SAY_SATH_SPELL2 = -1580013, - SAY_SATH_SLAY1 = -1580014, - SAY_SATH_SLAY2 = -1580015, - SAY_SATH_ENRAGE = -1580016, + SAY_SATH_AGGRO = 0, + SAY_SATH_SLAY = 1, + SAY_SATH_DEATH = 2, + SAY_SATH_SPELL1 = 3, + SAY_SATH_SPELL2 = 4, + + SAY_EVIL_AGGRO = 0, + SAY_EVIL_SLAY = 1, + SAY_GOOD_PLRWIN = 2, + SAY_EVIL_ENRAGE = 3, + + SAY_GOOD_AGGRO = 0, + SAY_GOOD_NEAR_DEATH = 1, + SAY_GOOD_NEAR_DEATH2 = 2, }; enum Spells { - AURA_SUNWELL_RADIANCE = 45769, - AURA_SPECTRAL_EXHAUSTION = 44867, - AURA_SPECTRAL_REALM = 46021, - AURA_SPECTRAL_INVISIBILITY = 44801, - AURA_DEMONIC_VISUAL = 44800, - - SPELL_SPECTRAL_BLAST = 44869, - SPELL_TELEPORT_SPECTRAL = 46019, - SPELL_ARCANE_BUFFET = 45018, - SPELL_FROST_BREATH = 44799, - SPELL_TAIL_LASH = 45122, - - SPELL_BANISH = 44836, - SPELL_TRANSFORM_KALEC = 44670, - SPELL_ENRAGE = 44807, - - SPELL_CORRUPTION_STRIKE = 45029, - SPELL_AGONY_CURSE = 45032, - SPELL_SHADOW_BOLT = 45031, - - SPELL_HEROIC_STRIKE = 45026, - SPELL_REVITALIZE = 45027 + AURA_SUNWELL_RADIANCE = 45769, + AURA_SPECTRAL_EXHAUSTION = 44867, + AURA_SPECTRAL_REALM = 46021, + AURA_SPECTRAL_INVISIBILITY = 44801, + AURA_DEMONIC_VISUAL = 44800, + + SPELL_SPECTRAL_BLAST = 44869, + SPELL_TELEPORT_SPECTRAL = 46019, + SPELL_ARCANE_BUFFET = 45018, + SPELL_FROST_BREATH = 44799, + SPELL_TAIL_LASH = 45122, + + SPELL_BANISH = 44836, + SPELL_TRANSFORM_KALEC = 44670, + SPELL_ENRAGE = 44807, + + SPELL_CORRUPTION_STRIKE = 45029, + SPELL_AGONY_CURSE = 45032, + SPELL_SHADOW_BOLT = 45031, + + SPELL_HEROIC_STRIKE = 45026, + SPELL_REVITALIZE = 45027 }; enum SWPActions { - DO_ENRAGE = 1, - DO_BANISH = 2, + DO_ENRAGE = 1, + DO_BANISH = 2, }; #define GO_FAILED "You are unable to use this currently." @@ -360,7 +352,7 @@ public: void EnterCombat(Unit* /*who*/) { me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_EVIL_AGGRO, me); + Talk(SAY_EVIL_AGGRO); DoZoneInCombat(); if (instance) @@ -369,7 +361,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_EVIL_SLAY1, SAY_EVIL_SLAY2), me); + Talk(SAY_EVIL_SLAY); } void MovementInform(uint32 type, uint32 /*id*/) @@ -408,7 +400,7 @@ public: TalkTimer = 1000; break; case 2: - DoScriptText(SAY_GOOD_PLRWIN, me); + Talk(SAY_GOOD_PLRWIN); TalkTimer = 10000; break; case 3: @@ -426,7 +418,7 @@ public: switch (TalkSequence) { case 1: - DoScriptText(SAY_EVIL_ENRAGE, me); + Talk(SAY_EVIL_ENRAGE); TalkTimer = 3000; break; case 2: @@ -505,20 +497,20 @@ public: switch (YellSequence) { case 0: - DoScriptText(SAY_GOOD_AGGRO, me); + Talk(SAY_GOOD_AGGRO); ++YellSequence; break; case 1: if (HealthBelowPct(50)) { - DoScriptText(SAY_GOOD_NEAR_DEATH, me); + Talk(SAY_GOOD_NEAR_DEATH); ++YellSequence; } break; case 2: if (HealthBelowPct(10)) { - DoScriptText(SAY_GOOD_NEAR_DEATH2, me); + Talk(SAY_GOOD_NEAR_DEATH2); ++YellSequence; } break; @@ -642,7 +634,7 @@ public: me->AddThreat(Kalec, 100.0f); Kalec->setActive(true); } - DoScriptText(SAY_SATH_AGGRO, me); + Talk(SAY_SATH_AGGRO); } void DamageTaken(Unit* done_by, uint32 &damage) @@ -664,12 +656,12 @@ public: EnterEvadeMode(); return; } - DoScriptText(RAND(SAY_SATH_SLAY1, SAY_SATH_SLAY2), me); + Talk(SAY_SATH_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_SATH_DEATH, me); + Talk(SAY_SATH_DEATH); me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); TeleportAllPlayersBack(); if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) @@ -781,7 +773,7 @@ public: if (ShadowBoltTimer <= diff) { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); + if (!(rand()%5))Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); } else ShadowBoltTimer -= diff; @@ -796,7 +788,7 @@ public: if (CorruptionStrikeTimer <= diff) { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); + if (!(rand()%5))Talk(SAY_SATH_SPELL2); DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; } else CorruptionStrikeTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp index c05a36f93a7..1537f0eeb88 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp @@ -26,11 +26,13 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#define SAY_AGGRO -1070000 - -#define SPELL_ARCINGSMASH 8374 -#define SPELL_KNOCKAWAY 10101 -#define SPELL_WSTOMP 11876 +enum Ironaya +{ + SAY_AGGRO = 0, + SPELL_ARCINGSMASH = 8374, + SPELL_KNOCKAWAY = 10101, + SPELL_WSTOMP = 11876, +}; class boss_ironaya : public CreatureScript { @@ -58,7 +60,7 @@ class boss_ironaya : public CreatureScript void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); } void UpdateAI(const uint32 uiDiff) diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index 6aaf2df0b22..05938452520 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -41,8 +41,8 @@ EndContentData */ enum Sylvanas { QUEST_JOURNEY_TO_UNDERCITY = 9180, - SAY_LAMENT_END = -1000196, - EMOTE_LAMENT_END = -1000197, + EMOTE_LAMENT_END = 0, + SAY_LAMENT_END = 1, SOUND_CREDIT = 10896, ENTRY_HIGHBORNE_LAMENTER = 21628, @@ -153,8 +153,8 @@ public: LamentEventTimer = 2000; if (!me->HasAura(SPELL_SYLVANAS_CAST)) { - DoScriptText(SAY_LAMENT_END, me); - DoScriptText(EMOTE_LAMENT_END, me); + Talk(SAY_LAMENT_END); + Talk(EMOTE_LAMENT_END); LamentEvent = false; } } else LamentEventTimer -= diff; -- cgit v1.2.3 From 08b7439f484a3ea430ee5b04d9101d98bb3dc195 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 20 Nov 2012 19:02:58 +0100 Subject: Typo Fix after 81606e5 (Thanks to vlad852 for noticing) --- src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index eeb1df7b693..efbc4f75ae1 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -476,7 +476,7 @@ class instance_uldaman : public InstanceMapScript case 2: case 3: case 4: - return vVaultWalker.at(identifier); + return vVaultWalker.at(identifier - 1); case 5: case 6: case 7: -- cgit v1.2.3 From cd2b79f8d4b978559cc564f0a9a1c22bf03afeea Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 20 Nov 2012 20:45:10 +0100 Subject: Fix compile under windows --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 13b3335cfdc..64a47c4bf8b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16,11 +16,12 @@ * with this program. If not, see . */ +#include "Unit.h" +#include "Common.h" #include "Battlefield.h" #include "BattlefieldMgr.h" #include "Battleground.h" #include "CellImpl.h" -#include "Common.h" #include "ConditionMgr.h" #include "CreatureAI.h" #include "CreatureAIImpl.h" @@ -53,7 +54,6 @@ #include "TemporarySummon.h" #include "Totem.h" #include "Transport.h" -#include "Unit.h" #include "UpdateFieldFlags.h" #include "Util.h" #include "Vehicle.h" -- cgit v1.2.3 From 1e5e7056dc5f267aaf0ebd27101df04ac8c783e1 Mon Sep 17 00:00:00 2001 From: Gacko Date: Tue, 20 Nov 2012 22:03:10 +0100 Subject: Core/DB: Converted 7 more scripts to creature text --- .../world/2012_11_16_03_world_creature_text.sql | 140 +++++++++++++++++++++ .../BlackwingLair/boss_victor_nefarius.cpp | 10 +- .../SunwellPlateau/boss_brutallus.cpp | 86 ++++++------- .../SunwellPlateau/boss_eredar_twins.cpp | 90 ++++++------- .../SunwellPlateau/boss_felmyst.cpp | 27 ++-- .../SunwellPlateau/boss_kiljaeden.cpp | 94 ++++++-------- .../EasternKingdoms/ZulAman/boss_janalai.cpp | 33 +++-- src/server/scripts/EasternKingdoms/hinterlands.cpp | 50 ++++---- 8 files changed, 321 insertions(+), 209 deletions(-) (limited to 'src') diff --git a/sql/updates/world/2012_11_16_03_world_creature_text.sql b/sql/updates/world/2012_11_16_03_world_creature_text.sql index c84f25b97b9..ea0a508fb05 100644 --- a/sql/updates/world/2012_11_16_03_world_creature_text.sql +++ b/sql/updates/world/2012_11_16_03_world_creature_text.sql @@ -285,3 +285,143 @@ INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`text`,`type`,`sound`,`probab (24891,0,0,"I need... your help... Cannot... resist him... much longer...",14,12428,100,'kalecgos SAY_GOOD_AGGRO'), (24891,1,0,"Aaahhh! Help me, before I lose my mind!",14,12429,100,'kalecgos SAY_GOOD_NEAR_DEATH'), (24891,2,0,"Hurry! There is not much of me left!",14,12430,100,'kalecgos SAY_GOOD_NEAR_DEATH2'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580065 AND -1580044; +DELETE FROM `creature_text` WHERE `entry` IN (24882,24895); +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`text`,`type`,`sound`,`probability`,`comment`) VALUES +(24882,0,0,"Puny lizard! Death is the only answer you'll find here!",14,12458,100,'brutallus YELL_INTRO'), +(24882,1,0,"Grah! Your magic is weak!",14,12459,100,'brutallus YELL_INTRO_BREAK_ICE'), +(24882,2,0,"I will crush you!",14,12460,100,'brutallus YELL_INTRO_CHARGE'), +(24882,3,0,"That was fun.",14,12461,100,'brutallus YELL_INTRO_KILL_MADRIGOSA'), +(24882,4,0,"Come, try your luck!",14,12462,100,'brutallus YELL_INTRO_TAUNT'), +(24882,5,0,"Ahh! More lambs to the slaughter!",14,12463,100,'brutallus YELL_AGGRO'), +(24882,6,0,"Perish, insect!",14,12464,100,'brutallus YELL_KILL1'), +(24882,6,1,"You are meat!",14,12465,100,'brutallus YELL_KILL2'), +(24882,6,2,"Too easy!",14,12466,100,'brutallus YELL_KILL3'), +(24882,7,0,"Bring the fight to me!",14,12467,100,'brutallus YELL_LOVE1'), +(24882,7,1,"Another day, another glorious battle!",14,12468,100,'brutallus YELL_LOVE2'), +(24882,7,2,"I live for this!",14,12469,100,'brutallus YELL_LOVE3'), +(24882,8,0,"So much for a real challenge... Die!",14,12470,100,'brutallus YELL_BERSERK'), +(24882,9,0,"Gah! Well done... Now... this gets... interesting...",14,12471,100,'brutallus YELL_DEATH'), +(24895,0,0,"Hold, friends! There is information to be had before this devil meets his fate!",14,12472,100,'madrigosa YELL_MADR_ICE_BARRIER'), +(24895,1,0,"Where is Anveena, demon? What has become of Kalec?",14,12473,100,'madrigosa YELL_MADR_INTRO'), +(24895,2,0,"You will tell me where they are!",14,12474,100,'madrigosa YELL_MADR_ICE_BLOCK'), +(24895,3,0,"Speak, I grow weary of asking!",14,12475,100,'madrigosa YELL_MADR_TRAP'), +(24895,4,0,"Malygos, my lord! I did my best!",14,12476,100,'madrigosa YELL_MADR_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580065 AND -1580044; +DELETE FROM `creature_text` WHERE `entry` IN (25166,25165); +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(25165,0,0,14,12484,100,"eredar - YELL_INTRO_SAC_1","Misery..."), +(25165,1,0,14,0,100,"eredar - YELL_INTRO_SAC_3","Confusion..."), +(25165,2,0,14,0,100,"eredar - YELL_INTRO_SAC_5","Mistrust..."), +(25165,3,0,14,0,100,"eredar - YELL_INTRO_SAC_7","These are the hallmarks..."), +(25165,4,0,14,0,100,"eredar - YELL_SAC_DEAD","I... fade."), +(25165,5,0,41,0,100,"eredar - EMOTE_SHADOW_NOVA","%s directs Shadow Nova at $N"), +(25165,6,0,14,0,100,"eredar - YELL_ENRAGE","Time is a luxury you no longer possess!"), +(25165,7,0,14,12488,100,"eredar - YELL_SISTER_ALYTHESS_DEAD","Alythess! Your fire burns within me!"), +(25165,8,0,14,12486,100,"eredar - YELL_SAC_KILL_1","Shadow engulf."), +(25165,8,1,14,12487,100,"eredar - YELL_SAC_KILL_2","Ee-nok Kryul!"), +(25165,9,0,14,12485,100,"eredar - YELL_SHADOW_NOVA","Shadow to the aid of fire!"), +(25166,0,0,14,0,100,"eredar - YELL_INTRO_ALY_2","Depravity..."), +(25166,1,0,14,0,100,"eredar - YELL_INTRO_ALY_4","Hatred..."), +(25166,2,0,14,0,100,"eredar - YELL_INTRO_ALY_6","Chaos..."), +(25166,3,0,14,0,100,"eredar - YELL_INTRO_ALY_8","These are the pillars..."), +(25166,4,0,41,0,100,"eredar - EMOTE_CONFLAGRATION","%s directs Conflagration at $N"), +(25166,5,0,14,12490,100,"eredar - YELL_ALY_KILL_1","Fire consume."), +(25166,5,1,14,12491,100,"eredar - YELL_ALY_KILL_2","Ed-ir Halach!"), +(25166,6,0,14,12494,100,"eredar - YELL_ALY_DEAD","De-ek Anur!"), +(25166,7,0,14,12492,100,"eredar - YELL_SISTER_SACROLASH_DEAD","Sacrolash!"), +(25166,8,0,14,12489,100,"eredar - YELL_CANFLAGRATION","Fire to the aid of shadow!"), +(25166,9,0,14,12493,100,"eredar - YELL_BERSERK","Your luck has run its curse!"); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580098 AND -1580066; +DELETE FROM `creature_text` WHERE `entry` IN (25608,25319,25315,26046); +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(25608,0,0,14,12495,100,"KJ - SAY_KJ_OFFCOMBAT1","All my plans have led to this!"), +(25608,0,1,14,12496,100,"KJ - SAY_KJ_OFFCOMBAT2","Stay on task! Do not waste time!"), +(25608,0,2,14,12497,100,"KJ - SAY_KJ_OFFCOMBAT3","I have waited long enough!"), +(25608,0,3,14,12498,100,"KJ - SAY_KJ_OFFCOMBAT4","Fail me and suffer for eternity!"), +(25608,0,4,14,12499,100,"KJ - SAY_KJ_OFFCOMBAT5","Drain the girl! Drain her power until there is nothing but a vacant shell!"), +(25319,0,0,14,12449,100,"KJ - SAY_KALECGOS_ENCOURAGE","Strike now, heroes, while he is weakened! Vanquish the Deceiver!"), +(25319,1,0,14,12440,100,"KJ - SAY_KALECGOS_READY1","I will channel my power into the orbs, be ready!"), +(25319,2,0,14,12441,100,"KJ - SAY_KALECGOS_READY2","I have empowered another orb! Use it quickly!"), +(25319,3,0,14,12442,100,"KJ - SAY_KALECGOS_READY3","Another orb is ready! Make haste!"), +(25319,4,0,14,12443,100,"KJ - SAY_KALECGOS_READY4","I have channeled all I can! The power is in your hands!"), +(25319,5,0,14,12445,100,"KJ - SAY_KALECGOS_AWAKEN","Anveena, you must awaken, this world needs you!"), +(25319,6,0,14,12446,100,"KJ - SAY_KALECGOS_LETGO","You must let go! You must become what you were always meant to be! The time is now, Anveena!"), +(25319,7,0,14,12447,100,"KJ - SAY_KALECGOS_FOCUS","Anveena, I love you! Focus on my voice, come back for me now! Only you can cleanse the Sunwell!"), +(25319,8,0,14,12448,100,"KJ - SAY_KALECGOS_FATE","Yes, Anveena! Let fate embrace you now!"), +(25319,9,0,14,12450,100,"KJ - SAY_KALECGOS_GOODBYE","Goodbye, Anveena, my love. Few will remember your name, yet this day you change the course of destiny. What was once corrupt is now pure. Heroes, do not let her sacrifice be in vain."), +(25319,10,0,14,12438,100,"KJ - SAY_KALECGOS_JOIN","You are not alone. The Blue Dragonflight shall help you vanquish the Deceiver."), +(25315,0,0,14,12527,100,"KJ - SAY_KJ_DEATH","Nooooooooooooo!"), +(25315,1,0,14,12501,100,"KJ - SAY_KJ_SLAY1","Another step towards destruction!"), +(25315,1,1,14,12502,100,"KJ - SAY_KJ_SLAY2","Anak-ky'ri!"), +(25315,2,0,14,12503,100,"KJ - SAY_KJ_REFLECTION1","Who can you trust?"), +(25315,2,1,14,12504,100,"KJ - SAY_KJ_REFLECTION2","The enemy is among you."), +(25315,3,0,14,12500,100,"KJ - SAY_KJ_EMERGE","The expendible have perished... So be it! Now I shall succeed where Sargeras could not! I will bleed this wretched world and secure my place as the true master of the Burning Legion. The end has come! Let the unraveling of this world commence!"), +(25315,4,0,14,12505,100,"KJ - SAY_KJ_DARKNESS1","Chaos!"), +(25315,4,1,14,12506,100,"KJ - SAY_KJ_DARKNESS2","Destruction!"), +(25315,4,2,14,12507,100,"KJ - SAY_KJ_DARKNESS3","Oblivion!"), +(25315,5,0,14,12508,100,"KJ - SAY_KJ_PHASE3","I will not be denied! This world shall fall!"), +(25315,6,0,14,12509,100,"KJ - SAY_KJ_PHASE4","Do not harbor false hope. You cannot win!"), +(25315,7,0,14,12510,100,"KJ - SAY_KJ_PHASE5","Aggghh! The powers of the Sunwell... turned... against me! What have you done? WHAT HAVE YOU DONE?"), +(25315,8,0,41,0,100,"KJ - EMOTE_KJ_DARKNESS","%s begins to channel dark energy"), +(26046,0,0,14,12511,100,"KJ - SAY_ANVEENA_IMPRISONED","I serve only the Master now."), +(26046,1,0,14,12512,100,"KJ - SAY_ANVEENA_LOST","But I'm... lost... I cannot find my way back!"), +(26046,2,0,14,12513,100,"KJ - SAY_ANVEENA_KALEC","Kalec... Kalec?"), +(26046,3,0,14,12514,100,"KJ - SAY_ANVEENA_GOODBYE","The nightmare is over, the spell is broken! Goodbye, Kalec, my love!"); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580043 AND -1580036; +DELETE FROM `creature_text` WHERE `entry`=25038; +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(25038,0,0,14,12477,100,"felmyst - YELL_BIRTH","Glory to Kil'jaeden! Death to all who oppose!"), +(25038,1,0,14,12480,100,"felmyst - YELL_KILL1","I kill for the master!"), +(25038,1,1,14,12481,100,"felmyst - YELL_KILL2","The end has come!"), +(25038,2,0,14,12478,100,"felmyst - YELL_BREATH","Choke on your final breath!"), +(25038,3,0,14,12479,100,"felmyst - YELL_TAKEOFF","I am stronger than ever before!"), +(25038,4,0,14,12482,100,"felmyst - YELL_BERSERK","No more hesitation! Your fates are written!"), +(25038,5,0,14,12483,100,"felmyst - YELL_DEATH","Kil'jaeden... will... prevail..."), +(25038,6,0,14,12439,100,"felmyst - YELL_KALECGOS","Madrigosa deserved a far better fate. You did what had to be done, but this battle is far from over."); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000292 AND -1000287; +DELETE FROM `creature_text` WHERE `entry`=7806; +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(7806,0,0,12,0,100,"oox SAY_OOX_START","Emergency power activated! Initializing ambulanory motor! CLUCK!"), +(7806,1,0,12,0,100,"oox SAY_OOX_AGGRO1","Physical threat detected! Evasive action! CLUCK!"), +(7806,1,1,12,0,100,"oox SAY_OOX_AGGRO2","Thread analyzed! Activating combat plan beta! CLUCK!"), +(7806,2,0,12,0,100,"oox SAY_OOX_AMBUSH","CLUCK! Sensors detect spatial anomaly - danger imminent! CLUCK!"), +(7806,3,0,12,0,100,"oox SAY_OOX_AMBUSH_REPLY","No one challanges the Wastewander nomads - not even robotic chickens! ATTACK!"), +(7806,4,0,12,0,100,"oox SAY_OOX_END","Cloaking systems online! CLUCK! Engaging cloak for transport to Booty Bay!"); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000409 AND -1000403; +DELETE FROM `creature_text` WHERE `entry` IN (2691,7780); +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(2691,0,0,12,0,100,"SAY_RIN_BY_OUTRUNNER","Attack my sisters! The troll must not escape!"), +(7780,0,0,12,0,100,"SAY_RIN_FREE","Rin'ji is free!"), +(7780,1,0,12,0,100,"SAY_RIN_HELP_1","Rin'ji needs help!"), +(7780,1,1,12,0,100,"SAY_RIN_HELP_2","Rin'ji is being attacked!"), +(7780,2,0,12,0,100,"SAY_RIN_COMPLETE","Rin'ji can see road now, $n. Rin'ji knows the way home."), +(7780,3,0,12,0,100,"SAY_RIN_PROGRESS_1","Rin'ji will tell you secret now... $n, should go to the Overlook Cliffs. Rin'ji hid something on island there"), +(7780,4,0,12,0,100,"SAY_RIN_PROGRESS_2","You find it, you keep it! Don't tell no one that Rin'ji talked to you!"); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1568009 AND -1568000; +DELETE FROM `creature_text` WHERE `entry`=23578; +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(23578,0,0,14,12031,100,"janalai SAY_AGGRO","Spirits of da wind be your doom!"), +(23578,1,0,14,12032,100,"janalai SAY_FIRE_BOMBS","I burn ya now!"), +(23578,2,0,14,12033,100,"janalai SAY_SUMMON_HATCHER","Where ma hatcha? Get to work on dem eggs!"), +(23578,3,0,14,12034,100,"janalai SAY_ALL_EGGS","I show you strength... in numbers."), +(23578,4,0,14,12035,100,"janalai SAY_BERSERK","You done run outta time!"), +(23578,5,0,14,12036,100,"janalai SAY_SLAY_1","It all be over now, mon!"), +(23578,5,1,14,12037,100,"janalai SAY_SLAY_2","Tazaga-choo!"), +(23578,6,0,14,12038,100,"janalai SAY_DEATH","Zul'jin... got a surprise for you..."), +(23578,7,0,14,12039,100,"janalai SAY_EVENT_STRANGERS","Come, strangers. The spirit of the dragonhawk hot be hungry for worthy souls."), +(23578,8,0,14,12040,100,"janalai SAY_EVENT_FRIENDS","Come, friends. Your bodies gonna feed ma hatchlings, and your souls are going to feed me with power!"); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1469006 AND -1469004; +DELETE FROM `creature_text` WHERE `entry`=10162; +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`type`,`sound`,`probability`,`comment`,`text`) VALUES +(10162,0,0,12,0,100,"victor_nefarius SAY_GAMESBEGIN_1","In this world where time is your enemy, it is my greatest ally. This grand game of life that you think you play in fact plays you. To that I say..."), +(10162,1,0,14,8280,100,"victor_nefarius SAY_GAMESBEGIN_2","Let the games begin!"), +(10162,2,0,14,8279,100,"victor_nefarius SAY_VAEL_INTRO","Ah, the heroes. You are persistent, aren't you. Your allied attempted to match his power against mine, and had to pay the price. Now he shall serve me, by slaughtering you. Get up little red wyrm and destroy them!"); diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index a93519bcbe7..1335f189286 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -30,9 +30,9 @@ EndScriptData */ enum Says { - SAY_GAMESBEGIN_1 = -1469004, - SAY_GAMESBEGIN_2 = -1469005, - SAY_VAEL_INTRO = -1469006 //when he corrupts Vaelastrasz + SAY_GAMESBEGIN_1 = 0, + SAY_GAMESBEGIN_2 = 1, + //SAY_VAEL_INTRO = 2, Not used - when he corrupts Vaelastrasz }; #define GOSSIP_ITEM_1 "I've made no mistakes." @@ -101,7 +101,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF+3: player->CLOSE_GOSSIP_MENU(); - DoScriptText(SAY_GAMESBEGIN_1, creature); + creature->AI()->Talk(SAY_GAMESBEGIN_1); CAST_AI(boss_victor_nefarius::boss_victor_nefariusAI, creature->AI())->BeginEvent(player); break; } @@ -238,7 +238,7 @@ public: void BeginEvent(Player* target) { - DoScriptText(SAY_GAMESBEGIN_2, me); + Talk(SAY_GAMESBEGIN_2); //Trinity::Singleton::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); /* diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index c763cb69dec..3e9d2e991fc 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -28,41 +28,37 @@ EndScriptData */ enum Quotes { - YELL_INTRO = -1580017, - YELL_INTRO_BREAK_ICE = -1580018, - YELL_INTRO_CHARGE = -1580019, - YELL_INTRO_KILL_MADRIGOSA = -1580020, - YELL_INTRO_TAUNT = -1580021, - - YELL_MADR_ICE_BARRIER = -1580031, - YELL_MADR_INTRO = -1580032, - YELL_MADR_ICE_BLOCK = -1580033, - YELL_MADR_TRAP = -1580034, - YELL_MADR_DEATH = -1580035, - - YELL_AGGRO = -1580022, - YELL_KILL1 = -1580023, - YELL_KILL2 = -1580024, - YELL_KILL3 = -1580025, - YELL_LOVE1 = -1580026, - YELL_LOVE2 = -1580027, - YELL_LOVE3 = -1580028, - YELL_BERSERK = -1580029, - YELL_DEATH = -1580030 + YELL_INTRO = 0, + YELL_INTRO_BREAK_ICE = 1, + YELL_INTRO_CHARGE = 2, + YELL_INTRO_KILL_MADRIGOSA = 3, + YELL_INTRO_TAUNT = 4, + + YELL_AGGRO = 5, + YELL_KILL = 6, + YELL_LOVE = 7, + YELL_BERSERK = 8, + YELL_DEATH = 9, + + YELL_MADR_ICE_BARRIER = 0, + YELL_MADR_INTRO = 1, + YELL_MADR_ICE_BLOCK = 2, + YELL_MADR_TRAP = 3, + YELL_MADR_DEATH = 4, }; enum Spells { - SPELL_METEOR_SLASH = 45150, - SPELL_BURN = 46394, - SPELL_STOMP = 45185, - SPELL_BERSERK = 26662, - SPELL_DUAL_WIELD = 42459, - - SPELL_INTRO_FROST_BLAST = 45203, - SPELL_INTRO_FROSTBOLT = 44843, - SPELL_INTRO_ENCAPSULATE = 45665, - SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 + SPELL_METEOR_SLASH = 45150, + SPELL_BURN = 46394, + SPELL_STOMP = 45185, + SPELL_BERSERK = 26662, + SPELL_DUAL_WIELD = 42459, + + SPELL_INTRO_FROST_BLAST = 45203, + SPELL_INTRO_FROSTBOLT = 44843, + SPELL_INTRO_ENCAPSULATE = 45665, + SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 }; #define FELMYST 25038 @@ -122,7 +118,7 @@ public: void EnterCombat(Unit* /*who*/) { - DoScriptText(YELL_AGGRO, me); + Talk(YELL_AGGRO); if (instance) instance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); @@ -130,12 +126,12 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(YELL_KILL1, YELL_KILL2, YELL_KILL3), me); + Talk(YELL_KILL); } void JustDied(Unit* /*killer*/) { - DoScriptText(YELL_DEATH, me); + Talk(YELL_DEATH); if (instance) { @@ -199,19 +195,19 @@ public: switch (IntroPhase) { case 0: - DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa); + Madrigosa->AI()->Talk(YELL_MADR_ICE_BARRIER); IntroPhaseTimer = 7000; ++IntroPhase; break; case 1: me->SetInFront(Madrigosa); Madrigosa->SetInFront(me); - DoScriptText(YELL_MADR_INTRO, Madrigosa, me); + Madrigosa->AI()->Talk(YELL_MADR_INTRO, me->GetGUID()); IntroPhaseTimer = 9000; ++IntroPhase; break; case 2: - DoScriptText(YELL_INTRO, me, Madrigosa); + Talk(YELL_INTRO, Madrigosa->GetGUID()); IntroPhaseTimer = 13000; ++IntroPhase; break; @@ -225,32 +221,32 @@ public: ++IntroPhase; break; case 4: - DoScriptText(YELL_INTRO_BREAK_ICE, me); + Talk(YELL_INTRO_BREAK_ICE); IntroPhaseTimer = 6000; ++IntroPhase; break; case 5: Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false); - DoScriptText(YELL_MADR_TRAP, Madrigosa); + Madrigosa->AI()->Talk(YELL_MADR_TRAP); DoCast(me, SPELL_INTRO_ENCAPSULATE); IntroPhaseTimer = 11000; ++IntroPhase; break; case 6: - DoScriptText(YELL_INTRO_CHARGE, me); + Talk(YELL_INTRO_CHARGE); IntroPhaseTimer = 5000; ++IntroPhase; break; case 7: me->Kill(Madrigosa); - DoScriptText(YELL_MADR_DEATH, Madrigosa); + Madrigosa->AI()->Talk(YELL_MADR_DEATH); me->SetFullHealth(); me->AttackStop(); IntroPhaseTimer = 4000; ++IntroPhase; break; case 8: - DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me); + Talk(YELL_INTRO_KILL_MADRIGOSA); me->SetOrientation(0.14f); me->StopMoving(); Madrigosa->setDeathState(CORPSE); @@ -258,7 +254,7 @@ public: ++IntroPhase; break; case 9: - DoScriptText(YELL_INTRO_TAUNT, me); + Talk(YELL_INTRO_TAUNT); IntroPhaseTimer = 5000; ++IntroPhase; break; @@ -316,7 +312,7 @@ public: if (StompTimer <= diff) { - DoScriptText(RAND(YELL_LOVE1, YELL_LOVE2, YELL_LOVE3), me); + Talk(YELL_LOVE); DoCast(me->getVictim(), SPELL_STOMP); StompTimer = 30000; } else StompTimer -= diff; @@ -336,7 +332,7 @@ public: if (BerserkTimer < diff && !Enraged) { - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_BERSERK); Enraged = true; } else BerserkTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 95dde4f0ada..23a83a7ee8f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -28,35 +28,27 @@ EndScriptData */ enum Quotes { - //Alytesh - YELL_CANFLAGRATION = -1580044, - YELL_SISTER_SACROLASH_DEAD = -1580045, - YELL_ALY_KILL_1 = -1580046, - YELL_ALY_KILL_2 = -1580047, - YELL_ALY_DEAD = -1580048, - YELL_BERSERK = -1580049, - - //Sacrolash - YELL_SHADOW_NOVA = -1580050, - YELL_SISTER_ALYTHESS_DEAD = -1580051, - YELL_SAC_KILL_1 = -1580052, - YELL_SAC_KILL_2 = -1580053, - SAY_SAC_DEAD = -1580054, - YELL_ENRAGE = -1580055, - - //Intro - YELL_INTRO_SAC_1 = -1580056, - YELL_INTRO_ALY_2 = -1580057, - YELL_INTRO_SAC_3 = -1580058, - YELL_INTRO_ALY_4 = -1580059, - YELL_INTRO_SAC_5 = -1580060, - YELL_INTRO_ALY_6 = -1580061, - YELL_INTRO_SAC_7 = -1580062, - YELL_INTRO_ALY_8 = -1580063, - - //Emote - EMOTE_SHADOW_NOVA = -1580064, - EMOTE_CONFLAGRATION = -1580065 + YELL_INTRO_SAC_1 = 0, + YELL_INTRO_SAC_3 = 1, + YELL_INTRO_SAC_5 = 2, + YELL_INTRO_SAC_7 = 3, + YELL_SAC_DEAD = 4, + EMOTE_SHADOW_NOVA = 5, + YELL_ENRAGE = 6, + YELL_SISTER_ALYTHESS_DEAD = 7, + YELL_SAC_KILL = 8, + YELL_SHADOW_NOVA = 9, + + YELL_INTRO_ALY_2 = 0, + YELL_INTRO_ALY_4 = 1, + YELL_INTRO_ALY_6 = 2, + YELL_INTRO_ALY_8 = 3, + EMOTE_CONFLAGRATION = 4, + YELL_ALY_KILL = 5, + YELL_ALY_DEAD = 6, + YELL_SISTER_SACROLASH_DEAD = 7, + YELL_CANFLAGRATION = 8, + YELL_BERSERK = 9, }; enum Spells @@ -165,7 +157,7 @@ public: void KilledUnit(Unit* /*victim*/) { if (rand()%4 == 0) - DoScriptText(RAND(YELL_SAC_KILL_1, YELL_SAC_KILL_2), me); + Talk(YELL_SAC_KILL); } void JustDied(Unit* /*killer*/) @@ -173,7 +165,7 @@ public: // only if ALY death if (SisterDeath) { - DoScriptText(SAY_SAC_DEAD, me); + Talk(YELL_SAC_DEAD); if (instance) instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); @@ -235,7 +227,7 @@ public: Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { - DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); + Talk(YELL_SISTER_ALYTHESS_DEAD); DoCast(me, SPELL_EMPOWER); me->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; @@ -275,8 +267,8 @@ public: if (!SisterDeath) { if (target) - DoScriptText(EMOTE_SHADOW_NOVA, me, target); - DoScriptText(YELL_SHADOW_NOVA, me); + Talk(EMOTE_SHADOW_NOVA, target->GetGUID()); + Talk(YELL_SHADOW_NOVA); } ShadownovaTimer = 30000+(rand()%5000); } @@ -324,7 +316,7 @@ public: if (EnrageTimer < diff && !Enraged) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_ENRAGE, me); + Talk(YELL_ENRAGE); DoCast(me, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; @@ -457,7 +449,7 @@ public: { if (rand()%4 == 0) { - DoScriptText(RAND(YELL_ALY_KILL_1, YELL_ALY_KILL_2), me); + Talk(YELL_ALY_KILL); } } @@ -465,7 +457,7 @@ public: { if (SisterDeath) { - DoScriptText(YELL_ALY_DEAD, me); + Talk(YELL_ALY_DEAD); if (instance) instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); @@ -528,24 +520,24 @@ public: case 0: return 0; case 1: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_1, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_1); return 1000; - case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000; + case 2: Talk(YELL_INTRO_ALY_2); return 1000; case 3: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_3, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_3); return 2000; - case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000; + case 4: Talk(YELL_INTRO_ALY_4); return 1000; case 5: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_5, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_5); return 2000; - case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000; + case 6: Talk(YELL_INTRO_ALY_6); return 1000; case 7: if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_7, Sacrolash); + Sacrolash->AI()->Talk(YELL_INTRO_SAC_7); return 3000; - case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000; + case 8: Talk(YELL_INTRO_ALY_8); return 900000; } return 10000; } @@ -568,7 +560,7 @@ public: Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isDead()) { - DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); + Talk(YELL_SISTER_SACROLASH_DEAD); DoCast(me, SPELL_EMPOWER); me->InterruptSpell(CURRENT_GENERIC_SPELL); SisterDeath = true; @@ -622,8 +614,8 @@ public: if (!SisterDeath) { if (target) - DoScriptText(EMOTE_CONFLAGRATION, me, target); - DoScriptText(YELL_CANFLAGRATION, me); + Talk(EMOTE_CONFLAGRATION, target->GetGUID()); + Talk(YELL_CANFLAGRATION); } BlazeTimer = 4000; @@ -661,7 +653,7 @@ public: if (EnrageTimer < diff && !Enraged) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_ENRAGE); Enraged = true; } else EnrageTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index bc841d76714..89f541304cd 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -31,14 +31,13 @@ EndScriptData */ enum Yells { - YELL_BIRTH = -1580036, - YELL_KILL1 = -1580037, - YELL_KILL2 = -1580038, - YELL_BREATH = -1580039, - YELL_TAKEOFF = -1580040, - YELL_BERSERK = -1580041, - YELL_DEATH = -1580042, - YELL_KALECGOS = -1580043, // after felmyst's death spawned and say this + YELL_BIRTH = 0, + YELL_KILL1 = 1, + YELL_BREATH = 2, + YELL_TAKEOFF = 3, + YELL_BERSERK = 4, + YELL_DEATH = 5, + //YELL_KALECGOS = 6, Not used. After felmyst's death spawned and say this }; enum Spells @@ -181,17 +180,17 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(YELL_KILL1, YELL_KILL2), me); + Talk(YELL_KILL); } void JustRespawned() { - DoScriptText(YELL_BIRTH, me); + Talk(YELL_BIRTH); } void JustDied(Unit* /*killer*/) { - DoScriptText(YELL_DEATH, me); + Talk(YELL_DEATH); if (instance) instance->SetData(DATA_FELMYST_EVENT, DONE); @@ -279,7 +278,7 @@ public: me->GetMotionMaster()->Clear(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->StopMoving(); - DoScriptText(YELL_TAKEOFF, me); + Talk(YELL_TAKEOFF); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); break; case 1: @@ -424,7 +423,7 @@ public: switch (events.ExecuteEvent()) { case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_BERSERK, true); events.ScheduleEvent(EVENT_BERSERK, 10000); break; @@ -459,7 +458,7 @@ public: switch (events.ExecuteEvent()) { case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); + Talk(YELL_BERSERK); DoCast(me, SPELL_BERSERK, true); break; case EVENT_FLIGHT_SEQUENCE: diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index ce8338e2b2d..c2552963b0e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -33,46 +33,34 @@ EndScriptData */ /*** Speech and sounds***/ enum Yells { - // These are used throughout Sunwell and Magisters(?). Players can hear this while running through the instances. - SAY_KJ_OFFCOMBAT1 = -1580066, - SAY_KJ_OFFCOMBAT2 = -1580067, - SAY_KJ_OFFCOMBAT3 = -1580068, - SAY_KJ_OFFCOMBAT4 = -1580069, - SAY_KJ_OFFCOMBAT5 = -1580070, - - // Encounter speech and sounds - SAY_KJ_EMERGE = -1580071, - SAY_KJ_SLAY1 = -1580072, - SAY_KJ_SLAY2 = -1580073, - SAY_KJ_REFLECTION1 = -1580074, - SAY_KJ_REFLECTION2 = -1580075, - SAY_KJ_DARKNESS1 = -1580076, - SAY_KJ_DARKNESS2 = -1580077, - SAY_KJ_DARKNESS3 = -1580078, - SAY_KJ_PHASE3 = -1580079, - SAY_KJ_PHASE4 = -1580080, - SAY_KJ_PHASE5 = -1580081, - SAY_KJ_DEATH = -1580093, - EMOTE_KJ_DARKNESS = -1580094, - - /*** Kalecgos - Anveena speech at the beginning of Phase 5; Anveena's sacrifice ***/ - SAY_KALECGOS_AWAKEN = -1580082, - SAY_ANVEENA_IMPRISONED = -1580083, - SAY_KALECGOS_LETGO = -1580084, - SAY_ANVEENA_LOST = -1580085, - SAY_KALECGOS_FOCUS = -1580086, - SAY_ANVEENA_KALEC = -1580087, - SAY_KALECGOS_FATE = -1580088, - SAY_ANVEENA_GOODBYE = -1580089, - SAY_KALECGOS_GOODBYE = -1580090, - SAY_KALECGOS_ENCOURAGE = -1580091, - - /*** Kalecgos says throughout the fight ***/ - SAY_KALECGOS_JOIN = -1580092, - SAY_KALEC_ORB_READY1 = -1580095, - SAY_KALEC_ORB_READY2 = -1580096, - SAY_KALEC_ORB_READY3 = -1580097, - SAY_KALEC_ORB_READY4 = -1580098 + SAY_KJ_OFFCOMBAT = 0, + + SAY_KALECGOS_ENCOURAGE = 0, + SAY_KALECGOS_READY1 = 1, + SAY_KALECGOS_READY2 = 2, + SAY_KALECGOS_READY3 = 3, + SAY_KALECGOS_READY4 = 4, + SAY_KALECGOS_AWAKEN = 5, + SAY_KALECGOS_LETGO = 6, + SAY_KALECGOS_FOCUS = 7, + SAY_KALECGOS_FATE = 8, + SAY_KALECGOS_GOODBYE = 9, + SAY_KALECGOS_JOIN = 10, + + SAY_KJ_DEATH = 0, + SAY_KJ_SLAY = 1, + SAY_KJ_REFLECTION = 2, + SAY_KJ_EMERGE = 3, + SAY_KJ_DARKNESS = 4, + SAY_KJ_PHASE3 = 5, + SAY_KJ_PHASE4 = 6, + SAY_KJ_PHASE5 = 7, + EMOTE_KJ_DARKNESS = 8, + + SAY_ANVEENA_IMPRISONED = 0, + SAY_ANVEENA_LOST = 1, + SAY_ANVEENA_KALEC = 2, + SAY_ANVEENA_GOODBYE = 3, }; /*** Spells used during the encounter ***/ @@ -322,7 +310,7 @@ public: pOrb->Refresh(); } } - DoScriptText(SAY_KALECGOS_ENCOURAGE, me); + Talk(SAY_KALECGOS_ENCOURAGE); } else { @@ -338,10 +326,10 @@ public: ++EmpowerCount; switch (EmpowerCount) { - case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break; - case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break; - case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break; - case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break; + case 1: Talk(SAY_KALECGOS_READY1); break; + case 2: Talk(SAY_KALECGOS_READY2); break; + case 3: Talk(SAY_KALECGOS_READY3); break; + case 4: Talk(SAY_KALECGOS_READY4); break; } } } @@ -469,7 +457,7 @@ public: if (uiRandomSayTimer < diff) { if (instance && instance->GetData(DATA_MURU_EVENT) != DONE && instance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) - DoScriptText(RAND(SAY_KJ_OFFCOMBAT1, SAY_KJ_OFFCOMBAT2, SAY_KJ_OFFCOMBAT3, SAY_KJ_OFFCOMBAT4, SAY_KJ_OFFCOMBAT5), me); + Talk(SAY_KJ_OFFCOMBAT); uiRandomSayTimer = 30000; } else uiRandomSayTimer -= diff; @@ -613,7 +601,7 @@ public: void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_KJ_DEATH, me); + Talk(SAY_KJ_DEATH); summons.DespawnAll(); if (instance) @@ -622,7 +610,7 @@ public: void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_KJ_SLAY1, SAY_KJ_SLAY2), me); + Talk(SAY_KJ_SLAY); } void EnterEvadeMode() @@ -657,7 +645,7 @@ public: void CastSinisterReflection() { - DoScriptText(RAND(SAY_KJ_REFLECTION1, SAY_KJ_REFLECTION2), me); + Talk(SAY_KJ_REFLECTION); for (uint8 i = 0; i < 4; ++i) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)) @@ -717,8 +705,8 @@ public: { SpeechTimer = 0; if (instance) - if (Creature* pSpeechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) - DoScriptText(Speeches[speechCount].textid, pSpeechCreature); + if (Creature* speechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) + speechCreature->AI()->Talk(Speeches[speechCount].textid); if (speechCount == 12) if (Creature* pAnveena = Unit::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); @@ -799,7 +787,7 @@ public: // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. if (!IsInDarkness) { - DoScriptText(EMOTE_KJ_DARKNESS, me); + Talk(EMOTE_KJ_DARKNESS); DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); ChangeTimers(true, 9000); Timer[TIMER_DARKNESS] = 8750; @@ -813,7 +801,7 @@ public: Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000, 70000); IsInDarkness = false; DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); - DoScriptText(RAND(SAY_KJ_DARKNESS1, SAY_KJ_DARKNESS2, SAY_KJ_DARKNESS3), me); + Talk(SAY_KJ_DARKNESS); } Timer[TIMER_SOUL_FLAY] = 9000; } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 8a102757036..ed10dec97dd 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -31,16 +31,15 @@ EndScriptData */ enum eEnums { - SAY_AGGRO = -1568000, - SAY_FIRE_BOMBS = -1568001, - SAY_SUMMON_HATCHER = -1568002, - SAY_ALL_EGGS = -1568003, - SAY_BERSERK = -1568004, - SAY_SLAY_1 = -1568005, - SAY_SLAY_2 = -1568006, - SAY_DEATH = -1568007, - SAY_EVENT_STRANGERS = -1568008, - SAY_EVENT_FRIENDS = -1568009, + SAY_AGGRO = 0, + SAY_FIRE_BOMBS = 1, + SAY_SUMMON_HATCHER = 2, + SAY_ALL_EGGS = 3, + SAY_BERSERK = 4, + SAY_SLAY = 5, + SAY_DEATH = 6, + SAY_EVENT_STRANGERS = 7, + SAY_EVENT_FRIENDS = 8, // Jan'alai SPELL_FLAME_BREATH = 43140, @@ -163,7 +162,7 @@ class boss_janalai : public CreatureScript void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_DEATH, me); + Talk(SAY_DEATH); if (instance) instance->SetData(DATA_JANALAIEVENT, DONE); @@ -171,7 +170,7 @@ class boss_janalai : public CreatureScript void KilledUnit(Unit* /*victim*/) { - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me); + Talk(SAY_SLAY); } void EnterCombat(Unit* /*who*/) @@ -179,7 +178,7 @@ class boss_janalai : public CreatureScript if (instance) instance->SetData(DATA_JANALAIEVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, me); + Talk(SAY_AGGRO); // DoZoneInCombat(); } @@ -352,7 +351,7 @@ class boss_janalai : public CreatureScript } else { - DoScriptText(SAY_BERSERK, me); + Talk(SAY_BERSERK); DoCast(me, SPELL_BERSERK, true); EnrageTimer = 300000; } @@ -360,7 +359,7 @@ class boss_janalai : public CreatureScript if (BombTimer <= diff) { - DoScriptText(SAY_FIRE_BOMBS, me); + Talk(SAY_FIRE_BOMBS); me->AttackStop(); me->GetMotionMaster()->Clear(); @@ -393,7 +392,7 @@ class boss_janalai : public CreatureScript { if (HealthBelowPct(35)) { - DoScriptText(SAY_ALL_EGGS, me); + Talk(SAY_ALL_EGGS); me->AttackStop(); me->GetMotionMaster()->Clear(); @@ -407,7 +406,7 @@ class boss_janalai : public CreatureScript { if (HatchAllEggs(0)) { - DoScriptText(SAY_SUMMON_HATCHER, me); + Talk(SAY_SUMMON_HATCHER); me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[0][0][0], hatcherway[0][0][1], hatcherway[0][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[1][0][0], hatcherway[1][0][1], hatcherway[1][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); HatcherTimer = 90000; diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index fc7f52ae9b5..544ea0fd175 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -39,11 +39,11 @@ EndContentData */ enum eOOX { - SAY_OOX_START = -1000287, - SAY_OOX_AGGRO1 = -1000288, - SAY_OOX_AGGRO2 = -1000289, - SAY_OOX_AMBUSH = -1000290, - SAY_OOX_END = -1000292, + SAY_OOX_START = 0, + SAY_OOX_AGGRO = 1, + SAY_OOX_AMBUSH = 3, + SAY_OOX_AMBUSH_REPLY = 4, + SAY_OOX_END = 5, QUEST_RESQUE_OOX_09 = 836, @@ -70,7 +70,7 @@ public: else if (player->GetTeam() == HORDE) creature->setFaction(FACTION_ESCORTEE_H); - DoScriptText(SAY_OOX_START, creature, player); + creature->AI()->Talk(SAY_OOX_START, player->GetGUID()); if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, creature->AI())) pEscortAI->Start(false, false, player->GetGUID(), quest); @@ -94,13 +94,13 @@ public: switch (waypointId) { case 26: - DoScriptText(SAY_OOX_AMBUSH, me); + Talk(SAY_OOX_AMBUSH); break; case 43: - DoScriptText(SAY_OOX_AMBUSH, me); + Talk(SAY_OOX_AMBUSH); break; case 64: - DoScriptText(SAY_OOX_END, me); + Talk(SAY_OOX_END); if (Player* player = GetPlayerForEscort()) player->GroupEventHappens(QUEST_RESQUE_OOX_09, me); break; @@ -137,10 +137,7 @@ public: if (who->GetEntry() == NPC_MARAUDING_OWL || who->GetEntry() == NPC_VILE_AMBUSHER) return; - if (rand()%1) - DoScriptText(SAY_OOX_AGGRO1, me); - else - DoScriptText(SAY_OOX_AGGRO2, me); + Talk(SAY_OOX_AGGRO); } void JustSummoned(Creature* summoned) @@ -156,13 +153,13 @@ public: enum eRinji { - SAY_RIN_FREE = -1000403, //from here - SAY_RIN_BY_OUTRUNNER = -1000404, - SAY_RIN_HELP_1 = -1000405, - SAY_RIN_HELP_2 = -1000406, //to here, are used also by 6182 but this is wrong... - SAY_RIN_COMPLETE = -1000407, - SAY_RIN_PROGRESS_1 = -1000408, - SAY_RIN_PROGRESS_2 = -1000409, + SAY_RIN_BY_OUTRUNNER = 0, + + SAY_RIN_FREE = 0, //from here + SAY_RIN_HELP = 1, + SAY_RIN_COMPLETE = 2, + SAY_RIN_PROGRESS_1 = 3, + SAY_RIN_PROGRESS_2 = 4, QUEST_RINJI_TRAPPED = 2742, NPC_RANGER = 2694, @@ -243,7 +240,8 @@ public: { if (who->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) { - DoScriptText(SAY_RIN_BY_OUTRUNNER, who); + if (Creature* talker = who->ToCreature()) + talker->AI()->Talk(SAY_RIN_BY_OUTRUNNER); m_bIsByOutrunner = true; } @@ -251,7 +249,7 @@ public: return; //only if attacked and escorter is not in combat? - DoScriptText(RAND(SAY_RIN_HELP_1, SAY_RIN_HELP_2), me); + Talk(SAY_RIN_HELP); } } @@ -287,7 +285,7 @@ public: switch (waypointId) { case 1: - DoScriptText(SAY_RIN_FREE, me, player); + Talk(SAY_RIN_FREE, player->GetGUID()); break; case 7: DoSpawnAmbush(true); @@ -296,7 +294,7 @@ public: DoSpawnAmbush(false); break; case 17: - DoScriptText(SAY_RIN_COMPLETE, me, player); + Talk(SAY_RIN_COMPLETE, player->GetGUID()); player->GroupEventHappens(QUEST_RINJI_TRAPPED, me); SetRun(); m_uiPostEventCount = 1; @@ -320,11 +318,11 @@ public: switch (m_uiPostEventCount) { case 1: - DoScriptText(SAY_RIN_PROGRESS_1, me, player); + Talk(SAY_RIN_PROGRESS_1, player->GetGUID()); ++m_uiPostEventCount; break; case 2: - DoScriptText(SAY_RIN_PROGRESS_2, me, player); + Talk(SAY_RIN_PROGRESS_2, player->GetGUID()); m_uiPostEventCount = 0; break; } -- cgit v1.2.3 From 8bd462b6d14445176f359c05d35409d9e9d59c2b Mon Sep 17 00:00:00 2001 From: ZxBiohazardZx Date: Tue, 20 Nov 2012 23:20:14 +0100 Subject: Core/scritps: change enum to fix compile --- src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 89f541304cd..35fabb7a195 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -32,7 +32,7 @@ EndScriptData */ enum Yells { YELL_BIRTH = 0, - YELL_KILL1 = 1, + YELL_KILL = 1, YELL_BREATH = 2, YELL_TAKEOFF = 3, YELL_BERSERK = 4, -- cgit v1.2.3 From 695836cb0151935a124db4a4f1be1d46c89a1152 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 21 Nov 2012 00:15:58 +0100 Subject: Core: Fix non pch build --- .../EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp | 4 ---- .../EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 255b6d4bf85..9b59be3bb5c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -528,13 +528,9 @@ public: void SaySound(int32 textEntry, Unit* target = 0) { if (target) - { Talk(textEntry, target->GetGUID()); - } else - { Talk(textEntry); - } laugh += 4000; } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 84de4af1595..5d9df239870 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -23,6 +23,7 @@ SDComment: SDCategory: Shadowfang Keep EndScriptData */ +#include "ScriptedCreature.h" #include "ScriptMgr.h" #include "InstanceScript.h" #include "shadowfang_keep.h" -- cgit v1.2.3 From 84d88cbcec87234d35be5ffac76433aa30785edf Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 21 Nov 2012 00:43:24 +0100 Subject: Core: Fix warnings --- .../ScarletMonastery/boss_headless_horseman.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 9b59be3bb5c..78a5f3797d8 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -252,20 +252,17 @@ public: laugh = urand(15000, 30000); } - void EnterCombat(Unit* /*who*/) {} - void SaySound(int32 textEntry, Unit* target = 0) + void EnterCombat(Unit* /*who*/) { } + + void SaySound(uint8 textEntry, Unit* target = 0) { if (target) - { Talk(textEntry, target->GetGUID()); - } else - { Talk(textEntry); - } + //DoCast(me, SPELL_HEAD_SPEAKS, true); - Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000); - if (speaker) + if (Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000)) speaker->CastSpell(speaker, SPELL_HEAD_SPEAKS, false); laugh += 3000; } @@ -525,7 +522,7 @@ public: } } - void SaySound(int32 textEntry, Unit* target = 0) + void SaySound(uint8 textEntry, Unit* target = 0) { if (target) Talk(textEntry, target->GetGUID()); -- cgit v1.2.3 From 441712fbba4870f02a56e6d638ff42655dcbc905 Mon Sep 17 00:00:00 2001 From: Blipi Date: Wed, 21 Nov 2012 04:11:58 +0100 Subject: Core/Dungeon Finder: Old state should be saved, not the new one --- src/server/game/DungeonFinding/LFGGroupData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp index a4ee230b5eb..c7cf6f23ce9 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.cpp +++ b/src/server/game/DungeonFinding/LFGGroupData.cpp @@ -37,7 +37,7 @@ void LfgGroupData::SetState(LfgState state) case LFG_STATE_FINISHED_DUNGEON: case LFG_STATE_NONE: case LFG_STATE_DUNGEON: - m_OldState = state; + m_OldState = m_State; // No break on purpose default: m_State = state; -- cgit v1.2.3 From ae507e5cc6750032de6d6ee4d26f70e813dd9060 Mon Sep 17 00:00:00 2001 From: Blipi Date: Wed, 21 Nov 2012 04:31:21 +0100 Subject: Core/Dungeon Finder: Properly save old state for LfgPlayerData --- src/server/game/DungeonFinding/LFGPlayerData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index e5645f0f0aa..f1281875598 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp @@ -35,7 +35,7 @@ void LfgPlayerData::SetState(LfgState state) m_SelectedDungeons.clear(); // No break on purpose case LFG_STATE_DUNGEON: - m_OldState = state; + m_OldState = m_State; // No break on purpose default: m_State = state; -- cgit v1.2.3 From b0b3c9ffbe84d3c86d6314419d695a44a24ee0dc Mon Sep 17 00:00:00 2001 From: Amit 86 Date: Wed, 21 Nov 2012 09:31:53 +0200 Subject: Fix a typo in Trial Of The Crusader ELEGIBLE -> ELIGIBLE --- .../TrialOfTheCrusader/boss_anubarak_trial.cpp | 2 +- .../TrialOfTheCrusader/boss_faction_champions.cpp | 2 +- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 2 +- .../TrialOfTheCrusader/boss_northrend_beasts.cpp | 4 ++-- .../CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- .../TrialOfTheCrusader/instance_trial_of_the_crusader.cpp | 10 +++++----- .../TrialOfTheCrusader/trial_of_the_crusader.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index a77f341a49b..f618d0e04e7 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -203,7 +203,7 @@ class boss_anubarak_trial : public CreatureScript { Talk(SAY_KILL_PLAYER); if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 70fd93df824..a99aa373602 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -647,7 +647,7 @@ struct boss_faction_championsAI : public BossAI temp->AI()->Talk(SAY_KILL_PLAYER); - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0); } } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index f8017980766..e2068cabb95 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -128,7 +128,7 @@ class boss_jaraxxus : public CreatureScript { Talk(SAY_KILL_PLAYER); if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 106abe6fa52..2d09feef089 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -550,7 +550,7 @@ struct boss_jormungarAI : public BossAI { if (who->GetTypeId() == TYPEID_PLAYER) if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0); } void EnterCombat(Unit* /*who*/) @@ -952,7 +952,7 @@ class boss_icehowl : public CreatureScript if (who->GetTypeId() == TYPEID_PLAYER) { if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 0c081da5204..01d3bcbfe90 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -194,7 +194,7 @@ struct boss_twin_baseAI : public BossAI { Talk(SAY_KILL_PLAYER); if (instance) - instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0); + instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 6623d8e8765..fb084ec1e3c 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -42,7 +42,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript ResilienceWillFixItTimer = 0; SnoboldCount = 0; MistressOfPainCount = 0; - TributeToImmortalityElegible = true; + TributeToImmortalityEligible = true; NeedSave = false; TirionFordringGUID = 0; @@ -462,8 +462,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript else if (data == DECREASE) --MistressOfPainCount; break; - case DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE: - TributeToImmortalityElegible = false; + case DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE: + TributeToImmortalityEligible = false; break; default: break; @@ -722,7 +722,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript return TrialCounter == 50; case A_TRIBUTE_TO_IMMORTALITY_HORDE: case A_TRIBUTE_TO_IMMORTALITY_ALLIANCE: - return TrialCounter == 50 && TributeToImmortalityElegible; + return TrialCounter == 50 && TributeToImmortalityEligible; case A_TRIBUTE_TO_DEDICATED_INSANITY: return false/*uiGrandCrusaderAttemptsLeft == 50 && !bHasAtAnyStagePlayerEquippedTooGoodItem*/; default: @@ -769,7 +769,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript uint32 ResilienceWillFixItTimer; uint8 SnoboldCount; uint8 MistressOfPainCount; - bool TributeToImmortalityElegible; + bool TributeToImmortalityEligible; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index fa38b6b46c1..70fe03c5e0f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -24,7 +24,7 @@ enum DATA_SNOBOLD_COUNT = 301, DATA_MISTRESS_OF_PAIN_COUNT = 302, - DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE = 303, + DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE = 303, INCREASE = 501, DECREASE = 502, -- cgit v1.2.3 From 1d7adbfc7f788e5609803716195fe738fed7d41f Mon Sep 17 00:00:00 2001 From: Spp Date: Wed, 21 Nov 2012 12:36:00 +0100 Subject: Core/AI: Fix crash in SmartScript Closes 8340 --- src/server/game/AI/SmartScripts/SmartScript.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index a22978632fe..2cd65c42f74 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -753,12 +753,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_CALL_GROUPEVENTHAPPENS: { + if (!unit) + break; + if (IsPlayer(unit) && GetBaseObject()) { unit->ToPlayer()->GroupEventHappens(e.action.quest.quest, GetBaseObject()); sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u", unit->GetGUIDLow(), e.action.quest.quest); } + // Special handling for vehicles if (Vehicle* vehicle = unit->GetVehicleKit()) for (SeatMap::iterator it = vehicle->Seats.begin(); it != vehicle->Seats.end(); ++it) -- cgit v1.2.3 From fa7bfbc8d0b2ef4c29718e0a01c1fdae5b47448b Mon Sep 17 00:00:00 2001 From: horn Date: Wed, 21 Nov 2012 17:57:09 +0100 Subject: Core/Calendar: Fix typos --- src/server/game/Handlers/CalendarHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 3301b821f2b..876a0fc4463 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -245,7 +245,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) if (calendarEvent->IsGuildAnnouncement()) { // 946684800 is 01/01/2000 00:00:00 - default response time - CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); + CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, ""); sCalendarMgr->AddInvite(calendarEvent, invite); } else @@ -441,7 +441,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) { if (isGuildEvent && inviteeGuildId == _player->GetGuildId()) { - sCalendarMgr->SendCalendarCommandResult(inviteeGuid, CALENDAR_ERROR_NO_GUILD_INVITES); + sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NO_GUILD_INVITES); return; } -- cgit v1.2.3 From d3c902915b66fd6fa4a498f00150863cac95e394 Mon Sep 17 00:00:00 2001 From: Spp Date: Wed, 21 Nov 2012 19:54:50 +0100 Subject: Core/Dungeon Finder: Properly update Lfg Status (shouldn't lose 'eye' when changing maps or reconnect after disconnection) - Also fixes removing Player data when it shouldn't... should solve some problems with players not getting reward in some cases --- src/server/game/DungeonFinding/LFG.h | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 20 +-- src/server/game/DungeonFinding/LFGMgr.h | 9 +- src/server/game/DungeonFinding/LFGScripts.cpp | 13 +- src/server/game/Handlers/LFGHandler.cpp | 192 +++++++++++++------------- 5 files changed, 119 insertions(+), 117 deletions(-) (limited to 'src') diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index 6ad30547670..8477002279c 100755 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -41,7 +41,7 @@ enum LfgUpdateType LFG_UPDATETYPE_DEFAULT = 0, // Internal Use LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave LFG_UPDATETYPE_ROLECHECK_ABORTED = 4, - LFG_UPDATETYPE_JOIN_PROPOSAL = 5, + LFG_UPDATETYPE_JOIN_QUEUE = 5, LFG_UPDATETYPE_ROLECHECK_FAILED = 6, LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7, LFG_UPDATETYPE_PROPOSAL_FAILED = 8, diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 41d3b540089..da279016255 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -553,14 +553,17 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const LfgDungeonSet const& playerDungeons = GetSelectedDungeons(guid); if (playerDungeons == dungeons) // Joining the same dungeons -- Send OK { - LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment); player->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK if (grp) { + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment); for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) if (itr->getSource() && itr->getSource()->GetSession()) itr->getSource()->GetSession()->SendLfgUpdateParty(updateData); } + else + player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment)); + return; } else // Remove from queue and rejoin @@ -691,7 +694,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const SetState(gguid, LFG_STATE_ROLECHECK); // Send update to player - LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment); + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment); for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { if (Player* plrg = itr->getSource()) @@ -728,7 +731,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const } // Send update to player player->GetSession()->SendLfgJoinResult(joinData); - player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment)); + player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment)); SetState(gguid, LFG_STATE_QUEUED); SetRoles(guid, roles); debugNames.append(player->GetName()); @@ -751,10 +754,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const */ void LFGMgr::LeaveLfg(uint64 guid) { - LfgState state = GetState(guid); - uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid); - sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid); + + uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid); + LfgState state = GetState(guid); switch (state) { case LFG_STATE_QUEUED: @@ -1964,11 +1967,10 @@ void LFGMgr::SetOptions(uint32 options) m_options = options; } -LfgState LFGMgr::GetLfgStatus(uint64 guid, LfgUpdateData& data) +LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid) { LfgPlayerData& playerData = PlayersStore[guid]; - data.dungeons = playerData.GetSelectedDungeons(); - return playerData.GetState(); + return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons()); } bool LFGMgr::IsSeasonActive(uint32 dungeonId) diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index ba1cc251278..135a0b7fb92 100755 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -155,11 +155,14 @@ struct LfgJoinResultData // Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER struct LfgUpdateData { - LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") {} + LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { } LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment): - updateType(_type), dungeons(_dungeons), comment(_comment) {} + updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { } + LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""): + updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { } LfgUpdateType updateType; + LfgState state; LfgDungeonSet dungeons; std::string comment; }; @@ -361,7 +364,7 @@ class LFGMgr bool isOptionEnabled(uint32 option); uint32 GetOptions(); void SetOptions(uint32 options); - LfgState GetLfgStatus(uint64 guid, LfgUpdateData& data); + LfgUpdateData GetLfgStatus(uint64 guid); bool IsSeasonActive(uint32 dungeonId); std::string DumpQueueInfo(bool full = false); diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 930367a0745..f9e3c02fe98 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -46,14 +46,11 @@ void LFGPlayerScript::OnLogout(Player* player) if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 guid = player->GetGUID(); - sLFGMgr->LeaveLfg(guid); - LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); - player->GetSession()->SendLfgUpdateParty(updateData); - player->GetSession()->SendLfgUpdatePlayer(updateData); - player->GetSession()->SendLfgLfrList(false); - // TODO - Do not remove, add timer before deleting - sLFGMgr->RemovePlayerData(guid); + if (!player->GetGroup()) + { + player->GetSession()->SendLfgLfrList(false); + sLFGMgr->LeaveLfg(player->GetGUID()); + } } void LFGPlayerScript::OnLogin(Player* player) diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 92d70c8a19f..90e64428fd2 100755 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -64,7 +64,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) recvData >> numDungeons; if (!numDungeons) { - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID()); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s no dungeons selected", GetPlayerInfo().c_str()); recvData.rfinish(); return; } @@ -80,7 +80,8 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) std::string comment; recvData >> comment; - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str()); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s", + GetPlayerInfo().c_str(), roles, uint8(newDungeons.size()), comment.c_str()); sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment); } @@ -90,7 +91,8 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/) uint64 guid = GetPlayer()->GetGUID(); uint64 gguid = grp ? grp->GetGUID() : guid; - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LEAVE [" UI64FMTD "] in group: %u", guid, grp ? 1 : 0); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LEAVE %s in group: %u", + GetPlayerInfo().c_str(), grp ? 1 : 0); // Check cheating - only leader can leave the queue if (!grp || grp->GetLeaderGUID() == GetPlayer()->GetGUID()) @@ -104,7 +106,8 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData) recvData >> lfgGroupID; recvData >> accept; - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PROPOSAL_RESULT [" UI64FMTD "] proposal: %u accept: %u", GetPlayer()->GetGUID(), lfgGroupID, accept ? 1 : 0); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PROPOSAL_RESULT %s proposal: %u accept: %u", + GetPlayerInfo().c_str(), lfgGroupID, accept ? 1 : 0); sLFGMgr->UpdateProposal(lfgGroupID, GetPlayer()->GetGUID(), accept); } @@ -116,11 +119,13 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) Group* grp = GetPlayer()->GetGroup(); if (!grp) { - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES [" UI64FMTD "] Not in group", guid); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES %s Not in group", + GetPlayerInfo().c_str()); return; } uint64 gguid = grp->GetGUID(); - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES: Group [" UI64FMTD "], Player [" UI64FMTD "], Roles: %u", gguid, guid, roles); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u", + GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles); sLFGMgr->UpdateRoleCheck(gguid, guid, roles); } @@ -129,7 +134,8 @@ void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recvData) std::string comment; recvData >> comment; uint64 guid = GetPlayer()->GetGUID(); - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_COMMENT [" UI64FMTD "] comment: %s", guid, comment.c_str()); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_COMMENT %s comment: %s", + GetPlayerInfo().c_str(), comment.c_str()); sLFGMgr->SetComment(guid, comment); } @@ -140,7 +146,8 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData) recvData >> agree; uint64 guid = GetPlayer()->GetGUID(); - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", guid, agree ? 1 : 0); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE %s agree: %u", + GetPlayerInfo().c_str(), agree ? 1 : 0); sLFGMgr->UpdateBoot(guid, agree); } @@ -149,14 +156,16 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData) bool out; recvData >> out; - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_TELEPORT [" UI64FMTD "] out: %u", GetPlayer()->GetGUID(), out ? 1 : 0); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_TELEPORT %s out: %u", + GetPlayerInfo().c_str(), out ? 1 : 0); sLFGMgr->TeleportPlayer(GetPlayer(), out, true); } void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/) { uint64 guid = GetPlayer()->GetGUID(); - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s", + GetPlayerInfo().c_str()); // Get Random dungeons that can be done at a certain level and expansion LfgDungeonSet randomDungeons; @@ -177,7 +186,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4)); data << uint8(randomDungeons.size()); // Random Dungeon count @@ -235,7 +244,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/) { uint64 guid = GetPlayer()->GetGUID(); - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); Group* grp = GetPlayer()->GetGroup(); if (!grp) @@ -260,7 +269,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData* for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it) size += 8 + 4 + uint32(it->second.size()) * (4 + 4); - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size); BuildPartyLockDungeonBlock(data, lockMap); SendPacket(&data); @@ -270,7 +279,8 @@ void WorldSession::HandleLfrJoinOpcode(WorldPacket& recvData) { uint32 entry; // Raid id to search recvData >> entry; - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_JOIN [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), entry); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_JOIN %s dungeon entry: %u", + GetPlayerInfo().c_str(), entry); //SendLfrUpdateListOpcode(entry); } @@ -278,48 +288,66 @@ void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recvData) { uint32 dungeonId; // Raid id queue to leave recvData >> dungeonId; - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_LEAVE [" UI64FMTD "] dungeonId: %u", GetPlayer()->GetGUID(), dungeonId); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_LEAVE %s dungeonId: %u", + GetPlayerInfo().c_str(), dungeonId); //sLFGMgr->LeaveLfr(GetPlayer(), dungeonId); } +void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) +{ + uint64 guid = GetPlayer()->GetGUID(); + sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); + + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); + LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid); + + if (GetPlayer()->GetGroup()) + { + SendLfgUpdateParty(updateData); + updateData.dungeons.clear(); + SendLfgUpdatePlayer(updateData); + } + else + { + SendLfgUpdatePlayer(updateData); + updateData.dungeons.clear(); + SendLfgUpdateParty(updateData); + } +} + void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData) { bool queued = false; - bool extrainfo = false; uint64 guid = GetPlayer()->GetGUID(); uint8 size = uint8(updateData.dungeons.size()); switch (updateData.updateType) { - case LFG_UPDATETYPE_JOIN_PROPOSAL: + case LFG_UPDATETYPE_JOIN_QUEUE: case LFG_UPDATETYPE_ADDED_TO_QUEUE: queued = true; - extrainfo = true; break; case LFG_UPDATETYPE_UPDATE_STATUS: - extrainfo = size > 0; - break; - case LFG_UPDATETYPE_PROPOSAL_BEGIN: - extrainfo = true; + queued = updateData.state == LFG_STATE_QUEUED; break; default: break; } - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER [" UI64FMTD "] updatetype: %u", guid, updateData.updateType); - WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", + GetPlayerInfo().c_str(), updateData.updateType); + WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); data << uint8(updateData.updateType); // Lfg Update type - data << uint8(extrainfo); // Extra info - if (extrainfo) + data << uint8(size > 0); // Extra info + if (size) { data << uint8(queued); // Join the queue data << uint8(0); // unk - Always 0 data << uint8(0); // unk - Always 0 data << uint8(size); - if (size) - for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) - data << uint32(*it); + for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) + data << uint32(*it); data << updateData.comment; } SendPacket(&data); @@ -328,39 +356,32 @@ void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData) void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData) { bool join = false; - bool extrainfo = false; bool queued = false; uint64 guid = GetPlayer()->GetGUID(); uint8 size = uint8(updateData.dungeons.size()); switch (updateData.updateType) { - case LFG_UPDATETYPE_JOIN_PROPOSAL: - extrainfo = true; - break; - case LFG_UPDATETYPE_ADDED_TO_QUEUE: - extrainfo = true; - join = true; + case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success queued = true; - break; - case LFG_UPDATETYPE_UPDATE_STATUS: - extrainfo = size > 0; - join = true; - queued = true; - break; + // no break on purpose case LFG_UPDATETYPE_PROPOSAL_BEGIN: - extrainfo = true; join = true; break; + case LFG_UPDATETYPE_UPDATE_STATUS: + join = updateData.state != LFG_STATE_ROLECHECK && updateData.state != LFG_STATE_NONE; + queued = updateData.state == LFG_STATE_QUEUED; + break; default: break; } - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY [" UI64FMTD "] updatetype: %u", guid, updateData.updateType); - WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", + GetPlayerInfo().c_str(), updateData.updateType); + WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); data << uint8(updateData.updateType); // Lfg Update type - data << uint8(extrainfo); // Extra info - if (extrainfo) + data << uint8(size > 0); // Extra info + if (size) { data << uint8(join); // LFG Join data << uint8(queued); // Join the queue @@ -370,9 +391,8 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData) data << uint8(0); // unk - Always 0 data << uint8(size); - if (size) - for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) - data << uint32(*it); + for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) + data << uint32(*it); data << updateData.comment; } SendPacket(&data); @@ -380,7 +400,8 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData) void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles) { - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u", + GetPlayerInfo().c_str(), GUID_LOPART(guid), roles); WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4); data << uint64(guid); // Guid @@ -397,7 +418,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck) else dungeons = roleCheck.dungeons; - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID()); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1)); data << uint32(roleCheck.state); // Check result @@ -447,7 +468,8 @@ void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData) for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) size += 8 + 4 + uint32(it->second.size()) * (4 + 4); - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u", + GetPlayerInfo().c_str(), joinData.result, joinData.state); WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size); data << uint32(joinData.result); // Check Result data << uint32(joinData.state); // Check Value @@ -458,8 +480,8 @@ void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData) void WorldSession::SendLfgQueueStatus(const LfgQueueStatusData& queueData) { - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u", - GetPlayer()->GetGUID(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS %s dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u", + GetPlayerInfo().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps); WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 +4 + 1 + 1 + 1 + 4); data << uint32(queueData.dungeonId); // Dungeon @@ -482,7 +504,8 @@ void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntr uint8 itemNum = uint8(quest ? quest->GetRewItemsCount() : 0); - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD [" UI64FMTD "] rdungeonEntry: %u - sdungeonEntry: %u - done: %u", GetPlayer()->GetGUID(), rdungeonEntry, sdungeonEntry, done); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u - sdungeonEntry: %u - done: %u", + GetPlayerInfo().c_str(), rdungeonEntry, sdungeonEntry, done); WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4)); data << uint32(rdungeonEntry); // Random Dungeon Finished data << uint32(sdungeonEntry); // Dungeon Finished @@ -523,8 +546,12 @@ void WorldSession::SendLfgBootProposalUpdate(const LfgPlayerBoot& boot) ++agreeNum; } } - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s", - guid, uint8(boot.inProgress), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), boot.victim, votesNum, agreeNum, secsleft, LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str()); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_BOOT_PROPOSAL_UPDATE %s inProgress: %u - " + "didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - " + "needed: %u - reason %s", + GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != LFG_ANSWER_PENDING), + uint8(playerVote == LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum, + secsleft, LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str()); WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length()); data << uint8(boot.inProgress); // Vote in progress data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote @@ -545,7 +572,8 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p bool silent = !proposal.isNew && gguid == proposal.group; uint32 dungeonEntry = proposal.dungeonId; - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", guid, proposal.state); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PROPOSAL_UPDATE %s state: %u", + GetPlayerInfo().c_str(), proposal.state); WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + proposal.players.size() * (4 + 1 + 1 + 1 + 1 +1)); // show random dungeon if player selected random dungeon and it's not lfg group @@ -589,7 +617,8 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p void WorldSession::SendLfgLfrList(bool update) { - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_LFR_LIST [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_LFR_LIST %s update: %u", + GetPlayerInfo().c_str(), update ? 1 : 0); WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1); data << uint8(update); // In Lfg Queue? SendPacket(&data); @@ -597,14 +626,15 @@ void WorldSession::SendLfgLfrList(bool update) void WorldSession::SendLfgDisabled() { - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_DISABLED [" UI64FMTD "]", GetPlayer()->GetGUID()); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_DISABLED %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_DISABLED, 0); SendPacket(&data); } void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) { - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_OFFER_CONTINUE [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_OFFER_CONTINUE %s dungeon entry: %u", + GetPlayerInfo().c_str(), dungeonEntry); WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4); data << uint32(dungeonEntry); SendPacket(&data); @@ -612,48 +642,18 @@ void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) void WorldSession::SendLfgTeleportError(uint8 err) { - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err); + sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_TELEPORT_DENIED %s reason: %u", + GetPlayerInfo().c_str(), err); WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4); data << uint32(err); // Error SendPacket(&data); } -void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) -{ - uint64 guid = GetPlayer()->GetGUID(); - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_GET_STATUS [" UI64FMTD "]", guid); - - LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS); - LfgState state = sLFGMgr->GetLfgStatus(guid, updateData); - - if (state == LFG_STATE_NONE || updateData.dungeons.empty()) - { - SendLfgUpdatePlayer(updateData); - SendLfgUpdateParty(updateData); - return; - } - - if (state != LFG_STATE_QUEUED) - return; - - if (GetPlayer()->GetGroup()) - { - SendLfgUpdateParty(updateData); - updateData.dungeons.clear(); - SendLfgUpdatePlayer(updateData); - } - else - { - SendLfgUpdatePlayer(updateData); - updateData.dungeons.clear(); - SendLfgUpdateParty(updateData); - } -} - /* void WorldSession::SendLfrUpdateListOpcode(uint32 dungeonEntry) { - sLog->outDebug(LOG_FILTER_PACKETIO, "SMSG_LFG_UPDATE_LIST [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry); + sLog->outDebug(LOG_FILTER_PACKETIO, "SMSG_LFG_UPDATE_LIST %s dungeon entry: %u", + GetPlayerInfo().c_str(), dungeonEntry); WorldPacket data(SMSG_LFG_UPDATE_LIST); SendPacket(&data); } -- cgit v1.2.3 From 32c259b1ce88c36015514018e95a7d6c29420678 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 22 Nov 2012 12:11:35 +0100 Subject: Core/Channels: Remove unnecessary calls to FindPlayer wherever is possible - Add better opcode debug messages - Move isValidChatMessage debug messages to trace --- src/server/game/Chat/Channels/Channel.cpp | 791 ++++++++++++--------------- src/server/game/Chat/Channels/Channel.h | 146 +++-- src/server/game/Chat/Channels/ChannelMgr.cpp | 11 +- src/server/game/Chat/ChatLink.cpp | 100 ++-- src/server/game/DungeonFinding/LFGMgr.h | 3 +- src/server/game/Entities/Player/Player.cpp | 21 +- src/server/game/Entities/Player/Player.h | 2 +- src/server/game/Handlers/ChannelHandler.cpp | 302 +++++----- src/server/game/Handlers/LFGHandler.cpp | 63 +-- 9 files changed, 682 insertions(+), 757 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 3ccab6e5c6c..7bada252da6 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -25,48 +25,54 @@ #include "AccountMgr.h" #include "Player.h" -Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_announce(true), - m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), - m_ownerGUID(0), m_Team(Team) +Channel::Channel(std::string const& name, uint32 channelId, uint32 team): + _announce(true), + _ownership(true), + _IsSaved(false), + _flags(0), + _channelId(channelId), + _Team(team), + _ownerGUID(0), + _name(name), + _password("") { - m_IsSaved = false; // set special flags if built-in channel - if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channel_id)) // check whether it's a built-in channel + if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channelId)) // check whether it's a built-in channel { - m_announce = false; // no join/leave announces - m_ownership = false; // no ownership handout + _announce = false; // no join/leave announces + _ownership = false; // no ownership handout - m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels + _flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel - m_flags |= CHANNEL_FLAG_TRADE; + _flags |= CHANNEL_FLAG_TRADE; if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels - m_flags |= CHANNEL_FLAG_CITY; + _flags |= CHANNEL_FLAG_CITY; if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel - m_flags |= CHANNEL_FLAG_LFG; + _flags |= CHANNEL_FLAG_LFG; else // for all other channels - m_flags |= CHANNEL_FLAG_NOT_LFG; + _flags |= CHANNEL_FLAG_NOT_LFG; } else // it's custom channel { - m_flags |= CHANNEL_FLAG_CUSTOM; + _flags |= CHANNEL_FLAG_CUSTOM; // If storing custom channels in the db is enabled either load or save the channel if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS)) { PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHANNEL); stmt->setString(0, name); - stmt->setUInt32(1, m_Team); + stmt->setUInt32(1, _Team); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) //load { Field* fields = result->Fetch(); - m_announce = fields[0].GetBool(); - m_ownership = fields[1].GetBool(); - m_password = fields[2].GetString(); + _announce = fields[0].GetBool(); + _ownership = fields[1].GetBool(); + _password = fields[2].GetString(); const char* db_BannedList = fields[3].GetCString(); if (db_BannedList) @@ -77,8 +83,8 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_an uint64 banned_guid = atol(*i); if (banned_guid) { - sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded banned guid:" UI64FMTD "", name.c_str(), banned_guid); - banned.insert(banned_guid); + sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid); + bannedStore.insert(banned_guid); } } } @@ -87,45 +93,45 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_an { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL); stmt->setString(0, name); - stmt->setUInt32(1, m_Team); + stmt->setUInt32(1, _Team); CharacterDatabase.Execute(stmt); sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) saved in database", name.c_str()); } - m_IsSaved = true; + _IsSaved = true; } } } void Channel::UpdateChannelInDB() const { - if (m_IsSaved) + if (_IsSaved) { std::ostringstream banlist; - BannedList::const_iterator iter; - for (iter = banned.begin(); iter != banned.end(); ++iter) + BannedContainer::const_iterator iter; + for (iter = bannedStore.begin(); iter != bannedStore.end(); ++iter) banlist << (*iter) << ' '; std::string banListStr = banlist.str(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL); - stmt->setBool(0, m_announce); - stmt->setBool(1, m_ownership); - stmt->setString(2, m_password); + stmt->setBool(0, _announce); + stmt->setBool(1, _ownership); + stmt->setString(2, _password); stmt->setString(3, banListStr); - stmt->setString(4, m_name); - stmt->setUInt32(5, m_Team); + stmt->setString(4, _name); + stmt->setUInt32(5, _Team); CharacterDatabase.Execute(stmt); - sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", m_name.c_str()); + sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str()); } } void Channel::UpdateChannelUseageInDB() const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE); - stmt->setString(0, m_name); - stmt->setUInt32(1, m_Team); + stmt->setString(0, _name); + stmt->setUInt32(1, _Team); CharacterDatabase.Execute(stmt); } @@ -141,531 +147,500 @@ void Channel::CleanOldChannelsInDB() } } -void Channel::Join(uint64 p, const char *pass) +void Channel::JoinChannel(Player* player, std::string const& pass) { - WorldPacket data; - if (IsOn(p)) + uint64 guid = player->GetGUID(); + if (IsOn(guid)) { - if (!IsConstant()) // non send error message for built-in channels + // Do not send error message for built-in channels + if (!IsConstant()) { - MakePlayerAlreadyMember(&data, p); - SendToOne(&data, p); + WorldPacket data; + MakePlayerAlreadyMember(&data, guid); + SendToOne(&data, guid); } return; } - if (IsBanned(p)) + if (IsBanned(guid)) { + WorldPacket data; MakeBanned(&data); - SendToOne(&data, p); + SendToOne(&data, guid); return; } - if (m_password.length() > 0 && strcmp(pass, m_password.c_str())) + if (!_password.empty() && pass != _password) { + WorldPacket data; MakeWrongPassword(&data); - SendToOne(&data, p); + SendToOne(&data, guid); return; } - Player* player = ObjectAccessor::FindPlayer(p); - - if (player) + if (HasFlag(CHANNEL_FLAG_LFG) && + sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && + AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && + player->GetGroup()) { - if (HasFlag(CHANNEL_FLAG_LFG) && - sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup()) - { - MakeNotInLfg(&data); - SendToOne(&data, p); - return; - } - - player->JoinedChannel(this); + WorldPacket data; + MakeNotInLfg(&data); + SendToOne(&data, guid); + return; } - if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + player->JoinedChannel(this); + + if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || + !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { - MakeJoined(&data, p); + WorldPacket data; + MakeJoined(&data, guid); SendToAll(&data); } - data.clear(); - PlayerInfo pinfo; - pinfo.player = p; + pinfo.player = guid; pinfo.flags = MEMBER_FLAG_NONE; - players[p] = pinfo; + playersStore[guid] = pinfo; + WorldPacket data; MakeYouJoined(&data); - SendToOne(&data, p); + SendToOne(&data, guid); - JoinNotify(p); + JoinNotify(guid); // Custom channel handling if (!IsConstant()) { // Update last_used timestamp in db - if (!players.empty()) + if (!playersStore.empty()) UpdateChannelUseageInDB(); // If the channel has no owner yet and ownership is allowed, set the new owner. - if (!m_ownerGUID && m_ownership) + if (!_ownerGUID && _ownership) { - SetOwner(p, (players.size() > 1 ? true : false)); - players[p].SetModerator(true); + SetOwner(guid, playersStore.size() > 1); + playersStore[guid].SetModerator(true); } } } -void Channel::Leave(uint64 p, bool send) +void Channel::LeaveChannel(Player* player, bool send) { - if (!IsOn(p)) + uint64 guid = player->GetGUID(); + if (!IsOn(guid)) { if (send) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); } + return; } - else + + if (send) { - Player* player = ObjectAccessor::FindPlayer(p); + WorldPacket data; + MakeYouLeft(&data); + SendToOne(&data, guid); + player->LeftChannel(this); + data.clear(); + } - if (send) - { - WorldPacket data; - MakeYouLeft(&data); - SendToOne(&data, p); - if (player) - player->LeftChannel(this); - data.clear(); - } + bool changeowner = playersStore[guid].IsOwner(); - bool changeowner = players[p].IsOwner(); + playersStore.erase(guid); + if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || + !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + { + WorldPacket data; + MakeLeft(&data, guid); + SendToAll(&data); + } - players.erase(p); - if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) - { - WorldPacket data; - MakeLeft(&data, p); - SendToAll(&data); - } + LeaveNotify(guid); - LeaveNotify(p); + if (!IsConstant()) + { + // Update last_used timestamp in db + UpdateChannelUseageInDB(); - if (!IsConstant()) + // If the channel owner left and there are still playersStore inside, pick a new owner + if (changeowner && _ownership && !playersStore.empty()) { - // Update last_used timestamp in db - UpdateChannelUseageInDB(); - - // If the channel owner left and there are still players inside, pick a new owner - if (changeowner && m_ownership && !players.empty()) - { - uint64 newowner = players.begin()->second.player; - players[newowner].SetModerator(true); - SetOwner(newowner); - } + uint64 newowner = playersStore.begin()->second.player; + playersStore[newowner].SetModerator(true); + SetOwner(newowner); } } } -void Channel::KickOrBan(uint64 good, const char *badname, bool ban) +void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban) { - AccountTypes sec = SEC_PLAYER; - Player* gplr = ObjectAccessor::FindPlayer(good); - if (gplr) - sec = gplr->GetSession()->GetSecurity(); + AccountTypes sec = player->GetSession()->GetSecurity(); + uint64 good = player->GetGUID(); if (!IsOn(good)) { WorldPacket data; MakeNotMember(&data); SendToOne(&data, good); + return; } - else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) + + if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); SendToOne(&data, good); + return; } - else + + Player* bad = sObjectAccessor->FindPlayerByName(badname); + uint64 victim = bad ? bad->GetGUID() : 0; + if (!victim || !IsOn(victim)) { - Player* bad = sObjectAccessor->FindPlayerByName(badname); - if (bad == NULL || !IsOn(bad->GetGUID())) - { - WorldPacket data; - MakePlayerNotFound(&data, badname); - SendToOne(&data, good); - } - else if (!AccountMgr::IsGMAccount(sec) && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID) - { - WorldPacket data; - MakeNotOwner(&data); - SendToOne(&data, good); - } - else - { - bool changeowner = (m_ownerGUID == bad->GetGUID()); - - WorldPacket data; - bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)); + WorldPacket data; + MakePlayerNotFound(&data, badname); + SendToOne(&data, good); + return; + } - if (ban && !IsBanned(bad->GetGUID())) - { - banned.insert(bad->GetGUID()); - UpdateChannelInDB(); + bool changeowner = _ownerGUID == victim; - if (notify) - MakePlayerBanned(&data, bad->GetGUID(), good); - } - else if (notify) - MakePlayerKicked(&data, bad->GetGUID(), good); + if (!AccountMgr::IsGMAccount(sec) && changeowner && good != _ownerGUID) + { + WorldPacket data; + MakeNotOwner(&data); + SendToOne(&data, good); + return; + } - if (notify) - SendToAll(&data); + bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)); - players.erase(bad->GetGUID()); - bad->LeftChannel(this); + if (ban && !IsBanned(victim)) + { + bannedStore.insert(victim); + UpdateChannelInDB(); - if (changeowner && m_ownership && !players.empty()) - { - uint64 newowner = good; - players[newowner].SetModerator(true); - SetOwner(newowner); - } + if (notify) + { + WorldPacket data; + MakePlayerBanned(&data, victim, good); + SendToAll(&data); } } + else if (notify) + { + WorldPacket data; + MakePlayerKicked(&data, victim, good); + SendToAll(&data); + } + + playersStore.erase(victim); + bad->LeftChannel(this); + + if (changeowner && _ownership && !playersStore.empty()) + { + uint64 newowner = good; + playersStore[newowner].SetModerator(true); + SetOwner(newowner); + } } -void Channel::UnBan(uint64 good, const char *badname) +void Channel::UnBan(Player const* player, std::string const& badname) { - uint32 sec = 0; - Player* gplr = ObjectAccessor::FindPlayer(good); - if (gplr) - sec = gplr->GetSession()->GetSecurity(); + uint32 sec = player->GetSession()->GetSecurity(); + uint64 good = player->GetGUID(); if (!IsOn(good)) { WorldPacket data; MakeNotMember(&data); SendToOne(&data, good); + return; } - else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) + + if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); SendToOne(&data, good); + return; } - else - { - Player* bad = sObjectAccessor->FindPlayerByName(badname); - if (bad == NULL || !IsBanned(bad->GetGUID())) - { - WorldPacket data; - MakePlayerNotFound(&data, badname); - SendToOne(&data, good); - } - else - { - banned.erase(bad->GetGUID()); - WorldPacket data; - MakePlayerUnbanned(&data, bad->GetGUID(), good); - SendToAll(&data); + Player* bad = sObjectAccessor->FindPlayerByName(badname); + uint64 victim = bad ? bad->GetGUID(): 0; - UpdateChannelInDB(); - } + if (!victim || !IsBanned(victim)) + { + WorldPacket data; + MakePlayerNotFound(&data, badname); + SendToOne(&data, good); + return; } + + bannedStore.erase(victim); + + WorldPacket data; + MakePlayerUnbanned(&data, victim, good); + SendToAll(&data); + + UpdateChannelInDB(); } -void Channel::Password(uint64 p, const char *pass) +void Channel::Password(Player const* player, std::string const& pass) { - uint32 sec = 0; - Player* player = ObjectAccessor::FindPlayer(p); - if (player) - sec = player->GetSession()->GetSecurity(); + uint64 guid = player->GetGUID(); ChatHandler chat(player->GetSession()); - - if (!IsOn(p)) + if (!IsOn(guid)) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) + + if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity())) { WorldPacket data; MakeNotModerator(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else - { - m_password = pass; - WorldPacket data; - MakePasswordChanged(&data, p); - SendToAll(&data); + _password = pass; - UpdateChannelInDB(); - } + WorldPacket data; + MakePasswordChanged(&data, guid); + SendToAll(&data); + + UpdateChannelInDB(); } -void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) +void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set) { - Player* player = ObjectAccessor::FindPlayer(p); - if (!player) - return; - + uint64 guid = player->GetGUID(); uint32 sec = player->GetSession()->GetSecurity(); - if (!IsOn(p)) + if (!IsOn(guid)) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) + + if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else - { - Player* newp = sObjectAccessor->FindPlayerByName(p2n); - if (!newp) - { - WorldPacket data; - MakePlayerNotFound(&data, p2n); - SendToOne(&data, p); - return; - } - if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod) - return; + if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod) + return; - if (!IsOn(newp->GetGUID())) - { - WorldPacket data; - MakePlayerNotFound(&data, p2n); - SendToOne(&data, p); - return; - } + Player* newp = sObjectAccessor->FindPlayerByName(p2n); + uint64 victim = newp ? newp->GetGUID() : 0; + if (!victim || !IsOn(victim) || // allow make moderator from another team only if both is GMs // at this moment this only way to show channel post for GM from another team - if ((!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && - player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) - { - WorldPacket data; - MakePlayerNotFound(&data, p2n); - SendToOne(&data, p); - return; - } - - if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p) - { - WorldPacket data; - MakeNotOwner(&data); - SendToOne(&data, p); - return; - } - - if (mod) - SetModerator(newp->GetGUID(), set); - else - SetMute(newp->GetGUID(), set); - } -} - -void Channel::SetOwner(uint64 p, const char *newname) -{ - Player* player = ObjectAccessor::FindPlayer(p); - if (!player) - return; - - uint32 sec = player->GetSession()->GetSecurity(); - - if (!IsOn(p)) + ((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && + player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))) { WorldPacket data; - MakeNotMember(&data); - SendToOne(&data, p); + MakePlayerNotFound(&data, p2n); + SendToOne(&data, guid); return; } - if (!AccountMgr::IsGMAccount(sec) && p != m_ownerGUID) + if (_ownerGUID == victim && _ownerGUID != guid) { WorldPacket data; MakeNotOwner(&data); - SendToOne(&data, p); + SendToOne(&data, guid); return; } - Player* newp = sObjectAccessor->FindPlayerByName(newname); - if (newp == NULL || !IsOn(newp->GetGUID())) + if (mod) + SetModerator(newp->GetGUID(), set); + else + SetMute(newp->GetGUID(), set); +} + +void Channel::SetOwner(Player const* player, std::string const& newname) +{ + uint64 guid = player->GetGUID(); + uint32 sec = player->GetSession()->GetSecurity(); + + if (!IsOn(guid) || (!AccountMgr::IsGMAccount(sec) && guid != _ownerGUID)) { WorldPacket data; - MakePlayerNotFound(&data, newname); - SendToOne(&data, p); + MakeNotMember(&data); + SendToOne(&data, guid); return; } - if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + Player* newp = sObjectAccessor->FindPlayerByName(newname); + uint64 victim = newp ? newp->GetGUID() : 0; + + if (!victim || !IsOn(victim) || + (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))) { WorldPacket data; MakePlayerNotFound(&data, newname); - SendToOne(&data, p); + SendToOne(&data, guid); return; } - players[newp->GetGUID()].SetModerator(true); - SetOwner(newp->GetGUID()); + playersStore[victim].SetModerator(true); + SetOwner(victim); } -void Channel::SendWhoOwner(uint64 p) +void Channel::SendWhoOwner(uint64 guid) { - if (!IsOn(p)) - { - WorldPacket data; - MakeNotMember(&data); - SendToOne(&data, p); - } - else - { - WorldPacket data; + WorldPacket data; + if (IsOn(guid)) MakeChannelOwner(&data); - SendToOne(&data, p); - } + else + MakeNotMember(&data); + SendToOne(&data, guid); } -void Channel::List(Player* player) +void Channel::List(Player const* player) { - uint64 p = player->GetGUID(); + uint64 guid = player->GetGUID(); - if (!IsOn(p)) + if (!IsOn(guid)) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else - { - WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+players.size()*(8+1)); - data << uint8(1); // channel type? - data << GetName(); // channel name - data << uint8(GetFlags()); // channel flags? - size_t pos = data.wpos(); - data << uint32(0); // size of list, placeholder + sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_LIST %s Channel: %s", + player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str()); - uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); + WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+playersStore.size()*(8+1)); + data << uint8(1); // channel type? + data << GetName(); // channel name + data << uint8(GetFlags()); // channel flags? - uint32 count = 0; - for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - { - Player* member = ObjectAccessor::FindPlayer(i->first); + size_t pos = data.wpos(); + data << uint32(0); // size of list, placeholder - // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters - // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && - member->IsVisibleGloballyFor(player)) - { - data << uint64(i->first); - data << uint8(i->second.flags); // flags seems to be changed... - ++count; - } - } + uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); - data.put(pos, count); + uint32 count = 0; + for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) + { + Player* member = ObjectAccessor::FindPlayer(i->first); - SendToOne(&data, p); + // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters + // MODERATOR, GAME MASTER, ADMINISTRATOR can see all + if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && + member->IsVisibleGloballyFor(player)) + { + data << uint64(i->first); + data << uint8(i->second.flags); // flags seems to be changed... + ++count; + } } + + data.put(pos, count); + + SendToOne(&data, guid); } -void Channel::Announce(uint64 p) +void Channel::Announce(Player const* player) { - uint32 sec = 0; - Player* player = ObjectAccessor::FindPlayer(p); - if (player) - sec = player->GetSession()->GetSecurity(); + uint64 guid = player->GetGUID(); + uint32 sec = player->GetSession()->GetSecurity(); - if (!IsOn(p)) + if (!IsOn(guid)) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) + + if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else - { - m_announce = !m_announce; - WorldPacket data; - if (m_announce) - MakeAnnouncementsOn(&data, p); - else - MakeAnnouncementsOff(&data, p); - SendToAll(&data); + _announce = !_announce; - UpdateChannelInDB(); - } + WorldPacket data; + if (_announce) + MakeAnnouncementsOn(&data, guid); + else + MakeAnnouncementsOff(&data, guid); + SendToAll(&data); + + UpdateChannelInDB(); } -void Channel::Say(uint64 p, const char *what, uint32 lang) +void Channel::Say(uint64 guid, std::string const& what, uint32 lang) { - if (!what) + if (what.empty()) return; + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) lang = LANG_UNIVERSAL; - Player* player = ObjectAccessor::FindPlayer(p); + Player* player = ObjectAccessor::FindPlayer(guid); - if (!IsOn(p)) + if (!IsOn(guid)) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); + return; } - else if (players[p].IsMuted()) + + if (playersStore[guid].IsMuted()) { WorldPacket data; MakeMuted(&data); - SendToOne(&data, p); - } - else - { - uint32 messageLength = strlen(what) + 1; - - WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1); - data << (uint8)CHAT_MSG_CHANNEL; - data << (uint32)lang; - data << p; // 2.1.0 - data << uint32(0); // 2.1.0 - data << m_name; - data << p; - data << messageLength; - data << what; - data << uint8(player ? player->GetChatTag() : 0); - - SendToAll(&data, !players[p].IsModerator() ? p : false); + SendToOne(&data, guid); + return; } + + WorldPacket data(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + _name.size() + 8 + 4 + what.size() + 1); + data << uint8(CHAT_MSG_CHANNEL); + data << uint32(lang); + data << guid; + data << uint32(0); + data << _name; + data << guid; + data << what.size() + 1; + data << what; + data << uint8(player ? player->GetChatTag() : 0); + + SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false); } -void Channel::Invite(uint64 p, const char *newname) +void Channel::Invite(Player const* player, std::string const& newname) { - if (!IsOn(p)) + uint64 guid = player->GetGUID(); + + if (!IsOn(guid)) { WorldPacket data; MakeNotMember(&data); - SendToOne(&data, p); + SendToOne(&data, guid); return; } @@ -674,7 +649,7 @@ void Channel::Invite(uint64 p, const char *newname) { WorldPacket data; MakePlayerNotFound(&data, newname); - SendToOne(&data, p); + SendToOne(&data, guid); return; } @@ -682,19 +657,15 @@ void Channel::Invite(uint64 p, const char *newname) { WorldPacket data; MakePlayerInviteBanned(&data, newname); - SendToOne(&data, p); + SendToOne(&data, guid); return; } - Player* player = ObjectAccessor::FindPlayer(p); - if (!player) - return; - if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; MakeInviteWrongFaction(&data); - SendToOne(&data, p); + SendToOne(&data, guid); return; } @@ -702,45 +673,47 @@ void Channel::Invite(uint64 p, const char *newname) { WorldPacket data; MakePlayerAlreadyMember(&data, newp->GetGUID()); - SendToOne(&data, p); + SendToOne(&data, guid); return; } - WorldPacket data; - if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p))) + if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid))) { - MakeInvite(&data, p); + WorldPacket data; + MakeInvite(&data, guid); SendToOne(&data, newp->GetGUID()); data.clear(); } + + WorldPacket data; MakePlayerInvited(&data, newp->GetName()); - SendToOne(&data, p); + SendToOne(&data, guid); } void Channel::SetOwner(uint64 guid, bool exclaim) { - if (m_ownerGUID) + if (_ownerGUID) { // [] will re-add player after it possible removed - PlayerList::iterator p_itr = players.find(m_ownerGUID); - if (p_itr != players.end()) + PlayerContainer::iterator p_itr = playersStore.find(_ownerGUID); + if (p_itr != playersStore.end()) p_itr->second.SetOwner(false); } - m_ownerGUID = guid; - if (m_ownerGUID) + _ownerGUID = guid; + if (_ownerGUID) { - uint8 oldFlag = GetPlayerFlags(m_ownerGUID); - players[m_ownerGUID].SetModerator(true); - players[m_ownerGUID].SetOwner(true); + uint8 oldFlag = GetPlayerFlags(_ownerGUID); + playersStore[_ownerGUID].SetModerator(true); + playersStore[_ownerGUID].SetOwner(true); WorldPacket data; - MakeModeChange(&data, m_ownerGUID, oldFlag); + MakeModeChange(&data, _ownerGUID, oldFlag); SendToAll(&data); if (exclaim) { - MakeOwnerChanged(&data, m_ownerGUID); + MakeOwnerChanged(&data, _ownerGUID); SendToAll(&data); } @@ -748,36 +721,25 @@ void Channel::SetOwner(uint64 guid, bool exclaim) } } -void Channel::SendToAll(WorldPacket* data, uint64 p) +void Channel::SendToAll(WorldPacket* data, uint64 guid) { - for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - { - Player* player = ObjectAccessor::FindPlayer(i->first); - if (player) - { - if (!p || !player->GetSocial()->HasIgnore(GUID_LOPART(p))) + for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) + if (Player* player = ObjectAccessor::FindPlayer(i->first)) + if (!guid || !player->GetSocial()->HasIgnore(GUID_LOPART(guid))) player->GetSession()->SendPacket(data); - } - } } void Channel::SendToAllButOne(WorldPacket* data, uint64 who) { - for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - { + for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) if (i->first != who) - { - Player* player = ObjectAccessor::FindPlayer(i->first); - if (player) + if (Player* player = ObjectAccessor::FindPlayer(i->first)) player->GetSession()->SendPacket(data); - } - } } void Channel::SendToOne(WorldPacket* data, uint64 who) { - Player* player = ObjectAccessor::FindPlayer(who); - if (player) + if (Player* player = ObjectAccessor::FindPlayer(who)) player->GetSession()->SendPacket(data); } @@ -791,29 +753,25 @@ void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/) } -// done void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type) { - data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1); + data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + _name.size()); *data << uint8(notify_type); - *data << m_name; + *data << _name; } -// done 0x00 void Channel::MakeJoined(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_JOINED_NOTICE); *data << uint64(guid); } -// done 0x01 void Channel::MakeLeft(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_LEFT_NOTICE); *data << uint64(guid); } -// done 0x02 void Channel::MakeYouJoined(WorldPacket* data) { MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE); @@ -822,7 +780,6 @@ void Channel::MakeYouJoined(WorldPacket* data) *data << uint32(0); } -// done 0x03 void Channel::MakeYouLeft(WorldPacket* data) { MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE); @@ -830,64 +787,55 @@ void Channel::MakeYouLeft(WorldPacket* data) *data << uint8(IsConstant()); } -// done 0x04 void Channel::MakeWrongPassword(WorldPacket* data) { MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE); } -// done 0x05 void Channel::MakeNotMember(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE); } -// done 0x06 void Channel::MakeNotModerator(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE); } -// done 0x07 void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE); *data << uint64(guid); } -// done 0x08 void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE); *data << uint64(guid); } -// done 0x09 -void Channel::MakePlayerNotFound(WorldPacket* data, const std::string& name) +void Channel::MakePlayerNotFound(WorldPacket* data, std::string const& name) { MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE); *data << name; } -// done 0x0A void Channel::MakeNotOwner(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE); } -// done 0x0B void Channel::MakeChannelOwner(WorldPacket* data) { std::string name = ""; - if (!sObjectMgr->GetPlayerNameByGUID(m_ownerGUID, name) || name.empty()) + if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID, name) || name.empty()) name = "PLAYER_NOT_FOUND"; MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE); - *data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name); + *data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name); } -// done 0x0C void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags) { MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE); @@ -896,27 +844,23 @@ void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags) *data << uint8(GetPlayerFlags(guid)); } -// done 0x0D void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE); *data << uint64(guid); } -// done 0x0E void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE); *data << uint64(guid); } -// done 0x11 void Channel::MakeMuted(WorldPacket* data) { MakeNotifyPacket(data, CHAT_MUTED_NOTICE); } -// done 0x12 void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good) { MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE); @@ -924,13 +868,11 @@ void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good) *data << uint64(good); } -// done 0x13 void Channel::MakeBanned(WorldPacket* data) { MakeNotifyPacket(data, CHAT_BANNED_NOTICE); } -// done 0x14 void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good) { MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE); @@ -938,7 +880,6 @@ void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good) *data << uint64(good); } -// done 0x15 void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good) { MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE); @@ -946,91 +887,77 @@ void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good) *data << uint64(good); } -// done 0x16 void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name) { MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE); *data << name; } -// done 0x17 void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE); *data << uint64(guid); } -// done 0x18 void Channel::MakeInvite(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_INVITE_NOTICE); *data << uint64(guid); } -// done 0x19 void Channel::MakeInviteWrongFaction(WorldPacket* data) { MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE); } -// done 0x1A void Channel::MakeWrongFaction(WorldPacket* data) { MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE); } -// done 0x1B void Channel::MakeInvalidName(WorldPacket* data) { MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE); } -// done 0x1C void Channel::MakeNotModerated(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE); } -// done 0x1D void Channel::MakePlayerInvited(WorldPacket* data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE); *data << name; } -// done 0x1E void Channel::MakePlayerInviteBanned(WorldPacket* data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE); *data << name; } -// done 0x1F void Channel::MakeThrottled(WorldPacket* data) { MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE); } -// done 0x20 void Channel::MakeNotInArea(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE); } -// done 0x21 void Channel::MakeNotInLfg(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE); } -// done 0x22 void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE); *data << uint64(guid); } -// done 0x23 void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE); @@ -1039,13 +966,7 @@ void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid) void Channel::JoinNotify(uint64 guid) { - WorldPacket data; - - if (IsConstant()) - data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1); - else - data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1); - + WorldPacket data(IsConstant() ? SMSG_USERLIST_ADD : SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size()); data << uint64(guid); data << uint8(GetPlayerFlags(guid)); data << uint8(GetFlags()); @@ -1060,7 +981,7 @@ void Channel::JoinNotify(uint64 guid) void Channel::LeaveNotify(uint64 guid) { - WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1); + WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size()); data << uint64(guid); data << uint8(GetFlags()); data << uint32(GetNumPlayers()); diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index d33a19acc6e..c816cd91257 100755 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -51,10 +51,10 @@ enum ChatNotify // CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s."; CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak."; CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s."; - CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are banned from that channel."; - CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s."; + CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are bannedStore from that channel."; + CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s bannedStore by %s."; CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s."; - CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not banned."; + CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not bannedStore."; CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel."; CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'."; CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s."; @@ -62,7 +62,7 @@ enum ChatNotify CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name"; CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated"; CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel"; - CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been banned."; + CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been bannedStore."; CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message."; CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone. CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels. @@ -145,18 +145,45 @@ class Channel } }; - typedef std::map PlayerList; - PlayerList players; - typedef std::set BannedList; - BannedList banned; - bool m_announce; - bool m_ownership; - std::string m_name; - std::string m_password; - uint8 m_flags; - uint32 m_channelId; - uint64 m_ownerGUID; - bool m_IsSaved; + public: + Channel(std::string const& name, uint32 channel_id, uint32 Team = 0); + std::string const& GetName() const { return _name; } + uint32 GetChannelId() const { return _channelId; } + bool IsConstant() const { return _channelId != 0; } + bool IsAnnounce() const { return _announce; } + bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; } + std::string const& GetPassword() const { return _password; } + void SetPassword(std::string const& npassword) { _password = npassword; } + void SetAnnounce(bool nannounce) { _announce = nannounce; } + uint32 GetNumPlayers() const { return playersStore.size(); } + uint8 GetFlags() const { return _flags; } + bool HasFlag(uint8 flag) const { return _flags & flag; } + + void JoinChannel(Player* player, std::string const& pass); + void LeaveChannel(Player* player, bool send = true); + void KickOrBan(Player const* player, std::string const& badname, bool ban); + void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); } + void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); } + void UnBan(Player const* player, std::string const& badname); + void Password(Player const* player, std::string const& pass); + void SetMode(Player const* player, std::string const& p2n, bool mod, bool set); + void SetOwner(uint64 guid, bool exclaim = true); + void SetOwner(Player const* player, std::string const& name); + void SendWhoOwner(uint64 guid); + void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); } + void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); } + void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); } + void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); } + void List(Player const* player); + void Announce(Player const* player); + void Say(uint64 guid, std::string const& what, uint32 lang); + void Invite(Player const* player, std::string const& newp); + void Voice(uint64 guid1, uint64 guid2); + void DeVoice(uint64 guid1, uint64 guid2); + void JoinNotify(uint64 guid); // invisible notify + void LeaveNotify(uint64 guid); // invisible notify + void SetOwnership(bool ownership) { _ownership = ownership; }; + static void CleanOldChannelsInDB(); private: // initial packet data (notify type and channel name) @@ -197,91 +224,62 @@ class Channel void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22 void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23 - void SendToAll(WorldPacket* data, uint64 p = 0); + void SendToAll(WorldPacket* data, uint64 guid = 0); void SendToAllButOne(WorldPacket* data, uint64 who); void SendToOne(WorldPacket* data, uint64 who); - bool IsOn(uint64 who) const { return players.find(who) != players.end(); } - bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); } + bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); } + bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); } void UpdateChannelInDB() const; void UpdateChannelUseageInDB() const; - uint8 GetPlayerFlags(uint64 p) const + uint8 GetPlayerFlags(uint64 guid) const { - PlayerList::const_iterator p_itr = players.find(p); - if (p_itr == players.end()) - return 0; - - return p_itr->second.flags; + PlayerContainer::const_iterator itr = playersStore.find(guid); + return itr != playersStore.end() ? itr->second.flags : 0; } - void SetModerator(uint64 p, bool set) + void SetModerator(uint64 guid, bool set) { - if (players[p].IsModerator() != set) + if (playersStore[guid].IsModerator() != set) { - uint8 oldFlag = GetPlayerFlags(p); - players[p].SetModerator(set); + uint8 oldFlag = GetPlayerFlags(guid); + playersStore[guid].SetModerator(set); WorldPacket data; - MakeModeChange(&data, p, oldFlag); + MakeModeChange(&data, guid, oldFlag); SendToAll(&data); } } - void SetMute(uint64 p, bool set) + void SetMute(uint64 guid, bool set) { - if (players[p].IsMuted() != set) + if (playersStore[guid].IsMuted() != set) { - uint8 oldFlag = GetPlayerFlags(p); - players[p].SetMuted(set); + uint8 oldFlag = GetPlayerFlags(guid); + playersStore[guid].SetMuted(set); WorldPacket data; - MakeModeChange(&data, p, oldFlag); + MakeModeChange(&data, guid, oldFlag); SendToAll(&data); } } - public: - uint32 m_Team; - Channel(std::string const& name, uint32 channel_id, uint32 Team = 0); - std::string const& GetName() const { return m_name; } - uint32 GetChannelId() const { return m_channelId; } - bool IsConstant() const { return m_channelId != 0; } - bool IsAnnounce() const { return m_announce; } - bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; } - std::string const& GetPassword() const { return m_password; } - void SetPassword(std::string const& npassword) { m_password = npassword; } - void SetAnnounce(bool nannounce) { m_announce = nannounce; } - uint32 GetNumPlayers() const { return players.size(); } - uint8 GetFlags() const { return m_flags; } - bool HasFlag(uint8 flag) const { return m_flags & flag; } + typedef std::map PlayerContainer; + typedef std::set BannedContainer; - void Join(uint64 p, const char *pass); - void Leave(uint64 p, bool send = true); - void KickOrBan(uint64 good, const char *badname, bool ban); - void Kick(uint64 good, const char *badname) { KickOrBan(good, badname, false); } - void Ban(uint64 good, const char *badname) { KickOrBan(good, badname, true); } - void UnBan(uint64 good, const char *badname); - void Password(uint64 p, const char *pass); - void SetMode(uint64 p, const char *p2n, bool mod, bool set); - void SetOwner(uint64 p, bool exclaim = true); - void SetOwner(uint64 p, const char *newname); - void SendWhoOwner(uint64 p); - void SetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, true); } - void UnsetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, false); } - void SetMute(uint64 p, const char *newname) { SetMode(p, newname, false, true); } - void UnsetMute(uint64 p, const char *newname) { SetMode(p, newname, false, false); } - void List(Player* p); - void Announce(uint64 p); - void Say(uint64 p, const char *what, uint32 lang); - void Invite(uint64 p, const char *newp); - void Voice(uint64 guid1, uint64 guid2); - void DeVoice(uint64 guid1, uint64 guid2); - void JoinNotify(uint64 guid); // invisible notify - void LeaveNotify(uint64 guid); // invisible notify - void SetOwnership(bool ownership) { m_ownership = ownership; }; - static void CleanOldChannelsInDB(); + bool _announce; + bool _ownership; + bool _IsSaved; + uint8 _flags; + uint32 _channelId; + uint32 _Team; + uint64 _ownerGUID; + std::string _name; + std::string _password; + PlayerContainer playersStore; + BannedContainer bannedStore; }; #endif diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 66111e5a6db..bcb9ee61b78 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -35,6 +35,7 @@ ChannelMgr* ChannelMgr::forTeam(uint32 team) if (team == ALLIANCE) return ACE_Singleton::instance(); + if (team == HORDE) return ACE_Singleton::instance(); @@ -78,8 +79,8 @@ Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pk return NULL; } - else - return i->second; + + return i->second; } void ChannelMgr::LeftChannel(std::string const& name) @@ -95,7 +96,7 @@ void ChannelMgr::LeftChannel(std::string const& name) Channel* channel = i->second; - if (channel->GetNumPlayers() == 0 && !channel->IsConstant()) + if (!channel->GetNumPlayers() && !channel->IsConstant()) { channels.erase(wname); delete channel; @@ -104,6 +105,6 @@ void ChannelMgr::LeftChannel(std::string const& name) void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name) { - data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size - (*data) << (uint8)0x05 << name; + data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size()); + (*data) << uint8(5) << name; } diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index 8b9346be815..a9c72e1112e 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -75,7 +75,7 @@ inline bool CheckDelimiter(std::istringstream& iss, char delimiter, const char* char c = iss.peek(); if (c != delimiter) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c); return false; } iss.ignore(1); @@ -109,20 +109,20 @@ bool ItemChatLink::Initialize(std::istringstream& iss) uint32 itemEntry = 0; if (!ReadUInt32(iss, itemEntry)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str()); return false; } // Validate item _item = sObjectMgr->GetItemTemplate(itemEntry); if (!_item) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry); return false; } // Validate item's color if (_color != ItemQualityColors[_item->Quality]) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color); return false; } // Number of various item properties after item entry @@ -136,7 +136,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) int32 id = 0; if (!ReadInt32(iss, id)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index); return false; } if (id && (index == randomPropertyPosition)) @@ -147,7 +147,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) _property = sItemRandomPropertiesStore.LookupEntry(id); if (!_property) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id); return false; } } @@ -156,7 +156,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) _suffix = sItemRandomSuffixStore.LookupEntry(-id); if (!_suffix) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id); return false; } } @@ -198,7 +198,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) } } if (!res) - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId); return res; } @@ -210,14 +210,14 @@ bool QuestChatLink::Initialize(std::istringstream& iss) uint32 questId = 0; if (!ReadUInt32(iss, questId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str()); return false; } // Validate quest _quest = sObjectMgr->GetQuestTemplate(questId); if (!_quest) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId); return false; } // Check delimiter @@ -226,13 +226,13 @@ bool QuestChatLink::Initialize(std::istringstream& iss) // Read quest level if (!ReadInt32(iss, _questLevel)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str()); return false; } // Validate quest level if (_questLevel >= STRONG_MAX_LEVEL) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel); return false; } return true; @@ -252,7 +252,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context) break; } if (!res) - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId()); return res; } @@ -266,14 +266,14 @@ bool SpellChatLink::Initialize(std::istringstream& iss) uint32 spellId = 0; if (!ReadUInt32(iss, spellId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str()); return false; } // Validate spell _spell = sSpellMgr->GetSpellInfo(spellId); if (!_spell) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId); return false; } return true; @@ -289,19 +289,19 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context) SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(_spell->Id); if (bounds.first == bounds.second) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id); return false; } SkillLineAbilityEntry const* skillInfo = bounds.first->second; if (!skillInfo) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id); return false; } SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); if (!skillLine) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId); return false; } @@ -327,7 +327,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context) } if (!res) - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id); return res; } @@ -341,14 +341,14 @@ bool AchievementChatLink::Initialize(std::istringstream& iss) uint32 achievementId = 0; if (!ReadUInt32(iss, achievementId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); return false; } // Validate achievement _achievement = sAchievementStore.LookupEntry(achievementId); if (!_achievement) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId); return false; } // Check delimiter @@ -357,7 +357,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss) // Read HEX if (!ReadHex(iss, _guid, 0)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str()); return false; } // Skip progress @@ -369,7 +369,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss) if (!ReadUInt32(iss, _data[index])) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index); return false; } } @@ -389,7 +389,7 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context) } if (!res) - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID); return res; } @@ -403,14 +403,14 @@ bool TradeChatLink::Initialize(std::istringstream& iss) uint32 spellId = 0; if (!ReadUInt32(iss, spellId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); return false; } // Validate spell _spell = sSpellMgr->GetSpellInfo(spellId); if (!_spell) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId); return false; } // Check delimiter @@ -419,7 +419,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss) // Minimum talent level if (!ReadInt32(iss, _minSkillLevel)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str()); return false; } // Check delimiter @@ -428,7 +428,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss) // Maximum talent level if (!ReadInt32(iss, _maxSkillLevel)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str()); return false; } // Check delimiter @@ -437,7 +437,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss) // Something hexadecimal if (!ReadHex(iss, _guid, 0)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str()); return false; } // Skip base64 encoded stuff @@ -454,21 +454,21 @@ bool TalentChatLink::Initialize(std::istringstream& iss) // Read talent entry if (!ReadUInt32(iss, _talentId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str()); return false; } // Validate talent TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId); if (!talentInfo) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId); return false; } // Validate talent's spell _spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]); if (!_spell) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]); return false; } // Delimiter @@ -477,7 +477,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss) // Rank if (!ReadInt32(iss, _rankId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str()); return false; } return true; @@ -493,14 +493,14 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss) uint32 spellId = 0; if (!ReadUInt32(iss, spellId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str()); return false; } // Validate spell _spell = sSpellMgr->GetSpellInfo(spellId); if (!_spell) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId); return false; } return true; @@ -515,7 +515,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss) // Slot if (!ReadUInt32(iss, _slotId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str()); return false; } // Check delimiter @@ -525,21 +525,21 @@ bool GlyphChatLink::Initialize(std::istringstream& iss) uint32 glyphId = 0; if (!ReadUInt32(iss, glyphId)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str()); return false; } // Validate glyph _glyph = sGlyphPropertiesStore.LookupEntry(glyphId); if (!_glyph) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId); return false; } // Validate glyph's spell _spell = sSpellMgr->GetSpellInfo(_glyph->SpellId); if (!_spell) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId); return false; } return true; @@ -577,14 +577,14 @@ bool LinkExtractor::IsValidMessage() } else if (_iss.get() != PIPE_CHAR) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str()); return false; } // pipe has always to be followed by at least one char if (_iss.peek() == '\0') { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str()); return false; } @@ -607,14 +607,14 @@ bool LinkExtractor::IsValidMessage() } else { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar); return false; } } else if (validSequence != validSequenceIterator) { // no escaped pipes in sequences - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str()); return false; } @@ -623,7 +623,7 @@ bool LinkExtractor::IsValidMessage() case 'c': if (!ReadHex(_iss, color, 8)) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str()); return false; } break; @@ -632,7 +632,7 @@ bool LinkExtractor::IsValidMessage() _iss.getline(buffer, 256, DELIMITER); if (_iss.eof()) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); return false; } @@ -654,7 +654,7 @@ bool LinkExtractor::IsValidMessage() link = new GlyphChatLink(); else { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer); return false; } _links.push_back(link); @@ -669,13 +669,13 @@ bool LinkExtractor::IsValidMessage() // links start with '[' if (_iss.get() != '[') { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str()); return false; } _iss.getline(buffer, 256, ']'); if (_iss.eof()) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); return false; } @@ -693,7 +693,7 @@ bool LinkExtractor::IsValidMessage() // no further payload break; default: - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar); return false; } } @@ -701,7 +701,7 @@ bool LinkExtractor::IsValidMessage() // check if every opened sequence was also closed properly if (validSequence != validSequenceIterator) { - sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str()); + sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str()); return false; } diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 135a0b7fb92..9c023d1daf8 100755 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -18,8 +18,9 @@ #ifndef _LFGMGR_H #define _LFGMGR_H -#include "Common.h" #include +#include "DBCStructure.h" +#include "Field.h" #include "LFG.h" #include "LFGQueue.h" #include "LFGGroupData.h" diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 973eca27c56..dd9907d8c07 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5585,11 +5585,11 @@ void Player::CleanupChannels() { Channel* ch = *m_channels.begin(); m_channels.erase(m_channels.begin()); // remove from player's channel list - ch->Leave(GetGUID(), false); // not send to client, not remove from player's channel list + ch->LeaveChannel(this, false); // not send to client, not remove from player's channel list if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam())) cMgr->LeftChannel(ch->GetName()); // deleted channel if empty } - sLog->outDebug(LOG_FILTER_CHATSYS, "Player: channels cleaned up!"); + sLog->outDebug(LOG_FILTER_CHATSYS, "Player %s: channels cleaned up!", GetName().c_str()); } void Player::UpdateLocalChannels(uint32 newZone) @@ -5662,11 +5662,11 @@ void Player::UpdateLocalChannels(uint32 newZone) removeChannel = usedChannel; if (joinChannel) - joinChannel->Join(GetGUID(), ""); // Changed Channel: ... or Joined Channel: ... + joinChannel->JoinChannel(this, ""); // Changed Channel: ... or Joined Channel: ... if (removeChannel) { - removeChannel->Leave(GetGUID(), sendRemove); // Leave old channel + removeChannel->LeaveChannel(this, sendRemove); // Leave old channel std::string name = removeChannel->GetName(); // Store name, (*i)erase in LeftChannel LeftChannel(removeChannel); // Remove from player's channel list cMgr->LeftChannel(name); // Delete if empty @@ -5681,7 +5681,7 @@ void Player::LeaveLFGChannel() { if ((*i)->IsLFG()) { - (*i)->Leave(GetGUID()); + (*i)->LeaveChannel(this); break; } } @@ -5689,13 +5689,8 @@ void Player::LeaveLFGChannel() void Player::UpdateDefense() { - uint32 defense_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE); - - if (UpdateSkill(SKILL_DEFENSE, defense_skill_gain)) - { - // update dependent from defense skill part - UpdateDefenseBonusesMod(); - } + if (UpdateSkill(SKILL_DEFENSE, sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE))) + UpdateDefenseBonusesMod(); // update dependent from defense skill part } void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply) @@ -21720,7 +21715,7 @@ bool Player::IsAlwaysDetectableFor(WorldObject const* seer) const return false; } -bool Player::IsVisibleGloballyFor(Player* u) const +bool Player::IsVisibleGloballyFor(Player const* u) const { if (!u) return false; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 3ff70e76cec..3e4b3e8a971 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2317,7 +2317,7 @@ class Player : public Unit, public GridObject bool IsNeverVisible() const; - bool IsVisibleGloballyFor(Player* player) const; + bool IsVisibleGloballyFor(Player const* player) const; void SendInitialVisiblePackets(Unit* target); void UpdateObjectVisibility(bool forced = true); diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index dd5d08eb3fc..462bc7fff0b 100755 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -22,249 +22,252 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - - uint32 channel_id; + uint32 channelId; uint8 unknown1, unknown2; - std::string channelname, pass; + std::string channelName, password; + + recvPacket >> channelId >> unknown1 >> unknown2 >> channelName >> password; - recvPacket >> channel_id; - recvPacket >> unknown1 >> unknown2; - recvPacket >> channelname; - recvPacket >> pass; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s", + GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str()); - if (channel_id) + if (channelId) { - ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channel_id); + ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channelId); if (!channel) return; - AreaTableEntry const* current_zone = GetAreaEntryByAreaID(_player->GetZoneId()); - if (!current_zone) - return; - - if (!_player->CanJoinConstantChannelInZone(channel, current_zone)) + AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId()); + if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone)) return; } - if (channelname.empty()) + if (channelName.empty()) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) { - cMgr->setTeam(_player->GetTeam()); - if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id)) - chn->Join(_player->GetGUID(), pass.c_str()); + cMgr->setTeam(GetPlayer()->GetTeam()); + if (Channel* channel = cMgr->GetJoinChannel(channelName, channelId)) + channel->JoinChannel(GetPlayer(), password); } } void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - uint32 unk; - std::string channelname; - recvPacket >> unk; // channel id? - recvPacket >> channelname; + std::string channelName; + recvPacket >> unk >> channelName; - if (channelname.empty()) + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u", + GetPlayerInfo().c_str(), channelName.c_str(), unk); + + if (channelName.empty()) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) { - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->Leave(_player->GetGUID(), true); - cMgr->LeftChannel(channelname); + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->LeaveChannel(GetPlayer(), true); + cMgr->LeftChannel(channelName); } } void WorldSession::HandleChannelList(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname; - recvPacket >> channelname; + std::string channelName; + recvPacket >> channelName; + + sLog->outDebug(LOG_FILTER_CHATSYS, "%s %s Channel: %s", + recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST", + GetPlayerInfo().c_str(), channelName.c_str()); - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->List(_player); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->List(GetPlayer()); } void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, pass; - recvPacket >> channelname; + std::string channelName, password; + recvPacket >> channelName >> password; - recvPacket >> pass; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s", + GetPlayerInfo().c_str(), channelName.c_str(), password.c_str()); - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->Password(_player->GetGUID(), pass.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->Password(GetPlayer(), password); } void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, newp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> newp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(newp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->SetOwner(_player->GetGUID(), newp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->SetOwner(GetPlayer(), targetName); } void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname; - recvPacket >> channelname; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->SendWhoOwner(_player->GetGUID()); + std::string channelName; + recvPacket >> channelName; + + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s", + GetPlayerInfo().c_str(), channelName.c_str()); + + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->SendWhoOwner(GetPlayer()->GetGUID()); } void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->SetModerator(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->SetModerator(GetPlayer(), targetName); } void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->UnsetModerator(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->UnsetModerator(GetPlayer(), targetName); } void WorldSession::HandleChannelMute(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->SetMute(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->SetMute(GetPlayer(), targetName); } void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->UnsetMute(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->UnsetMute(GetPlayer(), targetName); } void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->Invite(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->Invite(GetPlayer(), targetName); } void WorldSession::HandleChannelKick(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; - if (!normalizePlayerName(otp)) + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); + + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->Kick(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->Kick(GetPlayer(), targetName); } void WorldSession::HandleChannelBan(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->Ban(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->Ban(GetPlayer(), targetName); } void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - - std::string channelname, otp; - recvPacket >> channelname; + std::string channelName, targetName; + recvPacket >> channelName >> targetName; - recvPacket >> otp; + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s", + GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); - if (!normalizePlayerName(otp)) + if (!normalizePlayerName(targetName)) return; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->UnBan(_player->GetGUID(), otp.c_str()); + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->UnBan(GetPlayer(), targetName); } void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname; - recvPacket >> channelname; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->Announce(_player->GetGUID()); + std::string channelName; + recvPacket >> channelName; + + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s", + GetPlayerInfo().c_str(), channelName.c_str()); + + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->Announce(GetPlayer()); } void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) @@ -275,17 +278,23 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname; - recvPacket >> channelname; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) + std::string channelName; + recvPacket >> channelName; + + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s", + GetPlayerInfo().c_str(), channelName.c_str()); + + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) { - if (Channel* chn = cMgr->GetChannel(channelname, _player)) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) { - WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4); - data << chn->GetName(); - data << uint8(chn->GetFlags()); - data << uint32(chn->GetNumPlayers()); + sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u", + GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers()); + + WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, channel->GetName().size() + 1 + 4); + data << channel->GetName(); + data << uint8(channel->GetFlags()); + data << uint32(channel->GetNumPlayers()); SendPacket(&data); } } @@ -293,10 +302,15 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - std::string channelname; - recvPacket >> channelname; - /*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel* chn = cMgr->GetChannel(channelname, _player)) - chn->JoinNotify(_player->GetGUID());*/ + std::string channelName; + recvPacket >> channelName; + + sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_SET_CHANNEL_WATCH %s Channel: %s", + GetPlayerInfo().c_str(), channelName.c_str()); + + /* + if (ChannelMgr* cMgr = channelMgr(GetPlayer()->GetTeam())) + if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) + channel->JoinNotify(GetPlayer()); + */ } diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 90e64428fd2..3f33b60329b 100755 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -15,15 +15,13 @@ * with this program. If not, see . */ -#include "WorldSession.h" -#include "WorldPacket.h" -#include "DBCStores.h" -#include "Player.h" -#include "Group.h" #include "LFGMgr.h" #include "ObjectMgr.h" -#include "GroupMgr.h" +#include "Group.h" +#include "Player.h" #include "Opcodes.h" +#include "WorldPacket.h" +#include "WorldSession.h" void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock) { @@ -60,7 +58,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) uint32 roles; recvData >> roles; - recvData.read_skip(); // uint8 (always 0) - uint8 (always 0) + recvData.read_skip(); // uint8 (always 0) - uint8 (always 0) recvData >> numDungeons; if (!numDungeons) { @@ -73,10 +71,10 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) for (int8 i = 0; i < numDungeons; ++i) { recvData >> dungeon; - newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry + newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry } - recvData.read_skip(); // for 0..uint8 (always 3) { uint8 (always 0) } + recvData.read_skip(); // for 0..uint8 (always 3) { uint8 (always 0) } std::string comment; recvData >> comment; @@ -101,7 +99,7 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData) { - uint32 lfgGroupID; // Internal lfgGroupID + uint32 lfgGroupID; // Internal lfgGroupID bool accept; // Accept to join? recvData >> lfgGroupID; recvData >> accept; @@ -114,7 +112,7 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData) void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) { uint8 roles; - recvData >> roles; // Player Group Roles + recvData >> roles; // Player Group Roles uint64 guid = GetPlayer()->GetGUID(); Group* grp = GetPlayer()->GetGroup(); if (!grp) @@ -295,10 +293,9 @@ void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recvData) void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) { - uint64 guid = GetPlayer()->GetGUID(); sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); + uint64 guid = GetPlayer()->GetGUID(); LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid); if (GetPlayer()->GetGroup()) @@ -318,7 +315,6 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData) { bool queued = false; - uint64 guid = GetPlayer()->GetGUID(); uint8 size = uint8(updateData.dungeons.size()); switch (updateData.updateType) @@ -337,13 +333,13 @@ void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData) sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", GetPlayerInfo().c_str(), updateData.updateType); WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); - data << uint8(updateData.updateType); // Lfg Update type - data << uint8(size > 0); // Extra info + data << uint8(updateData.updateType); // Lfg Update type + data << uint8(size > 0); // Extra info if (size) { - data << uint8(queued); // Join the queue - data << uint8(0); // unk - Always 0 - data << uint8(0); // unk - Always 0 + data << uint8(queued); // Join the queue + data << uint8(0); // unk - Always 0 + data << uint8(0); // unk - Always 0 data << uint8(size); for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) @@ -357,12 +353,11 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData) { bool join = false; bool queued = false; - uint64 guid = GetPlayer()->GetGUID(); uint8 size = uint8(updateData.dungeons.size()); switch (updateData.updateType) { - case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success + case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success queued = true; // no break on purpose case LFG_UPDATETYPE_PROPOSAL_BEGIN: @@ -379,16 +374,16 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData) sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", GetPlayerInfo().c_str(), updateData.updateType); WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); - data << uint8(updateData.updateType); // Lfg Update type - data << uint8(size > 0); // Extra info + data << uint8(updateData.updateType); // Lfg Update type + data << uint8(size > 0); // Extra info if (size) { - data << uint8(join); // LFG Join - data << uint8(queued); // Join the queue - data << uint8(0); // unk - Always 0 - data << uint8(0); // unk - Always 0 + data << uint8(join); // LFG Join + data << uint8(queued); // Join the queue + data << uint8(0); // unk - Always 0 + data << uint8(0); // unk - Always 0 for (uint8 i = 0; i < 3; ++i) - data << uint8(0); // unk - Always 0 + data << uint8(0); // unk - Always 0 data << uint8(size); for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) @@ -443,7 +438,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck) data << uint8(roles > 0); // Ready data << uint32(roles); // Roles Player* player = ObjectAccessor::FindPlayer(guid); - data << uint8(player ? player->getLevel() : 0); // Level + data << uint8(player ? player->getLevel() : 0); // Level for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) { @@ -456,7 +451,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck) data << uint8(roles > 0); // Ready data << uint32(roles); // Roles player = ObjectAccessor::FindPlayer(guid); - data << uint8(player ? player->getLevel() : 0); // Level + data << uint8(player ? player->getLevel() : 0);// Level } } SendPacket(&data); @@ -606,11 +601,11 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p } else { - data << uint8(player.group == proposal.group); // In dungeon (silent) - data << uint8(player.group == gguid); // Same Group than player + data << uint8(player.group == proposal.group); // In dungeon (silent) + data << uint8(player.group == gguid); // Same Group than player } - data << uint8(player.accept != LFG_ANSWER_PENDING); // Answered - data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted + data << uint8(player.accept != LFG_ANSWER_PENDING);// Answered + data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted } SendPacket(&data); } -- cgit v1.2.3