Merge remote-tracking branch 'upstream/main' into more-cdclient-cleanup

This commit is contained in:
David Markowitz
2023-05-13 16:16:58 -07:00
319 changed files with 4872 additions and 4158 deletions

View File

@@ -1,24 +1,24 @@
#include "BankInteractServer.h"
#include "GameMessages.h"
#include "Entity.h"
#include "AMFFormat.h"
#include "Amf3.h"
void BankInteractServer::OnUse(Entity* self, Entity* user) {
AMFArrayValue args;
AMFStringValue* bank = new AMFStringValue();
bank->SetStringValue("bank");
args.InsertValue("state", bank);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
args.Insert("state", "bank");
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
}
void BankInteractServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
if (args == "ToggleBank") {
AMFArrayValue args;
args.InsertValue("visible", new AMFFalseValue());
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &args);
args.Insert("visible", false);
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", args);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
}

View File

@@ -1,19 +1,20 @@
#include "MailBoxServer.h"
#include "AMFFormat.h"
#include "Amf3.h"
#include "GameMessages.h"
#include "Entity.h"
void MailBoxServer::OnUse(Entity* self, Entity* user) {
AMFStringValue* value = new AMFStringValue();
value->SetStringValue("Mail");
AMFArrayValue args;
args.InsertValue("state", value);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
args.Insert("state", "Mail");
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
}
void MailBoxServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (args == "toggleMail") {
AMFArrayValue args;
args.InsertValue("visible", new AMFFalseValue());
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleMail", &args);
args.Insert("visible", false);
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleMail", args);
}
}

View File

@@ -7,7 +7,7 @@ void NjRailActivatorsServer::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
// Only allow use if this is not a quick build or the quick build is built
if (rebuildComponent == nullptr || rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent == nullptr || rebuildComponent->GetState() == eRebuildState::COMPLETED) {
auto* character = user->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(flag, true);

View File

@@ -19,7 +19,7 @@ void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::s
}
void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
auto* relatedRail = GetRelatedRail(self);
if (relatedRail == nullptr)
return;
@@ -30,7 +30,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
return;
self->SetNetworkVar(NetworkNotActiveVariable, false);
} else if (state == REBUILD_RESETTING) {
} else if (state == eRebuildState::RESETTING) {
auto* relatedRail = GetRelatedRail(self);
if (relatedRail == nullptr)
return;

View File

@@ -5,5 +5,5 @@ void NjhubLavaPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* targe
if (!target->IsPlayer())
return;
target->Smash(self->GetObjectID(), VIOLENT, u"drown");
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"drown");
}

View File

@@ -97,7 +97,7 @@ void PetDigServer::OnDie(Entity* self, Entity* killer) {
// Handles smashing leftovers (edge case for the AG X)
auto* xObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"X"));
if (xObject != nullptr) {
xObject->Smash(xObject->GetObjectID(), VIOLENT);
xObject->Smash(xObject->GetObjectID(), eKillType::VIOLENT);
}
}
@@ -112,7 +112,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
auto* player = playerEntity->GetCharacter();
const auto groupID = self->GetVar<std::u16string>(u"groupID");
auto playerFlag = 0;
int32_t playerFlag = 0;
// The flag that the player dug up
if (groupID == u"Flag1") {
@@ -136,7 +136,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
auto* xObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"X"));
if (xObject != nullptr) {
xObject->Smash(xObject->GetObjectID(), VIOLENT);
xObject->Smash(xObject->GetObjectID(), eKillType::VIOLENT);
}
}

View File

@@ -15,7 +15,7 @@ void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
void PropertyPlatform::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr && rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::COMPLETED) {
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
// if (movingPlatform != nullptr) {
// movingPlatform->GotoWaypoint(1);

View File

@@ -2,7 +2,8 @@
#include "Character.h"
#include "GameMessages.h"
#include "dServer.h"
#include "AMFFormat.h"
#include "Amf3.h"
#include "Entity.h"
void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"hasCustomText")) {
@@ -11,24 +12,18 @@ void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
{
AMFArrayValue args;
auto* state = new AMFStringValue();
state->SetStringValue("Story");
args.Insert("state", "Story");
args.InsertValue("state", state);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
}
user->AddCallbackTimer(0.1f, [user, customText]() {
AMFArrayValue args;
auto* text = new AMFStringValue();
text->SetStringValue(customText);
args.Insert("visible", true);
args.Insert("text", customText);
args.InsertValue("visible", new AMFTrueValue());
args.InsertValue("text", text);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "ToggleStoryBox", &args);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "ToggleStoryBox", args);
});
return;

View File

@@ -3,6 +3,8 @@
#include "GameMessages.h"
#include "Character.h"
#include "eReplicaComponentType.h"
#include "eTerminateType.h"
#include "ePlayerFlag.h"
//2021-05-03 - max - added script, omitted some parts related to inheritance in lua which we don't need
@@ -22,15 +24,15 @@ void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
if (!character) return;
// At this point the player has to be in a faction.
LOT tokenLOT = 0;
if (character->GetPlayerFlag(ePlayerFlags::VENTURE_FACTION)) //venture
if (character->GetPlayerFlag(ePlayerFlag::VENTURE_FACTION)) //venture
tokenLOT = 8321;
else if (character->GetPlayerFlag(ePlayerFlags::ASSEMBLY_FACTION)) //assembly
else if (character->GetPlayerFlag(ePlayerFlag::ASSEMBLY_FACTION)) //assembly
tokenLOT = 8318;
else if (character->GetPlayerFlag(ePlayerFlags::PARADOX_FACTION)) //paradox
else if (character->GetPlayerFlag(ePlayerFlag::PARADOX_FACTION)) //paradox
tokenLOT = 8320;
else if (character->GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) //sentinel
else if (character->GetPlayerFlag(ePlayerFlag::SENTINEL_FACTION)) //sentinel
tokenLOT = 8319;
inv->AddItem(tokenLOT, tokensToGive, eLootSourceType::LOOT_SOURCE_NONE);
inv->AddItem(tokenLOT, tokensToGive, eLootSourceType::NONE);
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());

View File

@@ -3,6 +3,7 @@
#include "GameMessages.h"
#include "Loot.h"
#include "EntityManager.h"
#include "eTerminateType.h"
void WishingWellServer::OnStartup(Entity* self) {
}