Merge branch 'csicorruption' into 'master'

Allow ModPCCrimeLevel to clear crimes and cap bounties

Closes #7416

See merge request OpenMW/openmw!3664
macos_ci_fix
Alexei Kotov 1 year ago
commit d97563c830

@ -77,6 +77,7 @@
Bug #7380: NiZBufferProperty issue
Bug #7413: Generated wilderness cells don't spawn fish
Bug #7415: Unbreakable lock discrepancies
Bug #7416: Modpccrimelevel is different from vanilla
Bug #7428: AutoCalc flag is not used to calculate enchantment costs
Bug #7450: Evading obstacles does not work for actors missing certain animations
Bug #7459: Icons get stacked on the cursor when picking up multiple items simultaneously

@ -1152,7 +1152,7 @@ namespace MWMechanics
if (npcStats.getCrimeId() != -1)
{
// if you've paid for your crimes and I haven't noticed
if (npcStats.getCrimeId() <= world->getPlayer().getCrimeId())
if (npcStats.getCrimeId() <= world->getPlayer().getCrimeId() || playerStats.getBounty() <= 0)
{
// Calm witness down
if (ptr.getClass().isClass(ptr, "Guard"))

@ -1358,7 +1358,8 @@ namespace MWMechanics
if (reported)
{
player.getClass().getNpcStats(player).setBounty(player.getClass().getNpcStats(player).getBounty() + arg);
player.getClass().getNpcStats(player).setBounty(
std::max(0, player.getClass().getNpcStats(player).getBounty() + arg));
// If committing a crime against a faction member, expell from the faction
if (!victim.isEmpty() && victim.getClass().isNpc())
@ -1923,7 +1924,8 @@ namespace MWMechanics
if (reported)
{
npcStats.setBounty(npcStats.getBounty() + gmst.find("iWereWolfBounty")->mValue.getInteger());
npcStats.setBounty(
std::max(0, npcStats.getBounty() + gmst.find("iWereWolfBounty")->mValue.getInteger()));
}
}
}

@ -445,10 +445,12 @@ namespace MWScript
{
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(
static_cast<int>(runtime[0].mFloat) + player.getClass().getNpcStats(player).getBounty());
int bounty = std::max(
0, static_cast<int>(runtime[0].mFloat) + player.getClass().getNpcStats(player).getBounty());
player.getClass().getNpcStats(player).setBounty(bounty);
runtime.pop();
if (bounty == 0)
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
}
};

Loading…
Cancel
Save