diff --git a/commands/ProcessCommand.iss b/commands/ProcessCommand.iss new file mode 100644 index 0000000..994512f --- /dev/null +++ b/commands/ProcessCommand.iss @@ -0,0 +1,11 @@ +function main(jsonvalue params) +{ + if ${params.Get[1].Equal["jk"]} + { + echo "JK JK" + } + else + { + echo "for real" + } +} \ No newline at end of file diff --git a/common/Navigation/Movement.iss b/common/Navigation/Movement.iss index 68166a1..d79a5b3 100644 --- a/common/Navigation/Movement.iss +++ b/common/Navigation/Movement.iss @@ -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 } } diff --git a/common/Navigation/Test.iss b/common/Navigation/Test.iss index db6aaf8..d52d6c6 100644 --- a/common/Navigation/Test.iss +++ b/common/Navigation/Test.iss @@ -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~}"] } } diff --git a/common/Relay.iss b/common/Relay.iss new file mode 100644 index 0000000..0866aa6 --- /dev/null +++ b/common/Relay.iss @@ -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 + } +} \ No newline at end of file diff --git a/common/api.iss b/common/api.iss index dacf05c..d76eebc 100644 --- a/common/api.iss +++ b/common/api.iss @@ -8,17 +8,13 @@ objectdef MRApi variable string prefix = ${forWhoTarget.Token[1, ":"]}; 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" + } } } diff --git a/mr.iss b/mr.iss index cf1c293..054d7c0 100644 --- a/mr.iss +++ b/mr.iss @@ -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 } } \ No newline at end of file