EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RamMethods Class Reference

#include "RamMethods.h"

Inheritance diagram for RamMethods:
Collaboration diagram for RamMethods:

Public Member Functions

RamMethods.cpp

methods for R.A.M. activities

: Allan

Date
: 9Jan18
void ActivityCheck (Client *const pClient, const Call_InstallJob &args, BlueprintRef bpRef)
 
void JobsCheck (Character *pChar, const Call_InstallJob &args)
 
void InstallationCheck (Client *const pClient, int32 lineLocationID)
 
void LinePermissionCheck (Client *const pClient, const Call_InstallJob &args)
 
void ItemOwnerCheck (Client *const pClient, const Call_InstallJob &args, BlueprintRef bpRef)
 
void ItemLocationCheck (Client *const pClient, const Call_InstallJob &args, InventoryItemRef installedItem)
 
void HangarRolesCheck (Client *const pClient, int16 flagID)
 
void LocationRolesCheck (Client *const pClient, const CorpPathElement &data)
 
void ProductionTimeCheck (uint32 productionTime)
 
void MaterialSkillsCheck (Client *const pClient, uint32 runs, const PathElement &bomLocation, const Rsp_InstallJob &rsp, const std::vector< EvERam::RequiredItem > &reqItems)
 
void VerifyCompleteJob (const Call_CompleteJob &args, EvERam::JobProperties &data, Client *const pClient)
 
bool Calculate (const Call_InstallJob &args, BlueprintRef bpRef, Character *pChar, Rsp_InstallJob &into)
 
void EncodeBillOfMaterials (const std::vector< EvERam::RequiredItem > &reqItems, float materialMultiplier, float charMaterialMultiplier, uint32 runs, BillOfMaterials &into)
 
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)
 
void GetBOMItems (const PathElement &bomLocation, std::vector< InventoryItemRef > &into)
 
void GetBOMItemsMap (const PathElement &bomLocation, std::map< uint16, InventoryItemRef > &into)
 
void GetAdjustedRamRequiredMaterials ()
 
const char * GetActivityName (int8 activityID)
 
- Public Member Functions inherited from Singleton< RamMethods >
 Singleton ()
 Primary constructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< RamMethods >
static RamMethodsget ()
 
- Static Protected Attributes inherited from Singleton< RamMethods >
static std::shared_ptr
< RamMethods
mInstance
 

Detailed Description

Definition at line 19 of file RamMethods.h.

Member Function Documentation

void RamMethods::ActivityCheck ( Client *const  pClient,
const Call_InstallJob &  args,
BlueprintRef  bpRef 
)

Definition at line 39 of file RamMethods.cpp.

References EvERam::Activity::Copying, EvERam::Activity::Duplicating, RefPtr< X >::get(), Client::GetCharacterID(), Client::GetName(), FactoryDB::GetTech2Blueprint(), EvERam::Activity::Invention, FactoryDB::IsProducableBy(), EvERam::Activity::Manufacturing, EvERam::Activity::ResearchMaterial, EvERam::Activity::ResearchTech, EvERam::Activity::ResearchTime, EvERam::Activity::ReverseEngineering, and sLog.

40 {
41  if (bpRef.get() == nullptr)
42  throw UserError ("RamInventionNoOutput");
43 
44  // check validity of activity
45  if ((args.activityID < EvERam::Activity::Manufacturing)
46  or (args.activityID > EvERam::Activity::Invention))
47  throw UserError ("RamAssemblyLineHasNoActivity");
48 
49  const ItemType* pType(nullptr);
50  switch(args.activityID) {
52  if (!bpRef->infinite()
53  and ((bpRef->runs() - args.runs) < 0))
54  throw UserError ("RamTooManyProductionRuns");
55 
56  pType = &bpRef->productType();
57  } break;
60  if (bpRef->copy())
61  throw UserError ("RamCannotResearchABlueprintCopy");
62  pType = &bpRef->type();
63  } break;
65  if (bpRef->copy())
66  throw UserError ("RamCannotCopyABlueprintCopy");
67  pType = &bpRef->type();
68  } break;
70  if (!bpRef->copy() or bpRef->infinite())
71  throw UserError ("RamCannotInventABlueprintOriginal");
72 
73  uint32 pTypeID = FactoryDB::GetTech2Blueprint(bpRef->typeID());
74  if (pTypeID == 0)
75  throw UserError ("RamInventionNoOutput");
76  if (bpRef->runs() < 1)
77  throw UserError ("RamTooManyProductionsRuns");
78 
79  pType = &bpRef->productType();
80  } break;
81  case EvERam::Activity::ReverseEngineering: // RE is ONLY at experimental POS module...cannot do RE in stations. right now, this will never hit.
82  case EvERam::Activity::ResearchTech: // cannot find any reference to this. not used?
83  case EvERam::Activity::Duplicating: // ancient pre-apoc 'copy' activity. no longer used.
84  default: {
85  // not supported
86  sLog.Error("RAM::InstallJob()", "Unsupported Activity %u sent by %s(%u).", args.activityID, pClient->GetName(), pClient->GetCharacterID());
87  throw UserError ("RamActivityInvalid");
88  }
89  }
90 
91  if (pType == nullptr)
92  throw UserError ("RamNoKnownOutputType");
93 
94  if (!FactoryDB::IsProducableBy(args.AssemblyLineID, pType))
95  throw UserError ("RamBadEndProductForActivity");
96 }
static bool IsProducableBy(const uint32 assemblyLineID, const ItemType *pType)
Definition: FactoryDB.cpp:29
static uint32 GetTech2Blueprint(const uint32 blueprintTypeID)
Definition: FactoryDB.cpp:647
int32 GetCharacterID() const
Definition: Client.h:113
* args
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
X * get() const
Definition: RefPtr.h:213
const char * GetName() const
Definition: Client.h:94
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
unsigned __int32 uint32
Definition: eve-compat.h:50

Here is the call graph for this function:

bool RamMethods::Calculate ( const Call_InstallJob &  args,
BlueprintRef  bpRef,
Character pChar,
Rsp_InstallJob &  into 
)

Definition at line 403 of file RamMethods.cpp.

References EvESkill::AdvancedLaboratoryOperation, AttrCopySpeedPercent, AttrManufactureCostMultiplier, AttrManufacturingTimeResearchSpeed, AttrMineralNeedResearchSpeed, EvERam::Activity::Copying, EvEMath::RAM::CopyTime(), EvilNumber::get_float(), FactoryDB::GetAssemblyLineProperties(), InventoryItem::GetAttribute(), FactoryDB::GetMultipliers(), FactoryDB::GetNextFreeTime(), Character::GetSkillLevel(), EvESkill::Industry, EvERam::Activity::Invention, EvEMath::RAM::InventionTime(), EvERam::Activity::Manufacturing, EvE::max(), EvEMath::RAM::ME_ResearchTime(), EvESkill::Metallurgy, EvEMath::RAM::PE_ResearchTime(), EvEMath::RAM::ProductionTime(), EvESkill::Research, EvERam::Activity::ResearchMaterial, EvERam::Activity::ResearchTime, EvERam::Activity::ReverseEngineering, EvESkill::Science, and sConfig.

404 {
405  // get line data
406  if (!FactoryDB::GetAssemblyLineProperties(args.AssemblyLineID, pChar, into, args.isCorpJob))
407  return false;
408 
409  // set char defaults
410  into.charTimeMultiplier = 1.0;
411  into.charMaterialMultiplier = EvE::max(1.0f, pChar->GetAttribute (AttrManufactureCostMultiplier).get_float ());
412 
413  const ItemType* pType(nullptr);
414  switch(args.activityID) {
416  pType = &bpRef->productType();
417  FactoryDB::GetMultipliers(args.AssemblyLineID, pType, into);
418  into.materialMultiplier += bpRef->GetME();
419  into.materialMultiplier *= sConfig.ram.MatMod;
420  into.charTimeMultiplier *= (1.0f - (0.04f * pChar->GetSkillLevel(EvESkill::Industry)));
421  into.productionTime = EvEMath::RAM::ProductionTime(bpRef->type().productionTime(), bpRef->type().productivityModifier(),
422  bpRef->pLevel(), into.timeMultiplier);
423  // modify base time by char multiplier
424  into.productionTime *= into.charTimeMultiplier;
425  // if time modifier is set in config, apply that now
426  into.productionTime *= sConfig.ram.ProdTime;
427  } break;
429  pType = &bpRef->type();
430  FactoryDB::GetMultipliers(args.AssemblyLineID, pType, into);
431  into.productionTime = EvEMath::RAM::ME_ResearchTime(bpRef->type().researchMaterialTime(),
432  pChar->GetSkillLevel(EvESkill::Metallurgy), into.timeMultiplier
433  /*implant modifier here*/);
434  into.productionTime *= sConfig.ram.ResME;
435  into.charTimeMultiplier *= pChar->GetAttribute(AttrMineralNeedResearchSpeed).get_float();
436  } break;
438  pType = &bpRef->type();
439  FactoryDB::GetMultipliers(args.AssemblyLineID, pType, into);
440  //ch->GetAttribute(AttrResearchCostPercent).get_int(); << this is not used
441 
442  into.productionTime = EvEMath::RAM::PE_ResearchTime(bpRef->type().researchProductivityTime(),
443  pChar->GetSkillLevel(EvESkill::Research), into.timeMultiplier
444  /*implant modifier here*/);
445  into.productionTime *= sConfig.ram.ResPE;
446  into.charTimeMultiplier *= pChar->GetAttribute(AttrManufacturingTimeResearchSpeed).get_float();
447  } break;
449  pType = &bpRef->type();
450  FactoryDB::GetMultipliers(args.AssemblyLineID, pType, into);
451  into.productionTime = EvEMath::RAM::CopyTime(bpRef->type().researchCopyTime(),
452  pChar->GetSkillLevel(EvESkill::Science), into.timeMultiplier
453  /*implant modifier here*/);
454  into.productionTime *= sConfig.ram.CopyTime;
455  into.charTimeMultiplier *= pChar->GetAttribute(AttrCopySpeedPercent).get_float();
456  //bpRef->type().chanceOfDuplicating();
457  } break;
459  pType = &bpRef->type();
460  FactoryDB::GetMultipliers(args.AssemblyLineID, pType, into);
461  into.productionTime = EvEMath::RAM::InventionTime(bpRef->type().researchTechTime(),
463  into.timeMultiplier
464  /*implant modifier here*/);
465  into.productionTime *= sConfig.ram.InventTime;
466  } break;
468  pType = &bpRef->type();
469  FactoryDB::GetMultipliers(args.AssemblyLineID, pType, into);
470  // base research time for RE is one hour
471  into.productionTime = 3600; // in seconds
472  into.productionTime *= sConfig.ram.ReTime;
473  //bpRef->type().chanceOfRE();
474  } break;
475  }
476 
477  // calculate cost
478  into.usageCost *= ceil(into.productionTime / 3600.0f);
479  into.cost = into.installCost + into.usageCost;
480  // multiply single run time by run count for total time
481  into.productionTime *= args.runs;
482 
483  into.maxJobStartTime = FactoryDB::GetNextFreeTime(args.AssemblyLineID);
484 
485  return true;
486 }
#define sConfig
A macro for easier access to the singleton.
static bool GetMultipliers(const uint32 assemblyLineID, const ItemType *pType, Rsp_InstallJob &into)
Definition: FactoryDB.cpp:678
int32 InventionTime(uint32 BaseTime, uint8 AdvLabLevel, float SlotModifier=1, float ImplantModifier=1)
Definition: EvEMath.cpp:89
* args
int32 ME_ResearchTime(uint32 BaseTime, uint8 MetallurgyLevel, float SlotModifier=1, float ImplantModifier=1)
Definition: EvEMath.cpp:68
int32 PE_ResearchTime(uint32 BaseTime, uint8 ResearchLevel, float SlotModifier=1, float ImplantModifier=1)
Definition: EvEMath.cpp:73
static int64 GetNextFreeTime(const uint32 assemblyLineID)
Definition: FactoryDB.cpp:662
int32 ProductionTime(uint32 BaseTime, float bpProductivityModifier, float ProductionLevel, float TimeModifier=1)
Definition: EvEMath.cpp:55
int32 CopyTime(uint16 BaseTime, uint8 ScienceLevel, float SlotModifier=1, float ImplantModifier=1)
Definition: EvEMath.cpp:84
int64 max(int64 x, int64 y=0)
Definition: misc.h:103
EvilNumber GetAttribute(const uint16 attrID) const
static bool GetAssemblyLineProperties(const uint32 assemblyLineID, Character *pChar, Rsp_InstallJob &into, bool isCorpJob=false)
Definition: FactoryDB.cpp:400
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
Definition: Character.cpp:575
float get_float()
Definition: EvilNumber.cpp:184

Here is the call graph for this function:

void RamMethods::EncodeBillOfMaterials ( const std::vector< EvERam::RequiredItem > &  reqItems,
float  materialMultiplier,
float  charMaterialMultiplier,
uint32  runs,
BillOfMaterials &  into 
)
Todo:
update this shit.....

Definition at line 488 of file RamMethods.cpp.

References PySafeDecRef.

489 {
490  PySafeDecRef( into.extras.lines );
491  into.extras.lines = new PyList();
492  PySafeDecRef( into.wasteMaterials.lines );
493  into.wasteMaterials.lines = new PyList();
494  PySafeDecRef( into.rawMaterials.lines );
495  into.rawMaterials.lines = new PyList();
496 
497  for (auto cur : reqItems) {
498  if (cur.isSkill) {
499  into.skills[cur.typeID] = new PyInt(cur.quantity);
500  continue;
501  }
502 
503  int qtyNeeded = (uint32)round(cur.quantity * materialMultiplier + (cur.quantity * charMaterialMultiplier - cur.quantity)) * runs;
504 
505  // otherwise, make line for material list
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; // no idea what is this for
511  line.requiresHP = false; // no idea what is this for
512 
514  // "Extra material" is not affected by skills, and return upon completion
515  // "Raw material" is fully consumed and affected by skills/efficiency
516  // "Waste Material" is amount of material wasted ...
517  if (cur.extra) {
518  into.extras.lines->AddItem( line.Encode() );
519  } else {
520  // if there are losses, make line for waste material list
521  if (charMaterialMultiplier > 1.0) {
522  MaterialList_Line wastage( line ); // simply copy original line ...
523  wastage.quantity = qtyNeeded - line.quantity;
524  into.wasteMaterials.lines->AddItem( wastage.Encode() );
525  }
526  into.rawMaterials.lines->AddItem( line.Encode() );
527  }
528  }
529 }
signed __int32 int32
Definition: eve-compat.h:49
Python integer.
Definition: PyRep.h:231
unsigned __int32 uint32
Definition: eve-compat.h:50
#define PySafeDecRef(op)
Definition: PyRep.h:61
Python list.
Definition: PyRep.h:639
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 
)

Definition at line 531 of file RamMethods.cpp.

References AttrSkillLevel, flagSkill, GetBOMItems(), Client::GetChar(), Client::GetCharacterID(), Client::GetCorporationID(), Inventory::GetItemsByFlag(), InventoryItem::GetMyInventory(), items, and EvE::min().

531  {
532  //
533  std::vector<InventoryItemRef> skills, items;
534 
535  //get the skills
536  pClient->GetChar()->GetMyInventory()->GetItemsByFlag(flagSkill, skills);
537 
538  //get the items
539  GetBOMItems( bomLocation, items );
540 
541  //now do the check
542  uint32 qtyReq(0);
543  for (auto cur : reqItems) {
544  qtyReq = cur.quantity;
545  if (!cur.isSkill) {
546  qtyReq = (uint32)round(qtyReq * materialMultiplier + (cur.quantity * charMaterialMultiplier - cur.quantity)) * runs;
547  }
548 
549  std::vector<InventoryItemRef>::iterator curi, endi;
550  if (cur.isSkill) {
551  curi = skills.begin();
552  endi = skills.end();
553  } else {
554  curi = items.begin();
555  endi = items.end();
556  }
557 
558  for (; curi != endi and qtyReq > 0; ++curi) {
559  if (((*curi)->typeID() == cur.typeID)
560  and (((*curi)->ownerID() == pClient->GetCharacterID())
561  or ((*curi)->ownerID() == pClient->GetCorporationID()))) {
562  if (cur.isSkill) {
563  qtyReq -= std::min(qtyReq, (*curi)->GetAttribute(AttrSkillLevel).get_uint32() );
564  } else {
565  qtyReq -= std::min(qtyReq, (uint32)(*curi)->quantity() );
566  }
567  }
568  }
569 
570  if (qtyReq > 0)
571  into[cur.typeID] = new PyInt(qtyReq);
572  }
573 }
double min(double x, double y)
Definition: misc.h:95
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetCorporationID() const
Definition: Client.h:123
CharacterRef GetChar() const
Definition: Client.h:164
uint32 GetItemsByFlag(EVEItemFlags flag, std::vector< InventoryItemRef > &items) const
Definition: Inventory.cpp:458
Python integer.
Definition: PyRep.h:231
unsigned __int32 uint32
Definition: eve-compat.h:50
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
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 GetBOMItems(const PathElement &bomLocation, std::vector< InventoryItemRef > &into)
Definition: RamMethods.cpp:574

Here is the call graph for this function:

const char * RamMethods::GetActivityName ( int8  activityID)

Definition at line 603 of file RamMethods.cpp.

References codelog, EvERam::Activity::Copying, EvERam::Activity::Duplicating, EvERam::Activity::Invention, EvERam::Activity::Manufacturing, EvERam::Activity::ResearchMaterial, EvERam::Activity::ResearchTech, EvERam::Activity::ResearchTime, and EvERam::Activity::ReverseEngineering.

604 {
605  switch (activityID) {
606  case EvERam::Activity::Copying: return "Copying";
607  case EvERam::Activity::Manufacturing: return "Manufacturing";
608  case EvERam::Activity::Invention: return "Invention";
609  case EvERam::Activity::ResearchMaterial: return "Research ME";
610  case EvERam::Activity::ResearchTime: return "Research PE";
611  case EvERam::Activity::ReverseEngineering: return "Reverse Engineering";
612  // these last 2 should never hit
615  codelog(MANUF__ERROR, "RamMethods::GetActivityName - invalid activity sent: %u", activityID);
616  } break;
617  }
618  return "Undefined";
619 }
#define codelog(type, fmt,...)
Definition: logsys.h:128
void RamMethods::GetAdjustedRamRequiredMaterials ( )

Definition at line 597 of file RamMethods.cpp.

598 {
599  // will need to update this using above formula for correct material list
600 
601 }
void RamMethods::GetBOMItems ( const PathElement &  bomLocation,
std::vector< InventoryItemRef > &  into 
)

Definition at line 574 of file RamMethods.cpp.

References Inventory::GetItemsByFlag(), inventory(), and sItemFactory.

Referenced by EncodeMissingMaterials().

575 {
576  Inventory *inventory = sItemFactory.GetInventoryFromId( bomLocation.locationID );
577  if (inventory != nullptr )
578  inventory->GetItemsByFlag((EVEItemFlags)bomLocation.flagID, into );
579 }
EVEItemFlags
Definition: EVE_Flags.h:13
uint32 GetItemsByFlag(EVEItemFlags flag, std::vector< InventoryItemRef > &items) const
Definition: Inventory.cpp:458
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
#define sItemFactory
Definition: ItemFactory.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void RamMethods::GetBOMItemsMap ( const PathElement &  bomLocation,
std::map< uint16, InventoryItemRef > &  into 
)

Definition at line 581 of file RamMethods.cpp.

References Inventory::GetTypesByFlag(), inventory(), and sItemFactory.

Referenced by MaterialSkillsCheck().

582 {
583  Inventory *inventory = sItemFactory.GetInventoryFromId( bomLocation.locationID );
584  if (inventory != nullptr )
585  inventory->GetTypesByFlag( (EVEItemFlags)bomLocation.flagID, into );
586 }
bool GetTypesByFlag(EVEItemFlags flag, std::map< uint16, InventoryItemRef > &items)
Definition: Inventory.cpp:465
EVEItemFlags
Definition: EVE_Flags.h:13
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
#define sItemFactory
Definition: ItemFactory.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void RamMethods::HangarRolesCheck ( Client *const  pClient,
int16  flagID 
)

Definition at line 291 of file RamMethods.cpp.

References flagCorpHangar2, flagCorpHangar3, flagCorpHangar4, flagCorpHangar5, flagCorpHangar6, flagCorpHangar7, flagHangar, Client::GetCorpRole(), Corp::Role::HangarCanTake1, Corp::Role::HangarCanTake2, Corp::Role::HangarCanTake3, Corp::Role::HangarCanTake4, Corp::Role::HangarCanTake5, Corp::Role::HangarCanTake6, and Corp::Role::HangarCanTake7.

292 {
293  int64 roles(pClient->GetCorpRole());
294  switch (flagID) {
295  case flagHangar: {
297  throw UserError ("RamAccessDeniedToBOMHangar");
298  } break;
299  case flagCorpHangar2: {
301  throw UserError ("RamAccessDeniedToBOMHangar");
302  } break;
303  case flagCorpHangar3: {
305  throw UserError ("RamAccessDeniedToBOMHangar");
306  } break;
307  case flagCorpHangar4: {
309  throw UserError ("RamAccessDeniedToBOMHangar");
310  } break;
311  case flagCorpHangar5: {
313  throw UserError ("RamAccessDeniedToBOMHangar");
314  } break;
315  case flagCorpHangar6: {
317  throw UserError ("RamAccessDeniedToBOMHangar");
318  } break;
319  case flagCorpHangar7: {
321  throw UserError ("RamAccessDeniedToBOMHangar");
322  } break;
323  }
324 }
int64 GetCorpRole() const
Definition: Client.h:129
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
signed __int64 int64
Definition: eve-compat.h:51

Here is the call graph for this function:

void RamMethods::InstallationCheck ( Client *const  pClient,
int32  lineLocationID 
)

Definition at line 123 of file RamMethods.cpp.

References Client::GetRegionID(), IsRegionID, and sDataMgr.

124 {
125  if (sDataMgr.IsStation(lineLocationID)) {
126  uint32 regionID = sDataMgr.GetStationRegion(lineLocationID);
127  if (!IsRegionID(regionID))
128  throw UserError ("RamIsNotAnInstallation");
129  if (pClient->GetRegionID() != regionID)
130  throw UserError ("RamRangeLimitationRegion");
131  } else {
132  // get structure data and run tests
133  // RamStructureNotInSpace
134  // RamStructureNotIsSolarsystem
135  }
136 
137  // check player skill for limits
138  // RamRangeLimitation
139  // RamRangeLimitationJumps
140  // RamRangeLimitationJumpsNoSkill
141 
142  /*
143  * jumpsPerSkillLevel =
144  * {0: -1, // station/structure
145  * 1: 0, // system
146  * 2: 5,
147  * 3: 10,
148  * 4: 20,
149  * 5: 50}
150  */
151 }
uint32 GetRegionID() const
Definition: Client.h:154
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
unsigned __int32 uint32
Definition: eve-compat.h:50
#define IsRegionID(itemID)
Definition: EVE_Defines.h:273
#define sDataMgr

Here is the call graph for this function:

void RamMethods::ItemLocationCheck ( Client *const  pClient,
const Call_InstallJob &  args,
InventoryItemRef  installedItem 
)

Definition at line 234 of file RamMethods.cpp.

References UserError::AddLocationName(), InventoryItem::flag(), flagCargoHold, flagHangar, flagPilot, Client::GetChar(), Client::GetLocationID(), Client::GetShipID(), IsHangarFlag, InventoryItem::locationID(), and sDataMgr.

235 {
236  // a lot of this is checked in client. need to verify
237  if (sDataMgr.IsStation(args.lineContainerID)) {
238  if (installedItem->locationID() != args.lineContainerID) {
239  if (args.lineContainerID == pClient->GetLocationID()) {
240  throw UserError (
241  (args.isCorpJob)
242  ? "RamCorpInstalledItemWrongLocation"
243  : "RamInstalledItemWrongLocation")
244  .AddLocationName ("location", args.lineContainerID);
245  } else {
246  throw UserError ("RamRemoteInstalledItemNotInStation");
247  }
248  } else {
249  if (args.isCorpJob) {
250  if (!IsHangarFlag(installedItem->flag())) {
251  if (args.lineContainerID == pClient->GetLocationID()) {
252  throw UserError(
253  (args.isCorpJob)
254  ? "RamCorpInstalledItemWrongLocation"
255  : "RamInstalledItemWrongLocation")
256  .AddLocationName("location", args.lineContainerID);
257  }
258  }
259  } else {
260  if (installedItem->flag() != flagHangar) {
261  if (args.lineLocationID == pClient->GetLocationID()) {
262  throw UserError ("RamInstalledItemWrongLocation")
263  .AddLocationName ("location", args.lineContainerID);
264  } else {
265  throw UserError ("RamRemoteInstalledItemInStationNotHangar");
266  }
267  }
268  }
269  }
270  } else if (args.lineContainerID == pClient->GetShipID()) {
271  if (pClient->GetChar()->flag() != flagPilot)
272  throw UserError ("RamAccessDeniedNotPilot");
273 
274  if (args.isCorpJob and (installedItem->flag() == flagCargoHold))
275  throw UserError ("RamCorpInstalledItemNotInCargo");
276 
277  if (installedItem->locationID() != args.lineContainerID)
278  throw UserError ("RamInstalledItemMustBeInShip");
279  } else {
280  /* this will be POS assembly modules and Outpost checks
281  * RamStationIsNotConstructed
282  * RamInstalledItemMustBeInInstallation
283  * RamInstalledItemBadLocationStructure
284  * RamInstalledItemInStructureNotInContainer
285  * RamInstalledItemInStructureUnknownLocation
286  */
287  throw CustomError ("R.A.M. at POS/Outpost not supported yet");
288  }
289 }
uint32 GetShipID() const
Definition: Client.h:150
uint32 GetLocationID() const
Definition: Client.h:151
CharacterRef GetChar() const
Definition: Client.h:164
Advanced version of UserError that allows to send a full custom message.
Definition: PyExceptions.h:453
* args
uint32 locationID() const
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
EVEItemFlags flag() const
#define IsHangarFlag(flag)
Definition: EVE_Defines.h:344
UserError & AddLocationName(const char *name, uint32 locationID)
Shorthand method for adding a location's name.
#define sDataMgr

Here is the call graph for this function:

void RamMethods::ItemOwnerCheck ( Client *const  pClient,
const Call_InstallJob &  args,
BlueprintRef  bpRef 
)

Definition at line 221 of file RamMethods.cpp.

References Client::GetCharacterID(), and Client::GetCorporationID().

222 {
223  // ownership
224  if (args.isCorpJob) {
225  if (bpRef->ownerID() != pClient->GetCorporationID())
226  throw UserError ("RamCannotInstallItemForAnotherCorp");
227  } else {
228  // this one is checked in client
229  if (bpRef->ownerID() != pClient->GetCharacterID())
230  throw UserError ("RamCannotInstallItemForAnother");
231  }
232 }
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetCorporationID() const
Definition: Client.h:123
* args
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121

Here is the call graph for this function:

void RamMethods::JobsCheck ( Character pChar,
const Call_InstallJob &  args 
)

Definition at line 98 of file RamMethods.cpp.

References UserError::AddAmount(), EvESkill::AdvancedLaboratoryOperation, EvESkill::AdvancedMassProduction, AttrManufactureSlotLimit, AttrMaxLaborotorySlots, FactoryDB::CountManufacturingJobs(), FactoryDB::CountResearchJobs(), EvilNumber::get_int(), InventoryItem::GetAttribute(), Character::GetSkillLevel(), InventoryItem::itemID(), EvESkill::LaboratoryOperation, EvERam::Activity::Manufacturing, and EvESkill::MassProduction.

99 {
100  if (args.activityID == EvERam::Activity::Manufacturing) {
101  uint32 jobCount = FactoryDB::CountManufacturingJobs(pChar->itemID());
102  uint charMaxJobs = pChar->GetAttribute(AttrManufactureSlotLimit).get_int()
105 
106  if (charMaxJobs <= jobCount)
107  throw UserError ("MaxFactorySlotUsageReached")
108  .AddAmount ("current", jobCount)
109  .AddAmount ("max", charMaxJobs);
110  } else {
111  uint charMaxJobs = pChar->GetAttribute(AttrMaxLaborotorySlots).get_int()
114 
115  uint32 jobCount = FactoryDB::CountResearchJobs(pChar->itemID());
116  if (charMaxJobs <= jobCount)
117  throw UserError ("MaxResearchFacilitySlotUsageReached")
118  .AddAmount ("current", jobCount)
119  .AddAmount ("max", charMaxJobs);
120  }
121 }
static uint32 CountManufacturingJobs(const uint32 installerID)
Definition: FactoryDB.cpp:554
* args
UserError & AddAmount(const char *name, int quantity)
Shorthand method for adding a quantity value.
static uint32 CountResearchJobs(const uint32 installerID)
Definition: FactoryDB.cpp:579
int64 get_int()
Definition: EvilNumber.cpp:166
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
unsigned __int32 uint32
Definition: eve-compat.h:50
EvilNumber GetAttribute(const uint16 attrID) const
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
Definition: Character.cpp:575
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

void RamMethods::LinePermissionCheck ( Client *const  pClient,
const Call_InstallJob &  args 
)
Todo:
corp secStatus???? didnt know that was a thing.

Definition at line 153 of file RamMethods.cpp.

References EvERam::LineRestrictions::activityID, EvERam::RestrictionMask::ByAlliance, EvERam::RestrictionMask::ByCorp, EvERam::RestrictionMask::BySecurity, EvERam::RestrictionMask::ByStanding, Corp::Role::CanRentFactorySlot, Corp::Role::CanRentResearchSlot, Character::corpSecRating(), Corp::Role::Director, Corp::Role::FactoryManager, Client::GetAllianceID(), FactoryDB::GetAssemblyLineRestrictions(), Client::GetChar(), Client::GetCorporationID(), Client::GetCorpRole(), Client::GetSecurityRating(), StandingDB::GetStanding(), Character::GetStandingModified(), EvERam::Activity::Invention, EvERam::Activity::Manufacturing, EvERam::LineRestrictions::maxCharSec, EvERam::LineRestrictions::maxCorpSec, EvERam::LineRestrictions::minCharSec, EvERam::LineRestrictions::minCorpSec, EvERam::LineRestrictions::minStanding, EvERam::LineRestrictions::ownerID, and EvERam::LineRestrictions::rMask.

154 {
155  // get properties
157  if (!FactoryDB::GetAssemblyLineRestrictions(args.AssemblyLineID, data))
158  throw UserError ("RamInstallationHasNoDefaultContent");
159 
160  // check validity of activity
163  throw UserError ("RamAssemblyLineHasNoActivity");
164 
165  // verify corp roles
166  if (args.isCorpJob) {
167  int64 roles(pClient->GetCorpRole());
168  // check slot rental permissions first
169  if (args.activityID == EvERam::Activity::Manufacturing) {
171  throw UserError ("RamCannotInstallWithoutRentFactorySlot");
172  } else {
174  throw UserError ("RamCannotInstallWithoutRentResearchSlot");
175  }
177  throw UserError ("RamCannotInstallForCorpByRoleFactoryManager");
179  throw UserError ("RamCannotInstallForCorpByRole");
180  }
181 
182  // check usage restriction
184  if (data.ownerID != pClient->GetAllianceID())
185  throw UserError ("RamAccessDeniedWrongAlliance");
186  }
188  if (data.ownerID != pClient->GetCorporationID())
189  throw UserError ("RamAccessDeniedWrongCorp");
190  }
191 
192  // check standing
194  // get standings
195  if (args.isCorpJob) {
196  if (data.minStanding > StandingDB::GetStanding(data.ownerID, pClient->GetCorporationID()))
197  throw UserError ("RamAccessDeniedCorpStandingTooLow");
198  } else {
199  if (data.minStanding > pClient->GetChar()->GetStandingModified(data.ownerID))
200  throw UserError ("RamAccessDeniedStandingTooLow");
201  }
202  }
203 
204  // check security rating
206  if (args.isCorpJob) {
208  if (data.minCorpSec > pClient->GetChar()->corpSecRating())
209  throw UserError ("RamAccessDeniedCorpSecStatusTooLow");
210  if (data.maxCorpSec < pClient->GetChar()->corpSecRating())
211  throw UserError ("RamAccessDeniedCorpSecStatusTooHigh");
212  } else {
213  if (data.minCharSec > pClient->GetSecurityRating())
214  throw UserError ("RamAccessDeniedSecStatusTooLow");
215  if (data.maxCharSec < pClient->GetSecurityRating())
216  throw UserError ("RamAccessDeniedSecStatusTooHigh");
217  }
218  }
219 }
static float GetStanding(uint32 fromID, uint32 toID)
Definition: StandingDB.cpp:142
float GetSecurityRating() const
Definition: Client.h:172
int64 GetCorpRole() const
Definition: Client.h:129
int32 GetCorporationID() const
Definition: Client.h:123
float corpSecRating() const
Definition: Character.h:306
CharacterRef GetChar() const
Definition: Client.h:164
int32 GetAllianceID() const
Definition: Client.h:125
* args
float GetStandingModified(uint32 fromID, uint32 toID=0)
Definition: Character.cpp:1363
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
signed __int64 int64
Definition: eve-compat.h:51
static bool GetAssemblyLineRestrictions(const int32 assemblyLineID, EvERam::LineRestrictions &data)
Definition: FactoryDB.cpp:481

Here is the call graph for this function:

void RamMethods::LocationRolesCheck ( Client *const  pClient,
const CorpPathElement &  data 
)
Todo:
determine what roles are required here and test
Todo:
finish this.

Definition at line 326 of file RamMethods.cpp.

References Client::GetCorpHQ(), Client::GetRolesAtHQ(), and STATION_OFFICE_OFFSET.

327 {
328  int64 roles(0);
329  // this will verify corp roles at location
330  uint32 stationID(data.officeFolderID - STATION_OFFICE_OFFSET);
331  if (stationID == pClient->GetCorpHQ()) {
332  roles = pClient->GetRolesAtHQ();
334  } else {
335  // not hq is this a base?
337  }
338 
339 }
int32 GetCorpHQ() const
Definition: Client.h:124
int64 GetRolesAtHQ() const
Definition: Client.h:135
unsigned __int32 uint32
Definition: eve-compat.h:50
signed __int64 int64
Definition: eve-compat.h:51
#define STATION_OFFICE_OFFSET
Definition: EVE_Defines.h:177

Here is the call graph for this function:

void RamMethods::MaterialSkillsCheck ( Client *const  pClient,
uint32  runs,
const PathElement &  bomLocation,
const Rsp_InstallJob &  rsp,
const std::vector< EvERam::RequiredItem > &  reqItems 
)

Definition at line 341 of file RamMethods.cpp.

References UserError::AddFormatValue(), GetBOMItemsMap(), Client::GetChar(), Character::GetSkillLevel(), and items.

342 {
343  std::map<uint16, InventoryItemRef> items; // typeID, itemRef
344  GetBOMItemsMap( bomLocation, items );
345 
346  for (auto cur : reqItems) {
347  if (cur.isSkill) { // check skill (quantity is required level)
348  if (pClient->GetChar()->GetSkillLevel(cur.typeID) < cur.quantity) {
349  throw UserError ("RamNeedSkillForJob")
350  .AddFormatValue ("skillID", new PyInt (cur.typeID))
351  .AddFormatValue ("skillLevel", new PyInt (cur.quantity));
352  }
353  } else {
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();
362  else
363  qtyNeeded = 0;
364  }
365 
366  if (qtyNeeded)
367  throw UserError ("RamNeedMoreForJob")
368  .AddFormatValue ("item", new PyInt (cur.typeID));
369  }
370  }
371 }
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
CharacterRef GetChar() const
Definition: Client.h:164
Python integer.
Definition: PyRep.h:231
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
unsigned __int32 uint32
Definition: eve-compat.h:50
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
Definition: Character.cpp:575
void GetBOMItemsMap(const PathElement &bomLocation, std::map< uint16, InventoryItemRef > &into)
Definition: RamMethods.cpp:581
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

Here is the call graph for this function:

void RamMethods::ProductionTimeCheck ( uint32  productionTime)

Definition at line 373 of file RamMethods.cpp.

References UserError::AddFormatValue(), and RAM_PRODUCTION_TIME_LIMIT.

374 {
375  if (productionTime > RAM_PRODUCTION_TIME_LIMIT)
376  throw UserError ("RamProductionTimeExceedsLimits")
377  .AddFormatValue ("productionTime", new PyInt (productionTime))
379 }
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
Python integer.
Definition: PyRep.h:231
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
static const uint32 RAM_PRODUCTION_TIME_LIMIT
Definition: RamMethods.cpp:18

Here is the call graph for this function:

void RamMethods::VerifyCompleteJob ( const Call_CompleteJob &  args,
EvERam::JobProperties data,
Client *const  pClient 
)

Definition at line 381 of file RamMethods.cpp.

References EvERam::JobProperties::endTime, Corp::Role::FactoryManager, InventoryItem::flag(), flagPilot, Client::GetChar(), Client::GetCorporationID(), Client::GetCorpRole(), GetFileTimeNow(), Client::GetShipID(), EvERam::Status::InProgress, IsCorp, EvERam::JobProperties::ownerID, and EvERam::JobProperties::status.

382 {
383  // this isnt entirely right....if job is installed in ship, receiver must be pilot in active ship to complete job.
384  if (args.containerID == pClient->GetShipID())
385  if (pClient->GetChar()->flag() != flagPilot)
386  throw UserError ("RamCompletionMustBeInShip");
387 
388  if (IsCorp(data.ownerID)) {
389  if (data.ownerID == pClient->GetCorporationID()) {
391  throw UserError ("RamCompletionAccessDeniedByCorpRole");
392  } else // alliances not implemented
393  throw UserError ("RamCompletionAccessDenied");
394  }
395 
397  throw UserError ("RamCompletionJobCompleted");
398 
399  if (!args.cancel and (data.endTime > GetFileTimeNow()))
400  throw UserError ("RamCompletionJobCompleted");
401 }
uint32 GetShipID() const
Definition: Client.h:150
int64 GetCorpRole() const
Definition: Client.h:129
int32 GetCorporationID() const
Definition: Client.h:123
CharacterRef GetChar() const
Definition: Client.h:164
* args
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
EVEItemFlags flag() const
#define IsCorp(itemID)
Definition: EVE_Defines.h:234
double GetFileTimeNow()
Definition: utils_time.cpp:84

Here is the call graph for this function:


The documentation for this class was generated from the following files: