75 lines
1.6 KiB
Plaintext
75 lines
1.6 KiB
Plaintext
objectdef QuestWriterController
|
|
{
|
|
variable string CurrentNPCName
|
|
variable string CurrentStepType
|
|
variable string CurrentDialogOptions
|
|
variable jsonvalue QuestSteps = []
|
|
|
|
method Initialize()
|
|
{
|
|
LGUI2:LoadPackageFile["writer.json"]
|
|
}
|
|
|
|
method Shutdown()
|
|
{
|
|
LGUI2:UnloadPackageFile["writer.json"]
|
|
}
|
|
|
|
method OnClose()
|
|
{
|
|
Script:End
|
|
}
|
|
|
|
method OnNPCDialogButtonClick()
|
|
{
|
|
CurrentStepType:Set["ncp_dialog"]
|
|
LGUI2.Element["mr.quest_writer.npc_dialog_properties"]:SetVisibility["visible"]
|
|
}
|
|
|
|
method OnSetNPCNameButtonClick()
|
|
{
|
|
echo "Setting NPC Name to ${Me.Target.Name}"
|
|
This.CurrentNPCName:Set["${Me.Target.Name}"]
|
|
}
|
|
|
|
method OnAddStepButtonClick()
|
|
{
|
|
variable jsonvalue newStep
|
|
|
|
newStep:SetValue[$$>"{
|
|
"type": ${This.CurrentStepType.AsJSON~},
|
|
"params": {
|
|
"npc_name": ${This.CurrentNPCName.AsJSON~},
|
|
"dialog_options": ${This.CurrentDialogOptions.AsJSON~}
|
|
}
|
|
}"<$$]
|
|
This.QuestSteps:Add["${newStep.AsJSON~}"]
|
|
|
|
echo "Current Steps ${This.QuestSteps.AsJSON~}"
|
|
}
|
|
|
|
member:jsonvalueref CurrentSteps()
|
|
{
|
|
variable jsonvalue questList
|
|
|
|
questList:SetValue[$$>"[
|
|
"Step 1",
|
|
"Step 2",
|
|
"Step 3",
|
|
]"<$$]
|
|
|
|
return questList
|
|
}
|
|
|
|
}
|
|
|
|
variable(global) QuestWriterController MRQuestWriterController
|
|
|
|
function main()
|
|
{
|
|
echo "${MRQuestWriterController.CurrentSteps.AsJSON~}"
|
|
while 1
|
|
{
|
|
wait 1
|
|
}
|
|
} |