mrbot/common/api.iss

94 lines
2.5 KiB
Plaintext

#ifndef _mr_api_
#define _mr_api_
objectdef MRBotApi
{
variable string test = "test MRAPI";
member:bool IsForMe(string forWhoTarget)
{
variable string target = ${forWhoTarget}
variable string prefix = ${forWhoTarget.Token[1, ":"]}
variable bool negate = FALSE
echo "IsForMe ${forWhoTarget} ${prefix} ${target}"
if ${target.Count[":"]} > 0
{
negate:Set[${prefix.Equal["not"]}]
target:Set[${forWhoTarget.Token[2, ":"]}];
}
if ${prefix.Equal["igw"]}
{
return ${Me.Group["${target}"](exists)}
}
if ${prefix.Equal["igwbn"]}
{
return !${Me.Name.Equal["${target}"]) && ${Me.Group["${target}"](exists)}
}
if ${prefix.Equal["irw"]}
{
return ${Me.Raid["${target}"](exists)}
}
if ${prefix.Equal["irwbn"]}
{
return !${Me.Name.Equal["${target}"]) && ${Me.Raid["${target}"](exists)}
}
if ${target.Equal["${Me.Name}"]} || ${target.Equal["all"]}
{
echo "Name match ${negate.Not}"
return ${negate.Not};
}
if ${target.Equal["${Me.Class}"]} || ${target.Equal["${Me.SubClass}"]} || ${target.Equal["${Me.Archetype}"]}
{
return ${negate.Not};
}
if ${target.Equal["melee"]} && (${Me.Archetype.Equal["fighter"]} || ${Me.Archetype.Equal["scout"]})
{
echo "melee match"
return ${negate.Not};
}
if ${target.Equal["caster"]} && (${Me.Archetype.Equal["mage"]} || ${Me.Archetype.Equal["priest"]})
{
return ${negate.Not};
}
return ${negate}
}
function MoveTo(string forWho, point3f location, float minDistance = 0)
{
echo "Moving to ${location}"
if ${This.IsForMe["${forWho}"]}
{
MRNav:MoveTo["${location}"]
}
else
{
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
}
}
}
#endif