mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
include library.factions;
|
|
include library.quests;
|
|
include library.utils;
|
|
|
|
trigger OnQuestActivated(int questRow)
|
|
{
|
|
if(quests.isMyQuest(questRow, "quest.task.set_faction"))
|
|
{
|
|
boolean success = false;
|
|
String questName = quests.getDataEntry(questRow, "NAME");
|
|
String targetObjVarName = "quest." + questName + ".target";
|
|
String factionName = null;
|
|
if(hasObjVar(self, targetObjVarName))
|
|
{
|
|
factionName = getStringObjVar(self, targetObjVarName);
|
|
}
|
|
else
|
|
{
|
|
factionName = quests.getDataEntry(questRow, "TARGET");
|
|
}
|
|
|
|
if(factionName != null && factionName.length() > 0)
|
|
{
|
|
String parameterObjVarName = "quest." + questName + ".parameter";
|
|
int factionPoints = 0;
|
|
if(hasObjVar(self, parameterObjVarName))
|
|
{
|
|
factionPoints = getIntObjVar(self, parameterObjVarName);
|
|
}
|
|
else
|
|
{
|
|
String factionPointsString = quests.getDataEntry(questRow, "PARAMETER");
|
|
if(factionPointsString != null && factionPointsString.length() > 0)
|
|
{
|
|
factionPoints = utils.stringToInt(factionPointsString);
|
|
}
|
|
}
|
|
|
|
factions.setFactionStanding(self, factionName, factionPoints);
|
|
success = true;
|
|
}
|
|
else
|
|
{
|
|
LOG("newquests", "failed to retrieve a faction name from object variable (" + targetObjVarName + ") or from the TARGET column at quest row " + questRow + " in quests.tab");
|
|
}
|
|
quests.complete(questName, self, success);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|