Added basic navigation & relay commands infrastructure

This commit is contained in:
Malcolm Roberts 2024-01-10 15:16:29 -06:00
parent adc9ad36cd
commit dbb62c2f7b
6 changed files with 118 additions and 24 deletions

View File

@ -0,0 +1,11 @@
function main(jsonvalue params)
{
if ${params.Get[1].Equal["jk"]}
{
echo "JK JK"
}
else
{
echo "for real"
}
}

View File

@ -7,6 +7,7 @@ objectdef MovememntKeyMap
objectdef MRNavigation
{
variable bool CampSpotSet = FALSE
variable bool MoveToRequested = FALSE
variable point3f MoveToPoint
variable float Percision = 5
@ -18,10 +19,22 @@ objectdef MRNavigation
method MoveTo(point3f point)
{
This:BreakCampSpot
MoveToRequested:Set[TRUE]
MoveToPoint:Set[${point.X}, ${point.Z}, ${point.Z}]
}
method SetCampSpot(point3f point)
{
CampSpotSet:Set[TRUE]
MoveToPoint:Set[${point.X}, ${point.Z}, ${point.Z}]
}
method BreakCampSpot()
{
CampSpotSet:Set[FALSE]
}
method MoveToComplete()
{
MoveToRequested:Set[FALSE]
@ -72,13 +85,16 @@ function main()
{
while 1
{
if !${MRNav.MoveToRequested}
if ${MRNav.MoveToRequested}
{
continue
call Debounce "call MoveTo ${MRNav.MoveToPoint}" "move" 5
}
call Debounce "call MoveTo ${MRNav.MoveToPoint}" "move" 5
if ${MRNav.CampSpotSet}
{
call Debounce "call MoveTo ${MRNav.MoveToPoint}" "move" 5
}
wait 1
}
}

View File

@ -1,7 +1,5 @@
objectdef TestController
{
variable string Name="Apple"
variable string Color="Red"
method Initialize()
{
echo "TestController::Initialize"
@ -24,7 +22,23 @@ objectdef TestController
method Test()
{
MRNav:MoveTo["${Me.Target.Loc}"]
variable jsonvalue relayObj
relayObj:SetValue["$$>{
"target": "all",
"object": "MRRelayApi",
"method": "SetMoveSpot",
"parameters": {
"ForWho": "Dasteg",
"location": {
"X": ${Me.Target.Loc.X},
"Y": ${Me.Target.Loc.Y},
"Z": ${Me.Target.Loc.Z},
}
}
}<$$"]
innerspace:Relay["${relayObj.AsJSON~}"]
}
}

27
common/Relay.iss Normal file
View File

@ -0,0 +1,27 @@
#include "${LavishScript.HomeDirectory}/Scripts/mr/common/Api.iss"
objectdef RelayApi
{
method SetMoveSpot()
{
"echo SetMoveSpot: ${Context.AsJSON~}"
if !${MRNav(exists)}
{
echo "Loading Movement"
RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Navigation/Movement"
}
variable point3f location
location:Set[${Context.Get["parameters", "location", "X"]}, ${Context.Get["parameters", "location", "Y"]}, ${Context.Get["parameters", "location", "Z"]}]
MRApi:MoveTo["${Context.Get["parameters","ForWho"]}", "${location}"]
}
}
variable(global) RelayApi MRRelayApi
function main()
{
while 1
{
wait 1
}
}

View File

@ -9,16 +9,12 @@ objectdef MRApi
variable bool negate = FALSE;
if ${target.Count[":"]} > 0
{
negate:Set[${prefix.Equal["not"]}]
target:Set[${forWhoTarget.Token[2, ":"]}];
}
echo "Target: ${target}"
echo "negate: ${negate}"
if ${prefix.Equal["igw"]}
{
return ${Me.Group["${target}"](exists)}
@ -37,33 +33,46 @@ objectdef MRApi
if ${prefix.Equal["irwbn"]}
{
return !${Me.Name.Equal["${target}"]) && ${Me.Raid["${target}"](exists)}
}
if ${target.Equal["${Me.Name}"]} || ${target.Equal["all"]}
{
return !${negate};
echo "Name match ${negate.Not}"
return ${negate.Not};
}
if ${target.Equal["${Me.Class}"]} || ${target.Equal["${Me.SubClass}"]} || ${target.Equal["${Me.Archetype}"]}
{
return !${negate};
return ${negate.Not};
}
if ${target.Equal["melee"]} && (${Me.Archetype.Equal["fighter"]} || ${Me.Archetype.Equal["scout"]})
{
echo "melee match"
return !${negate};
return ${negate.Not};
}
if ${target.Equal["caster"]} && (${Me.Archetype.Equal["mage"]} || ${Me.Archetype.Equal["priest"]})
{
return !${negate};
return ${negate.Not};
}
return ${negate};
return ${negate}
}
static method MoveTo(string forWho, point3f location)
{
echo "Moving to ${location}"
if ${MRApi.IsForMe[${forWho}]}
{
MRNav:MoveTo["${location}"]
}
else
{
echo "NotForMe"
}
}
}

29
mr.iss
View File

@ -1,22 +1,39 @@
function main(... params)
{
if ${params[1].Lower.Equal["osa"]}
variable string command = ${params[1].Lower}
if ${command.Equal["osa"]}
{
run mr/osa/osa
}
elseif ${params[1].Lower.Equal["bot"]}
elseif ${command.Equal["bot"]}
{
run mr/bot/bot
}
elseif ${params[1].Lower.Equal["export"]}
elseif ${command.Equal["export"]}
{
run mr/bot/export_abilities
}
elseif ${params[1].Lower.Equal["test"]}
elseif ${command.Equal["relay"]}
{
ConsoleClear
run "mr/common/Navigation/test"
if !${MRRelayApi(exists)}
{
RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Relay"
}
}
elseif ${command.Equal["!c"]}
{
variable jsonvalue rest = []
rest:Erase[1]
if !${MRNav(exists)}
{
RunScript "${LavishScript.HomeDirectory}/Scripts/mr/common/Navigation/Movement"
}
run mr/commands/ProcessCommand ${rest}
}
elseif ${command.Equal["test"]}
{
run mr/common/Navigation/test
}
}