mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-19 22:08:08 +00:00
Merge branch 'main' into guild_temp
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include <BitStream.h>
|
||||
#include "tinyxml2.h"
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "dServer.h"
|
||||
#include "dZoneManager.h"
|
||||
@@ -13,6 +13,10 @@
|
||||
#include "VehiclePhysicsComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Item.h"
|
||||
#include "Amf3.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eGameActivity.h"
|
||||
#include <ctime>
|
||||
|
||||
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
||||
m_Character = character;
|
||||
@@ -33,7 +37,7 @@ CharacterComponent::CharacterComponent(Entity* parent, Character* character) : C
|
||||
m_EditorLevel = m_GMLevel;
|
||||
m_Reputation = 0;
|
||||
|
||||
m_CurrentActivity = 0;
|
||||
m_CurrentActivity = eGameActivity::NONE;
|
||||
m_CountryCode = 0;
|
||||
m_LastUpdateTimestamp = std::time(nullptr);
|
||||
|
||||
@@ -45,7 +49,6 @@ bool CharacterComponent::LandingAnimDisabled(int zoneID) {
|
||||
switch (zoneID) {
|
||||
case 0:
|
||||
case 556:
|
||||
case 1001:
|
||||
case 1101:
|
||||
case 1202:
|
||||
case 1203:
|
||||
@@ -71,7 +74,7 @@ bool CharacterComponent::LandingAnimDisabled(int zoneID) {
|
||||
CharacterComponent::~CharacterComponent() {
|
||||
}
|
||||
|
||||
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
|
||||
|
||||
if (bIsInitialUpdate) {
|
||||
outBitStream->Write0();
|
||||
@@ -169,9 +172,9 @@ void CharacterComponent::SetPvpEnabled(const bool value) {
|
||||
m_PvpEnabled = value;
|
||||
}
|
||||
|
||||
void CharacterComponent::SetGMLevel(int gmlevel) {
|
||||
void CharacterComponent::SetGMLevel(eGameMasterLevel gmlevel) {
|
||||
m_DirtyGMInfo = true;
|
||||
if (gmlevel > 0) m_IsGM = true;
|
||||
if (gmlevel > eGameMasterLevel::CIVILIAN) m_IsGM = true;
|
||||
else m_IsGM = false;
|
||||
m_GMLevel = gmlevel;
|
||||
}
|
||||
@@ -186,7 +189,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
Game::logger->Log("CharacterComponent", "Failed to find char tag while loading XML!");
|
||||
LOG("Failed to find char tag while loading XML!");
|
||||
return;
|
||||
}
|
||||
if (character->QueryAttribute("rpt", &m_Reputation) == tinyxml2::XML_NO_ATTRIBUTE) {
|
||||
@@ -249,7 +252,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
// End custom attributes
|
||||
//
|
||||
|
||||
if (m_GMLevel > 0) {
|
||||
if (m_GMLevel > eGameMasterLevel::CIVILIAN) {
|
||||
m_IsGM = true;
|
||||
m_DirtyGMInfo = true;
|
||||
m_EditorLevel = m_GMLevel;
|
||||
@@ -291,7 +294,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* minifig = doc->FirstChildElement("obj")->FirstChildElement("mf");
|
||||
if (!minifig) {
|
||||
Game::logger->Log("CharacterComponent", "Failed to find mf tag while updating XML!");
|
||||
LOG("Failed to find mf tag while updating XML!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -311,7 +314,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
Game::logger->Log("CharacterComponent", "Failed to find char tag while updating XML!");
|
||||
LOG("Failed to find char tag while updating XML!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -364,7 +367,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
|
||||
auto newUpdateTimestamp = std::time(nullptr);
|
||||
Game::logger->Log("TotalTimePlayed", "Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp);
|
||||
LOG("Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp);
|
||||
|
||||
m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp;
|
||||
character->SetAttribute("time", m_TotalTimePlayed);
|
||||
@@ -394,7 +397,7 @@ Item* CharacterComponent::GetRocket(Entity* player) {
|
||||
}
|
||||
|
||||
if (!rocket) {
|
||||
Game::logger->Log("CharacterComponent", "Unable to find rocket to equip!");
|
||||
LOG("Unable to find rocket to equip!");
|
||||
return rocket;
|
||||
}
|
||||
return rocket;
|
||||
@@ -432,7 +435,7 @@ void CharacterComponent::TrackMissionCompletion(bool isAchievement) {
|
||||
|
||||
// Achievements are tracked separately for the zone
|
||||
if (isAchievement) {
|
||||
const auto mapID = dZoneManager::Instance()->GetZoneID().GetMapID();
|
||||
const auto mapID = Game::zoneManager->GetZoneID().GetMapID();
|
||||
GetZoneStatisticsForMap(mapID).m_AchievementsCollected++;
|
||||
}
|
||||
}
|
||||
@@ -493,7 +496,7 @@ void CharacterComponent::TrackArmorDelta(int32_t armor) {
|
||||
void CharacterComponent::TrackRebuildComplete() {
|
||||
UpdatePlayerStatistic(QuickBuildsCompleted);
|
||||
|
||||
const auto mapID = dZoneManager::Instance()->GetZoneID().GetMapID();
|
||||
const auto mapID = Game::zoneManager->GetZoneID().GetMapID();
|
||||
GetZoneStatisticsForMap(mapID).m_QuickBuildsCompleted++;
|
||||
}
|
||||
|
||||
@@ -747,6 +750,6 @@ void CharacterComponent::RemoveVentureVisionEffect(std::string ventureVisionType
|
||||
void CharacterComponent::UpdateClientMinimap(bool showFaction, std::string ventureVisionType) const {
|
||||
if (!m_Parent) return;
|
||||
AMFArrayValue arrayToSend;
|
||||
arrayToSend.InsertValue(ventureVisionType, showFaction ? static_cast<AMFValue*>(new AMFTrueValue()) : static_cast<AMFValue*>(new AMFFalseValue()));
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", &arrayToSend);
|
||||
arrayToSend.Insert(ventureVisionType, showFaction);
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", arrayToSend);
|
||||
}
|
||||
|
Reference in New Issue
Block a user