From 7fd7fcce93b4215c258e535a072e36da0e1867b0 Mon Sep 17 00:00:00 2001 From: Tartalo Date: Tue, 16 Feb 2010 21:13:40 +0100 Subject: Frozen Halls, Forge of Souls: Boss Bronjahm script --HG-- branch : trunk --- src/scripts/CMakeLists.txt | 1 + .../frozen_halls/forge_of_souls/boss_bronjahm.cpp | 186 +++++++++++++++++++++ .../frozen_halls/forge_of_souls/forge_of_souls.h | 4 + .../forge_of_souls/instance_forge_of_souls.cpp | 5 +- 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 src/scripts/northrend/frozen_halls/forge_of_souls/boss_bronjahm.cpp (limited to 'src') diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 05007138ca7..6fc29306a27 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -327,6 +327,7 @@ SET(scripts_STAT_SRCS northrend/draktharon_keep/boss_tharon_ja.cpp northrend/draktharon_keep/drak_tharon_keep.h northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp + northrend/frozen_halls/forge_of_souls/boss_bronjahm.cpp northrend/frozen_halls/forge_of_souls/forge_of_souls.h northrend/frozen_halls/halls_of_reflection/instance_halls_of_reflection.cpp northrend/frozen_halls/halls_of_reflection/halls_of_reflection.h diff --git a/src/scripts/northrend/frozen_halls/forge_of_souls/boss_bronjahm.cpp b/src/scripts/northrend/frozen_halls/forge_of_souls/boss_bronjahm.cpp new file mode 100644 index 00000000000..fe515516a68 --- /dev/null +++ b/src/scripts/northrend/frozen_halls/forge_of_souls/boss_bronjahm.cpp @@ -0,0 +1,186 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ScriptedPch.h" +#include "forge_of_souls.h" + +enum Spells +{ + SPELL_MAGIC_S_BANE = 68793, + SPELL_MAGIC_S_BANE_H = 69050, + SPELL_CORRUPT_SOUL = 68839, + SPELL_CONSUME_SOUL = 68858, + SPELL_CONSUME_SOUL_H = 69047, + SPELL_TELEPORT = 68988, + SPELL_FEAR = 68950, + SPELL_SOULSTORM = 68872, + SPELL_SOULSTORM_H = 69049, + SPELL_SHADOW_BOLT = 70043 +}; +enum CombatPhases +{ + PHASE_1, + PHASE_2 +}; +/*enum Adds +{ + CREATURE_CORRUPTED_SOUL_FRAGMENT = 36535 +};*/ +struct boss_bronjahmAI : public ScriptedAI +{ + boss_bronjahmAI(Creature *c) : ScriptedAI(c) + { + pInstance = m_creature->GetInstanceData(); + } + + uint32 uiFearTimer; + uint32 uiShadowBoltTimer; + uint32 uiMagicsBaneTimer; + uint32 uiCorruptSoulTimer; + + CombatPhases Phase; + + ScriptedInstance* pInstance; + + void Reset() + { + Phase = PHASE_1; + + uiFearTimer = urand(8000,12000); + uiShadowBoltTimer = 2000; + uiMagicsBaneTimer = urand(8000,15000); + uiCorruptSoulTimer = urand(15000,25000); + + if (pInstance) + pInstance->SetData(DATA_BRONJAHM_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* who) + { + //DoScriptText(SAY_AGGRO, m_creature); + + if (pInstance) + pInstance->SetData(DATA_BRONJAHM_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* killer) + { + //DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_BRONJAHM_EVENT, DONE); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + switch (Phase) + { + case PHASE_1: + if (uiCorruptSoulTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(pTarget,SPELL_CORRUPT_SOUL); + uiCorruptSoulTimer = urand(15000,25000); + } else uiCorruptSoulTimer -= diff; + break; + case PHASE_2: + if (!me->HasAura(SPELL_SOULSTORM) || !me->HasAura(SPELL_SOULSTORM_H)) + DoCast(m_creature, DUNGEON_MODE(SPELL_SOULSTORM,SPELL_SOULSTORM_H)); + if (uiFearTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(m_creature->getVictim(),SPELL_FEAR); + uiFearTimer = urand(8000,12000); + } else uiFearTimer -= diff; + break; + } + + if (HealthBelowPct(30)) + DoCast(m_creature,SPELL_TELEPORT); + + if (uiShadowBoltTimer <= diff) + { + if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + DoCastVictim(SPELL_SHADOW_BOLT); + uiShadowBoltTimer = 2000; + } else uiShadowBoltTimer -= diff; + + if (uiMagicsBaneTimer <= diff) + { + DoCastVictim(DUNGEON_MODE(SPELL_MAGIC_S_BANE,SPELL_MAGIC_S_BANE_H)); + uiMagicsBaneTimer = urand(8000,15000); + } else uiMagicsBaneTimer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_bronjahm(Creature* pCreature) +{ + return new boss_bronjahmAI(pCreature); +} + +struct mob_corrupted_soul_fragmentAI : public ScriptedAI +{ + mob_corrupted_soul_fragmentAI(Creature *c) : ScriptedAI(c) + { + pInstance = m_creature->GetInstanceData(); + } + + ScriptedInstance* pInstance; + + void Reset() + { + SetCombatMovement(false); + if (pInstance) + if (Creature* pBronjham = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_BRONJAHM))) + m_creature->GetMotionMaster()->MoveChase(pBronjham); + + } + + void MovementInform(uint32 type, uint32 id) + { + if (pInstance) + if (Creature* pBronjham = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_BRONJAHM))) + DoCast(pBronjham,DUNGEON_MODE(SPELL_CONSUME_SOUL,SPELL_CONSUME_SOUL_H)); + } + + void UpdateAI(const uint32 diff) {} +}; + +CreatureAI* GetAI_mob_corrupted_soul_fragment(Creature* pCreature) +{ + return new mob_corrupted_soul_fragmentAI(pCreature); +} + +void AddSC_boss_bronjahm() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "mob_corruptel_soul_fragment"; + newscript->GetAI = &GetAI_mob_corrupted_soul_fragment; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_bronjahm"; + newscript->GetAI = &GetAI_boss_bronjahm; + newscript->RegisterSelf(); +} \ No newline at end of file diff --git a/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h b/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h index d50716c9e39..e48d5934cb8 100644 --- a/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h +++ b/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h @@ -5,6 +5,10 @@ enum Data DATA_BRONJAHM_EVENT, DATA_DEVOURER_EVENT }; +enum Data64 +{ + DATA_BRONJAHM +}; enum Creatures { CREATURE_BRONJAHM = 36497, diff --git a/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp b/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp index 2ac41f59c8f..a7aea8e21a1 100644 --- a/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp +++ b/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp @@ -72,16 +72,17 @@ struct instance_forge_of_souls : public ScriptedInstance return 0; } -/* + uint64 GetData64(uint32 identifier) { switch(identifier) { + case DATA_BRONJAHM: return uiBronjahm; } return 0; } -*/ + std::string GetSaveData() { OUT_SAVE_INST_DATA; -- cgit v1.2.3 From 15ef0c79d246bdeafe69837ec4fa39370a9e806d Mon Sep 17 00:00:00 2001 From: Tartalo Date: Tue, 16 Feb 2010 21:14:56 +0100 Subject: Frozen Halls, Forge of Souls: Add GPL note --HG-- branch : trunk --- .../frozen_halls/forge_of_souls/forge_of_souls.h | 16 ++++++++++++++++ .../forge_of_souls/instance_forge_of_souls.cpp | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h b/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h index e48d5934cb8..6f7a3987cee 100644 --- a/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h +++ b/src/scripts/northrend/frozen_halls/forge_of_souls/forge_of_souls.h @@ -1,3 +1,19 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef DEF_FORGE_OF_SOULS_H #define DEF_FORGE_OF_SOULS_H enum Data diff --git a/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp b/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp index a7aea8e21a1..2f038e178ca 100644 --- a/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp +++ b/src/scripts/northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp @@ -1,3 +1,19 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "ScriptedPch.h" #include "forge_of_souls.h" -- cgit v1.2.3 From d45342807db6e928579d83ef61c1a8b431d0ac82 Mon Sep 17 00:00:00 2001 From: Tartalo Date: Tue, 16 Feb 2010 21:15:28 +0100 Subject: Frozen Halls, Halls of Reflection: add GPL note --HG-- branch : trunk --- .../halls_of_reflection/halls_of_reflection.h | 16 ++++++++++++++++ .../halls_of_reflection/instance_halls_of_reflection.cpp | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/scripts/northrend/frozen_halls/halls_of_reflection/halls_of_reflection.h b/src/scripts/northrend/frozen_halls/halls_of_reflection/halls_of_reflection.h index 8241c6bb608..ac7ddc09b6d 100644 --- a/src/scripts/northrend/frozen_halls/halls_of_reflection/halls_of_reflection.h +++ b/src/scripts/northrend/frozen_halls/halls_of_reflection/halls_of_reflection.h @@ -1,3 +1,19 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef DEF_HALLS_OF_REFLECTION_H #define DEF_HALLS_OF_REFLECTION_H enum Data diff --git a/src/scripts/northrend/frozen_halls/halls_of_reflection/instance_halls_of_reflection.cpp b/src/scripts/northrend/frozen_halls/halls_of_reflection/instance_halls_of_reflection.cpp index 45bd4cb7514..5caf2351843 100644 --- a/src/scripts/northrend/frozen_halls/halls_of_reflection/instance_halls_of_reflection.cpp +++ b/src/scripts/northrend/frozen_halls/halls_of_reflection/instance_halls_of_reflection.cpp @@ -1,3 +1,19 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "ScriptedPch.h" #include "halls_of_reflection.h" -- cgit v1.2.3 From 5021d44e8f9e236679310d25e6030971905277be Mon Sep 17 00:00:00 2001 From: Tartalo Date: Tue, 16 Feb 2010 21:15:56 +0100 Subject: Frozen Halls, Pit of Saron: add GPL note --HG-- branch : trunk --- .../frozen_halls/pit_of_saron/instance_pit_of_saron.cpp | 16 ++++++++++++++++ .../northrend/frozen_halls/pit_of_saron/pit_of_saron.h | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/scripts/northrend/frozen_halls/pit_of_saron/instance_pit_of_saron.cpp b/src/scripts/northrend/frozen_halls/pit_of_saron/instance_pit_of_saron.cpp index 55ee4b6cc3f..908eaf8f669 100644 --- a/src/scripts/northrend/frozen_halls/pit_of_saron/instance_pit_of_saron.cpp +++ b/src/scripts/northrend/frozen_halls/pit_of_saron/instance_pit_of_saron.cpp @@ -1,3 +1,19 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "ScriptedPch.h" #include "pit_of_saron.h" diff --git a/src/scripts/northrend/frozen_halls/pit_of_saron/pit_of_saron.h b/src/scripts/northrend/frozen_halls/pit_of_saron/pit_of_saron.h index 7d61b30ac07..97a9ff7d8f0 100644 --- a/src/scripts/northrend/frozen_halls/pit_of_saron/pit_of_saron.h +++ b/src/scripts/northrend/frozen_halls/pit_of_saron/pit_of_saron.h @@ -1,3 +1,19 @@ +/* Copyright (C) 2006 - 2010 TrinityCore + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef DEF_PIT_OF_SARON_H #define DEF_PIT_OF_SARON_H enum Data -- cgit v1.2.3 From 667c4b694f6564ad8a392a498884255bb451407e Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 16 Feb 2010 15:26:40 -0700 Subject: * Updated DBC count to the actual number being used by the core. * Solves 102% issue on DBC loading --HG-- branch : trunk --- src/game/DBCStores.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 3056b863516..f0cfec6e40b 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -218,7 +218,7 @@ void LoadDBCStores(const std::string& dataPath) { std::string dbcPath = dataPath+"dbc/"; - const uint32 DBCFilesCount = 84; + const uint32 DBCFilesCount = 85; barGoLink bar(DBCFilesCount); -- cgit v1.2.3 From 6cdacbd313fa6f426ada895feead584797ff8caf Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 16 Feb 2010 15:36:19 -0700 Subject: * Removed hack for summon water elemental * Proper handling for Glyph of Eternal Water * Summoned water elemental still doesn't last forever, but the right spells * are cast in the right situations. * Credits to Edrinn --HG-- branch : trunk --- sql/updates/7370_world_spell_linked_spell.sql | 2 ++ src/game/Spell.cpp | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 sql/updates/7370_world_spell_linked_spell.sql (limited to 'src') diff --git a/sql/updates/7370_world_spell_linked_spell.sql b/sql/updates/7370_world_spell_linked_spell.sql new file mode 100644 index 00000000000..2c6910501ab --- /dev/null +++ b/sql/updates/7370_world_spell_linked_spell.sql @@ -0,0 +1,2 @@ +-- Remove hack for glyph of Eternal Water +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=31687 AND `spell_effect`=70907; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3451e75c571..9cf135b113d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3000,6 +3000,12 @@ void Spell::cast(bool skipCheck) else m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true); } + // Summon Water Elemental - handling for Glyph of Eternal Water + if (m_spellInfo->id == 31687) + if (m_caster->HasAura(70937)) + m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, 70908, true); + else + m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, 70907, true); if (m_caster->GetTypeId() == TYPEID_PLAYER) ((Player*)m_caster)->SetSpellModTakingSpell(this, false); -- cgit v1.2.3 From 9dad3d2a99c678a52e8c1269a666dd044391bbe3 Mon Sep 17 00:00:00 2001 From: raczman Date: Wed, 17 Feb 2010 00:22:11 +0100 Subject: Removed debug comments that weren't meant to leave dev repo. --HG-- branch : trunk --- src/game/BattleGroundSA.cpp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index ce2e9e0611e..f1ba5157f8e 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -24,24 +24,9 @@ #include "ObjectMgr.h" #include "WorldPacket.h" -/* - The crap needs shitload of DB data fixed, will paste it here: - - Cannons: - update creature_template set IconName = "Gunner" where entry = 27894; - UPDATE `creature_template` SET `vehicleid`=160 WHERE `entry`=27894; - ^^ Sniffed by el manuel, should be good. - UPDATE `creature_template` SET `spell1`=49872 WHERE `entry`=27894; - UPDATE `creature_template` set `unit_flags`=`unit_flags`|4 WHERE `entry`=27894; - - UPDATE `creature_template` SET `vehicleid`=158 WHERE `entry`=28781; - UPDATE `creature_template` set `spell1=49872 where `entry`=32795; - UPDATE `creature_template` set `spell1=52338,`spell2`=60206 where `entry`=32796; - */ BattleGroundSA::BattleGroundSA() { - //TODO FIX ME! m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; @@ -53,7 +38,7 @@ BattleGroundSA::BattleGroundSA() BattleGroundSA::~BattleGroundSA() { - sLog.outError("SOTA ZDYCHA: \n%u %u\n %u %u",BG_SA_MAXOBJ,m_BgObjects.size(),BG_SA_MAXNPC,m_BgCreatures.size()); + } void BattleGroundSA::Reset() @@ -79,7 +64,7 @@ bool BattleGroundSA::ResetObjs() uint32 atF = BG_SA_Factions[attackers]; uint32 defF = BG_SA_Factions[attackers ? TEAM_ALLIANCE : TEAM_HORDE]; - sLog.outError("SOTA: Attacking team: %u %u %u",attackers,atF,defF); + for(uint8 i = 0; i SetUInt32Value(GAMEOBJECT_FACTION, defF); @@ -159,7 +143,6 @@ bool BattleGroundSA::ResetObjs() else { GraveyardStatus[i] = ((attackers == TEAM_HORDE )? TEAM_ALLIANCE : TEAM_HORDE); - sLog.outError("SOTA: Spawning GY %u %f %f %f team %u",i,sg->x,sg->y,sg->z,GraveyardStatus[i]); if(!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) )) { sLog.outError("SOTA: couldn't spawn GY: %u",i); @@ -231,7 +214,6 @@ void BattleGroundSA::StartShips() { if(ShipsStarted) return; - sLog.outError("SOTA: Starting boats!"); DoorOpen(BG_SA_BOAT_ONE); DoorOpen(BG_SA_BOAT_TWO); @@ -322,9 +304,6 @@ void BattleGroundSA::FillInitialWorldStates(WorldPacket& data) uint32 ally_attacks = uint32(attackers == TEAM_ALLIANCE ? 1 : 0); uint32 horde_attacks = uint32(attackers == TEAM_HORDE ? 1 : 0); - for(uint8 i = 0; i < BG_SA_MAX_GY; i++) - sLog.outError("UWS: %u",GraveyardStatus[i]); - data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]); data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]); data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]); @@ -441,7 +420,6 @@ void BattleGroundSA::TeleportPlayers() void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint32 event) { - sLog.outError("SOTA: EventGO %u",event); switch(event) { @@ -540,7 +518,6 @@ void BattleGroundSA::DestroyGate(uint32 i, Player* pl) if(i < 5) DelObject(i+9); - sLog.outError("SOTA: gate %u destroyed!",i+1); UpdateWorldState(uws, GateStatus[i]); UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1); } @@ -625,7 +602,6 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i) switch(i) { case BG_SA_LEFT_CAPTURABLE_GY: - sLog.outError("LEFT GY"); SpawnBGObject(BG_SA_LEFT_FLAG,RESPAWN_ONE_DAY); npc = BG_SA_NPC_RIGSPARK; AddCreature(BG_SA_NpcEntries[npc], npc, attackers, @@ -635,7 +611,6 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i) UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); break; case BG_SA_RIGHT_CAPTURABLE_GY: - sLog.outError("RIGHT GY"); SpawnBGObject(BG_SA_RIGHT_FLAG, RESPAWN_ONE_DAY); npc = BG_SA_NPC_SPARKLIGHT; AddCreature(BG_SA_NpcEntries[npc], npc, attackers, @@ -662,7 +637,6 @@ void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object) if(object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC]) { - sLog.outError("SOTA: Match ended."); if(Source->GetTeamId() == attackers) { -- cgit v1.2.3 From 97c62f2c737d5576cc632c2ef18f659bff2cc261 Mon Sep 17 00:00:00 2001 From: raczman Date: Wed, 17 Feb 2010 00:48:32 +0100 Subject: Compile fix. Whoever pushed that, *PLEASE* do a test compile before pushing. --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 9cf135b113d..229f40bb3c1 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3001,7 +3001,7 @@ void Spell::cast(bool skipCheck) m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true); } // Summon Water Elemental - handling for Glyph of Eternal Water - if (m_spellInfo->id == 31687) + if (m_spellInfo->Id == 31687) if (m_caster->HasAura(70937)) m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, 70908, true); else -- cgit v1.2.3 From 08c6dae672257b5ccc9cca48b04dbec2e344fbf8 Mon Sep 17 00:00:00 2001 From: Tartalo Date: Wed, 17 Feb 2010 15:53:16 +0100 Subject: Borean Tundra: Support for quest 11876 'Help Those That Cannot Help Themselves' --HG-- branch : trunk --- sql/updates/7373_world_creature_template.sql | 2 + sql/updates/7373_world_item_template.sql | 2 + src/scripts/northrend/borean_tundra.cpp | 134 +++++++++++++++++++++++++++ src/scripts/world/item_scripts.cpp | 75 +++++++++++++++ 4 files changed, 213 insertions(+) create mode 100644 sql/updates/7373_world_creature_template.sql create mode 100644 sql/updates/7373_world_item_template.sql (limited to 'src') diff --git a/sql/updates/7373_world_creature_template.sql b/sql/updates/7373_world_creature_template.sql new file mode 100644 index 00000000000..e7bd039ddd5 --- /dev/null +++ b/sql/updates/7373_world_creature_template.sql @@ -0,0 +1,2 @@ +UPDATE `creatyre_template` SET `scriptname`='npc_trapped_mammoth_calf' WHERE `entry`=25850; + diff --git a/sql/updates/7373_world_item_template.sql b/sql/updates/7373_world_item_template.sql new file mode 100644 index 00000000000..e9c51195524 --- /dev/null +++ b/sql/updates/7373_world_item_template.sql @@ -0,0 +1,2 @@ +UPDATE `item_template` SET `scriptname`='item_dehta_trap_smasher' WHERE `entry`=35228; + diff --git a/src/scripts/northrend/borean_tundra.cpp b/src/scripts/northrend/borean_tundra.cpp index 0fb147d9d0b..6396b58c1ac 100644 --- a/src/scripts/northrend/borean_tundra.cpp +++ b/src/scripts/northrend/borean_tundra.cpp @@ -1987,6 +1987,135 @@ CreatureAI* GetAI_npc_bonker_togglevolt(Creature* pCreature) return new npc_bonker_togglevoltAI(pCreature); } +/*###### +## Help Those That Cannot Help Themselves, Quest 11876 +######*/ + +enum eHelpThemselves +{ + QUEST_CANNOT_HELP_THEMSELVES = 11876, + GO_MAMMOTH_TRAP_1 = 188022, + GO_MAMMOTH_TRAP_2 = 188024, + GO_MAMMOTH_TRAP_3 = 188025, + GO_MAMMOTH_TRAP_4 = 188026, + GO_MAMMOTH_TRAP_5 = 188027, + GO_MAMMOTH_TRAP_6 = 188028, + GO_MAMMOTH_TRAP_7 = 188029, + GO_MAMMOTH_TRAP_8 = 188030, + GO_MAMMOTH_TRAP_9 = 188031, + GO_MAMMOTH_TRAP_10 = 188032, + GO_MAMMOTH_TRAP_11 = 188033, + GO_MAMMOTH_TRAP_12 = 188034, + GO_MAMMOTH_TRAP_13 = 188035, + GO_MAMMOTH_TRAP_14 = 188036, + GO_MAMMOTH_TRAP_15 = 188037, + GO_MAMMOTH_TRAP_16 = 188038, + GO_MAMMOTH_TRAP_17 = 188039, + GO_MAMMOTH_TRAP_18 = 188040, + GO_MAMMOTH_TRAP_19 = 188041, + GO_MAMMOTH_TRAP_20 = 188042, + GO_MAMMOTH_TRAP_21 = 188043, + GO_MAMMOTH_TRAP_22 = 188044, +}; + +struct npc_trapped_mammoth_calfAI : public ScriptedAI +{ + npc_trapped_mammoth_calfAI(Creature* c) : ScriptedAI(c) {} + + uint32 uiTimer; + bool bStarted; + + void Reset() + { + GameObject *pTrap; + + uiTimer = 1500; + bStarted = false; + + if ((pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_1,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_2,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_3,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_4,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_5,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_6,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_7,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_8,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_9,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_10,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_11,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_12,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_13,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_14,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_15,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_16,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_17,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_18,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_19,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_20,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_21,1.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_22,1.0f))) + pTrap->SetGoState(GO_STATE_ACTIVE); + } + + void UpdateAI(const uint32 diff) + { + if (bStarted) + { + if (uiTimer <= diff) + { + Position pos; + m_creature->GetRandomNearPosition(pos, 10.0f); + m_creature->GetMotionMaster()->MovePoint(0,pos); + bStarted = false; + } + else uiTimer -= diff; + } + } + + void DoAction(const int32 param) + { + if (param == 1) + bStarted = true; + } + + void MovementInform(uint32 uiType, uint32 uiId) + { + GameObject* pTrap; + if (uiType != POINT_MOTION_TYPE) + return; + m_creature->DisappearAndDie(); + + if ((pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_1,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_2,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_3,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_4,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_5,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_6,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_7,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_8,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_9,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_10,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_11,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_12,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_13,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_14,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_15,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_16,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_17,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_18,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_19,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_20,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_21,11.0f)) || + (pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_22,11.0f))) + pTrap->SetLootState(GO_JUST_DEACTIVATED); + } +}; + +CreatureAI* GetAI_npc_trapped_mammoth_calf(Creature* pCreature) +{ + return new npc_trapped_mammoth_calfAI(pCreature); +} + void AddSC_borean_tundra() { Script *newscript; @@ -2122,4 +2251,9 @@ void AddSC_borean_tundra() newscript->GetAI = &GetAI_npc_bonker_togglevolt; newscript->pQuestAccept=&QuestAccept_npc_bonker_togglevolt; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_trapped_mammoth_calf"; + newscript->GetAI = &GetAI_npc_trapped_mammoth_calf; + newscript->RegisterSelf(); } diff --git a/src/scripts/world/item_scripts.cpp b/src/scripts/world/item_scripts.cpp index 658ee379fdf..6787e8df303 100644 --- a/src/scripts/world/item_scripts.cpp +++ b/src/scripts/world/item_scripts.cpp @@ -316,6 +316,76 @@ bool ItemUse_item_petrov_cluster_bombs(Player* pPlayer, Item* pItem, const Spell return false; } +/*###### +# item_dehta_trap_smasher +# For quest 11876, Help Those That Cannot Help Themselves +######*/ +enum eHelpThemselves +{ + QUEST_CANNOT_HELP_THEMSELVES = 11876, + NPC_TRAPPED_MAMMOTH_CALF = 25850, + GO_MAMMOTH_TRAP_1 = 188022, + GO_MAMMOTH_TRAP_2 = 188024, + GO_MAMMOTH_TRAP_3 = 188025, + GO_MAMMOTH_TRAP_4 = 188026, + GO_MAMMOTH_TRAP_5 = 188027, + GO_MAMMOTH_TRAP_6 = 188028, + GO_MAMMOTH_TRAP_7 = 188029, + GO_MAMMOTH_TRAP_8 = 188030, + GO_MAMMOTH_TRAP_9 = 188031, + GO_MAMMOTH_TRAP_10 = 188032, + GO_MAMMOTH_TRAP_11 = 188033, + GO_MAMMOTH_TRAP_12 = 188034, + GO_MAMMOTH_TRAP_13 = 188035, + GO_MAMMOTH_TRAP_14 = 188036, + GO_MAMMOTH_TRAP_15 = 188037, + GO_MAMMOTH_TRAP_16 = 188038, + GO_MAMMOTH_TRAP_17 = 188039, + GO_MAMMOTH_TRAP_18 = 188040, + GO_MAMMOTH_TRAP_19 = 188041, + GO_MAMMOTH_TRAP_20 = 188042, + GO_MAMMOTH_TRAP_21 = 188043, + GO_MAMMOTH_TRAP_22 = 188044, +}; + +bool ItemUse_item_dehta_trap_smasher(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets) +{ + Creature* pMammoth; + GameObject* pTrap; + + if (pPlayer->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) == QUEST_STATUS_INCOMPLETE && + (pMammoth = pPlayer->FindNearestCreature(NPC_TRAPPED_MAMMOTH_CALF,5.0f)) && + ((pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_1,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_2,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_3,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_4,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_5,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_6,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_7,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_8,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_9,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_10,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_11,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_12,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_13,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_14,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_15,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_16,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_17,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_18,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_19,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_20,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_21,5.0f)) || + (pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_22,5.0f)))) + { + pMammoth->AI()->DoAction(1); + pTrap->SetGoState(GO_STATE_READY); + pPlayer->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF,0); + } + + return false; +} + void AddSC_item_scripts() { Script *newscript; @@ -374,4 +444,9 @@ void AddSC_item_scripts() newscript->Name = "item_petrov_cluster_bombs"; newscript->pItemUse = &ItemUse_item_petrov_cluster_bombs; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "item_dehta_trap_smasher"; + newscript->pItemUse = &ItemUse_item_dehta_trap_smasher; + newscript->RegisterSelf(); } -- cgit v1.2.3 From 8930098acbf86a8d1cdc75887b9d38718d6e27aa Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 16 Feb 2010 21:21:52 -0700 Subject: * Add support for CONDITION_QUEST_NONE (14) as a loot condition and gossip * condition. If set the player must never have taken or completed the quest * listed in value1 --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 5 +++++ src/game/ObjectMgr.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index c83026c946e..13f991cd5a3 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7612,6 +7612,11 @@ bool PlayerCondition::Meets(Player const * player) const QuestStatus status = player->GetQuestStatus(value1); return (status == QUEST_STATUS_INCOMPLETE); } + case CONDITION_QUEST_NONE: + { + QuestStatus status = player->GetQuestStatus(value1); + return (status == QUEST_STATUS_NONE); + } case CONDITION_AD_COMMISSION_AURA: { Unit::AuraApplicationMap const& auras = player->GetAppliedAuras(); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 63483958ab0..faa29d4ce7f 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -311,9 +311,10 @@ enum ConditionType CONDITION_NO_AURA = 11, // spell_id effindex CONDITION_ACTIVE_EVENT = 12, // event_id CONDITION_INSTANCE_DATA = 13, // entry data + CONDITION_QUEST_NONE = 14, // quest_id 0 }; -#define MAX_CONDITION 14 // maximum value in ConditionType enum +#define MAX_CONDITION 15 // maximum value in ConditionType enum struct PlayerCondition { -- cgit v1.2.3 From bea79b07112208d5fac892db358b416587668b1a Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 17 Feb 2010 00:51:19 -0700 Subject: * Add error checking for vehicle IDs that are in creature_template but don't * exist in Vehicle.dbc. This *WILL* cause the client to freeze / hang. * Look on TDB in the "Core related DB content" forum for a query to clean * these up. * Thanks to MaXiMiUS for the slap in the face :) --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 13f991cd5a3..3de2bf13232 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -730,6 +730,13 @@ void ObjectMgr::LoadCreatureTemplates() const_cast(cInfo)->InhabitType = INHABIT_ANYWHERE; } + if (cInfo->VehicleId) + { + VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->Entry); + if (!vehId) + sLog.outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); + } + if(cInfo->PetSpellDataId) { CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); -- cgit v1.2.3 From d2acbbd616540df0dcbcab8ec8d4d63d116480ac Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 17 Feb 2010 02:08:11 -0700 Subject: * Added chack for TRAINER_TYPE_PETS, to prevent bogus error that was generated * since pet trainers no longer train spells. --HG-- branch : trunk --- src/game/Creature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 7816412a0ad..cd9f8d8f009 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -810,7 +810,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const { - if(!isTrainer()) + if(!isTrainer() || GetCreatureInfo()->trainer_type == TRAINER_TYPE_PETS) return false; TrainerSpellData const* trainer_spells = GetTrainerSpells(); -- cgit v1.2.3 From 8ba75526b5fb7f497384cfcd36edf7d6df77df94 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 17 Feb 2010 02:17:17 -0700 Subject: * Properly fix bogus pet trainers error message --HG-- branch : trunk --- src/game/Creature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index cd9f8d8f009..3e834f4aca0 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -810,12 +810,12 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const { - if(!isTrainer() || GetCreatureInfo()->trainer_type == TRAINER_TYPE_PETS) + if(!isTrainer()) return false; TrainerSpellData const* trainer_spells = GetTrainerSpells(); - if(!trainer_spells || trainer_spells->spellList.empty()) + if((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS) { sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.", GetGUIDLow(),GetEntry()); -- cgit v1.2.3 From 401a8eec02992605c64900baa9a39d7c24ba7810 Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 18 Feb 2010 00:20:17 +0100 Subject: Use same calculations for Pull effect as for jump effect --HG-- branch : trunk --- src/game/SpellEffects.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index ccf3abe022d..585fbbc42af 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -6825,7 +6825,15 @@ void Spell::EffectPlayerPull(uint32 i) if(!unitTarget) return; - unitTarget->GetMotionMaster()->MoveJump(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), float(damage ? damage : unitTarget->GetDistance2d(m_caster)), float(m_spellInfo->EffectMiscValue[i])/10); + float speedZ; + if(m_spellInfo->EffectMiscValue[i]) + speedZ = float(m_spellInfo->EffectMiscValue[i])/10; + else if(m_spellInfo->EffectMiscValueB[i]) + speedZ = float(m_spellInfo->EffectMiscValueB[i])/10; + else + speedZ = 10.0f; + float speedXY = m_caster->GetExactDist2d(x, y) * 10.0f / speedZ; + unitTarget->GetMotionMaster()->MoveJump(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), speedXY, speedZ); } void Spell::EffectDispelMechanic(uint32 i) -- cgit v1.2.3 From 6d05d649eb7427e84df13fc2b72f78384ba729ed Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 18 Feb 2010 00:31:50 +0100 Subject: Fix Glyph of Unholy Blight, and make Unholy Blight accumulate damage. --HG-- branch : trunk --- src/game/Unit.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f0d6f0b9b4b..12e8f1b37e6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7288,6 +7288,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (dummySpell->Id == 49194) { basepoints0 = triggerAmount * damage / 100; + // Glyph of Unholy Blight + if (AuraEffect *glyph=GetAuraEffect(63332,0)) + basepoints0 += basepoints0 * glyph->GetAmount() / 100; + // Find replaced aura to use it's remaining amount + AuraEffectList const& DoTAuras = target->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE); + for (Unit::AuraEffectList::const_iterator i = DoTAuras.begin(); i != DoTAuras.end(); ++i) + { + if ((*i)->GetCasterGUID() != GetGUID() || (*i)->GetId() != 50536) + continue; + basepoints0 += ((*i)->GetAmount() * ((*i)->GetTotalTicks() - ((*i)->GetTickNumber()))) / (*i)->GetTotalTicks(); + break; + } + triggered_spell_id = 50536; break; } -- cgit v1.2.3 From 54d8411eb950e68f2abee2be9f4491d368e024fe Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 18 Feb 2010 00:33:09 +0100 Subject: Fix error, should've tested it before :< --HG-- branch : trunk --- src/game/SpellEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 585fbbc42af..b7ff7df86df 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -6832,7 +6832,7 @@ void Spell::EffectPlayerPull(uint32 i) speedZ = float(m_spellInfo->EffectMiscValueB[i])/10; else speedZ = 10.0f; - float speedXY = m_caster->GetExactDist2d(x, y) * 10.0f / speedZ; + float speedXY = m_caster->GetExactDist2d(unitTarget) * 10.0f / speedZ; unitTarget->GetMotionMaster()->MoveJump(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), speedXY, speedZ); } -- cgit v1.2.3 From cedf706f29fa4fdaccd9d12ee88ac47e6b4a4f16 Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 18 Feb 2010 01:06:47 +0100 Subject: Treat rune cooldowns as timers and not as remaining tick counts Implement support for modifiers changing rune regeneration rate Apply all spells from Improved Unholy Aura --HG-- branch : trunk --- src/game/Player.cpp | 29 +++++++++++++++++++++-------- src/game/Player.h | 9 +++++---- src/game/Spell.cpp | 4 ++-- src/game/SpellAuras.cpp | 4 ++-- src/game/Unit.cpp | 2 +- 5 files changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f83fc526009..2c58e8cf9e7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2025,6 +2025,12 @@ void Player::RegenerateAll() Regenerate(POWER_MANA); + // Runes act as cooldowns, and they don't need to send any data + if(getClass() == CLASS_DEATH_KNIGHT) + for (uint32 i = 0; i < MAX_RUNES; ++i) + if(uint32 cd = GetRuneCooldown(i)) + SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0); + if (m_regenTimerCount >= 2000) { // Not in combat or they have regeneration @@ -2038,9 +2044,6 @@ void Player::RegenerateAll() if (getClass() == CLASS_DEATH_KNIGHT) Regenerate(POWER_RUNIC_POWER); - if(getClass() == CLASS_DEATH_KNIGHT) - Regenerate(POWER_RUNE); - m_regenTimerCount -= 2000; } @@ -2049,11 +2052,6 @@ void Player::RegenerateAll() void Player::Regenerate(Powers power) { - if (power == POWER_RUNE) - for (uint32 i = 0; i < MAX_RUNES; ++i) - if (uint8 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it... - SetRuneCooldown(i, cd - 1); // ... by 2 sec (because update is every 2 sec) - uint32 maxValue = GetMaxPower(power); if (!maxValue) return; @@ -21791,6 +21789,21 @@ void Player::UpdateCharmedAI() } } +uint32 Player::GetRuneBaseCooldown(uint8 index) +{ + uint8 rune = GetBaseRune(index); + uint32 cooldown = RUNE_COOLDOWN; + + AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); + for(AuraEffectList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i) + { + if((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune) + cooldown = cooldown*(100-(*i)->GetAmount())/100; + } + + return cooldown; +} + void Player::RemoveRunesByAuraEffect(AuraEffect const * aura) { for(uint8 i = 0; i < MAX_RUNES; ++i) diff --git a/src/game/Player.h b/src/game/Player.h index bfd9225947e..f76d58e3295 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -281,7 +281,7 @@ struct Areas }; #define MAX_RUNES 6 -#define RUNE_COOLDOWN 5 // 5*2=10 sec +#define RUNE_COOLDOWN 10000 enum RuneType { @@ -296,7 +296,7 @@ struct RuneInfo { uint8 BaseRune; uint8 CurrentRune; - uint8 Cooldown; + uint32 Cooldown; AuraEffect const * ConvertAura; }; @@ -2259,13 +2259,14 @@ class Player : public Unit, public GridObject uint8 GetRunesState() const { return m_runes->runeState; } RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); } RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); } - uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; } + uint32 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; } + uint32 GetRuneBaseCooldown(uint8 index); bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const; RuneType GetLastUsedRune() { return m_runes->lastUsedRune; } void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; } void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; } void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; } - void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); } + void SetRuneCooldown(uint8 index, uint32 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); } void SetRuneConvertAura(uint8 index, AuraEffect const * aura) { m_runes->runes[index].ConvertAura = aura; } void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const * aura) { SetRuneConvertAura(index, aura); ConvertRune(index, newType); } void RemoveRunesByAuraEffect(AuraEffect const * aura); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 229f40bb3c1..98ac23e69d5 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4229,7 +4229,7 @@ void Spell::TakeRunePower() RuneType rune = plr->GetCurrentRune(i); if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0)) { - plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec + plr->SetRuneCooldown(i, plr->GetRuneBaseCooldown(i)); plr->SetLastUsedRune(RuneType(rune)); runeCost[rune]--; } @@ -4244,7 +4244,7 @@ void Spell::TakeRunePower() RuneType rune = plr->GetCurrentRune(i); if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH)) { - plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec + plr->SetRuneCooldown(i, plr->GetRuneBaseCooldown(i)); plr->SetLastUsedRune(RuneType(rune)); runeCost[rune]--; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index cc768e7ad51..750cabdb28f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1381,7 +1381,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, { // Not listed as any effect, only base points set int32 basePoints0 = unholyPresenceAura->GetSpellProto()->EffectBasePoints[1]; - //target->CastCustomSpell(target,63622,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura); + target->CastCustomSpell(target,63622,&basePoints0 ,&basePoints0,&basePoints0,true,0,unholyPresenceAura); target->CastCustomSpell(target,65095,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura); } target->CastSpell(target,49772, true); @@ -1403,7 +1403,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, { if(presence == 48265 && unholyPresenceAura) { - //target->RemoveAurasDueToSpell(63622); + target->RemoveAurasDueToSpell(63622); target->RemoveAurasDueToSpell(65095); } target->RemoveAurasDueToSpell(49772); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 12e8f1b37e6..ae5f50d3710 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7723,7 +7723,7 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura * triggeredByAura, ((Player*)this)->GetBaseRune(i) != RUNE_BLOOD ) continue; } - if (((Player*)this)->GetRuneCooldown(i) != RUNE_COOLDOWN) + if (((Player*)this)->GetRuneCooldown(i) != ((Player*)this)->GetRuneBaseCooldown(i)) continue; --runesLeft; -- cgit v1.2.3 From 43a6be4b10da0c5e1e45e97d1130af3b93afaa71 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Thu, 18 Feb 2010 21:17:19 +0100 Subject: Fix a crash in generic_vehicleAI_toc5AI. gdb log: #3 0x0000000000ce25c9 in Vehicle::GetPassenger (this=0x0, seatId=0 '\0') #4 0x0000000000f10820 in generic_vehicleAI_toc5AI::UpdateAI ( this=0x7f1c123c3000, uiDiff=118) --HG-- branch : trunk --- .../trial_of_the_champion/boss_grand_champions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp b/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp index 9d745c8775a..6fc53263ed1 100644 --- a/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp +++ b/src/scripts/northrend/crusaders_coliseum/trial_of_the_champion/boss_grand_champions.cpp @@ -261,6 +261,12 @@ struct generic_vehicleAI_toc5AI : public npc_escortAI //dosen't work at all if (uiShieldBreakerTimer <= uiDiff) { + if (!pVehicle) + { + pVehicle = m_creature->GetVehicleKit(); + return; + } + if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0)) { Map::PlayerList const& players = m_creature->GetMap()->GetPlayers(); -- cgit v1.2.3 From 746052f5618dab6f3d54b77ef7c656f637ae46c3 Mon Sep 17 00:00:00 2001 From: Tartalo Date: Thu, 18 Feb 2010 22:22:09 +0100 Subject: Borean Tundra: Support for quest 11560 Oh Noes, the Tadpoles! --HG-- branch : trunk --- sql/updates/7385_world_scriptname.sql | 2 ++ src/scripts/world/go_scripts.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 sql/updates/7385_world_scriptname.sql (limited to 'src') diff --git a/sql/updates/7385_world_scriptname.sql b/sql/updates/7385_world_scriptname.sql new file mode 100644 index 00000000000..87d2b5fdb36 --- /dev/null +++ b/sql/updates/7385_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `scriptname`='go_tadpole_cage' WHERE `entry`=187373; + diff --git a/src/scripts/world/go_scripts.cpp b/src/scripts/world/go_scripts.cpp index cd71124c4f5..ee75698ddf6 100644 --- a/src/scripts/world/go_scripts.cpp +++ b/src/scripts/world/go_scripts.cpp @@ -736,6 +736,30 @@ bool GOHello_go_soulwell(Player *pPlayer, GameObject* pGO) return true; } +/*###### +## Quest 11560: Oh Noes, the Tadpoles! +## go_tadpole_cage +######*/ + +enum eTadpoles +{ + QUEST_OH_NOES_THE_TADPOLES = 11560, + NPC_WINTERFIN_TADPOLE = 25201 +}; + +bool GOHello_go_tadpole_cage(Player *pPlayer, GameObject *pGO) +{ + Creature *pTadpole; + if (pPlayer->GetQuestStatus(QUEST_OH_NOES_THE_TADPOLES) == QUEST_STATUS_INCOMPLETE && + (pTadpole = pGO->FindNearestCreature(NPC_WINTERFIN_TADPOLE,1.0f))) + { + pGO->UseDoorOrButton(); + pTadpole->DisappearAndDie(); + pPlayer->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE,0); + //FIX: Summon minion tadpole + } + return true; +} void AddSC_go_scripts() { @@ -891,4 +915,9 @@ void AddSC_go_scripts() newscript->Name = "go_soulwell"; newscript->pGOHello = &GOHello_go_soulwell; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_tadpole_cage"; + newscript->pGOHello = &GOHello_go_tadpole_cage; + newscript->RegisterSelf(); } -- cgit v1.2.3 From a95dd226e435c204c3fdd183336da975139eee5b Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 18 Feb 2010 02:07:20 -0700 Subject: * Properly display missing vehicle IDs on startup --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 3de2bf13232..e19c5e850e4 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -732,7 +732,7 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->VehicleId) { - VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->Entry); + VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId); if (!vehId) sLog.outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); } -- cgit v1.2.3 From a0fc3acdc4bcffbbcbe70ad82b02a3eec97308b2 Mon Sep 17 00:00:00 2001 From: Tartalo Date: Fri, 19 Feb 2010 00:20:14 +0100 Subject: Grizzly Hills: Support for quest 12027 Mr. Floppy's Perilous Adventure Needs db support --HG-- branch : trunk --- sql/updates/7387_world_script_texts.sql | 15 ++ sql/updates/7387_world_script_waypoints.sql | 29 ++++ sql/updates/7387_world_scriptname.sql | 2 + src/scripts/northrend/grizzly_hills.cpp | 252 ++++++++++++++++++++++++++++ 4 files changed, 298 insertions(+) create mode 100644 sql/updates/7387_world_script_texts.sql create mode 100644 sql/updates/7387_world_script_waypoints.sql create mode 100644 sql/updates/7387_world_scriptname.sql (limited to 'src') diff --git a/sql/updates/7387_world_script_texts.sql b/sql/updates/7387_world_script_texts.sql new file mode 100644 index 00000000000..57d8cbf0fe3 --- /dev/null +++ b/sql/updates/7387_world_script_texts.sql @@ -0,0 +1,15 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=26588; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(26588, -1800013, 'Thank you for helping me get back to the camp. Go tell Walter that I''m safe now!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800012, 'Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800011, 'The Ravenous Worg chomps down on Mr. Floppy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 4, 0, 0, '12027'), +(26588, -1800010, 'Mr. Floppy revives', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 4, 0, 0, '12027'), +(26588, -1800009, 'I think I see the camp! We''re almost home, Mr. Floppy! Let''s go!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800008, 'Mr. Floppy, you''re ok! Thank you so much for saving Mr. Floppy!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800007, 'Don''t go toward the light, Mr. Floppy!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800006, 'Let''s get out of here before more wolves find us!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800005, 'There''s a big meanie attacking Mr. Floppy! Help! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800004, 'He''s gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800003, 'Oh, no! Look, it''s another wolf, and it''s a biiiiiig one!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800002, 'He''s going for Mr. Floppy! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800001, 'Um... I think one of those wolves is back...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'); diff --git a/sql/updates/7387_world_script_waypoints.sql b/sql/updates/7387_world_script_waypoints.sql new file mode 100644 index 00000000000..be595a30389 --- /dev/null +++ b/sql/updates/7387_world_script_waypoints.sql @@ -0,0 +1,29 @@ +DELETE FROM `script_waypoint` wHERE `entry`=26588; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(26588, 1, 4333.18, -3688.4, 263.857, 0, '0'), +(26588, 2, 4341.38, -3683.77, 257.422, 0, '0'), +(26588, 3, 4342.67, -3683.21, 257.218, 0, '0'), +(26588, 4, 4346.22, -3688.72, 257.065, 0, '0'), +(26588, 5, 4343.8, -3695.27, 257.124, 0, '0'), +(26588, 6, 4337.74, -3707.2, 257.628, 0, '0'), +(26588, 7, 4317.58, -3722.8, 256.941, 0, '0'), +(26588, 8, 4306.64, -3736.46, 258.304, 0, '0'), +(26588, 9, 4299.96, -3760.02, 254.959, 0, '0'), +(26588, 10, 4294.21, -3777.34, 249.139, 1000, '0'), +(26588, 11, 4294.37, -3776.97, 249.259, 10000, '0'), +(26588, 12, 4300.22, -3794.61, 240.107, 2000, '0'), +(26588, 13, 4307.25, -3817.76, 231.414, 2000, '0'), +(26588, 14, 4326.31, -3883.31, 208.457, 2000, '0'), +(26588, 15, 4346.19, -3905.41, 198.805, 2000, '0'), +(26588, 16, 4347.39, -3916.43, 196.716, 5000, '0'), +(26588, 17, 4350.17, -3935.03, 191.824, 1000, '0'), +(26588, 18, 4347.24, -3939.54, 191.445, 2000, '0'), +(26588, 19, 4347.24, -3939.54, 191.445, 2000, '0'), +(26588, 20, 4347.24, -3939.54, 191.445, 5000, '0'), +(26588, 21, 4347.24, -3939.54, 191.445, 7000, '0'), +(26588, 22, 4347.24, -3939.54, 191.445, 5000, '0'), +(26588, 23, 4347.24, -3939.54, 191.445, 5000, '0'), +(26588, 24, 4347.24, -3939.54, 191.445, 0, '0'), +(26588, 25, 4353.72, -3965.61, 190.154, 0, '0'), +(26588, 26, 4363.12, -3995.61, 183.327, 0, '0'), +(26588, 27, 4371.99, -4010.97, 181.33, 0, '0'); diff --git a/sql/updates/7387_world_scriptname.sql b/sql/updates/7387_world_scriptname.sql new file mode 100644 index 00000000000..2ea586552d2 --- /dev/null +++ b/sql/updates/7387_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_emily' WHERE `entry`=26588; +UPDATE `creature_template` SET `ScriptName` = 'npc_mrfloppy' WHERE `entry`=26589; diff --git a/src/scripts/northrend/grizzly_hills.cpp b/src/scripts/northrend/grizzly_hills.cpp index ca1301fe287..b057faf7e5f 100644 --- a/src/scripts/northrend/grizzly_hills.cpp +++ b/src/scripts/northrend/grizzly_hills.cpp @@ -26,6 +26,7 @@ npc_orsonn_and_kodian EndContentData */ #include "ScriptedPch.h" +#include "ScriptedEscortAI.h" #define GOSSIP_ITEM1 "You're free to go Orsonn, but first tell me what's wrong with the furbolg." #define GOSSIP_ITEM2 "What happened then?" @@ -115,6 +116,246 @@ bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, ui return true; } +/*###### +## Quest 12027: Mr. Floppy's Perilous Adventure +######*/ + +enum eFloppy +{ + NPC_MRFLOPPY = 26589, + NPC_HUNGRY_WORG = 26586, + NPC_RAVENOUS_WORG = 26590, //RWORG + NPC_EMILY = 26588, + + QUEST_PERILOUS_ADVENTURE = 12027, + + SPELL_MRFLOPPY = 47184, //vehicle aura + + SAY_WORGHAGGRO1 = -1800001, //Um... I think one of those wolves is back... + SAY_WORGHAGGRO2 = -1800002, //He's going for Mr. Floppy! + SAY_WORGRAGGRO3 = -1800003, //Oh, no! Look, it's another wolf, and it's a biiiiiig one! + SAY_WORGRAGGRO4 = -1800004, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta! + SAY_RANDOMAGGRO = -1800005, //There's a big meanie attacking Mr. Floppy! Help! + SAY_VICTORY1 = -1800006, //Let's get out of here before more wolves find us! + SAY_VICTORY2 = -1800007, //Don't go toward the light, Mr. Floppy! + SAY_VICTORY3 = -1800008, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy! + SAY_VICTORY4 = -1800009, //I think I see the camp! We're almost home, Mr. Floppy! Let's go! + TEXT_EMOTE_WP1 = -1800010, //Mr. Floppy revives + TEXT_EMOTE_AGGRO = -1800011, //The Ravenous Worg chomps down on Mr. Floppy + SAY_QUEST_ACCEPT = -1800012, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves! + SAY_QUEST_COMPLETE = -1800013 //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now! +}; + +//emily +struct npc_emilyAI : public npc_escortAI +{ + npc_emilyAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + uint32 m_uiChatTimer; + + uint64 RWORGGUID; + uint64 MrfloppyGUID; + + Creature* Mrfloppy; + Creature* RWORG; + bool Completed; + + + void JustSummoned(Creature* pSummoned) + { + if (Creature* Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 50.0f)) + pSummoned->AI()->AttackStart(Mrfloppy); + else + pSummoned->AI()->AttackStart(m_creature->getVictim()); + } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + switch (i) + { + case 9: + Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f); + break; + case 10: + if (Mrfloppy) + { + DoScriptText(SAY_WORGHAGGRO1, m_creature); + m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + } + break; + case 11: + Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + break; + case 17: + Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); + DoScriptText(SAY_WORGRAGGRO3, m_creature); + RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + RWORG->setFaction(35); + break; + case 18: + if (Mrfloppy) + { + RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); + DoCast(Mrfloppy,SPELL_MRFLOPPY); + } + break; + case 19: + if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) + Mrfloppy->EnterVehicle(RWORG); + break; + case 20: + if (Mrfloppy) + RWORG->HandleEmoteCommand(34); + break; + case 21: + if (Mrfloppy) + { + RWORG->Kill(Mrfloppy); + Mrfloppy->ExitVehicle(); + RWORG->setFaction(14); + RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ()); + DoScriptText(SAY_VICTORY2, m_creature); + } + break; + case 22: + if (Mrfloppy && Mrfloppy->isDead()) + { + RWORG->DisappearAndDie(); + m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); + Mrfloppy->setDeathState(ALIVE); + Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + DoScriptText(SAY_VICTORY3, m_creature); + } + break; + case 24: + if (pPlayer) + { + Completed = true; + pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, m_creature); + DoScriptText(SAY_QUEST_COMPLETE, m_creature, pPlayer); + } + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + break; + case 25: + DoScriptText(SAY_VICTORY4, m_creature); + break; + case 27: + m_creature->DisappearAndDie(); + if (Mrfloppy) + Mrfloppy->DisappearAndDie(); + break; + } + } + + void EnterCombat(Unit* Who) + { + DoScriptText(SAY_RANDOMAGGRO, m_creature); + } + + void Reset() + { + m_uiChatTimer = 4000; + Mrfloppy = NULL; + RWORG = NULL; + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + if (m_uiChatTimer <= uiDiff) + { + m_uiChatTimer = 12000; + } + else + m_uiChatTimer -= uiDiff; + } + } +}; + + +bool QuestAccept_npc_emily(Player* pPlayer, Creature* pCreature, Quest const* quest) +{ + if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE) + { + DoScriptText(SAY_QUEST_ACCEPT, pCreature); + if (Creature* Mrfloppy = GetClosestCreatureWithEntry(pCreature, NPC_MRFLOPPY, 180.0f)) + { + Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } + + if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI()))) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; +} + +CreatureAI* GetAI_npc_emily(Creature* pCreature) +{ + return new npc_emilyAI(pCreature); +} + +//mrfloppy + +struct npc_mrfloppyAI : public ScriptedAI +{ + npc_mrfloppyAI(Creature *c) : ScriptedAI(c) {} + + uint64 EmilyGUID; + uint64 RWORGGUID; + uint64 HWORGGUID; + + Creature* HWORG; + Creature* RWORG; + + Creature* Emily; + + void Reset() + { + HWORG = NULL; + RWORG = NULL; + Emily = NULL; + } + + void EnterCombat(Unit* Who) + { + if (Creature* Emily = GetClosestCreatureWithEntry(m_creature, NPC_EMILY, 50.0f)) + { + switch(Who->GetEntry()) + { + case NPC_HUNGRY_WORG: + DoScriptText(SAY_WORGHAGGRO2, Emily); + break; + case NPC_RAVENOUS_WORG: + DoScriptText(SAY_WORGRAGGRO4, Emily); + break; + default: + DoScriptText(SAY_RANDOMAGGRO, Emily); + } + } + } + + void EnterEvadeMode() {} + + void MoveInLineOfSight(Unit *who) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + } +}; + +CreatureAI* GetAI_npc_mrfloppy(Creature* pCreature) +{ + return new npc_mrfloppyAI(pCreature); +} + void AddSC_grizzly_hills() { Script* newscript; @@ -124,4 +365,15 @@ void AddSC_grizzly_hills() newscript->pGossipHello = &GossipHello_npc_orsonn_and_kodian; newscript->pGossipSelect = &GossipSelect_npc_orsonn_and_kodian; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_emily"; + newscript->GetAI = &GetAI_npc_emily; + newscript->pQuestAccept = &QuestAccept_npc_emily; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_mrfloppy"; + newscript->GetAI = &GetAI_npc_mrfloppy; + newscript->RegisterSelf(); } -- cgit v1.2.3 From b0042f7056d893afc9d487cdf911481c3ed2b9a4 Mon Sep 17 00:00:00 2001 From: Darkrabbit Date: Thu, 18 Feb 2010 02:42:59 +0100 Subject: * Optimized guild and arena team loading at startup --HG-- branch : trunk --- src/game/ArenaTeam.cpp | 156 ++++++++++++++++++----------------- src/game/ArenaTeam.h | 4 +- src/game/Guild.cpp | 215 ++++++++++++++++++++++++++----------------------- src/game/Guild.h | 9 ++- src/game/ObjectMgr.cpp | 78 +++++++++++++----- 5 files changed, 264 insertions(+), 198 deletions(-) (limited to 'src') diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 45ac5057de2..05a6a8fd75b 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -176,85 +176,91 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) return true; } -bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId) +bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult) { - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId); - - if(!result) - return false; - - Field *fields = result->Fetch(); - - m_TeamId = fields[0].GetUInt32(); - m_Name = fields[1].GetCppString(); - m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); - m_Type = fields[3].GetUInt32(); - m_BackgroundColor = fields[4].GetUInt32(); - m_EmblemStyle = fields[5].GetUInt32(); - m_EmblemColor = fields[6].GetUInt32(); - m_BorderStyle = fields[7].GetUInt32(); - m_BorderColor = fields[8].GetUInt32(); - - // only load here, so additional checks can be made - LoadStatsFromDB(ArenaTeamId); - LoadMembersFromDB(ArenaTeamId); - - if(Empty()) - { - // arena team is empty, delete from db - CharacterDatabase.BeginTransaction(); - CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId); - CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId); - CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId); - CharacterDatabase.CommitTransaction(); + if(!arenaTeamDataResult) return false; - } + Field *fields = arenaTeamDataResult->Fetch(); + + m_TeamId = fields[0].GetUInt32(); + m_Name = fields[1].GetCppString(); + m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + m_Type = fields[3].GetUInt32(); + m_BackgroundColor = fields[4].GetUInt32(); + m_EmblemStyle = fields[5].GetUInt32(); + m_EmblemColor = fields[6].GetUInt32(); + m_BorderStyle = fields[7].GetUInt32(); + m_BorderColor = fields[8].GetUInt32(); + //load team stats + m_stats.rating = fields[9].GetUInt32(); + m_stats.games_week = fields[10].GetUInt32(); + m_stats.wins_week = fields[11].GetUInt32(); + m_stats.games_season = fields[12].GetUInt32(); + m_stats.wins_season = fields[13].GetUInt32(); + m_stats.rank = fields[14].GetUInt32(); + return true; } -void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId) +bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult) { - // 0 1 2 3 4 5 - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rating,games,wins,played,wins2,rank FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId); - - if(!result) - return; - - Field *fields = result->Fetch(); + if(!arenaTeamMembersResult) + return false; - m_stats.rating = fields[0].GetUInt32(); - m_stats.games_week = fields[1].GetUInt32(); - m_stats.wins_week = fields[2].GetUInt32(); - m_stats.games_season = fields[3].GetUInt32(); - m_stats.wins_season = fields[4].GetUInt32(); - m_stats.rank = fields[5].GetUInt32(); -} - -void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId) -{ - // 0 1 2 3 4 5 6 7 - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class " - "FROM arena_team_member member " - "INNER JOIN characters chars on member.guid = chars.guid " - "WHERE member.arenateamid = '%u'", ArenaTeamId); - if(!result) - return; + bool captainPresentInTeam = false; do { - Field *fields = result->Fetch(); + Field *fields = arenaTeamMembersResult->Fetch(); + //prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members + if (!fields) + break; + uint32 arenaTeamId = fields[0].GetUInt32(); + if (arenaTeamId < m_TeamId) + { + //there is in table arena_team_member record which doesn't have arenateamid in arena_team table, report error + sLog.outErrorDb("ArenaTeam %u does not exist but it has record in arena_team_member table, deleting it!", arenaTeamId); + CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", arenaTeamId); + continue; + } + + if (arenaTeamId > m_TeamId) + //we loaded all members for this arena_team already, break cycle + break; + ArenaTeamMember newmember; - newmember.guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); - newmember.games_week = fields[1].GetUInt32(); - newmember.wins_week = fields[2].GetUInt32(); - newmember.games_season = fields[3].GetUInt32(); - newmember.wins_season = fields[4].GetUInt32(); - newmember.personal_rating = fields[5].GetUInt32(); - newmember.name = fields[6].GetCppString(); - newmember.Class = fields[7].GetUInt8(); + newmember.guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); + newmember.games_week = fields[2].GetUInt32(); + newmember.wins_week = fields[3].GetUInt32(); + newmember.games_season = fields[4].GetUInt32(); + newmember.wins_season = fields[5].GetUInt32(); + newmember.personal_rating = fields[6].GetUInt32(); + newmember.name = fields[7].GetCppString(); + newmember.Class = fields[8].GetUInt8(); + + //check if member exists in characters table + if (newmember.name.empty()) + { + sLog.outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newmember.guid)); + this->DelMember(newmember.guid); + continue; + } + + if (newmember.guid == GetCaptain()) + captainPresentInTeam = true; + m_members.push_back(newmember); - }while( result->NextRow() ); + }while (arenaTeamMembersResult->NextRow()); + + if(Empty() || !captainPresentInTeam) + { + // arena team is empty or captain is not in team, delete from db + sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId); + return false; + } + + return true; } void ArenaTeam::SetCaptain(const uint64& guid) @@ -304,18 +310,24 @@ void ArenaTeam::DelMember(uint64 guid) void ArenaTeam::Disband(WorldSession *session) { // event - WorldPacket data; - session->BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_DISBANDED_S, 2, session->GetPlayerName(), GetName(), ""); - BroadcastPacket(&data); + if (session) + { + WorldPacket data; + session->BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_DISBANDED_S, 2, session->GetPlayerName(), GetName(), ""); + BroadcastPacket(&data); + } while (!m_members.empty()) { // Removing from members is done in DelMember. DelMember(m_members.front().guid); } - - if(Player *player = session->GetPlayer()) - sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + + if (session) + { + if(Player *player = session->GetPlayer()) + sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + } CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId); diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index d9dc736f870..ffbb36c5d44 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -173,8 +173,8 @@ class ArenaTeam bool IsFighting() const; - bool LoadArenaTeamFromDB(uint32 ArenaTeamId); - void LoadMembersFromDB(uint32 ArenaTeamId); + bool LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult); + bool LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult); void LoadStatsFromDB(uint32 ArenaTeamId); void SaveToDB(); diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index e8fd4b57bed..8453d9c378b 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -207,59 +207,43 @@ void Guild::SetGINFO(std::string ginfo) CharacterDatabase.PExecute("UPDATE guild SET info='%s' WHERE guildid='%u'", ginfo.c_str(), m_Id); } -bool Guild::LoadGuildFromDB(uint32 GuildId) +bool Guild::LoadGuildFromDB(QueryResult_AutoPtr guildDataResult) { - //set m_Id in case guild data are broken in DB and Guild will be Disbanded (deleted from DB) - m_Id = GuildId; - - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(TabId) FROM guild_bank_tab WHERE guildid='%u'", GuildId); - if (result) - { - Field *fields = result->Fetch(); - m_PurchasedTabs = fields[0].GetUInt32(); - if (m_PurchasedTabs > GUILD_BANK_MAX_TABS) - m_PurchasedTabs = GUILD_BANK_MAX_TABS; - } - - if (!LoadRanksFromDB(GuildId)) - return false; - - if (!LoadMembersFromDB(GuildId)) + if (!guildDataResult) return false; - LoadBankRightsFromDB(GuildId); // Must be after LoadRanksFromDB because it populates rank struct - - // 0 1 2 3 4 5 - result = CharacterDatabase.PQuery("SELECT name, leaderguid, EmblemStyle, EmblemColor, BorderStyle, BorderColor," - // 6 7 8 9 10 - "BackgroundColor, info, motd, createdate, BankMoney FROM guild WHERE guildid = '%u'", GuildId); - - if (!result) - return false; - - Field *fields = result->Fetch(); - - m_Name = fields[0].GetCppString(); - m_LeaderGuid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); - - m_EmblemStyle = fields[2].GetUInt32(); - m_EmblemColor = fields[3].GetUInt32(); - m_BorderStyle = fields[4].GetUInt32(); - m_BorderColor = fields[5].GetUInt32(); - m_BackgroundColor = fields[6].GetUInt32(); - GINFO = fields[7].GetCppString(); - MOTD = fields[8].GetCppString(); - time_t time = fields[9].GetUInt64(); - m_GuildBankMoney = fields[10].GetUInt64(); + Field *fields = guildDataResult->Fetch(); + + m_Id = fields[0].GetUInt32(); + m_Name = fields[1].GetCppString(); + m_LeaderGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + m_EmblemStyle = fields[3].GetUInt32(); + m_EmblemColor = fields[4].GetUInt32(); + m_BorderStyle = fields[5].GetUInt32(); + m_BorderColor = fields[6].GetUInt32(); + m_BackgroundColor = fields[7].GetUInt32(); + GINFO = fields[8].GetCppString(); + MOTD = fields[9].GetCppString(); + time_t time = fields[10].GetUInt64(); + m_GuildBankMoney = fields[11].GetUInt64(); + m_PurchasedTabs = fields[12].GetUInt32(); + + if (m_PurchasedTabs > GUILD_BANK_MAX_TABS) + m_PurchasedTabs = GUILD_BANK_MAX_TABS; if (time > 0) { - tm local = *(localtime(&time)); // dereference and assign + tm local = *(localtime(&time)); // dereference and assign m_CreatedDay = local.tm_mday; m_CreatedMonth = local.tm_mon + 1; m_CreatedYear = local.tm_year + 1900; } + return true; +} + +bool Guild::CheckGuildStructure() +{ // Repair the structure of guild // If the guildmaster doesn't exist or isn't the member of guild // attempt to promote another member @@ -280,24 +264,19 @@ bool Guild::LoadGuildFromDB(uint32 GuildId) if (itr->second.RankId == GR_GUILDMASTER && GUID_LOPART(m_LeaderGuid) != itr->first) // Allow only 1 guildmaster ChangeRank(itr->first, GR_OFFICER); // set right of member to officer - sLog.outDebug("Guild %u Creation time Loaded day: %u, month: %u, year: %u", GuildId, m_CreatedDay, m_CreatedMonth, m_CreatedYear); - return true; } -bool Guild::LoadRanksFromDB(uint32 GuildId) +bool Guild::LoadRanksFromDB(QueryResult_AutoPtr guildRanksResult) { - Field *fields; - // 0 1 2 3 - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rid,rname,rights,BankMoneyPerDay FROM guild_rank WHERE guildid = '%u' ORDER BY rid ASC", GuildId); - - if (!result) + if (!guildRanksResult) { - sLog.outError("Guild %u has broken `guild_rank` data, creating new...",GuildId); + sLog.outError("Guild %u has broken `guild_rank` data, creating new...",m_Id); CreateDefaultGuildRanks(0); return true; } + Field *fields; bool broken_ranks = false; //GUILD RANKS are sequence starting from 0 = GUILD_MASTER (ALL PRIVILEGES) to max 9 (lowest privileges) @@ -307,12 +286,27 @@ bool Guild::LoadRanksFromDB(uint32 GuildId) do { - fields = result->Fetch(); + fields = guildRanksResult->Fetch(); + //condition that would be true when all ranks in QueryResult will be processed and guild without ranks is being processed + if (!fields) + break; + + uint32 guildId = fields[0].GetUInt32(); + if (guildId < m_Id) + { + //there is in table guild_rank record which doesn't have guildid in guild table, report error + sLog.outErrorDb("Guild %u does not exist but it has a record in guild_rank table, deleting it!", guildId); + CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", guildId); + continue; + } - uint32 rankID = fields[0].GetUInt32(); - std::string rankName = fields[1].GetCppString(); - uint32 rankRights = fields[2].GetUInt32(); - uint32 rankMoney = fields[3].GetUInt32(); + if (guildId > m_Id) + //we loaded all ranks for this guild already, break cycle + break; + uint32 rankID = fields[1].GetUInt32(); + std::string rankName = fields[2].GetCppString(); + uint32 rankRights = fields[3].GetUInt32(); + uint32 rankMoney = fields[4].GetUInt32(); if (rankID != m_Ranks.size()) // guild_rank.ids are sequence 0,1,2,3.. broken_ranks = true; @@ -322,27 +316,27 @@ bool Guild::LoadRanksFromDB(uint32 GuildId) rankRights |= GR_RIGHT_ALL; AddRank(rankName,rankRights,rankMoney); - }while (result->NextRow()); + }while( guildRanksResult->NextRow() ); if (m_Ranks.size() < GUILD_RANKS_MIN_COUNT) // if too few ranks, renew them { m_Ranks.clear(); - sLog.outError("Guild %u has broken `guild_rank` data, creating new...",GuildId); + sLog.outError("Guild %u has broken `guild_rank` data, creating new...", m_Id); CreateDefaultGuildRanks(0); // 0 is default locale_idx broken_ranks = false; } // guild_rank have wrong numbered ranks, repair if (broken_ranks) { - sLog.outError("Guild %u has broken `guild_rank` data, repairing...",GuildId); + sLog.outError("Guild %u has broken `guild_rank` data, repairing...", m_Id); CharacterDatabase.BeginTransaction(); - CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", GuildId); + CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", m_Id); for (size_t i = 0; i < m_Ranks.size(); ++i) { std::string name = m_Ranks[i].Name; uint32 rights = m_Ranks[i].Rights; CharacterDatabase.escape_string(name); - CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", GuildId, uint32(i), name.c_str(), rights); + CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights); } CharacterDatabase.CommitTransaction(); } @@ -350,46 +344,53 @@ bool Guild::LoadRanksFromDB(uint32 GuildId) return true; } -bool Guild::LoadMembersFromDB(uint32 GuildId) +bool Guild::LoadMembersFromDB(QueryResult_AutoPtr guildMembersResult) { - // 0 1 2 3 4 5 - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guild_member.guid,rank, pnote, offnote, BankResetTimeMoney,BankRemMoney," - // 6 7 8 9 10 11 - "BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2," - // 12 13 14 15 16 17 - "BankResetTimeTab3, BankRemSlotsTab3, BankResetTimeTab4, BankRemSlotsTab4, BankResetTimeTab5, BankRemSlotsTab5," - // 18 19 20 21 22 - "characters.name, characters.level, characters.zone, characters.class, characters.logout_time " - "FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid WHERE guildid = '%u'", GuildId); - - if (!result) + if (!guildMembersResult) return false; do { - Field *fields = result->Fetch(); + Field *fields = guildMembersResult->Fetch(); + //this condition will be true when all rows in QueryResult are processed and new guild without members is going to be loaded - prevent crash + if (!fields) + break; + + uint32 guildId = fields[0].GetUInt32(); + if (guildId < m_Id) + { + //there is in table guild_member record which doesn't have guildid in guild table, report error + sLog.outErrorDb("Guild %u does not exist but it has a record in guild_member table, deleting it!", guildId); + CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid = '%u'", guildId); + continue; + } + + if (guildId > m_Id) + //we loaded all members for this guild already, break cycle + break; + MemberSlot newmember; - uint64 guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); - newmember.RankId = fields[1].GetUInt32(); + uint64 guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); + newmember.RankId = fields[2].GetUInt32(); //don't allow member to have not existing rank! if (newmember.RankId >= m_Ranks.size()) newmember.RankId = GetLowestRank(); - newmember.Pnote = fields[2].GetCppString(); - newmember.OFFnote = fields[3].GetCppString(); - newmember.BankResetTimeMoney = fields[4].GetUInt32(); - newmember.BankRemMoney = fields[5].GetUInt32(); - for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i) + newmember.Pnote = fields[3].GetCppString(); + newmember.OFFnote = fields[4].GetCppString(); + newmember.BankResetTimeMoney = fields[5].GetUInt32(); + newmember.BankRemMoney = fields[6].GetUInt32(); + for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i) { - newmember.BankResetTimeTab[i] = fields[6+(2*i)].GetUInt32(); - newmember.BankRemSlotsTab[i] = fields[7+(2*i)].GetUInt32(); + newmember.BankResetTimeTab[i] = fields[7+(2*i)].GetUInt32(); + newmember.BankRemSlotsTab[i] = fields[8+(2*i)].GetUInt32(); } - newmember.Name = fields[18].GetCppString(); - newmember.Level = fields[19].GetUInt8(); - newmember.ZoneId = fields[20].GetUInt32(); + newmember.Name = fields[19].GetCppString(); + newmember.Level = fields[20].GetUInt8(); newmember.Class = fields[21].GetUInt8(); - newmember.LogoutTime = fields[22].GetUInt64(); + newmember.ZoneId = fields[22].GetUInt32(); + newmember.LogoutTime = fields[23].GetUInt64(); //this code will remove unexisting character guids from guild if (newmember.Level < 1 || newmember.Level > STRONG_MAX_LEVEL) // can be at broken `data` field @@ -414,7 +415,7 @@ bool Guild::LoadMembersFromDB(uint32 GuildId) members[GUID_LOPART(guid)] = newmember; - }while (result->NextRow()); + }while (guildMembersResult->NextRow()); if (members.empty()) return false; @@ -1372,27 +1373,39 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId) // ************************************************* // Rights per day related -void Guild::LoadBankRightsFromDB(uint32 GuildId) +bool Guild::LoadBankRightsFromDB(QueryResult_AutoPtr guildBankTabRightsResult) { - // 0 1 2 3 - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT TabId, rid, gbright, SlotPerDay FROM guild_bank_right WHERE guildid = '%u' ORDER BY TabId", GuildId); - - if (!result) - return; + if (!guildBankTabRightsResult) + return true; do { - Field *fields = result->Fetch(); - uint8 TabId = fields[0].GetUInt8(); - uint32 rankId = fields[1].GetUInt32(); - uint16 right = fields[2].GetUInt16(); - uint16 SlotPerDay = fields[3].GetUInt16(); + Field *fields = guildBankTabRightsResult->Fetch(); + //prevent crash when all rights in result are already processed + if (!fields) + break; + uint32 guildId = fields[0].GetUInt32(); + if (guildId < m_Id) + { + //there is in table guild_bank_right record which doesn't have guildid in guild table, report error + sLog.outErrorDb("Guild %u does not exist but it has a record in guild_bank_right table, deleting it!", guildId); + CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid = '%u'", guildId); + continue; + } + + if (guildId > m_Id) + //we loaded all ranks for this guild bank already, break cycle + break; + uint8 TabId = fields[1].GetUInt8(); + uint32 rankId = fields[2].GetUInt32(); + uint16 right = fields[3].GetUInt16(); + uint16 SlotPerDay = fields[4].GetUInt16(); SetBankRightsAndSlots(rankId, TabId, right, SlotPerDay, false); - }while (result->NextRow()); + }while (guildBankTabRightsResult->NextRow()); - return; + return true; } // ************************************************* diff --git a/src/game/Guild.h b/src/game/Guild.h index c440177e38e..891f959655e 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -327,9 +327,10 @@ class Guild uint32 GetMemberSize() const { return members.size(); } - bool LoadGuildFromDB(uint32 GuildId); - bool LoadRanksFromDB(uint32 GuildId); - bool LoadMembersFromDB(uint32 GuildId); + bool LoadGuildFromDB(QueryResult_AutoPtr guildDataResult); + bool CheckGuildStructure(); + bool LoadRanksFromDB(QueryResult_AutoPtr guildRanksResult); + bool LoadMembersFromDB(QueryResult_AutoPtr guildMembersResult); void SetMemberStats(uint64 guid); @@ -421,7 +422,7 @@ class Guild uint32 GetBankMoneyPerDay(uint32 rankId); uint32 GetBankSlotPerDay(uint32 rankId, uint8 TabId); // rights per day - void LoadBankRightsFromDB(uint32 GuildId); + bool LoadBankRightsFromDB(QueryResult_AutoPtr guildBankTabRightsResult); // Guild Bank Event Logs void LoadGuildBankEventLogFromDB(); void DisplayGuildBankLogs(WorldSession *session, uint8 TabId); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index e19c5e850e4..f051c2c6cc3 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3223,10 +3223,14 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play void ObjectMgr::LoadGuilds() { - Guild *newguild; + Guild *newGuild; uint32 count = 0; - - QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT guildid FROM guild" ); + + // 0 1 2 3 4 5 6 + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT guild.guildid,guild.name,leaderguid,EmblemStyle,EmblemColor,BorderStyle,BorderColor," + // 7 8 9 10 11 12 + "BackgroundColor,info,motd,createdate,BankMoney,COUNT(guild_bank_tab.guildid) " + "FROM guild LEFT JOIN guild_bank_tab ON guild.guildid = guild_bank_tab.guildid GROUP BY guild.guildid ORDER BY guildid ASC"); if (!result) { @@ -3240,26 +3244,50 @@ void ObjectMgr::LoadGuilds() return; } + // load guild ranks + // 0 1 2 3 4 + QueryResult_AutoPtr guildRanksResult = CharacterDatabase.Query("SELECT guildid,rid,rname,rights,BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC"); + + // load guild members + // 0 1 2 3 4 5 6 + QueryResult_AutoPtr guildMembersResult = CharacterDatabase.Query("SELECT guildid,guild_member.guid,rank,pnote,offnote,BankResetTimeMoney,BankRemMoney," + // 7 8 9 10 11 12 + "BankResetTimeTab0,BankRemSlotsTab0,BankResetTimeTab1,BankRemSlotsTab1,BankResetTimeTab2,BankRemSlotsTab2," + // 13 14 15 16 17 18 + "BankResetTimeTab3,BankRemSlotsTab3,BankResetTimeTab4,BankRemSlotsTab4,BankResetTimeTab5,BankRemSlotsTab5," + // 19 20 21 22 23 + "characters.name, characters.level, characters.class, characters.zone, characters.logout_time " + "FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid ORDER BY guildid ASC"); + + // load guild bank tab rights + // 0 1 2 3 4 + QueryResult_AutoPtr guildBankTabRightsResult = CharacterDatabase.Query("SELECT guildid,TabId,rid,gbright,SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC"); + barGoLink bar(result->GetRowCount()); do { - Field *fields = result->Fetch(); + //Field *fields = result->Fetch(); bar.step(); ++count; - newguild = new Guild; - if (!newguild->LoadGuildFromDB(fields[0].GetUInt32())) - { - newguild->Disband(); - delete newguild; + newGuild = new Guild; + if (!newGuild->LoadGuildFromDB(result) || + !newGuild->LoadRanksFromDB(guildRanksResult) || + !newGuild->LoadMembersFromDB(guildMembersResult) || + !newGuild->LoadBankRightsFromDB(guildBankTabRightsResult) || + !newGuild->CheckGuildStructure() + ) + { + newGuild->Disband(); + delete newGuild; continue; } - newguild->LoadGuildEventLogFromDB(); - newguild->LoadGuildBankEventLogFromDB(); - newguild->LoadGuildBankFromDB(); - AddGuild(newguild); + newGuild->LoadGuildEventLogFromDB(); + newGuild->LoadGuildBankEventLogFromDB(); + newGuild->LoadGuildBankFromDB(); + AddGuild(newGuild); } while (result->NextRow()); @@ -3276,7 +3304,11 @@ void ObjectMgr::LoadArenaTeams() { uint32 count = 0; - QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT arenateamid FROM arena_team" ); + // 0 1 2 3 4 5 + QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle," + // 6 7 8 9 10 11 12 13 14 + "EmblemColor,BorderStyle,BorderColor, rating,games,wins,played,wins2,rank " + "FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" ); if( !result ) { @@ -3289,7 +3321,13 @@ void ObjectMgr::LoadArenaTeams() sLog.outString( ">> Loaded %u arenateam definitions", count ); return; } - + + // load arena_team members + QueryResult_AutoPtr arenaTeamMembersResult = CharacterDatabase.Query( + // 0 1 2 3 4 5 6 7 8 + "SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class " + "FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC"); + barGoLink bar( result->GetRowCount() ); do @@ -3299,13 +3337,15 @@ void ObjectMgr::LoadArenaTeams() bar.step(); ++count; - ArenaTeam *newarenateam = new ArenaTeam; - if(!newarenateam->LoadArenaTeamFromDB(fields[0].GetUInt32())) + ArenaTeam *newArenaTeam = new ArenaTeam; + if (!newArenaTeam->LoadArenaTeamFromDB(result) || + !newArenaTeam->LoadMembersFromDB(arenaTeamMembersResult)) { - delete newarenateam; + newArenaTeam->Disband(NULL); + delete newArenaTeam; continue; } - AddArenaTeam(newarenateam); + AddArenaTeam(newArenaTeam); }while( result->NextRow() ); sLog.outString(); -- cgit v1.2.3 From b19e793032feef0cf2dcd52262a25f6f81a15c37 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 18 Feb 2010 16:54:45 -0700 Subject: * CRLF to LF --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index f051c2c6cc3..cdc267ad1bd 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3284,8 +3284,8 @@ void ObjectMgr::LoadGuilds() delete newGuild; continue; } - newGuild->LoadGuildEventLogFromDB(); - newGuild->LoadGuildBankEventLogFromDB(); + newGuild->LoadGuildEventLogFromDB(); + newGuild->LoadGuildBankEventLogFromDB(); newGuild->LoadGuildBankFromDB(); AddGuild(newGuild); @@ -3321,13 +3321,13 @@ void ObjectMgr::LoadArenaTeams() sLog.outString( ">> Loaded %u arenateam definitions", count ); return; } - - // load arena_team members - QueryResult_AutoPtr arenaTeamMembersResult = CharacterDatabase.Query( - // 0 1 2 3 4 5 6 7 8 - "SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class " - "FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC"); - + + // load arena_team members + QueryResult_AutoPtr arenaTeamMembersResult = CharacterDatabase.Query( + // 0 1 2 3 4 5 6 7 8 + "SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class " + "FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC"); + barGoLink bar( result->GetRowCount() ); do -- cgit v1.2.3 From 1da4996189c402f8176b561abc770df0feab0630 Mon Sep 17 00:00:00 2001 From: _manuel_ Date: Fri, 19 Feb 2010 15:12:46 -0800 Subject: Razorfen downs: Implemented event from boss Tuten'kash. For a full fix see TDB Forums. --HG-- branch : trunk --- sql/updates/7390_world_scriptname.sql | 4 + src/game/ScriptLoader.cpp | 2 + src/scripts/CMakeLists.txt | 2 + .../razorfen_downs/instance_razorfen_downs.cpp | 215 +++++++++++++++++++++ .../kalimdor/razorfen_downs/razorfen_downs.cpp | 80 ++++++++ .../kalimdor/razorfen_downs/razorfen_downs.h | 45 +++++ win/VC90/game.vcproj | 60 +++--- 7 files changed, 382 insertions(+), 26 deletions(-) create mode 100644 sql/updates/7390_world_scriptname.sql create mode 100644 src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp create mode 100644 src/scripts/kalimdor/razorfen_downs/razorfen_downs.h (limited to 'src') diff --git a/sql/updates/7390_world_scriptname.sql b/sql/updates/7390_world_scriptname.sql new file mode 100644 index 00000000000..0c82857311d --- /dev/null +++ b/sql/updates/7390_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_gong' WHERE `entry`=148917; +UPDATE `creature_template` SET `ScriptName`='npc_tomb_creature' WHERE `entry` IN (7351,7349); +UPDATE `instance_template` SET `script`='instance_razorfen_downs' WHERE `map`=129; + diff --git a/src/game/ScriptLoader.cpp b/src/game/ScriptLoader.cpp index 60814ce6c83..df4c9a251fc 100644 --- a/src/game/ScriptLoader.cpp +++ b/src/game/ScriptLoader.cpp @@ -238,6 +238,7 @@ void AddSC_boss_ptheradras(); void AddSC_boss_onyxia(); //Onyxia's Lair void AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs void AddSC_razorfen_downs(); +void AddSC_instance_razorfen_downs(); void AddSC_razorfen_kraul(); //Razorfen Kraul void AddSC_boss_kurinnaxx(); //Ruins of ahn'qiraj void AddSC_boss_rajaxx(); @@ -702,6 +703,7 @@ void AddScripts() AddSC_boss_onyxia(); //Onyxia's Lair AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs AddSC_razorfen_downs(); + AddSC_instance_razorfen_downs(); AddSC_razorfen_kraul(); //Razorfen Kraul AddSC_boss_kurinnaxx(); //Ruins of ahn'qiraj AddSC_boss_rajaxx(); diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 6fc29306a27..a94f6daafa2 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -253,6 +253,8 @@ SET(scripts_STAT_SRCS kalimdor/onyxias_lair/boss_onyxia.cpp kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp kalimdor/razorfen_downs/razorfen_downs.cpp + kalimdor/razorfen_downs/instance_razorfen_downs.cpp + kalimdor/razorfen_downs/razorfen_downs.h kalimdor/razorfen_kraul/razorfen_kraul.h kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp kalimdor/razorfen_kraul/razorfen_kraul.cpp diff --git a/src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp b/src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp new file mode 100644 index 00000000000..8ac8073e1f1 --- /dev/null +++ b/src/scripts/kalimdor/razorfen_downs/instance_razorfen_downs.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2010 Trinity + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ScriptedPch.h" +#include "razorfen_downs.h" + +#define MAX_ENCOUNTER 1 + +struct instance_razorfen_downs : public ScriptedInstance +{ + instance_razorfen_downs(Map* pMap) : ScriptedInstance(pMap) + { + Initialize(); + }; + + uint64 uiGongGUID; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint8 uiGongWaves; + + std::string str_data; + + void Initialize() + { + uiGongGUID = 0; + + uiGongWaves = 0; + + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + + saveStream << "T C " << m_auiEncounter[0] + << " " << uiGongWaves; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; + + if (dataHead1 == 'T' && dataHead2 == 'C') + { + m_auiEncounter[0] = data0; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + uiGongWaves = data1; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + void OnGameObjectCreate(GameObject* pGo, bool bAdd) + { + switch(pGo->GetEntry()) + { + case GO_GONG: + uiGongGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + break; + default: + break; + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + if (uiType == DATA_GONG_WAVES) + { + uiGongWaves = uiData; + + switch(uiGongWaves) + { + case 9: + case 14: + if (GameObject* pGo = instance->GetGameObject(uiGongGUID)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + break; + case 1: + case 10: + case 16: + { + GameObject* pGo = instance->GetGameObject(uiGongGUID); + + if (!pGo) + return; + + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + + uint32 uiCreature = 0; + uint8 uiSummonTimes = 0; + + switch(uiGongWaves) + { + case 1: + uiCreature = CREATURE_TOMB_FIEND; + uiSummonTimes = 7; + break; + case 10: + uiCreature = CREATURE_TOMB_REAVER; + uiSummonTimes = 3; + break; + case 16: + uiCreature = CREATURE_TUTEN_KASH; + break; + default: + break; + } + + + if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633)) + { + if (uiGongWaves == 10 || uiGongWaves == 1) + { + for (uint8 i = 0; i < uiSummonTimes; ++i) + { + if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633)) + pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + } + } + pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + } + break; + } + default: + break; + } + } + + if (uiType == BOSS_TUTEN_KASH) + { + m_auiEncounter[0] = uiData; + + if (uiData == DONE) + SaveToDB(); + } + } + + uint32 GetData(uint32 uiType) + { + switch(uiType) + { + case DATA_GONG_WAVES: + return uiGongWaves; + } + + return 0; + } + + uint64 GetData64(uint32 uiType) + { + switch(uiType) + { + case DATA_GONG: return uiGongGUID; + } + + return 0; + } +}; + +InstanceData* GetInstanceData_instance_razorfen_downs(Map* pMap) +{ + return new instance_razorfen_downs(pMap); +} + +void AddSC_instance_razorfen_downs() +{ + Script* newscript; + + newscript = new Script; + newscript->Name = "instance_razorfen_downs"; + newscript->GetInstanceData = &GetInstanceData_instance_razorfen_downs; + newscript->RegisterSelf(); +} diff --git a/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp index 7160524ff65..d8ffb63a3a7 100644 --- a/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp +++ b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.cpp @@ -26,6 +26,7 @@ npc_henry_stern EndContentData */ #include "ScriptedPch.h" +#include "razorfen_downs.h" /*### # npc_henry_stern @@ -73,6 +74,75 @@ bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32 return true; } +/*###### +## go_gong +######*/ + +bool GOHello_go_gong(Player* pPlayer, GameObject* pGO) +{ + //basic support, not blizzlike data is missing... + ScriptedInstance* pInstance = pGO->GetInstanceData(); + + if (pInstance) + { + pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); + return true; + } + + return false; +} + +enum eTombCreature +{ + SPELL_WEB = 745 +}; + +struct npc_tomb_creatureAI : public ScriptedAI +{ + npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceData(); + } + + ScriptedInstance* pInstance; + + uint32 uiWebTimer; + + void Reset() + { + uiWebTimer = urand(5000,8000); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //from acid + if (m_creature->GetEntry() == CREATURE_TOMB_REAVER) + { + if (uiWebTimer <= uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_WEB); + uiWebTimer = urand(7000,16000); + } else uiWebTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* pKiller) + { + if (pInstance) + pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); + } +}; + +CreatureAI* GetAI_npc_tomb_creature(Creature* pCreature) +{ + return new npc_tomb_creatureAI (pCreature); +} + void AddSC_razorfen_downs() { Script* newscript; @@ -82,4 +152,14 @@ void AddSC_razorfen_downs() newscript->pGossipHello = &GossipHello_npc_henry_stern; newscript->pGossipSelect = &GossipSelect_npc_henry_stern; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_gong"; + newscript->pGOHello = &GOHello_go_gong; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_tomb_creature"; + newscript->GetAI = &GetAI_npc_tomb_creature; + newscript->RegisterSelf(); } diff --git a/src/scripts/kalimdor/razorfen_downs/razorfen_downs.h b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.h new file mode 100644 index 00000000000..d1c95d3f305 --- /dev/null +++ b/src/scripts/kalimdor/razorfen_downs/razorfen_downs.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Trinity + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef DEF_RAZORFEN_DOWNS_H +#define DEF_RAZORFEN_DOWNS_H + +enum eData +{ + BOSS_TUTEN_KASH, + DATA_GONG_WAVES +}; + +enum eData64 +{ + DATA_GONG +}; + +enum eGameObject +{ + GO_GONG = 148917 +}; + +enum eCreature +{ + CREATURE_TOMB_FIEND = 7349, + CREATURE_TOMB_REAVER = 7351, + CREATURE_TUTEN_KASH = 7355 +}; + +#endif diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index c54c46012a2..bddf1189edd 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -104,7 +104,7 @@ /> @@ -188,7 +185,7 @@ /> @@ -2888,10 +2888,18 @@ RelativePath="..\..\src\scripts\kalimdor\razorfen_downs\boss_amnennar_the_coldbringer.cpp" > + + + + - @@ -4152,7 +4160,7 @@ /> Date: Sat, 20 Feb 2010 15:29:16 +0100 Subject: Don't take away runes when not hitting --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 98ac23e69d5..28784baf64b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4086,7 +4086,7 @@ void Spell::TakePower() Powers powerType = Powers(m_spellInfo->powerType); - if(powerType == POWER_RUNE) + if(hit && powerType == POWER_RUNE) { TakeRunePower(); return; -- cgit v1.2.3