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
|
@ -649,4 +649,9 @@ void Core::Entity::Actor::addStatusEffectByIdIfNotExist( int32_t id, int32_t dur
|
||||||
void Core::Entity::Actor::removeSingleStatusEffectFromId( int32_t id )
|
void Core::Entity::Actor::removeSingleStatusEffectFromId( int32_t id )
|
||||||
{
|
{
|
||||||
m_pStatusEffectContainer->removeSingleStatusEffectFromId( 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
|
// remove a status effect by id
|
||||||
void removeSingleStatusEffectFromId( int32_t id );
|
void removeSingleStatusEffectFromId( int32_t id );
|
||||||
|
|
||||||
|
//get the status effect container
|
||||||
|
StatusEffect::StatusEffectContainerPtr getStatusEffectContainer() const;
|
||||||
|
|
||||||
// TODO: Why did i even declare them publicly here?!
|
// TODO: Why did i even declare them publicly here?!
|
||||||
std::set< ActorPtr > m_inRangeActors;
|
std::set< ActorPtr > m_inRangeActors;
|
||||||
std::set< PlayerPtr > m_inRangePlayers;
|
std::set< PlayerPtr > m_inRangePlayers;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "src/servers/Server_Zone/Forwards.h"
|
#include "src/servers/Server_Zone/Forwards.h"
|
||||||
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
#include "src/servers/Server_Zone/Inventory/Inventory.h"
|
||||||
#include "src/servers/Server_Zone/Inventory/Item.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 Core {
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
@ -93,6 +95,15 @@ namespace Server {
|
||||||
//m_data.unknown_60 = 3;
|
//m_data.unknown_60 = 3;
|
||||||
//m_data.unknown_61 = 7;
|
//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();
|
sendUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::map< uint8_t, Core::StatusEffect::StatusEffectPtr > Core::StatusEffect::StatusEffectContainer::getEffectMap() const
|
||||||
|
{
|
||||||
|
return m_effectMap;
|
||||||
|
}
|
||||||
|
|
||||||
void Core::StatusEffect::StatusEffectContainer::sendUpdate()
|
void Core::StatusEffect::StatusEffectContainer::sendUpdate()
|
||||||
{
|
{
|
||||||
uint64_t currentTimeMs = Util::getTimeMs();
|
uint64_t currentTimeMs = Util::getTimeMs();
|
||||||
|
|
|
@ -29,6 +29,8 @@ public:
|
||||||
int8_t getFreeSlot();
|
int8_t getFreeSlot();
|
||||||
void freeSlot( uint8_t slotId );
|
void freeSlot( uint8_t slotId );
|
||||||
|
|
||||||
|
std::map< uint8_t, Core::StatusEffect::StatusEffectPtr > getEffectMap() const;
|
||||||
|
|
||||||
void sendUpdate();
|
void sendUpdate();
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +40,6 @@ private:
|
||||||
Entity::ActorPtr m_pOwner;
|
Entity::ActorPtr m_pOwner;
|
||||||
std::queue< uint8_t > m_freeEffectSlotQueue;
|
std::queue< uint8_t > m_freeEffectSlotQueue;
|
||||||
|
|
||||||
std::vector< StatusEffectPtr > m_effectList;
|
|
||||||
std::vector< std::pair< uint8_t, uint32_t> > m_tickEffectList;
|
std::vector< std::pair< uint8_t, uint32_t> > m_tickEffectList;
|
||||||
std::map< uint8_t, StatusEffectPtr > m_effectMap;
|
std::map< uint8_t, StatusEffectPtr > m_effectMap;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue