1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:53:50 +00:00

added script instruction pcraiserank. Does not work yet.

This commit is contained in:
gugus 2012-04-04 22:14:38 +02:00
parent 2c7c945208
commit aaa5368fe9
2 changed files with 20 additions and 10 deletions

View file

@ -127,4 +127,5 @@ op 0x2000141: GetWaterLevel
op 0x2000142: SetWaterLevel op 0x2000142: SetWaterLevel
op 0x2000143: ModWaterLevel op 0x2000143: ModWaterLevel
op 0x2000144: ToggleWater, twa op 0x2000144: ToggleWater, twa
opcodes 0x2000145-0x3ffffff unused op 0x2000145: PCRaiseRank
opcodes 0x2000146-0x3ffffff unused

View file

@ -17,6 +17,8 @@
#include "interpretercontext.hpp" #include "interpretercontext.hpp"
#include "ref.hpp" #include "ref.hpp"
#include "../mwdialogue/dialoguemanager.hpp"
namespace MWScript namespace MWScript
{ {
namespace Stats namespace Stats
@ -303,12 +305,18 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
std::cout << "try to rais rank...";
MWScript::InterpreterContext& context MWScript::InterpreterContext& context
= static_cast<MWScript::InterpreterContext&> (runtime.getContext()); = static_cast<MWScript::InterpreterContext&> (runtime.getContext());
std::string factionID = runtime.getStringLiteral (runtime[0].mInteger); std::string factionID = context.getEnvironment().mDialogueManager->getFaction();
runtime.pop(); if(factionID != "")
context.getEnvironment().mWorld->getPlayer().raiseRank(factionID); {
std::cout << "raiserank!!!!!";
MWWorld::Ptr player = context.getEnvironment().mWorld->getPlayer().getPlayer();
MWWorld::Class::get(player).getNpcStats(player).mFactionRank[factionID] = 1;
}
std::cout << std::endl;
} }
}; };
@ -342,8 +350,8 @@ namespace MWScript
const int opcodeSetSkillExplicit = 0x20000df; const int opcodeSetSkillExplicit = 0x20000df;
const int opcodeModSkill = 0x20000fa; const int opcodeModSkill = 0x20000fa;
const int opcodeModSkillExplicit = 0x2000115; const int opcodeModSkillExplicit = 0x2000115;
const int opcodePCJoinFaction = 0x2000141; //const int opcodePCJoinFaction = 0x2000141;
const int opcodePCRaiseRank = 0x2000142; const int opcodePCRaiseRank = 0x2000145;
void registerExtensions (Compiler::Extensions& extensions) void registerExtensions (Compiler::Extensions& extensions)
{ {
@ -415,8 +423,9 @@ namespace MWScript
extensions.registerInstruction (mod + skills[i], "l", extensions.registerInstruction (mod + skills[i], "l",
opcodeModSkill+i, opcodeModSkillExplicit+i); opcodeModSkill+i, opcodeModSkillExplicit+i);
} }
extensions.registerInstruction("PCJoinFaction","S",opcodePCJoinFaction); //extensions.registerInstruction("PCJoinFaction","S",opcodePCJoinFaction);
extensions.registerInstruction("PCRaiseRank","S",opcodePCRaiseRank); std::cout << "rgister raiserank";
extensions.registerInstruction("pcraiserank","",opcodePCRaiseRank);
} }
void installOpcodes (Interpreter::Interpreter& interpreter) void installOpcodes (Interpreter::Interpreter& interpreter)
@ -473,7 +482,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill<ExplicitRef> (i)); interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill<ExplicitRef> (i));
} }
interpreter.installSegment5(opcodePCJoinFaction,new OpPCJoinFaction); //interpreter.installSegment5(opcodePCJoinFaction,new OpPCJoinFaction);
interpreter.installSegment5(opcodePCRaiseRank,new OpPCRaiseRank); interpreter.installSegment5(opcodePCRaiseRank,new OpPCRaiseRank);
} }
} }