From 3806891db03ed9f3084a599d817fc2832ab82ad9 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 18 Oct 2023 07:18:22 -0700 Subject: [PATCH] Teams: Default team loot to ffa (#1224) --- dChatServer/PlayerContainer.cpp | 5 +++++ dChatServer/PlayerContainer.h | 1 + dGame/TeamManager.cpp | 6 ++++++ dGame/TeamManager.h | 7 +++---- resources/sharedconfig.ini | 4 ++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dChatServer/PlayerContainer.cpp b/dChatServer/PlayerContainer.cpp index e49630ed..503495f6 100644 --- a/dChatServer/PlayerContainer.cpp +++ b/dChatServer/PlayerContainer.cpp @@ -11,6 +11,7 @@ #include "eConnectionType.h" #include "eChatInternalMessageType.h" #include "ChatPackets.h" +#include "dConfig.h" PlayerContainer::PlayerContainer() { } @@ -19,6 +20,10 @@ PlayerContainer::~PlayerContainer() { mPlayers.clear(); } +TeamData::TeamData() { + lootFlag = Game::config->GetValue("default_team_loot") == "0" ? 0 : 1; +} + void PlayerContainer::InsertPlayer(Packet* packet) { CINSTREAM_SKIP_HEADER; PlayerData* data = new PlayerData(); diff --git a/dChatServer/PlayerContainer.h b/dChatServer/PlayerContainer.h index 0836eb59..a0a40058 100644 --- a/dChatServer/PlayerContainer.h +++ b/dChatServer/PlayerContainer.h @@ -18,6 +18,7 @@ struct PlayerData { }; struct TeamData { + TeamData(); LWOOBJID teamID = LWOOBJID_EMPTY; // Internal use LWOOBJID leaderID = LWOOBJID_EMPTY; std::vector memberIDs{}; diff --git a/dGame/TeamManager.cpp b/dGame/TeamManager.cpp index 0258ce3e..abb20c48 100644 --- a/dGame/TeamManager.cpp +++ b/dGame/TeamManager.cpp @@ -1,8 +1,14 @@ #include "TeamManager.h" #include "EntityManager.h" +#include "Game.h" +#include "dConfig.h" TeamManager* TeamManager::m_Address = nullptr; //For singleton method +Team::Team() { + lootOption = Game::config->GetValue("default_team_loot") == "0" ? 0 : 1; +} + TeamManager::TeamManager() { } diff --git a/dGame/TeamManager.h b/dGame/TeamManager.h index eb1b5c5b..5d4716f8 100644 --- a/dGame/TeamManager.h +++ b/dGame/TeamManager.h @@ -2,16 +2,15 @@ #include "Entity.h" -struct Team -{ +struct Team { + Team(); LWOOBJID teamID = LWOOBJID_EMPTY; char lootOption = 0; std::vector members{}; char lootRound = 0; }; -class TeamManager -{ +class TeamManager { public: static TeamManager* Instance() { if (!m_Address) { diff --git a/resources/sharedconfig.ini b/resources/sharedconfig.ini index ad587b18..46b11470 100644 --- a/resources/sharedconfig.ini +++ b/resources/sharedconfig.ini @@ -43,3 +43,7 @@ maximum_mtu_size=1228 # This cannot just be any arbitrary number. This has to match the same value that is in your client. # If you do not know what this value is, default it to 171022. client_net_version=171022 + +# Turn to 0 to default teams to use the live accurate Shared Loot (0) by default as opposed to Free for All (1) +# This is used in both Chat and World servers. +default_team_loot=1