Compare commits

...

4 Commits

Author SHA1 Message Date
David Markowitz
40fef36530 fix: coins dropping on killer (#1948)
tested that when a player dies the coins spawn on their body instead
2025-12-13 22:00:58 -08:00
David Markowitz
bf020baa17 fix: temp fixes for ghosting so I can continue being on break (#1947)
* fix: temp fixes for ghosting so I can continue being on break

disables the ghost feature for now so i can continue my break

* Update GhostComponent.cpp
2025-12-08 20:39:33 -08:00
David Markowitz
a713216540 fix: saving gm invis for non gms (#1940) 2025-11-18 22:04:07 -06:00
David Markowitz
ea86a708e4 fix: uninitialized memory (#1937) 2025-11-18 19:06:03 -08:00
4 changed files with 14 additions and 9 deletions

View File

@@ -31,7 +31,7 @@ public:
std::string& GetSessionKey() { return m_SessionKey; }
SystemAddress& GetSystemAddress() { return m_SystemAddress; }
eGameMasterLevel GetMaxGMLevel() { return m_MaxGMLevel; }
eGameMasterLevel GetMaxGMLevel() const { return m_MaxGMLevel; }
uint32_t GetLastCharID() { return m_LastCharID; }
void SetLastCharID(uint32_t newCharID) { m_LastCharID = newCharID; }

View File

@@ -755,7 +755,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
const auto isPlayer = m_Parent->IsPlayer();
GameMessages::SendDie(m_Parent, source, source, true, killType, deathType, 0, 0, 0, isPlayer, false, 1);
GameMessages::SendDie(m_Parent, source, source, true, killType, deathType, 0, 0, 0, isPlayer, true, 1);
//NANI?!
if (!isPlayer) {
@@ -785,8 +785,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
lootMsg.sourceID = source;
lootMsg.item = LOT_NULL;
lootMsg.Send();
lootMsg.Send(m_Parent->GetSystemAddress());
character->SetCoins(coinsTotal, eLootSourceType::PICKUP);
character->SetCoins(coinsTotal, eLootSourceType::DELETION);
}
}

View File

@@ -12,7 +12,7 @@ GhostComponent::GhostComponent(Entity* parent, const int32_t componentID) : Comp
m_GhostReferencePoint = NiPoint3Constant::ZERO;
m_GhostOverridePoint = NiPoint3Constant::ZERO;
m_GhostOverride = false;
RegisterMsg<GameMessages::ToggleGMInvis>(this, &GhostComponent::OnToggleGMInvis);
RegisterMsg<GameMessages::GetGMInvis>(this, &GhostComponent::OnGetGMInvis);
RegisterMsg<GameMessages::GetObjectReportInfo>(this, &GhostComponent::MsgGetObjectReportInfo);
@@ -43,7 +43,8 @@ void GhostComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
auto* ghstElement = objElement->FirstChildElement("ghst");
if (ghstElement) objElement->DeleteChild(ghstElement);
// Only save if GM invisible
if (!m_IsGMInvisible) return;
const auto* const user = UserManager::Instance()->GetUser(m_Parent->GetSystemAddress());
if (!m_IsGMInvisible || !user || user->GetMaxGMLevel() < eGameMasterLevel::FORUM_MODERATOR) return;
ghstElement = objElement->InsertNewChildElement("ghst");
if (ghstElement) ghstElement->SetAttribute("i", m_IsGMInvisible);
}
@@ -88,6 +89,8 @@ void GhostComponent::GhostEntity(LWOOBJID id) {
}
bool GhostComponent::OnToggleGMInvis(GameMessages::GameMsg& msg) {
// TODO: disabled for now while bugs are fixed
return false;
auto& gmInvisMsg = static_cast<GameMessages::ToggleGMInvis&>(msg);
gmInvisMsg.bStateOut = !m_IsGMInvisible;
m_IsGMInvisible = !m_IsGMInvisible;
@@ -117,8 +120,11 @@ bool GhostComponent::OnToggleGMInvis(GameMessages::GameMsg& msg) {
bool GhostComponent::OnGetGMInvis(GameMessages::GameMsg& msg) {
LOG_DEBUG("GM Invisibility requested: %s", m_IsGMInvisible ? "true" : "false");
auto& gmInvisMsg = static_cast<GameMessages::GetGMInvis&>(msg);
gmInvisMsg.bGMInvis = m_IsGMInvisible;
return gmInvisMsg.bGMInvis;
// TODO: disabled for now while bugs are fixed
// gmInvisMsg.bGMInvis = m_IsGMInvisible;
// return gmInvisMsg.bGMInvis;
gmInvisMsg.bGMInvis = false;
return false;
}
bool GhostComponent::MsgGetObjectReportInfo(GameMessages::GameMsg& msg) {

View File

@@ -63,7 +63,7 @@ private:
bool m_GhostOverride;
bool m_IsGMInvisible;
bool m_IsGMInvisible{ false };
};