mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-07 18:04:34 +00:00
Merge remote-tracking branch 'origin/master' into createnewpeople
This commit is contained in:
commit
4a2f85cfde
83 changed files with 280 additions and 234 deletions
|
|
@ -82,7 +82,7 @@ message(STATUS "Configuring OpenMW...")
|
|||
set(OPENMW_VERSION_MAJOR 0)
|
||||
set(OPENMW_VERSION_MINOR 50)
|
||||
set(OPENMW_VERSION_RELEASE 0)
|
||||
set(OPENMW_LUA_API_REVISION 86)
|
||||
set(OPENMW_LUA_API_REVISION 87)
|
||||
set(OPENMW_POSTPROCESSING_API_REVISION 3)
|
||||
|
||||
set(OPENMW_VERSION_COMMITHASH "")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
#include <future>
|
||||
#include <system_error>
|
||||
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <SDL.h>
|
||||
|
|
@ -28,7 +29,6 @@
|
|||
|
||||
#include <components/compiler/extensions0.hpp>
|
||||
|
||||
#include <components/stereo/multiview.hpp>
|
||||
#include <components/stereo/stereomanager.hpp>
|
||||
|
||||
#include <components/sceneutil/glextensions.hpp>
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace MWBase
|
|||
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
||||
std::string_view start, std::string_view stop, float startpoint, uint32_t loops, bool loopfallback)
|
||||
= 0;
|
||||
virtual void jailTimeServed(const MWWorld::Ptr& actor, int days) = 0;
|
||||
virtual void skillLevelUp(const MWWorld::Ptr& actor, ESM::RefId skillId, std::string_view source) = 0;
|
||||
virtual void skillUse(const MWWorld::Ptr& actor, ESM::RefId skillId, int useType, float scale) = 0;
|
||||
virtual void onHit(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& weapon,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <components/misc/strings/format.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/luamanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
|
@ -86,46 +87,6 @@ namespace MWGui
|
|||
|
||||
// We should not worsen corprus when in prison
|
||||
player.getClass().getCreatureStats(player).getActiveSpells().skipWorsenings(mDays * 24);
|
||||
|
||||
const auto& skillStore = MWBase::Environment::get().getESMStore()->get<ESM::Skill>();
|
||||
std::set<const ESM::Skill*> skills;
|
||||
for (int day = 0; day < mDays; ++day)
|
||||
{
|
||||
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
||||
const ESM::Skill* skill = skillStore.searchRandom({}, prng);
|
||||
skills.insert(skill);
|
||||
|
||||
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill->mId);
|
||||
if (skill->mId == ESM::Skill::Security || skill->mId == ESM::Skill::Sneak)
|
||||
value.setBase(std::min(100.f, value.getBase() + 1));
|
||||
else
|
||||
value.setBase(std::max(0.f, value.getBase() - 1));
|
||||
}
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting>& gmst
|
||||
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
|
||||
|
||||
std::string message;
|
||||
if (mDays == 1)
|
||||
message = gmst.find("sNotifyMessage42")->mValue.getString();
|
||||
else
|
||||
message = gmst.find("sNotifyMessage43")->mValue.getString();
|
||||
|
||||
message = Misc::StringUtils::format(message, mDays);
|
||||
|
||||
for (const ESM::Skill* skill : skills)
|
||||
{
|
||||
int skillValue = player.getClass().getNpcStats(player).getSkill(skill->mId).getBase();
|
||||
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
|
||||
if (skill->mId == ESM::Skill::Sneak || skill->mId == ESM::Skill::Security)
|
||||
skillMsg = gmst.find("sNotifyMessage39")->mValue.getString();
|
||||
|
||||
skillMsg = Misc::StringUtils::format(skillMsg, skill->mName, skillValue);
|
||||
message += "\n" + skillMsg;
|
||||
}
|
||||
|
||||
std::vector<std::string> buttons;
|
||||
buttons.emplace_back("#{Interface:OK}");
|
||||
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(message, buttons);
|
||||
MWBase::Environment::get().getLuaManager()->jailTimeServed(player, mDays);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -774,12 +774,10 @@ namespace MWGui
|
|||
, mGlobalMapRender(std::make_unique<MWRender::GlobalMap>(localMapRender->getRoot(), workQueue))
|
||||
, mEditNoteDialog()
|
||||
{
|
||||
static bool registered = false;
|
||||
if (!registered)
|
||||
{
|
||||
[[maybe_unused]] static const bool registered = [] {
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<MarkerWidget>("Widget");
|
||||
registered = true;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
|
||||
mEditNoteDialog.setVisible(false);
|
||||
mEditNoteDialog.eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditOk);
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ namespace MWGui
|
|||
getWidget(mAvailableEffectsList, "AvailableEffects");
|
||||
getWidget(mUsedEffectsView, "UsedEffects");
|
||||
getWidget(mPriceLabel, "PriceLabel");
|
||||
getWidget(mPlayerGold, "PlayerGold");
|
||||
getWidget(mBuyButton, "BuyButton");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
|
||||
|
|
@ -370,6 +371,10 @@ namespace MWGui
|
|||
mPtr = actor;
|
||||
mNameEdit->setCaption({});
|
||||
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
mPlayerGold->setCaptionWithReplacing(MyGUI::utility::toString(playerGold));
|
||||
|
||||
startEditing();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ namespace MWGui
|
|||
MyGUI::Button* mBuyButton;
|
||||
MyGUI::Button* mCancelButton;
|
||||
MyGUI::TextBox* mPriceLabel;
|
||||
MyGUI::TextBox* mPlayerGold;
|
||||
|
||||
ESM::Spell mSpell;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace MWGui
|
|||
: WindowBase("openmw_trainingwindow.layout")
|
||||
{
|
||||
getWidget(mTrainingOptions, "TrainingOptions");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
getWidget(mCancelButton, "OkButton");
|
||||
getWidget(mPlayerGold, "PlayerGold");
|
||||
|
||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onCancelButtonClicked);
|
||||
|
|
@ -115,14 +115,14 @@ namespace MWGui
|
|||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(price <= playerGold
|
||||
? "SandTextButton"
|
||||
: "SandTextButtonDisabled", // can't use setEnabled since that removes tooltip
|
||||
MyGUI::IntCoord(5, 5 + i * lineHeight, mTrainingOptions->getWidth() - 10, lineHeight),
|
||||
MyGUI::IntCoord(4, 3 + i * lineHeight, mTrainingOptions->getWidth() - 10, lineHeight),
|
||||
MyGUI::Align::Default);
|
||||
|
||||
button->setUserData(skills[i].first);
|
||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
|
||||
|
||||
button->setCaptionWithReplacing(
|
||||
MyGUI::TextIterator::toTagsString(skill->mName) + " - " + MyGUI::utility::toString(price));
|
||||
MyGUI::TextIterator::toTagsString(skill->mName) + " - " + MyGUI::utility::toString(price) + "#{sgp}");
|
||||
|
||||
button->setSize(button->getTextSize().width + 12, button->getSize().height);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
#include "animationbindings.hpp"
|
||||
|
||||
#include <components/esm3/loadmgef.hpp>
|
||||
#include <components/esm3/loadstat.hpp>
|
||||
#include <components/lua/asyncpackage.hpp>
|
||||
#include <components/lua/luastate.hpp>
|
||||
#include <components/lua/utilpackage.hpp>
|
||||
#include <components/misc/finitenumbers.hpp>
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
|
@ -15,11 +9,8 @@
|
|||
|
||||
#include "../mwmechanics/character.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "luamanagerimp.hpp"
|
||||
#include "objectvariant.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "idcollectionbindings.hpp"
|
||||
#include "types/types.hpp"
|
||||
#include "recordstore.hpp"
|
||||
|
||||
namespace sol
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initBirthSignRecordBindings(const Context& context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include "cellbindings.hpp"
|
||||
|
||||
#include <components/esm/esmbridge.hpp>
|
||||
|
||||
#include <components/esm3/loadacti.hpp>
|
||||
#include <components/esm3/loadalch.hpp>
|
||||
#include <components/esm3/loadappa.hpp>
|
||||
|
|
@ -27,7 +25,6 @@
|
|||
#include <components/esm4/loadammo.hpp>
|
||||
#include <components/esm4/loadarmo.hpp>
|
||||
#include <components/esm4/loadbook.hpp>
|
||||
#include <components/esm4/loadcell.hpp>
|
||||
#include <components/esm4/loadclot.hpp>
|
||||
#include <components/esm4/loadcont.hpp>
|
||||
#include <components/esm4/loaddoor.hpp>
|
||||
|
|
@ -38,7 +35,6 @@
|
|||
#include <components/esm4/loadligh.hpp>
|
||||
#include <components/esm4/loadmisc.hpp>
|
||||
#include <components/esm4/loadmstt.hpp>
|
||||
#include <components/esm4/loadrefr.hpp>
|
||||
#include <components/esm4/loadscol.hpp>
|
||||
#include <components/esm4/loadstat.hpp>
|
||||
#include <components/esm4/loadtree.hpp>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef MWLUA_CELLBINDINGS_H
|
||||
#define MWLUA_CELLBINDINGS_H
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
void initCellBindingsForLocalScripts(const Context&);
|
||||
void initCellBindingsForGlobalScripts(const Context&);
|
||||
struct Context;
|
||||
|
||||
void initCellBindingsForLocalScripts(const Context& context);
|
||||
void initCellBindingsForGlobalScripts(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_CELLBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <components/lua/luastate.hpp>
|
||||
|
||||
#include "idcollectionbindings.hpp"
|
||||
#include "types/types.hpp"
|
||||
#include "recordstore.hpp"
|
||||
|
||||
namespace sol
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initClassRecordBindings(const Context& context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include <stdexcept>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/esm3/loadfact.hpp>
|
||||
#include <components/lua/l10n.hpp>
|
||||
#include <components/lua/luastate.hpp>
|
||||
#include <components/lua/serialization.hpp>
|
||||
|
|
@ -20,6 +19,7 @@
|
|||
#include "../mwworld/datetimemanager.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "coremwscriptbindings.hpp"
|
||||
#include "dialoguebindings.hpp"
|
||||
#include "factionbindings.hpp"
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
void addCoreTimeBindings(sol::table& api, const Context& context);
|
||||
|
||||
sol::table initCorePackage(const Context&);
|
||||
sol::table initCorePackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_COREBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef OPENMW_MWLUA_DEBUGBINDINGS_H
|
||||
#define OPENMW_MWLUA_DEBUGBINDINGS_H
|
||||
|
||||
#include <sol/sol.hpp>
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,6 +113,15 @@ namespace MWLua
|
|||
scripts->onSkillLevelUp(event.mSkill, event.mSource);
|
||||
}
|
||||
|
||||
void operator()(const OnJailTimeServed& event) const
|
||||
{
|
||||
MWWorld::Ptr actor = getPtr(event.mActor);
|
||||
if (actor.isEmpty())
|
||||
return;
|
||||
if (auto* scripts = getLocalScripts(actor))
|
||||
scripts->onJailTimeServed(event.mDays);
|
||||
}
|
||||
|
||||
private:
|
||||
MWWorld::Ptr getPtr(ESM::RefNum id) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,8 +70,13 @@ namespace MWLua
|
|||
std::string mSkill;
|
||||
std::string mSource;
|
||||
};
|
||||
struct OnJailTimeServed
|
||||
{
|
||||
ESM::RefNum mActor;
|
||||
int mDays;
|
||||
};
|
||||
using Event = std::variant<OnActive, OnInactive, OnConsume, OnActivate, OnUseItem, OnNewExterior, OnTeleported,
|
||||
OnAnimationTextKey, OnSkillUse, OnSkillLevelUp>;
|
||||
OnAnimationTextKey, OnSkillUse, OnSkillLevelUp, OnJailTimeServed>;
|
||||
|
||||
void clear() { mQueue.clear(); }
|
||||
void addToQueue(Event e) { mQueue.push_back(std::move(e)); }
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initCoreFactionBindings(const Context& context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwinput/actions.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "luamanagerimp.hpp"
|
||||
|
||||
namespace sol
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initInputPackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initInputPackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_INPUTBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -1,14 +1,24 @@
|
|||
#include "landbindings.hpp"
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
|
||||
#include <sol/object.hpp>
|
||||
#include <sol/table.hpp>
|
||||
#include <sol/variadic_results.hpp>
|
||||
|
||||
#include <components/esm/refid.hpp>
|
||||
#include <components/esm/util.hpp>
|
||||
#include <components/esmterrain/storage.hpp>
|
||||
#include <components/lua/luastate.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/worldmodel.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "object.hpp"
|
||||
|
||||
namespace
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
#ifndef MWLUA_LANDBINDINGS_H
|
||||
#define MWLUA_LANDBINDINGS_H
|
||||
|
||||
#include "context.hpp"
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initCoreLandBindings(const Context& context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#include "localscripts.hpp"
|
||||
|
||||
#include <components/esm3/loadcell.hpp>
|
||||
#include <components/esm3/loadweap.hpp>
|
||||
#include <components/misc/strings/lower.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/aicombat.hpp"
|
||||
|
|
@ -232,7 +228,7 @@ namespace MWLua
|
|||
[&](LuaUtil::LuaView& view) { addPackage("openmw.self", sol::make_object(view.sol(), &mData)); });
|
||||
registerEngineHandlers({ &mOnActiveHandlers, &mOnInactiveHandlers, &mOnConsumeHandlers, &mOnActivatedHandlers,
|
||||
&mOnTeleportedHandlers, &mOnAnimationTextKeyHandlers, &mOnPlayAnimationHandlers, &mOnSkillUse,
|
||||
&mOnSkillLevelUp });
|
||||
&mOnSkillLevelUp, &mOnJailTimeServed });
|
||||
}
|
||||
|
||||
void LocalScripts::setActive(bool active, bool callHandlers)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef MWLUA_LOCALSCRIPTS_H
|
||||
#define MWLUA_LOCALSCRIPTS_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include <components/lua/luastate.hpp>
|
||||
|
|
@ -89,6 +87,7 @@ namespace MWLua
|
|||
{
|
||||
callEngineHandlers(mOnSkillLevelUp, skillId, source);
|
||||
}
|
||||
void onJailTimeServed(int days) { callEngineHandlers(mOnJailTimeServed, days); }
|
||||
|
||||
void applyStatsCache();
|
||||
|
||||
|
|
@ -118,6 +117,7 @@ namespace MWLua
|
|||
EngineHandlerList mOnPlayAnimationHandlers{ "_onPlayAnimation" };
|
||||
EngineHandlerList mOnSkillUse{ "_onSkillUse" };
|
||||
EngineHandlerList mOnSkillLevelUp{ "_onSkillLevelUp" };
|
||||
EngineHandlerList mOnJailTimeServed{ "_onJailTimeServed" };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,30 @@
|
|||
#ifndef MWLUA_LUABINDINGS_H
|
||||
#define MWLUA_LUABINDINGS_H
|
||||
|
||||
#include <map>
|
||||
#include <sol/forward.hpp>
|
||||
#include <string>
|
||||
|
||||
#include "context.hpp"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
// Initialize Lua packages that are available for all scripts.
|
||||
std::map<std::string, sol::object> initCommonPackages(const Context&);
|
||||
std::map<std::string, sol::object> initCommonPackages(const Context& context);
|
||||
|
||||
// Initialize Lua packages that are available for global scripts (additionally to common packages).
|
||||
std::map<std::string, sol::object> initGlobalPackages(const Context&);
|
||||
std::map<std::string, sol::object> initGlobalPackages(const Context& context);
|
||||
|
||||
// Initialize Lua packages that are available for local scripts (additionally to common packages).
|
||||
std::map<std::string, sol::object> initLocalPackages(const Context&);
|
||||
std::map<std::string, sol::object> initLocalPackages(const Context& context);
|
||||
|
||||
// Initialize Lua packages that are available only for local scripts on the player (additionally to common and local
|
||||
// packages).
|
||||
std::map<std::string, sol::object> initPlayerPackages(const Context&);
|
||||
std::map<std::string, sol::object> initPlayerPackages(const Context& context);
|
||||
|
||||
// Initialize Lua packages that are available only for menu scripts (additionally to common packages).
|
||||
std::map<std::string, sol::object> initMenuPackages(const Context&);
|
||||
std::map<std::string, sol::object> initMenuPackages(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_LUABINDINGS_H
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@
|
|||
#include <MyGUI_InputManager.h>
|
||||
#include <osg/Stats>
|
||||
|
||||
#include <sol/object.hpp>
|
||||
#include <sol/table.hpp>
|
||||
#include <sol/types.hpp>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/esm/luascripts.hpp>
|
||||
|
|
@ -15,7 +19,6 @@
|
|||
|
||||
#include <components/l10n/manager.hpp>
|
||||
|
||||
#include <components/lua_ui/content.hpp>
|
||||
#include <components/lua_ui/registerscriptsettings.hpp>
|
||||
#include <components/lua_ui/util.hpp>
|
||||
|
||||
|
|
@ -490,6 +493,11 @@ namespace MWLua
|
|||
EngineEvents::OnSkillLevelUp{ getId(actor), skillId.serializeText(), std::string(source) });
|
||||
}
|
||||
|
||||
void LuaManager::jailTimeServed(const MWWorld::Ptr& actor, int days)
|
||||
{
|
||||
mEngineEvents.addToQueue(EngineEvents::OnJailTimeServed{ getId(actor), days });
|
||||
}
|
||||
|
||||
void LuaManager::onHit(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& weapon,
|
||||
const MWWorld::Ptr& ammo, int attackType, float attackStrength, float damage, bool isHealth,
|
||||
const osg::Vec3f& hitPos, bool successful, MWMechanics::DamageSourceType sourceType)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <osg/Stats>
|
||||
#include <set>
|
||||
|
||||
#include <osg/Stats>
|
||||
|
||||
#include <components/lua/inputactions.hpp>
|
||||
#include <components/lua/luastate.hpp>
|
||||
#include <components/lua/scripttracker.hpp>
|
||||
|
|
@ -92,6 +93,7 @@ namespace MWLua
|
|||
bool loopfallback) override;
|
||||
void skillUse(const MWWorld::Ptr& actor, ESM::RefId skillId, int useType, float scale) override;
|
||||
void skillLevelUp(const MWWorld::Ptr& actor, ESM::RefId skillId, std::string_view source) override;
|
||||
void jailTimeServed(const MWWorld::Ptr& actor, int days) override;
|
||||
void onHit(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& weapon,
|
||||
const MWWorld::Ptr& ammo, int attackType, float attackStrength, float damage, bool isHealth,
|
||||
const osg::Vec3f& hitPos, bool successful, MWMechanics::DamageSourceType sourceType) override;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initCoreMagicBindings(const Context& context);
|
||||
void addActorMagicBindings(sol::table& actor, const Context& context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initMarkupPackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initMarkupPackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_MARKUPBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include "../mwbase/statemanager.hpp"
|
||||
#include "../mwstate/character.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
static const MWState::Character* findCharacter(std::string_view characterDir)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#include "../mwbase/luamanager.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "inputprocessor.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initMenuPackage(const Context& context);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/worldimp.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "object.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initMWScriptBindings(const Context&);
|
||||
|
||||
sol::table initMWScriptBindings(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_MWSCRIPTBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -13,9 +13,12 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/scene.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "luamanagerimp.hpp"
|
||||
#include "objectlists.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
template <class T = MWWorld::Ptr>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initNearbyPackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initNearbyPackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_NEARBYBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef MWLUA_OBJECT_H
|
||||
#define MWLUA_OBJECT_H
|
||||
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
#include <typeindex>
|
||||
|
||||
#include <sol/sol.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef MWLUA_OBJECTBINDINGS_H
|
||||
#define MWLUA_OBJECTBINDINGS_H
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
void initObjectBindingsForLocalScripts(const Context&);
|
||||
void initObjectBindingsForGlobalScripts(const Context&);
|
||||
struct Context;
|
||||
|
||||
void initObjectBindingsForLocalScripts(const Context& context);
|
||||
void initObjectBindingsForGlobalScripts(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_OBJECTBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#include "objectlists.hpp"
|
||||
|
||||
#include <components/esm3/esmreader.hpp>
|
||||
#include <components/esm3/esmwriter.hpp>
|
||||
#include <components/esm3/loadcell.hpp>
|
||||
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwrender/postprocessor.hpp"
|
||||
|
||||
#include "context.hpp"
|
||||
#include "luamanagerimp.hpp"
|
||||
|
||||
namespace
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initPostprocessingPackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initPostprocessingPackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_POSTPROCESSINGBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "idcollectionbindings.hpp"
|
||||
#include "types/types.hpp"
|
||||
#include "recordstore.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
struct Context;
|
||||
|
||||
sol::table initRaceRecordBindings(const Context& context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
#ifndef MWLUA_RECORDSTORE_H
|
||||
#define MWLUA_RECORDSTORE_H
|
||||
|
||||
#include <sol/sol.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#include <sol/forward.hpp>
|
||||
#include <sol/overload.hpp>
|
||||
#include <sol/state_view.hpp>
|
||||
#include <sol/table.hpp>
|
||||
#include <sol/types.hpp>
|
||||
#include <sol/unsafe_function.hpp>
|
||||
#include <sol/usertype.hpp>
|
||||
|
||||
#include <components/esm/defs.hpp>
|
||||
#include <components/lua/luastate.hpp>
|
||||
#include <components/lua/util.hpp>
|
||||
|
||||
#include "apps/openmw/mwbase/environment.hpp"
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initCoreSoundBindings(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initCoreSoundBindings(const Context& context);
|
||||
|
||||
sol::table initAmbientPackage(const Context& context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
#include "stats.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
#include <components/esm3/loadclas.hpp>
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ namespace MWLua
|
|||
}
|
||||
luaManager->addUIMessage(message, mode);
|
||||
};
|
||||
|
||||
api["_showInteractiveMessage"] = [windowManager](std::string_view message, sol::optional<sol::table>) {
|
||||
windowManager->interactiveMessageBox(message, { "#{Interface:OK}" });
|
||||
};
|
||||
api["CONSOLE_COLOR"] = LuaUtil::makeStrictReadOnly(LuaUtil::tableFromPairs<std::string, Misc::Color>(lua,
|
||||
{
|
||||
{ "Default", Misc::Color::fromHex(MWBase::WindowManager::sConsoleColor_Default.substr(1)) },
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initUserInterfacePackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initUserInterfacePackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_UIBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef MWLUA_USERDATASERIALIZER_H
|
||||
#define MWLUA_USERDATASERIALIZER_H
|
||||
|
||||
#include "object.hpp"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
namespace LuaUtil
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initVFSPackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initVFSPackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_VFSBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include <components/esm3/loadligh.hpp>
|
||||
#include <components/esm3/loadmisc.hpp>
|
||||
#include <components/esm3/loadnpc.hpp>
|
||||
#include <components/esm3/loadskil.hpp>
|
||||
#include <components/esm3/loadweap.hpp>
|
||||
#include <components/lua/luastate.hpp>
|
||||
#include <components/misc/finitenumbers.hpp>
|
||||
|
|
@ -28,6 +27,7 @@
|
|||
#include "luamanagerimp.hpp"
|
||||
|
||||
#include "animationbindings.hpp"
|
||||
#include "context.hpp"
|
||||
#include "corebindings.hpp"
|
||||
#include "mwscriptbindings.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <sol/forward.hpp>
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
sol::table initWorldPackage(const Context&);
|
||||
struct Context;
|
||||
|
||||
sol::table initWorldPackage(const Context& context);
|
||||
}
|
||||
|
||||
#endif // MWLUA_WORLDBINDINGS_H
|
||||
|
|
|
|||
|
|
@ -401,14 +401,12 @@ namespace MWRender
|
|||
{
|
||||
if (mViewMode == VM_FirstPerson)
|
||||
{
|
||||
static bool prototypeAdded = false;
|
||||
if (!prototypeAdded)
|
||||
{
|
||||
[[maybe_unused]] static const bool prototypeAdded = [&] {
|
||||
osg::ref_ptr<osgUtil::RenderBin> depthClearBin(new osgUtil::RenderBin);
|
||||
depthClearBin->setDrawCallback(new DepthClearCallback());
|
||||
osgUtil::RenderBin::addRenderBinPrototype("DepthClear", depthClearBin);
|
||||
prototypeAdded = true;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
mObjectRoot->getOrCreateStateSet()->setRenderBinDetails(
|
||||
RenderBin_FirstPerson, "DepthClear", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,14 +88,13 @@ namespace MWRender
|
|||
|
||||
if (mProgramBlobber != nullptr)
|
||||
{
|
||||
static bool pipelineLogged = [&] {
|
||||
[[maybe_unused]] static const bool pipelineLogged = [&] {
|
||||
if (mUseCompute)
|
||||
Log(Debug::Info) << "Initialized compute shader pipeline for water ripples";
|
||||
else
|
||||
Log(Debug::Info) << "Initialized fallback fragment shader pipeline for water ripples";
|
||||
return true;
|
||||
}();
|
||||
(void)pipelineLogged;
|
||||
}
|
||||
|
||||
setCullCallback(new osg::NodeCallback);
|
||||
|
|
|
|||
|
|
@ -522,16 +522,14 @@ namespace MWSound
|
|||
|
||||
/* We need to make sure ffmpeg is initialized. Optionally silence warning
|
||||
* output from the lib */
|
||||
static bool done_init = false;
|
||||
if (!done_init)
|
||||
{
|
||||
[[maybe_unused]] static const bool doneInit = [] {
|
||||
// This is not needed anymore above FFMpeg version 4.0
|
||||
#if LIBAVCODEC_VERSION_INT < 3805796
|
||||
av_register_all();
|
||||
#endif
|
||||
av_log_set_level(AV_LOG_ERROR);
|
||||
done_init = true;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
}
|
||||
|
||||
FFmpegDecoder::~FFmpegDecoder()
|
||||
|
|
|
|||
|
|
@ -1273,13 +1273,12 @@ namespace MWWorld
|
|||
const std::size_t leftCapacity = mPreloader->getMaxCacheSize() - mPreloader->getCacheSize();
|
||||
if (cells.size() > leftCapacity)
|
||||
{
|
||||
static bool logged = [&] {
|
||||
[[maybe_unused]] static const bool logged = [&] {
|
||||
Log(Debug::Warning) << "Not enough cell preloader cache capacity to preload exterior cells, consider "
|
||||
"increasing \"preload cell cache max\" up to "
|
||||
<< (mPreloader->getCacheSize() + cells.size());
|
||||
return true;
|
||||
}();
|
||||
(void)logged;
|
||||
cells.resize(leftCapacity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -407,6 +407,7 @@ add_component_dir(detournavigator
|
|||
areatype
|
||||
asyncnavmeshupdater
|
||||
bounds
|
||||
cellgridbounds
|
||||
changetype
|
||||
collisionshapetype
|
||||
commulativeaabb
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
|
|
|
|||
|
|
@ -10,10 +10,8 @@
|
|||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace DetourNavigator
|
||||
|
|
@ -79,7 +77,7 @@ namespace DetourNavigator
|
|||
return;
|
||||
}
|
||||
|
||||
const auto data
|
||||
const std::unique_ptr<PreparedNavMeshData> data
|
||||
= prepareNavMeshTileData(*recastMesh, mWorldspace, mTilePosition, mAgentBounds, mSettings.mRecast);
|
||||
|
||||
if (data == nullptr)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
#include "exceptions.hpp"
|
||||
#include "flags.hpp"
|
||||
#include "navmeshdata.hpp"
|
||||
#include "navmeshdb.hpp"
|
||||
#include "navmeshtilescache.hpp"
|
||||
#include "offmeshconnection.hpp"
|
||||
#include "preparednavmeshdata.hpp"
|
||||
#include "recastcontext.hpp"
|
||||
|
|
@ -22,8 +20,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include <DetourCommon.h>
|
||||
#include <DetourNavMesh.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <osg/Vec3f>
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#include <Recast.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace
|
||||
{
|
||||
void initPolyMeshDetail(rcPolyMeshDetail& value) noexcept
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
#include "flags.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <osg/Vec3f>
|
||||
|
||||
#include <optional>
|
||||
|
||||
class dtNavMeshQuery;
|
||||
|
||||
namespace DetourNavigator
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@
|
|||
#include <osg/Vec3f>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "configurationmanager.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/fallback/validate.hpp>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
|
||||
#define COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <stack>
|
||||
#include <string_view>
|
||||
|
|
|
|||
|
|
@ -95,13 +95,10 @@ namespace SceneUtil
|
|||
|
||||
static void setReversed(bool reverseZ)
|
||||
{
|
||||
static bool init = false;
|
||||
|
||||
if (!init)
|
||||
{
|
||||
[[maybe_unused]] static const bool init = [&] {
|
||||
AutoDepth::sReversed = reverseZ;
|
||||
init = true;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
}
|
||||
|
||||
static bool isReversed()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include <osg/ClipControl>
|
||||
|
||||
#include <sstream>
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
#include "glextensions.hpp"
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ Example:
|
|||
local attack = {
|
||||
attacker = self,
|
||||
weapon = Actor.getEquipment(self, Actor.EQUIPMENT_SLOT.CarriedRight),
|
||||
sourceType = I.Combat.ATTACK_SOURCE_TYPE.Melee,
|
||||
strenght = 1,
|
||||
sourceType = I.Combat.ATTACK_SOURCE_TYPES.Melee,
|
||||
strength = 1,
|
||||
type = self.ATTACK_TYPE.Chop,
|
||||
damage = {
|
||||
health = 20,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Interfaces
|
|||
AI <interface_ai>
|
||||
AnimationController <interface_animation>
|
||||
Camera <interface_camera>
|
||||
Combat <interface_combat>
|
||||
Controls <interface_controls>
|
||||
Crimes <interface_crimes>
|
||||
GamepadControls <interface_gamepadcontrols>
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@
|
|||
<Widget type="HBox" position="0 336 558 60">
|
||||
<Property key="Padding" value="16"/>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" name="PlayerGoldTextBox">
|
||||
<Property key="Caption" value="#{sGold}"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="PlayerGold"/>
|
||||
<Widget type="Spacer"/>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText">
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 319 200" align="Center" name="_Main">
|
||||
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 320 200" align="Center" name="_Main">
|
||||
|
||||
<Widget type="TextBox" skin="NormalText" position="0 5 319 24" name="Select" align="Right Top">
|
||||
<Widget type="TextBox" skin="NormalText" position="6 3 300 24" name="Select" align="Right Top">
|
||||
<Property key="TextAlign" value="Center"/>
|
||||
<Property key="Caption" value="#{sServiceTrainingTitle}"/>
|
||||
</Widget>
|
||||
<Widget type="TextBox" skin="SandText" position="5 30 319 24" name="Travel" align="Right Top">
|
||||
<Widget type="TextBox" skin="SandText" position="6 22 300 24" name="Travel" align="Right Top">
|
||||
<Property key="TextAlign" value="Left"/>
|
||||
<Property key="Caption" value="#{sTrainingServiceTitle}"/>
|
||||
</Widget>
|
||||
|
||||
|
||||
<Widget type="Widget" skin="MW_Box" position="6 54 299 100" align="Left Top" name="TrainingOptions">
|
||||
<Widget type="Widget" skin="MW_Box" position="6 42 300 115" align="Left Top" name="TrainingOptions">
|
||||
</Widget>
|
||||
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="8 161 200 24" name="PlayerGold" align="Right Top">
|
||||
<Widget type="TextBox" skin="SandText" position="6 161 200 24" name="PlayerGold" align="Right Top">
|
||||
<Property key="TextAlign" value="Left"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" position="244 161 60 24" name="CancelButton" align="Right Top">
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" position="246 161 60 24" name="OkButton" align="Right Top">
|
||||
<Property key="ExpandDirection" value="Left"/>
|
||||
<Property key="Caption" value="#{Interface:Cancel}"/>
|
||||
<Property key="Caption" value="#{Interface:OK}"/>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ end
|
|||
|
||||
local function skillLevelUpHandler(skillid, source, params)
|
||||
local skillStat = NPC.stats.skills[skillid](self)
|
||||
if skillStat.base >= 100 then
|
||||
if (skillStat.base >= 100 and params.skillIncreaseValue > 0) or
|
||||
(skillStat.base <= 0 and params.skillIncreaseValue < 0) then
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
@ -62,25 +63,67 @@ local function skillLevelUpHandler(skillid, source, params)
|
|||
= levelStat.skillIncreasesForSpecialization[params.levelUpSpecialization] + params.levelUpSpecializationIncreaseValue;
|
||||
end
|
||||
|
||||
local skillRecord = Skill.record(skillid)
|
||||
local npcRecord = NPC.record(self)
|
||||
local class = NPC.classes.record(npcRecord.class)
|
||||
if source ~= 'jail' then
|
||||
local skillRecord = Skill.record(skillid)
|
||||
local npcRecord = NPC.record(self)
|
||||
local class = NPC.classes.record(npcRecord.class)
|
||||
|
||||
ambient.playSound("skillraise")
|
||||
ambient.playSound("skillraise")
|
||||
|
||||
local message = string.format(core.getGMST('sNotifyMessage39'),skillRecord.name,skillStat.base)
|
||||
local message = string.format(core.getGMST('sNotifyMessage39'),skillRecord.name,skillStat.base)
|
||||
|
||||
if source == I.SkillProgression.SKILL_INCREASE_SOURCES.Book then
|
||||
message = '#{sBookSkillMessage}\n'..message
|
||||
if source == I.SkillProgression.SKILL_INCREASE_SOURCES.Book then
|
||||
message = '#{sBookSkillMessage}\n'..message
|
||||
end
|
||||
|
||||
ui.showMessage(message, { showInDialogue = false })
|
||||
|
||||
if levelStat.progress >= core.getGMST('iLevelUpTotal') then
|
||||
ui.showMessage('#{sLevelUpMsg}', { showInDialogue = false })
|
||||
end
|
||||
|
||||
if not source or source == I.SkillProgression.SKILL_INCREASE_SOURCES.Usage then skillStat.progress = 0 end
|
||||
end
|
||||
end
|
||||
|
||||
ui.showMessage(message, { showInDialogue = false })
|
||||
local function jailTimeServed(days)
|
||||
if not days or days <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if levelStat.progress >= core.getGMST('iLevelUpTotal') then
|
||||
ui.showMessage('#{sLevelUpMsg}', { showInDialogue = false })
|
||||
local oldSkillLevels = {}
|
||||
local skillByNumber = {}
|
||||
for skillid, skillStat in pairs(NPC.stats.skills) do
|
||||
oldSkillLevels[skillid] = skillStat(self).base
|
||||
skillByNumber[#skillByNumber+1] = skillid
|
||||
end
|
||||
|
||||
math.randomseed(core.getSimulationTime())
|
||||
for day=1,days do
|
||||
local skillid = skillByNumber[math.random(#skillByNumber)]
|
||||
-- skillLevelUp() handles skill-based increase/decrease
|
||||
I.SkillProgression.skillLevelUp(skillid, I.SkillProgression.SKILL_INCREASE_SOURCES.Jail)
|
||||
end
|
||||
|
||||
if not source or source == I.SkillProgression.SKILL_INCREASE_SOURCES.Usage then skillStat.progress = 0 end
|
||||
local message = ''
|
||||
if days == 1 then
|
||||
message = string.format(core.getGMST('sNotifyMessage42'), days)
|
||||
else
|
||||
message = string.format(core.getGMST('sNotifyMessage43'), days)
|
||||
end
|
||||
for skillid, skillStat in pairs(NPC.stats.skills) do
|
||||
local diff = skillStat(self).base - oldSkillLevels[skillid]
|
||||
if diff ~= 0 then
|
||||
local skillMsg = core.getGMST('sNotifyMessage39')
|
||||
if diff < 0 then
|
||||
skillMsg = core.getGMST('sNotifyMessage44')
|
||||
end
|
||||
local skillRecord = Skill.record(skillid)
|
||||
message = message..'\n'..string.format(skillMsg, skillRecord.name, skillStat(self).base)
|
||||
end
|
||||
end
|
||||
|
||||
I.UI.showInteractiveMessage(message)
|
||||
end
|
||||
|
||||
local function skillUsedHandler(skillid, params)
|
||||
|
|
@ -114,6 +157,7 @@ I.SkillProgression.addSkillLevelUpHandler(skillLevelUpHandler)
|
|||
return {
|
||||
engineHandlers = {
|
||||
onUpdate = onUpdate,
|
||||
_onJailTimeServed = jailTimeServed,
|
||||
},
|
||||
|
||||
eventHandlers = {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ local Skill = core.stats.Skill
|
|||
-- Table of all existing sources for skill increases. Any sources not listed below will be treated as equal to Trainer.
|
||||
-- @type SkillLevelUpSource
|
||||
-- @field #string Book book
|
||||
-- @field #string Jail jail
|
||||
-- @field #string Trainer trainer
|
||||
-- @field #string Usage usage
|
||||
|
||||
|
|
@ -131,15 +132,17 @@ local function skillLevelUp(skillid, source)
|
|||
levelUpAttributeIncreaseValue = core.getGMST('iLevelUpMajorMultAttribute')
|
||||
end
|
||||
|
||||
local options =
|
||||
{
|
||||
skillIncreaseValue = 1,
|
||||
levelUpProgress = levelUpProgress,
|
||||
levelUpAttribute = skillRecord.attribute,
|
||||
levelUpAttributeIncreaseValue = levelUpAttributeIncreaseValue,
|
||||
levelUpSpecialization = skillRecord.specialization,
|
||||
levelUpSpecializationIncreaseValue = core.getGMST('iLevelupSpecialization'),
|
||||
}
|
||||
local options = {}
|
||||
if source == 'jail' and not (skillid == 'security' or skillid == 'sneak') then
|
||||
options.skillIncreaseValue = -1
|
||||
else
|
||||
options.skillIncreaseValue = 1
|
||||
options.levelUpProgress = levelUpProgress
|
||||
options.levelUpAttribute = skillRecord.attribute
|
||||
options.levelUpAttributeIncreaseValue = levelUpAttributeIncreaseValue
|
||||
options.levelUpSpecialization = skillRecord.specialization
|
||||
options.levelUpSpecializationIncreaseValue = core.getGMST('iLevelupSpecialization')
|
||||
end
|
||||
|
||||
for i = #skillLevelUpHandlers, 1, -1 do
|
||||
if skillLevelUpHandlers[i](skillid, source, options) == false then
|
||||
|
|
@ -156,8 +159,15 @@ return {
|
|||
-- @context local
|
||||
-- @usage local I = require('openmw.interfaces')
|
||||
--
|
||||
-- -- Make jail time hurt sneak skill instead of benefitting it
|
||||
-- I.SkillProgression.addSkillLevelUpHandler(function(skillid, source, options)
|
||||
-- if skillid == 'sneak' and source == 'jail' and options.skillIncreaseValue > 0 then
|
||||
-- options.skillIncreaseValue = -options.skillIncreaseValue
|
||||
-- end
|
||||
-- end)
|
||||
--
|
||||
-- -- Forbid increasing destruction skill past 50
|
||||
-- I.SkillProgression.addSkillLevelUpHandler(function(skillid, options)
|
||||
-- I.SkillProgression.addSkillLevelUpHandler(function(skillid, source, options)
|
||||
-- if skillid == 'destruction' and types.NPC.stats.skills.destruction(self).base >= 50 then
|
||||
-- return false
|
||||
-- end
|
||||
|
|
@ -187,7 +197,7 @@ return {
|
|||
-- a modifiable table of skill level up values, and can be modified to change the behavior of later handlers.
|
||||
-- These values are calculated based on vanilla mechanics. Setting any value to nil will cause that mechanic to be skipped. By default contains these values:
|
||||
--
|
||||
-- * `skillIncreaseValue` - The numeric amount of skill levels gained.
|
||||
-- * `skillIncreaseValue` - The numeric amount of skill levels gained. By default this is 1, except when the source is jail in which case it will instead be -1 for all skills except sneak and security.
|
||||
-- * `levelUpProgress` - The numeric amount of level up progress gained.
|
||||
-- * `levelUpAttribute` - The string identifying the attribute that should receive points from this skill level up.
|
||||
-- * `levelUpAttributeIncreaseValue` - The numeric amount of attribute increase points received. This contributes to the amount of each attribute the character receives during a vanilla level up.
|
||||
|
|
@ -263,7 +273,7 @@ return {
|
|||
--- Trigger a skill level up, activating relevant handlers
|
||||
-- @function [parent=#SkillProgression] skillLevelUp
|
||||
-- @param #string skillid The id of the skill to level up.
|
||||
-- @param #SkillLevelUpSource source The source of the skill increase.
|
||||
-- @param #SkillLevelUpSource source The source of the skill increase. Note that passing a value of @{#SkillLevelUpSource.Jail} will cause a skill decrease for all skills except sneak and security.
|
||||
skillLevelUp = skillLevelUp,
|
||||
|
||||
--- @{#SkillLevelUpSource}
|
||||
|
|
@ -272,6 +282,7 @@ return {
|
|||
Book = 'book',
|
||||
Usage = 'usage',
|
||||
Trainer = 'trainer',
|
||||
Jail = 'jail',
|
||||
},
|
||||
|
||||
--- Compute the total skill gain required to level up a skill based on its current level, and other modifying factors such as major skills and specialization.
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ return {
|
|||
interface = {
|
||||
--- Interface version
|
||||
-- @field [parent=#UI] #number version
|
||||
version = 2,
|
||||
version = 3,
|
||||
|
||||
--- All available UI modes.
|
||||
-- Use `view(I.UI.MODE)` in `luap` console mode to see the list.
|
||||
|
|
@ -254,6 +254,13 @@ return {
|
|||
-- @return #boolean
|
||||
isWindowVisible = isWindowVisible,
|
||||
|
||||
---
|
||||
-- Shows a message as an interactive message box pausing the game, with a single button with the localized text OK.
|
||||
-- @function [parent=#UI] showInteractiveMessage
|
||||
-- @param #string message Message to display
|
||||
-- @param #table options Options (none yet)
|
||||
showInteractiveMessage = ui._showInteractiveMessage
|
||||
|
||||
-- TODO
|
||||
-- registerHudElement = function(name, showFn, hideFn) end,
|
||||
-- showHudElement = function(name, bool) end,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
-- * `scale` - a boolean, to set if the sound's pitch should be scaled by simulation time scaling (default: true);
|
||||
-- * `loop` - a boolean, to set if the sound should be repeated when it ends (default: false);
|
||||
-- @usage local params = {
|
||||
-- timeOffset=0.1
|
||||
-- timeOffset=0.1,
|
||||
-- volume=0.3,
|
||||
-- scale=false,
|
||||
-- pitch=1.0,
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
-- * `scale` - a boolean, to set if the sound's pitch should be scaled by simulation time scaling (default: true);
|
||||
-- * `loop` - a boolean, to set if the sound should be repeated when it ends (default: false);
|
||||
-- @usage local params = {
|
||||
-- timeOffset=0.1
|
||||
-- timeOffset=0.1,
|
||||
-- volume=0.3,
|
||||
-- scale=false,
|
||||
-- pitch=1.0,
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@
|
|||
--
|
||||
-- * `loops` - a number >= 0, the number of times the animation should loop after the first play (default: 0).
|
||||
-- * `priority` - Either a single #Priority value that will be assigned to all bone groups. Or a table mapping bone groups to its priority (default: PRIORITY.Default).
|
||||
-- * `blendMask` - A mask of which bone groups to include in the animation (Default: BLEND_MASK.All.
|
||||
-- * `blendMask` - A mask of which bone groups to include in the animation (Default: BLEND_MASK.All).
|
||||
-- * `autoDisable` - If true, the animation will be immediately removed upon finishing, which means information will not be possible to query once completed. (Default: true)
|
||||
-- * `speed` - a floating point number >= 0, the speed at which the animation should play (default: 1)
|
||||
-- * `startKey` - the animation key at which the animation should start (default: "start")
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
-- model = types.Static.record(mgef.hitStatic).model,
|
||||
-- options = {
|
||||
-- vfxId = mgef.id,
|
||||
-- particuleTextureOverride = mgef.particle,
|
||||
-- particleTextureOverride = mgef.particle,
|
||||
-- loop = false,
|
||||
-- }
|
||||
-- })
|
||||
|
|
@ -254,7 +254,7 @@
|
|||
-- Can only be used on self.
|
||||
-- @function [parent=#animation] removeVfx
|
||||
-- @param openmw.core#GameObject actor
|
||||
-- @param #number vfxId an integer ID that uniquely identifies the VFX to remove
|
||||
-- @param #string vfxId a string ID that uniquely identifies the VFX to remove
|
||||
|
||||
---
|
||||
-- Removes all vfx from the actor.
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@
|
|||
|
||||
---
|
||||
-- Additional summand for the yaw angle; useful for camera shaking effects.
|
||||
-- Setting extra pitch doesn't block player input.
|
||||
-- Full yaw is `getYaw()+getExtraYaw()`.
|
||||
-- @function [parent=#camera] setExtraYaw
|
||||
-- @param #number value
|
||||
|
|
@ -122,7 +121,7 @@
|
|||
|
||||
---
|
||||
-- Additional summand for the roll angle; useful for camera shaking effects.
|
||||
-- Full yaw is `getRoll()+getExtraRoll()`.
|
||||
-- Full roll is `getRoll()+getExtraRoll()`.
|
||||
-- @function [parent=#camera] setExtraRoll
|
||||
-- @param #number value
|
||||
|
||||
|
|
@ -150,7 +149,7 @@
|
|||
---
|
||||
-- Set preferred offset between tracked position (see `getTrackedPosition`) and the camera focal point (the center of the screen) in third person mode.
|
||||
-- The offset is a 2d vector (X, Y) where X is horizontal (to the right from the character) and Y component is vertical (upward).
|
||||
-- The real offset can differ from the preferred one during smooth transition of if blocked by an obstacle.
|
||||
-- The real offset can differ from the preferred one during smooth transition or if blocked by an obstacle.
|
||||
-- Smooth transition happens by default every time when the preferred offset was changed. Use `instantTransition()` to skip the current transition.
|
||||
-- @function [parent=#camera] setFocalPreferredOffset
|
||||
-- @param openmw.util#Vector2 offset
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@
|
|||
-- * `pitch` - a floating point number >= 0, to set a sound pitch (default: 1);
|
||||
-- * `loop` - a boolean, to set if sound should be repeated when it ends (default: false);
|
||||
-- @usage local params = {
|
||||
-- timeOffset=0.1
|
||||
-- timeOffset=0.1,
|
||||
-- volume=0.3,
|
||||
-- loop=false,
|
||||
-- pitch=1.0
|
||||
|
|
@ -822,7 +822,7 @@
|
|||
-- * `pitch` - a floating point number >= 0, to set a sound pitch (default: 1);
|
||||
-- * `loop` - a boolean, to set if sound should be repeated when it ends (default: false);
|
||||
-- @usage local params = {
|
||||
-- timeOffset=0.1
|
||||
-- timeOffset=0.1,
|
||||
-- volume=0.3,
|
||||
-- loop=false,
|
||||
-- pitch=1.0
|
||||
|
|
|
|||
|
|
@ -1011,7 +1011,7 @@
|
|||
-- @param openmw.core#GameObject actor NPC object
|
||||
-- @param #string faction Faction ID
|
||||
-- @usage local NPC = require('openmw.types').NPC;
|
||||
-- NPC.clearExpell(player, "mages guild");
|
||||
-- NPC.clearExpelled(player, "mages guild");
|
||||
|
||||
---
|
||||
-- Check if NPC is expelled from given faction.
|
||||
|
|
|
|||
Loading…
Reference in a new issue