From 51a2b0d211a6d0b623640d9ed15ce0a3c8e611a5 Mon Sep 17 00:00:00 2001 From: "philipp.dallig" Date: Fri, 18 Nov 2011 06:46:34 +0000 Subject: [PATCH] world and other stuff --- base/escort_ai.cpp | 6 +- include/sc_creature.cpp | 46 +++- include/sc_creature.h | 11 +- include/sc_gossip.h | 22 -- include/sc_instance.cpp | 19 +- include/sc_instance.h | 16 +- include/sc_utility.cpp | 247 ++++++++++++++++++ include/sc_utility.h | 107 ++++++++ scripts/battlegrounds/battleground.cpp | 12 +- scripts/battlegrounds/battlegroundIC.cpp | 308 +++++++++++++++++++++++ scripts/battlegrounds/battlegroundSA.cpp | 20 +- scripts/custom/teleguy.cpp | 218 +++++++++------- scripts/world/guards.cpp | 202 +++++++-------- scripts/world/item_scripts.cpp | 52 ++-- scripts/world/mob_generic_creature.cpp | 11 +- scripts/world/npc_professions.cpp | 62 ++--- scripts/world/pet_scripts.cpp | 18 +- scripts/world/spell_scripts.cpp | 24 +- 18 files changed, 1058 insertions(+), 343 deletions(-) create mode 100644 include/sc_utility.cpp create mode 100644 include/sc_utility.h create mode 100644 scripts/battlegrounds/battlegroundIC.cpp diff --git a/base/escort_ai.cpp b/base/escort_ai.cpp index ebc9be3..0d05429 100644 --- a/base/escort_ai.cpp +++ b/base/escort_ai.cpp @@ -246,15 +246,11 @@ bool npc_escortAI::IsPlayerOrGroupInRange() { if (Group* pGroup = pPlayer->GetGroup()) { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) { Player* pMember = pRef->getSource(); - if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) - { return true; - break; - } } } else diff --git a/include/sc_creature.cpp b/include/sc_creature.cpp index 4a1a6d2..e3b311f 100644 --- a/include/sc_creature.cpp +++ b/include/sc_creature.cpp @@ -17,9 +17,16 @@ struct TSpellSummary ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), m_bCombatMovement(true), - m_uiEvadeCheckCooldown(2500) + m_uiEvadeCheckCooldown(2500), + m_events(NULL) {} +ScriptedAI::~ScriptedAI() +{ + if (m_events) + delete m_events; +} + /// This function shows if combat movement is enabled, overwrite for more info void ScriptedAI::GetAIInformation(ChatHandler& reader) { @@ -124,7 +131,6 @@ void ScriptedAI::EnterEvadeMode() m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); if (m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); @@ -196,7 +202,7 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, return m_creature->SummonCreature(uiId,m_creature->GetPositionX()+fX, m_creature->GetPositionY()+fY, m_creature->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime); } -SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTarget selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) +SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 iMechanic, SelectTarget selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) { //No target so we can't cast if (!pTarget) @@ -238,7 +244,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u continue; //Check for spell mechanic if specified - if (uiMechanic >= 0 && pTempSpell->Mechanic != uiMechanic) + if (iMechanic >= 0 && pTempSpell->Mechanic != (uint32)iMechanic) continue; //Make sure that the spell uses the requested amount of power @@ -474,22 +480,22 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange) return pPlayer; } -void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged) +void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 iMainHand, int32 iOffHand, int32 iRanged) { if (bLoadDefault) { - m_creature->LoadEquipment(m_creature->GetCreatureInfo()->equipmentId,true); + m_creature->LoadEquipment(m_creature->GetCreatureInfo()->equipmentId, true); return; } - if (uiMainHand >= 0) - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand)); + if (iMainHand >= 0) + m_creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, iMainHand); - if (uiOffHand >= 0) - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand)); + if (iOffHand >= 0) + m_creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, iOffHand); - if (uiRanged >= 0) - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged)); + if (iRanged >= 0) + m_creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, iRanged); } void ScriptedAI::SetCombatMovement(bool bCombatMove) @@ -506,6 +512,7 @@ enum NPC_JAN_ALAI = 23578, NPC_SARTHARION = 28860, NPC_TALON_KING_IKISS = 18473, + NPC_KARGATH_BLADEFIST = 16808, }; bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) @@ -544,11 +551,17 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) return false; break; case NPC_TALON_KING_IKISS: + { float fX, fY, fZ; m_creature->GetRespawnCoord(fX, fY, fZ); if (m_creature->GetDistance2d(fX, fY) < 70.0f) return false; break; + } + case NPC_KARGATH_BLADEFIST: + if (fX < 255.0f && fX > 205.0f) + return false; + break; default: error_log("SD2: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", m_creature->GetEntry()); return false; @@ -558,6 +571,15 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) return true; } +EventManager& ScriptedAI::Events() +{ + // use lazy initialization to save memory + if (!m_events) + m_events = new EventManager(); + + return *m_events; +} + void Scripted_NoMovementAI::GetAIInformation(ChatHandler& reader) { reader.PSendSysMessage("Subclass of Scripted_NoMovementAI"); diff --git a/include/sc_creature.h b/include/sc_creature.h index fc031f8..5a02d32 100644 --- a/include/sc_creature.h +++ b/include/sc_creature.h @@ -9,6 +9,8 @@ #include "Creature.h" #include "Chat.h" +class EventManager; + //Spell targets used by SelectSpell enum SelectTarget { @@ -46,7 +48,7 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI { public: explicit ScriptedAI(Creature* pCreature); - ~ScriptedAI() {} + ~ScriptedAI(); // ************* // CreatureAI Functions @@ -206,12 +208,12 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI Creature* DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime); // Returns spells that meet the specified criteria from the creatures spell list - SpellEntry const* SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTarget selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffect); + SpellEntry const* SelectSpell(Unit* pTarget, int32 uiSchool, int32 iMechanic, SelectTarget selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffect); // Checks if you can cast the specified spell bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false); - void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE); + void SetEquipmentSlots(bool bLoadDefault, int32 iMainHand = EQUIP_NO_CHANGE, int32 iOffHand = EQUIP_NO_CHANGE, int32 iRanged = EQUIP_NO_CHANGE); // Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures do not chase victims void SetCombatMovement(bool bCombatMove); @@ -219,9 +221,12 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff); + EventManager& Events(); + private: bool m_bCombatMovement; uint32 m_uiEvadeCheckCooldown; + EventManager* m_events; }; struct MANGOS_DLL_DECL Scripted_NoMovementAI : public ScriptedAI diff --git a/include/sc_gossip.h b/include/sc_gossip.h index da7e43b..7d17154 100644 --- a/include/sc_gossip.h +++ b/include/sc_gossip.h @@ -145,15 +145,6 @@ extern uint32 GetSkillLevel(Player* pPlayer, uint32 uiSkill); // guid - npc guid (ObjectGuid) #define SEND_GOSSIP_MENU(uiTextId, guid) PlayerTalkClass->SendGossipMenu(uiTextId, guid) -// This fuction shows POI(point of interest) to client. -// a - position X -// b - position Y -// c - Icon Id -// d - Flags -// e - Data -// f - Location Name -#define SEND_POI(a, b, c, d, e, f) PlayerTalkClass->SendPointOfInterest(a, b, c, d, e, f) - // Closes the Menu #define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip() @@ -165,17 +156,4 @@ extern uint32 GetSkillLevel(Player* pPlayer, uint32 uiSkill); #define SEND_TABARDLIST(a) GetSession()->SendTabardVendorActivate(a) #define SEND_TAXILIST(a) GetSession()->SendTaxiStatus(a) -// Function to send the Auction List -// a - pointer to unit (Unit*) -#define SEND_AUCTIONLIST(a) GetSession()->SendAuctionHello(a) - -// Ressurect's the player if is dead. -#define SEND_SPRESURRECT() GetSession()->SendSpiritResurrect() - -// Function to send the Quest Dialogue Status -// a - pointer to player (Player*) -// b - pointer to questgiver (Object*) -// c - defstatus (uint32) -#define QUEST_DIALOG_STATUS(a, b, c) GetSession()->getDialogStatus(a, b, c) - #endif diff --git a/include/sc_instance.cpp b/include/sc_instance.cpp index ba636c6..153388a 100644 --- a/include/sc_instance.cpp +++ b/include/sc_instance.cpp @@ -287,16 +287,19 @@ void DialogueHelper::DoNextDialogueStep() } // Simulate Case - if (m_bCanSimulate && m_pInstance && uiSpeakerEntry && iTextEntry < 0) - m_pInstance->DoOrSimulateScriptTextForThisInstance(iTextEntry, uiSpeakerEntry); - else + if (uiSpeakerEntry && iTextEntry < 0) { - // Get Speaker - Creature* pSpeaker = NULL; - if (m_pInstance && uiSpeakerEntry) - pSpeaker = m_pInstance->GetSingleCreatureFromStorage(uiSpeakerEntry); + // Use Speaker if directly provided + Creature* pSpeaker = GetSpeakerByEntry(uiSpeakerEntry); + if (m_pInstance && !pSpeaker) // Get Speaker from instance + { + if (m_bCanSimulate) // Simulate case + m_pInstance->DoOrSimulateScriptTextForThisInstance(iTextEntry, uiSpeakerEntry); + else + pSpeaker = m_pInstance->GetSingleCreatureFromStorage(uiSpeakerEntry); + } - if (pSpeaker && iTextEntry < 0) + if (pSpeaker) DoScriptText(iTextEntry, pSpeaker); } diff --git a/include/sc_instance.h b/include/sc_instance.h index dd54ff9..0c41d2d 100644 --- a/include/sc_instance.h +++ b/include/sc_instance.h @@ -20,8 +20,8 @@ enum EncounterState #define OUT_SAVE_INST_DATA debug_log("SD2: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_SAVE_INST_DATA_COMPLETE debug_log("SD2: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA(a) debug_log("SD2: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) -#define OUT_LOAD_INST_DATA_COMPLETE debug_log("SD2: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA_FAIL error_log("SD2: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_COMPLETE debug_log("SD2: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_FAIL error_log("SD2: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) class MANGOS_DLL_DECL ScriptedInstance : public InstanceData { @@ -69,6 +69,13 @@ class MANGOS_DLL_DECL ScriptedInstance : public InstanceData EntryGuidMap m_mNpcEntryGuidStore; ///< Store unique NPC-Guids by entry }; +// Class for world maps (May need additional zone-wide functions later on) +class MANGOS_DLL_DECL ScriptedMap : public ScriptedInstance +{ + public: + ScriptedMap(Map* pMap) : ScriptedInstance(pMap) {} +}; + /// A static const array of this structure must be handled to DialogueHelper struct DialogueEntry { @@ -96,7 +103,7 @@ class DialogueHelper // The array MUST be terminated by {0,0,0,0,0} DialogueHelper(DialogueEntryTwoSide const* aDialogueTwoSide); - /// Function that MUST be called + /// Function to initialize the dialogue helper for instances. If not used with instances, GetSpeakerByEntry MUST be overwritten to obtain the speakers void InitializeDialogueHelper(ScriptedInstance* pInstance, bool bCanSimulateText = false) { m_pInstance = pInstance; m_bCanSimulate = bCanSimulateText; } /// Set if take first entries or second entries void SetDialogueSide(bool bIsFirstSide) { m_bIsFirstSide = bIsFirstSide; } @@ -106,7 +113,10 @@ class DialogueHelper void DialogueUpdate(uint32 uiDiff); protected: + /// Will be called when a dialogue step was done virtual void JustDidDialogueStep(int32 iEntry) {} + /// Will be called to get a speaker, MUST be implemented if not used in instances + virtual Creature* GetSpeakerByEntry(uint32 uiEntry) { return NULL; } private: void DoNextDialogueStep(); diff --git a/include/sc_utility.cpp b/include/sc_utility.cpp new file mode 100644 index 0000000..331c311 --- /dev/null +++ b/include/sc_utility.cpp @@ -0,0 +1,247 @@ +#include "precompiled.h" + +//--- EventManager -------------------------------------------------- + +void EventManager::Cooldown::Update(uint32 time_diff) +{ + if (!remaining) + return; + if (remaining <= time_diff) + duration = remaining = 0; + else + remaining -= time_diff; +} + +EventManager::EventManager(): + m_time(0), m_phase(0) +{ +} + +void EventManager::InsertEvent(uint32 time_diff, Event const& ev) +{ + m_events.insert(EventContainer::value_type(m_time + time_diff, ev)); +} + +uint32 EventManager::GetCooldownDuration(uint32 categ) const +{ + CooldownMap::const_iterator i_cd = m_cooldowns.find(categ); + if (i_cd == m_cooldowns.end()) + return 0; + return i_cd->second.duration; +} + +uint32 EventManager::GetCooldownTime(uint32 categ) const +{ + CooldownMap::const_iterator i_cd = m_cooldowns.find(categ); + if (i_cd == m_cooldowns.end()) + return 0; + return i_cd->second.remaining; +} + +void EventManager::Reset() +{ + m_time = m_phase = 0; + m_events.clear(); + m_cooldowns.clear(); +} + +void EventManager::ResetCooldowns() +{ + m_cooldowns.clear(); +} + +void EventManager::Update(uint32 time_diff) +{ + m_time += time_diff; + for (CooldownMap::iterator i = m_cooldowns.begin(); i != m_cooldowns.end(); ++i) + i->second.Update(time_diff); +} + +void EventManager::SetPhase(uint32 phase) +{ + if (phase >= 32) + throw std::domain_error("EventManager::SetPhase(): phase value must be < 32"); + m_phase = phase; +} + +void EventManager::SetCooldown(uint32 time, uint32 categ) +{ + m_cooldowns[categ] = Cooldown(time); +} + +void EventManager::ScheduleEvent(uint32 event_id, uint32 time, uint32 period, uint32 cd, uint32 cd_cat, uint32 phase_mask) +{ + if (!event_id) + throw std::invalid_argument("EventManager::ScheduleEvent(): event_id must be != 0"); + if (!phase_mask) + throw std::invalid_argument("EventManager::ScheduleEvent(): phase_mask must be != 0"); + InsertEvent(time, Event(event_id, period, period, phase_mask, cd, cd_cat)); +} + +void EventManager::RescheduleEvent(uint32 event_id, uint32 time, uint32 period, uint32 cd, uint32 cd_cat, uint32 phase_mask) +{ + CancelEvent(event_id); + ScheduleEvent(event_id, time, period, cd, cd_cat, phase_mask); +} + +void EventManager::ScheduleEventInRange(uint32 event_id, uint32 time_min, uint32 time_max, uint32 period_min, uint32 period_max, uint32 cd, uint32 cd_cat, uint32 phase_mask) +{ + if (!event_id) + throw std::invalid_argument("EventManager::ScheduleEventInRange(): event_id must be != 0"); + if (!phase_mask) + throw std::invalid_argument("EventManager::ScheduleEventInRange(): phase_mask must be != 0"); + if (!time_max) + time_max = time_min; + if (!period_max) + period_max = period_min; + if (time_max < time_min) + throw std::invalid_argument("EventManager::ScheduleEventInRange(): time_max must be >= time_min"); + if (period_max < period_min) + throw std::invalid_argument("EventManager::ScheduleEventInRange(): period_max must be >= period_min"); + if (!period_min && period_max) + throw std::invalid_argument("EventManager::ScheduleEventInRange(): period range must not include 0"); + uint32 time = time_min != time_max ? urand(time_min, time_max) : time_min; + InsertEvent(time, Event(event_id, period_min, period_max, phase_mask, cd, cd_cat)); +} + +void EventManager::RescheduleEventInRange(uint32 event_id, uint32 time_min, uint32 time_max, uint32 period_min, uint32 period_max, uint32 cd, uint32 cd_cat, uint32 phase_mask) +{ + CancelEvent(event_id); + ScheduleEventInRange(event_id, time_min, time_max, period_min, period_max, cd, cd_cat, phase_mask); +} + +bool EventManager::HasEvent(uint32 time) const +{ + EventContainer::const_iterator i_ev = m_events.begin(); + if (i_ev == m_events.end()) + return false; + return i_ev->first <= m_time + time; +} + +uint32 EventManager::GetNextEvent() const +{ + EventContainer::const_iterator i_ev = m_events.begin(); + if (i_ev == m_events.end()) + return 0; + return i_ev->second.id; +} + +void EventManager::CancelAllEvents() +{ + m_events.clear(); +} + +void EventManager::CancelEvent(uint32 event_id, uint32 phase_mask) +{ + for (EventContainer::iterator i = m_events.begin(); i != m_events.end(); ) + if (i->second.id == event_id && i->second.phase_mask & phase_mask) + { + m_events.erase(i); + i = m_events.begin(); + } + else + ++i; +} + +void EventManager::CancelNextEvent() +{ + EventContainer::iterator i_ev = m_events.begin(); + if (i_ev == m_events.end()) + return; + m_events.erase(i_ev); +} + +void EventManager::CancelNextEventWithId(uint32 event_id, uint32 phase_mask) +{ + for (EventContainer::iterator i = m_events.begin(); i != m_events.end(); ++i) + if (i->second.id == event_id && i->second.phase_mask & phase_mask) + { + m_events.erase(i); + break; + } +} + +void EventManager::CancelEventsWithCategory(uint32 categ, uint32 phase_mask) +{ + for (EventContainer::iterator i = m_events.begin(); i != m_events.end(); ) + if (i->second.category == categ && i->second.phase_mask & phase_mask) + { + m_events.erase(i); + i = m_events.begin(); + } + else + ++i; +} + +void EventManager::DelayEvents(uint32 time, uint32 phase_mask) +{ + EventContainer delayed; + for (EventContainer::iterator i = m_events.begin(); i != m_events.end(); ) + if (i->second.phase_mask & phase_mask) + { + delayed.insert(std::make_pair(i->first + time, i->second)); + m_events.erase(i); + i = m_events.begin(); + } + else + ++i; + m_events.insert(delayed.begin(), delayed.end()); +} + +void EventManager::DelayEventsWithId(uint32 event_id, uint32 time, uint32 phase_mask) +{ + EventContainer delayed; + for (EventContainer::iterator i = m_events.begin(); i != m_events.end(); ) + if (i->second.id == event_id && i->second.phase_mask & phase_mask) + { + delayed.insert(std::make_pair(i->first + time, i->second)); + m_events.erase(i); + i = m_events.begin(); + } + else + ++i; + m_events.insert(delayed.begin(), delayed.end()); +} + +uint32 EventManager::ExecuteEvent() +{ + EventContainer::iterator i_ev = m_events.begin(); + // container empty, no events to process + if (i_ev == m_events.end()) + return 0; + // we got a event to process, executing + if (i_ev->first <= m_time) + { + uint32 delta = m_time - i_ev->first; // latency time in executing this event + Event ev = i_ev->second; + m_events.erase(i_ev); + // if event is periodic, calculate next execution time + uint32 period = ev.period_min != ev.period_max ? urand(ev.period_min, ev.period_max) : ev.period_min; + if (period) + { + delta %= period; // in case we took way too long, get difference counting lost ticks + InsertEvent(period - delta, ev); + } + // check if can be executed in current phase + if (!(ev.phase_mask & GetPhaseMask())) + return 0; + // if we're on cooldown then cannot execute event + CooldownMap::const_iterator i_cd = m_cooldowns.find(ev.category); + if (i_cd != m_cooldowns.end() && i_cd->second.remaining) + { + // try again after cooldown ends, but don't wait longer than remaining period time + if (!period || (i_cd->second.duration < period && i_cd->second.remaining < period - delta)) + { + ev.period_min = ev.period_max = 0; + InsertEvent(i_cd->second.remaining, ev); + } + return 0; + } + // all ok, now trigger cooldown if any + SetCooldown(ev.cooldown, ev.category); + // return succeful event executed + return ev.id; + } + // all events in future, nothing to do for now + return 0; +} diff --git a/include/sc_utility.h b/include/sc_utility.h new file mode 100644 index 0000000..867eeb9 --- /dev/null +++ b/include/sc_utility.h @@ -0,0 +1,107 @@ +/* Copyright (C) 2006 - 2011 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_UTILITY_H +#define SC_UTILITY_H + +// class for handling timed events +class MANGOS_DLL_DECL EventManager +{ +protected: + struct Event + { + uint32 id; // event identifier + uint32 period_min; // repeating period (0 = doesn't repeat) + uint32 period_max; // random value in interval 'period_min' to 'period_max' + uint32 phase_mask; // phases where this event can happen (bit mask) + uint32 cooldown; // cooldown triggered after event executes + uint32 category; // cooldown category (will trigger cd only for this category) + + Event(uint32 _id, uint32 _pmin, uint32 _pmax, uint32 _phase, uint32 _cd, uint32 _cat): + id(_id), period_min(_pmin), period_max(_pmax), phase_mask(_phase), cooldown(_cd), category(_cat) + { + } + }; + + struct Cooldown + { + uint32 duration; // total length of the cooldown + uint32 remaining; // remaining time + + explicit Cooldown(uint32 _val = 0): + duration(_val), remaining(_val) + { + } + + void Update(uint32 time_diff); + }; + + typedef std::multimap EventContainer; + typedef std::map CooldownMap; + + uint32 m_time; // current elapsed time (in milliseconds) + uint32 m_phase; // current phase (value, not mask) + EventContainer m_events; // event queue + CooldownMap m_cooldowns; // cooldowns by category + + void InsertEvent(uint32 time_diff, Event const& ev); + +public: + enum { ALL_PHASES = 0xFFFFFFFF }; // default value for phase mask + + EventManager(); + + uint32 GetTimer() const { return m_time; } + uint32 GetPhase() const { return m_phase; } + uint32 GetPhaseMask() const { return 1 << m_phase; } + uint32 GetCooldownDuration(uint32 categ) const; + uint32 GetCooldownTime(uint32 categ) const; + + void Reset(); + void ResetCooldowns(); + + void Update(uint32 time_diff); + void SetPhase(uint32 phase); + void SetCooldown(uint32 time, uint32 categ = 0); + + // inserts an event in the queue that will execute in the next 'time' milliseconds and + // will repeat every 'period' milliseconds (if not 0). Each triggering of this event + // will cause a cooldown of 'cd' milliseconds on the 'cd_cat' category + void ScheduleEvent(uint32 event_id, uint32 time, uint32 period = 0, uint32 cd = 0, uint32 cd_cat = 0, uint32 phase_mask = ALL_PHASES); + // cancels pending events with the specified id and inserts new one into the queue + void RescheduleEvent(uint32 event_id, uint32 time, uint32 period = 0, uint32 cd = 0, uint32 cd_cat = 0, uint32 phase_mask = ALL_PHASES); + + // schedule event with random time interval + // if the _max value is 0, then its assumed no range (value equal to _min) + void ScheduleEventInRange(uint32 event_id, uint32 time_min, uint32 time_max = 0, uint32 period_min = 0, uint32 period_max = 0, uint32 cd = 0, uint32 cd_cat = 0, uint32 phase_mask = ALL_PHASES); + void RescheduleEventInRange(uint32 event_id, uint32 time_min, uint32 time_max = 0, uint32 period_min = 0, uint32 period_max = 0, uint32 cd = 0, uint32 cd_cat = 0, uint32 phase_mask = ALL_PHASES); + + bool HasEvent(uint32 time = 0) const; // check if there is a pending event in the next 'time' milliseconds + uint32 GetNextEvent() const; // returns next queued event + + void CancelAllEvents(); // cancels all events + void CancelEvent(uint32 event_id, uint32 phase_mask = ALL_PHASES); // ^ with specified id + void CancelNextEvent(); // cancels next queued event + void CancelNextEventWithId(uint32 event_id, uint32 phase_mask = ALL_PHASES); // ^ with specified id + void CancelEventsWithCategory(uint32 categ, uint32 phase_mask = ALL_PHASES); // cancels all events with specified cd category + + void DelayEvents(uint32 time, uint32 phase_mask = ALL_PHASES); // delays all events by the specified amount + void DelayEventsWithId(uint32 event_id, uint32 time, uint32 phase_mask = ALL_PHASES); // ^ with specified id + + uint32 ExecuteEvent(); // process and return next pending event + +private: + EventManager(EventManager const&); + EventManager& operator= (EventManager const&); +}; + +// helper for calculating bit masks (compile time constant that can be used in enums) +// usage: bit_mask::value +template +struct bit_mask { enum { value = 1UL << N1 | bit_mask::value }; }; + +template <> +struct bit_mask<-1, -1, -1, -1, -1, -1> { enum { value = 0 }; }; + +#endif // SC_UTILITY_H diff --git a/scripts/battlegrounds/battleground.cpp b/scripts/battlegrounds/battleground.cpp index 42edcba..2487fc0 100644 --- a/scripts/battlegrounds/battleground.cpp +++ b/scripts/battlegrounds/battleground.cpp @@ -105,11 +105,11 @@ CreatureAI* GetAI_npc_spirit_guide(Creature* pCreature) void AddSC_battleground() { - Script* newscript; + Script* pNewScript; - newscript = new Script; - newscript->Name = "npc_spirit_guide"; - newscript->GetAI = &GetAI_npc_spirit_guide; - newscript->pGossipHello = &GossipHello_npc_spirit_guide; - newscript->RegisterSelf(); + pNewScript = new Script; + pNewScript->Name = "npc_spirit_guide"; + pNewScript->GetAI = &GetAI_npc_spirit_guide; + pNewScript->pGossipHello = &GossipHello_npc_spirit_guide; + pNewScript->RegisterSelf(); } diff --git a/scripts/battlegrounds/battlegroundIC.cpp b/scripts/battlegrounds/battlegroundIC.cpp new file mode 100644 index 0000000..26940ba --- /dev/null +++ b/scripts/battlegrounds/battlegroundIC.cpp @@ -0,0 +1,308 @@ +/* Copyright (C) 2006 - 2011 ScriptDev2 + Copyright (C) 2011 MangosR2_ScriptDev2 + * 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 "precompiled.h" +#include "BattleGroundIC.h" +#include "Vehicle.h" + +/*###### +## go_ic_teleport +## npc_ic_vehicle +## npc_ic_cannon +######*/ + +#define MAX_PORTALS 15 + +enum +{ + SPELL_TELEPORT_EFFECT = 66548, // teleport effect + + NPC_CATAPULT = 34793, + NPC_DEMOLISHER = 34775, + NPC_GLAIVE_A = 34802, + NPC_GLAIVE_H = 35273, +}; + +static float SpawnLocation[MAX_PORTALS][3]= +{ + {324.635f, -749.128f, 49.3602f}, // alli left outside + {311.92f, -913.972f, 48.8159f}, // a r o + {425.675f, -857.09f, 48.5104f}, // a f o + {1236.53f, -669.415f, 48.2729f}, // h l o + {1235.09f, -857.898f, 48.9163f}, // h r o + {1143.25f, -779.599f, 48.629f}, // h f o + + {326.285f, -777.366f, 49.0208f}, // a l i + {323.54f, -888.361f, 48.9197f}, // a r i + {397.089f, -859.382f, 48.8993f}, // a f i + {1235.53f, -683.872f, 49.304f}, // h l i + {1233.27f, -844.526f, 48.8824f}, // h r i + {1158.76f, -746.182f, 48.6277f}, // horde front inside + + {827.958f, -994.467f, 134.071f}, // gunship portals (not working yet) + {738.613f, -1106.58f, 134.745f}, + {672.283f, -1156.99f, 133.706f}, +}; + +bool GOHello_go_ic_teleport(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->GetMapId() != 628) + return false; + + if (BattleGround *bg = pPlayer->GetBattleGround()) // no need to check for faction, since only the eligible players can click the portal + { + BattleGroundIC * IoC = static_cast(bg); + + for (uint32 i = 0; i < MAX_PORTALS; ++i) + { + if ((pGo->GetPositionX() == SpawnLocation[i][0]) && + (pGo->GetPositionY() == SpawnLocation[i][1]) && + (pGo->GetPositionZ() == SpawnLocation[i][2])) + { + // teleports outside walls + if (i <= 5) + pPlayer->TeleportTo(bg->GetMapId(), SpawnLocation[i + 6][0], SpawnLocation[i + 6][1], SpawnLocation[i + 6][2], pPlayer->GetOrientation()); + // teleports within the keep + else if (i > 5 && i <= 11) + pPlayer->TeleportTo(bg->GetMapId(), SpawnLocation[i - 6][0], SpawnLocation[i - 6][1], SpawnLocation[i - 6][2], pPlayer->GetOrientation()); + // gunship teleports + else + { + } + return true; + } + + } + } + return false; +} + +struct MANGOS_DLL_DECL npc_ic_vehicleAI : public ScriptedAI +{ + npc_ic_vehicleAI(Creature* pCreature) : ScriptedAI(pCreature) + { + SetCombatMovement(false); + Reset(); + } + + void Reset() + { + done = false; + gotFaction = false; + } + + bool done; + bool gotFaction; + BattleGround *bg; + + void Aggro(Unit* /*who*/){ m_creature->CombatStop(); } + + void EnterCombat(Unit *pEnemy) + { + if (!m_creature->isCharmed()) + m_creature->CombatStop(); + } + + void StartEvent(Player* pPlayer, Creature* pCreature) + { + if (BattleGround *bg = pPlayer->GetBattleGround()) + { + if (VehicleKit *vehicle = pCreature->GetVehicleKit()) + { + if (!pCreature->GetCharmerGuid().IsEmpty()) + pPlayer->EnterVehicle(vehicle); + else + { + pPlayer->EnterVehicle(vehicle); + pPlayer->CastSpell(pCreature, 60968, true); + } + } + } + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->isCharmed()) + { + if (m_creature->isInCombat()) + m_creature->CombatStop(); + + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); + + if (!done) + { + Map* pMap = m_creature->GetMap(); + + if (!pMap || !pMap->IsBattleGround()) + return; + + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + Map::PlayerList::const_iterator itr = PlayerList.begin(); + Player *player = itr->getSource(); + if (player) + { + bg = player->GetBattleGround(); + done = true; + } + } + + if (bg) + { + if (gotFaction == false) + { + if (m_creature->GetEntry() == NPC_DEMOLISHER) + m_creature->setFaction(bg->GetVehicleFaction(VEHICLE_BG_DEMOLISHER)); + else if (m_creature->GetEntry() == NPC_CATAPULT) + m_creature->setFaction(bg->GetVehicleFaction(VEHICLE_IC_CATAPULT)); + // Glaive throwers have separate ID for horde/alli + else if (m_creature->GetEntry() == NPC_GLAIVE_A) + m_creature->setFaction(VEHICLE_FACTION_ALLIANCE); + else if (m_creature->GetEntry() == NPC_GLAIVE_H) + m_creature->setFaction(VEHICLE_FACTION_HORDE); + + gotFaction = true; + } + } + } + } +}; + +CreatureAI* GetAI_npc_ic_vehicle(Creature* pCreature) +{ + return new npc_ic_vehicleAI(pCreature); +} + +bool GossipHello_npc_ic_vehicle(Player* pPlayer, Creature* pCreature) +{ + pPlayer->CLOSE_GOSSIP_MENU(); + ((npc_ic_vehicleAI*)pCreature->AI())->StartEvent(pPlayer, pCreature); + return true; +} + +struct MANGOS_DLL_DECL npc_ic_cannonAI : public ScriptedAI +{ + npc_ic_cannonAI(Creature* pCreature) : ScriptedAI(pCreature) + { + SetCombatMovement(false); + Reset(); + } + + void Reset() + { + done = false; + } + + bool done; + BattleGround *bg; + + void Aggro(Unit* who){ m_creature->CombatStop(); } + + void StartEvent(Player* pPlayer, Creature* pCreature) + { + if (BattleGround *bg = pPlayer->GetBattleGround()) + { + if (bg->GetStatus() == STATUS_WAIT_JOIN) + return; + + if (VehicleKit *vehicle = pCreature->GetVehicleKit()) + { + if (!pCreature->GetCharmerGuid().IsEmpty()) + pPlayer->EnterVehicle(vehicle); + else + { + pPlayer->EnterVehicle(vehicle); + pPlayer->CastSpell(pCreature, 60968, true); + } + } + } + } + + void UpdateAI(const uint32 diff) + { + if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + if (!m_creature->isCharmed()) + { + if (m_creature->isInCombat()) + m_creature->CombatStop(); + + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); + + if (!done) + { + Map* pMap = m_creature->GetMap(); + + if (!pMap || !pMap->IsBattleGround()) + return; + + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + Map::PlayerList::const_iterator itr = PlayerList.begin(); + Player *player = itr->getSource(); + if (player) + { + bg = player->GetBattleGround(); + done = true; + } + } + + if (bg) + { + // simplest way to determine factions Ive found + float x = m_creature->GetPositionX(); + if (x > 1000.0f) + m_creature->setFaction(VEHICLE_FACTION_HORDE); + else + m_creature->setFaction(VEHICLE_FACTION_ALLIANCE); + } + } + } +}; + +CreatureAI* GetAI_npc_ic_cannon(Creature* pCreature) +{ + return new npc_ic_cannonAI(pCreature); +} + +bool GossipHello_npc_ic_cannon(Player* pPlayer, Creature* pCreature) +{ + pPlayer->CLOSE_GOSSIP_MENU(); + ((npc_ic_cannonAI*)pCreature->AI())->StartEvent(pPlayer, pCreature); + return true; +} + +void AddSC_battlegroundIC() +{ + Script *pNewScript; + + pNewScript = new Script; + pNewScript->Name = "go_ic_teleport"; + pNewScript->pGOUse = &GOHello_go_ic_teleport; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_ic_vehicle"; + pNewScript->GetAI = &GetAI_npc_ic_vehicle; + pNewScript->pGossipHello = &GossipHello_npc_ic_vehicle; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_ic_cannon"; + pNewScript->GetAI = &GetAI_npc_ic_cannon; + pNewScript->pGossipHello = &GossipHello_npc_ic_cannon; + pNewScript->RegisterSelf(); +} diff --git a/scripts/battlegrounds/battlegroundSA.cpp b/scripts/battlegrounds/battlegroundSA.cpp index ae801f1..e9e6ae1 100644 --- a/scripts/battlegrounds/battlegroundSA.cpp +++ b/scripts/battlegrounds/battlegroundSA.cpp @@ -30,9 +30,11 @@ struct MANGOS_DLL_DECL npc_sa_demolisherAI : public ScriptedAI void Reset() { done = false; + factionSet = false; } bool done; + bool factionSet; BattleGround *bg; void Aggro(Unit* who){ m_creature->CombatStop(); } @@ -57,7 +59,7 @@ struct MANGOS_DLL_DECL npc_sa_demolisherAI : public ScriptedAI else { pPlayer->EnterVehicle(vehicle); - //pPlayer->CastSpell(pCreature, 60968, true); + pPlayer->CastSpell(pCreature, 60968, true); } } } @@ -102,7 +104,12 @@ struct MANGOS_DLL_DECL npc_sa_demolisherAI : public ScriptedAI if (bg) { - m_creature->setFaction(bg->GetVehicleFaction(VEHICLE_SA_DEMOLISHER)); + if (factionSet == false) + { + m_creature->setFaction(bg->GetVehicleFaction(VEHICLE_BG_DEMOLISHER)); + factionSet = true; + } + if (mustDespawn(bg)) m_creature->ForcedDespawn(); } @@ -133,9 +140,11 @@ struct MANGOS_DLL_DECL npc_sa_cannonAI : public ScriptedAI void Reset() { done = false; + factionSet = false; } bool done; + bool factionSet; BattleGround *bg; void Aggro(Unit* who){ m_creature->CombatStop(); } @@ -154,7 +163,7 @@ struct MANGOS_DLL_DECL npc_sa_cannonAI : public ScriptedAI else { pPlayer->EnterVehicle(vehicle); - //pPlayer->CastSpell(pCreature, 60968, true); + pPlayer->CastSpell(pCreature, 60968, true); } } } @@ -189,8 +198,11 @@ struct MANGOS_DLL_DECL npc_sa_cannonAI : public ScriptedAI } } - if (bg) + if ((bg) && (factionSet == false)) + { m_creature->setFaction(bg->GetVehicleFaction(VEHICLE_SA_CANNON)); + factionSet = true; + } } } }; diff --git a/scripts/custom/teleguy.cpp b/scripts/custom/teleguy.cpp index 1f73c44..bd345c8 100644 --- a/scripts/custom/teleguy.cpp +++ b/scripts/custom/teleguy.cpp @@ -5,33 +5,33 @@ int costo; bool GossipHello_mob_teleguy(Player *player, Creature *_Creature) { if (player->GetTeam() == ALLIANCE ) { - player->ADD_GOSSIP_ITEM( 5, "Darnassus. 5 Silver" , GOSSIP_SENDER_MAIN, 1203); - player->ADD_GOSSIP_ITEM( 5, "Exodar. 5 Silver" , GOSSIP_SENDER_MAIN, 1216); - player->ADD_GOSSIP_ITEM( 5, "Stormwind. 5 Silver" , GOSSIP_SENDER_MAIN, 1206); - player->ADD_GOSSIP_ITEM( 5, "Ironforge. 5 Silver" , GOSSIP_SENDER_MAIN, 1224); - player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); - player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); - player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); - player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); - player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); - player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); - player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); - player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); - } else { - player->ADD_GOSSIP_ITEM( 5, "Orgrimmar. 5 Silver" , GOSSIP_SENDER_MAIN, 1215); - player->ADD_GOSSIP_ITEM( 5, "Silvermoon. 5 Silver" , GOSSIP_SENDER_MAIN, 1217); - player->ADD_GOSSIP_ITEM( 5, "Undercity. 5 Silver" , GOSSIP_SENDER_MAIN, 1213); - player->ADD_GOSSIP_ITEM( 5, "Thunder Bluff. 5 Silver" , GOSSIP_SENDER_MAIN, 1225); - player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); - player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); - player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); - player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); - player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); - player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); - player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); - player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); - } - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); + player->ADD_GOSSIP_ITEM( 5, "Darnassus. 5 Silver" , GOSSIP_SENDER_MAIN, 1203); + player->ADD_GOSSIP_ITEM( 5, "Exodar. 5 Silver" , GOSSIP_SENDER_MAIN, 1216); + player->ADD_GOSSIP_ITEM( 5, "Stormwind. 5 Silver" , GOSSIP_SENDER_MAIN, 1206); + player->ADD_GOSSIP_ITEM( 5, "Ironforge. 5 Silver" , GOSSIP_SENDER_MAIN, 1224); + player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); + player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); + player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); + player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); + player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); + player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); + player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); + player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); + } else { + player->ADD_GOSSIP_ITEM( 5, "Orgrimmar. 5 Silver" , GOSSIP_SENDER_MAIN, 1215); + player->ADD_GOSSIP_ITEM( 5, "Silvermoon. 5 Silver" , GOSSIP_SENDER_MAIN, 1217); + player->ADD_GOSSIP_ITEM( 5, "Undercity. 5 Silver" , GOSSIP_SENDER_MAIN, 1213); + player->ADD_GOSSIP_ITEM( 5, "Thunder Bluff. 5 Silver" , GOSSIP_SENDER_MAIN, 1225); + player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); + player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); + player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); + player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); + player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); + player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); + player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); + player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); + } + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); return true; } @@ -64,11 +64,11 @@ void SendDefaultMenu_mob_teleguy(Player *player, Creature *_Creature, uint32 act switch(action) { case 5550: //Normal Instances - if (player->GetTeam() == ALLIANCE ) { + if (player->GetTeam() == ALLIANCE ) { player->ADD_GOSSIP_ITEM( 5, "The Stockade. 10 Silver" , GOSSIP_SENDER_MAIN, 1253); - } else { + } else { player->ADD_GOSSIP_ITEM( 5, "Ragefire Chasm. 10 Silver" , GOSSIP_SENDER_MAIN, 1248); - } + } player->ADD_GOSSIP_ITEM( 5, "The Wailing Caverns. 10 Silver" , GOSSIP_SENDER_MAIN, 1249); player->ADD_GOSSIP_ITEM( 5, "Deadmines. 10 Silver" , GOSSIP_SENDER_MAIN, 1250); player->ADD_GOSSIP_ITEM( 5, "Shadowfang Keep. 10 Silver" , GOSSIP_SENDER_MAIN, 1251); @@ -92,6 +92,8 @@ void SendDefaultMenu_mob_teleguy(Player *player, Creature *_Creature, uint32 act player->ADD_GOSSIP_ITEM( 5, "Blackrock Spire. 50 Silver" , GOSSIP_SENDER_MAIN, 1264); player->ADD_GOSSIP_ITEM( 5, "Stratholme. 50 Silver" , GOSSIP_SENDER_MAIN, 1265); player->ADD_GOSSIP_ITEM( 5, "Scholomance. 50 Silver" , GOSSIP_SENDER_MAIN, 1266); + player->ADD_GOSSIP_ITEM( 5, "Ahn'Qiraj. 50 Silver" , GOSSIP_SENDER_MAIN, 1267); + player->ADD_GOSSIP_ITEM( 5, "Zul'Gurub. 50 Silver" , GOSSIP_SENDER_MAIN, 1268); player->ADD_GOSSIP_ITEM( 7, "<- [Back]" , GOSSIP_SENDER_MAIN, 5550); player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); @@ -99,78 +101,78 @@ void SendDefaultMenu_mob_teleguy(Player *player, Creature *_Creature, uint32 act break; case 5553: //Instances 60-70 BC - player->ADD_GOSSIP_ITEM( 5, "Auchindoun. 1 Gold" , GOSSIP_SENDER_MAIN, 4006); - player->ADD_GOSSIP_ITEM( 5, "Karazhan. 1 Gold" , GOSSIP_SENDER_MAIN, 4007); - player->ADD_GOSSIP_ITEM( 5, "Gruul's Lair. 1 Gold" , GOSSIP_SENDER_MAIN, 4008); - player->ADD_GOSSIP_ITEM( 5, "Hellfire Citadel. 1 Gold" , GOSSIP_SENDER_MAIN, 4009); - player->ADD_GOSSIP_ITEM( 5, "Coilfang Reservoir. 1 Gold" , GOSSIP_SENDER_MAIN, 4010); - player->ADD_GOSSIP_ITEM( 5, "Tempest Keep. 1 Gold" , GOSSIP_SENDER_MAIN, 4011); - player->ADD_GOSSIP_ITEM( 5, "Zul'Aman. 1 Gold" , GOSSIP_SENDER_MAIN, 4016); - player->ADD_GOSSIP_ITEM( 5, "Black Temple. 1 Gold" , GOSSIP_SENDER_MAIN, 4013); - player->ADD_GOSSIP_ITEM( 5, "Magister's Terrace. 2 Gold" , GOSSIP_SENDER_MAIN, 4017); - player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); + player->ADD_GOSSIP_ITEM( 5, "Auchindoun. 1 Gold" , GOSSIP_SENDER_MAIN, 4006); + player->ADD_GOSSIP_ITEM( 5, "Karazhan. 1 Gold" , GOSSIP_SENDER_MAIN, 4007); + player->ADD_GOSSIP_ITEM( 5, "Gruul's Lair. 1 Gold" , GOSSIP_SENDER_MAIN, 4008); + player->ADD_GOSSIP_ITEM( 5, "Hellfire Citadel. 1 Gold" , GOSSIP_SENDER_MAIN, 4009); + player->ADD_GOSSIP_ITEM( 5, "Coilfang Reservoir. 1 Gold" , GOSSIP_SENDER_MAIN, 4010); + player->ADD_GOSSIP_ITEM( 5, "Tempest Keep. 1 Gold" , GOSSIP_SENDER_MAIN, 4011); + player->ADD_GOSSIP_ITEM( 5, "Zul'Aman. 1 Gold" , GOSSIP_SENDER_MAIN, 4016); + player->ADD_GOSSIP_ITEM( 5, "Black Temple. 1 Gold" , GOSSIP_SENDER_MAIN, 4013); + player->ADD_GOSSIP_ITEM( 5, "Magister's Terrace. 2 Gold" , GOSSIP_SENDER_MAIN, 4017); + player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); break; case 5554: //Instances 70-80 WotLK - player->ADD_GOSSIP_ITEM( 5, "Caverns of Time. 20 Gold" , GOSSIP_SENDER_MAIN, 4012); - player->ADD_GOSSIP_ITEM( 5, "Utgarde Keep. 20 Gold" , GOSSIP_SENDER_MAIN, 4019); - player->ADD_GOSSIP_ITEM( 5, "Azjol-Nerub. 20 Gold" , GOSSIP_SENDER_MAIN, 4021); - player->ADD_GOSSIP_ITEM( 5, "The Old Kingdom. 20 Gold" , GOSSIP_SENDER_MAIN, 4022); - player->ADD_GOSSIP_ITEM( 5, "Drak'Tharon Keep. 20 Gold" , GOSSIP_SENDER_MAIN, 4023); - player->ADD_GOSSIP_ITEM( 5, "Gundrak. 20 Gold" , GOSSIP_SENDER_MAIN, 4025); - player->ADD_GOSSIP_ITEM( 5, "Utgarde Pinnacle. 20 Gold" , GOSSIP_SENDER_MAIN, 4026); - player->ADD_GOSSIP_ITEM( 5, "Halls of Stone. 20 Gold" , GOSSIP_SENDER_MAIN, 4032); - player->ADD_GOSSIP_ITEM( 5, "Halls of Lightning. 20 Gold" , GOSSIP_SENDER_MAIN, 4033); - player->ADD_GOSSIP_ITEM( 5, "Frozen Halls. 20 Gold" , GOSSIP_SENDER_MAIN, 4034); - player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); + player->ADD_GOSSIP_ITEM( 5, "Caverns of Time. 20 Gold" , GOSSIP_SENDER_MAIN, 4012); + player->ADD_GOSSIP_ITEM( 5, "Utgarde Keep. 20 Gold" , GOSSIP_SENDER_MAIN, 4019); + player->ADD_GOSSIP_ITEM( 5, "Azjol-Nerub. 20 Gold" , GOSSIP_SENDER_MAIN, 4021); + player->ADD_GOSSIP_ITEM( 5, "The Old Kingdom. 20 Gold" , GOSSIP_SENDER_MAIN, 4022); + player->ADD_GOSSIP_ITEM( 5, "Drak'Tharon Keep. 20 Gold" , GOSSIP_SENDER_MAIN, 4023); + player->ADD_GOSSIP_ITEM( 5, "Gundrak. 20 Gold" , GOSSIP_SENDER_MAIN, 4025); + player->ADD_GOSSIP_ITEM( 5, "Utgarde Pinnacle. 20 Gold" , GOSSIP_SENDER_MAIN, 4026); + player->ADD_GOSSIP_ITEM( 5, "Halls of Stone. 20 Gold" , GOSSIP_SENDER_MAIN, 4032); + player->ADD_GOSSIP_ITEM( 5, "Halls of Lightning. 20 Gold" , GOSSIP_SENDER_MAIN, 4033); + player->ADD_GOSSIP_ITEM( 5, "Frozen Halls. 20 Gold" , GOSSIP_SENDER_MAIN, 4034); + player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); break; case 5555: //Raids 80 WotLK - player->ADD_GOSSIP_ITEM( 5, "The Nexus. 20 Gold" , GOSSIP_SENDER_MAIN, 4020); - player->ADD_GOSSIP_ITEM( 5, "Coliseum Vanguard. 20 Gold" , GOSSIP_SENDER_MAIN, 4024); - player->ADD_GOSSIP_ITEM( 5, "Ulduar. 20 Gold" , GOSSIP_SENDER_MAIN, 4027); - player->ADD_GOSSIP_ITEM( 5, "Wyrmrest Temple. 20 Gold" , GOSSIP_SENDER_MAIN, 4028); - player->ADD_GOSSIP_ITEM( 5, "Naxxramas. 20 Gold" , GOSSIP_SENDER_MAIN, 4029); - player->ADD_GOSSIP_ITEM( 5, "Icecrown Citadel. 20 Gold" , GOSSIP_SENDER_MAIN, 4030); - player->ADD_GOSSIP_ITEM( 5, "Vault of Archavon. 20 Gold" , GOSSIP_SENDER_MAIN, 4031); - player->ADD_GOSSIP_ITEM( 5, "Onyxia's Lair. 20 Gold" , GOSSIP_SENDER_MAIN, 4035); - player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); - - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); -break; - + player->ADD_GOSSIP_ITEM( 5, "The Nexus. 20 Gold" , GOSSIP_SENDER_MAIN, 4020); + player->ADD_GOSSIP_ITEM( 5, "Coliseum Vanguard. 20 Gold" , GOSSIP_SENDER_MAIN, 4024); + player->ADD_GOSSIP_ITEM( 5, "Ulduar. 20 Gold" , GOSSIP_SENDER_MAIN, 4027); + player->ADD_GOSSIP_ITEM( 5, "Wyrmrest Temple. 20 Gold" , GOSSIP_SENDER_MAIN, 4028); + player->ADD_GOSSIP_ITEM( 5, "Naxxramas. 20 Gold" , GOSSIP_SENDER_MAIN, 4029); + player->ADD_GOSSIP_ITEM( 5, "Icecrown Citadel. 20 Gold" , GOSSIP_SENDER_MAIN, 4030); + player->ADD_GOSSIP_ITEM( 5, "Vault of Archavon. 20 Gold" , GOSSIP_SENDER_MAIN, 4031); + player->ADD_GOSSIP_ITEM( 5, "Onyxia's Lair. 20 Gold" , GOSSIP_SENDER_MAIN, 4035); + player->ADD_GOSSIP_ITEM( 7, "<- [Main Menu]" , GOSSIP_SENDER_MAIN, 5552); + + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); +break; + case 5552: //Back To Main Menu if (player->GetTeam() == ALLIANCE ) { - player->ADD_GOSSIP_ITEM( 5, "Darnassus. 5 Silver" , GOSSIP_SENDER_MAIN, 1203); - player->ADD_GOSSIP_ITEM( 5, "Exodar. 5 Silver" , GOSSIP_SENDER_MAIN, 1216); - player->ADD_GOSSIP_ITEM( 5, "Stormwind. 5 Silver" , GOSSIP_SENDER_MAIN, 1206); - player->ADD_GOSSIP_ITEM( 5, "Ironforge. 5 Silver" , GOSSIP_SENDER_MAIN, 1224); - player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); - player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); - player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); - player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); - player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); - player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); - player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); - player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); - } else { - player->ADD_GOSSIP_ITEM( 5, "Orgrimmar. 5 Silver" , GOSSIP_SENDER_MAIN, 1215); - player->ADD_GOSSIP_ITEM( 5, "Silvermoon. 5 Silver" , GOSSIP_SENDER_MAIN, 1217); - player->ADD_GOSSIP_ITEM( 5, "Undercity. 5 Silver" , GOSSIP_SENDER_MAIN, 1213); - player->ADD_GOSSIP_ITEM( 5, "Thunder Bluff. 5 Silver" , GOSSIP_SENDER_MAIN, 1225); - player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); - player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); - player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); - player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); - player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); - player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); - player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); - player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); - } + player->ADD_GOSSIP_ITEM( 5, "Darnassus. 5 Silver" , GOSSIP_SENDER_MAIN, 1203); + player->ADD_GOSSIP_ITEM( 5, "Exodar. 5 Silver" , GOSSIP_SENDER_MAIN, 1216); + player->ADD_GOSSIP_ITEM( 5, "Stormwind. 5 Silver" , GOSSIP_SENDER_MAIN, 1206); + player->ADD_GOSSIP_ITEM( 5, "Ironforge. 5 Silver" , GOSSIP_SENDER_MAIN, 1224); + player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); + player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); + player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); + player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); + player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); + player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); + player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); + player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); + } else { + player->ADD_GOSSIP_ITEM( 5, "Orgrimmar. 5 Silver" , GOSSIP_SENDER_MAIN, 1215); + player->ADD_GOSSIP_ITEM( 5, "Silvermoon. 5 Silver" , GOSSIP_SENDER_MAIN, 1217); + player->ADD_GOSSIP_ITEM( 5, "Undercity. 5 Silver" , GOSSIP_SENDER_MAIN, 1213); + player->ADD_GOSSIP_ITEM( 5, "Thunder Bluff. 5 Silver" , GOSSIP_SENDER_MAIN, 1225); + player->ADD_GOSSIP_ITEM( 5, "Gnomeregan. 5 Silver" , GOSSIP_SENDER_MAIN, 1222); + player->ADD_GOSSIP_ITEM( 5, "Shattrath City. 5 Silver" , GOSSIP_SENDER_MAIN, 1287); + player->ADD_GOSSIP_ITEM( 5, "Dalaran. 5 Silver" , GOSSIP_SENDER_MAIN, 1205); + player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas. 5 Silver" , GOSSIP_SENDER_MAIN, 1288); + player->ADD_GOSSIP_ITEM( 7, "[Instances Normal] ->" , GOSSIP_SENDER_MAIN, 5550); + player->ADD_GOSSIP_ITEM( 7, "[Instances BC] ->" , GOSSIP_SENDER_MAIN, 5553); + player->ADD_GOSSIP_ITEM( 7, "[Instances WotLK] ->" , GOSSIP_SENDER_MAIN, 5554); + player->ADD_GOSSIP_ITEM( 7, "[Raids WotLK] ->" , GOSSIP_SENDER_MAIN, 5555); + } player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetObjectGuid()); break; @@ -471,6 +473,30 @@ case 1266:// Scholomance } break; +case 1267:// Ahn'Qiraj + if (player->getLevel() >= 50) + { + player->CLOSE_GOSSIP_MENU(); + player->TeleportTo(1, -8169.81f, 1528.11f, 4.195f, 2.948f); + player->ModifyMoney(-10*costo); + } else { + player->CLOSE_GOSSIP_MENU(); + _Creature->MonsterSay("You must be at least level 50!", LANG_UNIVERSAL); + } +break; + +case 1268:// Zul'Gurub + if (player->getLevel() >= 50) + { + player->CLOSE_GOSSIP_MENU(); + player->TeleportTo(0, -11916.1f, -1223.97f, 92.288f, 4.707f); + player->ModifyMoney(-10*costo); + } else { + player->CLOSE_GOSSIP_MENU(); + _Creature->MonsterSay("You must be at least level 50!", LANG_UNIVERSAL); + } +break; + case 1287:// Shattrath City if(player->getLevel() >= 58) { @@ -534,9 +560,9 @@ break; case 4009:// Hellfire Citadel if (player->getLevel() >= 58) { - player->CLOSE_GOSSIP_MENU(); - player->TeleportTo(530, -305.816223f, 3056.401611f, -2.473183f, 2.01f); - player->ModifyMoney(-20*costo); + player->CLOSE_GOSSIP_MENU(); + player->TeleportTo(530, -305.816223f, 3056.401611f, -2.473183f, 2.01f); + player->ModifyMoney(-20*costo); } else { player->CLOSE_GOSSIP_MENU(); _Creature->MonsterSay("You must be at least level 58!", LANG_UNIVERSAL); @@ -838,4 +864,4 @@ void AddSC_mob_teleguy() newscript->pGossipHello = &GossipHello_mob_teleguy; newscript->pGossipSelect = &GossipSelect_mob_teleguy; newscript->RegisterSelf(); -} +} \ No newline at end of file diff --git a/scripts/world/guards.cpp b/scripts/world/guards.cpp index c71e03c..f3dfbc8 100644 --- a/scripts/world/guards.cpp +++ b/scripts/world/guards.cpp @@ -273,105 +273,105 @@ CreatureAI* GetAI_guard_undercity(Creature* pCreature) void AddSC_guards() { - Script *newscript; - - newscript = new Script; - newscript->Name = "guard_azuremyst"; - newscript->GetAI = &GetAI_guard_azuremyst; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_bluffwatcher"; - newscript->GetAI = &GetAI_guard_bluffwatcher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_contested"; - newscript->GetAI = &GetAI_guard_contested; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_darnassus"; - newscript->GetAI = &GetAI_guard_darnassus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_dunmorogh"; - newscript->GetAI = &GetAI_guard_dunmorogh; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_durotar"; - newscript->GetAI = &GetAI_guard_durotar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_elwynnforest"; - newscript->GetAI = &GetAI_guard_elwynnforest; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_eversong"; - newscript->GetAI = &GetAI_guard_eversong; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_exodar"; - newscript->GetAI = &GetAI_guard_exodar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_ironforge"; - newscript->GetAI = &GetAI_guard_ironforge; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_mulgore"; - newscript->GetAI = &GetAI_guard_mulgore; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_orgrimmar"; - newscript->GetAI = &GetAI_guard_orgrimmar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_shattrath"; - newscript->GetAI = &GetAI_guard_shattrath; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_shattrath_aldor"; - newscript->GetAI = &GetAI_guard_shattrath_aldor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_shattrath_scryer"; - newscript->GetAI = &GetAI_guard_shattrath_scryer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_silvermoon"; - newscript->GetAI = &GetAI_guard_silvermoon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_stormwind"; - newscript->GetAI = &GetAI_guard_stormwind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_teldrassil"; - newscript->GetAI = &GetAI_guard_teldrassil; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_tirisfal"; - newscript->GetAI = &GetAI_guard_tirisfal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_undercity"; - newscript->GetAI = &GetAI_guard_undercity; - newscript->RegisterSelf(); + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "guard_azuremyst"; + pNewScript->GetAI = &GetAI_guard_azuremyst; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_bluffwatcher"; + pNewScript->GetAI = &GetAI_guard_bluffwatcher; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_contested"; + pNewScript->GetAI = &GetAI_guard_contested; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_darnassus"; + pNewScript->GetAI = &GetAI_guard_darnassus; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_dunmorogh"; + pNewScript->GetAI = &GetAI_guard_dunmorogh; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_durotar"; + pNewScript->GetAI = &GetAI_guard_durotar; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_elwynnforest"; + pNewScript->GetAI = &GetAI_guard_elwynnforest; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_eversong"; + pNewScript->GetAI = &GetAI_guard_eversong; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_exodar"; + pNewScript->GetAI = &GetAI_guard_exodar; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_ironforge"; + pNewScript->GetAI = &GetAI_guard_ironforge; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_mulgore"; + pNewScript->GetAI = &GetAI_guard_mulgore; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_orgrimmar"; + pNewScript->GetAI = &GetAI_guard_orgrimmar; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_shattrath"; + pNewScript->GetAI = &GetAI_guard_shattrath; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_shattrath_aldor"; + pNewScript->GetAI = &GetAI_guard_shattrath_aldor; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_shattrath_scryer"; + pNewScript->GetAI = &GetAI_guard_shattrath_scryer; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_silvermoon"; + pNewScript->GetAI = &GetAI_guard_silvermoon; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_stormwind"; + pNewScript->GetAI = &GetAI_guard_stormwind; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_teldrassil"; + pNewScript->GetAI = &GetAI_guard_teldrassil; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_tirisfal"; + pNewScript->GetAI = &GetAI_guard_tirisfal; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "guard_undercity"; + pNewScript->GetAI = &GetAI_guard_undercity; + pNewScript->RegisterSelf(); } diff --git a/scripts/world/item_scripts.cpp b/scripts/world/item_scripts.cpp index aafbd55..d713363 100644 --- a/scripts/world/item_scripts.cpp +++ b/scripts/world/item_scripts.cpp @@ -154,30 +154,30 @@ bool ItemUse_item_jungle_punch_sample(Player* pPlayer, Item* pItem, const SpellC void AddSC_item_scripts() { - Script *newscript; - - newscript = new Script; - newscript->Name = "item_arcane_charges"; - newscript->pItemUse = &ItemUse_item_arcane_charges; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_flying_machine"; - newscript->pItemUse = &ItemUse_item_flying_machine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_gor_dreks_ointment"; - newscript->pItemUse = &ItemUse_item_gor_dreks_ointment; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_petrov_cluster_bombs"; - newscript->pItemUse = &ItemUse_item_petrov_cluster_bombs; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_jungle_punch_sample"; - newscript->pItemUse = &ItemUse_item_jungle_punch_sample; - newscript->RegisterSelf(); + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "item_arcane_charges"; + pNewScript->pItemUse = &ItemUse_item_arcane_charges; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "item_flying_machine"; + pNewScript->pItemUse = &ItemUse_item_flying_machine; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "item_gor_dreks_ointment"; + pNewScript->pItemUse = &ItemUse_item_gor_dreks_ointment; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "item_petrov_cluster_bombs"; + pNewScript->pItemUse = &ItemUse_item_petrov_cluster_bombs; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "item_jungle_punch_sample"; + pNewScript->pItemUse = &ItemUse_item_jungle_punch_sample; + pNewScript->RegisterSelf(); } diff --git a/scripts/world/mob_generic_creature.cpp b/scripts/world/mob_generic_creature.cpp index 9a7688c..c17c435 100644 --- a/scripts/world/mob_generic_creature.cpp +++ b/scripts/world/mob_generic_creature.cpp @@ -163,9 +163,10 @@ CreatureAI* GetAI_generic_creature(Creature* pCreature) void AddSC_generic_creature() { - Script *newscript; - newscript = new Script; - newscript->Name = "generic_creature"; - newscript->GetAI = &GetAI_generic_creature; - newscript->RegisterSelf(false); + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "generic_creature"; + pNewScript->GetAI = &GetAI_generic_creature; + pNewScript->RegisterSelf(false); } diff --git a/scripts/world/npc_professions.cpp b/scripts/world/npc_professions.cpp index e4cbecf..ce71f04 100644 --- a/scripts/world/npc_professions.cpp +++ b/scripts/world/npc_professions.cpp @@ -1169,35 +1169,35 @@ bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 u void AddSC_npc_professions() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_prof_alchemy"; - newscript->pGossipHello = &GossipHello_npc_prof_alchemy; - newscript->pGossipSelect = &GossipSelect_npc_prof_alchemy; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prof_blacksmith"; - newscript->pGossipHello = &GossipHello_npc_prof_blacksmith; - newscript->pGossipSelect = &GossipSelect_npc_prof_blacksmith; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prof_leather"; - newscript->pGossipHello = &GossipHello_npc_prof_leather; - newscript->pGossipSelect = &GossipSelect_npc_prof_leather; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prof_tailor"; - newscript->pGossipHello = &GossipHello_npc_prof_tailor; - newscript->pGossipSelect = &GossipSelect_npc_prof_tailor; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "go_soothsaying_for_dummies"; - newscript->pGOUse = &GOUse_go_soothsaying_for_dummies; - //newscript->pGossipSelect = &GossipSelect_go_soothsaying_for_dummies; - newscript->RegisterSelf();*/ + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "npc_prof_alchemy"; + pNewScript->pGossipHello = &GossipHello_npc_prof_alchemy; + pNewScript->pGossipSelect = &GossipSelect_npc_prof_alchemy; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_prof_blacksmith"; + pNewScript->pGossipHello = &GossipHello_npc_prof_blacksmith; + pNewScript->pGossipSelect = &GossipSelect_npc_prof_blacksmith; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_prof_leather"; + pNewScript->pGossipHello = &GossipHello_npc_prof_leather; + pNewScript->pGossipSelect = &GossipSelect_npc_prof_leather; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_prof_tailor"; + pNewScript->pGossipHello = &GossipHello_npc_prof_tailor; + pNewScript->pGossipSelect = &GossipSelect_npc_prof_tailor; + pNewScript->RegisterSelf(); + + /*pNewScript = new Script; + pNewScript->Name = "go_soothsaying_for_dummies"; + pNewScript->pGOUse = &GOUse_go_soothsaying_for_dummies; + //pNewScript->pGossipSelect = &GossipSelect_go_soothsaying_for_dummies; + pNewScript->RegisterSelf();*/ } diff --git a/scripts/world/pet_scripts.cpp b/scripts/world/pet_scripts.cpp index 34efe81..19997a0 100644 --- a/scripts/world/pet_scripts.cpp +++ b/scripts/world/pet_scripts.cpp @@ -197,15 +197,15 @@ CreatureAI* GetAI_pet_greater_earth_elemental(Creature* pCreature) void AddSC_pet_scripts() { - Script* newscript; + Script* pNewScript; - newscript = new Script; - newscript->Name = "pet_greater_fire_elemental"; - newscript->GetAI = &GetAI_pet_greater_fire_elemental; - newscript->RegisterSelf(); + pNewScript = new Script; + pNewScript->Name = "pet_greater_fire_elemental"; + pNewScript->GetAI = &GetAI_pet_greater_fire_elemental; + pNewScript->RegisterSelf(); - newscript = new Script; - newscript->Name = "pet_greater_earth_elemental"; - newscript->GetAI = &GetAI_pet_greater_earth_elemental; - newscript->RegisterSelf(); + pNewScript = new Script; + pNewScript->Name = "pet_greater_earth_elemental"; + pNewScript->GetAI = &GetAI_pet_greater_earth_elemental; + pNewScript->RegisterSelf(); } diff --git a/scripts/world/spell_scripts.cpp b/scripts/world/spell_scripts.cpp index 8bb9964..b634f16 100644 --- a/scripts/world/spell_scripts.cpp +++ b/scripts/world/spell_scripts.cpp @@ -910,16 +910,16 @@ bool EffectDummyCreature_spell_dummy_npc(Unit* pCaster, uint32 uiSpellId, SpellE void AddSC_spell_scripts() { - Script* pNewscript; - - pNewscript = new Script; - pNewscript->Name = "spell_dummy_go"; - pNewscript->pEffectDummyGO = &EffectDummyGameObj_spell_dummy_go; - pNewscript->RegisterSelf(); - - pNewscript = new Script; - pNewscript->Name = "spell_dummy_npc"; - pNewscript->pEffectDummyNPC = &EffectDummyCreature_spell_dummy_npc; - pNewscript->pEffectAuraDummy = &EffectAuraDummy_spell_aura_dummy_npc; - pNewscript->RegisterSelf(); + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "spell_dummy_go"; + pNewScript->pEffectDummyGO = &EffectDummyGameObj_spell_dummy_go; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "spell_dummy_npc"; + pNewScript->pEffectDummyNPC = &EffectDummyCreature_spell_dummy_npc; + pNewScript->pEffectAuraDummy = &EffectAuraDummy_spell_aura_dummy_npc; + pNewScript->RegisterSelf(); }