mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-21 03:35:05 -06:00
Compare commits
1 Commits
v3.0.1
...
entity-cle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81b4f84d03 |
@@ -72,7 +72,7 @@ std::string FdbToSqlite::Convert::ReadString(std::istream& cdClientBuffer) {
|
||||
const auto readString = BinaryIO::ReadU8String(cdClientBuffer);
|
||||
|
||||
cdClientBuffer.seekg(prevPosition);
|
||||
return GeneralUtils::Latin1ToUTF8(readString);
|
||||
return GeneralUtils::Latin1ToWTF8(readString);
|
||||
}
|
||||
|
||||
int32_t FdbToSqlite::Convert::SeekPointer(std::istream& cdClientBuffer) {
|
||||
|
||||
@@ -167,18 +167,11 @@ std::u16string GeneralUtils::ASCIIToUTF16(const std::string_view string, const s
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string GeneralUtils::Latin1ToUTF8(const std::u8string_view string, const size_t size) {
|
||||
std::string toReturn{};
|
||||
|
||||
for (const auto u : string) {
|
||||
PushUTF8CodePoint(toReturn, u);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
//! Converts a (potentially-ill-formed) UTF-16 string to UTF-8
|
||||
//! Converts a (potentially-ill-formed) Latin1 string to UTF-8
|
||||
//! See: <http://simonsapin.github.io/wtf-8/#decoding-ill-formed-utf-16>
|
||||
std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const size_t size) {
|
||||
template<typename StringType>
|
||||
std::string ToWTF8(const StringType string, const size_t size) {
|
||||
const size_t newSize = MinSize(size, string);
|
||||
std::string ret;
|
||||
ret.reserve(newSize);
|
||||
@@ -203,6 +196,13 @@ std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const si
|
||||
|
||||
return ret;
|
||||
}
|
||||
std::string GeneralUtils::Latin1ToWTF8(const std::u8string_view string, const size_t size) {
|
||||
return ToWTF8(string, size);
|
||||
}
|
||||
|
||||
std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const size_t size) {
|
||||
return ToWTF8(string, size);
|
||||
}
|
||||
|
||||
bool GeneralUtils::CaseInsensitiveStringCompare(const std::string_view a, const std::string_view b) {
|
||||
return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); });
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace GeneralUtils {
|
||||
\param size A size to trim the string to. Default is SIZE_MAX (No trimming)
|
||||
\return An UTF-8 representation of the string
|
||||
*/
|
||||
std::string Latin1ToUTF8(const std::u8string_view string, const size_t size = SIZE_MAX);
|
||||
std::string Latin1ToWTF8(const std::u8string_view string, const size_t size = SIZE_MAX);
|
||||
|
||||
//! Converts a UTF-16 string to a UTF-8 string
|
||||
/*!
|
||||
|
||||
@@ -1378,7 +1378,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!other->GetIsDead()) {
|
||||
if (!other->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
if (GetComponent<BaseCombatAIComponent>() != nullptr) {
|
||||
const auto index = std::find(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), otherEntity);
|
||||
|
||||
@@ -1606,13 +1606,6 @@ void Entity::AddQuickBuildCompleteCallback(const std::function<void(Entity* user
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::GetIsDead() const {
|
||||
DestroyableComponent* dest = GetComponent<DestroyableComponent>();
|
||||
if (dest && dest->GetArmor() == 0 && dest->GetHealth() == 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Entity::AddLootItem(const Loot::Info& info) {
|
||||
if (!IsPlayer()) return;
|
||||
|
||||
|
||||
@@ -82,8 +82,6 @@ public:
|
||||
|
||||
const std::vector<LDFBaseData*>& GetNetworkSettings() const { return m_NetworkSettings; }
|
||||
|
||||
bool GetIsDead() const;
|
||||
|
||||
bool GetPlayerReadyForUpdates() const { return m_PlayerIsReadyForUpdates; }
|
||||
|
||||
bool GetIsGhostingCandidate() const;
|
||||
|
||||
@@ -227,7 +227,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
|
||||
bitStream.Write(armorDamageDealt);
|
||||
bitStream.Write(healthDamageDealt);
|
||||
bitStream.Write(targetEntity->GetIsDead());
|
||||
bitStream.Write(targetEntity->GetComponent<DestroyableComponent>()->GetIsDead());
|
||||
}
|
||||
|
||||
bitStream.Write(successState);
|
||||
|
||||
@@ -116,7 +116,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitS
|
||||
for (auto validTarget : validTargets) {
|
||||
if (targets.size() >= this->m_maxTargets) break;
|
||||
if (std::find(targets.begin(), targets.end(), validTarget) != targets.end()) continue;
|
||||
if (validTarget->GetIsDead()) continue;
|
||||
if (validTarget->GetComponent<DestroyableComponent>()->GetIsDead()) continue;
|
||||
|
||||
const auto targetPos = validTarget->GetPosition();
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
m_SoftTimer -= deltaTime;
|
||||
}
|
||||
|
||||
if (m_Disabled || m_Parent->GetIsDead())
|
||||
if (m_Disabled || m_Parent->GetComponent<DestroyableComponent>()->GetIsDead())
|
||||
return;
|
||||
bool stunnedThisFrame = m_Stunned;
|
||||
CalculateCombat(deltaTime); // Putting this here for now
|
||||
|
||||
@@ -160,7 +160,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
|
||||
}
|
||||
|
||||
//Kill player if health == 0
|
||||
if (entity->GetIsDead()) {
|
||||
if (entity->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
entity->Smash(entity->GetObjectID());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ void BaseEnemyApe::OnStartup(Entity* self) {
|
||||
|
||||
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
|
||||
auto* anchor = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
|
||||
if (anchor != nullptr && !anchor->GetIsDead()) {
|
||||
if (anchor != nullptr && !anchor->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
anchor->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,13 +152,13 @@ void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
|
||||
auto StateChangeType = eStateChangeType::POP;
|
||||
|
||||
if (bFreeze) {
|
||||
if (player->GetIsDead()) {
|
||||
if (player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StateChangeType = eStateChangeType::PUSH;
|
||||
} else {
|
||||
if (player->GetIsDead()) {
|
||||
if (player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
|
||||
for (auto memberID : team) {
|
||||
auto member = Game::entityManager->GetEntity(memberID);
|
||||
if (member != nullptr && !member->GetIsDead()) {
|
||||
if (member != nullptr && !member->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ bool BaseSurvivalServer::CheckAllPlayersDead() {
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player == nullptr || player->GetIsDead()) {
|
||||
if (player == nullptr || player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
deadPlayers++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ bool BaseWavesServer::CheckAllPlayersDead() {
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player == nullptr || player->GetIsDead()) {
|
||||
if (player == nullptr || player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
deadPlayers++;
|
||||
}
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void BaseWavesServer::SpawnWave(Entity* self) {
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player && player->GetIsDead()) {
|
||||
if (player && player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
player->Resurrect();
|
||||
}
|
||||
}
|
||||
@@ -501,7 +501,7 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player != nullptr && !player->GetIsDead()) {
|
||||
if (player != nullptr && !player->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
SetActivityValue(self, playerID, 1, currentTime);
|
||||
SetActivityValue(self, playerID, 2, state.waveNumber);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "ActPlayerDeathTrigger.h"
|
||||
|
||||
#include "DestroyableComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
if (!target->IsPlayer() || target->GetComponent<DestroyableComponent>()->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
|
||||
target->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ActSharkPlayerDeathTrigger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "Entity.h"
|
||||
@@ -11,7 +12,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen
|
||||
|
||||
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419);
|
||||
|
||||
if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
if (sender->GetComponent<DestroyableComponent>()->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
|
||||
if (sender->GetCharacter()) {
|
||||
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "AgShipPlayerDeathTrigger.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AgShipPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (target->GetLOT() == 1 && !target->GetIsDead()) {
|
||||
if (target->GetLOT() == 1 && !target->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"electro-shock-death");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "TriggerGas.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "Entity.h"
|
||||
@@ -28,7 +29,7 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != this->m_TimerName) return;
|
||||
auto players = self->GetVar<std::vector<Entity*>>(u"players");
|
||||
for (auto player : players) {
|
||||
if (player->GetIsDead() || !player){
|
||||
if (player->GetComponent<DestroyableComponent>()->GetIsDead() || !player){
|
||||
auto position = std::find(players.begin(), players.end(), player);
|
||||
if (position != players.end()) players.erase(position);
|
||||
continue;
|
||||
@@ -46,4 +47,3 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->SetVar(u"players", players);
|
||||
self->AddTimer(this->m_TimerName, this->m_Time);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "PetDigBuild.h"
|
||||
#include "EntityManager.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
@@ -45,7 +46,7 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
|
||||
return;
|
||||
|
||||
// If the quick build expired and the treasure was not collected, hide the treasure
|
||||
if (!treasure->GetIsDead()) {
|
||||
if (!treasure->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
treasure->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ void NsConcertInstrument::OnQuickBuildNotifyState(Entity* self, eQuickBuildState
|
||||
}
|
||||
|
||||
void NsConcertInstrument::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
if (!target->GetIsDead()) {
|
||||
if (!target->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
self->SetVar<LWOOBJID>(u"activePlayer", target->GetObjectID());
|
||||
|
||||
self->AddCallbackTimer(0.2f, [self, target]() {
|
||||
|
||||
@@ -267,31 +267,41 @@ int main(int argc, char** argv) {
|
||||
|
||||
// pre calculate the FDB checksum
|
||||
if (Game::config->GetValue("check_fdb") == "1") {
|
||||
auto cdclient = Game::assetManager->GetFile("cdclient.fdb");
|
||||
if (cdclient) {
|
||||
std::ifstream fileStream;
|
||||
|
||||
const int32_t bufferSize = 1024;
|
||||
MD5 md5;
|
||||
static const std::vector<std::string> aliases = {
|
||||
"CDServers.fdb",
|
||||
"cdserver.fdb",
|
||||
"CDClient.fdb",
|
||||
"cdclient.fdb",
|
||||
};
|
||||
|
||||
char fileStreamBuffer[bufferSize] = {};
|
||||
|
||||
while (!cdclient.eof()) {
|
||||
memset(fileStreamBuffer, 0, bufferSize);
|
||||
cdclient.read(fileStreamBuffer, bufferSize);
|
||||
md5.update(fileStreamBuffer, cdclient.gcount());
|
||||
for (const auto& file : aliases) {
|
||||
fileStream.open(Game::assetManager->GetResPath() / file, std::ios::binary | std::ios::in);
|
||||
if (fileStream.is_open()) {
|
||||
break;
|
||||
}
|
||||
|
||||
const char* nullTerminateBuffer = "\0";
|
||||
md5.update(nullTerminateBuffer, 1); // null terminate the data
|
||||
md5.finalize();
|
||||
databaseChecksum = md5.hexdigest();
|
||||
|
||||
LOG("FDB Checksum calculated as: %s", databaseChecksum.c_str());
|
||||
}
|
||||
if (databaseChecksum.empty()) {
|
||||
LOG("check_fdb is on but no fdb file found.");
|
||||
return EXIT_FAILURE;
|
||||
|
||||
const int32_t bufferSize = 1024;
|
||||
MD5 md5;
|
||||
|
||||
char fileStreamBuffer[1024] = {};
|
||||
|
||||
while (!fileStream.eof()) {
|
||||
memset(fileStreamBuffer, 0, bufferSize);
|
||||
fileStream.read(fileStreamBuffer, bufferSize);
|
||||
md5.update(fileStreamBuffer, fileStream.gcount());
|
||||
}
|
||||
|
||||
fileStream.close();
|
||||
|
||||
const char* nullTerminateBuffer = "\0";
|
||||
md5.update(nullTerminateBuffer, 1); // null terminate the data
|
||||
md5.finalize();
|
||||
databaseChecksum = md5.hexdigest();
|
||||
|
||||
LOG("FDB Checksum calculated as: %s", databaseChecksum.c_str());
|
||||
}
|
||||
|
||||
uint32_t currentFrameDelta = highFrameDelta;
|
||||
@@ -538,115 +548,115 @@ void HandlePacketChat(Packet* packet) {
|
||||
if (packet->data[0] == ID_USER_PACKET_ENUM && packet->length >= 4) {
|
||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT) {
|
||||
switch (static_cast<MessageType::Chat>(packet->data[3])) {
|
||||
case MessageType::Chat::WORLD_ROUTE_PACKET: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
LWOOBJID playerID;
|
||||
inStream.Read(playerID);
|
||||
case MessageType::Chat::WORLD_ROUTE_PACKET: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
LWOOBJID playerID;
|
||||
inStream.Read(playerID);
|
||||
|
||||
auto player = Game::entityManager->GetEntity(playerID);
|
||||
if (!player) return;
|
||||
auto player = Game::entityManager->GetEntity(playerID);
|
||||
if (!player) return;
|
||||
|
||||
auto sysAddr = player->GetSystemAddress();
|
||||
auto sysAddr = player->GetSystemAddress();
|
||||
|
||||
//Write our stream outwards:
|
||||
CBITSTREAM;
|
||||
unsigned char data;
|
||||
while (inStream.Read(data)) {
|
||||
bitStream.Write(data);
|
||||
//Write our stream outwards:
|
||||
CBITSTREAM;
|
||||
unsigned char data;
|
||||
while (inStream.Read(data)) {
|
||||
bitStream.Write(data);
|
||||
}
|
||||
|
||||
SEND_PACKET; //send routed packet to player
|
||||
break;
|
||||
}
|
||||
|
||||
SEND_PACKET; //send routed packet to player
|
||||
break;
|
||||
}
|
||||
case MessageType::Chat::GM_ANNOUNCE: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
|
||||
case MessageType::Chat::GM_ANNOUNCE: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
std::string title;
|
||||
std::string msg;
|
||||
|
||||
std::string title;
|
||||
std::string msg;
|
||||
uint32_t len;
|
||||
inStream.Read<uint32_t>(len);
|
||||
for (uint32_t i = 0; len > i; i++) {
|
||||
char character;
|
||||
inStream.Read<char>(character);
|
||||
title += character;
|
||||
}
|
||||
|
||||
uint32_t len;
|
||||
inStream.Read<uint32_t>(len);
|
||||
for (uint32_t i = 0; len > i; i++) {
|
||||
char character;
|
||||
inStream.Read<char>(character);
|
||||
title += character;
|
||||
}
|
||||
len = 0;
|
||||
inStream.Read<uint32_t>(len);
|
||||
for (uint32_t i = 0; len > i; i++) {
|
||||
char character;
|
||||
inStream.Read<char>(character);
|
||||
msg += character;
|
||||
}
|
||||
|
||||
len = 0;
|
||||
inStream.Read<uint32_t>(len);
|
||||
for (uint32_t i = 0; len > i; i++) {
|
||||
char character;
|
||||
inStream.Read<char>(character);
|
||||
msg += character;
|
||||
}
|
||||
//Send to our clients:
|
||||
AMFArrayValue args;
|
||||
|
||||
//Send to our clients:
|
||||
AMFArrayValue args;
|
||||
args.Insert("title", title);
|
||||
args.Insert("message", msg);
|
||||
|
||||
args.Insert("title", title);
|
||||
args.Insert("message", msg);
|
||||
|
||||
GameMessages::SendUIMessageServerToAllClients("ToggleAnnounce", args);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Chat::GM_MUTE: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
LWOOBJID playerId;
|
||||
time_t expire = 0;
|
||||
inStream.Read(playerId);
|
||||
inStream.Read(expire);
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(playerId);
|
||||
auto* character = entity != nullptr ? entity->GetCharacter() : nullptr;
|
||||
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
||||
if (user) {
|
||||
user->SetMuteExpire(expire);
|
||||
|
||||
entity->GetCharacter()->SendMuteNotice();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MessageType::Chat::TEAM_GET_STATUS: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
|
||||
LWOOBJID teamID = 0;
|
||||
char lootOption = 0;
|
||||
char memberCount = 0;
|
||||
std::vector<LWOOBJID> members;
|
||||
|
||||
inStream.Read(teamID);
|
||||
bool deleteTeam = inStream.ReadBit();
|
||||
|
||||
if (deleteTeam) {
|
||||
TeamManager::Instance()->DeleteTeam(teamID);
|
||||
|
||||
LOG("Deleting team (%llu)", teamID);
|
||||
GameMessages::SendUIMessageServerToAllClients("ToggleAnnounce", args);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
inStream.Read(lootOption);
|
||||
inStream.Read(memberCount);
|
||||
LOG("Updating team (%llu), (%i), (%i)", teamID, lootOption, memberCount);
|
||||
for (char i = 0; i < memberCount; i++) {
|
||||
LWOOBJID member = LWOOBJID_EMPTY;
|
||||
inStream.Read(member);
|
||||
members.push_back(member);
|
||||
case MessageType::Chat::GM_MUTE: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
LWOOBJID playerId;
|
||||
time_t expire = 0;
|
||||
inStream.Read(playerId);
|
||||
inStream.Read(expire);
|
||||
|
||||
LOG("Updating team member (%llu)", member);
|
||||
auto* entity = Game::entityManager->GetEntity(playerId);
|
||||
auto* character = entity != nullptr ? entity->GetCharacter() : nullptr;
|
||||
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
||||
if (user) {
|
||||
user->SetMuteExpire(expire);
|
||||
|
||||
entity->GetCharacter()->SendMuteNotice();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
TeamManager::Instance()->UpdateTeam(teamID, lootOption, members);
|
||||
case MessageType::Chat::TEAM_GET_STATUS: {
|
||||
CINSTREAM_SKIP_HEADER;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG("Received an unknown chat: %i", int(packet->data[3]));
|
||||
LWOOBJID teamID = 0;
|
||||
char lootOption = 0;
|
||||
char memberCount = 0;
|
||||
std::vector<LWOOBJID> members;
|
||||
|
||||
inStream.Read(teamID);
|
||||
bool deleteTeam = inStream.ReadBit();
|
||||
|
||||
if (deleteTeam) {
|
||||
TeamManager::Instance()->DeleteTeam(teamID);
|
||||
|
||||
LOG("Deleting team (%llu)", teamID);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
inStream.Read(lootOption);
|
||||
inStream.Read(memberCount);
|
||||
LOG("Updating team (%llu), (%i), (%i)", teamID, lootOption, memberCount);
|
||||
for (char i = 0; i < memberCount; i++) {
|
||||
LWOOBJID member = LWOOBJID_EMPTY;
|
||||
inStream.Read(member);
|
||||
members.push_back(member);
|
||||
|
||||
LOG("Updating team member (%llu)", member);
|
||||
}
|
||||
|
||||
TeamManager::Instance()->UpdateTeam(teamID, lootOption, members);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG("Received an unknown chat: %i", int(packet->data[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user