Compare commits

..

1 Commits

Author SHA1 Message Date
jadebenn
81b4f84d03 move IsDead to the DestroyableComponent 2024-12-24 23:00:49 -06:00
21 changed files with 156 additions and 152 deletions

View File

@@ -72,7 +72,7 @@ std::string FdbToSqlite::Convert::ReadString(std::istream& cdClientBuffer) {
const auto readString = BinaryIO::ReadU8String(cdClientBuffer); const auto readString = BinaryIO::ReadU8String(cdClientBuffer);
cdClientBuffer.seekg(prevPosition); cdClientBuffer.seekg(prevPosition);
return GeneralUtils::Latin1ToUTF8(readString); return GeneralUtils::Latin1ToWTF8(readString);
} }
int32_t FdbToSqlite::Convert::SeekPointer(std::istream& cdClientBuffer) { int32_t FdbToSqlite::Convert::SeekPointer(std::istream& cdClientBuffer) {

View File

@@ -167,18 +167,11 @@ std::u16string GeneralUtils::ASCIIToUTF16(const std::string_view string, const s
return ret; return ret;
} }
std::string GeneralUtils::Latin1ToUTF8(const std::u8string_view string, const size_t size) {
std::string toReturn{};
for (const auto u : string) { //! Converts a (potentially-ill-formed) Latin1 string to UTF-8
PushUTF8CodePoint(toReturn, u);
}
return toReturn;
}
//! Converts a (potentially-ill-formed) UTF-16 string to UTF-8
//! See: <http://simonsapin.github.io/wtf-8/#decoding-ill-formed-utf-16> //! 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); const size_t newSize = MinSize(size, string);
std::string ret; std::string ret;
ret.reserve(newSize); ret.reserve(newSize);
@@ -203,6 +196,13 @@ std::string GeneralUtils::UTF16ToWTF8(const std::u16string_view string, const si
return ret; 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) { 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); }); return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); });

View File

@@ -57,7 +57,7 @@ namespace GeneralUtils {
\param size A size to trim the string to. Default is SIZE_MAX (No trimming) \param size A size to trim the string to. Default is SIZE_MAX (No trimming)
\return An UTF-8 representation of the string \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 //! Converts a UTF-16 string to a UTF-8 string
/*! /*!

View File

@@ -1378,7 +1378,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
} }
} }
if (!other->GetIsDead()) { if (!other->GetComponent<DestroyableComponent>()->GetIsDead()) {
if (GetComponent<BaseCombatAIComponent>() != nullptr) { if (GetComponent<BaseCombatAIComponent>() != nullptr) {
const auto index = std::find(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), otherEntity); 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) { void Entity::AddLootItem(const Loot::Info& info) {
if (!IsPlayer()) return; if (!IsPlayer()) return;

View File

@@ -82,8 +82,6 @@ public:
const std::vector<LDFBaseData*>& GetNetworkSettings() const { return m_NetworkSettings; } const std::vector<LDFBaseData*>& GetNetworkSettings() const { return m_NetworkSettings; }
bool GetIsDead() const;
bool GetPlayerReadyForUpdates() const { return m_PlayerIsReadyForUpdates; } bool GetPlayerReadyForUpdates() const { return m_PlayerIsReadyForUpdates; }
bool GetIsGhostingCandidate() const; bool GetIsGhostingCandidate() const;

View File

@@ -227,7 +227,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
bitStream.Write(armorDamageDealt); bitStream.Write(armorDamageDealt);
bitStream.Write(healthDamageDealt); bitStream.Write(healthDamageDealt);
bitStream.Write(targetEntity->GetIsDead()); bitStream.Write(targetEntity->GetComponent<DestroyableComponent>()->GetIsDead());
} }
bitStream.Write(successState); bitStream.Write(successState);

View File

@@ -116,7 +116,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitS
for (auto validTarget : validTargets) { for (auto validTarget : validTargets) {
if (targets.size() >= this->m_maxTargets) break; if (targets.size() >= this->m_maxTargets) break;
if (std::find(targets.begin(), targets.end(), validTarget) != targets.end()) continue; 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(); const auto targetPos = validTarget->GetPosition();

View File

@@ -193,7 +193,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
m_SoftTimer -= deltaTime; m_SoftTimer -= deltaTime;
} }
if (m_Disabled || m_Parent->GetIsDead()) if (m_Disabled || m_Parent->GetComponent<DestroyableComponent>()->GetIsDead())
return; return;
bool stunnedThisFrame = m_Stunned; bool stunnedThisFrame = m_Stunned;
CalculateCombat(deltaTime); // Putting this here for now CalculateCombat(deltaTime); // Putting this here for now

View File

@@ -160,7 +160,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
} }
//Kill player if health == 0 //Kill player if health == 0
if (entity->GetIsDead()) { if (entity->GetComponent<DestroyableComponent>()->GetIsDead()) {
entity->Smash(entity->GetObjectID()); entity->Smash(entity->GetObjectID());
} }

View File

@@ -16,7 +16,7 @@ void BaseEnemyApe::OnStartup(Entity* self) {
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) { void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
auto* anchor = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"QB")); 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); anchor->Smash(self->GetObjectID(), eKillType::SILENT);
} }
} }

View File

@@ -152,13 +152,13 @@ void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
auto StateChangeType = eStateChangeType::POP; auto StateChangeType = eStateChangeType::POP;
if (bFreeze) { if (bFreeze) {
if (player->GetIsDead()) { if (player->GetComponent<DestroyableComponent>()->GetIsDead()) {
return; return;
} }
StateChangeType = eStateChangeType::PUSH; StateChangeType = eStateChangeType::PUSH;
} else { } else {
if (player->GetIsDead()) { if (player->GetComponent<DestroyableComponent>()->GetIsDead()) {
// //
} }
} }

View File

@@ -54,7 +54,7 @@ void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam"); auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
for (auto memberID : team) { for (auto memberID : team) {
auto member = Game::entityManager->GetEntity(memberID); 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()); GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
} }
} }

View File

@@ -315,7 +315,7 @@ bool BaseSurvivalServer::CheckAllPlayersDead() {
for (const auto& playerID : state.players) { for (const auto& playerID : state.players) {
auto* player = Game::entityManager->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr || player->GetIsDead()) { if (player == nullptr || player->GetComponent<DestroyableComponent>()->GetIsDead()) {
deadPlayers++; deadPlayers++;
} }
} }

View File

@@ -310,7 +310,7 @@ bool BaseWavesServer::CheckAllPlayersDead() {
for (const auto& playerID : state.players) { for (const auto& playerID : state.players) {
auto* player = Game::entityManager->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr || player->GetIsDead()) { if (player == nullptr || player->GetComponent<DestroyableComponent>()->GetIsDead()) {
deadPlayers++; deadPlayers++;
} }
} }
@@ -431,7 +431,7 @@ void BaseWavesServer::SpawnWave(Entity* self) {
for (const auto& playerID : state.players) { for (const auto& playerID : state.players) {
auto* player = Game::entityManager->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player && player->GetIsDead()) { if (player && player->GetComponent<DestroyableComponent>()->GetIsDead()) {
player->Resurrect(); player->Resurrect();
} }
} }
@@ -501,7 +501,7 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3
for (const auto& playerID : state.players) { for (const auto& playerID : state.players) {
auto* player = Game::entityManager->GetEntity(playerID); 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, 1, currentTime);
SetActivityValue(self, playerID, 2, state.waveNumber); SetActivityValue(self, playerID, 2, state.waveNumber);

View File

@@ -1,9 +1,9 @@
#include "ActPlayerDeathTrigger.h" #include "ActPlayerDeathTrigger.h"
#include "DestroyableComponent.h"
#include "Entity.h" #include "Entity.h"
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) { 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); target->Smash(self->GetObjectID(), eKillType::SILENT);
} }

View File

@@ -1,4 +1,5 @@
#include "ActSharkPlayerDeathTrigger.h" #include "ActSharkPlayerDeathTrigger.h"
#include "DestroyableComponent.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "Entity.h" #include "Entity.h"
@@ -11,7 +12,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419); 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()) { if (sender->GetCharacter()) {
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death"); sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");

View File

@@ -1,8 +1,9 @@
#include "AgShipPlayerDeathTrigger.h" #include "AgShipPlayerDeathTrigger.h"
#include "DestroyableComponent.h"
#include "Entity.h" #include "Entity.h"
void AgShipPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) { 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"); target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"electro-shock-death");
} }
} }

View File

@@ -1,4 +1,5 @@
#include "TriggerGas.h" #include "TriggerGas.h"
#include "DestroyableComponent.h"
#include "InventoryComponent.h" #include "InventoryComponent.h"
#include "SkillComponent.h" #include "SkillComponent.h"
#include "Entity.h" #include "Entity.h"
@@ -28,7 +29,7 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != this->m_TimerName) return; if (timerName != this->m_TimerName) return;
auto players = self->GetVar<std::vector<Entity*>>(u"players"); auto players = self->GetVar<std::vector<Entity*>>(u"players");
for (auto player : players) { for (auto player : players) {
if (player->GetIsDead() || !player){ if (player->GetComponent<DestroyableComponent>()->GetIsDead() || !player){
auto position = std::find(players.begin(), players.end(), player); auto position = std::find(players.begin(), players.end(), player);
if (position != players.end()) players.erase(position); if (position != players.end()) players.erase(position);
continue; continue;
@@ -46,4 +47,3 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
self->SetVar(u"players", players); self->SetVar(u"players", players);
self->AddTimer(this->m_TimerName, this->m_Time); self->AddTimer(this->m_TimerName, this->m_Time);
} }

View File

@@ -1,6 +1,7 @@
#include "PetDigBuild.h" #include "PetDigBuild.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "EntityInfo.h" #include "EntityInfo.h"
#include "DestroyableComponent.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "eMissionState.h" #include "eMissionState.h"
@@ -45,7 +46,7 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
return; return;
// If the quick build expired and the treasure was not collected, hide the treasure // 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); treasure->Smash(self->GetObjectID(), eKillType::SILENT);
} }
} }

View File

@@ -27,7 +27,7 @@ void NsConcertInstrument::OnQuickBuildNotifyState(Entity* self, eQuickBuildState
} }
void NsConcertInstrument::OnQuickBuildComplete(Entity* self, Entity* target) { void NsConcertInstrument::OnQuickBuildComplete(Entity* self, Entity* target) {
if (!target->GetIsDead()) { if (!target->GetComponent<DestroyableComponent>()->GetIsDead()) {
self->SetVar<LWOOBJID>(u"activePlayer", target->GetObjectID()); self->SetVar<LWOOBJID>(u"activePlayer", target->GetObjectID());
self->AddCallbackTimer(0.2f, [self, target]() { self->AddCallbackTimer(0.2f, [self, target]() {

View File

@@ -267,31 +267,41 @@ int main(int argc, char** argv) {
// pre calculate the FDB checksum // pre calculate the FDB checksum
if (Game::config->GetValue("check_fdb") == "1") { if (Game::config->GetValue("check_fdb") == "1") {
auto cdclient = Game::assetManager->GetFile("cdclient.fdb"); std::ifstream fileStream;
if (cdclient) {
const int32_t bufferSize = 1024; static const std::vector<std::string> aliases = {
MD5 md5; "CDServers.fdb",
"cdserver.fdb",
"CDClient.fdb",
"cdclient.fdb",
};
char fileStreamBuffer[bufferSize] = {}; for (const auto& file : aliases) {
fileStream.open(Game::assetManager->GetResPath() / file, std::ios::binary | std::ios::in);
while (!cdclient.eof()) { if (fileStream.is_open()) {
memset(fileStreamBuffer, 0, bufferSize); break;
cdclient.read(fileStreamBuffer, bufferSize);
md5.update(fileStreamBuffer, cdclient.gcount());
} }
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."); const int32_t bufferSize = 1024;
return EXIT_FAILURE; 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; uint32_t currentFrameDelta = highFrameDelta;
@@ -538,115 +548,115 @@ void HandlePacketChat(Packet* packet) {
if (packet->data[0] == ID_USER_PACKET_ENUM && packet->length >= 4) { if (packet->data[0] == ID_USER_PACKET_ENUM && packet->length >= 4) {
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT) { if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT) {
switch (static_cast<MessageType::Chat>(packet->data[3])) { switch (static_cast<MessageType::Chat>(packet->data[3])) {
case MessageType::Chat::WORLD_ROUTE_PACKET: { case MessageType::Chat::WORLD_ROUTE_PACKET: {
CINSTREAM_SKIP_HEADER; CINSTREAM_SKIP_HEADER;
LWOOBJID playerID; LWOOBJID playerID;
inStream.Read(playerID); inStream.Read(playerID);
auto player = Game::entityManager->GetEntity(playerID); auto player = Game::entityManager->GetEntity(playerID);
if (!player) return; if (!player) return;
auto sysAddr = player->GetSystemAddress(); auto sysAddr = player->GetSystemAddress();
//Write our stream outwards: //Write our stream outwards:
CBITSTREAM; CBITSTREAM;
unsigned char data; unsigned char data;
while (inStream.Read(data)) { while (inStream.Read(data)) {
bitStream.Write(data); bitStream.Write(data);
}
SEND_PACKET; //send routed packet to player
break;
} }
SEND_PACKET; //send routed packet to player case MessageType::Chat::GM_ANNOUNCE: {
break; CINSTREAM_SKIP_HEADER;
}
case MessageType::Chat::GM_ANNOUNCE: { std::string title;
CINSTREAM_SKIP_HEADER; std::string msg;
std::string title; uint32_t len;
std::string msg; inStream.Read<uint32_t>(len);
for (uint32_t i = 0; len > i; i++) {
char character;
inStream.Read<char>(character);
title += character;
}
uint32_t len; len = 0;
inStream.Read<uint32_t>(len); inStream.Read<uint32_t>(len);
for (uint32_t i = 0; len > i; i++) { for (uint32_t i = 0; len > i; i++) {
char character; char character;
inStream.Read<char>(character); inStream.Read<char>(character);
title += character; msg += character;
} }
len = 0; //Send to our clients:
inStream.Read<uint32_t>(len); AMFArrayValue args;
for (uint32_t i = 0; len > i; i++) {
char character;
inStream.Read<char>(character);
msg += character;
}
//Send to our clients: args.Insert("title", title);
AMFArrayValue args; args.Insert("message", msg);
args.Insert("title", title); GameMessages::SendUIMessageServerToAllClients("ToggleAnnounce", args);
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);
break; break;
} }
inStream.Read(lootOption); case MessageType::Chat::GM_MUTE: {
inStream.Read(memberCount); CINSTREAM_SKIP_HEADER;
LOG("Updating team (%llu), (%i), (%i)", teamID, lootOption, memberCount); LWOOBJID playerId;
for (char i = 0; i < memberCount; i++) { time_t expire = 0;
LWOOBJID member = LWOOBJID_EMPTY; inStream.Read(playerId);
inStream.Read(member); inStream.Read(expire);
members.push_back(member);
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; LWOOBJID teamID = 0;
} char lootOption = 0;
default: char memberCount = 0;
LOG("Received an unknown chat: %i", int(packet->data[3])); 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]));
} }
} }
} }