diff options
author | megamage <none@none> | 2009-06-18 20:28:16 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-18 20:28:16 -0500 |
commit | 9008c0a838e84f79d961e11d450550466ebc3743 (patch) | |
tree | 82dd23ed05deabd7de62b801fe463bc41bc38268 /src | |
parent | e0553121f276be21d0c8162b79d1a87f814d0ee3 (diff) | |
parent | ee6126dd50db4875acc9aee7b13f2215e965b084 (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/npc/npcs_special.cpp | 213 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp | 47 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp | 12 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp | 23 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp | 33 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp | 25 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp | 4 | ||||
-rw-r--r-- | src/game/Chat.cpp | 1 | ||||
-rw-r--r-- | src/game/Chat.h | 1 | ||||
-rw-r--r-- | src/game/Language.h | 13 | ||||
-rw-r--r-- | src/game/Level3.cpp | 97 | ||||
-rw-r--r-- | src/game/TicketHandler.cpp | 46 | ||||
-rw-r--r-- | src/game/WorldSession.h | 2 |
13 files changed, 442 insertions, 75 deletions
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp index f195d54b882..55ba138bc09 100644 --- a/src/bindings/scripts/scripts/npc/npcs_special.cpp +++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp @@ -23,6 +23,7 @@ EndScriptData */ /* ContentData +npc_air_force_bots 80% support for misc (invisible) guard bots in areas where player allowed to fly. Summon guards after a preset time if tagged by spell npc_chicken_cluck 100% support for quest 3861 (Cluck!) npc_dancing_flames 100% midsummer event NPC npc_guardian 100% guardianAI used to prevent players from accessing off-limits areas. Not in use by SD2 @@ -38,6 +39,213 @@ EndContentData */ #include "precompiled.h" #include "../npc/npc_escortAI.h" +#include "ObjectMgr.h" + +/*######## +# npc_air_force_bots +#########*/ + +enum SpawnType +{ + SPAWNTYPE_TRIPWIRE_ROOFTOP, // no warning, summon creature at smaller range + SPAWNTYPE_ALARMBOT, // cast guards mark and summon npc - if player shows up with that buff duration < 5 seconds attack +}; + +struct SpawnAssociation +{ + uint32 m_uiThisCreatureEntry; + uint32 m_uiSpawnedCreatureEntry; + SpawnType m_SpawnType; +}; + +enum +{ + SPELL_GUARDS_MARK = 38067, + AURA_DURATION_TIME_LEFT = 5000 +}; + +const float RANGE_TRIPWIRE = 15.0f; +const float RANGE_GUARDS_MARK = 50.0f; + +SpawnAssociation m_aSpawnAssociations[] = +{ + {2614, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Alliance) + {2615, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Horde) + {21974, 21976, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Area 52) + {21993, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Horde - Bat Rider) + {21996, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Alliance - Gryphon) + {21997, 21976, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Goblin - Area 52 - Zeppelin) + {21999, 15241, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Alliance) + {22001, 15242, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Horde) + {22002, 15242, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Ground (Horde) + {22003, 15241, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Ground (Alliance) + {22063, 21976, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Goblin - Area 52) + {22065, 22064, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Ethereal - Stormspire) + {22066, 22067, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Scryer - Dragonhawk) + {22068, 22064, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Ethereal - Stormspire) + {22069, 22064, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Stormspire) + {22070, 22067, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Scryer) + {22071, 22067, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Scryer) + {22078, 22077, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Aldor) + {22079, 22077, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Aldor - Gryphon) + {22080, 22077, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Aldor) + {22086, 22085, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Sporeggar) + {22087, 22085, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Sporeggar - Spore Bat) + {22088, 22085, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Sporeggar) + {22090, 22089, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Toshley's Station - Flying Machine) + {22124, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Cenarion) + {22125, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Cenarion - Stormcrow) + {22126, 22122, SPAWNTYPE_ALARMBOT} //Air Force Trip Wire - Rooftop (Cenarion Expedition) +}; + +struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI +{ + npc_air_force_botsAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pSpawnAssoc = NULL; + m_uiSpawnedGUID = 0; + + // find the correct spawnhandling + static uint32 uiEntryCount = sizeof(m_aSpawnAssociations)/sizeof(SpawnAssociation); + + for (uint8 i=0; i<uiEntryCount; ++i) + { + if (m_aSpawnAssociations[i].m_uiThisCreatureEntry == pCreature->GetEntry()) + { + m_pSpawnAssoc = &m_aSpawnAssociations[i]; + break; + } + } + + if (!m_pSpawnAssoc) + error_db_log("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", pCreature->GetEntry()); + else + { + CreatureInfo const* spawnedTemplate = GetCreatureTemplateStore(m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + + if (!spawnedTemplate) + { + m_pSpawnAssoc = NULL; + error_db_log("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + return; + } + } + } + + SpawnAssociation* m_pSpawnAssoc; + uint64 m_uiSpawnedGUID; + + void Reset() { } + + Creature* SummonGuard() + { + Creature* pSummoned = m_creature->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + + if (pSummoned) + m_uiSpawnedGUID = pSummoned->GetGUID(); + else + { + error_db_log("TCSR: npc_air_force_bots: wasn't able to spawn creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + m_pSpawnAssoc = NULL; + } + + return pSummoned; + } + + Creature* GetSummonedGuard() + { + Creature* pCreature = (Creature*)Unit::GetUnit(*m_creature, m_uiSpawnedGUID); + + if (pCreature && pCreature->isAlive()) + return pCreature; + + return NULL; + } + + void MoveInLineOfSight(Unit* pWho) + { + if (!m_pSpawnAssoc) + return; + + if (pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + { + Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? (Player*)pWho : NULL; + + // airforce guards only spawn for players + if (!pPlayerTarget) + return; + + Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); + + // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup + if (!pLastSpawnedGuard) + m_uiSpawnedGUID = 0; + + switch(m_pSpawnAssoc->m_SpawnType) + { + case SPAWNTYPE_ALARMBOT: + { + if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK)) + return; + + Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK, 0); + if (pMarkAura) + { + // the target wasn't able to move out of our range within 25 seconds + if (!pLastSpawnedGuard) + { + pLastSpawnedGuard = SummonGuard(); + + if (!pLastSpawnedGuard) + return; + } + + if (pMarkAura->GetAuraDuration() < AURA_DURATION_TIME_LEFT) + { + if (!pLastSpawnedGuard->getVictim()) + pLastSpawnedGuard->AI()->AttackStart(pWho); + } + } + else + { + if (!pLastSpawnedGuard) + pLastSpawnedGuard = SummonGuard(); + + if (!pLastSpawnedGuard) + return; + + pLastSpawnedGuard->CastSpell(pWho, SPELL_GUARDS_MARK, true); + } + break; + } + case SPAWNTYPE_TRIPWIRE_ROOFTOP: + { + if (!pWho->IsWithinDistInMap(m_creature, RANGE_TRIPWIRE)) + return; + + if (!pLastSpawnedGuard) + pLastSpawnedGuard = SummonGuard(); + + if (!pLastSpawnedGuard) + return; + + // ROOFTOP only triggers if the player is on the ground + if (!pPlayerTarget->IsFlying()) + { + if (!pLastSpawnedGuard->getVictim()) + pLastSpawnedGuard->AI()->AttackStart(pWho); + } + break; + } + } + } + } +}; + +CreatureAI* GetAI_npc_air_force_bots(Creature* pCreature) +{ + return new npc_air_force_botsAI(pCreature); +} /*######## # npc_chicken_cluck @@ -1374,6 +1582,11 @@ void AddSC_npcs_special() Script *newscript; newscript = new Script; + newscript->Name = "npc_air_force_bots"; + newscript->GetAI = &GetAI_npc_air_force_bots; + newscript->RegisterSelf(); + + newscript = new Script; newscript->Name="npc_chicken_cluck"; newscript->GetAI = &GetAI_npc_chicken_cluck; newscript->pQuestAccept = &QuestAccept_npc_chicken_cluck; diff --git a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp index 26af428c2e7..596c6ce3fb1 100644 --- a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp +++ b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp @@ -36,8 +36,16 @@ EndContentData */ ## npc_bunthen_plainswind ######*/ -#define GOSSIP_BP1 "Do you know where I can find Half Pendant of Aquatic Endurance?" -#define GOSSIP_BP2 "I'd like to fly to Thunder Bluff." +enum +{ + QUEST_SEA_LION_HORDE = 30, + QUEST_SEA_LION_ALLY = 272, + TAXI_PATH_ID_ALLY = 315, + TAXI_PATH_ID_HORDE = 316 +}; + +#define GOSSIP_ITEM_THUNDER "I'd like to fly to Thunder Bluff." +#define GOSSIP_ITEM_AQ_END "Do you know where I can find Half Pendant of Aquatic Endurance?" bool GossipHello_npc_bunthen_plainswind(Player *player, Creature *_Creature) { @@ -45,17 +53,17 @@ bool GossipHello_npc_bunthen_plainswind(Player *player, Creature *_Creature) player->SEND_GOSSIP_MENU(4916,_Creature->GetGUID()); else if(player->GetTeam() != HORDE) { - if(player->GetQuestStatus(272) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, GOSSIP_BP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + if(player->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(4917,_Creature->GetGUID()); } else if(player->getClass() == CLASS_DRUID && player->GetTeam() == HORDE) { - player->ADD_GOSSIP_ITEM( 0, GOSSIP_BP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if(player->GetQuestStatus(30) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, GOSSIP_BP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + if(player->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(4918,_Creature->GetGUID()); } @@ -67,14 +75,10 @@ bool GossipSelect_npc_bunthen_plainswind(Player *player, Creature *_Creature, ui switch(action) { case GOSSIP_ACTION_INFO_DEF + 1: - { player->CLOSE_GOSSIP_MENU(); if (player->getClass() == CLASS_DRUID && player->GetTeam() == HORDE) - { - player->ActivateTaxiPathTo(316); - } + player->ActivateTaxiPathTo(TAXI_PATH_ID_HORDE); break; - } case GOSSIP_ACTION_INFO_DEF + 2: player->SEND_GOSSIP_MENU(5373,_Creature->GetGUID()); break; @@ -139,25 +143,26 @@ bool GossipSelect_npc_great_bear_spirit(Player *player, Creature *_Creature, uin ## npc_silva_filnaveth ######*/ -#define GOSSIP_SF1 "Do you know where I can find Half Pendant of Aquatic Agility?" -#define GOSSIP_SF2 "I'd like to fly to Rut'theran Village." +#define GOSSIP_ITEM_RUTHERAN "I'd like to fly to Rut'theran Village." +#define GOSSIP_ITEM_AQ_AGI "Do you know where I can find Half Pendant of Aquatic Agility?" + bool GossipHello_npc_silva_filnaveth(Player *player, Creature *_Creature) { if(player->getClass() != CLASS_DRUID) player->SEND_GOSSIP_MENU(4913,_Creature->GetGUID()); else if(player->GetTeam() != ALLIANCE) { - if(player->GetQuestStatus(30) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, GOSSIP_SF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + if(player->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(4915,_Creature->GetGUID()); } else if(player->getClass() == CLASS_DRUID && player->GetTeam() == ALLIANCE) { - player->ADD_GOSSIP_ITEM( 0, GOSSIP_SF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if(player->GetQuestStatus(272) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, GOSSIP_SF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + if(player->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(4914,_Creature->GetGUID()); } @@ -169,12 +174,10 @@ bool GossipSelect_npc_silva_filnaveth(Player *player, Creature *_Creature, uint3 switch(action) { case GOSSIP_ACTION_INFO_DEF + 1: - { player->CLOSE_GOSSIP_MENU(); if (player->getClass() == CLASS_DRUID && player->GetTeam() == ALLIANCE) - player->ActivateTaxiPathTo(315); + player->ActivateTaxiPathTo(TAXI_PATH_ID_ALLY); break; - } case GOSSIP_ACTION_INFO_DEF + 2: player->SEND_GOSSIP_MENU(5374,_Creature->GetGUID()); break; diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp index aa7c55330a2..0ae27fd009d 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp @@ -628,21 +628,13 @@ enum { QUEST_ALLY_OF_NETHER = 10870, - TAXI_NODE_START = 161, // From Karynaku - TAXI_NODE_END = 162 // To Mordenai + TAXI_PATH_ID = 649 }; bool QuestAccept_npc_karynaku(Player* player, Creature* creature, Quest const* quest) { if(quest->GetQuestId() == QUEST_ALLY_OF_NETHER) - { - std::vector<uint32> nodes; - - nodes.resize(2); - nodes[0] = TAXI_NODE_START; - nodes[1] = TAXI_NODE_END; - player->ActivateTaxiPathTo(nodes); //player->ActivateTaxiPathTo(649); - } + player->ActivateTaxiPathTo(TAXI_PATH_ID); //player->ActivateTaxiPathTo(649); return true; } diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp index 236ef85f85c..d74d3934c6c 100644 --- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp @@ -41,21 +41,28 @@ EndContentData */ #define GOSSIP_RALIQ "You owe Sim'salabim money. Hand them over or die!" -#define FACTION_HOSTILE_RD 45 -#define FACTION_FRIENDLY_RD 35 - -#define SPELL_UPPERCUT 10966 +enum +{ + SPELL_UPPERCUT = 10966, + QUEST_CRACK_SKULLS = 10009, + FACTION_HOSTILE_RD = 45 +}; struct TRINITY_DLL_DECL npc_raliq_the_drunkAI : public ScriptedAI { - npc_raliq_the_drunkAI(Creature* c) : ScriptedAI(c) {} + npc_raliq_the_drunkAI(Creature* c) : ScriptedAI(c) + { + m_uiNormFaction = c->getFaction(); + } + uint32 m_uiNormFaction; uint32 Uppercut_Timer; void Reset() { Uppercut_Timer = 5000; - m_creature->setFaction(FACTION_FRIENDLY_RD); + if (m_creature->getFaction() != m_uiNormFaction) + m_creature->setFaction(m_uiNormFaction); } void EnterCombat(Unit *who) {} @@ -74,6 +81,7 @@ struct TRINITY_DLL_DECL npc_raliq_the_drunkAI : public ScriptedAI DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_npc_raliq_the_drunk(Creature *_Creature) { return new npc_raliq_the_drunkAI (_Creature); @@ -81,7 +89,7 @@ CreatureAI* GetAI_npc_raliq_the_drunk(Creature *_Creature) bool GossipHello_npc_raliq_the_drunk(Player *player, Creature *_Creature ) { - if( player->GetQuestStatus(10009) == QUEST_STATUS_INCOMPLETE ) + if( player->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE ) player->ADD_GOSSIP_ITEM(1, GOSSIP_RALIQ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(9440, _Creature->GetGUID()); @@ -634,6 +642,7 @@ void AddSC_shattrath_city() newscript = new Script; newscript->Name="npc_raliq_the_drunk"; + newscript->GetAI = &GetAI_npc_raliq_the_drunk; newscript->pGossipHello = &GossipHello_npc_raliq_the_drunk; newscript->pGossipSelect = &GossipSelect_npc_raliq_the_drunk; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp index e35c45b2cf0..8e45c6c6a7c 100644 --- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp @@ -243,19 +243,26 @@ CreatureAI* GetAI_mob_netherweb_victim(Creature *_Creature) #define GOSSIP_FLOON1 "You owe Sim'salabim money. Hand them over or die!" #define GOSSIP_FLOON2 "Hand over the money or die...again!" -#define SAY_FLOON_ATTACK -1000352 +enum +{ + SAY_FLOON_ATTACK = -1000352, -#define FACTION_HOSTILE_FL 1738 -#define FACTION_FRIENDLY_FL 35 + SPELL_SILENCE = 6726, + SPELL_FROSTBOLT = 9672, + SPELL_FROST_NOVA = 11831, -#define SPELL_SILENCE 6726 -#define SPELL_FROSTBOLT 9672 -#define SPELL_FROST_NOVA 11831 + FACTION_HOSTILE_FL = 1738, + QUEST_CRACK_SKULLS = 10009 +}; struct TRINITY_DLL_DECL npc_floonAI : public ScriptedAI { - npc_floonAI(Creature* c) : ScriptedAI(c) {} + npc_floonAI(Creature* c) : ScriptedAI(c) + { + m_uiNormFaction = c->getFaction(); + } + uint32 m_uiNormFaction; uint32 Silence_Timer; uint32 Frostbolt_Timer; uint32 FrostNova_Timer; @@ -265,7 +272,8 @@ struct TRINITY_DLL_DECL npc_floonAI : public ScriptedAI Silence_Timer = 2000; Frostbolt_Timer = 4000; FrostNova_Timer = 9000; - m_creature->setFaction(FACTION_FRIENDLY_FL); + if (m_creature->getFaction() != m_uiNormFaction) + m_creature->setFaction(m_uiNormFaction); } void EnterCombat(Unit *who) {} @@ -296,6 +304,7 @@ struct TRINITY_DLL_DECL npc_floonAI : public ScriptedAI DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_npc_floon(Creature *_Creature) { return new npc_floonAI (_Creature); @@ -303,8 +312,8 @@ CreatureAI* GetAI_npc_floon(Creature *_Creature) bool GossipHello_npc_floon(Player *player, Creature *_Creature ) { - if( player->GetQuestStatus(10009) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM(1, GOSSIP_FLOON1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + if( player->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE ) + player->ADD_GOSSIP_ITEM(0, GOSSIP_FLOON1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(9442, _Creature->GetGUID()); return true; @@ -314,7 +323,7 @@ bool GossipSelect_npc_floon(Player *player, Creature *_Creature, uint32 sender, { if( action == GOSSIP_ACTION_INFO_DEF ) { - player->ADD_GOSSIP_ITEM(1, GOSSIP_FLOON2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_FLOON2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(9443, _Creature->GetGUID()); } if( action == GOSSIP_ACTION_INFO_DEF+1 ) @@ -538,9 +547,9 @@ void AddSC_terokkar_forest() newscript = new Script; newscript->Name="npc_floon"; + newscript->GetAI = &GetAI_npc_floon; newscript->pGossipHello = &GossipHello_npc_floon; newscript->pGossipSelect = &GossipSelect_npc_floon; - newscript->GetAI = &GetAI_npc_floon; newscript->RegisterSelf(); newscript = new Script; diff --git a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp index e6d6ecf8f0a..d5d2a47138e 100644 --- a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp @@ -120,21 +120,28 @@ bool GossipSelect_npcs_ashyen_and_keleth(Player *player, Creature *_Creature, ui #define GOSSIP_COOSH "You owe Sim'salabim money. Hand them over or die!" -#define FACTION_HOSTILE_CO 45 -#define FACTION_FRIENDLY_CO 35 - -#define SPELL_LIGHTNING_BOLT 9532 +enum +{ + SPELL_LIGHTNING_BOLT = 9532, + QUEST_CRACK_SKULLS = 10009, + FACTION_HOSTILE_CO = 45 +}; struct TRINITY_DLL_DECL npc_cooshcooshAI : public ScriptedAI { - npc_cooshcooshAI(Creature* c) : ScriptedAI(c) {} + npc_cooshcooshAI(Creature* c) : ScriptedAI(c) + { + m_uiNormFaction = c->getFaction(); + } + uint32 m_uiNormFaction; uint32 LightningBolt_Timer; void Reset() { LightningBolt_Timer = 2000; - m_creature->setFaction(FACTION_FRIENDLY_CO); + if (m_creature->getFaction() != m_uiNormFaction) + m_creature->setFaction(m_uiNormFaction); } void EnterCombat(Unit *who) {} @@ -153,6 +160,7 @@ struct TRINITY_DLL_DECL npc_cooshcooshAI : public ScriptedAI DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_npc_cooshcoosh(Creature *_Creature) { return new npc_cooshcooshAI (_Creature); @@ -160,8 +168,8 @@ CreatureAI* GetAI_npc_cooshcoosh(Creature *_Creature) bool GossipHello_npc_cooshcoosh(Player *player, Creature *_Creature ) { - if( player->GetQuestStatus(10009) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM(1, GOSSIP_COOSH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + if( player->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE ) + player->ADD_GOSSIP_ITEM(0, GOSSIP_COOSH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(9441, _Creature->GetGUID()); return true; @@ -359,6 +367,7 @@ void AddSC_zangarmarsh() newscript = new Script; newscript->Name="npc_cooshcoosh"; + newscript->GetAI = &GetAI_npc_cooshcoosh; newscript->pGossipHello = &GossipHello_npc_cooshcoosh; newscript->pGossipSelect = &GossipSelect_npc_cooshcoosh; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp b/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp index c06cd917b0e..9c0f2a92e81 100644 --- a/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp +++ b/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp @@ -104,7 +104,7 @@ bool GossipHello_npc_sergeant_bly(Player *player, Creature *_Creature ) { /*if( pInstance->GetData(0) == DONE ) {*/ - player->ADD_GOSSIP_ITEM(1, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(1517, _Creature->GetGUID()); /*} else if( pInstance->GetData(0) == IN_PROGRESS ) @@ -182,7 +182,7 @@ bool GossipHello_npc_weegli_blastfuse(Player *player, Creature *_Creature ) //event not implemented yet, this is only placeholder for future developement /*if( pInstance->GetData(0) == DONE ) { - player->ADD_GOSSIP_ITEM(1, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(1514, _Creature->GetGUID());//if event can proceed to end } else if( pInstance->GetData(0) == IN_PROGRESS ) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 416696b4369..d1e85f6baa0 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -306,6 +306,7 @@ ChatCommand * ChatHandler::getCommandTable() { "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL }, { "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL }, { "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupMapCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; diff --git a/src/game/Chat.h b/src/game/Chat.h index f5d889479c2..b970628f94f 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -256,6 +256,7 @@ class ChatHandler bool HandleLookupSpellCommand(const char* args); bool HandleLookupTaxiNodeCommand(const char * args); bool HandleLookupTeleCommand(const char * args); + bool HandleLookupMapCommand(const char* args); bool HandleModifyKnownTitlesCommand(const char* args); bool HandleModifyHPCommand(const char* args); diff --git a/src/game/Language.h b/src/game/Language.h index 2b063999951..c16393eba1c 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -854,7 +854,16 @@ enum TrinityStrings LANG_COMMAND_PLAYED_TO_ALL = 5009, LANG_NPCINFO_LINKGUID = 5010, LANG_TELEPORTED_TO_BY_CONSOLE = 5011, - // Room for more Trinity strings 5012-9999 + // for command lookup map + LANG_COMMAND_NOMAPFOUND = 5012, + LANG_CONTINENT = 5013, + LANG_INSTANCE = 5014, + LANG_BATTLEGROUND = 5015, + LANG_ARENA = 5016, + LANG_RAID = 5017, + LANG_HEROIC = 5018, + LANG_MOUNTABLE = 5019, + // Room for more Trinity strings 5020-9999 // Used for GM Announcements LANG_GM_BROADCAST = 6613, LANG_GM_NOTIFY = 6614, @@ -929,7 +938,7 @@ enum TrinityStrings LANG_OPVP_EP_FLIGHT_CGT = 10053, LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054, LANG_OPVP_ZM_GOSSIP_HORDE = 10055, - + // Use for custom patches 11000-11999 // NOT RESERVED IDS 12000-1999999999 diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 30a646ee4b4..849565cc030 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3799,6 +3799,103 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) return true; } +bool ChatHandler::HandleLookupMapCommand(const char* args) +{ + if(!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if(!Utf8toWStr(namepart, wnamepart)) + return false; + + wstrToLower(wnamepart); + + uint32 counter = 0; + + // search in Map.dbc + for(uint32 id = 0; id < sMapStore.GetNumRows(); id++) + { + MapEntry const* MapInfo = sMapStore.LookupEntry(id); + if(MapInfo) + { + uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); + + std::string name = MapInfo->name[loc]; + if(name.empty()) + continue; + + if(!Utf8FitTo(name, wnamepart)) + { + loc = LOCALE_enUS; + for(; loc < MAX_LOCALE; loc++) + { + if(m_session && loc == m_session->GetSessionDbcLocale()) + continue; + + name = MapInfo->name[loc]; + if(name.empty()) + continue; + + if(Utf8FitTo(name, wnamepart)) + break; + } + } + + if(loc < MAX_LOCALE) + { + // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format + std::ostringstream ss; + + if(m_session) + ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << "]"; + else // console + ss << id << " - [" << name << "]"; + + if(MapInfo->IsContinent()) + ss << GetTrinityString(LANG_CONTINENT); + + switch(MapInfo->map_type) + { + case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break; + case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break; + case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break; + } + + if(MapInfo->IsRaid()) + ss << GetTrinityString(LANG_RAID); + + if(MapInfo->SupportsHeroicMode()) + ss << GetTrinityString(LANG_HEROIC); + + uint32 ResetTimeRaid = MapInfo->resetTimeRaid; + uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic; + + if(MapInfo->IsMountAllowed()) + ss << GetTrinityString(LANG_MOUNTABLE); + + if(ResetTimeRaid && !ResetTimeHeroic) + PSendSysMessage(ss.str().c_str(), ResetTimeRaid); + else if(!ResetTimeRaid && ResetTimeHeroic) + PSendSysMessage(ss.str().c_str(), ResetTimeHeroic); + else if(ResetTimeRaid && ResetTimeHeroic) + PSendSysMessage(ss.str().c_str(), ResetTimeRaid, ResetTimeHeroic); + else + SendSysMessage(ss.str().c_str()); + + counter++; + } + } + } + + if(!counter) + SendSysMessage(LANG_COMMAND_NOMAPFOUND); + + return true; +} + /** \brief GM command level 3 - Create a guild. * * This command allows a GM (level 3) to create a guild. diff --git a/src/game/TicketHandler.cpp b/src/game/TicketHandler.cpp index cedafe964f0..d193f85ef3e 100644 --- a/src/game/TicketHandler.cpp +++ b/src/game/TicketHandler.cpp @@ -28,6 +28,14 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 4*4+1+2*4); + + if(GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID())) + { + WorldPacket data( SMSG_GMTICKET_CREATE, 4 ); + data << uint32(1); // 1 - You already have GM ticket + SendPacket( &data ); + return; + } uint32 map; float x, y, z; @@ -105,24 +113,22 @@ void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/) sWorld.SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->guid ); objmgr.RemoveGMTicket(ticket, GetPlayer()->GetGUID(), false); + SendGMTicketGetTicket(0x0A, 0); } } void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/) { - WorldPacket data(SMSG_GMTICKET_GETTICKET, 400); + WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 ); + data << (uint32)time(NULL); + data << (uint32)0; + SendPacket( &data ); GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); - - if(!ticket) - { - data << uint32(10); - SendPacket(&data); - return; - } - data << uint32(6); - data << ticket->message.c_str(); - SendPacket(&data); + if(ticket) + SendGMTicketGetTicket(0x06, ticket->message.c_str()); + else + SendGMTicketGetTicket(0x0A, 0); } @@ -132,3 +138,21 @@ void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/ data << uint32(1); SendPacket(&data); } + +void WorldSession::SendGMTicketGetTicket(uint32 status, char const* text) +{ + int len = text ? strlen(text) : 0; + WorldPacket data( SMSG_GMTICKET_GETTICKET, (4+len+1+4+2+4+4) ); + data << uint32(status); // standard 0x0A, 0x06 if text present + if(status == 6) + { + data << text; // ticket text + data << uint8(0x7); // ticket category + data << float(0); // tickets in queue? + data << float(0); // if > "tickets in queue" then "We are currently experiencing a high volume of petitions." + data << float(0); // 0 - "Your ticket will be serviced soon", 1 - "Wait time currently unavailable" + data << uint8(0); // if == 2 and next field == 1 then "Your ticket has been escalated" + data << uint8(0); // const + } + SendPacket( &data ); +} diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index bd3f9595fb3..f4842c0f0bc 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -171,7 +171,6 @@ class TRINITY_DLL_SPEC WorldSession void SendTabardVendorActivate( uint64 guid ); void SendSpiritResurrect(); void SendBindPoint(Creature* npc); - void SendGMTicketGetTicket(uint32 status, char const* text); void SendAttackStop(Unit const* enemy); @@ -329,6 +328,7 @@ class TRINITY_DLL_SPEC WorldSession void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket); void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); + void SendGMTicketGetTicket(uint32 status, char const* text); //void HandleGMSurveySubmit(WorldPacket& recvPacket); |