mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
Some enchanting fixes
This commit is contained in:
parent
cc8f7f238e
commit
86275e5bd4
12 changed files with 24 additions and 29 deletions
|
@ -16,7 +16,6 @@
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
@ -274,7 +273,7 @@ namespace MWClass
|
||||||
return ref->mBase->mEnchant;
|
return ref->mBase->mEnchant;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr 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 =
|
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||||
ptr.get<ESM::Armor>();
|
ptr.get<ESM::Armor>();
|
||||||
|
@ -285,8 +284,7 @@ namespace MWClass
|
||||||
newItem.mData.mEnchant=enchCharge;
|
newItem.mData.mEnchant=enchCharge;
|
||||||
newItem.mEnchant=enchId;
|
newItem.mEnchant=enchId;
|
||||||
const ESM::Armor *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
const ESM::Armor *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||||
MWWorld::ManualRef mref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
return record->mId;
|
||||||
return mref.getPtr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const
|
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace MWClass
|
||||||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
|
|
||||||
virtual MWWorld::Ptr 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;
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
const;
|
const;
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "../mwworld/actionread.hpp"
|
#include "../mwworld/actionread.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
@ -148,7 +147,7 @@ namespace MWClass
|
||||||
return ref->mBase->mEnchant;
|
return ref->mBase->mEnchant;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr 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 =
|
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||||
ptr.get<ESM::Book>();
|
ptr.get<ESM::Book>();
|
||||||
|
@ -160,8 +159,7 @@ namespace MWClass
|
||||||
newItem.mData.mEnchant=enchCharge;
|
newItem.mData.mEnchant=enchCharge;
|
||||||
newItem.mEnchant=enchId;
|
newItem.mEnchant=enchId;
|
||||||
const ESM::Book *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
const ESM::Book *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||||
MWWorld::ManualRef mref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
return record->mId;
|
||||||
return mref.getPtr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const
|
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace MWClass
|
||||||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
|
|
||||||
virtual MWWorld::Ptr 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;
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||||
///< Generate action for using via inventory menu
|
///< Generate action for using via inventory menu
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -222,7 +221,7 @@ namespace MWClass
|
||||||
return ref->mBase->mEnchant;
|
return ref->mBase->mEnchant;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr 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 =
|
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
@ -233,8 +232,7 @@ namespace MWClass
|
||||||
newItem.mData.mEnchant=enchCharge;
|
newItem.mData.mEnchant=enchCharge;
|
||||||
newItem.mEnchant=enchId;
|
newItem.mEnchant=enchId;
|
||||||
const ESM::Clothing *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
const ESM::Clothing *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||||
MWWorld::ManualRef mref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
return record->mId;
|
||||||
return mref.getPtr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
|
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace MWClass
|
||||||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
|
|
||||||
virtual MWWorld::Ptr 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;
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
const;
|
const;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
|
@ -362,7 +361,7 @@ namespace MWClass
|
||||||
return ref->mBase->mEnchant;
|
return ref->mBase->mEnchant;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr 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 =
|
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
@ -373,8 +372,7 @@ namespace MWClass
|
||||||
newItem.mData.mEnchant=enchCharge;
|
newItem.mData.mEnchant=enchCharge;
|
||||||
newItem.mEnchant=enchId;
|
newItem.mEnchant=enchId;
|
||||||
const ESM::Weapon *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
const ESM::Weapon *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||||
MWWorld::ManualRef mref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
return record->mId;
|
||||||
return mref.getPtr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const
|
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace MWClass
|
||||||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
|
|
||||||
virtual MWWorld::Ptr 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;
|
||||||
|
|
||||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||||
const;
|
const;
|
||||||
|
|
|
@ -254,6 +254,7 @@ namespace MWGui
|
||||||
mEnchanting.setEffect(mEffectList);
|
mEnchanting.setEffect(mEffectList);
|
||||||
|
|
||||||
mEnchanting.create();
|
mEnchanting.create();
|
||||||
|
mWindowManager.messageBox ("#{sEnchantmentMenu12}", std::vector<std::string>());
|
||||||
mWindowManager.removeGuiMode (GM_Enchanting);
|
mWindowManager.removeGuiMode (GM_Enchanting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
void Enchanting::create()
|
void Enchanting::create()
|
||||||
{
|
{
|
||||||
|
mOldItemPtr.getRefData().setCount(mOldItemPtr.getRefData().getCount()-1);
|
||||||
|
mSoulGemPtr.getRefData().setCount(mSoulGemPtr.getRefData().getCount()-1);
|
||||||
|
|
||||||
mEnchantment.mData.mCharge = getGemCharge();
|
mEnchantment.mData.mCharge = getGemCharge();
|
||||||
if(mEnchantType==3)
|
if(mEnchantType==3)
|
||||||
{
|
{
|
||||||
|
@ -57,14 +60,13 @@ namespace MWMechanics
|
||||||
mEnchantment.mEffects = mEffectList;
|
mEnchantment.mEffects = mEffectList;
|
||||||
const ESM::Enchantment *enchantment = MWBase::Environment::get().getWorld()->createRecord (mEnchantment);
|
const ESM::Enchantment *enchantment = MWBase::Environment::get().getWorld()->createRecord (mEnchantment);
|
||||||
|
|
||||||
MWWorld::Ptr newobj = MWWorld::Class::get(mOldItemPtr).applyEnchantment(mOldItemPtr, enchantment->mId, getGemCharge(), mNewItemName);
|
std::string newobjId = MWWorld::Class::get(mOldItemPtr).applyEnchantment(mOldItemPtr, enchantment->mId, getGemCharge(), mNewItemName);
|
||||||
|
|
||||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), newobj.getCellRef().mRefID);
|
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), newobjId);
|
||||||
newobj.mPtr = mOldItemPtr.mPtr;
|
MWWorld::Ptr newobjPtr = ref.getPtr();
|
||||||
MWWorld::Class::get (mEnchanter).getContainerStore (mEnchanter).add (ref.getPtr());
|
MWWorld::Ptr result = mOldItemPtr;
|
||||||
|
result.mPtr = newobjPtr.mPtr;
|
||||||
mOldItemPtr.getRefData().setCount(mOldItemPtr.getRefData().getCount()-1);
|
MWWorld::Class::get (mEnchanter).getContainerStore (mEnchanter).add (result);
|
||||||
mSoulGemPtr.getRefData().setCount(mSoulGemPtr.getRefData().getCount()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Enchanting::nextEnchantType()
|
void Enchanting::nextEnchantType()
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace MWWorld
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr Class::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
std::string Class::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error ("class can't be enchanted");
|
throw std::runtime_error ("class can't be enchanted");
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual MWWorld::Ptr 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;
|
||||||
|
|
||||||
virtual Ptr
|
virtual Ptr
|
||||||
copyToCell(const Ptr &ptr, CellStore &cell) const;
|
copyToCell(const Ptr &ptr, CellStore &cell) const;
|
||||||
|
|
Loading…
Reference in a new issue