Added call to GM in CharacterComponent

This commit is contained in:
EmosewaMC 2022-02-12 21:03:04 -08:00
parent 352f654ede
commit afa38ae890

View File

@ -12,6 +12,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "PossessorComponent.h" #include "PossessorComponent.h"
#include "VehiclePhysicsComponent.h" #include "VehiclePhysicsComponent.h"
#include "GameMessages.h"
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) { CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
m_Character = character; m_Character = character;
@ -191,6 +192,7 @@ void CharacterComponent::HandleLevelUp()
auto* rewardsTable = CDClientManager::Instance()->GetTable<CDRewardsTable>("Rewards"); auto* rewardsTable = CDClientManager::Instance()->GetTable<CDRewardsTable>("Rewards");
const auto& rewards = rewardsTable->GetByLevelID(m_Level); const auto& rewards = rewardsTable->GetByLevelID(m_Level);
bool rewardingItem = rewards.size() > 0;
auto* parent = m_Character->GetEntity(); auto* parent = m_Character->GetEntity();
@ -214,29 +216,23 @@ void CharacterComponent::HandleLevelUp()
case 0: case 0:
inventoryComponent->AddItem(reward->value, reward->count); inventoryComponent->AddItem(reward->value, reward->count);
break; break;
case 4: case 4:
{ {
auto* items = inventoryComponent->GetInventory(ITEMS); auto* items = inventoryComponent->GetInventory(ITEMS);
items->SetSize(items->GetSize() + reward->value); items->SetSize(items->GetSize() + reward->value);
} }
break; break;
case 9: case 9:
controllablePhysicsComponent->SetSpeedMultiplier(static_cast<float>(reward->value) / 500.0f); controllablePhysicsComponent->SetSpeedMultiplier(static_cast<float>(reward->value) / 500.0f);
break; break;
case 11: case 11:
break;
case 12: case 12:
break; break;
default: default:
break; break;
} }
} }
GameMessages::NotifyLevelRewards(parent->GetObjectID(), parent->GetSystemAddress(), m_Level, rewardingItem);
} }
void CharacterComponent::SetGMLevel(int gmlevel) { void CharacterComponent::SetGMLevel(int gmlevel) {