1153 lines
48 KiB
Plaintext
1153 lines
48 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: TRUE Random Task Generator
|
|
//:: rtg_i0_generic
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This file is the main processing center for the RTG. Task element storage
|
|
task generation and rewarding are all handled via calls to functions here.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Nathan 'yibble' Reynolds
|
|
//:: Created On: 10/11/2002
|
|
//:://////////////////////////////////////////////
|
|
|
|
//void main(){} // Uncomment to permit debug compiles.
|
|
|
|
//////////////////////////////////////////////////
|
|
// The structures that holds the information for a task
|
|
//////////////////////////////////////////////////
|
|
struct RTG_TaskData {
|
|
int nType; // Type of task.
|
|
int nCR; // Challenge rating of task.
|
|
int nActive; // Flag the task as Active.
|
|
int nSpawnerInstance;// Instance of Spawner.
|
|
int nRewardItemNum; // Number of stacked reward items.
|
|
int nRewardGold; // NOT USED: Gold reward for completing task.
|
|
int nRewardXP; // NOT USED: Experience reward for completing task.
|
|
int nNumItems; // Currently used only in Harvest tasks.
|
|
|
|
string sItemRef; // Blueprint reference of item for task.
|
|
string sItemName; // Name reference of item for task.
|
|
string sItemTag; // Blueprint reference of item for task.
|
|
|
|
string sAntagonistRef; // Blueprint reference of antagonsist in task.
|
|
string sAntagonistName; // Name reference of antagonsist in task.
|
|
string sProtagonistRef; // Blueprint reference of protagonsist in task.
|
|
string sProtagonistName;// Name reference of protagonsist in task.
|
|
|
|
string sText; // Text that is spoken by NPCs.
|
|
|
|
string sSpawnerLoc; // Name of Spawners parent area.
|
|
|
|
string sRewardItemRef; // Blueprint of item reward for completing task.
|
|
string sRewardItemName; // Name of item reward for completing task.
|
|
};
|
|
|
|
struct RTG_TaskPhraseData {
|
|
int nType; // Type of task.
|
|
string sText; // Text of the task.
|
|
};
|
|
|
|
struct RTG_TaskReplyPhraseData {
|
|
int nType; // Type of task.
|
|
string sText; // Text of the task.
|
|
};
|
|
|
|
struct RTG_TaskCompletePhraseData {
|
|
int nType; // Type of task.
|
|
string sText; // Text of the task.
|
|
};
|
|
|
|
struct RTG_TaskItemData {
|
|
int nCR; // Challenge rating of item.
|
|
string sRef; // Blueprint reference of item for task.
|
|
string sTag; // Tag of task item.
|
|
string sName; // Name of item.
|
|
};
|
|
|
|
struct RTG_TaskAntagonistData {
|
|
int nCR; // Challenge rating of item.
|
|
int nType; // Antagonists have types now!
|
|
string sRef; // Blueprint reference of item for task.
|
|
string sName; // Name of antagonist.
|
|
};
|
|
|
|
struct RTG_TaskProtagonistData {
|
|
int nCR; // Challenge rating of item.
|
|
string sRef; // Blueprint reference of item for task.
|
|
string sName; // Name of protagonist.
|
|
};
|
|
|
|
struct RTG_RewardItemData {
|
|
int nCR; // Challenge rating of item.
|
|
int nNum; // Number of stacked reward items.
|
|
string sRef; // Blueprint reference of item for task.
|
|
string sName; // Name of reward item.
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// These are the prototypes of all the public functions
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Gets the number of start phrases that are in the system.
|
|
int Private_GetTaskPhraseCount();
|
|
|
|
// Gets the number of reply phrases that are in the system.
|
|
int Private_GetTaskReplyPhraseCount();
|
|
|
|
// Gets the number of completion phrases that are in the system.
|
|
int Private_GetTaskCompletePhraseCount();
|
|
|
|
// NOT USED: Gets the number of active tasks that are in the system.
|
|
int Private_GetTaskCount();
|
|
|
|
// Gets the number of target items that are in the system.
|
|
int Private_GetTaskItemCount();
|
|
|
|
// Gets the number of antagonsists that are in the system.
|
|
int Private_GetAntagonistCount();
|
|
|
|
// Gets the number of protagonsists that are in the system.
|
|
int Private_GetProtagonistCount();
|
|
|
|
// Gets the number of reward items that are in the system.
|
|
int Private_GetRewardItemCount();
|
|
|
|
// Gets the number of related spawners that are in the system.
|
|
int Private_GetVeryEasyHostileSpawnerCount();
|
|
|
|
// Gets the number of related spawners that are in the system.
|
|
int Private_GetVeryEasyFriendlySpawnerCount();
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// These are the prototypes of all the private functions
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Sets the number of start phrases that are in the system.
|
|
void Private_SetTaskPhraseCount(int nValue);
|
|
|
|
// Sets the number of reply phrases that are in the system.
|
|
void Private_SetTaskReplyPhraseCount(int nValue);
|
|
|
|
// Sets the number of completion phrases that are in the system.
|
|
void Private_SetTaskCompletePhraseCount(int nValue);
|
|
|
|
// NOT USED: Sets the number of active tasks that are in the system.
|
|
void Private_SetTaskCount(int nValue);
|
|
|
|
// Sets the number of target items that are in the system.
|
|
void Private_SetItemCount(int nValue);
|
|
|
|
// Sets the number of antagonsists that are in the system.
|
|
void Private_SetAntagonistCount(int nValue);
|
|
|
|
// Sets the number of protagonsists that are in the system.
|
|
void Private_SetProtagonistCount(int nValue);
|
|
|
|
// Sets the number of reward items that are in the system.
|
|
void Private_SetRewardItemCount(int nValue);
|
|
|
|
// Sets the number of related spawners that are in the system.
|
|
void Private_SetVeryEasyHostileSpawnerCount(int nValue);
|
|
|
|
// Sets the number of related spawners that are in the system.
|
|
void Private_SetVeryEasyFriendlySpawnerCount(int nValue);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_TaskPhraseData Private_GetTaskPhrase(int nIndex);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_TaskItemData Private_GetTaskItem(int nIndex);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_TaskAntagonistData Private_GetAntagonist(int nIndex);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_TaskProtagonistData Private_GetProtagonist(int nIndex);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_RewardItemData Private_GetRewardItem(int nIndex);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_TaskReplyPhraseData Private_GetTaskReplyPhrase(int nIndex);
|
|
|
|
// Get a specific element from the system.
|
|
struct RTG_TaskCompletePhraseData Private_GetTaskCompletePhrase(int nIndex);
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Constants.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "rtg_i0_const"
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Public Functions.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
void DebugMessage(string sMessage)
|
|
{
|
|
PrintString(sMessage);
|
|
}
|
|
|
|
void RTG_CreateTaskGenerator()
|
|
{
|
|
Private_SetTaskPhraseCount(0);
|
|
Private_SetTaskReplyPhraseCount(0);
|
|
Private_SetTaskCompletePhraseCount(0);
|
|
Private_SetTaskCount(0);
|
|
Private_SetItemCount(0);
|
|
Private_SetAntagonistCount(0);
|
|
Private_SetProtagonistCount(0);
|
|
Private_SetRewardItemCount(0);
|
|
|
|
// Count Very Easy Hostile Spawners.
|
|
int nCount = 0;
|
|
object oSpawner = GetObjectByTag("RTG_VEASY_SPWN_HOS", 0);
|
|
|
|
while(GetIsObjectValid(oSpawner))
|
|
{
|
|
nCount ++;
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_HOS", nCount);
|
|
}
|
|
Private_SetVeryEasyHostileSpawnerCount(nCount --);
|
|
|
|
// Count Very Easy Friendly Spawners.
|
|
nCount = 0;
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_FRE", 0);
|
|
|
|
while(GetIsObjectValid(oSpawner))
|
|
{
|
|
nCount ++;
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_FRE", nCount);
|
|
}
|
|
Private_SetVeryEasyFriendlySpawnerCount(nCount --);
|
|
}
|
|
|
|
string ParseText(string sOriginalPhrase, string sLabel, string sItemName)
|
|
{
|
|
int nPosition = FindSubString(sOriginalPhrase, sLabel);
|
|
|
|
if(!nPosition)
|
|
return sOriginalPhrase;
|
|
|
|
return GetSubString(sOriginalPhrase, 0, nPosition) + sItemName + GetSubString(sOriginalPhrase, nPosition + GetStringLength(sLabel), GetStringLength(sOriginalPhrase));
|
|
}
|
|
|
|
void RTG_AddTaskPhraseData (struct RTG_TaskPhraseData newTaskPhraseData)
|
|
{
|
|
int nPhrases;
|
|
nPhrases = Private_GetTaskPhraseCount();
|
|
|
|
string sPhraseIndex = IntToString(nPhrases);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sTaskPhraseText" + sPhraseIndex, newTaskPhraseData.sText);
|
|
SetLocalInt(oModule, "RTG_sTaskPhraseType" + sPhraseIndex, newTaskPhraseData.nType);
|
|
|
|
Private_SetTaskPhraseCount(nPhrases + 1);
|
|
}
|
|
|
|
void RTG_AddTaskReplyPhraseData (struct RTG_TaskReplyPhraseData newTaskReplyPhraseData)
|
|
{
|
|
int nPhrases;
|
|
nPhrases = Private_GetTaskReplyPhraseCount();
|
|
|
|
string sPhraseIndex = IntToString(nPhrases);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sTaskReplyPhraseText" + sPhraseIndex, newTaskReplyPhraseData.sText);
|
|
SetLocalInt(oModule, "RTG_sTaskReplyPhraseType" + sPhraseIndex, newTaskReplyPhraseData.nType);
|
|
|
|
Private_SetTaskReplyPhraseCount(nPhrases + 1);
|
|
}
|
|
|
|
void RTG_AddTaskCompletePhraseData (struct RTG_TaskCompletePhraseData newTaskCompletePhraseData)
|
|
{
|
|
int nPhrases;
|
|
nPhrases = Private_GetTaskCompletePhraseCount();
|
|
|
|
string sPhraseIndex = IntToString(nPhrases);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sTaskCompletePhraseText" + sPhraseIndex, newTaskCompletePhraseData.sText);
|
|
SetLocalInt(oModule, "RTG_sTaskCompletePhraseType" + sPhraseIndex, newTaskCompletePhraseData.nType);
|
|
|
|
Private_SetTaskCompletePhraseCount(nPhrases + 1);
|
|
}
|
|
|
|
void RTG_AddTaskItemData (struct RTG_TaskItemData newTaskItemData)
|
|
{
|
|
int nItems;
|
|
nItems = Private_GetTaskItemCount();
|
|
|
|
string sItemIndex = IntToString(nItems);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sTaskItemRef" + sItemIndex, newTaskItemData.sRef);
|
|
SetLocalString(oModule, "RTG_sTaskItemTag" + sItemIndex, newTaskItemData.sTag);
|
|
SetLocalString(oModule, "RTG_sTaskItemName" + sItemIndex, newTaskItemData.sName);
|
|
SetLocalInt(oModule, "RTG_sTaskItemCR" + sItemIndex, newTaskItemData.nCR);
|
|
|
|
Private_SetItemCount(nItems + 1);
|
|
}
|
|
|
|
void RTG_AddAntagonistData (struct RTG_TaskAntagonistData newAntagonistData)
|
|
{
|
|
int nAntagonists;
|
|
nAntagonists = Private_GetAntagonistCount();
|
|
|
|
string sAntagonistIndex = IntToString(nAntagonists);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sAntagonistRef" + sAntagonistIndex, newAntagonistData.sRef);
|
|
SetLocalString(oModule, "RTG_sAntagonistName" + sAntagonistIndex, newAntagonistData.sName);
|
|
SetLocalInt(oModule, "RTG_sAntagonistCR" + sAntagonistIndex, newAntagonistData.nCR);
|
|
SetLocalInt(oModule, "RTG_sAntagonistType" + sAntagonistIndex, newAntagonistData.nType);
|
|
|
|
Private_SetAntagonistCount(nAntagonists + 1);
|
|
}
|
|
|
|
void RTG_AddProtagonistData (struct RTG_TaskProtagonistData newProtagonistData)
|
|
{
|
|
int nProtagonists;
|
|
nProtagonists = Private_GetProtagonistCount();
|
|
|
|
string sProtagonistIndex = IntToString(nProtagonists);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sProtagonistRef" + sProtagonistIndex, newProtagonistData.sRef);
|
|
SetLocalString(oModule, "RTG_sProtagonistName" + sProtagonistIndex, newProtagonistData.sName);
|
|
SetLocalInt(oModule, "RTG_sProtagonistCR" + sProtagonistIndex, newProtagonistData.nCR);
|
|
|
|
Private_SetProtagonistCount(nProtagonists + 1);
|
|
}
|
|
|
|
void RTG_AddRewardItemData (struct RTG_RewardItemData newRewardItemData)
|
|
{
|
|
int nRewardItems;
|
|
nRewardItems = Private_GetRewardItemCount();
|
|
|
|
string sRewardItemIndex = IntToString(nRewardItems);
|
|
object oModule = GetModule();
|
|
|
|
SetLocalString(oModule, "RTG_sRewardItemRef" + sRewardItemIndex, newRewardItemData.sRef);
|
|
SetLocalString(oModule, "RTG_sRewardItemName" + sRewardItemIndex, newRewardItemData.sName);
|
|
SetLocalInt(oModule, "RTG_sRewardItemCR" + sRewardItemIndex, newRewardItemData.nCR);
|
|
SetLocalInt(oModule, "RTG_sRewardItemNum" + sRewardItemIndex, newRewardItemData.nNum);
|
|
|
|
Private_SetRewardItemCount(nRewardItems + 1);
|
|
}
|
|
|
|
struct RTG_TaskData RTG_GetTask(int nCRMustMatch = 0, int nCRExclude = 0, int nCRMayMatch = 0, int nTaskTypeMustMatch = 0, int nTaskTypeExclude = 0, int nTaskTypeMayMatch = 0)
|
|
{
|
|
//int nActiveTasks = Private_GetTaskCount();
|
|
int nPhrases = Private_GetTaskPhraseCount();
|
|
int nTaskItems = Private_GetTaskItemCount();
|
|
int nAntagonists = Private_GetAntagonistCount();
|
|
int nProtagonists = Private_GetProtagonistCount();
|
|
int nRewardItems = Private_GetRewardItemCount();
|
|
|
|
DebugMessage("RTG_GetTask() nPhrases = " + IntToString(nPhrases));
|
|
DebugMessage("RTG_GetTask() nTaskItems = " + IntToString(nTaskItems));
|
|
DebugMessage("RTG_GetTask() nAntagonists = " + IntToString(nAntagonists));
|
|
DebugMessage("RTG_GetTask() nProtagonists = " + IntToString(nProtagonists));
|
|
DebugMessage("RTG_GetTask() nRewardItems = " + IntToString(nRewardItems));
|
|
|
|
int nStart, i;
|
|
|
|
struct RTG_TaskData retTaskData;
|
|
struct RTG_TaskPhraseData curTaskPhraseData;
|
|
struct RTG_TaskItemData curTaskItemData;
|
|
struct RTG_TaskAntagonistData curTaskAntagonistData;
|
|
struct RTG_TaskProtagonistData curTaskProtagonistData;
|
|
struct RTG_RewardItemData curRewardItemData;
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Find a task item.
|
|
////////////////////////////////////////////////////////////////////////////
|
|
nStart = Random(nTaskItems);
|
|
//nStart = 0;
|
|
for (i=nStart; i<nTaskItems; i++)
|
|
{
|
|
curTaskItemData = Private_GetTaskItem(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nCRMustMatch & curTaskItemData.nCR) != nCRMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nCRMayMatch != RTG_CHALLENGE_RATING_NONE && (nCRMayMatch & curTaskItemData.nCR) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nCRExclude & curTaskItemData.nCR) != RTG_CHALLENGE_RATING_NONE)
|
|
continue;
|
|
|
|
// This item matches all the criteria, save it so it can be return in case all of them
|
|
// fail the 25% roll by some chance
|
|
|
|
DebugMessage("RTG_GetTask() curTaskItemData.sRef(" + IntToString(i) + ") = " + curTaskItemData.sRef);
|
|
|
|
if (curTaskItemData.sRef != "")
|
|
{
|
|
retTaskData.sItemRef = curTaskItemData.sRef;
|
|
retTaskData.sItemTag = curTaskItemData.sTag;
|
|
retTaskData.sItemName = curTaskItemData.sName;
|
|
DebugMessage("RTG_GetTask() " + curTaskItemData.sName);
|
|
break;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Find an Antagonist.
|
|
////////////////////////////////////////////////////////////////////////////
|
|
nStart = Random(nAntagonists);
|
|
//nStart = 0;
|
|
for (i=nStart; i<nAntagonists; i++)
|
|
{
|
|
curTaskAntagonistData = Private_GetAntagonist(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nCRMustMatch & curTaskAntagonistData.nCR) != nCRMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nCRMayMatch != RTG_CHALLENGE_RATING_NONE && (nCRMayMatch & curTaskAntagonistData.nCR) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nCRExclude & curTaskAntagonistData.nCR) != RTG_CHALLENGE_RATING_NONE)
|
|
continue;
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nTaskTypeMustMatch & curTaskAntagonistData.nType) != nTaskTypeMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nTaskTypeMayMatch != RTG_TASK_TYPE_NONE && (nTaskTypeMayMatch & curTaskAntagonistData.nType) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nTaskTypeExclude & curTaskAntagonistData.nType) != RTG_TASK_TYPE_NONE)
|
|
continue;
|
|
|
|
|
|
|
|
// This item matches all the criteria, save it so it can be return in case all of them
|
|
// fail the 25% roll by some chance
|
|
|
|
DebugMessage("RTG_GetTask() curTaskAntagonistData.sRef(" + IntToString(i) + ") = " + curTaskAntagonistData.sRef);
|
|
|
|
if (curTaskAntagonistData.sRef != "")
|
|
{
|
|
retTaskData.sAntagonistRef = curTaskAntagonistData.sRef;
|
|
retTaskData.sAntagonistName = curTaskAntagonistData.sName;
|
|
retTaskData.nCR = curTaskAntagonistData.nCR;
|
|
DebugMessage("RTG_GetTask() " + curTaskAntagonistData.sName);
|
|
break;
|
|
}
|
|
}
|
|
if(retTaskData.sAntagonistRef == "")
|
|
{
|
|
nStart = 0;
|
|
for (i=nStart; i<nAntagonists; i++)
|
|
{
|
|
curTaskAntagonistData = Private_GetAntagonist(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nCRMustMatch & curTaskAntagonistData.nCR) != nCRMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nCRMayMatch != RTG_CHALLENGE_RATING_NONE && (nCRMayMatch & curTaskAntagonistData.nCR) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nCRExclude & curTaskAntagonistData.nCR) != RTG_CHALLENGE_RATING_NONE)
|
|
continue;
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nTaskTypeMustMatch & curTaskAntagonistData.nType) != nTaskTypeMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nTaskTypeMayMatch != RTG_TASK_TYPE_NONE && (nTaskTypeMayMatch & curTaskAntagonistData.nType) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nTaskTypeExclude & curTaskAntagonistData.nType) != RTG_TASK_TYPE_NONE)
|
|
continue;
|
|
|
|
DebugMessage("RTG_GetTask() curTaskAntagonistData.sRef(" + IntToString(i) + ") = " + curTaskAntagonistData.sRef);
|
|
|
|
if (curTaskAntagonistData.sRef != "")
|
|
{
|
|
retTaskData.sAntagonistRef = curTaskAntagonistData.sRef;
|
|
retTaskData.sAntagonistName = curTaskAntagonistData.sName;
|
|
retTaskData.nCR = curTaskAntagonistData.nCR;
|
|
DebugMessage("RTG_GetTask() " + curTaskAntagonistData.sName);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Find an Protagonist.
|
|
////////////////////////////////////////////////////////////////////////////
|
|
nStart = Random(nProtagonists);
|
|
//nStart = 0;
|
|
for (i=nStart; i<nProtagonists; i++)
|
|
{
|
|
curTaskProtagonistData = Private_GetProtagonist(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nCRMustMatch & curTaskProtagonistData.nCR) != nCRMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nCRMayMatch != RTG_CHALLENGE_RATING_NONE && (nCRMayMatch & curTaskProtagonistData.nCR) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nCRExclude & curTaskProtagonistData.nCR) != RTG_CHALLENGE_RATING_NONE)
|
|
continue;
|
|
|
|
// This item matches all the criteria, save it so it can be return in case all of them
|
|
// fail the 25% roll by some chance
|
|
|
|
DebugMessage("RTG_GetTask() curTaskProtagonistData.sRef(" + IntToString(i) + ") = " + curTaskProtagonistData.sRef);
|
|
|
|
if (curTaskAntagonistData.sRef != "")
|
|
{
|
|
retTaskData.sProtagonistRef = curTaskProtagonistData.sRef;
|
|
retTaskData.sProtagonistName = curTaskProtagonistData.sName;
|
|
retTaskData.nCR = curTaskProtagonistData.nCR;
|
|
DebugMessage("RTG_GetTask() " + curTaskProtagonistData.sName);
|
|
break;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Find a Reward Item.
|
|
////////////////////////////////////////////////////////////////////////////
|
|
nStart = Random(nRewardItems);
|
|
//nStart = 0;
|
|
for (i=nStart; i<nRewardItems; i++)
|
|
{
|
|
curRewardItemData = Private_GetRewardItem(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nCRMustMatch & curRewardItemData.nCR) != nCRMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nCRMayMatch != RTG_CHALLENGE_RATING_NONE && (nCRMayMatch & curRewardItemData.nCR) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nCRExclude & curRewardItemData.nCR) != RTG_CHALLENGE_RATING_NONE)
|
|
continue;
|
|
|
|
// This item matches all the criteria, save it so it can be return in case all of them
|
|
// fail the 25% roll by some chance
|
|
|
|
DebugMessage("RTG_GetTask() curRewardItemData.sRef(" + IntToString(i) + ") = " + curRewardItemData.sRef);
|
|
|
|
if (curRewardItemData.sRef != "")
|
|
{
|
|
retTaskData.sRewardItemRef = curRewardItemData.sRef;
|
|
retTaskData.sRewardItemName = curRewardItemData.sName;
|
|
retTaskData.nRewardItemNum = curRewardItemData.nNum;
|
|
|
|
DebugMessage("RTG_GetTask() " + curRewardItemData.sName);
|
|
break;
|
|
}
|
|
}
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Find a task phrase.
|
|
////////////////////////////////////////////////////////////////////////////
|
|
nStart = Random(nPhrases);
|
|
//nStart = 0;
|
|
for (i=nStart; i<nPhrases; i++)
|
|
{
|
|
curTaskPhraseData = Private_GetTaskPhrase(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nTaskTypeMustMatch & curTaskPhraseData.nType) != nTaskTypeMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nTaskTypeMayMatch != RTG_TASK_TYPE_NONE && (nTaskTypeMayMatch & curTaskPhraseData.nType) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nTaskTypeExclude & curTaskPhraseData.nType) != RTG_TASK_TYPE_NONE)
|
|
continue;
|
|
|
|
// This item matches all the criteria, save it so it can be return in case all of them
|
|
// fail the 25% roll by some chance
|
|
|
|
DebugMessage("RTG_GetTask() curTaskPhraseData.sText(" + IntToString(i) + ") = " + curTaskPhraseData.sText);
|
|
|
|
if (curTaskPhraseData.sText != "")
|
|
{
|
|
//Pick a Spawner.
|
|
if(retTaskData.nCR == RTG_CHALLENGE_RATING_VERY_EASY && curTaskPhraseData.nType == RTG_TASK_TYPE_KILLNSTEAL)
|
|
{
|
|
object oSpawner;
|
|
retTaskData.nSpawnerInstance = Random(Private_GetVeryEasyHostileSpawnerCount());
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_HOS", retTaskData.nSpawnerInstance);
|
|
DebugMessage("RTG_GetTask() Spawner Instance = " + IntToString(retTaskData.nSpawnerInstance));
|
|
retTaskData.sSpawnerLoc = GetName(GetArea(oSpawner));
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%item%", retTaskData.sItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%antagonist%", retTaskData.sAntagonistName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%reward%", retTaskData.sRewardItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%location%", retTaskData.sSpawnerLoc);
|
|
}
|
|
else if(retTaskData.nCR == RTG_CHALLENGE_RATING_VERY_EASY && curTaskPhraseData.nType == RTG_TASK_TYPE_DELIVERY)
|
|
{
|
|
object oSpawner;
|
|
retTaskData.nSpawnerInstance = Random(Private_GetVeryEasyFriendlySpawnerCount());
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_FRE", retTaskData.nSpawnerInstance);
|
|
DebugMessage("RTG_GetTask() Spawner Instance = " + IntToString(retTaskData.nSpawnerInstance));
|
|
retTaskData.sSpawnerLoc = GetName(GetArea(oSpawner));
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%item%", retTaskData.sItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%reward%", retTaskData.sRewardItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%location%", retTaskData.sSpawnerLoc);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%protagonist%", retTaskData.sProtagonistName);
|
|
}
|
|
else if(retTaskData.nCR == RTG_CHALLENGE_RATING_VERY_EASY && curTaskPhraseData.nType == RTG_TASK_TYPE_HARVEST)
|
|
{
|
|
object oSpawner;
|
|
retTaskData.nSpawnerInstance = Random(Private_GetVeryEasyHostileSpawnerCount());
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_HOS", retTaskData.nSpawnerInstance);
|
|
DebugMessage("RTG_GetTask() Spawner Instance = " + IntToString(retTaskData.nSpawnerInstance));
|
|
retTaskData.sSpawnerLoc = GetName(GetArea(oSpawner));
|
|
retTaskData.nNumItems = 1 + Random(5);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%numitem%", IntToString(retTaskData.nNumItems));
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%item%", retTaskData.sItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%antagonist%", retTaskData.sAntagonistName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%reward%", retTaskData.sRewardItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%location%", retTaskData.sSpawnerLoc);
|
|
}
|
|
// Parse the text for labels initialise the task.
|
|
|
|
retTaskData.nType = curTaskPhraseData.nType;
|
|
retTaskData.sText = curTaskPhraseData.sText;
|
|
|
|
retTaskData.nActive = TRUE;
|
|
|
|
//DebugMessage("RTG_GetTask() " + curTaskPhraseData.sText);
|
|
break;
|
|
}
|
|
}
|
|
// EMERGENCY. Couldn't find relevant phrase, start from the beginning!
|
|
if(retTaskData.sText == "")
|
|
{
|
|
nStart = 0;
|
|
for (i=nStart; i<nPhrases; i++)
|
|
{
|
|
curTaskPhraseData = Private_GetTaskPhrase(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if ((nTaskTypeMustMatch & curTaskPhraseData.nType) != nTaskTypeMustMatch)
|
|
continue;
|
|
|
|
// If we are looking for a item that matches one or more of the following
|
|
// but does not match any then go to the next item
|
|
if (nTaskTypeMayMatch != RTG_TASK_TYPE_NONE && (nTaskTypeMayMatch & curTaskPhraseData.nType) == 0)
|
|
continue;
|
|
|
|
// If this item is part of an excluded category, goto the next item
|
|
if ((nTaskTypeExclude & curTaskPhraseData.nType) != RTG_TASK_TYPE_NONE)
|
|
continue;
|
|
|
|
// This item matches all the criteria, save it so it can be return in case all of them
|
|
// fail the 25% roll by some chance
|
|
|
|
DebugMessage("RTG_GetTask() curTaskPhraseData.sText(" + IntToString(i) + ") = " + curTaskPhraseData.sText);
|
|
|
|
if (curTaskPhraseData.sText != "")
|
|
{
|
|
//Pick a Spawner.
|
|
if(retTaskData.nCR == RTG_CHALLENGE_RATING_VERY_EASY && curTaskPhraseData.nType == RTG_TASK_TYPE_KILLNSTEAL)
|
|
{
|
|
object oSpawner;
|
|
retTaskData.nSpawnerInstance = Random(Private_GetVeryEasyHostileSpawnerCount());
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_HOS", retTaskData.nSpawnerInstance);
|
|
DebugMessage("RTG_GetTask() Spawner Instance = " + IntToString(retTaskData.nSpawnerInstance));
|
|
retTaskData.sSpawnerLoc = GetName(GetArea(oSpawner));
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%item%", retTaskData.sItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%antagonist%", retTaskData.sAntagonistName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%reward%", retTaskData.sRewardItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%location%", retTaskData.sSpawnerLoc);
|
|
}
|
|
else if(retTaskData.nCR == RTG_CHALLENGE_RATING_VERY_EASY && curTaskPhraseData.nType == RTG_TASK_TYPE_DELIVERY)
|
|
{
|
|
object oSpawner;
|
|
retTaskData.nSpawnerInstance = Random(Private_GetVeryEasyFriendlySpawnerCount());
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_FRE", retTaskData.nSpawnerInstance);
|
|
DebugMessage("RTG_GetTask() Spawner Instance = " + IntToString(retTaskData.nSpawnerInstance));
|
|
retTaskData.sSpawnerLoc = GetName(GetArea(oSpawner));
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%item%", retTaskData.sItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%reward%", retTaskData.sRewardItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%location%", retTaskData.sSpawnerLoc);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%protagonist%", retTaskData.sProtagonistName);
|
|
}
|
|
else if(retTaskData.nCR == RTG_CHALLENGE_RATING_VERY_EASY && curTaskPhraseData.nType == RTG_TASK_TYPE_HARVEST)
|
|
{
|
|
object oSpawner;
|
|
retTaskData.nSpawnerInstance = Random(Private_GetVeryEasyHostileSpawnerCount());
|
|
oSpawner = GetObjectByTag("RTG_VEASY_SPWN_HOS", retTaskData.nSpawnerInstance);
|
|
DebugMessage("RTG_GetTask() Spawner Instance = " + IntToString(retTaskData.nSpawnerInstance));
|
|
retTaskData.sSpawnerLoc = GetName(GetArea(oSpawner));
|
|
retTaskData.nNumItems = 1 + Random(5);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%numitem%", IntToString(retTaskData.nNumItems));
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%item%", retTaskData.sItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%antagonist%", retTaskData.sAntagonistName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%reward%", retTaskData.sRewardItemName);
|
|
curTaskPhraseData.sText = ParseText(curTaskPhraseData.sText, "%location%", retTaskData.sSpawnerLoc);
|
|
}
|
|
// Parse the text for labels initialise the task.
|
|
|
|
retTaskData.nType = curTaskPhraseData.nType;
|
|
retTaskData.sText = curTaskPhraseData.sText;
|
|
|
|
retTaskData.nActive = TRUE;
|
|
|
|
//DebugMessage("RTG_GetTask() " + curTaskPhraseData.sText);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return retTaskData;
|
|
}
|
|
|
|
struct RTG_TaskCompletePhraseData RTG_CompletedTask(object oPC)
|
|
{
|
|
int nPhrases = Private_GetTaskCompletePhraseCount();
|
|
|
|
DebugMessage("RTG_CompletedTask() nPhrases = " + IntToString(nPhrases));
|
|
|
|
int nStart, i;
|
|
int nType = GetLocalInt(oPC, "RTG_TaskType");
|
|
|
|
struct RTG_TaskCompletePhraseData curTaskCompletePhraseData;
|
|
struct RTG_TaskCompletePhraseData ret;
|
|
|
|
// Find a task item.
|
|
nStart = Random(nPhrases);
|
|
for (i=nStart; i<nPhrases; i++)
|
|
{
|
|
curTaskCompletePhraseData = Private_GetTaskCompletePhrase(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if (curTaskCompletePhraseData.nType != nType)
|
|
continue;
|
|
|
|
if (curTaskCompletePhraseData.sText != "" && curTaskCompletePhraseData.nType == RTG_TASK_TYPE_KILLNSTEAL)
|
|
{
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%antagonist%", GetLocalString(oPC, "RTG_AntagonistName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%reward%", GetLocalString(oPC, "RTG_RewardItemName"));
|
|
ret = curTaskCompletePhraseData;
|
|
break;
|
|
}
|
|
else if (curTaskCompletePhraseData.sText != "" && curTaskCompletePhraseData.nType == RTG_TASK_TYPE_DELIVERY)
|
|
{
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%protagonist%", GetLocalString(oPC, "RTG_ProtagonistName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%reward%", GetLocalString(oPC, "RTG_RewardItemName"));
|
|
ret = curTaskCompletePhraseData;
|
|
break;
|
|
}
|
|
else if (curTaskCompletePhraseData.sText != "" && curTaskCompletePhraseData.nType == RTG_TASK_TYPE_HARVEST)
|
|
{
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%antagonist%", GetLocalString(oPC, "RTG_AntagonistName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%reward%", GetLocalString(oPC, "RTG_RewardItemName"));
|
|
ret = curTaskCompletePhraseData;
|
|
break;
|
|
}
|
|
}
|
|
// EMERGENCY. Couldn't find relevant phrase, start from the beginning!
|
|
if(ret.sText == "")
|
|
{
|
|
nStart = 0;
|
|
for (i=nStart; i<nPhrases; i++)
|
|
{
|
|
curTaskCompletePhraseData = Private_GetTaskCompletePhrase(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if (curTaskCompletePhraseData.nType != nType)
|
|
continue;
|
|
|
|
if (curTaskCompletePhraseData.sText != "" && curTaskCompletePhraseData.nType == RTG_TASK_TYPE_KILLNSTEAL)
|
|
{
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%antagonist%", GetLocalString(oPC, "RTG_AntagonistName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%reward%", GetLocalString(oPC, "RTG_RewardItemName"));
|
|
ret = curTaskCompletePhraseData;
|
|
break;
|
|
}
|
|
else if (curTaskCompletePhraseData.sText != "" && curTaskCompletePhraseData.nType == RTG_TASK_TYPE_DELIVERY)
|
|
{
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%protagonist%", GetLocalString(oPC, "RTG_ProtagonistName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%reward%", GetLocalString(oPC, "RTG_RewardItemName"));
|
|
ret = curTaskCompletePhraseData;
|
|
break;
|
|
}
|
|
else if (curTaskCompletePhraseData.sText != "" && curTaskCompletePhraseData.nType == RTG_TASK_TYPE_HARVEST)
|
|
{
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%antagonist%", GetLocalString(oPC, "RTG_AntagonistName"));
|
|
curTaskCompletePhraseData.sText = ParseText(curTaskCompletePhraseData.sText, "%reward%", GetLocalString(oPC, "RTG_RewardItemName"));
|
|
ret = curTaskCompletePhraseData;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//Award and Clean up Player.
|
|
object oRewardItem;
|
|
string sRewardItemResRef = GetLocalString(oPC, "RTG_RewardItemRef");
|
|
int sRewardItemNum = GetLocalInt(oPC, "RTG_RewardItemNum");
|
|
|
|
|
|
DestroyObject(GetItemPossessedBy(oPC, GetLocalString(oPC, "RTG_ItemTag")));
|
|
oRewardItem = CreateItemOnObject(sRewardItemResRef, oPC, sRewardItemNum);
|
|
|
|
if(sRewardItemResRef == "nw_it_gold001")
|
|
GiveXPToCreature(oPC, sRewardItemNum);
|
|
else
|
|
GiveXPToCreature(oPC, GetGoldPieceValue(oRewardItem));
|
|
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_TaskReplyPhraseData RTG_ReplyTask(object oPC)
|
|
{
|
|
int nPhrases = Private_GetTaskReplyPhraseCount();
|
|
|
|
DebugMessage("RTG_CompletedTask() nPhrases = " + IntToString(nPhrases));
|
|
|
|
int nStart, i;
|
|
int nType = GetLocalInt(oPC, "RTG_TaskType");
|
|
|
|
struct RTG_TaskReplyPhraseData curTaskReplyPhraseData;
|
|
struct RTG_TaskReplyPhraseData ret;
|
|
|
|
// Find a task item.
|
|
nStart = Random(nPhrases);
|
|
for (i=nStart; i<nPhrases; i++)
|
|
{
|
|
curTaskReplyPhraseData = Private_GetTaskReplyPhrase(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if (curTaskReplyPhraseData.nType != nType)
|
|
continue;
|
|
|
|
if (curTaskReplyPhraseData.sText != "" && curTaskReplyPhraseData.nType == RTG_TASK_TYPE_DELIVERY)
|
|
{
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%assignedby%", GetLocalString(oPC, "RTG_AssignedByName"));
|
|
ret = curTaskReplyPhraseData;
|
|
break;
|
|
}
|
|
else if (curTaskReplyPhraseData.sText != "" && curTaskReplyPhraseData.nType == RTG_TASK_TYPE_HARVEST)
|
|
{
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%itemnum%", IntToString(GetLocalInt(oPC, "RTG_ItemNum")));
|
|
ret = curTaskReplyPhraseData;
|
|
break;
|
|
}
|
|
}
|
|
// EMERGENCY. Couldn't find relevant phrase, start from the beginning!
|
|
if(ret.sText == "")
|
|
{
|
|
nStart = 0;
|
|
for (i=nStart; i<nPhrases; i++)
|
|
{
|
|
curTaskReplyPhraseData = Private_GetTaskReplyPhrase(i);
|
|
|
|
// If this item does not match all these categories, goto the next item
|
|
if (curTaskReplyPhraseData.nType != nType)
|
|
continue;
|
|
|
|
if (curTaskReplyPhraseData.sText != "" && curTaskReplyPhraseData.nType == RTG_TASK_TYPE_DELIVERY)
|
|
{
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%assignedby%", GetLocalString(oPC, "RTG_AssignedByName"));
|
|
ret = curTaskReplyPhraseData;
|
|
break;
|
|
}
|
|
else if (curTaskReplyPhraseData.sText != "" && curTaskReplyPhraseData.nType == RTG_TASK_TYPE_HARVEST)
|
|
{
|
|
curTaskReplyPhraseData.sText = ParseText(curTaskReplyPhraseData.sText, "%item%", GetLocalString(oPC, "RTG_ItemName"));
|
|
ret = curTaskReplyPhraseData;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
DeleteLocalString(oPC, "RTG_ProtagonistRef");
|
|
return ret;
|
|
}
|
|
|
|
void RTG_SetTaskOnObject(object oPC, struct RTG_TaskData newTask)
|
|
{
|
|
SetLocalInt(oPC, "RTG_TaskActive", newTask.nActive);
|
|
SetLocalInt(oPC, "RTG_TaskType", newTask.nType);
|
|
SetLocalInt(oPC, "RTG_TaskCR", newTask.nCR);
|
|
SetLocalString(oPC, "RTG_ItemRef", newTask.sItemRef);
|
|
SetLocalString(oPC, "RTG_ItemTag", newTask.sItemTag);
|
|
SetLocalString(oPC, "RTG_ItemName", newTask.sItemName);
|
|
SetLocalInt(oPC, "RTG_ItemNum", newTask.nNumItems);
|
|
SetLocalString(oPC, "RTG_AntagonistRef", newTask.sAntagonistRef);
|
|
SetLocalString(oPC, "RTG_AntagonistName", newTask.sAntagonistName);
|
|
SetLocalString(oPC, "RTG_ProtagonistRef", newTask.sProtagonistRef);
|
|
SetLocalString(oPC, "RTG_ProtagonistName", newTask.sProtagonistName);
|
|
SetLocalInt(oPC, "RTG_SpawnerInstance", newTask.nSpawnerInstance);
|
|
SetLocalString(oPC, "RTG_RewardItemRef", newTask.sRewardItemRef);
|
|
SetLocalString(oPC, "RTG_RewardItemName", newTask.sRewardItemName);
|
|
SetLocalInt(oPC, "RTG_RewardItemNum", newTask.nRewardItemNum);
|
|
SetLocalString(oPC, "RTG_AssignedByTag", GetTag(OBJECT_SELF));
|
|
SetLocalString(oPC, "RTG_AssignedByName", GetName(OBJECT_SELF));
|
|
SendMessageToPC(oPC, "You have been assigned a task: '" + newTask.sText + "'");
|
|
}
|
|
|
|
void RTG_RemoveTaskFromObject(object oPC)
|
|
{
|
|
DeleteLocalInt(oPC, "RTG_TaskActive");
|
|
DeleteLocalInt(oPC, "RTG_TaskType");
|
|
DeleteLocalInt(oPC, "RTG_TaskCR");
|
|
DeleteLocalString(oPC, "RTG_ItemRef");
|
|
DeleteLocalString(oPC, "RTG_ItemTag");
|
|
DeleteLocalString(oPC, "RTG_ItemName");
|
|
DeleteLocalInt(oPC, "RTG_ItemNum");
|
|
DeleteLocalString(oPC, "RTG_AntagonistRef");
|
|
DeleteLocalString(oPC, "RTG_AntagonistName");
|
|
DeleteLocalString(oPC, "RTG_ProtagonistRef");
|
|
DeleteLocalString(oPC, "RTG_ProtagonistName");
|
|
DeleteLocalInt(oPC, "RTG_SpawnerInstance");
|
|
DeleteLocalString(oPC, "RTG_RewardItemRef");
|
|
DeleteLocalString(oPC, "RTG_RewardItemName");
|
|
DeleteLocalString(oPC, "RTG_AssignedByTag");
|
|
DeleteLocalString(oPC, "RTG_AssignedByName");
|
|
DeleteLocalInt(oPC, "RTG_RewardItemNum");
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Source code the all the private functions in the system
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// NOT USED: Returns the number of active tasks in the system.
|
|
int Private_GetTaskPhraseCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nTaskPhrases");
|
|
}
|
|
|
|
int Private_GetTaskReplyPhraseCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nTaskReplyPhrases");
|
|
}
|
|
|
|
int Private_GetTaskCompletePhraseCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nTaskCompletePhrases");
|
|
}
|
|
|
|
int Private_GetTaskCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nActiveTasks");
|
|
}
|
|
|
|
int Private_GetTaskItemCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nItems");
|
|
}
|
|
|
|
int Private_GetAntagonistCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nAntagonists");
|
|
}
|
|
|
|
int Private_GetProtagonistCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nProtagonists");
|
|
}
|
|
|
|
int Private_GetRewardItemCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nRewardItems");
|
|
}
|
|
|
|
int Private_GetVeryEasyHostileSpawnerCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nVeryEasyHostileSpawners");
|
|
}
|
|
|
|
int Private_GetVeryEasyFriendlySpawnerCount()
|
|
{
|
|
return GetLocalInt(GetModule(), "RTG_nVeryEasyFriendlySpawners");
|
|
}
|
|
|
|
struct RTG_TaskPhraseData Private_GetTaskPhrase(int nIndex)
|
|
{
|
|
int nTaskItems = Private_GetTaskPhraseCount();
|
|
string sTaskItemsIndex = IntToString(nIndex);
|
|
struct RTG_TaskPhraseData ret;
|
|
|
|
if (nIndex < nTaskItems)
|
|
{
|
|
ret.nType = GetLocalInt(GetModule(), "RTG_sTaskPhraseType" + sTaskItemsIndex);
|
|
ret.sText = GetLocalString(GetModule(), "RTG_sTaskPhraseText" + sTaskItemsIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_TaskReplyPhraseData Private_GetTaskReplyPhrase(int nIndex)
|
|
{
|
|
int nTaskItems = Private_GetTaskReplyPhraseCount();
|
|
string sTaskItemsIndex = IntToString(nIndex);
|
|
struct RTG_TaskReplyPhraseData ret;
|
|
|
|
if (nIndex < nTaskItems)
|
|
{
|
|
ret.nType = GetLocalInt(GetModule(), "RTG_sTaskReplyPhraseType" + sTaskItemsIndex);
|
|
ret.sText = GetLocalString(GetModule(), "RTG_sTaskReplyPhraseText" + sTaskItemsIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_TaskCompletePhraseData Private_GetTaskCompletePhrase(int nIndex)
|
|
{
|
|
int nTaskItems = Private_GetTaskCompletePhraseCount();
|
|
string sTaskItemsIndex = IntToString(nIndex);
|
|
struct RTG_TaskCompletePhraseData ret;
|
|
|
|
if (nIndex < nTaskItems)
|
|
{
|
|
ret.nType = GetLocalInt(GetModule(), "RTG_sTaskCompletePhraseType" + sTaskItemsIndex);
|
|
ret.sText = GetLocalString(GetModule(), "RTG_sTaskCompletePhraseText" + sTaskItemsIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_TaskItemData Private_GetTaskItem(int nIndex)
|
|
{
|
|
int nTaskItems = Private_GetTaskItemCount();
|
|
string sTaskItemsIndex = IntToString(nIndex);
|
|
struct RTG_TaskItemData ret;
|
|
|
|
if (nIndex < nTaskItems)
|
|
{
|
|
ret.sRef = GetLocalString(GetModule(), "RTG_sTaskItemRef" + sTaskItemsIndex);
|
|
ret.sTag = GetLocalString(GetModule(), "RTG_sTaskItemTag" + sTaskItemsIndex);
|
|
ret.sName = GetLocalString(GetModule(), "RTG_sTaskItemName" + sTaskItemsIndex);
|
|
ret.nCR = GetLocalInt(GetModule(), "RTG_sTaskItemCR" + sTaskItemsIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_TaskAntagonistData Private_GetAntagonist(int nIndex)
|
|
{
|
|
int nAntagonists = Private_GetAntagonistCount();
|
|
string sAntagonistIndex = IntToString(nIndex);
|
|
struct RTG_TaskAntagonistData ret;
|
|
|
|
if (nIndex < nAntagonists)
|
|
{
|
|
ret.nCR = GetLocalInt(GetModule(), "RTG_sAntagonistCR" + sAntagonistIndex);
|
|
ret.nType = GetLocalInt(GetModule(), "RTG_sAntagonistType" + sAntagonistIndex);
|
|
ret.sRef = GetLocalString(GetModule(), "RTG_sAntagonistRef" + sAntagonistIndex);
|
|
ret.sName = GetLocalString(GetModule(), "RTG_sAntagonistName" + sAntagonistIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_TaskProtagonistData Private_GetProtagonist(int nIndex)
|
|
{
|
|
int nProtagonists = Private_GetProtagonistCount();
|
|
string sProtagonistIndex = IntToString(nIndex);
|
|
struct RTG_TaskProtagonistData ret;
|
|
|
|
if (nIndex < nProtagonists)
|
|
{
|
|
ret.nCR = GetLocalInt(GetModule(), "RTG_sProtagonistCR" + sProtagonistIndex);
|
|
ret.sRef = GetLocalString(GetModule(), "RTG_sProtagonistRef" + sProtagonistIndex);
|
|
ret.sName = GetLocalString(GetModule(), "RTG_sProtagonistName" + sProtagonistIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
struct RTG_RewardItemData Private_GetRewardItem(int nIndex)
|
|
{
|
|
int nRewardItems = Private_GetRewardItemCount();
|
|
string sRewardItemIndex = IntToString(nIndex);
|
|
struct RTG_RewardItemData ret;
|
|
|
|
if (nIndex < nRewardItems)
|
|
{
|
|
ret.nCR = GetLocalInt(GetModule(), "RTG_sRewardItemCR" + sRewardItemIndex);
|
|
ret.sRef = GetLocalString(GetModule(), "RTG_sRewardItemRef" + sRewardItemIndex);
|
|
ret.sName = GetLocalString(GetModule(), "RTG_sRewardItemName" + sRewardItemIndex);
|
|
ret.nNum = GetLocalInt(GetModule(), "RTG_sRewardItemNum" + sRewardItemIndex);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
void Private_SetTaskPhraseCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nTaskPhrases", nValue);
|
|
}
|
|
|
|
void Private_SetTaskReplyPhraseCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nTaskReplyPhrases", nValue);
|
|
}
|
|
|
|
void Private_SetTaskCompletePhraseCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nTaskCompletePhrases", nValue);
|
|
}
|
|
|
|
void Private_SetTaskCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nActiveTasks", nValue);
|
|
}
|
|
|
|
void Private_SetItemCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nItems", nValue);
|
|
}
|
|
|
|
void Private_SetAntagonistCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nAntagonists", nValue);
|
|
}
|
|
|
|
void Private_SetProtagonistCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nProtagonists", nValue);
|
|
}
|
|
|
|
void Private_SetRewardItemCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nRewardItems", nValue);
|
|
}
|
|
|
|
void Private_SetVeryEasyHostileSpawnerCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nVeryEasyHostileSpawners", nValue);
|
|
}
|
|
|
|
void Private_SetVeryEasyFriendlySpawnerCount(int nValue)
|
|
{
|
|
SetLocalInt(GetModule(), "RTG_nVeryEasyFriendlySpawners", nValue);
|
|
}
|