|
|
|
@ -2453,111 +2453,6 @@ namespace MWWorld
|
|
|
|
|
mRendering->rebuildPtr(getPlayerPtr());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void World::setWerewolf(const MWWorld::Ptr& actor, bool werewolf)
|
|
|
|
|
{
|
|
|
|
|
MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats(actor);
|
|
|
|
|
|
|
|
|
|
// The actor does not have to change state
|
|
|
|
|
if (npcStats.isWerewolf() == werewolf)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (actor == getPlayerPtr())
|
|
|
|
|
{
|
|
|
|
|
if (werewolf)
|
|
|
|
|
{
|
|
|
|
|
mPlayer->saveSkillsAttributes();
|
|
|
|
|
mPlayer->setWerewolfSkillsAttributes();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
mPlayer->restoreSkillsAttributes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
npcStats.setWerewolf(werewolf);
|
|
|
|
|
|
|
|
|
|
// This is a bit dangerous. Equipped items other than WerewolfRobe may reference
|
|
|
|
|
// bones that do not even exist with the werewolf object root.
|
|
|
|
|
// Therefore, make sure to unequip everything at once, and only fire the change event
|
|
|
|
|
// (which will rebuild the animation parts) afterwards. unequipAll will do this for us.
|
|
|
|
|
MWWorld::InventoryStore& invStore = actor.getClass().getInventoryStore(actor);
|
|
|
|
|
invStore.unequipAll(actor);
|
|
|
|
|
|
|
|
|
|
if(werewolf)
|
|
|
|
|
{
|
|
|
|
|
InventoryStore &inv = actor.getClass().getInventoryStore(actor);
|
|
|
|
|
|
|
|
|
|
inv.equip(InventoryStore::Slot_Robe, inv.ContainerStore::add("werewolfrobe", 1, actor), actor);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
actor.getClass().getContainerStore(actor).remove("werewolfrobe", 1, actor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NpcAnimation::updateParts will already rebuild the animation when it detects change of Npc type.
|
|
|
|
|
// the following is just for reattaching the camera properly.
|
|
|
|
|
mRendering->rebuildPtr(actor);
|
|
|
|
|
|
|
|
|
|
if(actor == getPlayerPtr())
|
|
|
|
|
{
|
|
|
|
|
// Update the GUI only when called on the player
|
|
|
|
|
MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager();
|
|
|
|
|
|
|
|
|
|
if (werewolf)
|
|
|
|
|
{
|
|
|
|
|
windowManager->forceHide(MWGui::GW_Inventory);
|
|
|
|
|
windowManager->forceHide(MWGui::GW_Magic);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
windowManager->unsetForceHide(MWGui::GW_Inventory);
|
|
|
|
|
windowManager->unsetForceHide(MWGui::GW_Magic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
windowManager->setWerewolfOverlay(werewolf);
|
|
|
|
|
|
|
|
|
|
// Witnesses of the player's transformation will make them a globally known werewolf
|
|
|
|
|
std::vector<MWWorld::Ptr> closeActors;
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(actor.getRefData().getPosition().asVec3(),
|
|
|
|
|
getStore().get<ESM::GameSetting>().search("fAlarmRadius")->getFloat(),
|
|
|
|
|
closeActors);
|
|
|
|
|
|
|
|
|
|
bool detected = false, reported = false;
|
|
|
|
|
for (std::vector<MWWorld::Ptr>::const_iterator it = closeActors.begin(); it != closeActors.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
if (*it == actor)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!it->getClass().isNpc())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (getLOS(*it, actor) && MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor, *it))
|
|
|
|
|
detected = true;
|
|
|
|
|
if (it->getClass().getCreatureStats(*it).getAiSetting(MWMechanics::CreatureStats::AI_Alarm).getModified() > 0)
|
|
|
|
|
reported = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (detected)
|
|
|
|
|
{
|
|
|
|
|
windowManager->messageBox("#{sWerewolfAlarmMessage}");
|
|
|
|
|
setGlobalInt("pcknownwerewolf", 1);
|
|
|
|
|
|
|
|
|
|
if (reported)
|
|
|
|
|
{
|
|
|
|
|
npcStats.setBounty(npcStats.getBounty()+
|
|
|
|
|
mStore.get<ESM::GameSetting>().find("iWereWolfBounty")->getInt());
|
|
|
|
|
windowManager->messageBox("#{sCrimeMessage}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void World::applyWerewolfAcrobatics(const Ptr &actor)
|
|
|
|
|
{
|
|
|
|
|
const Store<ESM::GameSetting> &gmst = getStore().get<ESM::GameSetting>();
|
|
|
|
|
MWMechanics::NpcStats &stats = actor.getClass().getNpcStats(actor);
|
|
|
|
|
|
|
|
|
|
stats.getSkill(ESM::Skill::Acrobatics).setBase(gmst.find("fWerewolfAcrobatics")->getInt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool World::getGodModeState()
|
|
|
|
|
{
|
|
|
|
|
return mGodMode;
|
|
|
|
|