mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
chore: Simplify and move Player functionality to relevant component (#1408)
* Moving and organizing Player code - Move code to CharacterComponent - Remove extraneous interfaces - Simplify some code greatly - Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.) - Update code to use CharacterComponent for sending to zone instead of Player*. * Moving and organizing Player code - Move code to CharacterComponent - Remove extraneous interfaces - Simplify some code greatly - Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.) - Update code to use CharacterComponent for sending to zone instead of Player*. - Remove static storage container (static containers can be destroyed before exit/terminate handler executes) * remove player cast * Remove extra includes
This commit is contained in:
parent
66cc582a9a
commit
929d029f12
@ -1879,7 +1879,7 @@ const NiQuaternion& Entity::GetRotation() const {
|
|||||||
return NiQuaternion::IDENTITY;
|
return NiQuaternion::IDENTITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::SetPosition(NiPoint3 position) {
|
void Entity::SetPosition(const NiPoint3& position) {
|
||||||
auto* controllable = GetComponent<ControllablePhysicsComponent>();
|
auto* controllable = GetComponent<ControllablePhysicsComponent>();
|
||||||
|
|
||||||
if (controllable != nullptr) {
|
if (controllable != nullptr) {
|
||||||
@ -1907,7 +1907,7 @@ void Entity::SetPosition(NiPoint3 position) {
|
|||||||
Game::entityManager->SerializeEntity(this);
|
Game::entityManager->SerializeEntity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::SetRotation(NiQuaternion rotation) {
|
void Entity::SetRotation(const NiQuaternion& rotation) {
|
||||||
auto* controllable = GetComponent<ControllablePhysicsComponent>();
|
auto* controllable = GetComponent<ControllablePhysicsComponent>();
|
||||||
|
|
||||||
if (controllable != nullptr) {
|
if (controllable != nullptr) {
|
||||||
|
@ -106,7 +106,7 @@ public:
|
|||||||
|
|
||||||
virtual User* GetParentUser() const;
|
virtual User* GetParentUser() const;
|
||||||
|
|
||||||
virtual SystemAddress GetSystemAddress() const { return UNASSIGNED_SYSTEM_ADDRESS; };
|
virtual const SystemAddress& GetSystemAddress() const { return UNASSIGNED_SYSTEM_ADDRESS; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setters
|
* Setters
|
||||||
@ -124,13 +124,13 @@ public:
|
|||||||
|
|
||||||
void SetNetworkId(uint16_t id);
|
void SetNetworkId(uint16_t id);
|
||||||
|
|
||||||
void SetPosition(NiPoint3 position);
|
void SetPosition(const NiPoint3& position);
|
||||||
|
|
||||||
void SetRotation(NiQuaternion rotation);
|
void SetRotation(const NiQuaternion& rotation);
|
||||||
|
|
||||||
virtual void SetRespawnPos(NiPoint3 position) {}
|
virtual void SetRespawnPos(const NiPoint3& position) {}
|
||||||
|
|
||||||
virtual void SetRespawnRot(NiQuaternion rotation) {}
|
virtual void SetRespawnRot(const NiQuaternion& rotation) {}
|
||||||
|
|
||||||
virtual void SetSystemAddress(const SystemAddress& value) {};
|
virtual void SetSystemAddress(const SystemAddress& value) {};
|
||||||
|
|
||||||
@ -229,8 +229,8 @@ public:
|
|||||||
void TriggerEvent(eTriggerEventType event, Entity* optionalTarget = nullptr);
|
void TriggerEvent(eTriggerEventType event, Entity* optionalTarget = nullptr);
|
||||||
void ScheduleDestructionAfterUpdate() { m_ShouldDestroyAfterUpdate = true; }
|
void ScheduleDestructionAfterUpdate() { m_ShouldDestroyAfterUpdate = true; }
|
||||||
|
|
||||||
virtual NiPoint3 GetRespawnPosition() const { return NiPoint3::ZERO; }
|
virtual const NiPoint3& GetRespawnPosition() const { return NiPoint3::ZERO; }
|
||||||
virtual NiQuaternion GetRespawnRotation() const { return NiQuaternion::IDENTITY; }
|
virtual const NiQuaternion& GetRespawnRotation() const { return NiQuaternion::IDENTITY; }
|
||||||
|
|
||||||
void Sleep();
|
void Sleep();
|
||||||
void Wake();
|
void Wake();
|
||||||
|
285
dGame/Player.cpp
285
dGame/Player.cpp
@ -3,162 +3,22 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "Database.h"
|
|
||||||
#include "MissionComponent.h"
|
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
|
#include "Game.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "ZoneInstanceManager.h"
|
|
||||||
#include "WorldPackets.h"
|
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "CharacterComponent.h"
|
|
||||||
#include "Mail.h"
|
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
#include "Loot.h"
|
#include "Loot.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
std::vector<Player*> Player::m_Players = {};
|
namespace {
|
||||||
|
std::vector<Player*> m_Players;
|
||||||
|
};
|
||||||
|
|
||||||
Player::Player(const LWOOBJID& objectID, const EntityInfo info, User* user, Entity* parentEntity) : Entity(objectID, info, parentEntity) {
|
const std::vector<Player*>& Player::GetAllPlayers() {
|
||||||
m_ParentUser = user;
|
return m_Players;
|
||||||
m_Character = m_ParentUser->GetLastUsedChar();
|
|
||||||
m_ParentUser->SetLoggedInChar(objectID);
|
|
||||||
m_GMLevel = m_Character->GetGMLevel();
|
|
||||||
m_SystemAddress = m_ParentUser->GetSystemAddress();
|
|
||||||
m_DroppedLoot = {};
|
|
||||||
m_DroppedCoins = 0;
|
|
||||||
|
|
||||||
m_GhostReferencePoint = NiPoint3::ZERO;
|
|
||||||
m_GhostOverridePoint = NiPoint3::ZERO;
|
|
||||||
m_GhostOverride = false;
|
|
||||||
m_ObservedEntitiesLength = 256;
|
|
||||||
m_ObservedEntitiesUsed = 0;
|
|
||||||
m_ObservedEntities.resize(m_ObservedEntitiesLength);
|
|
||||||
|
|
||||||
m_Character->SetEntity(this);
|
|
||||||
|
|
||||||
const auto& iter = std::find(m_Players.begin(), m_Players.end(), this);
|
|
||||||
|
|
||||||
if (iter != m_Players.end()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Players.push_back(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
User* Player::GetParentUser() const {
|
|
||||||
return m_ParentUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemAddress Player::GetSystemAddress() const {
|
|
||||||
return m_SystemAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::SetSystemAddress(const SystemAddress& value) {
|
|
||||||
m_SystemAddress = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::SetRespawnPos(const NiPoint3 position) {
|
|
||||||
if (!m_Character) return;
|
|
||||||
|
|
||||||
m_respawnPos = position;
|
|
||||||
|
|
||||||
m_Character->SetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID(), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::SetRespawnRot(const NiQuaternion rotation) {
|
|
||||||
m_respawnRot = rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
NiPoint3 Player::GetRespawnPosition() const {
|
|
||||||
return m_respawnPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
NiQuaternion Player::GetRespawnRotation() const {
|
|
||||||
return m_respawnRot;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::SendMail(const LWOOBJID sender, const std::string& senderName, const std::string& subject, const std::string& body, LOT attachment, uint16_t attachmentCount) const {
|
|
||||||
Mail::SendMail(sender, senderName, this, subject, body, attachment, attachmentCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId) {
|
|
||||||
const auto objid = GetObjectID();
|
|
||||||
|
|
||||||
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneId, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
|
||||||
auto* entity = Game::entityManager->GetEntity(objid);
|
|
||||||
|
|
||||||
if (entity == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto sysAddr = entity->GetSystemAddress();
|
|
||||||
|
|
||||||
auto* character = entity->GetCharacter();
|
|
||||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
|
||||||
|
|
||||||
if (character != nullptr && characterComponent != nullptr) {
|
|
||||||
character->SetZoneID(zoneID);
|
|
||||||
character->SetZoneInstance(zoneInstance);
|
|
||||||
character->SetZoneClone(zoneClone);
|
|
||||||
|
|
||||||
characterComponent->SetLastRocketConfig(u"");
|
|
||||||
|
|
||||||
character->SaveXMLToDatabase();
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
|
|
||||||
|
|
||||||
Game::entityManager->DestructEntity(entity);
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::AddLimboConstruction(LWOOBJID objectId) {
|
|
||||||
const auto& iter = std::find(m_LimboConstructions.begin(), m_LimboConstructions.end(), objectId);
|
|
||||||
|
|
||||||
if (iter != m_LimboConstructions.end()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_LimboConstructions.push_back(objectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::RemoveLimboConstruction(LWOOBJID objectId) {
|
|
||||||
const auto& iter = std::find(m_LimboConstructions.begin(), m_LimboConstructions.end(), objectId);
|
|
||||||
|
|
||||||
if (iter == m_LimboConstructions.end()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_LimboConstructions.erase(iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::ConstructLimboEntities() {
|
|
||||||
for (const auto objectId : m_LimboConstructions) {
|
|
||||||
auto* entity = Game::entityManager->GetEntity(objectId);
|
|
||||||
|
|
||||||
if (entity == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Game::entityManager->ConstructEntity(entity, m_SystemAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_LimboConstructions.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<LWOOBJID, Loot::Info>& Player::GetDroppedLoot() {
|
|
||||||
return m_DroppedLoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NiPoint3& Player::GetGhostReferencePoint() const {
|
|
||||||
return m_GhostOverride ? m_GhostOverridePoint : m_GhostReferencePoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NiPoint3& Player::GetOriginGhostReferencePoint() const {
|
|
||||||
return m_GhostReferencePoint;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SetGhostReferencePoint(const NiPoint3& value) {
|
void Player::SetGhostReferencePoint(const NiPoint3& value) {
|
||||||
@ -169,52 +29,94 @@ void Player::SetGhostOverridePoint(const NiPoint3& value) {
|
|||||||
m_GhostOverridePoint = value;
|
m_GhostOverridePoint = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NiPoint3& Player::GetGhostOverridePoint() const {
|
void Player::SetRespawnPos(const NiPoint3& position) {
|
||||||
return m_GhostOverridePoint;
|
if (!m_Character) return;
|
||||||
|
|
||||||
|
m_respawnPos = position;
|
||||||
|
|
||||||
|
m_Character->SetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID(), position);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SetGhostOverride(bool value) {
|
void Player::SetRespawnRot(const NiQuaternion& rotation) {
|
||||||
m_GhostOverride = value;
|
m_respawnRot = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::GetGhostOverride() const {
|
void Player::SetSystemAddress(const SystemAddress& value) {
|
||||||
return m_GhostOverride;
|
m_SystemAddress = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player::Player(const LWOOBJID& objectID, const EntityInfo info, User* user, Entity* parentEntity) : Entity(objectID, info, parentEntity) {
|
||||||
|
m_ParentUser = user;
|
||||||
|
m_Character = m_ParentUser->GetLastUsedChar();
|
||||||
|
m_ParentUser->SetLoggedInChar(objectID);
|
||||||
|
m_GMLevel = m_Character->GetGMLevel();
|
||||||
|
m_SystemAddress = m_ParentUser->GetSystemAddress();
|
||||||
|
m_DroppedCoins = 0;
|
||||||
|
|
||||||
|
m_GhostReferencePoint = NiPoint3::ZERO;
|
||||||
|
m_GhostOverridePoint = NiPoint3::ZERO;
|
||||||
|
m_GhostOverride = false;
|
||||||
|
|
||||||
|
int32_t initialObservedEntitiesCapacity = 256;
|
||||||
|
m_ObservedEntities.resize(initialObservedEntitiesCapacity);
|
||||||
|
|
||||||
|
m_Character->SetEntity(this);
|
||||||
|
|
||||||
|
const auto& iter = std::find(m_Players.begin(), m_Players.end(), this);
|
||||||
|
|
||||||
|
if (iter == m_Players.end()) {
|
||||||
|
m_Players.push_back(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::AddLimboConstruction(LWOOBJID objectId) {
|
||||||
|
const auto iter = std::find(m_LimboConstructions.begin(), m_LimboConstructions.end(), objectId);
|
||||||
|
if (iter == m_LimboConstructions.end()) {
|
||||||
|
m_LimboConstructions.push_back(objectId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::RemoveLimboConstruction(LWOOBJID objectId) {
|
||||||
|
const auto iter = std::find(m_LimboConstructions.begin(), m_LimboConstructions.end(), objectId);
|
||||||
|
if (iter != m_LimboConstructions.end()) {
|
||||||
|
m_LimboConstructions.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::ConstructLimboEntities() {
|
||||||
|
for (const auto& objectId : m_LimboConstructions) {
|
||||||
|
auto* entity = Game::entityManager->GetEntity(objectId);
|
||||||
|
if (!entity) continue;
|
||||||
|
|
||||||
|
Game::entityManager->ConstructEntity(entity, m_SystemAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_LimboConstructions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::ObserveEntity(int32_t id) {
|
void Player::ObserveEntity(int32_t id) {
|
||||||
for (int32_t i = 0; i < m_ObservedEntitiesUsed; i++) {
|
for (auto& observedEntity : m_ObservedEntities) {
|
||||||
if (m_ObservedEntities[i] == 0 || m_ObservedEntities[i] == id) {
|
if (observedEntity == 0 || observedEntity == id) {
|
||||||
m_ObservedEntities[i] = id;
|
observedEntity = id;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto index = m_ObservedEntitiesUsed++;
|
m_ObservedEntities.reserve(m_ObservedEntities.size() + 1);
|
||||||
|
|
||||||
if (m_ObservedEntitiesUsed > m_ObservedEntitiesLength) {
|
m_ObservedEntities.push_back(id);
|
||||||
m_ObservedEntities.resize(m_ObservedEntitiesLength + m_ObservedEntitiesLength);
|
|
||||||
|
|
||||||
m_ObservedEntitiesLength = m_ObservedEntitiesLength + m_ObservedEntitiesLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ObservedEntities[index] = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::IsObserved(int32_t id) {
|
bool Player::IsObserved(int32_t id) {
|
||||||
for (int32_t i = 0; i < m_ObservedEntitiesUsed; i++) {
|
return std::find(m_ObservedEntities.begin(), m_ObservedEntities.end(), id) != m_ObservedEntities.end();
|
||||||
if (m_ObservedEntities[i] == id) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::GhostEntity(int32_t id) {
|
void Player::GhostEntity(int32_t id) {
|
||||||
for (int32_t i = 0; i < m_ObservedEntitiesUsed; i++) {
|
for (auto& observedEntity : m_ObservedEntities) {
|
||||||
if (m_ObservedEntities[i] == id) {
|
if (observedEntity == id) {
|
||||||
m_ObservedEntities[i] = 0;
|
observedEntity = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,59 +130,44 @@ Player* Player::GetPlayer(const SystemAddress& sysAddr) {
|
|||||||
Player* Player::GetPlayer(const std::string& name) {
|
Player* Player::GetPlayer(const std::string& name) {
|
||||||
const auto characters = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CHARACTER);
|
const auto characters = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::CHARACTER);
|
||||||
|
|
||||||
|
Player* player = nullptr;
|
||||||
for (auto* character : characters) {
|
for (auto* character : characters) {
|
||||||
if (!character->IsPlayer()) continue;
|
if (!character->IsPlayer()) continue;
|
||||||
|
|
||||||
if (GeneralUtils::CaseInsensitiveStringCompare(name, character->GetCharacter()->GetName())) {
|
if (GeneralUtils::CaseInsensitiveStringCompare(name, character->GetCharacter()->GetName())) {
|
||||||
return dynamic_cast<Player*>(character);
|
player = dynamic_cast<Player*>(character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* Player::GetPlayer(LWOOBJID playerID) {
|
Player* Player::GetPlayer(LWOOBJID playerID) {
|
||||||
|
Player* playerToReturn = nullptr;
|
||||||
for (auto* player : m_Players) {
|
for (auto* player : m_Players) {
|
||||||
if (player->GetObjectID() == playerID) {
|
if (player->GetObjectID() == playerID) {
|
||||||
return player;
|
playerToReturn = player;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return playerToReturn;
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<Player*>& Player::GetAllPlayers() {
|
|
||||||
return m_Players;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t Player::GetDroppedCoins() {
|
|
||||||
return m_DroppedCoins;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::SetDroppedCoins(uint64_t value) {
|
|
||||||
m_DroppedCoins = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player() {
|
Player::~Player() {
|
||||||
LOG("Deleted player");
|
LOG("Deleted player");
|
||||||
|
|
||||||
for (int32_t i = 0; i < m_ObservedEntitiesUsed; i++) {
|
for (auto& observedEntity : m_ObservedEntities) {
|
||||||
const auto id = m_ObservedEntities[i];
|
if (observedEntity == 0) continue;
|
||||||
|
|
||||||
if (id == 0) {
|
auto* entity = Game::entityManager->GetGhostCandidate(observedEntity);
|
||||||
continue;
|
if (!entity) continue;
|
||||||
}
|
|
||||||
|
|
||||||
auto* entity = Game::entityManager->GetGhostCandidate(id);
|
|
||||||
|
|
||||||
if (entity != nullptr) {
|
|
||||||
entity->SetObservers(entity->GetObservers() - 1);
|
entity->SetObservers(entity->GetObservers() - 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_LimboConstructions.clear();
|
m_LimboConstructions.clear();
|
||||||
|
|
||||||
const auto& iter = std::find(m_Players.begin(), m_Players.end(), this);
|
const auto iter = std::find(m_Players.begin(), m_Players.end(), this);
|
||||||
|
|
||||||
if (iter == m_Players.end()) {
|
if (iter == m_Players.end()) {
|
||||||
return;
|
return;
|
||||||
|
@ -18,64 +18,44 @@ public:
|
|||||||
* Getters
|
* Getters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
User* GetParentUser() const override;
|
User* GetParentUser() const override { return m_ParentUser; };
|
||||||
|
|
||||||
SystemAddress GetSystemAddress() const override;
|
const SystemAddress& GetSystemAddress() const override { return m_SystemAddress; };
|
||||||
|
|
||||||
NiPoint3 GetRespawnPosition() const override;
|
const NiPoint3& GetRespawnPosition() const override { return m_respawnPos; };
|
||||||
|
|
||||||
NiQuaternion GetRespawnRotation() const override;
|
const NiQuaternion& GetRespawnRotation() const override { return m_respawnRot; };
|
||||||
|
|
||||||
const NiPoint3& GetGhostReferencePoint() const;
|
const NiPoint3& GetGhostReferencePoint() const { return m_GhostOverride ? m_GhostOverridePoint : m_GhostReferencePoint; };
|
||||||
|
|
||||||
const NiPoint3& GetOriginGhostReferencePoint() const;
|
const NiPoint3& GetOriginGhostReferencePoint() const { return m_GhostReferencePoint; };
|
||||||
|
|
||||||
const NiPoint3& GetGhostOverridePoint() const;
|
const NiPoint3& GetGhostOverridePoint() const { return m_GhostOverridePoint; };
|
||||||
|
|
||||||
bool GetGhostOverride() const;
|
bool GetGhostOverride() const { return m_GhostOverride; };
|
||||||
|
|
||||||
std::map<LWOOBJID, Loot::Info>& GetDroppedLoot();
|
std::map<LWOOBJID, Loot::Info>& GetDroppedLoot() { return m_DroppedLoot; };
|
||||||
|
|
||||||
uint64_t GetDroppedCoins();
|
uint64_t GetDroppedCoins() const { return m_DroppedCoins; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setters
|
* Setters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void SetGhostOverride(bool value) { m_GhostOverride = value; };
|
||||||
|
|
||||||
|
void SetDroppedCoins(const uint64_t value) { m_DroppedCoins = value; };
|
||||||
|
|
||||||
void SetSystemAddress(const SystemAddress& value) override;
|
void SetSystemAddress(const SystemAddress& value) override;
|
||||||
|
|
||||||
void SetRespawnPos(NiPoint3 position) override;
|
void SetRespawnPos(const NiPoint3& position) override;
|
||||||
|
|
||||||
void SetRespawnRot(NiQuaternion rotation) override;
|
void SetRespawnRot(const NiQuaternion& rotation) override;
|
||||||
|
|
||||||
void SetGhostReferencePoint(const NiPoint3& value);
|
void SetGhostReferencePoint(const NiPoint3& value);
|
||||||
|
|
||||||
void SetGhostOverridePoint(const NiPoint3& value);
|
void SetGhostOverridePoint(const NiPoint3& value);
|
||||||
|
|
||||||
void SetGhostOverride(bool value);
|
|
||||||
|
|
||||||
void SetDroppedCoins(uint64_t value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for sending an in-game mail.
|
|
||||||
*
|
|
||||||
* @param sender id of the sender. LWOOBJID_EMPTY for system mail
|
|
||||||
* @param senderName name of the sender. Max 32 characters.
|
|
||||||
* @param subject mail subject. Max 50 characters.
|
|
||||||
* @param body mail body. Max 400 characters.
|
|
||||||
* @param attachment LOT of the attached item. LOT_NULL if no attachment.
|
|
||||||
* @param attachmentCount stack size for attachment.
|
|
||||||
*/
|
|
||||||
void SendMail(LWOOBJID sender, const std::string& senderName, const std::string& subject, const std::string& body, LOT attachment, uint16_t attachmentCount) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for transfering the player to another instance.
|
|
||||||
*
|
|
||||||
* @param zoneId zoneID for the new instance.
|
|
||||||
* @param cloneId cloneID for the new instance.
|
|
||||||
*/
|
|
||||||
void SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId = 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ghosting
|
* Ghosting
|
||||||
*/
|
*/
|
||||||
@ -86,11 +66,11 @@ public:
|
|||||||
|
|
||||||
void ConstructLimboEntities();
|
void ConstructLimboEntities();
|
||||||
|
|
||||||
void ObserveEntity(int32_t id);
|
void ObserveEntity(const int32_t id);
|
||||||
|
|
||||||
bool IsObserved(int32_t id);
|
bool IsObserved(const int32_t id);
|
||||||
|
|
||||||
void GhostEntity(int32_t id);
|
void GhostEntity(const int32_t id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static methods
|
* Static methods
|
||||||
@ -122,15 +102,9 @@ private:
|
|||||||
|
|
||||||
std::vector<int32_t> m_ObservedEntities;
|
std::vector<int32_t> m_ObservedEntities;
|
||||||
|
|
||||||
int32_t m_ObservedEntitiesLength;
|
|
||||||
|
|
||||||
int32_t m_ObservedEntitiesUsed;
|
|
||||||
|
|
||||||
std::vector<LWOOBJID> m_LimboConstructions;
|
std::vector<LWOOBJID> m_LimboConstructions;
|
||||||
|
|
||||||
std::map<LWOOBJID, Loot::Info> m_DroppedLoot;
|
std::map<LWOOBJID, Loot::Info> m_DroppedLoot;
|
||||||
|
|
||||||
uint64_t m_DroppedCoins;
|
uint64_t m_DroppedCoins;
|
||||||
|
|
||||||
static std::vector<Player*> m_Players;
|
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "CDRewardCodesTable.h"
|
#include "CDRewardCodesTable.h"
|
||||||
#include "Mail.h"
|
#include "Mail.h"
|
||||||
|
#include "ZoneInstanceManager.h"
|
||||||
|
#include "WorldPackets.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
||||||
@ -768,7 +770,7 @@ void CharacterComponent::AwardClaimCodes() {
|
|||||||
if (rewardCodes.empty()) return;
|
if (rewardCodes.empty()) return;
|
||||||
|
|
||||||
auto* cdrewardCodes = CDClientManager::Instance().GetTable<CDRewardCodesTable>();
|
auto* cdrewardCodes = CDClientManager::Instance().GetTable<CDRewardCodesTable>();
|
||||||
for (auto const rewardCode: rewardCodes){
|
for (auto const rewardCode : rewardCodes) {
|
||||||
LOG_DEBUG("Processing RewardCode %i", rewardCode);
|
LOG_DEBUG("Processing RewardCode %i", rewardCode);
|
||||||
const uint32_t rewardCodeIndex = rewardCode >> 6;
|
const uint32_t rewardCodeIndex = rewardCode >> 6;
|
||||||
const uint32_t bitIndex = rewardCode % 64;
|
const uint32_t bitIndex = rewardCode % 64;
|
||||||
@ -786,3 +788,32 @@ void CharacterComponent::AwardClaimCodes() {
|
|||||||
Mail::SendMail(LWOOBJID_EMPTY, "%[MAIL_SYSTEM_NOTIFICATION]", m_Parent, subject.str(), body.str(), attachmentLOT, 1);
|
Mail::SendMail(LWOOBJID_EMPTY, "%[MAIL_SYSTEM_NOTIFICATION]", m_Parent, subject.str(), body.str(), attachmentLOT, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CharacterComponent::SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId) const {
|
||||||
|
const auto objid = m_Parent->GetObjectID();
|
||||||
|
|
||||||
|
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneId, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
||||||
|
auto* entity = Game::entityManager->GetEntity(objid);
|
||||||
|
|
||||||
|
if (!entity) return;
|
||||||
|
|
||||||
|
const auto sysAddr = entity->GetSystemAddress();
|
||||||
|
|
||||||
|
auto* character = entity->GetCharacter();
|
||||||
|
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||||
|
|
||||||
|
if (character && characterComponent) {
|
||||||
|
character->SetZoneID(zoneID);
|
||||||
|
character->SetZoneInstance(zoneInstance);
|
||||||
|
character->SetZoneClone(zoneClone);
|
||||||
|
|
||||||
|
characterComponent->SetLastRocketConfig(u"");
|
||||||
|
|
||||||
|
character->SaveXMLToDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldPackets::SendTransferToWorld(sysAddr, serverIP, serverPort, mythranShift);
|
||||||
|
|
||||||
|
Game::entityManager->DestructEntity(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -281,6 +281,14 @@ public:
|
|||||||
|
|
||||||
LWOOBJID GetCurrentInteracting() {return m_CurrentInteracting;};
|
LWOOBJID GetCurrentInteracting() {return m_CurrentInteracting;};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a player to another zone with an optional clone ID
|
||||||
|
*
|
||||||
|
* @param zoneId zoneID for the new instance.
|
||||||
|
* @param cloneId cloneID for the new instance.
|
||||||
|
*/
|
||||||
|
void SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId = 0) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character info regarding this character, including clothing styles, etc.
|
* Character info regarding this character, including clothing styles, etc.
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
#include "eUseItemResponse.h"
|
#include "eUseItemResponse.h"
|
||||||
|
#include "Mail.h"
|
||||||
|
|
||||||
#include "CDComponentsRegistryTable.h"
|
#include "CDComponentsRegistryTable.h"
|
||||||
#include "CDInventoryComponentTable.h"
|
#include "CDInventoryComponentTable.h"
|
||||||
@ -264,17 +265,11 @@ void InventoryComponent::AddItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (slot == -1) {
|
if (slot == -1) {
|
||||||
auto* player = dynamic_cast<Player*>(GetParent());
|
|
||||||
|
|
||||||
if (player == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
outOfSpace += size;
|
outOfSpace += size;
|
||||||
|
|
||||||
switch (sourceType) {
|
switch (sourceType) {
|
||||||
case 0:
|
case 0:
|
||||||
player->SendMail(LWOOBJID_EMPTY, "Darkflame Universe", "Lost Reward", "You received an item and didn't have room for it.", lot, size);
|
Mail::SendMail(LWOOBJID_EMPTY, "Darkflame Universe", m_Parent, "Lost Reward", "You received an item and didn't have room for it.", lot, size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "eObjectBits.h"
|
#include "eObjectBits.h"
|
||||||
|
#include "CharacterComponent.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
@ -247,7 +248,8 @@ void PropertyManagementComponent::OnStartBuilding() {
|
|||||||
for (auto* player : players) {
|
for (auto* player : players) {
|
||||||
if (player == ownerEntity) continue;
|
if (player == ownerEntity) continue;
|
||||||
|
|
||||||
player->SendToZone(zoneId);
|
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||||
|
if (characterComponent) characterComponent->SendToZone(zoneId);
|
||||||
}
|
}
|
||||||
auto inventoryComponent = ownerEntity->GetComponent<InventoryComponent>();
|
auto inventoryComponent = ownerEntity->GetComponent<InventoryComponent>();
|
||||||
|
|
||||||
|
@ -71,10 +71,8 @@ void RacingControlComponent::OnPlayerLoaded(Entity* player) {
|
|||||||
|
|
||||||
// If the race has already started, send the player back to the main world.
|
// If the race has already started, send the player back to the main world.
|
||||||
if (m_Loaded || !vehicle) {
|
if (m_Loaded || !vehicle) {
|
||||||
auto* playerInstance = dynamic_cast<Player*>(player);
|
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||||
if (playerInstance) {
|
if (characterComponent) characterComponent->SendToZone(m_MainWorld);
|
||||||
playerInstance->SendToZone(m_MainWorld);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,10 +103,11 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
|||||||
|
|
||||||
if (item == nullptr) {
|
if (item == nullptr) {
|
||||||
LOG("Failed to find item");
|
LOG("Failed to find item");
|
||||||
auto* playerInstance = dynamic_cast<Player*>(player);
|
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||||
if (playerInstance) {
|
|
||||||
|
if (characterComponent) {
|
||||||
m_LoadedPlayers--;
|
m_LoadedPlayers--;
|
||||||
playerInstance->SendToZone(m_MainWorld);
|
characterComponent->SendToZone(m_MainWorld);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -427,9 +426,9 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
|
|||||||
m_Parent->GetObjectID(), 3, 0, LWOOBJID_EMPTY, u"",
|
m_Parent->GetObjectID(), 3, 0, LWOOBJID_EMPTY, u"",
|
||||||
player->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
player->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
auto* playerInstance = dynamic_cast<Player*>(player);
|
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||||
|
|
||||||
playerInstance->SendToZone(m_MainWorld);
|
if (characterComponent) characterComponent->SendToZone(m_MainWorld);
|
||||||
|
|
||||||
vehicle->Kill();
|
vehicle->Kill();
|
||||||
}
|
}
|
||||||
@ -561,9 +560,9 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* playerInstance = dynamic_cast<Player*>(playerEntity);
|
auto* characterComponent = playerEntity->GetComponent<CharacterComponent>();
|
||||||
|
|
||||||
playerInstance->SendToZone(m_MainWorld);
|
if (characterComponent) characterComponent->SendToZone(m_MainWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LobbyPlayers.clear();
|
m_LobbyPlayers.clear();
|
||||||
@ -623,9 +622,9 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* playerInstance = dynamic_cast<Player*>(playerEntity);
|
auto* characterComponent = playerEntity->GetComponent<CharacterComponent>();
|
||||||
|
|
||||||
playerInstance->SendToZone(m_MainWorld);
|
if (characterComponent) characterComponent->SendToZone(m_MainWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "BaseConsoleTeleportServer.h"
|
#include "BaseConsoleTeleportServer.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "Player.h"
|
#include "CharacterComponent.h"
|
||||||
#include "RenderComponent.h"
|
#include "RenderComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "eTerminateType.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");
|
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);
|
UpdatePlayerTable(self, player, false);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "Player.h"
|
#include "CharacterComponent.h"
|
||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "eMissionState.h"
|
#include "eMissionState.h"
|
||||||
#include "MissionComponent.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());
|
const auto& playersIter = std::find(state.players.begin(), state.players.end(), player->GetObjectID());
|
||||||
|
|
||||||
if (waitingIter != state.waitingPlayers.end() || playersIter != state.players.end()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,8 +162,8 @@ void BaseSurvivalServer::BaseMessageBoxResponse(Entity* self, Entity* sender, in
|
|||||||
if (sender->IsPlayer()) {
|
if (sender->IsPlayer()) {
|
||||||
auto* character = sender->GetCharacter();
|
auto* character = sender->GetCharacter();
|
||||||
if (character != nullptr) {
|
if (character != nullptr) {
|
||||||
auto* player = dynamic_cast<Player*>(sender);
|
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||||
player->SendToZone(character->GetLastNonInstanceZoneID());
|
if (characterComponent) characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "Player.h"
|
#include "CharacterComponent.h"
|
||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
#include "eMissionState.h"
|
#include "eMissionState.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
@ -162,8 +162,8 @@ void BaseWavesServer::BaseMessageBoxResponse(Entity* self, Entity* sender, int32
|
|||||||
if (sender->IsPlayer()) {
|
if (sender->IsPlayer()) {
|
||||||
auto* character = sender->GetCharacter();
|
auto* character = sender->GetCharacter();
|
||||||
if (character != nullptr) {
|
if (character != nullptr) {
|
||||||
auto* player = dynamic_cast<Player*>(sender);
|
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||||
player->SendToZone(character->GetLastNonInstanceZoneID());
|
if (characterComponent) characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "InstanceExitTransferPlayerToLastNonInstance.h"
|
#include "InstanceExitTransferPlayerToLastNonInstance.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "Player.h"
|
#include "CharacterComponent.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "eTerminateType.h"
|
#include "eTerminateType.h"
|
||||||
@ -23,9 +23,7 @@ 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) {
|
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 (!sender->IsPlayer()) return;
|
||||||
if (player == nullptr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto* character = sender->GetCharacter();
|
auto* character = sender->GetCharacter();
|
||||||
if (character != nullptr) {
|
if (character != nullptr) {
|
||||||
@ -47,7 +45,8 @@ void InstanceExitTransferPlayerToLastNonInstance::OnMessageBoxResponse(Entity* s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player->SendToZone(lastInstance);
|
auto* characterComponent = sender->GetComponent<CharacterComponent>();
|
||||||
|
if (characterComponent) characterComponent->SendToZone(lastInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,16 +453,12 @@ void SGCannon::SpawnNewModel(Entity* self) {
|
|||||||
|
|
||||||
void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
||||||
auto* player = Game::entityManager->GetEntity(playerID);
|
auto* player = Game::entityManager->GetEntity(playerID);
|
||||||
if (player == nullptr)
|
if (!player) return;
|
||||||
return;
|
|
||||||
|
|
||||||
auto* playerObject = dynamic_cast<Player*>(player);
|
auto* character = player->GetCharacter();
|
||||||
if (playerObject == nullptr)
|
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||||
return;
|
if (characterComponent && character) {
|
||||||
|
characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
|
||||||
auto* character = playerObject->GetCharacter();
|
|
||||||
if (character != nullptr) {
|
|
||||||
playerObject->SendToZone(character->GetLastNonInstanceZoneID());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "WblGenericZone.h"
|
#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) {
|
void WblGenericZone::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||||
if (args == m_WblAbortMsg) {
|
if (args == m_WblAbortMsg) {
|
||||||
if (!sender) return;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user