43 #include "packets/Manufacturing.h"
64 if (!bind_args->
IsInt()) {
65 _log(SERVICE__ERROR,
"%s: Non-integer bind argument '%s'", pClient->
GetName(), bind_args->
TypeString());
70 if (!
sDataMgr.IsStation(stationID)) {
71 _log(SERVICE__ERROR,
"%s: Expected stationID, but got %u.", pClient->
GetName(), stationID);
84 m_staEfficiency(0.0f),
112 _log(MANUF__INFO,
"%s: Calling GetOptionsForItemTypes().", call.
client->
GetName());
113 call.
Dump(MANUF__DUMP);
115 Call_GetOptionsForItemTypes
args;
116 if (!args.Decode(&call.
tuple)) {
117 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
122 Rsp_GetOptionsForItemTypes rsp;
123 Rsp_GetOptionsForItemTypes_Arg arg;
125 for (
auto cur : args.typeIDs) {
126 arg.isRecyclable =
sDataMgr.IsRecyclable(cur.first);
127 arg.isRefinable =
sDataMgr.IsRefinable(cur.first);
128 rsp.typeIDs[cur.first] = arg.Encode();
136 Rsp_GetReprocessingInfo rsp;
138 rsp.tax =
CalcTax( rsp.standing );
145 Call_SingleIntegerArg arg;
146 if (!arg.Decode(&call.
tuple)) {
147 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
158 if (!args.Decode(&call.
tuple)) {
159 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
165 for (
auto cur : args.itemIDs) {
167 if (quote !=
nullptr)
168 rsp.quotes[cur] = quote;
176 _log(MANUF__WARNING,
"Character %s tried to reprocess, but isn't is station.", call.
client->
GetName());
181 call.
Dump(MANUF__DUMP);
184 if (!args.Decode(&call.
tuple)) {
185 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
190 if (args.ownerID == 0)
198 _log(MANUF__WARNING,
"%s(%u) doesnt have FactoryManager role to access materials for reprocessing.", \
200 call.
client->
SendErrorMsg(
"You do not have the role \'Factory Manager\' which is required to access factory services on behalf of a corporation.");
210 for (
auto cur : args.items) {
212 if (iRef.get() ==
nullptr)
216 if (iRef->type().portionSize() > iRef->quantity()) {
217 throw UserError (
"QuantityLessThanMinimumPortion")
219 .AddAmount (
"portion", iRef->type ().portionSize ());
225 std::vector<Recoverable> recoverables;
229 std::vector<Recoverable>::iterator itr = recoverables.begin();
230 for (; itr != recoverables.end(); ++itr) {
231 uint32 full = itr->amountPerBatch * iRef->quantity() / iRef->type().portionSize();
232 uint32 quantity =
uint32(full * efficiency * (1.0f - tax) );
238 if (iRef2.
get() ==
nullptr)
245 uint32 qtyLeft = iRef->quantity() % iRef->type().portionSize();
247 iRef->SetQuantity(qtyLeft,
true);
267 double efficiency = (0.375f
271 if (item.
get() !=
nullptr) {
274 efficiency *= (1 + 0.05f * cRef->
GetSkillLevel(specificSkill));
282 if (efficiency > 1.0f)
290 if (iRef.
get() ==
nullptr)
301 _log(MANUF__WARNING,
"%s(%u) doesnt have FactoryManager role to access materials for reprocessing.", \
303 pClient->
SendErrorMsg(
"You do not have the role \'Factory Manager\' which is required to access factory services on behalf of a corporation.");
312 pClient->
SendErrorMsg(
"The requested item is not yours.");
317 throw UserError (
"QuantityLessThanMinimumPortion")
322 std::vector<Recoverable> recoverables;
327 quote.lines =
new PyList();
329 quote.quantityToProcess = iRef->
quantity() - quote.leftOvers;
332 double tax =
CalcTax( quote.playerStanding );
335 for (
auto cur :recoverables) {
337 Rsp_GetQuote_Recoverables_Line line;
338 line.typeID = cur.typeID;
339 line.client =
uint32(efficiency * (1.0f - tax) * ratio);
340 line.station =
uint32(efficiency * tax * ratio);
341 line.unrecoverable = ratio - line.client - line.station;
342 quote.lines->AddItem( line.Encode() );
345 return quote.Encode();
352 if (standing < 0.0f) {
364 float tax =
m_tax - 0.75f / 100.0f * standing;
static float GetStanding(uint32 fromID, uint32 toID)
Dispatcher *const m_dispatch
float CalcReprocessingEfficiency(const Client *pClient, InventoryItemRef item=InventoryItemRef(nullptr)) const
uint32 GetLocationID() const
void SendErrorMsg(const char *fmt,...)
#define _log(type, fmt,...)
int64 GetCorpRole() const
virtual void RemoveItem(InventoryItemRef iRef)
void GetRefineData(uint32 &stationCorpID, float &staEfficiency, float &tax)
UserError & AddTypeName(const char *name, uint32 typeID)
Shorthand method for adding a type's name.
int32 GetCharacterID() const
StationItemRef m_stationRef
int32 GetCorporationID() const
std::string m_strBoundObjectName
CharacterRef GetChar() const
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
void Move(uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
PyRep * GetQuote(uint32 itemID, Client *pClient)
void _SetCallDispatcher(CallDispatcher *d)
const ItemType & type() const
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
uint16 portionSize() const
#define codelog(type, fmt,...)
PyServiceMgr *const m_manager
const char * GetName() const
Python object "ccp_exceptions.UserError".
#define PyCallable_REG_CALL(c, m)
int64 GetRolesAtAll() const
EVEItemFlags flag() const
PyCallable_Make_InnerDispatcher(ReprocessingService) PyCallable_Make_InnerDispatcher(ReprocessingServiceBound) ReprocessingService
bool GetRecoverables(const uint32 typeID, std::vector< Recoverable > &into)
int64 max(int64 x, int64 y=0)
Dispatcher *const m_dispatch
virtual ~ReprocessingService()
EvilNumber GetAttribute(const uint16 attrID) const
float GetStanding(const Client *pClient) 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
int8 GetSkillLevel(uint16 skillTypeID, bool zeroForNotInjected=true) const
float CalcTax(float standing) const
ReprocessingServiceBound(PyServiceMgr *mgr, ReprocessingDB &db, uint32 stationID)
const char * TypeString() const
Dispatcher *const m_dispatch
const char * GetName() const
virtual ~ReprocessingServiceBound()