mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Show tooltip for non-affordable list items (Fixes #2025)
This commit is contained in:
parent
2106893563
commit
2be65a89a7
4 changed files with 21 additions and 7 deletions
|
@ -73,7 +73,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
|
||||
|
||||
MyGUI::Button* button =
|
||||
mList->createWidget<MyGUI::Button>("SandTextButton",
|
||||
mList->createWidget<MyGUI::Button>(price <= playerGold ? "SandTextButton" : "SandTextButtonDisabled", // can't use setEnabled since that removes tooltip
|
||||
0,
|
||||
currentY,
|
||||
0,
|
||||
|
@ -83,7 +83,6 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
|
||||
currentY += 18;
|
||||
|
||||
button->setEnabled(price<=playerGold);
|
||||
button->setUserString("Price", boost::lexical_cast<std::string>(price));
|
||||
button->setUserData(*iter);
|
||||
button->setCaptionWithReplacing(name);
|
||||
|
@ -124,6 +123,10 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
|||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
int price = boost::lexical_cast<int>(sender->getUserString("Price"));
|
||||
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
|
||||
return;
|
||||
|
||||
// repair
|
||||
MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>();
|
||||
item.getCellRef().setCharge(item.getClass().getItemMaxHealth(item));
|
||||
|
@ -132,7 +135,6 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
|||
|
||||
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1);
|
||||
|
||||
int price = boost::lexical_cast<int>(sender->getUserString("Price"));
|
||||
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
|
||||
|
|
|
@ -54,14 +54,13 @@ namespace MWGui
|
|||
|
||||
MyGUI::Button* toAdd =
|
||||
mSpellsView->createWidget<MyGUI::Button>(
|
||||
"SandTextButton",
|
||||
price <= playerGold ? "SandTextButton" : "SandTextButtonDisabled", // can't use setEnabled since that removes tooltip
|
||||
0,
|
||||
mCurrentY,
|
||||
200,
|
||||
sLineHeight,
|
||||
MyGUI::Align::Default
|
||||
);
|
||||
toAdd->setEnabled(price<=playerGold);
|
||||
|
||||
mCurrentY += sLineHeight;
|
||||
|
||||
|
@ -140,6 +139,9 @@ namespace MWGui
|
|||
int price = *_sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
|
||||
return;
|
||||
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (mSpellsWidgetMap.find(_sender)->second);
|
||||
|
|
|
@ -93,10 +93,9 @@ namespace MWGui
|
|||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer
|
||||
(mPtr,pcStats.getSkill (skills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true);
|
||||
|
||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>("SandTextButton",
|
||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(price <= playerGold ? "SandTextButton" : "SandTextButtonDisabled", // can't use setEnabled since that removes tooltip
|
||||
MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default);
|
||||
|
||||
button->setEnabled(price <= playerGold);
|
||||
button->setUserData(skills[i].first);
|
||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
|
||||
|
||||
|
@ -133,6 +132,9 @@ namespace MWGui
|
|||
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
|
||||
return;
|
||||
|
||||
MWMechanics::NpcStats& npcStats = mPtr.getClass().getNpcStats (mPtr);
|
||||
if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ())
|
||||
{
|
||||
|
|
|
@ -100,6 +100,14 @@ color_misc=0,205,205 # ????
|
|||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceSkin" name="SandTextButtonDisabled" size="16 16">
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="TextAlign" value="Left Bottom"/>
|
||||
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch">
|
||||
<State name="normal" colour="#{fontcolour=disabled}" shift="0"/>
|
||||
</BasisSkin>
|
||||
</Resource>
|
||||
|
||||
<Resource type="ResourceSkin" name="SpellTextUnequipped" size="16 16">
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="TextAlign" value="Left Bottom"/>
|
||||
|
|
Loading…
Reference in a new issue