chore: Player class removal (#1445)

* SystemAddress and destructor

* move respawn logic to character comp

Tested that respawn pos and rot can be set as per previously by crossing a respawn point and smashing to see if I would respawn at the new place.

* Move loot cheat checking

* Remove GetParentUser overload

Tested completing missions
control behaviors
collecting life crate
completing a bunch of missions using macros
loading into worlds
brick-by-brick
placing models
digging the x spot in gnarled forest
can still ban and mute players
cheat detection is still doing its thing
flags are still set (checked with flag 45)
claim codes still work (created new char, checked the lego club mail was there)

* Move player constructor logic

Its now at the bottom of Entity constructor.  Time to remove Player

* Remove Player class

Removes the Player class.  Tested that I can still login and see another player in Venture Explorer and logging out a few times still works as well as smashing enemies

* store ptr

* Update SlashCommandHandler.cpp
This commit is contained in:
David Markowitz
2024-02-04 06:29:05 -08:00
committed by GitHub
parent 050184c558
commit f0b6ad89d9
28 changed files with 215 additions and 260 deletions

View File

@@ -24,6 +24,7 @@
#include "eMissionTaskType.h"
#include "eMissionLockState.h"
#include "eReplicaComponentType.h"
#include "Character.h"
#include "CDMissionEmailTable.h"
@@ -208,8 +209,8 @@ Entity* Mission::GetAssociate() const {
return m_MissionComponent->GetParent();
}
User* Mission::GetUser() const {
return GetAssociate()->GetParentUser();
Character* Mission::GetCharacter() const {
return GetAssociate()->GetCharacter();
}
uint32_t Mission::GetMissionId() const {
@@ -390,7 +391,7 @@ void Mission::Catchup() {
if (type == eMissionTaskType::PLAYER_FLAG) {
for (int32_t target : task->GetAllTargets()) {
const auto flag = GetUser()->GetLastUsedChar()->GetPlayerFlag(target);
const auto flag = GetCharacter()->GetPlayerFlag(target);
if (!flag) {
continue;
@@ -413,7 +414,7 @@ void Mission::YieldRewards() {
return;
}
auto* character = GetUser()->GetLastUsedChar();
auto* character = GetCharacter();
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
@@ -599,8 +600,10 @@ void Mission::SetMissionState(const eMissionState state, const bool sendingRewar
if (entity == nullptr) {
return;
}
auto* characterComponent = entity->GetComponent<CharacterComponent>();
if (!characterComponent) return;
GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info.id, static_cast<int>(state), sendingRewards);
GameMessages::SendNotifyMission(entity, characterComponent->GetSystemAddress(), info.id, static_cast<int>(state), sendingRewards);
}
void Mission::SetMissionTypeState(eMissionLockState state, const std::string& type, const std::string& subType) {

View File

@@ -17,6 +17,7 @@ namespace tinyxml2 {
enum class eMissionState : int;
enum class eMissionLockState : int;
class MissionComponent;
class Character;
/**
* A mission (or achievement) that a player may unlock, progress and complete.
@@ -46,7 +47,7 @@ public:
* Returns the account owns the entity that is currently progressing this mission
* @return the account owns the entity that is currently progressing this mission
*/
User* GetUser() const;
Character* GetCharacter() const;
/**
* Returns the current state of this mission