mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Merge remote-tracking branch 'upstream/main' into PetFixes
This commit is contained in:
@@ -85,7 +85,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
//First rotate for anim
|
||||
NiQuaternion rot = NiQuaternion::IDENTITY;
|
||||
NiQuaternion rot = NiQuaternionConstant::IDENTITY;
|
||||
|
||||
controllable->SetStatic(false);
|
||||
|
||||
@@ -179,7 +179,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
|
||||
|
||||
std::vector<LWOOBJID> spiderEggs{};
|
||||
|
||||
auto spooders = Game::entityManager->GetEntitiesInGroup("EGG");
|
||||
auto spooders = Game::entityManager->GetEntitiesInGroup("SpiderEggs");
|
||||
for (auto spodder : spooders) {
|
||||
spiderEggs.push_back(spodder->GetObjectID());
|
||||
}
|
||||
@@ -402,7 +402,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
|
||||
const auto withdrawn = self->GetBoolean(u"isWithdrawn");
|
||||
if (!withdrawn) return;
|
||||
|
||||
NiQuaternion rot = NiQuaternion::IDENTITY;
|
||||
NiQuaternion rot = NiQuaternionConstant::IDENTITY;
|
||||
|
||||
//First rotate for anim
|
||||
controllable->SetStatic(false);
|
||||
@@ -597,12 +597,12 @@ void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
|
||||
|
||||
if (!isWithdrawn) return;
|
||||
|
||||
if (controllable->GetRotation() == NiQuaternion::IDENTITY) {
|
||||
if (controllable->GetRotation() == NiQuaternionConstant::IDENTITY) {
|
||||
return;
|
||||
}
|
||||
|
||||
controllable->SetStatic(false);
|
||||
controllable->SetRotation(NiQuaternion::IDENTITY);
|
||||
controllable->SetRotation(NiQuaternionConstant::IDENTITY);
|
||||
controllable->SetStatic(true);
|
||||
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "GeneralUtils.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "dNavMesh.h"
|
||||
|
||||
void BaseEnemyMech::OnStartup(Entity* self) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
@@ -19,7 +20,7 @@ void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
|
||||
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 };
|
||||
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
|
||||
|
||||
EntityInfo info = EntityInfo();
|
||||
std::vector<LDFBaseData*> cfg;
|
||||
|
@@ -13,7 +13,7 @@ void AgLaserSensorServer::OnStartup(Entity* self) {
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
|
||||
phantomPhysicsComponent->SetDirectionalMultiplier(repelForce);
|
||||
phantomPhysicsComponent->SetDirection(NiPoint3::UNIT_Y);
|
||||
phantomPhysicsComponent->SetDirection(NiPoint3Constant::UNIT_Y);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "NpcCowboyServer.h"
|
||||
#include "eMissionState.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID != 1880) {
|
||||
@@ -23,4 +24,17 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
|
||||
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
inventoryComponent->RemoveItem(14378, 1);
|
||||
}
|
||||
|
||||
// Next up hide or show the samples based on the mission state
|
||||
int32_t visible = 1;
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName("PlungerGunTargets");
|
||||
for (auto* spawner : spawners) {
|
||||
for (const auto entity : spawner->GetSpawnedObjectIDs())
|
||||
GameMessages::SendNotifyClientObject(entity, u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
#include "NpcWispServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "eMissionState.h"
|
||||
#include "Spawner.h"
|
||||
|
||||
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID != 1849 && missionID != 1883)
|
||||
@@ -25,7 +26,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
}
|
||||
|
||||
// Next up hide or show the samples based on the mission state
|
||||
auto visible = 1;
|
||||
int32_t visible = 1;
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
visible = 0;
|
||||
}
|
||||
@@ -35,9 +36,10 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
|
||||
|
||||
for (const auto& group : groups) {
|
||||
auto samples = Game::entityManager->GetEntitiesInGroup(group);
|
||||
for (auto* sample : samples) {
|
||||
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName(group);
|
||||
for (const auto* spawner : spawners) {
|
||||
for (const auto objId : spawner->GetSpawnedObjectIDs())
|
||||
GameMessages::SendNotifyClientObject(objId, u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
return;
|
||||
}
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3Constant::ZERO);
|
||||
|
||||
Game::entityManager->SerializeEntity(bridge);
|
||||
}
|
||||
|
@@ -12,16 +12,12 @@ void AmDropshipComputer::OnStartup(Entity* self) {
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (quickBuildComponent == nullptr || quickBuildComponent->GetState() != eQuickBuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
if (!quickBuildComponent || quickBuildComponent->GetState() != eQuickBuildState::COMPLETED) return;
|
||||
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!missionComponent || !inventoryComponent) return;
|
||||
|
||||
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == eMissionState::COMPLETE) {
|
||||
return;
|
||||
@@ -33,14 +29,12 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
|
||||
int32_t pipeNum = 0;
|
||||
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
|
||||
return;
|
||||
}
|
||||
const auto pipeNum = GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1));
|
||||
if (!pipeNum) return;
|
||||
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
const auto nextPipeNum = pipeNum.value() + 1;
|
||||
|
||||
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
|
||||
|
||||
@@ -70,11 +64,9 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
const auto* const quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (quickBuildComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!quickBuildComponent) return;
|
||||
|
||||
if (timerName == "reset" && quickBuildComponent->GetState() == eQuickBuildState::OPEN) {
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
|
@@ -144,13 +144,10 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
|
||||
);
|
||||
|
||||
for (const auto& mission : missions) {
|
||||
int32_t missionID = 0;
|
||||
const auto missionID = GeneralUtils::TryParse<int32_t>(mission);
|
||||
if (!missionID) continue;
|
||||
|
||||
if (!GeneralUtils::TryParse(mission, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionIDs.push_back(missionID);
|
||||
missionIDs.push_back(missionID.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,12 +12,9 @@ void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, cons
|
||||
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
|
||||
|
||||
for (const auto& missionIDStr : missionIDs) {
|
||||
int32_t missionID = 0;
|
||||
const auto missionID = GeneralUtils::TryParse<uint32_t>(missionIDStr);
|
||||
if (!missionID) continue;
|
||||
|
||||
if (!GeneralUtils::TryParse(missionIDStr, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(missionID, 1, 1, false);
|
||||
missionComponent->ForceProgressTaskType(missionID.value(), 1, 1, false);
|
||||
}
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
GameMessages::SendOrientToAngle(playerId, true, rads, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendTeleport(playerId, position, NiQuaternion::IDENTITY, player->GetSystemAddress());
|
||||
GameMessages::SendTeleport(playerId, position, NiQuaternionConstant::IDENTITY, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true
|
||||
|
@@ -119,7 +119,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
|
||||
return;
|
||||
|
||||
auto* playerEntity = Game::entityManager->GetEntity(playerID);
|
||||
if (!playerEntity || !playerEntity->GetParentUser() || !playerEntity->GetParentUser()->GetLastUsedChar())
|
||||
if (!playerEntity || !playerEntity->GetCharacter())
|
||||
return;
|
||||
|
||||
auto* player = playerEntity->GetCharacter();
|
||||
|
@@ -17,12 +17,12 @@ void QbEnemyStunner::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
if (!skillComponent) return;
|
||||
|
||||
// Get the skill IDs of this object.
|
||||
CDObjectSkillsTable* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
|
||||
CDObjectSkillsTable* skillsTable = CDClientManager::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>();
|
||||
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::GetTable<CDSkillBehaviorTable>();
|
||||
CDSkillBehavior behaviorData = skillBehaviorTable->GetSkillByID(skill.skillID);
|
||||
|
||||
skillBehaviorMap.insert(std::make_pair(skill.skillID, behaviorData.behaviorID));
|
||||
|
@@ -40,6 +40,6 @@ void PetFromDigServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eP
|
||||
return;
|
||||
// TODO: Remove custom group?
|
||||
// Command the pet to the player as it may otherwise go to its spawn point which is non existant
|
||||
// petComponent->Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 6, 202, true);
|
||||
// petComponent->Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 6, 202, true);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "BaseConsoleTeleportServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Player.h"
|
||||
#include "CharacterComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eTerminateType.h"
|
||||
@@ -94,7 +94,9 @@ void BaseConsoleTeleportServer::TransferPlayer(Entity* self, Entity* player, int
|
||||
|
||||
const auto& teleportZone = self->GetVar<std::u16string>(u"transferZoneID");
|
||||
|
||||
static_cast<Player*>(player)->SendToZone(std::stoi(GeneralUtils::UTF16ToWTF8(teleportZone)));
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
|
||||
if (characterComponent) characterComponent->SendToZone(std::stoi(GeneralUtils::UTF16ToWTF8(teleportZone)));
|
||||
|
||||
UpdatePlayerTable(self, player, false);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Player.h"
|
||||
#include "CharacterComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eMissionState.h"
|
||||
#include "MissionComponent.h"
|
||||
@@ -23,7 +23,8 @@ void BaseSurvivalServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
const auto& playersIter = std::find(state.players.begin(), state.players.end(), player->GetObjectID());
|
||||
|
||||
if (waitingIter != state.waitingPlayers.end() || playersIter != state.players.end()) {
|
||||
static_cast<Player*>(player)->SendToZone(player->GetCharacter()->GetLastNonInstanceZoneID());
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SendToZone(player->GetCharacter()->GetLastNonInstanceZoneID());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -161,8 +162,8 @@ void BaseSurvivalServer::BaseMessageBoxResponse(Entity* self, Entity* sender, in
|
||||
if (sender->IsPlayer()) {
|
||||
auto* character = sender->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
auto* player = dynamic_cast<Player*>(sender);
|
||||
player->SendToZone(character->GetLastNonInstanceZoneID());
|
||||
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Player.h"
|
||||
#include "CharacterComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eMissionState.h"
|
||||
#include "MissionComponent.h"
|
||||
@@ -162,8 +162,8 @@ void BaseWavesServer::BaseMessageBoxResponse(Entity* self, Entity* sender, int32
|
||||
if (sender->IsPlayer()) {
|
||||
auto* character = sender->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
auto* player = dynamic_cast<Player*>(sender);
|
||||
player->SendToZone(character->GetLastNonInstanceZoneID());
|
||||
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,11 +41,9 @@ void ChooseYourDestinationNsToNt::SetDestination(Entity* self, Entity* player) {
|
||||
void ChooseYourDestinationNsToNt::BaseChoiceBoxRespond(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) {
|
||||
if (button != -1) {
|
||||
const auto newMapStr = GeneralUtils::UTF16ToWTF8(buttonIdentifier).substr(7, -1);
|
||||
|
||||
int32_t newMap = 0;
|
||||
if (!GeneralUtils::TryParse(newMapStr, newMap)) {
|
||||
return;
|
||||
}
|
||||
const auto newMap = GeneralUtils::TryParse<int32_t>(newMapStr);
|
||||
|
||||
if (!newMap) return;
|
||||
|
||||
std::u16string strText = u"";
|
||||
|
||||
@@ -56,7 +54,7 @@ void ChooseYourDestinationNsToNt::BaseChoiceBoxRespond(Entity* self, Entity* sen
|
||||
}
|
||||
|
||||
self->SetVar(u"teleportString", strText);
|
||||
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(newMap));
|
||||
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(newMap.value()));
|
||||
|
||||
GameMessages::SendDisplayMessageBox(sender->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, strText, u"", sender->GetSystemAddress());
|
||||
} else {
|
||||
|
@@ -11,12 +11,12 @@ void FireFirstSkillonStartup::OnStartup(Entity* self) {
|
||||
if (!skillComponent) return;
|
||||
|
||||
// Get the skill IDs of this object.
|
||||
CDObjectSkillsTable* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
|
||||
CDObjectSkillsTable* skillsTable = CDClientManager::GetTable<CDObjectSkillsTable>();
|
||||
std::vector<CDObjectSkills> skills = skillsTable->Query([=](CDObjectSkills entry) {return (entry.objectTemplate == self->GetLOT()); });
|
||||
|
||||
// For each skill, cast it with the associated behavior ID.
|
||||
for (auto skill : skills) {
|
||||
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
|
||||
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::GetTable<CDSkillBehaviorTable>();
|
||||
CDSkillBehavior behaviorData = skillBehaviorTable->GetSkillByID(skill.skillID);
|
||||
|
||||
// Should parent entity be null, make the originator self.
|
||||
|
@@ -46,11 +46,7 @@ CppScripts::Script* ScriptComponent::GetScript() {
|
||||
}
|
||||
|
||||
void ScriptComponent::SetScript(const std::string& scriptName) {
|
||||
//we don't need to delete the script because others may be using it :)
|
||||
/*if (m_Client) {
|
||||
m_Script = new InvalidScript();
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Scripts are managed by the CppScripts class and are effecitvely singletons
|
||||
// and they may also be used by other script components so DON'T delete them.
|
||||
m_Script = CppScripts::GetScript(m_Parent, scriptName);
|
||||
}
|
||||
|
@@ -17,9 +17,9 @@ class Entity;
|
||||
* Handles the loading and execution of server side scripts on entities, scripts were originally written in Lua,
|
||||
* here they're written in C++
|
||||
*/
|
||||
class ScriptComponent : public Component {
|
||||
class ScriptComponent final : public Component {
|
||||
public:
|
||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT;
|
||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT;
|
||||
|
||||
ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client = false);
|
||||
~ScriptComponent() override;
|
||||
|
@@ -7,10 +7,8 @@
|
||||
void FvBrickPuzzleServer::OnStartup(Entity* self) {
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
|
||||
int32_t pipeNum = 0;
|
||||
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
|
||||
return;
|
||||
}
|
||||
const auto pipeNum = GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1));
|
||||
if (!pipeNum) return;
|
||||
|
||||
if (pipeNum != 1) {
|
||||
self->AddTimer("reset", 30);
|
||||
@@ -20,14 +18,12 @@ void FvBrickPuzzleServer::OnStartup(Entity* self) {
|
||||
void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
|
||||
int32_t pipeNum = 0;
|
||||
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
|
||||
return;
|
||||
}
|
||||
const auto pipeNum = GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1));
|
||||
if (!pipeNum) return;
|
||||
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
const auto nextPipeNum = pipeNum.value() + 1;
|
||||
|
||||
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
|
||||
|
||||
@@ -37,7 +33,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
samePipeSpawners[0]->Deactivate();
|
||||
}
|
||||
|
||||
if (killer != nullptr && killer->IsPlayer()) {
|
||||
if (killer && killer->IsPlayer()) {
|
||||
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
|
||||
|
||||
const auto nextPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "InstanceExitTransferPlayerToLastNonInstance.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Player.h"
|
||||
#include "CharacterComponent.h"
|
||||
#include "Character.h"
|
||||
#include "dServer.h"
|
||||
#include "eTerminateType.h"
|
||||
@@ -23,10 +23,8 @@ void InstanceExitTransferPlayerToLastNonInstance::OnUse(Entity* self, Entity* us
|
||||
}
|
||||
|
||||
void InstanceExitTransferPlayerToLastNonInstance::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* player = dynamic_cast<Player*>(sender);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
if (!sender->IsPlayer()) return;
|
||||
|
||||
auto* character = sender->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
if (identifier == u"Instance_Exit" && button == 1) {
|
||||
@@ -47,7 +45,8 @@ void InstanceExitTransferPlayerToLastNonInstance::OnMessageBoxResponse(Entity* s
|
||||
}
|
||||
}
|
||||
|
||||
player->SendToZone(lastInstance);
|
||||
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SendToZone(lastInstance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,7 @@ void GfBanana::OnHit(Entity* self, Entity* attacker) {
|
||||
return;
|
||||
}
|
||||
|
||||
bananaEntity->SetPosition(bananaEntity->GetPosition() - NiPoint3::UNIT_Y * 8);
|
||||
bananaEntity->SetPosition(bananaEntity->GetPosition() - NiPoint3Constant::UNIT_Y * 8);
|
||||
|
||||
auto* bananaDestroyable = bananaEntity->GetComponent<DestroyableComponent>();
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Player.h"
|
||||
#include "Character.h"
|
||||
#include "ShootingGalleryComponent.h"
|
||||
#include "PossessorComponent.h"
|
||||
@@ -453,16 +452,12 @@ void SGCannon::SpawnNewModel(Entity* self) {
|
||||
|
||||
void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
if (!player) return;
|
||||
|
||||
auto* playerObject = dynamic_cast<Player*>(player);
|
||||
if (playerObject == nullptr)
|
||||
return;
|
||||
|
||||
auto* character = playerObject->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
playerObject->SendToZone(character->GetLastNonInstanceZoneID());
|
||||
auto* character = player->GetCharacter();
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
if (characterComponent && character) {
|
||||
characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,6 +39,6 @@ void CrabServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTami
|
||||
return;
|
||||
// TODO: Remove custom group?
|
||||
// Command the pet to the player as it may otherwise go to its spawn point which is non existant
|
||||
// petComponent->Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 6, 202, true);
|
||||
// petComponent->Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 6, 202, true);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#include "WblGenericZone.h"
|
||||
#include "Player.h"
|
||||
#include "CharacterComponent.h"
|
||||
|
||||
void WblGenericZone::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
if (args == m_WblAbortMsg) {
|
||||
if (!sender) return;
|
||||
auto player = dynamic_cast<Player*>(sender);
|
||||
if (player) player->SendToZone(m_WblMainZone);
|
||||
|
||||
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||
if (characterComponent) characterComponent->SendToZone(m_WblMainZone);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user