示例#1
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWScript::InterpreterContext& context
                        = static_cast<MWScript::InterpreterContext&> (runtime.getContext());

                    std::string id = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);

                    if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr))
                    {
                        // health is a special case
                        Interpreter::Type_Integer value =
                            MWWorld::Class::get (ptr).getItemMaxHealth (ptr);
                        runtime.push (value);

                        return;
                    }

                    Interpreter::Type_Integer value =
                        MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
                        getCurrent();

                    runtime.push (value);
                }
示例#2
0
 virtual void execute (Interpreter::Runtime& runtime)
 {
     MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
     if (cell->getCell()->hasWater())
         runtime.push (cell->getWaterLevel());
     else
         runtime.push (-std::numeric_limits<float>().max());
 }
示例#3
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    if (!MWMechanics::getPlayer().isInCell())
                    {
                        runtime.push (0);
                        return;
                    }

                    bool interior =
                        !MWMechanics::getPlayer().getCell()->getCell()->isExterior();

                    runtime.push (interior ? 1 : 0);
                }
示例#4
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
                    {
                        runtime.push (0);
                        return;
                    }

                    bool interior =
                        !MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell()->isExterior();

                    runtime.push (interior ? 1 : 0);
                }
示例#5
0
 virtual void execute (Interpreter::Runtime& runtime)
 {
     if (!MWMechanics::getPlayer().isInCell())
     {
         runtime.push(0.f);
         return;
     }
     MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
     if (cell->getCell()->hasWater())
         runtime.push (cell->getWaterLevel());
     else
         runtime.push (-std::numeric_limits<float>::max());
 }
示例#6
0
                virtual void execute(Interpreter::Runtime &runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
                    MWWorld::ContainerStoreIterator it = invStore.getSlot (MWWorld::InventoryStore::Slot_CarriedRight);
                    if (it == invStore.end() || it->getTypeName () != typeid(ESM::Weapon).name())
                    {
                        runtime.push(-1);
                        return;
                    }

                    runtime.push(it->get<ESM::Weapon>()->mBase->mData.mType);
                }
示例#7
0
 virtual void execute (Interpreter::Runtime& runtime)
 {
     if (!MWMechanics::getPlayer().isInCell())
     {
         runtime.push(0.f);
         return;
     }
     MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
     if (cell->isExterior())
         runtime.push(0.f); // vanilla oddity, return 0 even though water is actually at -1
     else if (cell->getCell()->hasWater())
         runtime.push (cell->getWaterLevel());
     else
         runtime.push (-std::numeric_limits<float>::max());
 }
示例#8
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
                    runtime.push (stats.getMovementFlag (MWMechanics::CreatureStats::Flag_ForceSneak));
                }
示例#9
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    runtime.push(ptr.getClass().getCreatureStats (ptr).getAiSetting (
                                     (MWMechanics::CreatureStats::AiSetting)mIndex).getModified());
                }
示例#10
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    float param = runtime[0].mFloat;
                    runtime.pop();

                    runtime.push(std::sqrt (param));
                }
示例#11
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();

                    runtime.push (ptr.getClass().getNpcStats (ptr).isSameFaction (player.getClass().getNpcStats (player)));
                }
示例#12
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    Interpreter::Type_Integer value = ptr.getClass().getCreatureStats (ptr).getAiSequence().getLastRunTypeId();

                    runtime.push (value);
                }
示例#13
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    bool interior =
                        MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mData.mFlags &
                            ESM::Cell::Interior;

                    runtime.push (interior ? 1 : 0);
                }
示例#14
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);
                    std::string id = runtime.getStringLiteral(runtime[0].mInteger);
                    runtime.pop();

                    runtime.push(MWWorld::Class::get(ptr).getCreatureStats(ptr).getActiveSpells().isSpellActive(id));
                }
示例#15
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    Interpreter::Type_Integer value = MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().isPackageDone();

                    runtime.push (value);
                }
示例#16
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    MWMechanics::NpcStats& npcStats = MWWorld::Class::get(ptr).getNpcStats (ptr);

                    runtime.push (npcStats.getMovementFlag (MWMechanics::NpcStats::Flag_ForceSneak));
                }
示例#17
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    InterpreterContext& context =
                        static_cast<InterpreterContext&> (runtime.getContext());

                    MWWorld::Ptr ptr = context.getReference();

                    runtime.push (MWBase::Environment::get().getWindowManager()->readPressedButton());
                }
示例#18
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    InterpreterContext& context =
                        static_cast<InterpreterContext&> (runtime.getContext());

                    MWWorld::Ptr ptr = context.getReference();

                    runtime.push (context.hasBeenActivated (ptr));
                }
示例#19
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
                    const MWWorld::Class &cls = ptr.getClass();

                    bool isSneaking = MWBase::Environment::get().getMechanicsManager()->isSneaking(ptr);

                    runtime.push (isSneaking && cls.getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Sneak));
                }
示例#20
0
                virtual void execute(Interpreter::Runtime &runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    std::string item = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
                    for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot)
                    {
                        MWWorld::ContainerStoreIterator it = invStore.getSlot (slot);
                        if (it != invStore.end() && Misc::StringUtils::ciEqual(it->getCellRef().mRefID, item))
                        {
                            runtime.push(1);
                            return;
                        }
                    }
                    runtime.push(0);
                }
示例#21
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    int index = runtime[0].mInteger;
                    runtime.pop();

                    runtime.push (MWBase::Environment::get().getSoundManager()->getSoundPlaying (
                        ptr, runtime.getStringLiteral (index)));
                }
示例#22
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    std::string quest = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    int index = MWBase::Environment::get().getJournal()->getJournalIndex (quest);

                    runtime.push (index);

                }
示例#23
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    int key = runtime[0].mInteger;
                    runtime.pop();

                    runtime.push (MWWorld::Class::get(ptr).getCreatureStats (ptr).getMagicEffects ().get (
                                      MWMechanics::EffectKey(key)).mMagnitude > 0);
                }
示例#24
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    std::string objectID = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    MWMechanics::CreatureStats &stats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
                    runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject()));
                }
示例#25
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    Interpreter::Type_Integer value =
                        MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
                        getModified();

                    runtime.push (value);
                }
示例#26
0
            virtual void execute (Interpreter::Runtime& runtime)
            {
                std::string faction1 = runtime.getStringLiteral (runtime[0].mInteger);
                runtime.pop();

                std::string faction2 = runtime.getStringLiteral (runtime[0].mInteger);
                runtime.pop();

                runtime.push(MWBase::Environment::get().getDialogueManager()
                             ->getFactionReaction(faction1, faction2));
            }
示例#27
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    std::string name = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    if (!MWMechanics::getPlayer().isInCell())
                    {
                        runtime.push(0);
                        return;
                    }
                    const MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();

                    std::string current = MWBase::Environment::get().getWorld()->getCellName(cell);
                    Misc::StringUtils::lowerCaseInPlace(current);

                    bool match = current.length()>=name.length() &&
                        current.substr (0, name.length())==name;

                    runtime.push (match ? 1 : 0);
                }
示例#28
0
                virtual void execute(Interpreter::Runtime &runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);
      
		    const std::string &name = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
                    for (MWWorld::ContainerStoreIterator it = invStore.begin(MWWorld::ContainerStore::Type_Miscellaneous);
                         it != invStore.end(); ++it)
                    {

                        if (Misc::StringUtils::ciEqual(it->getCellRef().mSoul, name))
                        {
                            runtime.push(1);
                            return;
                        }
                    }
                    runtime.push(0);
                }
示例#29
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr observer = R()(runtime);
                    std::string actorID = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPtr(actorID, true);

                    if(!actor.getClass().isActor() || !observer.getClass().isActor())
                    {
                        runtime.push(0);
                        return;
                    }

                    Interpreter::Type_Integer value =
                            MWBase::Environment::get().getWorld()->getLOS(observer, actor) &&
                            MWBase::Environment::get().getMechanicsManager()->awarenessCheck(actor, observer);

                    runtime.push (value);
                }
示例#30
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    MWWorld::Ptr ptr = R()(runtime);

                    if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr))
                    {
                        // health is a special case
                        Interpreter::Type_Integer value =
                            MWWorld::Class::get (ptr).getItemMaxHealth (ptr);
                        runtime.push (value);

                        return;
                    }

                    Interpreter::Type_Integer value =
                        MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
                        getCurrent();

                    runtime.push (value);
                }