Compare commits

...

10 Commits

25 changed files with 1127 additions and 160 deletions

16
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
"cSpell.words": [
"combobox",
"comboboxselection",
"CONTEXTITEMDATA",
"imagebox",
"itemview",
"listbox",
"listboxitem",
"scrollviewer",
"stackpanel",
"Tahoma",
"textblock",
"textbox"
]
}

View File

@ -2,6 +2,7 @@
#define _mr_auto_quest_actions_ #define _mr_auto_quest_actions_
#include "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/actions/npc_dialog_action.iss" #include "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/actions/npc_dialog_action.iss"
#include "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/actions/run_path_action.iss"
function RunAction(string actionType, jsonvalue params) function RunAction(string actionType, jsonvalue params)
{ {
@ -9,6 +10,10 @@ function RunAction(string actionType, jsonvalue params)
{ {
call npc_dialog_action params call npc_dialog_action params
} }
if ${actionType.Equal["run_path"]}
{
call run_path_action params
}
} }
#endif #endif

View File

@ -0,0 +1,33 @@
#includeoptional "${LavishScript.HomeDirectory}/Scripts/mr/common/api.iss"
variable(global) MRBotApi MRApi
function run_path_action(jsonvalueref params)
{
variable jsoniterator pathIterator
params.Get["path"]:GetIterator[pathIterator]
if !${MRApi(exists)}
{
echo "MRApi not available"
}
if !${MRNav(exists)}
{
echo "MRNav not available"
}
if ${pathIterator:First(exists)}
{
variable point3f nextLocation
do
{
nextLocation:Set[${pathIterator.Value.Get[x]},${pathIterator.Value.Get[y]},${pathIterator.Value.Get[z]}]
call MRApi.MoveTo "${Me.Name}" "${nextLocation}" 1
call MRApi.WaitForMoveTo "${Me.Name}" "${nextLocation}" 1
}
while ${pathIterator:Next(exists)}
}
}

View File

@ -0,0 +1,174 @@
#ifndef _MR_KILL_MOBS_PROPERTIES_CONTROLLER_
#define _MR_KILL_MOBS_PROPERTIES_CONTROLLER_
#include "${LavishScript.HomeDirectory}/scripts/mr/common/file_helpers.iss"
objectdef KillMobsPropertiesController
{
variable jsonvalue PropertyEditorUi ="{}"
variable jsonvalue ListViewUi ="{}"
variable jsonvalue PathToRun = "[]"
variable string StepType = "kill_mobs"
variable string PropertyPath
variable int KillQuantity
variable string CurrentTarget
variable jsonvalue QuestStepList = "[]"
member:jsonvalueref GetUI()
{
return PropertyEditorUi
}
member:float GetDistanceFromLastPoint()
{
if ${PathToRun.Used} == 0
{
return 0
}
variable jsonvalueref lastPoint = PathToRun.Get[${PathToRun.Used}]
return ${Math.Distance["${Me.Loc.X}", "${Me.Loc.Y}", "${Me.Loc.Z}", "${lastPoint.Get["x"]}", "${lastPoint.Get["y"]}", "${lastPoint.Get["z"]}"]}
}
member:jsonvalueref GetDialogOptions()
{
variable jsonvalue dialogOptions
dialogOptions:SetValue[$$>"{
"type": "${This.StepType}",
"params": {
"path": ${This.PathToRun.AsJSON~}
}
}"<$$]
return dialogOptions
}
member:jsonvalueref GetDisplayForProperties(jsonvalueref step)
{
variable jsonvalue theUi
variable jsoniterator pathIterator
variable string currentPoint
theUi:SetValue["${This.ListViewUi.AsJSON~}"]
step.Get["params", "path"]:GetIterator[pathIterator]
if ${pathIterator:First(exists)}
{
do
{
currentPoint:Set["x: ${pathIterator.Value.Get["x"]} y: ${pathIterator.Value.Get["y"]} z: ${pathIterator.Value.Get["z"]}"]
theUi.Get["children", 2, "items"]:Add["${currentPoint.AsJSON~}"]
}
while ${pathIterator:Next(exists)}
}
return theUi
}
member:jsonvalueref QuestList()
{
variable jsonvalue questList = "[]"
variable index:quest questIndex
variable iterator questIterator
QuestJournalWindow:GetActiveQuests[questIndex]
questIndex:GetIterator[questIterator]
if ${questIterator:First(exists)}
{
do
{
questList:Add["${questIterator.Value.Name.AsJSON~}"]
}
while ${questIterator:Next(exists)}
}
return questList
}
method OnQuestSelectionChanged()
{
variable index:collection:string questDetails
variable iterator questDetailsIterator
QuestJournalWindow.ActiveQuest["${Context.Source.SelectedItem.Data}"]:MakeCurrentActiveQuest
QuestJournalWindow.CurrentQuest:GetDetails[questDetails]
questDetails:GetIterator[questDetailsIterator]
variable int counter = 0
This.QuestStepList:Clear
if ${questDetailsIterator:First(exists)}
{
do
{
echo "value: ${questDetailsIterator.Value.Element["Text"].AsJSON~}"
This.QuestStepList:Add["${questDetailsIterator.Value.Element["Text"].AsJSON~}"]
if ${questDetailsIterator.Value.FirstKey(exists)}
{
do
{
echo "-- ${counter}: ${questDetailsIterator.Value.CurrentKey} => ${questDetailsIterator.Value.CurrentValue}"
}
while ${questDetailsIterator.Value.NextKey(exists)}
echo "-----------------"
}
counter:Inc
}
while ${questDetailsIterator:Next(exists)}
}
echo "QuestStepList: ${this.QuestStepList.AsJSON~}"
}
method OnRefreshQuestList()
{
echo "OnRefreshQuestList"
}
method GetQuestItemView()
{
echo "GetQuestItemView: ${Context(type)} ${Context.Args}"
Context:SetView["$$>
{
"type": "itemview",
"content": {
"type": "textblock",
"text": "test"
}
}
<$$"]
}
method Initialize()
{
This.PropertyPath:Set["${FileHelpers.GetDirectoryFromFilePath["_FILE_"]}"]
PropertyEditorUi:ParseFile["${This.PropertyPath}/editor_ui.json"]
ListViewUi:ParseFile["${This.PropertyPath}/list_ui.json"]
}
method Shutdown()
{
}
method OnSetTargetNameButtonClick()
{
This.CurrentTarget:Set["${Me.Target.Name}"]
}
method OnAddPointClick()
{
PathToRun:Add[$$>"{
x: ${Me.Loc.X},
y: ${Me.Loc.Y},
z: ${Me.Loc.Z}
}"<$$]
}
}
#endif

View File

@ -0,0 +1,221 @@
{
"$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
"type": "stackpanel",
"name": "mr.quest_writer.run_path_properties",
"_dock": "bottom",
"borderBrush": {
"color": "#f4f3ee"
},
"templates": {
"property_header": {
"type": "panel",
"borderBrush": {
"color": "#f4f3ee"
},
"borderThickness": [0, 0, 0, 1],
"margin": [0, 0, 0, 15]
},
"property_group": {
"type": "stackpanel",
"orientation": "vertical",
"borderBrush": {
"color": "#f4f3ee"
},
"borderThickness": [1, 1, 1, 1],
"padding": [5, 5, 5, 5],
"margin": [5, 5, 5, 5]
},
"mr.quest_writer.run_path_properties.quest_item": {
"type": "textblock",
"padding": 2,
"textBinding": {
"pullFormat": "${_CONTEXTITEMDATA_.Get[name]}",
"pullReplaceNull": ""
}
}
},
"borderThickness": [0, 2, 0, 0],
"header": "test",
"children": [
{
"type": "panel",
"visibility": "hidden",
"name": "mr.quest_writer.run_path_properties.events.events"
},
{
"type": "panel",
"jsonTemplate": "property_header",
"children": [
{
"type": "textblock",
"text": "Kill Mobs Properties",
"font": {
"bold": true,
"heightFactor": 1.2
},
"horizontalAlignment": "center",
"widthFactor": 1
}
]
},
{
"type": "stackpanel",
"jsonTemplate": "property_group",
"children": [
{
"type": "textblock",
"text": "Target Name:",
"widthFactor": 1,
"horizontalAlignment": "left",
"margin": [0, 0, 0, 15],
"borderBrush": {
"color": "#f4f3ee"
},
"borderThickness": [0, 0, 0, 1],
"font": {
"heightFactor": 0.9
}
},
{
"type": "stackpanel",
"orientation": "horizontal",
"children": [
{
"type": "button",
"content": "◎",
"tooltip": "Set the name to the currently targeted mob.",
"margin": [0, 0, 5, 0],
"eventHandlers": {
"onRelease": [
"method",
"MRKillMobsPropertiesController",
"OnSetTargetNameButtonClick"
]
}
},
{
"type": "textblock",
"widthFactor": 1,
"text": "${MRKillMobsPropertiesController.CurrentTarget}"
}
]
}
]
},
{
"type": "stackpanel",
"orientation": "vertical",
"jsonTemplate": "property_group",
"children": [
{
"type": "textblock",
"text": "Hunting Path",
"widthFactor": 1,
"horizontalAlignment": "left"
},
{
"type": "button",
"name": "mr.quest_writer.run_path_properties.add_point",
"content": "Add Point",
"tooltip": "Add a point.",
"horizontalAlignment": "stretch",
"eventHandlers": {
"onRelease": [
"method",
"MRRunPathPropertiesController",
"OnAddPointClick"
]
}
},
{
"type": "stackpanel",
"widthFactor": 1,
"children": [
{
"type": "textblock",
"text": "Distance From Last",
"horizontalAlignment": "left",
"widthFactor": 1
},
{
"type": "textblock",
"horizontalAlignment": "left",
"widthFactor": 1,
"textBinding": {
"pullFormat": "${MRRunPathPropertiesController.GetDistanceFromLastPoint}"
}
}
]
}
]
},
{
"type": "stackpanel",
"jsonTemplate": "property_group",
"horizontalContentAlignment": "left",
"children": [
{
"type": "textblock",
"text": "Kill Quest Step",
"tooltip": "This is the step we will check to see when this action is finished."
},
{
"type": "stackpanel",
"orientation": "horizontal",
"margin": [0, 0, 0, 15],
"children": [
{
"type": "combobox",
"widthFactor": 0.8,
"eventHandlers": {
"onSelectionChanged": [
"method",
"MRKillMobsPropertiesController",
"OnQuestSelectionChanged"
]
},
"itemsBinding": {
"pullFormat": "${MRKillMobsPropertiesController.QuestList}",
"pullReplaceNull": "",
"pullOnce": true
},
"popup": {
"jsonTemplate": "combobox.popup",
"maxSize": [250, 300]
}
},
{
"type": "button",
"content": "⟳",
"tooltip": "Refresh the quest steps.",
"margin": [5, 0, 0, 0],
"eventHandlers": {
"onRelease": [
"method",
"MRKillMobsPropertiesController",
"OnRefreshQuestList"
]
}
}
]
},
{
"type": "combobox",
"widthFactor": 0.8,
"itemsBinding": {
"pullFormat": "${MRKillMobsPropertiesController.QuestStepList}",
"pullReplaceNull": "",
"pushFormat": [
"MRKillMobsPropertiesController.SelectedStep:Set[",
"]"
]
},
"popup": {
"jsonTemplate": "combobox.popup",
"maxSize": [250, 300]
}
}
]
}
]
}

View File

@ -0,0 +1,24 @@
{
"$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
"type": "stackpanel",
"orientation": "vertical",
"horizontalAlignment": "left",
"children": [
{
"type": "textblock",
"horizontalAlignment": "stretch",
"font": {
"bold": true,
"heightFactor": 1.1
},
"text": "Run Path"
},
{
"type": "listbox",
"horizontalAlignment": "stretch",
"borderThickness": 0,
"padding": [5, 0, 0, 0],
"items": []
}
]
}

View File

@ -36,12 +36,10 @@ objectdef NPCDialogPropertiesController
variable string npcName = "N/A" variable string npcName = "N/A"
variable jsonvalue theUi variable jsonvalue theUi
theUi:SetValue["${this.listViewUi}"] theUi:SetValue["${This.listViewUi.AsJSON~}"]
npcName:Set["${step.Get["params","npc_name"]}"] npcName:Set["${step.Get["params","npc_name"]}"]
options:Set["${step.Get["params","dialog_options"]}"] options:Set["${step.Get["params","dialog_options"]}"]
theUi:ParseFile["${This.PropertyPath}/list_ui.json"]
theUi.Get["children", 2, "children", 2]:SetString["text", "${npcName}"] theUi.Get["children", 2, "children", 2]:SetString["text", "${npcName}"]
theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"] theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"]

View File

@ -3,10 +3,12 @@
#includeoptional "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/npc_dialog_properties/editor.iss" #includeoptional "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/npc_dialog_properties/editor.iss"
#includeoptional "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/run_path_properties/editor.iss" #includeoptional "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/run_path_properties/editor.iss"
#includeoptional "${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/kill_mobs_properties/editor.iss"
variable(global) NPCDialogPropertiesController MRNPCDialogPropertiesController variable(global) NPCDialogPropertiesController MRNPCDialogPropertiesController
variable(global) RunPathPropertiesController MRRunPathPropertiesController variable(global) RunPathPropertiesController MRRunPathPropertiesController
variable(global) KillMobsPropertiesController MRKillMobsPropertiesController
objectdef PropertyEditors objectdef PropertyEditors
{ {
@ -20,6 +22,10 @@ objectdef PropertyEditors
{ {
return MRRunPathPropertiesController; return MRRunPathPropertiesController;
} }
if ${stepType.Equal["${MRKillMobsPropertiesController.StepType}"]}
{
return MRKillMobsPropertiesController;
}
return null; return null;
} }

View File

@ -31,13 +31,12 @@ objectdef RunPathPropertiesController
{ {
variable jsonvalue dialogOptions variable jsonvalue dialogOptions
; dialogOptions:SetValue[$$>"{ dialogOptions:SetValue[$$>"{
; "type": "${This.StepType}", "type": "${This.StepType}",
; "params": { "params": {
; "npc_name": ${This.CurrentNPCName.AsJSON~}, "path": ${This.PathToRun.AsJSON~}
; "dialog_options": ${This.CurrentDialogOptions.AsJSON~} }
; } }"<$$]
; }"<$$]
return dialogOptions return dialogOptions
} }
@ -45,13 +44,22 @@ objectdef RunPathPropertiesController
member:jsonvalueref GetDisplayForProperties(jsonvalueref step) member:jsonvalueref GetDisplayForProperties(jsonvalueref step)
{ {
variable jsonvalue theUi variable jsonvalue theUi
variable jsoniterator pathIterator
variable string currentPoint
theUi:SetValue["${this.ListViewUi}"] theUi:SetValue["${This.ListViewUi.AsJSON~}"]
step.Get["params", "path"]:GetIterator[pathIterator]
if ${pathIterator:First(exists)}
{
do
{
currentPoint:Set["x: ${pathIterator.Value.Get["x"]} y: ${pathIterator.Value.Get["y"]} z: ${pathIterator.Value.Get["z"]}"]
theUi.Get["children", 2, "items"]:Add["${currentPoint.AsJSON~}"]
}
while ${pathIterator:Next(exists)}
}
theUi:ParseFile["${This.PropertyPath}/list_ui.json"]
; theUi.Get["children", 2, "children", 2]:SetString["text", "${npcName}"]
; theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"]
return theUi return theUi
} }

View File

@ -11,41 +11,14 @@
"bold": true, "bold": true,
"heightFactor": 1.1 "heightFactor": 1.1
}, },
"text": "NPC Dialog" "text": "Run Path"
}, },
{ {
"type": "stackpanel", "type": "listbox",
"orientation": "horizontal",
"horizontalAlignment": "stretch", "horizontalAlignment": "stretch",
"borderThickness": 0,
"padding": [5, 0, 0, 0], "padding": [5, 0, 0, 0],
"children": [ "items": []
{
"type": "textblock",
"text": "NPC Name:",
"margin": [0, 0, 5, 0]
},
{
"type": "textblock",
"text": ""
}
]
},
{
"type": "stackpanel",
"orientation": "horizontal",
"horizontalAlignment": "stretch",
"padding": [5, 0, 0, 0],
"children": [
{
"type": "textblock",
"text": "Options:",
"margin": [0, 0, 5, 0]
},
{
"type": "textblock",
"text": ""
}
]
} }
] ]
} }

View File

@ -12,16 +12,16 @@ objectdef QuestWriterController
member:jsonvalueref FormatPropertiesForDisplay(jsonvalue step) member:jsonvalueref FormatPropertiesForDisplay(jsonvalue step)
{ {
echo "Formatting properties for ${step.Get["type"]}"
variable jsonvalue stepItem variable jsonvalue stepItem
if ${step.Get["type"].Equal["${MRNPCDialogPropertiesController.StepType}"]} variable weakref stepProperties
{ stepProperties:SetReference[${PropertyEditors.GetPropertyEditor[${step.Get["type"]}]}]
stepItem:SetValue["${MRNPCDialogPropertiesController.GetDisplayForProperties[step].AsJSON~}"]
return stepItem
} stepItem:SetValue["${stepProperties.GetDisplayForProperties[step]}"]
else
{ return stepItem
return null
}
} }
member:string GetQuestStepsForDisplay() member:string GetQuestStepsForDisplay()
@ -44,7 +44,7 @@ objectdef QuestWriterController
listItem:SetValue[$$>"{ listItem:SetValue[$$>"{
"type": "dockpanel", "type": "dockpanel",
"widthFactor": .18, "widthFactor": .19,
"children": [ "children": [
${stepItem.AsJSON~}, ${stepItem.AsJSON~},
{ {
@ -100,6 +100,8 @@ objectdef QuestWriterController
{ {
variable jsonvalue step variable jsonvalue step
step:SetValue["${Context.Source.Metadata.Get["step"].AsJSON~}"] step:SetValue["${Context.Source.Metadata.Get["step"].AsJSON~}"]
echo "Testing step ${step.Get["params"].AsJSON~}"
QueueCommand call RunAction ${step.Get["type"]} "${step.Get["params"].AsJSON~}" QueueCommand call RunAction ${step.Get["type"]} "${step.Get["params"].AsJSON~}"
} }

View File

@ -1,102 +1,29 @@
{ {
"$schema": "http://www.lavishsoft.com/schema/lgui2Package.json", "$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
"skin": { "templates": {
"name": "MRSkin", "property_header": {
"brushes": { "type": "panel",
"window.titleBar.backgroundBrush": { "borderBrush": {
"color": "#211C18"
}
},
"templates": {
"window.title": {
"verticalAlignment": "center",
"margin": [2, 0, 0, 0]
},
"button": {
"jsonTemplate": "default:button",
"margin": [2, 2, 2, 2],
"color": "#f4f3ee" "color": "#f4f3ee"
}, },
"checkbox": { "borderThickness": [0, 0, 0, 1],
"jsonTemplate": "default:checkbox", "margin": [0, 0, 0, 15]
"margin": [2, 2, 2, 2] },
"property_group": {
"type": "stackpanel",
"orientation": "vertical",
"borderBrush": {
"color": "#f4f3ee"
}, },
"window": { "borderThickness": [1, 1, 1, 1],
"jsonTemplate": "default:window", "padding": [5, 5, 5, 5],
"backgroundBrush": { "margin": [5, 5, 5, 5]
"color": "#463f3a"
},
"color": "#f4f3ee",
"font": {
"face": "Segoe UI",
"height": 16
}
},
"listbox.contentContainer": {
"jsonTemplate": "scrollviewer",
"type": "scrollviewer",
"acceptsMouseFocus": false,
"contentContainer": {
"type": "border",
"horizontalContentAlignment": "stretch",
"verticalContentAlignment": "stretch"
}
},
"listbox.contentContainerFitWidth": {
"jsonTemplate": "listbox.contentContainer",
"horizontalScroll": "fit"
},
"listbox.content": {
"type": "stackpanel",
"uniform": true,
"backgroundBrush": "listbox.backgroundBrush"
},
"listbox": {
"defaultItemViewTemplate": "listboxitem",
"acceptsKeyboardFocus": true,
"padding": [ 1, 1, 1, 1 ],
"borderThickness": 1,
"borderBrush": "listbox.borderBrush",
"contentContainer": {
"jsonTemplate": "listbox.contentContainer"
},
"content": {
"jsonTemplate": "listbox.content"
}
},
"itemview": {
"type": "itemview",
"acceptsKeyboardFocus": false,
"contentContainer": {
"type": "border",
"horizontalContentAlignment": "stretch",
"verticalContentAlignment": "stretch"
},
"padding": [ 2, 2, 2, 2 ],
"margin": [ 1, 1, 1, 1 ],
"backgroundBrush": "itemview.backgroundBrush",
"eventHandlers": {
"onMouseButtonMove": {
"type": "forward",
"elementType": "itemlist",
"event": "onItemMouseButtonMove"
}
},
"styles": {
"onSelected": {
"backgroundBrush": "itemview.selectedBackgroundBrush"
},
"onDeselected": {
"backgroundBrush": "itemview.backgroundBrush"
}
}
}
} }
}, },
"elements": [ "elements": [
{ {
"type": "window", "type": "window",
"skin": "MRSkin", "skin": "mr.dark",
"title": "MR Quest Writer", "title": "MR Quest Writer",
"name": "mr.quest_writer.window", "name": "mr.quest_writer.window",
"borderThickness": 2, "borderThickness": 2,
@ -124,7 +51,7 @@
"type": "panel", "type": "panel",
"visibility": "hidden", "visibility": "hidden",
"name": "MRQuestWriterController.events" "name": "MRQuestWriterController.events"
} },
{ {
"type": "dockpanel", "type": "dockpanel",
"widthFactor": 0.2, "widthFactor": 0.2,
@ -254,9 +181,6 @@
"name": "mr.quest_writer.quest_steps", "name": "mr.quest_writer.quest_steps",
"heightFactor": 1, "heightFactor": 1,
"widthFactor": 1, "widthFactor": 1,
"-contentContainer":{
"jsonTemplate":"listbox.contentContainerFitWidth"
},
"itemsBinding": { "itemsBinding": {
"pullFormat": "${MRQuestWriterController.GetQuestStepsForDisplay}", "pullFormat": "${MRQuestWriterController.GetQuestStepsForDisplay}",
"autoPull": false, "autoPull": false,

View File

@ -0,0 +1,21 @@
#include "${LavishScript.HomeDirectory}/scripts/mr/common/file_helpers.iss"
objectdef AliasSettingsController
{
variable string BasePath
method Initialize()
{
BasePath = ${FileHelpers.GetDirectoryFromFilePath[_FILE_]}
LGUI2:LoadPackageFile["${BasePath}/ui.json"]
}
method Shutdown()
{
LGUI2:UnloadPackageFile["${BasePath}/ui.json"]
}
method OnClose()
{
Script:End
}
}

View File

View File

@ -34,7 +34,7 @@
2, 2,
2, 2,
2 2
], ]
}, },
"window": { "window": {
"jsonTemplate": "default:window", "jsonTemplate": "default:window",

View File

@ -6,7 +6,7 @@ objectdef RelayApi
variable point3f location variable point3f location
location:Set[${Context.Get["parameters", "location", "X"]}, ${Context.Get["parameters", "location", "Y"]}, ${Context.Get["parameters", "location", "Z"]}] location:Set[${Context.Get["parameters", "location", "X"]}, ${Context.Get["parameters", "location", "Y"]}, ${Context.Get["parameters", "location", "Z"]}]
MRApi:MoveTo["${Context.Get["parameters","ForWho"]}", "${location}", ${Context.Get["parameters", "minDistance"]}] ;MRApi:MoveTo["${Context.Get["parameters","ForWho"]}", "${location}", ${Context.Get["parameters", "minDistance"]}]
} }
} }

View File

@ -1,12 +1,15 @@
#ifndef _mr_api_ #ifndef _mr_api_
#define _mr_api_ #define _mr_api_
objectdef MRApi objectdef MRBotApi
{ {
static member:bool IsForMe(string forWhoTarget) variable string test = "test MRAPI";
member:bool IsForMe(string forWhoTarget)
{ {
variable string target = ${forWhoTarget}; variable string target = ${forWhoTarget}
variable string prefix = ${forWhoTarget.Token[1, ":"]}; variable string prefix = ${forWhoTarget.Token[1, ":"]}
variable bool negate = FALSE; variable bool negate = FALSE
echo "IsForMe ${forWhoTarget} ${prefix} ${target}"
if ${target.Count[":"]} > 0 if ${target.Count[":"]} > 0
@ -62,19 +65,192 @@ objectdef MRApi
return ${negate} return ${negate}
} }
static method MoveTo(string forWho, point3f location, float minDistance = 0) function MoveTo(string forWho, point3f location, float minDistance = 0)
{ {
echo "Moving to ${location}" echo "Moving to ${location}"
if ${MRApi.IsForMe[${forWho}]} if ${This.IsForMe["${forWho}"]}
{ {
MRNav:MoveTo["${location}"] MRNav:MoveTo["${location}"]
} }
else else
{ {
echo "NotForMe" echo "${forWho} NotForMe"
} }
} }
function WaitForMoveTo(string forWho, point3f location, float minDistance = 0)
{
echo "Waiting for move to ${location}"
while ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${location.X},${location.Y},${location.Z}]} > ${minDistance}
{
echo "waiting for path to complete ${Math.Distance[${Me.X},${Me.Y},${Me.Z},${location.X},${location.Y},${location.Z}]}"
wait 5
}
}
function ActivateSpecial(string ActorName, float X, float Y, float Z)
{
call TestArrivalCoord ${X} ${Y} ${Z}
if (!${Return})
call MoveTo "${ActorName}" ${X} ${Y} ${Z}
MR:Special["${Me.Name}"]
wait 50
}
function ActivateVerbOn(string ActorName, string verb, bool UseID)
{
echo do ${verb} on ${ActorName} (${UseID})
if ${UseID}
eq2execute apply_verb ${Actor[Query,Name=="${ActorName}"].ID} "${verb}"
else
MR:ApplyVerbForWho["${Me.Name}","${ActorName}","${verb}"]
wait 50
}
;===================================================================================
;long list below
;
function DescribeActor(int ActorID)
{
echo ID: ${ActorID}
echo Name: ${Actor[${ActorID}].Name}
echo LastName: ${Actor[${ActorID}].LastName}
echo Health: ${Actor[${ActorID}].Health}
echo Power: ${Actor[${ActorID}].Power}
echo Level: ${Actor[${ActorID}].Level}
echo EffectiveLevel: ${Actor[${ActorID}].EffectiveLevel}
echo TintFlags: ${Actor[${ActorID}].TintFlags}
echo VisualVariant: ${Actor[${ActorID}].VisualVariant}
echo Mood: ${Actor[${ActorID}].Mood}
echo CurrentAnimation: ${Actor[${ActorID}].CurrentAnimation}
echo Overlay: ${Actor[${ActorID}].Overlay}
echo Aura: ${Actor[${ActorID}].Aura}
echo Gender: ${Actor[${ActorID}].Gender}
echo Race: ${Actor[${ActorID}].Race}
echo Class: ${Actor[${ActorID}].Class}
echo Guild: ${Actor[${ActorID}].Guild}
echo Type: ${Actor[${ActorID}].Type}
echo SuffixTitle: ${Actor[${ActorID}].SuffixTitle}
echo ConColor: ${Actor[${ActorID}].ConColor}
echo Distance: ${Actor[${ActorID}].Distance}
echo X ${Actor[${ActorID}].Loc.X}
echo Y ${Actor[${ActorID}].Loc.Y}
echo Z ${Actor[${ActorID}].Loc.Z}
}
;===================================================================================
;long list below
;
function get_Archetype(string ToonClass)
{
switch ${ToonClass}
{
case warrior
{
return fighter
break
}
case berserker
{
return fighter
break
}
case guardian
{
return fighter
break
}
case paladin
{
return fighter
break
}
case shadowknight
{
return fighter
break
}
case monk
{
return fighter
break
}
case bruiser
{
return fighter
break
}
case warden
{
return priest
break
}
case mystic
{
return priest
break
}
case defiler
{
return priest
break
}
case fury
{
return priest
break
}
case templar
{
return priest
break
}
case inquisitor
{
return priest
break
}
case conjuror
{
return mage
break
}
case necromancer
{
return mage
break
}
case warlock
{
return mage
break
}
case wizard
{
return mage
break
}
case illusionist
{
return mage
break
}
case coercer
{
return mage
break
}
Default
{
return scout
break
}
}
}
;===================================================================================
} }

6
mr.iss
View File

@ -6,7 +6,7 @@ function main(... params)
if ${command.Equal["init"]} if ${command.Equal["init"]}
{ {
alias mr run mr squelch alias mr run mr
if !${Script[Relay](exists)} if !${Script[Relay](exists)}
{ {
RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Relay" RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Relay"
@ -16,6 +16,8 @@ function main(... params)
{ {
RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Navigation/Movement" RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Navigation/Movement"
} }
LGUI2:LoadSkinFile["${LavishScript.HomeDirectory}/Scripts/mr/ui/mr.dark.skin.json"]
LGUI2:PushSkin["mr.dark"]
} }
elseif ${command.Equal["osa"]} elseif ${command.Equal["osa"]}
{ {
@ -36,7 +38,7 @@ function main(... params)
} }
elseif ${command.Equal["test"]} elseif ${command.Equal["test"]}
{ {
run mr/test run mr/test/test
} }
} }

35
test/test.iss Normal file
View File

@ -0,0 +1,35 @@
objectdef MRTestController
{
method Initialize()
{
LGUI2:LoadPackageFile["window.json"]
variable jsonvalue editor_ui
editor_ui:ParseFile["${LavishScript.HomeDirectory}/Scripts/mr/auto_quest/property_editors/kill_mobs_properties/editor_ui.json"]
; LGUI2.Element["mr.test.test_panel"]:AddChild[editor_ui]
}
method Shutdown()
{
LGUI2:UnloadPackageFile["window.json"]
}
method OnClose()
{
Script:End
}
}
variable(global) MRTestController TestController
function main()
{
LGUI2:LoadSkinFile["${LavishScript.HomeDirectory}/Scripts/mr/ui/mr.dark.skin.json"]
while 1
{
wait 5
}
}

81
test/window.json Normal file
View File

@ -0,0 +1,81 @@
{
"$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
"templates": {
"mr.templates.combobox_item": {
"jsonTemplate": "listboxitem",
"padding": 2,
"content": {
"type": "textblock",
"textBinding": {
"pullFormat": "${_CONTEXTITEMDATA_.Get[name]}",
"pullReplaceNull": ""
}
}
}
},
"elements": [
{
"type": "window",
"title": "Test",
"name": "mr.test.window",
"hideOnClose": false,
"minSize": {
"width": 500,
"height": 500
},
"eventHandlers": {
"onCloseButtonClick": ["method", "TestController", "OnClose"]
},
"content": {
"type": "stackpanel",
"orientation": "vertical",
"children": [
{
"type": "stackpanel",
"name": "mr.test.test_panel",
"orientation": "vertical",
"children": [
{
"type": "stackpanel",
"orientation": "horizontal",
"children": [
{
"type": "combobox",
"itemViewGenerators": {
"default": {
"type": "template",
"template": "mr.templates.combobox_item"
}
},
"items": [
{
"name": "abc"
},
{
"name": "123"
},
{
"name": "def"
},
{
"name": "456"
}
]
}
]
},
{
"type": "textblock",
"text": "Test Text"
}
]
}
]
}
}
]
}

BIN
ui/icons/close_button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

BIN
ui/icons/close_button_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

BIN
ui/icons/close_button_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

268
ui/mr.dark.skin.json Normal file
View File

@ -0,0 +1,268 @@
{
"$schema": "http://www.lavishsoft.com/schema/lgui2Skin.json",
"type": "skin",
"name": "mr.dark",
"brushes": {
"background": {
"color": [0.15, 0.15, 0.15]
},
"controlBackground": {
"color": [0.3, 0.3, 0.3]
},
"selectedBackgroundBrush": {
"color": [0.5, 0.5, 0.5]
},
"titleBarBackground": {
"color": [0.1, 0.1, 0.1]
},
"text": {
"color": [0.9, 0.9, 0.9]
},
"border": {
"color": [0.5, 0.5, 0.5]
},
"titleBarCloseTexture": {
"color": [1.0, 1.0, 1.0],
"opacity": 0.7,
"imageFile": "${LavishScript.HomeDirectory}/Scripts/mr/ui/icons/close_button_3.png"
},
"titleBarMinimizeTexture": {
"color": [1.0, 1.0, 1.0],
"opacity": 0.7,
"imageFile": "${LavishScript.HomeDirectory}/Scripts/mr/ui/icons/minimize_button_3.png"
}
},
"templates": {
"window": {
"backgroundBrush": "background",
"titleBar": {
"jsonTemplate": "window.titleBar"
}
},
"window.titleBar": {
"backgroundBrush": "titleBarBackground",
"font": {
"face": "Tahoma",
"height": 16,
"bold": true
},
"children": [
{
"type": "button",
"jsonTemplate": "button",
"_dock": "right",
"borderThickness": 0,
"borderColor": [0],
"content": {
"type": "imagebox",
"margin": [0],
"width": 20,
"imageBrush": "titleBarCloseTexture"
},
"padding": 0,
"eventHandlers": {
"onMouse1Release": {
"type": "forward",
"elementType": "window",
"event": "onCloseButtonClick"
}
}
},
{
"type": "button",
"jsonTemplate": "button",
"_dock": "right",
"borderThickness": 0,
"borderColor": [0],
"content": {
"type": "imagebox",
"margin": [0],
"width": 20,
"imageBrush": "titleBarMinimizeTexture"
},
"padding": 0,
"eventHandlers": {
"onMouse1Release": {
"type": "forward",
"elementType": "window",
"event": "onShadeButtonClick"
}
}
}
]
},
"textblock": {
"color": "text",
"font": {
"face": "Tahoma",
"height": 14,
"bold": false
}
},
"button": {
"type": "button",
"backgroundBrush": "controlBackground",
"borderRounding": 0.3,
"color": "text",
"opacity": 0.8,
"styles": {
"gotMouseOver": {
"opacity": 1.0
},
"lostMouseOver": {
"opacity": 0.8
},
"onPress": {
"opacity": 0.8
},
"onRelease": {
"opacity": 1.0
}
}
},
"itemview": {
"type": "itemview",
"acceptsKeyboardFocus": false,
"contentContainer": {
"type": "border",
"horizontalContentAlignment": "stretch",
"verticalContentAlignment": "stretch"
},
"padding": [2, 2, 2, 2],
"margin": [1, 1, 1, 1],
"backgroundBrush": "controlBackground",
"styles": {
"onSelected": {
"backgroundBrush": "selectedBackgroundBrush"
},
"onDeselected": {
"backgroundBrush": "controlBackground"
}
}
},
"listboxitem.gotMouseOver": {
"font": {
"bold": true
},
"opacity": 1.0
},
"listboxitem.lostMouseOver": {
"font": {
"bold": false
},
"opacity": 0.8
},
"listboxitem": {
"jsonTemplate": "itemview",
"padding": [1, 5, 1, 5],
"styles": {
"gotMouseOver": {
"jsonTemplate": "listboxitem.gotMouseOver"
},
"lostMouseOver": {
"jsonTemplate": "listboxitem.lostMouseOver"
}
}
},
"listbox.contentContainer": {
"jsonTemplate": "scrollviewer",
"type": "scrollviewer",
"acceptsMouseFocus": false,
"contentContainer": {
"type": "border",
"horizontalContentAlignment": "stretch",
"verticalContentAlignment": "stretch"
}
},
"listbox.contentContainerFitWidth": {
"jsonTemplate": "listbox.contentContainer",
"horizontalScroll": "fit"
},
"listbox.content": {
"type": "stackpanel",
"uniform": true,
"backgroundBrush": "background"
},
"listbox": {
"defaultItemViewTemplate": "listboxitem",
"acceptsKeyboardFocus": true,
"borderThickness": 1,
"borderBrush": "border",
"contentContainer": {
"jsonTemplate": "listbox.contentContainer"
},
"content": {
"jsonTemplate": "listbox.content"
}
},
"comboboxselection": {
"jsonTemplate": "itemview",
"padding": [2, 2, 2, 2],
"margin": [1, 1, 1, 1],
"horizontalAlignment": "left",
"verticalAlignment": "center",
"eventHandlers": {}
},
"popup.panel": {
"type": "panel",
"borderBrush": "border",
"backgroundBrush": "controlBackground"
},
"popup": {
"type": "popup",
"strata": 1.1,
"acceptsMouseFocus": false,
"backgroundBrush": "controlBackground",
"contentContainer": {
"jsonTemplate": "popup.panel"
}
},
"combobox.popup.content": {
"jsonTemplate": "listbox",
"type": "listbox",
"borderThickness": 0
},
"combobox.popup": {
"type": "popup",
"jsonTemplate": "popup",
"backgroundBrush": "controlBackground",
"contentContainer": {
"jsonTemplate": "popup.panel",
"type": "anchor",
"anchorToElement": {
"elementType": "combobox",
"elementTree": "logical",
"flags": "ancestor"
},
"clipToParent": false,
"anchorLocationFactor": [0.0, 1.0]
},
"content": {
"jsonTemplate": "combobox.popup.content"
}
},
"combobox": {
"type": "combobox",
"backgroundBrush": "controlBackground",
"borderBrush": "border",
"borderRounding": 0.3,
"padding": [5, 3, 5, 3],
"acceptsKeyboardFocus": true,
"minSize": [40, 0],
"fitContentContainer": false,
"headerContainer": {
"type": "border",
"verticalAlignment": "center"
},
"selectedItemViewTemplate": "comboboxselection",
"popup": {
"jsonTemplate": "combobox.popup"
},
"contentContainer": {
"type": "panel"
}
}
}
}