Merge branch 'master' into 'master'
Some checks are pending
Build and test / Ubuntu (push) Waiting to run
Build and test / MacOS (push) Waiting to run
Build and test / Read .env file and expose it as output (push) Waiting to run
Build and test / Windows (2019) (push) Blocked by required conditions
Build and test / Windows (2022) (push) Blocked by required conditions

Add Player Gold Counter to Spell Creation Window

See merge request OpenMW/openmw!4610
This commit is contained in:
Garrett 2025-04-27 13:22:41 +00:00
commit e4e857e3e7
6 changed files with 30 additions and 4 deletions

View file

@ -50,7 +50,7 @@ namespace MWGui
getWidget(mBuyButton, "BuyButton");
getWidget(mPrice, "PriceLabel");
getWidget(mPriceText, "PriceTextLabel");
getWidget(mPlayerGold, "PlayerGold");
setWidgets(mAvailableEffectsList, mUsedEffectsView);
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onCancelButtonClicked);
@ -65,6 +65,10 @@ namespace MWGui
{
center();
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mName);
MWWorld::Ptr player = MWMechanics::getPlayer();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing(MyGUI::utility::toString(playerGold));
}
void EnchantingDialog::setSoulGem(const MWWorld::Ptr& gem)

View file

@ -70,6 +70,7 @@ namespace MWGui
MyGUI::TextBox* mSuccessChance;
MyGUI::TextBox* mPrice;
MyGUI::TextBox* mPriceText;
MyGUI::TextBox* mPlayerGold;
MWMechanics::Enchanting mEnchanting;
ESM::EffectList mEffectList;

View file

@ -30,7 +30,6 @@
namespace
{
bool sortMagicEffects(short id1, short id2)
{
const MWWorld::Store<ESM::GameSetting>& gmst
@ -352,6 +351,7 @@ namespace MWGui
getWidget(mAvailableEffectsList, "AvailableEffects");
getWidget(mUsedEffectsView, "UsedEffects");
getWidget(mPriceLabel, "PriceLabel");
getWidget(mPlayerGold, "PlayerGold");
getWidget(mBuyButton, "BuyButton");
getWidget(mCancelButton, "CancelButton");
@ -370,6 +370,10 @@ namespace MWGui
mPtr = actor;
mNameEdit->setCaption({});
MWWorld::Ptr player = MWMechanics::getPlayer();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing(MyGUI::utility::toString(playerGold));
startEditing();
}

View file

@ -175,6 +175,7 @@ namespace MWGui
MyGUI::Button* mBuyButton;
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPriceLabel;
MyGUI::TextBox* mPlayerGold;
ESM::Spell mSpell;
};

View file

@ -138,6 +138,14 @@
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{sEnchantmentHelp7}"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="NormalText" name="GoldTextLabel">
<Property key="Caption" value="#{sGold}"/>
<UserString key="ToolTipType" value="Layout"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" name="PlayerGold">
<Property key="Caption" value="0"/>
</Widget>
<Widget type="Spacer"/>

View file

@ -41,7 +41,7 @@
<Property key="TextAlign" value="Right HCenter"/>
<Property key="NeedMouse" value="false"/>
</Widget>
<!-- Available effects -->
<Widget type="TextBox" skin="NormalText" position="12 48 300 24">
<Property key="Caption" value="#{sMagicEffects}"/>
@ -68,6 +68,15 @@
<Widget type="HBox" position="0 336 558 60">
<Property key="Padding" value="16"/>
<Widget type="AutoSizedTextBox" skin="NormalText">
<Property key="Caption" value="#{sGold}"/>
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{sYourGold}"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" name="PlayerGold">
</Widget>
<Widget type="Spacer"/>
<Widget type="AutoSizedTextBox" skin="NormalText">
@ -79,7 +88,6 @@
<Widget type="AutoSizedTextBox" skin="SandText" name="PriceLabel">
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" name="BuyButton">
<Property key="Caption" value="#{sBuy}"/>
</Widget>