|
|
@ -17,6 +17,21 @@
|
|
|
|
#include "draganddrop.hpp"
|
|
|
|
#include "draganddrop.hpp"
|
|
|
|
#include "countdialog.hpp"
|
|
|
|
#include "countdialog.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int getProfit(const MWWorld::Ptr& actor)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string script = actor.getClass().getScript(actor);
|
|
|
|
|
|
|
|
if (!script.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return actor.getRefData().getLocals().getIntVar(script, "minimumprofit");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -116,13 +131,12 @@ void CompanionWindow::updateEncumbranceBar()
|
|
|
|
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
|
|
|
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
|
|
|
mEncumbranceBar->setValue(encumbrance, capacity);
|
|
|
|
mEncumbranceBar->setValue(encumbrance, capacity);
|
|
|
|
|
|
|
|
|
|
|
|
if (mPtr.getTypeName() != typeid(ESM::NPC).name())
|
|
|
|
if (mModel && mModel->hasProfit(mPtr))
|
|
|
|
mProfitLabel->setCaption("");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWMechanics::NpcStats& stats = mPtr.getClass().getNpcStats(mPtr);
|
|
|
|
mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + MyGUI::utility::toString(getProfit(mPtr)));
|
|
|
|
mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + MyGUI::utility::toString(stats.getProfit()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
mProfitLabel->setCaption("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
|
|
@ -132,7 +146,7 @@ void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
|
|
|
|
|
|
|
|
void CompanionWindow::exit()
|
|
|
|
void CompanionWindow::exit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && mPtr.getClass().getNpcStats(mPtr).getProfit() < 0)
|
|
|
|
if (mModel && mModel->hasProfit(mPtr) && getProfit(mPtr) < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::vector<std::string> buttons;
|
|
|
|
std::vector<std::string> buttons;
|
|
|
|
buttons.push_back("#{sCompanionWarningButtonOne}");
|
|
|
|
buttons.push_back("#{sCompanionWarningButtonOne}");
|
|
|
@ -148,9 +162,6 @@ void CompanionWindow::onMessageBoxButtonClicked(int button)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (button == 0)
|
|
|
|
if (button == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mPtr.getRefData().getLocals().setVarByInt(mPtr.getClass().getScript(mPtr),
|
|
|
|
|
|
|
|
"minimumprofit", mPtr.getClass().getNpcStats(mPtr).getProfit());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
|
|
|
// Important for Calvus' contract script to work properly
|
|
|
|
// Important for Calvus' contract script to work properly
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
|
|
|