12 #include "../eve-common/EVE_Character.h"
41 if (bpRef.
get() ==
nullptr)
47 throw UserError (
"RamAssemblyLineHasNoActivity");
50 switch(args.activityID) {
52 if (!bpRef->infinite()
53 and ((bpRef->runs() - args.runs) < 0))
54 throw UserError (
"RamTooManyProductionRuns");
56 pType = &bpRef->productType();
61 throw UserError (
"RamCannotResearchABlueprintCopy");
62 pType = &bpRef->type();
66 throw UserError (
"RamCannotCopyABlueprintCopy");
67 pType = &bpRef->type();
70 if (!bpRef->copy() or bpRef->infinite())
71 throw UserError (
"RamCannotInventABlueprintOriginal");
76 if (bpRef->runs() < 1)
77 throw UserError (
"RamTooManyProductionsRuns");
79 pType = &bpRef->productType();
86 sLog.Error(
"RAM::InstallJob()",
"Unsupported Activity %u sent by %s(%u).", args.activityID, pClient->
GetName(), pClient->
GetCharacterID());
95 throw UserError (
"RamBadEndProductForActivity");
106 if (charMaxJobs <= jobCount)
107 throw UserError (
"MaxFactorySlotUsageReached")
116 if (charMaxJobs <= jobCount)
117 throw UserError (
"MaxResearchFacilitySlotUsageReached")
125 if (
sDataMgr.IsStation(lineLocationID)) {
128 throw UserError (
"RamIsNotAnInstallation");
130 throw UserError (
"RamRangeLimitationRegion");
158 throw UserError (
"RamInstallationHasNoDefaultContent");
163 throw UserError (
"RamAssemblyLineHasNoActivity");
166 if (args.isCorpJob) {
171 throw UserError (
"RamCannotInstallWithoutRentFactorySlot");
174 throw UserError (
"RamCannotInstallWithoutRentResearchSlot");
177 throw UserError (
"RamCannotInstallForCorpByRoleFactoryManager");
179 throw UserError (
"RamCannotInstallForCorpByRole");
185 throw UserError (
"RamAccessDeniedWrongAlliance");
189 throw UserError (
"RamAccessDeniedWrongCorp");
195 if (args.isCorpJob) {
197 throw UserError (
"RamAccessDeniedCorpStandingTooLow");
200 throw UserError (
"RamAccessDeniedStandingTooLow");
206 if (args.isCorpJob) {
209 throw UserError (
"RamAccessDeniedCorpSecStatusTooLow");
211 throw UserError (
"RamAccessDeniedCorpSecStatusTooHigh");
214 throw UserError (
"RamAccessDeniedSecStatusTooLow");
216 throw UserError (
"RamAccessDeniedSecStatusTooHigh");
224 if (args.isCorpJob) {
226 throw UserError (
"RamCannotInstallItemForAnotherCorp");
230 throw UserError (
"RamCannotInstallItemForAnother");
237 if (
sDataMgr.IsStation(args.lineContainerID)) {
238 if (installedItem->
locationID() != args.lineContainerID) {
242 ?
"RamCorpInstalledItemWrongLocation"
243 :
"RamInstalledItemWrongLocation")
246 throw UserError (
"RamRemoteInstalledItemNotInStation");
249 if (args.isCorpJob) {
254 ?
"RamCorpInstalledItemWrongLocation"
255 :
"RamInstalledItemWrongLocation")
262 throw UserError (
"RamInstalledItemWrongLocation")
265 throw UserError (
"RamRemoteInstalledItemInStationNotHangar");
270 }
else if (args.lineContainerID == pClient->
GetShipID()) {
272 throw UserError (
"RamAccessDeniedNotPilot");
275 throw UserError (
"RamCorpInstalledItemNotInCargo");
277 if (installedItem->
locationID() != args.lineContainerID)
278 throw UserError (
"RamInstalledItemMustBeInShip");
287 throw CustomError (
"R.A.M. at POS/Outpost not supported yet");
297 throw UserError (
"RamAccessDeniedToBOMHangar");
301 throw UserError (
"RamAccessDeniedToBOMHangar");
305 throw UserError (
"RamAccessDeniedToBOMHangar");
309 throw UserError (
"RamAccessDeniedToBOMHangar");
313 throw UserError (
"RamAccessDeniedToBOMHangar");
317 throw UserError (
"RamAccessDeniedToBOMHangar");
321 throw UserError (
"RamAccessDeniedToBOMHangar");
343 std::map<uint16, InventoryItemRef>
items;
346 for (
auto cur : reqItems) {
354 uint32 qtyNeeded = round(cur.quantity * rsp.materialMultiplier) * runs;
355 if (cur.damagePerJob == 1)
356 qtyNeeded += round(cur.quantity * rsp.charMaterialMultiplier - cur.quantity) * runs;
357 std::map<uint16, InventoryItemRef>::iterator itr = items.find(cur.typeID);
358 if (itr != items.end())
359 if (itr->second->typeID() == cur.typeID) {
360 if (itr->second->quantity() < qtyNeeded)
361 qtyNeeded -= itr->second->quantity();
376 throw UserError (
"RamProductionTimeExceedsLimits")
384 if (args.containerID == pClient->
GetShipID())
386 throw UserError (
"RamCompletionMustBeInShip");
391 throw UserError (
"RamCompletionAccessDeniedByCorpRole");
393 throw UserError (
"RamCompletionAccessDenied");
397 throw UserError (
"RamCompletionJobCompleted");
400 throw UserError (
"RamCompletionJobCompleted");
410 into.charTimeMultiplier = 1.0;
414 switch(args.activityID) {
416 pType = &bpRef->productType();
418 into.materialMultiplier += bpRef->GetME();
419 into.materialMultiplier *=
sConfig.ram.MatMod;
422 bpRef->pLevel(), into.timeMultiplier);
424 into.productionTime *= into.charTimeMultiplier;
426 into.productionTime *=
sConfig.ram.ProdTime;
429 pType = &bpRef->type();
434 into.productionTime *=
sConfig.ram.ResME;
438 pType = &bpRef->type();
445 into.productionTime *=
sConfig.ram.ResPE;
449 pType = &bpRef->type();
454 into.productionTime *=
sConfig.ram.CopyTime;
459 pType = &bpRef->type();
465 into.productionTime *=
sConfig.ram.InventTime;
468 pType = &bpRef->type();
471 into.productionTime = 3600;
472 into.productionTime *=
sConfig.ram.ReTime;
478 into.usageCost *= ceil(into.productionTime / 3600.0f);
479 into.cost = into.installCost + into.usageCost;
481 into.productionTime *= args.runs;
491 into.extras.lines =
new PyList();
493 into.wasteMaterials.lines =
new PyList();
495 into.rawMaterials.lines =
new PyList();
497 for (
auto cur : reqItems) {
499 into.skills[cur.typeID] =
new PyInt(cur.quantity);
503 int qtyNeeded = (
uint32)round(cur.quantity * materialMultiplier + (cur.quantity * charMaterialMultiplier - cur.quantity)) * runs;
506 MaterialList_Line line;
507 line.requiredTypeID = cur.typeID;
508 line.quantity = (
int32) round (cur.quantity * materialMultiplier) * runs;
509 line.damagePerJob = cur.damagePerJob;
510 line.isSkillCheck =
false;
511 line.requiresHP =
false;
518 into.extras.lines->AddItem( line.Encode() );
521 if (charMaterialMultiplier > 1.0) {
522 MaterialList_Line wastage( line );
523 wastage.quantity = qtyNeeded - line.quantity;
524 into.wasteMaterials.lines->AddItem( wastage.Encode() );
526 into.rawMaterials.lines->AddItem( line.Encode() );
531 void RamMethods::EncodeMissingMaterials(
const std::vector<EvERam::RequiredItem> &reqItems,
const PathElement &bomLocation,
Client *
const pClient,
float materialMultiplier,
float charMaterialMultiplier,
int32 runs, std::map<int32, PyRep *> &into) {
533 std::vector<InventoryItemRef> skills,
items;
543 for (
auto cur : reqItems) {
544 qtyReq = cur.quantity;
546 qtyReq = (
uint32)round(qtyReq * materialMultiplier + (cur.quantity * charMaterialMultiplier - cur.quantity)) * runs;
549 std::vector<InventoryItemRef>::iterator curi, endi;
551 curi = skills.begin();
554 curi = items.begin();
558 for (; curi != endi and qtyReq > 0; ++curi) {
559 if (((*curi)->typeID() == cur.typeID)
571 into[cur.typeID] =
new PyInt(qtyReq);
577 if (inventory !=
nullptr )
584 if (inventory !=
nullptr )
605 switch (activityID) {
615 codelog(MANUF__ERROR,
"RamMethods::GetActivityName - invalid activity sent: %u", activityID);
static float GetStanding(uint32 fromID, uint32 toID)
#define sConfig
A macro for easier access to the singleton.
uint32 GetLocationID() const
void InstallationCheck(Client *const pClient, int32 lineLocationID)
bool GetTypesByFlag(EVEItemFlags flag, std::map< uint16, InventoryItemRef > &items)
static bool GetMultipliers(const uint32 assemblyLineID, const ItemType *pType, Rsp_InstallJob &into)
float GetSecurityRating() const
int64 GetCorpRole() const
static uint32 CountManufacturingJobs(const uint32 installerID)
void VerifyCompleteJob(const Call_CompleteJob &args, EvERam::JobProperties &data, Client *const pClient)
static bool IsProducableBy(const uint32 assemblyLineID, const ItemType *pType)
double min(double x, double y)
bool Calculate(const Call_InstallJob &args, BlueprintRef bpRef, Character *pChar, Rsp_InstallJob &into)
void LocationRolesCheck(Client *const pClient, const CorpPathElement &data)
uint32 GetRegionID() const
static uint32 GetTech2Blueprint(const uint32 blueprintTypeID)
int32 GetCharacterID() const
int32 GetCorporationID() const
float corpSecRating() const
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
CharacterRef GetChar() const
Advanced version of UserError that allows to send a full custom message.
int64 GetRolesAtHQ() const
int32 GetAllianceID() const
int32 InventionTime(uint32 BaseTime, uint8 AdvLabLevel, float SlotModifier=1, float ImplantModifier=1)
void JobsCheck(Character *pChar, const Call_InstallJob &args)
void EncodeMissingMaterials(const std::vector< EvERam::RequiredItem > &reqItems, const PathElement &bomLocation, Client *const pClient, float materialMultiplier, float charMaterialMultiplier, int32 runs, std::map< int32, PyRep * > &into)
uint32 GetItemsByFlag(EVEItemFlags flag, std::vector< InventoryItemRef > &items) const
#define sLog
Evaluates to a NewLog instance.
void MaterialSkillsCheck(Client *const pClient, uint32 runs, const PathElement &bomLocation, const Rsp_InstallJob &rsp, const std::vector< EvERam::RequiredItem > &reqItems)
int32 ME_ResearchTime(uint32 BaseTime, uint8 MetallurgyLevel, float SlotModifier=1, float ImplantModifier=1)
UserError & AddAmount(const char *name, int quantity)
Shorthand method for adding a quantity value.
void EncodeBillOfMaterials(const std::vector< EvERam::RequiredItem > &reqItems, float materialMultiplier, float charMaterialMultiplier, uint32 runs, BillOfMaterials &into)
static uint32 CountResearchJobs(const uint32 installerID)
int32 PE_ResearchTime(uint32 BaseTime, uint8 ResearchLevel, float SlotModifier=1, float ImplantModifier=1)
static int64 GetNextFreeTime(const uint32 assemblyLineID)
#define codelog(type, fmt,...)
float GetStandingModified(uint32 fromID, uint32 toID=0)
uint32 locationID() const
void ItemOwnerCheck(Client *const pClient, const Call_InstallJob &args, BlueprintRef bpRef)
const char * GetName() const
int32 ProductionTime(uint32 BaseTime, float bpProductivityModifier, float ProductionLevel, float TimeModifier=1)
Python object "ccp_exceptions.UserError".
EVEItemFlags flag() const
static const uint32 RAM_PRODUCTION_TIME_LIMIT
int32 CopyTime(uint16 BaseTime, uint8 ScienceLevel, float SlotModifier=1, float ImplantModifier=1)
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 kick all and halt server immediate command list all items in current location s inventory(either station or solsystem)." ) COMMAND( cargo
int64 max(int64 x, int64 y=0)
void LinePermissionCheck(Client *const pClient, const Call_InstallJob &args)
#define STATION_OFFICE_OFFSET
void ActivityCheck(Client *const pClient, const Call_InstallJob &args, BlueprintRef bpRef)
EvilNumber GetAttribute(const uint16 attrID) const
static bool GetAssemblyLineProperties(const uint32 assemblyLineID, Character *pChar, Rsp_InstallJob &into, bool isCorpJob=false)
static bool GetAssemblyLineRestrictions(const int32 assemblyLineID, EvERam::LineRestrictions &data)
void GetAdjustedRamRequiredMaterials()
void ItemLocationCheck(Client *const pClient, const Call_InstallJob &args, InventoryItemRef installedItem)
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
#define IsHangarFlag(flag)
const char * GetActivityName(int8 activityID)
void GetBOMItemsMap(const PathElement &bomLocation, std::map< uint16, InventoryItemRef > &into)
#define IsRegionID(itemID)
void HangarRolesCheck(Client *const pClient, int16 flagID)
Inventory * GetMyInventory()
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 ProductionTimeCheck(uint32 productionTime)
UserError & AddLocationName(const char *name, uint32 locationID)
Shorthand method for adding a location's name.
Reference-counting-based smart pointer.
void GetBOMItems(const PathElement &bomLocation, std::vector< InventoryItemRef > &into)