|
|
|
@ -950,7 +950,6 @@ namespace MWMechanics
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
const MWWorld::CellRef& cellref = target.getCellRef();
|
|
|
|
|
|
|
|
|
|
// there is no harm to use unlocked doors
|
|
|
|
|
int lockLevel = cellref.getLockLevel();
|
|
|
|
|
if (target.getClass().isDoor() &&
|
|
|
|
@ -1030,7 +1029,7 @@ namespace MWMechanics
|
|
|
|
|
if (isAllowedToUse(ptr, bed, victim))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if(commitCrime(ptr, victim, OT_SleepingInOwnedBed))
|
|
|
|
|
if(commitCrime(ptr, victim, OT_SleepingInOwnedBed, bed.getCellRef().getFaction()))
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage64}");
|
|
|
|
|
return true;
|
|
|
|
@ -1044,7 +1043,7 @@ namespace MWMechanics
|
|
|
|
|
MWWorld::Ptr victim;
|
|
|
|
|
if (isAllowedToUse(ptr, item, victim))
|
|
|
|
|
return;
|
|
|
|
|
commitCrime(ptr, victim, OT_Trespassing);
|
|
|
|
|
commitCrime(ptr, victim, OT_Trespassing, item.getCellRef().getFaction());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::pair<std::string, int> > MechanicsManager::getStolenItemOwners(const std::string& itemid)
|
|
|
|
@ -1125,7 +1124,7 @@ namespace MWMechanics
|
|
|
|
|
// move items from player to owner and report about theft
|
|
|
|
|
victim.getClass().getContainerStore(victim).add(item, toRemove, victim);
|
|
|
|
|
store.remove(item, toRemove, player);
|
|
|
|
|
commitCrime(player, victim, OT_Theft, item.getClass().getValue(item) * toRemove);
|
|
|
|
|
commitCrime(player, victim, OT_Theft, item.getCellRef().getFaction(), item.getClass().getValue(item) * toRemove);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MechanicsManager::confiscateStolenItems(const MWWorld::Ptr &player, const MWWorld::Ptr &targetContainer)
|
|
|
|
@ -1212,11 +1211,11 @@ namespace MWMechanics
|
|
|
|
|
mStolenItems[Misc::StringUtils::lowerCase(item.getCellRef().getRefId())][owner] += count;
|
|
|
|
|
}
|
|
|
|
|
if (alarm)
|
|
|
|
|
commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count);
|
|
|
|
|
commitCrime(ptr, victim, OT_Theft, ownerCellRef->getFaction(), item.getClass().getValue(item) * count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MechanicsManager::commitCrime(const MWWorld::Ptr &player, const MWWorld::Ptr &victim, OffenseType type, int arg, bool victimAware)
|
|
|
|
|
bool MechanicsManager::commitCrime(const MWWorld::Ptr &player, const MWWorld::Ptr &victim, OffenseType type, const std::string& factionId, int arg, bool victimAware)
|
|
|
|
|
{
|
|
|
|
|
// NOTE: victim may be empty
|
|
|
|
|
|
|
|
|
@ -1263,13 +1262,13 @@ namespace MWMechanics
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (crimeSeen)
|
|
|
|
|
reportCrime(player, victim, type, arg);
|
|
|
|
|
reportCrime(player, victim, type, factionId, arg);
|
|
|
|
|
else if (type == OT_Assault && !victim.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
bool reported = false;
|
|
|
|
|
if (victim.getClass().isClass(victim, "guard")
|
|
|
|
|
&& !victim.getClass().getCreatureStats(victim).getAiSequence().hasPackage(AiPackage::TypeIdPursue))
|
|
|
|
|
reported = reportCrime(player, victim, type, arg);
|
|
|
|
|
reported = reportCrime(player, victim, type, std::string(), arg);
|
|
|
|
|
|
|
|
|
|
if (!reported)
|
|
|
|
|
startCombat(victim, player); // TODO: combat should be started with an "unaware" flag, which makes the victim flee?
|
|
|
|
@ -1300,7 +1299,7 @@ namespace MWMechanics
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MechanicsManager::reportCrime(const MWWorld::Ptr &player, const MWWorld::Ptr &victim, OffenseType type, int arg)
|
|
|
|
|
bool MechanicsManager::reportCrime(const MWWorld::Ptr &player, const MWWorld::Ptr &victim, OffenseType type, const std::string& factionId, int arg)
|
|
|
|
|
{
|
|
|
|
|
const MWWorld::Store<ESM::GameSetting>& store = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
|
|
|
|
|
|
|
|
@ -1471,6 +1470,14 @@ namespace MWMechanics
|
|
|
|
|
player.getClass().getNpcStats(player).expell(factionID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!factionId.empty())
|
|
|
|
|
{
|
|
|
|
|
const std::map<std::string, int>& playerRanks = player.getClass().getNpcStats(player).getFactionRanks();
|
|
|
|
|
if (playerRanks.find(Misc::StringUtils::lowerCase(factionId)) != playerRanks.end())
|
|
|
|
|
{
|
|
|
|
|
player.getClass().getNpcStats(player).expell(factionId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type == OT_Assault && !victim.isEmpty()
|
|
|
|
|
&& !victim.getClass().getCreatureStats(victim).getAiSequence().isInCombat(player)
|
|
|
|
|