mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 10:53:54 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
34b163233b
187 changed files with 2230 additions and 1225 deletions
|
@ -119,6 +119,7 @@ set(OENGINE_OGRE
|
|||
)
|
||||
|
||||
set(OENGINE_GUI
|
||||
${LIBDIR}/openengine/gui/loglistener.cpp
|
||||
${LIBDIR}/openengine/gui/manager.cpp
|
||||
${LIBDIR}/openengine/gui/layout.hpp
|
||||
)
|
||||
|
@ -224,6 +225,9 @@ endif ()
|
|||
|
||||
|
||||
set(BOOST_COMPONENTS system filesystem program_options)
|
||||
if(WIN32)
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
||||
endif(WIN32)
|
||||
|
||||
IF(BOOST_STATIC)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
|
|
|
@ -387,7 +387,7 @@ std::string magicEffectLabel(int idx)
|
|||
"sEffectSummonCreature04",
|
||||
"sEffectSummonCreature05"
|
||||
};
|
||||
if (idx >= 0 && idx <= 143)
|
||||
if (idx >= 0 && idx <= 142)
|
||||
return magicEffectLabels[idx];
|
||||
else
|
||||
return "Invalid";
|
||||
|
@ -471,7 +471,7 @@ std::string skillLabel(int idx)
|
|||
"Speechcraft",
|
||||
"Hand-to-hand"
|
||||
};
|
||||
if (idx >= 0 && idx <= 27)
|
||||
if (idx >= 0 && idx <= 26)
|
||||
return skillLabels[idx];
|
||||
else
|
||||
return "Invalid";
|
||||
|
@ -498,7 +498,7 @@ std::string rangeTypeLabel(int idx)
|
|||
"Touch",
|
||||
"Target"
|
||||
};
|
||||
if (idx >= 0 && idx <= 3)
|
||||
if (idx >= 0 && idx <= 2)
|
||||
return rangeTypeLabels[idx];
|
||||
else
|
||||
return "Invalid";
|
||||
|
|
|
@ -707,9 +707,9 @@ void Record<ESM::Faction>::print()
|
|||
std::cout << " Faction Reaction: "
|
||||
<< mData.mData.mRankData[i].mFactReaction << std::endl;
|
||||
}
|
||||
std::vector<ESM::Faction::Reaction>::iterator rit;
|
||||
std::map<std::string, int>::iterator rit;
|
||||
for (rit = mData.mReactions.begin(); rit != mData.mReactions.end(); rit++)
|
||||
std::cout << " Reaction: " << rit->mReaction << " = " << rit->mFaction << std::endl;
|
||||
std::cout << " Reaction: " << rit->second << " = " << rit->first << std::endl;
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
|
@ -41,11 +41,11 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
|||
// Check if the font is installed
|
||||
if (!fonts.contains("EB Garamond")) {
|
||||
|
||||
QString font = QString::fromStdString(mCfgMgr.getGlobalDataPath().string()) + QString("resources/mygui/EBGaramond-Regular.ttf");
|
||||
QString font = QString::fromUtf8(mCfgMgr.getGlobalDataPath().string().c_str()) + QString("resources/mygui/EBGaramond-Regular.ttf");
|
||||
file.setFileName(font);
|
||||
|
||||
if (!file.exists()) {
|
||||
font = QString::fromStdString(mCfgMgr.getLocalPath().string()) + QString("resources/mygui/EBGaramond-Regular.ttf");
|
||||
font = QString::fromUtf8(mCfgMgr.getLocalPath().string().c_str()) + QString("resources/mygui/EBGaramond-Regular.ttf");
|
||||
}
|
||||
|
||||
fontDatabase.addApplicationFont(font);
|
||||
|
@ -243,7 +243,7 @@ bool Launcher::MainDialog::showFirstRunDialog()
|
|||
}
|
||||
|
||||
// Create the file if it doesn't already exist, else the importer will fail
|
||||
QString path = QString::fromStdString(mCfgMgr.getUserConfigPath().string()) + QString("openmw.cfg");
|
||||
QString path = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str()) + QString("openmw.cfg");
|
||||
QFile file(path);
|
||||
|
||||
if (!file.exists()) {
|
||||
|
@ -358,7 +358,7 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
|||
{
|
||||
mLauncherSettings.setMultiValueEnabled(true);
|
||||
|
||||
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
|
||||
QStringList paths;
|
||||
paths.append(QString("launcher.cfg"));
|
||||
|
@ -464,8 +464,8 @@ bool Launcher::expansions(Launcher::UnshieldThread& cd)
|
|||
|
||||
bool Launcher::MainDialog::setupGameSettings()
|
||||
{
|
||||
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
|
||||
QString globalPath = QString::fromStdString(mCfgMgr.getGlobalPath().string());
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
|
||||
|
||||
// Load the user config file first, separately
|
||||
// So we can write it properly, uncontaminated
|
||||
|
@ -594,7 +594,7 @@ bool Launcher::MainDialog::setupGameSettings()
|
|||
|
||||
while(expansions(cd));
|
||||
|
||||
selectedFile = QString::fromStdString(cd.GetMWEsmPath());
|
||||
selectedFile = QString::fromUtf8(cd.GetMWEsmPath().c_str());
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
|
@ -615,8 +615,8 @@ bool Launcher::MainDialog::setupGraphicsSettings()
|
|||
{
|
||||
mGraphicsSettings.setMultiValueEnabled(false);
|
||||
|
||||
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
|
||||
QString globalPath = QString::fromStdString(mCfgMgr.getGlobalPath().string());
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
|
||||
|
||||
QFile localDefault(QString("settings-default.cfg"));
|
||||
QFile globalDefault(globalPath + QString("settings-default.cfg"));
|
||||
|
@ -702,7 +702,7 @@ bool Launcher::MainDialog::writeSettings()
|
|||
mGraphicsPage->saveSettings();
|
||||
mDataFilesPage->saveSettings();
|
||||
|
||||
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
QDir dir(userPath);
|
||||
|
||||
if (!dir.exists()) {
|
||||
|
@ -806,7 +806,7 @@ void Launcher::MainDialog::play()
|
|||
msgBox.setWindowTitle(tr("No game file selected"));
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>You do not have no game file selected.</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>You do not have a game file selected.</b><br><br> \
|
||||
OpenMW will not start without a game file selected.<br>"));
|
||||
msgBox.exec();
|
||||
return;
|
||||
|
|
|
@ -45,7 +45,8 @@ void Launcher::GameSettings::validatePaths()
|
|||
Files::PathContainer dataDirs;
|
||||
|
||||
foreach (const QString &path, paths) {
|
||||
dataDirs.push_back(Files::PathContainer::value_type(path.toStdString()));
|
||||
QByteArray bytes = path.toUtf8();
|
||||
dataDirs.push_back(Files::PathContainer::value_type(std::string(bytes.constData(), bytes.length())));
|
||||
}
|
||||
|
||||
// Parse the data dirs to convert the tokenized paths
|
||||
|
@ -53,7 +54,7 @@ void Launcher::GameSettings::validatePaths()
|
|||
mDataDirs.clear();
|
||||
|
||||
for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) {
|
||||
QString path = QString::fromStdString(it->string());
|
||||
QString path = QString::fromUtf8(it->string().c_str());
|
||||
path.remove(QChar('\"'));
|
||||
|
||||
QDir dir(path);
|
||||
|
@ -68,12 +69,13 @@ void Launcher::GameSettings::validatePaths()
|
|||
return;
|
||||
|
||||
dataDirs.clear();
|
||||
dataDirs.push_back(Files::PathContainer::value_type(local.toStdString()));
|
||||
QByteArray bytes = local.toUtf8();
|
||||
dataDirs.push_back(Files::PathContainer::value_type(std::string(bytes.constData(), bytes.length())));
|
||||
|
||||
mCfgMgr.processPaths(dataDirs);
|
||||
|
||||
if (!dataDirs.empty()) {
|
||||
QString path = QString::fromStdString(dataDirs.front().string());
|
||||
QString path = QString::fromUtf8(dataDirs.front().string().c_str());
|
||||
path.remove(QChar('\"'));
|
||||
|
||||
QDir dir(path);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "unshieldthread.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace bfs = boost::filesystem;
|
||||
|
@ -49,7 +49,7 @@ namespace
|
|||
|
||||
std::string read_to_string(const bfs::path& path)
|
||||
{
|
||||
std::ifstream strstream(path.c_str(), std::ios::in | std::ios::binary);
|
||||
bfs::ifstream strstream(path, std::ios::in | std::ios::binary);
|
||||
std::string str;
|
||||
|
||||
strstream.seekg(0, std::ios::end);
|
||||
|
@ -201,7 +201,7 @@ namespace
|
|||
add_setting("Archives", "Archive 1", "Bloodmoon.bsa", ini);
|
||||
}
|
||||
|
||||
std::ofstream inistream(ini_path.c_str());
|
||||
bfs::ofstream inistream((ini_path));
|
||||
inistream << ini;
|
||||
inistream.close();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "importer.hpp"
|
||||
#include <boost/iostreams/device/file.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
@ -9,6 +8,10 @@
|
|||
#include <sstream>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
MwIniImporter::MwIniImporter()
|
||||
: mVerbose(false)
|
||||
|
@ -661,7 +664,7 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
|
|||
|
||||
std::string section("");
|
||||
MwIniImporter::multistrmap map;
|
||||
boost::iostreams::stream<boost::iostreams::file_source>file(filename.c_str());
|
||||
bfs::ifstream file((bfs::path(filename)));
|
||||
ToUTF8::Utf8Encoder encoder(mEncoding);
|
||||
|
||||
std::string line;
|
||||
|
@ -674,6 +677,10 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
|
|||
line = line.substr(0, line.length()-1);
|
||||
}
|
||||
|
||||
if(line.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(line[0] == '[') {
|
||||
int pos = line.find(']');
|
||||
if(pos < 2) {
|
||||
|
@ -690,10 +697,6 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
|
|||
line = line.substr(0,comment_pos);
|
||||
}
|
||||
|
||||
if(line.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int pos = line.find("=");
|
||||
if(pos < 1) {
|
||||
continue;
|
||||
|
@ -720,7 +723,7 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::string& filenam
|
|||
std::cout << "load cfg file: " << filename << std::endl;
|
||||
|
||||
MwIniImporter::multistrmap map;
|
||||
boost::iostreams::stream<boost::iostreams::file_source>file(filename.c_str());
|
||||
bfs::ifstream file((bfs::path(filename)));
|
||||
|
||||
std::string line;
|
||||
while (std::getline(file, line)) {
|
||||
|
@ -858,7 +861,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini) co
|
|||
}
|
||||
}
|
||||
|
||||
void MwIniImporter::writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, const multistrmap &cfg) {
|
||||
void MwIniImporter::writeToFile(std::ostream &out, const multistrmap &cfg) {
|
||||
|
||||
for(multistrmap::const_iterator it=cfg.begin(); it != cfg.end(); ++it) {
|
||||
for(std::vector<std::string>::const_iterator entry=it->second.begin(); entry != it->second.end(); ++entry) {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#ifndef MWINIIMPORTER_IMPORTER
|
||||
#define MWINIIMPORTER_IMPORTER 1
|
||||
|
||||
#include <boost/iostreams/device/file.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <exception>
|
||||
#include <iosfwd>
|
||||
|
||||
#include <components/to_utf8/to_utf8.hpp>
|
||||
|
||||
|
@ -24,7 +23,7 @@ class MwIniImporter {
|
|||
void mergeFallback(multistrmap &cfg, const multistrmap &ini) const;
|
||||
void importGameFiles(multistrmap &cfg, const multistrmap &ini) const;
|
||||
void importArchives(multistrmap &cfg, const multistrmap &ini) const;
|
||||
static void writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, const multistrmap &cfg);
|
||||
static void writeToFile(std::ostream &out, const multistrmap &cfg);
|
||||
|
||||
private:
|
||||
static void insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value);
|
||||
|
|
|
@ -1,14 +1,59 @@
|
|||
#include "importer.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
namespace bpo = boost::program_options;
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
#ifndef _WIN32
|
||||
int main(int argc, char *argv[]) {
|
||||
#else
|
||||
|
||||
// Include on Windows only
|
||||
#include <boost/locale.hpp>
|
||||
|
||||
class utf8argv
|
||||
{
|
||||
public:
|
||||
|
||||
utf8argv(int argc, wchar_t *wargv[])
|
||||
{
|
||||
args.reserve(argc);
|
||||
argv = new const char *[argc];
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
args.push_back(boost::locale::conv::utf_to_utf<char>(wargv[i]));
|
||||
argv[i] = args.back().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
~utf8argv() { delete[] argv; }
|
||||
char **get() const { return const_cast<char **>(argv); }
|
||||
|
||||
private:
|
||||
|
||||
const char **argv;
|
||||
std::vector<std::string> args;
|
||||
};
|
||||
|
||||
/* The only way to pass Unicode on Winodws with CLI is to use wide
|
||||
characters interface which presents UTF-16 encoding. The rest of
|
||||
OpenMW application stack assumes UTF-8 encoding, therefore this
|
||||
conversion.
|
||||
|
||||
For boost::filesystem::path::imbue see components/files/windowspath.cpp
|
||||
*/
|
||||
int wmain(int argc, wchar_t *wargv[]) {
|
||||
utf8argv converter(argc, wargv);
|
||||
char **argv = converter.get();
|
||||
boost::filesystem::path::imbue(boost::locale::generator().generate(""));
|
||||
#endif
|
||||
bpo::options_description desc("Syntax: mwiniimporter <options> inifile configfile\nAllowed options");
|
||||
bpo::positional_options_description p_desc;
|
||||
desc.add_options()
|
||||
|
@ -94,7 +139,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
std::cout << "write to: " << outputFile << std::endl;
|
||||
boost::iostreams::stream<boost::iostreams::file_sink> file(outputFile);
|
||||
bfs::ofstream file((bfs::path(outputFile)));
|
||||
importer.writeToFile(file, cfg);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -145,6 +145,10 @@ if(WIN32)
|
|||
endif(WIN32)
|
||||
|
||||
set(BOOST_COMPONENTS system filesystem program_options thread wave)
|
||||
if(WIN32)
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
||||
endif(WIN32)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
|
||||
|
|
|
@ -27,7 +27,9 @@ void CSMDoc::OpenSaveStage::perform (int stage, Messages& messages)
|
|||
{
|
||||
mState.start (mDocument, mProjectFile);
|
||||
|
||||
mState.getStream().open ((mProjectFile ? mState.getPath() : mState.getTmpPath()).string().c_str());
|
||||
mState.getStream().open (
|
||||
mProjectFile ? mState.getPath() : mState.getTmpPath(),
|
||||
std::ios::binary);
|
||||
|
||||
if (!mState.getStream().is_open())
|
||||
throw std::runtime_error ("failed to open stream for saving");
|
||||
|
|
|
@ -47,7 +47,7 @@ const boost::filesystem::path& CSMDoc::SavingState::getTmpPath() const
|
|||
return mTmpPath;
|
||||
}
|
||||
|
||||
std::ofstream& CSMDoc::SavingState::getStream()
|
||||
boost::filesystem::ofstream& CSMDoc::SavingState::getStream()
|
||||
{
|
||||
return mStream;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <fstream>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
#include <components/esm/esmwriter.hpp>
|
||||
|
||||
|
@ -20,7 +21,7 @@ namespace CSMDoc
|
|||
boost::filesystem::path mPath;
|
||||
boost::filesystem::path mTmpPath;
|
||||
ToUTF8::Utf8Encoder mEncoder;
|
||||
std::ofstream mStream;
|
||||
boost::filesystem::ofstream mStream;
|
||||
ESM::ESMWriter mWriter;
|
||||
boost::filesystem::path mProjectPath;
|
||||
bool mProjectFile;
|
||||
|
@ -39,7 +40,7 @@ namespace CSMDoc
|
|||
|
||||
const boost::filesystem::path& getTmpPath() const;
|
||||
|
||||
std::ofstream& getStream();
|
||||
boost::filesystem::ofstream& getStream();
|
||||
|
||||
ESM::ESMWriter& getWriter();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ add_openmw_dir (mwworld
|
|||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
||||
esmstore store recordcmp fallback actionrepair actionsoulgem livecellref actiondoor
|
||||
contentloader esmloader omwloader actiontrap cellreflist projectilemanager
|
||||
contentloader esmloader omwloader actiontrap cellreflist projectilemanager cellref
|
||||
)
|
||||
|
||||
add_openmw_dir (mwclass
|
||||
|
@ -83,6 +83,10 @@ add_openmw_dir (mwbase
|
|||
|
||||
# Main executable
|
||||
set(BOOST_COMPONENTS system filesystem program_options thread wave)
|
||||
if(WIN32)
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
||||
endif(WIN32)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
IF(OGRE_STATIC)
|
||||
|
|
|
@ -236,7 +236,7 @@ void OMW::Engine::addArchive (const std::string& archive) {
|
|||
// Set resource dir
|
||||
void OMW::Engine::setResourceDir (const boost::filesystem::path& parResDir)
|
||||
{
|
||||
mResDir = boost::filesystem::system_complete(parResDir);
|
||||
mResDir = parResDir;
|
||||
}
|
||||
|
||||
// Set start cell name (only interiors for now)
|
||||
|
@ -492,11 +492,11 @@ void OMW::Engine::activate()
|
|||
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action =
|
||||
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
ptr.getClass().activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
interpreterContext.activate (ptr, action);
|
||||
|
||||
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
|
||||
std::string script = ptr.getClass().getScript (ptr);
|
||||
|
||||
MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
|
|
|
@ -68,6 +68,12 @@ namespace MWBase
|
|||
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
|
||||
|
||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
|
||||
|
||||
/// Changes faction1's opinion of faction2 by \a diff.
|
||||
virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff) = 0;
|
||||
|
||||
/// @return faction1's opinion of faction2
|
||||
virtual int getFactionReaction (const std::string& faction1, const std::string& faction2) const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ namespace MWClass
|
|||
std::string text;
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
{
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
info.text = text;
|
||||
|
@ -108,7 +108,7 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
|
||||
{
|
||||
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
|
||||
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
{
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfActivator");
|
||||
|
|
|
@ -127,8 +127,8 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
info.text = text;
|
||||
|
|
|
@ -168,10 +168,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
if (ptr.getCellRef().mCharge == -1)
|
||||
return ref->mBase->mData.mValue;
|
||||
else
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(ptr.getCellRef().mCharge) / getItemMaxHealth(ptr));
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(getItemHealth(ptr)) / getItemMaxHealth(ptr));
|
||||
}
|
||||
|
||||
void Armor::registerSelf()
|
||||
|
@ -242,7 +239,7 @@ namespace MWClass
|
|||
|
||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->mBase->mData.mArmor);
|
||||
|
||||
int remainingHealth = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mHealth;
|
||||
int remainingHealth = getItemHealth(ptr);
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||
|
||||
|
@ -250,14 +247,14 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().mEnchantmentCharge;
|
||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -272,7 +269,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
void Armor::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
std::string Armor::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
@ -283,19 +280,18 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Armor *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
ref->mBase = record;
|
||||
ref->mRef.mRefID = record->mId;
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
std::pair<int, std::string> Armor::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc);
|
||||
|
||||
if (ptr.getCellRef().mCharge == 0)
|
||||
if (ptr.getCellRef().getCharge() == 0)
|
||||
return std::make_pair(0, "#{sInventoryMessage1}");
|
||||
|
||||
// slots that this item can be equipped in
|
||||
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||
std::pair<std::vector<int>, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr);
|
||||
|
||||
if (slots_.first.empty())
|
||||
return std::make_pair(0, "");
|
||||
|
|
|
@ -67,7 +67,8 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
|
||||
|
||||
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. \n
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
|
||||
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
{
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfItem");
|
||||
|
@ -139,8 +139,8 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
void Book::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
std::string Book::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
@ -171,8 +171,7 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Book *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
ref->mBase = record;
|
||||
ref->mRef.mRefID = record->mId;
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -51,7 +51,8 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
|
|
@ -193,14 +193,14 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().mEnchantmentCharge;
|
||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -215,7 +215,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
void Clothing::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
std::string Clothing::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
@ -226,14 +226,13 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Clothing *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
ref->mBase = record;
|
||||
ref->mRef.mRefID = record->mId;
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
std::pair<int, std::string> Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
// slots that this item can be equipped in
|
||||
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||
std::pair<std::vector<int>, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr);
|
||||
|
||||
if (slots_.first.empty())
|
||||
return std::make_pair(0, "");
|
||||
|
|
|
@ -59,7 +59,8 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
|
||||
|
||||
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace MWClass
|
|||
ptr.get<ESM::Container>();
|
||||
|
||||
data->mContainerStore.fill(
|
||||
ref->mBase->mInventory, ptr.getCellRef().mOwner, ptr.getCellRef().mFaction, MWBase::Environment::get().getWorld()->getStore());
|
||||
ref->mBase->mInventory, ptr.getCellRef().getOwner(), ptr.getCellRef().getFaction(), MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
@ -75,7 +75,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
||||
const ESM::InventoryList& list = ref->mBase->mInventory;
|
||||
MWWorld::ContainerStore& store = getContainerStore(ptr);
|
||||
store.restock(list, ptr, ptr.getCellRef().mOwner, ptr.getCellRef().mFaction);
|
||||
store.restock(list, ptr, ptr.getCellRef().getOwner(), ptr.getCellRef().getFaction());
|
||||
}
|
||||
|
||||
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -112,7 +112,7 @@ namespace MWClass
|
|||
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
|
||||
|
||||
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
|
||||
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
{
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfContainer");
|
||||
|
@ -127,23 +127,23 @@ namespace MWClass
|
|||
const std::string trapActivationSound = "Disarm Trap Fail";
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWWorld::InventoryStore& invStore = player.getClass().getInventoryStore(player);
|
||||
|
||||
bool needKey = ptr.getCellRef().mLockLevel > 0;
|
||||
bool needKey = ptr.getCellRef().getLockLevel() > 0;
|
||||
bool hasKey = false;
|
||||
std::string keyName;
|
||||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().mKey;
|
||||
std::string keyId = ptr.getCellRef().getKey();
|
||||
Misc::StringUtils::toLower(keyId);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
std::string refId = it->getCellRef().mRefID;
|
||||
std::string refId = it->getCellRef().getRefId();
|
||||
Misc::StringUtils::toLower(refId);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
keyName = MWWorld::Class::get(*it).getName(*it);
|
||||
keyName = it->getClass().getName(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,13 +152,13 @@ namespace MWClass
|
|||
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}");
|
||||
unlock(ptr);
|
||||
// using a key disarms the trap
|
||||
ptr.getCellRef().mTrap = "";
|
||||
ptr.getCellRef().setTrap("");
|
||||
}
|
||||
|
||||
|
||||
if (!needKey || hasKey)
|
||||
{
|
||||
if(ptr.getCellRef().mTrap.empty())
|
||||
if(ptr.getCellRef().getTrap().empty())
|
||||
{
|
||||
boost::shared_ptr<MWWorld::Action> action (new MWWorld::ActionOpen(ptr));
|
||||
return action;
|
||||
|
@ -166,7 +166,7 @@ namespace MWClass
|
|||
else
|
||||
{
|
||||
// Activate trap
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().mTrap, ptr));
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().getTrap(), ptr));
|
||||
action->setSound(trapActivationSound);
|
||||
return action;
|
||||
}
|
||||
|
@ -227,16 +227,16 @@ namespace MWClass
|
|||
info.caption = ref->mBase->mName;
|
||||
|
||||
std::string text;
|
||||
if (ref->mRef.mLockLevel > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->mRef.mLockLevel);
|
||||
else if (ref->mRef.mLockLevel < 0)
|
||||
if (ptr.getCellRef().getLockLevel() > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
|
||||
else if (ptr.getCellRef().getLockLevel() < 0)
|
||||
text += "\n#{sUnlocked}";
|
||||
if (ref->mRef.mTrap != "")
|
||||
if (ptr.getCellRef().getTrap() != "")
|
||||
text += "\n#{sTrapped}";
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
@ -261,14 +261,14 @@ namespace MWClass
|
|||
void Container::lock (const MWWorld::Ptr& ptr, int lockLevel) const
|
||||
{
|
||||
if(lockLevel!=0)
|
||||
ptr.getCellRef().mLockLevel = abs(lockLevel); //Changes lock to locklevel, in positive
|
||||
ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive
|
||||
else
|
||||
ptr.getCellRef().mLockLevel = abs(ptr.getCellRef().mLockLevel); //No locklevel given, just flip the oriional one
|
||||
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the original one
|
||||
}
|
||||
|
||||
void Container::unlock (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ptr.getCellRef().mLockLevel = -abs(ptr.getCellRef().mLockLevel); //Makes lockLevel negative
|
||||
ptr.getCellRef().setLockLevel(-abs(ptr.getCellRef().getLockLevel())); //Makes lockLevel negative
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace MWClass
|
|||
|
||||
if (!weapon.isEmpty())
|
||||
{
|
||||
const bool weaphashealth = get(weapon).hasItemHealth(weapon);
|
||||
const bool weaphashealth = weapon.getClass().hasItemHealth(weapon);
|
||||
const unsigned char *attack = NULL;
|
||||
if(type == ESM::Weapon::AT_Chop)
|
||||
attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
|
||||
|
@ -291,19 +291,23 @@ namespace MWClass
|
|||
weaponDamage *= 0.5f + (stats.getAttribute(ESM::Attribute::Luck).getModified() / 100.0f);
|
||||
if(weaphashealth)
|
||||
{
|
||||
int weapmaxhealth = weapon.get<ESM::Weapon>()->mBase->mData.mHealth;
|
||||
if(weapon.getCellRef().mCharge == -1)
|
||||
weapon.getCellRef().mCharge = weapmaxhealth;
|
||||
weaponDamage *= float(weapon.getCellRef().mCharge) / weapmaxhealth;
|
||||
}
|
||||
int weapmaxhealth = weapon.getClass().getItemMaxHealth(weapon);
|
||||
int weaphealth = weapon.getClass().getItemHealth(weapon);
|
||||
weaponDamage *= float(weaphealth) / weapmaxhealth;
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->getGodModeState())
|
||||
weapon.getCellRef().mCharge -= std::min(std::max(1,
|
||||
(int)(damage * gmst.find("fWeaponDamageMult")->getFloat())), weapon.getCellRef().mCharge);
|
||||
{
|
||||
// Reduce weapon charge by at least one, but cap at 0
|
||||
weaphealth -= std::min(std::max(1,
|
||||
(int)(damage * gmst.find("fWeaponDamageMult")->getFloat())), weaphealth);
|
||||
|
||||
weapon.getCellRef().setCharge(weaphealth);
|
||||
}
|
||||
|
||||
// Weapon broken? unequip it
|
||||
if (weapon.getCellRef().mCharge == 0)
|
||||
if (weapon.getCellRef().getCharge() == 0)
|
||||
weapon = *getInventoryStore(ptr).unequipItem(weapon, ptr);
|
||||
}
|
||||
|
||||
damage += weaponDamage;
|
||||
}
|
||||
|
@ -354,7 +358,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitObject(MWWorld::Class::get(object).getId(object));
|
||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||
|
||||
if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
||||
{
|
||||
|
@ -444,7 +448,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
|
||||
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
{
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfCreature");
|
||||
|
@ -825,14 +829,14 @@ namespace MWClass
|
|||
{
|
||||
// Note we do not respawn moved references in the cell they were moved to. Instead they are respawned in the original cell.
|
||||
// This also means we cannot respawn dynamically placed references with no content file connection.
|
||||
if (ptr.getCellRef().mRefNum.mContentFile != -1)
|
||||
if (ptr.getCellRef().getRefNum().mContentFile != -1)
|
||||
{
|
||||
if (ptr.getRefData().getCount() == 0)
|
||||
ptr.getRefData().setCount(1);
|
||||
|
||||
// Reset to original position
|
||||
ESM::Position& pos = ptr.getRefData().getPosition();
|
||||
pos = ptr.getCellRef().mPos;
|
||||
pos = ptr.getCellRef().getPosition();
|
||||
|
||||
ptr.getRefData().setCustomData(NULL);
|
||||
}
|
||||
|
@ -844,7 +848,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
const ESM::InventoryList& list = ref->mBase->mInventory;
|
||||
MWWorld::ContainerStore& store = getContainerStore(ptr);
|
||||
store.restock(list, ptr, ptr.getCellRef().mRefID, ptr.getCellRef().mFaction);
|
||||
store.restock(list, ptr, ptr.getCellRef().getRefId(), ptr.getCellRef().getFaction());
|
||||
}
|
||||
|
||||
const ESM::GameSetting* Creature::fMinWalkSpeedCreature;
|
||||
|
|
|
@ -73,8 +73,8 @@ namespace MWClass
|
|||
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
MWWorld::ManualRef ref(store, id);
|
||||
ref.getPtr().getCellRef().mPos = ptr.getCellRef().mPos;
|
||||
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(), ptr.getCell() , ptr.getCellRef().mPos);
|
||||
ref.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition());
|
||||
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(), ptr.getCell() , ptr.getCellRef().getPosition());
|
||||
customData.mSpawnActorId = placed.getClass().getCreatureStats(placed).getActorId();
|
||||
customData.mSpawn = false;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
if (ref->mRef.mTeleport && !ref->mRef.mDestCell.empty()) // TODO doors that lead to exteriors
|
||||
return ref->mRef.mDestCell;
|
||||
if (ptr.getCellRef().getTeleport() && !ptr.getCellRef().getDestCell().empty()) // TODO doors that lead to exteriors
|
||||
return ptr.getCellRef().getDestCell();
|
||||
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
@ -99,23 +99,23 @@ namespace MWClass
|
|||
const std::string lockedSound = "LockedDoor";
|
||||
const std::string trapActivationSound = "Disarm Trap Fail";
|
||||
|
||||
MWWorld::ContainerStore &invStore = get(actor).getContainerStore(actor);
|
||||
MWWorld::ContainerStore &invStore = actor.getClass().getContainerStore(actor);
|
||||
|
||||
bool needKey = ptr.getCellRef().mLockLevel > 0;
|
||||
bool needKey = ptr.getCellRef().getLockLevel() > 0;
|
||||
bool hasKey = false;
|
||||
std::string keyName;
|
||||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().mKey;
|
||||
std::string keyId = ptr.getCellRef().getKey();
|
||||
Misc::StringUtils::toLower(keyId);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
std::string refId = it->getCellRef().mRefID;
|
||||
std::string refId = it->getCellRef().getRefId();
|
||||
Misc::StringUtils::toLower(refId);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
keyName = get(*it).getName(*it);
|
||||
keyName = it->getClass().getName(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,22 +125,22 @@ namespace MWClass
|
|||
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}");
|
||||
unlock(ptr); //Call the function here. because that makes sense.
|
||||
// using a key disarms the trap
|
||||
ptr.getCellRef().mTrap = "";
|
||||
ptr.getCellRef().getTrap() = "";
|
||||
}
|
||||
|
||||
if (!needKey || hasKey)
|
||||
{
|
||||
if(!ptr.getCellRef().mTrap.empty())
|
||||
if(!ptr.getCellRef().getTrap().empty())
|
||||
{
|
||||
// Trap activation
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().mTrap, ptr));
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().getTrap(), ptr));
|
||||
action->setSound(trapActivationSound);
|
||||
return action;
|
||||
}
|
||||
|
||||
if (ref->mRef.mTeleport)
|
||||
if (ptr.getCellRef().getTeleport())
|
||||
{
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest));
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest()));
|
||||
|
||||
action->setSound(openSound);
|
||||
|
||||
|
@ -191,14 +191,14 @@ namespace MWClass
|
|||
void Door::lock (const MWWorld::Ptr& ptr, int lockLevel) const
|
||||
{
|
||||
if(lockLevel!=0)
|
||||
ptr.getCellRef().mLockLevel = abs(lockLevel); //Changes lock to locklevel, in positive
|
||||
ptr.getCellRef().setLockLevel(abs(lockLevel)); //Changes lock to locklevel, in positive
|
||||
else
|
||||
ptr.getCellRef().mLockLevel = abs(ptr.getCellRef().mLockLevel); //No locklevel given, just flip the origional one
|
||||
ptr.getCellRef().setLockLevel(abs(ptr.getCellRef().getLockLevel())); //No locklevel given, just flip the origional one
|
||||
}
|
||||
|
||||
void Door::unlock (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ptr.getCellRef().mLockLevel = -abs(ptr.getCellRef().mLockLevel); //Makes lockLevel negative
|
||||
ptr.getCellRef().setLockLevel(-abs(ptr.getCellRef().getLockLevel())); //Makes lockLevel negative
|
||||
}
|
||||
|
||||
std::string Door::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -234,17 +234,17 @@ namespace MWClass
|
|||
|
||||
std::string text;
|
||||
|
||||
if (ref->mRef.mTeleport)
|
||||
if (ptr.getCellRef().getTeleport())
|
||||
{
|
||||
text += "\n#{sTo}";
|
||||
text += "\n" + getDestination(*ref);
|
||||
}
|
||||
|
||||
if (ref->mRef.mLockLevel > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->mRef.mLockLevel);
|
||||
else if (ref->mRef.mLockLevel < 0)
|
||||
if (ptr.getCellRef().getLockLevel() > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
|
||||
else if (ptr.getCellRef().getLockLevel() < 0)
|
||||
text += "\n#{sUnlocked}";
|
||||
if (ref->mRef.mTrap != "")
|
||||
if (ptr.getCellRef().getTrap() != "")
|
||||
text += "\n#{sTrapped}";
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
|
@ -260,16 +260,16 @@ namespace MWClass
|
|||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
std::string dest;
|
||||
if (door.mRef.mDestCell != "")
|
||||
if (door.mRef.getDestCell() != "")
|
||||
{
|
||||
// door leads to an interior, use interior name as tooltip
|
||||
dest = door.mRef.mDestCell;
|
||||
dest = door.mRef.getDestCell();
|
||||
}
|
||||
else
|
||||
{
|
||||
// door leads to exterior, use cell name (if any), otherwise translated region name
|
||||
int x,y;
|
||||
MWBase::Environment::get().getWorld()->positionToIndex (door.mRef.mDoorDest.pos[0], door.mRef.mDoorDest.pos[1], x, y);
|
||||
MWBase::Environment::get().getWorld()->positionToIndex (door.mRef.getDoorDest().pos[0], door.mRef.getDoorDest().pos[1], x, y);
|
||||
const ESM::Cell* cell = store.get<ESM::Cell>().find(x,y);
|
||||
if (cell->mName != "")
|
||||
dest = cell->mName;
|
||||
|
|
|
@ -147,13 +147,13 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player);
|
||||
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
|
||||
|
||||
static const float fWortChanceValue =
|
||||
|
|
|
@ -187,8 +187,8 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ namespace MWClass
|
|||
|
||||
std::pair<int, std::string> Light::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
|
||||
MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc);
|
||||
MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
|
||||
if(weapon == invStore.end())
|
||||
|
|
|
@ -86,10 +86,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Lockpick> *ref =
|
||||
ptr.get<ESM::Lockpick>();
|
||||
|
||||
if (ptr.getCellRef().mCharge == -1)
|
||||
return ref->mBase->mData.mValue;
|
||||
else
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(ptr.getCellRef().mCharge) / getItemMaxHealth(ptr));
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(getItemHealth(ptr)) / getItemMaxHealth(ptr));
|
||||
}
|
||||
|
||||
void Lockpick::registerSelf()
|
||||
|
@ -136,7 +133,7 @@ namespace MWClass
|
|||
|
||||
std::string text;
|
||||
|
||||
int remainingUses = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||
int remainingUses = getItemHealth(ptr);
|
||||
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
|
@ -144,8 +141,8 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ namespace
|
|||
{
|
||||
bool isGold (const MWWorld::Ptr& ptr)
|
||||
{
|
||||
return Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_001")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_005")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_010")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100");
|
||||
return Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_001")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_005")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_010")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_100");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,12 +94,12 @@ namespace MWClass
|
|||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
int value = ref->mBase->mData.mValue;
|
||||
if (ptr.getCellRef().mGoldValue > 1 && ptr.getRefData().getCount() == 1)
|
||||
value = ptr.getCellRef().mGoldValue;
|
||||
if (ptr.getCellRef().getGoldValue() > 1 && ptr.getRefData().getCount() == 1)
|
||||
value = ptr.getCellRef().getGoldValue();
|
||||
|
||||
if (ptr.getCellRef().mSoul != "")
|
||||
if (ptr.getCellRef().getSoul() != "")
|
||||
{
|
||||
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(ref->mRef.mSoul);
|
||||
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(ref->mRef.getSoul());
|
||||
value *= creature->mData.mSoul;
|
||||
}
|
||||
|
||||
|
@ -167,9 +167,9 @@ namespace MWClass
|
|||
info.caption = ref->mBase->mName + countString;
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
if (ref->mRef.mSoul != "")
|
||||
if (ref->mRef.getSoul() != "")
|
||||
{
|
||||
const ESM::Creature *creature = store.get<ESM::Creature>().find(ref->mRef.mSoul);
|
||||
const ESM::Creature *creature = store.get<ESM::Creature>().find(ref->mRef.getSoul());
|
||||
info.caption += " (" + creature->mName + ")";
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,8 @@ namespace MWClass
|
|||
}
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
newRef.getPtr().get<ESM::Miscellaneous>();
|
||||
newPtr = MWWorld::Ptr(&cell.get<ESM::Miscellaneous>().insert(*ref), &cell);
|
||||
newPtr.getCellRef().mGoldValue = goldAmount;
|
||||
newPtr.getCellRef().setGoldValue(goldAmount);
|
||||
newPtr.getRefData().setCount(1);
|
||||
} else {
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
|
@ -231,7 +231,7 @@ namespace MWClass
|
|||
|
||||
boost::shared_ptr<MWWorld::Action> Miscellaneous::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
if (ptr.getCellRef().mSoul == "")
|
||||
if (ptr.getCellRef().getSoul().empty())
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::NullAction());
|
||||
else
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionSoulgem(ptr));
|
||||
|
@ -242,12 +242,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
item.get<ESM::Miscellaneous>();
|
||||
|
||||
return !ref->mBase->mData.mIsKey && (npcServices & ESM::NPC::Misc)
|
||||
&& !Misc::StringUtils::ciEqual(item.getCellRef().mRefID, "gold_001")
|
||||
&& !Misc::StringUtils::ciEqual(item.getCellRef().mRefID, "gold_005")
|
||||
&& !Misc::StringUtils::ciEqual(item.getCellRef().mRefID, "gold_010")
|
||||
&& !Misc::StringUtils::ciEqual(item.getCellRef().mRefID, "gold_025")
|
||||
&& !Misc::StringUtils::ciEqual(item.getCellRef().mRefID, "gold_100");
|
||||
return !ref->mBase->mData.mIsKey && (npcServices & ESM::NPC::Misc) && !isGold(item);
|
||||
}
|
||||
|
||||
float Miscellaneous::getWeight(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -484,10 +484,10 @@ namespace MWClass
|
|||
if(victim.isEmpty()) // Didn't hit anything
|
||||
return;
|
||||
|
||||
const MWWorld::Class &othercls = MWWorld::Class::get(victim);
|
||||
const MWWorld::Class &othercls = victim.getClass();
|
||||
if(!othercls.isActor()) // Can't hit non-actors
|
||||
return;
|
||||
MWMechanics::CreatureStats &otherstats = victim.getClass().getCreatureStats(victim);
|
||||
MWMechanics::CreatureStats &otherstats = othercls.getCreatureStats(victim);
|
||||
if(otherstats.isDead()) // Can't hit dead actors
|
||||
return;
|
||||
|
||||
|
@ -496,7 +496,7 @@ namespace MWClass
|
|||
|
||||
int weapskill = ESM::Skill::HandToHand;
|
||||
if(!weapon.isEmpty())
|
||||
weapskill = get(weapon).getEquipmentSkill(weapon);
|
||||
weapskill = weapon.getClass().getEquipmentSkill(weapon);
|
||||
|
||||
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
|
||||
|
||||
|
@ -511,7 +511,7 @@ namespace MWClass
|
|||
MWMechanics::NpcStats &stats = getNpcStats(ptr);
|
||||
if(!weapon.isEmpty())
|
||||
{
|
||||
const bool weaphashealth = get(weapon).hasItemHealth(weapon);
|
||||
const bool weaphashealth = weapon.getClass().hasItemHealth(weapon);
|
||||
const unsigned char *attack = NULL;
|
||||
if(type == ESM::Weapon::AT_Chop)
|
||||
attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
|
||||
|
@ -526,20 +526,24 @@ namespace MWClass
|
|||
(stats.getAttribute(ESM::Attribute::Strength).getModified() * fDamageStrengthMult->getFloat() * 0.1);
|
||||
if(weaphashealth)
|
||||
{
|
||||
int weapmaxhealth = weapon.get<ESM::Weapon>()->mBase->mData.mHealth;
|
||||
if(weapon.getCellRef().mCharge == -1)
|
||||
weapon.getCellRef().mCharge = weapmaxhealth;
|
||||
damage *= float(weapon.getCellRef().mCharge) / weapmaxhealth;
|
||||
}
|
||||
int weapmaxhealth = weapon.getClass().getItemMaxHealth(weapon);
|
||||
int weaphealth = weapon.getClass().getItemHealth(weapon);
|
||||
|
||||
damage *= float(weaphealth) / weapmaxhealth;
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->getGodModeState())
|
||||
weapon.getCellRef().mCharge -= std::min(std::max(1,
|
||||
(int)(damage * gmst.find("fWeaponDamageMult")->getFloat())), weapon.getCellRef().mCharge);
|
||||
{
|
||||
// Reduce weapon charge by at least one, but cap at 0
|
||||
weaphealth -= std::min(std::max(1,
|
||||
(int)(damage * gmst.find("fWeaponDamageMult")->getFloat())), weaphealth);
|
||||
|
||||
weapon.getCellRef().setCharge(weaphealth);
|
||||
}
|
||||
|
||||
// Weapon broken? unequip it
|
||||
if (weapon.getCellRef().mCharge == 0)
|
||||
if (weaphealth == 0)
|
||||
weapon = *inv.unequipItem(weapon, ptr);
|
||||
|
||||
}
|
||||
}
|
||||
healthdmg = true;
|
||||
}
|
||||
|
@ -637,7 +641,7 @@ namespace MWClass
|
|||
}
|
||||
|
||||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitObject(get(object).getId(object));
|
||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||
|
||||
if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
||||
{
|
||||
|
@ -705,20 +709,19 @@ namespace MWClass
|
|||
MWWorld::Ptr armor = ((armorslot != inv.end()) ? *armorslot : MWWorld::Ptr());
|
||||
if(!armor.isEmpty() && armor.getTypeName() == typeid(ESM::Armor).name())
|
||||
{
|
||||
ESM::CellRef &armorref = armor.getCellRef();
|
||||
if(armorref.mCharge == -1)
|
||||
armorref.mCharge = armor.get<ESM::Armor>()->mBase->mData.mHealth;
|
||||
armorref.mCharge -= std::min(std::max(1, (int)damagediff),
|
||||
armorref.mCharge);
|
||||
int armorhealth = armor.getClass().getItemHealth(armor);
|
||||
armorhealth -= std::min(std::max(1, (int)damagediff),
|
||||
armorhealth);
|
||||
armor.getCellRef().setCharge(armorhealth);
|
||||
|
||||
// Armor broken? unequip it
|
||||
if (armorref.mCharge == 0)
|
||||
if (armorhealth == 0)
|
||||
inv.unequipItem(armor, ptr);
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
skillUsageSucceeded(ptr, get(armor).getEquipmentSkill(armor), 0);
|
||||
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
|
||||
|
||||
switch(get(armor).getEquipmentSkill(armor))
|
||||
switch(armor.getClass().getEquipmentSkill(armor))
|
||||
{
|
||||
case ESM::Skill::LightArmor:
|
||||
sndMgr->playSound3D(ptr, "Light Armor Hit", 1.0f, 1.0f);
|
||||
|
@ -802,7 +805,7 @@ namespace MWClass
|
|||
if(ptr.getRefData().getHandle() == "player")
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
|
||||
|
||||
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
|
||||
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
{
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfNPC");
|
||||
|
@ -814,7 +817,7 @@ namespace MWClass
|
|||
}
|
||||
if(getCreatureStats(ptr).isDead())
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
|
||||
if(get(ptr).getCreatureStats(ptr).isHostile())
|
||||
if(ptr.getClass().getCreatureStats(ptr).isHostile())
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction("#{sActorInCombat}"));
|
||||
if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak))
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr)); // stealing
|
||||
|
@ -943,7 +946,7 @@ namespace MWClass
|
|||
|
||||
if (fallHeight >= fallDistanceMin)
|
||||
{
|
||||
const float acrobaticsSkill = MWWorld::Class::get(ptr).getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
|
||||
const float acrobaticsSkill = ptr.getClass().getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
|
||||
const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData());
|
||||
const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(ESM::MagicEffect::Jump).mMagnitude;
|
||||
const float fallAcroBase = gmst.find("fFallAcroBase")->getFloat();
|
||||
|
@ -1107,7 +1110,7 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref = it->get<ESM::Armor>();
|
||||
|
||||
int armorSkillType = MWWorld::Class::get(*it).getEquipmentSkill(*it);
|
||||
int armorSkillType = it->getClass().getEquipmentSkill(*it);
|
||||
int armorSkill = stats.getSkill(armorSkillType).getModified();
|
||||
|
||||
if(ref->mBase->mData.mWeight == 0)
|
||||
|
@ -1177,7 +1180,7 @@ namespace MWClass
|
|||
if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name())
|
||||
return "FootBareLeft";
|
||||
|
||||
switch(Class::get(*boots).getEquipmentSkill(*boots))
|
||||
switch(boots->getClass().getEquipmentSkill(*boots))
|
||||
{
|
||||
case ESM::Skill::LightArmor:
|
||||
return "FootLightLeft";
|
||||
|
@ -1204,7 +1207,7 @@ namespace MWClass
|
|||
if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name())
|
||||
return "FootBareRight";
|
||||
|
||||
switch(Class::get(*boots).getEquipmentSkill(*boots))
|
||||
switch(boots->getClass().getEquipmentSkill(*boots))
|
||||
{
|
||||
case ESM::Skill::LightArmor:
|
||||
return "FootLightRight";
|
||||
|
@ -1316,14 +1319,14 @@ namespace MWClass
|
|||
{
|
||||
// Note we do not respawn moved references in the cell they were moved to. Instead they are respawned in the original cell.
|
||||
// This also means we cannot respawn dynamically placed references with no content file connection.
|
||||
if (ptr.getCellRef().mRefNum.mContentFile != -1)
|
||||
if (ptr.getCellRef().getRefNum().mContentFile != -1)
|
||||
{
|
||||
if (ptr.getRefData().getCount() == 0)
|
||||
ptr.getRefData().setCount(1);
|
||||
|
||||
// Reset to original position
|
||||
ESM::Position& pos = ptr.getRefData().getPosition();
|
||||
pos = ptr.getCellRef().mPos;
|
||||
pos = ptr.getCellRef().getPosition();
|
||||
|
||||
ptr.getRefData().setCustomData(NULL);
|
||||
}
|
||||
|
@ -1335,7 +1338,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
const ESM::InventoryList& list = ref->mBase->mInventory;
|
||||
MWWorld::ContainerStore& store = getContainerStore(ptr);
|
||||
store.restock(list, ptr, ptr.getCellRef().mRefID, ptr.getCellRef().mFaction);
|
||||
store.restock(list, ptr, ptr.getCellRef().getRefId(), ptr.getCellRef().getFaction());
|
||||
}
|
||||
|
||||
const ESM::GameSetting *Npc::fMinWalkSpeed;
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MWClass
|
|||
|
||||
// hide effects the player doesnt know about
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player);
|
||||
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
|
||||
int i=0;
|
||||
static const float fWortChanceValue =
|
||||
|
@ -151,8 +151,8 @@ namespace MWClass
|
|||
info.isPotion = true;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
|
|
@ -85,10 +85,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
if (ptr.getCellRef().mCharge == -1)
|
||||
return ref->mBase->mData.mValue;
|
||||
else
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(ptr.getCellRef().mCharge) / getItemMaxHealth(ptr));
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(getItemHealth(ptr)) / getItemMaxHealth(ptr));
|
||||
}
|
||||
|
||||
void Probe::registerSelf()
|
||||
|
@ -135,7 +132,7 @@ namespace MWClass
|
|||
|
||||
std::string text;
|
||||
|
||||
int remainingUses = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||
int remainingUses = getItemHealth(ptr);
|
||||
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
|
@ -143,8 +140,8 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
|
|
@ -76,10 +76,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
if (ptr.getCellRef().mCharge == -1)
|
||||
return ref->mBase->mData.mValue;
|
||||
else
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(ptr.getCellRef().mCharge) / getItemMaxHealth(ptr));
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(getItemHealth(ptr)) / getItemMaxHealth(ptr));
|
||||
}
|
||||
|
||||
void Repair::registerSelf()
|
||||
|
@ -139,7 +136,7 @@ namespace MWClass
|
|||
|
||||
std::string text;
|
||||
|
||||
int remainingUses = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||
int remainingUses = getItemHealth(ptr);
|
||||
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
|
@ -147,8 +144,8 @@ namespace MWClass
|
|||
text += MWGui::ToolTips::getValueString(getValue(ptr), "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
|
|
@ -154,10 +154,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
if (ptr.getCellRef().mCharge == -1)
|
||||
return ref->mBase->mData.mValue;
|
||||
else
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(ptr.getCellRef().mCharge) / getItemMaxHealth(ptr));
|
||||
return ref->mBase->mData.mValue * (static_cast<float>(getItemHealth(ptr)) / getItemMaxHealth(ptr));
|
||||
}
|
||||
|
||||
void Weapon::registerSelf()
|
||||
|
@ -340,7 +337,7 @@ namespace MWClass
|
|||
|
||||
if (ref->mBase->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
||||
{
|
||||
int remainingHealth = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mHealth;
|
||||
int remainingHealth = getItemHealth(ptr);
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||
}
|
||||
|
@ -351,11 +348,11 @@ namespace MWClass
|
|||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().mEnchantmentCharge;
|
||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mFaction, "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
|
@ -372,7 +369,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
void Weapon::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
std::string Weapon::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
@ -383,16 +380,15 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Weapon *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
ref->mBase = record;
|
||||
ref->mRef.mRefID = record->mId;
|
||||
return record->mId;
|
||||
}
|
||||
|
||||
std::pair<int, std::string> Weapon::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
if (ptr.getCellRef().mCharge == 0)
|
||||
if (ptr.getCellRef().getCharge() == 0)
|
||||
return std::make_pair(0, "#{sInventoryMessage1}");
|
||||
|
||||
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||
std::pair<std::vector<int>, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr);
|
||||
|
||||
if (slots_.first.empty())
|
||||
return std::make_pair (0, "");
|
||||
|
|
|
@ -68,7 +68,8 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
|
||||
|
||||
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||
|
|
|
@ -134,13 +134,13 @@ namespace MWDialogue
|
|||
|
||||
mActor = actor;
|
||||
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
||||
MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats (actor);
|
||||
mTalkedTo = creatureStats.hasTalkedToPlayer();
|
||||
|
||||
mActorKnownTopics.clear();
|
||||
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor));
|
||||
win->startDialogue(actor, actor.getClass().getName (actor));
|
||||
|
||||
//setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
|
||||
updateTopics();
|
||||
|
@ -194,7 +194,7 @@ namespace MWDialogue
|
|||
|
||||
Compiler::Locals locals;
|
||||
|
||||
std::string actorScript = MWWorld::Class::get (mActor).getScript (mActor);
|
||||
std::string actorScript = mActor.getClass().getScript (mActor);
|
||||
|
||||
if (!actorScript.empty())
|
||||
{
|
||||
|
@ -435,7 +435,7 @@ namespace MWDialogue
|
|||
// Apply disposition change to NPC's base disposition
|
||||
if (mActor.getClass().isNpc())
|
||||
{
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
||||
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
||||
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
|
||||
}
|
||||
mPermanentDispositionChange = 0;
|
||||
|
@ -642,6 +642,8 @@ namespace MWDialogue
|
|||
if (iter->second)
|
||||
state.mKnownTopics.push_back (iter->first);
|
||||
|
||||
state.mModFactionReaction = mModFactionReaction;
|
||||
|
||||
writer.startRecord (ESM::REC_DIAS);
|
||||
state.save (writer);
|
||||
writer.endRecord (ESM::REC_DIAS);
|
||||
|
@ -661,9 +663,46 @@ namespace MWDialogue
|
|||
iter!=state.mKnownTopics.end(); ++iter)
|
||||
if (store.get<ESM::Dialogue>().search (*iter))
|
||||
mKnownTopics.insert (std::make_pair (*iter, true));
|
||||
|
||||
mModFactionReaction = state.mModFactionReaction;
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueManager::modFactionReaction(const std::string &faction1, const std::string &faction2, int diff)
|
||||
{
|
||||
std::string fact1 = Misc::StringUtils::lowerCase(faction1);
|
||||
std::string fact2 = Misc::StringUtils::lowerCase(faction2);
|
||||
|
||||
// Make sure the factions exist
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(fact1);
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(fact2);
|
||||
|
||||
std::map<std::string, int>& map = mModFactionReaction[fact1];
|
||||
if (map.find(fact2) == map.end())
|
||||
map[fact2] = 0;
|
||||
map[fact2] += diff;
|
||||
}
|
||||
|
||||
int DialogueManager::getFactionReaction(const std::string &faction1, const std::string &faction2) const
|
||||
{
|
||||
std::string fact1 = Misc::StringUtils::lowerCase(faction1);
|
||||
std::string fact2 = Misc::StringUtils::lowerCase(faction2);
|
||||
|
||||
ModFactionReactionMap::const_iterator map = mModFactionReaction.find(fact1);
|
||||
int diff = 0;
|
||||
if (map != mModFactionReaction.end() && map->second.find(fact2) != map->second.end())
|
||||
diff = map->second.at(fact2);
|
||||
|
||||
const ESM::Faction* faction = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(fact1);
|
||||
|
||||
std::map<std::string, int>::const_iterator it = faction->mReactions.begin();
|
||||
for (; it != faction->mReactions.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(it->first, fact2))
|
||||
return it->second + diff;
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
std::vector<HyperTextToken> ParseHyperText(const std::string& text)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,11 @@ namespace MWDialogue
|
|||
{
|
||||
std::map<std::string, ESM::Dialogue> mDialogueMap;
|
||||
std::map<std::string, bool> mKnownTopics;// Those are the topics the player knows.
|
||||
|
||||
// Modified faction reactions. <Faction1, <Faction2, Difference> >
|
||||
typedef std::map<std::string, std::map<std::string, int> > ModFactionReactionMap;
|
||||
ModFactionReactionMap mModFactionReaction;
|
||||
|
||||
std::list<std::string> mActorKnownTopics;
|
||||
|
||||
Translation::Storage& mTranslationDataStorage;
|
||||
|
@ -86,6 +91,12 @@ namespace MWDialogue
|
|||
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||
|
||||
virtual void readRecord (ESM::ESMReader& reader, int32_t type);
|
||||
|
||||
/// Changes faction1's opinion of faction2 by \a diff.
|
||||
virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff);
|
||||
|
||||
/// @return faction1's opinion of faction2
|
||||
virtual int getFactionReaction (const std::string& faction1, const std::string& faction2) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
|||
// actor id
|
||||
if (!info.mActor.empty())
|
||||
{
|
||||
if ( !Misc::StringUtils::ciEqual(info.mActor, MWWorld::Class::get (mActor).getId (mActor)))
|
||||
if ( !Misc::StringUtils::ciEqual(info.mActor, mActor.getClass().getId (mActor)))
|
||||
return false;
|
||||
}
|
||||
else if (isCreature)
|
||||
|
@ -64,7 +64,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
|||
if (isCreature)
|
||||
return false;
|
||||
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get (mActor).getNpcStats (mActor);
|
||||
MWMechanics::NpcStats& stats = mActor.getClass().getNpcStats (mActor);
|
||||
std::map<std::string, int>::iterator iter = stats.getFactionRanks().find ( Misc::StringUtils::lowerCase (info.mFaction));
|
||||
|
||||
if (iter==stats.getFactionRanks().end())
|
||||
|
@ -98,7 +98,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
|
|||
// check player faction
|
||||
if (!info.mPcFaction.empty())
|
||||
{
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get (player).getNpcStats (player);
|
||||
MWMechanics::NpcStats& stats = player.getClass().getNpcStats (player);
|
||||
std::map<std::string,int>::iterator iter = stats.getFactionRanks().find (Misc::StringUtils::lowerCase (info.mPcFaction));
|
||||
|
||||
if(iter==stats.getFactionRanks().end())
|
||||
|
@ -182,7 +182,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
|
||||
case SelectWrapper::Function_Local:
|
||||
{
|
||||
std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor);
|
||||
std::string scriptName = mActor.getClass().getScript (mActor);
|
||||
|
||||
if (scriptName.empty())
|
||||
return false; // no script
|
||||
|
@ -220,8 +220,8 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
float ratio = MWWorld::Class::get (player).getCreatureStats (player).getHealth().getCurrent() /
|
||||
MWWorld::Class::get (player).getCreatureStats (player).getHealth().getModified();
|
||||
float ratio = player.getClass().getCreatureStats (player).getHealth().getCurrent() /
|
||||
player.getClass().getCreatureStats (player).getHealth().getModified();
|
||||
|
||||
return select.selectCompare (static_cast<int>(ratio*100));
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
float value = MWWorld::Class::get (player).getCreatureStats (player).
|
||||
float value = player.getClass().getCreatureStats (player).
|
||||
getDynamic (select.getArgument()).getCurrent();
|
||||
|
||||
return select.selectCompare (value);
|
||||
|
@ -238,8 +238,8 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
|
|||
|
||||
case SelectWrapper::Function_HealthPercent:
|
||||
{
|
||||
float ratio = MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getCurrent() /
|
||||
MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getModified();
|
||||
float ratio = mActor.getClass().getCreatureStats (mActor).getHealth().getCurrent() /
|
||||
mActor.getClass().getCreatureStats (mActor).getHealth().getModified();
|
||||
|
||||
return select.selectCompare (ratio);
|
||||
}
|
||||
|
@ -262,17 +262,9 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_Item:
|
||||
{
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get (player).getContainerStore (player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore (player);
|
||||
|
||||
int sum = 0;
|
||||
|
||||
std::string name = select.getName();
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
|
||||
if (Misc::StringUtils::ciEqual(iter->getCellRef().mRefID, name))
|
||||
sum += iter->getRefData().getCount();
|
||||
|
||||
return sum;
|
||||
return store.count(select.getName());
|
||||
}
|
||||
|
||||
case SelectWrapper::Function_Dead:
|
||||
|
@ -285,29 +277,29 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_AiSetting:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAiSetting (
|
||||
return mActor.getClass().getCreatureStats (mActor).getAiSetting (
|
||||
(MWMechanics::CreatureStats::AiSetting)select.getArgument()).getModified();
|
||||
|
||||
case SelectWrapper::Function_PcAttribute:
|
||||
|
||||
return MWWorld::Class::get (player).getCreatureStats (player).
|
||||
return player.getClass().getCreatureStats (player).
|
||||
getAttribute (select.getArgument()).getModified();
|
||||
|
||||
case SelectWrapper::Function_PcSkill:
|
||||
|
||||
return static_cast<int> (MWWorld::Class::get (player).
|
||||
return static_cast<int> (player.getClass().
|
||||
getNpcStats (player).getSkill (select.getArgument()).getModified());
|
||||
|
||||
case SelectWrapper::Function_FriendlyHit:
|
||||
{
|
||||
int hits = MWWorld::Class::get (mActor).getCreatureStats (mActor).getFriendlyHits();
|
||||
int hits = mActor.getClass().getCreatureStats (mActor).getFriendlyHits();
|
||||
|
||||
return hits>4 ? 4 : hits;
|
||||
}
|
||||
|
||||
case SelectWrapper::Function_PcLevel:
|
||||
|
||||
return MWWorld::Class::get (player).getCreatureStats (player).getLevel();
|
||||
return player.getClass().getCreatureStats (player).getLevel();
|
||||
|
||||
case SelectWrapper::Function_PcGender:
|
||||
|
||||
|
@ -315,7 +307,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_PcClothingModifier:
|
||||
{
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get (player).getInventoryStore (player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore (player);
|
||||
|
||||
int value = 0;
|
||||
|
||||
|
@ -324,7 +316,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
MWWorld::ContainerStoreIterator slot = store.getSlot (i);
|
||||
|
||||
if (slot!=store.end())
|
||||
value += MWWorld::Class::get (*slot).getValue (*slot);
|
||||
value += slot->getClass().getValue (*slot);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -332,15 +324,15 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_PcCrimeLevel:
|
||||
|
||||
return MWWorld::Class::get (player).getNpcStats (player).getBounty();
|
||||
return player.getClass().getNpcStats (player).getBounty();
|
||||
|
||||
case SelectWrapper::Function_RankRequirement:
|
||||
{
|
||||
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
|
||||
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
|
||||
return 0;
|
||||
|
||||
std::string faction =
|
||||
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
|
||||
int rank = getFactionRank (player, faction);
|
||||
|
||||
|
@ -360,11 +352,11 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_Level:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getLevel();
|
||||
return mActor.getClass().getCreatureStats (mActor).getLevel();
|
||||
|
||||
case SelectWrapper::Function_PCReputation:
|
||||
|
||||
return MWWorld::Class::get (player).getNpcStats (player).getReputation();
|
||||
return player.getClass().getNpcStats (player).getReputation();
|
||||
|
||||
case SelectWrapper::Function_Weather:
|
||||
|
||||
|
@ -372,15 +364,15 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_Reputation:
|
||||
|
||||
return MWWorld::Class::get (mActor).getNpcStats (mActor).getReputation();
|
||||
return mActor.getClass().getNpcStats (mActor).getReputation();
|
||||
|
||||
case SelectWrapper::Function_FactionRankDiff:
|
||||
{
|
||||
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
|
||||
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
|
||||
return 0;
|
||||
|
||||
std::pair<std::string, int> faction =
|
||||
*MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin();
|
||||
*mActor.getClass().getNpcStats (mActor).getFactionRanks().begin();
|
||||
|
||||
int rank = getFactionRank (player, faction.first);
|
||||
|
||||
|
@ -389,31 +381,30 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_WerewolfKills:
|
||||
|
||||
return MWWorld::Class::get (player).getNpcStats (player).getWerewolfKills();
|
||||
return player.getClass().getNpcStats (player).getWerewolfKills();
|
||||
|
||||
case SelectWrapper::Function_RankLow:
|
||||
case SelectWrapper::Function_RankHigh:
|
||||
{
|
||||
bool low = select.getFunction()==SelectWrapper::Function_RankLow;
|
||||
|
||||
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
|
||||
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
|
||||
return 0;
|
||||
|
||||
std::string factionId =
|
||||
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
|
||||
int value = 0;
|
||||
|
||||
const ESM::Faction& faction =
|
||||
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find (factionId);
|
||||
MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats (player);
|
||||
|
||||
MWMechanics::NpcStats& playerStats = MWWorld::Class::get (player).getNpcStats (player);
|
||||
|
||||
for (std::vector<ESM::Faction::Reaction>::const_iterator iter (faction.mReactions.begin());
|
||||
iter!=faction.mReactions.end(); ++iter)
|
||||
if (playerStats.getFactionRanks().find (iter->mFaction)!=playerStats.getFactionRanks().end())
|
||||
if (low ? iter->mReaction<value : iter->mReaction>value)
|
||||
value = iter->mReaction;
|
||||
std::map<std::string, int>::const_iterator playerFactionIt = playerStats.getFactionRanks().begin();
|
||||
for (; playerFactionIt != playerStats.getFactionRanks().end(); ++playerFactionIt)
|
||||
{
|
||||
int reaction = MWBase::Environment::get().getDialogueManager()->getFactionReaction(factionId, playerFactionIt->first);
|
||||
if (low ? reaction < value : reaction > value)
|
||||
value = reaction;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -436,7 +427,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_NotId:
|
||||
|
||||
return !Misc::StringUtils::ciEqual(MWWorld::Class::get (mActor).getId (mActor), select.getName());
|
||||
return !Misc::StringUtils::ciEqual(mActor.getClass().getId (mActor), select.getName());
|
||||
|
||||
case SelectWrapper::Function_NotFaction:
|
||||
|
||||
|
@ -456,7 +447,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_NotLocal:
|
||||
{
|
||||
std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor);
|
||||
std::string scriptName = mActor.getClass().getScript (mActor);
|
||||
|
||||
if (scriptName.empty())
|
||||
// This actor has no attached script, so there is no local variable
|
||||
|
@ -489,36 +480,36 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_SameFaction:
|
||||
|
||||
return MWWorld::Class::get (mActor).getNpcStats (mActor).isSameFaction (
|
||||
MWWorld::Class::get (player).getNpcStats (player));
|
||||
return mActor.getClass().getNpcStats (mActor).isSameFaction (
|
||||
player.getClass().getNpcStats (player));
|
||||
|
||||
case SelectWrapper::Function_PcCommonDisease:
|
||||
|
||||
return MWWorld::Class::get (player).getCreatureStats (player).hasCommonDisease();
|
||||
return player.getClass().getCreatureStats (player).hasCommonDisease();
|
||||
|
||||
case SelectWrapper::Function_PcBlightDisease:
|
||||
|
||||
return MWWorld::Class::get (player).getCreatureStats (player).hasBlightDisease();
|
||||
return player.getClass().getCreatureStats (player).hasBlightDisease();
|
||||
|
||||
case SelectWrapper::Function_PcCorprus:
|
||||
|
||||
return MWWorld::Class::get (player).getCreatureStats (player).
|
||||
return player.getClass().getCreatureStats (player).
|
||||
getMagicEffects().get (ESM::MagicEffect::Corprus).mMagnitude!=0;
|
||||
|
||||
case SelectWrapper::Function_PcExpelled:
|
||||
{
|
||||
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
|
||||
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
|
||||
return false;
|
||||
|
||||
std::string faction =
|
||||
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first;
|
||||
|
||||
return player.getClass().getNpcStats(player).getExpelled(faction);
|
||||
}
|
||||
|
||||
case SelectWrapper::Function_PcVampire:
|
||||
|
||||
return MWWorld::Class::get (player).getCreatureStats(player).getMagicEffects().
|
||||
return player.getClass().getCreatureStats(player).getMagicEffects().
|
||||
get(ESM::MagicEffect::Vampirism).mMagnitude > 0;
|
||||
|
||||
case SelectWrapper::Function_TalkedToPc:
|
||||
|
@ -527,7 +518,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_Alarmed:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).isAlarmed();
|
||||
return mActor.getClass().getCreatureStats (mActor).isAlarmed();
|
||||
|
||||
case SelectWrapper::Function_Detected:
|
||||
|
||||
|
@ -535,11 +526,11 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_Attacked:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAttacked();
|
||||
return mActor.getClass().getCreatureStats (mActor).getAttacked();
|
||||
|
||||
case SelectWrapper::Function_ShouldAttack:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).isHostile();
|
||||
return mActor.getClass().getCreatureStats(mActor).getAiSetting(MWMechanics::CreatureStats::AI_Fight).getModified() >= 80;
|
||||
|
||||
case SelectWrapper::Function_CreatureTargetted:
|
||||
|
||||
|
@ -547,7 +538,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_Werewolf:
|
||||
|
||||
return MWWorld::Class::get (mActor).getNpcStats (mActor).isWerewolf();
|
||||
return mActor.getClass().getNpcStats (mActor).isWerewolf();
|
||||
|
||||
default:
|
||||
|
||||
|
@ -557,7 +548,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
int MWDialogue::Filter::getFactionRank (const MWWorld::Ptr& actor, const std::string& factionId) const
|
||||
{
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get (actor).getNpcStats (actor);
|
||||
MWMechanics::NpcStats& stats = actor.getClass().getNpcStats (actor);
|
||||
|
||||
std::map<std::string, int>::const_iterator iter = stats.getFactionRanks().find (factionId);
|
||||
|
||||
|
@ -573,13 +564,13 @@ bool MWDialogue::Filter::hasFactionRankSkillRequirements (const MWWorld::Ptr& ac
|
|||
if (rank<0 || rank>=10)
|
||||
throw std::runtime_error ("rank index out of range");
|
||||
|
||||
if (!MWWorld::Class::get (actor).getNpcStats (actor).hasSkillsForRank (factionId, rank))
|
||||
if (!actor.getClass().getNpcStats (actor).hasSkillsForRank (factionId, rank))
|
||||
return false;
|
||||
|
||||
const ESM::Faction& faction =
|
||||
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find (factionId);
|
||||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
||||
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats (actor);
|
||||
|
||||
return stats.getAttribute (faction.mData.mAttribute[0]).getBase()>=faction.mData.mRankData[rank].mAttribute1 &&
|
||||
stats.getAttribute (faction.mData.mAttribute[1]).getBase()>=faction.mData.mRankData[rank].mAttribute2;
|
||||
|
@ -591,7 +582,7 @@ bool MWDialogue::Filter::hasFactionRankReputationRequirements (const MWWorld::Pt
|
|||
if (rank<0 || rank>=10)
|
||||
throw std::runtime_error ("rank index out of range");
|
||||
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get (actor).getNpcStats (actor);
|
||||
MWMechanics::NpcStats& stats = actor.getClass().getNpcStats (actor);
|
||||
|
||||
const ESM::Faction& faction =
|
||||
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find (factionId);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace
|
|||
std::string getIconPath(MWWorld::Ptr ptr)
|
||||
{
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(ptr).getInventoryIcon(ptr);
|
||||
path += ptr.getClass().getInventoryIcon(ptr);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -174,7 +174,7 @@ namespace MWGui
|
|||
{
|
||||
update();
|
||||
|
||||
std::string sound = MWWorld::Class::get(item).getUpSoundId(item);
|
||||
std::string sound = item.getClass().getUpSoundId(item);
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace
|
|||
void updatePlayerHealth()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||
npcStats.updateHealth();
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ namespace MWGui
|
|||
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
|
||||
mReviewDialog->setHealth ( stats.getHealth() );
|
||||
mReviewDialog->setMagicka( stats.getMagicka() );
|
||||
|
|
|
@ -61,7 +61,7 @@ void CompanionWindow::onItemSelected(int index)
|
|||
if (count > 1 && !shift)
|
||||
{
|
||||
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
|
||||
dialog->open(MWWorld::Class::get(object).getName(object), "#{sTake}", count);
|
||||
dialog->open(object.getClass().getName(object), "#{sTake}", count);
|
||||
dialog->eventOkClicked.clear();
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::dragItem);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void CompanionWindow::open(const MWWorld::Ptr& npc)
|
|||
mSortModel = new SortFilterItemModel(mModel);
|
||||
mItemView->setModel(mSortModel);
|
||||
|
||||
setTitle(MWWorld::Class::get(npc).getName(npc));
|
||||
setTitle(npc.getClass().getName(npc));
|
||||
}
|
||||
|
||||
void CompanionWindow::onFrame()
|
||||
|
@ -104,22 +104,22 @@ void CompanionWindow::updateEncumbranceBar()
|
|||
{
|
||||
if (mPtr.isEmpty())
|
||||
return;
|
||||
float capacity = MWWorld::Class::get(mPtr).getCapacity(mPtr);
|
||||
float encumbrance = MWWorld::Class::get(mPtr).getEncumbrance(mPtr);
|
||||
float capacity = mPtr.getClass().getCapacity(mPtr);
|
||||
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
||||
mEncumbranceBar->setValue(encumbrance, capacity);
|
||||
|
||||
if (mPtr.getTypeName() != typeid(ESM::NPC).name())
|
||||
mProfitLabel->setCaption("");
|
||||
else
|
||||
{
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get(mPtr).getNpcStats(mPtr);
|
||||
MWMechanics::NpcStats& stats = mPtr.getClass().getNpcStats(mPtr);
|
||||
mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + boost::lexical_cast<std::string>(stats.getProfit()));
|
||||
}
|
||||
}
|
||||
|
||||
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && MWWorld::Class::get(mPtr).getNpcStats(mPtr).getProfit() < 0)
|
||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && mPtr.getClass().getNpcStats(mPtr).getProfit() < 0)
|
||||
{
|
||||
std::vector<std::string> buttons;
|
||||
buttons.push_back("#{sCompanionWarningButtonOne}");
|
||||
|
@ -135,8 +135,8 @@ void CompanionWindow::onMessageBoxButtonClicked(int button)
|
|||
{
|
||||
if (button == 0)
|
||||
{
|
||||
mPtr.getRefData().getLocals().setVarByInt(MWWorld::Class::get(mPtr).getScript(mPtr),
|
||||
"minimumProfit", MWWorld::Class::get(mPtr).getNpcStats(mPtr).getProfit());
|
||||
mPtr.getRefData().getLocals().setVarByInt(mPtr.getClass().getScript(mPtr),
|
||||
"minimumProfit", mPtr.getClass().getNpcStats(mPtr).getProfit());
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
||||
MWBase::Environment::get().getDialogueManager()->startDialogue (mPtr);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "console.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
#include <components/compiler/exception.hpp>
|
||||
#include <components/compiler/extensions0.hpp>
|
||||
|
||||
|
@ -194,7 +197,8 @@ namespace MWGui
|
|||
|
||||
void Console::executeFile (const std::string& path)
|
||||
{
|
||||
std::ifstream stream (path.c_str());
|
||||
namespace bfs = boost::filesystem;
|
||||
bfs::ifstream stream ((bfs::path(path)));
|
||||
|
||||
if (!stream.is_open())
|
||||
printError ("failed to open file: " + path);
|
||||
|
@ -409,7 +413,7 @@ namespace MWGui
|
|||
}
|
||||
else
|
||||
{
|
||||
setTitle("#{sConsoleTitle} (" + object.getCellRef().mRefID + ")");
|
||||
setTitle("#{sConsoleTitle} (" + object.getCellRef().getRefId() + ")");
|
||||
mPtr = object;
|
||||
}
|
||||
// User clicked on an object. Restore focus to the console command line.
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace MWGui
|
|||
mIsOnDragAndDrop = true;
|
||||
mDragAndDropWidget->setVisible(true);
|
||||
|
||||
std::string sound = MWWorld::Class::get(mItem.mBase).getUpSoundId(mItem.mBase);
|
||||
std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase);
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
|
||||
if (mSourceSortModel)
|
||||
|
@ -47,7 +47,7 @@ namespace MWGui
|
|||
}
|
||||
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(mItem.mBase).getInventoryIcon(mItem.mBase);
|
||||
path += mItem.mBase.getClass().getInventoryIcon(mItem.mBase);
|
||||
MyGUI::ImageBox* baseWidget = mDragAndDropWidget->createWidget<MyGUI::ImageBox>
|
||||
("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
|
||||
mDraggedWidget = baseWidget;
|
||||
|
@ -76,7 +76,7 @@ namespace MWGui
|
|||
|
||||
void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView)
|
||||
{
|
||||
std::string sound = MWWorld::Class::get(mItem.mBase).getDownSoundId(mItem.mBase);
|
||||
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
|
||||
mDragAndDropWidget->setVisible(false);
|
||||
|
@ -155,7 +155,7 @@ namespace MWGui
|
|||
if (count > 1 && !shift)
|
||||
{
|
||||
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
|
||||
dialog->open(MWWorld::Class::get(object).getName(object), "#{sTake}", count);
|
||||
dialog->open(object.getClass().getName(object), "#{sTake}", count);
|
||||
dialog->eventOkClicked.clear();
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &ContainerWindow::dragItem);
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ namespace MWGui
|
|||
{
|
||||
// check that we don't exceed container capacity
|
||||
MWWorld::Ptr item = mDragAndDrop->mItem.mBase;
|
||||
float weight = MWWorld::Class::get(item).getWeight(item) * mDragAndDrop->mDraggedCount;
|
||||
if (MWWorld::Class::get(mPtr).getCapacity(mPtr) < MWWorld::Class::get(mPtr).getEncumbrance(mPtr) + weight)
|
||||
float weight = item.getClass().getWeight(item) * mDragAndDrop->mDraggedCount;
|
||||
if (mPtr.getClass().getCapacity(mPtr) < mPtr.getClass().getEncumbrance(mPtr) + weight)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sContentsMessage3}");
|
||||
return;
|
||||
|
@ -227,7 +227,7 @@ namespace MWGui
|
|||
|
||||
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
|
||||
// or we end up using a possibly invalid model.
|
||||
setTitle(MWWorld::Class::get(container).getName(container));
|
||||
setTitle(container.getClass().getName(container));
|
||||
}
|
||||
|
||||
void ContainerWindow::onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char)
|
||||
|
@ -284,7 +284,7 @@ namespace MWGui
|
|||
{
|
||||
// play the sound of the first object
|
||||
MWWorld::Ptr item = mModel->getItem(i).mBase;
|
||||
std::string sound = MWWorld::Class::get(item).getUpSoundId(item);
|
||||
std::string sound = item.getClass().getUpSoundId(item);
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ namespace MWGui
|
|||
{
|
||||
onTakeAllButtonClicked(mTakeButton);
|
||||
|
||||
if (MWWorld::Class::get(mPtr).isPersistent(mPtr))
|
||||
if (mPtr.getClass().isPersistent(mPtr))
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sDisposeCorpseFail}");
|
||||
else
|
||||
MWBase::Environment::get().getWorld()->deleteObject(mPtr);
|
||||
|
|
|
@ -85,7 +85,7 @@ void ContainerItemModel::removeItem (const ItemStack& item, size_t count)
|
|||
|
||||
for (std::vector<MWWorld::Ptr>::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
|
||||
{
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source);
|
||||
MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source);
|
||||
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ void ContainerItemModel::update()
|
|||
mItems.clear();
|
||||
for (std::vector<MWWorld::Ptr>::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
|
||||
{
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source);
|
||||
MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source);
|
||||
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
|
|
|
@ -386,8 +386,8 @@ namespace MWGui
|
|||
mTopicLinks.clear();
|
||||
mKeywordSearch.clear();
|
||||
|
||||
bool isCompanion = !MWWorld::Class::get(mPtr).getScript(mPtr).empty()
|
||||
&& mPtr.getRefData().getLocals().getIntVar(MWWorld::Class::get(mPtr).getScript(mPtr), "companion");
|
||||
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
||||
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
||||
|
||||
bool anyService = mServices > 0 || isCompanion || mPtr.getTypeName() == typeid(ESM::NPC).name();
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(soulgem).getInventoryIcon(soulgem);
|
||||
path += soulgem.getClass().getInventoryIcon(soulgem);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -164,7 +164,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::ImageBox* image = mItemBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path += item.getClass().getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -207,7 +207,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path += item.getClass().getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -306,7 +306,7 @@ namespace MWGui
|
|||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
MWWorld::Ptr item = (i == 0) ? mEnchanting.getOldItem() : mEnchanting.getGem();
|
||||
if (Misc::StringUtils::ciEqual(item.getCellRef().mOwner, mPtr.getCellRef().mRefID))
|
||||
if (Misc::StringUtils::ciEqual(item.getCellRef().getOwner(), mPtr.getCellRef().getRefId()))
|
||||
{
|
||||
std::string msg = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sNotifyMessage49")->getString();
|
||||
if (msg.find("%s") != std::string::npos)
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace MWGui
|
|||
else
|
||||
dropped = world->dropObjectOnGround(world->getPlayerPtr(), item.mBase, count);
|
||||
if (setNewOwner)
|
||||
dropped.getCellRef().mOwner = "";
|
||||
dropped.getCellRef().setOwner("");
|
||||
|
||||
return dropped;
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ namespace MWGui
|
|||
void HUD::onWeaponClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||
return;
|
||||
|
@ -360,7 +360,7 @@ namespace MWGui
|
|||
void HUD::onMagicClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
|
||||
return;
|
||||
|
@ -443,7 +443,7 @@ namespace MWGui
|
|||
|
||||
void HUD::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)
|
||||
{
|
||||
std::string itemName = MWWorld::Class::get(item).getName(item);
|
||||
std::string itemName = item.getClass().getName(item);
|
||||
if (itemName != mSpellName && mSpellVisible)
|
||||
{
|
||||
mWeaponSpellTimer = 5.0f;
|
||||
|
@ -466,7 +466,7 @@ namespace MWGui
|
|||
, MyGUI::Align::Stretch);
|
||||
|
||||
std::string path = std::string("icons\\");
|
||||
path+=MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path+=item.getClass().getInventoryIcon(item);
|
||||
Widgets::fixTexturePath(path);
|
||||
itemBox->setImageTexture(path);
|
||||
itemBox->setNeedMouseFocus(false);
|
||||
|
@ -474,7 +474,7 @@ namespace MWGui
|
|||
|
||||
void HUD::setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent)
|
||||
{
|
||||
std::string itemName = MWWorld::Class::get(item).getName(item);
|
||||
std::string itemName = item.getClass().getName(item);
|
||||
if (itemName != mWeaponName && mWeaponVisible)
|
||||
{
|
||||
mWeaponSpellTimer = 5.0f;
|
||||
|
@ -493,10 +493,10 @@ namespace MWGui
|
|||
MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0));
|
||||
|
||||
std::string path = std::string("icons\\");
|
||||
path+=MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path+=item.getClass().getInventoryIcon(item);
|
||||
Widgets::fixTexturePath(path);
|
||||
|
||||
if (MWWorld::Class::get(item).getEnchantment(item) != "")
|
||||
if (item.getClass().getEnchantment(item) != "")
|
||||
{
|
||||
mWeapImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
|
||||
MyGUI::ImageBox* itemBox = mWeapImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
|
||||
|
@ -545,7 +545,7 @@ namespace MWGui
|
|||
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
|
||||
if (player.getClass().getNpcStats(player).isWerewolf())
|
||||
mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds");
|
||||
else
|
||||
mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds");
|
||||
|
@ -636,7 +636,7 @@ namespace MWGui
|
|||
|
||||
void HUD::updateEnemyHealthBar()
|
||||
{
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(mEnemy).getCreatureStats(mEnemy);
|
||||
MWMechanics::CreatureStats& stats = mEnemy.getClass().getCreatureStats(mEnemy);
|
||||
mEnemyHealth->setProgressRange(100);
|
||||
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
|
||||
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)
|
||||
|
|
|
@ -50,7 +50,7 @@ MWWorld::Ptr InventoryItemModel::copyItem (const ItemStack& item, size_t count,
|
|||
|
||||
void InventoryItemModel::removeItem (const ItemStack& item, size_t count)
|
||||
{
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor);
|
||||
MWWorld::ContainerStore& store = mActor.getClass().getContainerStore(mActor);
|
||||
int removed = store.remove(item.mBase, count, mActor);
|
||||
|
||||
if (removed == 0)
|
||||
|
@ -67,7 +67,7 @@ MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, I
|
|||
if (mActor.getClass().isActor() && mActor.getClass().getCreatureStats(mActor).isDead()
|
||||
// Make sure that the item is actually owned by the dead actor
|
||||
// Prevents a potential exploit for resetting the owner of any item, by placing the item in a corpse
|
||||
&& Misc::StringUtils::ciEqual(item.mBase.getCellRef().mOwner, mActor.getCellRef().mRefID))
|
||||
&& Misc::StringUtils::ciEqual(item.mBase.getCellRef().getOwner(), mActor.getCellRef().getRefId()))
|
||||
setNewOwner = true;
|
||||
|
||||
MWWorld::Ptr ret = otherModel->copyItem(item, count, setNewOwner);
|
||||
|
@ -77,7 +77,7 @@ MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, I
|
|||
|
||||
void InventoryItemModel::update()
|
||||
{
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor);
|
||||
MWWorld::ContainerStore& store = mActor.getClass().getContainerStore(mActor);
|
||||
|
||||
mItems.clear();
|
||||
|
||||
|
@ -87,7 +87,7 @@ void InventoryItemModel::update()
|
|||
// NOTE: Don't show WerewolfRobe objects in the inventory, or allow them to be taken.
|
||||
// Vanilla likely uses a hack like this since there's no other way to prevent it from
|
||||
// being shown or taken.
|
||||
if(item.getCellRef().mRefID == "werewolfrobe")
|
||||
if(item.getCellRef().getRefId() == "werewolfrobe")
|
||||
continue;
|
||||
|
||||
ItemStack newItem (item, this, item.getRefData().getCount());
|
||||
|
|
|
@ -162,14 +162,14 @@ namespace MWGui
|
|||
}
|
||||
|
||||
const ItemStack& item = mTradeModel->getItem(index);
|
||||
std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase);
|
||||
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
|
||||
|
||||
MWWorld::Ptr object = item.mBase;
|
||||
int count = item.mCount;
|
||||
|
||||
// Bound items may not be moved
|
||||
if (item.mBase.getCellRef().mRefID.size() > 6
|
||||
&& item.mBase.getCellRef().mRefID.substr(0,6) == "bound_")
|
||||
if (item.mBase.getCellRef().getRefId().size() > 6
|
||||
&& item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
|
||||
|
@ -184,7 +184,7 @@ namespace MWGui
|
|||
{
|
||||
// check if merchant accepts item
|
||||
int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices();
|
||||
if (!MWWorld::Class::get(object).canSell(object, services))
|
||||
if (!object.getClass().canSell(object, services))
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
|
@ -197,7 +197,7 @@ namespace MWGui
|
|||
{
|
||||
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
|
||||
std::string message = mTrading ? "#{sQuanityMenuMessage01}" : "#{sTake}";
|
||||
dialog->open(MWWorld::Class::get(object).getName(object), message, count);
|
||||
dialog->open(object.getClass().getName(object), message, count);
|
||||
dialog->eventOkClicked.clear();
|
||||
if (mTrading)
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::sellItem);
|
||||
|
@ -223,7 +223,7 @@ namespace MWGui
|
|||
const ItemStack& item = mTradeModel->getItem(mSelectedItem);
|
||||
if (item.mType == ItemStack::Type_Equipped)
|
||||
{
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
|
||||
MWWorld::Ptr newStack = *invStore.unequipItem(item.mBase, mPtr);
|
||||
|
||||
// The unequipped item was re-stacked. We have to update the index
|
||||
|
@ -259,7 +259,7 @@ namespace MWGui
|
|||
{
|
||||
ensureSelectedItemUnequipped();
|
||||
const ItemStack& item = mTradeModel->getItem(mSelectedItem);
|
||||
std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase);
|
||||
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
|
||||
if (item.mType == ItemStack::Type_Barter)
|
||||
|
@ -382,7 +382,7 @@ namespace MWGui
|
|||
|
||||
if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0)
|
||||
{
|
||||
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr);
|
||||
boost::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
|
||||
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
|
@ -447,14 +447,14 @@ namespace MWGui
|
|||
if (slot == -1)
|
||||
return MWWorld::Ptr();
|
||||
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
|
||||
if(invStore.getSlot(slot) != invStore.end())
|
||||
{
|
||||
MWWorld::Ptr item = *invStore.getSlot(slot);
|
||||
// NOTE: Don't allow users to select WerewolfRobe objects in the inventory. Vanilla
|
||||
// likely uses a hack like this since there's no other way to prevent it from being
|
||||
// taken.
|
||||
if(item.getCellRef().mRefID == "werewolfrobe")
|
||||
if(item.getCellRef().getRefId() == "werewolfrobe")
|
||||
return MWWorld::Ptr();
|
||||
return item;
|
||||
}
|
||||
|
@ -466,8 +466,8 @@ namespace MWGui
|
|||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
float capacity = MWWorld::Class::get(player).getCapacity(player);
|
||||
float encumbrance = MWWorld::Class::get(player).getEncumbrance(player);
|
||||
float capacity = player.getClass().getCapacity(player);
|
||||
float encumbrance = player.getClass().getEncumbrance(player);
|
||||
mEncumbranceBar->setValue(encumbrance, capacity);
|
||||
}
|
||||
|
||||
|
@ -498,9 +498,9 @@ namespace MWGui
|
|||
mAvatarImage->setImageTile(MyGUI::IntSize(std::min(512, size.width), std::min(1024, size.height)));
|
||||
|
||||
mArmorRating->setCaptionWithReplacing ("#{sArmor}: "
|
||||
+ boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
|
||||
+ boost::lexical_cast<std::string>(static_cast<int>(mPtr.getClass().getArmorRating(mPtr))));
|
||||
if (mArmorRating->getTextSize().width > mArmorRating->getSize().width)
|
||||
mArmorRating->setCaptionWithReplacing (boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
|
||||
mArmorRating->setCaptionWithReplacing (boost::lexical_cast<std::string>(static_cast<int>(mPtr.getClass().getArmorRating(mPtr))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ namespace MWGui
|
|||
&& (type != typeid(ESM::Potion).name()))
|
||||
return;
|
||||
|
||||
if (MWWorld::Class::get(object).getName(object) == "") // objects without name presented to user can never be picked up
|
||||
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
|
||||
return;
|
||||
|
||||
int count = object.getRefData().getCount();
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MWGui
|
|||
, mType(Type_Normal)
|
||||
, mBase(base)
|
||||
{
|
||||
if (MWWorld::Class::get(base).getEnchantment(base) != "")
|
||||
if (base.getClass().getEnchantment(base) != "")
|
||||
mFlags |= Flag_Enchanted;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ void ItemView::update()
|
|||
|
||||
/// \todo performance improvement: don't create/destroy all the widgets everytime the container window changes size, only reposition them
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item.mBase).getInventoryIcon(item.mBase);
|
||||
path += item.mBase.getClass().getInventoryIcon(item.mBase);
|
||||
|
||||
// background widget (for the "equipped" frame and magic item background image)
|
||||
bool isMagic = (item.mFlags & ItemStack::Flag_Enchanted);
|
||||
|
|
|
@ -61,8 +61,8 @@ namespace MWGui
|
|||
void LevelupDialog::setAttributeValues()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
|
||||
|
||||
for (int i=0; i<8; ++i)
|
||||
{
|
||||
|
@ -117,8 +117,8 @@ namespace MWGui
|
|||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
|
||||
|
||||
mSpentAttributes.clear();
|
||||
resetCoins();
|
||||
|
@ -172,7 +172,7 @@ namespace MWGui
|
|||
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
|
||||
|
||||
if (mSpentAttributes.size() < 3)
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}");
|
||||
|
|
|
@ -165,15 +165,15 @@ namespace MWGui
|
|||
|
||||
buttons.push_back("newgame");
|
||||
|
||||
if (MWBase::Environment::get().getStateManager()->characterBegin()!=
|
||||
MWBase::Environment::get().getStateManager()->characterEnd())
|
||||
buttons.push_back("loadgame");
|
||||
|
||||
if (state==MWBase::StateManager::State_Running &&
|
||||
MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1 &&
|
||||
MWBase::Environment::get().getWindowManager()->isSavingAllowed())
|
||||
buttons.push_back("savegame");
|
||||
|
||||
if (MWBase::Environment::get().getStateManager()->characterBegin()!=
|
||||
MWBase::Environment::get().getStateManager()->characterEnd())
|
||||
buttons.push_back("loadgame");
|
||||
|
||||
buttons.push_back("options");
|
||||
|
||||
if (state==MWBase::StateManager::State_NoGame)
|
||||
|
|
|
@ -39,19 +39,19 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
|
||||
iter!=store.end(); ++iter)
|
||||
{
|
||||
if (MWWorld::Class::get(*iter).hasItemHealth(*iter))
|
||||
if (iter->getClass().hasItemHealth(*iter))
|
||||
{
|
||||
int maxDurability = MWWorld::Class::get(*iter).getItemMaxHealth(*iter);
|
||||
int durability = (iter->getCellRef().mCharge == -1) ? maxDurability : iter->getCellRef().mCharge;
|
||||
int maxDurability = iter->getClass().getItemMaxHealth(*iter);
|
||||
int durability = iter->getClass().getItemHealth(*iter);
|
||||
if (maxDurability == durability)
|
||||
continue;
|
||||
|
||||
int basePrice = MWWorld::Class::get(*iter).getValue(*iter);
|
||||
int basePrice = iter->getClass().getValue(*iter);
|
||||
float fRepairMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
.find("fRepairMult")->getFloat();
|
||||
|
||||
|
@ -64,7 +64,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
|
||||
|
||||
|
||||
std::string name = MWWorld::Class::get(*iter).getName(*iter)
|
||||
std::string name = iter->getClass().getName(*iter)
|
||||
+ " - " + boost::lexical_cast<std::string>(price)
|
||||
+ MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
.find("sgp")->getString();;
|
||||
|
@ -114,7 +114,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
|||
{
|
||||
// repair
|
||||
MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>();
|
||||
item.getCellRef().mCharge = MWWorld::Class::get(item).getItemMaxHealth(item);
|
||||
item.getCellRef().setCharge(item.getClass().getItemMaxHealth(item));
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1);
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace MWGui
|
|||
const ItemStack& item = mSourceModel->getItem(i);
|
||||
|
||||
// Bound items may not be stolen
|
||||
if (item.mBase.getCellRef().mRefID.size() > 6
|
||||
&& item.mBase.getCellRef().mRefID.substr(0,6) == "bound_")
|
||||
if (item.mBase.getCellRef().getRefId().size() > 6
|
||||
&& item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace MWGui
|
|||
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path += item.getClass().getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -200,7 +200,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path += item.getClass().getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -265,7 +265,7 @@ namespace MWGui
|
|||
QuickKeyType type = *button->getUserData<QuickKeyType>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
|
||||
if (type == Type_Item || type == Type_MagicItem)
|
||||
{
|
||||
|
@ -274,11 +274,11 @@ namespace MWGui
|
|||
if (item.getRefData ().getCount() < 1)
|
||||
{
|
||||
// Try searching for a compatible replacement
|
||||
std::string id = item.getCellRef().mRefID;
|
||||
std::string id = item.getCellRef().getRefId();
|
||||
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, id))
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id))
|
||||
{
|
||||
item = *it;
|
||||
button->getChildAt(0)->setUserData(item);
|
||||
|
@ -290,7 +290,7 @@ namespace MWGui
|
|||
{
|
||||
// No replacement was found
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox (
|
||||
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item));
|
||||
"#{sQuickMenu5} " + item.getClass().getName(item));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ namespace MWGui
|
|||
assert(it != store.end());
|
||||
|
||||
// equip, if it can be equipped
|
||||
if (!MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
||||
if (!item.getClass().getEquipmentSlots(item).first.empty())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->useItem(item);
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ namespace MWGui
|
|||
case Type_MagicItem:
|
||||
{
|
||||
MWWorld::Ptr item = *button->getChildAt(0)->getUserData<MWWorld::Ptr>();
|
||||
key.mId = item.getCellRef().mRefID;
|
||||
key.mId = item.getCellRef().getRefId();
|
||||
break;
|
||||
}
|
||||
case Type_Magic:
|
||||
|
@ -458,11 +458,12 @@ namespace MWGui
|
|||
MWWorld::Ptr item;
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().mRefID, id))
|
||||
if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id))
|
||||
{
|
||||
if (item.isEmpty() ||
|
||||
// Prefer the stack with the lowest remaining uses
|
||||
(it->getCellRef().mCharge != -1 && (item.getCellRef().mCharge == -1 || it->getCellRef().mCharge < item.getCellRef().mCharge) ))
|
||||
!item.getClass().hasItemHealth(*it) ||
|
||||
it->getClass().getItemHealth(*it) < item.getClass().getItemHealth(item))
|
||||
{
|
||||
item = *it;
|
||||
}
|
||||
|
@ -522,8 +523,8 @@ namespace MWGui
|
|||
const int spellHeight = 18;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
/// \todo lots of copy&pasted code from SpellWindow
|
||||
|
@ -566,7 +567,7 @@ namespace MWGui
|
|||
std::vector<MWWorld::Ptr> items;
|
||||
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
|
||||
{
|
||||
std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it);
|
||||
std::string enchantId = it->getClass().getEnchantment(*it);
|
||||
if (enchantId != "")
|
||||
{
|
||||
// only add items with "Cast once" or "Cast on use"
|
||||
|
@ -645,7 +646,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(MWWorld::Class::get(item).getName(item));
|
||||
t->setCaption(item.getClass().getName(item));
|
||||
t->setTextAlign(MyGUI::Align::Left);
|
||||
t->setUserData(item);
|
||||
t->setUserString("ToolTipType", "ItemPtr");
|
||||
|
|
|
@ -41,7 +41,7 @@ void Recharge::open()
|
|||
void Recharge::start (const MWWorld::Ptr &item)
|
||||
{
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path += item.getClass().getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -56,7 +56,7 @@ void Recharge::updateView()
|
|||
{
|
||||
MWWorld::Ptr gem = *mGemIcon->getUserData<MWWorld::Ptr>();
|
||||
|
||||
std::string soul = gem.getCellRef().mSoul;
|
||||
std::string soul = gem.getCellRef().getSoul();
|
||||
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
|
||||
|
||||
mChargeLabel->setCaptionWithReplacing("#{sCharges} " + boost::lexical_cast<std::string>(creature->mData.mSoul));
|
||||
|
@ -85,7 +85,7 @@ void Recharge::updateView()
|
|||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin());
|
||||
iter!=store.end(); ++iter)
|
||||
{
|
||||
|
@ -93,20 +93,20 @@ void Recharge::updateView()
|
|||
if (enchantmentName.empty())
|
||||
continue;
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantmentName);
|
||||
if (iter->getCellRef().mEnchantmentCharge >= enchantment->mData.mCharge
|
||||
|| iter->getCellRef().mEnchantmentCharge == -1)
|
||||
if (iter->getCellRef().getEnchantmentCharge() >= enchantment->mData.mCharge
|
||||
|| iter->getCellRef().getEnchantmentCharge() == -1)
|
||||
continue;
|
||||
|
||||
MyGUI::TextBox* text = mView->createWidget<MyGUI::TextBox> (
|
||||
"SandText", MyGUI::IntCoord(8, currentY, mView->getWidth()-8, 18), MyGUI::Align::Default);
|
||||
text->setCaption(MWWorld::Class::get(*iter).getName(*iter));
|
||||
text->setCaption(iter->getClass().getName(*iter));
|
||||
text->setNeedMouseFocus(false);
|
||||
currentY += 19;
|
||||
|
||||
MyGUI::ImageBox* icon = mView->createWidget<MyGUI::ImageBox> (
|
||||
"ImageBox", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
||||
path += iter->getClass().getInventoryIcon(*iter);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -118,7 +118,7 @@ void Recharge::updateView()
|
|||
|
||||
Widgets::MWDynamicStatPtr chargeWidget = mView->createWidget<Widgets::MWDynamicStat>
|
||||
("MW_ChargeBar", MyGUI::IntCoord(72, currentY+2, 199, 20), MyGUI::Align::Default);
|
||||
chargeWidget->setValue(iter->getCellRef().mEnchantmentCharge, enchantment->mData.mCharge);
|
||||
chargeWidget->setValue(iter->getCellRef().getEnchantmentCharge(), enchantment->mData.mCharge);
|
||||
chargeWidget->setNeedMouseFocus(false);
|
||||
|
||||
currentY += 32 + 4;
|
||||
|
@ -159,15 +159,15 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
|||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
if (roll < x)
|
||||
{
|
||||
std::string soul = gem.getCellRef().mSoul;
|
||||
std::string soul = gem.getCellRef().getSoul();
|
||||
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
|
||||
|
||||
float restored = creature->mData.mSoul * (roll / x);
|
||||
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(
|
||||
item.getClass().getEnchantment(item));
|
||||
item.getCellRef().mEnchantmentCharge =
|
||||
std::min(item.getCellRef().mEnchantmentCharge + restored, static_cast<float>(enchantment->mData.mCharge));
|
||||
item.getCellRef().setEnchantmentCharge(
|
||||
std::min(item.getCellRef().getEnchantmentCharge() + restored, static_cast<float>(enchantment->mData.mCharge)));
|
||||
|
||||
player.getClass().skillUsageSucceeded (player, ESM::Skill::Enchant, 0);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void Repair::startRepairItem(const MWWorld::Ptr &item)
|
|||
mRepair.setTool(item);
|
||||
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
path += item.getClass().getInventoryIcon(item);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
@ -56,7 +56,7 @@ void Repair::updateRepairView()
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
mRepair.getTool().get<ESM::Repair>();
|
||||
|
||||
int uses = (mRepair.getTool().getCellRef().mCharge != -1) ? mRepair.getTool().getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||
int uses = mRepair.getTool().getClass().getItemHealth(mRepair.getTool());
|
||||
|
||||
float quality = ref->mBase->mData.mQuality;
|
||||
|
||||
|
@ -90,28 +90,28 @@ void Repair::updateRepairView()
|
|||
int currentY = 0;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
|
||||
iter!=store.end(); ++iter)
|
||||
{
|
||||
if (MWWorld::Class::get(*iter).hasItemHealth(*iter))
|
||||
if (iter->getClass().hasItemHealth(*iter))
|
||||
{
|
||||
int maxDurability = MWWorld::Class::get(*iter).getItemMaxHealth(*iter);
|
||||
int durability = (iter->getCellRef().mCharge == -1) ? maxDurability : iter->getCellRef().mCharge;
|
||||
int maxDurability = iter->getClass().getItemMaxHealth(*iter);
|
||||
int durability = iter->getClass().getItemHealth(*iter);
|
||||
if (maxDurability == durability)
|
||||
continue;
|
||||
|
||||
MyGUI::TextBox* text = mRepairView->createWidget<MyGUI::TextBox> (
|
||||
"SandText", MyGUI::IntCoord(8, currentY, mRepairView->getWidth()-8, 18), MyGUI::Align::Default);
|
||||
text->setCaption(MWWorld::Class::get(*iter).getName(*iter));
|
||||
text->setCaption(iter->getClass().getName(*iter));
|
||||
text->setNeedMouseFocus(false);
|
||||
currentY += 19;
|
||||
|
||||
MyGUI::ImageBox* icon = mRepairView->createWidget<MyGUI::ImageBox> (
|
||||
"ImageBox", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
||||
path += iter->getClass().getInventoryIcon(*iter);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
|
|
|
@ -256,6 +256,15 @@ namespace MWGui
|
|||
{
|
||||
mSaveList->addItem(it->mProfile.mDescription);
|
||||
}
|
||||
// When loading, Auto-select the first save, if there is one
|
||||
if (mSaveList->getItemCount() && !mSaving)
|
||||
{
|
||||
mSaveList->setIndexSelected(0);
|
||||
onSlotSelected(mSaveList, 0);
|
||||
// Give key focus to save list so we can confirm the selection with Enter
|
||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mSaveList);
|
||||
}
|
||||
else
|
||||
onSlotSelected(mSaveList, MyGUI::ITEM_NONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace
|
|||
|
||||
if (left.mBase.getTypeName() == right.mBase.getTypeName())
|
||||
{
|
||||
int cmp = MWWorld::Class::get(left.mBase).getName(left.mBase).compare(
|
||||
MWWorld::Class::get(right.mBase).getName(right.mBase));
|
||||
int cmp = left.mBase.getClass().getName(left.mBase).compare(
|
||||
right.mBase.getClass().getName(right.mBase));
|
||||
return cmp < 0;
|
||||
}
|
||||
else
|
||||
|
@ -114,7 +114,7 @@ namespace MWGui
|
|||
if ((mFilter & Filter_OnlyEnchanted) && !(item.mFlags & ItemStack::Flag_Enchanted))
|
||||
return false;
|
||||
if ((mFilter & Filter_OnlyChargedSoulstones) && (base.getTypeName() != typeid(ESM::Miscellaneous).name()
|
||||
|| base.getCellRef().mSoul == ""))
|
||||
|| base.getCellRef().getSoul() == ""))
|
||||
return false;
|
||||
if ((mFilter & Filter_OnlyEnchantable) && (item.mFlags & ItemStack::Flag_Enchanted
|
||||
|| (base.getTypeName() != typeid(ESM::Armor).name()
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MWGui
|
|||
mPtr = actor;
|
||||
clearSpells();
|
||||
|
||||
MWMechanics::Spells& merchantSpells = MWWorld::Class::get (actor).getCreatureStats (actor).getSpells();
|
||||
MWMechanics::Spells& merchantSpells = actor.getClass().getCreatureStats (actor).getSpells();
|
||||
|
||||
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ namespace MWGui
|
|||
bool SpellBuyingWindow::playerHasSpell(const std::string &id)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells();
|
||||
MWMechanics::Spells& playerSpells = player.getClass().getCreatureStats (player).getSpells();
|
||||
for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(id, it->first))
|
||||
|
@ -121,7 +121,7 @@ namespace MWGui
|
|||
int price = *_sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (mSpellsWidgetMap.find(_sender)->second);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
|
|
|
@ -353,7 +353,7 @@ namespace MWGui
|
|||
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);
|
||||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (spell->mId);
|
||||
|
||||
|
@ -445,7 +445,7 @@ namespace MWGui
|
|||
// get the list of magic effects that are known to the player
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
std::vector<short> knownEffects;
|
||||
|
|
|
@ -40,14 +40,14 @@ namespace MWGui
|
|||
// TODO: Tracking add/remove/expire would be better than force updating every frame
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
|
||||
|
||||
EffectSourceVisitor visitor;
|
||||
|
||||
// permanent item enchantments & permanent spells
|
||||
visitor.mIsPermanent = true;
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
store.visitEffectSources(visitor);
|
||||
stats.getSpells().visitEffectSources(visitor);
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ namespace MWGui
|
|||
// retrieve all player spells, divide them into Powers and Spells and sort them
|
||||
std::vector<std::string> spellList;
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||
|
@ -122,7 +122,7 @@ namespace MWGui
|
|||
std::vector<MWWorld::Ptr> items;
|
||||
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
|
||||
{
|
||||
std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it);
|
||||
std::string enchantId = it->getClass().getEnchantment(*it);
|
||||
if (enchantId != "")
|
||||
{
|
||||
// only add items with "Cast once" or "Cast on use"
|
||||
|
@ -203,7 +203,7 @@ namespace MWGui
|
|||
MWWorld::Ptr item = *it;
|
||||
|
||||
const ESM::Enchantment* enchant =
|
||||
esmStore.get<ESM::Enchantment>().find(MWWorld::Class::get(item).getEnchantment(item));
|
||||
esmStore.get<ESM::Enchantment>().find(item.getClass().getEnchantment(item));
|
||||
|
||||
// check if the item is currently equipped (will display in a different color)
|
||||
bool equipped = false;
|
||||
|
@ -218,7 +218,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(MWWorld::Class::get(item).getName(item));
|
||||
t->setCaption(item.getClass().getName(item));
|
||||
t->setTextAlign(MyGUI::Align::Left);
|
||||
t->setUserData(item);
|
||||
t->setUserString("ToolTipType", "ItemPtr");
|
||||
|
@ -238,7 +238,7 @@ namespace MWGui
|
|||
int castCost = std::max(1.f, enchantCost - (enchantCost / 100) * (eSkill - 10));
|
||||
|
||||
std::string cost = boost::lexical_cast<std::string>(castCost);
|
||||
int currentCharge = int(item.getCellRef().mEnchantmentCharge);
|
||||
int currentCharge = int(item.getCellRef().getEnchantmentCharge());
|
||||
if (currentCharge == -1)
|
||||
currentCharge = enchant->mData.mCharge;
|
||||
std::string charge = boost::lexical_cast<std::string>(currentCharge);
|
||||
|
@ -300,7 +300,7 @@ namespace MWGui
|
|||
void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>();
|
||||
|
||||
// retrieve ContainerStoreIterator to the item
|
||||
|
@ -316,7 +316,7 @@ namespace MWGui
|
|||
|
||||
// equip, if it can be equipped and is not already equipped
|
||||
if (_sender->getUserString("Equipped") == "false"
|
||||
&& !MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
||||
&& !item.getClass().getEquipmentSlots(item).first.empty())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->useItem(item);
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ namespace MWGui
|
|||
{
|
||||
std::string spellId = _sender->getUserString("Spell");
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
|
||||
|
||||
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ namespace MWGui
|
|||
void SpellWindow::onDeleteSpellAccept()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell() == mSpellToDelete)
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace MWGui
|
|||
NoDrop::onFrame(dt);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
|
||||
|
||||
// level progress
|
||||
MyGUI::Widget* levelWidget;
|
||||
|
@ -459,7 +459,7 @@ namespace MWGui
|
|||
addSeparator(coord1, coord2);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
|
||||
const std::set<std::string> &expelled = PCstats.getExpelled();
|
||||
|
||||
addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString("sFaction", "Faction"), coord1, coord2);
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace MWGui
|
|||
if (mFocusObject.isEmpty ())
|
||||
return;
|
||||
|
||||
const MWWorld::Class& objectclass = MWWorld::Class::get (mFocusObject);
|
||||
const MWWorld::Class& objectclass = mFocusObject.getClass();
|
||||
|
||||
MyGUI::IntSize tooltipSize;
|
||||
if ((!objectclass.hasToolTip(mFocusObject))&&(MWBase::Environment::get().getWindowManager()->getMode() == GM_Console))
|
||||
|
@ -97,7 +97,7 @@ namespace MWGui
|
|||
setCoord(0, 0, 300, 300);
|
||||
mDynamicToolTipBox->setVisible(true);
|
||||
ToolTipInfo info;
|
||||
info.caption=mFocusObject.getCellRef().mRefID;
|
||||
info.caption=mFocusObject.getCellRef().getRefId();
|
||||
info.icon="";
|
||||
tooltipSize = createToolTip(info);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::IntSize tooltipSize;
|
||||
|
||||
const MWWorld::Class& object = MWWorld::Class::get (mFocusObject);
|
||||
const MWWorld::Class& object = mFocusObject.getClass();
|
||||
if (!object.hasToolTip(mFocusObject))
|
||||
{
|
||||
mDynamicToolTipBox->setVisible(false);
|
||||
|
|
|
@ -138,7 +138,7 @@ namespace MWGui
|
|||
|
||||
int services = 0;
|
||||
if (!mMerchant.isEmpty())
|
||||
services = MWWorld::Class::get(mMerchant).getServices(mMerchant);
|
||||
services = mMerchant.getClass().getServices(mMerchant);
|
||||
|
||||
mItems.clear();
|
||||
// add regular items
|
||||
|
@ -148,14 +148,14 @@ namespace MWGui
|
|||
if(!mMerchant.isEmpty())
|
||||
{
|
||||
MWWorld::Ptr base = item.mBase;
|
||||
if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, MWWorld::ContainerStore::sGoldId))
|
||||
if(Misc::StringUtils::ciEqual(base.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId))
|
||||
continue;
|
||||
if(!MWWorld::Class::get(base).canSell(base, services))
|
||||
if(!base.getClass().canSell(base, services))
|
||||
continue;
|
||||
|
||||
// Bound items may not be bought
|
||||
if (item.mBase.getCellRef().mRefID.size() > 6
|
||||
&& item.mBase.getCellRef().mRefID.substr(0,6) == "bound_")
|
||||
if (item.mBase.getCellRef().getRefId().size() > 6
|
||||
&& item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ namespace MWGui
|
|||
if(mMerchant.getClass().hasInventoryStore(mMerchant))
|
||||
{
|
||||
bool isEquipped = false;
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get(mMerchant).getInventoryStore(mMerchant);
|
||||
MWWorld::InventoryStore& store = mMerchant.getClass().getInventoryStore(mMerchant);
|
||||
for (int slot=0; slot<MWWorld::InventoryStore::Slots; ++slot)
|
||||
{
|
||||
MWWorld::ContainerStoreIterator equipped = store.getSlot(slot);
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace MWGui
|
|||
|
||||
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
|
||||
// or we end up using a possibly invalid model.
|
||||
setTitle(MWWorld::Class::get(actor).getName(actor));
|
||||
setTitle(actor.getClass().getName(actor));
|
||||
|
||||
onFilterChanged(mFilterAll);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace MWGui
|
|||
|
||||
int TradeWindow::getMerchantServices()
|
||||
{
|
||||
return MWWorld::Class::get(mPtr).getServices(mPtr);
|
||||
return mPtr.getClass().getServices(mPtr);
|
||||
}
|
||||
|
||||
void TradeWindow::onItemSelected (int index)
|
||||
|
@ -150,7 +150,7 @@ namespace MWGui
|
|||
{
|
||||
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
|
||||
std::string message = "#{sQuanityMenuMessage02}";
|
||||
dialog->open(MWWorld::Class::get(object).getName(object), message, count);
|
||||
dialog->open(object.getClass().getName(object), message, count);
|
||||
dialog->eventOkClicked.clear();
|
||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &TradeWindow::sellItem);
|
||||
mItemToSell = mSortModel->mapToSource(index);
|
||||
|
@ -165,7 +165,7 @@ namespace MWGui
|
|||
void TradeWindow::sellItem(MyGUI::Widget* sender, int count)
|
||||
{
|
||||
const ItemStack& item = mTradeModel->getItem(mItemToSell);
|
||||
std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase);
|
||||
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
|
||||
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
|
||||
|
||||
TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();
|
||||
|
@ -208,7 +208,7 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::addOrRemoveGold(int amount, const MWWorld::Ptr& actor)
|
||||
{
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(actor).getContainerStore(actor);
|
||||
MWWorld::ContainerStore& store = actor.getClass().getContainerStore(actor);
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ namespace MWGui
|
|||
// check if the player is attempting to sell back an item stolen from this actor
|
||||
for (std::vector<ItemStack>::iterator it = merchantBought.begin(); it != merchantBought.end(); ++it)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(it->mBase.getCellRef().mOwner, mPtr.getCellRef().mRefID))
|
||||
if (Misc::StringUtils::ciEqual(it->mBase.getCellRef().getOwner(), mPtr.getCellRef().getRefId()))
|
||||
{
|
||||
std::string msg = gmst.find("sNotifyMessage49")->getString();
|
||||
if (msg.find("%s") != std::string::npos)
|
||||
|
@ -442,7 +442,7 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::sellToNpc(const MWWorld::Ptr& item, int count, bool boughtItem)
|
||||
{
|
||||
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, boughtItem);
|
||||
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, item.getClass().getValue(item) * count, boughtItem);
|
||||
|
||||
mCurrentBalance += diff;
|
||||
mCurrentMerchantOffer += diff;
|
||||
|
@ -452,7 +452,7 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::buyFromNpc(const MWWorld::Ptr& item, int count, bool soldItem)
|
||||
{
|
||||
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, !soldItem);
|
||||
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, item.getClass().getValue(item) * count, !soldItem);
|
||||
|
||||
mCurrentBalance -= diff;
|
||||
mCurrentMerchantOffer -= diff;
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace MWGui
|
|||
|
||||
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold));
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats (actor);
|
||||
MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor);
|
||||
|
||||
// NPC can train you in his best 3 skills
|
||||
std::vector< std::pair<int, int> > bestSkills;
|
||||
|
@ -73,7 +73,7 @@ namespace MWGui
|
|||
MyGUI::EnumeratorWidgetPtr widgets = mTrainingOptions->getEnumerator ();
|
||||
MyGUI::Gui::getInstance ().destroyWidgets (widgets);
|
||||
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
@ -115,7 +115,7 @@ namespace MWGui
|
|||
int skillId = *sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
|
||||
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
@ -123,7 +123,7 @@ namespace MWGui
|
|||
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr);
|
||||
MWMechanics::NpcStats& npcStats = mPtr.getClass().getNpcStats (mPtr);
|
||||
if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sServiceTrainingWords}");
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWorld()->changeToExteriorCell(pos);
|
||||
}
|
||||
|
||||
MWWorld::Class::get(player).adjustPosition(player);
|
||||
player.getClass().adjustPosition(player);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
||||
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(0);
|
||||
|
|
|
@ -118,11 +118,12 @@ namespace MWGui
|
|||
|
||||
void WaitDialog::startWaiting(int hoursToWait)
|
||||
{
|
||||
if(Settings::Manager::getBool("autosave","Saves") && mSleeping) //autosaves when enabled and sleeping
|
||||
MWBase::Environment::get().getStateManager()->quickSave("Autosave");
|
||||
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
world->getFader ()->fadeOut(0.2);
|
||||
setVisible(false);
|
||||
if(Settings::Manager::getBool("autosave","Saves") && mSleeping) //autosaves when enabled and sleeping (Not resting, apparently)
|
||||
MWBase::Environment::get().getStateManager()->quickSave("Autosave");
|
||||
mProgressBar.setVisible (true);
|
||||
|
||||
mWaiting = true;
|
||||
|
@ -171,11 +172,11 @@ namespace MWGui
|
|||
void WaitDialog::setCanRest (bool canRest)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified())
|
||||
&& (stats.getHealth().getCurrent() >= stats.getHealth().getModified())
|
||||
&& (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified());
|
||||
MWMechanics::NpcStats& npcstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
MWMechanics::NpcStats& npcstats = player.getClass().getNpcStats(player);
|
||||
bool werewolf = npcstats.isWerewolf();
|
||||
|
||||
mUntilHealedButton->setVisible(canRest && !full);
|
||||
|
@ -218,8 +219,20 @@ namespace MWGui
|
|||
}
|
||||
|
||||
if (mCurHour > mHours)
|
||||
{
|
||||
stopWaiting();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &pcstats = player.getClass().getNpcStats(player);
|
||||
|
||||
// trigger levelup if possible
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
if (mSleeping && pcstats.getLevelProgress () >= gmst.find("iLevelUpTotal")->getInt())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (GM_Levelup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaitDialog::stopWaiting ()
|
||||
|
@ -229,17 +242,6 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Rest);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_RestBed);
|
||||
mWaiting = false;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &pcstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
|
||||
// trigger levelup if possible
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
if (mSleeping && pcstats.getLevelProgress () >= gmst.find("iLevelUpTotal")->getInt())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (GM_Levelup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1027,20 +1027,20 @@ namespace MWGui
|
|||
{
|
||||
mSelectedSpell = "";
|
||||
const ESM::Enchantment* ench = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>()
|
||||
.find(MWWorld::Class::get(item).getEnchantment(item));
|
||||
.find(item.getClass().getEnchantment(item));
|
||||
|
||||
int chargePercent = (item.getCellRef().mEnchantmentCharge == -1) ? 100
|
||||
: (item.getCellRef().mEnchantmentCharge / static_cast<float>(ench->mData.mCharge) * 100);
|
||||
int chargePercent = (item.getCellRef().getEnchantmentCharge() == -1) ? 100
|
||||
: (item.getCellRef().getEnchantmentCharge() / static_cast<float>(ench->mData.mCharge) * 100);
|
||||
mHud->setSelectedEnchantItem(item, chargePercent);
|
||||
mSpellWindow->setTitle(MWWorld::Class::get(item).getName(item));
|
||||
mSpellWindow->setTitle(item.getClass().getName(item));
|
||||
}
|
||||
|
||||
void WindowManager::setSelectedWeapon(const MWWorld::Ptr& item)
|
||||
{
|
||||
int durabilityPercent = (item.getCellRef().mCharge == -1) ? 100
|
||||
: (item.getCellRef().mCharge / static_cast<float>(MWWorld::Class::get(item).getItemMaxHealth(item)) * 100);
|
||||
int durabilityPercent =
|
||||
(item.getClass().getItemHealth(item) / static_cast<float>(item.getClass().getItemMaxHealth(item)) * 100);
|
||||
mHud->setSelectedWeapon(item, durabilityPercent);
|
||||
mInventoryWindow->setTitle(MWWorld::Class::get(item).getName(item));
|
||||
mInventoryWindow->setTitle(item.getClass().getName(item));
|
||||
}
|
||||
|
||||
void WindowManager::unsetSelectedSpell()
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace MWInput
|
|||
|
||||
if (action == A_Use)
|
||||
{
|
||||
MWWorld::Class::get(mPlayer->getPlayer()).getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
|
||||
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
|
||||
}
|
||||
|
||||
if (currentValue == 1)
|
||||
|
@ -359,7 +359,7 @@ namespace MWInput
|
|||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
mOverencumberedMessageDelay -= dt;
|
||||
if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player))
|
||||
if (player.getClass().getEncumbrance(player) >= player.getClass().getCapacity(player))
|
||||
{
|
||||
mPlayer->setAutoMove (false);
|
||||
if (mOverencumberedMessageDelay <= 0)
|
||||
|
@ -492,7 +492,8 @@ namespace MWInput
|
|||
}
|
||||
if (arg.keysym.sym == SDLK_x && (arg.keysym.mod & SDL_Keymod(KMOD_CTRL)))
|
||||
{
|
||||
std::string text = edit->getTextSelection();
|
||||
// Discard color codes and other escape characters
|
||||
std::string text = MyGUI::TextIterator::getOnlyText(edit->getTextSelection());
|
||||
if (text.length())
|
||||
{
|
||||
SDL_SetClipboardText(text.c_str());
|
||||
|
@ -504,7 +505,8 @@ namespace MWInput
|
|||
{
|
||||
if (arg.keysym.sym == SDLK_c && (arg.keysym.mod & SDL_Keymod(KMOD_CTRL)))
|
||||
{
|
||||
std::string text = edit->getTextSelection();
|
||||
// Discard color codes and other escape characters
|
||||
std::string text = MyGUI::TextIterator::getOnlyText(edit->getTextSelection());
|
||||
if (text.length())
|
||||
SDL_SetClipboardText(text.c_str());
|
||||
}
|
||||
|
@ -664,7 +666,7 @@ namespace MWInput
|
|||
return;
|
||||
|
||||
// Not allowed if no spell selected
|
||||
MWWorld::InventoryStore& inventory = MWWorld::Class::get(mPlayer->getPlayer()).getInventoryStore(mPlayer->getPlayer());
|
||||
MWWorld::InventoryStore& inventory = mPlayer->getPlayer().getClass().getInventoryStore(mPlayer->getPlayer());
|
||||
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell().empty() &&
|
||||
inventory.getSelectedEnchantItem() == inventory.end())
|
||||
return;
|
||||
|
|
|
@ -62,17 +62,17 @@ bool disintegrateSlot (MWWorld::Ptr ptr, int slot, float disintegrate)
|
|||
{
|
||||
if (!item->getClass().hasItemHealth(*item))
|
||||
return false;
|
||||
if (item->getCellRef().mCharge == -1)
|
||||
item->getCellRef().mCharge = item->getClass().getItemMaxHealth(*item);
|
||||
int charge = item->getClass().getItemHealth(*item);
|
||||
|
||||
if (item->getCellRef().mCharge == 0)
|
||||
if (charge == 0)
|
||||
return false;
|
||||
|
||||
item->getCellRef().mCharge -=
|
||||
charge -=
|
||||
std::min(disintegrate,
|
||||
static_cast<float>(item->getCellRef().mCharge));
|
||||
static_cast<float>(charge));
|
||||
item->getCellRef().setCharge(charge);
|
||||
|
||||
if (item->getCellRef().mCharge == 0)
|
||||
if (charge == 0)
|
||||
{
|
||||
// Will unequip the broken item and try to find a replacement
|
||||
if (ptr.getRefData().getHandle() != "player")
|
||||
|
@ -147,13 +147,13 @@ namespace MWMechanics
|
|||
for (MWWorld::ContainerStoreIterator it = container.begin(MWWorld::ContainerStore::Type_Miscellaneous);
|
||||
it != container.end(); ++it)
|
||||
{
|
||||
const std::string& id = it->getCellRef().mRefID;
|
||||
const std::string& id = it->getCellRef().getRefId();
|
||||
if (id.size() >= soulgemFilter.size()
|
||||
&& id.substr(0,soulgemFilter.size()) == soulgemFilter)
|
||||
{
|
||||
float thisGemCapacity = it->get<ESM::Miscellaneous>()->mBase->mData.mValue * fSoulgemMult;
|
||||
if (thisGemCapacity >= creatureSoulValue && thisGemCapacity < gemCapacity
|
||||
&& it->getCellRef().mSoul.empty())
|
||||
&& it->getCellRef().getSoul().empty())
|
||||
{
|
||||
gem = it;
|
||||
gemCapacity = thisGemCapacity;
|
||||
|
@ -166,7 +166,7 @@ namespace MWMechanics
|
|||
|
||||
// Set the soul on just one of the gems, not the whole stack
|
||||
gem->getContainerStore()->unstack(*gem, caster);
|
||||
gem->getCellRef().mSoul = mCreature.getCellRef().mRefID;
|
||||
gem->getCellRef().setSoul(mCreature.getCellRef().getRefId());
|
||||
|
||||
if (caster.getRefData().getHandle() == "player")
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}");
|
||||
|
@ -187,10 +187,18 @@ namespace MWMechanics
|
|||
|
||||
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer)
|
||||
{
|
||||
CreatureStats& creatureStats = MWWorld::Class::get(actor1).getCreatureStats(actor1);
|
||||
CreatureStats& creatureStats = actor1.getClass().getCreatureStats(actor1);
|
||||
|
||||
if (againstPlayer && creatureStats.isHostile()) return; // already fighting against player
|
||||
|
||||
// pure water creatures won't try to fight with the target on the ground
|
||||
// except that creature is already hostile
|
||||
if ((againstPlayer || !creatureStats.isHostile())
|
||||
&& ((actor1.getClass().canSwim(actor1) && !actor1.getClass().canWalk(actor1) // pure water creature
|
||||
&& !MWBase::Environment::get().getWorld()->isSwimming(actor2))
|
||||
|| (!actor1.getClass().canSwim(actor1) && MWBase::Environment::get().getWorld()->isSwimming(actor2)))) // creature can't swim to target
|
||||
return;
|
||||
|
||||
float fight;
|
||||
|
||||
if (againstPlayer)
|
||||
|
@ -244,13 +252,13 @@ namespace MWMechanics
|
|||
|
||||
void Actors::adjustMagicEffects (const MWWorld::Ptr& creature)
|
||||
{
|
||||
CreatureStats& creatureStats = MWWorld::Class::get (creature).getCreatureStats (creature);
|
||||
CreatureStats& creatureStats = creature.getClass().getCreatureStats (creature);
|
||||
|
||||
MagicEffects now = creatureStats.getSpells().getMagicEffects();
|
||||
|
||||
if (creature.getTypeName()==typeid (ESM::NPC).name())
|
||||
{
|
||||
MWWorld::InventoryStore& store = MWWorld::Class::get (creature).getInventoryStore (creature);
|
||||
MWWorld::InventoryStore& store = creature.getClass().getInventoryStore (creature);
|
||||
now += store.getMagicEffects();
|
||||
}
|
||||
|
||||
|
@ -265,7 +273,7 @@ namespace MWMechanics
|
|||
|
||||
void Actors::calculateDynamicStats (const MWWorld::Ptr& ptr)
|
||||
{
|
||||
CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
|
||||
|
||||
int strength = creatureStats.getAttribute(ESM::Attribute::Strength).getBase();
|
||||
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getBase();
|
||||
|
@ -333,7 +341,7 @@ namespace MWMechanics
|
|||
|
||||
void Actors::calculateCreatureStatModifiers (const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
CreatureStats &creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
|
||||
CreatureStats &creatureStats = ptr.getClass().getCreatureStats(ptr);
|
||||
const MagicEffects &effects = creatureStats.getMagicEffects();
|
||||
|
||||
// attributes
|
||||
|
@ -546,7 +554,7 @@ namespace MWMechanics
|
|||
{
|
||||
MWWorld::CellStore* store = ptr.getCell();
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), creatureID, 1);
|
||||
ref.getPtr().getCellRef().mPos = ipos;
|
||||
ref.getPtr().getCellRef().setPosition(ipos);
|
||||
|
||||
MWMechanics::CreatureStats& summonedCreatureStats = ref.getPtr().getClass().getCreatureStats(ref.getPtr());
|
||||
|
||||
|
@ -600,7 +608,7 @@ namespace MWMechanics
|
|||
|
||||
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr)
|
||||
{
|
||||
NpcStats &npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
NpcStats &npcStats = ptr.getClass().getNpcStats(ptr);
|
||||
const MagicEffects &effects = npcStats.getMagicEffects();
|
||||
|
||||
// skills
|
||||
|
@ -656,7 +664,7 @@ namespace MWMechanics
|
|||
{
|
||||
bool isPlayer = ptr.getRefData().getHandle()=="player";
|
||||
|
||||
MWWorld::InventoryStore &inventoryStore = MWWorld::Class::get(ptr).getInventoryStore(ptr);
|
||||
MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr);
|
||||
MWWorld::ContainerStoreIterator heldIter =
|
||||
inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||
/**
|
||||
|
@ -678,7 +686,7 @@ namespace MWMechanics
|
|||
{
|
||||
if (torch != inventoryStore.end())
|
||||
{
|
||||
if (!MWWorld::Class::get (ptr).getCreatureStats (ptr).isHostile())
|
||||
if (!ptr.getClass().getCreatureStats (ptr).isHostile())
|
||||
{
|
||||
// For non-hostile NPCs, unequip whatever is in the left slot in favor of a light.
|
||||
if (heldIter != inventoryStore.end() && heldIter->getTypeName() != typeid(ESM::Light).name())
|
||||
|
@ -755,8 +763,8 @@ namespace MWMechanics
|
|||
if (ptr != player && ptr.getClass().isNpc())
|
||||
{
|
||||
// get stats of witness
|
||||
CreatureStats& creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
|
||||
NpcStats& npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr);
|
||||
NpcStats& npcStats = ptr.getClass().getNpcStats(ptr);
|
||||
|
||||
if (ptr.getClass().isClass(ptr, "Guard") && creatureStats.getAiSequence().getTypeId() != AiPackage::TypeIdPursue && !creatureStats.isHostile())
|
||||
{
|
||||
|
@ -824,7 +832,7 @@ namespace MWMechanics
|
|||
void Actors::addActor (const MWWorld::Ptr& ptr, bool updateImmediately)
|
||||
{
|
||||
// erase previous death events since we are currently only tracking them while in an active cell
|
||||
MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied();
|
||||
ptr.getClass().getCreatureStats(ptr).clearHasDied();
|
||||
|
||||
removeActor(ptr);
|
||||
|
||||
|
@ -964,7 +972,7 @@ namespace MWMechanics
|
|||
// Kill dead actors, update some variables
|
||||
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
||||
{
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
|
||||
const MWWorld::Class &cls = iter->first.getClass();
|
||||
CreatureStats &stats = cls.getCreatureStats(iter->first);
|
||||
|
||||
//KnockedOutOneFrameLogic
|
||||
|
@ -1137,12 +1145,12 @@ namespace MWMechanics
|
|||
std::list<MWWorld::Ptr> list;
|
||||
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();iter++)
|
||||
{
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
|
||||
const MWWorld::Class &cls = iter->first.getClass();
|
||||
CreatureStats &stats = cls.getCreatureStats(iter->first);
|
||||
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow)
|
||||
{
|
||||
MWMechanics::AiFollow* package = static_cast<MWMechanics::AiFollow*>(stats.getAiSequence().getActivePackage());
|
||||
if(package->getFollowedActor() == actor.getCellRef().mRefID)
|
||||
if(package->getFollowedActor() == actor.getCellRef().getRefId())
|
||||
list.push_front(iter->first);
|
||||
}
|
||||
}
|
||||
|
@ -1158,7 +1166,7 @@ namespace MWMechanics
|
|||
neighbors); //only care about those within the alarm disance
|
||||
for(std::vector<MWWorld::Ptr>::iterator iter(neighbors.begin());iter != neighbors.end();iter++)
|
||||
{
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(*iter);
|
||||
const MWWorld::Class &cls = iter->getClass();
|
||||
CreatureStats &stats = cls.getCreatureStats(*iter);
|
||||
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
|||
if(distance(dest, pos.pos[0], pos.pos[1], pos.pos[2]) < 200) { //Stop when you get close
|
||||
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
|
||||
MWWorld::Ptr target = MWBase::Environment::get().getWorld()->getPtr(mObjectId,false);
|
||||
MWWorld::Class::get(target).activate(target,actor).get()->execute(actor); //Arrest player
|
||||
target.getClass().activate(target,actor).get()->execute(actor); //Arrest player
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -63,7 +63,7 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor,float duration
|
|||
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(pos.pos[0],pos.pos[1],pos.pos[2]),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
|
||||
MWMechanics::AiSequence& seq = MWWorld::Class::get(*it).getCreatureStats(*it).getAiSequence();
|
||||
MWMechanics::AiSequence& seq = it->getClass().getCreatureStats(*it).getAiSequence();
|
||||
if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdAvoidDoor) { //Only add it once
|
||||
seq.stack(MWMechanics::AiAvoidDoor(mDoorPtr),*it);
|
||||
}
|
||||
|
@ -73,11 +73,6 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor,float duration
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string MWMechanics::AiAvoidDoor::getAvoidedDoor()
|
||||
{
|
||||
return mDoorPtr.getCellRef().mRefID;
|
||||
}
|
||||
|
||||
MWMechanics::AiAvoidDoor *MWMechanics::AiAvoidDoor::clone() const
|
||||
{
|
||||
return new AiAvoidDoor(*this);
|
||||
|
|
|
@ -24,9 +24,6 @@ namespace MWMechanics
|
|||
|
||||
virtual int getTypeId() const;
|
||||
|
||||
/// Returns the door being avoided
|
||||
std::string getAvoidedDoor();
|
||||
|
||||
private:
|
||||
float mDuration;
|
||||
MWWorld::Ptr mDoorPtr;
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace
|
|||
|
||||
// cast up-down ray with some offset from actor position to check for pits/obstacles on the way to target;
|
||||
// magnitude of pits/obstacles is defined by PATHFIND_Z_REACH
|
||||
bool checkWayIsClear(const Ogre::Vector3& from, const Ogre::Vector3& to, float offset)
|
||||
bool checkWayIsClear(const Ogre::Vector3& from, const Ogre::Vector3& to, float offsetXY)
|
||||
{
|
||||
if((to - from).length() >= PATHFIND_CAUTION_DIST || abs(from.z - to.z) <= PATHFIND_Z_REACH)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace
|
|||
dir.z = 0;
|
||||
dir.normalise();
|
||||
float verticalOffset = 200; // instead of '200' here we want the height of the actor
|
||||
Ogre::Vector3 _from = from + dir*offset + Ogre::Vector3::UNIT_Z * verticalOffset;
|
||||
Ogre::Vector3 _from = from + dir*offsetXY + Ogre::Vector3::UNIT_Z * verticalOffset;
|
||||
|
||||
// cast up-down ray and find height in world space of hit
|
||||
float h = _from.z - MWBase::Environment::get().getWorld()->getDistToNearestRayHit(_from, -Ogre::Vector3::UNIT_Z, verticalOffset + PATHFIND_Z_REACH + 1);
|
||||
|
@ -149,13 +149,27 @@ namespace MWMechanics
|
|||
bool AiCombat::execute (const MWWorld::Ptr& actor,float duration)
|
||||
{
|
||||
//General description
|
||||
if(actor.getClass().getCreatureStats(actor).isDead()) return true;
|
||||
if(actor.getClass().getCreatureStats(actor).isDead())
|
||||
return true;
|
||||
|
||||
MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtrViaActorId(mTargetActorId);
|
||||
|
||||
if(target.getClass().getCreatureStats(target).isDead())
|
||||
return true;
|
||||
|
||||
const MWWorld::Class& actorClass = actor.getClass();
|
||||
MWBase::World& world = *MWBase::Environment::get().getWorld();
|
||||
|
||||
if ((!actorClass.isNpc() && target == world.getPlayerPtr() &&
|
||||
actorClass.canSwim(actor) && !actorClass.canWalk(actor) // pure water creature
|
||||
&& !world.isSwimming(target)) // Player moved out of water
|
||||
|| (!actorClass.canSwim(actor) && world.isSwimming(target))) // creature can't swim to Player
|
||||
{
|
||||
actorClass.getCreatureStats(actor).setHostile(false);
|
||||
actorClass.getCreatureStats(actor).setAttackingOrSpell(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Update every frame
|
||||
if(mCombatMove)
|
||||
{
|
||||
|
@ -327,10 +341,11 @@ namespace MWMechanics
|
|||
Ogre::Vector3 vActorPos(pos.pos);
|
||||
Ogre::Vector3 vTargetPos(target.getRefData().getPosition().pos);
|
||||
Ogre::Vector3 vDirToTarget = vTargetPos - vActorPos;
|
||||
float distToTarget = vDirToTarget.length();
|
||||
|
||||
bool isStuck = false;
|
||||
float speed = 0.0f;
|
||||
if(mMovement.mPosition[1] && (Ogre::Vector3(mLastPos.pos) - vActorPos).length() < (speed = actorCls.getSpeed(actor)) / 10.0f)
|
||||
if(mMovement.mPosition[1] && (Ogre::Vector3(mLastPos.pos) - vActorPos).length() < (speed = actorCls.getSpeed(actor)) * tReaction / 2)
|
||||
isStuck = true;
|
||||
|
||||
mLastPos = pos;
|
||||
|
@ -342,16 +357,15 @@ namespace MWMechanics
|
|||
// determine vertical angle to target
|
||||
// if actor can move along z-axis it will control movement dir
|
||||
// if can't - it will control correct aiming
|
||||
mMovement.mRotation[0] = getXAngleToDir(vDirToTarget);
|
||||
|
||||
vDirToTarget.z = 0;
|
||||
float distToTarget = vDirToTarget.length();
|
||||
mMovement.mRotation[0] = getXAngleToDir(vDirToTarget, distToTarget);
|
||||
|
||||
// (within strike dist) || (not quite strike dist while following)
|
||||
if(distToTarget < rangeAttack || (distToTarget <= rangeFollow && mFollowTarget && !isStuck) )
|
||||
{
|
||||
//Melee and Close-up combat
|
||||
mMovement.mRotation[2] = getZAngleToDir(vDirToTarget, distToTarget);
|
||||
|
||||
// if we preserve dir.z then horizontal angle can be inaccurate
|
||||
mMovement.mRotation[2] = getZAngleToDir(Ogre::Vector3(vDirToTarget.x, vDirToTarget.y, 0));
|
||||
|
||||
// (not quite strike dist while following)
|
||||
if (mFollowTarget && distToTarget > rangeAttack)
|
||||
|
@ -398,18 +412,14 @@ namespace MWMechanics
|
|||
bool preferShortcut = false;
|
||||
bool inLOS = MWBase::Environment::get().getWorld()->getLOS(actor, target);
|
||||
|
||||
if(mReadyToAttack) isStuck = false;
|
||||
|
||||
// check if shortcut is available
|
||||
if(!isStuck
|
||||
&& (!mForceNoShortcut
|
||||
|| (Ogre::Vector3(mShortcutFailPos.pos) - vActorPos).length() >= PATHFIND_SHORTCUT_RETRY_DIST)
|
||||
&& inLOS)
|
||||
if(inLOS && (!isStuck || mReadyToAttack)
|
||||
&& (!mForceNoShortcut || (Ogre::Vector3(mShortcutFailPos.pos) - vActorPos).length() >= PATHFIND_SHORTCUT_RETRY_DIST))
|
||||
{
|
||||
if(speed == 0.0f) speed = actorCls.getSpeed(actor);
|
||||
// maximum dist before pit/obstacle for actor to avoid them depending on his speed
|
||||
float maxAvoidDist = tReaction * speed + speed / MAX_VEL_ANGULAR.valueRadians() * 2; // *2 - for reliability
|
||||
preferShortcut = checkWayIsClear(vActorPos, vTargetPos, distToTarget > maxAvoidDist*1.5? maxAvoidDist : maxAvoidDist/2);
|
||||
preferShortcut = checkWayIsClear(vActorPos, vTargetPos, Ogre::Vector3(vDirToTarget.x, vDirToTarget.y, 0).length() > maxAvoidDist*1.5? maxAvoidDist : maxAvoidDist/2);
|
||||
}
|
||||
|
||||
// don't use pathgrid when actor can move in 3 dimensions
|
||||
|
@ -467,7 +477,7 @@ namespace MWMechanics
|
|||
mReadyToAttack = false;
|
||||
}
|
||||
|
||||
if(distToTarget > rangeAttack && !distantCombat)
|
||||
if(!isStuck && distToTarget > rangeAttack && !distantCombat)
|
||||
{
|
||||
//special run attack; it shouldn't affect melee combat tactics
|
||||
if(actorCls.getMovementSettings(actor).mPosition[1] == 1)
|
||||
|
@ -517,7 +527,7 @@ namespace MWMechanics
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Door>& ref = *mDoorIter;
|
||||
float minSqr = 1.3*1.3*MIN_DIST_TO_DOOR_SQUARED; // for legibility
|
||||
if(vActorPos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos)) < minSqr &&
|
||||
if(vActorPos.squaredDistance(Ogre::Vector3(ref.mRef.getPosition().pos)) < minSqr &&
|
||||
ref.mData.getLocalRotation().rot[2] < 0.4f) // even small opening
|
||||
{
|
||||
//std::cout<<"closed door id \""<<ref.mRef.mRefID<<"\""<<std::endl;
|
||||
|
@ -552,7 +562,7 @@ namespace MWMechanics
|
|||
float minSqr = 1.6 * 1.6 * MIN_DIST_TO_DOOR_SQUARED; // for legibility
|
||||
// TODO: add reaction to checking open doors
|
||||
if(mBackOffDoor &&
|
||||
vActorPos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos)) < minSqr)
|
||||
vActorPos.squaredDistance(Ogre::Vector3(ref.mRef.getPosition().pos)) < minSqr)
|
||||
{
|
||||
mMovement.mPosition[1] = -0.2; // back off, but slowly
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace MWMechanics
|
|||
{
|
||||
// Stop moving if the player is to far away
|
||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(actor, "idle3", 0, 1);
|
||||
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
|
||||
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
|
||||
mMaxDist = 330;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, ESM::Pathgrid::Po
|
|||
MWWorld::Ptr door = getNearbyDoor(actor);
|
||||
if(door != MWWorld::Ptr()) // NOTE: checks interior cells only
|
||||
{
|
||||
if(door.getCellRef().mTrap.empty() && mLastDoorChecked != door) { //Open the door if untrapped
|
||||
if(door.getCellRef().getTrap().empty() && mLastDoorChecked != door) { //Open the door if untrapped
|
||||
door.getClass().activate(door, actor).get()->execute(actor);
|
||||
mLastDoorChecked = door;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ void AiSequence::execute (const MWWorld::Ptr& actor,float duration)
|
|||
float nearestDist = std::numeric_limits<float>::max();
|
||||
Ogre::Vector3 vActorPos = Ogre::Vector3(actor.getRefData().getPosition().pos);
|
||||
|
||||
for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end(); ++it)
|
||||
for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end();)
|
||||
{
|
||||
if ((*it)->getTypeId() != AiPackage::TypeIdCombat) break;
|
||||
|
||||
|
@ -147,7 +147,7 @@ void AiSequence::execute (const MWWorld::Ptr& actor,float duration)
|
|||
if (target.isEmpty())
|
||||
{
|
||||
delete *it;
|
||||
mPackages.erase(it++);
|
||||
it = mPackages.erase(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,20 +159,26 @@ void AiSequence::execute (const MWWorld::Ptr& actor,float duration)
|
|||
nearestDist = distTo;
|
||||
itActualCombat = it;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// all targets disappeared
|
||||
if (nearestDist == std::numeric_limits<float>::max())
|
||||
if (!mPackages.empty())
|
||||
{
|
||||
mDone = true;
|
||||
return;
|
||||
}
|
||||
else if (mPackages.begin() != itActualCombat)
|
||||
if (nearestDist < std::numeric_limits<float>::max() && mPackages.begin() != itActualCombat)
|
||||
{
|
||||
// move combat package with nearest target to the front
|
||||
mPackages.splice(mPackages.begin(), mPackages, itActualCombat);
|
||||
}
|
||||
|
||||
package = mPackages.front();
|
||||
mLastAiPackage = package->getTypeId();
|
||||
}
|
||||
else
|
||||
{
|
||||
mDone = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (package->execute (actor,duration))
|
||||
|
|
|
@ -572,7 +572,7 @@ namespace MWMechanics
|
|||
void AiWander::stopWalking(const MWWorld::Ptr& actor)
|
||||
{
|
||||
mPathFinder.clearPath();
|
||||
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
|
||||
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
|
||||
}
|
||||
|
||||
void AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect)
|
||||
|
|
|
@ -292,13 +292,13 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
|
|||
|
||||
void MWMechanics::Alchemy::increaseSkill()
|
||||
{
|
||||
MWWorld::Class::get (mAlchemist).skillUsageSucceeded (mAlchemist, ESM::Skill::Alchemy, 0);
|
||||
mAlchemist.getClass().skillUsageSucceeded (mAlchemist, ESM::Skill::Alchemy, 0);
|
||||
}
|
||||
|
||||
float MWMechanics::Alchemy::getChance() const
|
||||
{
|
||||
const CreatureStats& creatureStats = MWWorld::Class::get (mAlchemist).getCreatureStats (mAlchemist);
|
||||
const NpcStats& npcStats = MWWorld::Class::get (mAlchemist).getNpcStats (mAlchemist);
|
||||
const CreatureStats& creatureStats = mAlchemist.getClass().getCreatureStats (mAlchemist);
|
||||
const NpcStats& npcStats = mAlchemist.getClass().getNpcStats (mAlchemist);
|
||||
|
||||
return
|
||||
(npcStats.getSkill (ESM::Skill::Alchemy).getModified() +
|
||||
|
@ -331,7 +331,7 @@ void MWMechanics::Alchemy::setAlchemist (const MWWorld::Ptr& npc)
|
|||
|
||||
mEffects.clear();
|
||||
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get (npc).getContainerStore (npc);
|
||||
MWWorld::ContainerStore& store = npc.getClass().getContainerStore (npc);
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin (MWWorld::ContainerStore::Type_Apparatus));
|
||||
iter!=store.end(); ++iter)
|
||||
|
|
|
@ -407,29 +407,25 @@ MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::I
|
|||
return inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
}
|
||||
|
||||
void CharacterController::playRandomDeath(float startpoint)
|
||||
void CharacterController::playDeath(float startpoint, CharacterState death)
|
||||
{
|
||||
if(MWBase::Environment::get().getWorld()->isSwimming(mPtr) && mAnimation->hasAnimation("swimdeath"))
|
||||
switch (death)
|
||||
{
|
||||
mDeathState = CharState_SwimDeath;
|
||||
case CharState_SwimDeath:
|
||||
mCurrentDeath = "swimdeath";
|
||||
}
|
||||
else if (mHitState == CharState_KnockDown)
|
||||
{
|
||||
mDeathState = CharState_DeathKnockDown;
|
||||
break;
|
||||
case CharState_DeathKnockDown:
|
||||
mCurrentDeath = "deathknockdown";
|
||||
}
|
||||
else if (mHitState == CharState_KnockOut)
|
||||
{
|
||||
mDeathState = CharState_DeathKnockOut;
|
||||
break;
|
||||
case CharState_DeathKnockOut:
|
||||
mCurrentDeath = "deathknockout";
|
||||
break;
|
||||
default:
|
||||
mCurrentDeath = "death" + Ogre::StringConverter::toString(death - CharState_Death1 + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int selected=0;
|
||||
mCurrentDeath = chooseRandomGroup("death", &selected);
|
||||
mDeathState = static_cast<CharacterState>(CharState_Death1 + (selected-1));
|
||||
}
|
||||
mDeathState = death;
|
||||
|
||||
mPtr.getClass().getCreatureStats(mPtr).setDeathAnimation(mDeathState - CharState_Death1);
|
||||
|
||||
// For dead actors, refreshCurrentAnims is no longer called, so we need to disable the movement state manually.
|
||||
mMovementState = CharState_None;
|
||||
|
@ -440,6 +436,29 @@ void CharacterController::playRandomDeath(float startpoint)
|
|||
false, 1.0f, "start", "stop", startpoint, 0);
|
||||
}
|
||||
|
||||
void CharacterController::playRandomDeath(float startpoint)
|
||||
{
|
||||
if(MWBase::Environment::get().getWorld()->isSwimming(mPtr) && mAnimation->hasAnimation("swimdeath"))
|
||||
{
|
||||
mDeathState = CharState_SwimDeath;
|
||||
}
|
||||
else if (mHitState == CharState_KnockDown)
|
||||
{
|
||||
mDeathState = CharState_DeathKnockDown;
|
||||
}
|
||||
else if (mHitState == CharState_KnockOut)
|
||||
{
|
||||
mDeathState = CharState_DeathKnockOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
int selected=0;
|
||||
chooseRandomGroup("death", &selected);
|
||||
mDeathState = static_cast<CharacterState>(CharState_Death1 + (selected-1));
|
||||
}
|
||||
playDeath(startpoint, mDeathState);
|
||||
}
|
||||
|
||||
CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim)
|
||||
: mPtr(ptr)
|
||||
, mAnimation(anim)
|
||||
|
@ -459,7 +478,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
|
|||
if(!mAnimation)
|
||||
return;
|
||||
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
||||
const MWWorld::Class &cls = mPtr.getClass();
|
||||
if(cls.isActor())
|
||||
{
|
||||
/* Accumulate along X/Y only for now, until we can figure out how we should
|
||||
|
@ -497,7 +516,8 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
|
|||
|
||||
if(mDeathState != CharState_None)
|
||||
{
|
||||
playRandomDeath(1.0f);
|
||||
int deathindex = mPtr.getClass().getCreatureStats(mPtr).getDeathAnimation();
|
||||
playDeath(1.0f, CharacterState(CharState_Death1 + deathindex));
|
||||
}
|
||||
else
|
||||
refreshCurrentAnims(mIdleState, mMovementState, true);
|
||||
|
@ -549,7 +569,7 @@ bool CharacterController::updateCreatureState()
|
|||
|
||||
bool CharacterController::updateWeaponState()
|
||||
{
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
||||
const MWWorld::Class &cls = mPtr.getClass();
|
||||
CreatureStats &stats = cls.getCreatureStats(mPtr);
|
||||
WeaponType weaptype = WeapType_None;
|
||||
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
|
||||
|
@ -601,8 +621,8 @@ bool CharacterController::updateWeaponState()
|
|||
if(weapon != inv.end() && !(weaptype == WeapType_None && mWeaponType == WeapType_Spell))
|
||||
{
|
||||
std::string soundid = (weaptype == WeapType_None) ?
|
||||
MWWorld::Class::get(*weapon).getDownSoundId(*weapon) :
|
||||
MWWorld::Class::get(*weapon).getUpSoundId(*weapon);
|
||||
weapon->getClass().getDownSoundId(*weapon) :
|
||||
weapon->getClass().getUpSoundId(*weapon);
|
||||
if(!soundid.empty())
|
||||
{
|
||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||
|
@ -983,7 +1003,7 @@ bool CharacterController::updateWeaponState()
|
|||
void CharacterController::update(float duration)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
||||
const MWWorld::Class &cls = mPtr.getClass();
|
||||
Ogre::Vector3 movement(0.0f);
|
||||
|
||||
updateVisibility();
|
||||
|
|
|
@ -181,6 +181,7 @@ class CharacterController
|
|||
|
||||
void updateVisibility();
|
||||
|
||||
void playDeath(float startpoint, CharacterState death);
|
||||
void playRandomDeath(float startpoint = 0.0f);
|
||||
|
||||
/// choose a random animation group with \a prefix and numeric suffix
|
||||
|
|
|
@ -102,10 +102,11 @@ namespace MWMechanics
|
|||
if (roll < x)
|
||||
{
|
||||
// Reduce shield durability by incoming damage
|
||||
if (shield->getCellRef().mCharge == -1)
|
||||
shield->getCellRef().mCharge = shield->getClass().getItemMaxHealth(*shield);
|
||||
shield->getCellRef().mCharge -= std::min(shield->getCellRef().mCharge, int(damage));
|
||||
if (!shield->getCellRef().mCharge)
|
||||
int shieldhealth = shield->getClass().getItemHealth(*shield);
|
||||
|
||||
shieldhealth -= std::min(shieldhealth, int(damage));
|
||||
shield->getCellRef().setCharge(shieldhealth);
|
||||
if (shieldhealth == 0)
|
||||
inv.unequipItem(*shield, blocker);
|
||||
|
||||
// Reduce blocker fatigue
|
||||
|
|
|
@ -22,7 +22,8 @@ namespace MWMechanics
|
|||
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mKnockdownOneFrame(false),
|
||||
mKnockdownOverOneFrame(false), mHitRecovery(false), mBlock(false),
|
||||
mMovementFlags(0), mDrawState (DrawState_Nothing), mAttackStrength(0.f),
|
||||
mLastRestock(0,0), mGoldPool(0), mActorId(-1)
|
||||
mLastRestock(0,0), mGoldPool(0), mActorId(-1),
|
||||
mDeathAnimation(0)
|
||||
{
|
||||
for (int i=0; i<4; ++i)
|
||||
mAiSettings[i] = 0;
|
||||
|
@ -102,7 +103,6 @@ namespace MWMechanics
|
|||
|
||||
Stat<int> CreatureStats::getAiSetting (AiSetting index) const
|
||||
{
|
||||
assert (index>=0 && index<4);
|
||||
return mAiSettings[index];
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,6 @@ namespace MWMechanics
|
|||
|
||||
void CreatureStats::setAiSetting (AiSetting index, Stat<int> value)
|
||||
{
|
||||
assert (index>=0 && index<4);
|
||||
mAiSettings[index] = value;
|
||||
}
|
||||
|
||||
|
@ -500,6 +499,7 @@ namespace MWMechanics
|
|||
state.mDrawState = mDrawState;
|
||||
state.mLevel = mLevel;
|
||||
state.mActorId = mActorId;
|
||||
state.mDeathAnimation = mDeathAnimation;
|
||||
|
||||
mSpells.writeState(state.mSpells);
|
||||
mActiveSpells.writeState(state.mActiveSpells);
|
||||
|
@ -539,6 +539,7 @@ namespace MWMechanics
|
|||
mDrawState = DrawState_(state.mDrawState);
|
||||
mLevel = state.mLevel;
|
||||
mActorId = state.mActorId;
|
||||
mDeathAnimation = state.mDeathAnimation;
|
||||
|
||||
mSpells.readState(state.mSpells);
|
||||
mActiveSpells.readState(state.mActiveSpells);
|
||||
|
@ -592,4 +593,14 @@ namespace MWMechanics
|
|||
{
|
||||
esm.getHNT(sActorId, "COUN");
|
||||
}
|
||||
|
||||
unsigned char CreatureStats::getDeathAnimation() const
|
||||
{
|
||||
return mDeathAnimation;
|
||||
}
|
||||
|
||||
void CreatureStats::setDeathAnimation(unsigned char index)
|
||||
{
|
||||
mDeathAnimation = index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ namespace MWMechanics
|
|||
|
||||
int mActorId;
|
||||
|
||||
// The index of the death animation that was played
|
||||
unsigned char mDeathAnimation;
|
||||
|
||||
protected:
|
||||
// These two are only set by NpcStats, but they are declared in CreatureStats to prevent using virtual methods.
|
||||
bool mIsWerewolf;
|
||||
|
@ -250,6 +253,9 @@ namespace MWMechanics
|
|||
void setGoldPool(int pool);
|
||||
int getGoldPool() const;
|
||||
|
||||
unsigned char getDeathAnimation() const;
|
||||
void setDeathAnimation(unsigned char index);
|
||||
|
||||
int getActorId();
|
||||
///< Will generate an actor ID, if the actor does not have one yet.
|
||||
|
||||
|
|
|
@ -20,12 +20,10 @@ namespace MWMechanics
|
|||
if(!itemEmpty())
|
||||
{
|
||||
mObjectType = mOldItemPtr.getTypeName();
|
||||
mOldItemId = mOldItemPtr.getCellRef().mRefID;
|
||||
}
|
||||
else
|
||||
{
|
||||
mObjectType="";
|
||||
mOldItemId="";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +50,7 @@ namespace MWMechanics
|
|||
bool Enchanting::create()
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
ESM::Enchantment enchantment;
|
||||
enchantment.mData.mCharge = getGemCharge();
|
||||
|
||||
|
@ -67,7 +65,7 @@ namespace MWMechanics
|
|||
if(getEnchantChance()<std::rand()/static_cast<double> (RAND_MAX)*100)
|
||||
return false;
|
||||
|
||||
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2);
|
||||
mEnchanter.getClass().skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2);
|
||||
}
|
||||
|
||||
if(mCastStyle==ESM::Enchantment::ConstantEffect)
|
||||
|
@ -78,17 +76,13 @@ namespace MWMechanics
|
|||
enchantment.mData.mCost = getEnchantPoints();
|
||||
enchantment.mEffects = mEffectList;
|
||||
|
||||
// Create a new item
|
||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), mOldItemId, 1);
|
||||
const MWWorld::Ptr& newItemPtr = ref.getPtr();
|
||||
|
||||
// Apply the enchantment
|
||||
const ESM::Enchantment *enchantmentPtr = MWBase::Environment::get().getWorld()->createRecord (enchantment);
|
||||
MWWorld::Class::get(newItemPtr).applyEnchantment(newItemPtr, enchantmentPtr->mId, getGemCharge(), mNewItemName);
|
||||
std::string newItemId = mOldItemPtr.getClass().applyEnchantment(mOldItemPtr, enchantmentPtr->mId, getGemCharge(), mNewItemName);
|
||||
|
||||
// Add the new item to player inventory and remove the old one
|
||||
store.remove(mOldItemPtr, 1, player);
|
||||
store.add(newItemPtr, 1, player);
|
||||
store.add(newItemId, 1, player);
|
||||
|
||||
if(!mSelfEnchanting)
|
||||
payForEnchantment();
|
||||
|
@ -212,7 +206,7 @@ namespace MWMechanics
|
|||
|
||||
const float enchantCost = getEnchantPoints();
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
MWMechanics::NpcStats &stats = player.getClass().getNpcStats(player);
|
||||
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
|
||||
|
||||
/*
|
||||
|
@ -240,9 +234,9 @@ namespace MWMechanics
|
|||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
if(soulEmpty())
|
||||
return 0;
|
||||
if(mSoulGemPtr.getCellRef().mSoul=="")
|
||||
if(mSoulGemPtr.getCellRef().getSoul()=="")
|
||||
return 0;
|
||||
const ESM::Creature* soul = store.get<ESM::Creature>().find(mSoulGemPtr.getCellRef().mSoul);
|
||||
const ESM::Creature* soul = store.get<ESM::Creature>().find(mSoulGemPtr.getCellRef().getSoul());
|
||||
return soul->mData.mSoul;
|
||||
}
|
||||
|
||||
|
@ -277,7 +271,7 @@ namespace MWMechanics
|
|||
|
||||
float Enchanting::getEnchantChance() const
|
||||
{
|
||||
const NpcStats& npcStats = MWWorld::Class::get (mEnchanter).getNpcStats (mEnchanter);
|
||||
const NpcStats& npcStats = mEnchanter.getClass().getNpcStats (mEnchanter);
|
||||
|
||||
float chance1 = (npcStats.getSkill (ESM::Skill::Enchant).getModified() +
|
||||
(0.25 * npcStats.getAttribute (ESM::Attribute::Intelligence).getModified())
|
||||
|
@ -295,7 +289,7 @@ namespace MWMechanics
|
|||
void Enchanting::payForEnchantment() const
|
||||
{
|
||||
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
|
||||
store.remove(MWWorld::ContainerStore::sGoldId, getEnchantPrice(), player);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace MWMechanics
|
|||
|
||||
std::string mNewItemName;
|
||||
std::string mObjectType;
|
||||
std::string mOldItemId;
|
||||
|
||||
public:
|
||||
Enchanting();
|
||||
|
|
|
@ -53,9 +53,14 @@ namespace MWMechanics
|
|||
return std::string();
|
||||
std::string item = candidates[std::rand()%candidates.size()];
|
||||
|
||||
// Is this another levelled item or a real item?
|
||||
try
|
||||
// Vanilla doesn't fail on nonexistent items in levelled lists
|
||||
if (!MWBase::Environment::get().getWorld()->getStore().find(Misc::StringUtils::lowerCase(item)))
|
||||
{
|
||||
std::cerr << "Warning: ignoring nonexistent item '" << item << "' in levelled list '" << levItem->mId << "'" << std::endl;
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// Is this another levelled item or a real item?
|
||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item, 1);
|
||||
if (ref.getPtr().getTypeName() != typeid(ESM::ItemLevList).name()
|
||||
&& ref.getPtr().getTypeName() != typeid(ESM::CreatureLevList).name())
|
||||
|
@ -70,13 +75,6 @@ namespace MWMechanics
|
|||
return getLevelledItem(ref.getPtr().get<ESM::CreatureLevList>()->mBase, failChance);
|
||||
}
|
||||
}
|
||||
catch (std::logic_error&)
|
||||
{
|
||||
// Vanilla doesn't fail on nonexistent items in levelled lists
|
||||
std::cerr << "Warning: ignoring nonexistent item '" << item << "'" << std::endl;
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ namespace
|
|||
/// @return is \a ptr allowed to take/use \a item or is it a crime?
|
||||
bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, MWWorld::Ptr& victim)
|
||||
{
|
||||
const std::string& owner = item.getCellRef().mOwner;
|
||||
const std::string& owner = item.getCellRef().getOwner();
|
||||
bool isOwned = !owner.empty() && owner != "player";
|
||||
|
||||
const std::string& faction = item.getCellRef().mFaction;
|
||||
const std::string& faction = item.getCellRef().getFaction();
|
||||
bool isFactionOwned = false;
|
||||
if (!faction.empty() && ptr.getClass().isNpc())
|
||||
{
|
||||
|
@ -36,8 +36,8 @@ namespace
|
|||
isFactionOwned = true;
|
||||
}
|
||||
|
||||
if (!item.getCellRef().mOwner.empty())
|
||||
victim = MWBase::Environment::get().getWorld()->searchPtr(item.getCellRef().mOwner, true);
|
||||
if (!item.getCellRef().getOwner().empty())
|
||||
victim = MWBase::Environment::get().getWorld()->searchPtr(item.getCellRef().getOwner(), true);
|
||||
|
||||
return (!isOwned && !isFactionOwned);
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ namespace MWMechanics
|
|||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
||||
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
|
||||
MWMechanics::NpcStats& npcStats = ptr.getClass().getNpcStats (ptr);
|
||||
|
||||
const ESM::NPC *player = ptr.get<ESM::NPC>()->mBase;
|
||||
|
||||
|
@ -215,7 +215,7 @@ namespace MWMechanics
|
|||
|
||||
void MechanicsManager::add(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
if(MWWorld::Class::get(ptr).isActor())
|
||||
if(ptr.getClass().isActor())
|
||||
mActors.addActor(ptr);
|
||||
else
|
||||
mObjects.addObject(ptr);
|
||||
|
@ -234,7 +234,7 @@ namespace MWMechanics
|
|||
if(old == mWatched)
|
||||
mWatched = ptr;
|
||||
|
||||
if(MWWorld::Class::get(ptr).isActor())
|
||||
if(ptr.getClass().isActor())
|
||||
mActors.updateActor(old, ptr);
|
||||
else
|
||||
mObjects.updateObject(old, ptr);
|
||||
|
@ -475,13 +475,13 @@ namespace MWMechanics
|
|||
|
||||
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
const MWMechanics::NpcStats& npcSkill = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr);
|
||||
float x = npcSkill.getBaseDisposition();
|
||||
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>();
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* player = playerPtr.get<ESM::NPC>();
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||
|
||||
if (Misc::StringUtils::ciEqual(npc->mBase->mRace, player->mBase->mRace))
|
||||
x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispRaceMod")->getFloat();
|
||||
|
@ -498,27 +498,24 @@ namespace MWMechanics
|
|||
|
||||
if (playerStats.getFactionRanks().find(npcFaction) != playerStats.getFactionRanks().end())
|
||||
{
|
||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(npcFaction)->mReactions.begin();
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(npcFaction)->mReactions.end(); ++it)
|
||||
if (!playerStats.getExpelled(npcFaction))
|
||||
{
|
||||
if(Misc::StringUtils::ciEqual(it->mFaction, npcFaction)
|
||||
&& !playerStats.getExpelled(it->mFaction))
|
||||
reaction = it->mReaction;
|
||||
}
|
||||
reaction = playerStats.getFactionReputation(npcFaction);
|
||||
|
||||
rank = playerStats.getFactionRanks().find(npcFaction)->second;
|
||||
}
|
||||
else if (npcFaction != "")
|
||||
{
|
||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(npcFaction)->mReactions.begin();
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(npcFaction)->mReactions.end();++it)
|
||||
{
|
||||
if(playerStats.getFactionRanks().find(Misc::StringUtils::lowerCase(it->mFaction)) != playerStats.getFactionRanks().end() )
|
||||
{
|
||||
if(it->mReaction < reaction)
|
||||
reaction = it->mReaction;
|
||||
}
|
||||
else if (!npcFaction.empty())
|
||||
{
|
||||
std::map<std::string, int>::const_iterator playerFactionIt = playerStats.getFactionRanks().begin();
|
||||
for (; playerFactionIt != playerStats.getFactionRanks().end(); ++playerFactionIt)
|
||||
{
|
||||
std::string itFaction = playerFactionIt->first;
|
||||
|
||||
int itReaction = MWBase::Environment::get().getDialogueManager()->getFactionReaction(npcFaction, itFaction);
|
||||
if (playerFactionIt == playerStats.getFactionRanks().begin() || itReaction < reaction)
|
||||
reaction = itReaction;
|
||||
}
|
||||
rank = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -547,10 +544,10 @@ namespace MWMechanics
|
|||
if (ptr.getTypeName() == typeid(ESM::Creature).name())
|
||||
return basePrice;
|
||||
|
||||
const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
const MWMechanics::NpcStats &sellerStats = ptr.getClass().getNpcStats(ptr);
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||
|
||||
// I suppose the temporary disposition change _has_ to be considered here,
|
||||
// otherwise one would get different prices when exiting and re-entering the dialogue window...
|
||||
|
@ -592,10 +589,10 @@ namespace MWMechanics
|
|||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(npc).getNpcStats(npc);
|
||||
MWMechanics::NpcStats& npcStats = npc.getClass().getNpcStats(npc);
|
||||
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||
|
||||
float persTerm = playerStats.getAttribute(ESM::Attribute::Personality).getModified()
|
||||
/ gmst.find("fPersonalityMod")->getFloat();
|
||||
|
@ -666,8 +663,6 @@ namespace MWMechanics
|
|||
int fight = npcStats.getAiSetting(MWMechanics::CreatureStats::AI_Fight).getBase();
|
||||
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Flee,
|
||||
std::max(0, std::min(100, flee + int(std::max(iPerMinChange, s)))));
|
||||
// TODO: initiate combat and quit dialogue if fight rating is too high
|
||||
// or should setAiSetting handle this?
|
||||
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Fight,
|
||||
std::max(0, std::min(100, fight + int(std::min(-iPerMinChange, -s)))));
|
||||
}
|
||||
|
@ -741,27 +736,27 @@ namespace MWMechanics
|
|||
|
||||
void MechanicsManager::forceStateUpdate(const MWWorld::Ptr &ptr)
|
||||
{
|
||||
if(MWWorld::Class::get(ptr).isActor())
|
||||
if(ptr.getClass().isActor())
|
||||
mActors.forceStateUpdate(ptr);
|
||||
}
|
||||
|
||||
void MechanicsManager::playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number)
|
||||
{
|
||||
if(MWWorld::Class::get(ptr).isActor())
|
||||
if(ptr.getClass().isActor())
|
||||
mActors.playAnimationGroup(ptr, groupName, mode, number);
|
||||
else
|
||||
mObjects.playAnimationGroup(ptr, groupName, mode, number);
|
||||
}
|
||||
void MechanicsManager::skipAnimation(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
if(MWWorld::Class::get(ptr).isActor())
|
||||
if(ptr.getClass().isActor())
|
||||
mActors.skipAnimation(ptr);
|
||||
else
|
||||
mObjects.skipAnimation(ptr);
|
||||
}
|
||||
bool MechanicsManager::checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string &groupName)
|
||||
{
|
||||
if(MWWorld::Class::get(ptr).isActor())
|
||||
if(ptr.getClass().isActor())
|
||||
return mActors.checkAnimationPlaying(ptr, groupName);
|
||||
else
|
||||
return false;
|
||||
|
@ -1024,7 +1019,9 @@ namespace MWMechanics
|
|||
|
||||
void MechanicsManager::startCombat(const MWWorld::Ptr &ptr, const MWWorld::Ptr &target)
|
||||
{
|
||||
if (ptr.getClass().isNpc())
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "attack");
|
||||
|
||||
ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(MWMechanics::AiCombat(target), ptr);
|
||||
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
ptr.getClass().getCreatureStats(ptr).setHostile(true);
|
||||
|
|
|
@ -496,10 +496,10 @@ void MWMechanics::NpcStats::readState (const ESM::NpcStats& state)
|
|||
mExpelled.insert (iter->first);
|
||||
|
||||
if (iter->second.mRank >= 0)
|
||||
mFactionRank.insert (std::make_pair (iter->first, iter->second.mRank));
|
||||
mFactionRank[iter->first] = iter->second.mRank;
|
||||
|
||||
if (iter->second.mReputation)
|
||||
mFactionReputation.insert (std::make_pair (iter->first, iter->second.mReputation));
|
||||
mFactionReputation[iter->first] = iter->second.mReputation;
|
||||
}
|
||||
|
||||
mDisposition = state.mDisposition;
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace MWMechanics
|
|||
for (; it != refList.end(); ++it)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
||||
if(pos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos)) < minSqr)
|
||||
if(pos.squaredDistance(Ogre::Vector3(ref.mData.getPosition().pos)) < minSqr)
|
||||
if((closed && ref.mData.getLocalRotation().rot[2] == 0) ||
|
||||
(!closed && ref.mData.getLocalRotation().rot[2] >= 1))
|
||||
{
|
||||
|
|
|
@ -28,11 +28,11 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
|||
player.getClass().getContainerStore(player).unstack(mTool, player);
|
||||
|
||||
// reduce number of uses left
|
||||
int uses = (mTool.getCellRef().mCharge != -1) ? mTool.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||
mTool.getCellRef().mCharge = uses-1;
|
||||
int uses = mTool.getClass().getItemHealth(mTool);
|
||||
mTool.getCellRef().setCharge(uses-1);
|
||||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||
|
||||
float fatigueTerm = stats.getFatigueTerm();
|
||||
int pcStrength = stats.getAttribute(ESM::Attribute::Strength).getModified();
|
||||
|
@ -53,17 +53,17 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
|||
y = std::max(1, y);
|
||||
|
||||
// repair by 'y' points
|
||||
itemToRepair.getCellRef().mCharge += y;
|
||||
itemToRepair.getCellRef().mCharge = std::min(itemToRepair.getCellRef().mCharge,
|
||||
MWWorld::Class::get(itemToRepair).getItemMaxHealth(itemToRepair));
|
||||
int charge = itemToRepair.getClass().getItemHealth(itemToRepair);
|
||||
charge = std::min(charge + y, itemToRepair.getClass().getItemMaxHealth(itemToRepair));
|
||||
itemToRepair.getCellRef().setCharge(charge);
|
||||
|
||||
// set the OnPCRepair variable on the item's script
|
||||
std::string script = MWWorld::Class::get(itemToRepair).getScript(itemToRepair);
|
||||
std::string script = itemToRepair.getClass().getScript(itemToRepair);
|
||||
if(script != "")
|
||||
itemToRepair.getRefData().getLocals().setVarByInt(script, "onpcrepair", 1);
|
||||
|
||||
// increase skill
|
||||
MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Armorer, 0);
|
||||
player.getClass().skillUsageSucceeded(player, ESM::Skill::Armorer, 0);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1);
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairSuccess}");
|
||||
|
@ -75,23 +75,23 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
|
|||
}
|
||||
|
||||
// tool used up?
|
||||
if (mTool.getCellRef().mCharge == 0)
|
||||
if (mTool.getCellRef().getCharge() == 0)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
|
||||
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
|
||||
|
||||
store.remove(mTool, 1, player);
|
||||
|
||||
std::string message = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
.find("sNotifyMessage51")->getString();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->messageBox((boost::format(message) % MWWorld::Class::get(mTool).getName(mTool)).str());
|
||||
MWBase::Environment::get().getWindowManager()->messageBox((boost::format(message) % mTool.getClass().getName(mTool)).str());
|
||||
|
||||
// try to find a new tool of the same ID
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin());
|
||||
iter!=store.end(); ++iter)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(iter->getCellRef().mRefID, mTool.getCellRef().mRefID))
|
||||
if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), mTool.getCellRef().getRefId()))
|
||||
{
|
||||
mTool = *iter;
|
||||
break;
|
||||
|
|
|
@ -18,8 +18,8 @@ namespace MWMechanics
|
|||
Security::Security(const MWWorld::Ptr &actor)
|
||||
: mActor(actor)
|
||||
{
|
||||
CreatureStats& creatureStats = MWWorld::Class::get(actor).getCreatureStats(actor);
|
||||
NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats(actor);
|
||||
CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor);
|
||||
NpcStats& npcStats = actor.getClass().getNpcStats(actor);
|
||||
mAgility = creatureStats.getAttribute(ESM::Attribute::Agility).getModified();
|
||||
mLuck = creatureStats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||
mSecuritySkill = npcStats.getSkill(ESM::Skill::Security).getModified();
|
||||
|
@ -29,10 +29,10 @@ namespace MWMechanics
|
|||
void Security::pickLock(const MWWorld::Ptr &lock, const MWWorld::Ptr &lockpick,
|
||||
std::string& resultMessage, std::string& resultSound)
|
||||
{
|
||||
if (!(lock.getCellRef().mLockLevel > 0)) //If it's unlocked back out immediately
|
||||
if (!(lock.getCellRef().getLockLevel() > 0)) //If it's unlocked back out immediately
|
||||
return;
|
||||
|
||||
int lockStrength = lock.getCellRef().mLockLevel;
|
||||
int lockStrength = lock.getCellRef().getLockLevel();
|
||||
|
||||
float pickQuality = lockpick.get<ESM::Lockpick>()->mBase->mData.mQuality;
|
||||
|
||||
|
@ -51,31 +51,31 @@ namespace MWMechanics
|
|||
int roll = static_cast<float> (std::rand()) / RAND_MAX * 100;
|
||||
if (roll <= x)
|
||||
{
|
||||
MWWorld::Class::get(lock).unlock(lock);
|
||||
lock.getClass().unlock(lock);
|
||||
resultMessage = "#{sLockSuccess}";
|
||||
resultSound = "Open Lock";
|
||||
MWWorld::Class::get(mActor).skillUsageSucceeded(mActor, ESM::Skill::Security, 1);
|
||||
mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 1);
|
||||
}
|
||||
else
|
||||
resultMessage = "#{sLockFail}";
|
||||
}
|
||||
|
||||
if (lockpick.getCellRef().mCharge == -1)
|
||||
lockpick.getCellRef().mCharge = lockpick.get<ESM::Lockpick>()->mBase->mData.mUses;
|
||||
--lockpick.getCellRef().mCharge;
|
||||
if (!lockpick.getCellRef().mCharge)
|
||||
int uses = lockpick.getClass().getItemHealth(lockpick);
|
||||
--uses;
|
||||
lockpick.getCellRef().setCharge(uses);
|
||||
if (!uses)
|
||||
lockpick.getContainerStore()->remove(lockpick, 1, mActor);
|
||||
}
|
||||
|
||||
void Security::probeTrap(const MWWorld::Ptr &trap, const MWWorld::Ptr &probe,
|
||||
std::string& resultMessage, std::string& resultSound)
|
||||
{
|
||||
if (trap.getCellRef().mTrap == "")
|
||||
if (trap.getCellRef().getTrap() == "")
|
||||
return;
|
||||
|
||||
float probeQuality = probe.get<ESM::Probe>()->mBase->mData.mQuality;
|
||||
|
||||
const ESM::Spell* trapSpell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(trap.getCellRef().mTrap);
|
||||
const ESM::Spell* trapSpell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(trap.getCellRef().getTrap());
|
||||
float trapSpellPoints = trapSpell->mData.mCost;
|
||||
|
||||
float fTrapCostMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fTrapCostMult")->getFloat();
|
||||
|
@ -93,20 +93,20 @@ namespace MWMechanics
|
|||
int roll = static_cast<float> (std::rand()) / RAND_MAX * 100;
|
||||
if (roll <= x)
|
||||
{
|
||||
trap.getCellRef().mTrap = "";
|
||||
trap.getCellRef().setTrap("");
|
||||
|
||||
resultSound = "Disarm Trap";
|
||||
resultMessage = "#{sTrapSuccess}";
|
||||
MWWorld::Class::get(mActor).skillUsageSucceeded(mActor, ESM::Skill::Security, 0);
|
||||
mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 0);
|
||||
}
|
||||
else
|
||||
resultMessage = "#{sTrapFail}";
|
||||
}
|
||||
|
||||
if (probe.getCellRef().mCharge == -1)
|
||||
probe.getCellRef().mCharge = probe.get<ESM::Probe>()->mBase->mData.mUses;
|
||||
--probe.getCellRef().mCharge;
|
||||
if (!probe.getCellRef().mCharge)
|
||||
int uses = probe.getClass().getItemHealth(probe);
|
||||
--uses;
|
||||
probe.getCellRef().setCharge(uses);
|
||||
if (!uses)
|
||||
probe.getContainerStore()->remove(probe, 1, mActor);
|
||||
}
|
||||
|
||||
|
|
|
@ -470,21 +470,21 @@ namespace MWMechanics
|
|||
{
|
||||
if (effectId == ESM::MagicEffect::Lock)
|
||||
{
|
||||
if (target.getCellRef().mLockLevel < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||
target.getCellRef().mLockLevel = magnitude;
|
||||
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||
target.getCellRef().setLockLevel(magnitude);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::Open)
|
||||
{
|
||||
if (target.getCellRef().mLockLevel <= magnitude)
|
||||
if (target.getCellRef().getLockLevel() <= magnitude)
|
||||
{
|
||||
if (target.getCellRef().getLockLevel() > 0)
|
||||
{
|
||||
//Door not already unlocked
|
||||
if (target.getCellRef().mLockLevel > 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(target, "Open Lock", 1.f, 1.f);
|
||||
if (!caster.isEmpty() && caster.getClass().isActor())
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(caster, target);
|
||||
}
|
||||
target.getCellRef().mLockLevel = -abs(target.getCellRef().mLockLevel); //unlocks the door
|
||||
target.getCellRef().setLockLevel(-abs(target.getCellRef().getLockLevel())); //unlocks the door
|
||||
}
|
||||
else
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(target, "Open Lock Fail", 1.f, 1.f);
|
||||
|
@ -588,7 +588,7 @@ namespace MWMechanics
|
|||
throw std::runtime_error("can't cast an item without an enchantment");
|
||||
|
||||
mSourceName = item.getClass().getName(item);
|
||||
mId = item.getCellRef().mRefID;
|
||||
mId = item.getCellRef().getRefId();
|
||||
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantmentName);
|
||||
|
||||
|
@ -601,10 +601,10 @@ namespace MWMechanics
|
|||
int eSkill = mCaster.getClass().getSkill(mCaster, ESM::Skill::Enchant);
|
||||
const int castCost = std::max(1.f, enchantCost - (enchantCost / 100) * (eSkill - 10));
|
||||
|
||||
if (item.getCellRef().mEnchantmentCharge == -1)
|
||||
item.getCellRef().mEnchantmentCharge = enchantment->mData.mCharge;
|
||||
if (item.getCellRef().getEnchantmentCharge() == -1)
|
||||
item.getCellRef().setEnchantmentCharge(enchantment->mData.mCharge);
|
||||
|
||||
if (item.getCellRef().mEnchantmentCharge < castCost)
|
||||
if (item.getCellRef().getEnchantmentCharge() < castCost)
|
||||
{
|
||||
// TODO: Should there be a sound here?
|
||||
if (mCaster.getRefData().getHandle() == "player")
|
||||
|
@ -612,7 +612,7 @@ namespace MWMechanics
|
|||
return false;
|
||||
}
|
||||
// Reduce charge
|
||||
item.getCellRef().mEnchantmentCharge -= castCost;
|
||||
item.getCellRef().setEnchantmentCharge(item.getCellRef().getEnchantmentCharge() - castCost);
|
||||
}
|
||||
|
||||
if (enchantment->mData.mType == ESM::Enchantment::WhenUsed)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue