32 #include "../../eve-common/EVE_Calendar.h"
33 #include "../../eve-common/EVE_Mail.h"
105 Call_SingleIntegerArg arg;
106 if (!arg.Decode(&call.
tuple)) {
107 _log(SERVICE__ERROR,
"Unable to decode args.");
115 Call_AssemblyLinesSelect
args;
116 if (!args.Decode(&call.
tuple)) {
117 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
121 if (args.filter ==
"region") {
123 }
else if (args.filter ==
"char") {
125 }
else if (args.filter ==
"corp") {
127 }
else if (args.filter ==
"alliance") {
131 _log(SERVICE__ERROR,
"Unknown filter '%s'.", args.filter.c_str());
137 if (!args.Decode(&call.
tuple)) {
138 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
145 call.
client->
SendInfoModalMsg(
"You cannot view your corporation's jobs because you are not a Factory Manager.");
157 _log(MANUF__DUMP,
"RamProxyService::Handle_InstallJob() - size %u", call.
tuple->
size() );
158 call.
Dump(MANUF__DUMP);
160 Call_InstallJob
args;
161 if (!args.Decode(&call.
tuple)) {
162 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
166 _log(MANUF__INFO,
"RamProxyService::Handle_InstallJob() - %s",
sRamMthd.GetActivityName(args.activityID));
174 if (installedItem.
get() ==
nullptr) {
181 if (call.
byname.find(
"installedItem") != call.
byname.end()) {
221 if (installedItem.
get() ==
nullptr) {
223 throw UserError (
"RamActivityRequiresABlueprint");
226 _log(MANUF__ERROR,
"installedItem dict incomplete");
227 throw CustomError (
"Remote Job Installation Not Functional at this time.");
231 throw UserError (
"RamActivityRequiresABlueprint");
241 args.outputFlag = bpRef->flag();
251 PathElement bomLocPath;
252 if (args.isCorpJob) {
259 CorpPathElement bpPath;
260 if (!bpPath.Decode(args.bpLocPath)) {
261 _log(SERVICE__ERROR,
"Failed to decode Corp BP path.");
270 CorpPathElement bomPath;
271 if (!bomPath.Decode(args.bomLocPath)) {
272 _log(SERVICE__ERROR,
"Failed to decode Corp BOM path.");
279 bomLocPath.locationID = bomPath.officeID;
280 bomLocPath.ownerID = bomPath.officeCorpID;
281 bomLocPath.flagID = bomPath.pathFlagID;
284 if (!bomLocPath.Decode(args.bpLocPath->GetItem(0))) {
285 _log(SERVICE__ERROR,
"Failed to decode BOM path.");
299 if (call.
byname.find(
"maxJobStartTime") != call.
byname.end())
301 throw UserError (
"RamProductionTimeExceedsLimits");
306 std::vector<EvERam::RequiredItem> reqItems;
307 sDataMgr.GetRamRequiredItems(bpRef->typeID(), (
int8)args.activityID, reqItems);
311 _log(MANUF__INFO,
"quoteOnly = true");
312 sRamMthd.EncodeBillOfMaterials(reqItems, rsp.materialMultiplier, rsp.charMaterialMultiplier, args.runs, rsp.bom);
313 sRamMthd.EncodeMissingMaterials(reqItems, bomLocPath, call.
client, rsp.materialMultiplier, rsp.charMaterialMultiplier, args.runs, rsp.missingMaterials);
321 sRamMthd.MaterialSkillsCheck(call.
client, args.runs, bomLocPath, rsp, reqItems);
325 sRamMthd.ProductionTimeCheck(rsp.productionTime);
330 switch (args.lineLocationGroupID) {
333 locationID = args.lineLocationID;
337 locationID = args.lineLocationID;
340 locationID = args.lineLocationID;
341 if (
sDataMgr.IsStation(args.lineContainerID)) {
342 locationID = args.lineContainerID;
344 sLog.Warning(
"InstallJob",
"Location is not Station. Needs work.");
353 std::string reason =
"DESC: Installing ";
354 reason +=
sRamMthd.GetActivityName(args.activityID);
355 reason +=
" job in ";
356 if (
sDataMgr.IsStation(locationID)) {
357 reason +=
stDataMgr.GetStationName(locationID);
359 reason +=
"Unknown Location";
362 if (args.isCorpJob) {
375 if (beginTime < rsp.maxJobStartTime)
376 beginTime = rsp.maxJobStartTime;
383 _log(MANUF__ERROR,
"Could not InstallJob for %s using %s", call.
client->
GetName(), bpRef->name());
388 if (bpRef->quantity() > 1) {
390 if (iRef.
get() ==
nullptr) {
391 _log(MANUF__WARNING,
"Failed to split %s for %s.", bpRef->name(),
sRamMthd.GetActivityName(args.activityID));
392 throw UserError (
"RamActivityRequiresABlueprint");
398 bpRef->ChangeSingleton(
true);
402 std::vector<InventoryItemRef>
items;
403 sRamMthd.GetBOMItems( bomLocPath, items );
405 std::vector<EvERam::RequiredItem>::iterator itemItr = reqItems.begin();
406 for (; itemItr != reqItems.end(); ++itemItr) {
407 if (itemItr->isSkill)
411 uint32 qtyNeeded = (
uint32)round(((itemItr->quantity * rsp.materialMultiplier) + (itemItr->quantity * rsp.charMaterialMultiplier - itemItr->quantity)) * args.runs);
414 std::vector<InventoryItemRef>::iterator refItr = items.begin();
415 for (; refItr != items.end(); ++refItr)
416 if ((*refItr)->typeID() == itemItr->typeID) {
417 if (qtyNeeded >= (*refItr)->quantity()) {
418 qtyNeeded -= (*refItr)->quantity();
421 (*refItr)->AlterQuantity(-qtyNeeded,
true);
428 switch (args.activityID) {
431 bpRef->UpdateRuns(-args.runs);
434 bpRef->UpdateRuns(-args.runs);
438 bpRef->UpdateRuns(-args.runs);
463 if (args.isCorpJob) {
464 title +=
"Corporate ";
466 title +=
"Personal ";
468 title +=
sRamMthd.GetActivityName(args.activityID);
471 std::string description;
472 if (args.isCorpJob) {
473 description +=
"The ";
475 description +=
"Your ";
477 description +=
sRamMthd.GetActivityName(args.activityID);
478 description +=
" job in ";
480 if (
sDataMgr.IsStation(locationID)) {
481 description +=
stDataMgr.GetStationName(locationID);
483 description +=
"Unknown Location";
486 description +=
" is scheduled to complete at the time noted.<br><br>";
487 switch (args.activityID) {
489 description +=
"This job is for <color=red>";
490 description += std::to_string(args.runs);
491 description +=
"</color> runs of <color=yellow>";
492 description += bpRef->productType().groupName();
493 description +=
"</color>,<br>producing <color=green>";
494 description += std::to_string(args.runs * bpRef->productType().portionSize());
495 description +=
"</color> units of <color=green>";
496 description += bpRef->productType().name();
497 description +=
"</color>.";
500 description +=
"Upon completion, this job will increase the Material Efficiency of the ";
501 description +=
"<color=yellow>";
502 description += bpRef->itemName();
503 description +=
"</color> from <color=red>";
504 description += std::to_string(bpRef->mLevel());
505 description +=
"</color> to <color=green>";
506 description += std::to_string(bpRef->mLevel() + args.runs);
507 description +=
"</color>.";
510 description +=
"Upon completion, this job will increase the Production Efficiency of the ";
511 description +=
"<color=yellow>";
512 description += bpRef->itemName();
513 description +=
"</color> from <color=red>";
514 description += std::to_string(bpRef->pLevel());
515 description +=
"</color> to <color=green>";
516 description += std::to_string(bpRef->pLevel() + args.runs);
517 description +=
"</color>.";
520 description +=
"<color=green>";
521 description += std::to_string(args.runs);
522 description +=
"</color> Copies of the ";
523 description +=
"<color=yellow>";
524 description += bpRef->itemName();
525 description +=
"</color> will be made.";
538 if (args.isCorpJob) {
539 description +=
"<br><br>This ";
540 description +=
sRamMthd.GetActivityName(args.activityID);
541 description +=
" job was installed by ";
543 description +=
" on ";
545 description +=
" CST.";
550 description +=
"<br><br><br>And a good time shall be had by all!";
564 if (args.isCorpJob) {
593 _log(MANUF__DUMP,
"RamProxyService::Handle_CompleteJob() - size %u", call.
tuple->
size() );
594 call.
Dump(MANUF__DUMP);
596 Call_CompleteJob
args;
597 if (!args.Decode(&call.
tuple)) {
598 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
604 throw UserError (
"RamCompletionNoSuchJob");
613 if (installedItem.
get() ==
nullptr)
618 std::vector<EvERam::RequiredItem> reqItems;
620 for (
auto cur : reqItems) {
622 uint32 quantity = (cur.quantity * data.
jobRuns * (1 - cur.damagePerJob));
628 if (iRef.
get() !=
nullptr)
643 if (iRef.
get() !=
nullptr)
647 bpRef->UpdatePLevel(data.
jobRuns);
650 bpRef->UpdateMLevel(data.
jobRuns);
657 bpdata.mLevel = bpRef->mLevel();
658 bpdata.pLevel = bpRef->pLevel();
662 if (copy.
get() !=
nullptr)
663 copy->Move(args.containerID, data.
outputFlag,
true);
721 dict->
SetItemString(
"messageLabel",
new PyString(
"UI/ScienceAndIndustry/ScienceAndIndustryWindow/RamInventionJobSucceeded"));
729 dict->
SetItemString(
"messageLabel",
new PyString(
"UI/ScienceAndIndustry/ScienceAndIndustryWindow/RamInventionJobFailed"));
810 _log(MANUF__WARNING,
"Activity %u is currently unsupported.", data.
activity);
826 _log(MANUF__DUMP,
"RamProxyService::Handle_UpdateAssemblyLineConfigurations() - size %u", call.
tuple->
size() );
827 call.
Dump(MANUF__DUMP);
#define sConfig
A macro for easier access to the singleton.
Dispatcher *const m_dispatch
static PyRep * AssemblyLinesSelectCorporation(const uint32 corporationID)
void SendNotification(const PyAddress &dest, EVENotificationStream ¬i, bool seq=true)
uint32 GetSystemID() const
#define _log(type, fmt,...)
PyRep * GetItemString(const char *key) const
Obtains database entry based on given key string.
int64 GetCorpRole() const
std::map< std::string, PyRep * > byname
uint32 GetRegionID() const
static PyRep * AssemblyLinesSelectPersonal(const uint32 charID)
void SendInfoModalMsg(const char *fmt,...)
int32 GetCharacterID() const
int32 GetCorporationID() const
static uint32 InstallJob(const uint32 ownerID, const uint32 installerID, Call_InstallJob &args, const int64 beginTime, const int64 endTime, const uint32 systemID)
static uint32 IntegerValueU32(PyRep *pRep)
static uint32 SaveSystemEvent(uint32 ownerID, uint32 creatorID, int64 startDateTime, uint8 autoEventType, std::string title, std::string description, bool important=false)
CharacterRef GetChar() const
const char * GetName() const
static PyRep * AssemblyLinesSelectPublic(const uint32 regionID)
Advanced version of UserError that allows to send a full custom message.
static bool GetJobProperties(const uint32 jobID, EvERam::JobProperties &data)
int32 GetAllianceID() const
void Move(uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
static PyRep * GetJobs2(const int32 ownerID, const bool completed)
#define sLog
Evaluates to a NewLog instance.
bool IsEven(int64 number)
const std::string currentDateTime()
#define codelog(type, fmt,...)
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)
Dispatcher *const m_dispatch
const char * GetName() const
Python object "ccp_exceptions.UserError".
#define PyCallable_REG_CALL(c, m)
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
virtual ~RamProxyService()
static BlueprintRef Spawn(ItemData &data, EvERam::bpData &bdata)
static PyRep * AssemblyLinesGet(const uint32 containerID)
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
static PyRep * AssemblyLinesSelectAlliance(const int32 allianceID)
static void SetJobEventID(const uint32 jobID, const uint32 eventID)
void Dump(LogType type) const
static PyRep * AssemblyLinesSelectPrivate(const uint32 charID)
static void DeleteEvent(uint32 eventID)
static int64 IntegerValue(PyRep *pRep)
PyCallable_Make_InnerDispatcher(RamProxyService) RamProxyService
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
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
static bool CompleteJob(const uint32 jobID, const int8 completedStatus)