Add expansion gating for zoning

This commit is contained in:
Akkadius 2020-04-04 05:36:18 -05:00
parent cc8aa354f1
commit c1e58673b2
7 changed files with 1117 additions and 5 deletions

View File

@ -117,7 +117,7 @@ SET(repositories
repositories/spawngroup_repository.h repositories/spawngroup_repository.h
repositories/tradeskill_recipe_repository.h repositories/tradeskill_recipe_repository.h
repositories/instance_list_repository.h repositories/instance_list_repository.h
) repositories/zone_repository.h)
SET(common_headers SET(common_headers
any.h any.h

View File

@ -62,8 +62,10 @@ namespace Expansion {
static const char *ExpansionName[ExpansionNumber::MaxId] = { static const char *ExpansionName[ExpansionNumber::MaxId] = {
"Classic", "Classic",
"The Ruins of Kunark", "The Ruins of Kunark",
"The Shards of Velious",
"The Shadows of Luclin", "The Shadows of Luclin",
"The Planes of Power", "The Planes of Power",
"The Legacy of Ykesha",
"Lost Dungeons of Norrath", "Lost Dungeons of Norrath",
"Gates of Discord", "Gates of Discord",
"Omens of War", "Omens of War",

File diff suppressed because it is too large Load Diff

View File

@ -58,6 +58,7 @@ namespace WorldserverCommandHandler {
function_map["database:schema"] = &WorldserverCommandHandler::DatabaseGetSchema; function_map["database:schema"] = &WorldserverCommandHandler::DatabaseGetSchema;
function_map["database:dump"] = &WorldserverCommandHandler::DatabaseDump; function_map["database:dump"] = &WorldserverCommandHandler::DatabaseDump;
function_map["test:test"] = &WorldserverCommandHandler::TestCommand; function_map["test:test"] = &WorldserverCommandHandler::TestCommand;
function_map["test:expansion"] = &WorldserverCommandHandler::ExpansionTestCommand;
function_map["test:repository"] = &WorldserverCommandHandler::TestRepository; function_map["test:repository"] = &WorldserverCommandHandler::TestRepository;
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv); EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
@ -291,6 +292,22 @@ namespace WorldserverCommandHandler {
return; return;
} }
}
/**
* @param argc
* @param argv
* @param cmd
* @param description
*/
void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description)
{
description = "Expansion test command";
if (cmd[{"-h", "--help"}]) {
return;
}
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) { if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
LogInfo("No rule set configured, using default rules"); LogInfo("No rule set configured, using default rules");
} }

View File

@ -32,6 +32,7 @@ namespace WorldserverCommandHandler {
void DatabaseGetSchema(int argc, char **argv, argh::parser &cmd, std::string &description); void DatabaseGetSchema(int argc, char **argv, argh::parser &cmd, std::string &description);
void DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description); void DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description);
void TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description); void TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description); void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description);
}; };

View File

@ -90,6 +90,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#else #else
#include <pthread.h> #include <pthread.h>
#include "../common/unix.h" #include "../common/unix.h"
#include "../common/content/world_content_service.h"
#endif #endif
volatile bool RunLoops = true; volatile bool RunLoops = true;
@ -107,6 +110,7 @@ TaskManager *taskmanager = 0;
NpcScaleManager *npc_scale_manager; NpcScaleManager *npc_scale_manager;
QuestParserCollection *parse = 0; QuestParserCollection *parse = 0;
EQEmuLogSys LogSys; EQEmuLogSys LogSys;
WorldContentService content_service;
const SPDat_Spell_Struct* spells; const SPDat_Spell_Struct* spells;
int32 SPDAT_RECORDS = -1; int32 SPDAT_RECORDS = -1;
const ZoneConfig *Config; const ZoneConfig *Config;
@ -392,6 +396,14 @@ int main(int argc, char** argv) {
LogInfo("Initialized dynamic dictionary entries"); LogInfo("Initialized dynamic dictionary entries");
} }
content_service.SetCurrentExpansion(RuleI(Expansion, CurrentExpansion));
LogInfo(
"Current expansion is [{}] ({})",
content_service.GetCurrentExpansion(),
Expansion::ExpansionName[content_service.GetCurrentExpansion()]
);
#ifdef BOTS #ifdef BOTS
LogInfo("Loading bot commands"); LogInfo("Loading bot commands");
int botretval = bot_command_init(); int botretval = bot_command_init();

View File

@ -35,6 +35,9 @@ extern QueryServ* QServ;
extern WorldServer worldserver; extern WorldServer worldserver;
extern Zone* zone; extern Zone* zone;
#include "../common/repositories/zone_repository.h"
#include "../common/content/world_content_service.h"
void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
#ifdef BOTS #ifdef BOTS
@ -284,6 +287,29 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
//TODO: ADVENTURE ENTRANCE CHECK //TODO: ADVENTURE ENTRANCE CHECK
/**
* Expansion check
*/
auto zones = ZoneRepository::GetWhere(
fmt::format(
"expansion <= {} AND short_name = '{}'",
(content_service.GetCurrentExpansion() + 1),
target_zone_name
)
);
LogInfo(
"Checking zone request [{}] for expansion [{}] ({}) success [{}]",
target_zone_name,
(content_service.GetCurrentExpansion() + 1),
Expansion::ExpansionName[content_service.GetCurrentExpansion()],
!zones.empty() ? "true" : "false"
);
if (zones.empty()) {
myerror = ZONE_ERROR_NOEXPANSION;
}
if(myerror == 1) { if(myerror == 1) {
//we have successfully zoned //we have successfully zoned
DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions);