27 #include "packets/Planet.h"
56 _log(SE__DEBUG,
"Created CustomsSE for item %s (%u).", sRef->name(), sRef->itemID());
91 std::map<uint8, float> taxRateValues;
118 float z = targ.z - pos.z;
119 float x = targ.x - pos.x;
120 float y = targ.y - pos.y;
121 float yaw = atan2(x, z);
122 float hyp = sqrt(pow(z, 2) + pow(x, 2));
123 float pitch = atan2(y, hyp);
164 _log(POS__MESSAGE,
"CustomsSE::InitData() - Yaw: rise: %0.5f, run: %0.5f, angle: %0.5f (%0.3f)", z, x, yaw,
m_oData.
rotation.
x);
165 _log(POS__MESSAGE,
"CustomsSE::InitData() - Pitch: rise: %0.5f, run: %0.5f, angle: %0.5f (%0.3f)", y, hyp, pitch,
m_oData.
rotation.
y);
251 ge.effectID = effectID;
252 Notify_OnGodmaShipEffect shipEff;
253 shipEff.itemID = ge.selfID;
254 shipEff.effectID = effectID;
256 shipEff.start = (active ? 1 : 0);
257 shipEff.active = (active ? 1 : 0);
258 shipEff.environment = ge.Encode();
259 shipEff.startTime = shipEff.timeNow;
260 shipEff.duration = (active ? 0 : -1);
261 shipEff.repeat = (active ? 1 : 0);
264 events->
AddItem(shipEff.Encode());
266 event->SetItem(0, events);
305 _log(POS__TRACE,
"CustomsSE::Anchor() - TowerSE %s(%u) new position %.2f, %.2f, %.2f",
GetName(),
m_cData.
itemID, pos.
x, pos.
y, pos.
z);
318 std::vector<PyTuple*> updates;
322 updates.push_back(sbf.Encode());
326 updates.push_back(sbr.Encode());
330 m_destiny->
SendSpecialEffect(
m_cData.
itemID,
m_cData.
itemID,
m_self->
typeID(),0,0,
"effects.AnchorDrop",0,1,1,-1,0);
347 m_destiny->
SendSpecialEffect(
m_cData.
itemID,
m_cData.
itemID,
m_self->
typeID(),0,0,
"effects.AnchorLift",0,1,1,-1,0);
425 slim->
Dump(POS__SLIMITEM,
" ");
443 if (pClient ==
nullptr) {
444 sLog.Error(
"CustomsSE::Killed()",
"killer == IsDrone and pPlayer == nullptr");
449 killerID = killer->
GetID();
452 std::stringstream blob;
454 std::vector<InventoryItemRef> survivedItems;
455 std::map<uint32, InventoryItemRef> deadShipInventory;
456 deadShipInventory.clear();
458 if (!deadShipInventory.empty()) {
460 for (
auto cur : deadShipInventory) {
462 x = cur.second->quantity();
463 s = (cur.second->isSingleton() ? 1 : 0);
467 s = (bpRef->copy() ? 2 : s);
469 blob <<
"<i t=" << cur.second->typeID() <<
" f=" << cur.second->flag() <<
" s=" << s ;
478 survivedItems.push_back(cur.second);
480 blob <<
" d=" << d <<
" x=" <<
x <<
"/>";
521 if (pClient !=
nullptr) {
530 wreck_name +=
" Wreck";
533 if (wreckItemRef.get() ==
nullptr) {
534 sLog.Error(
"CustomsSE::Killed()",
"Creating Wreck Item Failed for %s of type %u", wreck_name.c_str(), 3962);
539 _log(PHYSICS__TRACE,
"Ship::Killed() - Ship %s(%u) Position: %.2f,%.2f,%.2f. Wreck %s(%u) Position: %.2f,%.2f,%.2f.", \
540 GetName(),
GetID(),
x(),
y(),
z(), wreckItemRef->name(), wreckItemRef->itemID(), wreckPosition.
x, wreckPosition.
y, wreckPosition.
z);
548 wreckEntity.
itemID = wreckItemRef->itemID();
550 wreckEntity.
ownerID = killerID;
551 wreckEntity.
typeID = 3962;
552 wreckEntity.
position = wreckPosition;
555 sLog.Error(
"CustomsSE::Killed()",
"Spawning Wreck Failed: typeID or typeName not supported: '%u'", 3962);
556 wreckItemRef->Delete();
563 for (
auto cur: survivedItems)
564 cur->Move(wreckItemRef->itemID(),
flagNone);
void Append(const T &value)
Appends a single value to buffer.
float orbitalHackerProgress
void GetEffectState(PyList &into)
CustomsSE(StructureItemRef sRef, PyServiceMgr &services, SystemManager *system, const FactionData &data)
uint32 finalCorporationID
void SendErrorMsg(const char *fmt,...)
bool GetCustomsData(EVEPOS::CustomsData &cData, EVEPOS::OrbitalData &oData)
#define _log(type, fmt,...)
float GetTaxRate(Client *pClient)
DestinyManager * m_destiny
void SaveCustomsData(EVEPOS::CustomsData &cData, EVEPOS::OrbitalData &oData)
bool SetFlag(EVEItemFlags flag, bool notify=false)
virtual PlanetSE * GetPlanetSE()
void UpdateCustomsData(EVEPOS::CustomsData &cData, EVEPOS::OrbitalData &oData)
const GPoint & position() const
void SendJettisonPacket() const
const std::string & customInfo() const
double Rad2Deg(double rad)
static void AddKill(uint32 sysID)
virtual Client * GetPilot()
Python floating point number.
int32 GetCharacterID() const
void SendDestinyUpdate(std::vector< PyTuple * > &updates, bool self_only=false) const
void UpdateSettings(int8 selectedHour, int8 standingValue, bool ally, bool standings, Call_TaxRateValuesDict &taxRateValues)
static void AddFactionKill(uint32 sysID)
const float GetSystemSecurityRating()
SystemEntity * GetPlanet(uint32 planetID)
static void SaveKillOrLoss(CharKillData &data)
CharacterRef GetChar() const
bool BuildDynamicEntity(const DBSystemDynamicEntity &entity, uint32 launcherID=0)
Advanced version of UserError that allows to send a full custom message.
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
const GPoint & GetPosition() const
void SetAnchor(Client *pClient, GPoint &pos)
EVEPOS::CustomsData m_cData
#define is_log_enabled(type)
#define sLog
Evaluates to a NewLog instance.
void VerifyAddItem(InventoryItemRef iRef)
void SendSpecialEffect(uint32 entityID, uint32 moduleID, uint32 moduleTypeID, uint32 targetID, uint32 chargeTypeID, std::string guid, bool isOffensive, bool start, bool isActive, int32 duration, uint32 repeat, int32 graphicInfo=0) const
bool IsEven(int64 number)
Generic class for buffers.
InventoryItemRef GetSelf()
PyRep * GetSettingsInfo()
void SetItem(size_t index, PyRep *object)
Stores Python object.
uint32 victimCorporationID
void SetAttribute(uint16 attrID, int num, bool notify=true)
std::map< uint8, float > taxRateValues
const char * GetName() const
void SendEffectUpdate(int16 effectID, bool active)
double finalSecurityStatus
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
void SetPosition(const GPoint &pt, bool update=false)
void SendSingleDestinyUpdate(PyTuple **up, bool self_only=false) const
void GetInventoryMap(std::map< uint32, InventoryItemRef > &invMap)
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
uint32 GetCorporationID()
const std::string & itemName() const
int main(int argc, char *argv[])
void DropLoot(WreckContainerRef wreckRef, uint32 groupID, uint32 owner)
EvilNumber GetAttribute(const uint16 attrID) const
void SendSingleDestinyEvent(PyTuple **ev, bool self_only=false) const
#define IsFaction(itemID)
void AwardSecurityStatus(InventoryItemRef iRef, Character *pChar)
const GPoint & GetPosition() const
#define IsAlliance(itemID)
virtual void Killed(Damage &fatal_blow)
Inventory * GetMyInventory()
InventoryItemRef weaponRef
virtual void EncodeDestiny(Buffer &into)
EVEPOS::OrbitalData m_oData
virtual PyDict * MakeSlimItem()
const char * itoa(int64 num)
Convers num to string.
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Reference-counting-based smart pointer.