PyDict *Character::CharGetInfo() { //TODO: verify that we are a char? if( !LoadContents( m_factory ) ) { codelog(ITEM__ERROR, "%s (%u): Failed to load contents for CharGetInfo", m_itemName.c_str(), m_itemID); return NULL; } PyDict *result = new PyDict; Rsp_CommonGetInfo_Entry entry; if(!Populate(entry)) return NULL; result->SetItem(new PyInt(m_itemID), new PyObject("util.KeyVal", entry.Encode())); //now encode skills... std::vector<InventoryItemRef> skills; //find all the skills contained within ourself. FindByFlag( flagSkill, skills ); FindByFlag( flagSkillInTraining, skills ); //encode an entry for each one. std::vector<InventoryItemRef>::iterator cur, end; cur = skills.begin(); end = skills.end(); for(; cur != end; cur++) { if(!(*cur)->Populate(entry)) { codelog(ITEM__ERROR, "%s (%u): Failed to load skill item %u for CharGetInfo", m_itemName.c_str(), itemID(), (*cur)->itemID()); } else { result->SetItem(new PyInt((*cur)->itemID()), new PyObject("util.KeyVal", entry.Encode())); } } return result; }
PyObject *Character::CharGetInfo() { //TODO: verify that we are a char? if( !LoadContents( m_factory ) ) { codelog(ITEM__ERROR, "%s (%u): Failed to load contents for CharGetInfo", m_itemName.c_str(), m_itemID); return NULL; } Rsp_CommonGetInfo result; Rsp_CommonGetInfo_Entry entry; //first encode self. if(!Populate(entry)) return NULL; //print already done. result.items[m_itemID] = entry.Encode(); //now encode skills... std::vector<InventoryItemRef> skills; // Check that there are not expired boosters CheckBoosters(); // find all the skills located at our character's brain( AKA locationID = characterID ) FindByFlag( flagSkill, skills ); FindByFlag( flagSkillInTraining, skills ); FindByFlag( flagImplant, skills ); FindByFlag( flagBooster, skills ); //encode an entry for each one. std::vector<InventoryItemRef>::iterator cur, end; cur = skills.begin(); end = skills.end(); for(; cur != end; cur++) { if(!(*cur)->Populate(entry)) { codelog(ITEM__ERROR, "%s (%u): Failed to load skill item %u for CharGetInfo", m_itemName.c_str(), itemID(), (*cur)->itemID()); } else { result.items[(*cur)->itemID()] = entry.Encode(); } } return(result.Encode()); }
double Inventory::GetStoredVolume(EVEItemFlags locationFlag) const { //TODO: And implement Sizes for packaged ships std::vector<InventoryItemRef> items; std::vector<InventoryItemRef>::iterator cur, end; items.clear(); FindByFlag(locationFlag,items); cur = items.begin(); end = items.end(); EvilNumber totalVolume(0.0); for(; cur != end; cur++) totalVolume += ((*cur)->GetAttribute(AttrVolume) * (*cur)->quantity()); // this is crap... bleh... as it should return a EvilNumber return totalVolume.get_float(); }
void Character::GetSkillsList(std::vector<InventoryItemRef> &skills) const { //find all the skills contained within ourself. FindByFlag( flagSkill, skills ); FindByFlag( flagSkillInTraining, skills ); }