Beispiel #1
0
void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
    WindowManager *wm = environment.mWindowManager;

    // Add a line separator if there are items above
    if (!skillWidgets.empty())
    {
        addSeparator(coord1, coord2);
    }

    addGroup(wm->getGameSettingString(titleId, titleDefault), coord1, coord2);

    SkillList::const_iterator end = skills.end();
    for (SkillList::const_iterator it = skills.begin(); it != end; ++it)
    {
        int skillId = *it;
        if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
            continue;
        assert(skillId >= 0 && skillId < ESM::Skill::Length);
        const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
        const MWMechanics::Stat<float> &stat = skillValues.find(skillId)->second;
        float base = stat.getBase();
        float modified = stat.getModified();

        ColorStyle style = CS_Normal;
        if (modified > base)
            style = CS_Super;
        else if (modified < base)
            style = CS_Sub;
        MyGUI::StaticTextPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
        skillWidgetMap[skillId] = widget;
    }
}
Beispiel #2
0
SelectSpecializationDialog::SelectSpecializationDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
  : WindowBase("openmw_chargen_select_specialization_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;

    setText("LabelT", wm->getGameSettingString("sSpecializationMenu1", ""));

    getWidget(specialization0, "Specialization0");
    getWidget(specialization1, "Specialization1");
    getWidget(specialization2, "Specialization2");
    specialization0->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Combat], ""));
    specialization0->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
    specialization1->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Magic], ""));
    specialization1->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
    specialization2->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Stealth], ""));
    specialization2->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
    specializationId = ESM::Class::Combat;

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr cancelButton;
    getWidget(cancelButton, "CancelButton");
    cancelButton->setCaption(wm->getGameSettingString("sCancel", ""));
    cancelButton->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
}
Beispiel #3
0
SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
  : WindowBase("openmw_chargen_select_attribute_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;

    setText("LabelT", wm->getGameSettingString("sAttributesMenu1", ""));

    for (int i = 0; i < 8; ++i)
    {
        Widgets::MWAttributePtr attribute;
        char theIndex = '0'+i;

        getWidget(attribute,  std::string("Attribute").append(1, theIndex));
        attribute->setWindowManager(wm);
        attribute->setAttributeId(ESM::Attribute::attributeIds[i]);
        attribute->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
    }

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr cancelButton;
    getWidget(cancelButton, "CancelButton");
    cancelButton->setCaption(wm->getGameSettingString("sCancel", ""));
    cancelButton->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
}
Beispiel #4
0
ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment)
    : InfoBoxDialog(environment)
{
    WindowManager *mw = environment.mWindowManager;
    setText("");
    ButtonList buttons;
    buttons.push_back(mw->getGameSettingString("sClassChoiceMenu1", ""));
    buttons.push_back(mw->getGameSettingString("sClassChoiceMenu2", ""));
    buttons.push_back(mw->getGameSettingString("sClassChoiceMenu3", ""));
    buttons.push_back(mw->getGameSettingString("sBack", ""));
    setButtons(buttons);
}
Beispiel #5
0
void PickClassDialog::updateStats()
{
    if (currentClassId.empty())
        return;
    WindowManager *wm = environment.mWindowManager;
    ESMS::ESMStore &store = environment.mWorld->getStore();
    const ESM::Class *klass = store.classes.search(currentClassId);
    if (!klass)
        return;

    ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->data.specialization);

    static const char *specIds[3] = {
        "sSpecializationCombat",
        "sSpecializationMagic",
        "sSpecializationStealth"
    };
    specializationName->setCaption(wm->getGameSettingString(specIds[specialization], specIds[specialization]));

    favoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
    favoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);

    for (int i = 0; i < 5; ++i)
    {
        majorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
        minorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
    }

    classImage->setImageTexture(std::string("textures\\levelup\\") + currentClassId + ".dds");
}
Beispiel #6
0
PickClassDialog::PickClassDialog(MWWorld::Environment& environment)
  : WindowBase("openmw_chargen_class_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;
    setText("SpecializationT", wm->getGameSettingString("sChooseClassMenu1", "Specialization"));
    getWidget(specializationName, "SpecializationName");

    setText("FavoriteAttributesT", wm->getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
    getWidget(favoriteAttribute[0], "FavoriteAttribute0");
    getWidget(favoriteAttribute[1], "FavoriteAttribute1");
    favoriteAttribute[0]->setWindowManager(wm);
    favoriteAttribute[1]->setWindowManager(wm);

    setText("MajorSkillT", wm->getGameSettingString("sChooseClassMenu3", "Major Skills:"));
    setText("MinorSkillT", wm->getGameSettingString("sChooseClassMenu4", "Minor Skills:"));
    for(int i = 0; i < 5; i++)
    {
        char theIndex = '0'+i;
        getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
        getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
        majorSkill[i]->setWindowManager(wm);
        minorSkill[i]->setWindowManager(wm);
    }

    getWidget(classList, "ClassList");
    classList->setScrollVisible(true);
    classList->eventListSelectAccept = MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
    classList->eventListMouseItemActivate = MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
    classList->eventListChangePosition = MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);

    getWidget(classImage, "ClassImage");

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr backButton;
    getWidget(backButton, "BackButton");
    backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);

    MyGUI::ButtonPtr okButton;
    getWidget(okButton, "OKButton");
    okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);

    updateClasses();
    updateStats();
}
Beispiel #7
0
GenerateClassResultDialog::GenerateClassResultDialog(MWWorld::Environment& environment)
  : WindowBase("openmw_chargen_generate_class_result_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;
    setText("ReflectT", wm->getGameSettingString("sMessageQuestionAnswer1", ""));

    getWidget(classImage, "ClassImage");
    getWidget(className, "ClassName");

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr backButton;
    getWidget(backButton, "BackButton");
    backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);

    MyGUI::ButtonPtr okButton;
    getWidget(okButton, "OKButton");
    okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
}
Beispiel #8
0
void StatsWindow::updateSkillArea()
{
    for (std::vector<MyGUI::WidgetPtr>::iterator it = skillWidgets.begin(); it != skillWidgets.end(); ++it)
    {
        MyGUI::Gui::getInstance().destroyWidget(*it);
    }
    skillWidgets.clear();

    const int valueSize = 40;
    MyGUI::IntCoord coord1(10, 0, skillClientWidget->getWidth() - (10 + valueSize), 18);
    MyGUI::IntCoord coord2(coord1.left + coord1.width, coord1.top, valueSize, coord1.height);

    if (!majorSkills.empty())
        addSkills(majorSkills, "sSkillClassMajor", "Major Skills", coord1, coord2);

    if (!minorSkills.empty())
        addSkills(minorSkills, "sSkillClassMinor", "Minor Skills", coord1, coord2);

    if (!miscSkills.empty())
        addSkills(miscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);

    WindowManager *wm = environment.mWindowManager;
    ESMS::ESMStore &store = environment.mWorld->getStore();

    if (!factions.empty())
    {
        // Add a line separator if there are items above
        if (!skillWidgets.empty())
            addSeparator(coord1, coord2);

        addGroup(wm->getGameSettingString("sFaction", "Faction"), coord1, coord2);
        FactionList::const_iterator end = factions.end();
        for (FactionList::const_iterator it = factions.begin(); it != end; ++it)
        {
            const ESM::Faction *faction = store.factions.find(it->first);
            addItem(faction->name, coord1, coord2);
            // TODO: Faction rank should be placed in tooltip
        }
    }

    if (!birthSignId.empty())
    {
        // Add a line separator if there are items above
        if (!skillWidgets.empty())
            addSeparator(coord1, coord2);

        addGroup(wm->getGameSettingString("sSign", "Sign"), coord1, coord2);
        const ESM::BirthSign *sign = store.birthSigns.find(birthSignId);
        addItem(sign->name, coord1, coord2);
    }

    // Add a line separator if there are items above
    if (!skillWidgets.empty())
        addSeparator(coord1, coord2);

    addValueItem(wm->getGameSettingString("sReputation", "Reputation"), boost::lexical_cast<std::string>(static_cast<int>(reputation)), CS_Normal, coord1, coord2);
    addValueItem(wm->getGameSettingString("sBounty", "Bounty"), boost::lexical_cast<std::string>(static_cast<int>(bounty)), CS_Normal, coord1, coord2);

    clientHeight = coord1.top;
    updateScroller();
}
Beispiel #9
0
ReviewDialog::ReviewDialog(MWWorld::Environment& environment)
    : WindowBase("openmw_chargen_review_layout.xml", environment)
    , lastPos(0)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;

    // Setup static stats
    ButtonPtr button;
    getWidget(nameWidget, "NameText");
    getWidget(button, "NameButton");
    button->setCaption(wm->getGameSettingString("sName", ""));
    button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onNameClicked);;

    getWidget(raceWidget, "RaceText");
    getWidget(button, "RaceButton");
    button->setCaption(wm->getGameSettingString("sRace", ""));
    button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onRaceClicked);;

    getWidget(classWidget, "ClassText");
    getWidget(button, "ClassButton");
    button->setCaption(wm->getGameSettingString("sClass", ""));
    button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onClassClicked);;

    getWidget(birthSignWidget, "SignText");
    getWidget(button, "SignButton");
    button->setCaption(wm->getGameSettingString("sBirthSign", ""));
    button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onBirthSignClicked);;

    // Setup dynamic stats
    getWidget(health, "Health");
    health->setTitle(wm->getGameSettingString("sHealth", ""));
    health->setValue(45, 45);

    getWidget(magicka, "Magicka");
    magicka->setTitle(wm->getGameSettingString("sMagic", ""));
    magicka->setValue(50, 50);

    getWidget(fatigue, "Fatigue");
    fatigue->setTitle(wm->getGameSettingString("sFatigue", ""));
    fatigue->setValue(160, 160);

    // Setup attributes

    MWAttributePtr attribute;
    for (int idx = 0; idx < ESM::Attribute::Length; ++idx)
    {
        getWidget(attribute, std::string("Attribute") + boost::lexical_cast<std::string>(idx));
        attributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::attributeIds[idx]), attribute));
        attribute->setWindowManager(wm);
        attribute->setAttributeId(ESM::Attribute::attributeIds[idx]);
        attribute->setAttributeValue(MWAttribute::AttributeValue(0, 0));
    }

    // Setup skills
    getWidget(skillAreaWidget, "Skills");
    getWidget(skillClientWidget, "SkillClient");
    getWidget(skillScrollerWidget, "SkillScroller");

    skillScrollerWidget->eventScrollChangePosition = MyGUI::newDelegate(this, &ReviewDialog::onScrollChangePosition);
    updateScroller();

    for (int i = 0; i < ESM::Skill::Length; ++i)
    {
        skillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
        skillWidgetMap.insert(std::pair<int, MyGUI::StaticTextPtr>(i, nullptr));
    }

    static_cast<MyGUI::WindowPtr>(mMainWidget)->eventWindowChangeCoord = MyGUI::newDelegate(this, &ReviewDialog::onWindowResize);

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr backButton;
    getWidget(backButton, "BackButton");
    backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onBackClicked);

    MyGUI::ButtonPtr okButton;
    getWidget(okButton, "OKButton");
    okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
}
Beispiel #10
0
SelectSkillDialog::SelectSkillDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
  : WindowBase("openmw_chargen_select_skill_layout.xml", environment)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;

    setText("LabelT", wm->getGameSettingString("sSkillsMenu1", ""));
    setText("CombatLabelT", wm->getGameSettingString("sSpecializationCombat", ""));
    setText("MagicLabelT", wm->getGameSettingString("sSpecializationMagic", ""));
    setText("StealthLabelT", wm->getGameSettingString("sSpecializationStealth", ""));

    for(int i = 0; i < 9; i++)
    {
        char theIndex = '0'+i;
        getWidget(combatSkill[i],  std::string("CombatSkill").append(1, theIndex));
        getWidget(magicSkill[i],   std::string("MagicSkill").append(1, theIndex)); 
        getWidget(stealthSkill[i], std::string("StealthSkill").append(1, theIndex));
    }

    struct {Widgets::MWSkillPtr widget; ESM::Skill::SkillEnum skillId;} skills[3][9] = {
        {
            {combatSkill[0], ESM::Skill::Block},
            {combatSkill[1], ESM::Skill::Armorer},
            {combatSkill[2], ESM::Skill::MediumArmor},
            {combatSkill[3], ESM::Skill::HeavyArmor},
            {combatSkill[4], ESM::Skill::BluntWeapon},
            {combatSkill[5], ESM::Skill::LongBlade},
            {combatSkill[6], ESM::Skill::Axe},
            {combatSkill[7], ESM::Skill::Spear},
            {combatSkill[8], ESM::Skill::Athletics}
        },   
        {    
            {magicSkill[0], ESM::Skill::Enchant},
            {magicSkill[1], ESM::Skill::Destruction},
            {magicSkill[2], ESM::Skill::Alteration},
            {magicSkill[3], ESM::Skill::Illusion},
            {magicSkill[4], ESM::Skill::Conjuration},
            {magicSkill[5], ESM::Skill::Mysticism},
            {magicSkill[6], ESM::Skill::Restoration},
            {magicSkill[7], ESM::Skill::Alchemy},
            {magicSkill[8], ESM::Skill::Unarmored}
        },   
        {    
            {stealthSkill[0], ESM::Skill::Security},
            {stealthSkill[1], ESM::Skill::Sneak},
            {stealthSkill[2], ESM::Skill::Acrobatics},
            {stealthSkill[3], ESM::Skill::LightArmor},
            {stealthSkill[4], ESM::Skill::ShortBlade},
            {stealthSkill[5] ,ESM::Skill::Marksman},
            {stealthSkill[6] ,ESM::Skill::Mercantile},
            {stealthSkill[7] ,ESM::Skill::Speechcraft},
            {stealthSkill[8] ,ESM::Skill::HandToHand}
        }
    };

    for (int spec = 0; spec < 3; ++spec)
    {
        for (int i = 0; i < 9; ++i)
        {
            skills[spec][i].widget->setWindowManager(wm);
            skills[spec][i].widget->setSkillId(skills[spec][i].skillId);
            skills[spec][i].widget->eventClicked = MyGUI::newDelegate(this, &SelectSkillDialog::onSkillClicked);
        }
    }

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr cancelButton;
    getWidget(cancelButton, "CancelButton");
    cancelButton->setCaption(wm->getGameSettingString("sCancel", ""));
    cancelButton->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSkillDialog::onCancelClicked);
}
Beispiel #11
0
CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
  : WindowBase("openmw_chargen_create_class_layout.xml", environment)
  , specDialog(nullptr)
  , attribDialog(nullptr)
  , skillDialog(nullptr)
  , descDialog(nullptr)
{
    // Centre dialog
    center();

    WindowManager *wm = environment.mWindowManager;
    setText("SpecializationT", wm->getGameSettingString("sChooseClassMenu1", "Specialization"));
    getWidget(specializationName, "SpecializationName");
    specializationName->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Combat], ""));
    specializationName->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationClicked);

    setText("FavoriteAttributesT", wm->getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
    getWidget(favoriteAttribute0, "FavoriteAttribute0");
    getWidget(favoriteAttribute1, "FavoriteAttribute1");
    favoriteAttribute0->setWindowManager(wm);
    favoriteAttribute1->setWindowManager(wm);
    favoriteAttribute0->eventClicked = MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
    favoriteAttribute1->eventClicked = MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);

    setText("MajorSkillT", wm->getGameSettingString("sSkillClassMajor", ""));
    setText("MinorSkillT", wm->getGameSettingString("sSkillClassMinor", ""));
    for(int i = 0; i < 5; i++)
    {
        char theIndex = '0'+i;
        getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
        getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
        skills.push_back(majorSkill[i]);
        skills.push_back(minorSkill[i]);
    }

    std::vector<Widgets::MWSkillPtr>::const_iterator end = skills.end();
    for (std::vector<Widgets::MWSkillPtr>::const_iterator it = skills.begin(); it != end; ++it)
    {
        (*it)->setWindowManager(wm);
        (*it)->eventClicked = MyGUI::newDelegate(this, &CreateClassDialog::onSkillClicked);
    }

    setText("LabelT", wm->getGameSettingString("sName", ""));
    getWidget(editName, "EditName");

    // Make sure the edit box has focus
    MyGUI::InputManager::getInstance().setKeyFocusWidget(editName);

    // TODO: These buttons should be managed by a Dialog class
    MyGUI::ButtonPtr descriptionButton;
    getWidget(descriptionButton, "DescriptionButton");
    descriptionButton->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionClicked);

    MyGUI::ButtonPtr backButton;
    getWidget(backButton, "BackButton");
    backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onBackClicked);

    MyGUI::ButtonPtr okButton;
    getWidget(okButton, "OKButton");
    okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &CreateClassDialog::onOkClicked);

    // Set default skills, attributes

    favoriteAttribute0->setAttributeId(ESM::Attribute::Strength);
    favoriteAttribute1->setAttributeId(ESM::Attribute::Agility);

    majorSkill[0]->setSkillId(ESM::Skill::Block);
    majorSkill[1]->setSkillId(ESM::Skill::Armorer);
    majorSkill[2]->setSkillId(ESM::Skill::MediumArmor);
    majorSkill[3]->setSkillId(ESM::Skill::HeavyArmor);
    majorSkill[4]->setSkillId(ESM::Skill::BluntWeapon);

    minorSkill[0]->setSkillId(ESM::Skill::LongBlade);
    minorSkill[1]->setSkillId(ESM::Skill::Axe);
    minorSkill[2]->setSkillId(ESM::Skill::Spear);
    minorSkill[3]->setSkillId(ESM::Skill::Athletics);
    minorSkill[4]->setSkillId(ESM::Skill::Enchant);
}