mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
85707b5e3e
@ -511,13 +511,13 @@ void OMW::Engine::activate()
|
||||
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action =
|
||||
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
interpreterContext.activate (ptr, action);
|
||||
|
||||
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
|
||||
|
||||
MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
if (!script.empty())
|
||||
{
|
||||
|
@ -104,13 +104,17 @@ namespace MWBase
|
||||
* @brief Commit a crime. If any actors witness the crime and report it,
|
||||
* reportCrime will be called automatically.
|
||||
* @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen.
|
||||
* @return was the crime reported?
|
||||
*/
|
||||
virtual void commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
virtual bool commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
OffenseType type, int arg=0) = 0;
|
||||
virtual void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
OffenseType type, int arg=0) = 0;
|
||||
/// Utility to check if taking this item is illegal and calling commitCrime if so
|
||||
virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, int count) = 0;
|
||||
/// Attempt sleeping in a bed. If this is illegal, call commitCrime.
|
||||
/// @return was it illegal, and someone saw you doing it?
|
||||
virtual bool sleepInBed (const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed) = 0;
|
||||
|
||||
enum PersuasionType
|
||||
{
|
||||
|
@ -112,6 +112,7 @@ namespace MWBase
|
||||
virtual const MWWorld::Fallback *getFallback () const = 0;
|
||||
|
||||
virtual MWWorld::Player& getPlayer() = 0;
|
||||
virtual MWWorld::Ptr getPlayerPtr() = 0;
|
||||
|
||||
virtual const MWWorld::ESMStore& getStore() const = 0;
|
||||
|
||||
@ -430,11 +431,10 @@ namespace MWBase
|
||||
|
||||
virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result) = 0;
|
||||
|
||||
/// Teleports \a ptr to the reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
|
||||
/// closest to \a worldPos.
|
||||
/// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
|
||||
/// @note id must be lower case
|
||||
virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr,
|
||||
const std::string& id, Ogre::Vector3 worldPos) = 0;
|
||||
const std::string& id) = 0;
|
||||
|
||||
enum DetectionType
|
||||
{
|
||||
@ -447,6 +447,10 @@ namespace MWBase
|
||||
/// @note This also works for references in containers.
|
||||
virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out,
|
||||
DetectionType type) = 0;
|
||||
|
||||
/// Update the value of some globals according to the world state, which may be used by dialogue entries.
|
||||
/// This should be called when initiating a dialogue.
|
||||
virtual void updateDialogueGlobals() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "../mwworld/actionopen.hpp"
|
||||
#include "../mwworld/actiontrap.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
@ -108,7 +107,7 @@ namespace MWClass
|
||||
const std::string lockedSound = "LockedChest";
|
||||
const std::string trapActivationSound = "Disarm Trap Fail";
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
|
||||
bool needKey = ptr.getCellRef().mLockLevel>0;
|
||||
|
@ -100,7 +100,7 @@ namespace MWClass
|
||||
|
||||
// TODO: this is not quite correct, in vanilla the merchant's gold pool is not available in his inventory.
|
||||
// (except for gold you gave him)
|
||||
data->mContainerStore.add("gold_001", ref->mBase->mData.mGold, ptr);
|
||||
data->mContainerStore.add(MWWorld::ContainerStore::sGoldId, ref->mBase->mData.mGold, ptr);
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/failedaction.hpp"
|
||||
@ -97,7 +96,7 @@ namespace MWClass
|
||||
|
||||
if (needKey && hasKey)
|
||||
{
|
||||
if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer())
|
||||
if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}");
|
||||
ptr.getCellRef().mLockLevel = 0;
|
||||
// using a key disarms the trap
|
||||
@ -118,7 +117,7 @@ namespace MWClass
|
||||
{
|
||||
// teleport door
|
||||
/// \todo remove this if clause once ActionTeleport can also support other actors
|
||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
||||
if (MWBase::Environment::get().getWorld()->getPlayerPtr()==actor)
|
||||
{
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest));
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/actioneat.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
@ -153,7 +152,7 @@ namespace MWClass
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
|
||||
|
||||
|
@ -93,7 +93,9 @@ namespace MWClass
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
int value = (ptr.getCellRef().mGoldValue == 1) ? ref->mBase->mData.mValue : ptr.getCellRef().mGoldValue;
|
||||
int value = ref->mBase->mData.mValue;
|
||||
if (ptr.getCellRef().mGoldValue > 1 && ptr.getRefData().getCount() == 1)
|
||||
value = ptr.getCellRef().mGoldValue;
|
||||
|
||||
if (ptr.getCellRef().mSoul != "")
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ namespace MWClass
|
||||
|
||||
// TODO: this is not quite correct, in vanilla the merchant's gold pool is not available in his inventory.
|
||||
// (except for gold you gave him)
|
||||
getContainerStore(ptr).add("gold_001", gold, ptr);
|
||||
getContainerStore(ptr).add(MWWorld::ContainerStore::sGoldId, gold, ptr);
|
||||
|
||||
getInventoryStore(ptr).autoEquip(ptr);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
@ -133,7 +132,7 @@ namespace MWClass
|
||||
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->mBase->mEffects);
|
||||
|
||||
// hide effects the player doesnt know about
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
|
||||
int i=0;
|
||||
@ -167,7 +166,7 @@ namespace MWClass
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// remove used potion (assume it is present in inventory)
|
||||
ptr.getContainerStore()->remove(ptr, 1, actor);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/dialogue.hpp"
|
||||
|
||||
@ -144,6 +143,7 @@ namespace MWDialogue
|
||||
|
||||
//setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
|
||||
updateTopics();
|
||||
updateGlobals();
|
||||
|
||||
//greeting
|
||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||
@ -299,6 +299,11 @@ namespace MWDialogue
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueManager::updateGlobals()
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->updateDialogueGlobals();
|
||||
}
|
||||
|
||||
void DialogueManager::updateTopics()
|
||||
{
|
||||
std::list<std::string> keywordList;
|
||||
@ -493,7 +498,7 @@ namespace MWDialogue
|
||||
else if (curDisp + mTemporaryDispositionChange > 100)
|
||||
mTemporaryDispositionChange = 100 - curDisp;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1);
|
||||
|
||||
std::string text;
|
||||
|
@ -40,6 +40,7 @@ namespace MWDialogue
|
||||
void parseText (const std::string& text);
|
||||
|
||||
void updateTopics();
|
||||
void updateGlobals();
|
||||
|
||||
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
||||
void executeScript (const std::string& script);
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
@ -93,7 +92,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
||||
|
||||
bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
|
||||
{
|
||||
const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// check player faction
|
||||
if (!info.mPcFaction.empty())
|
||||
@ -212,7 +211,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
||||
|
||||
case SelectWrapper::Function_PcHealthPercent:
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
float ratio = MWWorld::Class::get (player).getCreatureStats (player).getHealth().getCurrent() /
|
||||
MWWorld::Class::get (player).getCreatureStats (player).getHealth().getModified();
|
||||
@ -222,7 +221,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
||||
|
||||
case SelectWrapper::Function_PcDynamicStat:
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
float value = MWWorld::Class::get (player).getCreatureStats (player).
|
||||
getDynamic (select.getArgument()).getCurrent();
|
||||
@ -246,7 +245,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
||||
|
||||
int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) const
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
switch (select.getFunction())
|
||||
{
|
||||
@ -420,7 +419,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
||||
|
||||
bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) const
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
switch (select.getFunction())
|
||||
{
|
||||
@ -508,9 +507,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
||||
std::string faction =
|
||||
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
|
||||
std::set<std::string>& expelled = MWWorld::Class::get (player).getNpcStats (player).getExpelled();
|
||||
|
||||
return expelled.find (faction)!=expelled.end();
|
||||
return player.getClass().getNpcStats(player).getExpelled(faction);
|
||||
}
|
||||
|
||||
case SelectWrapper::Function_PcVampire:
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "inventoryitemmodel.hpp"
|
||||
@ -143,9 +142,9 @@ namespace MWGui
|
||||
|
||||
void AlchemyWindow::open()
|
||||
{
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mSortModel = new SortFilterItemModel(model);
|
||||
mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients);
|
||||
mItemView->setModel (mSortModel);
|
||||
@ -154,7 +153,7 @@ namespace MWGui
|
||||
|
||||
int index = 0;
|
||||
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools());
|
||||
iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
|
||||
@ -138,7 +137,7 @@ namespace MWGui
|
||||
MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0);
|
||||
|
||||
MWWorld::ActionTake take(mBook);
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/fallback.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -47,7 +46,7 @@ namespace
|
||||
|
||||
void updatePlayerHealth()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
|
||||
creatureStats.updateHealth();
|
||||
@ -220,7 +219,7 @@ namespace MWGui
|
||||
mReviewDialog->setBirthSign(mPlayerBirthSignId);
|
||||
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
|
||||
mReviewDialog->setHealth ( stats.getHealth() );
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwmechanics/pickpocket.hpp"
|
||||
@ -223,7 +222,7 @@ namespace MWGui
|
||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot)
|
||||
{
|
||||
// we are stealing stuff
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
mModel = new PickpocketItemModel(player, new InventoryItemModel(container));
|
||||
}
|
||||
else
|
||||
@ -251,12 +250,12 @@ namespace MWGui
|
||||
&& !mPickpocketDetected
|
||||
)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::Pickpocket pickpocket(player, mPtr);
|
||||
if (pickpocket.finish())
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->reportCrime(
|
||||
player, MWWorld::Ptr(), MWBase::MechanicsManager::OT_Pickpocket);
|
||||
player, mPtr, MWBase::MechanicsManager::OT_Pickpocket);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
|
||||
MWBase::Environment::get().getDialogueManager()->say(mPtr, "Thief");
|
||||
mPickpocketDetected = true;
|
||||
@ -325,7 +324,7 @@ namespace MWGui
|
||||
|
||||
bool ContainerWindow::onTakeItem(const ItemStack &item, int count)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if (dynamic_cast<PickpocketItemModel*>(mModel))
|
||||
{
|
||||
MWMechanics::Pickpocket pickpocket(player, mPtr);
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
||||
@ -21,7 +20,6 @@
|
||||
#include "list.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
#include "spellbuyingwindow.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
#include "travelwindow.hpp"
|
||||
#include "bookpage.hpp"
|
||||
|
||||
@ -69,24 +67,24 @@ namespace MWGui
|
||||
|
||||
void PersuasionDialog::onPersuade(MyGUI::Widget *sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWBase::MechanicsManager::PersuasionType type;
|
||||
if (sender == mAdmireButton) type = MWBase::MechanicsManager::PT_Admire;
|
||||
else if (sender == mIntimidateButton) type = MWBase::MechanicsManager::PT_Intimidate;
|
||||
else if (sender == mTauntButton) type = MWBase::MechanicsManager::PT_Taunt;
|
||||
else if (sender == mBribe10Button)
|
||||
{
|
||||
player.getClass().getContainerStore(player).remove("gold_001", 10, player);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, 10, player);
|
||||
type = MWBase::MechanicsManager::PT_Bribe10;
|
||||
}
|
||||
else if (sender == mBribe100Button)
|
||||
{
|
||||
player.getClass().getContainerStore(player).remove("gold_001", 100, player);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, 100, player);
|
||||
type = MWBase::MechanicsManager::PT_Bribe100;
|
||||
}
|
||||
else /*if (sender == mBribe1000Button)*/
|
||||
{
|
||||
player.getClass().getContainerStore(player).remove("gold_001", 1000, player);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, 1000, player);
|
||||
type = MWBase::MechanicsManager::PT_Bribe1000;
|
||||
}
|
||||
|
||||
@ -100,7 +98,8 @@ namespace MWGui
|
||||
WindowModal::open();
|
||||
center();
|
||||
|
||||
int playerGold = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mBribe10Button->setEnabled (playerGold >= 10);
|
||||
mBribe100Button->setEnabled (playerGold >= 100);
|
||||
|
@ -5,13 +5,11 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "itemselection.hpp"
|
||||
#include "container.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
#include "sortfilteritemmodel.hpp"
|
||||
|
||||
@ -106,7 +104,7 @@ namespace MWGui
|
||||
|
||||
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
mEnchanting.setSelfEnchanting(true);
|
||||
mEnchanting.setEnchanter(player);
|
||||
@ -149,7 +147,7 @@ namespace MWGui
|
||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyEnchantable);
|
||||
}
|
||||
|
||||
@ -236,7 +234,7 @@ namespace MWGui
|
||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones);
|
||||
|
||||
//MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
|
||||
@ -290,7 +288,9 @@ namespace MWGui
|
||||
mEnchanting.setNewItemName(mName->getCaption());
|
||||
mEnchanting.setEffect(mEffectList);
|
||||
|
||||
if (mEnchanting.getEnchantPrice() > MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
if (mEnchanting.getEnchantPrice() > playerGold)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}");
|
||||
return;
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
@ -242,7 +241,7 @@ namespace MWGui
|
||||
if (world->canPlaceObject(mouseX, mouseY))
|
||||
world->placeObject(object, mouseX, mouseY, mDragAndDrop->mDraggedCount);
|
||||
else
|
||||
world->dropObjectOnGround(world->getPlayer().getPlayer(), object, mDragAndDrop->mDraggedCount);
|
||||
world->dropObjectOnGround(world->getPlayerPtr(), object, mDragAndDrop->mDraggedCount);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->changePointer("arrow");
|
||||
|
||||
@ -320,7 +319,7 @@ namespace MWGui
|
||||
|
||||
void HUD::onWeaponClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||
@ -332,7 +331,7 @@ namespace MWGui
|
||||
|
||||
void HUD::onMagicClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||
@ -517,7 +516,7 @@ namespace MWGui
|
||||
mWeapStatus->setProgressPosition(0);
|
||||
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
|
||||
mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds");
|
||||
else
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/action.hpp"
|
||||
@ -34,7 +33,7 @@ namespace MWGui
|
||||
, mTrading(false)
|
||||
, mLastXSize(0)
|
||||
, mLastYSize(0)
|
||||
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
||||
, mPreview(MWBase::Environment::get().getWorld ()->getPlayerPtr())
|
||||
, mPreviewDirty(true)
|
||||
, mDragAndDrop(dragAndDrop)
|
||||
, mSelectedItem(-1)
|
||||
@ -85,7 +84,7 @@ namespace MWGui
|
||||
|
||||
void InventoryWindow::updatePlayer()
|
||||
{
|
||||
mPtr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
mPtr = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
mTradeModel = new TradeItemModel(new InventoryItemModel(mPtr), MWWorld::Ptr());
|
||||
mSortModel = new SortFilterItemModel(mTradeModel);
|
||||
mItemView->setModel(mSortModel);
|
||||
@ -277,7 +276,7 @@ namespace MWGui
|
||||
|
||||
void InventoryWindow::open()
|
||||
{
|
||||
mPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
mPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
updateEncumbranceBar();
|
||||
|
||||
@ -373,7 +372,7 @@ namespace MWGui
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr);
|
||||
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
||||
// the "Take" button should not be visible.
|
||||
@ -433,7 +432,7 @@ namespace MWGui
|
||||
|
||||
void InventoryWindow::updateEncumbranceBar()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
float capacity = MWWorld::Class::get(player).getCapacity(player);
|
||||
float encumbrance = MWWorld::Class::get(player).getEncumbrance(player);
|
||||
@ -448,19 +447,6 @@ namespace MWGui
|
||||
updateEncumbranceBar();
|
||||
}
|
||||
|
||||
int InventoryWindow::getPlayerGold()
|
||||
{
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin();
|
||||
it != invStore.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, "gold_001"))
|
||||
return it->getRefData().getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InventoryWindow::setTrading(bool trading)
|
||||
{
|
||||
mTrading = trading;
|
||||
@ -513,12 +499,10 @@ namespace MWGui
|
||||
return;
|
||||
|
||||
int count = object.getRefData().getCount();
|
||||
if (object.getCellRef().mGoldValue > 1)
|
||||
count = object.getCellRef().mGoldValue;
|
||||
|
||||
// add to player inventory
|
||||
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player);
|
||||
// remove from world
|
||||
MWBase::Environment::get().getWorld()->deleteObject (object);
|
||||
|
@ -31,8 +31,6 @@ namespace MWGui
|
||||
|
||||
void pickUpObject (MWWorld::Ptr object);
|
||||
|
||||
int getPlayerGold();
|
||||
|
||||
MyGUI::IntCoord getAvatarScreenCoord();
|
||||
|
||||
MWWorld::Ptr getAvatarSelectedItem(int x, int y);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/fallback.hpp"
|
||||
|
||||
@ -59,7 +58,7 @@ namespace MWGui
|
||||
|
||||
void LevelupDialog::setAttributeValues()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
@ -115,7 +114,7 @@ namespace MWGui
|
||||
void LevelupDialog::open()
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
@ -155,7 +154,7 @@ namespace MWGui
|
||||
|
||||
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
|
@ -294,7 +294,7 @@ namespace MWGui
|
||||
std::vector<MWWorld::Ptr> markers;
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
world->listDetectedReferences(
|
||||
world->getPlayer().getPlayer(),
|
||||
world->getPlayerPtr(),
|
||||
markers, MWBase::World::DetectionType(type));
|
||||
if (markers.empty())
|
||||
return;
|
||||
@ -515,8 +515,8 @@ namespace MWGui
|
||||
// For interiors, position is set by WindowManager via setGlobalMapPlayerPosition
|
||||
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
||||
{
|
||||
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
||||
Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedOrientation ();
|
||||
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
||||
Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedOrientation ();
|
||||
Ogre::Vector2 dir (orient.yAxis ().x, orient.yAxis().y);
|
||||
|
||||
float worldX, worldY;
|
||||
|
@ -8,12 +8,9 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
@ -36,7 +33,9 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
||||
|
||||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
|
||||
@ -69,8 +68,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
||||
|
||||
|
||||
MyGUI::Button* button =
|
||||
mList->createWidget<MyGUI::Button>(
|
||||
(price>MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton",
|
||||
mList->createWidget<MyGUI::Button>("SandTextButton",
|
||||
0,
|
||||
currentY,
|
||||
0,
|
||||
@ -80,7 +78,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
||||
|
||||
currentY += 18;
|
||||
|
||||
button->setEnabled(price<=MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold());
|
||||
button->setEnabled(price<=playerGold);
|
||||
button->setUserString("Price", boost::lexical_cast<std::string>(price));
|
||||
button->setUserData(*iter);
|
||||
button->setCaptionWithReplacing(name);
|
||||
@ -93,7 +91,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
||||
mList->setCanvasSize (MyGUI::IntSize(mList->getWidth(), std::max(mList->getHeight(), currentY)));
|
||||
|
||||
mGoldLabel->setCaptionWithReplacing("#{sGold}: "
|
||||
+ boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()));
|
||||
+ boost::lexical_cast<std::string>(playerGold));
|
||||
}
|
||||
|
||||
void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
@ -119,8 +117,8 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
||||
|
||||
int price = boost::lexical_cast<int>(sender->getUserString("Price"));
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
player.getClass().getContainerStore(player).remove("gold_001", price, player);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
|
||||
startRepair(mActor);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace MWGui
|
||||
|
||||
MessageBoxManager::MessageBoxManager ()
|
||||
{
|
||||
// TODO: fMessageTimePerChar
|
||||
mMessageBoxSpeed = 0.1;
|
||||
mInterMessageBoxe = NULL;
|
||||
mStaticMessageBox = NULL;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
@ -126,7 +125,7 @@ namespace MWGui
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel);
|
||||
}
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
mAssignDialog->setVisible (false);
|
||||
}
|
||||
@ -267,7 +266,7 @@ namespace MWGui
|
||||
|
||||
QuickKeyType type = *button->getUserData<QuickKeyType>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
|
||||
if (type == Type_Item || type == Type_MagicItem)
|
||||
@ -311,7 +310,7 @@ namespace MWGui
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(item).use(item);
|
||||
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
||||
// the "Take" button should not be visible.
|
||||
@ -344,7 +343,7 @@ namespace MWGui
|
||||
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
||||
|
||||
MWWorld::ActionEquip action(item);
|
||||
action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ());
|
||||
action.execute (MWBase::Environment::get().getWorld ()->getPlayerPtr());
|
||||
}
|
||||
|
||||
store.setSelectedEnchantItem(it);
|
||||
@ -430,7 +429,7 @@ namespace MWGui
|
||||
|
||||
const int spellHeight = 18;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
@ -85,7 +84,7 @@ void Recharge::updateView()
|
||||
|
||||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin());
|
||||
iter!=store.end(); ++iter)
|
||||
@ -141,7 +140,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
||||
|
||||
MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
ReferenceInterface::ReferenceInterface()
|
||||
@ -18,7 +16,7 @@ namespace MWGui
|
||||
|
||||
void ReferenceInterface::checkReferenceAvailable()
|
||||
{
|
||||
MWWorld::Ptr::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||
MWWorld::Ptr::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
|
||||
// check if player has changed cell, or count of the reference has become 0
|
||||
if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL)
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
@ -88,7 +87,7 @@ void Repair::updateRepairView()
|
||||
|
||||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
|
||||
@ -90,7 +89,7 @@ namespace MWGui
|
||||
MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0);
|
||||
|
||||
MWWorld::ActionTake take(mScroll);
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
||||
}
|
||||
|
@ -8,14 +8,11 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
const int SpellBuyingWindow::sLineHeight = 18;
|
||||
@ -43,15 +40,19 @@ namespace MWGui
|
||||
int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat();
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
MyGUI::Button* toAdd =
|
||||
mSpellsView->createWidget<MyGUI::Button>(
|
||||
(price>MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton",
|
||||
"SandTextButton",
|
||||
0,
|
||||
mCurrentY,
|
||||
200,
|
||||
sLineHeight,
|
||||
MyGUI::Align::Default
|
||||
);
|
||||
toAdd->setEnabled(price<=playerGold);
|
||||
|
||||
mCurrentY += sLineHeight;
|
||||
|
||||
@ -103,7 +104,7 @@ namespace MWGui
|
||||
|
||||
bool SpellBuyingWindow::playerHasSpell(const std::string &id)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells();
|
||||
for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it)
|
||||
{
|
||||
@ -117,17 +118,14 @@ namespace MWGui
|
||||
{
|
||||
int price = *_sender->getUserData<int>();
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()>=price)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (mSpellsWidgetMap.find(_sender)->second);
|
||||
player.getClass().getContainerStore(player).remove("gold_001", price, player);
|
||||
startSpellBuying(mPtr);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (mSpellsWidgetMap.find(_sender)->second);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
startSpellBuying(mPtr);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
}
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
}
|
||||
|
||||
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
@ -137,7 +135,10 @@ namespace MWGui
|
||||
|
||||
void SpellBuyingWindow::updateLabels()
|
||||
{
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()));
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold));
|
||||
mPlayerGold->setCoord(8,
|
||||
mPlayerGold->getTop(),
|
||||
mPlayerGold->getTextSize().width,
|
||||
|
@ -7,14 +7,12 @@
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
#include "class.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -334,7 +332,10 @@ namespace MWGui
|
||||
return;
|
||||
}
|
||||
|
||||
if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > playerGold)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}");
|
||||
return;
|
||||
@ -342,9 +343,7 @@ namespace MWGui
|
||||
|
||||
mSpell.mName = mNameEdit->getCaption();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
player.getClass().getContainerStore(player).remove("gold_001", boost::lexical_cast<int>(mPriceLabel->getCaption()), player);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, boost::lexical_cast<int>(mPriceLabel->getCaption()), player);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
|
||||
@ -414,7 +413,7 @@ namespace MWGui
|
||||
|
||||
mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price)));
|
||||
|
||||
float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mSuccessChance->setCaption(boost::lexical_cast<std::string>(int(chance)));
|
||||
}
|
||||
|
||||
@ -441,7 +440,7 @@ namespace MWGui
|
||||
{
|
||||
// get the list of magic effects that are known to the player
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
@ -40,7 +39,7 @@ namespace MWGui
|
||||
{
|
||||
// TODO: Tracking add/remove/expire would be better than force updating every frame
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
|
||||
@ -81,7 +80,7 @@ namespace MWGui
|
||||
|
||||
// retrieve all player spells, divide them into Powers and Spells and sort them
|
||||
std::vector<std::string> spellList;
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
@ -298,7 +297,7 @@ namespace MWGui
|
||||
|
||||
void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>();
|
||||
|
||||
@ -320,7 +319,7 @@ namespace MWGui
|
||||
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
||||
|
||||
MWWorld::ActionEquip action(item);
|
||||
action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ());
|
||||
action.execute (MWBase::Environment::get().getWorld ()->getPlayerPtr());
|
||||
|
||||
// since we changed equipping status, update the inventory window
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
|
||||
@ -335,7 +334,7 @@ namespace MWGui
|
||||
void SpellWindow::onSpellSelected(MyGUI::Widget* _sender)
|
||||
{
|
||||
std::string spellId = _sender->getUserString("Spell");
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
|
||||
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||
@ -389,7 +388,7 @@ namespace MWGui
|
||||
|
||||
void SpellWindow::onDeleteSpellAccept()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
@ -224,7 +224,7 @@ namespace MWGui
|
||||
if (!mMainWidget->getVisible())
|
||||
return;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
|
||||
// level progress
|
||||
@ -424,7 +424,7 @@ namespace MWGui
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::ESMStore &store = world->getStore();
|
||||
const ESM::NPC *player =
|
||||
world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
|
||||
// race tooltip
|
||||
const ESM::Race* playerRace = store.get<ESM::Race>().find(player->mRace);
|
||||
@ -452,7 +452,7 @@ namespace MWGui
|
||||
if (!mSkillWidgets.empty())
|
||||
addSeparator(coord1, coord2);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
const std::set<std::string> &expelled = PCstats.getExpelled();
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace MWGui
|
||||
if(!mMerchant.isEmpty())
|
||||
{
|
||||
MWWorld::Ptr base = item.mBase;
|
||||
if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, "gold_001"))
|
||||
if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, MWWorld::ContainerStore::sGoldId))
|
||||
continue;
|
||||
if(!MWWorld::Class::get(base).canSell(base, services))
|
||||
continue;
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "itemview.hpp"
|
||||
#include "sortfilteritemmodel.hpp"
|
||||
@ -212,11 +210,11 @@ namespace MWGui
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
store.add("gold_001", amount, actor);
|
||||
store.add(MWWorld::ContainerStore::sGoldId, amount, actor);
|
||||
}
|
||||
else
|
||||
{
|
||||
store.remove("gold_001", - amount, actor);
|
||||
store.remove(MWWorld::ContainerStore::sGoldId, - amount, actor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,8 +251,11 @@ namespace MWGui
|
||||
return;
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
// check if the player can afford this
|
||||
if (mCurrentBalance < 0 && MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold() < std::abs(mCurrentBalance))
|
||||
if (mCurrentBalance < 0 && playerGold < std::abs(mCurrentBalance))
|
||||
{
|
||||
// user notification
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
@ -271,8 +272,6 @@ namespace MWGui
|
||||
return;
|
||||
}
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
if(mCurrentBalance > mCurrentMerchantOffer)
|
||||
{
|
||||
//if npc is a creature: reject (no haggle)
|
||||
@ -294,8 +293,8 @@ namespace MWGui
|
||||
float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
|
||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()),100));
|
||||
|
||||
const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(mPtr).getNpcStats(mPtr);
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
const MWMechanics::NpcStats &sellerStats = mPtr.getClass().getNpcStats(mPtr);
|
||||
const MWMechanics::NpcStats &playerStats = player.getClass().getNpcStats(player);
|
||||
|
||||
float a1 = std::min(playerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100);
|
||||
float b1 = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
||||
@ -324,7 +323,7 @@ namespace MWGui
|
||||
}
|
||||
|
||||
//skill use!
|
||||
MWWorld::Class::get(playerPtr).skillUsageSucceeded(playerPtr, ESM::Skill::Mercantile, 0);
|
||||
player.getClass().skillUsageSucceeded(player, ESM::Skill::Mercantile, 0);
|
||||
}
|
||||
|
||||
int iBarterSuccessDisposition = gmst.find("iBarterSuccessDisposition")->getInt();
|
||||
@ -337,7 +336,7 @@ namespace MWGui
|
||||
// transfer the gold
|
||||
if (mCurrentBalance != 0)
|
||||
{
|
||||
addOrRemoveGold(mCurrentBalance, playerPtr);
|
||||
addOrRemoveGold(mCurrentBalance, player);
|
||||
addOrRemoveGold(-mCurrentBalance, mPtr);
|
||||
}
|
||||
|
||||
@ -398,7 +397,10 @@ namespace MWGui
|
||||
|
||||
void TradeWindow::updateLabels()
|
||||
{
|
||||
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()));
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(playerGold));
|
||||
|
||||
if (mCurrentBalance > 0)
|
||||
{
|
||||
@ -447,7 +449,7 @@ namespace MWGui
|
||||
MWWorld::ContainerStore store = mPtr.getClass().getContainerStore(mPtr);
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, "gold_001"))
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, MWWorld::ContainerStore::sGoldId))
|
||||
merchantGold += it->getRefData().getCount();
|
||||
}
|
||||
return merchantGold;
|
||||
|
@ -28,8 +28,6 @@ namespace MWGui
|
||||
|
||||
void startTrade(const MWWorld::Ptr& actor);
|
||||
|
||||
void addOrRemoveGold(int gold, const MWWorld::Ptr& actor);
|
||||
|
||||
void onFrame(float frameDuration);
|
||||
|
||||
void borrowItem (int index, size_t count);
|
||||
@ -95,6 +93,8 @@ namespace MWGui
|
||||
void onIncreaseButtonTriggered();
|
||||
void onDecreaseButtonTriggered();
|
||||
|
||||
void addOrRemoveGold(int gold, const MWWorld::Ptr& actor);
|
||||
|
||||
void updateLabels();
|
||||
|
||||
virtual void onReferenceUnavailable();
|
||||
|
@ -9,13 +9,11 @@
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "tooltips.hpp"
|
||||
|
||||
namespace MWGui
|
||||
@ -41,7 +39,10 @@ namespace MWGui
|
||||
{
|
||||
mPtr = actor;
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()));
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold));
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats (actor);
|
||||
|
||||
@ -72,7 +73,6 @@ namespace MWGui
|
||||
MyGUI::EnumeratorWidgetPtr widgets = mTrainingOptions->getEnumerator ();
|
||||
MyGUI::Gui::getInstance ().destroyWidgets (widgets);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
@ -83,11 +83,10 @@ namespace MWGui
|
||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer
|
||||
(mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true);
|
||||
|
||||
std::string skin = (price > MWBase::Environment::get().getWindowManager()->getInventoryWindow ()->getPlayerGold ()) ? "SandTextGreyedOut" : "SandTextButton";
|
||||
|
||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(skin,
|
||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>("SandTextButton",
|
||||
MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default);
|
||||
|
||||
button->setEnabled(price <= playerGold);
|
||||
button->setUserData(bestSkills[i].first);
|
||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
|
||||
|
||||
@ -115,7 +114,7 @@ namespace MWGui
|
||||
{
|
||||
int skillId = *sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
const MWWorld::ESMStore &store =
|
||||
@ -124,9 +123,6 @@ 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 (MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()<price)
|
||||
return;
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr);
|
||||
if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ())
|
||||
{
|
||||
@ -142,7 +138,7 @@ namespace MWGui
|
||||
pcStats.increaseSkill (skillId, *class_, true);
|
||||
|
||||
// remove gold
|
||||
player.getClass().getContainerStore(player).remove("gold_001", price, player);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
|
||||
// go back to game mode
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <OgreVector3.h>
|
||||
|
||||
#include <libs/openengine/ogre/fader.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
@ -9,12 +11,9 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
const int TravelWindow::sLineHeight = 18;
|
||||
@ -51,13 +50,15 @@ namespace MWGui
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
if(interior)
|
||||
{
|
||||
price = gmst.find("fMagesGuildTravel")->getFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
ESM::Position PlayerPos = player.getRefData().getPosition();
|
||||
float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2) );
|
||||
price = d/gmst.find("fTravelMult")->getFloat();
|
||||
@ -65,7 +66,8 @@ namespace MWGui
|
||||
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>((price>MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
||||
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>("SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
||||
toAdd->setEnabled(price<=playerGold);
|
||||
mCurrentY += sLineHeight;
|
||||
if(interior)
|
||||
toAdd->setUserString("interior","y");
|
||||
@ -121,13 +123,14 @@ namespace MWGui
|
||||
int price;
|
||||
iss >> price;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()<price)
|
||||
if (playerGold<price)
|
||||
return;
|
||||
|
||||
|
||||
player.getClass().getContainerStore(player).remove("gold_001", price, player);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
|
||||
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(1);
|
||||
ESM::Position pos = *_sender->getUserData<ESM::Position>();
|
||||
@ -166,7 +169,10 @@ namespace MWGui
|
||||
|
||||
void TravelWindow::updateLabels()
|
||||
{
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold()));
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold));
|
||||
mPlayerGold->setCoord(8,
|
||||
mPlayerGold->getTop(),
|
||||
mPlayerGold->getTextSize().width,
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
@ -148,7 +147,7 @@ namespace MWGui
|
||||
// we need to sleep for a specific time, and since that isn't calculated yet, we'll do it here
|
||||
// I'm making the assumption here that the # of hours rested is calculated when rest is started
|
||||
// TODO: the rougher logic here (calculating the hourly deltas) should really go into helper funcs elsewhere
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
@ -218,7 +217,7 @@ namespace MWGui
|
||||
|
||||
void WaitDialog::setCanRest (bool canRest)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified())
|
||||
&& (stats.getHealth().getCurrent() >= stats.getHealth().getModified())
|
||||
@ -272,7 +271,7 @@ namespace MWGui
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_RestBed);
|
||||
mWaiting = false;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &pcstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
|
||||
// trigger levelup if possible
|
||||
|
@ -355,7 +355,7 @@ namespace MWInput
|
||||
// if player tried to start moving, but can't (due to being overencumbered), display a notification.
|
||||
if (triedToMove)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
mOverencumberedMessageDelay -= dt;
|
||||
if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player))
|
||||
{
|
||||
@ -555,7 +555,7 @@ namespace MWInput
|
||||
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||
{
|
||||
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
||||
if (b)
|
||||
if (b && b->getEnabled())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
|
||||
@ -163,7 +162,7 @@ namespace MWMechanics
|
||||
{
|
||||
CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
//engage combat or not?
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(ptr != player && !creatureStats.isHostile())
|
||||
{
|
||||
ESM::Position playerpos = player.getRefData().getPosition();
|
||||
@ -585,7 +584,7 @@ namespace MWMechanics
|
||||
ptr.getClass().setActorHealth(ptr, stats.getHealth().getCurrent() - 3.0f*duration);
|
||||
|
||||
// Play a drowning sound as necessary for the player
|
||||
if(ptr == world->getPlayer().getPlayer())
|
||||
if(ptr == world->getPlayerPtr())
|
||||
{
|
||||
MWBase::SoundManager *sndmgr = MWBase::Environment::get().getSoundManager();
|
||||
if(!sndmgr->getSoundPlaying(MWWorld::Ptr(), "drown"))
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "movement.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/timestamp.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "movement.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/timestamp.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
@ -83,7 +82,7 @@ namespace MWMechanics
|
||||
return true;
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
ESM::Position pos = actor.getRefData().getPosition();
|
||||
bool cellChange = actor.getCell()->mCell->mData.mX != cellX || actor.getCell()->mCell->mData.mY != cellY;
|
||||
const ESM::Pathgrid *pathgrid =
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "npcstats.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
void MWMechanics::AiSequence::copy (const AiSequence& sequence)
|
||||
{
|
||||
@ -63,7 +62,7 @@ bool MWMechanics::AiSequence::isPackageDone() const
|
||||
|
||||
void MWMechanics::AiSequence::execute (const MWWorld::Ptr& actor,float duration)
|
||||
{
|
||||
if(actor != MWBase::Environment::get().getWorld()->getPlayer().getPlayer())
|
||||
if(actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
if (!mPackages.empty())
|
||||
{
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -38,7 +37,7 @@ namespace MWMechanics
|
||||
Movement &movement = actor.getClass().getMovementSettings(actor);
|
||||
const ESM::Cell *cell = actor.getCell()->mCell;
|
||||
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
if(cell->mData.mX != player.getCell()->mCell->mData.mX)
|
||||
{
|
||||
int sideX = sgn(cell->mData.mX - player.getCell()->mCell->mData.mX);
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "movement.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "enchanting.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
@ -53,7 +52,7 @@ namespace MWMechanics
|
||||
|
||||
bool Enchanting::create()
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
ESM::Enchantment enchantment;
|
||||
enchantment.mData.mCharge = getGemCharge();
|
||||
@ -213,7 +212,7 @@ namespace MWMechanics
|
||||
return 0;
|
||||
|
||||
const float enchantCost = getEnchantPoints();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
|
||||
|
||||
@ -297,9 +296,9 @@ namespace MWMechanics
|
||||
|
||||
void Enchanting::payForEnchantment() const
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
|
||||
store.remove("gold_001", getEnchantPrice(), player);
|
||||
store.remove(MWWorld::ContainerStore::sGoldId, getEnchantPrice(), player);
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,32 @@
|
||||
|
||||
#include "spellcasting.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
/// @return is \a ptr allowed to take/use \a item or is it a crime?
|
||||
bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item)
|
||||
{
|
||||
const std::string& owner = item.getCellRef().mOwner;
|
||||
bool isOwned = !owner.empty();
|
||||
|
||||
const std::string& faction = item.getCellRef().mFaction;
|
||||
bool isFactionOwned = false;
|
||||
if (!faction.empty())
|
||||
{
|
||||
const std::map<std::string, int>& factions = ptr.getClass().getNpcStats(ptr).getFactionRanks();
|
||||
if (factions.find(Misc::StringUtils::lowerCase(faction)) == factions.end())
|
||||
isFactionOwned = true;
|
||||
}
|
||||
|
||||
return (!isOwned && !isFactionOwned);
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
void MechanicsManager::buildPlayer()
|
||||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
||||
@ -230,7 +251,7 @@ namespace MWMechanics
|
||||
{
|
||||
// Uses ingame time, but scaled to real time
|
||||
duration /= MWBase::Environment::get().getWorld()->getTimeScaleFactor();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
player.getClass().getInventoryStore(player).rechargeItems(duration);
|
||||
}
|
||||
|
||||
@ -311,7 +332,7 @@ namespace MWMechanics
|
||||
MWBase::Environment::get().getWindowManager();
|
||||
|
||||
const ESM::NPC *player =
|
||||
world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
|
||||
const ESM::Race *race =
|
||||
world->getStore().get<ESM::Race>().find(player->mRace);
|
||||
@ -337,7 +358,7 @@ namespace MWMechanics
|
||||
|
||||
// HACK? The player has been changed, so a new Animation object may
|
||||
// have been made for them. Make sure they're properly updated.
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
mActors.removeActor(ptr);
|
||||
mActors.addActor(ptr);
|
||||
}
|
||||
@ -356,7 +377,7 @@ namespace MWMechanics
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
ESM::NPC player =
|
||||
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
*world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
player.mName = name;
|
||||
|
||||
world->createRecord(player);
|
||||
@ -369,7 +390,7 @@ namespace MWMechanics
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
ESM::NPC player =
|
||||
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
*world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
|
||||
player.mRace = race;
|
||||
player.mHead = head;
|
||||
@ -395,7 +416,7 @@ namespace MWMechanics
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
ESM::NPC player =
|
||||
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
*world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
player.mClass = id;
|
||||
|
||||
world->createRecord(player);
|
||||
@ -412,7 +433,7 @@ namespace MWMechanics
|
||||
const ESM::Class *ptr = world->createRecord(cls);
|
||||
|
||||
ESM::NPC player =
|
||||
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
*world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
player.mClass = ptr->mId;
|
||||
|
||||
world->createRecord(player);
|
||||
@ -428,7 +449,7 @@ namespace MWMechanics
|
||||
float x = npcSkill.getBaseDisposition();
|
||||
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>();
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* player = playerPtr.get<ESM::NPC>();
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
|
||||
@ -449,7 +470,7 @@ namespace MWMechanics
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); ++it)
|
||||
{
|
||||
if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction)
|
||||
&& playerStats.getExpelled().find(Misc::StringUtils::lowerCase(it->mFaction)) == playerStats.getExpelled().end())
|
||||
&& !playerStats.getExpelled(it->mFaction))
|
||||
reaction = it->mReaction;
|
||||
}
|
||||
rank = playerStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction))->second;
|
||||
@ -496,7 +517,7 @@ namespace MWMechanics
|
||||
|
||||
const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
|
||||
// I suppose the temporary disposition change _has_ to be considered here,
|
||||
@ -541,7 +562,7 @@ namespace MWMechanics
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(npc).getNpcStats(npc);
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
|
||||
float persTerm = playerStats.getAttribute(ESM::Attribute::Personality).getModified()
|
||||
@ -729,40 +750,44 @@ namespace MWMechanics
|
||||
return mAI;
|
||||
}
|
||||
|
||||
bool MechanicsManager::sleepInBed(const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed)
|
||||
{
|
||||
if (isAllowedToUse(ptr, bed))
|
||||
return false;
|
||||
MWWorld::Ptr victim;
|
||||
if (!bed.getCellRef().mOwner.empty())
|
||||
victim = MWBase::Environment::get().getWorld()->getPtr(bed.getCellRef().mOwner, true);
|
||||
|
||||
if(commitCrime(ptr, victim, OT_SleepingInOwnedBed))
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage64}");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void MechanicsManager::itemTaken(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item, int count)
|
||||
{
|
||||
const std::string& owner = item.getCellRef().mOwner;
|
||||
bool isOwned = !owner.empty();
|
||||
|
||||
const std::string& faction = item.getCellRef().mFaction;
|
||||
bool isFactionOwned = false;
|
||||
if (!faction.empty())
|
||||
{
|
||||
const std::map<std::string, int>& factions = ptr.getClass().getNpcStats(ptr).getFactionRanks();
|
||||
if (factions.find(Misc::StringUtils::lowerCase(faction)) == factions.end())
|
||||
isFactionOwned = true;
|
||||
}
|
||||
|
||||
if (!isOwned && !isFactionOwned)
|
||||
if (isAllowedToUse(ptr, item))
|
||||
return;
|
||||
|
||||
MWWorld::Ptr victim;
|
||||
if (!owner.empty())
|
||||
victim = MWBase::Environment::get().getWorld()->getPtr(owner, true);
|
||||
|
||||
// TODO: expell from faction
|
||||
if (!item.getCellRef().mOwner.empty())
|
||||
victim = MWBase::Environment::get().getWorld()->getPtr(item.getCellRef().mOwner, true);
|
||||
|
||||
commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count);
|
||||
}
|
||||
|
||||
void MechanicsManager::commitCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg)
|
||||
bool MechanicsManager::commitCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg)
|
||||
{
|
||||
// TODO: expell from faction
|
||||
|
||||
bool reported=false;
|
||||
for (Actors::PtrControllerMap::const_iterator it = mActors.begin(); it != mActors.end(); ++it)
|
||||
{
|
||||
if (it->first != ptr && awarenessCheck(ptr, it->first))
|
||||
if (it->first != ptr &&
|
||||
MWBase::Environment::get().getWorld()->getLOS(ptr, it->first) &&
|
||||
awarenessCheck(ptr, it->first))
|
||||
{
|
||||
// NPCs will always curse you when they notice you steal their items, even if they don't report the crime
|
||||
if (it->first == victim && type == OT_Theft)
|
||||
@ -777,6 +802,8 @@ namespace MWMechanics
|
||||
&& (type != OT_Assault || it->first != victim)
|
||||
)
|
||||
{
|
||||
// TODO: stats.setAlarmed(true) on NPCs within earshot
|
||||
// fAlarmRadius ?
|
||||
reported=true;
|
||||
break;
|
||||
}
|
||||
@ -785,24 +812,40 @@ namespace MWMechanics
|
||||
|
||||
if (reported)
|
||||
reportCrime(ptr, victim, type, arg);
|
||||
return reported;
|
||||
}
|
||||
|
||||
void MechanicsManager::reportCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg)
|
||||
{
|
||||
const MWWorld::Store<ESM::GameSetting>& store = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
// Bounty for each type of crime
|
||||
if (type == OT_Trespassing || type == OT_SleepingInOwnedBed)
|
||||
arg = 5;
|
||||
arg = store.find("iCrimeTresspass")->getInt();
|
||||
else if (type == OT_Pickpocket)
|
||||
arg = 25;
|
||||
arg = store.find("iCrimePickPocket")->getInt();
|
||||
else if (type == OT_Assault)
|
||||
arg = 40;
|
||||
arg = store.find("iCrimeAttack")->getInt();
|
||||
else if (type == OT_Murder)
|
||||
arg = 1000;
|
||||
arg = store.find("iCrimeKilling")->getInt();
|
||||
else if (type == OT_Theft)
|
||||
arg *= store.find("fCrimeStealing")->getFloat();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sCrimeMessage}");
|
||||
ptr.getClass().getNpcStats(ptr).setBounty(ptr.getClass().getNpcStats(ptr).getBounty()
|
||||
+ arg);
|
||||
|
||||
// If committing a crime against a faction member, expell from the faction
|
||||
if (!victim.isEmpty() && victim.getClass().isNpc())
|
||||
{
|
||||
std::string factionID;
|
||||
if(!victim.getClass().getNpcStats(victim).getFactionRanks().empty())
|
||||
factionID = victim.getClass().getNpcStats(victim).getFactionRanks().begin()->first;
|
||||
if (ptr.getClass().getNpcStats(ptr).isSameFaction(victim.getClass().getNpcStats(victim)))
|
||||
{
|
||||
ptr.getClass().getNpcStats(ptr).expell(factionID);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: make any guards in the area try to arrest the player
|
||||
}
|
||||
|
||||
|
@ -105,13 +105,17 @@ namespace MWMechanics
|
||||
* @brief Commit a crime. If any actors witness the crime and report it,
|
||||
* reportCrime will be called automatically.
|
||||
* @param arg Depends on \a type, e.g. for Theft, the value of the item that was stolen.
|
||||
* @return was the crime reported?
|
||||
*/
|
||||
virtual void commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
virtual bool commitCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
OffenseType type, int arg=0);
|
||||
virtual void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
OffenseType type, int arg=0);
|
||||
/// Utility to check if taking this item is illegal and calling commitCrime if so
|
||||
virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, int count);
|
||||
/// Attempt sleeping in a bed. If this is illegal, call commitCrime.
|
||||
/// @return was it illegal, and someone saw you doing it?
|
||||
virtual bool sleepInBed (const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed);
|
||||
|
||||
virtual void forceStateUpdate(const MWWorld::Ptr &ptr);
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
@ -109,14 +108,26 @@ std::map<std::string, int>& MWMechanics::NpcStats::getFactionRanks()
|
||||
return mFactionRank;
|
||||
}
|
||||
|
||||
const std::set<std::string>& MWMechanics::NpcStats::getExpelled() const
|
||||
bool MWMechanics::NpcStats::getExpelled(const std::string& factionID) const
|
||||
{
|
||||
return mExpelled;
|
||||
return mExpelled.find(Misc::StringUtils::lowerCase(factionID)) != mExpelled.end();
|
||||
}
|
||||
|
||||
std::set<std::string>& MWMechanics::NpcStats::getExpelled()
|
||||
void MWMechanics::NpcStats::expell(const std::string& factionID)
|
||||
{
|
||||
return mExpelled;
|
||||
std::string lower = Misc::StringUtils::lowerCase(factionID);
|
||||
if (mExpelled.find(lower) == mExpelled.end())
|
||||
{
|
||||
std::string message = "#{sExpelledMessage}";
|
||||
message += MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID)->mName;
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(message);
|
||||
mExpelled.insert(lower);
|
||||
}
|
||||
}
|
||||
|
||||
void MWMechanics::NpcStats::clearExpelled(const std::string& factionID)
|
||||
{
|
||||
mExpelled.erase(Misc::StringUtils::lowerCase(factionID));
|
||||
}
|
||||
|
||||
bool MWMechanics::NpcStats::isSameFaction (const NpcStats& npcStats) const
|
||||
|
@ -99,8 +99,10 @@ namespace MWMechanics
|
||||
const std::map<std::string, int>& getFactionRanks() const;
|
||||
std::map<std::string, int>& getFactionRanks();
|
||||
|
||||
const std::set<std::string>& getExpelled() const;
|
||||
std::set<std::string>& getExpelled();
|
||||
const std::set<std::string>& getExpelled() const { return mExpelled; }
|
||||
bool getExpelled(const std::string& factionID) const;
|
||||
void expell(const std::string& factionID);
|
||||
void clearExpelled(const std::string& factionID);
|
||||
|
||||
bool isSameFaction (const NpcStats& npcStats) const;
|
||||
///< Do *this and \a npcStats share a faction?
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
@ -20,7 +19,7 @@ namespace MWMechanics
|
||||
|
||||
void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
mTool.get<ESM::Repair>();
|
||||
|
||||
@ -77,7 +76,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
||||
// tool used up?
|
||||
if (mTool.getCellRef().mCharge == 0)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
|
||||
store.remove(mTool, 1, player);
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "security.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/actionteleport.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwrender/animation.hpp"
|
||||
|
||||
@ -287,17 +287,13 @@ namespace MWMechanics
|
||||
if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled())
|
||||
return;
|
||||
|
||||
Ogre::Vector3 worldPos;
|
||||
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(target.getCell(), worldPos))
|
||||
worldPos = MWBase::Environment::get().getWorld()->getPlayer().getLastKnownExteriorPosition();
|
||||
|
||||
if (effectId == ESM::MagicEffect::DivineIntervention)
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "divinemarker", worldPos);
|
||||
MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "divinemarker");
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::AlmsiviIntervention)
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "templemarker", worldPos);
|
||||
MWBase::Environment::get().getWorld()->teleportToClosestMarker(target, "templemarker");
|
||||
}
|
||||
|
||||
else if (effectId == ESM::MagicEffect::Mark)
|
||||
|
@ -228,6 +228,7 @@ namespace MWRender
|
||||
|
||||
void Camera::setSneakOffset()
|
||||
{
|
||||
// TODO: iFirstPersonSneakDelta
|
||||
if(mAnimation)
|
||||
mAnimation->addFirstPersonOffset(Ogre::Vector3(0.f, 0.f, -9.8f));
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
@ -219,7 +218,7 @@ namespace MWRender
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
|
||||
RaceSelectionPreview::RaceSelectionPreview()
|
||||
: CharacterPreview(MWBase::Environment::get().getWorld()->getPlayer().getPlayer(),
|
||||
: CharacterPreview(MWBase::Environment::get().getWorld()->getPlayerPtr(),
|
||||
512, 512, "CharacterHeadPreview", Ogre::Vector3(0, 6, -35), Ogre::Vector3(0,125,0))
|
||||
, mRef(&mBase)
|
||||
{
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "shadows.hpp"
|
||||
#include "localmap.hpp"
|
||||
@ -324,7 +323,7 @@ void RenderingManager::update (float duration, bool paused)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
int blind = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude;
|
||||
mRendering.getFader()->setFactor(std::max(0.f, 1.f-(blind / 100.f)));
|
||||
@ -585,7 +584,7 @@ void RenderingManager::setAmbientColour(const Ogre::ColourValue& colour)
|
||||
{
|
||||
mAmbientColor = colour;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int nightEye = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude;
|
||||
Ogre::ColourValue final = colour;
|
||||
final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f));
|
||||
@ -737,7 +736,7 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
|
||||
else if (it->second == "max viewing distance" && it->first == "Viewing distance")
|
||||
{
|
||||
if (!MWBase::Environment::get().getWorld()->isCellExterior() && !MWBase::Environment::get().getWorld()->isCellQuasiExterior())
|
||||
configureFog(*MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell());
|
||||
configureFog(*MWBase::Environment::get().getWorld()->getPlayerPtr().getCell());
|
||||
}
|
||||
else if (it->first == "Video" && (
|
||||
it->second == "resolution x"
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
@ -154,11 +152,11 @@ void RippleSimulation::addImpulses()
|
||||
/// \todo it should be more efficient to render all emitters at once
|
||||
for (std::vector<Emitter>::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it)
|
||||
{
|
||||
if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
||||
if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayerPtr())
|
||||
{
|
||||
// fetch a new ptr (to handle cell change etc)
|
||||
// for non-player actors this is done in updateObjectCell
|
||||
it->mPtr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
it->mPtr = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
}
|
||||
float* _currentPos = it->mPtr.getRefData().getPosition().pos;
|
||||
Ogre::Vector3 currentPos (_currentPos[0], _currentPos[1], _currentPos[2]);
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
@ -89,7 +88,7 @@ namespace MWScript
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
bool interior =
|
||||
!MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell->isExterior();
|
||||
!MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell->isExterior();
|
||||
|
||||
runtime.push (interior ? 1 : 0);
|
||||
}
|
||||
@ -104,11 +103,12 @@ namespace MWScript
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell;
|
||||
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell;
|
||||
|
||||
std::string current = cell->mName;
|
||||
|
||||
if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty())
|
||||
if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty()
|
||||
&& !cell->mRegion.empty())
|
||||
{
|
||||
const ESM::Region *region =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().find (cell->mRegion);
|
||||
@ -129,8 +129,11 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||
runtime.push (cell->mWaterLevel);
|
||||
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
if (cell->mCell->hasWater())
|
||||
runtime.push (cell->mWaterLevel);
|
||||
else
|
||||
runtime.push (-std::numeric_limits<float>().max());
|
||||
}
|
||||
};
|
||||
|
||||
@ -142,7 +145,7 @@ namespace MWScript
|
||||
{
|
||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||
|
||||
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
|
||||
if (cell->mCell->isExterior())
|
||||
throw std::runtime_error("Can't set water level in exterior cell");
|
||||
@ -160,7 +163,7 @@ namespace MWScript
|
||||
{
|
||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||
|
||||
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
||||
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
|
||||
if (cell->mCell->isExterior())
|
||||
throw std::runtime_error("Can't set water level in exterior cell");
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
@ -55,7 +54,7 @@ namespace MWScript
|
||||
MWWorld::Ptr itemPtr = *ptr.getClass().getContainerStore (ptr).add (item, count, ptr);
|
||||
|
||||
// Spawn a messagebox (only for items added to player's inventory and if player is talking to someone)
|
||||
if (ptr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer() )
|
||||
if (ptr == MWBase::Environment::get().getWorld ()->getPlayerPtr() )
|
||||
{
|
||||
// The two GMST entries below expand to strings informing the player of what, and how many of it has been added to their inventory
|
||||
std::string msgBox;
|
||||
@ -88,15 +87,9 @@ namespace MWScript
|
||||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
|
||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
||||
|
||||
Interpreter::Type_Integer sum = 0;
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
|
||||
if (Misc::StringUtils::ciEqual(iter->getCellRef().mRefID, item))
|
||||
sum += iter->getRefData().getCount();
|
||||
|
||||
runtime.push (sum);
|
||||
runtime.push (store.count(item));
|
||||
}
|
||||
};
|
||||
|
||||
@ -133,7 +126,7 @@ namespace MWScript
|
||||
|
||||
// Spawn a messagebox (only for items removed from player's inventory)
|
||||
if ((numRemoved > 0)
|
||||
&& (ptr == MWBase::Environment::get().getWorld()->getPlayer().getPlayer()))
|
||||
&& (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr()))
|
||||
{
|
||||
// The two GMST entries below expand to strings informing the player of what, and how many of it has been removed from their inventory
|
||||
std::string msgBox;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
@ -144,7 +143,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
runtime.push (MWWorld::Class::get(ptr).getStance (ptr, MWWorld::Class::Run));
|
||||
}
|
||||
};
|
||||
@ -155,7 +154,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
runtime.push (MWWorld::Class::get(ptr).getStance (ptr, MWWorld::Class::Sneak));
|
||||
}
|
||||
};
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "../mwbase/journal.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
@ -183,7 +182,7 @@ namespace MWScript
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
|
||||
runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).isSameFaction (MWWorld::Class::get(player).getNpcStats (player)));
|
||||
}
|
||||
|
@ -371,4 +371,9 @@ op 0x2000230: Resurrect, explicit
|
||||
op 0x2000231: GetSpellReadied
|
||||
op 0x2000232: GetSpellReadied, explicit
|
||||
op 0x2000233: GetPcJumping
|
||||
opcodes 0x2000234-0x3ffffff unused
|
||||
op 0x2000234: ShowRestMenu, explicit
|
||||
op 0x2000235: GoToJail
|
||||
op 0x2000236: PayFine
|
||||
op 0x2000237: PayFineThief
|
||||
opcodes 0x2000238-0x3ffffff unused
|
||||
|
||||
|
@ -15,7 +15,10 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
@ -45,6 +48,20 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class OpShowRestMenu : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr bed = R()(runtime, false);
|
||||
|
||||
if (bed.isEmpty() || !MWBase::Environment::get().getMechanicsManager()->sleepInBed(MWBase::Environment::get().getWorld()->getPlayerPtr(),
|
||||
bed))
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_RestBed);
|
||||
}
|
||||
};
|
||||
|
||||
class OpShowDialogue : public Interpreter::Opcode0
|
||||
{
|
||||
MWGui::GuiMode mDialogue;
|
||||
@ -172,7 +189,8 @@ namespace MWScript
|
||||
new OpEnableRest ());
|
||||
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeShowRestMenu,
|
||||
new OpShowDialogue (MWGui::GM_RestBed));
|
||||
new OpShowRestMenu<ImplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeShowRestMenuExplicit, new OpShowRestMenu<ExplicitRef>);
|
||||
|
||||
interpreter.installSegment5 (Compiler::Gui::opcodeGetButtonPressed, new OpGetButtonPressed);
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
@ -24,7 +23,7 @@
|
||||
namespace MWScript
|
||||
{
|
||||
MWWorld::Ptr InterpreterContext::getReference (
|
||||
const std::string& id, bool activeOnly)
|
||||
const std::string& id, bool activeOnly, bool doThrow)
|
||||
{
|
||||
if (!id.empty())
|
||||
{
|
||||
@ -32,7 +31,7 @@ namespace MWScript
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mReference.isEmpty())
|
||||
if (mReference.isEmpty() && doThrow)
|
||||
throw std::runtime_error ("no implicit reference");
|
||||
|
||||
return mReference;
|
||||
@ -40,7 +39,7 @@ namespace MWScript
|
||||
}
|
||||
|
||||
const MWWorld::Ptr InterpreterContext::getReference (
|
||||
const std::string& id, bool activeOnly) const
|
||||
const std::string& id, bool activeOnly, bool doThrow) const
|
||||
{
|
||||
if (!id.empty())
|
||||
{
|
||||
@ -48,7 +47,7 @@ namespace MWScript
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mReference.isEmpty())
|
||||
if (mReference.isEmpty() && doThrow)
|
||||
throw std::runtime_error ("no implicit reference");
|
||||
|
||||
return mReference;
|
||||
@ -248,28 +247,28 @@ namespace MWScript
|
||||
std::string InterpreterContext::getPCName() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
ESM::NPC player = *world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
return player.mName;
|
||||
}
|
||||
|
||||
std::string InterpreterContext::getPCRace() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
std::string race = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mRace;
|
||||
std::string race = world->getPlayerPtr().get<ESM::NPC>()->mBase->mRace;
|
||||
return world->getStore().get<ESM::Race>().find(race)->mName;
|
||||
}
|
||||
|
||||
std::string InterpreterContext::getPCClass() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
std::string class_ = world->getPlayer().getPlayer().get<ESM::NPC>()->mBase->mClass;
|
||||
std::string class_ = world->getPlayerPtr().get<ESM::NPC>()->mBase->mClass;
|
||||
return world->getStore().get<ESM::Class>().find(class_)->mName;
|
||||
}
|
||||
|
||||
std::string InterpreterContext::getPCRank() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first;
|
||||
|
||||
@ -288,7 +287,7 @@ namespace MWScript
|
||||
std::string InterpreterContext::getPCNextRank() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first;
|
||||
|
||||
@ -316,7 +315,7 @@ namespace MWScript
|
||||
int InterpreterContext::getPCBounty() const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
return MWWorld::Class::get (player).getNpcStats (player).getBounty();
|
||||
}
|
||||
|
||||
@ -387,7 +386,7 @@ namespace MWScript
|
||||
if (!mAction.get())
|
||||
throw std::runtime_error ("activation failed, because no action to perform");
|
||||
|
||||
mAction->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mAction->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mActivationHandled = true;
|
||||
}
|
||||
|
||||
@ -499,8 +498,8 @@ namespace MWScript
|
||||
ptr.getRefData().getLocals().mFloats[index] = value;
|
||||
}
|
||||
|
||||
MWWorld::Ptr InterpreterContext::getReference()
|
||||
MWWorld::Ptr InterpreterContext::getReference(bool required)
|
||||
{
|
||||
return getReference ("", true);
|
||||
return getReference ("", true, required);
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ namespace MWScript
|
||||
bool mActivationHandled;
|
||||
boost::shared_ptr<MWWorld::Action> mAction;
|
||||
|
||||
MWWorld::Ptr getReference (const std::string& id, bool activeOnly);
|
||||
MWWorld::Ptr getReference (const std::string& id, bool activeOnly, bool doThrow=true);
|
||||
|
||||
const MWWorld::Ptr getReference (const std::string& id, bool activeOnly) const;
|
||||
const MWWorld::Ptr getReference (const std::string& id, bool activeOnly, bool doThrow=true) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -150,7 +150,7 @@ namespace MWScript
|
||||
|
||||
virtual void setMemberFloat (const std::string& id, const std::string& name, float value);
|
||||
|
||||
MWWorld::Ptr getReference();
|
||||
MWWorld::Ptr getReference(bool required=true);
|
||||
///< Reference, that the script is running from (can be empty)
|
||||
};
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
@ -65,7 +64,7 @@ namespace MWScript
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
runtime.push (!world->isOnGround(player) && !world->isFlying(player));
|
||||
}
|
||||
};
|
||||
@ -700,13 +699,11 @@ namespace MWScript
|
||||
public:
|
||||
virtual void execute(Interpreter::Runtime& runtime)
|
||||
{
|
||||
// No way to tell if we have a reference before trying to get it, and it will
|
||||
// cause an exception is there isn't one :(
|
||||
try {
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
MWWorld::Ptr ptr = R()(runtime, false);
|
||||
if (!ptr.isEmpty())
|
||||
printLocalVars(runtime, ptr);
|
||||
}
|
||||
catch(std::runtime_error&) {
|
||||
else
|
||||
{
|
||||
// No reference, no problem.
|
||||
printGlobalVars(runtime);
|
||||
}
|
||||
@ -763,6 +760,43 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpGoToJail : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
world->teleportToClosestMarker(player, "prisonmarker");
|
||||
player.getClass().getNpcStats(player).setBounty(0);
|
||||
// TODO: pass time, change skills, show messagebox
|
||||
// TODO: move stolen items to closest evidence chest
|
||||
// iDaysinPrisonMod
|
||||
}
|
||||
};
|
||||
|
||||
class OpPayFine : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
virtual void execute(Interpreter::Runtime &runtime)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
player.getClass().getNpcStats(player).setBounty(0);
|
||||
|
||||
// TODO: move stolen items to closest evidence chest
|
||||
}
|
||||
};
|
||||
|
||||
class OpPayFineThief : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
virtual void execute(Interpreter::Runtime &runtime)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
player.getClass().getNpcStats(player).setBounty(0);
|
||||
}
|
||||
};
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox);
|
||||
@ -786,6 +820,9 @@ namespace MWScript
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetPcJumping, new OpGetPcJumping);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeWakeUpPc, new OpWakeUpPc);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodePlayBink, new OpPlayBink);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodePayFine, new OpPayFine);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodePayFineThief, new OpPayFineThief);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGoToJail, new OpGoToJail);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetLocked, new OpGetLocked<ImplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetLockedExplicit, new OpGetLocked<ExplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetEffect, new OpGetEffect<ImplicitRef>);
|
||||
|
@ -16,7 +16,7 @@ namespace MWScript
|
||||
{
|
||||
struct ExplicitRef
|
||||
{
|
||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const
|
||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const
|
||||
{
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
@ -27,12 +27,12 @@ namespace MWScript
|
||||
|
||||
struct ImplicitRef
|
||||
{
|
||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const
|
||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
return context.getReference();
|
||||
return context.getReference(required);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -114,10 +114,8 @@ namespace MWScript
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << "execution of script " << name << " failed." << std::endl;
|
||||
|
||||
if (mVerbose)
|
||||
std::cerr << "(" << e.what() << ")" << std::endl;
|
||||
std::cerr << "Execution of script " << name << " failed:" << std::endl;
|
||||
std::cerr << e.what() << std::endl;
|
||||
|
||||
iter->second.first.clear(); // don't execute again.
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
@ -391,7 +390,7 @@ namespace MWScript
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
runtime.push (static_cast <Interpreter::Type_Float> (MWWorld::Class::get (player).getNpcStats (player).getBounty()));
|
||||
}
|
||||
};
|
||||
@ -403,7 +402,7 @@ namespace MWScript
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat);
|
||||
runtime.pop();
|
||||
@ -417,7 +416,7 @@ namespace MWScript
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat + MWWorld::Class::get (player).getNpcStats (player).getBounty());
|
||||
runtime.pop();
|
||||
@ -539,7 +538,7 @@ namespace MWScript
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
|
||||
{
|
||||
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0;
|
||||
@ -568,7 +567,7 @@ namespace MWScript
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
|
||||
{
|
||||
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0;
|
||||
@ -601,7 +600,7 @@ namespace MWScript
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
|
||||
{
|
||||
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] -1;
|
||||
@ -637,7 +636,7 @@ namespace MWScript
|
||||
}
|
||||
}
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(factionID!="")
|
||||
{
|
||||
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
|
||||
@ -740,7 +739,7 @@ namespace MWScript
|
||||
|
||||
Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
runtime.push (
|
||||
MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId));
|
||||
}
|
||||
@ -776,7 +775,7 @@ namespace MWScript
|
||||
|
||||
Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, value);
|
||||
}
|
||||
};
|
||||
@ -811,7 +810,7 @@ namespace MWScript
|
||||
|
||||
Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId,
|
||||
MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)+
|
||||
value);
|
||||
@ -870,7 +869,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
|
||||
runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getWerewolfKills ());
|
||||
}
|
||||
@ -903,18 +902,10 @@ namespace MWScript
|
||||
}
|
||||
}
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(factionID!="")
|
||||
{
|
||||
std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled ();
|
||||
if (expelled.find (factionID) != expelled.end())
|
||||
{
|
||||
runtime.push(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
runtime.push(0);
|
||||
}
|
||||
runtime.push(player.getClass().getNpcStats(player).getExpelled(factionID));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -930,8 +921,6 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
std::string factionID = "";
|
||||
if(arg0 >0 )
|
||||
{
|
||||
@ -940,6 +929,7 @@ namespace MWScript
|
||||
}
|
||||
else
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
|
||||
{
|
||||
factionID = "";
|
||||
@ -949,12 +939,10 @@ namespace MWScript
|
||||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
|
||||
}
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(factionID!="")
|
||||
{
|
||||
std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled ();
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
expelled.insert(factionID);
|
||||
player.getClass().getNpcStats(player).expell(factionID);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -966,8 +954,6 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
std::string factionID = "";
|
||||
if(arg0 >0 )
|
||||
{
|
||||
@ -976,6 +962,7 @@ namespace MWScript
|
||||
}
|
||||
else
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
|
||||
{
|
||||
factionID = "";
|
||||
@ -985,13 +972,9 @@ namespace MWScript
|
||||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
|
||||
}
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(factionID!="")
|
||||
{
|
||||
std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled ();
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
expelled.erase (factionID);
|
||||
}
|
||||
player.getClass().getNpcStats(player).clearExpelled(factionID);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1011,7 +994,7 @@ namespace MWScript
|
||||
{
|
||||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// no-op when executed on the player
|
||||
if (ptr == player)
|
||||
@ -1038,7 +1021,7 @@ namespace MWScript
|
||||
{
|
||||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// no-op when executed on the player
|
||||
if (ptr == player)
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
@ -482,7 +482,7 @@ namespace MWScript
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr actor = pc
|
||||
? MWBase::Environment::get().getWorld()->getPlayer().getPlayer()
|
||||
? MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
: R()(runtime);
|
||||
|
||||
std::string itemID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "sound_output.hpp"
|
||||
#include "sound_decoder.hpp"
|
||||
@ -479,7 +478,7 @@ namespace MWSound
|
||||
static std::string regionName = "";
|
||||
static float sTimePassed = 0.0;
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
const MWWorld::Ptr player = world->getPlayerPtr();
|
||||
const ESM::Cell *cell = player.getCell()->mCell;
|
||||
|
||||
sTimePassed += duration;
|
||||
@ -547,7 +546,7 @@ namespace MWSound
|
||||
startRandomTitle();
|
||||
|
||||
MWWorld::Ptr player =
|
||||
MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const ESM::Cell *cell = player.getCell()->mCell;
|
||||
|
||||
Environment env = Env_Normal;
|
||||
|
@ -24,7 +24,7 @@ namespace MWWorld
|
||||
std::pair <int, std::string> result = MWWorld::Class::get (object).canBeEquipped (object, actor);
|
||||
|
||||
// display error message if the player tried to equip something
|
||||
if (!result.second.empty() && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer())
|
||||
if (!result.second.empty() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(result.second);
|
||||
|
||||
switch(result.first)
|
||||
@ -84,7 +84,7 @@ namespace MWWorld
|
||||
std::string script = MWWorld::Class::get(object).getScript(object);
|
||||
|
||||
/* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */
|
||||
if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "")
|
||||
if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && script != "")
|
||||
object.getRefData().getLocals().setVarByInt(script, "onpcequip", 1);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace MWWorld
|
||||
MWBase::Environment::get().getWindowManager()->getBookWindow()->open(getTarget());
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
// Skill gain from books
|
||||
|
@ -63,6 +63,8 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
const std::string MWWorld::ContainerStore::sGoldId = "gold_001";
|
||||
|
||||
MWWorld::ContainerStore::ContainerStore() : mCachedWeight (0), mWeightUpToDate (false) {}
|
||||
|
||||
MWWorld::ContainerStore::~ContainerStore() {}
|
||||
@ -77,6 +79,15 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end()
|
||||
return ContainerStoreIterator (this);
|
||||
}
|
||||
|
||||
int MWWorld::ContainerStore::count(const std::string &id)
|
||||
{
|
||||
int total=0;
|
||||
for (MWWorld::ContainerStoreIterator iter (begin()); iter!=end(); ++iter)
|
||||
if (Misc::StringUtils::ciEqual(iter->getCellRef().mRefID, id))
|
||||
total += iter->getRefData().getCount();
|
||||
return total;
|
||||
}
|
||||
|
||||
void MWWorld::ContainerStore::unstack(const Ptr &ptr, const Ptr& container)
|
||||
{
|
||||
if (ptr.getRefData().getCount() <= 1)
|
||||
@ -123,7 +134,11 @@ bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &id, int count, const Ptr &actorPtr)
|
||||
{
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count);
|
||||
return add(ref.getPtr(), count, actorPtr, true);
|
||||
// a bit pointless to set owner for the player
|
||||
if (actorPtr.getRefData().getHandle() != "player")
|
||||
return add(ref.getPtr(), count, actorPtr, true);
|
||||
else
|
||||
return add(ref.getPtr(), count, actorPtr, false);
|
||||
}
|
||||
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, int count, const Ptr& actorPtr, bool setOwner)
|
||||
@ -148,7 +163,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
|
||||
{
|
||||
CellStore *cell;
|
||||
|
||||
Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
|
||||
if(&(MWWorld::Class::get (player).getContainerStore (player)) == this)
|
||||
{
|
||||
@ -183,11 +198,13 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr,
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100"))
|
||||
{
|
||||
int realCount = MWWorld::Class::get(ptr).getValue(ptr) * ptr.getRefData().getCount();
|
||||
int realCount = ptr.getRefData().getCount();
|
||||
if (ptr.getCellRef().mGoldValue > 1 && realCount == 1)
|
||||
realCount = ptr.getCellRef().mGoldValue;
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, "gold_001"))
|
||||
if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, MWWorld::ContainerStore::sGoldId))
|
||||
{
|
||||
iter->getRefData().setCount(iter->getRefData().getCount() + realCount);
|
||||
flagAsModified();
|
||||
@ -195,7 +212,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr,
|
||||
}
|
||||
}
|
||||
|
||||
MWWorld::ManualRef ref(esmStore, "Gold_001", count);
|
||||
MWWorld::ManualRef ref(esmStore, MWWorld::ContainerStore::sGoldId, count);
|
||||
return addNewStack(ref.getPtr(), count);
|
||||
}
|
||||
|
||||
@ -305,8 +322,8 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std::
|
||||
const ESM::ItemLevList* levItem = ref.getPtr().get<ESM::ItemLevList>()->mBase;
|
||||
const std::vector<ESM::LeveledListBase::LevelItem>& items = levItem->mList;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
int playerLevel = MWWorld::Class::get(player).getCreatureStats(player).getLevel();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerLevel = player.getClass().getCreatureStats(player).getLevel();
|
||||
|
||||
failChance += levItem->mChanceNone;
|
||||
|
||||
|
@ -35,6 +35,8 @@ namespace MWWorld
|
||||
|
||||
static const int Type_All = 0xffff;
|
||||
|
||||
static const std::string sGoldId;
|
||||
|
||||
private:
|
||||
|
||||
MWWorld::CellRefList<ESM::Potion> potions;
|
||||
@ -92,6 +94,9 @@ namespace MWWorld
|
||||
void unstack (const Ptr& ptr, const Ptr& container);
|
||||
///< Unstack an item in this container. The item's count will be set to 1, then a new stack will be added with (origCount-1).
|
||||
|
||||
/// @return How many items with refID \a id are in this container?
|
||||
int count (const std::string& id);
|
||||
|
||||
protected:
|
||||
ContainerStoreIterator addNewStack (const Ptr& ptr, int count);
|
||||
///< Add the item to this container (do not try to stack it onto existing items)
|
||||
|
@ -166,10 +166,10 @@ namespace MWWorld
|
||||
void Scene::playerCellChange(MWWorld::CellStore *cell, const ESM::Position& pos, bool adjustPlayerPos)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr old = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr old = world->getPlayerPtr();
|
||||
world->getPlayer().setCell(cell);
|
||||
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
mRendering.updatePlayerPtr(player);
|
||||
|
||||
if (adjustPlayerPos) {
|
||||
@ -369,14 +369,14 @@ namespace MWWorld
|
||||
if(!loadcell)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
world->moveObject(world->getPlayer().getPlayer(), position.pos[0], position.pos[1], position.pos[2]);
|
||||
world->moveObject(world->getPlayerPtr(), position.pos[0], position.pos[1], position.pos[2]);
|
||||
|
||||
float x = Ogre::Radian(position.rot[0]).valueDegrees();
|
||||
float y = Ogre::Radian(position.rot[1]).valueDegrees();
|
||||
float z = Ogre::Radian(position.rot[2]).valueDegrees();
|
||||
world->rotateObject(world->getPlayer().getPlayer(), x, y, z);
|
||||
world->rotateObject(world->getPlayerPtr(), x, y, z);
|
||||
|
||||
MWWorld::Class::get(world->getPlayer().getPlayer()).adjustPosition(world->getPlayer().getPlayer());
|
||||
MWWorld::Class::get(world->getPlayerPtr()).adjustPosition(world->getPlayerPtr());
|
||||
world->getFader()->fadeIn(0.5f);
|
||||
return;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int
|
||||
|
||||
mRegionOverrides[Misc::StringUtils::lowerCase(region)] = weather;
|
||||
|
||||
std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell->mRegion;
|
||||
std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell->mRegion;
|
||||
if (Misc::StringUtils::ciEqual(region, playerRegion))
|
||||
setWeather(weather);
|
||||
}
|
||||
@ -696,7 +696,7 @@ void WeatherManager::switchToNextWeather(bool instantly)
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
if (world->isCellExterior() || world->isCellQuasiExterior())
|
||||
{
|
||||
std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayer().getPlayer().getCell()->mCell->mRegion);
|
||||
std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayerPtr().getCell()->mCell->mRegion);
|
||||
|
||||
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
|
||||
{
|
||||
|
@ -753,16 +753,16 @@ namespace MWWorld
|
||||
|
||||
void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
||||
{
|
||||
removeContainerScripts(getPlayer().getPlayer());
|
||||
removeContainerScripts(getPlayerPtr());
|
||||
mWorldScene->changeToInteriorCell(cellName, position);
|
||||
addContainerScripts(getPlayer().getPlayer(), getPlayer().getPlayer().getCell());
|
||||
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
||||
}
|
||||
|
||||
void World::changeToExteriorCell (const ESM::Position& position)
|
||||
{
|
||||
removeContainerScripts(getPlayer().getPlayer());
|
||||
removeContainerScripts(getPlayerPtr());
|
||||
mWorldScene->changeToExteriorCell(position);
|
||||
addContainerScripts(getPlayer().getPlayer(), getPlayer().getPlayer().getCell());
|
||||
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
||||
}
|
||||
|
||||
void World::markCellAsUnchanged()
|
||||
@ -869,7 +869,7 @@ namespace MWWorld
|
||||
int cellY = newCell.mCell->getGridY();
|
||||
mWorldScene->changeCell(cellX, cellY, pos, false);
|
||||
}
|
||||
addContainerScripts (getPlayer().getPlayer(), &newCell);
|
||||
addContainerScripts (getPlayerPtr(), &newCell);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1493,9 +1493,9 @@ namespace MWWorld
|
||||
cell = mCells.getExterior(cellX, cellY);
|
||||
}
|
||||
else
|
||||
cell = getPlayer().getPlayer().getCell();
|
||||
cell = getPlayerPtr().getCell();
|
||||
|
||||
ESM::Position pos = getPlayer().getPlayer().getRefData().getPosition();
|
||||
ESM::Position pos = getPlayerPtr().getRefData().getPosition();
|
||||
pos.pos[0] = result.second[0];
|
||||
pos.pos[1] = result.second[1];
|
||||
pos.pos[2] = result.second[2];
|
||||
@ -2035,7 +2035,7 @@ namespace MWWorld
|
||||
|
||||
std::string message;
|
||||
bool fail = false;
|
||||
bool isPlayer = (actor == getPlayer().getPlayer());
|
||||
bool isPlayer = (actor == getPlayerPtr());
|
||||
|
||||
std::string selectedSpell = stats.getSpells().getSelectedSpell();
|
||||
|
||||
@ -2273,6 +2273,8 @@ namespace MWWorld
|
||||
|
||||
bool World::findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result)
|
||||
{
|
||||
if (cell->isExterior())
|
||||
return false;
|
||||
MWWorld::CellRefList<ESM::Door>& doors = cell->mDoors;
|
||||
CellRefList<ESM::Door>::List& refList = doors.mList;
|
||||
|
||||
@ -2293,8 +2295,12 @@ namespace MWWorld
|
||||
}
|
||||
|
||||
void World::teleportToClosestMarker (const MWWorld::Ptr& ptr,
|
||||
const std::string& id, Ogre::Vector3 worldPos)
|
||||
const std::string& id)
|
||||
{
|
||||
Ogre::Vector3 worldPos;
|
||||
if (!findInteriorPositionInWorldSpace(ptr.getCell(), worldPos))
|
||||
worldPos = mPlayer->getLastKnownExteriorPosition();
|
||||
|
||||
MWWorld::Ptr closestMarker;
|
||||
float closestDistance = FLT_MAX;
|
||||
|
||||
@ -2415,4 +2421,30 @@ namespace MWWorld
|
||||
// with the Telekinesis effect.
|
||||
return feet * 22;
|
||||
}
|
||||
|
||||
MWWorld::Ptr World::getPlayerPtr()
|
||||
{
|
||||
return mPlayer->getPlayer();
|
||||
}
|
||||
|
||||
void World::updateDialogueGlobals()
|
||||
{
|
||||
MWWorld::Ptr player = getPlayerPtr();
|
||||
int bounty = player.getClass().getNpcStats(player).getBounty();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(ContainerStore::sGoldId);
|
||||
|
||||
float fCrimeGoldDiscountMult = getStore().get<ESM::GameSetting>().find("fCrimeGoldDiscountMult")->getFloat();
|
||||
float fCrimeGoldTurnInMult = getStore().get<ESM::GameSetting>().find("fCrimeGoldTurnInMult")->getFloat();
|
||||
|
||||
int discount = bounty*fCrimeGoldDiscountMult;
|
||||
int turnIn = bounty * fCrimeGoldTurnInMult;
|
||||
|
||||
mGlobalVariables->setInt("pchascrimegold", (bounty <= playerGold) ? 1 : 0);
|
||||
|
||||
mGlobalVariables->setInt("pchasgolddiscount", (discount <= playerGold) ? 1 : 0);
|
||||
mGlobalVariables->setInt("crimegolddiscount", discount);
|
||||
|
||||
mGlobalVariables->setInt("crimegoldturnin", turnIn);
|
||||
mGlobalVariables->setInt("pchasturnin", (turnIn <= playerGold) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
@ -187,6 +187,7 @@ namespace MWWorld
|
||||
virtual const Fallback *getFallback() const;
|
||||
|
||||
virtual Player& getPlayer();
|
||||
virtual MWWorld::Ptr getPlayerPtr();
|
||||
|
||||
virtual const MWWorld::ESMStore& getStore() const;
|
||||
|
||||
@ -521,17 +522,20 @@ namespace MWWorld
|
||||
|
||||
virtual bool findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, Ogre::Vector3& result);
|
||||
|
||||
/// Teleports \a ptr to the reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
|
||||
/// closest to \a worldPos.
|
||||
/// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
|
||||
/// @note id must be lower case
|
||||
virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr,
|
||||
const std::string& id, Ogre::Vector3 worldPos);
|
||||
const std::string& id);
|
||||
|
||||
/// List all references (filtered by \a type) detected by \a ptr. The range
|
||||
/// is determined by the current magnitude of the "Detect X" magic effect belonging to \a type.
|
||||
/// @note This also works for references in containers.
|
||||
virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out,
|
||||
DetectionType type);
|
||||
|
||||
/// Update the value of some globals according to the world state, which may be used by dialogue entries.
|
||||
/// This should be called when initiating a dialogue.
|
||||
virtual void updateDialogueGlobals();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ namespace Compiler
|
||||
extensions.registerInstruction ("enablerest", "", opcodeEnableRest);
|
||||
extensions.registerInstruction ("enablelevelupmenu", "", opcodeEnableRest);
|
||||
|
||||
extensions.registerInstruction ("showrestmenu", "", opcodeShowRestMenu);
|
||||
extensions.registerInstruction ("showrestmenu", "", opcodeShowRestMenu, opcodeShowRestMenuExplicit);
|
||||
|
||||
extensions.registerFunction ("getbuttonpressed", 'l', "", opcodeGetButtonPressed);
|
||||
|
||||
@ -244,6 +244,9 @@ namespace Compiler
|
||||
extensions.registerFunction ("getpcjumping", 'l', "", opcodeGetPcJumping);
|
||||
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
|
||||
extensions.registerInstruction ("playbink", "Sl", opcodePlayBink);
|
||||
extensions.registerInstruction ("payfine", "", opcodePayFine);
|
||||
extensions.registerInstruction ("payfinethief", "", opcodePayFineThief);
|
||||
extensions.registerInstruction ("gotojail", "", opcodeGoToJail);
|
||||
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
|
||||
extensions.registerFunction ("geteffect", 'l', "S", opcodeGetEffect, opcodeGetEffectExplicit);
|
||||
extensions.registerInstruction ("addsoulgem", "cc", opcodeAddSoulGem, opcodeAddSoulGemExplicit);
|
||||
|
@ -161,6 +161,7 @@ namespace Compiler
|
||||
const int opcodeEnableStatsMenu = 0x2000016;
|
||||
const int opcodeEnableRest = 0x2000017;
|
||||
const int opcodeShowRestMenu = 0x2000018;
|
||||
const int opcodeShowRestMenuExplicit = 0x2000234;
|
||||
const int opcodeGetButtonPressed = 0x2000137;
|
||||
const int opcodeToggleFogOfWar = 0x2000145;
|
||||
const int opcodeToggleFullHelp = 0x2000151;
|
||||
@ -222,6 +223,9 @@ namespace Compiler
|
||||
const int opcodeGetStandingActorExplicit = 0x200020f;
|
||||
const int opcodeGetWindSpeed = 0x2000212;
|
||||
const int opcodePlayBink = 0x20001f7;
|
||||
const int opcodeGoToJail = 0x2000235;
|
||||
const int opcodePayFine = 0x2000236;
|
||||
const int opcodePayFineThief = 0x2000237;
|
||||
const int opcodeHitOnMe = 0x2000213;
|
||||
const int opcodeHitOnMeExplicit = 0x2000214;
|
||||
const int opcodeDisableTeleporting = 0x2000215;
|
||||
|
@ -17,14 +17,6 @@
|
||||
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<!-- HTML colour: #9A9074 -->
|
||||
<Skin name="SandTextGreyedOut" size="16 16">
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="TextAlign" value="Left Bottom"/>
|
||||
<Property key="TextColour" value="0.6 0.56 0.45"/>
|
||||
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<!-- HTML colour: #BF9959 -->
|
||||
<Skin name="SandText" size="16 16">
|
||||
<Property key="FontName" value="Default"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user