From 192948a87f2e76bb820ab116d7d69179a23bc58a Mon Sep 17 00:00:00 2001 From: Neal Spellman Date: Mon, 19 Dec 2022 17:51:49 -0500 Subject: [PATCH] Initial NPC script and gating - TEMP: Adds guilds gating. - FV Guild Master script added which will toggle the guild UI. --- dCommon/dEnums/dCommonVars.h | 7 +++++++ dNet/AuthPackets.cpp | 6 +++--- dScripts/CppScripts.cpp | 3 +++ dScripts/ai/FV/CMakeLists.txt | 1 + dScripts/ai/FV/FvGuildCreate.cpp | 14 ++++++++++++++ dScripts/ai/FV/FvGuildCreate.h | 7 +++++++ 6 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 dScripts/ai/FV/FvGuildCreate.cpp create mode 100644 dScripts/ai/FV/FvGuildCreate.h diff --git a/dCommon/dEnums/dCommonVars.h b/dCommon/dEnums/dCommonVars.h index d13e8b94..14865a89 100644 --- a/dCommon/dEnums/dCommonVars.h +++ b/dCommon/dEnums/dCommonVars.h @@ -472,6 +472,13 @@ enum eGameActivities : uint32_t { ACTIVITY_PET_TAMING }; +enum eGuildCreationResponses { + CREATED = 0, + REJECTED_BAD_NAME, + REJECTED_EXISTS, + UNKNOWN_ERROR +}; + enum ePlayerFlags { BTARR_TESTING = 0, PLAYER_HAS_ENTERED_PET_RANCH = 1, diff --git a/dNet/AuthPackets.cpp b/dNet/AuthPackets.cpp index 636f3fcf..c428da94 100644 --- a/dNet/AuthPackets.cpp +++ b/dNet/AuthPackets.cpp @@ -194,9 +194,9 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd PacketUtils::WritePacketString("Talk_Like_A_Pirate", 33, &packet); // 7 unknown strings - perhaps other IP addresses? - PacketUtils::WritePacketString("", 33, &packet); - PacketUtils::WritePacketString("", 33, &packet); - PacketUtils::WritePacketString("", 33, &packet); + PacketUtils::WritePacketString("guilds", 33, &packet); + PacketUtils::WritePacketString("ninjago2", 33, &packet); + PacketUtils::WritePacketString("test", 33, &packet); PacketUtils::WritePacketString("", 33, &packet); PacketUtils::WritePacketString("", 33, &packet); PacketUtils::WritePacketString("", 33, &packet); diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index dce77e4b..d5a83db6 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -139,6 +139,7 @@ #include "TreasureChestDragonServer.h" #include "InstanceExitTransferPlayerToLastNonInstance.h" #include "FvFreeGfNinjas.h" +#include "FvGuildCreate.h" #include "FvPandaServer.h" #include "FvPandaSpawnerServer.h" #include "ZoneFvProperty.h" @@ -569,6 +570,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new InstanceExitTransferPlayerToLastNonInstance(); else if (scriptName == "scripts\\ai\\FV\\L_NPC_FREE_GF_NINJAS.lua") script = new FvFreeGfNinjas(); + else if (scriptName == "scripts\\ai\\FV\\L_GUILD_CREATE.lua") + script = new FvGuildCreate(); else if (scriptName == "scripts\\ai\\FV\\L_FV_PANDA_SPAWNER_SERVER.lua") script = new FvPandaSpawnerServer(); else if (scriptName == "scripts\\ai\\FV\\L_FV_PANDA_SERVER.lua") diff --git a/dScripts/ai/FV/CMakeLists.txt b/dScripts/ai/FV/CMakeLists.txt index 2a8a3367..a04dc06c 100644 --- a/dScripts/ai/FV/CMakeLists.txt +++ b/dScripts/ai/FV/CMakeLists.txt @@ -3,6 +3,7 @@ set(DSCRIPTS_SOURCES_AI_FV "FvFlyingCreviceDragon.cpp" "FvDragonSmashingGolemQb.cpp" "FvFreeGfNinjas.cpp" + "FvGuildCreate.cpp" "FvPandaSpawnerServer.cpp" "FvPandaServer.cpp" "FvBrickPuzzleServer.cpp" diff --git a/dScripts/ai/FV/FvGuildCreate.cpp b/dScripts/ai/FV/FvGuildCreate.cpp new file mode 100644 index 00000000..2e9e558f --- /dev/null +++ b/dScripts/ai/FV/FvGuildCreate.cpp @@ -0,0 +1,14 @@ +#include "FvGuildCreate.h" +#include "GameMessages.h" + +// Server script for Guild Master NPC in FV area. +// This NPC will react to a user interaction and display +// the guild creation screen. + +void FvGuildCreate::OnUse(Entity* self, Entity* user) { + AMFStringValue* value = new AMFStringValue(); + value->SetStringValue("ToggleGuildCreate"); + AMFArrayValue args; + GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), value->GetStringValue(), &args); + delete value; +} diff --git a/dScripts/ai/FV/FvGuildCreate.h b/dScripts/ai/FV/FvGuildCreate.h new file mode 100644 index 00000000..0f3d2ad3 --- /dev/null +++ b/dScripts/ai/FV/FvGuildCreate.h @@ -0,0 +1,7 @@ +#pragma once +#include "CppScripts.h" + +class FvGuildCreate : public CppScripts::Script { +public: + void OnUse(Entity* self, Entity* user) override; +};