49 _log(ITEM__TRACE,
"Created StructureItem for %s (%u).",
name(),
itemID());
50 _log(POS__TRACE,
"Created StructureItem for %s (%u).",
name(),
itemID());
60 return InventoryItem::Load<StructureItem>(structureID);
83 sRef->SetAttribute(
AttrMass, sRef->type().mass(),
false);
84 sRef->SetAttribute(
AttrRadius, sRef->type().radius(),
false);
85 sRef->SetAttribute(
AttrVolume, sRef->type().volume(),
false);
86 sRef->SetAttribute(
AttrCapacity, sRef->type().capacity(),
false);
146 Rsp_CommonGetInfo result;
147 Rsp_CommonGetInfo_Entry entry;
153 result.items[
m_itemID] = entry.Encode();
155 return result.Encode();
160 if (iRef.
get() ==
nullptr)
173 if (iRef.
get() ==
nullptr)
188 throw UserError (
"SetNameObjectMustBeAnchoredInSpace");
222 m_data(
EVEPOS::StructureData())
232 structure->SetMySE(
this);
237 _log(SE__DEBUG,
"Created StructureSE for item %s (%u).", structure->name(), structure->itemID());
286 sLog.Error(
"StructureSE::Init",
"ItemID is 0.");
297 sLog.Error(
"StructureSE::Init",
"groupID is Orbital_Infrastructure.");
370 _log(POS__WARNING,
"StructureSE::Init %s(%u) - Cannot find SE for anchorpointID %u. Load Failure.", \
477 m_destiny->
SendSpecialEffect(
m_data.
itemID,
m_data.
itemID,
m_self->
typeID(), 0, 0,
"effects.AnchorLift", 0, 0, 0, -1, 0);
484 m_destiny->
SendSpecialEffect(
m_data.
itemID,
m_data.
itemID,
m_self->
typeID(), 0, 0,
"effects.AnchorDrop", 0, 0, 0, -1, 0);
629 pClient->
SendErrorMsg(
"This module requires %s to be installed in the Infrastructure Hub.",
635 pClient->
SendErrorMsg(
"This module cannot be anchored as the system is currently being jammed.");
640 pClient->
SendErrorMsg(
"This module cannot be anchored as the system currently has an active beacon.");
656 pos.
x += radius + dist * std::sin(rad);
657 pos.
z += radius + dist * std::cos(rad);
662 _log(POS__TRACE,
"StructureSE::Anchor() - TowerSE %s(%u) new position %.2f, %.2f, %.2f at %s",
672 if (distance > anchorMax) {
673 pClient->
SendErrorMsg(
"You cannot anchor the %s farther than %u meters from a stargate.", \
678 if (distance < 1000) {
679 pClient->
SendErrorMsg(
"You cannot anchor the %s closer than %u meters from a stargate.", \
688 _log(POS__TRACE,
"StructureSE::Anchor() - SBUSE %s(%u) is anchoring %u m from %s",
701 pClient->
SendErrorMsg(
"There is no tower anchored at this moon. You cannot anchor any structure without a tower");
721 std::vector<PyTuple *> updates;
725 updates.push_back(sbf.Encode());
729 updates.push_back(sbr.Encode());
731 m_destiny->
SendSpecialEffect(
m_data.
itemID,
m_data.
itemID,
m_self->
typeID(), 0, 0,
"effects.AnchorDrop", 0, 1, 1, -1, 0);
762 m_destiny->
SendSpecialEffect(
m_data.
itemID,
m_data.
itemID,
m_self->
typeID(), 0, 0,
"effects.AnchorLift", 0, 1, 1, -1, 0);
804 .AddAmount (
"remaining", remaining)
815 .AddAmount (
"remaining", remaining)
847 m_destiny->
SendSpecialEffect(
m_data.
itemID,
m_data.
itemID,
m_self->
typeID(), 0, 0,
"effects.StructureOnline", 0, 1, 1, -1, 0);
878 m_destiny->
SendSpecialEffect(
m_data.
itemID,
m_data.
itemID,
m_self->
typeID(), 0, 0,
"effects.StructureOnline", 0, 1, 1, -1, 0);
998 ge.effectID = effectID;
999 Notify_OnGodmaShipEffect shipEff;
1000 shipEff.itemID = ge.selfID;
1001 shipEff.effectID = effectID;
1003 shipEff.start = (active ? 1 : 0);
1004 shipEff.active = (active ? 1 : 0);
1005 shipEff.environment = ge.Encode();
1006 shipEff.startTime = shipEff.timeNow;
1007 shipEff.duration = (active ? 0 : -1);
1008 shipEff.repeat = (active ? 1 : 0);
1009 shipEff.error =
PyStatic.NewNone();
1011 events->
AddItem(shipEff.Encode());
1013 event->SetItem(0, events);
1161 slim->
Dump(POS__SLIMITEM,
" ");
1188 OnSpecialFX13 effect;
1199 effect.duration = -1;
1200 effect.guid =
"effects.StructureOnline";
1201 effect.isOffensive =
false;
1205 into.
AddItem(effect.Encode());
1217 Client *pClient(
nullptr);
1228 if (pClient ==
nullptr)
1230 sLog.Error(
"StructureSE::Killed()",
"killer == IsDrone and pPlayer == nullptr");
1239 killerID = killer->
GetID();
1242 std::stringstream blob;
1244 std::vector<InventoryItemRef> survivedItems;
1245 std::map<uint32, InventoryItemRef> deadShipInventory;
1246 deadShipInventory.clear();
1248 if (!deadShipInventory.empty())
1251 for (
auto cur : deadShipInventory)
1254 x = cur.second->quantity();
1255 s = (cur.second->isSingleton() ? 1 : 0);
1260 s = (bpRef->copy() ? 2 : s);
1262 blob <<
"<i t=" << cur.second->typeID() <<
" f=" << cur.second->flag() <<
" s=" << s;
1273 survivedItems.push_back(cur.second);
1275 blob <<
" d=" << d <<
" x=" <<
x <<
"/>";
1305 data.
killBlob = blob.str().c_str();
1316 if (pClient !=
nullptr)
1325 if (wreckPosition.
isNaN())
1327 sLog.Error(
"StructureSE::Killed()",
"Wreck Position is NaN");
1335 wreckTypeID = 26557;
1339 wreck_name +=
" Wreck";
1342 if (wreckItemRef.get() ==
nullptr)
1344 sLog.Error(
"StructureSE::Killed()",
"Creating Wreck Item Failed for %s of type %u", wreck_name.c_str(), wreckTypeID);
1349 _log(PHYSICS__TRACE,
"StructureSE::Killed() - Structure %s(%u) Position: %.2f,%.2f,%.2f. Wreck %s(%u) Position: %.2f,%.2f,%.2f.",
1350 GetName(),
GetID(),
x(),
y(),
z(), wreckItemRef->name(), wreckItemRef->itemID(), wreckPosition.
x, wreckPosition.
y, wreckPosition.
z);
1358 wreckEntity.
itemID = wreckItemRef->itemID();
1360 wreckEntity.
ownerID = killerID;
1361 wreckEntity.
typeID = wreckTypeID;
1362 wreckEntity.
position = wreckPosition;
1366 sLog.Error(
"StructureSE::Killed()",
"Spawning Wreck Failed: typeID or typeName not supported: '%u'", wreckTypeID);
1367 wreckItemRef->Delete();
1374 for (
auto cur : survivedItems)
1375 cur->Move(wreckItemRef->itemID(),
flagNone);
void Append(const T &value)
Appends a single value to buffer.
SystemEntity * GetSE(uint32 entityID) const
uint32 GetLocationID() const
uint32 finalCorporationID
static StructureItemRef Load(uint32 structureID)
void SendErrorMsg(const char *fmt,...)
void SetTimer(uint32 time)
#define _log(type, fmt,...)
#define IsWreckTypeID(typeID)
DestinyManager * m_destiny
virtual MoonSE * GetMoonSE()
void Drop(SystemBubble *pBubble)
virtual void SetInvulnerable()
void SetTimer(uint32 setTimerTime=0)
bool SetFlag(EVEItemFlags flag, bool notify=false)
void UpdateBaseData(EVEPOS::StructureData &data)
virtual void RemoveItem(InventoryItemRef iRef)
virtual void SetOperating()
virtual void AddItem(InventoryItemRef iRef)
const GPoint & position() const
void SendJettisonPacket() const
PyObject * StructureGetInfo()
GaExpInl bool isNaN() const
static void AddKill(uint32 sysID)
virtual Client * GetPilot()
Python floating point number.
SystemEntity * GetClosestGateSE(const GPoint &myPos)
int32 GetCharacterID() const
virtual CustomsSE * GetCOSE()
void SendDestinyUpdate(std::vector< PyTuple * > &updates, bool self_only=false) const
StructureSE(StructureItemRef structure, PyServiceMgr &services, SystemManager *system, const FactionData &data)
static void AddFactionKill(uint32 sysID)
const float GetSystemSecurityRating()
static void SaveKillOrLoss(CharKillData &data)
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
void GetEffectState(PyList &into)
CharacterRef GetChar() const
bool BuildDynamicEntity(const DBSystemDynamicEntity &entity, uint32 launcherID=0)
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
const GPoint & GetPosition() const
bool HasCPU(float amount)
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
GaExpInl GaFloat normalize()
void OfflineModule(StructureSE *pSE)
const ItemType & type() const
#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
UserError & AddAmount(const char *name, int quantity)
Shorthand method for adding a quantity value.
bool IsEven(int64 number)
void Deactivate(int32 effectID)
Generic class for buffers.
void SaveBaseData(EVEPOS::StructureData &data)
InventoryItemRef GetSelf()
void SaveBridgeData(EVEPOS::JumpBridgeData &data)
double Deg2Rad(double deg)
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
virtual void Killed(Damage &fatal_blow)
static const GPoint NULL_ORIGIN(0, 0, 0)
void RemoveEntity(SystemEntity *pSE)
uint32 victimCorporationID
void Activate(int32 effectID)
uint32 locationID() const
virtual void Rename(std::string name)
bool Check(bool reset=true)
JumpBridgeSE * m_bridgeSE
void SetUsageFlags(int8 view=0, int8 take=0, int8 use=0)
const char * GetName() const
virtual SBUSE * GetSBUSE()
EVEPOS::StructureData m_data
bool Populate(Rsp_CommonGetInfo_Entry &into)
void SendEffectUpdate(int16 effectID, bool active)
Python object "ccp_exceptions.UserError".
void SetAnchor(Client *pClient, GPoint &pos)
SystemEntity * GetClosestMoonSE(const GPoint &myPos)
void DeleteData(uint32 itemID)
bool ChangeSingleton(bool singleton, bool notify=false)
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)
virtual StructureSE * GetPOSSE()
virtual PyDict * MakeSlimItem()
virtual JumpBridgeSE * GetJumpBridgeSE()
void SendSingleDestinyUpdate(PyTuple **up, bool self_only=false) const
virtual void SetOffline()
void GetInventoryMap(std::map< uint32, InventoryItemRef > &invMap)
RefPtr< InventoryItem > InventoryItemRef
virtual void EncodeDestiny(Buffer &into)
void SetSBU(StructureSE *pSE)
virtual TowerSE * GetTowerSE()
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 SetTowerSE(TowerSE *pTower)
static uint32 CreateItemID(ItemData &data)
void DropLoot(WreckContainerRef wreckRef, uint32 groupID, uint32 owner)
EvilNumber GetAttribute(const uint16 attrID) const
RefPtr< StructureItem > StructureItemRef
void SendSingleDestinyEvent(PyTuple **ev, bool self_only=false) const
#define IsStaticMapItem(itemID)
#define IsFaction(itemID)
void AwardSecurityStatus(InventoryItemRef iRef, Character *pChar)
virtual void Rename(std::string name)
void SetTower(StructureSE *pSE)
virtual void RemoveItem(InventoryItemRef iRef)
const GPoint & GetPosition() const
bool GetBaseData(EVEPOS::StructureData &data)
void AddModule(StructureSE *pSE)
virtual void SetVulnerable()
void OnlineModule(StructureSE *pSE)
virtual StargateSE * GetGateSE()
#define IsAlliance(itemID)
StructureItem(uint32 _structureID, const ItemType &_itemType, const ItemData &_data)
GaExpInl GaFloat distance(const GaVec3 &oth) const
virtual TCUSE * GetTCUSE()
virtual IHubSE * GetIHubSE()
Inventory * GetMyInventory()
InventoryItemRef weaponRef
static StructureItemRef Spawn(ItemData &data)
bool ContainsTypeQty(uint16 typeID, uint32 qty=0) const
const char * itoa(int64 num)
Convers num to string.
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
virtual void AddItem(InventoryItemRef iRef)
Reference-counting-based smart pointer.