mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 16:06:44 +00:00
added bounty related scripting functions
This commit is contained in:
parent
5f523afa05
commit
bed8fb69e6
2 changed files with 56 additions and 1 deletions
|
@ -291,8 +291,11 @@ op 0x20001e8: RaiseRank
|
||||||
op 0x20001e9: RaiseRank, explicit
|
op 0x20001e9: RaiseRank, explicit
|
||||||
op 0x20001ea: LowerRank
|
op 0x20001ea: LowerRank
|
||||||
op 0x20001eb: LowerRank, explicit
|
op 0x20001eb: LowerRank, explicit
|
||||||
|
op 0x20001ec: GetPCCrimeLevel
|
||||||
|
op 0x20001ed: SetPCCrimeLevel
|
||||||
|
op 0x20001ee: SetPCCrimeLevel
|
||||||
|
|
||||||
opcodes 0x20001ec-0x3ffffff unused
|
opcodes 0x20001ef-0x3ffffff unused
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -392,6 +392,46 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpGetPCCrimeLevel : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||||
|
runtime.push (static_cast <Interpreter::Type_Float> (MWWorld::Class::get (player).getNpcStats (player).getBounty()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpSetPCCrimeLevel : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||||
|
|
||||||
|
MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat);
|
||||||
|
runtime.pop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpModPCCrimeLevel : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||||
|
|
||||||
|
MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat + MWWorld::Class::get (player).getNpcStats (player).getBounty());
|
||||||
|
runtime.pop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<class R>
|
template<class R>
|
||||||
class OpAddSpell : public Interpreter::Opcode0
|
class OpAddSpell : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
|
@ -1016,6 +1056,10 @@ namespace MWScript
|
||||||
const int opcodeModSkill = 0x20000fa;
|
const int opcodeModSkill = 0x20000fa;
|
||||||
const int opcodeModSkillExplicit = 0x2000115;
|
const int opcodeModSkillExplicit = 0x2000115;
|
||||||
|
|
||||||
|
const int opcodeGetPCCrimeLevel = 0x20001ec;
|
||||||
|
const int opcodeSetPCCrimeLevel = 0x20001ed;
|
||||||
|
const int opcodeModPCCrimeLevel = 0x20001ee;
|
||||||
|
|
||||||
const int opcodeAddSpell = 0x2000147;
|
const int opcodeAddSpell = 0x2000147;
|
||||||
const int opcodeAddSpellExplicit = 0x2000148;
|
const int opcodeAddSpellExplicit = 0x2000148;
|
||||||
const int opcodeRemoveSpell = 0x2000149;
|
const int opcodeRemoveSpell = 0x2000149;
|
||||||
|
@ -1141,6 +1185,10 @@ namespace MWScript
|
||||||
opcodeModSkill+i, opcodeModSkillExplicit+i);
|
opcodeModSkill+i, opcodeModSkillExplicit+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extensions.registerFunction ("getpccrimelevel", 'f', "", opcodeGetPCCrimeLevel);
|
||||||
|
extensions.registerInstruction ("setpccrimelevel", "f", opcodeSetPCCrimeLevel);
|
||||||
|
extensions.registerInstruction ("modpccrimelevel", "f", opcodeModPCCrimeLevel);
|
||||||
|
|
||||||
extensions.registerInstruction ("addspell", "c", opcodeAddSpell, opcodeAddSpellExplicit);
|
extensions.registerInstruction ("addspell", "c", opcodeAddSpell, opcodeAddSpellExplicit);
|
||||||
extensions.registerInstruction ("removespell", "c", opcodeRemoveSpell,
|
extensions.registerInstruction ("removespell", "c", opcodeRemoveSpell,
|
||||||
opcodeRemoveSpellExplicit);
|
opcodeRemoveSpellExplicit);
|
||||||
|
@ -1235,6 +1283,10 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill<ExplicitRef> (i));
|
interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill<ExplicitRef> (i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interpreter.installSegment5 (opcodeGetPCCrimeLevel, new OpGetPCCrimeLevel);
|
||||||
|
interpreter.installSegment5 (opcodeSetPCCrimeLevel, new OpSetPCCrimeLevel);
|
||||||
|
interpreter.installSegment5 (opcodeModPCCrimeLevel, new OpModPCCrimeLevel);
|
||||||
|
|
||||||
interpreter.installSegment5 (opcodeAddSpell, new OpAddSpell<ImplicitRef>);
|
interpreter.installSegment5 (opcodeAddSpell, new OpAddSpell<ImplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeAddSpellExplicit, new OpAddSpell<ExplicitRef>);
|
interpreter.installSegment5 (opcodeAddSpellExplicit, new OpAddSpell<ExplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeRemoveSpell, new OpRemoveSpell<ImplicitRef>);
|
interpreter.installSegment5 (opcodeRemoveSpell, new OpRemoveSpell<ImplicitRef>);
|
||||||
|
|
Loading…
Reference in a new issue