mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 13:15:34 +00:00
Merge remote-tracking branch 'koncord/fix-gold-beh'
This commit is contained in:
commit
6e3032efc1
5 changed files with 31 additions and 17 deletions
|
@ -25,20 +25,16 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
bool isGold (const MWWorld::Ptr& ptr)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
bool Miscellaneous::isGold (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
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");
|
||||
}
|
||||
std::string Miscellaneous::getId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return ptr.get<ESM::Miscellaneous>()->mBase->mId;
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace MWClass
|
|||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
|
||||
virtual bool isKey (const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool isGold (const MWWorld::Ptr& ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,12 @@ namespace MWScript
|
|||
if (count == 0)
|
||||
return;
|
||||
|
||||
if(Misc::StringUtils::ciEqual(item, "gold_005")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_010")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_100"))
|
||||
item = "gold_001";
|
||||
|
||||
MWWorld::Ptr itemPtr = *ptr.getClass().getContainerStore (ptr).add (item, count, ptr);
|
||||
|
||||
// Spawn a messagebox (only for items added to player's inventory and if player is talking to someone)
|
||||
|
@ -91,6 +97,12 @@ namespace MWScript
|
|||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
if(Misc::StringUtils::ciEqual(item, "gold_005")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_010")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_100"))
|
||||
item = "gold_001";
|
||||
|
||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
||||
|
||||
runtime.push (store.count(item));
|
||||
|
@ -119,6 +131,12 @@ namespace MWScript
|
|||
if (count == 0)
|
||||
return;
|
||||
|
||||
if(Misc::StringUtils::ciEqual(item, "gold_005")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_010")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(item, "gold_100"))
|
||||
item = "gold_001";
|
||||
|
||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
||||
|
||||
std::string itemName;
|
||||
|
|
|
@ -284,6 +284,8 @@ namespace MWWorld
|
|||
|
||||
virtual bool isKey (const MWWorld::Ptr& ptr) const { return false; }
|
||||
|
||||
virtual bool isGold(const MWWorld::Ptr& ptr) const { return false; };
|
||||
|
||||
/// Get a blood texture suitable for \a ptr (see Blood Texture 0-2 in Morrowind.ini)
|
||||
virtual int getBloodTexture (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
|
|
|
@ -298,11 +298,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr,
|
|||
|
||||
// gold needs special handling: when it is inserted into a container, the base object automatically becomes Gold_001
|
||||
// this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold)
|
||||
if (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"))
|
||||
if(ptr.getClass().isGold(ptr))
|
||||
{
|
||||
int realCount = count * ptr.getClass().getValue(ptr);
|
||||
|
||||
|
|
Loading…
Reference in a new issue