forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'dteviot/MagicEffectsRefactorDraft3'
This commit is contained in:
commit
a52b947efe
74 changed files with 376 additions and 259 deletions
|
@ -78,7 +78,7 @@ add_openmw_dir (mwclass
|
|||
)
|
||||
|
||||
add_openmw_dir (mwmechanics
|
||||
mechanicsmanagerimp stat creaturestats magiceffects movement
|
||||
mechanicsmanagerimp stat creaturestats magiceffects movement actorutil
|
||||
drawstate spells activespells npcstats aipackage aisequence aipursue alchemy aiwander aitravel aifollow aiavoiddoor
|
||||
aiescort aiactivate aicombat repair enchanting pathfinding pathgrid security spellsuccess spellcasting
|
||||
disease pickpocket levelledlist combat steering obstacle autocalcspell difficultyscaling aicombataction actor summoning
|
||||
|
|
|
@ -704,8 +704,8 @@ void OMW::Engine::activate()
|
|||
return;
|
||||
|
||||
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
|
||||
if (player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
|
||||
|| player.getClass().getCreatureStats(player).getKnockedDown())
|
||||
const MWMechanics::NpcStats &playerStats = player.getClass().getNpcStats(player);
|
||||
if (playerStats.isParalyzed() || playerStats.getKnockedDown())
|
||||
return;
|
||||
|
||||
MWWorld::Ptr ptr = mEnvironment.getWorld()->getFacedObject();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
|
@ -244,7 +245,7 @@ namespace MWClass
|
|||
typeText = "#{sHeavy}";
|
||||
|
||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||
MWMechanics::getPlayer()));
|
||||
|
||||
int remainingHealth = getItemHealth(ptr);
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/combat.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -344,7 +345,7 @@ namespace MWClass
|
|||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitAttemptObject(object.getClass().getId(object));
|
||||
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWMechanics::getPlayer())
|
||||
{
|
||||
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
|
||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||
|
@ -603,11 +604,9 @@ namespace MWClass
|
|||
{
|
||||
float weight = getContainerStore (ptr).getWeight();
|
||||
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
|
||||
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Feather)).getMagnitude();
|
||||
|
||||
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Burden)).getMagnitude();
|
||||
const MWMechanics::MagicEffects& effects = getCreatureStats(ptr).getMagicEffects();
|
||||
weight -= effects.get(ESM::MagicEffect::Feather).getMagnitude();
|
||||
weight += effects.get(ESM::MagicEffect::Burden).getMagnitude();
|
||||
|
||||
if (weight<0)
|
||||
weight = 0;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct DoorCustomData : public MWWorld::CustomData
|
||||
|
@ -126,7 +128,7 @@ namespace MWClass
|
|||
|
||||
if (needKey && hasKey)
|
||||
{
|
||||
if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(actor == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}");
|
||||
unlock(ptr); //Call the function here. because that makes sense.
|
||||
// using a key disarms the trap
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "../mwmechanics/autocalcspell.hpp"
|
||||
#include "../mwmechanics/difficultyscaling.hpp"
|
||||
#include "../mwmechanics/character.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
@ -503,7 +504,7 @@ namespace MWClass
|
|||
if(otherstats.isDead()) // Can't hit dead actors
|
||||
return;
|
||||
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(ptr == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||
|
||||
int weapskill = ESM::Skill::HandToHand;
|
||||
|
@ -542,7 +543,7 @@ namespace MWClass
|
|||
{
|
||||
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg, attackStrength);
|
||||
}
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(ptr == MWMechanics::getPlayer())
|
||||
{
|
||||
skillUsageSucceeded(ptr, weapskill, 0);
|
||||
|
||||
|
@ -608,7 +609,7 @@ namespace MWClass
|
|||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitAttemptObject(object.getClass().getId(object));
|
||||
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWMechanics::getPlayer())
|
||||
{
|
||||
const std::string &script = ptr.getClass().getScript(ptr);
|
||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||
|
@ -700,7 +701,7 @@ namespace MWClass
|
|||
if (armorhealth == 0)
|
||||
armor = *inv.unequipItem(armor, ptr);
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
|
||||
|
||||
switch(armor.getClass().getEquipmentSkill(armor))
|
||||
|
@ -716,7 +717,7 @@ namespace MWClass
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
else if(ptr == MWMechanics::getPlayer())
|
||||
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
||||
}
|
||||
}
|
||||
|
@ -729,7 +730,7 @@ namespace MWClass
|
|||
if(damage > 0.0f)
|
||||
{
|
||||
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
|
||||
}
|
||||
MWMechanics::DynamicStat<float> health(getCreatureStats(ptr).getHealth());
|
||||
|
@ -783,7 +784,7 @@ namespace MWClass
|
|||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
// player got activated by another NPC
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(ptr == MWMechanics::getPlayer())
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
|
||||
|
||||
// Werewolfs can't activate NPCs
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "filter.hpp"
|
||||
#include "hypertextparser.hpp"
|
||||
|
@ -532,7 +533,7 @@ namespace MWDialogue
|
|||
else if (curDisp + mTemporaryDispositionChange > 100)
|
||||
mTemporaryDispositionChange = 100 - curDisp;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1);
|
||||
|
||||
if (success)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/magiceffects.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "selectwrapper.hpp"
|
||||
|
||||
|
@ -97,7 +98,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()->getPlayerPtr();
|
||||
const MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
// check player faction
|
||||
if (!info.mPcFaction.empty())
|
||||
|
@ -219,7 +220,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
|
||||
case SelectWrapper::Function_PcHealthPercent:
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
float ratio = player.getClass().getCreatureStats (player).getHealth().getCurrent() /
|
||||
player.getClass().getCreatureStats (player).getHealth().getModified();
|
||||
|
@ -229,7 +230,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
|
||||
case SelectWrapper::Function_PcDynamicStat:
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
float value = player.getClass().getCreatureStats (player).
|
||||
getDynamic (select.getArgument()).getCurrent();
|
||||
|
@ -253,7 +254,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
|
||||
int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) const
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
switch (select.getFunction())
|
||||
{
|
||||
|
@ -429,7 +430,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) const
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
switch (select.getFunction())
|
||||
{
|
||||
|
@ -532,7 +533,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
case SelectWrapper::Function_ShouldAttack:
|
||||
|
||||
return MWBase::Environment::get().getMechanicsManager()->isAggressive(mActor,
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
MWMechanics::getPlayer());
|
||||
|
||||
case SelectWrapper::Function_Werewolf:
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../mwmechanics/magiceffects.hpp"
|
||||
#include "../mwmechanics/alchemy.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
@ -124,9 +125,9 @@ namespace MWGui
|
|||
|
||||
void AlchemyWindow::open()
|
||||
{
|
||||
mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mAlchemy->setAlchemist (MWMechanics::getPlayer());
|
||||
|
||||
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
InventoryItemModel* model = new InventoryItemModel(MWMechanics::getPlayer());
|
||||
mSortModel = new SortFilterItemModel(model);
|
||||
mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients);
|
||||
mItemView->setModel (mSortModel);
|
||||
|
@ -136,7 +137,7 @@ namespace MWGui
|
|||
|
||||
int index = 0;
|
||||
|
||||
mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mAlchemy->setAlchemist (MWMechanics::getPlayer());
|
||||
|
||||
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy->beginTools());
|
||||
iter!=mAlchemy->endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
|
@ -123,7 +125,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()->getPlayerPtr());
|
||||
take.execute (MWMechanics::getPlayer());
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/fallback.hpp"
|
||||
|
@ -51,7 +52,7 @@ namespace
|
|||
|
||||
void updatePlayerHealth()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||
npcStats.updateHealth();
|
||||
}
|
||||
|
@ -228,7 +229,7 @@ namespace MWGui
|
|||
mReviewDialog->setBirthSign(mPlayerBirthSignId);
|
||||
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
|
||||
mReviewDialog->setHealth ( stats.getHealth() );
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
|
@ -137,7 +138,7 @@ namespace MWGui
|
|||
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot)
|
||||
{
|
||||
// we are stealing stuff
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
mModel = new PickpocketItemModel(player, new InventoryItemModel(container),
|
||||
!mPtr.getClass().getCreatureStats(mPtr).getKnockedDown());
|
||||
}
|
||||
|
@ -183,7 +184,7 @@ namespace MWGui
|
|||
&& !mPickpocketDetected
|
||||
)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::Pickpocket pickpocket(player, mPtr);
|
||||
if (pickpocket.finish())
|
||||
{
|
||||
|
@ -260,7 +261,7 @@ namespace MWGui
|
|||
|
||||
bool ContainerWindow::onTakeItem(const ItemStack &item, int count)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
// TODO: move to ItemModels
|
||||
if (dynamic_cast<PickpocketItemModel*>(mModel)
|
||||
&& !mPtr.getClass().getCreatureStats(mPtr).getKnockedDown())
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "bookpage.hpp"
|
||||
|
@ -89,7 +90,7 @@ namespace MWGui
|
|||
WindowModal::open();
|
||||
center();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mBribe10Button->setEnabled (playerGold >= 10);
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "itemselection.hpp"
|
||||
#include "itemwidget.hpp"
|
||||
|
||||
|
@ -160,7 +162,7 @@ namespace MWGui
|
|||
|
||||
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
mEnchanting.setSelfEnchanting(true);
|
||||
mEnchanting.setEnchanter(player);
|
||||
|
@ -208,7 +210,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()->getPlayerPtr());
|
||||
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
||||
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyEnchantable);
|
||||
}
|
||||
else
|
||||
|
@ -263,7 +265,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()->getPlayerPtr());
|
||||
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
||||
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones);
|
||||
|
||||
//MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
|
||||
|
@ -324,7 +326,7 @@ namespace MWGui
|
|||
mEnchanting.setNewItemName(mName->getCaption());
|
||||
mEnchanting.setEffect(mEffectList);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
if (mPtr != player && mEnchanting.getEnchantPrice() > playerGold)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "spellicons.hpp"
|
||||
|
@ -259,7 +260,7 @@ namespace MWGui
|
|||
{
|
||||
// drop item into the gameworld
|
||||
MWBase::Environment::get().getWorld()->breakInvisibility(
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
MWMechanics::getPlayer());
|
||||
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
|
||||
|
@ -338,7 +339,7 @@ namespace MWGui
|
|||
|
||||
void HUD::onWeaponClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr& player = MWMechanics::getPlayer();
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||
|
@ -350,7 +351,7 @@ namespace MWGui
|
|||
|
||||
void HUD::onMagicClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr& player = MWMechanics::getPlayer();
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "../mwscript/interpretercontext.hpp"
|
||||
#include "../mwrender/characterpreview.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "itemview.hpp"
|
||||
#include "inventoryitemmodel.hpp"
|
||||
#include "sortfilteritemmodel.hpp"
|
||||
|
@ -63,7 +65,7 @@ namespace MWGui
|
|||
, mGuiMode(GM_Inventory)
|
||||
, mLastXSize(0)
|
||||
, mLastYSize(0)
|
||||
, mPreview(new MWRender::InventoryPreview(viewer, resourceSystem, MWBase::Environment::get().getWorld()->getPlayerPtr()))
|
||||
, mPreview(new MWRender::InventoryPreview(viewer, resourceSystem, MWMechanics::getPlayer()))
|
||||
, mTrading(false)
|
||||
{
|
||||
mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture()));
|
||||
|
@ -333,7 +335,7 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::open()
|
||||
{
|
||||
mPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
mPtr = MWMechanics::getPlayer();
|
||||
|
||||
updateEncumbranceBar();
|
||||
|
||||
|
@ -439,7 +441,7 @@ namespace MWGui
|
|||
{
|
||||
const std::string& script = ptr.getClass().getScript(ptr);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
// early-out for items that need to be equipped, but can't be equipped: we don't want to set OnPcEquip in that case
|
||||
if (!ptr.getClass().getEquipmentSlots(ptr).first.empty())
|
||||
|
@ -549,7 +551,7 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::updateEncumbranceBar()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
float capacity = player.getClass().getCapacity(player);
|
||||
float encumbrance = player.getClass().getEncumbrance(player);
|
||||
|
@ -583,7 +585,7 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->updateMagicEffects(
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
MWMechanics::getPlayer());
|
||||
|
||||
dirtyPreview();
|
||||
}
|
||||
|
@ -614,7 +616,7 @@ namespace MWGui
|
|||
|
||||
int count = object.getRefData().getCount();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWBase::Environment::get().getWorld()->breakInvisibility(player);
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, object, MWWorld::Ptr(), count);
|
||||
|
@ -644,7 +646,7 @@ namespace MWGui
|
|||
{
|
||||
ItemModel::ModelIndex selected = -1;
|
||||
// not using mSortFilterModel as we only need sorting, not filtering
|
||||
SortFilterItemModel model(new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||
SortFilterItemModel model(new InventoryItemModel(MWMechanics::getPlayer()));
|
||||
model.setSortByType(false);
|
||||
model.update();
|
||||
if (model.getItemCount() == 0)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/store.hpp"
|
||||
|
@ -57,7 +58,7 @@ namespace MWGui
|
|||
|
||||
if (mFadeTimeRemaining <= 0)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWBase::Environment::get().getWorld()->teleportToClosestMarker(player, "prisonmarker");
|
||||
|
||||
setVisible(true);
|
||||
|
@ -76,7 +77,7 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Jail);
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
MWBase::Environment::get().getWorld()->advanceTime(mDays * 24);
|
||||
for (int i=0; i<mDays*24; ++i)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
@ -203,7 +204,7 @@ namespace MWGui
|
|||
|
||||
void LevelupDialog::onOkButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
|
||||
|
||||
if (mSpentAttributes.size() < mCoinCount)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
@ -40,7 +41,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
|
||||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
|
@ -125,7 +126,7 @@ void MerchantRepair::exit()
|
|||
|
||||
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
int price = MyGUI::utility::parseInt(sender->getUserString("Price"));
|
||||
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwgui/inventorywindow.hpp"
|
||||
|
||||
|
@ -147,7 +148,7 @@ namespace MWGui
|
|||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel);
|
||||
}
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
||||
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyUsableItems);
|
||||
|
||||
mAssignDialog->setVisible (false);
|
||||
|
@ -262,7 +263,7 @@ namespace MWGui
|
|||
|
||||
QuickKeyType type = mAssigned[index-1];
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
|
||||
if (type == Type_Item || type == Type_MagicItem)
|
||||
|
@ -474,7 +475,7 @@ namespace MWGui
|
|||
case Type_MagicItem:
|
||||
{
|
||||
// Find the item by id
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
MWWorld::Ptr item;
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
|
@ -544,7 +545,7 @@ namespace MWGui
|
|||
{
|
||||
WindowModal::open();
|
||||
|
||||
mMagicList->setModel(new SpellModel(MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||
mMagicList->setModel(new SpellModel(MWMechanics::getPlayer()));
|
||||
mMagicList->resetScrollbars();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "itemwidget.hpp"
|
||||
|
@ -92,7 +93,7 @@ void Recharge::updateView()
|
|||
|
||||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin());
|
||||
iter!=store.end(); ++iter)
|
||||
|
@ -147,7 +148,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
|||
|
||||
MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
ReferenceInterface::ReferenceInterface()
|
||||
|
@ -16,7 +18,7 @@ namespace MWGui
|
|||
|
||||
void ReferenceInterface::checkReferenceAvailable()
|
||||
{
|
||||
MWWorld::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
MWWorld::CellStore* playerCell = MWMechanics::getPlayer().getCell();
|
||||
|
||||
// check if player has changed cell, or count of the reference has become 0
|
||||
if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
|
@ -94,7 +96,7 @@ void Repair::updateRepairView()
|
|||
|
||||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
|
@ -103,7 +105,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()->getPlayerPtr());
|
||||
take.execute (MWMechanics::getPlayer());
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
@ -48,7 +49,7 @@ namespace MWGui
|
|||
int price = static_cast<int>(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();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
// TODO: refactor to use MyGUI::ListBox
|
||||
|
@ -125,7 +126,7 @@ namespace MWGui
|
|||
|
||||
bool SpellBuyingWindow::playerHasSpell(const std::string &id)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
return player.getClass().getCreatureStats(player).getSpells().hasSpell(id);
|
||||
}
|
||||
|
||||
|
@ -133,7 +134,7 @@ namespace MWGui
|
|||
{
|
||||
int price = *_sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
|
||||
return;
|
||||
|
||||
|
@ -158,7 +159,7 @@ namespace MWGui
|
|||
|
||||
void SpellBuyingWindow::updateLabels()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/spells.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
#include "class.hpp"
|
||||
|
@ -376,7 +377,7 @@ namespace MWGui
|
|||
return;
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
if (MyGUI::utility::parseInt(mPriceLabel->getCaption()) > playerGold)
|
||||
|
@ -474,7 +475,7 @@ namespace MWGui
|
|||
|
||||
mPriceLabel->setCaption(MyGUI::utility::toString(int(price)));
|
||||
|
||||
float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWMechanics::getPlayer());
|
||||
mSuccessChance->setCaption(MyGUI::utility::toString(int(chance)));
|
||||
}
|
||||
|
||||
|
@ -507,7 +508,7 @@ namespace MWGui
|
|||
{
|
||||
// get the list of magic effects that are known to the player
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
|
||||
|
@ -43,7 +44,7 @@ namespace MWGui
|
|||
{
|
||||
// TODO: Tracking add/remove/expire would be better than force updating every frame
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/spells.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "spellicons.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
|
@ -79,12 +80,12 @@ namespace MWGui
|
|||
{
|
||||
mSpellIcons->updateWidgets(mEffectBox, false);
|
||||
|
||||
mSpellView->setModel(new SpellModel(MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||
mSpellView->setModel(new SpellModel(MWMechanics::getPlayer()));
|
||||
}
|
||||
|
||||
void SpellWindow::onEnchantedItemSelected(MWWorld::Ptr item, bool alreadyEquipped)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
|
||||
// retrieve ContainerStoreIterator to the item
|
||||
|
@ -159,7 +160,7 @@ namespace MWGui
|
|||
|
||||
void SpellWindow::onSpellSelected(const std::string& spellId)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
store.setSelectedEnchantItem(store.end());
|
||||
MWBase::Environment::get().getWindowManager()->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
|
||||
|
@ -169,7 +170,7 @@ namespace MWGui
|
|||
|
||||
void SpellWindow::onDeleteSpellAccept()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
|
@ -183,7 +184,7 @@ namespace MWGui
|
|||
|
||||
void SpellWindow::cycle(bool next)
|
||||
{
|
||||
mSpellView->setModel(new SpellModel(MWBase::Environment::get().getWorld()->getPlayerPtr()));
|
||||
mSpellView->setModel(new SpellModel(MWMechanics::getPlayer()));
|
||||
|
||||
SpellModel::ModelIndex selected = 0;
|
||||
for (SpellModel::ModelIndex i = 0; i<int(mSpellView->getModel()->getItemCount()); ++i)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
|
||||
|
@ -234,7 +235,7 @@ namespace MWGui
|
|||
|
||||
NoDrop::onFrame(dt);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
|
||||
|
||||
// level progress
|
||||
|
@ -383,7 +384,7 @@ namespace MWGui
|
|||
int base = stat.getBase();
|
||||
int modified = stat.getModified();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
|
@ -493,7 +494,7 @@ namespace MWGui
|
|||
|
||||
if (!mFactions.empty())
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
|
||||
const std::set<std::string> &expelled = PCstats.getExpelled();
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "mapwindow.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
|
@ -234,7 +235,7 @@ namespace MWGui
|
|||
}
|
||||
if (MWMechanics::spellIncreasesSkill(spell)) // display school of spells that contribute to skill progress
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int school = MWMechanics::getSpellSchool(spell, player);
|
||||
info.text = "#{sSchool}: " + sSchoolNames[school];
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ namespace MWGui
|
|||
if(!mFocusObject.isEmpty())
|
||||
{
|
||||
const MWWorld::CellRef& cellref = mFocusObject.getCellRef();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr ptr = MWMechanics::getPlayer();
|
||||
MWWorld::Ptr victim;
|
||||
|
||||
MWBase::MechanicsManager* mm = MWBase::Environment::get().getMechanicsManager();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "itemview.hpp"
|
||||
|
@ -282,7 +283,7 @@ namespace MWGui
|
|||
return;
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
// check if the player can afford this
|
||||
|
@ -490,7 +491,7 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::updateLabels()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + MyGUI::utility::toString(playerGold));
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
|
||||
|
@ -68,7 +69,7 @@ namespace MWGui
|
|||
{
|
||||
mPtr = actor;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
@ -144,7 +145,7 @@ namespace MWGui
|
|||
int price;
|
||||
iss >> price;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
if (playerGold<price)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwstate/charactermanager.hpp"
|
||||
|
||||
|
@ -199,7 +200,7 @@ namespace MWGui
|
|||
{
|
||||
stopWaiting();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
const MWMechanics::NpcStats &pcstats = player.getClass().getNpcStats(player);
|
||||
|
||||
// trigger levelup if possible
|
||||
|
@ -213,7 +214,7 @@ namespace MWGui
|
|||
|
||||
void WaitDialog::setCanRest (bool canRest)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
bool full = (stats.getHealth().getCurrent() >= stats.getHealth().getModified())
|
||||
&& (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified());
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwrender/localmap.hpp"
|
||||
|
||||
|
@ -903,7 +904,7 @@ namespace MWGui
|
|||
if (!mLocalMapRender)
|
||||
return;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
osg::Vec3f playerPosition = player.getRefData().getPosition().asVec3();
|
||||
osg::Quat playerOrientation (-player.getRefData().getPosition().rot[2], osg::Vec3(0,0,1));
|
||||
|
@ -1547,7 +1548,7 @@ namespace MWGui
|
|||
{
|
||||
mInventoryWindow->updatePlayer();
|
||||
|
||||
const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
setWerewolfOverlay(true);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
using namespace ICS;
|
||||
|
||||
|
@ -1012,7 +1013,7 @@ namespace MWInput
|
|||
{
|
||||
if (!mControlSwitch["playercontrols"])
|
||||
return;
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
// Cannot use items or spells while in werewolf form
|
||||
|
@ -1029,7 +1030,7 @@ namespace MWInput
|
|||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode ()
|
||||
&& MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate")==-1)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
// Cannot use items or spells while in werewolf form
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "actor.hpp"
|
||||
#include "summoning.hpp"
|
||||
#include "combat.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -56,7 +57,7 @@ void adjustBoundItem (const std::string& item, bool bound, const MWWorld::Ptr& a
|
|||
action.execute(actor);
|
||||
MWWorld::ContainerStoreIterator rightHand = store.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
// change draw state only if the item is in player's right hand
|
||||
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
if (actor == MWMechanics::getPlayer()
|
||||
&& rightHand != store.end() && newPtr == *rightHand)
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
|
||||
|
@ -82,7 +83,7 @@ public:
|
|||
const std::string& sourceName, const std::string& sourceId, int casterActorId,
|
||||
float magnitude, float remainingTime = -1, float totalTime = -1)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if ( ((key.mId == ESM::MagicEffect::CommandHumanoid && mActor.getClass().isNpc())
|
||||
|| (key.mId == ESM::MagicEffect::CommandCreature && mActor.getTypeName() == typeid(ESM::Creature).name()))
|
||||
&& casterActorId == player.getClass().getCreatureStats(player).getActorId()
|
||||
|
@ -203,7 +204,7 @@ namespace MWMechanics
|
|||
gem->getContainerStore()->unstack(*gem, caster);
|
||||
gem->getCellRef().setSoul(mCreature.getCellRef().getRefId());
|
||||
|
||||
if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (caster == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}");
|
||||
|
||||
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>()
|
||||
|
@ -401,7 +402,7 @@ namespace MWMechanics
|
|||
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
||||
|
||||
float base = 1.f;
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == getPlayer())
|
||||
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fPCbaseMagickaMult")->getFloat();
|
||||
else
|
||||
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCbaseMagickaMult")->getFloat();
|
||||
|
@ -512,7 +513,7 @@ namespace MWMechanics
|
|||
{
|
||||
spells.worsenCorprus(it->first);
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicCorprusWorsens}");
|
||||
}
|
||||
}
|
||||
|
@ -539,19 +540,19 @@ namespace MWMechanics
|
|||
if (!creature || ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Creatures)
|
||||
{
|
||||
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Fight);
|
||||
stat.setModifier(static_cast<int>(creatureStats.getMagicEffects().get(ESM::MagicEffect::FrenzyHumanoid + creature).getMagnitude()
|
||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid+creature).getMagnitude()));
|
||||
stat.setModifier(static_cast<int>(effects.get(ESM::MagicEffect::FrenzyHumanoid + creature).getMagnitude()
|
||||
- effects.get(ESM::MagicEffect::CalmHumanoid+creature).getMagnitude()));
|
||||
creatureStats.setAiSetting(CreatureStats::AI_Fight, stat);
|
||||
|
||||
stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
||||
stat.setModifier(static_cast<int>(creatureStats.getMagicEffects().get(ESM::MagicEffect::DemoralizeHumanoid + creature).getMagnitude()
|
||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::RallyHumanoid+creature).getMagnitude()));
|
||||
stat.setModifier(static_cast<int>(effects.get(ESM::MagicEffect::DemoralizeHumanoid + creature).getMagnitude()
|
||||
- effects.get(ESM::MagicEffect::RallyHumanoid+creature).getMagnitude()));
|
||||
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
||||
}
|
||||
if (creature && ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Undead)
|
||||
{
|
||||
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
||||
stat.setModifier(static_cast<int>(creatureStats.getMagicEffects().get(ESM::MagicEffect::TurnUndead).getMagnitude()));
|
||||
stat.setModifier(static_cast<int>(effects.get(ESM::MagicEffect::TurnUndead).getMagnitude()));
|
||||
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
||||
}
|
||||
|
||||
|
@ -560,7 +561,7 @@ namespace MWMechanics
|
|||
// The actor was killed by a magic effect. Figure out if the player was responsible for it.
|
||||
const ActiveSpells& spells = creatureStats.getActiveSpells();
|
||||
bool killedByPlayer = false;
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
for (ActiveSpells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||
{
|
||||
const ActiveSpells::ActiveSpellParams& spell = it->second;
|
||||
|
@ -597,8 +598,8 @@ namespace MWMechanics
|
|||
// TODO: dirty flag for magic effects to avoid some unnecessary work below?
|
||||
|
||||
// any value of calm > 0 will stop the actor from fighting
|
||||
if ((creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid).getMagnitude() > 0 && ptr.getClass().isNpc())
|
||||
|| (creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc()))
|
||||
if ((effects.get(ESM::MagicEffect::CalmHumanoid).getMagnitude() > 0 && ptr.getClass().isNpc())
|
||||
|| (effects.get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc()))
|
||||
{
|
||||
for (std::list<AiPackage*>::const_iterator it = creatureStats.getAiSequence().begin(); it != creatureStats.getAiSequence().end(); )
|
||||
{
|
||||
|
@ -631,7 +632,7 @@ namespace MWMechanics
|
|||
for (std::map<int, std::string>::iterator it = boundItemsMap.begin(); it != boundItemsMap.end(); ++it)
|
||||
{
|
||||
bool found = creatureStats.mBoundItems.find(it->first) != creatureStats.mBoundItems.end();
|
||||
float magnitude = creatureStats.getMagicEffects().get(it->first).getMagnitude();
|
||||
float magnitude = effects.get(it->first).getMagnitude();
|
||||
if (found != (magnitude > 0))
|
||||
{
|
||||
std::string itemGmst = it->second;
|
||||
|
@ -727,7 +728,7 @@ namespace MWMechanics
|
|||
|
||||
void Actors::updateEquippedLight (const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
bool isPlayer = (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
bool isPlayer = (ptr == getPlayer());
|
||||
|
||||
MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr);
|
||||
MWWorld::ContainerStoreIterator heldIter =
|
||||
|
@ -824,7 +825,7 @@ namespace MWMechanics
|
|||
|
||||
void Actors::updateCrimePersuit(const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
if (ptr != player && ptr.getClass().isNpc())
|
||||
{
|
||||
// get stats of witness
|
||||
|
@ -946,7 +947,7 @@ namespace MWMechanics
|
|||
if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0;
|
||||
if (timerUpdateHeadTrack >= 0.3f) timerUpdateHeadTrack = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
|
||||
int hostilesCount = 0; // need to know this to play Battle music
|
||||
|
||||
|
@ -1038,13 +1039,12 @@ namespace MWMechanics
|
|||
> sqrProcessingDistance)
|
||||
continue;
|
||||
|
||||
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
|
||||
ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||
if (iter->first.getClass().getCreatureStats(iter->first).isParalyzed())
|
||||
iter->second->getCharacterController()->skipAnim();
|
||||
|
||||
// Handle player last, in case a cell transition occurs by casting a teleportation spell
|
||||
// (would invalidate the iterator)
|
||||
if (iter->first == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (iter->first == getPlayer())
|
||||
{
|
||||
playerCharacter = iter->second->getCharacterController();
|
||||
continue;
|
||||
|
@ -1431,9 +1431,9 @@ namespace MWMechanics
|
|||
for (PtrActorMap::iterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
MWWorld::Ptr ptr = it->first;
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
if (ptr == getPlayer()
|
||||
|| !isConscious(ptr)
|
||||
|| ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||
|| ptr.getClass().getCreatureStats(ptr).isParalyzed())
|
||||
continue;
|
||||
MWMechanics::AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||
seq.fastForward(ptr, it->second->getAiState());
|
||||
|
|
12
apps/openmw/mwmechanics/actorutil.cpp
Normal file
12
apps/openmw/mwmechanics/actorutil.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "actorutil.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
MWWorld::Ptr getPlayer()
|
||||
{
|
||||
return MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
}
|
||||
}
|
14
apps/openmw/mwmechanics/actorutil.hpp
Normal file
14
apps/openmw/mwmechanics/actorutil.hpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef OPENMW_MWMECHANICS_ACTORUTIL_H
|
||||
#define OPENMW_MWMECHANICS_ACTORUTIL_H
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
MWWorld::Ptr getPlayer();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
#include "movement.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
|
||||
#include "steering.hpp"
|
||||
|
@ -63,7 +64,7 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor, CharacterCont
|
|||
std::vector<MWWorld::Ptr> actors;
|
||||
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(pos.asVec3(),100,actors);
|
||||
for(std::vector<MWWorld::Ptr>::iterator it = actors.begin(); it != actors.end(); ++it) {
|
||||
if(*it != MWBase::Environment::get().getWorld()->getPlayerPtr()) { //Not the player
|
||||
if(*it != getPlayer()) { //Not the player
|
||||
MWMechanics::AiSequence& seq = it->getClass().getCreatureStats(*it).getAiSequence();
|
||||
if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdAvoidDoor) { //Only add it once
|
||||
seq.stack(MWMechanics::AiAvoidDoor(mDoorPtr),*it);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../mwworld/action.hpp"
|
||||
|
||||
#include "steering.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
MWMechanics::AiPackage::~AiPackage() {}
|
||||
|
||||
|
@ -34,7 +35,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, ESM::Pathgrid::Po
|
|||
/// Stops the actor when it gets too close to a unloaded cell
|
||||
const ESM::Cell *cell = actor.getCell()->getCell();
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
Movement &movement = actor.getClass().getMovementSettings(actor);
|
||||
|
||||
//Ensure pursuer doesn't leave loaded cells
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "aiactivate.hpp"
|
||||
#include "aicombat.hpp"
|
||||
#include "aipursue.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
#include <components/esm/aisequence.hpp>
|
||||
|
||||
|
@ -150,7 +151,7 @@ bool AiSequence::isPackageDone() const
|
|||
|
||||
void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
|
||||
{
|
||||
if(actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(actor != getPlayer())
|
||||
{
|
||||
if (!mPackages.empty())
|
||||
{
|
||||
|
@ -242,7 +243,7 @@ void AiSequence::clear()
|
|||
|
||||
void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
|
||||
{
|
||||
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (actor == getPlayer())
|
||||
throw std::runtime_error("Can't add AI packages to player");
|
||||
|
||||
if (package.getTypeId() == AiPackage::TypeIdCombat || package.getTypeId() == AiPackage::TypeIdPursue)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "steering.hpp"
|
||||
#include "movement.hpp"
|
||||
#include "coordinateconverter.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
|
||||
|
||||
|
@ -462,7 +463,7 @@ namespace MWMechanics
|
|||
if (hello > 0 && !MWBase::Environment::get().getWorld()->isSwimming(actor)
|
||||
&& MWBase::Environment::get().getSoundManager()->sayDone(actor))
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
|
||||
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
|
||||
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
||||
|
@ -496,7 +497,7 @@ namespace MWMechanics
|
|||
|
||||
helloDistance *= iGreetDistanceMultiplier;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
osg::Vec3f playerPos(player.getRefData().getPosition().asVec3());
|
||||
osg::Vec3f actorPos(actor.getRefData().getPosition().asVec3());
|
||||
float playerDistSqr = (playerPos - actorPos).length2();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "npcstats.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
#include "security.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
#include <components/misc/rng.hpp>
|
||||
|
||||
|
@ -619,7 +620,7 @@ void CharacterController::playDeath(float startpoint, CharacterState death)
|
|||
|
||||
void CharacterController::playRandomDeath(float startpoint)
|
||||
{
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == getPlayer())
|
||||
{
|
||||
// The first-person animations do not include death, so we need to
|
||||
// force-switch to third person before playing the death animation.
|
||||
|
@ -1167,7 +1168,7 @@ bool CharacterController::updateWeaponState()
|
|||
// Unset casting flag, otherwise pressing the mouse button down would
|
||||
// continue casting every frame if there is no animation
|
||||
mAttackingOrSpell = false;
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == getPlayer())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setAttackingOrSpell(false);
|
||||
}
|
||||
|
@ -1177,7 +1178,7 @@ bool CharacterController::updateWeaponState()
|
|||
// For the player, set the spell we want to cast
|
||||
// This has to be done at the start of the casting animation,
|
||||
// *not* when selecting a spell in the GUI (otherwise you could change the spell mid-animation)
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == getPlayer())
|
||||
{
|
||||
std::string selectedSpell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
|
||||
stats.getSpells().setSelectedSpell(selectedSpell);
|
||||
|
@ -1257,7 +1258,7 @@ bool CharacterController::updateWeaponState()
|
|||
mAttackType = "shoot";
|
||||
else
|
||||
{
|
||||
if(isWeapon && mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||
if(isWeapon && mPtr == getPlayer() &&
|
||||
Settings::Manager::getBool("best attack", "Game"))
|
||||
{
|
||||
MWWorld::ContainerStoreIterator weapon = mPtr.getClass().getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
|
@ -1563,7 +1564,7 @@ void CharacterController::update(float duration)
|
|||
|
||||
|
||||
// advance athletics
|
||||
if(mHasMovedInXY && mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(mHasMovedInXY && mPtr == getPlayer())
|
||||
{
|
||||
if(inwater)
|
||||
{
|
||||
|
@ -1664,7 +1665,7 @@ void CharacterController::update(float duration)
|
|||
}
|
||||
|
||||
// advance acrobatics
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == getPlayer())
|
||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
||||
|
||||
// decrease fatigue
|
||||
|
@ -1707,7 +1708,7 @@ void CharacterController::update(float duration)
|
|||
else
|
||||
{
|
||||
// report acrobatics progression
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == getPlayer())
|
||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1949,7 +1950,7 @@ bool CharacterController::kill()
|
|||
{
|
||||
if( isDead() )
|
||||
{
|
||||
if( mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr() && !isAnimPlaying(mCurrentDeath) )
|
||||
if( mPtr == getPlayer() && !isAnimPlaying(mCurrentDeath) )
|
||||
{
|
||||
//player's death animation is over
|
||||
MWBase::Environment::get().getStateManager()->askLoadRecent();
|
||||
|
@ -1965,7 +1966,7 @@ bool CharacterController::kill()
|
|||
mCurrentIdle.clear();
|
||||
|
||||
// Play Death Music if it was the player dying
|
||||
if(mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(mPtr == getPlayer())
|
||||
MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Death.mp3");
|
||||
|
||||
return true;
|
||||
|
@ -2006,7 +2007,7 @@ void CharacterController::updateMagicEffects()
|
|||
float alpha = 1.f;
|
||||
if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude())
|
||||
{
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == getPlayer())
|
||||
alpha = 0.4f;
|
||||
else
|
||||
alpha = 0.f;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -60,7 +61,7 @@ namespace MWMechanics
|
|||
|
||||
if (blockerStats.getKnockedDown() // Used for both knockout or knockdown
|
||||
|| blockerStats.getHitRecovery()
|
||||
|| blockerStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||
|| blockerStats.isParalyzed())
|
||||
return false;
|
||||
|
||||
if (!MWBase::Environment::get().getMechanicsManager()->isReadyToBlock(blocker))
|
||||
|
@ -137,7 +138,7 @@ namespace MWMechanics
|
|||
|
||||
blockerStats.setBlock(true);
|
||||
|
||||
if (blocker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (blocker == getPlayer())
|
||||
blocker.getClass().skillUsageSucceeded(blocker, ESM::Skill::Block, 0);
|
||||
|
||||
return true;
|
||||
|
@ -147,9 +148,9 @@ namespace MWMechanics
|
|||
|
||||
void resistNormalWeapon(const MWWorld::Ptr &actor, const MWWorld::Ptr& attacker, const MWWorld::Ptr &weapon, float &damage)
|
||||
{
|
||||
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
||||
float resistance = std::min(100.f, stats.getMagicEffects().get(ESM::MagicEffect::ResistNormalWeapons).getMagnitude()
|
||||
- stats.getMagicEffects().get(ESM::MagicEffect::WeaknessToNormalWeapons).getMagnitude());
|
||||
const MWMechanics::MagicEffects& effects = actor.getClass().getCreatureStats(actor).getMagicEffects();
|
||||
float resistance = std::min(100.f, effects.get(ESM::MagicEffect::ResistNormalWeapons).getMagnitude()
|
||||
- effects.get(ESM::MagicEffect::WeaknessToNormalWeapons).getMagnitude());
|
||||
|
||||
float multiplier = 1.f - resistance / 100.f;
|
||||
|
||||
|
@ -161,7 +162,7 @@ namespace MWMechanics
|
|||
&& actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
damage *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWereWolfSilverWeaponDamageMult")->getFloat();
|
||||
|
||||
if (damage == 0 && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (damage == 0 && attacker == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResistsWeapons}");
|
||||
}
|
||||
|
||||
|
@ -178,7 +179,7 @@ namespace MWMechanics
|
|||
return;
|
||||
}
|
||||
|
||||
if(attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(attacker == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||
|
||||
int weapskill = ESM::Skill::Marksman;
|
||||
|
@ -207,7 +208,7 @@ namespace MWMechanics
|
|||
adjustWeaponDamage(damage, weapon, attacker);
|
||||
reduceWeaponCondition(damage, true, weapon, attacker);
|
||||
|
||||
if(attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(attacker == getPlayer())
|
||||
attacker.getClass().skillUsageSucceeded(attacker, weapskill, 0);
|
||||
|
||||
if (victim.getClass().getCreatureStats(victim).getKnockedDown())
|
||||
|
@ -222,7 +223,7 @@ namespace MWMechanics
|
|||
MWBase::Environment::get().getWorld()->spawnBloodEffect(victim, hitPosition);
|
||||
|
||||
// Non-enchanted arrows shot at enemies have a chance to turn up in their inventory
|
||||
if (victim != MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
if (victim != getPlayer()
|
||||
&& !appliedEnchantment)
|
||||
{
|
||||
float fProjectileThrownStoreChance = gmst.find("fProjectileThrownStoreChance")->getFloat();
|
||||
|
@ -242,15 +243,15 @@ namespace MWMechanics
|
|||
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
|
||||
|
||||
float defenseTerm = 0;
|
||||
if (victim.getClass().getCreatureStats(victim).getFatigue().getCurrent() >= 0)
|
||||
MWMechanics::CreatureStats& victimStats = victim.getClass().getCreatureStats(victim);
|
||||
if (victimStats.getFatigue().getCurrent() >= 0)
|
||||
{
|
||||
MWMechanics::CreatureStats& victimStats = victim.getClass().getCreatureStats(victim);
|
||||
// Maybe we should keep an aware state for actors updated every so often instead of testing every time
|
||||
bool unaware = (!victimStats.getAiSequence().isInCombat())
|
||||
&& (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
&& (attacker == getPlayer())
|
||||
&& (!MWBase::Environment::get().getMechanicsManager()->awarenessCheck(attacker, victim));
|
||||
if (!(victimStats.getKnockedDown() ||
|
||||
victimStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
|
||||
victimStats.isParalyzed()
|
||||
|| unaware ))
|
||||
{
|
||||
defenseTerm = victimStats.getEvasion();
|
||||
|
@ -375,7 +376,7 @@ namespace MWMechanics
|
|||
damage *= minstrike + ((maxstrike-minstrike)*attackStrength);
|
||||
|
||||
MWMechanics::CreatureStats& otherstats = victim.getClass().getCreatureStats(victim);
|
||||
healthdmg = (otherstats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||
healthdmg = otherstats.isParalyzed()
|
||||
|| otherstats.getKnockedDown();
|
||||
bool isWerewolf = (attacker.getClass().isNpc() && attacker.getClass().getNpcStats(attacker).isWerewolf());
|
||||
if(isWerewolf)
|
||||
|
|
|
@ -221,6 +221,11 @@ namespace MWMechanics
|
|||
setAiSetting(index, stat);
|
||||
}
|
||||
|
||||
bool CreatureStats::isParalyzed() const
|
||||
{
|
||||
return mMagicEffects.get(ESM::MagicEffect::Paralyze).getMagnitude() > 0;
|
||||
}
|
||||
|
||||
bool CreatureStats::isDead() const
|
||||
{
|
||||
return mDead;
|
||||
|
|
|
@ -155,6 +155,8 @@ namespace MWMechanics
|
|||
float getFatigueTerm() const;
|
||||
///< Return effective fatigue
|
||||
|
||||
bool isParalyzed() const;
|
||||
|
||||
bool isDead() const;
|
||||
|
||||
void notifyDied();
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "actorutil.hpp"
|
||||
|
||||
float scaleDamage(float damage, const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr& player = MWMechanics::getPlayer();
|
||||
|
||||
// [-100, 100]
|
||||
int difficultySetting = Settings::Manager::getInt("difficulty", "Game");
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwmechanics/spells.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "spells.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
|
@ -20,7 +22,7 @@ namespace MWMechanics
|
|||
/// @param carrier The disease carrier.
|
||||
inline void diseaseContact (MWWorld::Ptr actor, MWWorld::Ptr carrier)
|
||||
{
|
||||
if (!carrier.getClass().isActor() || actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (!carrier.getClass().isActor() || actor != getPlayer())
|
||||
return;
|
||||
|
||||
float fDiseaseXferChance =
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "creaturestats.hpp"
|
||||
#include "npcstats.hpp"
|
||||
#include "spellcasting.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
|
@ -54,7 +55,7 @@ namespace MWMechanics
|
|||
|
||||
bool Enchanting::create()
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr& player = getPlayer();
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
ESM::Enchantment enchantment;
|
||||
enchantment.mData.mCharge = getGemCharge();
|
||||
|
@ -217,7 +218,7 @@ namespace MWMechanics
|
|||
int Enchanting::getEffectiveCastCost() const
|
||||
{
|
||||
int baseCost = getBaseCastCost();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
return getEffectiveEnchantmentCastCost(static_cast<float>(baseCost), player);
|
||||
}
|
||||
|
||||
|
@ -291,7 +292,7 @@ namespace MWMechanics
|
|||
|
||||
void Enchanting::payForEnchantment() const
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr& player = getPlayer();
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
|
||||
store.remove(MWWorld::ContainerStore::sGoldId, getEnchantPrice(), player);
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
|
@ -21,7 +22,7 @@ namespace MWMechanics
|
|||
{
|
||||
const std::vector<ESM::LevelledListBase::LevelItem>& items = levItem->mList;
|
||||
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWWorld::Ptr& player = getPlayer();
|
||||
int playerLevel = player.getClass().getCreatureStats(player).getLevel();
|
||||
|
||||
failChance += levItem->mChanceNone;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "spellcasting.hpp"
|
||||
#include "autocalcspell.hpp"
|
||||
#include "npcstats.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -83,7 +84,7 @@ namespace MWMechanics
|
|||
{
|
||||
void MechanicsManager::buildPlayer()
|
||||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr ptr = getPlayer();
|
||||
|
||||
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
|
||||
MWMechanics::NpcStats& npcStats = ptr.getClass().getNpcStats (ptr);
|
||||
|
@ -361,7 +362,7 @@ namespace MWMechanics
|
|||
{
|
||||
// Uses ingame time, but scaled to real time
|
||||
duration /= MWBase::Environment::get().getWorld()->getTimeScaleFactor();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
player.getClass().getInventoryStore(player).rechargeItems(duration);
|
||||
}
|
||||
|
||||
|
@ -489,7 +490,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()->getPlayerPtr();
|
||||
MWWorld::Ptr ptr = getPlayer();
|
||||
mActors.removeActor(ptr);
|
||||
mActors.addActor(ptr, true);
|
||||
}
|
||||
|
@ -586,7 +587,7 @@ namespace MWMechanics
|
|||
float x = static_cast<float>(npcSkill.getBaseDisposition());
|
||||
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>();
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr playerPtr = getPlayer();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* player = playerPtr.get<ESM::NPC>();
|
||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||
|
||||
|
@ -663,7 +664,7 @@ namespace MWMechanics
|
|||
|
||||
const MWMechanics::NpcStats &sellerStats = ptr.getClass().getNpcStats(ptr);
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr playerPtr = getPlayer();
|
||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||
|
||||
// I suppose the temporary disposition change _has_ to be considered here,
|
||||
|
@ -707,7 +708,7 @@ namespace MWMechanics
|
|||
|
||||
MWMechanics::NpcStats& npcStats = npc.getClass().getNpcStats(npc);
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr playerPtr = getPlayer();
|
||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||
|
||||
float npcRating1, npcRating2, npcRating3;
|
||||
|
@ -1010,7 +1011,7 @@ namespace MWMechanics
|
|||
void MechanicsManager::itemTaken(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item, const MWWorld::Ptr& container,
|
||||
int count)
|
||||
{
|
||||
if (ptr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr != getPlayer())
|
||||
return;
|
||||
|
||||
MWWorld::Ptr victim;
|
||||
|
@ -1067,7 +1068,7 @@ namespace MWMechanics
|
|||
// NOTE: victim may be empty
|
||||
|
||||
// Only player can commit crime
|
||||
if (player != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (player != getPlayer())
|
||||
return false;
|
||||
|
||||
// Find all the actors within the alarm radius
|
||||
|
@ -1306,15 +1307,16 @@ namespace MWMechanics
|
|||
|
||||
bool MechanicsManager::actorAttacked(const MWWorld::Ptr &ptr, const MWWorld::Ptr &attacker)
|
||||
{
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == getPlayer())
|
||||
return false;
|
||||
|
||||
std::list<MWWorld::Ptr> followers = getActorsFollowing(attacker);
|
||||
MWMechanics::CreatureStats& targetStats = ptr.getClass().getCreatureStats(ptr);
|
||||
if (std::find(followers.begin(), followers.end(), ptr) != followers.end())
|
||||
{
|
||||
ptr.getClass().getCreatureStats(ptr).friendlyHit();
|
||||
targetStats.friendlyHit();
|
||||
|
||||
if (ptr.getClass().getCreatureStats(ptr).getFriendlyHits() < 4)
|
||||
if (targetStats.getFriendlyHits() < 4)
|
||||
{
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
||||
return false;
|
||||
|
@ -1322,7 +1324,7 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
// Attacking an NPC that is already in combat with any other NPC is not a crime
|
||||
AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||
AiSequence& seq = targetStats.getAiSequence();
|
||||
bool isFightingNpc = false;
|
||||
for (std::list<AiPackage*>::const_iterator it = seq.begin(); it != seq.end(); ++it)
|
||||
{
|
||||
|
@ -1334,13 +1336,13 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
if (ptr.getClass().isNpc() && !attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)
|
||||
if (ptr.getClass().isNpc() && !attacker.isEmpty() && !seq.isInCombat(attacker)
|
||||
&& !isAggressive(ptr, attacker) && !isFightingNpc)
|
||||
commitCrime(attacker, ptr, MWBase::MechanicsManager::OT_Assault);
|
||||
|
||||
if (!attacker.isEmpty() && (attacker.getClass().getCreatureStats(attacker).getAiSequence().isInCombat(ptr)
|
||||
|| attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
&& !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker))
|
||||
|| attacker == getPlayer())
|
||||
&& !seq.isInCombat(attacker))
|
||||
{
|
||||
// Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back.
|
||||
// Note: accidental or collateral damage attacks are ignored.
|
||||
|
@ -1352,7 +1354,7 @@ namespace MWMechanics
|
|||
|
||||
void MechanicsManager::actorKilled(const MWWorld::Ptr &victim, const MWWorld::Ptr &attacker)
|
||||
{
|
||||
if (attacker.isEmpty() || attacker != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (attacker.isEmpty() || attacker != getPlayer())
|
||||
return;
|
||||
|
||||
if (victim == attacker)
|
||||
|
@ -1449,7 +1451,7 @@ namespace MWMechanics
|
|||
if (ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(target))
|
||||
return;
|
||||
ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(MWMechanics::AiCombat(target), ptr);
|
||||
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (target == getPlayer())
|
||||
{
|
||||
// if guard starts combat with player, guards pursuing player should do the same
|
||||
if (ptr.getClass().isClass(ptr, "Guard"))
|
||||
|
@ -1546,7 +1548,7 @@ namespace MWMechanics
|
|||
if (ptr.getClass().isNpc() && target.getClass().isNpc())
|
||||
{
|
||||
if (target.getClass().getNpcStats(target).isWerewolf() ||
|
||||
(target == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||
(target == getPlayer() &&
|
||||
MWBase::Environment::get().getWorld()->getGlobalInt("pcknownwerewolf")))
|
||||
{
|
||||
const ESM::GameSetting * iWerewolfFightMod = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search("iWerewolfFightMod");
|
||||
|
@ -1559,7 +1561,7 @@ namespace MWMechanics
|
|||
|
||||
void MechanicsManager::keepPlayerAlive()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
if (stats.isDead())
|
||||
{
|
||||
|
|
|
@ -14,15 +14,16 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
#include "npcstats.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
|
||||
void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
mTool.get<ESM::Repair>();
|
||||
|
||||
|
@ -82,7 +83,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
|||
// tool used up?
|
||||
if (mTool.getCellRef().getCharge() == 0)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = getPlayer();
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
|
||||
store.remove(mTool, 1, player);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "magiceffects.hpp"
|
||||
#include "npcstats.hpp"
|
||||
#include "summoning.hpp"
|
||||
#include "actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -134,7 +135,7 @@ namespace MWMechanics
|
|||
int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||
|
||||
float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm();
|
||||
if (MWBase::Environment::get().getWorld()->getGodModeState() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (MWBase::Environment::get().getWorld()->getGodModeState() && actor == getPlayer())
|
||||
castChance = 100;
|
||||
|
||||
if (!cap)
|
||||
|
@ -333,14 +334,15 @@ namespace MWMechanics
|
|||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (mId);
|
||||
if (spell && (spell->mData.mType == ESM::Spell::ST_Disease || spell->mData.mType == ESM::Spell::ST_Blight))
|
||||
{
|
||||
float x = (spell->mData.mType == ESM::Spell::ST_Disease) ?
|
||||
target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
||||
: target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).getMagnitude();
|
||||
int requiredResistance = (spell->mData.mType == ESM::Spell::ST_Disease) ?
|
||||
ESM::MagicEffect::ResistCommonDisease
|
||||
: ESM::MagicEffect::ResistBlightDisease;
|
||||
float x = target.getClass().getCreatureStats(target).getMagicEffects().get(requiredResistance).getMagnitude();
|
||||
|
||||
if (Misc::Rng::roll0to99() <= x)
|
||||
{
|
||||
// Fully resisted, show message
|
||||
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (target == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
|
||||
return;
|
||||
}
|
||||
|
@ -358,7 +360,7 @@ namespace MWMechanics
|
|||
if (target.getClass().isActor())
|
||||
targetEffects += target.getClass().getCreatureStats(target).getMagicEffects();
|
||||
|
||||
bool castByPlayer = (!caster.isEmpty() && caster == MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
bool castByPlayer = (!caster.isEmpty() && caster == getPlayer());
|
||||
|
||||
// Try absorbing if it's a spell
|
||||
// NOTE: Vanilla does this once per effect source instead of adding the % from all sources together, not sure
|
||||
|
@ -433,7 +435,7 @@ namespace MWMechanics
|
|||
if (magnitudeMult == 0)
|
||||
{
|
||||
// Fully resisted, show message
|
||||
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (target == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
|
||||
else if (castByPlayer)
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}");
|
||||
|
@ -569,7 +571,7 @@ namespace MWMechanics
|
|||
{
|
||||
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||
{
|
||||
if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (caster == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicLockSuccess}");
|
||||
target.getClass().lock(target, static_cast<int>(magnitude));
|
||||
}
|
||||
|
@ -585,7 +587,7 @@ namespace MWMechanics
|
|||
if (!caster.isEmpty() && caster.getClass().isActor())
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(caster, target);
|
||||
|
||||
if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (caster == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}");
|
||||
}
|
||||
target.getClass().unlock(target);
|
||||
|
@ -622,7 +624,7 @@ namespace MWMechanics
|
|||
return true;
|
||||
}
|
||||
|
||||
if (target != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (target != getPlayer())
|
||||
return false;
|
||||
|
||||
if (effectId == ESM::MagicEffect::DivineIntervention)
|
||||
|
@ -701,7 +703,7 @@ namespace MWMechanics
|
|||
|
||||
if (item.getCellRef().getEnchantmentCharge() < castCost)
|
||||
{
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mCaster == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicInsufficientCharge}");
|
||||
|
||||
// Failure sound
|
||||
|
@ -725,14 +727,14 @@ namespace MWMechanics
|
|||
|
||||
if (enchantment->mData.mType == ESM::Enchantment::WhenUsed)
|
||||
{
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mCaster == getPlayer())
|
||||
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 1);
|
||||
}
|
||||
if (enchantment->mData.mType == ESM::Enchantment::CastOnce)
|
||||
item.getContainerStore()->remove(item, 1, mCaster);
|
||||
else if (enchantment->mData.mType != ESM::Enchantment::WhenStrikes)
|
||||
{
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mCaster == getPlayer())
|
||||
{
|
||||
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 3);
|
||||
}
|
||||
|
@ -799,7 +801,7 @@ namespace MWMechanics
|
|||
float successChance = getSpellSuccessChance(spell, mCaster);
|
||||
if (Misc::Rng::roll0to99() >= successChance)
|
||||
{
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mCaster == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}");
|
||||
fail = true;
|
||||
}
|
||||
|
@ -817,7 +819,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr() && spellIncreasesSkill(spell))
|
||||
if (mCaster == getPlayer() && spellIncreasesSkill(spell))
|
||||
mCaster.getClass().skillUsageSucceeded(mCaster,
|
||||
spellSchoolToSkill(school), 0);
|
||||
|
||||
|
@ -962,7 +964,7 @@ namespace MWMechanics
|
|||
if (charge == 0)
|
||||
{
|
||||
// Will unequip the broken item and try to find a replacement
|
||||
if (ptr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr != getPlayer())
|
||||
inv.autoEquip(ptr);
|
||||
else
|
||||
inv.unequipItem(*item, ptr);
|
||||
|
@ -1097,7 +1099,7 @@ namespace MWMechanics
|
|||
|
||||
}
|
||||
|
||||
if (receivedMagicDamage && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (receivedMagicDamage && actor == getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/movement.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
@ -1091,7 +1092,7 @@ namespace MWPhysics
|
|||
|
||||
bool PhysicsSystem::toggleCollisionMode()
|
||||
{
|
||||
ActorMap::iterator found = mActors.find(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
ActorMap::iterator found = mActors.find(MWMechanics::getPlayer());
|
||||
if (found != mActors.end())
|
||||
{
|
||||
bool cmode = found->second->getCollisionMode();
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "npcanimation.hpp"
|
||||
#include "vismask.hpp"
|
||||
|
||||
|
@ -295,7 +297,7 @@ namespace MWRender
|
|||
// --------------------------------------------------------------------------------------------------
|
||||
|
||||
RaceSelectionPreview::RaceSelectionPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem)
|
||||
: CharacterPreview(viewer, resourceSystem, MWBase::Environment::get().getWorld()->getPlayerPtr(),
|
||||
: CharacterPreview(viewer, resourceSystem, MWMechanics::getPlayer(),
|
||||
512, 512, osg::Vec3f(0, 125, 8), osg::Vec3f(0,0,8))
|
||||
, mBase (*mCharacter.get<ESM::NPC>()->mBase)
|
||||
, mRef(&mBase)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -1039,7 +1040,7 @@ void NpcAnimation::setVampire(bool vampire)
|
|||
return;
|
||||
if ((mNpcType == Type_Vampire) != vampire)
|
||||
{
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mPtr == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWorld()->reattachPlayerCamera();
|
||||
else
|
||||
rebuild();
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "../mwworld/fallback.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
void createWaterRippleStateSet(Resource::ResourceSystem* resourceSystem, const MWWorld::Fallback* fallback, osg::Node* node)
|
||||
|
@ -177,7 +179,7 @@ void RippleSimulation::removeCell(const MWWorld::CellStore *store)
|
|||
{
|
||||
for (std::vector<Emitter>::iterator it = mEmitters.begin(); it != mEmitters.end();)
|
||||
{
|
||||
if (it->mPtr.getCell() == store && it->mPtr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (it->mPtr.getCell() == store && it->mPtr != MWMechanics::getPlayer())
|
||||
{
|
||||
it = mEmitters.erase(it);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
namespace MWScript
|
||||
|
@ -91,14 +93,14 @@ namespace MWScript
|
|||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
|
||||
if (!MWMechanics::getPlayer().isInCell())
|
||||
{
|
||||
runtime.push (0);
|
||||
return;
|
||||
}
|
||||
|
||||
bool interior =
|
||||
!MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell()->isExterior();
|
||||
!MWMechanics::getPlayer().getCell()->getCell()->isExterior();
|
||||
|
||||
runtime.push (interior ? 1 : 0);
|
||||
}
|
||||
|
@ -113,12 +115,12 @@ namespace MWScript
|
|||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
|
||||
if (!MWMechanics::getPlayer().isInCell())
|
||||
{
|
||||
runtime.push(0);
|
||||
return;
|
||||
}
|
||||
const MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
const MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
|
||||
|
||||
std::string current = MWBase::Environment::get().getWorld()->getCellName(cell);
|
||||
Misc::StringUtils::toLower(current);
|
||||
|
@ -136,12 +138,12 @@ namespace MWScript
|
|||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
|
||||
if (!MWMechanics::getPlayer().isInCell())
|
||||
{
|
||||
runtime.push(0.f);
|
||||
return;
|
||||
}
|
||||
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
|
||||
if (cell->getCell()->hasWater())
|
||||
runtime.push (cell->getWaterLevel());
|
||||
else
|
||||
|
@ -157,12 +159,12 @@ namespace MWScript
|
|||
{
|
||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
|
||||
if (!MWMechanics::getPlayer().isInCell())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
|
||||
|
||||
if (cell->getCell()->isExterior())
|
||||
throw std::runtime_error("Can't set water level in exterior cell");
|
||||
|
@ -180,12 +182,12 @@ namespace MWScript
|
|||
{
|
||||
Interpreter::Type_Float level = runtime[0].mFloat;
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
|
||||
if (!MWMechanics::getPlayer().isInCell())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
|
||||
|
||||
if (cell->getCell()->isExterior())
|
||||
throw std::runtime_error("Can't set water level in exterior cell");
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
|
@ -147,7 +149,7 @@ namespace MWScript
|
|||
|
||||
// Spawn a messagebox (only for items removed from player's inventory)
|
||||
if ((numRemoved > 0)
|
||||
&& (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr()))
|
||||
&& (ptr == MWMechanics::getPlayer()))
|
||||
{
|
||||
// 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;
|
||||
|
@ -192,7 +194,7 @@ namespace MWScript
|
|||
MWWorld::ActionEquip action (*it);
|
||||
action.execute(ptr);
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr() && !ptr.getClass().getScript(ptr).empty())
|
||||
if (ptr == MWMechanics::getPlayer() && !ptr.getClass().getScript(ptr).empty())
|
||||
ptr.getRefData().getLocals().setVarByInt(ptr.getClass().getScript(ptr), "onpcequip", 1);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
|
@ -53,7 +55,7 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr bed = R()(runtime, false);
|
||||
|
||||
if (bed.isEmpty() || !MWBase::Environment::get().getMechanicsManager()->sleepInBed(MWBase::Environment::get().getWorld()->getPlayerPtr(),
|
||||
if (bed.isEmpty() || !MWBase::Environment::get().getMechanicsManager()->sleepInBed(MWMechanics::getPlayer(),
|
||||
bed))
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_RestBed);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
@ -156,7 +157,7 @@ namespace MWScript
|
|||
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
context.executeActivation(ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
context.executeActivation(ptr, MWMechanics::getPlayer());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -976,7 +977,7 @@ namespace MWScript
|
|||
public:
|
||||
virtual void execute(Interpreter::Runtime &runtime)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats(player).setBounty(0);
|
||||
MWBase::Environment::get().getWorld()->confiscateStolenItems(player);
|
||||
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
|
||||
|
@ -988,7 +989,7 @@ namespace MWScript
|
|||
public:
|
||||
virtual void execute(Interpreter::Runtime &runtime)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats(player).setBounty(0);
|
||||
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
@ -460,7 +461,7 @@ namespace MWScript
|
|||
|
||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||
if (ptr == MWMechanics::getPlayer() &&
|
||||
id == wm->getSelectedSpell())
|
||||
{
|
||||
wm->unsetSelectedSpell();
|
||||
|
@ -548,7 +549,7 @@ namespace MWScript
|
|||
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats(player).joinFaction(factionID);
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +581,7 @@ namespace MWScript
|
|||
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) == player.getClass().getNpcStats(player).getFactionRanks().end())
|
||||
{
|
||||
player.getClass().getNpcStats(player).joinFaction(factionID);
|
||||
|
@ -619,7 +620,7 @@ namespace MWScript
|
|||
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats(player).lowerRank(factionID);
|
||||
}
|
||||
}
|
||||
|
@ -648,7 +649,7 @@ namespace MWScript
|
|||
// Make sure this faction exists
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if(factionID!="")
|
||||
{
|
||||
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end())
|
||||
|
@ -757,7 +758,7 @@ namespace MWScript
|
|||
|
||||
::Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
runtime.push (
|
||||
player.getClass().getNpcStats (player).getFactionReputation (factionId));
|
||||
}
|
||||
|
@ -792,7 +793,7 @@ namespace MWScript
|
|||
|
||||
::Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats (player).setFactionReputation (factionId, value);
|
||||
}
|
||||
};
|
||||
|
@ -826,7 +827,7 @@ namespace MWScript
|
|||
|
||||
::Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats (player).setFactionReputation (factionId,
|
||||
player.getClass().getNpcStats (player).getFactionReputation (factionId)+
|
||||
value);
|
||||
|
@ -911,7 +912,7 @@ namespace MWScript
|
|||
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
||||
}
|
||||
::Misc::StringUtils::toLower(factionID);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if(factionID!="")
|
||||
{
|
||||
runtime.push(player.getClass().getNpcStats(player).getExpelled(factionID));
|
||||
|
@ -942,7 +943,7 @@ namespace MWScript
|
|||
{
|
||||
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if(factionID!="")
|
||||
{
|
||||
player.getClass().getNpcStats(player).expell(factionID);
|
||||
|
@ -969,7 +970,7 @@ namespace MWScript
|
|||
{
|
||||
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
||||
}
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if(factionID!="")
|
||||
player.getClass().getNpcStats(player).clearExpelled(factionID);
|
||||
}
|
||||
|
@ -988,7 +989,7 @@ namespace MWScript
|
|||
if(factionID.empty())
|
||||
return;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
// no-op when executed on the player
|
||||
if (ptr == player)
|
||||
|
@ -1011,7 +1012,7 @@ namespace MWScript
|
|||
if(factionID.empty())
|
||||
return;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
|
||||
// no-op when executed on the player
|
||||
if (ptr == player)
|
||||
|
@ -1120,7 +1121,7 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
ptr.getClass().getCreatureStats(ptr).resurrect();
|
||||
else if (ptr.getClass().getCreatureStats(ptr).isDead())
|
||||
{
|
||||
|
@ -1159,10 +1160,10 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||
float currentValue = stats.getMagicEffects().get(mPositiveEffect).getMagnitude();
|
||||
const MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
||||
float currentValue = effects.get(mPositiveEffect).getMagnitude();
|
||||
if (mNegativeEffect != -1)
|
||||
currentValue -= stats.getMagicEffects().get(mNegativeEffect).getMagnitude();
|
||||
currentValue -= effects.get(mNegativeEffect).getMagnitude();
|
||||
|
||||
int ret = static_cast<int>(currentValue);
|
||||
runtime.push(ret);
|
||||
|
@ -1185,14 +1186,14 @@ namespace MWScript
|
|||
virtual void execute(Interpreter::Runtime &runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||
float currentValue = stats.getMagicEffects().get(mPositiveEffect).getMagnitude();
|
||||
MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
||||
float currentValue = effects.get(mPositiveEffect).getMagnitude();
|
||||
if (mNegativeEffect != -1)
|
||||
currentValue -= stats.getMagicEffects().get(mNegativeEffect).getMagnitude();
|
||||
currentValue -= effects.get(mNegativeEffect).getMagnitude();
|
||||
|
||||
int arg = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
stats.getMagicEffects().modifyBase(mPositiveEffect, (arg - static_cast<int>(currentValue)));
|
||||
effects.modifyBase(mPositiveEffect, (arg - static_cast<int>(currentValue)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
|
@ -214,7 +216,7 @@ namespace MWScript
|
|||
if (!ptr.isInCell())
|
||||
return;
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
||||
}
|
||||
|
@ -289,7 +291,7 @@ namespace MWScript
|
|||
if (ptr.getContainerStore())
|
||||
return;
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
||||
}
|
||||
|
@ -333,7 +335,7 @@ namespace MWScript
|
|||
// Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
|
||||
// except for when you position the player, then degrees must be used.
|
||||
// See "Morrowind Scripting for Dummies (9th Edition)" pages 50 and 54 for reference.
|
||||
if(ptr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(ptr != MWMechanics::getPlayer())
|
||||
zRot = zRot/60.0f;
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
|
||||
|
||||
|
@ -354,7 +356,7 @@ namespace MWScript
|
|||
if (!ptr.isInCell())
|
||||
return;
|
||||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
||||
}
|
||||
|
@ -372,7 +374,7 @@ namespace MWScript
|
|||
|
||||
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
||||
// non-player actors will move within the cell they are in.
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
{
|
||||
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);
|
||||
|
@ -389,7 +391,7 @@ namespace MWScript
|
|||
// Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
|
||||
// except for when you position the player, then degrees must be used.
|
||||
// See "Morrowind Scripting for Dummies (9th Edition)" pages 50 and 54 for reference.
|
||||
if(ptr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if(ptr != MWMechanics::getPlayer())
|
||||
zRot = zRot/60.0f;
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
|
||||
ptr.getClass().adjustPosition(ptr, false);
|
||||
|
@ -469,7 +471,7 @@ namespace MWScript
|
|||
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
MWWorld::CellStore* store = NULL;
|
||||
if (player.getCell()->isExterior())
|
||||
{
|
||||
|
@ -501,7 +503,7 @@ namespace MWScript
|
|||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr actor = pc
|
||||
? MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
? MWMechanics::getPlayer()
|
||||
: R()(runtime);
|
||||
|
||||
std::string itemID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "sound_output.hpp"
|
||||
#include "sound_decoder.hpp"
|
||||
#include "sound.hpp"
|
||||
|
@ -490,7 +492,7 @@ namespace MWSound
|
|||
while(snditer != mActiveSounds.end())
|
||||
{
|
||||
if(snditer->second.first != MWWorld::Ptr() &&
|
||||
snditer->second.first != MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||
snditer->second.first != MWMechanics::getPlayer() &&
|
||||
snditer->second.first.getCell() == cell)
|
||||
{
|
||||
snditer->first->stop();
|
||||
|
@ -735,7 +737,7 @@ namespace MWSound
|
|||
mListenerUp = up;
|
||||
|
||||
MWWorld::Ptr player =
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::getPlayer();
|
||||
const MWWorld::CellStore *cell = player.getCell();
|
||||
|
||||
mListenerUnderwater = ((cell->getCell()->mData.mFlags&ESM::Cell::HasWater) && mListenerPos.z() < cell->getWaterLevel());
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwscript/globalscripts.hpp"
|
||||
|
||||
|
@ -472,7 +473,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
if (firstPersonCam != MWBase::Environment::get().getWorld()->isFirstPerson())
|
||||
MWBase::Environment::get().getWorld()->togglePOV();
|
||||
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr ptr = MWMechanics::getPlayer();
|
||||
|
||||
ESM::CellId cellId = ptr.getCell()->getCell()->getCellId();
|
||||
|
||||
|
@ -519,7 +520,7 @@ void MWState::StateManager::deleteGame(const MWState::Character *character, cons
|
|||
|
||||
MWState::Character *MWState::StateManager::getCurrentCharacter (bool create)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
std::string name = player.get<ESM::NPC>()->mBase->mName;
|
||||
|
||||
return mCharacterManager.getCurrentCharacter (create, name);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
const MWWorld::Ptr& MWWorld::Action::getTarget() const
|
||||
{
|
||||
return mTarget;
|
||||
|
@ -19,7 +21,7 @@ void MWWorld::Action::execute (const Ptr& actor)
|
|||
{
|
||||
if (!mSoundId.empty())
|
||||
{
|
||||
if (mKeepSound && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (mKeepSound && actor == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0,
|
||||
MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal,mSoundOffset);
|
||||
else
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include <components/compiler/locals.hpp>
|
||||
|
||||
#include "inventorystore.hpp"
|
||||
|
@ -24,7 +26,7 @@ namespace MWWorld
|
|||
std::pair <int, std::string> result = object.getClass().canBeEquipped (object, actor);
|
||||
|
||||
// display error message if the player tried to equip something
|
||||
if (!result.second.empty() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (!result.second.empty() && actor == MWMechanics::getPlayer())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(result.second);
|
||||
|
||||
switch(result.first)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/levelledlist.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "manualref.hpp"
|
||||
#include "refdata.hpp"
|
||||
|
@ -209,7 +210,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &
|
|||
{
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count);
|
||||
// a bit pointless to set owner for the player
|
||||
if (actorPtr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (actorPtr != MWMechanics::getPlayer())
|
||||
return add(ref.getPtr(), count, actorPtr, true);
|
||||
else
|
||||
return add(ref.getPtr(), count, actorPtr, false);
|
||||
|
@ -224,7 +225,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
|
|||
// HACK: Set owner on the original item, then reset it after we have copied it
|
||||
// If we set the owner on the copied item, it would not stack correctly...
|
||||
std::string oldOwner = itemPtr.getCellRef().getOwner();
|
||||
if (!setOwner || actorPtr == MWBase::Environment::get().getWorld()->getPlayerPtr()) // No point in setting owner to the player - NPCs will not respect this anyway
|
||||
if (!setOwner || actorPtr == MWMechanics::getPlayer()) // No point in setting owner to the player - NPCs will not respect this anyway
|
||||
{
|
||||
itemPtr.getCellRef().setOwner("");
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ namespace MWWorld
|
|||
|
||||
void FailedAction::executeImp(const Ptr &actor)
|
||||
{
|
||||
if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && !mMessage.empty())
|
||||
if(actor == MWMechanics::getPlayer() && !mMessage.empty())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(mMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
|
||||
#include "esmstore.hpp"
|
||||
|
@ -136,7 +137,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr,
|
|||
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr, setOwner);
|
||||
|
||||
// Auto-equip items if an armor/clothing or weapon item is added, but not for the player nor werewolves
|
||||
if (actorPtr != MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
if (actorPtr != MWMechanics::getPlayer()
|
||||
&& !(actorPtr.getClass().isNpc() && actorPtr.getClass().getNpcStats(actorPtr).isWerewolf()))
|
||||
{
|
||||
std::string type = itemPtr.getTypeName();
|
||||
|
@ -508,7 +509,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
|
||||
// If an armor/clothing item is removed, try to find a replacement,
|
||||
// but not for the player nor werewolves.
|
||||
if (wasEquipped && (actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (wasEquipped && (actor != MWMechanics::getPlayer())
|
||||
&& !(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()))
|
||||
{
|
||||
std::string type = item.getTypeName();
|
||||
|
@ -540,7 +541,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c
|
|||
{
|
||||
retval = restack(*it);
|
||||
|
||||
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (actor == MWMechanics::getPlayer())
|
||||
{
|
||||
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
|
||||
const std::string& script = it->getClass().getScript(*it);
|
||||
|
@ -595,7 +596,7 @@ void MWWorld::InventoryStore::fireEquipmentChangedEvent(const Ptr& actor)
|
|||
|
||||
// if player, update inventory window
|
||||
/*
|
||||
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
if (actor == MWMechanics::getPlayer())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "../mwmechanics/combat.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwrender/effectmanager.hpp"
|
||||
#include "../mwrender/animation.hpp"
|
||||
|
@ -187,7 +188,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
// Explodes when hitting water
|
||||
if (MWBase::Environment::get().getWorld()->isUnderwater(MWBase::Environment::get().getWorld()->getPlayerPtr().getCell(), newPos))
|
||||
if (MWBase::Environment::get().getWorld()->isUnderwater(MWMechanics::getPlayer().getCell(), newPos))
|
||||
hit = true;
|
||||
|
||||
if (hit)
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/actorutil.hpp"
|
||||
|
||||
#include "../mwsound/sound.hpp"
|
||||
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
|
@ -798,7 +800,7 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int
|
|||
|
||||
mRegionOverrides[Misc::StringUtils::lowerCase(region)] = weather;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if (player.isInCell())
|
||||
{
|
||||
std::string playerRegion = player.getCell()->getCell()->mRegion;
|
||||
|
|
|
@ -1924,16 +1924,15 @@ namespace MWWorld
|
|||
bool World::isFlying(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
||||
bool isParalyzed = (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0);
|
||||
|
||||
if(!ptr.getClass().isActor())
|
||||
return false;
|
||||
|
||||
if (ptr.getClass().getCreatureStats(ptr).isDead())
|
||||
if (stats.isDead())
|
||||
return false;
|
||||
|
||||
if (ptr.getClass().canFly(ptr))
|
||||
return !isParalyzed;
|
||||
return !stats.isParalyzed();
|
||||
|
||||
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).getMagnitude() > 0
|
||||
&& isLevitationEnabled())
|
||||
|
|
Loading…
Reference in a new issue