mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 10:18:21 +00:00
Merge pull request #460 from EmosewaMC/HandleLEvelUpFix
Added UI pop up for level rewards
This commit is contained in:
commit
87d3ac15bd
@ -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();
|
||||||
|
|
||||||
@ -206,6 +208,8 @@ void CharacterComponent::HandleLevelUp()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Tell the client we beginning to send level rewards.
|
||||||
|
if(rewardingItem) GameMessages::NotifyLevelRewards(parent->GetObjectID(), parent->GetSystemAddress(), m_Level, rewardingItem);
|
||||||
|
|
||||||
for (auto* reward : rewards)
|
for (auto* reward : rewards)
|
||||||
{
|
{
|
||||||
@ -214,29 +218,24 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Tell the client we have finished sending level rewards.
|
||||||
|
if(rewardingItem) GameMessages::NotifyLevelRewards(parent->GetObjectID(), parent->GetSystemAddress(), m_Level, !rewardingItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::SetGMLevel(int gmlevel) {
|
void CharacterComponent::SetGMLevel(int gmlevel) {
|
||||||
|
@ -1516,6 +1516,18 @@ void GameMessages::SendRequestActivityEnter(LWOOBJID objectId, const SystemAddre
|
|||||||
SEND_PACKET
|
SEND_PACKET
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameMessages::NotifyLevelRewards(LWOOBJID objectID, const SystemAddress& sysAddr, int level, bool sending_rewards) {
|
||||||
|
CBITSTREAM
|
||||||
|
CMSGHEADER
|
||||||
|
|
||||||
|
bitStream.Write(objectID);
|
||||||
|
bitStream.Write((uint16_t)GAME_MSG::GAME_MSG_NOTIFY_LEVEL_REWARDS);
|
||||||
|
|
||||||
|
bitStream.Write(level);
|
||||||
|
bitStream.Write(sending_rewards);
|
||||||
|
|
||||||
|
SEND_PACKET
|
||||||
|
}
|
||||||
|
|
||||||
void GameMessages::SendSetShootingGalleryParams(LWOOBJID objectId, const SystemAddress& sysAddr,
|
void GameMessages::SendSetShootingGalleryParams(LWOOBJID objectId, const SystemAddress& sysAddr,
|
||||||
float cameraFOV,
|
float cameraFOV,
|
||||||
|
@ -68,6 +68,7 @@ namespace GameMessages {
|
|||||||
void SendOfferMission(const LWOOBJID& entity, const SystemAddress& sysAddr, int32_t missionID, const LWOOBJID& offererID);
|
void SendOfferMission(const LWOOBJID& entity, const SystemAddress& sysAddr, int32_t missionID, const LWOOBJID& offererID);
|
||||||
void SendNotifyMission(Entity * entity, const SystemAddress& sysAddr, int missionID, int missionState, bool sendingRewards);
|
void SendNotifyMission(Entity * entity, const SystemAddress& sysAddr, int missionID, int missionState, bool sendingRewards);
|
||||||
void SendNotifyMissionTask(Entity * entity, const SystemAddress& sysAddr, int missionID, int taskMask, std::vector<float> updates);
|
void SendNotifyMissionTask(Entity * entity, const SystemAddress& sysAddr, int missionID, int taskMask, std::vector<float> updates);
|
||||||
|
void NotifyLevelRewards(LWOOBJID objectID, const SystemAddress& sysAddr, int level, bool sending_rewards);
|
||||||
|
|
||||||
void SendModifyLEGOScore(Entity* entity, const SystemAddress& sysAddr, int64_t score, eLootSourceType sourceType);
|
void SendModifyLEGOScore(Entity* entity, const SystemAddress& sysAddr, int64_t score, eLootSourceType sourceType);
|
||||||
void SendUIMessageServerToSingleClient(Entity* entity, const SystemAddress& sysAddr, const std::string& message, NDGFxValue args);
|
void SendUIMessageServerToSingleClient(Entity* entity, const SystemAddress& sysAddr, const std::string& message, NDGFxValue args);
|
||||||
|
@ -532,6 +532,7 @@ enum GAME_MSG : unsigned short {
|
|||||||
GAME_MSG_RESPONSE_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1667,
|
GAME_MSG_RESPONSE_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1667,
|
||||||
GAME_MSG_PLAYER_SET_CAMERA_CYCLING_MODE = 1676,
|
GAME_MSG_PLAYER_SET_CAMERA_CYCLING_MODE = 1676,
|
||||||
GAME_MSG_NOTIFY_SERVER_LEVEL_PROCESSING_COMPLETE = 1734,
|
GAME_MSG_NOTIFY_SERVER_LEVEL_PROCESSING_COMPLETE = 1734,
|
||||||
|
GAME_MSG_NOTIFY_LEVEL_REWARDS = 1735,
|
||||||
GAME_MSG_MARK_INVENTORY_ITEM_AS_ACTIVE = 1767,
|
GAME_MSG_MARK_INVENTORY_ITEM_AS_ACTIVE = 1767,
|
||||||
END
|
END
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user