void ConditionAttributes::addCondition(Creature* creature, const Condition* addCondition) { if(updateCondition(addCondition)) { setTicks(addCondition->getTicks()); const ConditionAttributes& conditionAttrs = static_cast<const ConditionAttributes&>(*addCondition); //Remove the old condition endCondition(creature, CONDITIONEND_ABORT); //Apply the new one memcpy(skills, conditionAttrs.skills, sizeof(skills)); memcpy(skillsPercent, conditionAttrs.skillsPercent, sizeof(skillsPercent)); memcpy(stats, conditionAttrs.stats, sizeof(stats)); memcpy(statsPercent, conditionAttrs.statsPercent, sizeof(statsPercent)); if(Player* player = creature->getPlayer()) { updatePercentSkills(player); updateSkills(player); updatePercentStats(player); updateStats(player); } } }
void MainWindow::on_OEditSkill_clicked() { EditSkill wEditSkill(this); wEditSkill.setModal(true); connect(&wEditSkill, SIGNAL(accepted()), this, SLOT(updateSkills())); wEditSkill.exec(); }
void RaceDialog::open() { WindowModal::open(); updateRaces(); updateSkills(); updateSpellPowers(); mPreview = new MWRender::RaceSelectionPreview(); mPreview->setup(); mPreview->update (0); const ESM::NPC proto = mPreview->getPrototype(); setRaceId(proto.mRace); recountParts(); std::string index = proto.mHead.substr(proto.mHead.size() - 2, 2); mFaceIndex = boost::lexical_cast<int>(index) - 1; index = proto.mHair.substr(proto.mHair.size() - 2, 2); mHairIndex = boost::lexical_cast<int>(index) - 1; mPreviewImage->setImageTexture ("CharacterHeadPreview"); mPreviewDirty = true; }
void ConditionAttributes::addCondition(Creature* creature, const Condition* condition) { if (updateCondition(condition)) { setTicks(condition->getTicks()); const ConditionAttributes& conditionAttrs = static_cast<const ConditionAttributes&>(*condition); //Remove the old condition endCondition(creature); //Apply the new one memcpy(skills, conditionAttrs.skills, sizeof(skills)); memcpy(specialSkills, conditionAttrs.specialSkills, sizeof(specialSkills)); memcpy(skillsPercent, conditionAttrs.skillsPercent, sizeof(skillsPercent)); memcpy(stats, conditionAttrs.stats, sizeof(stats)); memcpy(statsPercent, conditionAttrs.statsPercent, sizeof(statsPercent)); disableDefense = conditionAttrs.disableDefense; if (Player* player = creature->getPlayer()) { updatePercentSkills(player); updateSkills(player); updatePercentStats(player); updateStats(player); } } }
bool ConditionAttributes::startCondition(Creature* creature) { if(Player* player = creature->getPlayer()) { updatePercentSkills(player); updateSkills(player); updatePercentStats(player); updateStats(player); } return Condition::startCondition(creature); }
void MainWindow::updateAbility() { /* Pass trough all the ability id (from str to cha) */ int abilityTotal(0); double abilityMod(0); QString abilityName; for (int i(0); i<6; i++) { abilityName = character.getAbilityName(i); abilityMod = character.getAbilityMod(i); abilityTotal = character.getAbilityTotal(i); QString showValue = QString ("%1: Total: %2 || Mod: %3").arg(abilityName).arg(abilityTotal).arg(abilityMod); lbAbilityArr[i]->setText(showValue); } updateSkills(); }
bool ConditionAttributes::startCondition(Creature* creature) { if (!Condition::startCondition(creature)) { return false; } creature->setUseDefense(!disableDefense); if (Player* player = creature->getPlayer()) { updatePercentSkills(player); updateSkills(player); updatePercentStats(player); updateStats(player); } return true; }
void RaceDialog::onSelectRace(MyGUI::ListBox* _sender, size_t _index) { if (_index == MyGUI::ITEM_NONE) return; const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index); if (Misc::StringUtils::ciEqual(mCurrentRaceId, *raceId)) return; mCurrentRaceId = *raceId; recountParts(); updatePreview(); updateSkills(); updateSpellPowers(); }
void RaceDialog::setRaceId(const std::string &raceId) { mCurrentRaceId = raceId; mRaceList->setIndexSelected(MyGUI::ITEM_NONE); size_t count = mRaceList->getItemCount(); for (size_t i = 0; i < count; ++i) { if (Misc::StringUtils::ciEqual(*mRaceList->getItemDataAt<std::string>(i), raceId)) { mRaceList->setIndexSelected(i); break; } } updateSkills(); updateSpellPowers(); }
void RaceDialog::onOpen() { WindowModal::onOpen(); updateRaces(); updateSkills(); updateSpellPowers(); mPreviewImage->setRenderItemTexture(nullptr); mPreview.reset(nullptr); mPreviewTexture.reset(nullptr); mPreview.reset(new MWRender::RaceSelectionPreview(mParent, mResourceSystem)); mPreview->rebuild(); mPreview->setAngle (mCurrentAngle); mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture())); mPreviewImage->setRenderItemTexture(mPreviewTexture.get()); mPreviewImage->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f)); const ESM::NPC& proto = mPreview->getPrototype(); setRaceId(proto.mRace); setGender(proto.isMale() ? GM_Male : GM_Female); recountParts(); for (unsigned int i=0; i<mAvailableHeads.size(); ++i) { if (Misc::StringUtils::ciEqual(mAvailableHeads[i], proto.mHead)) mFaceIndex = i; } for (unsigned int i=0; i<mAvailableHairs.size(); ++i) { if (Misc::StringUtils::ciEqual(mAvailableHairs[i], proto.mHair)) mHairIndex = i; } mPreviewDirty = true; size_t initialPos = mHeadRotate->getScrollRange()/2+mHeadRotate->getScrollRange()/10; mHeadRotate->setScrollPosition(initialPos); onHeadRotate(mHeadRotate, initialPos); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mRaceList); }
BTPc::BTPc(int monsterType, int j, BTCombatant *c /*= NULL*/) : race(-1), gender(BTGENDER_MALE), picture(-1), monster(monsterType), rateAttacks(1), save(0), sp(0), maxSp(0), gold(0), xp(0) { BTFactory<BTMonster> &monsterList = BTGame::getGame()->getMonsterList(); BTJobList &jobList = BTGame::getGame()->getJobList(); BTXpChartList &xpChartList = BTGame::getGame()->getXpChartList(); name = new char[monsterList[monster].getName().length() + 1]; strcpy(name, monsterList[monster].getName().c_str()); if (c == NULL) { job = j; level = maxLevel = monsterList[monster].getLevel(); } else { job = c->job; level = c->level; maxLevel = c->maxLevel; } if (level == 0) level = maxLevel = 1; else if ((level > 1) && (jobList[job]->xpChart != -1)) xp = xpChartList[jobList[job]->xpChart]->getXpNeeded(level - 1); gender = monsterList[monster].getGender(); picture = monsterList[monster].getPicture(); ac = monsterList[monster].getAc(); toHit = jobList[job]->calcToHit(level); if (c == NULL) { hp = maxHp = monsterList[monster].getHp().roll(); } else { hp = c->hp; maxHp = c->maxHp; } save = jobList[job]->calcSave(level); status.set(BTSTATUS_NPC); int i; for (i = 0; i < BT_STATS; ++i) stat[i] = 10; item = new BTEquipment[BTGame::getGame()->getModule()->maxItems]; updateSkills(); }
void RaceDialog::open() { WindowModal::open(); updateRaces(); updateSkills(); updateSpellPowers(); mPreview.reset(NULL); mPreviewImage->setImageTexture(""); const std::string textureName = "CharacterHeadPreview"; MyGUI::RenderManager::getInstance().destroyTexture(MyGUI::RenderManager::getInstance().getTexture(textureName)); mPreview.reset(new MWRender::RaceSelectionPreview()); mPreview->setup(); mPreview->update (mCurrentAngle); const ESM::NPC proto = mPreview->getPrototype(); setRaceId(proto.mRace); recountParts(); for (unsigned int i=0; i<mAvailableHeads.size(); ++i) { if (mAvailableHeads[i] == proto.mHead) mFaceIndex = i; } for (unsigned int i=0; i<mAvailableHairs.size(); ++i) { if (mAvailableHairs[i] == proto.mHair) mHairIndex = i; } mPreviewImage->setImageTexture (textureName); mPreviewDirty = true; size_t initialPos = mHeadRotate->getScrollRange()/2+mHeadRotate->getScrollRange()/10; mHeadRotate->setScrollPosition(initialPos); onHeadRotate(mHeadRotate, initialPos); }
RaceDialog::RaceDialog() : WindowModal("openmw_chargen_race.layout") , mGenderIndex(0) , mFaceIndex(0) , mHairIndex(0) , mCurrentAngle(0) , mPreviewDirty(true) , mPreview(NULL) { // Centre dialog center(); setText("AppearanceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu1", "Appearance")); getWidget(mPreviewImage, "PreviewImage"); getWidget(mHeadRotate, "HeadRotate"); mHeadRotate->setScrollRange(50); mHeadRotate->setScrollPosition(25); mHeadRotate->setScrollViewPage(10); mHeadRotate->eventScrollChangePosition += MyGUI::newDelegate(this, &RaceDialog::onHeadRotate); // Set up next/previous buttons MyGUI::Button *prevButton, *nextButton; setText("GenderChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu2", "Change Sex")); getWidget(prevButton, "PrevGenderButton"); getWidget(nextButton, "NextGenderButton"); prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender); nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender); setText("FaceChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu3", "Change Face")); getWidget(prevButton, "PrevFaceButton"); getWidget(nextButton, "NextFaceButton"); prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace); nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace); setText("HairChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu4", "Change Hair")); getWidget(prevButton, "PrevHairButton"); getWidget(nextButton, "NextHairButton"); prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair); nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair); setText("RaceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu5", "Race")); getWidget(mRaceList, "RaceList"); mRaceList->setScrollVisible(true); mRaceList->eventListSelectAccept += MyGUI::newDelegate(this, &RaceDialog::onAccept); mRaceList->eventListChangePosition += MyGUI::newDelegate(this, &RaceDialog::onSelectRace); setText("SkillsT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sBonusSkillTitle", "Skill Bonus")); getWidget(mSkillList, "SkillList"); setText("SpellPowerT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu7", "Specials")); getWidget(mSpellPowerList, "SpellPowerList"); MyGUI::Button* backButton; getWidget(backButton, "BackButton"); backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked); MyGUI::Button* okButton; getWidget(okButton, "OKButton"); okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", "")); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked); updateRaces(); updateSkills(); updateSpellPowers(); }