mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +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:
48
dScripts/ai/ACT/FootRace/BaseFootRaceManager.cpp
Normal file
48
dScripts/ai/ACT/FootRace/BaseFootRaceManager.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "BaseFootRaceManager.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
|
||||
void BaseFootRaceManager::OnStartup(Entity* self) {
|
||||
// TODO: Add to FootRaceStarter group
|
||||
}
|
||||
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
const auto splitArguments = GeneralUtils::SplitString(args, '_');
|
||||
if (splitArguments.size() > 1) {
|
||||
|
||||
const auto eventName = splitArguments[0];
|
||||
const auto player = EntityManager::Instance()->GetEntity(std::stoull(splitArguments[1]));
|
||||
|
||||
if (player != nullptr) {
|
||||
if (eventName == "updatePlayer") {
|
||||
UpdatePlayer(self, player->GetObjectID());
|
||||
} else if (IsPlayerInActivity(self, player->GetObjectID())) {
|
||||
if (eventName == "initialActivityScore") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, true);
|
||||
}
|
||||
|
||||
SetActivityScore(self, player->GetObjectID(), 1);
|
||||
} else if (eventName == "updatePlayerTrue") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
}
|
||||
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
} else if (eventName == "PlayerWon") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
if (param2 != -1) // Certain footraces set a flag
|
||||
character->SetPlayerFlag(param2, true);
|
||||
}
|
||||
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
dScripts/ai/ACT/FootRace/BaseFootRaceManager.h
Normal file
9
dScripts/ai/ACT/FootRace/BaseFootRaceManager.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "ActivityManager.h"
|
||||
#include "CppScripts.h"
|
||||
|
||||
class BaseFootRaceManager : public ActivityManager {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
3
dScripts/ai/ACT/FootRace/CMakeLists.txt
Normal file
3
dScripts/ai/ACT/FootRace/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
set(DSCRIPTS_SOURCES_AI_ACT_FOOTRACE
|
||||
"BaseFootRaceManager.cpp"
|
||||
PARENT_SCOPE)
|
Reference in New Issue
Block a user