2018-04-12 11:18:19 +00:00
|
|
|
#include <components/openmw-mp/Log.hpp>
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
|
|
|
#include "../mwworld/worldimp.hpp"
|
|
|
|
|
|
|
|
#include "RecordHelper.hpp"
|
|
|
|
|
|
|
|
bool RecordHelper::doesCreatureExist(const std::string& refId)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
return world->getStore().get<ESM::Creature>().search(refId);
|
|
|
|
}
|
|
|
|
|
2018-04-13 05:37:06 +00:00
|
|
|
bool RecordHelper::doesRaceExist(const std::string& raceId)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
return world->getStore().get<ESM::Race>().search(raceId);
|
|
|
|
}
|
|
|
|
|
2018-04-12 11:18:19 +00:00
|
|
|
std::string RecordHelper::createCreatureRecord(const ESM::Creature& creature)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
return world->createRecord(creature)->mId;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string RecordHelper::createNpcRecord(const ESM::NPC& npc)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
return world->createRecord(npc)->mId;
|
|
|
|
}
|
|
|
|
|
2018-07-26 18:01:59 +00:00
|
|
|
void RecordHelper::overrideCreatureRecord(const ESM::Creature& creature)
|
2018-04-12 11:18:19 +00:00
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
2018-07-26 18:01:59 +00:00
|
|
|
world->getModifiableStore().overrideRecord(creature);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RecordHelper::overrideNpcRecord(const ESM::NPC& npc)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
2018-04-12 11:18:19 +00:00
|
|
|
|
2018-07-26 18:01:59 +00:00
|
|
|
world->getModifiableStore().overrideRecord(npc);
|
2018-04-12 11:18:19 +00:00
|
|
|
}
|
|
|
|
|
2018-07-26 18:01:59 +00:00
|
|
|
void RecordHelper::overrideEnchantmentRecord(const ESM::Enchantment& enchantment)
|
2018-04-12 11:18:19 +00:00
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
2018-07-26 18:01:59 +00:00
|
|
|
world->getModifiableStore().overrideRecord(enchantment);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RecordHelper::overridePotionRecord(const ESM::Potion& potion)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
world->getModifiableStore().overrideRecord(potion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RecordHelper::overrideSpellRecord(const ESM::Spell& spell)
|
|
|
|
{
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
2018-04-12 11:18:19 +00:00
|
|
|
|
2018-07-26 18:01:59 +00:00
|
|
|
world->getModifiableStore().overrideRecord(spell);
|
2018-04-12 11:18:19 +00:00
|
|
|
}
|