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

@@ -49,8 +49,6 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
m_CurrentBossStage = 1;
// Obtain faction and collision group to save for subsequent resets
//self : SetVar("SBFactionList", self:GetFaction().factionList)
//self : SetVar("SBCollisionGroup", self:GetCollisionGroup().colGroup)
}
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
@@ -62,8 +60,6 @@ void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
missionComponent->CompleteMission(instanceMissionID);
}
Game::logger->Log("BossSpiderQueenEnemyServer", "Starting timer...");
// There is suppose to be a 0.1 second delay here but that may be admitted?
auto* controller = EntityManager::Instance()->GetZoneControlEntity();
@@ -166,9 +162,6 @@ void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount)
// The Spider Queen Boss is withdrawing and requesting the spawn
// of a hatchling wave
/*auto SpiderEggNetworkID = self->GetI64(u"SpiderEggNetworkID");
if (SpiderEggNetworkID == 0) return;*/
// Clamp invalid Spiderling number requests to the maximum amount of eggs available
if ((spiderCount > maxSpiderEggCnt) || (spiderCount < 0))
spiderCount = maxSpiderEggCnt;
@@ -177,44 +170,13 @@ void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount)
hatchCounter = spiderCount;
hatchList = {};
Game::logger->Log("SpiderQueen", "Trying to spawn %i spiders", hatchCounter);
// Run the wave manager
SpiderWaveManager(self);
}
void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
auto SpiderEggNetworkID = self->GetI64(u"SpiderEggNetworkID");
// Reset the spider egg spawner network to ensure a maximum number of eggs
//SpiderEggNetworkID:SpawnerReset()
// Obtain a list of all the eggs on the egg spawner network
//auto spiderEggList = SpiderEggNetworkID:SpawnerGetAllObjectIDsSpawned().objects;
//if (table.maxn(spiderEggList) <= 0) {
// self->AddTimer("PollSpiderWaveManager", 1.0f);
// return;
//}
//
//// A check for (wave mangement across multiple spawn iterations
//if(hatchCounter < spiderWaveCnt) {
// // We have already prepped some objects for (hatching,
// // remove them from our list for (random egg pulls
// for (i, sVal in ipairs(spiderEggList) {
// if(hatchList[sVal:GetID()]) {
// // We have found a prepped egg, remove it from the spiderEggList
// spiderEggList[i] = nil
// }
// }
//}
std::vector<LWOOBJID> spiderEggs{};
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("EGG");
@@ -224,44 +186,43 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
// Select a number of random spider eggs from the list equal to the
// current number needed to complete the current wave
for (int i = 0; i < hatchCounter; i++) {
// Select a random spider egg
auto randomEggLoc = GeneralUtils::GenerateRandomNumber<int>(0, spiderEggs.size() - 1);
auto randomEgg = spiderEggs[randomEggLoc];
if (!spiderEggs.empty()) {
for (int i = 0; i < hatchCounter; i++) {
// Select a random spider egg
auto randomEggLoc = GeneralUtils::GenerateRandomNumber<int>(0, spiderEggs.size() - 1);
auto randomEgg = spiderEggs[randomEggLoc];
//Just a quick check to try and prevent dupes:
for (auto en : hatchList) {
if (en == randomEgg) {
randomEggLoc++;
randomEgg = spiderEggs[randomEggLoc];
}
}
if (randomEgg) {
auto* eggEntity = EntityManager::Instance()->GetEntity(randomEgg);
if (eggEntity == nullptr) {
continue;
//Just a quick check to try and prevent dupes:
for (auto en : hatchList) {
if (en == randomEgg) {
randomEggLoc++;
randomEgg = spiderEggs[randomEggLoc];
}
}
// Prep the selected spider egg
//randomEgg:FireEvent{s}erID=self, args="prepEgg"}
eggEntity->OnFireEventServerSide(self, "prepEgg");
Game::logger->Log("SpiderQueen", "Prepping egg %llu", eggEntity->GetObjectID());
if (randomEgg) {
auto* eggEntity = EntityManager::Instance()->GetEntity(randomEgg);
// Add the prepped egg to our hatchList
hatchList.push_back(eggEntity->GetObjectID());
if (eggEntity == nullptr) {
continue;
}
// Decrement the hatchCounter
hatchCounter = hatchCounter - 1;
}
// Prep the selected spider egg
eggEntity->OnFireEventServerSide(self, "prepEgg");
// Remove it from our spider egg list
//table.remove(spiderEggList, randomEggLoc);
spiderEggs[randomEggLoc] = LWOOBJID_EMPTY;
// Add the prepped egg to our hatchList
hatchList.push_back(eggEntity->GetObjectID());
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
break;
// Decrement the hatchCounter
hatchCounter = hatchCounter - 1;
}
// Remove it from our spider egg list
spiderEggs[randomEggLoc] = LWOOBJID_EMPTY;
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
break;
}
}
}
@@ -280,14 +241,12 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
}
eggEntity->OnFireEventServerSide(self, "hatchEgg");
Game::logger->Log("SpiderQueen", "hatching egg %llu", eggEntity->GetObjectID());
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
combat->SetStunImmune(false);
combat->Stun(time += 6.0f);
combat->SetStunImmune(true);
//self->AddTimer("disableWaitForIdle", defaultAnimPause);
self->AddTimer("checkForSpiders", 6.0f);
}
@@ -398,10 +357,6 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) {
}
void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
/*
const auto targets = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CHARACTER);
*/
const auto targets = self->GetTargetsInPhantom();
if (self->GetBoolean(u"stoppedFlag")) {
@@ -434,8 +389,6 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
PlayAnimAndReturnTime(self, spiderSingleShot);
Game::logger->Log("BossSpiderQueenEnemyServer", "Ran RFS");
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(10, 15));
}
@@ -557,26 +510,6 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake-bridge", self->GetObjectID(), 100.0f);
} else if (timerName == "AdvanceComplete") {
//Reset faction and collision
/*local SBFactionList = self:GetVar("SBFactionList")
local SBCollisionGroup = self:GetVar("SBCollisionGroup")
for i, fVal in ipairs(SBFactionList) {
if(i == 1) {
//Our first faction - flush and add
self:SetFaction{faction = fVal}
else
//Add
self:ModifyFaction{factionID = fVal, bAddFaction = true}
}
}*/
/*
auto SBCollisionGroup = self->GetI32(u"SBCollisionGroup");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", SBCollisionGroup, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
*/
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 11, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
//Wind up, telegraphing next round
@@ -626,7 +559,6 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
//Did we queue a spcial attack?
if (self->GetBoolean(u"bSpecialQueued")) {
self->SetBoolean(u"bSpecialQueued", false);
//SpiderSkillManager(self, true);
}
}
}
@@ -674,17 +606,6 @@ void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
controllable->SetStatic(true);
EntityManager::Instance()->SerializeEntity(self);
//if (waitForIdle) return;
////Play the Spider Boss' mountain idle anim
//PlayAnimAndReturnTime(self, spiderWithdrawIdle);
////If there are still baby spiders, don't do anyhting either
//auto spooders = EntityManager::Instance()->GetEntitiesInGroup("BabySpider");
//if (spooders.size() > 0) return;
//else
// WithdrawSpider(self, false);
}
//----------------------------------------------

View File

@@ -7,6 +7,7 @@
#include "SkillComponent.h"
#include "eAninmationFlags.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"
void BaseEnemyApe::OnStartup(Entity* self) {
self->SetVar<uint32_t>(u"timesStunned", 2);
@@ -16,7 +17,7 @@ void BaseEnemyApe::OnStartup(Entity* self) {
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
auto* anchor = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
if (anchor != nullptr && !anchor->GetIsDead()) {
anchor->Smash(self->GetObjectID(), SILENT);
anchor->Smash(self->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -30,7 +30,7 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
return;
if (args == "ChestReady" && (propertyOwner == std::to_string(LWOOBJID_EMPTY) || player->GetVar<bool>(u"bootyDug"))) {
self->Smash(self->GetObjectID(), SILENT);
self->Smash(self->GetObjectID(), eKillType::SILENT);
} else if (args == "ChestOpened") {
// Make sure players only dig up one booty per instance
player->SetVar<bool>(u"bootyDug", true);
@@ -49,6 +49,6 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
}
}
} else if (args == "ChestDead") {
self->Smash(player->GetObjectID(), SILENT);
self->Smash(player->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -4,6 +4,7 @@
#include "Character.h"
#include "EntityManager.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
//Tell the client to spawn the baby spiderling:
@@ -17,7 +18,7 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
if (!character) return;
character->SetPlayerFlag(74, true);
character->SetPlayerFlag(ePlayerFlag::CAGED_SPIDER, true);
//Remove the maelstrom cube:
auto inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));

View File

@@ -18,7 +18,7 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
missionState == eMissionState::AVAILABLE ||
missionState == eMissionState::COMPLETE_AVAILABLE) {
if (inventoryComponent->GetLotCount(14378) == 0) {
inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(14378, 1, eLootSourceType::NONE);
}
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(14378, 1);

View File

@@ -10,7 +10,7 @@ void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
// Add or remove the lucky shovel based on whether the mission was completed or started
if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
&& luckyShovel == nullptr) {
inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventory->AddItem(14591, 1, eLootSourceType::NONE);
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(14591, 1);
}

View File

@@ -19,7 +19,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
if (missionID == 1883 && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
&& maelstromVacuum == nullptr) {
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::NONE);
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(maelstromVacuumLot, 1);
}

View File

@@ -4,6 +4,7 @@
#include "eMissionState.h"
#include "Character.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
/*
--------------------------------------------------------------
@@ -36,6 +37,6 @@ void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int mis
//reset the equipment flag
auto character = target->GetCharacter();
if (character) character->SetPlayerFlag(equipFlag, false);
if (character) character->SetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR, false);
}
}

View File

@@ -7,6 +7,5 @@ class RemoveRentalGear : public CppScripts::Script {
private:
int defaultMission = 768; //mission to remove gearSets on completion
std::vector<int> gearSets = { 14359,14321,14353,14315 }; //inventory items to remove
int equipFlag = 126; //Set upon wearing trial faction armor for the first time in a session
};

View File

@@ -9,8 +9,8 @@ void ZoneAgSpiderQueen::SetGameVariables(Entity* self) {
ZoneAgProperty::SetGameVariables(self);
// Disable property flags
self->SetVar<uint32_t>(defeatedProperyFlag, 0);
self->SetVar<uint32_t>(placedModelFlag, 0);
self->SetVar<int32_t>(defeatedProperyFlag, 0);
self->SetVar<int32_t>(placedModelFlag, 0);
self->SetVar<uint32_t>(guardFirstMissionFlag, 0);
self->SetVar<uint32_t>(guardMissionFlag, 0);
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);

View File

@@ -18,7 +18,7 @@ void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string&
auto* character = caster->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(self->GetVar<int32_t>(m_FlagVariable), true);
character->SetPlayerFlag(self->GetVar<uint32_t>(m_FlagVariable), true);
}
EntityInfo info{};

View File

@@ -24,5 +24,5 @@ void AmBridge::OnTimerDone(Entity* self, std::string timerName) {
return;
}
self->Smash(self->GetObjectID(), VIOLENT);
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
}

View File

@@ -1,6 +1,6 @@
#include "AmConsoleTeleportServer.h"
#include "ChooseYourDestinationNsToNt.h"
#include "AMFFormat.h"
#include "Amf3.h"
void AmConsoleTeleportServer::OnStartup(Entity* self) {
self->SetVar(u"teleportAnim", m_TeleportAnim);

View File

@@ -2,6 +2,7 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "SimplePhysicsComponent.h"
#include "eTerminateType.h"
void AmDrawBridge::OnStartup(Entity* self) {
self->SetNetworkVar(u"InUse", false);
@@ -25,7 +26,7 @@ void AmDrawBridge::OnUse(Entity* self, Entity* user) {
auto* player = user;
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {

View File

@@ -12,7 +12,7 @@ void AmDropshipComputer::OnStartup(Entity* self) {
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
return;
}
@@ -27,7 +27,7 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
return;
}
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::NONE);
}
void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
@@ -76,7 +76,7 @@ void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
return;
}
if (timerName == "reset" && rebuildComponent->GetState() == REBUILD_OPEN) {
self->Smash(self->GetObjectID(), SILENT);
if (timerName == "reset" && rebuildComponent->GetState() == eRebuildState::OPEN) {
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -176,7 +176,7 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
return;
}

View File

@@ -6,6 +6,7 @@
#include "MissionComponent.h"
#include "EntityInfo.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"
void AmSkullkinDrill::OnStartup(Entity* self) {
self->SetNetworkVar(u"bIsInUse", false);
@@ -247,7 +248,7 @@ void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
}
}
self->Smash(attacker->GetObjectID(), SILENT);
self->Smash(attacker->GetObjectID(), eKillType::SILENT);
self->CancelAllTimers();
@@ -265,7 +266,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
auto* child = EntityManager::Instance()->GetEntity(childID);
if (child != nullptr) {
child->Smash(self->GetObjectID(), SILENT);
child->Smash(self->GetObjectID(), eKillType::SILENT);
}
self->SetNetworkVar(u"bIsInUse", false);

View File

@@ -2,6 +2,7 @@
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "Item.h"
#include "eTerminateType.h"
void AmTeapotServer::OnUse(Entity* self, Entity* user) {
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
@@ -18,5 +19,5 @@ void AmTeapotServer::OnUse(Entity* self, Entity* user) {
blueFlowerItem->SetCount(blueFlowerItem->GetCount() - 10);
inventoryComponent->AddItem(WU_S_IMAGINATION_TEA, 1);
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -6,6 +6,7 @@
#include "MissionComponent.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
#include "eTerminateType.h"
int32_t ImgBrickConsoleQB::ResetBricks = 30;
int32_t ImgBrickConsoleQB::ResetConsole = 60;
@@ -20,7 +21,7 @@ void ImgBrickConsoleQB::OnStartup(Entity* self) {
void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
if (!self->GetNetworkVar<bool>(u"used")) {
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
@@ -29,7 +30,7 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
for (auto* console : consoles) {
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
if (consoleRebuildComponent->GetState() != REBUILD_COMPLETED) {
if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) {
continue;
}
@@ -87,7 +88,7 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
self->SetNetworkVar(u"used", true);
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
}
@@ -113,7 +114,7 @@ void ImgBrickConsoleQB::SmashCanister(Entity* self) {
const auto canisters = EntityManager::Instance()->GetEntitiesInGroup("Canister");
for (auto* canister : canisters) {
canister->Smash(canister->GetObjectID(), VIOLENT);
canister->Smash(canister->GetObjectID(), eKillType::VIOLENT);
}
const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister");
@@ -146,7 +147,7 @@ void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) {
for (auto* console : consoles) {
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
if (consoleRebuildComponent->GetState() != REBUILD_COMPLETED) {
if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) {
continue;
}
@@ -167,7 +168,7 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
auto offFX = 0;
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
@@ -228,14 +229,14 @@ void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "reset") {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_OPEN) {
self->Smash(self->GetObjectID(), SILENT);
if (rebuildComponent->GetState() == eRebuildState::OPEN) {
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
} else if (timerName == "Die") {
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
for (auto* console : consoles) {
console->Smash(console->GetObjectID(), VIOLENT);
console->Smash(console->GetObjectID(), eKillType::VIOLENT);
}
}
}

View File

@@ -55,7 +55,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
}
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();

View File

@@ -3,6 +3,8 @@
#include "EntityManager.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eTerminateType.h"
#include "eStateChangeType.h"
void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"bIsInUse")) {
@@ -79,6 +81,6 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
missionComponent->ForceProgress(601, 910, 1);
}
GameMessages::SendTerminateInteraction(playerId, FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(playerId, eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
}

View File

@@ -6,6 +6,7 @@
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "eTerminateType.h"
void GfTikiTorch::OnStartup(Entity* self) {
LightTorch(self);
@@ -34,7 +35,7 @@ void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {
Entity* player = EntityManager::Instance()->GetEntity(self->GetI64(u"userID"));
if (player != nullptr && player->GetCharacter()) {
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
self->SetBoolean(u"isInUse", false);

View File

@@ -4,6 +4,7 @@
#include "Preconditions.h"
#include "eEndBehavior.h"
#include "DestroyableComponent.h"
#include "eStateChangeType.h"
#ifdef _WIN32
#define _USE_MATH_DEFINES
@@ -43,10 +44,13 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendTeleport(playerId, position, rotation, player->GetSystemAddress(), true);
// Hacky fix for odd rotations
if (self->GetVar<std::u16string>(u"MastName") != u"Jail") {
auto mastName = self->GetVar<std::u16string>(u"MastName");
if (mastName == u"Elephant") {
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 140.0f, player->GetSystemAddress());
} else {
} else if (mastName == u"Jail") {
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 100.0f, player->GetSystemAddress());
} else if (mastName == u""){
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 203.0f, player->GetSystemAddress());
}
const auto cinematic = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Cinematic"));

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) {
}

View File

@@ -1,7 +1,7 @@
#include "NsLegoClubDoor.h"
#include "dZoneManager.h"
#include "GameMessages.h"
#include "AMFFormat.h"
#include "Amf3.h"
void NsLegoClubDoor::OnStartup(Entity* self) {
self->SetVar(u"currentZone", (int32_t)dZoneManager::Instance()->GetZoneID().GetMapID());
@@ -12,116 +12,56 @@ void NsLegoClubDoor::OnStartup(Entity* self) {
args = {};
AMFStringValue* callbackClient = new AMFStringValue();
callbackClient->SetStringValue(std::to_string(self->GetObjectID()));
args.InsertValue("callbackClient", callbackClient);
args.Insert("callbackClient", std::to_string(self->GetObjectID()));
args.Insert("strIdentifier", "choiceDoor");
args.Insert("title", "%[UI_CHOICE_DESTINATION]");
AMFStringValue* strIdentifier = new AMFStringValue();
strIdentifier->SetStringValue("choiceDoor");
args.InsertValue("strIdentifier", strIdentifier);
AMFStringValue* title = new AMFStringValue();
title->SetStringValue("%[UI_CHOICE_DESTINATION]");
args.InsertValue("title", title);
AMFArrayValue* choiceOptions = new AMFArrayValue();
AMFArrayValue* choiceOptions = args.InsertArray("options");
{
AMFArrayValue* nsArgs = new AMFArrayValue();
AMFArrayValue* nsArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NS]");
nsArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1200");
nsArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NS_HOVER]");
nsArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(nsArgs);
nsArgs->Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->Insert("caption", "%[UI_CHOICE_NS]");
nsArgs->Insert("identifier", "zoneID_1200");
nsArgs->Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]");
}
{
AMFArrayValue* ntArgs = new AMFArrayValue();
AMFArrayValue* ntArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NT]");
ntArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1900");
ntArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NT_HOVER]");
ntArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(ntArgs);
ntArgs->Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->Insert("caption", "%[UI_CHOICE_NT]");
ntArgs->Insert("identifier", "zoneID_1900");
ntArgs->Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
}
options = choiceOptions;
args.InsertValue("options", choiceOptions);
}
void NsLegoClubDoor::OnUse(Entity* self, Entity* user) {
auto* player = user;
if (CheckChoice(self, player)) {
AMFArrayValue* multiArgs = new AMFArrayValue();
AMFArrayValue multiArgs;
AMFStringValue* callbackClient = new AMFStringValue();
callbackClient->SetStringValue(std::to_string(self->GetObjectID()));
multiArgs->InsertValue("callbackClient", callbackClient);
AMFStringValue* strIdentifier = new AMFStringValue();
strIdentifier->SetStringValue("choiceDoor");
multiArgs->InsertValue("strIdentifier", strIdentifier);
AMFStringValue* title = new AMFStringValue();
title->SetStringValue("%[UI_CHOICE_DESTINATION]");
multiArgs->InsertValue("title", title);
multiArgs->InsertValue("options", options);
multiArgs.Insert("callbackClient", std::to_string(self->GetObjectID()));
multiArgs.Insert("strIdentifier", "choiceDoor");
multiArgs.Insert("title", "%[UI_CHOICE_DESTINATION]");
multiArgs.Insert("options", static_cast<AMFBaseValue*>(options));
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", multiArgs);
multiArgs.Remove("options", false); // We do not want the local amf to delete the options!
} else if (self->GetVar<int32_t>(u"currentZone") != m_ChoiceZoneID) {
AMFArrayValue* multiArgs = new AMFArrayValue();
AMFArrayValue multiArgs;
multiArgs.Insert("state", "Lobby");
AMFStringValue* state = new AMFStringValue();
state->SetStringValue("Lobby");
multiArgs->InsertValue("state", state);
AMFArrayValue* context = new AMFArrayValue();
AMFStringValue* user = new AMFStringValue();
user->SetStringValue(std::to_string(player->GetObjectID()));
context->InsertValue("user", user);
AMFStringValue* callbackObj = new AMFStringValue();
callbackObj->SetStringValue(std::to_string(self->GetObjectID()));
context->InsertValue("callbackObj", callbackObj);
AMFStringValue* helpVisible = new AMFStringValue();
helpVisible->SetStringValue("show");
context->InsertValue("HelpVisible", helpVisible);
AMFStringValue* type = new AMFStringValue();
type->SetStringValue("Lego_Club_Valid");
context->InsertValue("type", type);
multiArgs->InsertValue("context", context);
AMFArrayValue* context = multiArgs.InsertArray("context");
context->Insert("user", std::to_string(player->GetObjectID()));
context->Insert("callbackObj", std::to_string(self->GetObjectID()));
context->Insert("HelpVisible", "show");
context->Insert("type", "Lego_Club_Valid");
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "pushGameState", multiArgs);
} else {

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
#include "ChooseYourDestinationNsToNt.h"
#include "BaseConsoleTeleportServer.h"
#include "AMFFormat.h"
#include "Amf3.h"
class NsLegoClubDoor : public CppScripts::Script, ChooseYourDestinationNsToNt, BaseConsoleTeleportServer
{

View File

@@ -1,7 +1,7 @@
#include "NsLupTeleport.h"
#include "dZoneManager.h"
#include "GameMessages.h"
#include "AMFFormat.h"
#include "Amf3.h"
void NsLupTeleport::OnStartup(Entity* self) {
self->SetVar(u"currentZone", (int32_t)dZoneManager::Instance()->GetZoneID().GetMapID());
@@ -12,72 +12,36 @@ void NsLupTeleport::OnStartup(Entity* self) {
args = {};
AMFStringValue* callbackClient = new AMFStringValue();
callbackClient->SetStringValue(std::to_string(self->GetObjectID()));
args.InsertValue("callbackClient", callbackClient);
args.Insert("callbackClient", std::to_string(self->GetObjectID()));
args.Insert("strIdentifier", "choiceDoor");
args.Insert("title", "%[UI_CHOICE_DESTINATION]");
AMFStringValue* strIdentifier = new AMFStringValue();
strIdentifier->SetStringValue("choiceDoor");
args.InsertValue("strIdentifier", strIdentifier);
AMFStringValue* title = new AMFStringValue();
title->SetStringValue("%[UI_CHOICE_DESTINATION]");
args.InsertValue("title", title);
AMFArrayValue* choiceOptions = new AMFArrayValue();
AMFArrayValue* choiceOptions = args.InsertArray("options");
{
AMFArrayValue* nsArgs = new AMFArrayValue();
AMFArrayValue* nsArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NS]");
nsArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1200");
nsArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NS_HOVER]");
nsArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(nsArgs);
nsArgs->Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->Insert("caption", "%[UI_CHOICE_NS]");
nsArgs->Insert("identifier", "zoneID_1200");
nsArgs->Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]");
}
{
AMFArrayValue* ntArgs = new AMFArrayValue();
AMFArrayValue* ntArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NT]");
ntArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1900");
ntArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NT_HOVER]");
ntArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(ntArgs);
ntArgs->Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->Insert("caption", "%[UI_CHOICE_NT]");
ntArgs->Insert("identifier", "zoneID_1900");
ntArgs->Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
}
args.InsertValue("options", choiceOptions);
}
void NsLupTeleport::OnUse(Entity* self, Entity* user) {
auto* player = user;
if (CheckChoice(self, player)) {
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", &args);
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", args);
} else {
BaseOnUse(self, player);
}

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
#include "ChooseYourDestinationNsToNt.h"
#include "BaseConsoleTeleportServer.h"
#include "AMFFormat.h"
#include "Amf3.h"
class NsLupTeleport : public CppScripts::Script, ChooseYourDestinationNsToNt, BaseConsoleTeleportServer
{

View File

@@ -4,6 +4,8 @@
#include "Character.h"
#include "MissionComponent.h"
#include "RebuildComponent.h"
#include "eTerminateType.h"
#include "ePlayerFlag.h"
void NsTokenConsoleServer::OnStartup(Entity* self) {
@@ -16,7 +18,7 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) {
return;
}
if (rebuildComponent->GetState() != REBUILD_COMPLETED) {
if (rebuildComponent->GetState() != eRebuildState::COMPLETED) {
return;
}
@@ -42,20 +44,18 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) {
// Player must be in faction to interact with this entity.
LOT tokenLOT = 0;
if (character->GetPlayerFlag(46)) {
if (character->GetPlayerFlag(ePlayerFlag::VENTURE_FACTION)) //venture
tokenLOT = 8321;
} else if (character->GetPlayerFlag(47)) {
else if (character->GetPlayerFlag(ePlayerFlag::ASSEMBLY_FACTION)) //assembly
tokenLOT = 8318;
} else if (character->GetPlayerFlag(48)) {
else if (character->GetPlayerFlag(ePlayerFlag::PARADOX_FACTION)) //paradox
tokenLOT = 8320;
} else if (character->GetPlayerFlag(49)) {
else if (character->GetPlayerFlag(ePlayerFlag::SENTINEL_FACTION)) //sentinel
tokenLOT = 8319;
}
inventoryComponent->AddItem(tokenLOT, 5, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(tokenLOT, 5, eLootSourceType::NONE);
missionComponent->ForceProgressTaskType(863, 1, 1, false);
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -6,6 +6,7 @@
#include "eMissionState.h"
#include "RenderComponent.h"
#include "eEndBehavior.h"
#include "eStateChangeType.h"
void NtAssemblyTubeServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");

View File

@@ -1,6 +1,6 @@
#include "NtConsoleTeleportServer.h"
#include "Entity.h"
#include "AMFFormat.h"
#include "Amf3.h"
void NtConsoleTeleportServer::OnStartup(Entity* self) {
self->SetVar(u"teleportAnim", m_TeleportAnim);

View File

@@ -42,5 +42,5 @@ void NtDirtCloudServer::OnSkillEventFired(Entity* self, Entity* caster, const st
self->SetVar(u"CloudOn", false);
self->Smash(self->GetObjectID(), VIOLENT);
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
}

View File

@@ -2,12 +2,13 @@
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "ePlayerFlag.h"
void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 35.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_DUKE, 13548, 1319
ePlayerFlag::NT_FACTION_SPY_DUKE, 13548, 1319
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
@@ -31,7 +32,7 @@ void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int mission
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
if ((state == eMissionState::AVAILABLE || state == eMissionState::ACTIVE) && lotCount < 1) {
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::NONE);
} else if (state == eMissionState::READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
}

View File

@@ -1,11 +1,12 @@
#include "NtHaelServer.h"
#include "Entity.h"
#include "ePlayerFlag.h"
void NtHaelServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 25.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_HAEL, 13892, 1321
ePlayerFlag::NT_FACTION_SPY_HAEL, 13892, 1321
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {

View File

@@ -2,10 +2,11 @@
#include "GameMessages.h"
#include "Entity.h"
#include "Character.h"
#include "ePlayerFlag.h"
void NTImagimeterVisibility::OnRebuildComplete(Entity* self, Entity* target) {
auto* character = target->GetCharacter();
if (character) character->SetPlayerFlag(ePlayerFlags::NT_PLINTH_REBUILD, true);
if (character) character->SetPlayerFlag(ePlayerFlag::NT_PLINTH_REBUILD, true);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlinthBuilt", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress());
}

View File

@@ -1,11 +1,12 @@
#include "NtOverbuildServer.h"
#include "EntityManager.h"
#include "ePlayerFlag.h"
void NtOverbuildServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 30.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_OVERBUILD, 13891, 1320
ePlayerFlag::NT_FACTION_SPY_OVERBUILD, 13891, 1320
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {

View File

@@ -5,6 +5,8 @@
#include "Character.h"
#include "eMissionState.h"
#include "RenderComponent.h"
#include "eTerminateType.h"
#include "eStateChangeType.h"
void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress());

View File

@@ -4,6 +4,7 @@
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"
void NtParadoxTeleServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");

View File

@@ -5,6 +5,8 @@
#include "GeneralUtils.h"
#include "RenderComponent.h"
#include "eEndBehavior.h"
#include "eTerminateType.h"
#include "eStateChangeType.h"
void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
auto* player = user;
@@ -102,7 +104,7 @@ void NtVentureCannonServer::UnlockCannonPlayer(Entity* self, Entity* player) {
self->SetNetworkVar(u"bIsInUse", false);
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
void NtVentureCannonServer::FirePlayer(Entity* self, Entity* player) {

View File

@@ -3,6 +3,7 @@
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eTerminateType.h"
void SpawnGryphonServer::SetVariables(Entity* self) {
self->SetVar<LOT>(u"petLOT", 12433);
@@ -20,7 +21,7 @@ void SpawnGryphonServer::OnUse(Entity* self, Entity* user) {
if (missionComponent != nullptr && inventoryComponent != nullptr
&& missionComponent->GetMissionState(1391) == eMissionState::ACTIVE) {
inventoryComponent->RemoveItem(12483, inventoryComponent->GetLotCount(12483));
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
return;
}

View File

@@ -31,8 +31,8 @@ void ZoneAgMedProperty::SetGameVariables(Entity* self) {
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, { "BirdFX", "SunBeam" });
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, {});
self->SetVar<uint32_t>(defeatedProperyFlag, 118);
self->SetVar<uint32_t>(placedModelFlag, 119);
self->SetVar<int32_t>(defeatedProperyFlag, 118);
self->SetVar<int32_t>(placedModelFlag, 119);
self->SetVar<uint32_t>(guardMissionFlag, 1293);
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 1294);
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");

View File

@@ -39,8 +39,8 @@ void ZoneAgProperty::SetGameVariables(Entity* self) {
self->SetVar<std::string>(LauncherSpawner, "Launcher");
self->SetVar<std::string>(InstancerSpawner, "Instancer");
self->SetVar<uint32_t>(defeatedProperyFlag, 71);
self->SetVar<uint32_t>(placedModelFlag, 73);
self->SetVar<int32_t>(defeatedProperyFlag, 71);
self->SetVar<int32_t>(placedModelFlag, 73);
self->SetVar<uint32_t>(guardFirstMissionFlag, 891);
self->SetVar<uint32_t>(guardMissionFlag, 320);
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 951);
@@ -413,7 +413,7 @@ void ZoneAgProperty::BaseOnFireEventServerSide(Entity* self, Entity* sender, std
if (player == nullptr)
return;
player->GetCharacter()->SetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag), true);
player->GetCharacter()->SetPlayerFlag(self->GetVar<int32_t>(defeatedProperyFlag), true);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlayCinematic", 0, 0,
LWOOBJID_EMPTY, destroyedCinematic, UNASSIGNED_SYSTEM_ADDRESS);

View File

@@ -29,8 +29,8 @@ void ZoneNsMedProperty::SetGameVariables(Entity* self) {
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, { "Rockets" });
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, { });
self->SetVar<uint32_t>(defeatedProperyFlag, 122);
self->SetVar<uint32_t>(placedModelFlag, 123);
self->SetVar<int32_t>(defeatedProperyFlag, 122);
self->SetVar<int32_t>(placedModelFlag, 123);
self->SetVar<uint32_t>(guardMissionFlag, 1322);
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 1294);
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");

View File

@@ -1,7 +1,8 @@
#include "PropertyBankInteract.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "AMFFormat.h"
#include "Amf3.h"
#include "Entity.h"
void PropertyBankInteract::OnStartup(Entity* self) {
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
@@ -20,11 +21,10 @@ void PropertyBankInteract::OnPlayerLoaded(Entity* self, Entity* player) {
void PropertyBankInteract::OnUse(Entity* self, Entity* user) {
AMFArrayValue args;
auto* value = new AMFStringValue();
value->SetStringValue("bank");
args.InsertValue("state", value);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
args.Insert("state", "bank");
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"OpenBank", 0, 0, LWOOBJID_EMPTY,
"", user->GetSystemAddress());
@@ -34,9 +34,10 @@ void PropertyBankInteract::OnFireEventServerSide(Entity* self, Entity* sender, s
int32_t param2, int32_t param3) {
if (args == "ToggleBank") {
AMFArrayValue amfArgs;
amfArgs.InsertValue("visible", new AMFFalseValue());
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &amfArgs);
amfArgs.Insert("visible", false);
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", amfArgs);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY,
"", sender->GetSystemAddress());

View File

@@ -12,7 +12,7 @@ void VeBricksampleServer::OnUse(Entity* self, Entity* user) {
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) {
inventoryComponent->AddItem(loot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
inventoryComponent->AddItem(loot, 1, eLootSourceType::ACTIVITY);
for (auto* brickEntity : EntityManager::Instance()->GetEntitiesInGroup("Bricks")) {
GameMessages::SendNotifyClientObject(brickEntity->GetObjectID(), u"Pickedup");

View File

@@ -5,6 +5,6 @@ class VeEpsilonServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
const uint32_t m_ConsoleMissionID = 1220;
const uint32_t m_ConsoleRepeatMissionID = 1225;
const uint32_t m_ConsoleBaseFlag = 1010;
const int32_t m_ConsoleBaseFlag = 1010;
const std::string m_ConsoleGroup = "Consoles";
};

View File

@@ -3,18 +3,19 @@
#include "Character.h"
#include "GameMessages.h"
#include "Loot.h"
#include "eTerminateType.h"
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
LootGenerator::Instance().DropActivityLoot(user, self, 12551);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (inventoryComponent != nullptr) {
inventoryComponent->AddItem(12547, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY); // Add the panel required for pickup
inventoryComponent->AddItem(12547, 1, eLootSourceType::ACTIVITY); // Add the panel required for pickup
}
// The flag to set is 101<number>
const auto flagNumber = self->GetVar<std::u16string>(m_NumberVariable);
const auto flag = std::stoi("101" + GeneralUtils::UTF16ToWTF8(flagNumber));
const int32_t flag = std::stoi("101" + GeneralUtils::UTF16ToWTF8(flagNumber));
auto* character = user->GetCharacter();
if (character != nullptr) {
@@ -22,5 +23,5 @@ void VeMissionConsole::OnUse(Entity* self, Entity* user) {
}
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"");
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -61,6 +61,6 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
// kill the bouncer
GameMessages::SendNotifyClientObject(bouncer->GetObjectID(), u"TimeToDie");
bouncer->Smash(self->GetObjectID(), VIOLENT);
bouncer->Smash(self->GetObjectID(), eKillType::VIOLENT);
}
}

View File

@@ -46,7 +46,7 @@ void CavePrisonCage::Setup(Entity* self, Spawner* spawner) {
}
void CavePrisonCage::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state != eRebuildState::REBUILD_RESETTING) {
if (state != eRebuildState::RESETTING) {
return;
}

View File

@@ -9,7 +9,7 @@ void ImaginationShrineServer::OnUse(Entity* self, Entity* user) {
return;
}
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
// Use the shrine
BaseUse(self, user);
}

View File

@@ -44,6 +44,6 @@ void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID,
return;
}
inventoryComponent->AddItem(16644, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(16644, 1, eLootSourceType::NONE);
}
}

View File

@@ -4,11 +4,12 @@
#include "Loot.h"
#include "Entity.h"
#include "DestroyableComponent.h"
#include "ePlayerFlag.h"
void NjDragonEmblemChestServer::OnUse(Entity* self, Entity* user) {
auto* character = user->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(NJ_WU_SHOW_DAILY_CHEST, false);
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, false);
}
auto* destroyable = self->GetComponent<DestroyableComponent>();

View File

@@ -1,6 +1,7 @@
#include "NjGarmadonCelebration.h"
#include "Character.h"
#include "GameMessages.h"
#include "ePlayerFlag.h"
void NjGarmadonCelebration::OnCollisionPhantom(Entity* self, Entity* target) {
auto* character = target->GetCharacter();
@@ -9,8 +10,8 @@ void NjGarmadonCelebration::OnCollisionPhantom(Entity* self, Entity* target) {
return;
}
if (!character->GetPlayerFlag(ePlayerFlags::NJ_GARMADON_CINEMATIC_SEEN)) {
character->SetPlayerFlag(ePlayerFlags::NJ_GARMADON_CINEMATIC_SEEN, true);
if (!character->GetPlayerFlag(ePlayerFlag::NJ_GARMADON_CINEMATIC_SEEN)) {
character->SetPlayerFlag(ePlayerFlag::NJ_GARMADON_CINEMATIC_SEEN, true);
GameMessages::SendStartCelebrationEffect(target, target->GetSystemAddress(), GarmadonCelebrationID);
}

View File

@@ -1,12 +1,13 @@
#pragma once
#include "CppScripts.h"
#include <map>
#include "ePlayerFlag.h"
static std::map<std::u16string, uint32_t> ElementFlags = {
{u"earth", ePlayerFlags::NJ_EARTH_SPINJITZU},
{u"lightning", ePlayerFlags::NJ_LIGHTNING_SPINJITZU},
{u"ice", ePlayerFlags::NJ_ICE_SPINJITZU},
{u"fire", ePlayerFlags::NJ_FIRE_SPINJITZU}
static std::map<std::u16string, ePlayerFlag> ElementFlags = {
{u"earth", ePlayerFlag::NJ_EARTH_SPINJITZU},
{u"lightning", ePlayerFlag::NJ_LIGHTNING_SPINJITZU},
{u"ice", ePlayerFlag::NJ_ICE_SPINJITZU},
{u"fire", ePlayerFlag::NJ_FIRE_SPINJITZU}
};
static std::map<std::u16string, uint32_t> ElementMissions = {

View File

@@ -12,6 +12,6 @@ void NjScrollChestServer::OnUse(Entity* self, Entity* user) {
playerInventory->RemoveItem(keyLOT, 1);
// Reward the player with the item set
playerInventory->AddItem(rewardItemLOT, 1, eLootSourceType::LOOT_SOURCE_NONE);
playerInventory->AddItem(rewardItemLOT, 1, eLootSourceType::NONE);
}
}

View File

@@ -4,6 +4,7 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "eMissionState.h"
#include "ePlayerFlag.h"
void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
@@ -24,7 +25,7 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, e
missionComponent->AcceptMission(subMissionID);
}
character->SetPlayerFlag(ePlayerFlags::NJ_WU_SHOW_DAILY_CHEST, false);
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, false);
// Hide the chest
for (auto* chest : EntityManager::Instance()->GetEntitiesInGroup(m_DragonChestGroup)) {
@@ -37,7 +38,7 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, e
case eMissionState::READY_TO_COMPLETE:
case eMissionState::COMPLETE_READY_TO_COMPLETE:
{
character->SetPlayerFlag(NJ_WU_SHOW_DAILY_CHEST, true);
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, true);
// Show the chest
for (auto* chest : EntityManager::Instance()->GetEntitiesInGroup(m_DragonChestGroup)) {

View File

@@ -226,21 +226,21 @@ void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* co
rebuildComponent->AddRebuildStateCallback([this, self, counterWeight](eRebuildState state) {
switch (state) {
case REBUILD_BUILDING:
case eRebuildState::BUILDING:
GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification,
0, 0, counterWeight->GetObjectID(),
BaseCounterweightQB + std::to_string(self->GetVar<uint32_t>(WaveNumberVariable)),
UNASSIGNED_SYSTEM_ADDRESS);
return;
case REBUILD_INCOMPLETE:
case eRebuildState::INCOMPLETE:
GameMessages::SendNotifyClientObject(self->GetObjectID(), EndCinematicNotification,
0, 0, LWOOBJID_EMPTY, "",
UNASSIGNED_SYSTEM_ADDRESS);
return;
case REBUILD_RESETTING:
case eRebuildState::RESETTING:
ActivityTimerStart(self, SpawnCounterWeightTimer, 0.0f, 0.0f);
return;
case REBUILD_COMPLETED: {
case eRebuildState::COMPLETED: {
// TODO: Move the platform?
// The counterweight is actually a moving platform and we should listen to the last waypoint event here

View File

@@ -3,6 +3,7 @@
#include "DestroyableComponent.h"
#include "BaseCombatAIComponent.h"
#include "RenderComponent.h"
#include "ePetTamingNotifyType.h"
void DamagingPets::OnStartup(Entity* self) {
@@ -33,15 +34,15 @@ void DamagingPets::OnPlayerLoaded(Entity* self, Entity* player) {
});
}
void DamagingPets::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) {
void DamagingPets::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) {
switch (type) {
case NOTIFY_TYPE_SUCCESS:
case NOTIFY_TYPE_BEGIN:
case ePetTamingNotifyType::SUCCESS:
case ePetTamingNotifyType::BEGIN:
self->CancelAllTimers();
ClearEffects(self);
break;
case NOTIFY_TYPE_FAILED:
case NOTIFY_TYPE_QUIT:
case ePetTamingNotifyType::FAILED:
case ePetTamingNotifyType::QUIT:
{
self->SetNetworkVar<bool>(u"bIAmTamable", false);
self->AddTimer("GoEvil", 1.0f);

View File

@@ -13,7 +13,7 @@ class DamagingPets : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnTimerDone(Entity* self, std::string message) override;
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) override;
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) override;
void OnSkillEventFired(Entity* self, Entity* target, const std::string& message) override;
void OnPlayerLoaded(Entity* self, Entity* player) override;
private:

View File

@@ -1,5 +1,6 @@
#include "PetFromDigServer.h"
#include "PetComponent.h"
#include "ePetTamingNotifyType.h"
void PetFromDigServer::OnStartup(Entity* self) {
auto* petComponent = self->GetComponent<PetComponent>();
@@ -24,16 +25,16 @@ void PetFromDigServer::OnTimerDone(Entity* self, std::string timerName) {
if (petComponent == nullptr || petComponent->GetOwner() != nullptr)
return;
self->Smash(self->GetObjectID(), SILENT);
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
}
void PetFromDigServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) {
if (type == NOTIFY_TYPE_BEGIN) {
void PetFromDigServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) {
if (type == ePetTamingNotifyType::BEGIN) {
self->CancelTimer("killself");
} else if (type == NOTIFY_TYPE_QUIT || type == NOTIFY_TYPE_FAILED) {
self->Smash(self->GetObjectID(), SILENT);
} else if (type == NOTIFY_TYPE_SUCCESS) {
} else if (type == ePetTamingNotifyType::QUIT || type == ePetTamingNotifyType::FAILED) {
self->Smash(self->GetObjectID(), eKillType::SILENT);
} else if (type == ePetTamingNotifyType::SUCCESS) {
auto* petComponent = self->GetComponent<PetComponent>();
if (petComponent == nullptr)
return;

View File

@@ -6,5 +6,5 @@ class PetFromDigServer : public CppScripts::Script
public:
void OnStartup(Entity* self) override;
void OnTimerDone(Entity* self, std::string timerName) override;
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) override;
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) override;
};

View File

@@ -1,5 +1,6 @@
#include "PetFromObjectServer.h"
#include "PetComponent.h"
#include "ePetTamingNotifyType.h"
void PetFromObjectServer::OnStartup(Entity* self) {
self->SetNetworkVar(u"pettamer", std::to_string(self->GetVar<LWOOBJID>(u"tamer")));
@@ -11,20 +12,20 @@ void PetFromObjectServer::OnTimerDone(Entity* self, std::string timerName) {
const auto* petComponent = self->GetComponent<PetComponent>();
if (petComponent == nullptr || petComponent->GetOwner() != nullptr)
return;
self->Smash(self->GetObjectID(), SILENT);
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
}
void PetFromObjectServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) {
void PetFromObjectServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) {
switch (type) {
case NOTIFY_TYPE_BEGIN:
case ePetTamingNotifyType::BEGIN:
self->CancelAllTimers();
break;
case NOTIFY_TYPE_QUIT:
case NOTIFY_TYPE_FAILED:
self->Smash(self->GetObjectID(), SILENT);
case ePetTamingNotifyType::QUIT:
case ePetTamingNotifyType::FAILED:
self->Smash(self->GetObjectID(), eKillType::SILENT);
break;
case NOTIFY_TYPE_SUCCESS:
case ePetTamingNotifyType::SUCCESS:
// TODO: Remove from groups?
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"UpdateSuccessPicking", 0,
0, tamer->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);

View File

@@ -5,5 +5,5 @@ class PetFromObjectServer : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnTimerDone(Entity* self, std::string timerName) override;
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) override;
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) override;
};

View File

@@ -3,6 +3,8 @@
#include "Player.h"
#include "RenderComponent.h"
#include "EntityManager.h"
#include "eTerminateType.h"
#include "eStateChangeType.h"
void BaseConsoleTeleportServer::BaseOnUse(Entity* self, Entity* user) {
auto* player = user;
@@ -52,7 +54,7 @@ void BaseConsoleTeleportServer::BaseOnMessageBoxResponse(Entity* self, Entity* s
GameMessages::SendDisplayZoneSummary(playerID, player->GetSystemAddress(), false, false, self->GetObjectID());
});
} else if (button == -1 || button == 0) {
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, player->GetObjectID());
}
}
@@ -88,7 +90,7 @@ void BaseConsoleTeleportServer::TransferPlayer(Entity* self, Entity* player, int
true, true, true, true, true, true, true
);
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, player->GetObjectID());
const auto& teleportZone = self->GetVar<std::u16string>(u"transferZoneID");

View File

@@ -38,8 +38,8 @@ void BasePropertyServer::SetGameVariables(Entity* self) {
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, {});
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, {});
self->SetVar<uint32_t>(defeatedProperyFlag, 0);
self->SetVar<uint32_t>(placedModelFlag, 0);
self->SetVar<int32_t>(defeatedProperyFlag, 0);
self->SetVar<int32_t>(placedModelFlag, 0);
self->SetVar<uint32_t>(guardMissionFlag, 0);
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");
@@ -127,7 +127,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
if (player->GetObjectID() != propertyOwner)
return;
} else {
const auto defeatedFlag = player->GetCharacter()->GetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag));
const auto defeatedFlag = player->GetCharacter()->GetPlayerFlag(self->GetVar<int32_t>(defeatedProperyFlag));
self->SetNetworkVar(UnclaimedVariable, true);
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID());
@@ -274,7 +274,7 @@ void BasePropertyServer::RequestDie(Entity* self, Entity* other) {
if (destroyable == nullptr)
return;
destroyable->Smash(other->GetObjectID(), SILENT);
destroyable->Smash(other->GetObjectID(), eKillType::SILENT);
}
void BasePropertyServer::ActivateSpawner(const std::string& spawnerName) {
@@ -464,7 +464,7 @@ void BasePropertyServer::HandleOrbsTimer(Entity* self) {
if (player != nullptr) {
auto* character = player->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag), true);
character->SetPlayerFlag(self->GetVar<int32_t>(defeatedProperyFlag), true);
}
}

View File

@@ -1,6 +1,7 @@
#include "ChooseYourDestinationNsToNt.h"
#include "Character.h"
#include "GameMessages.h"
#include "eTerminateType.h"
bool ChooseYourDestinationNsToNt::CheckChoice(Entity* self, Entity* player) {
const auto choiceZoneID = self->GetVar<int32_t>(u"choiceZone");
@@ -59,6 +60,6 @@ void ChooseYourDestinationNsToNt::BaseChoiceBoxRespond(Entity* self, Entity* sen
GameMessages::SendDisplayMessageBox(sender->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, strText, u"", sender->GetSystemAddress());
} else {
GameMessages::SendTerminateInteraction(sender->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(sender->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
}

View File

@@ -160,7 +160,6 @@
#include "AgSalutingNpcs.h"
#include "BossSpiderQueenEnemyServer.h"
#include "RockHydrantSmashable.h"
#include "SpecialImaginePowerupSpawner.h"
// Misc Scripts
#include "ExplodingAsset.h"
@@ -295,6 +294,24 @@
// WBL scripts
#include "WblGenericZone.h"
// Alpha Scripts
#include "TriggerGas.h"
#include "ActNinjaSensei.h"
// pickups
#include "SpecialCoinSpawner.h"
#include "SpecialPowerupSpawner.h"
#include "SpecialSpeedBuffSpawner.h"
// Wild Scripts
#include "WildAndScared.h"
#include "WildGfGlowbug.h"
#include "WildAmbientCrab.h"
#include "WildPants.h"
#include "WildNinjaStudent.h"
#include "WildNinjaSensei.h"
#include "WildNinjaBricks.h"
//Big bad global bc this is a namespace and not a class:
InvalidScript* invalidToReturn = new InvalidScript();
std::map<std::string, CppScripts::Script*> m_Scripts;
@@ -371,8 +388,6 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new RemoveRentalGear();
else if (scriptName == "scripts\\02_server\\Map\\AG\\L_NPC_NJ_ASSISTANT_SERVER.lua")
script = new NpcNjAssistantServer();
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_IMAGINE-POWERUP-SPAWNER.lua")
script = new SpecialImaginePowerupSpawner();
else if (scriptName == "scripts\\ai\\AG\\L_AG_SALUTING_NPCS.lua")
script = new AgSalutingNpcs();
else if (scriptName == "scripts\\ai\\AG\\L_AG_JET_EFFECT_SERVER.lua")
@@ -860,11 +875,65 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua")
script = new WblGenericZone();
// Alpha
if (scriptName == "scripts\\ai\\FV\\L_TRIGGER_GAS.lua")
script = new TriggerGas();
else if (scriptName == "scripts\\ai\\FV\\L_ACT_NINJA_SENSEI.lua")
script = new ActNinjaSensei();
// pickups
if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_1_BRONZE-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(1);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_1_GOLD-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(10000);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_1_SILVER-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(100);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_10_BRONZE-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(10);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_10_GOLD-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(100000);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_10_SILVER-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(1000);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_25_BRONZE-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(25);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_25_GOLD-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(250000);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_25_SILVER-COIN-SPAWNER.lua")
script = new SpecialCoinSpawner(2500);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_IMAGINE-POWERUP-SPAWNER.lua")
script = new SpecialPowerupSpawner(13);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_IMAGINE-POWERUP-SPAWNER-2PT.lua")
script = new SpecialPowerupSpawner(129);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_LIFE-POWERUP-SPAWNER.lua")
script = new SpecialPowerupSpawner(5);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_ARMOR-POWERUP-SPAWNER.lua")
script = new SpecialPowerupSpawner(747);
else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_SPEED_BUFF_SPAWNER.lua")
script = new SpecialSpeedBuffSpawner();
// Wild
if (scriptName == "scripts\\ai\\WILD\\L_WILD_GF_RAT.lua" || scriptName == "scripts\\ai\\WILD\\L_WILD_GF_SNAIL.lua")
script = new WildAndScared();
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_GF_GLOWBUG.lua")
script = new WildGfGlowbug();
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_AMBIENT_CRAB.lua")
script = new WildAmbientCrab();
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_PANTS.lua")
script = new WildPants();
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_NINJA_BRICKS.lua")
script = new WildNinjaBricks();
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_NINJA_STUDENT.lua")
script = new WildNinjaStudent();
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_NINJA_SENSEI.lua")
script = new WildNinjaSensei();
// handle invalid script reporting if the path is greater than zero and it's not an ignored script
// information not really needed for sys admins but is for developers
else if (script == invalidToReturn) {
if ((scriptName.length() > 0) && !((scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua") ||
(scriptName == "scripts\\02_server\\Enemy\\General\\L_BASE_ENEMY_SPIDERLING.lua") ||
(scriptName =="scripts\\ai\\FV\\L_ACT_NINJA_STUDENT.lua") ||
(scriptName == "scripts\\ai\\WILD\\L_WILD_GF_FROG.lua") ||
(scriptName == "scripts\\empty.lua")
)) Game::logger->LogDebug("CppScripts", "LOT %i attempted to load CppScript for '%s', but returned InvalidScript.", parent->GetLOT(), scriptName.c_str());
}

View File

@@ -8,6 +8,8 @@ class User;
class Entity;
class NiPoint3;
enum class eMissionState : int32_t;
enum class ePetTamingNotifyType : uint32_t;
enum class eRebuildState : uint32_t;
namespace CppScripts {
/**
@@ -44,6 +46,13 @@ namespace CppScripts {
*/
virtual void OnCollisionPhantom(Entity* self, Entity* target) {};
/**
* Invoked upon an entity leaving the phantom collider on self.
*
* Equivalent to 'function onOffCollisionPhantom(self, msg)'
*/
virtual void OnOffCollisionPhantom(Entity* self, Entity* target) {};
/**
* Invoked when a player accepted a mission.
*
@@ -262,7 +271,7 @@ namespace CppScripts {
*
* Equivalent to 'function onNotifyPetTamingMinigame(self, msg)'
*/
virtual void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) {};
virtual void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) {};
/**
* Invoked when a player responded to a message box.
@@ -340,6 +349,15 @@ namespace CppScripts {
* @param itemObjId The items Object ID
*/
virtual void OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {};
/**
* Handles exiting a scripted activity
*
* @param sender
* @param player the player to remove
* @param canceled if it was done via the cancel button
*/
virtual void OnRequestActivityExit(Entity* sender, LWOOBJID player, bool canceled){};
};
Script* GetScript(Entity* parent, const std::string& scriptName);

View File

@@ -4,6 +4,7 @@
#include "DestroyableComponent.h"
#include "ControllablePhysicsComponent.h"
#include "EntityManager.h"
#include "eStateChangeType.h"
void PersonalFortress::OnStartup(Entity* self) {
auto* owner = self->GetOwner();

View File

@@ -1,6 +1,7 @@
#include "StunImmunity.h"
#include "DestroyableComponent.h"
#include "ControllablePhysicsComponent.h"
#include "eStateChangeType.h"
void StunImmunity::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();

View File

@@ -12,7 +12,7 @@ void NPCAddRemoveItem::OnMissionDialogueOK(Entity* self, Entity* target, int mis
for (const auto& itemSetting : missionSetting.second) {
for (const auto& lot : itemSetting.items) {
if (itemSetting.add && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)) {
inventory->AddItem(lot, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventory->AddItem(lot, 1, eLootSourceType::NONE);
} else if (itemSetting.remove && (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE)) {
inventory->RemoveItem(lot, 1);
}

View File

@@ -6,6 +6,8 @@
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
#include "eCinematicEvent.h"
#include "ePlayerFlag.h"
void NtFactionSpyServer::OnStartup(Entity* self) {
SetVariables(self);
@@ -77,14 +79,14 @@ void NtFactionSpyServer::OnCinematicUpdate(Entity* self, Entity* sender, eCinema
// Make sure we're listening to the root we're interested in
if (pathRoot == cinematicRoot) {
if (event == STARTED && pathIndex >= 0 && pathIndex < dialogueTable.size()) {
if (event == eCinematicEvent::STARTED && pathIndex >= 0 && pathIndex < dialogueTable.size()) {
// If the cinematic started, show part of the conversation
GameMessages::SendNotifyClientObject(self->GetObjectID(), m_SpyDialogueNotification, 0,
0, ParamObjectForConversationID(self, dialogueTable.at(pathIndex).conversationID),
dialogueTable.at(pathIndex).token, sender->GetSystemAddress());
} else if (event == ENDED && pathIndex >= dialogueTable.size() - 1) {
} else if (event == eCinematicEvent::ENDED && pathIndex >= dialogueTable.size() - 1) {
auto spyData = self->GetVar<SpyData>(m_SpyDataVariable);
auto* character = sender->GetCharacter();
if (character != nullptr) {

View File

@@ -7,7 +7,7 @@ struct SpyDialogue {
};
struct SpyData {
uint32_t flagID;
int32_t flagID;
LOT itemID;
uint32_t missionID;
};

View File

@@ -3,6 +3,7 @@
#include "EntityManager.h"
#include "PetComponent.h"
#include "EntityInfo.h"
#include "eTerminateType.h"
void SpawnPetBaseServer::OnStartup(Entity* self) {
SetVariables(self);
@@ -43,7 +44,7 @@ void SpawnPetBaseServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayCinematic(user->GetObjectID(), spawnCinematic, UNASSIGNED_SYSTEM_ADDRESS);
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
bool SpawnPetBaseServer::CheckNumberOfPets(Entity* self, Entity* user) {

View File

@@ -9,7 +9,7 @@ void ActMine::OnStartup(Entity* self) {
}
void ActMine::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == eRebuildState::REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
auto* rebuild = self->GetComponent<RebuildComponent>();
if (rebuild) {
auto* builder = rebuild->GetBuilder();

View File

@@ -40,7 +40,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
}
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();

View File

@@ -37,7 +37,7 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
if (character != nullptr) {
character->SetPlayerFlag(115, false);
if (param2 != -1) // Certain footraces set a flag
character->SetPlayerFlag(param2, true);
character->SetPlayerFlag(static_cast<uint32_t>(param2), true);
}
StopActivity(self, player->GetObjectID(), 0, param1);

View File

@@ -6,113 +6,55 @@
#include "RenderComponent.h"
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
if (inUse) {
return;
}
if (inUse || self->GetLOT() != 6859) return;
GameMessages::SendNotifyClientObject(
self->GetObjectID(),
u"isInUse",
0,
0,
LWOOBJID_EMPTY,
"",
UNASSIGNED_SYSTEM_ADDRESS
self->GetObjectID(), u"toggleInUse", 1, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS
);
inUse = true;
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
if (entities.empty()) {
return;
}
auto* effect = entities[0];
GameMessages::SendPlayFXEffect(effect, 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true);
self->AddTimer("radarDish", 2);
self->AddTimer("CineDone", 9);
if (entities.empty()) return;
GameMessages::SendPlayFXEffect(entities.at(0), 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true);
self->AddTimer("radarDish", 2.0f);
self->AddTimer("PlayEffect", 2.5f);
self->AddTimer("CineDone", 7.5f + 5.0f); // 7.5f is time the cinematic takes to play
}
void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target) {
if (self->GetLOT() != 6209) return;
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
if (entities.empty()) return;
RenderComponent::PlayAnimation(entities.at(0), u"jetFX");
if (entities.empty()) {
return;
}
auto* effect = entities[0];
auto groups = self->GetGroups();
if (groups.empty()) {
return;
}
// So we can give kill credit to person who build this
builder = target->GetObjectID();
const auto group = groups[0];
RenderComponent::PlayAnimation(effect, u"jetFX");
self->AddTimer("PlayEffect", 2.5f);
if (group == "Base_Radar") {
self->AddTimer("CineDone", 5);
auto groups = self->GetGroups();
if (!groups.empty() && groups.at(0) == "Base_Radar") {
self->AddTimer("PlayEffect", 2.5f);
self->AddTimer("CineDone", 7.5f + 5.0f); // 7.5f is time the cinematic takes to play
}
}
void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "radarDish") {
GameMessages::SendStopFXEffect(self, true, "radarDish");
return;
}
if (timerName == "PlayEffect") {
} else if (timerName == "PlayEffect") {
auto entities = EntityManager::Instance()->GetEntitiesInGroup("mortarMain");
if (entities.empty()) return;
if (entities.empty()) {
return;
}
const auto size = entities.size();
if (size == 0) {
return;
}
const auto selected = GeneralUtils::GenerateRandomNumber<int>(0, size - 1);
auto* mortar = entities[selected];
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(eReplicaComponentType::SKILL));
const auto selected = GeneralUtils::GenerateRandomNumber<int>(0, entities.size() - 1);
auto* mortar = entities.at(selected);
// so we give proper credit to the builder for the kills from this skill
mortar->SetOwnerOverride(builder);
SkillComponent* skillComponent;
if (!mortar->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
return;
}
skillComponent->CalculateBehavior(318, 3727, LWOOBJID_EMPTY, true);
return;
}
if (timerName == "CineDone") {
auto* skillComponent = mortar->GetComponent<SkillComponent>();
if (skillComponent) skillComponent->CastSkill(318);
} else if (timerName == "CineDone") {
GameMessages::SendNotifyClientObject(
self->GetObjectID(),
u"toggleInUse",
-1,
0,
LWOOBJID_EMPTY,
"",
UNASSIGNED_SYSTEM_ADDRESS
self->GetObjectID(), u"toggleInUse", -1, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS
);
inUse = false;
}
}

View File

@@ -2,9 +2,10 @@
#include "Loot.h"
#include "GameMessages.h"
#include "Entity.h"
#include "eTerminateType.h"
void AgPicnicBlanket::OnUse(Entity* self, Entity* user) {
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
if (self->GetVar<bool>(u"active"))
return;
self->SetVar<bool>(u"active", true);

View File

@@ -49,7 +49,7 @@ void AgQbElevator::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "startKillTimer") {
killTimerStartup(self);
} else if (timerName == "KillTimer") {
self->Smash(self->GetObjectID(), VIOLENT);
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
}
}

View File

@@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "RenderComponent.h"
#include "Entity.h"
#include "eTerminateType.h"
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());

View File

@@ -0,0 +1,78 @@
#include "ActNinjaSensei.h"
#include "Entity.h"
#include "EntityManager.h"
#include "GameMessages.h"
void ActNinjaSensei::OnStartup(Entity* self) {
auto students = EntityManager::Instance()->GetEntitiesInGroup(this->m_StudentGroup);
std::vector<Entity*> validStudents = {};
for (auto* student : students) {
if (student && student->GetLOT() == this->m_StudentLOT) validStudents.push_back(student);
}
self->SetVar(u"students", validStudents);
self->AddTimer("crane", 5);
}
void ActNinjaSensei::OnTimerDone(Entity* self, std::string timerName) {
auto students = self->GetVar<std::vector<Entity*>>(u"students");
if (students.empty()) return;
if (timerName == "crane") {
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"crane");
}
GameMessages::SendPlayAnimation(self, u"crane");
self->AddTimer("bow", 15.33);
}
if (timerName == "bow") {
GameMessages::SendPlayAnimation(self, u"bow");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"bow");
}
GameMessages::SendPlayAnimation(self, u"bow");
self->AddTimer("tiger", 5);
}
if (timerName == "tiger") {
GameMessages::SendPlayAnimation(self, u"tiger");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"tiger");
}
GameMessages::SendPlayAnimation(self, u"tiger");
self->AddTimer("bow2", 15.33);
}
if (timerName == "bow2") {
GameMessages::SendPlayAnimation(self, u"bow");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"bow");
}
GameMessages::SendPlayAnimation(self, u"bow");
self->AddTimer("mantis", 5);
}
if (timerName == "mantis") {
GameMessages::SendPlayAnimation(self, u"mantis");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"mantis");
}
GameMessages::SendPlayAnimation(self, u"mantis");
self->AddTimer("bow3", 15.3);
}
if (timerName == "bow3") {
GameMessages::SendPlayAnimation(self, u"bow");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"bow");
}
GameMessages::SendPlayAnimation(self, u"bow");
self->AddTimer("repeat", 5);
}
if (timerName == "repeat") {
self->CancelAllTimers();
self->AddTimer("crane", 5);
}
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include "CppScripts.h"
class ActNinjaSensei : public CppScripts::Script {
void OnStartup(Entity* self) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
std::string m_StudentGroup = "Sensei_kids";
LOT m_StudentLOT = 2497;
};

View File

@@ -1,9 +1,10 @@
#include "ActNinjaTurret.h"
#include "eRebuildState.h"
void ActNinjaTurret::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == eRebuildState::REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
self->SetVar(u"AmBuilt", true);
} else if (state == eRebuildState::REBUILD_RESETTING) {
} else if (state == eRebuildState::RESETTING) {
self->SetVar(u"AmBuilt", false);
}
}

View File

@@ -21,7 +21,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
auto* rebuildComponent = object->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
indexCount++;
}
}
@@ -52,7 +52,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
}
void ActParadoxPipeFix::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == REBUILD_RESETTING) {
if (state == eRebuildState::RESETTING) {
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
if (!refinery.empty()) {

View File

@@ -1,4 +1,5 @@
set(DSCRIPTS_SOURCES_AI_FV
set(DSCRIPTS_SOURCES_AI_FV
"ActNinjaSensei.cpp"
"ActNinjaTurret.cpp"
"FvFlyingCreviceDragon.cpp"
"FvDragonSmashingGolemQb.cpp"
@@ -15,4 +16,5 @@ set(DSCRIPTS_SOURCES_AI_FV
"FvPassThroughWall.cpp"
"FvBounceOverWall.cpp"
"FvMaelstromGeyser.cpp"
"TriggerGas.cpp"
PARENT_SCOPE)

View File

@@ -61,8 +61,8 @@ void FvBrickPuzzleServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "reset") {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr && rebuildComponent->GetState() == REBUILD_OPEN) {
self->Smash(self->GetObjectID(), SILENT);
if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::OPEN) {
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
}
}

View File

@@ -1,6 +1,8 @@
#include "FvConsoleLeftQuickbuild.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "eTerminateType.h"
#include "eRebuildState.h"
void FvConsoleLeftQuickbuild::OnStartup(Entity* self) {
self->SetVar(u"IAmBuilt", false);
@@ -8,7 +10,7 @@ void FvConsoleLeftQuickbuild::OnStartup(Entity* self) {
}
void FvConsoleLeftQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
self->SetVar(u"IAmBuilt", true);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
@@ -16,7 +18,7 @@ void FvConsoleLeftQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState s
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleLeftUp");
}
} else if (state == REBUILD_RESETTING) {
} else if (state == eRebuildState::RESETTING) {
self->SetVar(u"IAmBuilt", false);
self->SetVar(u"AmActive", false);
@@ -43,5 +45,5 @@ void FvConsoleLeftQuickbuild::OnUse(Entity* self, Entity* user) {
}
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -1,6 +1,8 @@
#include "FvConsoleRightQuickbuild.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "eTerminateType.h"
#include "eRebuildState.h"
void FvConsoleRightQuickbuild::OnStartup(Entity* self) {
self->SetVar(u"IAmBuilt", false);
@@ -8,7 +10,7 @@ void FvConsoleRightQuickbuild::OnStartup(Entity* self) {
}
void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
self->SetVar(u"IAmBuilt", true);
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
@@ -16,7 +18,7 @@ void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState
if (!objects.empty()) {
objects[0]->NotifyObject(self, "ConsoleRightUp");
}
} else if (state == REBUILD_RESETTING) {
} else if (state == eRebuildState::RESETTING) {
self->SetVar(u"IAmBuilt", false);
self->SetVar(u"AmActive", false);
@@ -43,5 +45,5 @@ void FvConsoleRightQuickbuild::OnUse(Entity* self, Entity* user) {
}
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -3,6 +3,7 @@
#include "EntityManager.h"
#include "RenderComponent.h"
#include "Entity.h"
#include "eRebuildState.h"
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
self->AddTimer("GolemBreakTimer", 10.5f);
@@ -15,7 +16,7 @@ void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
}
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == eRebuildState::REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
RenderComponent::PlayAnimation(self, u"dragonsmash");
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");

View File

@@ -56,7 +56,7 @@ void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::st
object = EntityManager::Instance()->GetEntitiesInGroup("Canister")[0];
if (object != nullptr) {
object->Smash(self->GetObjectID(), SILENT);
object->Smash(self->GetObjectID(), eKillType::SILENT);
}
canisterSpawner->Reset();

Some files were not shown because too many files have changed in this diff Show More