mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-20 14:28:07 +00:00
format codebase
This commit is contained in:
@@ -3,90 +3,81 @@
|
||||
#include "EntityManager.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void GfCaptainsCannon::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
if (self->GetVar<bool>(u"bIsInUse"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar<LWOOBJID>(u"userID", user->GetObjectID());
|
||||
void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetVar<bool>(u"bIsInUse")) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar<bool>(u"bIsInUse", true);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", true);
|
||||
self->SetVar<LWOOBJID>(u"userID", user->GetObjectID());
|
||||
|
||||
GameMessages::SendSetStunned(user->GetObjectID(), PUSH, user->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
|
||||
);
|
||||
self->SetVar<bool>(u"bIsInUse", true);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", true);
|
||||
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
GameMessages::SendSetStunned(user->GetObjectID(), PUSH, user->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
position.x += forward.x * -3;
|
||||
position.z += forward.z * -3;
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
|
||||
auto rotation = self->GetRotation();
|
||||
position.x += forward.x * -3;
|
||||
position.z += forward.z * -3;
|
||||
|
||||
GameMessages::SendTeleport(user->GetObjectID(), position, rotation, user->GetSystemAddress());
|
||||
auto rotation = self->GetRotation();
|
||||
|
||||
GameMessages::SendPlayAnimation(user, u"cannon-strike-no-equip");
|
||||
GameMessages::SendTeleport(user->GetObjectID(), position, rotation, user->GetSystemAddress());
|
||||
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
|
||||
GameMessages::SendPlayAnimation(user, u"cannon-strike-no-equip");
|
||||
|
||||
self->AddTimer("FireCannon", 1.667f);
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
self->AddTimer("FireCannon", 1.667f);
|
||||
}
|
||||
|
||||
void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"userID");
|
||||
void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", false);
|
||||
if (player == nullptr) {
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", false);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "FireCannon")
|
||||
{
|
||||
float cinematicTime = 6.3f;
|
||||
if (timerName == "FireCannon") {
|
||||
float cinematicTime = 6.3f;
|
||||
|
||||
GameMessages::SendPlayCinematic(playerId, u"Cannon_Cam", player->GetSystemAddress());
|
||||
GameMessages::SendPlayCinematic(playerId, u"Cannon_Cam", player->GetSystemAddress());
|
||||
|
||||
self->AddTimer("cinematicTimer", cinematicTime);
|
||||
self->AddTimer("cinematicTimer", cinematicTime);
|
||||
|
||||
const auto sharkObjects = EntityManager::Instance()->GetEntitiesInGroup("SharkCannon");
|
||||
const auto sharkObjects = EntityManager::Instance()->GetEntitiesInGroup("SharkCannon");
|
||||
|
||||
for (auto* shark : sharkObjects)
|
||||
{
|
||||
if (shark->GetLOT() != m_SharkItemID) continue;
|
||||
for (auto* shark : sharkObjects) {
|
||||
if (shark->GetLOT() != m_SharkItemID) continue;
|
||||
|
||||
GameMessages::SendPlayAnimation(shark, u"cannon");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(shark, u"cannon");
|
||||
}
|
||||
|
||||
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");
|
||||
}
|
||||
else if (timerName == "cinematicTimer")
|
||||
{
|
||||
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
|
||||
);
|
||||
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");
|
||||
} else if (timerName == "cinematicTimer") {
|
||||
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", false);
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", false);
|
||||
|
||||
GameMessages::SendStopFXEffect(player, true, "hook");
|
||||
GameMessages::SendStopFXEffect(player, true, "hook");
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr)
|
||||
{
|
||||
missionComponent->ForceProgress(601, 910, 1);
|
||||
}
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->ForceProgress(601, 910, 1);
|
||||
}
|
||||
|
||||
GameMessages::SendTerminateInteraction(playerId, FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
GameMessages::SendTerminateInteraction(playerId, FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user