Trader Gold Reset Delay

Trade Time initialized to 0
Gold pot set correctly for npc’s and creatures
actorid
Jeffrey Haines 11 years ago
parent 2a8bf46607
commit 6896142db1

@ -124,12 +124,12 @@ namespace MWClass
data->mContainerStore = new MWWorld::ContainerStore();
// Relates to NPC gold reset delay
data->mCreatureStats.setTradeTime (MWBase::Environment::get().getWorld()->getTimeStamp());
data->mCreatureStats.setTradeTime(MWWorld::TimeStamp(0.0, 0));
data->mCreatureStats.setGoldPool(ref->mBase->mData.mGold);
// store
ptr.getRefData().setCustomData (data.release());
ptr.getRefData().setCustomData(data.release());
getContainerStore(ptr).fill(ref->mBase->mInventory, getId(ptr), "",
MWBase::Environment::get().getWorld()->getStore());

@ -358,7 +358,7 @@ namespace MWClass
MWBase::Environment::get().getWorld()->getStore());
// Relates to NPC gold reset delay
data->mNpcStats.setTradeTime(MWBase::Environment::get().getWorld()->getTimeStamp());
data->mNpcStats.setTradeTime(MWWorld::TimeStamp(0.0, 0));
data->mNpcStats.setGoldPool(gold);

@ -484,7 +484,6 @@ namespace MWGui
void TradeWindow::checkTradeTime()
{
MWWorld::ContainerStore store = mPtr.getClass().getContainerStore(mPtr);
MWWorld::LiveCellRef<ESM::NPC> *ref = mPtr.get<ESM::NPC>();
const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr);
double delay = boost::lexical_cast<double>(MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fBarterGoldResetDelay")->getInt());
@ -492,7 +491,7 @@ namespace MWGui
if (MWBase::Environment::get().getWorld()->getTimeStamp() >= sellerStats.getTradeTime() + delay)
{
addOrRemoveGold(-store.count(MWWorld::ContainerStore::sGoldId), mPtr);
addOrRemoveGold(+ref->mBase->mNpdt52.mGold, mPtr);
addOrRemoveGold(+sellerStats.getGoldPool(), mPtr);
}
}

Loading…
Cancel
Save