mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-30 16:10:56 -06:00
Compare commits
5 Commits
object-deb
...
EmosewaMC-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4f3362fd3 | ||
|
|
f8a82fbf79 | ||
|
|
17d0c45382 | ||
|
|
7dbbef81ac | ||
|
|
06958cb9cd |
@@ -87,6 +87,8 @@ void EntityManager::ReloadConfig() {
|
|||||||
auto hcXpReduction = Game::config->GetValue("hardcore_uscore_reduction");
|
auto hcXpReduction = Game::config->GetValue("hardcore_uscore_reduction");
|
||||||
m_HardcoreUscoreReduction = hcXpReduction.empty() ? 1.0f : GeneralUtils::TryParse<float>(hcXpReduction).value_or(1.0f);
|
m_HardcoreUscoreReduction = hcXpReduction.empty() ? 1.0f : GeneralUtils::TryParse<float>(hcXpReduction).value_or(1.0f);
|
||||||
m_HardcoreMode = GetHardcoreDisabledWorlds().contains(Game::zoneManager->GetZoneID().GetMapID()) ? false : m_HardcoreMode;
|
m_HardcoreMode = GetHardcoreDisabledWorlds().contains(Game::zoneManager->GetZoneID().GetMapID()) ? false : m_HardcoreMode;
|
||||||
|
auto hcCoinKeep = Game::config->GetValue("hardcore_coin_keep");
|
||||||
|
m_HardcoreCoinKeep = hcCoinKeep.empty() ? false : GeneralUtils::TryParse<float>(hcCoinKeep).value_or(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityManager::Initialize() {
|
void EntityManager::Initialize() {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public:
|
|||||||
const std::set<LOT>& GetHardcoreUscoreReducedLots() const { return m_HardcoreUscoreReducedLots; };
|
const std::set<LOT>& GetHardcoreUscoreReducedLots() const { return m_HardcoreUscoreReducedLots; };
|
||||||
const std::set<LOT>& GetHardcoreUscoreExcludedEnemies() const { return m_HardcoreUscoreExcludedEnemies; };
|
const std::set<LOT>& GetHardcoreUscoreExcludedEnemies() const { return m_HardcoreUscoreExcludedEnemies; };
|
||||||
const std::set<LWOMAPID>& GetHardcoreDisabledWorlds() const { return m_HardcoreDisabledWorlds; };
|
const std::set<LWOMAPID>& GetHardcoreDisabledWorlds() const { return m_HardcoreDisabledWorlds; };
|
||||||
|
float GetHardcoreCoinKeep() const { return m_HardcoreCoinKeep; }
|
||||||
|
|
||||||
// Messaging
|
// Messaging
|
||||||
bool SendMessage(GameMessages::GameMsg& msg) const;
|
bool SendMessage(GameMessages::GameMsg& msg) const;
|
||||||
@@ -125,6 +126,7 @@ private:
|
|||||||
std::set<LOT> m_HardcoreUscoreReducedLots{};
|
std::set<LOT> m_HardcoreUscoreReducedLots{};
|
||||||
std::set<LOT> m_HardcoreUscoreExcludedEnemies{};
|
std::set<LOT> m_HardcoreUscoreExcludedEnemies{};
|
||||||
std::set<LWOMAPID> m_HardcoreDisabledWorlds{};
|
std::set<LWOMAPID> m_HardcoreDisabledWorlds{};
|
||||||
|
float m_HardcoreCoinKeep{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENTITYMANAGER_H
|
#endif // ENTITYMANAGER_H
|
||||||
|
|||||||
@@ -786,7 +786,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Check if this zone allows coin drops
|
//Check if this zone allows coin drops
|
||||||
if (Game::zoneManager->GetPlayerLoseCoinOnDeath()) {
|
if (Game::zoneManager->GetPlayerLoseCoinOnDeath() && !Game::entityManager->GetHardcoreMode()) {
|
||||||
auto* character = m_Parent->GetCharacter();
|
auto* character = m_Parent->GetCharacter();
|
||||||
uint64_t coinsTotal = character->GetCoins();
|
uint64_t coinsTotal = character->GetCoins();
|
||||||
const uint64_t minCoinsToLose = Game::zoneManager->GetWorldConfig().coinsLostOnDeathMin;
|
const uint64_t minCoinsToLose = Game::zoneManager->GetWorldConfig().coinsLostOnDeathMin;
|
||||||
@@ -1012,13 +1012,23 @@ void DestroyableComponent::DoHardcoreModeDrops(const LWOOBJID source) {
|
|||||||
//get character:
|
//get character:
|
||||||
auto* chars = m_Parent->GetCharacter();
|
auto* chars = m_Parent->GetCharacter();
|
||||||
if (chars) {
|
if (chars) {
|
||||||
auto coins = chars->GetCoins();
|
auto oldCoins = chars->GetCoins();
|
||||||
|
// Floor this so there arent coins generated from rounding
|
||||||
|
auto coins = static_cast<uint64_t>(oldCoins * Game::entityManager->GetHardcoreCoinKeep());
|
||||||
|
auto coinsToDrop = oldCoins - coins;
|
||||||
|
LOG("Player had %llu coins, will lose %i coins to have %i", oldCoins, coinsToDrop, coins);
|
||||||
|
|
||||||
//lose all coins:
|
//lose all coins:
|
||||||
chars->SetCoins(0, eLootSourceType::NONE);
|
chars->SetCoins(coins, eLootSourceType::NONE);
|
||||||
|
|
||||||
//drop all coins:
|
//drop all coins:
|
||||||
GameMessages::SendDropClientLoot(m_Parent, source, LOT_NULL, coins, m_Parent->GetPosition());
|
constexpr auto MAX_TO_DROP_PER_GM = 100'000;
|
||||||
|
while (coinsToDrop > MAX_TO_DROP_PER_GM) {
|
||||||
|
LOG("Dropping 100,000, %llu left", coinsToDrop);
|
||||||
|
GameMessages::SendDropClientLoot(m_Parent, source, LOT_NULL, MAX_TO_DROP_PER_GM, m_Parent->GetPosition());
|
||||||
|
coinsToDrop -= MAX_TO_DROP_PER_GM;
|
||||||
|
}
|
||||||
|
GameMessages::SendDropClientLoot(m_Parent, source, LOT_NULL, coinsToDrop, m_Parent->GetPosition());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,7 +324,8 @@ Inventory::~Inventory() {
|
|||||||
void Inventory::RegenerateItemIDs() {
|
void Inventory::RegenerateItemIDs() {
|
||||||
std::map<LWOOBJID, Item*> newItems{};
|
std::map<LWOOBJID, Item*> newItems{};
|
||||||
for (auto* const item : items | std::views::values) {
|
for (auto* const item : items | std::views::values) {
|
||||||
const bool equipped = item->GetParent() == LWOOBJID_EMPTY && item->IsEquipped();
|
if (item->GetParent() != LWOOBJID_EMPTY) continue; // temp items dont need new ids
|
||||||
|
const bool equipped = item->IsEquipped();
|
||||||
if (equipped) item->UnEquip();
|
if (equipped) item->UnEquip();
|
||||||
const auto oldID = item->GetId();
|
const auto oldID = item->GetId();
|
||||||
const auto newID = item->GenerateID();
|
const auto newID = item->GenerateID();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
|||||||
if (!self->GetBoolean(u"bIsHit")) {
|
if (!self->GetBoolean(u"bIsHit")) {
|
||||||
for (const auto objID : proximityComponent->GetProximityObjects("crateHitters")) {
|
for (const auto objID : proximityComponent->GetProximityObjects("crateHitters")) {
|
||||||
auto* const entity = Game::entityManager->GetEntity(objID);
|
auto* const entity = Game::entityManager->GetEntity(objID);
|
||||||
if (!entity) continue;
|
if (!entity || entity->GetObjectID() != attacker->GetObjectID()) continue;
|
||||||
|
|
||||||
auto* const destroyable = entity->GetComponent<DestroyableComponent>();
|
auto* const destroyable = entity->GetComponent<DestroyableComponent>();
|
||||||
if (destroyable) destroyable->Smash(attacker->GetObjectID());
|
if (destroyable) destroyable->Smash(attacker->GetObjectID());
|
||||||
|
|||||||
@@ -99,3 +99,6 @@ hardcore_uscore_excluded_enemies=
|
|||||||
|
|
||||||
# Disables hardcore mode for specific worlds, if hardcore is enabled
|
# Disables hardcore mode for specific worlds, if hardcore is enabled
|
||||||
hardcore_disabled_worlds=
|
hardcore_disabled_worlds=
|
||||||
|
|
||||||
|
# Keeps this percentage of a players' coins on death in hardcore
|
||||||
|
hardcore_coin_keep=
|
||||||
|
|||||||
Reference in New Issue
Block a user