37 _log(ITEM__TRACE,
"Created ShipItem for %s(%u).",
name(),
itemID());
48 return InventoryItem::Load<ShipItem>( shipID);
109 if (pClient ==
nullptr) {
167 if (
sConfig.server.CargoMassAdditive)
391 std::map< uint32, InventoryItemRef > invMap;
394 for (
auto cur : invMap)
395 mass += cur.second->type().mass() * cur.second->quantity();
470 if (iRef.
get() ==
nullptr)
476 if (
sConfig.server.CargoMassAdditive) {
488 if (iRef.
get() ==
nullptr)
493 codelog(SHIP__ERROR,
"ShipItem::AddItem() - flag = flagNone.");
494 if (
sConfig.debug.IsTestServer)
506 if (iRef.
get() ==
nullptr)
534 if (iRef.
get() ==
nullptr)
555 if (
sConfig.server.CargoMassAdditive) {
565 _log(MODULE__INFO,
"Added ModuleID %u to Online List", modID);
569 std::map<uint32, InventoryItemRef> invMap;
571 for (
auto cur : invMap )
573 iRefVec.push_back(cur.second);
603 if (cRef.
get() ==
nullptr)
610 _log(MODULE__TRACE,
"ShipItem::LoadCharge - Trying to load %s from %s to %s.", \
612 throw UserError (
"CantMoveChargesBetweenModules");
617 throw UserError (
"ModuleNoLongerPresentForCharges");
619 if (pMod->IsActive()) {
620 throw CustomError (
"You cannot load active modules.");
630 throw UserError (
"LoadingChargeSlotAlready")
665 std::vector<GenericModule*> modVec;
667 for (
auto cur : modVec) {
668 if (pos + 1 > chargeIDs.size())
671 if (cRef.
get() ==
nullptr) {
686 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod);
692 if (cRef.get() ==
nullptr)
695 int8 size(chargeIDs.size());
700 std::list<GenericModule*>::iterator itr2 = itr->second.begin();
701 while ((itr2 != itr->second.end()) and (pos <= size)) {
703 if (cRef.get() ==
nullptr){
725 if (pMod->IsActive())
726 throw UserError (
"CannotAccessChargeWhileInUse");
728 if (!pMod->IsLoaded())
729 throw CustomError (
"Your %s is not loaded.", pMod->GetSelf()->name());
757 throw UserError (
"NotEnoughLauncherSlots")
767 throw UserError (
"CannotFitRigWrongSize")
769 .AddTypeName (
"item", iRef->
typeID ())
780 throw UserError (
"NotEnoughUpgradeSlots")
788 throw UserError (
"NotEnoughUpgradeCapacity")
810 codelog(SHIP__ERROR,
"ShipItem::FindAvailableModuleSlot() - iRef %s has no bank effect.", iRef->
name());
821 throw CustomError (
"Those locations are not compatible.");
826 throw CustomError (
"Your %s is currently active. You must wait for the cycle to complete before it can be removed.", pMod->
GetSelf()->
name());
831 throw CustomError (
"Your %s is currently active. You must wait for the cycle to complete before it can be removed.", pMod->
GetSelf()->
name());
835 if (modItemRef1.
get() ==
nullptr) {
836 _log(MODULE__TRACE,
"ShipItem::MoveModuleSlot - modItemRef1 is null.");
837 throw CustomError (
"The module to move was not found.");
850 if (chargeItemRef2.
get() !=
nullptr)
858 if (chargeItemRef1.get() !=
nullptr)
883 if (fraction > 1.0) fraction = 1.0;
884 if (fraction < 0.0) fraction = 0.0;
890 if ((newCapacitorCharge - 0.5f) < 0)
891 newCapacitorCharge = 0;
893 _log(SHIP__MESSAGE,
"SetShipCapacitorLevel() to %.1f%%. new value is %.1f", fraction, newCapacitorCharge.
get_float());
899 if (fraction > 1.0) fraction = 1.0;
900 if (fraction < 0.0) fraction = 0.0;
906 if ((newShieldCharge - 0.2f) < 0)
909 _log(SHIP__MESSAGE,
"SetShipShield() to %.1f%%. new value is %.1f", fraction, newShieldCharge.
get_float());
915 fraction = 1 - fraction;
917 if (fraction > 1.0) fraction = 1.0;
918 if (fraction < 0.0) fraction = 0.0;
924 if ((newArmorDamage - 0.2f) < 0)
927 _log(SHIP__MESSAGE,
"SetShipArmor() to %.1f%%. new value is %.1f", fraction, newArmorDamage.
get_float());
933 fraction = 1 - fraction;
935 if (fraction > 1.0) fraction = 1.0;
936 if (fraction < 0.0) fraction = 0.0;
942 if ((newHullDamage - 0.2f) < 0)
945 _log(SHIP__MESSAGE,
"SetShipHull() to %.1f%%. new value is %.1f", fraction, newHullDamage.
get_float());
966 if (amount > cHull) {
969 if (amount >= cArmor) {
972 amount = cArmor - amount;
985 for (
auto cur : itemRefVec) {
990 if ((amount / cur->GetAttribute(
AttrHP)) > fraction) {
991 amount = cur->GetAttribute(
AttrHP) * fraction;
1068 if (iRef.
get() ==
nullptr)
1076 _log(MODULE__ERROR,
"ReplaceCharges() called by %s(%u). It still needs to be written.",
name(),
itemID());
1150 _log(SHIP__HEAT,
"ShipItem::ProcessHeat() Executed in %.3f us.",
GetTimeUSeconds() - start);
1182 std::string rack =
"";
1199 _log(SHIP__HEAT,
"GenerateHeat() - %s invalid rack sent (%u)",
name(), attrID);
1210 _log(SHIP__HEAT,
"%s generated %.2f heat points from the %s rack this tic. t = %.3f",
name(), heat, rack.c_str(), t);
1217 float t(1.0f + heat), newHeat(0.0f);
1218 std::string rack =
"";
1230 _log(SHIP__HEAT,
"DissipateHeat() - %s invalid rack sent (%u)",
name(), attrID);
1240 _log(SHIP__HEAT,
"%s dissipated %.2f heat points from the %s rack this tic. was %.1f, is %.1f, t = %.3f", \
1241 name(), newHeat, rack.c_str(), heat, (heat - newHeat), t);
1280 float curHeat(0.0f), damChance(0.0f);
1292 std::vector<uint32> modVec;
1307 for (
auto cur : modVec)
1319 std::vector<InventoryItemRef> moduleList;
1321 for (
auto cur : moduleList) {
1329 std::map<uint32, InventoryItemRef> invMap;
1331 for (
auto cur : invMap )
1344 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod);
1346 modules.push_back(pMod);
1347 for (
auto cur : itr->second)
1348 modules.push_back(cur);
1352 std::list<GenericModule*>::iterator itr2 = cur.second.begin(), end = cur.second.end();
1353 while (itr2 != end) {
1354 if ((*itr2) == pMod) {
1367 if (masterID == slaveID)
1378 if ((pMaster ==
nullptr) or (pSlave ==
nullptr))
1380 if (pMaster == pSlave)
1383 throw UserError (
"CantLinkAmmoInWeapon");
1385 throw UserError (
"CantLinkModuleActive");
1387 throw UserError (
"CantLinkModuleDamaged");
1389 throw UserError (
"CantLinkModuleLoading");
1391 throw UserError (
"CantLinkModuleNotOnline");
1393 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMaster);
1395 std::list<GenericModule*> slaves;
1396 slaves.push_back(pSlave);
1401 itr->second.push_back(pSlave);
1408 _log(MODULE__ERROR,
"MergeModuleGroups() called by %s(%u). It still needs to be written.",
name(),
itemID());
1413 _log(MODULE__ERROR,
"PeelAndLink() called by %s(%u). It still needs to be written.",
name(),
itemID());
1418 std::list< GenericModule* > weaponList;
1422 for (
auto cur : weaponList) {
1423 if (
sConfig.server.UnloadOnLinkAll)
1425 cur->SetLinked(
false);
1426 cur->SetLinkMaster(
false);
1433 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.begin();
1435 if (itr->second.empty()) {
1437 _log(MODULE__INFO,
"ShipItem::LinkAllWeapons() - %s(%s) has empty link list. Removing.", \
1438 itr->first->GetSelf()->name(),
sDataMgr.GetFlagName(itr->first->flag()));
1452 std::list< GenericModule*>::iterator itr = weaponList.begin();
1453 while (itr != weaponList.end()) {
1454 if ((*itr)->IsLoaded() or (*itr)->IsLoading()) {
1456 _log(MODULE__INFO,
"ShipItem::LinkWeaponLoop() - %s(%s-%u) IsLoaded. Skipping.", \
1457 (*itr)->GetSelf()->name(),
sDataMgr.GetFlagName((*itr)->flag()), (*itr)->itemID());
1458 m_pilot->
SendErrorMsg(
"You cannot group the %s while loaded with %s", (*itr)->GetSelf()->name(), (*itr)->GetLoadedChargeRef()->name());
1459 itr = weaponList.erase(itr);
1460 }
else if (master ==
nullptr) {
1464 if (
item.first->typeID() == (*itr)->typeID()) {
1467 _log(MODULE__INFO,
"ShipItem::LinkWeaponLoop() -(null master) %s(%s-%u) matches list master %s(%s-%u). Adding.", \
1468 (*itr)->GetSelf()->name(),
sDataMgr.GetFlagName((*itr)->flag()), (*itr)->itemID(),
\
1469 item.first->GetSelf()->name(),
sDataMgr.GetFlagName(
item.first->flag()),
item.first->itemID());
1471 itr = weaponList.erase(itr);
1480 _log(MODULE__INFO,
"ShipItem::LinkWeaponLoop() - Setting %s(%s-%u) to master.",\
1481 (*itr)->GetSelf()->name(),
sDataMgr.GetFlagName((*itr)->flag()), (*itr)->itemID());
1483 std::list<GenericModule*> slaves;
1484 m_linkedWeapons[master] = slaves;
1485 itr = weaponList.erase(itr);
1487 if (master->
typeID() == (*itr)->typeID()) {
1489 _log(MODULE__INFO,
"ShipItem::LinkWeaponLoop() - %s(%s-%u) matches master %s(%s-%u). Adding.", \
1490 (*itr)->GetSelf()->name(),
sDataMgr.GetFlagName((*itr)->flag()), (*itr)->itemID(), \
1493 itr = weaponList.erase(itr);
1496 if (
item.first->typeID() == (*itr)->typeID()) {
1499 _log(MODULE__INFO,
"ShipItem::LinkWeaponLoop() - %s(%s-%u) matches list master %s(%s-%u). Adding.", \
1500 (*itr)->GetSelf()->name(),
sDataMgr.GetFlagName((*itr)->flag()), (*itr)->itemID(),
\
1501 item.first->GetSelf()->name(),
sDataMgr.GetFlagName(
item.first->flag()),
item.first->itemID());
1503 itr = weaponList.erase(itr);
1511 _log(MODULE__INFO,
"ShipItem::LinkWeaponLoop() - Completed loop in %.3fus.",
GetTimeUSeconds() - start);
1525 if (pMod1 ==
nullptr)
1528 if (pMod1->IsActive()) {
1532 if (pMod1->IsLoading()) {
1533 m_pilot->
SendNotifyMsg(
"You cannot ungroup weapons while they are being loaded with charges.");
1536 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod1);
1543 uint32 slaveID(itr->second.front()->itemID());
1568 if (masterID == slaveID)
1572 if ((pMod1 ==
nullptr) or (pMod2 ==
nullptr))
1576 if (pMod1->IsActive())
1577 throw UserError (
"CantUngroupModuleActive");
1578 if (pMod1->IsLoading())
1579 throw UserError (
"CantUngroupModuleLoading");
1581 pMod2->SetLinked(
false);
1583 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod1);
1585 std::list<GenericModule*>::iterator itr2 = itr->second.begin();
1586 while (itr2 != itr->second.end()) {
1587 if ((*itr2) == pMod2) {
1588 itr2 = itr->second.erase(itr2);
1589 if (itr->second.empty()) {
1590 pMod1->SetLinked(
false);
1591 pMod1->SetLinkMaster(
false);
1605 if (pMod1 ==
nullptr)
1609 if (pMod1->IsActive())
1610 throw UserError (
"CantUngroupModuleActive");
1611 if (pMod1->IsLoading())
1612 throw UserError (
"CantUngroupModuleLoading");
1614 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod1);
1616 pMod1->SetLinked(
false);
1617 pMod1->SetLinkMaster(
false);
1618 std::list<GenericModule*>::iterator itr2 = itr->second.begin();
1619 while (itr2 != itr->second.end()) {
1620 (*itr2)->SetLinked(
false);
1621 itr2 = itr->second.erase(itr2);
1622 if (itr->second.empty()) {
1638 std::list<GenericModule*>::iterator itr2 = cur.second.begin();
1639 while (itr2 != cur.second.end()) {
1640 if ((*itr2) == pMod1) {
1653 std::list< GenericModule* > weaponList;
1655 for (
auto cur : weaponList) {
1656 if (cur->IsActive())
1657 throw UserError (
"CantUngroupModuleActive");
1658 if (cur->IsLoading())
1659 throw UserError (
"CantUngroupModuleLoading");
1661 cur->SetLinked(
false);
1662 cur->SetLinkMaster(
false);
1670 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod);
1673 return itr->second.size() + 1;
1679 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod);
1681 std::list<GenericModule*>::iterator itr2 = itr->second.begin(), end = itr->second.end();
1682 while (itr2 != end) {
1683 if ((*itr2)->IsLoaded())
1699 for (
auto slave : cur.second)
1701 result->
SetItem(
new PyInt(cur.first->itemID()), slaves);
1705 _log(MODULE__MESSAGE,
"GetLinkedWeapons()");
1706 result->
Dump(MODULE__MESSAGE,
" ");
1714 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMod);
1716 for (
auto cur : itr->second)
1721 std::list<GenericModule*>::iterator itr = cur.second.begin();
1722 while (itr != cur.second.end()) {
1723 if ((*itr) == pMod) {
1735 std::multimap< uint32, uint32 > data;
1739 for (
auto slave : cur.second)
1740 data.emplace(cur.first->itemID(), slave->itemID());
1750 m_pilot->
SendErrorMsg(
"There was an error loading your weapon groups. Ref: ServerError 06071");
1761 while (res->
GetRow(row)) {
1765 if ((pMaster ==
nullptr) or (pSlave ==
nullptr)) {
1770 std::map<GenericModule*, std::list<GenericModule*>>::iterator itr =
m_linkedWeapons.find(pMaster);
1772 std::list<GenericModule*> slaves;
1773 slaves.push_back(pSlave);
1776 itr->second.push_back(pSlave);
1786 m_pilot->
SendErrorMsg(
"There was an error loading a weapon group master. Ref: ServerError 06123");
1796 _log(EFFECTS__TRACE,
"ShipItem::ProcessEffects()");
1819 std::vector< InventoryItemRef > modVec;
1821 for (
auto cur : modVec)
1822 cur->ResetAttributes();
1823 std::map<EVEItemFlags, InventoryItemRef> charges;
1825 for (
auto cur : charges)
1826 cur.second->ResetAttributes();
1831 _log(EFFECTS__DEBUG,
"ShipItem::ProcessEffects() - effects processed and applied in %.3fms", (
GetTimeMSeconds() - start));
1836 _log(EFFECTS__TRACE,
"ShipItem::ProcessShipEffects()");
1837 for (
auto it :
type().m_stateFxMap) {
1841 sFxProc.ParseExpression(
this,
sFxDataMgr.GetExpression(it.second.preExpression), data);
1860 _log(EFFECTS__TRACE,
"ShipItem::ClearModuleModifiers()");
1862 std::vector< InventoryItemRef > modVec;
1864 for (
auto cur : modVec)
1865 cur->ClearModifiers();
1866 std::map<EVEItemFlags, InventoryItemRef> charges;
1868 for (
auto cur : charges)
1869 cur.second->ClearModifiers();
1873 _log(EFFECTS__TRACE,
"ShipItem::ResetEffects()");
1882 std::vector< InventoryItemRef > modVec;
1884 for (
auto cur : modVec)
1885 cur->ResetAttributes();
1886 std::map<EVEItemFlags, InventoryItemRef> charges;
1888 for (
auto cur : charges)
1889 cur.second->ResetAttributes();
1892 _log(EFFECTS__DEBUG,
"ShipItem::ResetEffects() - Effects reset in %.3fms", (
GetTimeMSeconds() - start));
1926 std::stringstream dna;
1928 _log(SHIP__MESSAGE,
"ShipDNA has compiled DNA of \"%s\" for %s(%u) ", dna.str().c_str(),
name(),
itemID());
1933 std::stringstream modHi, modMid, modLow, subSys, modRig, charges, drones;
1935 std::vector<InventoryItemRef> moduleList;
1939 for (
auto cur : moduleList) {
1941 modRig << cur->typeID() <<
";" << cur->quantity() <<
":";
1942 }
else if (
IsHiSlot(cur->flag())) {
1943 modHi << cur->typeID() <<
";" << cur->quantity() <<
":";
1945 modMid << cur->typeID() <<
";" << cur->quantity() <<
":";
1947 modLow << cur->typeID() <<
";" << cur->quantity() <<
":";
1949 subSys << cur->typeID() <<
":";
1955 std::map<EVEItemFlags, InventoryItemRef> chargeList;
1957 for (
auto cur : chargeList)
1958 charges << cur.second->typeID() <<
";" << cur.second->quantity() <<
":";
1964 std::stringstream dna;
1966 dna << subSys.str() << modHi.str() << modMid.str() << modLow.str() << modRig.str() << charges.str() << drones.str();
1968 _log(SHIP__MESSAGE,
"ShipDNA has compiled \"%s\" for %s(%u) ", dna.str().c_str(),
name(),
itemID());
1976 if (pClient ==
nullptr) {
1995 throw CustomError (
"The %s can only carry fighter drones in it's Drone Bay. The %s is not allowed.",
name(), iRef->
name());
2011 throw CustomError (
"Only indy ships may be placed into the Rorqual's ship hold.");
2014 throw CustomError (
"Only ships may be placed into the maintenance bay.");
2020 throw CustomError (
"Only fuel types may be stored in the fuel bay.");
2025 throw CustomError (
"Only mined ore may be stored in the ore hold.");
2030 throw CustomError (
"Only gas products may be stored in the gas hold.");
2035 throw CustomError (
"Only refined minerals may be placed into the mineral hold.");
2040 throw CustomError (
"Only salvaged materials may be placed into the salvage bay.");
2046 throw CustomError (
"Only ships may be placed into the ship hold.");
2053 throw CustomError (
"Only small ships may be placed into the ship's small ship hold.");
2058 throw CustomError (
"Only medium ships may be placed into the ship's medium ship hold.");
2063 throw CustomError (
"Only large ships may be placed into the ship's large ship hold.");
2074 throw CustomError (
"Only indy ships may be placed into the ship's industrial ship hold.");
2089 throw CustomError (
"Only ammunition and crystals may be placed into the ammo bay.");
2109 throw CustomError (
"%s cannot be fitted onto a ship. Only hardware modules may be fitted.", iRef->
name());
2114 throw CustomError (
"You do not have the required skills to fit this %s. Ref: ServerError 25163.", iRef->
name());
2117 throw CustomError (
"Your ship cannot equip the %s.<br>The group '%s' is not allowed on your %s.", \
2122 if (pMod !=
nullptr) {
2126 sLog.Error(
"ShipItem::VerifyHoldType",
"Charge size %u for %s does not match Module size %u for %s.",\
2128 pMod->GetAttribute(
AttrChargeSize).get_uint32(), pMod->GetSelf()->name());
2129 throw CustomError (
"Incorrect charge size for this module.");
2136 throw CustomError (
"Incorrect charge type for this module.");
2140 throw CustomError (
"There is no module in %s. Ref: ServerError 25162.",
sDataMgr.GetFlagName(flag));
2144 sLog.Error(
"ShipItem::VerifyHoldType",
"testing %s to add %u %s of cat %s has reached the end.",
2146 throw CustomError (
"Internal Server Error. Ref: ServerError 25162.");
2156 _log( INV__ERROR,
"%s(%u): Failed to load contents for ShipGetInfo",
name(),
itemID());
2161 Rsp_CommonGetInfo_Entry entry;
2169 std::vector<InventoryItemRef> equipped;
2174 for (
auto cur : equipped) {
2175 Rsp_CommonGetInfo_Entry entry2;
2176 if (cur->Populate(entry2)) {
2187 _log( SHIP__ERROR,
"%s(%u): Failed to Populate() %s(%u) for ShipGetInfo", \
2188 name(),
itemID(), cur->name(), cur->itemID());
2193 _log(SHIP__INFO,
"ShipItem::GetShipInfo() decoded:");
2194 result->
Dump(SHIP__INFO,
" ");
2202 _log(INV__ERROR,
"%s(%u): Failed to load contents for GetShipState",
name(),
itemID());
2216 std::vector<InventoryItemRef> moduleList;
2218 for (
auto cur : moduleList)
2219 result->
SetItem(
new PyInt(cur->itemID()), cur->GetItemStatusRow());
2227 _log(INV__ERROR,
"%s(%u): Failed to load contents for GetShipState",
name(),
itemID());
2233 std::map< EVEItemFlags, InventoryItemRef > charges;
2237 if (charges.empty())
2241 for (
auto cur : charges)
2249 _log(INV__ERROR,
"%s(%u): Failed to load contents for ShipGetModuleList",
name(),
itemID());
2255 std::vector<InventoryItemRef> moduleList;
2257 for (
auto cur : moduleList) {
2268 bool result =
false;
2322 _log(SHIP__TRACE,
"ShipItem::ValidateItemSpecifics - Beginning the group validation for %s(%u):", iRef->
name(), iRef->
itemID());
2324 if (fitID == groupID)
2327 if (fitID == groupID)
2330 if (fitID == groupID)
2333 if (fitID == groupID)
2336 if (fitID == groupID)
2339 if (fitID == groupID)
2342 if (fitID == groupID)
2345 if (fitID == groupID)
2358 _log(SHIP__TRACE,
"ShipItem::ValidateItemSpecifics - Group Validation returning %s.", (result ?
"true" :
"false"));
2361 _log(SHIP__TRACE,
"ShipItem::ValidateItemSpecifics - Beginning the type validation for %s(%u):", iRef->
name(), iRef->
itemID());
2366 if (fitID == typeID)
2369 if (fitID == typeID)
2372 if (fitID == typeID)
2375 if (fitID == typeID)
2382 _log(SHIP__TRACE,
"ShipItem::ValidateItemSpecifics - Type Validation returning %s.", (result ?
"true" :
"false"));
2399 m_oldTargetRange(0),
2402 m_allowFleetSMBUsage(false)
2413 _log(SHIP__TRACE,
"Created ShipSE %p for item %u",
this, self->itemID());
2423 RechargeTimeMS = (RechargeTimeMS < 1 ? 1 : RechargeTimeMS);
2424 Current = (Current < 1 ? 1 : Current);
2425 float Cmax = (Capacity < 1 ? 1 : Capacity);
2428 float tau = (RechargeTimeMS / 5000.0);
2430 float Cmax2_tau = ((Cmax * 2) / tau);
2433 float C_Cmax = (C / Cmax);
2435 float sC_Cmax = sqrt(C_Cmax);
2437 return (Cmax2_tau * (sC_Cmax - C_Cmax));
2457 if (Charge < Capacity) {
2459 if (newCharge > Capacity) {
2460 newCharge = Capacity;
2461 }
else if ((Capacity - newCharge) < 0.3) {
2462 newCharge = Capacity;
2472 if (Charge < Capacity) {
2474 if (newCharge > Capacity) {
2475 newCharge = Capacity;
2476 }
else if ((Capacity - newCharge) < 0.3) {
2477 newCharge = Capacity;
2483 if (
sConfig.debug.UseProfiling)
2505 std::string reason =
"Insurance payment for loss of the ship ";
2519 if (pClient ==
nullptr) {
2661 std::string modeStr =
"Goto";
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;
2677 _log(SE__DESTINY,
"ShipSE::EncodeDestiny(): %s - id:%li, mode:%s, flags:0x%X, Vel:%.1f, %.1f, %.1f", \
2711 std::vector<InventoryItemRef>
items;
2714 if (!items.empty()) {
2716 for (
auto cur : items)
2719 slim->SetItemString(
"modules", list );
2723 _log( DESTINY__DEBUG,
"ShipSE::MakeSlimItem() - %s(%u)",
GetName(),
GetID());
2724 slim->Dump(DESTINY__DEBUG,
" ");
2794 sLog.Magenta(
"ShipSE::LaunchDrone()",
"%s: Launching drone %u", pChar->
name(), dRef->
itemID());
void Append(const T &value)
Appends a single value to buffer.
float GetRemainingCapacity(EVEItemFlags flag) const
#define sConfig
A macro for easier access to the singleton.
bool ContentsLoaded() const
virtual DroneSE * GetDroneSE()
SystemEntity * GetSE(uint32 entityID) const
bool ValidateItemSpecifics(InventoryItemRef iRef)
void CheckSlotFitLimited(EVEItemFlags flag)
static ShipItemRef Spawn(ItemData &data)
double GetFollowDistance()
void Online(ShipSE *pShipSE=nullptr)
void HeatDamageCheck(GenericModule *pMod)
void SendErrorMsg(const char *fmt,...)
void DamageModule(uint32 modID, float amt=1)
#define _log(type, fmt,...)
InventoryItemRef GetLoadedChargeOnModule(EVEItemFlags flag)
DestinyManager * m_destiny
void ScoopDrone(SystemEntity *pSE)
int32 GetInt(uint32 index) const
void GetModuleItemVec(std::vector< InventoryItemRef > &iRefVec)
float GetSecurityRating() const
void ClearAllTargets(bool notify=true)
void ClearTarget(SystemEntity *tSE)
void Online(uint32 modID)
virtual void AddItem(InventoryItemRef iRef)
bool HasAttribute(const uint16 attrID) const
bool SetFlag(EVEItemFlags flag, bool notify=false)
virtual void RemoveItem(InventoryItemRef iRef)
virtual void AddItem(InventoryItemRef iRef)
ModuleManager * GetModuleManager()
static bool FitModuleSkillCheck(InventoryItemRef item, CharacterRef ch)
void UnfitModule(uint32 itemID)
uint8 GetLoadedLinkedCount(GenericModule *pMod)
void VerifyHoldType(EVEItemFlags flag, InventoryItemRef iRef, Client *pClient=nullptr)
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
void QueueDestinyEvent(PyTuple **multiEvent)
UserError & AddTypeName(const char *name, uint32 typeID)
Shorthand method for adding a type's name.
void UnloadModule(uint32 itemID)
uint32 UnlinkWeapon(uint32 moduleID)
Python floating point number.
const GVector & GetVelocity() const
int32 GetCharacterID() const
std::vector< uint32 > m_onlineModuleVec
int32 GetCorporationID() const
PyServiceMgr & m_services
bool HasEffect(uint16 effectID) const
bool ValidateBoardShip(CharacterRef who)
void CheckGroupFitLimited(EVEItemFlags flag, InventoryItemRef iRef)
void RemoveItem(InventoryItemRef iRef)
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
void SetPosition(const GPoint &pos)
this is a class that kinda mimics how python polymorph's numbers.
PyPackedRow * GetItemStatusRow() const
void LoadLinkedWeapons(GenericModule *pMod, std::vector< int32 > &chargeIDs)
void SendNotifyMsg(const char *fmt,...)
CharacterRef GetChar() const
void GetLoadedCharges(std::map< EVEItemFlags, InventoryItemRef > &charges)
void UpdateDrones(std::map< int16, int8 > &attribs)
Advanced version of UserError that allows to send a full custom message.
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
static const uint16 SHIP_PROCESS_TICK_MS
int32 GetAllianceID() const
const GPoint & GetPosition() const
void UninstallRig(uint32 itemID)
void Move(uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
void GetModulesInBank(EVEItemFlags flag, std::vector< GenericModule * > &modVec)
static void SaveWeaponGroups(uint32 shipID, std::multimap< uint32, uint32 > &data)
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
void GetWeapons(std::list< GenericModule * > &weaponList)
bool GetRow(DBResultRow &into)
ModuleManager * m_ModuleManager
TargetManager * m_targMgr
const ItemType & type() const
#define is_log_enabled(type)
#define sLog
Evaluates to a NewLog instance.
std::map< GenericModule *, std::list< GenericModule * > > m_linkedWeapons
void GetModuleListOfRefsAsc(std::vector< InventoryItemRef > &modVec)
double GetPackagedVolume()
PyRep * GetLinkedWeapons()
Generic class for buffers.
GenericModule * GetModule(EVEItemFlags flag)
static ShipItemRef Load(uint32 shipID)
void SetShipHull(float fraction)
InventoryItemRef GetSelf()
ShipItem(uint32 shipID, const ItemType &type, const ItemData &data)
void UpdateModules(std::vector< uint32 > modVec)
bool VerifySlotExchange(EVEItemFlags slot1, EVEItemFlags slot2)
PyTuple * new_tuple(int64 arg1)
void ProcessEffects(bool add=false, bool update=false)
PyTuple * MakeDamageState()
bool InstallRig(ModuleItemRef mRef, EVEItemFlags flag)
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
void OfflineGroup(GenericModule *pMod)
static void LoadWeaponGroups(uint32 shipID, DBQueryResult &res)
void PeelAndLink(uint32 masterID, uint32 slaveID)
void ReplaceCharges(EVEItemFlags flag, InventoryItemRef newCharge)
float CalculateRechargeRate(float Capacity, float RechargeTimeMS, float Current)
void SetShipCapacitorLevel(float fraction)
float DissipateHeat(uint16 attrID, float heat)
#define IsValidTarget(itemID)
static void DeleteInsuranceByShipID(uint32 shipID)
bool InstallSubSystem(ModuleItemRef mRef, EVEItemFlags flag)
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)
uint32 locationID() const
virtual Client * GetPilot()
void LoadChargesToBank(EVEItemFlags flag, std::vector< int32 > &chargeIDs)
void DeactivateAllModules()
void Activate(int32 itemID, uint16 effectID, int32 targetID, int32 repeat)
void RepairShip(float fraction)
void SetAttribute(uint16 attrID, int num, bool notify=true)
bool Check(bool reset=true)
#define IsFittingSlot(flag)
void Activate(int32 itemID, std::string effectName, int32 targetID, int32 repeat)
const char * GetName() const
float GetShipInsurancePayout(uint32 shipID)
const char * GetName() const
const std::string & name() const
void GetLinkedWeaponMods(EVEItemFlags flag, std::vector< GenericModule * > &modules)
bool Populate(Rsp_CommonGetInfo_Entry &into)
void ProcessEffects(ShipItem *pShip)
void Jump(bool showCloak=true)
int32 warFactionID() const
float GenerateHeat(uint16 attrID)
Python object "ccp_exceptions.UserError".
void LinkWeaponLoop(std::list< GenericModule * > &moduleVec)
#define IsSubSystem(flag)
void AddModuleToOnlineVec(uint32 modID)
bool ChangeSingleton(bool singleton, bool notify=false)
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
uint32 corporationID() const
void RemoveTarget(SystemEntity *pSE)
EVEItemFlags flag() const
InventoryItemRef GetModuleRef(EVEItemFlags flag)
std::map< uint32, InventoryItem * > m_drones
void ApplyBoost(BoostData &bData)
void UnloadCharge(GenericModule *pMod)
void TryModuleLimitChecks(EVEItemFlags flag, InventoryItemRef iRef)
void GetInventoryMap(std::map< uint32, InventoryItemRef > &invMap)
void Launch(ShipSE *pShipSE)
void RemoveTarget(SystemEntity *pSE)
RefPtr< InventoryItem > InventoryItemRef
bool HasSkillTrainedToLevel(uint16 skillTypeID, uint8 skillLevel) const
void CharacterLeavingShip()
bool LaunchDrone(InventoryItemRef dRef)
void ProcessShipEffects(bool update=false)
RefPtr< ShipItem > ShipItemRef
uint16 GetAvailableSlotInBank(EVEEffectID slotBank)
#define IsModuleSlot(flag)
GenericModule * GetModule(EVEItemFlags flag)
virtual void EncodeDestiny(Buffer &into)
ShipSE(InventoryItemRef self, PyServiceMgr &services, SystemManager *pSystem, const FactionData &data)
const std::string & itemName() const
#define IsCargoHoldFlag(flag)
void UpdateShipVariables()
int main(int argc, char *argv[])
void ResetShipSystemMgr(SystemManager *pSystem)
void SetShipArmor(float fraction)
virtual Client * GetPilot()
void SendDamageStateChanged()
void Offline(uint32 itemID)
static uint32 CreateItemID(ItemData &data)
EvilNumber GetAttribute(const uint16 attrID) const
void LoadCharge(InventoryItemRef chargeRef, EVEItemFlags flag)
virtual void SetPlayer(Client *pClient)
virtual void SetPlayer(Client *pClient)
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
virtual void RemoveItem(InventoryItemRef iRef)
#define IsFaction(itemID)
void DamageGroup(GenericModule *pMod)
virtual void SetPilot(Client *pClient)
void RepairModule(uint32 itemID, EvilNumber amount)
bool AddModule(ModuleItemRef mRef, EVEItemFlags flag)
void DamageRandModule(float chance)
void Online(uint32 itemID)
#define IsHangarFlag(flag)
PyDict * GetChargeState()
static uint32 CreateItemID(ItemData &data)
void RemoveCharge(EVEItemFlags fromFlag)
void ClearModuleModifiers()
uint32 AddItemByFlag(EVEItemFlags flag, InventoryItemRef iRef, Client *pClient=nullptr)
EVEItemFlags FindAvailableModuleSlot(InventoryItemRef iRef)
void GetActiveModulesHeat(uint8 rack, float &heat)
#define IsAlliance(itemID)
float GetRemainingVolumeByFlag(EVEItemFlags flag) const
void Offline(uint32 modID)
void SetLinkMaster(bool set=false)
AttributeMap * pAttributeMap
void GetModuleRefVec(std::vector< InventoryItemRef > &iRefVec)
void MakeRandomPointOnSphere(double radius)
void SetShipShield(float fraction)
void GetItemStatusRow(PyPackedRow *into) const
void MergeModuleGroups(uint32 masterID, uint32 slaveID)
bool IsSlotOccupied(EVEItemFlags flag)
Inventory * GetMyInventory()
void SetLinked(bool set=false)
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
virtual PyDict * MakeSlimItem()
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
uint32 GetItemsByFlagRange(EVEItemFlags low_flag, EVEItemFlags high_flag, std::vector< InventoryItemRef > &items) const
PyList * ShipGetModuleList()
void LoadCharge(InventoryItemRef cRef, EVEItemFlags flag)
InventoryItemRef m_targetRef
const uint32 m_processTimerTick
static void ClearWeaponGroups(uint32 shipID)
void MoveModuleSlot(EVEItemFlags slot1, EVEItemFlags slot2)
virtual Client * GetPilot()
bool GetSingleItemByFlag(EVEItemFlags flag, InventoryItemRef &iRef) const
void UnlinkGroup(uint32 memberID, bool update=false)
void Jump(bool showCloak=true)
void LinkWeapon(uint32 masterID, uint32 slaveID)
void RemoveRig(InventoryItemRef iRef)
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
uint8 GetLinkedCount(GenericModule *pMod)
static const float BUBBLE_RADIUS_METERS