mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
17
dScripts/02_server/Map/AG/AgBugsprayer.cpp
Normal file
17
dScripts/02_server/Map/AG/AgBugsprayer.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "AgBugsprayer.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
self->AddTimer("castSkill", 1);
|
||||
self->SetOwnerOverride(target->GetObjectID());
|
||||
}
|
||||
|
||||
void AgBugsprayer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "castSkill") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
skillComponent->CalculateBehavior(1435, 36581, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/AG/AgBugsprayer.h
Normal file
10
dScripts/02_server/Map/AG/AgBugsprayer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgBugsprayer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
27
dScripts/02_server/Map/AG/AgCagedBricksServer.cpp
Normal file
27
dScripts/02_server/Map/AG/AgCagedBricksServer.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "AgCagedBricksServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Character.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
|
||||
//Tell the client to spawn the baby spiderling:
|
||||
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("cagedSpider");
|
||||
for (auto spodder : spooders) {
|
||||
GameMessages::SendFireEventClientSide(spodder->GetObjectID(), user->GetSystemAddress(), u"toggle", LWOOBJID_EMPTY, 0, 0, user->GetObjectID());
|
||||
}
|
||||
|
||||
//Set the flag & mission status:
|
||||
auto character = user->GetCharacter();
|
||||
|
||||
if (!character) return;
|
||||
|
||||
character->SetPlayerFlag(74, true);
|
||||
|
||||
//Remove the maelstrom cube:
|
||||
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
if (inv) {
|
||||
inv->RemoveItem(14553, 1);
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/AgCagedBricksServer.h
Normal file
6
dScripts/02_server/Map/AG/AgCagedBricksServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgCagedBricksServer : public CppScripts::Script {
|
||||
void OnUse(Entity* self, Entity* user);
|
||||
};
|
55
dScripts/02_server/Map/AG/AgLaserSensorServer.cpp
Normal file
55
dScripts/02_server/Map/AG/AgLaserSensorServer.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "AgLaserSensorServer.h"
|
||||
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "AgMonumentLaserServer.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgLaserSensorServer::OnStartup(Entity* self) {
|
||||
|
||||
PhantomPhysicsComponent* physComp = static_cast<PhantomPhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
physComp->SetPhysicsEffectActive(true);
|
||||
physComp->SetEffectType(2); // repulse (prolly should make definitions of these are in Entity.cpp)
|
||||
physComp->SetDirectionalMultiplier(static_cast<float>(m_RepelForce));
|
||||
physComp->SetDirection(NiPoint3::UNIT_Y);
|
||||
|
||||
m_Skill = self->GetComponent<SkillComponent>();
|
||||
}
|
||||
|
||||
|
||||
void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
|
||||
if (!m_Skill) return;
|
||||
|
||||
|
||||
Entity* laser = nullptr;
|
||||
|
||||
for (auto script : EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPT)) {
|
||||
|
||||
AgMonumentLaserServer* hasLaser = (AgMonumentLaserServer*)script;
|
||||
|
||||
if (hasLaser) {
|
||||
const auto source = script->GetPosition();
|
||||
const auto obj = self->GetObjectID();
|
||||
|
||||
if (obj == 76690936093053 && Vector3::DistanceSquared(source, NiPoint3(149.007f, 417.083f, 218.346f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
} else if (obj == 75866302318824 && Vector3::DistanceSquared(source, NiPoint3(48.6403f, 403.803f, 196.711f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
} else if (obj == 75866302318822 && Vector3::DistanceSquared(source, NiPoint3(19.2155f, 420.083f, 249.226f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
} else if (obj == 75866302318823 && Vector3::DistanceSquared(source, NiPoint3(-6.61596f, 404.633f, 274.323f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (laser != nullptr) {
|
||||
m_Skill->CalculateBehavior(m_SkillCastID, 15714, target->GetObjectID());
|
||||
}
|
||||
}
|
15
dScripts/02_server/Map/AG/AgLaserSensorServer.h
Normal file
15
dScripts/02_server/Map/AG/AgLaserSensorServer.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class SkillComponent;
|
||||
|
||||
class AgLaserSensorServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnCollisionPhantom(Entity* self, Entity* target);
|
||||
private:
|
||||
SkillComponent* m_Skill;
|
||||
int m_RepelForce = -25;
|
||||
int m_SkillCastID = 163;
|
||||
};
|
||||
|
33
dScripts/02_server/Map/AG/AgMonumentBirds.cpp
Normal file
33
dScripts/02_server/Map/AG/AgMonumentBirds.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "AgMonumentBirds.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//Makes the ag birds fly away when you get close and smashes them.
|
||||
//Created mrb... 6 / 3 / 11
|
||||
//Ported Max 20/07/2020
|
||||
//--------------------------------------------------------------
|
||||
|
||||
void AgMonumentBirds::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(flyRadius, "MonumentBirds");
|
||||
}
|
||||
|
||||
void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (self->GetVar<bool>(u"IsFlying")) return;
|
||||
|
||||
if (name == "MonumentBirds" && status == "ENTER") {
|
||||
self->AddTimer("killBird", 1.0f);
|
||||
GameMessages::SendPlayAnimation(self, sOnProximityAnim);
|
||||
self->SetVar<bool>(u"IsFlying", true);
|
||||
self->SetVar<LWOOBJID>(u"PlayerID", entering->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != "killBird") return;
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
|
||||
if (player == nullptr) return;
|
||||
|
||||
self->ScheduleKillAfterUpdate(player);
|
||||
}
|
13
dScripts/02_server/Map/AG/AgMonumentBirds.h
Normal file
13
dScripts/02_server/Map/AG/AgMonumentBirds.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentBirds : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status);
|
||||
void OnTimerDone(Entity* self, std::string timerName);
|
||||
|
||||
private:
|
||||
std::u16string sOnProximityAnim = u"fly1";
|
||||
float flyRadius = 5.0f;
|
||||
};
|
20
dScripts/02_server/Map/AG/AgMonumentLaserServer.cpp
Normal file
20
dScripts/02_server/Map/AG/AgMonumentLaserServer.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "AgMonumentLaserServer.h"
|
||||
|
||||
void AgMonumentLaserServer::OnStartup(Entity* self) {
|
||||
/*
|
||||
self->SetProximityRadius(m_Radius, "MonumentLaser");
|
||||
|
||||
std::cout << "Monument Laser " << self->GetObjectID() << " is at " << self->GetPosition().GetX()
|
||||
<< ","<< self->GetPosition().GetY() << "," << self->GetPosition().GetZ() << std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
void AgMonumentLaserServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
/*
|
||||
if (status == "ENTER") {
|
||||
|
||||
std::cout << "Monument laser ID: " << self->GetObjectID() << std::endl;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
10
dScripts/02_server/Map/AG/AgMonumentLaserServer.h
Normal file
10
dScripts/02_server/Map/AG/AgMonumentLaserServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentLaserServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status);
|
||||
private:
|
||||
float m_Radius = 25.0f;
|
||||
};
|
9
dScripts/02_server/Map/AG/AgMonumentRaceCancel.cpp
Normal file
9
dScripts/02_server/Map/AG/AgMonumentRaceCancel.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "AgMonumentRaceCancel.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
|
||||
if (!managers.empty()) {
|
||||
managers[0]->OnFireEventServerSide(target, "course_cancel");
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/AgMonumentRaceCancel.h
Normal file
6
dScripts/02_server/Map/AG/AgMonumentRaceCancel.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentRaceCancel : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
};
|
15
dScripts/02_server/Map/AG/AgMonumentRaceGoal.cpp
Normal file
15
dScripts/02_server/Map/AG/AgMonumentRaceGoal.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "AgMonumentRaceGoal.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
|
||||
void AgMonumentRaceGoal::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(15, "RaceGoal");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
9
dScripts/02_server/Map/AG/AgMonumentRaceGoal.h
Normal file
9
dScripts/02_server/Map/AG/AgMonumentRaceGoal.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentRaceGoal : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
};
|
16
dScripts/02_server/Map/AG/CMakeLists.txt
Normal file
16
dScripts/02_server/Map/AG/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
|
||||
"AgCagedBricksServer.cpp"
|
||||
"NpcWispServer.cpp"
|
||||
"NpcEpsilonServer.cpp"
|
||||
"AgLaserSensorServer.cpp"
|
||||
"AgMonumentLaserServer.cpp"
|
||||
"AgMonumentBirds.cpp"
|
||||
"RemoveRentalGear.cpp"
|
||||
"NpcNjAssistantServer.cpp"
|
||||
"AgBugsprayer.cpp"
|
||||
"NpcAgCourseStarter.cpp"
|
||||
"AgMonumentRaceGoal.cpp"
|
||||
"AgMonumentRaceCancel.cpp"
|
||||
"NpcCowboyServer.cpp"
|
||||
"NpcPirateServer.cpp"
|
||||
PARENT_SCOPE)
|
108
dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp
Normal file
108
dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
#include "NpcAgCourseStarter.h"
|
||||
#include "EntityManager.h"
|
||||
#include "ScriptedActivityComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "LeaderboardManager.h"
|
||||
#include "MissionComponent.h"
|
||||
#include <ctime>
|
||||
|
||||
void NpcAgCourseStarter::OnStartup(Entity* self) {
|
||||
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnUse(Entity* self, Entity* user) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (scriptedActivityComponent->GetActivityPlayerData(user->GetObjectID()) != nullptr) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"exit", 0, 0, LWOOBJID_EMPTY, "", user->GetSystemAddress());
|
||||
} else {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start", 0, 0, LWOOBJID_EMPTY, "", user->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (identifier == u"player_dialog_cancel_course" && button == 1) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"cancel_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
} else if (identifier == u"player_dialog_start_course" && button == 1) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
GameMessages::SendActivityStart(self->GetObjectID(), sender->GetSystemAddress());
|
||||
|
||||
auto* data = scriptedActivityComponent->AddActivityPlayerData(sender->GetObjectID());
|
||||
|
||||
if (data->values[1] != 0) return;
|
||||
|
||||
time_t startTime = std::time(0) + 4; // Offset for starting timer
|
||||
|
||||
data->values[1] = *(float*)&startTime;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
} else if (identifier == u"FootRaceCancel") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
if (scriptedActivityComponent->GetActivityPlayerData(sender->GetObjectID()) != nullptr) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"exit", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
} else {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
}
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (scriptedActivityComponent == nullptr)
|
||||
return;
|
||||
|
||||
auto* data = scriptedActivityComponent->GetActivityPlayerData(sender->GetObjectID());
|
||||
if (data == nullptr)
|
||||
return;
|
||||
|
||||
if (args == "course_cancel") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"cancel_timer", 0, 0,
|
||||
LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
} else if (args == "course_finish") {
|
||||
time_t endTime = std::time(0);
|
||||
time_t finish = (endTime - *(time_t*)&data->values[1]);
|
||||
|
||||
data->values[2] = *(float*)&finish;
|
||||
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->ForceProgressTaskType(1884, 1, 1, false);
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, -finish, self->GetObjectID(),
|
||||
"performact_time");
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(),
|
||||
0, (uint32_t)finish);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
|
||||
scriptedActivityComponent->GetActivityID(), 0, sender->GetObjectID(),
|
||||
"", sender->GetSystemAddress());
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 1, finish, LWOOBJID_EMPTY, "",
|
||||
sender->GetSystemAddress());
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
}
|
||||
}
|
13
dScripts/02_server/Map/AG/NpcAgCourseStarter.h
Normal file
13
dScripts/02_server/Map/AG/NpcAgCourseStarter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcAgCourseStarter : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
26
dScripts/02_server/Map/AG/NpcCowboyServer.cpp
Normal file
26
dScripts/02_server/Map/AG/NpcCowboyServer.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "NpcCowboyServer.h"
|
||||
#include "MissionState.h"
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != 1880) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
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 (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) {
|
||||
inventoryComponent->RemoveItem(14378, 1);
|
||||
}
|
||||
}
|
7
dScripts/02_server/Map/AG/NpcCowboyServer.h
Normal file
7
dScripts/02_server/Map/AG/NpcCowboyServer.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcCowboyServer : public CppScripts::Script
|
||||
{
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
};
|
10
dScripts/02_server/Map/AG/NpcEpsilonServer.cpp
Normal file
10
dScripts/02_server/Map/AG/NpcEpsilonServer.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "NpcEpsilonServer.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
|
||||
//If we are completing the Nexus Force join mission, play the celebration for it:
|
||||
if (missionID == 1851) {
|
||||
GameMessages::SendStartCelebrationEffect(target, target->GetSystemAddress(), 22);
|
||||
}
|
||||
}
|
7
dScripts/02_server/Map/AG/NpcEpsilonServer.h
Normal file
7
dScripts/02_server/Map/AG/NpcEpsilonServer.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcEpsilonServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
};
|
||||
|
27
dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp
Normal file
27
dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "NpcNjAssistantServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Item.h"
|
||||
|
||||
void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != mailMission) return;
|
||||
|
||||
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_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));
|
||||
|
||||
// If we are ready to complete our missions, we take the kit from you:
|
||||
if (inv && missionState == MissionState::MISSION_STATE_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));
|
||||
missionComponent->CompleteMission(mailAchievement, true);
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/AG/NpcNjAssistantServer.h
Normal file
10
dScripts/02_server/Map/AG/NpcNjAssistantServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcNjAssistantServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
|
||||
private:
|
||||
int mailMission = 1728; //mission to get the item out of your mailbox
|
||||
int mailAchievement = 1729; // fun fact: spelled "Achivement" in the actual script
|
||||
};
|
17
dScripts/02_server/Map/AG/NpcPirateServer.cpp
Normal file
17
dScripts/02_server/Map/AG/NpcPirateServer.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "NpcPirateServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState 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)
|
||||
&& 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) {
|
||||
inventory->RemoveItem(14591, 1);
|
||||
}
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/NpcPirateServer.h
Normal file
6
dScripts/02_server/Map/AG/NpcPirateServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcPirateServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
};
|
43
dScripts/02_server/Map/AG/NpcWispServer.cpp
Normal file
43
dScripts/02_server/Map/AG/NpcWispServer.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "NpcWispServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != 1849 && missionID != 1883)
|
||||
return;
|
||||
|
||||
auto* inventory = target->GetComponent<InventoryComponent>();
|
||||
if (inventory == nullptr)
|
||||
return;
|
||||
|
||||
LOT maelstromVacuumLot = 14592;
|
||||
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)
|
||||
&& 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) {
|
||||
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) {
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
auto groups = missionID == 1849
|
||||
? std::vector<std::string> { "MaelstromSamples" }
|
||||
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
|
||||
|
||||
for (const auto& group : groups) {
|
||||
auto samples = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
for (auto* sample : samples) {
|
||||
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/NpcWispServer.h
Normal file
6
dScripts/02_server/Map/AG/NpcWispServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcWispServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
};
|
39
dScripts/02_server/Map/AG/RemoveRentalGear.cpp
Normal file
39
dScripts/02_server/Map/AG/RemoveRentalGear.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "RemoveRentalGear.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "Item.h"
|
||||
#include "Character.h"
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------
|
||||
--Removes the rental gear from the player on mission turn in
|
||||
--
|
||||
--created mrb ... 5 / 25 / 11
|
||||
--updated abeechler 6 / 27 / 11 ... Add session flag resetting for set equips
|
||||
--ported Max 21/07/2020
|
||||
--------------------------------------------------------------
|
||||
--add missionID configData to the object in HF to remove this
|
||||
--gear what the specified mission is completed
|
||||
--------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState 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 (!inv) return;
|
||||
|
||||
//remove the inventory items
|
||||
for (int item : gearSets) {
|
||||
auto* id = inv->FindItemByLot(item);
|
||||
if (id) {
|
||||
inv->UnEquipItem(id);
|
||||
inv->RemoveItem(id->GetLot(), id->GetCount());
|
||||
}
|
||||
}
|
||||
|
||||
//reset the equipment flag
|
||||
auto character = target->GetCharacter();
|
||||
if (character) character->SetPlayerFlag(equipFlag, false);
|
||||
}
|
||||
}
|
12
dScripts/02_server/Map/AG/RemoveRentalGear.h
Normal file
12
dScripts/02_server/Map/AG/RemoveRentalGear.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class RemoveRentalGear : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
|
||||
private:
|
||||
int defaultMission = 768; //mission to remove gearSets on completion
|
||||
std::vector<int> gearSets = { 14359,14321,14353,14315 }; //inventory items to remove
|
||||
int equipFlag = 126; //Set upon wearing trial faction armor for the first time in a session
|
||||
};
|
||||
|
Reference in New Issue
Block a user