void KoOdtFrameReportTextBox::createBody(KoXmlWriter *bodyWriter) const { bodyWriter->startElement("draw:frame"); bodyWriter->addAttribute("draw:id", itemName()); bodyWriter->addAttribute("xml:id", itemName()); bodyWriter->addAttribute("draw:name", itemName()); bodyWriter->addAttribute("text:anchor-type", "page"); bodyWriter->addAttribute("text:anchor-page-number", pageNumber()); bodyWriter->addAttribute("draw:style-name", m_frameStyleName); commonAttributes(bodyWriter); bodyWriter->startElement("draw:text-box"); bodyWriter->startElement("text:p"); bodyWriter->addAttribute("text:style-name", m_paragraphStyleName); bodyWriter->startElement("text:span"); bodyWriter->addAttribute("text:style-name", m_textStyleName); bodyWriter->addTextNode(textBox()->text()); bodyWriter->endElement(); // text:span bodyWriter->endElement(); // text:p bodyWriter->endElement(); // draw:text-box bodyWriter->endElement(); // draw:frame }
void Character::AddItem(InventoryItemRef item) { Inventory::AddItem( item ); if( item->flag() == flagSkill || item->flag() == flagSkillInTraining ) { // Skill has been added ... if( item->categoryID() != EVEDB::invCategories::Skill ) { _log( ITEM__WARNING, "%s (%u): %s has been added with flag %d.", itemName().c_str(), itemID(), item->category().name().c_str(), (int)item->flag() ); } else { SkillRef skill = SkillRef::StaticCast( item ); if( !skill->singleton() ) { _log( ITEM__TRACE, "%s (%u): Injecting %s.", itemName().c_str(), itemID(), item->itemName().c_str() ); // Make it singleton and set initial skill values. skill->ChangeSingleton( true ); skill->SetAttribute(AttrSkillLevel, 0); skill->SetAttribute(AttrSkillPoints, 0); if( skill->flag() != flagSkillInTraining ) skill->SetAttribute(AttrExpiryTime, 0); } } } }
bool InventoryItem::Merge(InventoryItemRef to_merge, int32 qty, bool notify) { if(typeID() != to_merge->typeID()) { _log(ITEM__ERROR, "%s (%u): Asked to merge with %s (%u).", itemName().c_str(), itemID(), to_merge->itemName().c_str(), to_merge->itemID()); return false; } if(locationID() != to_merge->locationID() || flag() != to_merge->flag()) { _log(ITEM__ERROR, "%s (%u) in location %u, flag %u: Asked to merge with item %u in location %u, flag %u.", itemName().c_str(), itemID(), locationID(), flag(), to_merge->itemID(), to_merge->locationID(), to_merge->flag()); return false; } if(qty == 0) qty = to_merge->quantity(); if(qty <= 0) { _log(ITEM__ERROR, "%s (%u): Asked to merge with %d units of item %u.", itemName().c_str(), itemID(), qty, to_merge->itemID()); return false; } if(!AlterQuantity(qty, notify)) { _log(ITEM__ERROR, "%s (%u): Failed to add quantity %d.", itemName().c_str(), itemID(), qty); return false; } if(qty == to_merge->quantity()) { to_merge->Delete(); } else if(!to_merge->AlterQuantity(-qty, notify)) { _log(ITEM__ERROR, "%s (%u): Failed to remove quantity %d.", to_merge->itemName().c_str(), to_merge->itemID(), qty); return false; } return true; }
QList<DbTreeItem*> DbViewItem::populateChildren() { QList<DbTreeItem*> children; children.append(new DbTableColumnParentItem(QObject::tr("Columns"), itemName(), getModel(), this)); children.append(new DbTableTriggerParentItem(QObject::tr("Triggers"), itemName(), getModel(), this)); return children; }
void QReportTreeManager::on_actionDeleteParameter_triggered() { bool b = _designer->removeParametere(itemName()); if(b) nodeParameters->removeChild(currentItem()); }
void refreshHistory(QString username) { MainMutex::mutex().lock(); unsigned short id = this->getKeyOfMap(this->_client->getContactList(), username.toStdString()); std::map<unsigned short, std::vector<std::pair<messageType, std::string> > > history = this->_client->getMessagesList(); MainMutex::mutex().unlock(); this->historyList->clear(); if (history[id].empty()) { QString content(QString::fromUtf8("Vous n'avez encore rien envoyé à votre correspondant ! N'hésitez pas à lui envoyer un petit message pour lui dire bonjour ! :)")); QListWidgetItem *item = new QListWidgetItem(content); item->setTextAlignment(Qt::AlignCenter); this->historyList->addItem(item); } else { for (std::vector<std::pair<messageType, std::string> >::iterator it = history[id].begin(); it != history[id].end(); it++) { QString itemName(it->second.c_str()); QListWidgetItem *item = new QListWidgetItem(itemName); if (it->first == FROM_ME) item->setTextAlignment(Qt::AlignRight); else if (it->first == FROM_OTHER) item->setTextAlignment(Qt::AlignLeft); else item->setTextAlignment(Qt::AlignCenter); this->historyList->addItem(item); } } }
void QReportTreeManager::on_actionEditDataTable_triggered() { QReportDataTable *table = _designer->editDataTable(itemName()); if(table) initTreeItems(); }
/* * InventoryItem */ InventoryItem::InventoryItem( ItemFactory &_factory, uint32 _itemID, const ItemType &_type, const ItemData &_data) : RefObject( 0 ), //attributes(_factory, *this, true, true), mAttributeMap(*this), mDefaultAttributeMap(*this,true), m_saveTimer(0,true), m_factory(_factory), m_itemID(_itemID), m_itemName(_data.name), m_type(_type), m_ownerID(_data.ownerID), m_locationID(_data.locationID), m_flag(_data.flag), m_contraband(_data.contraband), m_singleton(_data.singleton), m_quantity(_data.quantity), m_position(_data.position), m_customInfo(_data.customInfo) { // assert for data consistency assert(_data.typeID == _type.id()); //m_saveTimerExpiryTime = ITEM_DB_SAVE_TIMER_EXPIRY * 60 * 1000; // 10 minutes in milliseconds //m_saveTimer.SetTimer(m_saveTimerExpiryTime); // set timer in milliseconds m_saveTimer.Disable(); // disable timer by default _log(ITEM__TRACE, "Created object %p for item %s (%u).", this, itemName().c_str(), itemID()); }
void QReportTreeManager::on_actionNewDataTable_triggered() { QReportDataTable *table = _designer->addDataTable(itemName()); if(table) initTreeItems(); // QReportDataTableDialog dialog(_report, itemName()); // if(dialog.exec() == QDialog::Accepted){ // QReportDataTable *table = dialog.createDataTable(); // _report->addDataTable(table); // /* // QTreeWidgetItem *newTableItem = new QTreeWidgetItem; // newTableItem->setData(1, 0, TYPE_DataTable); // newTableItem->setText(0, table->objectName()); // newTableItem->setIcon(0, QIcon(":/designer/table")); // currentItem()->addChild(newTableItem); // for(int i = 0; i < table->fields().count(); i++) { // QTreeWidgetItem *newFieldItem = new QTreeWidgetItem; // newFieldItem->setData(1, 0, TYPE_FIELD); // newFieldItem->setData(2, 0, table->fields().at(i)->type()); // newFieldItem->setText(0, table->fields().at(i)->objectName()); // newFieldItem->setIcon(0, QIcon(":/designer/field")); // newTableItem->addChild(newFieldItem); // }//for // newTableItem->setExpanded(true); // currentItem()->setExpanded(true); // */ // }//if }
void QReportTreeManager::on_actionDeleteDataTable_triggered() { bool b = _designer->removeDataTable(itemName()); if(b) initTreeItems(); }
void ProjectManager::onSaveRenderView(const QUrl& url) { assert(QThread::currentThread() == thread()); QString itemName("qoItem"); QQuickWindow* window = mScenarioManager.getEngine()->getQQuickWindow(); QOItem* item = window->findChild<QOItem*>(itemName); if(!item) { qFatal("ProjectManager.onSaveRenderView: " "Couldn't find ogre item with name (objectName=%s).", itemName.toLocal8Bit().constData()); } QImage img = item->saveCurrentImage(); if(img.isNull()) { qWarning("ProjectManager.onSaveRenderView: The screenshot couldn't be allocated. " "Out of memory."); return; } QString path = url.toLocalFile(); if(!img.save(path + ".png", "PNG", 100)) { qWarning("ProjectManager.onSaveRenderView: Failed to save current scene screenshot to %s", path.toLocal8Bit().constData()); } }
/// Refresh dependencies void ctConfigToolDoc::RefreshDependencies(ctConfigItem* item) { if (item==NULL) return; wxArrayString requiresArr; wxString requires = item->GetPropertyString(wxT("requires")); wxString precludes = item->GetPropertyString(wxT("precludes")); wxString enabledIf = item->GetPropertyString(wxT("enabled-if")); wxString enabledIfNot = item->GetPropertyString(wxT("enabled-if-not")); wxString indeterminateIf = item->GetPropertyString(wxT("indeterminate-if")); wxString context = item->GetPropertyString(wxT("context")); if (!requires.IsEmpty()) item->StringToArray(requires, requiresArr); if (!precludes.IsEmpty()) item->StringToArray(precludes, requiresArr); if (!enabledIfNot.IsEmpty()) item->StringToArray(enabledIfNot, requiresArr); if (!enabledIf.IsEmpty()) item->StringToArray(enabledIf, requiresArr); if (!indeterminateIf.IsEmpty()) item->StringToArray(indeterminateIf, requiresArr); // Add the parent to the list of dependencies, if the // parent is a check or radio group. ctConfigItem* parent = item->GetParent(); if (parent && (parent->GetType() == ctTypeCheckGroup || parent->GetType() == ctTypeRadioGroup)) requiresArr.Add(parent->GetName()); // Also look in 'context' since these items // are another kind of dependency (switching to // a different platform may cause the dependencies // to be evaluated differently). if (!context.IsEmpty()) item->StringToArray(context, requiresArr); size_t i; for (i = 0; i < requiresArr.GetCount(); i++) { wxString itemName(requiresArr[i]); ctConfigItem* otherItem = GetTopItem()->FindItem(itemName); if (otherItem && !otherItem->GetDependents().Member(item)) { otherItem->GetDependents().Append(item); } } for ( wxObjectList::compatibility_iterator node = item->GetChildren().GetFirst(); node; node = node->GetNext() ) { ctConfigItem* child = (ctConfigItem*) node->GetData(); RefreshDependencies(child); } }
void QReportTreeManager::on_actionEditParameter_triggered() { QReportParametere *p = _designer->editParametere(itemName()); if(p){ setItemText(p->objectName()); setItemName(p->objectName()); }//if }
void scum(unsigned long startingSeed, short numberOfSeedsToScan, short scanThroughDepth) { unsigned long theSeed; char path[BROGUE_FILENAME_MAX]; item *theItem; creature *monst; char buf[500]; FILE *logFile; logFile = fopen("Brogue seed catalog.txt", "w"); rogue.nextGame = NG_NOTHING; getAvailableFilePath(path, LAST_GAME_NAME, GAME_SUFFIX); strcat(path, GAME_SUFFIX); fprintf(logFile, "Brogue seed catalog, seeds %li to %li, through depth %i.\n\n\ To play one of these seeds, press control-N from the title screen \ and enter the seed number. Knowing which items will appear on \ the first %i depths will, of course, make the game significantly easier.", startingSeed, startingSeed + numberOfSeedsToScan - 1, scanThroughDepth, scanThroughDepth); for (theSeed = startingSeed; theSeed < startingSeed + numberOfSeedsToScan; theSeed++) { fprintf(logFile, "\n\nSeed %li:", theSeed); printf("\nScanned seed %li.", theSeed); rogue.nextGamePath[0] = '\0'; randomNumbersGenerated = 0; rogue.playbackMode = false; rogue.playbackFastForward = false; rogue.playbackBetweenTurns = false; strcpy(currentFilePath, path); initializeRogue(theSeed); rogue.playbackOmniscience = true; for (rogue.depthLevel = 1; rogue.depthLevel <= scanThroughDepth; rogue.depthLevel++) { startLevel(rogue.depthLevel == 1 ? 1 : rogue.depthLevel - 1, 1); // descending into level n fprintf(logFile, "\n Depth %i:", rogue.depthLevel); for (theItem = floorItems->nextItem; theItem != NULL; theItem = theItem->nextItem) { itemName(theItem, buf, true, true, NULL); upperCase(buf); fprintf(logFile, "\n %s", buf); if (pmap[theItem->xLoc][theItem->yLoc].machineNumber > 0) { fprintf(logFile, " (vault %i)", pmap[theItem->xLoc][theItem->yLoc].machineNumber); } } for (monst = monsters->nextCreature; monst != NULL; monst = monst->nextCreature) { scumMonster(monst, logFile); } for (monst = dormantMonsters->nextCreature; monst != NULL; monst = monst->nextCreature) { scumMonster(monst, logFile); } } freeEverything(); remove(currentFilePath); // Don't add a spurious LastGame file to the brogue folder. } fclose(logFile); }
//------------------------------------------------------------------------------------- bool EntityTableItemRedisBase::initialize(const PropertyDescription* pPropertyDescription, const DataType* pDataType, std::string name) { itemName(name); pDataType_ = pDataType; pPropertyDescription_ = pPropertyDescription; indexType_ = pPropertyDescription->indexType(); return true; }
void KoOdtFrameReportPicture::createBody(KoXmlWriter *bodyWriter) const { bodyWriter->startElement("draw:frame"); bodyWriter->addAttribute("draw:id", itemName()); bodyWriter->addAttribute("xml:id", itemName()); bodyWriter->addAttribute("draw:name", itemName()); bodyWriter->addAttribute("text:anchor-type", "page"); bodyWriter->addAttribute("text:anchor-page-number", pageNumber()); bodyWriter->addAttribute("draw:style-name", m_frameStyleName); commonAttributes(bodyWriter); bodyWriter->startElement("draw:image"); bodyWriter->addAttribute("xlink:href", "Pictures/" + pictureName()); bodyWriter->addAttribute("xlink:type", "simple"); bodyWriter->addAttribute("xlink:show", "embed"); bodyWriter->addAttribute("xlink:actuate", "onLoad"); bodyWriter->endElement(); bodyWriter->endElement(); // draw:frame }
void refreshOnline(void) { MainMutex::mutex().lock(); std::map<unsigned short, std::string> map = this->_client->getContactList(); MainMutex::mutex().unlock(); this->onlineList->clear(); for (std::map<unsigned short, std::string>::iterator it = map.begin(); it != map.end(); it++) { QString itemName(it->second.c_str()); QListWidgetItem *item = new QListWidgetItem(itemName); this->onlineList->addItem(item); } }
InventoryItemRef InventoryItem::Split(int32 qty_to_take, bool notify) { if(qty_to_take <= 0) { _log(ITEM__ERROR, "%s (%u): Asked to split into a chunk of %d", itemName().c_str(), itemID(), qty_to_take); return InventoryItemRef(); } if(!AlterQuantity(-qty_to_take, notify)) { _log(ITEM__ERROR, "%s (%u): Failed to remove quantity %d during split.", itemName().c_str(), itemID(), qty_to_take); return InventoryItemRef(); } ItemData idata( typeID(), ownerID(), (notify ? 1 : locationID()), //temp location to cause the spawn via update flag(), qty_to_take ); InventoryItemRef res = m_factory.SpawnItem(idata); if(notify) res->Move( locationID(), flag() ); return( res ); }
bool CFileSystemDialogImp::OnItemDblClicked( const CEGUI::EventArgs& e ) {GUCE_TRACE; // Test if this was a left mouse click const CEGUI::MouseEventArgs& eData = static_cast< const CEGUI::MouseEventArgs& >( e ); if ( eData.button == CEGUI::LeftButton ) { // Get some easy access to data CGridViewImp* fsView = static_cast< CGridViewImp* >( GetFileSystemGridView() ); CEGUI::MultiColumnList* fsViewWidget = fsView->GetImplementationWidget(); UInt32 columnIndex = 0; UInt32 rowIndex = 0; if ( fsView->TestForItemHit( eData.position.d_x , eData.position.d_y , columnIndex , rowIndex ) ) { CEGUI::ListboxItem* listItem = fsViewWidget->getItemAtGridReference( CEGUI::MCLGridRef( rowIndex, columnIndex ) ); if ( NULL != listItem ) { if ( listItem->getText() == ".." ) { // ".." means go up one dir m_currentPath = GUCEF::CORE::StripLastSubDir( m_currentPath ); RefreshView(); } else if ( IsItemADirectory( listItem->getText().c_str() ) ) { GUCEF::CORE::AppendToPath( m_currentPath, listItem->getText().c_str() ); RefreshView(); } else if ( IsItemAnArchive( listItem->getText().c_str() ) ) { CString itemName( listItem->getText().c_str() ); CString realName = itemName.CutChars( 3, true ); GUCEF::CORE::AppendToPath( m_currentPath, realName ); RefreshView(); } } } } return true; }
bool Character::InjectSkillIntoBrain(SkillRef skill, uint8 level) { Client *c = m_factory.entity_list.FindCharacter( itemID() ); SkillRef oldSkill = GetSkill( skill->typeID() ); if( oldSkill ) { //oldSkill->attributes.SetNotify(true); //oldSkill->Set_skillLevel( level ); //oldSkill->Set_skillPoints( pow(2, ( 2.5 * level ) - 2.5 ) * SKILL_BASE_POINTS * ( oldSkill->attributes.GetInt( oldSkill->attributes.Attr_skillTimeConstant ) ) ); oldSkill->SetAttribute(AttrSkillLevel, level); EvilNumber eTmp = skill->GetAttribute(AttrSkillTimeConstant) * ( pow(2,( 2.5 * level) - 2.5 ) * EVIL_SKILL_BASE_POINTS ); oldSkill->SetAttribute(AttrSkillPoints, eTmp); return true; } // are we injecting from a stack of skills? if( skill->quantity() > 1 ) { // split the stack to obtain single item InventoryItemRef single_skill = skill->Split( 1 ); if( !single_skill ) { _log( ITEM__ERROR, "%s (%u): Unable to split stack of %s (%u).", itemName().c_str(), itemID(), skill->itemName().c_str(), skill->itemID() ); return false; } // use single_skill ... single_skill->MoveInto( *this, flagSkill ); } else skill->MoveInto( *this, flagSkill ); skill->SetAttribute(AttrSkillLevel, level); //TODO: get right number of skill points //skill->Set_skillPoints( pow(2,( 2.5 * level) - 2.5 ) * SKILL_BASE_POINTS * ( skill->attributes.GetInt( skill->attributes.Attr_skillTimeConstant ) ) ); EvilNumber tmp = pow(2,( 2.5 * level) - 2.5 ) * EVIL_SKILL_BASE_POINTS; EvilNumber eTmp = skill->GetAttribute(AttrSkillTimeConstant); eTmp = eTmp * tmp; skill->SetAttribute(AttrSkillPoints, eTmp); return true; }
bool Character::InjectSkillIntoBrain(SkillRef skill) { Client *c = m_factory.entity_list.FindCharacter( itemID() ); SkillRef oldSkill = GetSkill( skill->typeID() ); if( oldSkill ) { //TODO: build and send proper UserError for CharacterAlreadyKnowsSkill. if( c != NULL ) c->SendNotifyMsg( "You already know this skill." ); return false; } // TODO: based on config options later, check to see if another character, owned by this characters account, // is training a skill. If so, return. (flagID=61). if( !skill->SkillPrereqsComplete( *this ) ) { // TODO: need to send back a response to the client. need packet specs. _log( ITEM__TRACE, "%s (%u): Requested to train skill %u item %u but prereq not complete.", itemName().c_str(), itemID(), skill->typeID(), skill->itemID() ); if( c != NULL ) c->SendNotifyMsg( "Injection failed! Skill prerequisites incomplete." ); return false; } // are we injecting from a stack of skills? if( skill->quantity() > 1 ) { // split the stack to obtain single item InventoryItemRef single_skill = skill->Split( 1 ); if( !single_skill ) { _log( ITEM__ERROR, "%s (%u): Unable to split stack of %s (%u).", itemName().c_str(), itemID(), skill->itemName().c_str(), skill->itemID() ); return false; } // use single_skill ... single_skill->MoveInto( *this, flagSkill ); } else // use original skill skill->MoveInto( *this, flagSkill ); if( c != NULL ) c->SendNotifyMsg( "Injection of skill complete." ); return true; }
void InventoryItem::SaveItem() { //_log( ITEM__TRACE, "Saving item %u.", itemID() ); SaveAttributes(); m_factory.db().SaveItem( itemID(), ItemData( itemName().c_str(), typeID(), ownerID(), locationID(), flag(), contraband(), singleton(), quantity(), position(), customInfo().c_str() ) ); }
void CHelperItemSet::InitPaihangTree(const char* worldid) { if(m_worldIdList.size()>0 ) { //for(int i=0;i<(int)m_worldIdList.size();i++) //{ // if(strcmp(((String)m_worldIdList[i]).c_str(),worldid)==0) return; //} } m_worldIdList.push_back(String(worldid)); int ArryLenth=3; char *Anchors[]={"top50level.html","top50money.html","top50xinfa.html"}; wchar_t *Names[]={L"高手排行(TOP50)", L"富豪排行(TOP50)", L"心法排行(TOP50)"}; if(!m_rootItemPaihang) return; char *PathStart="http://tl.sohu.com/tlbbrank"; char szPath[MAX_PATH]; char szAnchor[MAX_PATH]; for(int i=0;i<ArryLenth;i++) { memset(szAnchor, 0, MAX_PATH); memset(szPath, 0, MAX_PATH); strcpy(szPath, PathStart); strcat(szPath, "/"); strcat(szPath,worldid); strcat(szPath,"/"); strcat(szPath,Anchors[i]); WString itemName(Names[i]); strcpy(szAnchor,Anchors[i]); strcat(szAnchor,worldid); String itemAnchor(szAnchor); String itemUrl(szPath); itemUrl=CheckUrl(itemUrl); CHelperItem item(itemName, itemAnchor,itemUrl ); m_rootItemPaihang->AddChildItem(item); } }
void Character::UpdateSkillQueue() { Client *c = m_factory.entity_list.FindCharacter( itemID() ); SkillRef currentTraining = GetSkillInTraining(); if( currentTraining ) { if( m_skillQueue.empty() || currentTraining->typeID() != m_skillQueue.front().typeID ) { // either queue is empty or skill with different typeID is in training ... // stop training: _log( ITEM__ERROR, "%s (%u): Stopping training of skill %s (%u).", itemName().c_str(), itemID(), currentTraining->itemName().c_str(), currentTraining->itemID() ); /* uint64 timeEndTrain = currentTraining->expiryTime(); if(timeEndTrain != 0) { double nextLevelSP = currentTraining->GetSPForLevel( currentTraining->skillLevel() + 1 ); double SPPerMinute = GetSPPerMin( currentTraining ); double minRemaining = (double)(timeEndTrain - Win32TimeNow()) / (double)Win32Time_Minute; currentTraining->Set_skillPoints( nextLevelSP - (minRemaining * SPPerMinute) ); } currentTraining->Clear_expiryTime(); */ EvilNumber timeEndTrain = currentTraining->GetAttribute(AttrExpiryTime); if (timeEndTrain != 0) { EvilNumber nextLevelSP = currentTraining->GetSPForLevel( currentTraining->GetAttribute(AttrSkillLevel) + 1 ); EvilNumber SPPerMinute = GetSPPerMin( currentTraining ); EvilNumber minRemaining = (timeEndTrain - EvilNumber(Win32TimeNow())) / (double)Win32Time_Minute; //currentTraining->Set_skillPoints( nextLevelSP - (minRemaining * SPPerMinute) ); EvilNumber skillPointsTrained = nextLevelSP - (minRemaining * SPPerMinute); currentTraining->SetAttribute(AttrSkillPoints, skillPointsTrained); sLog.Debug( "", "Skill %s (%u) trained %u skill points before termination from training queue", currentTraining->itemName().c_str(), currentTraining->itemID(), skillPointsTrained.get_float() ); } currentTraining->SetAttribute(AttrExpiryTime, 0); currentTraining->MoveInto( *this, flagSkill, true ); if( c != NULL ) { OnSkillTrainingStopped osst; osst.itemID = currentTraining->itemID(); osst.endOfTraining = 0; PyTuple* tmp = osst.Encode(); c->QueueDestinyEvent( &tmp ); PySafeDecRef( tmp ); c->UpdateSkillTraining(); } // nothing currently in training currentTraining = SkillRef(); } } EvilNumber nextStartTime = EvilTimeNow(); while( !m_skillQueue.empty() ) { if( !currentTraining ) { // something should be trained, get desired skill uint32 skillTypeID = m_skillQueue.front().typeID; currentTraining = GetSkill( skillTypeID ); if( !currentTraining ) { _log( ITEM__ERROR, "%s (%u): Skill %u to train was not found.", itemName().c_str(), itemID(), skillTypeID ); break; } sLog.Debug( "Character::UpdateSkillQueue()", "%s (%u): Starting training of skill %s (%u)", m_itemName.c_str(), m_itemID, currentTraining->itemName().c_str(), currentTraining->itemID() ); EvilNumber SPPerMinute = GetSPPerMin( currentTraining ); EvilNumber NextLevel = currentTraining->GetAttribute(AttrSkillLevel) + 1; EvilNumber SPToNextLevel = currentTraining->GetSPForLevel( NextLevel ) - currentTraining->GetAttribute(AttrSkillPoints); sLog.Debug( " ", "Training skill at %f SP/min", SPPerMinute.get_float() ); sLog.Debug( " ", "%f SP to next Level of %d", SPToNextLevel.get_float(), NextLevel.get_int() ); SPPerMinute.to_float(); SPToNextLevel.to_float(); nextStartTime.to_float(); EvilNumber timeTraining = nextStartTime + EvilTime_Minute * SPToNextLevel / SPPerMinute; currentTraining->MoveInto( *this, flagSkillInTraining ); double dbl_timeTraining = timeTraining.get_float() + (double)(Win32Time_Second * 10); currentTraining->SetAttribute(AttrExpiryTime, dbl_timeTraining); // Set server-side // skill expiry + 10 sec sLog.Debug( " ", "Calculated time to complete training = %s", Win32TimeToString((uint64)dbl_timeTraining).c_str() ); if( c != NULL ) { OnSkillStartTraining osst; osst.itemID = currentTraining->itemID(); osst.endOfTraining = timeTraining.get_float(); PyTuple* tmp = osst.Encode(); c->QueueDestinyEvent( &tmp ); PySafeDecRef( tmp ); c->UpdateSkillTraining(); } } if( currentTraining->GetAttribute(AttrExpiryTime) <= EvilTimeNow() ) { // training has been finished: sLog.Debug( "Character::UpdateSkillQueue()", "%s (%u): Finishing training of skill %s (%u).", itemName().c_str(), itemID(), currentTraining->itemName().c_str(), currentTraining->itemID() ); currentTraining->SetAttribute(AttrSkillLevel, currentTraining->GetAttribute(AttrSkillLevel) + 1 ); currentTraining->SetAttribute(AttrSkillPoints, currentTraining->GetSPForLevel( currentTraining->GetAttribute(AttrSkillLevel) ), true); nextStartTime = currentTraining->GetAttribute(AttrExpiryTime); currentTraining->SetAttribute(AttrExpiryTime, 0); currentTraining->MoveInto( *this, flagSkill, true ); if( c != NULL ) { OnSkillTrained ost; ost.itemID = currentTraining->itemID(); PyTuple* tmp = ost.Encode(); c->QueueDestinyEvent( &tmp ); PySafeDecRef( tmp ); c->UpdateSkillTraining(); } // erase first element in skill queue m_skillQueue.erase( m_skillQueue.begin() ); // nothing currently in training currentTraining = SkillRef(); } // else the skill is in training ... else break; } // Re-Calculate total SP trained and store in internal variable: _CalculateTotalSPTrained(); // Save character and skill data: SaveCharacter(); SaveSkillQueue(); }
virtual bool isSameKey(std::string key){ return itemName() == key; }
/************************************************************************* SAX2 Handler methods *************************************************************************/ void CHelperItemSet_xmlHandler::elementStart(const String& element, const CHelperXMLAttributes& attributes) { // handle an ItemSet element. if (element == HelperItemSetElement) { // do nothing... } // handle an item element else if(element == ItemElement) { // get name of item. String itemName(attributes.getValueAsString(ItemNameAttribute)); // get anchor for new item String itemAnchor(attributes.getValueAsString(ItemAnchorAttribute)); // get url for new item String itemUrl(attributes.getValueAsString(ItemUrlAttribute)); // url convert(MFC) if(!itemUrl.empty()) { DWORD dwServiceType; CString strServer, strObject; INTERNET_PORT nPort; String strFullURL; AfxParseURL(itemUrl.c_str(), dwServiceType, strServer, strObject, nPort); if(AFX_INET_SERVICE_UNK == dwServiceType) { //local file itemUrl = CHelperSystem::GetMe()->GetWorkDictory() + itemUrl; } else { itemUrl = itemUrl; } } // create new item CHelperItem item(itemName, itemAnchor, itemUrl); // add this item to the current parent (if any) if (!m_stack.empty()) { m_stack.push_back(m_stack.back()->AddChildItem(item)); } else { throw std::exception("HelperItemSet::xmlHandler::startElement item hiberarchy error!"); } } else { char szException[MAX_PATH]; _snprintf(szException, MAX_PATH, "HelperItemSet::xmlHandler::startElement - Unexpected data was found while parsing the Imageset file: '%s' is unknown.", element.c_str()); throw std::exception(szException); } }
void Character::UpdateSkillQueue() { Client *c = m_factory.entity_list.FindCharacter( itemID() ); SkillRef currentTraining = GetSkillInTraining(); if( currentTraining ) { if( m_skillQueue.empty() || currentTraining->typeID() != m_skillQueue.front().typeID ) { // either queue is empty or skill with different typeID is in training ... // stop training: _log( ITEM__ERROR, "%s (%u): Stopping training of skill %s (%u).", itemName().c_str(), itemID(), currentTraining->itemName().c_str(), currentTraining->itemID() ); /* uint64 timeEndTrain = currentTraining->expiryTime(); if(timeEndTrain != 0) { double nextLevelSP = currentTraining->GetSPForLevel( currentTraining->skillLevel() + 1 ); double SPPerMinute = GetSPPerMin( currentTraining ); double minRemaining = (double)(timeEndTrain - Win32TimeNow()) / (double)Win32Time_Minute; currentTraining->Set_skillPoints( nextLevelSP - (minRemaining * SPPerMinute) ); } currentTraining->Clear_expiryTime(); */ EvilNumber timeEndTrain = currentTraining->GetAttribute(AttrExpiryTime); if (timeEndTrain != 0) { EvilNumber nextLevelSP = currentTraining->GetSPForLevel( currentTraining->GetAttribute(AttrSkillLevel) + 1 ); EvilNumber SPPerMinute = GetSPPerMin( currentTraining ); EvilNumber minRemaining = (timeEndTrain - EvilNumber(Win32TimeNow())) / (double)Win32Time_Minute; //currentTraining->Set_skillPoints( nextLevelSP - (minRemaining * SPPerMinute) ); currentTraining->SetAttribute(AttrSkillPoints, nextLevelSP - (minRemaining * SPPerMinute)); } currentTraining->SetAttribute(AttrExpiryTime, 0); currentTraining->MoveInto( *this, flagSkill, true ); if( c != NULL ) { OnSkillTrainingStopped osst; osst.itemID = currentTraining->itemID(); osst.endOfTraining = 0; PyTuple* tmp = osst.Encode(); c->QueueDestinyEvent( &tmp ); PySafeDecRef( tmp ); c->UpdateSkillTraining(); } // nothing currently in training currentTraining = SkillRef(); } } EvilNumber nextStartTime = EvilTimeNow(); while( !m_skillQueue.empty() ) { if( !currentTraining ) { // something should be trained, get desired skill uint32 skillTypeID = m_skillQueue.front().typeID; currentTraining = GetSkill( skillTypeID ); if( !currentTraining ) { _log( ITEM__ERROR, "%s (%u): Skill %u to train was not found.", itemName().c_str(), itemID(), skillTypeID ); break; } _log( ITEM__TRACE, "%s (%u): Starting training of skill %s (%u).", m_itemName.c_str(), m_itemID, currentTraining->itemName().c_str(), currentTraining->itemID() ); EvilNumber SPPerMinute = GetSPPerMin( currentTraining ); // double SPToNextLevel = currentTraining->GetSPForLevel( currentTraining->skillLevel() + 1 ) - currentTraining->skillPoints(); EvilNumber SPToNextLevel = currentTraining->GetSPForLevel( currentTraining->GetAttribute(AttrSkillLevel) + 1) - currentTraining->GetAttribute(AttrSkillPoints); //uint64 timeTraining = nextStartTime + Win32Time_Minute * SPToNextLevel / SPPerMinute; EvilNumber timeTraining = nextStartTime + EvilTime_Minute * SPToNextLevel / SPPerMinute; currentTraining->MoveInto( *this, flagSkillInTraining ); //currentTraining->Set_expiryTime( timeTraining ); currentTraining->SetAttribute(AttrExpiryTime, timeTraining); if( c != NULL ) { OnSkillStartTraining osst; osst.itemID = currentTraining->itemID(); osst.endOfTraining = timeTraining.get_int(); PyTuple* tmp = osst.Encode(); c->QueueDestinyEvent( &tmp ); PySafeDecRef( tmp ); c->UpdateSkillTraining(); } } //if( currentTraining->expiryTime() <= Win32TimeNow() ) if( currentTraining->GetAttribute(AttrExpiryTime) <= EvilTimeNow() ) { // training has been finished: _log( ITEM__ERROR, "%s (%u): Finishing training of skill %s (%u).", itemName().c_str(), itemID(), currentTraining->itemName().c_str(), currentTraining->itemID() ); //currentTraining->Set_skillLevel( currentTraining->skillLevel() + 1 ); //currentTraining->Set_skillPoints( currentTraining->GetSPForLevel( currentTraining->skillLevel() ) ); //nextStartTime = currentTraining->expiryTime(); //currentTraining->Clear_expiryTime(); currentTraining->SetAttribute(AttrSkillLevel, currentTraining->GetAttribute(AttrSkillLevel) + 1 ); currentTraining->SetAttribute(AttrSkillPoints, currentTraining->GetSPForLevel( currentTraining->GetAttribute(AttrSkillLevel) ) ); nextStartTime = currentTraining->GetAttribute(AttrExpiryTime); currentTraining->SetAttribute(AttrExpiryTime, 0); currentTraining->MoveInto( *this, flagSkill, true ); if( c != NULL ) { OnSkillTrained ost; ost.itemID = currentTraining->itemID(); PyTuple* tmp = ost.Encode(); c->QueueDestinyEvent( &tmp ); PySafeDecRef( tmp ); c->UpdateSkillTraining(); } // erase first element in skill queue m_skillQueue.erase( m_skillQueue.begin() ); // nothing currently in training currentTraining = SkillRef(); } // else the skill is in training ... else break; } // Re-Calculate total SP trained and store in internal variable: _CalculateTotalSPTrained(); // Save character and skill data: SaveCharacter(); SaveSkillQueue(); }
bool ItemLibraryItemModel::operator<(const ItemLibraryItemModel &other) const { return itemName() < other.itemName(); }
void Character::SaveCharacter() { _log( ITEM__TRACE, "Saving character %u.", itemID() ); // Calculate total Skill Points trained at this time to save to DB: _CalculateTotalSPTrained(); sLog.Debug( "Character::SaveCharacter()", "Saving all character info and skill attribute info to DB for character %s...", itemName().c_str() ); // character data m_factory.db().SaveCharacter( itemID(), CharacterData( accountID(), title().c_str(), description().c_str(), gender(), bounty(), balance(), aurBalance(), securityRating(), logonMinutes(), m_totalSPtrained.get_float(), corporationID(), allianceID(), warFactionID(), stationID(), solarSystemID(), constellationID(), regionID(), ancestryID(), careerID(), schoolID(), careerSpecialityID(), startDateTime(), createDateTime(), corporationDateTime() ) ); // corporation data m_factory.db().SaveCorpMemberInfo( itemID(), CorpMemberInfo( corporationHQ(), corpRole(), rolesAtAll(), rolesAtBase(), rolesAtHQ(), rolesAtOther() ) ); // Save this character's own attributes: SaveAttributes(); // Loop through all skills and invoke mAttributeMap.SaveAttributes() for each std::vector<InventoryItemRef> skills; GetSkillsList( skills ); std::vector<InventoryItemRef>::iterator cur, end; cur = skills.begin(); end = skills.end(); for(; cur != end; cur++) cur->get()->SaveAttributes(); //cur->get()->mAttributeMap.Save(); SaveCertificates(); }
void ContentTab::populateListWidget() { QFileInfoList fileList = m_ContentDir.entryInfoList(QDir::Files, QDir::Time); foreach(QFileInfo item, fileList) { new QListWidgetItem(m_Icon, itemName(item), this); }