From afa38ae890a428256736044ecf719b75590763fc Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 12 Feb 2022 21:03:04 -0800 Subject: [PATCH] Added call to GM in CharacterComponent --- dGame/dComponents/CharacterComponent.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index c7a216f3..d7a41a8b 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -12,6 +12,7 @@ #include "EntityManager.h" #include "PossessorComponent.h" #include "VehiclePhysicsComponent.h" +#include "GameMessages.h" CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) { m_Character = character; @@ -191,6 +192,7 @@ void CharacterComponent::HandleLevelUp() auto* rewardsTable = CDClientManager::Instance()->GetTable("Rewards"); const auto& rewards = rewardsTable->GetByLevelID(m_Level); + bool rewardingItem = rewards.size() > 0; auto* parent = m_Character->GetEntity(); @@ -214,29 +216,23 @@ void CharacterComponent::HandleLevelUp() case 0: inventoryComponent->AddItem(reward->value, reward->count); break; - case 4: { auto* items = inventoryComponent->GetInventory(ITEMS); items->SetSize(items->GetSize() + reward->value); } break; - case 9: controllablePhysicsComponent->SetSpeedMultiplier(static_cast(reward->value) / 500.0f); break; - case 11: - break; - case 12: break; - default: break; } - } - + } + GameMessages::NotifyLevelRewards(parent->GetObjectID(), parent->GetSystemAddress(), m_Level, rewardingItem); } void CharacterComponent::SetGMLevel(int gmlevel) {