EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DynamicSystemEntity Class Reference

#include "SystemEntity.h"

Inheritance diagram for DynamicSystemEntity:
Collaboration diagram for DynamicSystemEntity:

Public Member Functions

 DynamicSystemEntity (InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
 
virtual ~DynamicSystemEntity ()
 
virtual DynamicSystemEntityGetDynamicSE ()
 
virtual bool IsDynamicEntity ()
 
virtual void UpdateDamage ()
 
virtual void EncodeDestiny (Buffer &into)
 
virtual void MakeDamageState (DoDestinyDamageState &into)
 
virtual PyDictMakeSlimItem ()
 
virtual bool Load ()
 
virtual bool IsInvul ()
 
virtual bool IsFrozen ()
 
void AwardBounty (Client *pClient)
 
void SetInvul (bool invul=false)
 
void SetFrozen (bool frozen=false)
 
- Public Member Functions inherited from SystemEntity
 SystemEntity (InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
 
virtual ~SystemEntity ()
 
virtual void Process ()
 
virtual bool ProcessTic ()
 
virtual SystemEntityGetSE ()
 
virtual StaticSystemEntityGetStaticSE ()
 
virtual StationSEGetStationSE ()
 
virtual PlanetSEGetPlanetSE ()
 
virtual MoonSEGetMoonSE ()
 
virtual StargateSEGetGateSE ()
 
virtual BeltSEGetBeltSE ()
 
virtual ItemSystemEntityGetItemSE ()
 
virtual ContainerSEGetContSE ()
 
virtual WreckSEGetWreckSE ()
 
virtual AnomalySEGetAnomalySE ()
 
virtual WormholeSEGetWormholeSE ()
 
virtual FieldSEGetFieldSE ()
 
virtual ProbeSEGetProbeSE ()
 
virtual ObjectSystemEntityGetObjectSE ()
 
virtual AsteroidSEGetAsteroidSE ()
 
virtual StructureSEGetPOSSE ()
 
virtual StructureSEGetJammerSE ()
 
virtual JumpBridgeSEGetJumpBridgeSE ()
 
virtual StructureSEGetOutpostSE ()
 
virtual TowerSEGetTowerSE ()
 
virtual ArraySEGetArraySE ()
 
virtual WeaponSEGetWeaponSE ()
 
virtual BatterySEGetBatterySE ()
 
virtual DeployableSEGetDeployableSE ()
 
virtual SentryGetSentrySE ()
 
virtual ModuleSEGetModuleSE ()
 
virtual ReactorSEGetReactorSE ()
 
virtual CustomsSEGetCOSE ()
 
virtual TCUSEGetTCUSE ()
 
virtual SBUSEGetSBUSE ()
 
virtual IHubSEGetIHubSE ()
 
virtual NPCGetNPCSE ()
 
virtual DroneSEGetDroneSE ()
 
virtual MissileGetMissileSE ()
 
virtual ShipSEGetShipSE ()
 
virtual ConcordGetConcordSE ()
 
virtual bool isGlobal ()
 
virtual bool IsSystemEntity ()
 
virtual bool IsInanimateSE ()
 
virtual bool IsStaticEntity ()
 
virtual bool IsBeltSE ()
 
virtual bool IsGateSE ()
 
virtual bool IsPlanetSE ()
 
virtual bool IsMoonSE ()
 
virtual bool IsStationSE ()
 
virtual bool IsItemEntity ()
 
virtual bool IsAnomalySE ()
 
virtual bool IsWormholeSE ()
 
virtual bool IsCelestialSE ()
 
virtual bool IsContainerSE ()
 
virtual bool IsFieldSE ()
 
virtual bool IsProbeSE ()
 
virtual bool IsObjectEntity ()
 
virtual bool IsSentrySE ()
 
virtual bool IsPOSSE ()
 
virtual bool IsCOSE ()
 
virtual bool IsTCUSE ()
 
virtual bool IsSBUSE ()
 
virtual bool IsIHubSE ()
 
virtual bool IsTowerSE ()
 
virtual bool IsArraySE ()
 
virtual bool IsJammerSE ()
 
virtual bool IsWeaponSE ()
 
virtual bool IsBatterySE ()
 
virtual bool IsModuleSE ()
 
virtual bool IsMoonMiner ()
 
virtual bool IsOutpostSE ()
 
virtual bool IsAsteroidSE ()
 
virtual bool IsDeployableSE ()
 
virtual bool IsJumpBridgeSE ()
 
virtual bool IsReactorSE ()
 
virtual bool IsOperSE ()
 
virtual bool IsLogin ()
 
virtual bool IsNPCSE ()
 
virtual bool IsDroneSE ()
 
virtual bool IsWreckSE ()
 
virtual bool IsMissileSE ()
 
virtual bool IsShipSE ()
 
virtual bool IsConcord ()
 
PyServiceMgrGetServices ()
 
SystemBubbleSysBubble ()
 
SystemManagerSystemMgr ()
 
TargetManagerTargetMgr ()
 
DestinyManagerDestinyMgr ()
 
InventoryItemRef GetSelf ()
 
uint16 GetTypeID ()
 
uint32 GetGroupID ()
 
uint8 GetCategoryID ()
 
EVEItemFlags GetFlag ()
 
uint32 GetID ()
 
double GetRadius ()
 
uint32 GetLocationID ()
 
const char * GetName () const
 
const GPointGetPosition () const
 
void SetPosition (const GPoint &pos)
 
double x ()
 
double y ()
 
double z ()
 
int32 GetAllianceID ()
 
int32 GetWarFactionID ()
 
uint32 GetCorporationID ()
 
uint32 GetOwnerID ()
 
uint32 GetFleetID ()
 
void SetFleetID (uint32 set)
 
int8 GetHarmonic ()
 
void SetHarmonic (int8 set)
 
void DropLoot (WreckContainerRef wreckRef, uint32 groupID, uint32 owner)
 
void AwardSecurityStatus (InventoryItemRef iRef, Character *pChar)
 
void SendDamageStateChanged ()
 
bool ApplyDamage (Damage &d)
 
double DistanceTo2 (const SystemEntity *other)
 
PyTupleMakeDamageState ()
 
virtual void Abandon ()
 
const bool IsDead ()
 
const GVectorGetVelocity ()
 
virtual void Killed (Damage &fatal_blow)
 
virtual void MissileLaunched (Missile *pMissile)
 
virtual bool LoadExtras ()
 
virtual void Delete ()
 
virtual void SetPilot (Client *pClient)
 
virtual bool HasPilot ()
 
virtual ClientGetPilot ()
 

Private Attributes

bool m_invul
 
bool m_frozen
 

Additional Inherited Members

- Protected Attributes inherited from SystemEntity
SystemBubblem_bubble
 
SystemManagerm_system
 
TargetManagerm_targMgr
 
DestinyManagerm_destiny
 
PyServiceMgrm_services
 
InventoryItemRef m_self
 
bool m_killed
 
double m_radius
 
int32 m_harmonic
 
int32 m_warID
 
int32 m_allyID
 
uint32 m_corpID
 
uint32 m_fleetID
 
uint32 m_ownerID
 

Detailed Description

Definition at line 471 of file SystemEntity.h.

Constructor & Destructor Documentation

DynamicSystemEntity::DynamicSystemEntity ( InventoryItemRef  self,
PyServiceMgr services,
SystemManager system 
)

Definition at line 600 of file SystemEntity.cpp.

References SystemEntity::m_destiny, and SystemEntity::m_targMgr.

601 : SystemEntity(self, services, system),
602 m_invul(false),
603 m_frozen(false)
604 {
605  m_targMgr = new TargetManager(this);
606  m_destiny = new DestinyManager(this);
607 
608  assert(m_targMgr != nullptr);
609  assert(m_destiny != nullptr);
610 }
DestinyManager * m_destiny
Definition: SystemEntity.h:265
TargetManager * m_targMgr
Definition: SystemEntity.h:264
SystemEntity(InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
DynamicSystemEntity::~DynamicSystemEntity ( )
virtual

Definition at line 612 of file SystemEntity.cpp.

References TargetManager::ClearAllTargets(), TargetManager::ClearModules(), SystemEntity::m_destiny, SystemEntity::m_targMgr, SafeDelete(), and sConsole.

613 {
614  if (m_targMgr != nullptr)
615  if (!sConsole.IsShutdown()) {
617  m_targMgr->ClearAllTargets(false);
618  //m_targMgr->OnTarget(nullptr, TargMgr::Mode::Clear, TargMgr::Msg::Destroyed);
619  }
620 
623 }
#define sConsole
DestinyManager * m_destiny
Definition: SystemEntity.h:265
void ClearAllTargets(bool notify=true)
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
TargetManager * m_targMgr
Definition: SystemEntity.h:264

Here is the call graph for this function:

Member Function Documentation

void DynamicSystemEntity::AwardBounty ( Client pClient)

Definition at line 702 of file SystemEntity.cpp.

References SystemManager::AddBounty(), BountyData::amount, AttrEntityKillBounty, Journal::EntryType::BountyPrize, Account::KeyType::Cash, corpCONCORD, BountyData::fromID, BountyData::fromKey, EvilNumber::get_double(), InventoryItem::GetAttribute(), Client::GetCharacterID(), Client::GetName(), Client::GetSystemName(), SystemEntity::GetTypeID(), Client::InFleet(), InventoryItem::itemID(), SystemEntity::m_self, SystemEntity::m_system, Stat::npcBounties, BountyData::reason, BountyData::refTypeID, sConfig, sFltSvc, sStatMgr, BountyData::toID, BountyData::toKey, and AccountService::TranserFunds().

Referenced by NPC::Killed(), and DroneSE::Killed().

703 {
704  // this will use a map{charID/BountyData} in system manager for using a bounty timer.
706  bounty *= sConfig.rates.npcBountyMultiply;
707  if (bounty < 1)
708  return;
709 
710  // add data to StatisticMgr
711  sStatMgr.Add(Stat::npcBounties, bounty);
712 
713  std::string reason = "Bounty for killing a pirate in ";
714  reason += pClient->GetSystemName();
715 
716  BountyData data = BountyData();
717  data.fromID = m_self->itemID();
718  data.toID = pClient->GetCharacterID();
722  data.reason = reason;
723 
724  // handle distribution to fleets
725  if (pClient->InFleet()) {
726  // get fleet members onGrid and distrubute bounty
727  std::vector< uint32 > members;
728  sFltSvc.GetFleetMembersOnGrid(pClient, members);
729  // split bounty between members
730  bounty /= members.size();
731  // send bounty to members
732  if (sConfig.server.BountyPayoutDelayed and sConfig.server.FleetShareDelayed) {
733  for (auto cur :members)
734  m_system->AddBounty(cur, data);
735  } else {
736  reason += " (FleetShare) ";
737  reason += " by ";
738  reason += pClient->GetName();
739  data.reason = reason;
740  for (auto cur :members)
742  }
743  } else {
744  data.amount = bounty;
745  if (sConfig.server.BountyPayoutDelayed) {
746  m_system->AddBounty(pClient->GetCharacterID(), data);
747  } else {
749  }
750  }
751 }
#define sConfig
A macro for easier access to the singleton.
#define sStatMgr
Definition: StatisticMgr.h:68
uint16 fromKey
int32 GetCharacterID() const
Definition: Client.h:113
#define sFltSvc
Definition: FleetService.h:147
InventoryItemRef m_self
Definition: SystemEntity.h:269
bool InFleet()
Definition: Client.h:142
void AddBounty(uint32 charID, BountyData &data)
static void TranserFunds(uint32 fromID, uint32 toID, double amount, std::string reason="", uint8 entryTypeID=Journal::EntryType::Undefined, uint32 referenceID=0, uint16 fromKey=Account::KeyType::Cash, uint16 toKey=Account::KeyType::Cash, Client *pClient=nullptr)
SystemManager * m_system
Definition: SystemEntity.h:263
const char * GetName() const
Definition: Client.h:94
std::string reason
EvilNumber GetAttribute(const uint16 attrID) const
double get_double()
Definition: EvilNumber.cpp:191
uint16 GetTypeID()
Definition: SystemEntity.h:203
std::string GetSystemName() const
Definition: Client.h:155
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

void DynamicSystemEntity::EncodeDestiny ( Buffer into)
virtual

Reimplemented from SystemEntity.

Reimplemented in ShipSE, WreckSE, StructureSE, DroneSE, NPC, and Missile.

Definition at line 643 of file SystemEntity.cpp.

References _log, Destiny::MassSector::allianceID, Buffer::Append(), Destiny::MassSector::cloak, Destiny::MassSector::corporationID, Destiny::BallHeader::entityID, Destiny::BallHeader::flags, Destiny::STOP_Struct::formationID, DestinyManager::GetInertia(), DestinyManager::GetMass(), DestinyManager::GetMaxVelocity(), SystemEntity::GetName(), DestinyManager::GetSpeedFraction(), DestinyManager::GetVelocity(), Destiny::MassSector::harmonic, Destiny::DataSector::inertia, IsAlliance, DestinyManager::IsCloaked(), Destiny::Ball::Flag::IsFree, InventoryItem::itemID(), SystemEntity::m_allyID, SystemEntity::m_corpID, SystemEntity::m_destiny, SystemEntity::m_harmonic, SystemEntity::m_radius, SystemEntity::m_self, main(), Destiny::MassSector::mass, Destiny::DataSector::maxSpeed, Destiny::BallHeader::mode, Destiny::BallHeader::posX, Destiny::BallHeader::posY, Destiny::BallHeader::posZ, Destiny::BallHeader::radius, Destiny::DataSector::speedfraction, Destiny::Ball::Mode::STOP, Destiny::DataSector::velX, Destiny::DataSector::velY, Destiny::DataSector::velZ, Ga::GaVec3::x, SystemEntity::x(), Ga::GaVec3::y, SystemEntity::y(), Ga::GaVec3::z, and SystemEntity::z().

644 {
645  using namespace Destiny;
646  BallHeader head = BallHeader();
647  head.entityID = m_self->itemID();
648  head.mode = Ball::Mode::STOP;
649  head.radius = m_radius;
650  head.posX = x();
651  head.posY = y();
652  head.posZ = z();
653  head.flags = Ball::Flag::IsFree;
654  into.Append( head );
655  MassSector mass = MassSector();
656  mass.mass = m_destiny->GetMass();
657  mass.cloak = (m_destiny->IsCloaked() ? 1 : 0);
658  mass.harmonic = m_harmonic;
659  mass.corporationID = m_corpID;
660  mass.allianceID = (IsAlliance(m_allyID) ? m_allyID : -1);
661  into.Append( mass );
662  DataSector data = DataSector();
663  data.inertia = m_destiny->GetInertia();
665  data.velX = m_destiny->GetVelocity().x;
666  data.velY = m_destiny->GetVelocity().y;
667  data.velZ = m_destiny->GetVelocity().z;
669  into.Append( data );
671  main.formationID = 0xFF;
672  into.Append( main );
673 
674  _log(SE__DESTINY, "DSE::EncodeDestiny(): %s - id:%li, mode:%u, flags:0x%X", GetName(), head.entityID, head.mode, head.flags);
675 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
#define _log(type, fmt,...)
Definition: logsys.h:124
DestinyManager * m_destiny
Definition: SystemEntity.h:265
double y()
Definition: SystemEntity.h:214
const GVector & GetVelocity() const
GaFloat x
Definition: GaTypes.h:207
int32 m_harmonic
Definition: SystemEntity.h:276
float GetSpeedFraction()
InventoryItemRef m_self
Definition: SystemEntity.h:269
uint32 m_corpID
Definition: SystemEntity.h:281
double GetMaxVelocity()
double GetInertia()
double z()
Definition: SystemEntity.h:215
const char * GetName() const
Definition: SystemEntity.h:210
double x()
Definition: SystemEntity.h:213
GaFloat y
Definition: GaTypes.h:207
int main(int argc, char *argv[])
#define IsAlliance(itemID)
Definition: EVE_Defines.h:244
double m_radius
Definition: SystemEntity.h:273
GaFloat z
Definition: GaTypes.h:207
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

virtual DynamicSystemEntity* DynamicSystemEntity::GetDynamicSE ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 477 of file SystemEntity.h.

477 { return this; }
virtual bool DynamicSystemEntity::IsDynamicEntity ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 482 of file SystemEntity.h.

482 { return true; }
virtual bool DynamicSystemEntity::IsFrozen ( )
inlinevirtual

Reimplemented from SystemEntity.

Reimplemented in ShipSE.

Definition at line 494 of file SystemEntity.h.

References m_frozen.

494 { return m_frozen; }
virtual bool DynamicSystemEntity::IsInvul ( )
inlinevirtual

Reimplemented from SystemEntity.

Reimplemented in ShipSE.

Definition at line 493 of file SystemEntity.h.

References m_invul.

493 { return m_invul; }
virtual bool DynamicSystemEntity::Load ( )
inlinevirtual

Reimplemented in NPC.

Definition at line 492 of file SystemEntity.h.

Referenced by NPC::Load().

492 { return true; }

Here is the caller graph for this function:

void DynamicSystemEntity::MakeDamageState ( DoDestinyDamageState &  into)
virtual

Reimplemented from SystemEntity.

Reimplemented in ShipSE, ProbeSE, DroneSE, and Missile.

Definition at line 677 of file SystemEntity.cpp.

References AttrArmorDamage, AttrArmorHP, AttrDamage, AttrHP, AttrShieldCapacity, AttrShieldCharge, AttrShieldRechargeRate, EvilNumber::get_double(), InventoryItem::GetAttribute(), GetFileTimeNow(), and SystemEntity::m_self.

677  {
680  into.timestamp = GetFileTimeNow();
682  into.structure = 1.0 - (m_self->GetAttribute(AttrDamage).get_double() / m_self->GetAttribute(AttrHP).get_double());
683 }
InventoryItemRef m_self
Definition: SystemEntity.h:269
double GetFileTimeNow()
Definition: utils_time.cpp:84
EvilNumber GetAttribute(const uint16 attrID) const
double get_double()
Definition: EvilNumber.cpp:191

Here is the call graph for this function:

PyDict * DynamicSystemEntity::MakeSlimItem ( )
virtual

Reimplemented from SystemEntity.

Reimplemented in ShipSE, WreckSE, StructureSE, ProbeSE, DroneSE, Missile, and TowerSE.

Definition at line 625 of file SystemEntity.cpp.

References _log, SystemEntity::GetName(), IsAlliance, IsCorp, IsFaction, SystemEntity::IsNPCSE(), InventoryItem::itemID(), InventoryItem::itemName(), SystemEntity::m_allyID, SystemEntity::m_corpID, SystemEntity::m_ownerID, SystemEntity::m_self, SystemEntity::m_warID, SystemEntity::MakeSlimItem(), PyStatic, and InventoryItem::typeID().

625  {
626  if (IsNPCSE())
628 
629  _log(SE__SLIMITEM, "MakeSlimItem for DSE %s(%u)", GetName(), m_self->itemID());
630  PyDict *slim = new PyDict();
631  slim->SetItemString("itemID", new PyLong(m_self->itemID()));
632  slim->SetItemString("typeID", new PyInt(m_self->typeID()));
633  slim->SetItemString("ownerID", new PyInt(m_ownerID));
634  //slim->SetItemString("categoryID", new PyInt(m_self->categoryID()));
635  //slim->SetItemString("groupID", new PyInt(m_self->groupID()));
636  slim->SetItemString("name", new PyString(m_self->itemName()));
637  slim->SetItemString("corpID", IsCorp(m_corpID) ? new PyInt(m_corpID) : PyStatic.NewNone());
638  slim->SetItemString("allianceID", IsAlliance(m_allyID) ? new PyInt(m_allyID) : PyStatic.NewNone());
639  slim->SetItemString("warFactionID", IsFaction(m_warID) ? new PyInt(m_warID) : PyStatic.NewNone());
640  return (slim);
641 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python string.
Definition: PyRep.h:430
virtual bool IsNPCSE()
Definition: SystemEntity.h:186
Python's dictionary.
Definition: PyRep.h:719
uint32 m_ownerID
Definition: SystemEntity.h:283
virtual PyDict * MakeSlimItem()
InventoryItemRef m_self
Definition: SystemEntity.h:269
uint32 m_corpID
Definition: SystemEntity.h:281
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
const char * GetName() const
Definition: SystemEntity.h:210
#define IsCorp(itemID)
Definition: EVE_Defines.h:234
const std::string & itemName() const
#define IsFaction(itemID)
Definition: EVE_Defines.h:250
#define IsAlliance(itemID)
Definition: EVE_Defines.h:244
uint16 typeID() const
uint32 itemID() const
Definition: InventoryItem.h:98
Python long integer.
Definition: PyRep.h:261

Here is the call graph for this function:

void DynamicSystemEntity::SetFrozen ( bool  frozen = false)
inline

Definition at line 500 of file SystemEntity.h.

References m_frozen.

500 { m_frozen = frozen; }
void DynamicSystemEntity::SetInvul ( bool  invul = false)
inline

Definition at line 499 of file SystemEntity.h.

References m_invul.

499 { m_invul = invul; }
void DynamicSystemEntity::UpdateDamage ( )
virtual
Todo:
(Allan) needs more work

Reimplemented from SystemEntity.

Definition at line 685 of file SystemEntity.cpp.

References AttrArmorDamage, AttrArmorHP, AttrDamage, AttrHP, AttrShieldCapacity, AttrShieldCharge, AttrShieldRechargeRate, EvilNumber::get_double(), InventoryItem::GetAttribute(), GetFileTimeNow(), InventoryItem::itemID(), SystemEntity::m_self, and SystemEntity::UpdateDamage().

Referenced by NPC::UseArmorRepairer(), NPC::UseHullRepairer(), and NPC::UseShieldRecharge().

686 {
689  DamageDetails dmgState;
691  dmgState.recharge = m_self->GetAttribute(AttrShieldRechargeRate).get_double();
692  dmgState.timestamp = GetFileTimeNow();
694  dmgState.structure = 1.0 - m_self->GetAttribute(AttrDamage).get_double() / m_self->GetAttribute(AttrHP).get_double();
695  OnDamageStateChange dmgChange;
696  dmgChange.entityID = m_self->itemID();
697  dmgChange.state = dmgState.Encode();
698  PyTuple *up = dmgChange.Encode();
699  //source->QueueDestinyUpdate(&up);
700 }
Python tuple.
Definition: PyRep.h:567
InventoryItemRef m_self
Definition: SystemEntity.h:269
virtual void UpdateDamage()
Definition: SystemEntity.h:250
double GetFileTimeNow()
Definition: utils_time.cpp:84
EvilNumber GetAttribute(const uint16 attrID) const
double get_double()
Definition: EvilNumber.cpp:191
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool DynamicSystemEntity::m_frozen
private

Definition at line 504 of file SystemEntity.h.

Referenced by IsFrozen(), and SetFrozen().

bool DynamicSystemEntity::m_invul
private

Definition at line 503 of file SystemEntity.h.

Referenced by IsInvul(), and SetInvul().


The documentation for this class was generated from the following files: