mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Make players spawn with StatusEffects
This commit is contained in:
parent
30d72ace1f
commit
1b49a53afc
5 changed files with 26 additions and 1 deletions
|
@ -650,3 +650,8 @@ void Core::Entity::Actor::removeSingleStatusEffectFromId( int32_t id )
|
|||
{
|
||||
m_pStatusEffectContainer->removeSingleStatusEffectFromId( id );
|
||||
}
|
||||
|
||||
Core::StatusEffect::StatusEffectContainerPtr Core::Entity::Actor::getStatusEffectContainer() const
|
||||
{
|
||||
return m_pStatusEffectContainer;
|
||||
}
|
|
@ -301,6 +301,9 @@ public:
|
|||
// remove a status effect by id
|
||||
void removeSingleStatusEffectFromId( int32_t id );
|
||||
|
||||
//get the status effect container
|
||||
StatusEffect::StatusEffectContainerPtr getStatusEffectContainer() const;
|
||||
|
||||
// TODO: Why did i even declare them publicly here?!
|
||||
std::set< ActorPtr > m_inRangeActors;
|
||||
std::set< PlayerPtr > m_inRangePlayers;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
||||
#include "src/servers/Server_Zone/Inventory/Item.h"
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffectContainer.h"
|
||||
#include "src/servers/Server_Zone/StatusEffect/StatusEffect.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
@ -93,6 +95,15 @@ namespace Server {
|
|||
//m_data.unknown_60 = 3;
|
||||
//m_data.unknown_61 = 7;
|
||||
|
||||
uint64_t currentTimeMs = Util::getTimeMs();
|
||||
|
||||
for( auto const& effect : pPlayer->getStatusEffectContainer()->getEffectMap() )
|
||||
{
|
||||
m_data.effect[effect.first].effect_id = effect.second->getId();
|
||||
m_data.effect[effect.first].duration = static_cast< float >( effect.second->getDuration() - ( currentTimeMs - effect.second->getStartTimeMs() ) ) / 1000;
|
||||
m_data.effect[effect.first].sourceActorId = effect.second->getSrcActorId();
|
||||
m_data.effect[effect.first].unknown1 = effect.second->getParam();
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -107,6 +107,11 @@ void Core::StatusEffect::StatusEffectContainer::removeStatusEffect( uint8_t effe
|
|||
sendUpdate();
|
||||
}
|
||||
|
||||
std::map< uint8_t, Core::StatusEffect::StatusEffectPtr > Core::StatusEffect::StatusEffectContainer::getEffectMap() const
|
||||
{
|
||||
return m_effectMap;
|
||||
}
|
||||
|
||||
void Core::StatusEffect::StatusEffectContainer::sendUpdate()
|
||||
{
|
||||
uint64_t currentTimeMs = Util::getTimeMs();
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
int8_t getFreeSlot();
|
||||
void freeSlot( uint8_t slotId );
|
||||
|
||||
std::map< uint8_t, Core::StatusEffect::StatusEffectPtr > getEffectMap() const;
|
||||
|
||||
void sendUpdate();
|
||||
|
||||
|
||||
|
@ -38,7 +40,6 @@ private:
|
|||
Entity::ActorPtr m_pOwner;
|
||||
std::queue< uint8_t > m_freeEffectSlotQueue;
|
||||
|
||||
std::vector< StatusEffectPtr > m_effectList;
|
||||
std::vector< std::pair< uint8_t, uint32_t> > m_tickEffectList;
|
||||
std::map< uint8_t, StatusEffectPtr > m_effectMap;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue