|
|
|
@ -7,6 +7,8 @@
|
|
|
|
|
#include <components/interpreter/runtime.hpp>
|
|
|
|
|
#include <components/interpreter/opcodes.hpp>
|
|
|
|
|
|
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
|
|
|
|
|
#include "interpretercontext.hpp"
|
|
|
|
|
|
|
|
|
|
namespace MWScript
|
|
|
|
@ -26,8 +28,10 @@ namespace MWScript
|
|
|
|
|
MWScript::InterpreterContext& context
|
|
|
|
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value =
|
|
|
|
|
context.getReference().getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
getModified();
|
|
|
|
|
|
|
|
|
|
runtime.push (value);
|
|
|
|
@ -50,8 +54,10 @@ namespace MWScript
|
|
|
|
|
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value =
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
getModified();
|
|
|
|
|
|
|
|
|
|
runtime.push (value);
|
|
|
|
@ -74,7 +80,9 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
context.getReference().getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
setModified (value, 0);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -98,7 +106,9 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
setModified (value, 0);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -119,10 +129,12 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
value += context.getReference().getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
value += MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
getModified();
|
|
|
|
|
|
|
|
|
|
context.getReference().getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
setModified (value, 0, 100);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -146,11 +158,13 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
value +=
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
getModified();
|
|
|
|
|
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats().mAttributes[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
|
|
|
|
setModified (value, 0, 100);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -168,6 +182,8 @@ namespace MWScript
|
|
|
|
|
MWScript::InterpreterContext& context
|
|
|
|
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
if (mIndex==0)
|
|
|
|
|
{
|
|
|
|
|
// health is a special case
|
|
|
|
@ -196,7 +212,7 @@ namespace MWScript
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value =
|
|
|
|
|
context.getReference().getCreatureStats().mDynamic[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
|
|
|
|
getCurrent();
|
|
|
|
|
|
|
|
|
|
runtime.push (value);
|
|
|
|
@ -219,6 +235,8 @@ namespace MWScript
|
|
|
|
|
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
if (mIndex==0)
|
|
|
|
|
{
|
|
|
|
|
// health is a special case
|
|
|
|
@ -247,7 +265,7 @@ namespace MWScript
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value =
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats().mDynamic[mIndex].
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
|
|
|
|
getCurrent();
|
|
|
|
|
|
|
|
|
|
runtime.push (value);
|
|
|
|
@ -270,7 +288,9 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
context.getReference().getCreatureStats().mDynamic[mIndex].
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
|
|
|
|
setModified (value, 0);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -294,7 +314,9 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats().mDynamic[mIndex].
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
|
|
|
|
setModified (value, 0);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -315,7 +337,9 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = context.getReference().getCreatureStats();
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
|
|
|
|
|
|
|
|
@ -345,8 +369,10 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats =
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats();
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
|
|
|
|
|
|
|
|
@ -374,7 +400,9 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = context.getReference().getCreatureStats();
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
|
|
|
|
|
|
|
|
@ -401,8 +429,10 @@ namespace MWScript
|
|
|
|
|
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats =
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats();
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
|
|
|
|
|
|
|
|
@ -423,7 +453,9 @@ namespace MWScript
|
|
|
|
|
MWScript::InterpreterContext& context
|
|
|
|
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = context.getReference().getCreatureStats();
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Float value = 0;
|
|
|
|
|
|
|
|
|
@ -452,8 +484,10 @@ namespace MWScript
|
|
|
|
|
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
|
|
|
|
runtime.pop();
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats =
|
|
|
|
|
context.getWorld().getPtr (id, false).getCreatureStats();
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Float value = 0;
|
|
|
|
|
|
|
|
|
|