mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
feat(Core/WorldState): improved WorldState scripting (#20141)
* implement world state script
based on
0b87ca9d9e
Co-authored-by: killerwife <killerwife@gmail.com>
* refactor to use onleave and onenter instead of spell_area
allows players to right click remove adal's buff
* add MapMgr.h
* refactor: use condition enum instead of uint32, prefix WORLD_STATE where needed
* remove lock from WorldState::Update
sWorldState->Update() is only called from World::Update
* remove unsafe SmartAI action of setWorldState
---------
Co-authored-by: killerwife <killerwife@gmail.com>
This commit is contained in:
68
src/server/scripts/World/transport_zeppelin.h
Normal file
68
src/server/scripts/World/transport_zeppelin.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 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 Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
enum ZeppelinEvent
|
||||
{
|
||||
EVENT_UC_FROM_GROMGOL_ARRIVAL = 15312,
|
||||
EVENT_GROMGOL_FROM_UC_ARRIVAL = 15314,
|
||||
EVENT_OG_FROM_UC_ARRIVAL = 15318,
|
||||
EVENT_UC_FROM_OG_ARRIVAL = 15320,
|
||||
EVENT_OG_FROM_GROMGOL_ARRIVAL = 15322,
|
||||
EVENT_GROMGOL_FROM_OG_ARRIVAL = 15324,
|
||||
EVENT_WK_ARRIVAL = 15431,
|
||||
EVENT_VL_FROM_UC_ARRIVAL = 19126,
|
||||
EVENT_UC_FROM_VL_ARRIVAL = 19127,
|
||||
EVENT_OG_FROM_BT_ARRIVAL = 19137,
|
||||
EVENT_BT_FROM_OG_ARRIVAL = 19139,
|
||||
EVENT_OG_FROM_TB_ARRIVAL = 21868,
|
||||
EVENT_TB_FROM_OG_ARRIVAL = 21870,
|
||||
EVENT_OG_TO_GROMGOL_DEPARTURE = 15323,
|
||||
EVENT_GROMGOL_TO_OG_DEPARTURE = 15325,
|
||||
EVENT_OG_TO_UC_DEPARTURE = 15319,
|
||||
EVENT_UC_TO_OG_DEPARTURE = 15321,
|
||||
EVENT_UC_TO_GROMGOL_DEPARTURE = 15313,
|
||||
EVENT_GROMGOL_TO_UC_DEPARTURE = 15315,
|
||||
};
|
||||
|
||||
enum ZeppelinMaster
|
||||
{
|
||||
NPC_NEZRAZ = 3149,
|
||||
NPC_HINDENBURG = 3150,
|
||||
NPC_FREZZA = 9564,
|
||||
NPC_ZAPETTA = 9566,
|
||||
NPC_SNURK_BUCKSQUICK = 12136,
|
||||
NPC_SQUIBBY_OVERSPECK = 12137,
|
||||
NPC_HARROWMEISER = 23823,
|
||||
NPC_GREEB_RAMROCKET = 26537,
|
||||
NPC_NARGO_SCREWBORE = 26538,
|
||||
NPC_MEEFI_FARTHROTTLE = 26539,
|
||||
NPC_DRENK_SPANNERSPARK = 26540,
|
||||
NPC_ZELLI_HOTNOZZLE = 34765,
|
||||
NPC_KRENDLE_BIGPOCKETS = 34766,
|
||||
};
|
||||
|
||||
const float SEARCH_RANGE_ZEPPELIN_MASTER = 32.0f;
|
||||
|
||||
enum ZeppelinPassenger
|
||||
{
|
||||
// The Thundercaller
|
||||
NPC_SKY_CAPTAIN_CLOUDKICKER = 25077,
|
||||
NPC_CHIEF_OFFICER_COPPERNUT = 25070,
|
||||
// The Purple Princess
|
||||
NPC_SKY_CAPTAIN_CABLELAMP = 25105,
|
||||
NPC_WATCHER_UMJIN = 25107,
|
||||
};
|
||||
109
src/server/scripts/World/transport_zeppelins.cpp
Normal file
109
src/server/scripts/World/transport_zeppelins.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 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 Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameObjectScript.h"
|
||||
#include "WorldState.h"
|
||||
#include "transport_zeppelin.h"
|
||||
|
||||
// 175080 The Iron Eagle - Grom'gol to Orgrimmar
|
||||
struct go_transport_the_iron_eagle : GameObjectAI
|
||||
{
|
||||
go_transport_the_iron_eagle(GameObject *object) : GameObjectAI(object) { };
|
||||
|
||||
void EventInform(uint32 eventId) override
|
||||
{
|
||||
sWorldState->HandleConditionStateChange(WORLD_STATE_CONDITION_THE_IRON_EAGLE, static_cast<WorldStateConditionState>(eventId));
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_GROMGOL_FROM_OG_ARRIVAL:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_NEZRAZ, SEARCH_RANGE_ZEPPELIN_MASTER))
|
||||
creature->AI()->Talk(0);
|
||||
break;
|
||||
case EVENT_OG_FROM_GROMGOL_ARRIVAL:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_SNURK_BUCKSQUICK, 150.0f))
|
||||
creature->AI()->Talk(0);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 164871 The Thundercaller - Undercity to Orgrimmar
|
||||
struct go_transport_the_thundercaller : GameObjectAI
|
||||
{
|
||||
go_transport_the_thundercaller(GameObject *object) : GameObjectAI(object) { };
|
||||
|
||||
void EventInform(uint32 eventId) override
|
||||
{
|
||||
sWorldState->HandleConditionStateChange(WORLD_STATE_CONDITION_THE_THUNDERCALLER, static_cast<WorldStateConditionState>(eventId));
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_OG_FROM_UC_ARRIVAL:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_FREZZA, SEARCH_RANGE_ZEPPELIN_MASTER))
|
||||
creature->AI()->Talk(0);
|
||||
break;
|
||||
case EVENT_UC_FROM_OG_ARRIVAL:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_ZAPETTA, SEARCH_RANGE_ZEPPELIN_MASTER))
|
||||
creature->AI()->Talk(0);
|
||||
break;
|
||||
case EVENT_OG_TO_UC_DEPARTURE:
|
||||
break;
|
||||
case EVENT_UC_TO_OG_DEPARTURE:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_ZAPETTA, SEARCH_RANGE_ZEPPELIN_MASTER))
|
||||
creature->AI()->Talk(1);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 176495 The Purple Princess - Grom'Gol to Undercity
|
||||
struct go_transport_the_purple_princess : GameObjectAI
|
||||
{
|
||||
go_transport_the_purple_princess(GameObject *object) : GameObjectAI(object) { };
|
||||
|
||||
void EventInform(uint32 eventId) override
|
||||
{
|
||||
sWorldState->HandleConditionStateChange(WORLD_STATE_CONDITION_THE_PURPLE_PRINCESS, static_cast<WorldStateConditionState>(eventId));
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_GROMGOL_FROM_UC_ARRIVAL:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_SQUIBBY_OVERSPECK, SEARCH_RANGE_ZEPPELIN_MASTER))
|
||||
creature->AI()->Talk(0);
|
||||
break;
|
||||
case EVENT_UC_FROM_GROMGOL_ARRIVAL:
|
||||
if (Creature *creature = me->FindNearestCreature(NPC_HINDENBURG, SEARCH_RANGE_ZEPPELIN_MASTER))
|
||||
creature->AI()->Talk(0);
|
||||
break;
|
||||
case EVENT_UC_TO_GROMGOL_DEPARTURE:
|
||||
case EVENT_GROMGOL_TO_UC_DEPARTURE:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_transport_zeppelins()
|
||||
{
|
||||
RegisterGameObjectAI(go_transport_the_iron_eagle);
|
||||
RegisterGameObjectAI(go_transport_the_thundercaller);
|
||||
RegisterGameObjectAI(go_transport_the_purple_princess);
|
||||
}
|
||||
@@ -32,6 +32,7 @@ void AddSC_action_ip_logger(); // location: scripts\World\action_ip_logger.cpp
|
||||
void AddSC_player_scripts();
|
||||
void AddSC_npc_stave_of_ancients();
|
||||
void AddSC_server_mail();
|
||||
void AddSC_transport_zeppelins();
|
||||
|
||||
// The name of this function should match:
|
||||
// void Add${NameOfDirectory}Scripts()
|
||||
@@ -53,4 +54,5 @@ void AddWorldScripts()
|
||||
AddSC_player_scripts();
|
||||
AddSC_npc_stave_of_ancients();
|
||||
AddSC_server_mail();
|
||||
AddSC_transport_zeppelins();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user