Merge branch 'main' into npc-pathing

This commit is contained in:
Aaron Kimbre
2023-04-10 22:19:41 -05:00
612 changed files with 12044 additions and 7169 deletions

View File

@@ -13,6 +13,7 @@
#include "GameMessages.h"
#include "SkillComponent.h"
#include "eReplicaComponentType.h"
#include <vector>
@@ -27,9 +28,9 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
//self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true }
//Get our components:
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(COMPONENT_TYPE_DESTROYABLE));
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(eReplicaComponentType::DESTROYABLE));
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
if (!destroyable || !controllable) return;
@@ -47,8 +48,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) {
@@ -162,9 +161,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;
@@ -173,44 +169,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");
@@ -220,44 +185,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;
}
}
}
@@ -276,14 +240,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);
}
@@ -394,10 +356,6 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) {
}
void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
/*
const auto targets = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CHARACTER);
*/
const auto targets = self->GetTargetsInPhantom();
if (self->GetBoolean(u"stoppedFlag")) {
@@ -430,8 +388,6 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
PlayAnimAndReturnTime(self, spiderSingleShot);
Game::logger->Log("BossSpiderQueenEnemyServer", "Ran RFS");
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(10, 15));
}
@@ -553,26 +509,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
@@ -622,7 +558,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);
}
}
}
@@ -670,17 +605,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

@@ -5,6 +5,8 @@
#include "GameMessages.h"
#include "SkillComponent.h"
#include "BaseCombatAIComponent.h"
#include "EntityInfo.h"
#include "eAninmationFlags.h"
void AmDarklingDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0);
@@ -63,10 +65,11 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
self->SetVar<int32_t>(u"weakpoint", 2);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", 1);
@@ -131,7 +134,9 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
}
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<int32_t>(u"weakspot", -1);
GameMessages::SendNotifyObject(self->GetObjectID(), self->GetObjectID(), u"DragonRevive", UNASSIGNED_SYSTEM_ADDRESS);
}

View File

@@ -3,6 +3,8 @@
#include "SkillComponent.h"
#include "BaseCombatAIComponent.h"
#include "DestroyableComponent.h"
#include "eAninmationFlags.h"
#include "EntityInfo.h"
void FvMaelstromDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0);
@@ -59,8 +61,6 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
Game::logger->Log("FvMaelstromDragon", "Hit %i", destroyableComponent->GetArmor());
if (destroyableComponent->GetArmor() > 0) return;
auto weakpoint = self->GetVar<int32_t>(u"weakpoint");
@@ -80,10 +80,12 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
self->SetVar<int32_t>(u"weakpoint", 2);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", 1);
@@ -150,8 +152,9 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<int32_t>(u"weakspot", -1);
GameMessages::SendNotifyObject(self->GetObjectID(), self->GetObjectID(), u"DragonRevive", UNASSIGNED_SYSTEM_ADDRESS);

View File

@@ -3,7 +3,9 @@
#include "DestroyableComponent.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "SkillComponent.h"
#include "eAninmationFlags.h"
void BaseEnemyApe::OnStartup(Entity* self) {
self->SetVar<uint32_t>(u"timesStunned", 2);
@@ -31,9 +33,12 @@ void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
StunApe(self, true);
self->CancelTimer("spawnQBTime");
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent) {
skillComponent->Reset();
}
GameMessages::SendPlayAnimation(self, u"disable", 1.7f);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
? self->GetVar<float_t>(u"reviveTime") : 12.0f;
self->AddTimer("reviveTime", reviveTime);
@@ -50,6 +55,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
}
EntityManager::Instance()->SerializeEntity(self);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1);
StunApe(self, false);
@@ -125,7 +131,7 @@ void BaseEnemyApe::StunApe(Entity* self, bool stunState) {
skillComponent->Interrupt();
}
GameMessages::SendSetStunned(self->GetObjectID(), stunState ? PUSH : POP, UNASSIGNED_SYSTEM_ADDRESS, self->GetObjectID(),
GameMessages::SendSetStunned(self->GetObjectID(), stunState ? eStateChangeType::PUSH : eStateChangeType::POP, UNASSIGNED_SYSTEM_ADDRESS, self->GetObjectID(),
true, true, true, true, true,
true, true, true, true);

View File

@@ -3,8 +3,10 @@
#include "ControllablePhysicsComponent.h"
#include "EntityManager.h"
#include "dpWorld.h"
#include "EntityInfo.h"
#include "GeneralUtils.h"
#include "DestroyableComponent.h"
#include "eReplicaComponentType.h"
void BaseEnemyMech::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
@@ -14,7 +16,7 @@ void BaseEnemyMech::OnStartup(Entity* self) {
}
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
if (!controlPhys) return;
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };

View File

@@ -2,6 +2,7 @@
#include "ScriptedActivityComponent.h"
#include "TeamManager.h"
#include "EntityManager.h"
#include "Loot.h"
void TreasureChestDragonServer::OnStartup(Entity* self) {

View File

@@ -2,7 +2,9 @@
#include "EntityManager.h"
#include "RenderComponent.h"
#include "MissionComponent.h"
#include "MissionTaskType.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "Loot.h"
void BootyDigServer::OnStartup(Entity* self) {
auto* zoneControlObject = EntityManager::Instance()->GetZoneControlEntity();
@@ -36,8 +38,8 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
auto* mission = missionComponent->GetMission(1881);
if (mission != nullptr && (mission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE || mission->GetMissionState() == MissionState::MISSION_STATE_COMPLETE_ACTIVE)) {
mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
if (mission != nullptr && (mission->GetMissionState() == eMissionState::ACTIVE || mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) {
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
auto* renderComponent = self->GetComponent<RenderComponent>();
if (renderComponent != nullptr)

View File

@@ -3,6 +3,7 @@
#include "GeneralUtils.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
void MaestromExtracticatorServer::OnStartup(Entity* self) {
//self:SetNetworkVar("current_anim", failAnim)
@@ -24,7 +25,7 @@ void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* se
auto missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, 14718);
missionComponent->Progress(eMissionTaskType::SMASH, 14718);
CollectSample(self, sender->GetObjectID());
sender->ScheduleKillAfterUpdate();
}

View File

@@ -3,6 +3,7 @@
#include "GameMessages.h"
#include "Character.h"
#include "EntityManager.h"
#include "eReplicaComponentType.h"
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
//Tell the client to spawn the baby spiderling:
@@ -19,7 +20,7 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
character->SetPlayerFlag(74, true);
//Remove the maelstrom cube:
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
auto inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
if (inv) {
inv->RemoveItem(14553, 1);

View File

@@ -5,12 +5,14 @@
#include "EntityManager.h"
#include "AgMonumentLaserServer.h"
#include "EntityManager.h"
#include "ePhysicsEffectType.h"
#include "eReplicaComponentType.h"
void AgLaserSensorServer::OnStartup(Entity* self) {
PhantomPhysicsComponent* physComp = static_cast<PhantomPhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
PhantomPhysicsComponent* physComp = static_cast<PhantomPhysicsComponent*>(self->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
physComp->SetPhysicsEffectActive(true);
physComp->SetEffectType(2); // repulse (prolly should make definitions of these are in Entity.cpp)
physComp->SetEffectType(ePhysicsEffectType::REPULSE);
physComp->SetDirectionalMultiplier(static_cast<float>(m_RepelForce));
physComp->SetDirection(NiPoint3::UNIT_Y);
@@ -25,7 +27,7 @@ void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
Entity* laser = nullptr;
for (auto script : EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPT)) {
for (auto script : EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT)) {
AgMonumentLaserServer* hasLaser = (AgMonumentLaserServer*)script;

View File

@@ -7,9 +7,9 @@ void AgMonumentRaceGoal::OnStartup(Entity* self) {
}
void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (name == "RaceGoal" && entering->IsPlayer() && status == "ENTER") {
auto* manager = EntityManager::Instance()->GetEntitiesInGroup("race_manager")[0];
manager->OnFireEventServerSide(entering, "course_finish");
if (name == "RaceGoal" && entering && entering->IsPlayer() && status == "ENTER") {
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
if (managers.empty() || !managers.at(0)) return;
managers.at(0)->OnFireEventServerSide(entering, "course_finish");
}
}

View File

@@ -3,6 +3,8 @@
#include "ScriptedActivityComponent.h"
#include "GameMessages.h"
#include "LeaderboardManager.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "MissionComponent.h"
#include <ctime>
@@ -89,7 +91,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
auto* missionComponent = sender->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->ForceProgressTaskType(1884, 1, 1, false);
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, -finish, self->GetObjectID(),
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, -finish, self->GetObjectID(),
"performact_time");
}

View File

@@ -1,8 +1,8 @@
#include "NpcCowboyServer.h"
#include "MissionState.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1880) {
return;
}
@@ -13,14 +13,14 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
return;
}
if (missionState == MissionState::MISSION_STATE_COMPLETE_ACTIVE ||
missionState == MissionState::MISSION_STATE_ACTIVE ||
missionState == MissionState::MISSION_STATE_AVAILABLE ||
missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) {
if (missionState == eMissionState::COMPLETE_ACTIVE ||
missionState == eMissionState::ACTIVE ||
missionState == eMissionState::AVAILABLE ||
missionState == eMissionState::COMPLETE_AVAILABLE) {
if (inventoryComponent->GetLotCount(14378) == 0) {
inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_NONE);
}
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(14378, 1);
}
}

View File

@@ -3,5 +3,5 @@
class NpcCowboyServer : public CppScripts::Script
{
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -1,7 +1,7 @@
#include "NpcEpsilonServer.h"
#include "GameMessages.h"
void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
//If we are completing the Nexus Force join mission, play the celebration for it:
if (missionID == 1851) {

View File

@@ -2,6 +2,6 @@
#include "CppScripts.h"
class NpcEpsilonServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
};

View File

@@ -3,25 +3,27 @@
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "Item.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != mailMission) return;
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"switch", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress());
auto* inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
auto* inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
// If we are ready to complete our missions, we take the kit from you:
if (inv && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (inv && missionState == eMissionState::READY_TO_COMPLETE) {
auto* id = inv->FindItemByLot(14397); //the kit's lot
if (id != nullptr) {
inv->RemoveItem(id->GetLot(), id->GetCount());
}
}
} else if (missionState == MissionState::MISSION_STATE_AVAILABLE) {
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
} else if (missionState == eMissionState::AVAILABLE) {
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
missionComponent->CompleteMission(mailAchievement, true);
}
}

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
class NpcNjAssistantServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
private:
int mailMission = 1728; //mission to get the item out of your mailbox

View File

@@ -1,16 +1,17 @@
#include "NpcPirateServer.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* inventory = target->GetComponent<InventoryComponent>();
if (inventory != nullptr && missionID == 1881) {
auto* luckyShovel = inventory->FindItemByLot(14591);
// Add or remove the lucky shovel based on whether the mission was completed or started
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
&& luckyShovel == nullptr) {
inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(14591, 1);
}
}

View File

@@ -2,5 +2,5 @@
#include "CppScripts.h"
class NpcPirateServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -3,8 +3,9 @@
#include "EntityManager.h"
#include "Entity.h"
#include "GameMessages.h"
#include "eMissionState.h"
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1849 && missionID != 1883)
return;
@@ -16,16 +17,16 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
auto* maelstromVacuum = inventory->FindItemByLot(maelstromVacuumLot);
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
if (missionID == 1883 && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
&& maelstromVacuum == nullptr) {
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(maelstromVacuumLot, 1);
}
// Next up hide or show the samples based on the mission state
auto visible = 1;
if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
visible = 0;
}

View File

@@ -2,5 +2,5 @@
#include "CppScripts.h"
class NpcWispServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
};

View File

@@ -1,7 +1,9 @@
#include "RemoveRentalGear.h"
#include "InventoryComponent.h"
#include "Item.h"
#include "eMissionState.h"
#include "Character.h"
#include "eReplicaComponentType.h"
/*
--------------------------------------------------------------
@@ -16,11 +18,11 @@
--------------------------------------------------------------
*/
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != defaultMission && missionID != 313) return;
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
auto inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
auto inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return;
//remove the inventory items

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
class RemoveRentalGear : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
private:
int defaultMission = 768; //mission to remove gearSets on completion

View File

@@ -3,6 +3,7 @@
#include "EntityManager.h"
#include "ZoneAgProperty.h"
#include "DestroyableComponent.h"
#include "EntityInfo.h"
void ZoneAgSpiderQueen::SetGameVariables(Entity* self) {
ZoneAgProperty::SetGameVariables(self);

View File

@@ -1,6 +1,7 @@
#include "AmBlueX.h"
#include "SkillComponent.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "Character.h"
void AmBlueX::OnUse(Entity* self, Entity* user) {

View File

@@ -3,6 +3,7 @@
#include "RebuildComponent.h"
#include "InventoryComponent.h"
#include "dZoneManager.h"
#include "eMissionState.h"
void AmDropshipComputer::OnStartup(Entity* self) {
self->AddTimer("reset", 45.0f);
@@ -22,7 +23,7 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
return;
}
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == MissionState::MISSION_STATE_COMPLETE) {
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == eMissionState::COMPLETE) {
return;
}

View File

@@ -2,6 +2,7 @@
#include "EntityManager.h"
#include "DestroyableComponent.h"
#include "GameMessages.h"
#include "EntityInfo.h"
#include "MovementAIComponent.h"
#include "BaseCombatAIComponent.h"
#include "SkillComponent.h"

View File

@@ -5,6 +5,7 @@
#include "MovementAIComponent.h"
#include "BaseCombatAIComponent.h"
#include "SkillComponent.h"
#include "EntityInfo.h"
#include "RebuildComponent.h"
#include "MissionComponent.h"

View File

@@ -4,6 +4,7 @@
#include "DestroyableComponent.h"
#include "ProximityMonitorComponent.h"
#include "MissionComponent.h"
#include "EntityInfo.h"
void AmSkullkinDrill::OnStartup(Entity* self) {
self->SetNetworkVar(u"bIsInUse", false);
@@ -146,21 +147,21 @@ void AmSkullkinDrill::OnUse(Entity* self, Entity* user) {
}
void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
eStunState eChangeType = POP;
auto StateChangeType = eStateChangeType::POP;
if (bFreeze) {
if (player->GetIsDead()) {
return;
}
eChangeType = PUSH;
StateChangeType = eStateChangeType::PUSH;
} else {
if (player->GetIsDead()) {
//
}
}
GameMessages::SendSetStunned(player->GetObjectID(), eChangeType, player->GetSystemAddress(), self->GetObjectID(),
GameMessages::SendSetStunned(player->GetObjectID(), StateChangeType, player->GetSystemAddress(), self->GetObjectID(),
true, false, true, false, true, false, true
);
}

View File

@@ -2,6 +2,7 @@
#include "EntityManager.h"
#include "DestroyableComponent.h"
#include "MovingPlatformComponent.h"
#include "EntityInfo.h"
#include "GameMessages.h"
#include "MissionComponent.h"

View File

@@ -1,14 +1,21 @@
#include "AmTeapotServer.h"
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "Item.h"
void AmTeapotServer::OnUse(Entity* self, Entity* user) {
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (!inventoryComponent) return;
if (inventoryComponent->GetLotCount(BLUE_FLOWER_LEAVES) >= 10) {
inventoryComponent->RemoveItem(BLUE_FLOWER_LEAVES, 10);
auto* blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::ITEMS);
if (!blueFlowerItem) {
blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::VAULT_ITEMS);
if (!blueFlowerItem) return;
}
// The client allows you to use the teapot only if you have a stack of 10 leaves in some inventory somewhere.
if (blueFlowerItem->GetCount() >= 10) {
blueFlowerItem->SetCount(blueFlowerItem->GetCount() - 10);
inventoryComponent->AddItem(WU_S_IMAGINATION_TEA, 1);
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());

View File

@@ -1,6 +1,7 @@
#include "EnemyRoninSpawner.h"
#include "SkillComponent.h"
#include "RenderComponent.h"
#include "EntityInfo.h"
#include "EntityManager.h"
void EnemyRoninSpawner::OnStartup(Entity* self) {

View File

@@ -1,11 +1,12 @@
#include "FvCandle.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eReplicaComponentType.h"
std::vector<int32_t> FvCandle::m_Missions = { 850, 1431, 1529, 1566, 1603 };
void FvCandle::OnStartup(Entity* self) {
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;
@@ -22,7 +23,7 @@ void FvCandle::BlowOutCandle(Entity* self, Entity* blower) {
if (self->GetBoolean(u"AmHit"))
return;
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;
@@ -46,7 +47,7 @@ void FvCandle::BlowOutCandle(Entity* self, Entity* blower) {
void FvCandle::OnTimerDone(Entity* self, std::string timerName) {
self->SetBoolean(u"AmHit", false);
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;

View File

@@ -1,9 +1,9 @@
#include "FvFong.h"
#include "Darkitect.h"
#include "MissionState.h"
#include "eMissionState.h"
void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
if (missionID == 734 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID == 734 && missionState == eMissionState::READY_TO_COMPLETE) {
Darkitect Baron;
Baron.Reveal(self, target);
}

View File

@@ -4,5 +4,5 @@
class FvFong : public CppScripts::Script
{
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -4,6 +4,7 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
int32_t ImgBrickConsoleQB::ResetBricks = 30;
@@ -71,13 +72,13 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
if (missionComponent != nullptr && inventoryComponent != nullptr) {
if (missionComponent->GetMissionState(1302) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(1302) == eMissionState::ACTIVE) {
inventoryComponent->RemoveItem(13074, 1);
missionComponent->ForceProgressTaskType(1302, 1, 1);
}
if (missionComponent->GetMissionState(1926) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(1926) == eMissionState::ACTIVE) {
inventoryComponent->RemoveItem(14472, 1);
missionComponent->ForceProgressTaskType(1926, 1, 1);

View File

@@ -13,7 +13,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
self->SetVar<bool>(u"bIsInUse", true);
self->SetNetworkVar<bool>(u"bIsInUse", true);
GameMessages::SendSetStunned(user->GetObjectID(), PUSH, user->GetSystemAddress(),
GameMessages::SendSetStunned(user->GetObjectID(), eStateChangeType::PUSH, user->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
);
@@ -63,7 +63,7 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");
} else if (timerName == "cinematicTimer") {
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
);

View File

@@ -3,6 +3,8 @@
#include "EntityManager.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
void GfTikiTorch::OnStartup(Entity* self) {
LightTorch(self);
@@ -41,7 +43,7 @@ void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {
}
void GfTikiTorch::LightTorch(Entity* self) {
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (renderComponent == nullptr)
return;
@@ -65,7 +67,7 @@ void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::str
auto* casterMissionComponent = caster->GetComponent<MissionComponent>();
if (casterMissionComponent != nullptr) {
for (const auto missionID : m_missions) {
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
}
}

View File

@@ -2,6 +2,8 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "Preconditions.h"
#include "eEndBehavior.h"
#include "DestroyableComponent.h"
#ifdef _WIN32
#define _USE_MATH_DEFINES
@@ -16,9 +18,11 @@ void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) {
if (Preconditions::Check(target, 154) && Preconditions::Check(target, 44)) {
self->SetVar<LWOOBJID>(u"userID", target->GetObjectID());
GameMessages::SendSetStunned(target->GetObjectID(), PUSH, target->GetSystemAddress(),
GameMessages::SendSetStunned(target->GetObjectID(), eStateChangeType::PUSH, target->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true
);
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::PUSH, true, true, true, true, true, false, false, true, true);
self->AddTimer("Start", 3);
}
@@ -49,13 +53,13 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
if (!cinematic.empty()) {
GameMessages::SendPlayCinematic(playerId, GeneralUtils::ASCIIToUTF16(cinematic), player->GetSystemAddress(),
true, true, false, false, 0, false, leanIn
true, true, false, false, eEndBehavior::RETURN, false, leanIn
);
}
GameMessages::SendPlayFXEffect(playerId, 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
GameMessages::SendPlayAnimation(player, u"crow-swing-no-equip");
GameMessages::SendPlayAnimation(player, u"crow-swing-no-equip", 4.0f);
GameMessages::SendPlayAnimation(self, u"swing");
@@ -81,8 +85,11 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendTeleport(playerId, position, NiQuaternion::IDENTITY, player->GetSystemAddress());
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true
);
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::POP, true, true, true, true, true, false, false, true, true);
EntityManager::Instance()->SerializeEntity(player);
}
}

View File

@@ -1,5 +1,7 @@
#include "BankInteractServer.h"
#include "GameMessages.h"
#include "Entity.h"
#include "AMFFormat.h"
void BankInteractServer::OnUse(Entity* self, Entity* user) {
AMFArrayValue args;

View File

@@ -3,6 +3,7 @@
#include "GameMessages.h"
#include "MissionComponent.h"
#include "SkillComponent.h"
#include "eMissionTaskType.h"
//TODO: this has to be updated so that you only get killed if you're in a certain radius.
//And so that all entities in a certain radius are killed, not just the attacker.
@@ -51,14 +52,14 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
if (missionComponent != nullptr) {
if (missionID != 0) {
missionComponent->ForceProgressValue(missionID,
static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT),
static_cast<uint32_t>(eMissionTaskType::SCRIPT),
self->GetLOT(), false);
}
if (!achievementIDs.empty()) {
for (const auto& achievementID : GeneralUtils::SplitString(achievementIDs, u'_')) {
missionComponent->ForceProgressValue(std::stoi(GeneralUtils::UTF16ToWTF8(achievementID)),
static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT),
static_cast<uint32_t>(eMissionTaskType::SCRIPT),
self->GetLOT());
}
}

View File

@@ -1,6 +1,7 @@
#include "ForceVolumeServer.h"
#include "PhantomPhysicsComponent.h"
#include "EntityManager.h"
#include "ePhysicsEffectType.h"
void ForceVolumeServer::OnStartup(Entity* self) {
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
@@ -12,7 +13,7 @@ void ForceVolumeServer::OnStartup(Entity* self) {
const auto forceY = self->GetVar<float>(u"ForceY");
const auto forceZ = self->GetVar<float>(u"ForceZ");
phantomPhysicsComponent->SetEffectType(0); // PUSH
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::PUSH);
phantomPhysicsComponent->SetDirectionalMultiplier(forceAmount);
phantomPhysicsComponent->SetDirection({ forceX, forceY, forceZ });
phantomPhysicsComponent->SetPhysicsEffectActive(true);

View File

@@ -1,5 +1,8 @@
#include "GrowingFlower.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "Loot.h"
void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::string& message) {
if (!self->GetVar<bool>(u"blooming") && (message == "waterspray" || message == "shovelgrow")) {
@@ -15,13 +18,13 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
for (const auto mission : achievementIDs)
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
if (mission1 && missionComponent->GetMissionState(mission1) == MissionState::MISSION_STATE_ACTIVE)
missionComponent->ForceProgressTaskType(mission1, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
if (mission1 && missionComponent->GetMissionState(mission1) == eMissionState::ACTIVE)
missionComponent->ForceProgressTaskType(mission1, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
if (mission2 && missionComponent->GetMissionState(mission2) == MissionState::MISSION_STATE_ACTIVE)
missionComponent->ForceProgressTaskType(mission2, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
if (mission2 && missionComponent->GetMissionState(mission2) == eMissionState::ACTIVE)
missionComponent->ForceProgressTaskType(mission2, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
}
}
}

View File

@@ -1,6 +1,8 @@
#include "ImaginationBackpackHealServer.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
if (message == "CastImaginationBackpack") {
@@ -11,8 +13,8 @@ void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* cast
return;
auto* missionComponent = caster->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == MissionState::MISSION_STATE_ACTIVE) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == eMissionState::ACTIVE) {
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ClearMaelstrom", 0, 0,
caster->GetObjectID(), "", caster->GetSystemAddress());
}

View File

@@ -4,6 +4,8 @@
#include "EntityManager.h"
#include "Character.h"
#include "PetComponent.h"
#include "User.h"
#include "eMissionState.h"
std::vector<LWOOBJID> PetDigServer::treasures{};
@@ -162,13 +164,13 @@ void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* che
if (missionComponent != nullptr) {
// Can You Dig It progress
const auto digMissionState = missionComponent->GetMissionState(843);
if (digMissionState == MissionState::MISSION_STATE_ACTIVE) {
if (digMissionState == eMissionState::ACTIVE) {
missionComponent->ForceProgress(843, 1216, 1);
}
// Pet Excavator progress
const auto excavatorMissionState = missionComponent->GetMissionState(505);
if (excavatorMissionState == MissionState::MISSION_STATE_ACTIVE) {
if (excavatorMissionState == eMissionState::ACTIVE) {
if (chest->HasVar(u"PetDig")) {
int32_t playerFlag = 1260 + chest->GetVarAs<int32_t>(u"PetDig");
Character* player = owner->GetCharacter();
@@ -192,7 +194,7 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
// Some treasures require a mission to be active
if (digInfo.requiredMission >= 0) {
auto* missionComponent = owner->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < eMissionState::ACTIVE) {
return;
}
}

View File

@@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void PropertyDevice::OnStartup(Entity* self) {
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
@@ -17,7 +18,7 @@ void PropertyDevice::OnRebuildComplete(Entity* self, Entity* target) {
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
if (missionComponent->GetMissionState(m_PropertyMissionID) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(m_PropertyMissionID) == eMissionState::ACTIVE) {
GameMessages::SendPlayFXEffect(self->GetObjectID(), 641, u"create", "callhome");
missionComponent->ForceProgress(m_PropertyMissionID, 1793, self->GetLOT());
}

View File

@@ -1,6 +1,7 @@
#include "PropertyPlatform.h"
#include "RebuildComponent.h"
#include "GameMessages.h"
#include "MovingPlatformComponent.h"
void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
@@ -9,7 +10,7 @@ void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
// movingPlatform->SetNoAutoStart(true);
// }
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
0, 0, MovementPlatformState::Stationary);
0, 0, eMovementPlatformState::Stationary);
}
void PropertyPlatform::OnUse(Entity* self, Entity* user) {
@@ -20,7 +21,7 @@ void PropertyPlatform::OnUse(Entity* self, Entity* user) {
// movingPlatform->GotoWaypoint(1);
// }
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
1, 1, MovementPlatformState::Moving);
1, 1, eMovementPlatformState::Moving);
self->AddCallbackTimer(movementDelay + effectDelay, [self, this]() {
self->SetNetworkVar<float_t>(u"startEffect", dieDelay);

View File

@@ -1,7 +1,11 @@
#include "QbEnemyStunner.h"
#include "SkillComponent.h"
#include "CDClientManager.h"
#include "DestroyableComponent.h"
#include "CDObjectSkillsTable.h"
#include "CDSkillBehaviorTable.h"
void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
auto* destroyable = self->GetComponent<DestroyableComponent>();
@@ -13,12 +17,12 @@ void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
if (!skillComponent) return;
// Get the skill IDs of this object.
CDObjectSkillsTable* skillsTable = CDClientManager::Instance()->GetTable<CDObjectSkillsTable>("ObjectSkills");
CDObjectSkillsTable* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
auto skills = skillsTable->Query([=](CDObjectSkills entry) {return (entry.objectTemplate == self->GetLOT()); });
std::map<uint32_t, uint32_t> skillBehaviorMap;
// For each skill, cast it with the associated behavior ID.
for (auto skill : skills) {
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
CDSkillBehavior behaviorData = skillBehaviorTable->GetSkillByID(skill.skillID);
skillBehaviorMap.insert(std::make_pair(skill.skillID, behaviorData.behaviorID));

View File

@@ -1,5 +1,6 @@
#include "QbSpawner.h"
#include "BaseCombatAIComponent.h"
#include "EntityInfo.h"
#include "MovementAIComponent.h"
void QbSpawner::OnStartup(Entity* self) {
@@ -133,4 +134,3 @@ void QbSpawner::AggroTargetObject(Entity* self, Entity* enemy) {
}
}

View File

@@ -2,11 +2,12 @@
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "Character.h"
#include "eReplicaComponentType.h"
//2021-05-03 - max - added script, omitted some parts related to inheritance in lua which we don't need
void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
auto* inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
auto* inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
//make sure the user has the required amount of infected bricks
if (inv && inv->GetLotCount(6194) >= bricksToTake) {

View File

@@ -3,6 +3,8 @@
#include "Entity.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void TouchMissionUpdateServer::OnStartup(Entity* self) {
self->SetProximityRadius(20, "touchCheck"); // Those does not have a collider for some reason?
@@ -15,7 +17,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target)
return;
}
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
if (missionComponent == nullptr) {
return;
@@ -29,7 +31,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target)
const auto state = mission->GetMissionState();
if (state >= MissionState::MISSION_STATE_COMPLETE || mission->GetCompletions() > 1) {
if (state >= eMissionState::COMPLETE || mission->GetCompletions() > 1) {
return;
}

View File

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

View File

@@ -1,4 +1,5 @@
#include "NsConcertChoiceBuildManager.h"
#include "EntityInfo.h"
#include "EntityManager.h"
const std::vector<Crate> NsConcertChoiceBuildManager::crates{

View File

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

View File

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

View File

@@ -439,7 +439,7 @@ std::vector<Wave> ZoneNsWaves::GetWaves() {
5.0f,
(uint32_t)-1,
true,
30,
60,
},
};
}

View File

@@ -1,6 +1,8 @@
#pragma once
#include "BaseWavesServer.h"
#include "dCommonVars.h"
enum SpawnerName {
interior_A,
interior_B,

View File

@@ -2,6 +2,9 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "eEndBehavior.h"
void NtAssemblyTubeServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
@@ -22,7 +25,7 @@ void NtAssemblyTubeServer::OnProximityUpdate(Entity* self, Entity* entering, std
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
@@ -36,14 +39,14 @@ void NtAssemblyTubeServer::RunAssemblyTube(Entity* self, Entity* player) {
if (player->IsPlayer() && !bPlayerBeingTeleported) {
auto teleCinematic = self->GetVar<std::u16string>(u"Cinematic");
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
if (!teleCinematic.empty()) {
const auto teleCinematicUname = teleCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), teleCinematicUname, player->GetSystemAddress(),
true, true, true, false, 0, false, -1, false, true
true, true, true, false, eEndBehavior::RETURN, false, -1, false, true
);
}
@@ -108,7 +111,7 @@ void NtAssemblyTubeServer::UnlockPlayer(Entity* self, Entity* player) {
m_TeleportingPlayerTable[playerID] = false;
GameMessages::SendSetStunned(playerID, POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
}

View File

@@ -1,6 +1,7 @@
#include "NtCombatChallengeServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"

View File

@@ -1,6 +1,7 @@
#include "NtDukeServer.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 35.0f);
@@ -19,7 +20,7 @@ void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<std::vector<LWOOBJID>>(m_SpyCinematicObjectsVariable, { self->GetObjectID() });
}
void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
// Handles adding and removing the sword for the Crux Prime Sword mission
auto* missionComponent = target->GetComponent<MissionComponent>();
@@ -29,9 +30,9 @@ void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int mission
auto state = missionComponent->GetMissionState(m_SwordMissionID);
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) {
if ((state == eMissionState::AVAILABLE || state == eMissionState::ACTIVE) && lotCount < 1) {
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
} else if (state == eMissionState::READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
}
}

View File

@@ -3,7 +3,7 @@
class NtDukeServer : public NtFactionSpyServer {
void SetVariables(Entity* self) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
const uint32_t m_SwordMissionID = 1448;
const LOT m_SwordLot = 13777;
};

View File

@@ -3,6 +3,7 @@
#include "MissionComponent.h"
#include "EntityManager.h"
#include "Character.h"
#include "eMissionState.h"
void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress());
@@ -16,7 +17,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
const auto playerID = user->GetObjectID();
for (const auto mission : tPlayerOnMissions) {
if (missionComponent->GetMissionState(mission) != MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(mission) != eMissionState::ACTIVE) {
continue;
}
@@ -34,11 +35,11 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayAnimation(player, u"rebuild-celebrate");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SparkStop", 0, 0, player->GetObjectID(), "", player->GetSystemAddress());
GameMessages::SendSetStunned(player->GetObjectID(), eStunState::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
self->SetVar(u"bActive", false);
});
GameMessages::SendPlayAnimation(user, u"nexus-powerpanel", 6.0f);
GameMessages::SendSetStunned(user->GetObjectID(), eStunState::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
GameMessages::SendSetStunned(user->GetObjectID(), eStateChangeType::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
return;
}

View File

@@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
void NtParadoxTeleServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
@@ -22,7 +23,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
const auto bPlayerBeingTeleported = m_TeleportingPlayerTable[playerID];
if (player->IsPlayer() && !bPlayerBeingTeleported) {
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
@@ -44,7 +45,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
@@ -100,7 +101,7 @@ void NtParadoxTeleServer::UnlockPlayer(Entity* self, Entity* player) {
m_TeleportingPlayerTable[playerID] = false;
GameMessages::SendSetStunned(playerID, POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);

View File

@@ -2,6 +2,8 @@
#include "PhantomPhysicsComponent.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "ePhysicsEffectType.h"
void NtSentinelWalkwayServer::OnStartup(Entity* self) {
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
@@ -18,7 +20,7 @@ void NtSentinelWalkwayServer::OnStartup(Entity* self) {
const auto forward = self->GetRotation().GetRightVector() * -1;
phantomPhysicsComponent->SetEffectType(0); // PUSH
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::PUSH);
phantomPhysicsComponent->SetDirectionalMultiplier(force);
phantomPhysicsComponent->SetDirection(forward);
phantomPhysicsComponent->SetPhysicsEffectActive(true);
@@ -38,6 +40,6 @@ void NtSentinelWalkwayServer::OnProximityUpdate(Entity* self, Entity* entering,
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}

View File

@@ -1,10 +1,11 @@
#include "NtVandaServer.h"
#include "InventoryComponent.h"
#include "eMissionState.h"
void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
// Removes the alien parts after completing the mission
if (missionID == m_AlienPartMissionID && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (missionID == m_AlienPartMissionID && missionState == eMissionState::READY_TO_COMPLETE) {
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
for (const auto& alienPartLot : m_AlienPartLots) {
inventoryComponent->RemoveItem(alienPartLot, 1);

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
class NtVandaServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
const uint32_t m_AlienPartMissionID = 1183;
const std::vector<LOT> m_AlienPartLots = { 12479, 12480, 12481 };
};

View File

@@ -1,6 +1,7 @@
#include "NtVentureCannonServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "eEndBehavior.h"
void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
auto* player = user;
@@ -14,7 +15,7 @@ void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
self->SetNetworkVar(u"bIsInUse", true);
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
@@ -73,7 +74,7 @@ void NtVentureCannonServer::EnterCannonEnded(Entity* self, Entity* player) {
const auto exitCinematicUname = exitCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), exitCinematicUname, player->GetSystemAddress(),
true, true, true, false, 0, false, 0, false, false
true, true, true, false, eEndBehavior::RETURN, false, 0, false, false
);
self->AddCallbackTimer(1.5f, [this, self, playerID]() {
@@ -92,7 +93,7 @@ void NtVentureCannonServer::ExitCannonEnded(Entity* self, Entity* player) {
}
void NtVentureCannonServer::UnlockCannonPlayer(Entity* self, Entity* player) {
GameMessages::SendSetStunned(player->GetObjectID(), POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);

View File

@@ -1,6 +1,7 @@
#include "NtVentureSpeedPadServer.h"
#include "SkillComponent.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
void NtVentureSpeedPadServer::OnStartup(Entity* self) {
self->SetProximityRadius(3, "speedboost");
@@ -17,7 +18,7 @@ void NtVentureSpeedPadServer::OnProximityUpdate(Entity* self, Entity* entering,
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
auto* skillComponent = player->GetComponent<SkillComponent>();

View File

@@ -2,6 +2,7 @@
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void SpawnGryphonServer::SetVariables(Entity* self) {
self->SetVar<LOT>(u"petLOT", 12433);
@@ -17,7 +18,7 @@ void SpawnGryphonServer::OnUse(Entity* self, Entity* user) {
// Little extra for handling the case of the egg being placed the first time
if (missionComponent != nullptr && inventoryComponent != nullptr
&& missionComponent->GetMissionState(1391) == MissionState::MISSION_STATE_ACTIVE) {
&& missionComponent->GetMissionState(1391) == eMissionState::ACTIVE) {
inventoryComponent->RemoveItem(12483, inventoryComponent->GetLotCount(12483));
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
return;

View File

@@ -1,7 +1,9 @@
#include "EnemySpiderSpawner.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "DestroyableComponent.h"
#include "eReplicaComponentType.h"
//----------------------------------------------
//--Initiate egg hatching on call
@@ -13,7 +15,7 @@ void EnemySpiderSpawner::OnFireEventServerSide(Entity* self, Entity* sender, std
GameMessages::SendPlayFXEffect(self->GetObjectID(), 2856, u"maelstrom", "test", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
// Make indestructible
auto dest = static_cast<DestroyableComponent*>(self->GetComponent(COMPONENT_TYPE_DESTROYABLE));
auto dest = static_cast<DestroyableComponent*>(self->GetComponent(eReplicaComponentType::DESTROYABLE));
if (dest) {
dest->SetFaction(-1);
}

View File

@@ -6,6 +6,8 @@
#include "dZoneManager.h"
#include "RenderComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void ZoneAgProperty::SetGameVariables(Entity* self) {
self->SetVar<std::string>(GuardGroup, "Guard");
@@ -80,7 +82,7 @@ void ZoneAgProperty::PropGuardCheck(Entity* self, Entity* player) {
const auto state = missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag));
const auto firstState = missionComponent->GetMissionState(self->GetVar<uint32_t>(guardFirstMissionFlag));
if (firstState < MissionState::MISSION_STATE_COMPLETE || (state != MissionState::MISSION_STATE_COMPLETE && state != MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE))
if (firstState < eMissionState::COMPLETE || (state != eMissionState::COMPLETE && state != eMissionState::COMPLETE_READY_TO_COMPLETE))
ActivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
}
@@ -255,7 +257,7 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
DeactivateSpawner(self->GetVar<std::string>(SpiderScreamSpawner));
DestroySpawner(self->GetVar<std::string>(SpiderScreamSpawner));
for (auto* player : EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CHARACTER)) {
for (auto* player : EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CHARACTER)) {
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
}
@@ -304,13 +306,13 @@ void ZoneAgProperty::OnZonePropertyModelPlaced(Entity* self, Entity* player) {
if (!character->GetPlayerFlag(101)) {
BaseZonePropertyModelPlaced(self, player);
character->SetPlayerFlag(101, true);
if (missionComponent->GetMissionState(871) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(871) == eMissionState::ACTIVE) {
self->SetNetworkVar<std::u16string>(u"Tooltip", u"AnotherModel");
}
} else if (!character->GetPlayerFlag(102)) {
character->SetPlayerFlag(102, true);
if (missionComponent->GetMissionState(871) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(871) == eMissionState::ACTIVE) {
self->SetNetworkVar<std::u16string>(u"Tooltip", u"TwoMoreModels");
}
@@ -331,7 +333,7 @@ void ZoneAgProperty::OnZonePropertyModelPickedUp(Entity* self, Entity* player) {
if (!character->GetPlayerFlag(109)) {
character->SetPlayerFlag(109, true);
if (missionComponent->GetMissionState(891) == MissionState::MISSION_STATE_ACTIVE && !character->GetPlayerFlag(110)) {
if (missionComponent->GetMissionState(891) == eMissionState::ACTIVE && !character->GetPlayerFlag(110)) {
self->SetNetworkVar<std::u16string>(u"Tooltip", u"Rotate");
}
}
@@ -353,7 +355,7 @@ void ZoneAgProperty::OnZonePropertyModelRotated(Entity* self, Entity* player) {
if (!character->GetPlayerFlag(110)) {
character->SetPlayerFlag(110, true);
if (missionComponent->GetMissionState(891) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(891) == eMissionState::ACTIVE) {
self->SetNetworkVar<std::u16string>(u"Tooltip", u"PlaceModel");
self->SetVar<std::string>(u"tutorial", "place_model");
}

View File

@@ -1,6 +1,7 @@
#include "PropertyBankInteract.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "AMFFormat.h"
void PropertyBankInteract::OnStartup(Entity* self) {
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();

View File

@@ -1,14 +1,16 @@
#include "SsModularBuildServer.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void SsModularBuildServer::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector<LOT> modules) {
int missionNum = 1732;
if (bCompleted) {
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
Mission* rocketMission = mission->GetMission(missionNum);
if (rocketMission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE) {
if (rocketMission->GetMissionState() == eMissionState::ACTIVE) {
mission->ForceProgress(missionNum, 2478, 1);
}
}

View File

@@ -3,10 +3,11 @@
#include "EntityManager.h"
#include "MissionComponent.h"
#include "GameMessages.h"
#include "eMissionState.h"
void VeBricksampleServer::OnUse(Entity* self, Entity* user) {
auto* missionComponent = user->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == eMissionState::ACTIVE) {
const auto loot = self->GetVar<int32_t>(m_LootVariable);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();

View File

@@ -2,15 +2,17 @@
#include "Character.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "eMissionState.h"
#include "Entity.h"
void VeEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void VeEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* character = target->GetCharacter();
if (character == nullptr)
return;
// Resets the player flags that track which consoles they've used
if ((missionID == m_ConsoleMissionID || missionID == m_ConsoleRepeatMissionID)
&& (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)) {
&& (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)) {
for (auto i = 0; i < 10; i++) {
character->SetPlayerFlag(m_ConsoleBaseFlag + i, false);

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
class VeEpsilonServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
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;

View File

@@ -2,6 +2,7 @@
#include "InventoryComponent.h"
#include "Character.h"
#include "GameMessages.h"
#include "Loot.h"
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
LootGenerator::Instance().DropActivityLoot(user, self, 12551);

View File

@@ -2,6 +2,7 @@
#include "SkillComponent.h"
#include "RenderComponent.h"
#include "EntityManager.h"
#include "EntityInfo.h"
void EnemySkeletonSpawner::OnStartup(Entity* self) {
self->SetProximityRadius(15, "ronin");

View File

@@ -1,6 +1,7 @@
#include "NjColeNPC.h"
#include "MissionComponent.h"
#include "InventoryComponent.h"
#include "eMissionState.h"
void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) {
if (emote != 393) {
@@ -26,10 +27,10 @@ void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) {
missionComponent->ForceProgressTaskType(1818, 1, 1);
}
void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState);
if (missionID == 1818 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (missionID == 1818 && missionState >= eMissionState::READY_TO_COMPLETE) {
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();

View File

@@ -3,5 +3,5 @@
class NjColeNPC : public NjNPCMissionSpinjitzuServer {
void OnEmoteReceived(Entity* self, int32_t emote, Entity* target) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -1,5 +1,8 @@
#include "NjDragonEmblemChestServer.h"
#include "Character.h"
#include "EntityInfo.h"
#include "Loot.h"
#include "Entity.h"
#include "DestroyableComponent.h"
void NjDragonEmblemChestServer::OnUse(Entity* self, Entity* user) {

View File

@@ -1,6 +1,6 @@
#include "NjJayMissionItems.h"
void NjJayMissionItems::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NjJayMissionItems::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState);
NPCAddRemoveItem::OnMissionDialogueOK(self, target, missionID, missionState);
}

View File

@@ -5,6 +5,6 @@
#include <map>
class NjJayMissionItems : public NjNPCMissionSpinjitzuServer, NPCAddRemoveItem {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
std::map<uint32_t, std::vector<ItemSetting>> GetSettings() override;
};

View File

@@ -1,12 +1,12 @@
#include "NjNPCMissionSpinjitzuServer.h"
#include "Character.h"
#include "EntityManager.h"
#include "eMissionState.h"
void NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID,
MissionState missionState) {
void NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
const auto& element = self->GetVar<std::u16string>(ElementVariable);
if (missionID == ElementMissions.at(element) && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (missionID == ElementMissions.at(element) && missionState >= eMissionState::READY_TO_COMPLETE) {
const auto targetID = target->GetObjectID();

View File

@@ -18,7 +18,7 @@ static std::map<std::u16string, uint32_t> ElementMissions = {
class NjNPCMissionSpinjitzuServer : public CppScripts::Script {
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
private:
const std::u16string ElementVariable = u"element";
};

View File

@@ -3,8 +3,9 @@
#include "Character.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "eMissionState.h"
void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
// The Dragon statue daily mission
if (missionID == m_MainDragonMissionID) {
@@ -14,8 +15,8 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, M
return;
switch (missionState) {
case MissionState::MISSION_STATE_AVAILABLE:
case MissionState::MISSION_STATE_COMPLETE_AVAILABLE:
case eMissionState::AVAILABLE:
case eMissionState::COMPLETE_AVAILABLE:
{
// Reset the sub missions
for (const auto& subMissionID : m_SubDragonMissionIDs) {
@@ -33,8 +34,8 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, M
return;
}
case MissionState::MISSION_STATE_READY_TO_COMPLETE:
case MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE:
case eMissionState::READY_TO_COMPLETE:
case eMissionState::COMPLETE_READY_TO_COMPLETE:
{
character->SetPlayerFlag(NJ_WU_SHOW_DAILY_CHEST, true);

View File

@@ -2,7 +2,7 @@
#include "AmTemplateSkillVolume.h"
class NjWuNPC : public AmTemplateSkillVolume {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
const uint32_t m_MainDragonMissionID = 2040;
const std::vector<uint32_t> m_SubDragonMissionIDs = { 2064, 2065, 2066, 2067 };

View File

@@ -1,6 +1,7 @@
#include "RainOfArrows.h"
#include "EntityManager.h"
#include "SkillComponent.h"
#include "EntityInfo.h"
#include "GameMessages.h"
void RainOfArrows::OnStartup(Entity* self) {

View File

@@ -3,6 +3,7 @@
#include "TeamManager.h"
#include "EntityManager.h"
#include "dZoneManager.h"
#include "Loot.h"
void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) {
auto* sac = self->GetComponent<ScriptedActivityComponent>();

View File

@@ -1,5 +1,7 @@
#include "StinkyFishTarget.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "Entity.h"
void StinkyFishTarget::OnStartup(Entity* self) {
auto position = self->GetPosition();
@@ -15,6 +17,7 @@ void StinkyFishTarget::OnSkillEventFired(Entity* self, Entity* caster, const std
self->SetVar<LWOOBJID>(u"player", caster->GetObjectID());
EntityInfo entityInfo{};
entityInfo.lot = SHARK_LOT;
entityInfo.pos = self->GetPosition();
entityInfo.rot = self->GetRotation();
entityInfo.spawnerID = self->GetObjectID();
@@ -34,7 +37,7 @@ void StinkyFishTarget::OnTimerDone(Entity* self, std::string timerName) {
const auto playerID = self->GetVar<LWOOBJID>(u"player");
auto* fish = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"fish"));
if (fish != nullptr) {
if (fish) {
fish->Smash(playerID);
self->Smash(playerID);
}

View File

@@ -2,7 +2,10 @@
#include "CppScripts.h"
class StinkyFishTarget : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
const LOT SHARK_LOT = 8570;
};

View File

@@ -5,6 +5,7 @@
#include "GameMessages.h"
#include <algorithm>
#include "dLogger.h"
#include "Loot.h"
bool ActivityManager::IsPlayerInActivity(Entity* self, LWOOBJID playerID) {
const auto* sac = self->GetComponent<ScriptedActivityComponent>();
@@ -123,7 +124,6 @@ void ActivityManager::ActivityTimerStart(Entity* self, const std::string& timerN
const float_t stopTime) {
auto* timer = new ActivityTimer{ timerName, updateInterval, stopTime };
activeTimers.push_back(timer);
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
}

View File

@@ -15,7 +15,8 @@ void BaseConsoleTeleportServer::BaseOnMessageBoxResponse(Entity* self, Entity* s
if (button == 1) {
GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), player->GetObjectID(),
GameMessages::SendSetStunned(
player->GetObjectID(), eStateChangeType::PUSH, player->GetSystemAddress(), player->GetObjectID(),
true, true, true, true, true, true, true
);
@@ -82,11 +83,10 @@ void BaseConsoleTeleportServer::TransferPlayer(Entity* self, Entity* player, int
return;
}
// Ignoring extra effects for now
/*GameMessages::SendSetStunned(player->GetObjectID(), POP, player->GetSystemAddress(), player->GetObjectID(),
GameMessages::SendSetStunned(
player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), player->GetObjectID(),
true, true, true, true, true, true, true
);*/
);
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());

View File

@@ -8,6 +8,8 @@
#include "RenderComponent.h"
#include "PropertyManagementComponent.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
void BasePropertyServer::SetGameVariables(Entity* self) {
self->SetVar<std::string>(ClaimMarkerGroup, "");
@@ -97,7 +99,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
if (missionComponent != nullptr) {
missionComponent->Progress(
MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY,
eMissionTaskType::VISIT_PROPERTY,
mapID.GetMapID(),
mapID.GetCloneID()
);
@@ -150,7 +152,7 @@ void BasePropertyServer::PropGuardCheck(Entity* self, Entity* player) {
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr
&& missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag)) != MissionState::MISSION_STATE_COMPLETE) {
&& missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag)) != eMissionState::COMPLETE) {
ActivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
}
}
@@ -301,18 +303,8 @@ void BasePropertyServer::ResetSpawner(const std::string& spawnerName) {
void BasePropertyServer::DestroySpawner(const std::string& spawnerName) {
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
for (auto* node : spawner->m_Info.nodes) {
for (const auto& element : node->entities) {
auto* entity = EntityManager::Instance()->GetEntity(element);
if (entity == nullptr)
continue;
entity->Kill();
}
node->entities.clear();
}
if (!spawner) return;
spawner->DestroyAllEntities();
spawner->Deactivate();
}
}

View File

@@ -4,7 +4,8 @@
#include "EntityManager.h"
#include "dZoneManager.h"
#include "Player.h"
#include "MissionTaskType.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "MissionComponent.h"
#include "Character.h"
@@ -361,16 +362,16 @@ void BaseSurvivalServer::GameOver(Entity* self) {
// Update all mission progression
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, time, self->GetObjectID(),
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, time, self->GetObjectID(),
self->GetVar<std::string>(MissionTypeVariable));
for (const auto& survivalMission : missionsToUpdate) {
auto* mission = missionComponent->GetMission(survivalMission.first);
if (mission != nullptr && (uint32_t)time >= survivalMission.second
&& (mission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE
|| mission->GetMissionState() == MissionState::MISSION_STATE_COMPLETE_ACTIVE)) {
&& (mission->GetMissionState() == eMissionState::ACTIVE
|| mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) {
mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
}

View File

@@ -4,7 +4,8 @@
#include "EntityManager.h"
#include "dZoneManager.h"
#include "Player.h"
#include "MissionTaskType.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "MissionComponent.h"
#include "Character.h"
@@ -373,7 +374,7 @@ void BaseWavesServer::GameOver(Entity* self, bool won) {
// Update all mission progression
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, time, self->GetObjectID(), self->GetVar<std::string>(MissionTypeVariable));
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, time, self->GetObjectID(), self->GetVar<std::string>(MissionTypeVariable));
}
StopActivity(self, playerID, wave, time, score);
@@ -429,7 +430,7 @@ void BaseWavesServer::SpawnWave(Entity* self) {
for (const auto& playerID : state.players) {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player != nullptr) {
if (player && player->GetIsDead()) {
player->Resurrect();
}
}
@@ -510,15 +511,15 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3
// Get the mission state
auto missionState = missionComponent->GetMissionState(missionID);
// For some reason these achievements are not accepted by default, so we accept them here if they arent already.
if (missionState != MissionState::MISSION_STATE_COMPLETE && missionState != MissionState::MISSION_STATE_UNKNOWN) {
if (missionState != eMissionState::COMPLETE && missionState != eMissionState::UNKNOWN) {
missionComponent->AcceptMission(missionID);
missionState = missionComponent->GetMissionState(missionID);
}
if (missionState != MissionState::MISSION_STATE_COMPLETE) {
if (missionState != eMissionState::COMPLETE) {
auto mission = missionComponent->GetMission(missionID);
if (mission != nullptr) {
mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
}
@@ -528,15 +529,15 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3
// Get the mission state
auto missionState = missionComponent->GetMissionState(missionID);
// For some reason these achievements are not accepted by default, so we accept them here if they arent already.
if (missionState != MissionState::MISSION_STATE_COMPLETE && missionState != MissionState::MISSION_STATE_UNKNOWN) {
if (missionState != eMissionState::COMPLETE && missionState != eMissionState::UNKNOWN) {
missionComponent->AcceptMission(missionID);
missionState = missionComponent->GetMissionState(missionID);
}
if (missionState != MissionState::MISSION_STATE_COMPLETE) {
if (missionState != eMissionState::COMPLETE) {
auto mission = missionComponent->GetMission(missionID);
if (mission != nullptr) {
mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
}
@@ -564,14 +565,14 @@ void BaseWavesServer::UpdateMissionForAllPlayers(Entity* self, uint32_t missionI
// Get the mission state
auto missionState = missionComponent->GetMissionState(missionID);
// For some reason these achievements are not accepted by default, so we accept them here if they arent already.
if (missionState != MissionState::MISSION_STATE_COMPLETE && missionState != MissionState::MISSION_STATE_UNKNOWN) {
if (missionState != eMissionState::COMPLETE && missionState != eMissionState::UNKNOWN) {
missionComponent->AcceptMission(missionID);
missionState = missionComponent->GetMissionState(missionID);
}
if (missionState != MissionState::MISSION_STATE_COMPLETE) {
if (missionState != eMissionState::COMPLETE) {
auto mission = missionComponent->GetMission(missionID);
if (mission != nullptr) {
mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
}

View File

@@ -39,6 +39,12 @@ foreach(file ${DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS})
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "EquipmentScripts/${file}")
endforeach()
add_subdirectory(EquipmentTriggers)
foreach(file ${DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS})
set(DSCRIPTS_SOURCES ${DSCRIPTS_SOURCES} "EquipmentTriggers/${file}")
endforeach()
add_subdirectory(zone)
foreach(file ${DSCRIPTS_SOURCES_ZONE})

View File

@@ -278,6 +278,10 @@
#include "ImaginationBackpackHealServer.h"
#include "LegoDieRoll.h"
#include "BuccaneerValiantShip.h"
#include "GemPack.h"
#include "ShardArmor.h"
#include "TeslaPack.h"
#include "StunImmunity.h"
// Survival scripts
#include "AgSurvivalStromling.h"
@@ -291,6 +295,12 @@
// WBL scripts
#include "WblGenericZone.h"
// Wild Scripts
#include "WildAndScared.h"
#include "WildGfGlowbug.h"
#include "WildAmbientCrab.h"
#include "WildPants.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;
@@ -837,6 +847,14 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new BuccaneerValiantShip();
else if (scriptName == "scripts\\EquipmentScripts\\FireFirstSkillonStartup.lua")
script = new FireFirstSkillonStartup();
else if (scriptName == "scripts\\equipmenttriggers\\gempack.lua")
script = new GemPack();
else if (scriptName == "scripts\\equipmenttriggers\\shardarmor.lua")
script = new ShardArmor();
else if (scriptName == "scripts\\equipmenttriggers\\coilbackpack.lua")
script = new TeslaPack();
else if (scriptName == "scripts\\EquipmentScripts\\stunImmunity.lua")
script = new StunImmunity();
// FB
else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua")
@@ -848,11 +866,22 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua")
script = new WblGenericZone();
// 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();
// 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\\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

@@ -1,12 +1,13 @@
#pragma once
#include "dCommonVars.h"
#include "MissionState.h"
#include <cstdint>
#include <string>
#include <vector>
class User;
class Entity;
class NiPoint3;
enum class eMissionState : int32_t;
namespace CppScripts {
/**
@@ -48,7 +49,7 @@ namespace CppScripts {
*
* Equivalent to 'function onMissionDialogueOK(self, msg)'
*/
virtual void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {};
virtual void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {};
/**
* Invoked when the client or the server invoked an event server-side.
@@ -172,6 +173,13 @@ namespace CppScripts {
*/
virtual void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {};
/**
* Invoked when self has received either a hit or heal. Only used for scripts subscribed to an entity.
*
* Equivalent to 'function notifyHitOrHealResult(self, msg)'
*/
virtual void NotifyHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {};
/**
* Invoked when a player has responsed to a mission.
*
@@ -316,6 +324,22 @@ namespace CppScripts {
virtual void OnCinematicUpdate(Entity* self, Entity* sender, eCinematicEvent event, const std::u16string& pathName,
float_t pathTime, float_t totalTime, int32_t waypoint) {
};
/**
* Used by items to tell their owner that they were equipped.
*
* @param itemOwner The owner of the item
* @param itemObjId The items Object ID
*/
virtual void OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {};
/**
* Used by items to tell their owner that they were unequipped.
*
* @param itemOwner The owner of the item
* @param itemObjId The items Object ID
*/
virtual void OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {};
};
Script* GetScript(Entity* parent, const std::string& scriptName);

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