/** * this function isn't used. */ void DBResultToIntIntlistDict( DBQueryResult &result, std::map<int32, PyRep *> &into ) { /* this builds a map from the int in result[0], to a list of each result[1] * which is has the same result[0]. This function assumes the result is * ORDER BY result[0] */ uint32 last_key = 0xFFFFFFFF; PyList *l = NULL; DBResultRow row; while( result.GetRow( row ) ) { uint32 k = row.GetUInt(0); if( k != last_key ) { //watch for overwrite, no guarantee we are dealing with a key. std::map<int32, PyRep *>::iterator res = into.find(k); if( res != into.end() ) //log an error or warning? PyDecRef( res->second ); into[k] = l = new PyList(); last_key = k; } l->AddItemInt( row.GetInt( 1 ) ); } }
void ItemAttributeMgr::SetIntEx(Attr attr, const int_t &v, bool persist) { PyRep *oldValue = NULL; if(GetNotify() == true && !IsRechargable(attr)) { // get old value oldValue = PyGet(attr); } // set the attribute value EVEAdvancedAttributeMgr::SetInt(attr, v); // check if we shall save to DB if(GetSave() == true && (persist || IsPersistent(attr))) { // save to DB m_factory.db().UpdateAttribute_int(m_item.itemID(), attr, v); } if(GetNotify() == true) { std::map<Attr, TauCap>::const_iterator i = m_tauCap.find(attr); if(i != m_tauCap.end()) { // build the special list for rechargables PyList *l = new PyList; l->AddItemInt( v ); l->AddItemLong( Win32TimeNow() ); l->AddItem( _PyGet( GetReal( i->second.tau ) / 5.0 ) ); l->AddItem( PyGet( i->second.cap ) ); oldValue = l; } // send change _SendAttributeChange(attr, oldValue, new PyFloat(v)); } }
PyList *TargetManager::GetTargeters() const { PyList *result = new PyList(); std::map<SystemEntity *, TargetedByEntry *>::const_iterator cur, end; cur = m_targetedBy.begin(); end = m_targetedBy.end(); for(; cur != end; cur++) result->AddItemInt( cur->first->GetID() ); return result; }
PyResult InfoGatheringMgr::Handle_GetStateAndConfig(PyCallArgs &call) { PyDict *rsp = new PyDict; rsp->SetItemString("clientWorkerInterval", new PyInt(600000)); //Default From packetlogs is 600000 rsp->SetItemString("isEnabled", new PyInt(0)); //0 = Disabled, 1 = Enabled. Set to 0 becuase jsut gettting rid of exception. rsp->SetItemString("infoTypeAggregates", new PyNone()); rsp->SetItemString("infoTypesOncePerRun", new PyNone()); rsp->SetItemString("infoTypeParameters", new PyNone()); PyList *infoTypes = new PyList; infoTypes->AddItemInt(999); //Adding a value that was not in live so when its checks list it will always return false for now. rsp->SetItemString("infoTypes", new PyObjectEx_Type1( new PyToken("__builtin__.set"), new_tuple(infoTypes))); return new PyObject( "util.KeyVal", rsp ); }
PyResult ContractMgrService::Handle_GetContractList( PyCallArgs& call ) { sLog.Debug( "ContractMgrService", "Called GetContractListForOwner stub." ); // Call_GetContractListForOwner arg; PyDict* _contract = new PyDict; /*if( !arg.Decode(&call.tuple) ) { codelog(SERVICE__ERROR, "%s: Bad arguments to GetContractListForOwner", call.client->GetName()); return NULL; }*/ // Manual creation of a CRowset, i hate doing this -.-" DBRowDescriptor *header = new DBRowDescriptor(); header->AddColumn( "contractID", DBTYPE_I4); header->AddColumn( "issuerID", DBTYPE_I4); header->AddColumn( "issuerCorpID", DBTYPE_I4 ); header->AddColumn( "type", DBTYPE_UI1 ); header->AddColumn( "availability", DBTYPE_I4 ); header->AddColumn( "assigneeID", DBTYPE_I4 ); header->AddColumn( "numDays", DBTYPE_I4 ); header->AddColumn( "startStationID", DBTYPE_I4 ); header->AddColumn( "endStationID", DBTYPE_I4 ); header->AddColumn( "startSolarSystemID", DBTYPE_I4 ); header->AddColumn( "endSolarSystemID", DBTYPE_I4 ); header->AddColumn( "startRegionID", DBTYPE_I4 ); header->AddColumn( "endRegionID", DBTYPE_I4 ); header->AddColumn( "price", DBTYPE_CY ); header->AddColumn( "reward", DBTYPE_CY ); header->AddColumn( "collateral", DBTYPE_CY ); header->AddColumn( "title", DBTYPE_WSTR ); header->AddColumn( "description", DBTYPE_WSTR ); header->AddColumn( "forCorp", DBTYPE_BOOL ); header->AddColumn( "status", DBTYPE_UI1 ); header->AddColumn( "acceptorID", DBTYPE_I4 ); header->AddColumn( "dateIssued", DBTYPE_FILETIME ); header->AddColumn( "dateExpired", DBTYPE_FILETIME ); header->AddColumn( "dateAccepted", DBTYPE_FILETIME ); header->AddColumn( "dateCompleted", DBTYPE_FILETIME ); header->AddColumn( "volume", DBTYPE_R8 ); header->AddColumn( "issuerAllianceID", DBTYPE_I4 ); header->AddColumn( "issuerWalletKey", DBTYPE_I4 ); CRowSet *rowset = new CRowSet( &header ); PyList* fieldData = new PyList; DBResultRow row; std::map<uint32, ContractRef>::const_iterator cur, end; std::map<uint32, ContractRef> contracts = m_contractManager->GetContractList(); cur = contracts.begin(); end = contracts.end(); util_Rowset res; for(; cur != end; cur++ ) { ContractRef contract = cur->second; PyPackedRow* into = rowset->NewRow(); fieldData->AddItemInt( contract->contractID() ); fieldData->AddItemInt( contract->issuerID() ); fieldData->AddItemInt( contract->issuerCorpID() ); fieldData->AddItemInt( contract->type() ); fieldData->AddItemInt( contract->avail() ); fieldData->AddItemInt( contract->assigneeID() ); fieldData->AddItemInt( contract->expiretime() ); fieldData->AddItemInt( contract->duration() ); fieldData->AddItemInt( contract->startStationID() ); fieldData->AddItemInt( contract->endStationID() ); fieldData->AddItemInt( contract->startSolarSystemID() ); fieldData->AddItemInt( contract->endSolarSystemID() ); fieldData->AddItemInt( contract->startRegionID() ); fieldData->AddItemInt( contract->endRegionID() ); fieldData->AddItemInt( contract->price() ); fieldData->AddItemInt( contract->reward() ); fieldData->AddItemInt( contract->collateral() ); fieldData->AddItemString( contract->title().c_str() ); fieldData->AddItemString( contract->description().c_str() ); fieldData->AddItemInt( contract->forCorp() ); fieldData->AddItemInt( contract->status() ); fieldData->AddItemInt( contract->isAccepted() ); fieldData->AddItemInt( contract->acceptorID() ); fieldData->AddItemInt( contract->dateIssued() ); fieldData->AddItemInt( contract->dateExpired() ); fieldData->AddItemInt( contract->dateAccepted() ); fieldData->AddItemInt( contract->dateCompleted() ); fieldData->AddItemInt( contract->volume() ); into->SetField( contract->contractID(), fieldData ); fieldData = new PyList; res.lines = new PyList; res.header.clear(); fieldData = new PyList; res.header.push_back( "itemTypeID" ); res.header.push_back( "quantity" ); res.header.push_back( "inCrate" ); std::map<uint32, ContractRequestItemRef>::const_iterator rCur, rEnd; for(; rCur != rEnd; rCur++ ) { fieldData->AddItemInt( rCur->second->m_typeID ); fieldData->AddItemInt( rCur->second->m_quantity ); fieldData->AddItemInt( false ); res.lines->AddItem( fieldData ); fieldData = new PyList; } std::map<uint32, ContractGetItemsRef>::const_iterator iCur, iEnd; for(; iCur != iEnd; iCur++ ) { fieldData->AddItemInt( iCur->second->m_itemID ); fieldData->AddItemInt( iCur->second->m_quantity ); fieldData->AddItemInt( true ); res.lines->AddItem( fieldData ); fieldData = new PyList; } } _contract->SetItemString( "contracts", rowset ); _contract->SetItemString( "items", res.Encode() ); _contract->SetItemString( "bids", new PyNone ); return new PyObject( new PyString( "util.KeyVal" ), _contract ); }