178 if (pDestiny ==
nullptr) {
189 if (pSystem ==
nullptr) {
193 Call_FollowBall
args;
194 if (!args.Decode(&call.
tuple)) {
195 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
200 if (pSE ==
nullptr) {
201 _log(CLIENT__ERROR,
"%s: Unable to find entity %u to Follow/Approach.", call.
client->
GetName(), args.ballID);
215 if (pDestiny ==
nullptr) {
226 Call_SingleRealArg arg;
227 if (!arg.Decode(&call.
tuple)) {
228 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
233 if ((arg.arg != 0) && (arg.arg < 0.1))
251 if (pDestiny ==
nullptr) {
262 if (pSystem ==
nullptr) {
268 if (!arg.Decode(&call.
tuple)) {
269 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
274 if (pEntity ==
nullptr) {
275 _log(CLIENT__ERROR,
"%s: Unable to find entity %u to AlignTo.", call.
client->
GetName(), arg.entityID);
292 if (pDestiny ==
nullptr) {
304 if (!arg.Decode(&call.
tuple)) {
305 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
323 if (pDestiny ==
nullptr) {
334 Call_SingleIntegerArg arg;
335 if (!arg.Decode(&call.
tuple)) {
336 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
340 double x(0.0),
y(0.0), z(0.0);
346 if (pBMSvc ==
nullptr) {
347 sLog.Error(
"BeyonceService::Handle_GotoBookmark()",
"Attempt to access BookmarkService via (BookmarkService*)(call.client->services().LookupService(\"bookmark\")) returned NULL." );
363 if (pSE ==
nullptr) {
364 sLog.Error(
"BeyonceService::Handle_GotoBookmark()",
"%s: unable to find location %d", call.
client->
GetName(),
itemID );
383 if (pDestiny ==
nullptr) {
395 if (pSystem ==
nullptr) {
400 call.
Dump(SERVICE__CALL_DUMP);
402 if (!args.Decode(&call.
tuple)) {
403 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
409 ? args.range->AsInt()->value()
410 : args.range->AsFloat()->value();
413 if (pEntity ==
nullptr) {
414 _log(CLIENT__ERROR,
"%s: Unable to find entity %u to Orbit.", call.
client->
GetName(), args.entityID);
421 pDestiny->
Orbit(pEntity, range);
430 _log(SERVICE__CALL_DUMP,
"BeyonceBound::Handle_CmdWarpToStuff() - size %u", call.
tuple->
size() );
431 call.
Dump(SERVICE__CALL_DUMP);
439 if (pDestiny ==
nullptr) {
452 if (pSystem ==
nullptr) {
459 if (!(call.
byname.find(
"fleet")->second->IsNone()))
460 fleet = call.
byname.find(
"fleet")->second->AsBool()->value();
471 std::string stringArg =
"";
481 if (type ==
"item" ) {
482 pSE = pSystem->
GetSE(toID);
483 if (pSE ==
nullptr) {
487 }
else if (type ==
"bookmark" ) {
488 double x(0.0),
y(0.0), z(0.0);
494 if (bkSrvc ==
nullptr) {
495 sLog.Error(
"BeyonceService::Handle_WarpToStuff()",
"Attempt to access BookmarkService returned NULL." );
510 pSE = pSystem->
GetSE( toID );
511 if (pSE ==
nullptr) {
516 }
else if (type ==
"scan") {
518 pSE = pSystem->
GetSE(anomID);
519 }
else if (type ==
"launch") {
521 pSE = pSystem->
GetSE(toID);
526 else if (type ==
"epinstance") {
531 }
else if (type ==
"tutorial") {
535 }
else if (type ==
"char") {
542 sLog.Error(
"BeyonceService::Handle_WarpToStuff()",
"Unexpected type value: '%s'.", type.c_str() );
591 if (pSE !=
nullptr) {
598 double j = (((rand / RAND_MAX) - 1.0f) / 3.0f);
599 double s = 20 * std::pow(0.025f * (10 * std::log10(radius / 1000000) - 39), 20) + 0.5f;
601 double t = std::asin((warpToPoint.x / std::fabs(warpToPoint.x)) * (warpToPoint.z / std::sqrt(std::pow(warpToPoint.x, 2) + std::pow(warpToPoint.z, 2)))) + j;
602 uint32 d = radius * (s + 1) + 1000000;
603 warpToPoint.x += (d * std::sin(t));
604 warpToPoint.y += (0.5f * radius * std::sin(j));
605 warpToPoint.z -= (d * std::cos(t));
609 }
else if (pSE->
IsCOSE()) {
610 distance += (radius / 2);
612 distance += (radius / 3);
620 warpToPoint -= stopPoint;
625 warpToPoint -= (radius * 1.25f);
629 }
else if (radius > 90000) {
631 warpToPoint.
x += ((radius + 500000) * std::cos(radius));
632 warpToPoint.y += ((radius * 1.3f) - 7500);
633 warpToPoint.z -= ((radius + 500000) * std::sin(radius));
635 if (radius < 90000) {
639 GPoint stopPoint = (vectorFromOrigin * radius);
640 warpToPoint -= stopPoint;
643 if (warpToPoint.isZero()) {
645 codelog(CLIENT__ERROR,
"%s: warpToPoint.isZero() = true. Cannot find location %u for '%s'", call.
client->
GetName(), toID, type.c_str());
654 pDestiny->
WarpTo(warpToPoint, distance);
662 if (pDestiny ==
nullptr) {
673 if (pSystem ==
nullptr) {
679 CallWarpToStuffAutopilot arg;
680 if (!arg.Decode(&call.
tuple)) {
681 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
686 if (pSE ==
nullptr) {
687 codelog(CLIENT__ERROR,
"%s: unable to find destination Entity for ID %u", call.
client->
GetName(), arg.destID);
708 _log(AUTOPILOT__MESSAGE,
"%s called Stop. AP: %s, Invul: %s", call.
client->
GetName(), \
712 if (pDestiny ==
nullptr) {
716 if (!pDestiny->IsMoving())
718 if (pDestiny->IsWarping()) {
721 }
else if (pDestiny->IsFrozen()) {
742 if (pDestiny ==
nullptr) {
753 if (pSystem ==
nullptr) {
757 Call_TwoIntegerArgs
args;
758 if (!args.Decode(&call.
tuple)) {
759 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
803 if (pDestiny ==
nullptr) {
814 Call_StargateJump
args;
815 if (!args.Decode(&call.
tuple)) {
816 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
835 sLog.White(
"BeyonceBound::Handle_CmdAbandonLoot()",
"size= %u", call.
tuple->
size() );
836 call.
Dump(SERVICE__CALL_DUMP);
838 Call_SingleIntList arg;
839 if (!arg.Decode(&call.
tuple)) {
840 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
847 for (
auto cur : arg.ints) {
848 pSE = pSysMgr->
GetSE(cur);
857 itemData->
SetItem(1, slimData);
865 codelog(CLIENT__ERROR,
"%s: Client sent UpdateStateRequest. Previous call generated a bad return. Check Logs.", call.
client->
GetName());
868 if (pDestiny ==
nullptr) {
872 if (pDestiny->IsWarping()) {
878 pDestiny->SendSetState();
967 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdJumpThroughFleet");
968 call.
Dump(SHIP__WARNING);
974 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdJumpThroughAlliance");
975 call.
Dump(SHIP__WARNING);
981 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdJumpThroughCorporationStructure");
982 call.
Dump(SHIP__WARNING);
991 if (pDestiny ==
nullptr) {
999 Call_BridgeJumpAlliance
args;
1000 if (!args.Decode(&call.
tuple)) {
1001 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1011 std::vector<InventoryItemRef> fuelBayItems;
1012 std::vector<InventoryItemRef> requiredItems;
1014 uint32 fuelQuantity = 500;
1018 for (
auto cur : fuelBayItems) {
1019 if (cur->type().id() == fuelType) {
1020 quantity += cur->quantity();
1021 requiredItems.push_back(cur);
1022 if (quantity >= fuelQuantity) {
1027 if (quantity < fuelQuantity) {
1028 ship->
GetPilot()->
SendNotifyMsg(
"This jump requires %u units of %s in the Jump Bridge fuel hold.", fuelQuantity,
sItemFactory.GetType(fuelType)->name().c_str());
1032 uint32 quantityLeft = fuelQuantity;
1033 for (
auto cur : requiredItems) {
1034 if (cur->quantity() >= quantityLeft) {
1036 cur->AlterQuantity(-quantityLeft,
true);
1040 quantityLeft -= cur->quantity();
1042 cur->SetQuantity(0,
true,
true);
1062 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdBeaconJumpFleet");
1063 call.
Dump(SHIP__WARNING);
1072 if (pDestiny ==
nullptr) {
1083 Call_BeaconJumpFleet
args;
1084 if (!args.Decode(&call.
tuple)) {
1085 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1094 std::vector<InventoryItemRef> fuelBayItems;
1095 std::vector<InventoryItemRef> requiredItems;
1103 GVector heading ( startPosition, endPosition );
1110 fuelQuantity =
uint32(ceil(jumpDistance * fuelBaseConsumption * (1 - 0.1 * jumpFuelConservationLevel) * (1 - 0.1 * jumpFreightersLevel)));
1112 fuelQuantity =
uint32(ceil(jumpDistance * fuelBaseConsumption * (1 - 0.1 * jumpFuelConservationLevel)));
1117 for (
auto cur : fuelBayItems) {
1118 if (cur->type().id() == fuelType) {
1119 quantity += cur->quantity();
1120 requiredItems.push_back(cur);
1121 if (quantity >= fuelQuantity) {
1126 if (quantity < fuelQuantity) {
1127 ship->
GetPilot()->
SendNotifyMsg(
"This jump requires you to have %u units of %s in your fuel bay.", fuelQuantity,
sItemFactory.GetType(fuelType)->name().c_str());
1131 for (
auto cur : requiredItems) {
1132 if (cur->quantity() > fuelQuantity) {
1134 cur->AlterQuantity(-fuelQuantity,
true);
1138 cur->SetQuantity(0,
true,
true);
1156 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdBeaconJumpAlliance");
1157 call.
Dump(SHIP__WARNING);
1166 if (pDestiny ==
nullptr) {
1174 Call_BeaconJumpAlliance
args;
1175 if (!args.Decode(&call.
tuple)) {
1176 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
1185 std::vector<InventoryItemRef> fuelBayItems;
1186 std::vector<InventoryItemRef> requiredItems;
1194 GVector heading ( startPosition, endPosition );
1201 fuelQuantity =
uint32(ceil(jumpDistance * fuelBaseConsumption * (1 - 0.1 * jumpFuelConservationLevel) * (1 - 0.1 * jumpFreightersLevel)));
1203 fuelQuantity =
uint32(ceil(jumpDistance * fuelBaseConsumption * (1 - 0.1 * jumpFuelConservationLevel)));
1208 for (
auto cur : fuelBayItems) {
1209 if (cur->type().id() == fuelType) {
1210 quantity += cur->quantity();
1211 requiredItems.push_back(cur);
1212 if (quantity >= fuelQuantity) {
1217 if (quantity < fuelQuantity) {
1218 ship->
GetPilot()->
SendNotifyMsg(
"This jump requires you to have %u units of %s in your inventory.", fuelQuantity,
sItemFactory.GetType(fuelType)->name().c_str());
1222 uint32 quantityLeft = fuelQuantity;
1223 for (
auto cur : requiredItems) {
1224 if (cur->quantity() >= quantityLeft) {
1226 cur->AlterQuantity(-quantityLeft,
true);
1230 quantityLeft -= cur->quantity();
1232 cur->SetQuantity(0,
true,
true);
1252 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdFleetRegroup");
1253 call.
Dump(SHIP__WARNING);
1259 _log(SHIP__WARNING,
"BeyonceBound::Handle_CmdFleetTagTarget");
1260 call.
Dump(SHIP__WARNING);
#define sConfig
A macro for easier access to the singleton.
Dispatcher *const m_dispatch
void UpdateSessionInt(const char *sessionType, int value)
SystemEntity * GetSE(uint32 entityID) const
static std::string StringContent(PyRep *pRep)
void SendErrorMsg(const char *fmt,...)
uint32 GetSystemID() const
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
#define _log(type, fmt,...)
Dispatcher *const m_dispatch
PyRep * GetItem(size_t index) const
Returns Python object.
PyServiceMgr & services() const
virtual MoonSE * GetMoonSE()
void SetAutoPilot(bool set=false)
Dispatcher *const m_dispatch
std::map< std::string, PyRep * > byname
double min(double x, double y)
PyService * LookupService(const std::string &name)
const GPoint & position() const
void GotoDirection(const GPoint &direction)
SystemBubble * SysBubble()
static uint32 IntegerValueU32(PyRep *pRep)
std::string m_strBoundObjectName
void SendNotifyMsg(const char *fmt,...)
virtual bool IsWormholeSE()
CharacterRef GetChar() const
virtual bool IsPlanetSE()
const GPoint & GetPosition() const
PyCallable_Make_Dispatcher(BeyonceBound) BeyonceBound(PyServiceMgr *mgr
bool LookupBookmark(uint32 bookmarkID, uint32 &itemID, uint16 &typeID, uint32 &locationID, double &x, double &y, double &z)
void _SetCallDispatcher(CallDispatcher *d)
PyCallable_DECL_CALL(CmdFollowBall)
GaExpInl GaFloat normalize()
uint32 GetItemsByFlag(EVEItemFlags flag, std::vector< InventoryItemRef > &items) const
void CheckBallparkTimer()
#define sLog
Evaluates to a NewLog instance.
void SetUndock(bool undock=false)
virtual PyDict * MakeSlimItem()
StructureSE * GetMyTower()
DestinyManager * DestinyMgr()
void SetInvul(bool invul=false)
virtual bool IsStationSE()
AnomalyMgr * GetAnomMgr()
double MetersToLightYears(double meters)
virtual ~BeyonceService()
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
SystemManager * SystemMgr() const
static const GPoint NULL_ORIGIN(0, 0, 0)
void AlignTo(SystemEntity *pSE)
std::string GetBindStr() const
uint32 GetAnomalyID(std::string &sigID)
uint32 locationID() const
void SetSpeedFraction(float fraction=1.0f, bool startMovement=false)
PyServiceMgr *const m_manager
static GPoint GetSolarSystemPosition(uint32 systemID)
ShipItemRef GetShip() const
const char * GetName() const
void SetStateSent(bool set=false)
Python object "ccp_exceptions.UserError".
#define PyCallable_REG_CALL(c, m)
void SetDockStationID(uint32 stationID)
itemID[count] Create count or of the specified() x() entityID Translocate to the specified entity Immediately stops ship
void Follow(SystemEntity *pSE, uint32 distance)
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
void GotoPoint(const GPoint &point)
void WarpTo(const GPoint &where, int32 distance=0, bool autoPilot=false, SystemEntity *pSE=nullptr)
const char * GetName() const
int64 max(int64 x, int64 y=0)
void StargateJump(uint32 fromGate, uint32 toGate)
virtual Client * GetPilot()
void Orbit(SystemEntity *pSE, uint32 distance=0)
EvilNumber GetAttribute(const uint16 attrID) const
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
void Dump(LogType type) const
PyCallable_Make_InnerDispatcher(BeyonceService) BeyonceService
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
void BubblecastDestinyUpdate(std::vector< PyTuple * > &updates, const char *desc) const
static int64 IntegerValue(PyRep *pRep)
void MakeRandomPointOnSphere(double radius)
PyResult AttemptDockOperation()
void SetBeyonce(bool beyonce=false)
Inventory * GetMyInventory()
void CynoJump(InventoryItemRef beacon)
const char * GetName() const
static const float BUBBLE_RADIUS_METERS