From e5750548a3a37e5e1d42596c7ced466b1484e11f Mon Sep 17 00:00:00 2001 From: QAston Date: Tue, 13 Jan 2009 20:02:28 +0100 Subject: [PATCH 01/20] *Cast master of subtlety only on real aura apply/remove. --HG-- branch : trunk --- src/game/SpellAuras.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 0c9f8d54e4..cd9e41f2c5 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3120,7 +3120,7 @@ void Aura::HandleModStealth(bool apply, bool Real) Unit::AuraList const& mDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) { - if ((*i)->GetSpellProto()->SpellIconID == 2114) + if ((*i)->GetSpellProto()->SpellIconID == 2114 && Real) { if (apply) { From d6ead868c8cb8ce4dcfd21ba673717651f9dd83e Mon Sep 17 00:00:00 2001 From: QAston Date: Tue, 13 Jan 2009 21:04:10 +0100 Subject: [PATCH 02/20] *Hopefully fix "arena players cannot see each other" bug. --HG-- branch : trunk --- src/game/GroupHandler.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index e2a575162f..02901f0bcc 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -723,8 +723,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke uint32 updatedAura=player->GetUInt32Value(UNIT_FIELD_AURA + i); *data << uint16(updatedAura); *data << uint8(1); - if(!updatedAura) - player->UnsetAuraUpdateMask(i); + //TODO: find a safe place to do this cleanup + //if(!updatedAura) + //player->UnsetAuraUpdateMask(i); } } } @@ -807,8 +808,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke uint32 updatedAura=pet->GetUInt32Value(UNIT_FIELD_AURA + i); *data << uint16(updatedAura); *data << uint8(1); - if(!updatedAura) - pet->UnsetAuraUpdateMask(i); + //TODO: find a safe place to do this cleanup + //if(!updatedAura) + //pet->UnsetAuraUpdateMask(i); } } } From 850478d38f268c0c5fc590e4e96e1e5b911dd686 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 13 Jan 2009 23:49:38 -0600 Subject: [PATCH 03/20] *Try to fix the bug that ~Creature causes crash. --HG-- branch : trunk --- src/game/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e666114543..e8ba2b815a 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12542,6 +12542,8 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo) { uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); + if(target_guid == GetGUID()) + return; if(!IS_UNIT_GUID(target_guid)) return; From cc92edba07225cf1683a94d0f133bd26862f319f Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 14 Jan 2009 00:34:08 -0600 Subject: [PATCH 04/20] *Fix a typo. By Paradox. --HG-- branch : trunk --- src/game/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/World.cpp b/src/game/World.cpp index 838e201327..99ca7c185f 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -707,7 +707,7 @@ void World::LoadConfigSettings(bool reload) { sLog.outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_configs[CONFIG_START_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS],0); - m_configs[CONFIG_MAX_ARENA_POINTS] = 0; + m_configs[CONFIG_START_ARENA_POINTS] = 0; } else if(m_configs[CONFIG_START_ARENA_POINTS] > m_configs[CONFIG_MAX_ARENA_POINTS]) { From 8137a534b40918540e9fded5d3d582a6d2a9fd44 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 14 Jan 2009 18:32:03 +0100 Subject: [PATCH 05/20] *Cleanup in code --HG-- branch : trunk --- sql/updates/838_world_scripts.sql | 3 ++- .../scripts/scripts/zone/barrens/the_barrens.cpp | 15 ++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/sql/updates/838_world_scripts.sql b/sql/updates/838_world_scripts.sql index ef963ffb16..bb7f56c059 100644 --- a/sql/updates/838_world_scripts.sql +++ b/sql/updates/838_world_scripts.sql @@ -1,3 +1,4 @@ +delete from spell_script_target where entry=42222; insert into `spell_script_target` values ('42222','1','23616'); -update `creature_template` set `scriptname`='npc_kyle_frenzied' where `entry`='23616'; \ No newline at end of file +update `creature_template` set `scriptname`='npc_kyle_frenzied' where `entry`='23616'; diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp index cf35c4b9bc..879076e106 100644 --- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp +++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp @@ -366,7 +366,7 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature *_Creature) } /*##### -## npc_wizzlecrank_shredder TODO: Pilot scripting +## npc_wizzlecrank_shredder NOTE: Part2 will be in ACID #####*/ #define SAY_PROGRESS_1 "Alright, alright I think I can figure out how to operate this thing..." @@ -380,9 +380,6 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature *_Creature) #define SAY_PROGRESS_7 "That was a close one! Well, let's get going, it's still a ways to Ratchet!" #define SAY_PROGRESS_8 "Hmm... I don't think this blinking red light is a good thing..." -#define SAY_PILOT_9 "Looks like you'll have to go ahead to Ratchet and tell Sputtervalve that I've wrecked the shredder." -#define SAY_PILOT_10 "I'll stay behind and guard the wreck. Hurry! Hopefully no one will notice the smoke..." - #define QUEST_ESCAPE 863 #define NPC_PILOT 3451 #define MOB_MERCENARY 3282 @@ -422,13 +419,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI m_creature->setDeathState(JUST_DIED); if (player && player->GetTypeId() == TYPEID_PLAYER) ((Player*)player)->GroupEventHappens(QUEST_ESCAPE, m_creature); - break; - case 32: {Unit* Pilot = FindCreature(NPC_PILOT, 30); - if(Pilot) - ((Creature*)Pilot)->Say(SAY_PILOT_9, LANG_UNIVERSAL, NULL);}break; - case 33:{ Unit* Pilot = FindCreature(NPC_PILOT, 30); - if(Pilot) - ((Creature*)Pilot)->Say(SAY_PILOT_10, LANG_UNIVERSAL, NULL);} break; + break; } } @@ -501,8 +492,6 @@ CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature *_Creature) thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000);//7 thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000);//8 thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000);//justdied summon creature - thisAI->AddWaypoint(32, 1091.28, -2985.82, 91.74, 2000);//9 - thisAI->AddWaypoint(33, 1091.28, -2985.82, 91.74, 7000);//10 return (CreatureAI*)thisAI; } From e4d2c1c04e4befe54529c4eb216f3f9e360160d3 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 14 Jan 2009 18:41:20 +0100 Subject: [PATCH 06/20] *Command for add npc formation - by Silver1ce --HG-- branch : trunk --- src/game/Chat.cpp | 1 + src/game/Chat.h | 1 + src/game/Level2.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index f02dad06e7..43811f8e3e 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -439,6 +439,7 @@ ChatCommand * ChatHandler::getCommandTable() { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL }, + { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, //{ TODO: fix or remove this commands { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 6463b347f4..39aa3cb025 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -202,6 +202,7 @@ class ChatHandler bool HandleNpcUnFollowCommand(const char* args); bool HandleNpcWhisperCommand(const char* args); bool HandleNpcYellCommand(const char* args); + bool HandleNpcAddFormationCommand(const char* args); bool HandleReloadCommand(const char* args); bool HandleReloadAllCommand(const char* args); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 0258954d98..85eef6a6da 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -4007,3 +4007,49 @@ bool ChatHandler::HandleTempGameObjectCommand(const char* args) return true; } + +bool ChatHandler::HandleNpcAddFormationCommand(const char* args) +{ + if (!*args) + return false; + + uint32 leaderGUID = (uint32) atoi((char*)args); + Creature *pCreature = getSelectedCreature(); + + if(!pCreature || !pCreature->GetDBTableGUIDLow()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + uint32 lowguid = pCreature->GetDBTableGUIDLow(); + if(pCreature->GetFormationID()) + { + PSendSysMessage("Selected creature is already member of group %u", pCreature->GetFormationID()); + return false; + } + + if (!lowguid) + return false; + + Player *chr = m_session->GetPlayer(); + FormationMember *group_member; + + group_member = new FormationMember; + group_member->follow_angle = pCreature->GetAngle(chr) - chr->GetOrientation(); + group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(),int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(),int(2))); + group_member->memberGUID = lowguid; + group_member->leaderGUID = leaderGUID; + group_member->groupAI = 0; + + CreatureGroupMap[lowguid] = group_member; + pCreature->SearchFormation(); + + WorldDatabase.PExecuteLog("INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`) VALUES ('%u','%u','%f', '%f', '%u')", + leaderGUID, lowguid, group_member->follow_dist, group_member->follow_angle, group_member->groupAI); + + PSendSysMessage("Creature %u added to formation with leader %u", lowguid, leaderGUID); + + return true; + } From ba9c0ac5a3ec53d9abc6252c7fb4b0631a583b6d Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 14 Jan 2009 19:33:55 +0100 Subject: [PATCH 07/20] *Support for quest 10337 - by Enril *Optimization in phase hunter script - by Anubisss --HG-- branch : trunk --- sql/updates/850_world_scripts.sql | 1 + .../scripts/zone/netherstorm/netherstorm.cpp | 195 +++++++++++++++--- 2 files changed, 163 insertions(+), 33 deletions(-) create mode 100644 sql/updates/850_world_scripts.sql diff --git a/sql/updates/850_world_scripts.sql b/sql/updates/850_world_scripts.sql new file mode 100644 index 0000000000..720465b63f --- /dev/null +++ b/sql/updates/850_world_scripts.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName = 'npc_bessy' WHERE entry = 20415; \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index 8d1c528f7a..8f73b828e4 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Netherstorm SD%Complete: 75 -SDComment: Quest support: 10438, 10652 (special flight paths), 10299,10321,10322,10323,10329,10330,10338,10365(Shutting Down Manaforge), 10198 +SDComment: Quest support: 10337, 10438, 10652 (special flight paths), 10299,10321,10322,10323,10329,10330,10338,10365(Shutting Down Manaforge), 10198 SDCategory: Netherstorm EndScriptData */ @@ -27,9 +27,11 @@ go_manaforge_control_console npc_commander_dawnforge npc_protectorate_nether_drake npc_veronia +npc_bessy EndContentData */ #include "precompiled.h" +#include "../../npc/npc_escortAI.h" /*###### ## npc_manaforge_control_console @@ -790,9 +792,10 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI bool Weak; bool Materialize; + bool Drained; int WeakPercent; - uint32 PlayerGUID; + uint64 PlayerGUID; uint32 Health; uint32 Level; uint32 PhaseSlipVulnerabilityTimer; @@ -802,6 +805,7 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI { Weak = false; Materialize = false; + Drained = false; WeakPercent = 25 + (rand()%16); // 25-40 PlayerGUID = 0; @@ -820,60 +824,63 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if(!Materialize) { DoCast(m_creature, SPELL_MATERIALIZE); Materialize = true; } - Player* target = NULL; - target = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); + if(m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it + DoCast(m_creature, SPELL_PHASE_SLIP); - if(!target) + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; - - if(m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it - DoCast(m_creature, SPELL_PHASE_SLIP); - if(ManaBurnTimer < diff) // cast Mana Burn - { - if(target->GetCreateMana() > 0) + + if(ManaBurnTimer < diff) // cast Mana Burn + { + if(m_creature->getVictim()->GetCreateMana() > 0) + { + DoCast(m_creature->getVictim(), SPELL_MANA_BURN); + ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd + } + }else ManaBurnTimer -= diff; + + if(PlayerGUID) // start: support for quest 10190 + { + Unit* target = Unit::GetUnit((*m_creature), PlayerGUID); + + if(target && !Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && ((Player*)target)->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) { - DoCast(target, SPELL_MANA_BURN); - ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd + DoTextEmote(EMOTE_WEAK, 0); + Weak = true; } - }else ManaBurnTimer -= diff; - - if(!Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && target->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) // start: support for quest 10190 - { - DoTextEmote(EMOTE_WEAK, 0); - Weak = true; - } - if(Weak && m_creature->HasAura(34219, 0)) - { - Health = m_creature->GetHealth(); // get the normal mob's data - Level = m_creature->getLevel(); - + if(Weak && !Drained && m_creature->HasAura(34219, 0)) + { + Drained = true; + + Health = m_creature->GetHealth(); // get the normal mob's data + Level = m_creature->getLevel(); + m_creature->AttackStop(); // delete the normal mob m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); - + Creature* DrainedPhaseHunter = NULL; - + if(!DrainedPhaseHunter) - DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob - + if(DrainedPhaseHunter) { DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data DrainedPhaseHunter->SetHealth(Health); + DrainedPhaseHunter->AddThreat(target, 10000.0f); DrainedPhaseHunter->AI()->AttackStart(target); - } - } // end: support for quest 10190 + } + } + }// end: support for quest 10190 DoMeleeAttackIfReady(); } - }; CreatureAI* GetAI_mob_phase_hunter(Creature *_Creature) @@ -881,6 +888,122 @@ CreatureAI* GetAI_mob_phase_hunter(Creature *_Creature) return new mob_phase_hunterAI (_Creature); } +/*###### +## npc_bessy +######*/ + +#define Q_ALMABTRIEB 10337 +#define N_THADELL 20464 +#define SPAWN_FIRST 20512 +#define SPAWN_SECOND 19881 +#define SAY_THADELL_1 "Bessy, is that you?" +#define SAY_THADELL_2 "Thank you for bringing back my Bessy, $N. I couldn't live without her!" + +struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI +{ + + npc_bessyAI(Creature *c) : npc_escortAI(c) {Reset();} + + bool Completed; + + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) + ((Player*)player)->FailQuest(Q_ALMABTRIEB); + } + } + + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + + if (!player) + return; + + switch(i) + { + case 3: //first spawn + m_creature->SummonCreature(SPAWN_FIRST, 2449.67, 2183.11, 96.85, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_FIRST, 2449.53, 2184.43, 96.36, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_FIRST, 2449.85, 2186.34, 97.57, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + + case 7: + m_creature->SummonCreature(SPAWN_SECOND, 2309.64, 2186.24, 92.25, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_SECOND, 2309.25, 2183.46, 91.75, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + + case 12: + if (player) + { + ((Player*)player)->GroupEventHappens(Q_ALMABTRIEB, m_creature); + Completed = true; + } + {Unit* Thadell = FindCreature(N_THADELL, 30); + if(Thadell) + ((Creature*)Thadell)->Say(SAY_THADELL_1, LANG_UNIVERSAL, NULL);}break; + case 13: + {Unit* Thadell = FindCreature(N_THADELL, 30); + if(Thadell) + ((Creature*)Thadell)->Say(SAY_THADELL_2, LANG_UNIVERSAL, NULL);}break; + } + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } + + void Aggro(Unit* who) + { + + } + + void Reset() + { + Completed = false; + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } + }; + +bool QuestAccept_npc_bessy(Player* player, Creature* creature, Quest const* quest) +{ + if (quest->GetQuestId() == Q_ALMABTRIEB) + { + creature->setFaction(1603); + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + } + return true; +} + +CreatureAI* GetAI_npc_bessy(Creature *_Creature) +{ + npc_bessyAI* bessyAI = new npc_bessyAI(_Creature); + + bessyAI->AddWaypoint(0, 2488.77, 2184.89, 104.64); + bessyAI->AddWaypoint(1, 2478.72, 2184.77, 98.58); + bessyAI->AddWaypoint(2, 2473.52, 2184.71, 99.00); + bessyAI->AddWaypoint(3, 2453.15, 2184.96, 97.09,4000); + bessyAI->AddWaypoint(4, 2424.18, 2184.15, 94.11); + bessyAI->AddWaypoint(5, 2413.18, 2184.15, 93.42); + bessyAI->AddWaypoint(6, 2402.02, 2183.90, 87.59); + bessyAI->AddWaypoint(7, 2333.31, 2181.63, 90.03,4000); + bessyAI->AddWaypoint(8, 2308.73, 2184.34, 92.04); + bessyAI->AddWaypoint(9, 2303.10, 2196.89, 94.94); + bessyAI->AddWaypoint(10, 2304.58, 2272.23, 96.67); + bessyAI->AddWaypoint(11, 2297.09, 2271.40, 95.16); + bessyAI->AddWaypoint(12, 2297.68, 2266.79, 95.07,4000); + bessyAI->AddWaypoint(13, 2297.67, 2266.76, 95.07,4000); + + return (CreatureAI*)bessyAI; +} + /*###### ## ######*/ @@ -931,5 +1054,11 @@ void AddSC_netherstorm() newscript = new Script; newscript->Name = "mob_phase_hunter"; newscript->GetAI = &GetAI_mob_phase_hunter; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_bessy"; + newscript->GetAI = &GetAI_npc_bessy; + newscript->pQuestAccept = &QuestAccept_npc_bessy; newscript->RegisterSelf(); } From 52fcc84a60f427e2c97c6cc706aea39b648a308e Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 14 Jan 2009 19:39:09 +0100 Subject: [PATCH 08/20] *Added a check for Eventstarting in hyjal - by Bagsac --HG-- branch : trunk --- .../scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp index cbb8ce53b9..53a013bed5 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp @@ -230,6 +230,13 @@ void hyjalAI::StartEvent(Player* player) if(!player) return; + Map* Hyjal = m_creature->GetMap(); + if(Hyjal->GetPlayersCountExceptGMs() < 15) //check if there are more than 15 players in hyjal (abuse prevent) + { + //error_log("Some Players try to farm in Hyjal (less than 15 people)"); + return; + } + Talk(BEGIN); EventBegun = true; From 1c417cff773defc272a50363d2536610cb9e7aa0 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 14 Jan 2009 20:02:53 +0100 Subject: [PATCH 09/20] *Cleaned up game project with new filters for better review - by XTZGZoReX --HG-- branch : trunk --- win/VC71/game.vcproj | 1352 +++++++++++++++++++++++++----------------- win/VC80/game.vcproj | 1346 +++++++++++++++++++++-------------------- win/VC90/game.vcproj | 1346 +++++++++++++++++++++-------------------- 3 files changed, 2191 insertions(+), 1853 deletions(-) diff --git a/win/VC71/game.vcproj b/win/VC71/game.vcproj index 7800a9c7b2..9cddb4d8c1 100644 --- a/win/VC71/game.vcproj +++ b/win/VC71/game.vcproj @@ -128,235 +128,516 @@ + Name="World/Others" + > + RelativePath="..\..\src\game\AuctionHouse.cpp" + > + RelativePath="..\..\src\game\Channel.cpp" + > + RelativePath="..\..\src\game\Channel.h" + > + RelativePath="..\..\src\game\Chat.cpp" + > + RelativePath="..\..\src\game\Chat.h" + > + RelativePath="..\..\src\game\GameEvent.cpp" + > + RelativePath="..\..\src\game\GameEvent.h" + > + RelativePath="..\..\src\game\GossipDef.cpp" + > + RelativePath="..\..\src\game\GossipDef.h" + > + RelativePath="..\..\src\game\Mail.cpp" + > + RelativePath="..\..\src\game\Mail.h" + > + RelativePath="..\..\src\game\QuestDef.cpp" + > + RelativePath="..\..\src\game\QuestDef.h" + > + RelativePath="..\..\src\game\UpdateData.cpp" + > + RelativePath="..\..\src\game\UpdateData.h" + > + RelativePath="..\..\src\game\World.cpp" + > + RelativePath="..\..\src\game\World.h" + > + + + RelativePath="..\..\src\game\ArenaTeam.cpp" + > + RelativePath="..\..\src\game\ArenaTeam.h" + > + RelativePath="..\..\src\game\AuctionHouseObject.h" + > + RelativePath="..\..\src\game\Bag.cpp" + > + RelativePath="..\..\src\game\Bag.h" + > + RelativePath="..\..\src\game\Corpse.cpp" + > + RelativePath="..\..\src\game\Corpse.h" + > + RelativePath="..\..\src\game\Creature.cpp" + > + RelativePath="..\..\src\game\Creature.h" + > + RelativePath="..\..\src\game\CreatureGroups.cpp" + > + RelativePath="..\..\src\game\CreatureGroups.h" + > + RelativePath="..\..\src\game\DestinationHolder.cpp" + > + RelativePath="..\..\src\game\DestinationHolder.h" + > + RelativePath="..\..\src\game\DestinationHolderImp.h" + > + RelativePath="..\..\src\game\DynamicObject.cpp" + > + RelativePath="..\..\src\game\DynamicObject.h" + > + RelativePath="..\..\src\game\Formulas.h" + > + RelativePath="..\..\src\game\GameObject.cpp" + > + RelativePath="..\..\src\game\GameObject.h" + > + RelativePath="..\..\src\game\Group.cpp" + > + RelativePath="..\..\src\game\Group.h" + > + RelativePath="..\..\src\game\Guild.cpp" + > + RelativePath="..\..\src\game\Guild.h" + > + RelativePath="..\..\src\game\Item.cpp" + > + RelativePath="..\..\src\game\Item.h" + > + RelativePath="..\..\src\game\ItemPrototype.h" + > + RelativePath="..\..\src\game\MotionMaster.cpp" + > + RelativePath="..\..\src\game\MotionMaster.h" + > + RelativePath="..\..\src\game\Object.cpp" + > + RelativePath="..\..\src\game\Object.h" + > + RelativePath="..\..\src\game\ObjectAccessor.cpp" + > + RelativePath="..\..\src\game\ObjectAccessor.h" + > + RelativePath="..\..\src\game\ObjectDefines.h" + > + RelativePath="..\..\src\game\Pet.cpp" + > + RelativePath="..\..\src\game\Pet.h" + > + RelativePath="..\..\src\game\Player.cpp" + > + RelativePath="..\..\src\game\Player.h" + > + RelativePath="..\..\src\game\TemporarySummon.cpp" + > + RelativePath="..\..\src\game\TemporarySummon.h" + > + RelativePath="..\..\src\game\Totem.cpp" + > + RelativePath="..\..\src\game\Totem.h" + > + RelativePath="..\..\src\game\Traveller.h" + > + RelativePath="..\..\src\game\Unit.cpp" + > + RelativePath="..\..\src\game\Unit.h" + > + RelativePath="..\..\src\game\UnitEvents.h" + > + RelativePath="..\..\src\game\UpdateFields.h" + > + RelativePath="..\..\src\game\UpdateMask.h" + > + + + RelativePath="..\..\src\game\GlobalEvents.cpp" + > + RelativePath="..\..\src\game\GlobalEvents.h" + > + RelativePath="..\..\src\game\Opcodes.cpp" + > + RelativePath="..\..\src\game\Opcodes.h" + > + RelativePath="..\..\src\game\SharedDefines.h" + > - + RelativePath="..\..\src\game\WorldLog.cpp" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RelativePath="..\..\src\game\BattleGroundNA.cpp" + > + RelativePath="..\..\src\game\BattleGroundNA.h" + > + RelativePath="..\..\src\game\BattleGroundRL.cpp" + > + RelativePath="..\..\src\game\BattleGroundRL.h" + > + RelativePath="..\..\src\game\BattleGroundWS.cpp" + > + RelativePath="..\..\src\game\BattleGroundWS.h" + > + + @@ -397,6 +678,14 @@ RelativePath="..\..\src\game\OutdoorPvPNA.h" > + + + + @@ -421,329 +710,69 @@ RelativePath="..\..\src\game\OutdoorPvPZM.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Name="Artificial Intelligence" + > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RelativePath="..\..\src\game\CreatureAI.cpp" + > + RelativePath="..\..\src\game\CreatureAI.h" + > + RelativePath="..\..\src\game\CreatureAIImpl.h" + > + RelativePath="..\..\src\game\CreatureAIRegistry.cpp" + > + RelativePath="..\..\src\game\CreatureAIRegistry.h" + > + RelativePath="..\..\src\game\CreatureAISelector.cpp" + > + RelativePath="..\..\src\game\CreatureAISelector.h" + > + RelativePath="..\..\src\game\GuardAI.cpp" + > + + + + + + + + + + + RelativePath="..\..\src\game\ReactorAI.cpp" + > + RelativePath="..\..\src\game\ReactorAI.h" + > + RelativePath="..\..\src\game\TotemAI.cpp" + > + RelativePath="..\..\src\game\TotemAI.h" + > + + + + + RelativePath="..\..\src\game\ConfusedMovementGenerator.cpp" + > + RelativePath="..\..\src\game\ConfusedMovementGenerator.h" + > + RelativePath="..\..\src\game\FleeingMovementGenerator.cpp" + > + RelativePath="..\..\src\game\FleeingMovementGenerator.h" + > + RelativePath="..\..\src\game\HomeMovementGenerator.cpp" + > + RelativePath="..\..\src\game\HomeMovementGenerator.h" + > + RelativePath="..\..\src\game\IdleMovementGenerator.cpp" + > + RelativePath="..\..\src\game\IdleMovementGenerator.h" + > + RelativePath="..\..\src\game\MovementGenerator.cpp" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index 0e50c786dd..dd45fb37ab 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -348,124 +348,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -474,18 +362,6 @@ RelativePath="..\..\src\game\Channel.h" > - - - - - - @@ -494,18 +370,6 @@ RelativePath="..\..\src\game\Chat.h" > - - - - - - @@ -522,74 +386,6 @@ RelativePath="..\..\src\game\GossipDef.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -598,142 +394,6 @@ RelativePath="..\..\src\game\Mail.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -742,86 +402,6 @@ RelativePath="..\..\src\game\QuestDef.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -830,26 +410,6 @@ RelativePath="..\..\src\game\UpdateData.h" > - - - - - - - - - - @@ -860,20 +420,8 @@ - - - - - - @@ -894,14 +442,6 @@ RelativePath="..\..\src\game\Bag.h" > - - - - @@ -918,34 +458,6 @@ RelativePath="..\..\src\game\Creature.h" > - - - - - - - - - - - - - - @@ -974,14 +486,6 @@ RelativePath="..\..\src\game\DynamicObject.h" > - - - - @@ -995,11 +499,11 @@ > - - - - - - - - @@ -1034,26 +522,10 @@ RelativePath="..\..\src\game\Item.h" > - - - - - - - - @@ -1062,22 +534,6 @@ RelativePath="..\..\src\game\MotionMaster.h" > - - - - - - - - @@ -1098,22 +554,6 @@ RelativePath="..\..\src\game\ObjectDefines.h" > - - - - - - - - @@ -1122,14 +562,6 @@ RelativePath="..\..\src\game\Pet.h" > - - - - @@ -1138,66 +570,6 @@ RelativePath="..\..\src\game\Player.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1206,14 +578,6 @@ RelativePath="..\..\src\game\TemporarySummon.h" > - - - - @@ -1222,14 +586,6 @@ RelativePath="..\..\src\game\Totem.h" > - - - - @@ -1254,14 +610,6 @@ RelativePath="..\..\src\game\UpdateMask.h" > - - - - + + + + @@ -1411,6 +767,682 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index 3d0b45cbc0..7b79a39993 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -353,124 +353,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -479,18 +367,6 @@ RelativePath="..\..\src\game\Channel.h" > - - - - - - @@ -499,18 +375,6 @@ RelativePath="..\..\src\game\Chat.h" > - - - - - - @@ -527,74 +391,6 @@ RelativePath="..\..\src\game\GossipDef.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -603,142 +399,6 @@ RelativePath="..\..\src\game\Mail.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -747,86 +407,6 @@ RelativePath="..\..\src\game\QuestDef.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -835,26 +415,6 @@ RelativePath="..\..\src\game\UpdateData.h" > - - - - - - - - - - @@ -865,20 +425,8 @@ - - - - - - @@ -899,14 +447,6 @@ RelativePath="..\..\src\game\Bag.h" > - - - - @@ -923,34 +463,6 @@ RelativePath="..\..\src\game\Creature.h" > - - - - - - - - - - - - - - @@ -979,14 +491,6 @@ RelativePath="..\..\src\game\DynamicObject.h" > - - - - @@ -1000,11 +504,11 @@ > - - - - - - - - @@ -1039,26 +527,10 @@ RelativePath="..\..\src\game\Item.h" > - - - - - - - - @@ -1067,22 +539,6 @@ RelativePath="..\..\src\game\MotionMaster.h" > - - - - - - - - @@ -1103,22 +559,6 @@ RelativePath="..\..\src\game\ObjectDefines.h" > - - - - - - - - @@ -1127,14 +567,6 @@ RelativePath="..\..\src\game\Pet.h" > - - - - @@ -1143,66 +575,6 @@ RelativePath="..\..\src\game\Player.h" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1211,14 +583,6 @@ RelativePath="..\..\src\game\TemporarySummon.h" > - - - - @@ -1227,14 +591,6 @@ RelativePath="..\..\src\game\Totem.h" > - - - - @@ -1259,14 +615,6 @@ RelativePath="..\..\src\game\UpdateMask.h" > - - - - + + + + @@ -1416,6 +772,682 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1e92a75f8fc08cf61732aeeac963302551d24a10 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 14 Jan 2009 20:21:38 +0100 Subject: [PATCH 10/20] *Added missed row in 850 --HG-- branch : trunk --- .../scripts/scripts/zone/netherstorm/netherstorm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index 8f73b828e4..016eed30da 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -868,6 +868,7 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI Creature* DrainedPhaseHunter = NULL; if(!DrainedPhaseHunter) + DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob if(DrainedPhaseHunter) { @@ -956,10 +957,7 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void Aggro(Unit* who) - { - - } + void Aggro(Unit* who){} void Reset() { @@ -970,7 +968,8 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI { npc_escortAI::UpdateAI(diff); } - }; + +}; bool QuestAccept_npc_bessy(Player* player, Creature* creature, Quest const* quest) { From fcd3a315422c629b313033f9530ba89773c2b332 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 14 Jan 2009 19:54:55 -0600 Subject: [PATCH 11/20] *Fix a bug in removeaura. --HG-- branch : trunk --- src/game/Unit.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e8ba2b815a..c828aa3012 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4596,6 +4596,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) Aura* Aur = i->second; SpellEntry const* AurSpellInfo = Aur->GetSpellProto(); + // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura + // remove aura from list before to prevent deleting it before + m_Auras.erase(i); + ++m_removedAuras; // internal count used by unit update + Unit* caster = NULL; if (IsSingleTargetSpell(AurSpellInfo)) { @@ -4615,22 +4620,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order) if (Aur->GetModifier()->m_auraname < TOTAL_AURAS) { - m_modAuras[(*i).second->GetModifier()->m_auraname].remove((*i).second); - if((*i).second->GetSpellProto()->AuraInterruptFlags) + m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur); + + if(Aur->GetSpellProto()->AuraInterruptFlags) { - m_interruptableAuras.remove((*i).second); + m_interruptableAuras.remove(Aur); UpdateInterruptMask(); } - if((*i).second->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) - m_ccAuras.remove((*i).second); + + if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) + m_ccAuras.remove(Aur); } // Set remove mode Aur->SetRemoveMode(mode); - // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura - // remove aura from list before to prevent deleting it before - m_Auras.erase(i); - ++m_removedAuras; // internal count used by unit update // Statue unsummoned at aura remove Totem* statue = NULL; @@ -4651,12 +4654,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if(const std::vector *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id)) { - for(std::vector::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i) + for(std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) { if(spell_triggered < 0) - RemoveAurasDueToSpell(-(*i)); + RemoveAurasDueToSpell(-(*itr)); else if(Unit* caster = Aur->GetCaster()) - CastSpell(this, *i, true, 0, 0, caster->GetGUID()); + CastSpell(this, *itr, true, 0, 0, caster->GetGUID()); } } From fb9a507643e0ef0dc1963bfb7a5c2c8ade678f86 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Thu, 15 Jan 2009 16:45:24 +0100 Subject: [PATCH 12/20] *Support for creature 16518 *Support for item 22962 --HG-- branch : trunk --- sql/updates/852_world_scripts.sql | 2 + .../scripts/scripts/item/item_scripts.cpp | 25 ++++++++ .../zone/azuremyst_isle/azuremyst_isle.cpp | 61 ++++++++++++++++++- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 sql/updates/852_world_scripts.sql diff --git a/sql/updates/852_world_scripts.sql b/sql/updates/852_world_scripts.sql new file mode 100644 index 0000000000..96b5c7d6e7 --- /dev/null +++ b/sql/updates/852_world_scripts.sql @@ -0,0 +1,2 @@ +update creature_template set scriptname='mob_nestlewood_owlkin' where entry=16518; +update item_template set scriptname='item_inoculating_crystal' where entry=22962; \ No newline at end of file diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp index 889a4d900e..22e437079f 100644 --- a/src/bindings/scripts/scripts/item/item_scripts.cpp +++ b/src/bindings/scripts/scripts/item/item_scripts.cpp @@ -41,6 +41,7 @@ item_voodoo_charm Provide proper error message and target(q256 item_vorenthals_presence(i30259) Prevents abuse of this item item_yehkinyas_bramble(i10699) Allow cast spell on vale screecher only and remove corpse if cast sucessful (q3520) item_zezzak_shard(i31463) Quest The eyes of Grillok (q10813). Prevents abuse +item_inoculating_crystal Quest Inoculating. Prevent abuse EndContentData */ #include "precompiled.h" @@ -285,6 +286,25 @@ bool ItemUse_item_muiseks_vessel(Player *player, Item* _Item, SpellCastTargets c return true; } +/*##### +# item_inoculating_crystal +#####*/ + +bool ItemUse_item_inoculating_crystal(Player *player, Item* _Item, SpellCastTargets const& targets) +{ + if( targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId()==TYPEID_UNIT && + targets.getUnitTarget()->GetEntry() == 16518 ) + return false; + + WorldPacket data(SMSG_CAST_FAILED, (4+2)); // prepare packet error message + data << uint32(_Item->GetEntry()); // itemId + data << uint8(SPELL_FAILED_BAD_TARGETS); // reason + player->GetSession()->SendPacket(&data); // send message: Invalid target + + player->SendEquipError(EQUIP_ERR_NONE,_Item,NULL); // break spell + return true; +} + /*##### # item_razorthorn_flayer_gland #####*/ @@ -519,6 +539,11 @@ void AddSC_item_scripts() newscript->pItemUse = &ItemUse_item_muiseks_vessel; newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="item_inoculating_crystal"; + newscript->pItemUse = &ItemUse_item_inoculating_crystal; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name="item_razorthorn_flayer_gland"; newscript->pItemUse = &ItemUse_item_razorthorn_flayer_gland; diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp index 92ce2caaa4..b4eefc43ce 100644 --- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Azuremyst_Isle SD%Complete: 75 -SDComment: Quest support: 9283, 9537, 9582, 9554, 9531(special flight path, proper model for mount missing). Injured Draenei cosmetic only +SDComment: Quest support: 9283, 9537, 9582, 9554, 9531, 9303(special flight path, proper model for mount missing). Injured Draenei cosmetic only SDCategory: Azuremyst Isle EndScriptData */ @@ -28,6 +28,7 @@ npc_injured_draenei npc_magwin npc_susurrus npc_geezle +mob_nestlewood_owlkin EndContentData */ #include "precompiled.h" @@ -608,9 +609,60 @@ CreatureAI* GetAI_npc_geezleAI(Creature *_Creature) } /*###### -## +## mob_nestlewood_owlkin ######*/ +#define INOCULATION_CHANNEL 29528 +#define INOCULATED_OWLKIN 16534 + +struct TRINITY_DLL_DECL mob_nestlewood_owlkinAI : public ScriptedAI +{ + mob_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 ChannelTimer; + bool Channeled; + bool Hitted; + + void Reset() + { + ChannelTimer = 0; + Channeled = false; + Hitted = false; + } + + void Aggro(Unit *who){} + + void SpellHit(Unit* caster, const SpellEntry* spell) + { + if(!caster) + return; + + if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == INOCULATION_CHANNEL) + { + ChannelTimer = 3000; + Hitted = true; + } + } + + void UpdateAI(const uint32 diff) + { + if(ChannelTimer < diff && !Channeled && Hitted) + { + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + m_creature->SummonCreature(INOCULATED_OWLKIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + Channeled = true; + }else ChannelTimer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_nestlewood_owlkinAI(Creature *_Creature) +{ + return new mob_nestlewood_owlkinAI (_Creature); +} + void AddSC_azuremyst_isle() { Script *newscript; @@ -649,4 +701,9 @@ void AddSC_azuremyst_isle() newscript->GetAI = &GetAI_npc_geezleAI; newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="mob_nestlewood_owlkin"; + newscript->GetAI = &GetAI_mob_nestlewood_owlkinAI; + newscript->RegisterSelf(); + } From 65bd8648f084de7d0f5cbadd59cebd562de7243b Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Thu, 15 Jan 2009 17:23:16 +0100 Subject: [PATCH 13/20] *Corrected factions in two scripts --HG-- branch : trunk --- src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp | 3 ++- .../scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index 016eed30da..34fb3d3b50 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -975,7 +975,8 @@ bool QuestAccept_npc_bessy(Player* player, Creature* creature, Quest const* ques { if (quest->GetQuestId() == Q_ALMABTRIEB) { - creature->setFaction(1603); + creature->setFaction(113); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); } return true; diff --git a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp index 51cb2b4456..5d1bc07286 100644 --- a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp +++ b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp @@ -126,8 +126,9 @@ bool QuestAccept_npc_ame(Player* player, Creature* creature, Quest const* quest) { ((npc_escortAI*)(creature->AI()))->Start(false, true, false, player->GetGUID()); DoScriptText(SAY_READY, creature, player); + creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); // Change faction so mobs attack - creature->setFaction(775); + creature->setFaction(113); } return true; } From e9fdfb434aba417045fd8e354b8fbe73135e560f Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Thu, 15 Jan 2009 20:42:41 +0100 Subject: [PATCH 14/20] *Support for quest 6523 --HG-- branch : trunk --- sql/updates/857_world_scripts.sql | 1 + .../stonetalon_mountains.cpp | 123 +++++++++++++++++- .../scripts/zone/undercity/undercity.cpp | 2 +- 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 sql/updates/857_world_scripts.sql diff --git a/sql/updates/857_world_scripts.sql b/sql/updates/857_world_scripts.sql new file mode 100644 index 0000000000..3a34d80ee7 --- /dev/null +++ b/sql/updates/857_world_scripts.sql @@ -0,0 +1 @@ +update creature_template set scriptname='npc_kaya_flathoof' where entry=11856; \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp index 28f0c64472..a5ea8dd222 100644 --- a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp @@ -17,11 +17,17 @@ /* ScriptData SDName: Stonetalon_Mountains SD%Complete: 95 -SDComment: Quest support: 6627 (Braug Dimspirits questions/'answers' might have more to it, need more info) +SDComment: Quest support: 6627, 6523 SDCategory: Stonetalon Mountains EndScriptData */ +/* ContentData +npc_braug_dimspirit +npc_kaya_flathoof +EndContentData */ + #include "precompiled.h" +#include "../../npc/npc_escortAI.h" /*###### ## npc_braug_dimspirit @@ -64,6 +70,115 @@ bool GossipSelect_npc_braug_dimspirit(Player *player, Creature *_Creature, uint3 return true; } +/*###### +## npc_kaya_flathoof +######*/ + +#define SAY_START "Let's go before they find out I'm free!" +#define SAY_AMBUSH "Look out! We're under attack!" +#define SAY_END "Thank you for helping me. I know my way back from here." + +#define QUEST_PK 6523 +#define MOB_GB 11912 +#define MOB_GR 11910 +#define MOB_GS 11913 + +struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI +{ + npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {Reset();} + + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + + if(!player) + return; + + switch(i) + { + case 22: + DoSay(SAY_AMBUSH, LANG_UNIVERSAL, NULL); + m_creature->SummonCreature(MOB_GB, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(MOB_GR, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(MOB_GS, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 23: m_creature->SetInFront(player); + DoSay(SAY_END, LANG_UNIVERSAL, player, true); + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_PK, m_creature); + break; + } + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } + + void Reset(){} + + void Aggro(Unit* who){} + + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_PK); + } + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } +}; + +bool QuestAccept_npc_kaya_flathoof(Player* player, Creature* creature, Quest const* quest) +{ + if (quest->GetQuestId() == QUEST_PK) + { + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + creature->Say(SAY_START, LANG_UNIVERSAL, NULL); + creature->setFaction(113); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + } + return true; +} + +CreatureAI* GetAI_npc_kaya_flathoofAI(Creature *_Creature) +{ + npc_kaya_flathoofAI* thisAI = new npc_kaya_flathoofAI(_Creature); + + thisAI->AddWaypoint(0, 122.37, -345.80, 3.59); + thisAI->AddWaypoint(1, 113.69, -350.01, 4.54); + thisAI->AddWaypoint(2, 107.32, -353.09, 3.33); + thisAI->AddWaypoint(3, 99.25, -342.43, 2.87); + thisAI->AddWaypoint(4, 111.19, -315.60, 3.71); + thisAI->AddWaypoint(5, 109.99, -293.92, 5.16); + thisAI->AddWaypoint(6, 104.59, -268.27, 4.78); + thisAI->AddWaypoint(7, 82.80, -247.28, 5.73); + thisAI->AddWaypoint(8, 66.44, -245.99, 5.85); + thisAI->AddWaypoint(9, 34.36, -246.01, 5.97); + thisAI->AddWaypoint(10, 13.24, -245.61, 5.25); + thisAI->AddWaypoint(11, -10.27, -248.66, 4.69); + thisAI->AddWaypoint(12, -26.07, -262.76, 0.01); + thisAI->AddWaypoint(13, -33.15, -282.03, -4.12); + thisAI->AddWaypoint(14, -28.42, -315.52, -8.56); + thisAI->AddWaypoint(15, -32.05, -339.34, -10.84); + thisAI->AddWaypoint(16, -35.22, -358.11, -16.20); + thisAI->AddWaypoint(17, -51.57, -391.63, -24.85); + thisAI->AddWaypoint(18, -58.58, -409.08, -29.97); + thisAI->AddWaypoint(19, -60.37, -441.23, -36.80); + thisAI->AddWaypoint(20, -59.03, -476.39, -44.98); + thisAI->AddWaypoint(21, -53.18, -490.31, -46.11); + thisAI->AddWaypoint(22, -43.77, -497.99, -46.13, 3000);// summon + thisAI->AddWaypoint(23, -41.77, -518.15, -46.13, 5000);//end + + return (CreatureAI*)thisAI; +} + /*###### ## AddSC ######*/ @@ -77,4 +192,10 @@ void AddSC_stonetalon_mountains() newscript->pGossipHello = &GossipHello_npc_braug_dimspirit; newscript->pGossipSelect = &GossipSelect_npc_braug_dimspirit; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_kaya_flathoof"; + newscript->GetAI = &GetAI_npc_kaya_flathoofAI; + newscript->pQuestAccept = &QuestAccept_npc_kaya_flathoof; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp index 9b2dc13ac2..a5ba4abfd9 100644 --- a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp +++ b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Undercity SD%Complete: 95 -SDComment: Quest support: 6628(Parqual Fintallas questions/'answers' might have more to it, need more info), 9180(post-event). +SDComment: Quest support: 6628, 9180(post-event). SDCategory: Undercity EndScriptData */ From 2d654fdc413cf769e65415f0e4cab50a63642ca1 Mon Sep 17 00:00:00 2001 From: Paradox Date: Thu, 15 Jan 2009 21:29:32 -0500 Subject: [PATCH 15/20] Fix cross faction interaction --HG-- branch : trunk --- src/game/Group.cpp | 21 ++++++++++++- src/game/Group.h | 3 ++ src/game/GroupHandler.cpp | 2 ++ src/game/Level3.cpp | 2 +- src/game/Object.cpp | 45 +++++++++++++++++++++++++++ src/game/Object.h | 4 +++ src/game/Pet.cpp | 6 ++-- src/game/Player.cpp | 2 +- src/game/Unit.h | 2 +- src/trinitycore/trinitycore.conf.dist | 1 + 10 files changed, 81 insertions(+), 7 deletions(-) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 3e9dcff7d1..85c707d41f 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -295,12 +295,14 @@ bool Group::AddMember(const uint64 &guid, const char* name) uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method) { + BroadcastGroupUpdate(); + // remove member and change leader (if need) only if strong more 2 members _before_ member remove if(GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group { bool leaderChanged = _removeMember(guid); - Player *player = objmgr.GetPlayer( guid ); + Player *player = objmgr.GetPlayer( guid ); // FG: TODO: could be removed, its just here for consistency if (player) { WorldPacket data; @@ -1517,3 +1519,20 @@ void Group::_homebindIfInstance(Player *player) player->m_InstanceValid = false; } } + +void Group::BroadcastGroupUpdate(void) +{ + // FG: HACK: force flags update on group leave - for values update hack + // -- not very efficient but safe + for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) + { + + Player *pp = objmgr.GetPlayer(citr->guid); + if(pp && pp->IsInWorld()) + { + pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2); + pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE); + DEBUG_LOG("-- Forced group value update for '%s'", pp->GetName()); + } + } +} \ No newline at end of file diff --git a/src/game/Group.h b/src/game/Group.h index 8417a14526..7cb37b17ff 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -330,6 +330,9 @@ class TRINITY_DLL_SPEC Group InstanceGroupBind* GetBoundInstance(uint32 mapid, uint8 difficulty); BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; } + // FG: evil hacks + void BroadcastGroupUpdate(void); + protected: bool _addMember(const uint64 &guid, const char* name, bool isAssistant=false); bool _addMember(const uint64 &guid, const char* name, bool isAssistant, uint8 group); diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 02901f0bcc..679c16ced5 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -215,6 +215,8 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ ) uint8 subgroup = group->GetMemberGroup(GetPlayer()->GetGUID()); GetPlayer()->SetGroup(group, subgroup); + + group->BroadcastGroupUpdate(); } void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ ) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index a825743481..c14320fd68 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -4465,7 +4465,7 @@ static bool HandleResetStatsOrLevelHelper(Player* player) // set UNIT_FIELD_BYTES_1 to init state but preserve m_form value player->SetUInt32Value(UNIT_FIELD_BYTES_1, unitfield); - player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK3 | UNIT_BYTE2_FLAG_UNK5 ); + player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_UNK5 ); player->SetByteValue(UNIT_FIELD_BYTES_2, 3, player->m_form); player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 6d6cbb4f86..d114d1e82c 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -626,6 +626,38 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask else *data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_OTHER_TAGGER); } + // FG: pretend that OTHER players in own group are friendly ("blue") + else if(index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE) + { + bool ch = false; + if(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER && target != this) + { + if(target->IsInSameGroupWith((Player*)this) || target->IsInSameRaidWith((Player*)this)) + { + if(index == UNIT_FIELD_BYTES_2) + { + DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Player*)this)->GetName()); + *data << ( m_uint32Values[ index ] & (UNIT_BYTE2_FLAG_SANCTUARY << 8) ); // this flag is at uint8 offset 1 !! + ch = true; + } + else if(index == UNIT_FIELD_FACTIONTEMPLATE) + { + FactionTemplateEntry const *ft1, *ft2; + ft1 = ((Player*)this)->getFactionTemplateEntry(); + ft2 = ((Player*)target)->getFactionTemplateEntry(); + if(ft1 && ft2 && !ft1->IsFriendlyTo(*ft2)) + { + uint32 faction = ((Player*)target)->getFaction(); // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work) + DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Player*)this)->GetName(), faction); + *data << uint32(faction); + ch = true; + } + } + } + } + if(!ch) + *data << m_uint32Values[ index ]; + } else { // send in current format (float as float, uint32 as uint32) @@ -1297,6 +1329,19 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf) SendMessageToSet( &data, true ); // ToSelf ignored in this case } +void Object::ForceValuesUpdateAtIndex(uint32 i) +{ + m_uint32Values_mirror[i] = GetUInt32Value(i) + 1; // makes server think the field changed + if(m_inWorld) + { + if(!m_objectUpdated) + { + ObjectAccessor::Instance().AddUpdateObject(this); + m_objectUpdated = true; + } + } +} + namespace Trinity { class MessageChatLocaleCacheDo diff --git a/src/game/Object.h b/src/game/Object.h index ad56e68773..187092d577 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -301,6 +301,10 @@ class TRINITY_DLL_SPEC Object virtual bool hasQuest(uint32 /* quest_id */) const { return false; } virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; } + + // FG: some hacky helpers + void ForceValuesUpdateAtIndex(uint32); + protected: Object ( ); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index d42ab2af74..fe53242825 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -231,7 +231,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100); SetByteValue(UNIT_FIELD_BYTES_1, 1, fields[8].GetUInt32()); SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); - SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK3 | UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5 ); + SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5 ); if(fields[12].GetBool()) SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_NOT_ALLOWED); @@ -978,7 +978,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) { SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100); SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); - SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK3 | UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5 ); + SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5 ); SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED); SetUInt32Value(UNIT_MOD_CAST_SPEED, creature->GetUInt32Value(UNIT_MOD_CAST_SPEED) ); @@ -1760,7 +1760,7 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 pet_number) return false; SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE ); - SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK3 | UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5 ); + SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5 ); if(getPetType() == MINI_PET) // always non-attackable SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index daf589dd9a..46d10e37b1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -561,7 +561,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 SetUInt32Value(UNIT_FIELD_BYTES_0, ( RaceClassGender | ( powertype << 24 ) ) ); SetUInt32Value(UNIT_FIELD_BYTES_1, unitfield); - SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK3 | UNIT_BYTE2_FLAG_UNK5 ); + SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_UNK5 ); SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE ); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client diff --git a/src/game/Unit.h b/src/game/Unit.h index ec192fe942..5d5b0d492f 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -171,7 +171,7 @@ enum UnitBytes2_Flags UNIT_BYTE2_FLAG_UNK0 = 0x01, UNIT_BYTE2_FLAG_UNK1 = 0x02, UNIT_BYTE2_FLAG_UNK2 = 0x04, - UNIT_BYTE2_FLAG_UNK3 = 0x08, + UNIT_BYTE2_FLAG_SANCTUARY = 0x08, UNIT_BYTE2_FLAG_AURAS = 0x10, // show possitive auras as positive, and allow its dispel UNIT_BYTE2_FLAG_UNK5 = 0x20, UNIT_BYTE2_FLAG_UNK6 = 0x40, diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index 91b0209acd..af81a84038 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -670,6 +670,7 @@ AllowTwoSide.Interaction.Auction = 0 AllowTwoSide.Interaction.Mail = 0 AllowTwoSide.WhoList = 0 AllowTwoSide.AddFriend = 0 +AllowTwoSide.Trade = 0 TalentsInspecting = 1 ################################################################################################################### From a48321f34805153d1dfe462e3950c63299ea4184 Mon Sep 17 00:00:00 2001 From: KingPin Date: Thu, 15 Jan 2009 21:59:40 -0500 Subject: [PATCH 16/20] minor fix to Crossfaction trading patch originally by fgenesis, submitted for inclusion by Biglad. --HG-- branch : trunk --- src/game/TradeHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 58a18896e9..dc3bd020cc 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -536,7 +536,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if(pOther->GetTeam() !=_player->GetTeam() ) + if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam() ) { SendTradeStatus(TRADE_STATUS_WRONG_FACTION); return; From 4ce857b400770023afb45ffdab09a3a1a5db83e0 Mon Sep 17 00:00:00 2001 From: raczman Date: Thu, 15 Jan 2009 22:01:47 -0500 Subject: [PATCH 17/20] Cleanup of log output --HG-- branch : trunk --- src/game/BattleGroundAV.cpp | 2 +- src/game/CharacterHandler.cpp | 4 ++-- src/game/GameEvent.cpp | 2 +- src/game/Item.cpp | 8 ++++---- src/game/NPCHandler.cpp | 4 ++-- src/game/Pet.cpp | 4 ++-- src/game/Unit.cpp | 6 +++--- src/game/World.cpp | 4 ++-- src/game/WorldSocket.cpp | 2 +- src/trinitycore/Master.cpp | 8 ++++---- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 27cd169ffc..6b892a0fa5 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -125,7 +125,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) return;//maybe we should log this, cause this must be a cheater or a big bug uint8 team = GetTeamIndexByTeamId(player->GetTeam()); //TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor - sLog.outError("BG_AV Quest %i completed",questid); + sLog.outDebug("BG_AV Quest %i completed",questid); switch(questid) { case AV_QUEST_A_SCRAPS1: diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 170f425022..ccc6594a72 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -389,7 +389,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); std::string IP_str = GetRemoteAddress(); - sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); + sLog.outDetail("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); } @@ -439,7 +439,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) return; std::string IP_str = GetRemoteAddress(); - sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); + sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); if(sLog.IsOutCharDump()) // optimize GetPlayerDump call diff --git a/src/game/GameEvent.cpp b/src/game/GameEvent.cpp index 17084dd3eb..9ceed9024c 100644 --- a/src/game/GameEvent.cpp +++ b/src/game/GameEvent.cpp @@ -1016,7 +1016,7 @@ uint32 GameEvent::Update() // return the next e nextEventDelay = 0; for(std::set::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr) StopEvent(*itr); - sLog.outBasic("Next game event check in %u seconds.", nextEventDelay + 1); + sLog.outDetail("Next game event check in %u seconds.", nextEventDelay + 1); return (nextEventDelay + 1) * 1000; // Add 1 second to be sure event has started/stopped at next call } diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 0c264a76d8..b0c2109a5b 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -641,14 +641,14 @@ void Item::AddToUpdateQueueOf(Player *player) player = GetOwner(); if (!player) { - sLog.outError("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); + sLog.outDebug("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); return; } } if (player->GetGUID() != GetOwnerGUID()) { - sLog.outError("Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + sLog.outDebug("Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); return; } @@ -667,14 +667,14 @@ void Item::RemoveFromUpdateQueueOf(Player *player) player = GetOwner(); if (!player) { - sLog.outError("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); + sLog.outDebug("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); return; } } if (player->GetGUID() != GetOwnerGUID()) { - sLog.outError("Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + sLog.outDebug("Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); return; } diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 6bb916d9fe..edf58fd762 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -322,9 +322,9 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) { // recheck CHECK_PACKET_SIZE(recv_data,8+4+1); - sLog.outBasic("reading string"); + sLog.outDebug("reading string"); recv_data >> code; - sLog.outBasic("string read: %s", code.c_str()); + sLog.outDebug("string read: %s", code.c_str()); } Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_NONE); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index fe53242825..cafebf45f3 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -927,10 +927,10 @@ bool Pet::CreateBaseAtCreature(Creature* creature) } uint32 guid=objmgr.GenerateLowGuid(HIGHGUID_PET); - sLog.outBasic("SetInstanceID()"); + sLog.outDebug("SetInstanceID()"); SetInstanceId(creature->GetInstanceId()); - sLog.outBasic("Create pet"); + sLog.outDebug("Create pet"); uint32 pet_number = objmgr.GeneratePetNumber(); if(!Create(guid, creature->GetMap(), creature->GetEntry(), pet_number)) return false; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c828aa3012..900c7526fa 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -457,9 +457,9 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, float combat_reach = GetCombatReach(); if(combat_reach < 0.1) // sometimes bugged for players { - sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); - if(GetTypeId() == TYPEID_UNIT) - sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); + //sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); + // if(GetTypeId() == TYPEID_UNIT) + // sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); combat_reach = DEFAULT_COMBAT_REACH; } uint32 attacker_number = getAttackers().size(); diff --git a/src/game/World.cpp b/src/game/World.cpp index 99ca7c185f..80f995834a 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1308,7 +1308,7 @@ void World::SetInitialWorldSettings() exit(1); ///- Initialize game time and timers - sLog.outString( "DEBUG:: Initialize game time and timers" ); + sLog.outDebug( "DEBUG:: Initialize game time and timers" ); m_gameTime = time(NULL); m_startTime=m_gameTime; @@ -1453,7 +1453,7 @@ void World::Update(time_t diff) { if(m_updateTimeSum > m_configs[CONFIG_INTERVAL_LOG_UPDATE]) { - sLog.outString("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); + sLog.outBasic("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); m_updateTimeSum = m_updateTime; m_updateTimeCount = 1; } diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 847fd2e838..2551f1d07d 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -830,7 +830,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket (packet); - sLog.outBasic ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + sLog.outDetail ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index c1484fede8..ed526f497c 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2005-2008 MaNGOS * * Copyright (C) 2008 Trinity @@ -408,7 +408,7 @@ bool Master::_StartDB() sLog.outError("Database not specified in configuration file"); return false; } - sLog.outString("World Database: %s", dbstring.c_str()); + sLog.outDetail("World Database: %s", dbstring.c_str()); ///- Initialise the world database if(!WorldDatabase.Initialize(dbstring.c_str())) @@ -422,7 +422,7 @@ bool Master::_StartDB() sLog.outError("Character Database not specified in configuration file"); return false; } - sLog.outString("Character Database: %s", dbstring.c_str()); + sLog.outDetail("Character Database: %s", dbstring.c_str()); ///- Initialise the Character database if(!CharacterDatabase.Initialize(dbstring.c_str())) @@ -439,7 +439,7 @@ bool Master::_StartDB() } ///- Initialise the login database - sLog.outString("Login Database: %s", dbstring.c_str() ); + sLog.outDetail("Login Database: %s", dbstring.c_str() ); if(!LoginDatabase.Initialize(dbstring.c_str())) { sLog.outError("Cannot connect to login database %s",dbstring.c_str()); From b5debc9a67571457420dda976ee386ad1e1a1317 Mon Sep 17 00:00:00 2001 From: KingPin Date: Thu, 15 Jan 2009 22:25:19 -0500 Subject: [PATCH 18/20] Lets try this again... missing part from faction fix. --HG-- branch : trunk --- src/game/World.cpp | 1 + src/game/World.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/game/World.cpp b/src/game/World.cpp index 80f995834a..89a0b75cd3 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -606,6 +606,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Mail",false); m_configs[CONFIG_ALLOW_TWO_SIDE_WHO_LIST] = sConfig.GetBoolDefault("AllowTwoSide.WhoList", false); m_configs[CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND] = sConfig.GetBoolDefault("AllowTwoSide.AddFriend", false); + m_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfig.GetBoolDefault("AllowTwoSide.trade", false); m_configs[CONFIG_STRICT_PLAYER_NAMES] = sConfig.GetIntDefault("StrictPlayerNames", 0); m_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfig.GetIntDefault("StrictCharterNames", 0); m_configs[CONFIG_STRICT_PET_NAMES] = sConfig.GetIntDefault("StrictPetNames", 0); diff --git a/src/game/World.h b/src/game/World.h index 80b876ccaf..6ccebf8d9c 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -96,6 +96,7 @@ enum WorldConfigs CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL, CONFIG_ALLOW_TWO_SIDE_WHO_LIST, CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND, + CONFIG_ALLOW_TWO_SIDE_TRADE CONFIG_STRICT_PLAYER_NAMES, CONFIG_STRICT_CHARTER_NAMES, CONFIG_STRICT_PET_NAMES, From 56a80b4dd34b032b15abce97626a6915ba278463 Mon Sep 17 00:00:00 2001 From: KingPin Date: Thu, 15 Jan 2009 22:36:19 -0500 Subject: [PATCH 19/20] typo --HG-- branch : trunk --- src/game/World.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/World.h b/src/game/World.h index 6ccebf8d9c..63d9b52d7f 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -96,7 +96,7 @@ enum WorldConfigs CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL, CONFIG_ALLOW_TWO_SIDE_WHO_LIST, CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND, - CONFIG_ALLOW_TWO_SIDE_TRADE + CONFIG_ALLOW_TWO_SIDE_TRADE, CONFIG_STRICT_PLAYER_NAMES, CONFIG_STRICT_CHARTER_NAMES, CONFIG_STRICT_PET_NAMES, From a8e7fb16493c05a25044c01c5b58ea08e485a97a Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Fri, 16 Jan 2009 14:33:21 +0100 Subject: [PATCH 20/20] *Support for quest 648 - by Enril --HG-- branch : trunk --- sql/updates/863_world_scripts.sql | 12 + .../scripts/scripts/zone/tanaris/tanaris.cpp | 211 +++++++++++++++++- 2 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 sql/updates/863_world_scripts.sql diff --git a/sql/updates/863_world_scripts.sql b/sql/updates/863_world_scripts.sql new file mode 100644 index 0000000000..e23f6067c0 --- /dev/null +++ b/sql/updates/863_world_scripts.sql @@ -0,0 +1,12 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1060005 AND -1060000; +INSERT INTO script_texts + (`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 + (-1060000, 'Emergency power activated! Initializing ambulatory motor! CLUCK!', NULL, NULL, 'Notfallenergie aktiviert! Ambulatorenantrieb wird gestartet! GLUCK!', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060001, 'Physical threat detected! Evasive action! CLUCK!', NULL, NULL, 'Körperliche Bedrohung entdeckt! Ausweichmanöver! GLUCK!', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060002, 'Threat analyzed! Activating combat plan beta! CLUCK!', NULL, NULL, 'Bedrohung analysiert! Gefechtsplan Beta wird aktiviert! GLUCK!', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060003, 'CLUCK! Sensors detect spatial anomaly -- danger imminent! CLUCK', NULL, NULL, 'GLUCK! Sensoren haben räumliche Anomalie entdeckt - Gefahr im Verzug! GLUCK!', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060004, 'No one challenges the wastevander nomads -- not even robotic chickens! ATTACK!', NULL, NULL, 'Niemand fordert die Wüsenläufernomaden heraus - auch keine Robothühner! ANGRIFF!', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060005, 'Cloaking systems online! CLUCK! Engaging cloak for transport to Booty Bay!', NULL, NULL, 'Tarnsysteme online! GLUCK! Tarnung für Transport nach Beutebucht wird aktiviert.', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL); + +UPDATE `creature_template` SET `ScriptName` = 'npc_OOX17' WHERE `entry` = 7784; \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp index 90f680cf82..6cf663616b 100644 --- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp +++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Tanaris SD%Complete: 80 -SDComment: Quest support: 2954, 4005, 10277, 10279(Special flight path). Noggenfogger vendor +SDComment: Quest support: 2954, 4005, 10277, 648, 10279(Special flight path). Noggenfogger vendor SDCategory: Tanaris EndScriptData */ @@ -27,6 +27,7 @@ npc_custodian_of_time npc_marin_noggenfogger npc_steward_of_time npc_stone_watcher_of_norgannon +npc_OOX17 EndContentData */ #include "precompiled.h" @@ -365,6 +366,208 @@ bool GossipSelect_npc_stone_watcher_of_norgannon(Player *player, Creature *_Crea return true; } +/*###### +## npc_OOX17 +######*/ + +#define Q_OOX17 648 +#define SPAWN_FIRST 7803 +#define SPAWN_SECOND_1 5617 +#define SPAWN_SECOND_2 7805 +#define SAY_SCOFF -1060004 +#define SAY_CHICKEN_ACC -1060000 +#define SAY_CHICKEN_AGGRO_1 -1060001 +#define SAY_CHICKEN_AGGRO_2 -1060002 +#define SAY_CHICKEN_AMB -1060003 +#define SAY_CHICKEN_COMP -1060005 + +struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI +{ + npc_OOX17AI(Creature *c) : npc_escortAI(c) {Reset();} + + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + + if (!player) + return; + + switch(i) { + case 23: + m_creature->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->Say(SAY_CHICKEN_AMB, LANG_UNIVERSAL, NULL); + break; + + case 56: + m_creature->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->Say(SAY_CHICKEN_AMB, LANG_UNIVERSAL, NULL); + {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30); + if(scoff) + ((Creature*)scoff)->Say(SAY_SCOFF, LANG_UNIVERSAL, NULL);}break; + break; + + case 86: + if (player) + { + m_creature->Say(SAY_CHICKEN_COMP, LANG_UNIVERSAL, NULL); + ((Player*)player)->GroupEventHappens(Q_OOX17, m_creature); + } + break; + } + } + + void Reset(){} + + void Aggro(Unit* who) + { + switch (rand()%2) { + case 0: + m_creature->Say(SAY_CHICKEN_AGGRO_1, LANG_UNIVERSAL, 0); + break; + case 1: + m_creature->Say(SAY_CHICKEN_AGGRO_2, LANG_UNIVERSAL, 0); + break; + } + + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } + + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) + ((Player*)player)->FailQuest(Q_OOX17); + } + } + + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + } + }; + +bool QuestAccept_npc_OOX17(Player* player, Creature* creature, Quest const* quest) +{ + if (quest->GetQuestId() == Q_OOX17) + { + creature->setFaction(113); + creature->SetHealth(creature->GetMaxHealth()); + creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + creature->Say(SAY_CHICKEN_ACC, LANG_UNIVERSAL, NULL); + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + + } + return true; +} + +CreatureAI* GetAI_npc_OOX17(Creature *_Creature) +{ + npc_OOX17AI* OOX17AI = new npc_OOX17AI(_Creature); + + OOX17AI->AddWaypoint(0, -8843.73, -4374.44, 43.71); + OOX17AI->AddWaypoint(1, -8834.68, -4373.88, 45.71); + OOX17AI->AddWaypoint(2, -8832.93, -4373.85, 45.67); + OOX17AI->AddWaypoint(3, -8829.21, -4373.72, 44.14); + OOX17AI->AddWaypoint(4, -8825.10, -4373.56, 41.44); + OOX17AI->AddWaypoint(5, -8818.88, -4372.75, 36.43); + OOX17AI->AddWaypoint(6, -8803.37, -4369.68, 30.06); + OOX17AI->AddWaypoint(7, -8786.68, -4366.18, 23.91); + OOX17AI->AddWaypoint(8, -8764.97, -4366.94, 25.23); + OOX17AI->AddWaypoint(9, -8745.49, -4363.16, 22.80); + OOX17AI->AddWaypoint(10, -8724.13, -4353.55, 20.72); + OOX17AI->AddWaypoint(11, -8706.77, -4346.14, 16.12); + OOX17AI->AddWaypoint(12, -8688.27, -4372.85, 13.64); + OOX17AI->AddWaypoint(13, -8668.76, -4380.38, 11.69); + OOX17AI->AddWaypoint(14, -8645.19, -4388.62, 12.56); + OOX17AI->AddWaypoint(15, -8614.73, -4398.60, 9.86); + OOX17AI->AddWaypoint(16, -8560.33, -4411.27, 13.17); + OOX17AI->AddWaypoint(17, -8536.45, -4416.49, 11.84); + OOX17AI->AddWaypoint(18, -8503.48, -4423.70, 13.59); + OOX17AI->AddWaypoint(19, -8471.91, -4430.60, 9.56); + OOX17AI->AddWaypoint(20, -8441.36, -4435.31, 9.40); + OOX17AI->AddWaypoint(21, -8403.41, -4441.16, 11.83); + OOX17AI->AddWaypoint(22, -8371.24, -4446.13, 9.47); + OOX17AI->AddWaypoint(23, -8353.96, -4448.79, 10.10); //Scorpid + OOX17AI->AddWaypoint(24, -8336.40, -4446.39, 8.98); + OOX17AI->AddWaypoint(25, -8303.78, -4441.96, 11.89); + OOX17AI->AddWaypoint(26, -8272.20, -4433.31, 9.60); + OOX17AI->AddWaypoint(27, -8224.76, -4419.39, 13.03); + OOX17AI->AddWaypoint(28, -8193.31, -4406.04, 10.17); + OOX17AI->AddWaypoint(29, -8155.65, -4397.74, 8.99); + OOX17AI->AddWaypoint(30, -8129.25, -4394.57, 10.92); + OOX17AI->AddWaypoint(31, -8104.86, -4399.03, 8.93); + OOX17AI->AddWaypoint(32, -8063.15, -4423.40, 10.07); + OOX17AI->AddWaypoint(33, -8032.15, -4443.47, 9.97); + OOX17AI->AddWaypoint(34, -8015.39, -4454.33, 9.39); + OOX17AI->AddWaypoint(35, -7981.64, -4482.44, 10.32); + OOX17AI->AddWaypoint(36, -7958.83, -4503.98, 9.69); + OOX17AI->AddWaypoint(37, -7932.45, -4528.91, 10.08); + OOX17AI->AddWaypoint(38, -7904.09, -4566.67, 12.59); + OOX17AI->AddWaypoint(39, -7883.33, -4593.91, 12.15); + OOX17AI->AddWaypoint(40, -7862.83, -4624.53, 10.21); + OOX17AI->AddWaypoint(41, -7840.79, -4654.26, 9.45); + OOX17AI->AddWaypoint(42, -7826.17, -4673.99, 10.61); + OOX17AI->AddWaypoint(43, -7807.86, -4698.69, 11.24); + OOX17AI->AddWaypoint(44, -7793.88, -4717.55, 10.48); + OOX17AI->AddWaypoint(45, -7778.68, -4738.05, 8.89); + OOX17AI->AddWaypoint(46, -7746.42, -4780.39, 9.84); + OOX17AI->AddWaypoint(47, -7724.11, -4772.75, 10.28); + OOX17AI->AddWaypoint(48, -7697.98, -4763.80, 9.52); + OOX17AI->AddWaypoint(49, -7665.33, -4752.62, 10.56); + OOX17AI->AddWaypoint(50, -7641.47, -4750.33, 8.94); + OOX17AI->AddWaypoint(51, -7620.08, -4753.96, 8.93); + OOX17AI->AddWaypoint(52, -7603.15, -4757.53, 9.06); + OOX17AI->AddWaypoint(53, -7579.43, -4767.07, 8.93); + OOX17AI->AddWaypoint(54, -7558.51, -4779.01, 9.64); + OOX17AI->AddWaypoint(55, -7536.40, -4789.32, 8.92); + OOX17AI->AddWaypoint(56, -7512.07, -4793.50, 9.35); //Wastewander + OOX17AI->AddWaypoint(57, -7490.79, -4788.80, 10.53); + OOX17AI->AddWaypoint(58, -7469.10, -4785.11, 10.42); + OOX17AI->AddWaypoint(59, -7453.18, -4782.41, 9.15); + OOX17AI->AddWaypoint(60, -7426.27, -4777.83, 9.54); + OOX17AI->AddWaypoint(61, -7393.84, -4770.19, 12.57); + OOX17AI->AddWaypoint(62, -7367.25, -4764.17, 11.92); + OOX17AI->AddWaypoint(63, -7341.00, -4752.11, 10.17); + OOX17AI->AddWaypoint(64, -7321.62, -4744.97, 11.58); + OOX17AI->AddWaypoint(65, -7302.35, -4744.35, 11.97); + OOX17AI->AddWaypoint(66, -7281.00, -4743.66, 11.21); + OOX17AI->AddWaypoint(67, -7258.33, -4742.93, 9.64); + OOX17AI->AddWaypoint(68, -7236.70, -4742.24, 10.16); + OOX17AI->AddWaypoint(69, -7217.52, -4743.87, 10.79); + OOX17AI->AddWaypoint(70, -7201.86, -4746.32, 9.58); + OOX17AI->AddWaypoint(71, -7182.01, -4749.41, 9.09); + OOX17AI->AddWaypoint(72, -7159.61, -4752.90, 9.52); + OOX17AI->AddWaypoint(73, -7139.58, -4756.02, 9.53); + OOX17AI->AddWaypoint(74, -7122.60, -4754.91, 9.66); + OOX17AI->AddWaypoint(75, -7101.06, -4753.87, 8.92); + OOX17AI->AddWaypoint(76, -7082.79, -4752.99, 9.97); + OOX17AI->AddWaypoint(77, -7061.81, -4751.98, 9.26); + OOX17AI->AddWaypoint(78, -7035.12, -4754.39, 9.19); + OOX17AI->AddWaypoint(79, -7013.90, -4758.64, 10.28); + OOX17AI->AddWaypoint(80, -7001.71, -4769.73, 10.59); + OOX17AI->AddWaypoint(81, -6984.95, -4788.61, 9.30); + OOX17AI->AddWaypoint(82, -6970.41, -4788.77, 9.42); + OOX17AI->AddWaypoint(83, -6957.16, -4788.92, 6.26); + OOX17AI->AddWaypoint(84, -6951.29, -4802.73, 4.45); + OOX17AI->AddWaypoint(85, -6944.81, -4816.58, 1.60); + OOX17AI->AddWaypoint(86, -6942.06, -4839.40, 0.66,5000); + + return (CreatureAI*)OOX17AI; +} + /*###### ## AddSC ######*/ @@ -400,5 +603,11 @@ void AddSC_tanaris() newscript->Name="npc_stone_watcher_of_norgannon"; newscript->pGossipHello = &GossipHello_npc_stone_watcher_of_norgannon; newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_OOX17"; + newscript->GetAI = &GetAI_npc_OOX17; + newscript->pQuestAccept = &QuestAccept_npc_OOX17; newscript->RegisterSelf(); }