32 #include "packets/Repair.h"
91 _log(CLIENT__MESSAGE,
"RepairService bind request for:");
92 bind_args->
Dump(CLIENT__MESSAGE,
" ");
102 _log(PHYSICS__INFO,
"RepairSvcBound::Handle_DamageModules() size= %u", call.
tuple->
size() );
103 call.
Dump(PHYSICS__INFO);
105 Call_SingleIntList
args;
106 if (!args.Decode(&call.
tuple)) {
125 Call_RepairItems
args;
126 if (!args.Decode(&call.
tuple)) {
130 if (args.iskAmount < 0.01)
139 double cost(0), total(0);
141 std::vector<InventoryItemRef> itemRefVec;
143 for (; itr != end; ++itr) {
145 if (iRef.get() ==
nullptr)
150 itemRefVec.push_back(iRef);
151 if (iRef->IsShipItem()) {
154 cost = (iRef->type().basePrice() *
sConfig.rates.ShipRepairModifier);
157 cost = (iRef->type().basePrice() *
sConfig.rates.ModuleRepairModifier);
162 float fraction = 1.0;
163 if (args.iskAmount < total)
164 fraction = total / args.iskAmount;
184 for (
auto cur : itemRefVec) {
185 if (cur->IsShipItem()) {
194 curDamage = cHull + cArmor;
195 toRepair = curDamage * fraction;
197 if (toRepair > cHull) {
200 if (toRepair >= cArmor) {
203 toRepair = cArmor - toRepair;
214 if ((cur->GetAttribute(
AttrDamage).get_float() / cur->GetAttribute(
AttrHP).get_float()) > fraction) {
215 toRepair = cur->GetAttribute(
AttrHP) * fraction;
236 Call_SingleIntList
args;
237 if (!args.Decode(&call.
tuple)) {
246 float standing = 0.0f;
254 for (
auto cur : args.ints) {
257 rlr.serviceCharge =
"0%";
258 rlr.playerStanding = standing;
268 std::vector<InventoryItemRef> itemRefVec;
270 if (iRef.
get() ==
nullptr) {
272 if (iRef.
get() ==
nullptr)
275 itemRefVec.push_back(iRef);
284 for (
auto cur : itemRefVec) {
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();
293 if (cur->IsShipItem()) {
295 rid.maxHealth += cur->GetAttribute(
AttrArmorHP).get_int();
297 rid.costToRepairOneUnitOfDamage = (cur->type().basePrice() *
sConfig.rates.ShipRepairModifier);
300 rid.costToRepairOneUnitOfDamage = (cur->type().basePrice() *
sConfig.rates.ModuleRepairModifier);
334 Call_UnasembleItems
args;
335 if (!args.Decode(&call.
tuple)) {
339 args.Dump(PHYSICS__INFO);
346 if (args.list->size() > 0)
353 pList = dictItr->second->AsList();
354 if (pList !=
nullptr) {
358 tuple = (*listItr)->AsTuple();
359 if (tuple !=
nullptr) {
364 if (iRef.get() !=
nullptr) {
374 if (iRef->IsShipItem()) {
375 iRef->GetShipItem()->EmptyCargo();
376 iRef->GetShipItem()->StripFitting();
381 iRef->ChangeSingleton(
false,
true);
#define sConfig
A macro for easier access to the singleton.
Dispatcher *const m_dispatch
#define IsNPCCorp(itemID)
virtual ~RepairSvcBound()
#define _log(type, fmt,...)
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
void GetModuleItemVec(std::vector< InventoryItemRef > &iRefVec)
int32 GetCharacterID() const
static void GetDamageReports(uint32 itemID, Inventory *pInv, PyList *list)
storage_type::const_iterator const_iterator
static uint32 IntegerValueU32(PyRep *pRep)
std::string m_strBoundObjectName
this is a class that kinda mimics how python polymorph's numbers.
CharacterRef GetChar() const
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
void _SetCallDispatcher(CallDispatcher *d)
Dispatcher *const m_dispatch
#define codelog(type, fmt,...)
PyCallable_Make_Dispatcher(RepairSvcBound) RepairSvcBound(PyServiceMgr *mgr
SystemManager * SystemMgr() const
static void DeleteInsuranceByShipID(uint32 shipID)
float GetStandingModified(uint32 fromID, uint32 toID=0)
PyServiceMgr *const m_manager
float GetNPCCorpStanding(uint32 fromID, uint32 toID=0)
virtual ShipItem * GetShipItem()
const char * GetName() const
#define PyCallable_REG_CALL(c, m)
Dispatcher *const m_dispatch
StationItemRef GetStationFromInventory(uint32 stationID)
storage_type::const_iterator const_iterator
PyCallable_Make_InnerDispatcher(RepairService) RepairService
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
PyCallable_DECL_CALL(GetDamageReports)
static int64 IntegerValue(PyRep *pRep)
void GetModuleRefVec(std::vector< InventoryItemRef > &iRefVec)
Inventory * GetMyInventory()
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
virtual bool IsShipItem()
InventoryItemRef GetByID(uint32 id) const