|
|
@ -60,7 +60,7 @@ namespace
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ESM::LevelledListBase::LevelItem item;
|
|
|
|
ESM::LevelledListBase::LevelItem item;
|
|
|
|
item.mId = {itemId.begin(), itemId.end()};
|
|
|
|
item.mId = std::string{itemId};
|
|
|
|
item.mLevel = level;
|
|
|
|
item.mLevel = level;
|
|
|
|
list->mList.push_back(item);
|
|
|
|
list->mList.push_back(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -206,13 +206,13 @@ namespace MWScript
|
|
|
|
|
|
|
|
|
|
|
|
void execute (Interpreter::Runtime& runtime) override
|
|
|
|
void execute (Interpreter::Runtime& runtime) override
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string_view name = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string name{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
bool allowSkipping = runtime[0].mInteger != 0;
|
|
|
|
bool allowSkipping = runtime[0].mInteger != 0;
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->playVideo({name.begin(), name.end()}, allowSkipping);
|
|
|
|
MWBase::Environment::get().getWindowManager()->playVideo (name, allowSkipping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -560,7 +560,7 @@ namespace MWScript
|
|
|
|
char *end;
|
|
|
|
char *end;
|
|
|
|
long key = strtol(effect.data(), &end, 10);
|
|
|
|
long key = strtol(effect.data(), &end, 10);
|
|
|
|
if(key < 0 || key > 32767 || *end != '\0')
|
|
|
|
if(key < 0 || key > 32767 || *end != '\0')
|
|
|
|
key = ESM::MagicEffect::effectStringToId({effect.begin(), effect.end()});
|
|
|
|
key = ESM::MagicEffect::effectStringToId({effect});
|
|
|
|
|
|
|
|
|
|
|
|
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
|
|
|
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
|
|
|
|
|
|
|
|
|
|
@ -587,8 +587,7 @@ namespace MWScript
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
|
|
|
|
std::string_view creatureView = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string creature{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
std::string creature{creatureView.begin(), creatureView.end()};
|
|
|
|
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
std::string_view gem = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string_view gem = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
@ -600,7 +599,7 @@ namespace MWScript
|
|
|
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
store.get<ESM::Creature>().find(creature); // This line throws an exception if it can't find the creature
|
|
|
|
store.get<ESM::Creature>().find(creature); // This line throws an exception if it can't find the creature
|
|
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr item = *ptr.getClass().getContainerStore(ptr).add({gem.begin(), gem.end()}, 1, ptr);
|
|
|
|
MWWorld::Ptr item = *ptr.getClass().getContainerStore(ptr).add(gem, 1, ptr);
|
|
|
|
|
|
|
|
|
|
|
|
// Set the soul on just one of the gems, not the whole stack
|
|
|
|
// Set the soul on just one of the gems, not the whole stack
|
|
|
|
item.getContainerStore()->unstack(item, ptr);
|
|
|
|
item.getContainerStore()->unstack(item, ptr);
|
|
|
@ -1214,16 +1213,16 @@ namespace MWScript
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
|
|
|
|
std::string_view spellId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string spellId{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
std::string targetId = ::Misc::StringUtils::lowerCase(runtime.getStringLiteral(runtime[0].mInteger));
|
|
|
|
std::string targetId = ::Misc::StringUtils::lowerCase(runtime.getStringLiteral(runtime[0].mInteger));
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search({spellId.begin(), spellId.end()});
|
|
|
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(spellId);
|
|
|
|
if (!spell)
|
|
|
|
if (!spell)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
runtime.getContext().report("spellcasting failed: cannot find spell \""+std::string{spellId.begin(), spellId.end()}+"\"");
|
|
|
|
runtime.getContext().report("spellcasting failed: cannot find spell \""+spellId+"\"");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1263,13 +1262,13 @@ namespace MWScript
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
MWWorld::Ptr ptr = R()(runtime);
|
|
|
|
|
|
|
|
|
|
|
|
std::string_view spellId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string spellId{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search({spellId.begin(), spellId.end()});
|
|
|
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(spellId);
|
|
|
|
if (!spell)
|
|
|
|
if (!spell)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
runtime.getContext().report("spellcasting failed: cannot find spell \""+std::string{spellId.begin(), spellId.end()}+"\"");
|
|
|
|
runtime.getContext().report("spellcasting failed: cannot find spell \""+spellId+"\"");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1426,14 +1425,14 @@ namespace MWScript
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string_view levId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string levId{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
std::string_view creatureId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string_view creatureId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
ESM::CreatureLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::CreatureLevList>().find({levId.begin(), levId.end()});
|
|
|
|
ESM::CreatureLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::CreatureLevList>().find(levId);
|
|
|
|
addToLevList(&listCopy, creatureId, level);
|
|
|
|
addToLevList(&listCopy, creatureId, level);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1444,14 +1443,14 @@ namespace MWScript
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string_view levId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string levId{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
std::string_view creatureId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string_view creatureId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
ESM::CreatureLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::CreatureLevList>().find({levId.begin(), levId.end()});
|
|
|
|
ESM::CreatureLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::CreatureLevList>().find(levId);
|
|
|
|
removeFromLevList(&listCopy, creatureId, level);
|
|
|
|
removeFromLevList(&listCopy, creatureId, level);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1462,14 +1461,14 @@ namespace MWScript
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string_view levId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string levId{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
std::string_view itemId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string_view itemId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
ESM::ItemLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::ItemLevList>().find({levId.begin(), levId.end()});
|
|
|
|
ESM::ItemLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::ItemLevList>().find(levId);
|
|
|
|
addToLevList(&listCopy, itemId, level);
|
|
|
|
addToLevList(&listCopy, itemId, level);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1480,14 +1479,14 @@ namespace MWScript
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
void execute(Interpreter::Runtime &runtime) override
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string_view levId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string levId{runtime.getStringLiteral(runtime[0].mInteger)};
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
std::string_view itemId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
std::string_view itemId = runtime.getStringLiteral(runtime[0].mInteger);
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
int level = runtime[0].mInteger;
|
|
|
|
runtime.pop();
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
|
|
ESM::ItemLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::ItemLevList>().find({levId.begin(), levId.end()});
|
|
|
|
ESM::ItemLevList listCopy = *MWBase::Environment::get().getWorld()->getStore().get<ESM::ItemLevList>().find(levId);
|
|
|
|
removeFromLevList(&listCopy, itemId, level);
|
|
|
|
removeFromLevList(&listCopy, itemId, level);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(listCopy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|