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

#include "Ship.h"

Inheritance diagram for ShipSE:
Collaboration diagram for ShipSE:

Public Member Functions

 ShipSE (InventoryItemRef self, PyServiceMgr &services, SystemManager *pSystem, const FactionData &data)
 
virtual ~ShipSE ()
 
virtual ShipSEGetShipSE ()
 
virtual bool IsShipSE ()
 
virtual void Process ()
 
virtual void EncodeDestiny (Buffer &into)
 
virtual void MakeDamageState (DoDestinyDamageState &into)
 
virtual PyDictMakeSlimItem ()
 
virtual void Killed (Damage &fatal_blow)
 
virtual void MissileLaunched (Missile *pMissile)
 
virtual bool IsInvul ()
 
virtual bool IsFrozen ()
 
virtual bool IsLogin ()
 
virtual void SetPilot (Client *pClient)
 
virtual bool HasPilot ()
 
virtual ClientGetPilot ()
 
void Dock ()
 
void Jump (bool showCloak=true)
 
void Warp ()
 
void RemoveTarget (SystemEntity *pSE)
 
void SetPassword (std::string pass)
 
void ClearBoostData ()
 
bool IsBoosted ()
 
void SetBoost (bool set=false)
 
void RemoveBoost ()
 
void ApplyBoost (BoostData &bData)
 
uint8 GetMiningBoostAmount ()
 
void PayInsurance ()
 
void DamageModule (uint32 modID)
 
void DamageRandModule (float chance)
 
void ResetShipSystemMgr (SystemManager *pSystem)
 
void SaveShip ()
 
void UpdateDrones (std::map< int16, int8 > &attribs)
 
void AbortCycle ()
 
void SetLauncherID (uint32 shipID)
 
uint32 GetLauncherID ()
 
ShipItemRef GetShipItemRef ()
 
float CalculateRechargeRate (float Capacity, float RechargeTimeMS, float Current)
 
void AbandonDrones ()
 
bool LaunchDrone (InventoryItemRef dRef)
 
void ScoopDrone (SystemEntity *pSE)
 
uint8 DroneCount ()
 
bool GetFleetSMBUsage ()
 
void SetFleetSMBUsage (bool set=false)
 
- Public Member Functions inherited from DynamicSystemEntity
 DynamicSystemEntity (InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
 
virtual ~DynamicSystemEntity ()
 
virtual DynamicSystemEntityGetDynamicSE ()
 
virtual bool IsDynamicEntity ()
 
virtual void UpdateDamage ()
 
virtual bool Load ()
 
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 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 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 IsNPCSE ()
 
virtual bool IsDroneSE ()
 
virtual bool IsWreckSE ()
 
virtual bool IsMissileSE ()
 
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 bool LoadExtras ()
 
virtual void Delete ()
 

Protected Attributes

ShipItemRef m_shipRef
 
const uint32 m_processTimerTick
 
- 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
 

Private Attributes

ShipDB m_db
 
Timer m_processTimer
 
uint32 m_podShipID
 
bool m_allowFleetSMBUsage
 
BoostData m_boost = BoostData()
 
bool m_boosted
 
uint16 m_oldArmor
 
uint16 m_oldShield
 
uint16 m_oldScanRes
 
uint32 m_oldTargetRange
 
float m_oldInertia
 
std::string m_towerPass
 
std::map< uint32, InventoryItem * > m_drones
 

Detailed Description

Definition at line 301 of file Ship.h.

Constructor & Destructor Documentation

ShipSE::ShipSE ( InventoryItemRef  self,
PyServiceMgr services,
SystemManager pSystem,
const FactionData data 
)

Definition at line 2390 of file Ship.cpp.

References _log, FactionData::allianceID, FactionData::corporationID, FactionData::factionID, SystemEntity::m_allyID, m_boost, SystemEntity::m_corpID, SystemEntity::m_ownerID, m_processTimer, m_processTimerTick, m_towerPass, SystemEntity::m_warID, FactionData::ownerID, and Timer::Start().

2391 : DynamicSystemEntity(self, services, pSystem),
2395 m_oldArmor(0),
2396 m_oldShield(0),
2397 m_oldScanRes(0),
2398 m_oldInertia(0.0f),
2399 m_oldTargetRange(0),
2400 m_boosted(false),
2401 m_podShipID(0),
2402 m_allowFleetSMBUsage(false)
2403 {
2404  m_warID = data.factionID;
2405  m_allyID = data.allianceID;
2406  m_corpID = data.corporationID;
2407  m_ownerID = data.ownerID;
2408 
2409  m_boost = BoostData();
2410 
2411  m_towerPass = "";
2413  _log(SHIP__TRACE, "Created ShipSE %p for item %u", this, self->itemID());
2414 }
uint32 m_podShipID
Definition: Ship.h:385
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 m_ownerID
Definition: SystemEntity.h:283
BoostData m_boost
Definition: Ship.h:390
Timer m_processTimer
Definition: Ship.h:383
static const uint16 SHIP_PROCESS_TICK_MS
Definition: EVE_Consts.h:25
float m_oldInertia
Definition: Ship.h:396
uint32 m_corpID
Definition: SystemEntity.h:281
uint32 m_oldTargetRange
Definition: Ship.h:395
uint16 m_oldArmor
Definition: Ship.h:392
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
uint32 corporationID
ShipItemRef m_shipRef
Definition: Ship.h:376
uint16 m_oldScanRes
Definition: Ship.h:394
bool m_boosted
Definition: Ship.h:391
bool m_allowFleetSMBUsage
Definition: Ship.h:387
std::string m_towerPass
Definition: Ship.h:399
DynamicSystemEntity(InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
const uint32 m_processTimerTick
Definition: Ship.h:378
uint32 itemID() const
Definition: InventoryItem.h:98
uint16 m_oldShield
Definition: Ship.h:393
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

virtual ShipSE::~ShipSE ( )
inlinevirtual

Definition at line 306 of file Ship.h.

306 { /* do nothing here */ }

Member Function Documentation

void ShipSE::AbandonDrones ( )

Definition at line 2853 of file Ship.cpp.

References DroneSE::Abandon(), AttrDroneBandwidthLoad, AttrDroneBandwidthUsed, InventoryItem::GetAttribute(), SystemEntity::GetDroneSE(), SystemManager::GetSE(), SystemEntity::GetSelf(), SystemEntity::IsDroneSE(), m_drones, m_shipRef, SystemEntity::m_system, and InventoryItem::SetAttribute().

Referenced by Killed().

2853  {
2854  SystemEntity* pSE(nullptr);
2856  for (auto cur : m_drones) {
2857  pSE = m_system->GetSE(cur.first);
2858  if (pSE != nullptr)
2859  if (pSE->IsDroneSE()) {
2860  pSE->GetDroneSE()->Abandon();
2861  load -= pSE->GetSelf()->GetAttribute(AttrDroneBandwidthUsed);
2862  }
2863  }
2864  m_shipRef->SetAttribute(AttrDroneBandwidthLoad, load, false); // client dont care
2865 }
virtual DroneSE * GetDroneSE()
Definition: SystemEntity.h:135
SystemEntity * GetSE(uint32 entityID) const
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
SystemManager * m_system
Definition: SystemEntity.h:263
void SetAttribute(uint16 attrID, int num, bool notify=true)
std::map< uint32, InventoryItem * > m_drones
Definition: Ship.h:402
ShipItemRef m_shipRef
Definition: Ship.h:376
EvilNumber GetAttribute(const uint16 attrID) const
virtual void Abandon()
Definition: Drone.cpp:185

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::AbortCycle ( )
inline

Definition at line 356 of file Ship.h.

References ShipItem::AbortCycle(), and m_shipRef.

Referenced by Killed().

356 { m_shipRef->AbortCycle(); }
void AbortCycle()
Definition: Ship.h:146
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::ApplyBoost ( BoostData bData)

Definition at line 2757 of file Ship.cpp.

References _log, BoostData::armored, AttrArmorHP, AttrInetia, AttrMaxTargetRange, AttrScanResolution, AttrShieldCapacity, EvilNumber::get_float(), EvilNumber::get_uint32(), InventoryItem::GetAttribute(), SystemEntity::GetID(), SystemEntity::GetName(), BoostData::info, BoostData::leader, m_boost, m_boosted, SystemEntity::m_destiny, m_oldArmor, m_oldInertia, m_oldScanRes, m_oldShield, m_oldTargetRange, m_shipRef, RemoveBoost(), InventoryItem::SetAttribute(), BoostData::siege, BoostData::skirmish, and DestinyManager::UpdateShipVariables().

Referenced by Client::ProcessClient().

2758 {
2759  // note: mining boost applied in mining module code
2760 
2761  // remove existing boost
2762  if (m_boosted)
2763  RemoveBoost();
2764 
2765  _log( FLEET__TRACE, "ShipSE::ApplyBoost() - %s(%u)", GetName(), GetID());
2766 
2767  m_boost = bData;
2773 
2774  uint16 armorHP = m_oldArmor * (1.0f + (0.02f * m_boost.armored)); // 2% increase/level
2775  uint16 shieldHP = m_oldShield * (1.0f + (0.02f * m_boost.siege));// 2% increase/level
2776  uint16 scanRes = m_oldScanRes * (1.0f + (0.02f * m_boost.leader));// 2% increase/level
2777  uint32 targRange = m_oldTargetRange * (1.0f + (0.02f * m_boost.info));// 2% increase/level
2778  float inertia = m_oldInertia * (1.0f - (0.02f * m_boost.skirmish));// 2% decrease/level
2779 
2780  m_shipRef->SetAttribute(AttrInetia, inertia); // lower inertia = lower agility = faster ship
2781  m_shipRef->SetAttribute(AttrArmorHP, armorHP);
2782  m_shipRef->SetAttribute(AttrScanResolution, scanRes); // higher scanRes = faster targeting
2785 
2787 
2788  m_boosted = true;
2789 }
#define _log(type, fmt,...)
Definition: logsys.h:124
DestinyManager * m_destiny
Definition: SystemEntity.h:265
BoostData m_boost
Definition: Ship.h:390
int8 leader
Definition: FleetData.h:71
int8 siege
Definition: FleetData.h:74
float m_oldInertia
Definition: Ship.h:396
uint32 m_oldTargetRange
Definition: Ship.h:395
uint32 get_uint32()
Definition: EvilNumber.cpp:173
int8 info
Definition: FleetData.h:72
void SetAttribute(uint16 attrID, int num, bool notify=true)
uint32 GetID()
Definition: SystemEntity.h:207
uint16 m_oldArmor
Definition: Ship.h:392
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
int8 armored
Definition: FleetData.h:70
int8 skirmish
Definition: FleetData.h:75
ShipItemRef m_shipRef
Definition: Ship.h:376
void RemoveBoost()
Definition: Ship.cpp:2742
uint16 m_oldScanRes
Definition: Ship.h:394
EvilNumber GetAttribute(const uint16 attrID) const
bool m_boosted
Definition: Ship.h:391
float get_float()
Definition: EvilNumber.cpp:184
unsigned __int16 uint16
Definition: eve-compat.h:48
uint16 m_oldShield
Definition: Ship.h:393

Here is the call graph for this function:

Here is the caller graph for this function:

float ShipSE::CalculateRechargeRate ( float  Capacity,
float  RechargeTimeMS,
float  Current 
)

Definition at line 2416 of file Ship.cpp.

Referenced by Process().

2417 {
2418  // C = Cmax * [ 1 + ( SQRT(C0/Cmax) - 1) * EXP((t0-t1)/tau) ] ^ 2
2419  // dC/dt = (SQRT(C/Cmax) - C/Cmax) * 2 * Cmax / tau
2420  // tau = "Cap Recharge Time" / 5.0
2421 
2422  // prevent divide by zero.
2423  RechargeTimeMS = (RechargeTimeMS < 1 ? 1 : RechargeTimeMS);
2424  Current = (Current < 1 ? 1 : Current);
2425  float Cmax = (Capacity < 1 ? 1 : Capacity);
2426 
2427  // tau = "cap recharge time" / 5.0
2428  float tau = (RechargeTimeMS / 5000.0);
2429  // (2*Cmax) / tau
2430  float Cmax2_tau = ((Cmax * 2) / tau);
2431  float C = Current;
2432  // C / Cmax
2433  float C_Cmax = (C / Cmax);
2434  // sqrt( C / Cmax)
2435  float sC_Cmax = sqrt(C_Cmax);
2436  // charge rate in Gj / sec
2437  return (Cmax2_tau * (sC_Cmax - C_Cmax));
2438 }

Here is the caller graph for this function:

void ShipSE::ClearBoostData ( )

Definition at line 2730 of file Ship.cpp.

References m_boost, m_boosted, m_oldArmor, m_oldInertia, m_oldScanRes, m_oldShield, and m_oldTargetRange.

Referenced by RemoveBoost().

2731 {
2732  m_oldArmor = 0;
2733  m_oldShield = 0;
2734  m_oldScanRes = 0;
2735  m_oldInertia = 0.0f;
2736  m_oldTargetRange = 0;
2737 
2738  m_boost = BoostData();
2739  m_boosted = false;
2740 }
BoostData m_boost
Definition: Ship.h:390
float m_oldInertia
Definition: Ship.h:396
uint32 m_oldTargetRange
Definition: Ship.h:395
uint16 m_oldArmor
Definition: Ship.h:392
uint16 m_oldScanRes
Definition: Ship.h:394
bool m_boosted
Definition: Ship.h:391
uint16 m_oldShield
Definition: Ship.h:393

Here is the caller graph for this function:

void ShipSE::DamageModule ( uint32  modID)
inline

Definition at line 349 of file Ship.h.

References ShipItem::DamageModule(), and m_shipRef.

349 { m_shipRef->DamageModule(modID); }
void DamageModule(uint32 modID, float amt=1)
Definition: Ship.h:166
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

void ShipSE::DamageRandModule ( float  chance)

Definition at line 2494 of file Ship.cpp.

References ShipItem::DamageRandModule(), m_shipRef, and MakeRandomFloat().

Referenced by SystemEntity::ApplyDamage().

2495 {
2496  if (chance == 0)
2497  return;
2498  if (chance > MakeRandomFloat())
2500 }
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114
void DamageRandModule()
Definition: Ship.h:167
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::Dock ( )

Definition at line 2543 of file Ship.cpp.

References TargetManager::ClearAllTargets(), TargetManager::ClearModules(), ShipItem::Dock(), m_shipRef, and SystemEntity::m_targMgr.

Referenced by Client::DockToStation().

2543  {
2544  if (m_targMgr != nullptr) {
2546  m_targMgr->ClearAllTargets(false);
2547  //m_targMgr->OnTarget(nullptr, TargMgr::Mode::Clear, TargMgr::Msg::Docking);
2548  }
2549 
2550  m_shipRef->Dock();
2551 }
void ClearAllTargets(bool notify=true)
TargetManager * m_targMgr
Definition: SystemEntity.h:264
void Dock()
Definition: Ship.cpp:361
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

uint8 ShipSE::DroneCount ( )
inline

Definition at line 370 of file Ship.h.

References m_drones.

370 { return m_drones.size(); }
std::map< uint32, InventoryItem * > m_drones
Definition: Ship.h:402
void ShipSE::EncodeDestiny ( Buffer into)
virtual

Reimplemented from DynamicSystemEntity.

Definition at line 2579 of file Ship.cpp.

References _log, Destiny::MassSector::allianceID, Buffer::Append(), Destiny::MassSector::cloak, Destiny::MassSector::corporationID, Destiny::WARP_Struct::effectStamp, Destiny::BallHeader::entityID, Destiny::BallHeader::flags, Destiny::Ball::Mode::FOLLOW, Destiny::FOLLOW_Struct::followID, Destiny::WARP_Struct::followID, Destiny::FOLLOW_Struct::followRange, Destiny::WARP_Struct::followRange, Destiny::ORBIT_Struct::followRange, Destiny::GOTO_Struct::formationID, Destiny::FOLLOW_Struct::formationID, Destiny::STOP_Struct::formationID, Destiny::WARP_Struct::formationID, Destiny::ORBIT_Struct::formationID, DestinyManager::GetFollowDistance(), SystemEntity::GetID(), DestinyManager::GetInertia(), DestinyManager::GetMass(), DestinyManager::GetMaxVelocity(), SystemEntity::GetName(), SystemEntity::GetRadius(), DestinyManager::GetSpeedFraction(), DestinyManager::GetState(), DestinyManager::GetTargetID(), DestinyManager::GetTargetPoint(), DestinyManager::GetVelocity(), DestinyManager::GetWarpSpeed(), Destiny::Ball::Mode::GOTO, Destiny::MassSector::harmonic, InventoryItem::HasPilot(), Destiny::DataSector::inertia, IsAlliance, DestinyManager::IsCloaked(), Destiny::Ball::Flag::IsFree, Destiny::Ball::Flag::IsInteractive, SystemEntity::m_allyID, SystemEntity::m_corpID, SystemEntity::m_destiny, SystemEntity::m_harmonic, SystemEntity::m_self, main(), Destiny::MassSector::mass, Destiny::DataSector::maxSpeed, Destiny::BallHeader::mode, Destiny::Ball::Mode::ORBIT, Destiny::BallHeader::posX, Destiny::BallHeader::posY, Destiny::BallHeader::posZ, Destiny::BallHeader::radius, Destiny::WARP_Struct::speed, Destiny::DataSector::speedfraction, Destiny::ORBIT_Struct::targetID, Destiny::WARP_Struct::targX, Destiny::WARP_Struct::targY, Destiny::WARP_Struct::targZ, Destiny::DataSector::velX, Destiny::DataSector::velY, Destiny::DataSector::velZ, Destiny::Ball::Mode::WARP, Destiny::GOTO_Struct::x, Ga::GaVec3::x, SystemEntity::x(), Destiny::GOTO_Struct::y, Ga::GaVec3::y, SystemEntity::y(), Destiny::GOTO_Struct::z, Ga::GaVec3::z, and SystemEntity::z().

2579  {
2580  using namespace Destiny;
2581 
2582  uint8 mode = m_destiny->GetState(); //Ball::Mode::STOP;
2583 /*
2584  NameStruct name;
2585  name.name = GetName();
2586  name.name_len = sizeof(name.name);
2587  */
2588  BallHeader head = BallHeader();
2589  head.entityID = GetID();
2590  head.mode = mode;
2591  head.radius = GetRadius();
2592  head.posX = x();
2593  head.posY = y();
2594  head.posZ = z();
2595  if (m_self->HasPilot()) {
2597  } else {
2598  head.flags = Ball::Flag::IsFree;
2599  }
2600  into.Append( head);
2601  MassSector mass = MassSector();
2602  mass.mass = m_destiny->GetMass();
2603  mass.cloak = (m_destiny->IsCloaked() ? 1 : 0);
2604  mass.harmonic = m_harmonic;
2605  mass.corporationID = m_corpID;
2606  mass.allianceID = (IsAlliance(m_allyID) ? m_allyID : -1);
2607  into.Append( mass);
2608  DataSector data = DataSector();
2609  data.inertia = m_destiny->GetInertia();
2610  data.maxSpeed = m_destiny->GetMaxVelocity();
2611  data.velX = m_destiny->GetVelocity().x;
2612  data.velY = m_destiny->GetVelocity().y;
2613  data.velZ = m_destiny->GetVelocity().z;
2615  into.Append( data);
2616  switch (mode) {
2617  case Ball::Mode::WARP: {
2618  GPoint target = m_destiny->GetTargetPoint();
2619  WARP_Struct warp;
2620  warp.formationID = 0xFF;
2621  warp.targX = target.x;
2622  warp.targY = target.y;
2623  warp.targZ = target.z;
2624  warp.speed = m_destiny->GetWarpSpeed(); //ship warp speed x10 (dont ask...this is what it is...more dumb ccp shit)
2625  // warp timing. see ShipSE::EncodeDestiny() for notes/updates
2626  warp.effectStamp = -1; //m_destiny->GetStateStamp(); //timestamp when warp started
2627  warp.followRange = 0; //this isnt right
2628  warp.followID = 0; //this isnt right
2629  into.Append(warp);
2630  } break;
2631  case Ball::Mode::FOLLOW: {
2632  FOLLOW_Struct follow;
2633  follow.followID = m_destiny->GetTargetID();
2635  follow.formationID = 0xFF;
2636  into.Append(follow);
2637  } break;
2638  case Ball::Mode::ORBIT: {
2639  ORBIT_Struct orbit;
2640  orbit.targetID = m_destiny->GetTargetID();
2642  orbit.formationID = 0xFF;
2643  into.Append(orbit);
2644  } break;
2645  case Ball::Mode::GOTO: {
2646  GPoint target = m_destiny->GetTargetPoint();
2647  GOTO_Struct go;
2648  go.formationID = 0xFF;
2649  go.x = target.x;
2650  go.y = target.y;
2651  go.z = target.z;
2652  into.Append(go);
2653  } break;
2654  default: {
2655  STOP_Struct main;
2656  main.formationID = 0xFF;
2657  into.Append(main);
2658  } break;
2659  }
2660 
2661  std::string modeStr = "Goto";
2662  switch (mode) {
2663  case 1: modeStr = "Follow"; break;
2664  case 2: modeStr = "Stop"; break;
2665  case 3: modeStr = "Warp"; break;
2666  case 4: modeStr = "Orbit"; break;
2667  case 5: modeStr = "Missile"; break;
2668  case 6: modeStr = "Mushroom"; break;
2669  case 7: modeStr = "Boid"; break;
2670  case 8: modeStr = "Troll"; break;
2671  case 9: modeStr = "Miniball"; break;
2672  case 10: modeStr = "Field"; break;
2673  case 11: modeStr = "Rigid"; break;
2674  case 12: modeStr = "Formation"; break;
2675  }
2676 
2677  _log(SE__DESTINY, "ShipSE::EncodeDestiny(): %s - id:%li, mode:%s, flags:0x%X, Vel:%.1f, %.1f, %.1f", \
2678  GetName(), head.entityID, modeStr.c_str(), head.flags, data.velX, data.velY, data.velZ);
2679 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
unsigned __int8 uint8
Definition: eve-compat.h:46
double GetFollowDistance()
#define _log(type, fmt,...)
Definition: logsys.h:124
DestinyManager * m_destiny
Definition: SystemEntity.h:265
double GetRadius()
Definition: SystemEntity.h:208
double y()
Definition: SystemEntity.h:214
const GVector & GetVelocity() const
GaFloat x
Definition: GaTypes.h:207
int32 m_harmonic
Definition: SystemEntity.h:276
uint32 GetTargetID()
float GetSpeedFraction()
Definition: gpoint.h:33
InventoryItemRef m_self
Definition: SystemEntity.h:269
int32 GetWarpSpeed()
uint32 m_corpID
Definition: SystemEntity.h:281
double GetMaxVelocity()
double GetInertia()
double z()
Definition: SystemEntity.h:215
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
double x()
Definition: SystemEntity.h:213
GaFloat y
Definition: GaTypes.h:207
GPoint GetTargetPoint()
int main(int argc, char *argv[])
#define IsAlliance(itemID)
Definition: EVE_Defines.h:244
virtual bool HasPilot()
GaFloat z
Definition: GaTypes.h:207

Here is the call graph for this function:

bool ShipSE::GetFleetSMBUsage ( )
inline

Definition at line 372 of file Ship.h.

References m_allowFleetSMBUsage.

372 { return m_allowFleetSMBUsage; }
bool m_allowFleetSMBUsage
Definition: Ship.h:387
uint32 ShipSE::GetLauncherID ( )
inline

Definition at line 360 of file Ship.h.

References m_podShipID.

Referenced by DestinyManager::UpdateNewShip().

360 { return m_podShipID; }
uint32 m_podShipID
Definition: Ship.h:385

Here is the caller graph for this function:

uint8 ShipSE::GetMiningBoostAmount ( )
inline

Definition at line 345 of file Ship.h.

References m_boost, and BoostData::mining.

345 { return m_boost.mining; }
BoostData m_boost
Definition: Ship.h:390
int8 mining
Definition: FleetData.h:73
virtual Client* ShipSE::GetPilot ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 331 of file Ship.h.

References RefPtr< X >::get(), ShipItem::GetPilot(), and m_shipRef.

Referenced by LaunchDrone().

331 { return ((m_shipRef.get() == nullptr) ? nullptr : m_shipRef->GetPilot()); }
X * get() const
Definition: RefPtr.h:213
ShipItemRef m_shipRef
Definition: Ship.h:376
virtual Client * GetPilot()
Definition: Ship.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

ShipItemRef ShipSE::GetShipItemRef ( )
inline

Definition at line 362 of file Ship.h.

References m_shipRef.

Referenced by SystemEntity::ApplyDamage(), Client::Board(), Killed(), Missile::Missile(), DestinyManager::Undock(), SystemManager::UnloadSystem(), and DestinyManager::UpdateOldShip().

362 { return m_shipRef; }
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the caller graph for this function:

virtual ShipSE* ShipSE::GetShipSE ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 309 of file Ship.h.

309 { return this; }
virtual bool ShipSE::HasPilot ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 330 of file Ship.h.

References RefPtr< X >::get(), ShipItem::HasPilot(), and m_shipRef.

330 { return ((m_shipRef.get() == nullptr) ? false : m_shipRef->HasPilot()); }
virtual bool HasPilot()
Definition: Ship.h:71
X * get() const
Definition: RefPtr.h:213
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

bool ShipSE::IsBoosted ( )
inline

Definition at line 341 of file Ship.h.

References m_boosted.

341 { return m_boosted; }
bool m_boosted
Definition: Ship.h:391
virtual bool ShipSE::IsFrozen ( )
inlinevirtual

Reimplemented from DynamicSystemEntity.

Definition at line 325 of file Ship.h.

325 { return false; }
bool ShipSE::IsInvul ( )
virtual

Reimplemented from DynamicSystemEntity.

Definition at line 2529 of file Ship.cpp.

References ShipItem::GetPilot(), ShipItem::HasPilot(), Client::IsInvul(), and m_shipRef.

2530 {
2531  if (m_shipRef->HasPilot())
2532  return m_shipRef->GetPilot()->IsInvul();
2533  return false;
2534 }
virtual bool HasPilot()
Definition: Ship.h:71
bool IsInvul()
Definition: Client.h:234
ShipItemRef m_shipRef
Definition: Ship.h:376
virtual Client * GetPilot()
Definition: Ship.h:72

Here is the call graph for this function:

bool ShipSE::IsLogin ( )
virtual

Reimplemented from SystemEntity.

Definition at line 2536 of file Ship.cpp.

References ShipItem::GetPilot(), ShipItem::HasPilot(), Client::IsLogin(), and m_shipRef.

2537 {
2538  if (m_shipRef->HasPilot())
2539  return m_shipRef->GetPilot()->IsLogin();
2540  return false;
2541 }
bool IsLogin()
Definition: Client.h:235
virtual bool HasPilot()
Definition: Ship.h:71
ShipItemRef m_shipRef
Definition: Ship.h:376
virtual Client * GetPilot()
Definition: Ship.h:72

Here is the call graph for this function:

virtual bool ShipSE::IsShipSE ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 311 of file Ship.h.

311 { return true; }
void ShipSE::Jump ( bool  showCloak = true)

Definition at line 2553 of file Ship.cpp.

References TargetManager::ClearAllTargets(), TargetManager::ClearModules(), ShipItem::Jump(), DestinyManager::Jump(), SystemEntity::m_destiny, m_shipRef, and SystemEntity::m_targMgr.

Referenced by Client::ExecuteDriveJump(), and Client::ExecuteJump().

2553  {
2554  if (m_targMgr != nullptr) {
2556  m_targMgr->ClearAllTargets(false);
2557  //m_targMgr->OnTarget(nullptr, TargMgr::Mode::Clear, TargMgr::Msg::Jumping);
2558  }
2559 
2560  m_shipRef->Jump();
2561  m_destiny->Jump(showCloak);
2562 }
DestinyManager * m_destiny
Definition: SystemEntity.h:265
void ClearAllTargets(bool notify=true)
void Jump()
Definition: Ship.cpp:405
TargetManager * m_targMgr
Definition: SystemEntity.h:264
void Jump(bool showCloak=true)
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::Killed ( Damage fatal_blow)
virtual
Todo:
make error here
Todo:
make error msg here
Todo:
(allan) check for faction/corp status modifiers here.

Reimplemented from SystemEntity.

Definition at line 373 of file Damage.cpp.

References _log, AbandonDrones(), AbortCycle(), MapDB::AddFactionKill(), MapDB::AddKill(), MapDB::AddPodKill(), DBSystemDynamicEntity::allianceID, AttrArmorHP, AttrHP, AttrShieldCapacity, EVEDB::invGroups::Biomass, EVEDB::invCategories::Blueprint, SystemManager::BuildDynamicEntity(), DBSystemDynamicEntity::categoryID, EVEDB::invCategories::Celestial, DBSystemDynamicEntity::corporationID, SystemEntity::DropLoot(), DBSystemDynamicEntity::factionID, CharKillData::finalAllianceID, CharKillData::finalCharacterID, CharKillData::finalCorporationID, CharKillData::finalDamageDone, CharKillData::finalFactionID, CharKillData::finalSecurityStatus, CharKillData::finalShipTypeID, CharKillData::finalWeaponTypeID, flagNone, EvilNumber::get_int(), SystemEntity::GetAllianceID(), InventoryItem::GetAttribute(), Client::GetChar(), Client::GetCharacterID(), SystemEntity::GetCorporationID(), SystemEntity::GetDroneSE(), GetFileTimeNow(), SystemManager::GetID(), SystemEntity::GetID(), Inventory::GetInventoryMap(), SystemEntity::GetLocationID(), InventoryItem::GetMyInventory(), SystemEntity::GetName(), DroneSE::GetOwner(), InventoryItem::GetPilot(), SystemEntity::GetPilot(), DestinyManager::GetPosition(), Client::GetSecurityRating(), GetShipItemRef(), SystemManager::GetSystemSecurityRating(), Damage::GetTotal(), SystemEntity::GetTypeID(), SystemEntity::GetWarFactionID(), InventoryItem::groupID(), DBSystemDynamicEntity::groupID, InventoryItem::HasPilot(), SystemEntity::HasPilot(), is_log_enabled, SystemEntity::IsDroneSE(), IsEven(), Ga::GaVec3::isNaN(), IsRigSlot, IsWreckTypeID, InventoryItem::itemID(), DBSystemDynamicEntity::itemID, InventoryItem::itemName(), DBSystemDynamicEntity::itemName, itoa(), CharKillData::killBlob, CharKillData::killTime, SystemEntity::m_allyID, SystemEntity::m_bubble, SystemEntity::m_corpID, SystemEntity::m_destiny, SystemEntity::m_ownerID, SystemEntity::m_self, m_shipRef, SystemEntity::m_system, SystemEntity::m_warID, MakeRandomFloat(), MakeRandomInt(), GPoint::MakeRandomPointOnSphere(), CharKillData::moonID, InventoryItem::name(), DBSystemDynamicEntity::ownerID, Character::PayBounty(), PayInsurance(), DBSystemDynamicEntity::position, InventoryItem::radius(), sConfig, sDataMgr, Character::secStatusChange(), DestinyManager::SendJettisonPacket(), ShipItem::SetPopped(), sItemFactory, sLog, CharKillData::solarSystemID, Damage::srcSE, RefPtr< X >::StaticCast(), EvE::traceStack(), InventoryItem::typeID(), DBSystemDynamicEntity::typeID, CharKillData::victimAllianceID, CharKillData::victimCharacterID, CharKillData::victimCorporationID, CharKillData::victimDamageTaken, CharKillData::victimFactionID, CharKillData::victimShipTypeID, Damage::weaponRef, EVEDB::invGroups::Wreck, Ga::GaVec3::x, SystemEntity::x(), Ga::GaVec3::y, SystemEntity::y(), Ga::GaVec3::z, and SystemEntity::z().

373  {
374  if ((m_bubble == nullptr) or (m_destiny == nullptr) or (m_system == nullptr))
375  return; // make error here?
376 
377  m_shipRef->SetPopped(true);
378 
379  /* {'messageKey': 'ShipExploded', 'dataID': 17881627, 'suppressable': True, 'bodyID': 258841, 'messageType': 'info', 'urlAudio': '', 'urlIcon': '', 'titleID': 258840, 'messageID': 1558}
380  * u'ShipExplodedBody'}(u'Your ship has been destroyed by {[character]charID.name}.', None, {u'{[character]charID.name}': {'conditionalValues': [], 'variableType': 0, 'propertyName': 'name', 'args': 0, 'kwargs': {}, 'variableName': 'charID'}})
381  */
382  uint32 killerID = 0, locationID = GetLocationID();
383  Client* pClient(nullptr);
384  SystemEntity* killer(fatal_blow.srcSE);
385 
386  if (killer->HasPilot()) {
387  pClient = killer->GetPilot();
388  killerID = pClient->GetCharacterID();
389  } else if (killer->IsDroneSE()) {
390  pClient = killer->GetDroneSE()->GetOwner();
391  if (pClient == nullptr) {
393  sLog.Error("Ship::Killed()", "killer == IsDrone and pPlayer == nullptr");
394  EvE::traceStack();
395  } else {
396  killerID = pClient->GetCharacterID();
397  }
398  } else {
399  killerID = killer->GetID();
400  }
401 
402  // AttrFwLpKill
403 
404  // log faction kill in dynamic data -allan
405  MapDB::AddKill(locationID);
406  MapDB::AddFactionKill(locationID);
407 
408  // set up basic wreck data
409  GPoint wreckPosition = m_destiny->GetPosition();
410  if (wreckPosition.isNaN()) {
411  sLog.Error("Ship::Killed()", "Wreck Position is NaN");
412  return;
413  }
414  uint32 wreckTypeID = sDataMgr.GetWreckID(m_self->typeID());
415  if (!IsWreckTypeID(wreckTypeID)) {
416  sLog.Error("Ship::Killed()", "Could not get wreckType for %s of type %u", m_self->name(), m_self->typeID());
417  // default to generic frigate wreck till i get better checks and/or complete wreck data
418  wreckTypeID = 26557;
419  }
420 
421  std::string wreck_name = m_self->itemName() + " Wreck";
422 
423  if (!m_self->HasPilot()) {
424  // Spawn a wreck for the Ship that was destroyed:
425  ItemData wreckItemData(wreckTypeID, killerID, locationID, flagNone, wreck_name.c_str(), wreckPosition, itoa(m_allyID));
426  WreckContainerRef wreckItemRef = sItemFactory.SpawnWreckContainer( wreckItemData );
427  if (wreckItemRef.get() == nullptr) {
428  sLog.Error("Ship::Killed()", "Creating Wreck Item Failed for %s of type %u", wreck_name.c_str(), wreckTypeID);
429  return;
430  }
431 
432  if (is_log_enabled(PHYSICS__TRACE))
433  _log(PHYSICS__TRACE, "Ship::Killed() - Ship %s(%u) Position: %.2f,%.2f,%.2f. Wreck %s(%u) Position: %.2f,%.2f,%.2f.", \
434  GetName(), GetID(), x(), y(), z(), wreckItemRef->name(), wreckItemRef->itemID(), wreckPosition.x, wreckPosition.y, wreckPosition.z);
435 
437  wreckEntity.allianceID = killer->GetAllianceID();
439  wreckEntity.corporationID = killer->GetCorporationID();
440  wreckEntity.factionID = sDataMgr.GetWreckFaction(wreckTypeID);
441  wreckEntity.groupID = EVEDB::invGroups::Wreck;
442  wreckEntity.itemID = wreckItemRef->itemID();
443  wreckEntity.itemName = wreck_name;
444  wreckEntity.ownerID = killerID;
445  wreckEntity.typeID = wreckTypeID;
446  wreckEntity.position = wreckPosition;
447 
448  if (!m_system->BuildDynamicEntity(wreckEntity, m_self->itemID())) {
449  sLog.Error("Ship::Killed()", "Spawning Wreck Failed: typeID or typeName not supported: '%u'", wreckTypeID);
450  ; // PyException( MakeCustomError ( "Spawning Wreck Failed: typeID or typeName not supported." ) );
451  wreckItemRef->Delete();
452  return;
453  }
454 
456  // wreck was created successfully. drop loot and add to wreck.
457  DropLoot(wreckItemRef, m_self->groupID(), killerID);
458 
459  return;
460  }
461 
462  Client* pPilot(m_self->GetPilot());
463  if (pPilot == nullptr)
464  return; // make error here
465 
466  if (pClient != nullptr)
467  if (m_system->GetSystemSecurityRating() > 0) {
468  /* http://www.eveinfo.net/wiki/ind~4067.htm
469  * relative_sec_status_penalty = base_penalty * system_truesec * (1 + (victim_sec_status - agressor_sec_status) / 90)
470  * The actual drop in security status seen by the attacker is a function of their current security status and the relative penalty:
471  * security status loss = relative_penalty * (agressor_sec_status + 10)
472  */
474  double modifier = (1 + ((pPilot->GetSecurityRating() - pClient->GetSecurityRating()) / 90));
475  double penalty = 6.0f * m_system->GetSystemSecurityRating() * modifier;
476  double loss = penalty * ( pClient->GetSecurityRating() + 10);
477  loss *= sConfig.rates.secRate;
478  pClient->GetChar()->secStatusChange( loss );
479  }
480 
481  /* populate kill data for killMail and save to db -allan 01May16 --updated 13July17 */
482  CharKillData data = CharKillData();
483  data.solarSystemID = m_system->GetID();
484  data.victimCharacterID = pPilot->GetCharacterID();
486  data.victimAllianceID = m_allyID;
487  data.victimFactionID = m_warID;
488  data.victimShipTypeID = m_self->typeID();
489 
490  data.finalCharacterID = killerID;
491  data.finalCorporationID = killer->GetCorporationID();
492  data.finalAllianceID = killer->GetAllianceID();
493  data.finalFactionID = (killer->GetWarFactionID() > 500021 ? 500021 : killer->GetWarFactionID());
494  data.finalShipTypeID = killer->GetTypeID();
495  data.finalWeaponTypeID = fatal_blow.weaponRef->typeID();
496  data.finalSecurityStatus = 0; /* fix this */
497  data.finalDamageDone = fatal_blow.GetTotal();
498 
499  uint32 totalHP = m_self->GetAttribute(AttrHP).get_int();
500  totalHP += m_self->GetAttribute(AttrArmorHP).get_int();
502  data.victimDamageTaken = totalHP;
503 
504  std::stringstream blob;
505  std::vector<InventoryItemRef> survivedItems;
506  if (pPilot->InPod()) {
507  blob << "<items><i t=" << data.victimShipTypeID << " f=0 s=1 d=0 x=1/></items>";
508  } else {
509  AbortCycle();
510  AbandonDrones();
511 
512  // remove all charges (per packet data) ...why???
513  //GetShipItemRef()->UnloadAllModules();
514 
515  blob << "<items>";
516  /* killBlob contains destroyed/dropped items. u'<items><i t=3651 f=0 d=0 x=1/><i t=3634 f=0 d=0 x=1/></items>' -allan 13July17
517  " i*" tag is decoded as follows:
518  t = item.typeID
519  f = item.flag
520  s = item.singleton
521  d = item.qtyDropped
522  x = item.qtyDestroyed
523  */
524  std::map<uint32, InventoryItemRef> deadShipInventory;
525  deadShipInventory.clear();
526  GetShipItemRef()->GetMyInventory()->GetInventoryMap(deadShipInventory);
527  if (deadShipInventory.empty()) {
528  blob << "<i t=" << data.victimShipTypeID << " f=0 s=1 d=0 x=1/>";
529  } else {
530  uint32 s = 0, d = 0, x = 0;
531  for (auto cur : deadShipInventory) {
532  d = 0;
533  x = cur.second->quantity();
534  s = (cur.second->isSingleton() ? 1 : 0);
535  if (cur.second->categoryID() == EVEDB::invCategories::Blueprint) {
536  // singleton for bpo = 1, bpc = 2.
537  BlueprintRef bpRef = BlueprintRef::StaticCast(cur.second);
538  s = (bpRef->copy() ? 2 : s);
539  }
540 
541  blob << "<i t=" << cur.second->typeID() << " f=" << cur.second->flag() << " s=" << s ;
542  // all contained items have 50% chance of drop, except rigs, which do not survive
543  // todo: add damage to item, if applicable, from ship explosion
544  //cur.second->SetAttribute(AttrDamage, 5);
545  if (IsRigSlot(cur.second->flag())) {
546  /* just avoiding survive check */;
547  } else if (IsEven(MakeRandomInt(0, 100))) {
548  // item survived. check qty for drop
549  if (x > 1) {
550  d = MakeRandomInt(0, x);
551  x -= d;
552  }
553  // move item to vector for insertion into wreck later on
554  survivedItems.push_back(cur.second);
555  }
556  blob << " d=" << d << " x=" << x << "/>";
557  }
558  }
559  blob << "</items>";
560  }
561 
562  data.killBlob = blob.str().c_str();
563  data.killTime = GetFileTimeNow();
564  data.moonID = 0;
565 
566  pPilot->GetChar()->LogKill(data);
567 
568  if (pPilot->InPod()) {
569  // log podKill
570  MapDB::AddPodKill(locationID);
571 
572  if (pClient != nullptr)
573  pClient->GetChar()->PayBounty(pPilot->GetChar());
574 
575  std::string corpse_name = pPilot->GetName();
576  corpse_name += "'s Frozen Corpse";
577  uint32 corpseTypeID = 10041; // typeID from 'invTypes' table for "Frozen Corpse"
578  ItemData corpseItemData(corpseTypeID, m_ownerID, locationID, flagNone, corpse_name.c_str(), wreckPosition);
579  InventoryItemRef corpseItemRef = sItemFactory.SpawnItem( corpseItemData );
580  if (corpseItemRef.get() == nullptr) {
581  sLog.Error("Ship::Killed()", "Creating Corpse Item Failed for %s of type %u", corpse_name.c_str(), corpseTypeID);
583  corpseEntity.allianceID = m_allyID;
585  corpseEntity.corporationID = m_corpID;
586  corpseEntity.factionID = m_warID;
587  corpseEntity.groupID = EVEDB::invGroups::Biomass;
588  corpseEntity.itemID = corpseItemRef->itemID();
589  corpseEntity.itemName = corpse_name;
590  corpseEntity.ownerID = 1; //would this be 'owned' by killer?
591  corpseEntity.typeID = corpseTypeID;
592  corpseEntity.position = wreckPosition;
593  if (!m_system->BuildDynamicEntity(corpseEntity)) {
594  sLog.Error("Ship::Killed()", "Spawning Corpse Failed: typeID or typeName not supported: '%u'", corpseTypeID);
595  } else if (is_log_enabled(PHYSICS__TRACE)) {
596  _log(PHYSICS__TRACE, "Ship::Killed() - Pod %s(%u) Position: %.2f,%.2f,%.2f. Corpse %s(%u) Position: %.2f,%.2f,%.2f.", \
597  GetName(), GetID(), x(), y(), z(), corpseItemRef->name(), corpseItemRef->itemID(), wreckPosition.x, wreckPosition.y, wreckPosition.z);
598  }
599  }
600 
601  // this method will reset char variables to last clone state after being podded. NOTE *** NOT TESTED YET ***
602  pPilot->ResetAfterPodded();
603  } else {
604  PayInsurance();
605 
607 
608  uint16 groupID = m_self->groupID();
609  GPoint podPosition(wreckPosition);
610  podPosition.MakeRandomPointOnSphere(GetShipItemRef()->radius() + pPilot->GetPod()->radius() + MakeRandomFloat(100, 200));
611  // this resets client ship data
612  pPilot->ResetAfterPopped(podPosition);
613 
614  ItemData wreckItemData(wreckTypeID, pPilot->GetCharacterID(), locationID, flagNone, wreck_name.c_str(), wreckPosition, itoa(m_allyID));
615  WreckContainerRef wreckItemRef = sItemFactory.SpawnWreckContainer( wreckItemData );
616  if (wreckItemRef.get() == nullptr) {
617  sLog.Error("Ship::Killed()", "Creating Wreck Item Failed for %s of type %u", wreck_name.c_str(), wreckTypeID);
618  return;
619  }
620 
621  if (is_log_enabled(PHYSICS__TRACE))
622  _log(PHYSICS__TRACE, "Ship::Killed() - Ship %s(%u) Position: %.2f,%.2f,%.2f. Wreck %s(%u) Position: %.2f,%.2f,%.2f.", \
623  GetName(), GetID(), x(), y(), z(), wreckItemRef->name(), wreckItemRef->itemID(), wreckPosition.x, wreckPosition.y, wreckPosition.z);
624 
626  wreckEntity.allianceID = killer->GetAllianceID();
628  wreckEntity.corporationID = killer->GetCorporationID();
629  wreckEntity.factionID = sDataMgr.GetWreckFaction(wreckTypeID);
630  wreckEntity.groupID = EVEDB::invGroups::Wreck;
631  wreckEntity.itemID = wreckItemRef->itemID();
632  wreckEntity.itemName = wreck_name;
633  wreckEntity.ownerID = pPilot->GetCharacterID();
634  wreckEntity.typeID = wreckTypeID;
635  wreckEntity.position = wreckPosition;
636 
637  if (!m_system->BuildDynamicEntity(wreckEntity, m_self->itemID())) {
638  sLog.Error("Ship::Killed()", "Spawning Wreck Failed for typeID %u", wreckTypeID);
639  wreckItemRef->Delete();
640  return;
641  }
642 
643  DropLoot(wreckItemRef, groupID, killerID);
644 
645  for (auto cur: survivedItems)
646  cur->Move(wreckItemRef->itemID(), flagNone); // populate wreck with items that survived
647  }
648 }
#define sConfig
A macro for easier access to the singleton.
uint32 finalDamageDone
double radius() const
uint32 finalCorporationID
uint32 victimDamageTaken
#define _log(type, fmt,...)
Definition: logsys.h:124
#define IsWreckTypeID(typeID)
Definition: EVE_Defines.h:203
DestinyManager * m_destiny
Definition: SystemEntity.h:265
uint32 finalCharacterID
uint32 m_ownerID
Definition: SystemEntity.h:283
void SendJettisonPacket() const
void PayInsurance()
Definition: Ship.cpp:2502
ShipItemRef GetShipItemRef()
Definition: Ship.h:362
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114
double y()
Definition: SystemEntity.h:214
GaExpInl bool isNaN() const
Definition: GaTypes.h:194
static void AddKill(uint32 sysID)
Definition: MapDB.cpp:250
SystemBubble * m_bubble
Definition: SystemEntity.h:262
static void AddFactionKill(uint32 sysID)
Definition: MapDB.cpp:256
SystemEntity * srcSE
Definition: Damage.h:84
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
uint32 GetID() const
Definition: SystemManager.h:80
int32 victimFactionID
const char * name()
GaFloat x
Definition: GaTypes.h:207
bool BuildDynamicEntity(const DBSystemDynamicEntity &entity, uint32 launcherID=0)
uint16 groupID() const
#define is_log_enabled(type)
Definition: logsys.h:78
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
Definition: gpoint.h:33
InventoryItemRef m_self
Definition: SystemEntity.h:269
bool IsEven(int64 number)
Definition: misc.h:88
uint32 m_corpID
Definition: SystemEntity.h:281
uint32 GetLocationID()
Definition: SystemEntity.h:209
int64 get_int()
Definition: EvilNumber.cpp:166
uint32 solarSystemID
uint32 victimCorporationID
SystemManager * m_system
Definition: SystemEntity.h:263
uint16 finalShipTypeID
double z()
Definition: SystemEntity.h:215
uint32 GetID()
Definition: SystemEntity.h:207
uint32 victimCharacterID
int32 finalFactionID
const char * GetName() const
Definition: SystemEntity.h:210
double x()
Definition: SystemEntity.h:213
Definition: Client.h:66
double finalSecurityStatus
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
unsigned __int32 uint32
Definition: eve-compat.h:50
void GetInventoryMap(std::map< uint32, InventoryItemRef > &invMap)
Definition: Inventory.cpp:453
ShipItemRef m_shipRef
Definition: Ship.h:376
GaFloat y
Definition: GaTypes.h:207
double GetFileTimeNow()
Definition: utils_time.cpp:84
static void AddPodKill(uint32 sysID)
Definition: MapDB.cpp:262
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
const std::string & itemName() const
float GetTotal() const
Definition: Damage.h:48
void DropLoot(WreckContainerRef wreckRef, uint32 groupID, uint32 owner)
EvilNumber GetAttribute(const uint16 attrID) const
uint16 finalWeaponTypeID
uint16 victimShipTypeID
#define IsRigSlot(flag)
Definition: EVE_Defines.h:367
void SetPopped(bool set=false)
Definition: Ship.h:90
const GPoint & GetPosition() const
void traceStack(void)
Definition: misc.cpp:169
#define sItemFactory
Definition: ItemFactory.h:165
void AbortCycle()
Definition: Ship.h:356
int32 finalAllianceID
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
unsigned __int16 uint16
Definition: eve-compat.h:48
InventoryItemRef weaponRef
Definition: Damage.h:86
int32 victimAllianceID
std::string killBlob
uint16 typeID() const
virtual bool HasPilot()
void AbandonDrones()
Definition: Ship.cpp:2853
GaFloat z
Definition: GaTypes.h:207
const char * itoa(int64 num)
Convers num to string.
uint32 itemID() const
Definition: InventoryItem.h:98
virtual Client * GetPilot()
#define sDataMgr
bool ShipSE::LaunchDrone ( InventoryItemRef  dRef)

Definition at line 2792 of file Ship.cpp.

References Character::allianceID(), FactionData::allianceID, AttrDroneBandwidth, AttrDroneBandwidthLoad, AttrDroneBandwidthUsed, InventoryItem::ChangeSingleton(), Character::corporationID(), FactionData::corporationID, FactionData::factionID, flagNone, RefPtr< X >::get(), DroneSE::GetAI(), InventoryItem::GetAttribute(), Client::GetChar(), SystemEntity::GetLocationID(), GetPilot(), SystemEntity::GetPosition(), InventoryItem::itemID(), DroneSE::Launch(), m_drones, SystemEntity::m_services, m_shipRef, SystemEntity::m_system, GPoint::MakeRandomPointOnSphere(), InventoryItem::Move(), InventoryItem::name(), DroneSE::Online(), FactionData::ownerID, InventoryItem::SetAttribute(), DroneAIMgr::SetIdle(), InventoryItem::SetPosition(), sLog, and Character::warFactionID().

2792  {
2793  Character* pChar = GetPilot()->GetChar().get();
2794  sLog.Magenta("ShipSE::LaunchDrone()","%s: Launching drone %u", pChar->name(), dRef->itemID());
2795 
2796  dRef->Move(GetLocationID(), flagNone, true);
2797  dRef->ChangeSingleton(true);
2798 
2799  GPoint position(GetPosition());
2800  position.MakeRandomPointOnSphere(500.0);
2801  dRef->SetPosition(position);
2802 
2803  //now we create an SE to represent it.
2804  FactionData data = FactionData();
2805  data.allianceID = pChar->allianceID();
2806  data.corporationID = pChar->corporationID();
2807  data.factionID = pChar->warFactionID();
2808  data.ownerID = pChar->itemID();
2809  DroneSE* pDrone = new DroneSE(dRef, m_services, m_system, data);
2810 
2811  // tell new drone it's being launched.
2812  pDrone->Launch(this);
2813  // add drone to launched drone map (whether onlined or not)
2814  m_drones.emplace(dRef->itemID(), dRef.get());
2815 
2816  /*
2817  AttrDroneBandwidth = 1271, <-- ship attribute (total)
2818  AttrDroneBandwidthUsed = 1272, <-- drone attribute
2819  AttrDroneBandwidthLoad = 1273, <-- ship attribute (current used)
2820  */
2821  // if ship doesnt have bandwidth for drone, it will not online after launch (inert)
2823  load += dRef->GetAttribute(AttrDroneBandwidthUsed);
2824  if (load <= m_shipRef->GetAttribute(AttrDroneBandwidth)) {
2825  pDrone->Online();
2826  pDrone->GetAI()->SetIdle();
2827  m_shipRef->SetAttribute(AttrDroneBandwidthLoad, load, false); // client dont care
2828  return true;
2829  }
2830  //{'FullPath': u'UI/Messages', 'messageID': 258031, 'label': u'MaxBandwidthExceededBody'}(u"You don't have enough bandwidth to launch {droneName}. You need {bandwidthNeeded} Mbit/s but {droneName} requires {droneBandwidthUsed} Mbit/s.", None, {u'{droneName}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'droneName'}, u'{droneBandwidthUsed}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'droneBandwidthUsed'}, u'{bandwidthNeeded}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'bandwidthNeeded'}})
2831  //{'FullPath': u'UI/Messages', 'messageID': 258041, 'label': u'MaxBandwidthExceeded2Body'}(u"You don't have enough bandwidth to launch {droneName}. You need {droneBandwidthUsed} Mbit/s but only have {bandwidthLeft} Mbit/s available.", None, {u'{droneName}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'droneName'}, u'{bandwidthLeft}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'bandwidthLeft'}, u'{droneBandwidthUsed}': {'conditionalValues': [], 'variableType': 10, 'propertyName': None, 'args': 0, 'kwargs': {}, 'variableName': 'droneBandwidthUsed'}})
2832  return false;
2833 }
void Online(ShipSE *pShipSE=nullptr)
Definition: Drone.cpp:153
DroneAIMgr * GetAI()
Definition: Drone.h:75
PyServiceMgr & m_services
Definition: SystemEntity.h:267
void SetPosition(const GPoint &pos)
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
const char * name()
CharacterRef GetChar() const
Definition: Client.h:164
const GPoint & GetPosition() const
Definition: SystemEntity.h:211
void Move(uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
void SetIdle()
Definition: DroneAI.cpp:142
Definition: gpoint.h:33
uint32 GetLocationID()
Definition: SystemEntity.h:209
virtual Client * GetPilot()
Definition: Ship.h:331
SystemManager * m_system
Definition: SystemEntity.h:263
void SetAttribute(uint16 attrID, int num, bool notify=true)
X * get() const
Definition: RefPtr.h:213
int32 warFactionID() const
Definition: Character.h:303
Definition: Drone.h:46
bool ChangeSingleton(bool singleton, bool notify=false)
uint32 corporationID() const
Definition: Character.h:300
std::map< uint32, InventoryItem * > m_drones
Definition: Ship.h:402
uint32 corporationID
ShipItemRef m_shipRef
Definition: Ship.h:376
void Launch(ShipSE *pShipSE)
Definition: Drone.cpp:142
EvilNumber GetAttribute(const uint16 attrID) const
int32 allianceID() const
Definition: Character.h:302
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

void ShipSE::MakeDamageState ( DoDestinyDamageState &  into)
virtual

Reimplemented from DynamicSystemEntity.

Definition at line 2681 of file Ship.cpp.

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

2681  {
2683  into.recharge = m_self->GetAttribute(AttrShieldRechargeRate).get_float() + 7;
2684  into.timestamp = GetFileTimeNow();
2686  into.structure = 1.0 - (m_self->GetAttribute(AttrDamage).get_float() / m_self->GetAttribute(AttrHP).get_float());
2687 }
InventoryItemRef m_self
Definition: SystemEntity.h:269
double GetFileTimeNow()
Definition: utils_time.cpp:84
EvilNumber GetAttribute(const uint16 attrID) const
float get_float()
Definition: EvilNumber.cpp:184

Here is the call graph for this function:

PyDict * ShipSE::MakeSlimItem ( )
virtual

Reimplemented from DynamicSystemEntity.

Definition at line 2689 of file Ship.cpp.

References _log, PyList::AddItem(), InventoryItem::categoryID(), flagHiSlot0, flagHiSlot7, Client::GetBounty(), Client::GetCharacterID(), SystemEntity::GetID(), Inventory::GetItemsByFlagRange(), InventoryItem::GetMyInventory(), SystemEntity::GetName(), InventoryItem::GetPilot(), Client::GetSecurityRating(), InventoryItem::groupID(), is_log_enabled, IsAlliance, IsCorp, IsFaction, InventoryItem::itemID(), InventoryItem::itemName(), items, itemTypeCapsule, SystemEntity::m_allyID, SystemEntity::m_corpID, SystemEntity::m_ownerID, m_podShipID, SystemEntity::m_self, SystemEntity::m_warID, InventoryItem::name(), new_tuple(), PyStatic, and InventoryItem::typeID().

2689  {
2690  _log(SE__SLIMITEM, "MakeSlimItem for Ship %s(%u)", m_self->name(), m_self->itemID());
2691  PyDict *slim = new PyDict();
2692  slim->SetItemString("itemID", new PyLong(m_self->itemID()));
2693  slim->SetItemString("typeID", new PyInt(m_self->typeID()));
2694  slim->SetItemString("name", new PyString(m_self->itemName()));
2695  slim->SetItemString("ownerID", new PyInt(m_ownerID));
2696  slim->SetItemString("charID", new PyInt(m_self->GetPilot() ? m_self->GetPilot()->GetCharacterID() : 0));
2697  slim->SetItemString("corpID", IsCorp(m_corpID) ? new PyInt(m_corpID) : PyStatic.NewNone());
2698  slim->SetItemString("allianceID", IsAlliance(m_allyID) ? new PyInt(m_allyID) : PyStatic.NewNone());
2699  slim->SetItemString("warFactionID", IsFaction(m_warID) ? new PyInt(m_warID) : PyStatic.NewNone());
2700  slim->SetItemString("bounty", new PyFloat(m_self->GetPilot() ? m_self->GetPilot()->GetBounty() : 0));
2701  slim->SetItemString("securityStatus", new PyFloat(m_self->GetPilot() ? m_self->GetPilot()->GetSecurityRating() : 0.0));
2702  if (m_self->typeID() == itemTypeCapsule) {
2703  slim->SetItemString("launcherID", new PyInt(m_podShipID));
2704  return slim;
2705  } else {
2706  slim->SetItemString("categoryID", new PyInt(m_self->categoryID()));
2707  slim->SetItemString("groupID", new PyInt(m_self->groupID()));
2708  }
2709 
2710  //encode the hiSlot and Subsystem modules list ONLY
2711  std::vector<InventoryItemRef> items;
2713  //m_self->GetMyInventory()->GetItemsByFlagRange(flagSubSystem0, flagSubSystem7, items);
2714  if (!items.empty()) {
2715  PyList *list = new PyList();
2716  for (auto cur : items)
2717  list->AddItem(new_tuple(cur->itemID(), cur->typeID()));
2718 
2719  slim->SetItemString("modules", list );
2720  }
2721 
2722  if (is_log_enabled(DESTINY__DEBUG)) {
2723  _log( DESTINY__DEBUG, "ShipSE::MakeSlimItem() - %s(%u)", GetName(), GetID());
2724  slim->Dump(DESTINY__DEBUG, " ");
2725  }
2726 
2727  return slim;
2728 }
uint32 m_podShipID
Definition: Ship.h:385
#define _log(type, fmt,...)
Definition: logsys.h:124
Python string.
Definition: PyRep.h:430
float GetSecurityRating() const
Definition: Client.h:172
Python's dictionary.
Definition: PyRep.h:719
uint32 m_ownerID
Definition: SystemEntity.h:283
Python floating point number.
Definition: PyRep.h:292
int32 GetCharacterID() const
Definition: Client.h:113
const char * name()
void AddItem(PyRep *i)
Definition: PyRep.h:701
uint16 groupID() const
#define is_log_enabled(type)
Definition: logsys.h:78
InventoryItemRef m_self
Definition: SystemEntity.h:269
uint32 m_corpID
Definition: SystemEntity.h:281
PyTuple * new_tuple(int64 arg1)
Definition: PyRep.cpp:1160
float GetBounty() const
Definition: Client.h:171
Python integer.
Definition: PyRep.h:231
uint32 GetID()
Definition: SystemEntity.h:207
#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
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all items
uint32 GetItemsByFlagRange(EVEItemFlags low_flag, EVEItemFlags high_flag, std::vector< InventoryItemRef > &items) const
Definition: Inventory.cpp:502
uint16 typeID() const
uint8 categoryID() const
Python list.
Definition: PyRep.h:639
uint32 itemID() const
Definition: InventoryItem.h:98
virtual Client * GetPilot()
Python long integer.
Definition: PyRep.h:261

Here is the call graph for this function:

virtual void ShipSE::MissileLaunched ( Missile pMissile)
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 323 of file Ship.h.

323 { /* Do nothing here */ }
void ShipSE::PayInsurance ( )

Definition at line 2502 of file Ship.cpp.

References corpSCC, ShipDB::DeleteInsuranceByShipID(), ShipDB::GetShipInsurancePayout(), InventoryItem::groupID(), Journal::EntryType::Insurance, InventoryItem::itemID(), InventoryItem::itemName(), m_db, SystemEntity::m_ownerID, SystemEntity::m_self, EVEDB::invGroups::Rookieship, AccountService::TranserFunds(), and InventoryItem::typeID().

Referenced by Killed().

2502  {
2504  return;
2505  std::string reason = "Insurance payment for loss of the ship ";
2506  reason += m_self->itemName();
2510 }
uint32 m_ownerID
Definition: SystemEntity.h:283
uint16 groupID() const
InventoryItemRef m_self
Definition: SystemEntity.h:269
static void DeleteInsuranceByShipID(uint32 shipID)
Definition: ShipDB.cpp:65
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)
float GetShipInsurancePayout(uint32 shipID)
Definition: ShipDB.cpp:70
const std::string & itemName() const
ShipDB m_db
Definition: Ship.h:381
uint16 typeID() const
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::Process ( )
virtual
Todo:
m_self is NOT being populated for non-piloted ships...check later

Reimplemented from SystemEntity.

Definition at line 2440 of file Ship.cpp.

References _log, AttrCapacitorCapacity, AttrCapacitorCharge, AttrRechargeRate, AttrShieldCapacity, AttrShieldCharge, AttrShieldRechargeRate, CalculateRechargeRate(), EVEDB::invCategories::Charge, Timer::Check(), RefPtr< X >::get(), EvilNumber::get_float(), InventoryItem::GetAttribute(), Client::GetName(), InventoryItem::GetPilot(), GetTimeUSeconds(), InventoryItem::HasPilot(), InventoryItem::itemID(), SystemEntity::m_killed, m_processTimer, m_processTimerTick, SystemEntity::m_self, m_shipRef, SystemEntity::Process(), ShipItem::ProcessHeat(), ShipItem::ProcessModules(), sConfig, SystemEntity::SendDamageStateChanged(), InventoryItem::SetAttribute(), Profile::ship, and sProfiler.

2440  {
2441  if (m_killed)
2442  return;
2443  /* Enable base call to Process Targeting and Movement */
2445 
2446  // check to see if this is an empty ship, and exit if so.
2447  // we're not worried about recharge and modules for empty ships (segfaults)
2449  if ((m_self.get() == nullptr) or (!m_self->HasPilot()))
2450  return;
2451 
2452  if (m_processTimer.Check()) {
2453  double profileStartTime = GetTimeUSeconds();
2454  // shield
2456  float Capacity = m_self->GetAttribute(AttrShieldCapacity).get_float();
2457  if (Charge < Capacity) {
2458  float newCharge = Charge + ((m_processTimerTick /1000) * CalculateRechargeRate(Capacity, Charge, m_self->GetAttribute(AttrShieldRechargeRate).get_float()));
2459  if (newCharge > Capacity) {
2460  newCharge = Capacity;
2461  } else if ((Capacity - newCharge) < 0.3) {
2462  newCharge = Capacity;
2463  }
2464  m_self->SetAttribute(AttrShieldCharge, newCharge);
2466  _log(SHIP__RECHARGE, "ShipSE::Process(): %s(%u) - New Shield Charge: %f", m_self->GetPilot()->GetName(), m_self->itemID(), newCharge);
2467  }
2468 
2469  // cap
2472  if (Charge < Capacity) {
2473  float newCharge = Charge + ((m_processTimerTick /1000) * CalculateRechargeRate(Capacity, Charge, m_self->GetAttribute(AttrRechargeRate).get_float()));
2474  if (newCharge > Capacity) {
2475  newCharge = Capacity;
2476  } else if ((Capacity - newCharge) < 0.3) {
2477  newCharge = Capacity;
2478  }
2480  _log(SHIP__RECHARGE, "ShipSE::Process(): %s(%u) - New Cap Charge: %f", m_self->GetPilot()->GetName(), m_self->itemID(), newCharge);
2481  }
2482  // profile timer for the ship recharge shit
2483  if (sConfig.debug.UseProfiling)
2484  sProfiler.AddTime(Profile::ship, GetTimeUSeconds() - profileStartTime);
2485 
2486  // proc heat on the 5s cap/shield tic, if enabled
2487  if (sConfig.testing.ShipHeat)
2489  }
2490 
2492 }
void ProcessHeat()
Definition: Ship.cpp:1130
#define sConfig
A macro for easier access to the singleton.
virtual void Process()
#define _log(type, fmt,...)
Definition: logsys.h:124
void ProcessModules()
Definition: Ship.cpp:343
#define sProfiler
Definition: dbcore.cpp:39
Timer m_processTimer
Definition: Ship.h:383
InventoryItemRef m_self
Definition: SystemEntity.h:269
double GetTimeUSeconds()
Definition: utils_time.cpp:116
float CalculateRechargeRate(float Capacity, float RechargeTimeMS, float Current)
Definition: Ship.cpp:2416
void SetAttribute(uint16 attrID, int num, bool notify=true)
bool Check(bool reset=true)
Definition: timer.cpp:62
X * get() const
Definition: RefPtr.h:213
const char * GetName() const
Definition: Client.h:94
ShipItemRef m_shipRef
Definition: Ship.h:376
void SendDamageStateChanged()
EvilNumber GetAttribute(const uint16 attrID) const
float get_float()
Definition: EvilNumber.cpp:184
virtual bool HasPilot()
const uint32 m_processTimerTick
Definition: Ship.h:378
uint32 itemID() const
Definition: InventoryItem.h:98
virtual Client * GetPilot()

Here is the call graph for this function:

void ShipSE::RemoveBoost ( )

Definition at line 2742 of file Ship.cpp.

References _log, AttrArmorHP, AttrInetia, AttrMaxTargetRange, AttrScanResolution, AttrShieldCapacity, ClearBoostData(), SystemEntity::GetID(), SystemEntity::GetName(), SystemEntity::m_destiny, m_oldArmor, m_oldInertia, m_oldScanRes, m_oldShield, m_oldTargetRange, m_shipRef, InventoryItem::SetAttribute(), and DestinyManager::UpdateShipVariables().

Referenced by ApplyBoost().

2743 {
2744  _log( FLEET__TRACE, "ShipSE::RemoveBoost() - %s(%u)", GetName(), GetID());
2745 
2751 
2753 
2754  ClearBoostData();
2755 }
#define _log(type, fmt,...)
Definition: logsys.h:124
DestinyManager * m_destiny
Definition: SystemEntity.h:265
float m_oldInertia
Definition: Ship.h:396
void ClearBoostData()
Definition: Ship.cpp:2730
uint32 m_oldTargetRange
Definition: Ship.h:395
void SetAttribute(uint16 attrID, int num, bool notify=true)
uint32 GetID()
Definition: SystemEntity.h:207
uint16 m_oldArmor
Definition: Ship.h:392
const char * GetName() const
Definition: SystemEntity.h:210
ShipItemRef m_shipRef
Definition: Ship.h:376
uint16 m_oldScanRes
Definition: Ship.h:394
uint16 m_oldShield
Definition: Ship.h:393

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::RemoveTarget ( SystemEntity pSE)

Definition at line 2571 of file Ship.cpp.

References TargetManager::ClearTarget(), ShipItem::GetModuleManager(), m_shipRef, SystemEntity::m_targMgr, and ModuleManager::RemoveTarget().

2571  {
2572  // target has been unlocked
2574 
2575  m_targMgr->ClearTarget(pSE);
2576  //m_targMgr->OnTarget(pSE, TargMgr::Mode::Lost, TargMgr::Msg::StoppedTargeting);
2577 }
void ClearTarget(SystemEntity *tSE)
ModuleManager * GetModuleManager()
Definition: Ship.h:80
TargetManager * m_targMgr
Definition: SystemEntity.h:264
void RemoveTarget(SystemEntity *pSE)
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

void ShipSE::ResetShipSystemMgr ( SystemManager pSystem)

Definition at line 2512 of file Ship.cpp.

References SystemEntity::m_system.

Referenced by Client::MoveToLocation().

2513 {
2514  m_system = pSystem;
2515 }
SystemManager * m_system
Definition: SystemEntity.h:263

Here is the caller graph for this function:

void ShipSE::SaveShip ( )
inline

Definition at line 352 of file Ship.h.

References m_shipRef, and ShipItem::SaveShip().

352 { m_shipRef->SaveShip(); }
ShipItemRef m_shipRef
Definition: Ship.h:376
void SaveShip()
Definition: Ship.cpp:1060

Here is the call graph for this function:

void ShipSE::ScoopDrone ( SystemEntity pSE)

Definition at line 2835 of file Ship.cpp.

References AttrDroneBandwidthLoad, AttrDroneBandwidthUsed, InventoryItem::GetAttribute(), SystemEntity::GetDroneSE(), SystemEntity::GetID(), SystemEntity::GetSelf(), m_drones, m_shipRef, DroneSE::Offline(), and InventoryItem::SetAttribute().

2835  {
2836  m_drones.erase(pSE->GetID());
2837  pSE->GetDroneSE()->Offline();
2839  load -= pSE->GetSelf()->GetAttribute(AttrDroneBandwidthUsed);
2840  m_shipRef->SetAttribute(AttrDroneBandwidthLoad, load, false); // client dont care
2841 }
virtual DroneSE * GetDroneSE()
Definition: SystemEntity.h:135
this is a class that kinda mimics how python polymorph's numbers.
Definition: EvilNumber.h:59
void Offline()
Definition: Drone.cpp:163
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
void SetAttribute(uint16 attrID, int num, bool notify=true)
uint32 GetID()
Definition: SystemEntity.h:207
std::map< uint32, InventoryItem * > m_drones
Definition: Ship.h:402
ShipItemRef m_shipRef
Definition: Ship.h:376
EvilNumber GetAttribute(const uint16 attrID) const

Here is the call graph for this function:

void ShipSE::SetBoost ( bool  set = false)
inline

Definition at line 342 of file Ship.h.

References m_boosted.

342 { m_boosted = set; }
bool m_boosted
Definition: Ship.h:391
void ShipSE::SetFleetSMBUsage ( bool  set = false)
inline

Definition at line 373 of file Ship.h.

References m_allowFleetSMBUsage.

373 { m_allowFleetSMBUsage = set; }
bool m_allowFleetSMBUsage
Definition: Ship.h:387
void ShipSE::SetLauncherID ( uint32  shipID)
inline

Definition at line 359 of file Ship.h.

References m_podShipID.

Referenced by Client::Eject(), and Client::ResetAfterPopped().

359 { m_podShipID = shipID; }
uint32 m_podShipID
Definition: Ship.h:385

Here is the caller graph for this function:

void ShipSE::SetPassword ( std::string  pass)
inline

Definition at line 338 of file Ship.h.

References m_towerPass.

338 { m_towerPass = pass; }
std::string m_towerPass
Definition: Ship.h:399
void ShipSE::SetPilot ( Client pClient)
virtual

Reimplemented from SystemEntity.

Definition at line 2517 of file Ship.cpp.

References Client::GetAllianceID(), Client::GetCorporationID(), SystemEntity::m_allyID, SystemEntity::m_corpID, SystemEntity::m_self, and InventoryItem::SetPlayer().

Referenced by Client::MoveToPosition(), Client::ResetAfterPopped(), Client::SetShip(), and Client::UpdateNewShip().

2517  {
2518  m_self->SetPlayer(pClient);
2519  if (pClient == nullptr) {
2520  m_allyID = 0;
2521  m_corpID = 0;
2522  return;
2523  }
2524  // set shipSE data
2525  m_allyID = pClient->GetAllianceID();
2526  m_corpID = pClient->GetCorporationID();
2527 }
int32 GetCorporationID() const
Definition: Client.h:123
int32 GetAllianceID() const
Definition: Client.h:125
InventoryItemRef m_self
Definition: SystemEntity.h:269
uint32 m_corpID
Definition: SystemEntity.h:281
virtual void SetPlayer(Client *pClient)

Here is the call graph for this function:

Here is the caller graph for this function:

void ShipSE::UpdateDrones ( std::map< int16, int8 > &  attribs)

Definition at line 2843 of file Ship.cpp.

References AttrDroneFocusFire, AttrDroneIsAgressive, AttrFightersAttackAndFollow, and m_drones.

2843  {
2844  // update drones in space with new attrib settings
2845  for (auto cur : m_drones) {
2846  cur.second->SetAttribute(AttrDroneFocusFire, attribs[AttrDroneFocusFire]);
2847  cur.second->SetAttribute(AttrDroneIsAgressive, attribs[AttrDroneIsAgressive]);
2848  cur.second->SetAttribute(AttrFightersAttackAndFollow, attribs[AttrFightersAttackAndFollow]);
2849  //cur.second->SetAttribute(AttrDroneIsChaotic, attribs[AttrDroneIsChaotic]); // no longer used?
2850  }
2851 }
std::map< uint32, InventoryItem * > m_drones
Definition: Ship.h:402
void ShipSE::Warp ( )

Definition at line 2564 of file Ship.cpp.

References TargetManager::ClearModules(), m_shipRef, SystemEntity::m_targMgr, and ShipItem::Warp().

Referenced by DestinyManager::InitWarp().

2564  {
2565  if (m_targMgr != nullptr)
2567 
2568  m_shipRef->Warp();
2569 }
TargetManager * m_targMgr
Definition: SystemEntity.h:264
void Warp()
Definition: Ship.cpp:401
ShipItemRef m_shipRef
Definition: Ship.h:376

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool ShipSE::m_allowFleetSMBUsage
private

Definition at line 387 of file Ship.h.

Referenced by GetFleetSMBUsage(), and SetFleetSMBUsage().

BoostData ShipSE::m_boost = BoostData()
private

Definition at line 390 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), GetMiningBoostAmount(), and ShipSE().

bool ShipSE::m_boosted
private

Definition at line 391 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), IsBoosted(), and SetBoost().

ShipDB ShipSE::m_db
private

Definition at line 381 of file Ship.h.

Referenced by PayInsurance().

std::map<uint32, InventoryItem*> ShipSE::m_drones
private

Definition at line 402 of file Ship.h.

Referenced by AbandonDrones(), DroneCount(), LaunchDrone(), ScoopDrone(), and UpdateDrones().

uint16 ShipSE::m_oldArmor
private

Definition at line 392 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), and RemoveBoost().

float ShipSE::m_oldInertia
private

Definition at line 396 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), and RemoveBoost().

uint16 ShipSE::m_oldScanRes
private

Definition at line 394 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), and RemoveBoost().

uint16 ShipSE::m_oldShield
private

Definition at line 393 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), and RemoveBoost().

uint32 ShipSE::m_oldTargetRange
private

Definition at line 395 of file Ship.h.

Referenced by ApplyBoost(), ClearBoostData(), and RemoveBoost().

uint32 ShipSE::m_podShipID
private

Definition at line 385 of file Ship.h.

Referenced by GetLauncherID(), MakeSlimItem(), and SetLauncherID().

Timer ShipSE::m_processTimer
private

Definition at line 383 of file Ship.h.

Referenced by Process(), and ShipSE().

const uint32 ShipSE::m_processTimerTick
protected

Definition at line 378 of file Ship.h.

Referenced by Process(), and ShipSE().

std::string ShipSE::m_towerPass
private

Definition at line 399 of file Ship.h.

Referenced by SetPassword(), and ShipSE().


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