From: Anders R. <ma...@us...> - 2005-11-20 20:58:10
|
Update of /cvsroot/planeshift/planeshift/src/server/bulkobjects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4902/src/server/bulkobjects Modified Files: dictionary.cpp dictionary.h Log Message: - Added "Run script <script name>" to quest_scripts. Allowing to run progression scripts on quest responses. Index: dictionary.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/dictionary.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** dictionary.cpp 19 Nov 2005 10:22:18 -0000 1.73 --- dictionary.cpp 20 Nov 2005 20:58:02 -0000 1.74 *************** *** 1426,1430 **** { psString resp = GetName(); ! resp.AppendFmt(" src=\"%s\"",scriptname.GetData()); if (p0 != 0) resp.AppendFmt(" param0=\"%f\"",p0); --- 1426,1430 ---- { psString resp = GetName(); ! resp.AppendFmt(" scr=\"%s\"",scriptname.GetData()); if (p0 != 0) resp.AppendFmt(" param0=\"%f\"",p0); *************** *** 1439,1460 **** bool RunScriptResponseOp::Run(gemNPC *who, Client *target,NpcResponse *owner) { ! ProgressionEvent *event = psserver->GetProgressionManager()->FindEvent(scriptname); ! if (!event) { ! Error2("Progression script '%s' was not found in the Progression Manager!",scriptname.GetData()); ! return true; } - MathScriptVar *var; - var = event->FindOrCreateVariable("Param0"); - if (var) - var->SetValue(p0); - var = event->FindOrCreateVariable("Param1"); - if (var) - var->SetValue(p1); - var = event->FindOrCreateVariable("Param2"); - if (var) - var->SetValue(p2); - event->Run(target->GetActor(),who,psserver->GetProgressionManager() ); return true; } --- 1439,1468 ---- bool RunScriptResponseOp::Run(gemNPC *who, Client *target,NpcResponse *owner) { ! if ((scriptname.GetDataSafe())[0] == '<') { ! psserver->GetProgressionManager()->ProcessScript(scriptname,target->GetActor(),who); ! } ! else ! { ! ProgressionEvent *event = psserver->GetProgressionManager()->FindEvent(scriptname); ! if (!event) ! { ! Error2("Progression script '%s' was not found in the Progression Manager!",scriptname.GetData()); ! return true; ! } ! MathScriptVar *var; ! var = event->FindOrCreateVariable("Param0"); ! if (var) ! var->SetValue(p0); ! var = event->FindOrCreateVariable("Param1"); ! if (var) ! var->SetValue(p1); ! var = event->FindOrCreateVariable("Param2"); ! if (var) ! var->SetValue(p2); ! ! event->Run(target->GetActor(),who,psserver->GetProgressionManager() ); } return true; } Index: dictionary.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/dictionary.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** dictionary.h 19 Nov 2005 10:22:18 -0000 1.39 --- dictionary.h 20 Nov 2005 20:58:02 -0000 1.40 *************** *** 462,466 **** public: ! RunScriptResponseOp() { name="runscript"; p0=p1=p2=0; } virtual ~RunScriptResponseOp() {}; virtual bool Load(iDocumentNode *node); --- 462,466 ---- public: ! RunScriptResponseOp() { name="run"; p0=p1=p2=0; } virtual ~RunScriptResponseOp() {}; virtual bool Load(iDocumentNode *node); |