mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
feat(Core/WorldState): implement Battle for Sun's Reach Event (#21219)
Co-authored-by: killerwife <killerwife@gmail.com> Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Co-authored-by: MantisLord <sabinprosper@gmail.com>
This commit is contained in:
@@ -62,6 +62,7 @@ void AddSC_wp_commandscript();
|
||||
void AddSC_cache_commandscript();
|
||||
void AddSC_item_commandscript();
|
||||
void AddSC_player_settings_commandscript();
|
||||
void AddSC_worldstate_commandscript();
|
||||
|
||||
// The name of this function should match:
|
||||
// void Add${NameOfDirectory}Scripts()
|
||||
@@ -113,4 +114,5 @@ void AddCommandsScripts()
|
||||
AddSC_cache_commandscript();
|
||||
AddSC_item_commandscript();
|
||||
AddSC_player_settings_commandscript();
|
||||
AddSC_worldstate_commandscript();
|
||||
}
|
||||
|
||||
133
src/server/scripts/Commands/cs_worldstate.cpp
Normal file
133
src/server/scripts/Commands/cs_worldstate.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
Name: worldstate_commandscript
|
||||
%Complete: 100
|
||||
Comment: All worldstate related commands
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "Chat.h"
|
||||
#include "CommandScript.h"
|
||||
#include "Common.h"
|
||||
#include "WorldState.h"
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class worldstate_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
worldstate_commandscript() : CommandScript("worldstate_commandscript") { }
|
||||
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static ChatCommandTable sunsreachCommandTable =
|
||||
{
|
||||
{ "status", HandleSunsReachReclamationStatusCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "phase", HandleSunsReachReclamationPhaseCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "subphase", HandleSunsReachReclamationSubPhaseCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "counter", HandleSunsReachReclamationCounterCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "gate", HandleSunwellGateCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "gatecounter", HandleSunwellGateCounterCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
};
|
||||
|
||||
static ChatCommandTable worldStateCommandTable =
|
||||
{
|
||||
{ "sunsreach", sunsreachCommandTable }
|
||||
};
|
||||
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "worldstate", worldStateCommandTable }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleSunsReachReclamationStatusCommand(ChatHandler* handler )
|
||||
{
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSunsReachReclamationPhaseCommand(ChatHandler* handler, uint32 phase)
|
||||
{
|
||||
if (phase > SUNS_REACH_PHASE_4_HARBOR)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid phase, see \".worldstate sunsreach phase\" for usage");
|
||||
return false;
|
||||
}
|
||||
sWorldState->HandleSunsReachPhaseTransition(phase);
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSunsReachReclamationSubPhaseCommand(ChatHandler* handler, uint32 subphase)
|
||||
{
|
||||
if (subphase > SUBPHASE_ALL)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid subphase, see \".worldstate sunsreach subphase\" for usage");
|
||||
return false;
|
||||
}
|
||||
sWorldState->HandleSunsReachSubPhaseTransition(subphase);;
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSunsReachReclamationCounterCommand(ChatHandler* handler, Optional<uint32> index, Optional<uint32> value)
|
||||
{
|
||||
if (!index || !value || index.value() >= COUNTERS_MAX)
|
||||
{
|
||||
handler->PSendSysMessage("Syntax: .worldstate sunsreach counter <index> <value>.");
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
sWorldState->SetSunsReachCounter(SunsReachCounters(index.value()), value.value());
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSunwellGateCommand(ChatHandler* handler, uint32 newGate)
|
||||
{
|
||||
if (newGate > SUNWELL_ARCHONISUS_GATE3_OPEN)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid phase, see \".worldstate sunsreach gate\" for usage");
|
||||
return false;
|
||||
}
|
||||
sWorldState->HandleSunwellGateTransition(newGate);
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSunwellGateCounterCommand(ChatHandler* handler, Optional<uint32> index, Optional<uint32> value)
|
||||
{
|
||||
if (!index || !value || index.value() >= COUNTERS_MAX_GATES)
|
||||
{
|
||||
handler->PSendSysMessage("Syntax: .worldstate sunsreach gatecounter <index> <value>.");
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
sWorldState->SetSunwellGateCounter(SunwellGateCounters(index.value()), value.value());
|
||||
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_worldstate_commandscript()
|
||||
{
|
||||
new worldstate_commandscript();
|
||||
}
|
||||
49
src/server/scripts/World/suns_reach_reclamation.cpp
Normal file
49
src/server/scripts/World/suns_reach_reclamation.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 "CreatureScript.h"
|
||||
#include "WorldState.h"
|
||||
|
||||
class npc_suns_reach_reclamation : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_suns_reach_reclamation() : CreatureScript("npc_suns_reach_reclamation") { }
|
||||
|
||||
bool OnQuestReward(Player* /*player*/, Creature* /*creature*/, const Quest* quest, uint32 /*slot*/) override
|
||||
{
|
||||
sWorldState->AddSunsReachProgress(quest->GetQuestId());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class npc_sunwell_gate : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_sunwell_gate() : CreatureScript("npc_sunwell_gate") { }
|
||||
|
||||
bool OnQuestReward(Player* /*player*/, Creature* /*creature*/, const Quest* quest, uint32 /*slot*/) override
|
||||
{
|
||||
sWorldState->AddSunwellGateProgress(quest->GetQuestId());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_suns_reach_reclamation()
|
||||
{
|
||||
new npc_suns_reach_reclamation();
|
||||
new npc_sunwell_gate();
|
||||
}
|
||||
@@ -33,6 +33,7 @@ void AddSC_player_scripts();
|
||||
void AddSC_npc_stave_of_ancients();
|
||||
void AddSC_server_mail();
|
||||
void AddSC_transport_zeppelins();
|
||||
void AddSC_suns_reach_reclamation();
|
||||
|
||||
// The name of this function should match:
|
||||
// void Add${NameOfDirectory}Scripts()
|
||||
@@ -55,4 +56,5 @@ void AddWorldScripts()
|
||||
AddSC_npc_stave_of_ancients();
|
||||
AddSC_server_mail();
|
||||
AddSC_transport_zeppelins();
|
||||
AddSC_suns_reach_reclamation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user