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

#include "RepairService.h"

Inheritance diagram for RepairService:
Collaboration diagram for RepairService:

Public Member Functions

 RepairService (PyServiceMgr *mgr)
 
virtual ~RepairService ()
 
- Public Member Functions inherited from PyService
 PyService (PyServiceMgr *mgr, const char *serviceName)
 
virtual ~PyService ()
 
virtual PyResult Call (const std::string &method, PyCallArgs &args)
 
const char * GetName () const
 
- Public Member Functions inherited from PyCallable
 PyCallable ()
 
virtual ~PyCallable ()
 

Static Public Member Functions

static void GetDamageReports (uint32 itemID, Inventory *pInv, PyList *list)
 

Protected Member Functions

virtual PyBoundObjectCreateBoundObject (Client *pClient, const PyRep *bind_args)
 
 PyCallable_DECL_CALL (UnasembleItems)
 
- Protected Member Functions inherited from PyService
PyObject_BuildCachedReturn (PySubStream **result, const char *sessionInfo, CacheCheckTime check)
 
virtual PyResult Handle_MachoResolveObject (PyCallArgs &call)
 
virtual PyResult Handle_MachoBindObject (PyCallArgs &call)
 
- Protected Member Functions inherited from PyCallable
void _SetCallDispatcher (CallDispatcher *d)
 

Protected Attributes

Dispatcher *const m_dispatch
 
- Protected Attributes inherited from PyService
PyServiceMgr *const m_manager
 

Additional Inherited Members

- Protected Types inherited from PyService
enum  CacheCheckTime {
  check_Always = 0, check_Never, check_in_year, check_in_6_months,
  check_in_3_months, check_in_1_month, check_in_1_week, check_in_1_day,
  check_in_12_hours, check_in_6_hours, check_in_3_hours, check_in_2_hours,
  check_in_1_hour, check_in_30_minutes, check_in_15_minutes, check_in_5_minutes,
  check_in_1_minute, check_in_30_seconds, check_in_15_seconds, check_in_5_seconds,
  check_in_1_second, _checkCount
}
 
- Static Protected Attributes inherited from PyService
static const char *const s_checkTimeStrings [_checkCount]
 

Detailed Description

Definition at line 34 of file RepairService.h.

Constructor & Destructor Documentation

RepairService::RepairService ( PyServiceMgr mgr)
RepairService::~RepairService ( )
virtual

Definition at line 86 of file RepairService.cpp.

References m_dispatch.

86  {
87  delete m_dispatch;
88 }
Dispatcher *const m_dispatch
Definition: RepairService.h:42

Member Function Documentation

PyBoundObject * RepairService::CreateBoundObject ( Client pClient,
const PyRep bind_args 
)
protectedvirtual

Reimplemented from PyService.

Definition at line 90 of file RepairService.cpp.

References _log, PyRep::AsInt(), PyRep::Dump(), PyService::m_manager, and PyInt::value().

90  {
91  _log(CLIENT__MESSAGE, "RepairService bind request for:");
92  bind_args->Dump(CLIENT__MESSAGE, " ");
93 
94  return new RepairSvcBound(m_manager, bind_args->AsInt()->value());
95 }
#define _log(type, fmt,...)
Definition: logsys.h:124
int32 value() const
Definition: PyRep.h:247
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
PyServiceMgr *const m_manager
Definition: PyService.h:91
PyInt * AsInt()
Definition: PyRep.h:122

Here is the call graph for this function:

void RepairService::GetDamageReports ( uint32  itemID,
Inventory pInv,
PyList list 
)
static

Definition at line 267 of file RepairService.cpp.

References PyList::AddItem(), AttrArmorDamage, AttrArmorHP, AttrDamage, AttrHP, RefPtr< X >::get(), Inventory::GetByID(), ShipItem::GetModuleItemVec(), ShipItem::GetModuleRefVec(), InventoryItem::GetShipItem(), ShipItem::IsActive(), InventoryItem::IsShipItem(), sConfig, and sItemFactory.

267  {
268  std::vector<InventoryItemRef> itemRefVec;
269  InventoryItemRef iRef = pInv->GetByID(itemID);
270  if (iRef.get() == nullptr) {
271  iRef = sItemFactory.GetItem(itemID);
272  if (iRef.get() == nullptr)
273  return;
274  }
275  itemRefVec.push_back(iRef);
276  if (iRef->IsShipItem()) {
277  if (iRef->GetShipItem()->IsActive()) {
278  iRef->GetShipItem()->GetModuleRefVec(itemRefVec);
279  } else {
280  iRef->GetShipItem()->GetModuleItemVec(itemRefVec);
281  }
282  }
283 
284  for (auto cur : itemRefVec) {
285  RepairItemData rid;
286  rid.itemID = cur->itemID();
287  rid.typeID = cur->typeID();
288  rid.groupID = cur->groupID();
289  rid.damage = cur->GetAttribute(AttrDamage).get_int();
290  rid.maxHealth = cur->GetAttribute(AttrHP).get_int();
291  // not sure how to find this data
292  rid.repairable = 1;
293  if (cur->IsShipItem()) { // have to check for drone here, also
294  rid.damage += cur->GetAttribute(AttrArmorDamage).get_int();
295  rid.maxHealth += cur->GetAttribute(AttrArmorHP).get_int();
296  // ship is (basePrice)*7.5e-10
297  rid.costToRepairOneUnitOfDamage = (cur->type().basePrice() * sConfig.rates.ShipRepairModifier);
298  } else {
299  // modules are (basePrice)*1.25e-6
300  rid.costToRepairOneUnitOfDamage = (cur->type().basePrice() * sConfig.rates.ModuleRepairModifier);
301  }
302 
303  list->AddItem(rid.Encode());
304  }
305 }
#define sConfig
A macro for easier access to the singleton.
void GetModuleItemVec(std::vector< InventoryItemRef > &iRefVec)
Definition: Ship.cpp:568
void AddItem(PyRep *i)
Definition: PyRep.h:701
X * get() const
Definition: RefPtr.h:213
virtual ShipItem * GetShipItem()
Definition: InventoryItem.h:82
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
bool IsActive()
Definition: Ship.h:147
#define sItemFactory
Definition: ItemFactory.h:165
void GetModuleRefVec(std::vector< InventoryItemRef > &iRefVec)
Definition: Ship.cpp:577
virtual bool IsShipItem()
Definition: InventoryItem.h:85
InventoryItemRef GetByID(uint32 id) const
Definition: Inventory.cpp:415

Here is the call graph for this function:

RepairService::PyCallable_DECL_CALL ( UnasembleItems  )
protected

Member Data Documentation

Dispatcher* const RepairService::m_dispatch
protected

Definition at line 42 of file RepairService.h.

Referenced by ~RepairService().


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