Started working on an API, implemented ForWho I think
This commit is contained in:
parent
617bb0aa3f
commit
b102f2793d
72
common/api.iss
Normal file
72
common/api.iss
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef _mr_api_
|
||||
#define _mr_api_
|
||||
objectdef MRApi
|
||||
{
|
||||
static member:bool IsForMe(string forWhoTarget)
|
||||
{
|
||||
variable string target = ${forWhoTarget};
|
||||
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)}
|
||||
}
|
||||
|
||||
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"]}
|
||||
{
|
||||
return !${negate};
|
||||
}
|
||||
|
||||
if ${target.Equal["${Me.Class}"]} || ${target.Equal["${Me.SubClass}"]} || ${target.Equal["${Me.Archetype}"]}
|
||||
{
|
||||
return !${negate};
|
||||
}
|
||||
|
||||
if ${target.Equal["melee"]} && (${Me.Archetype.Equal["fighter"]} || ${Me.Archetype.Equal["scout"]})
|
||||
{
|
||||
echo "melee match"
|
||||
return !${negate};
|
||||
}
|
||||
|
||||
if ${target.Equal["caster"]} && (${Me.Archetype.Equal["mage"]} || ${Me.Archetype.Equal["priest"]})
|
||||
{
|
||||
return !${negate};
|
||||
}
|
||||
|
||||
return ${negate};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
2
mr.iss
2
mr.iss
@ -17,6 +17,6 @@ function main(... params)
|
||||
elseif ${params[1].Lower.Equal["test"]}
|
||||
{
|
||||
ConsoleClear
|
||||
run mr/test
|
||||
run mr/test ${params[2]}
|
||||
}
|
||||
}
|
||||
41
test.iss
41
test.iss
@ -1,39 +1,14 @@
|
||||
#include "${LavishScript.HomeDirectory}/Scripts/mr/common/KnowledgeBook.iss"
|
||||
#include "${LavishScript.HomeDirectory}/Scripts/mr/common/api.iss"
|
||||
|
||||
function main()
|
||||
function main(string forWho)
|
||||
{
|
||||
variable jsonvalue effect
|
||||
effect:SetValue[$$>{
|
||||
"description": "Inflicts 559 disease damage on targets in Area of Effect."
|
||||
}<$$]
|
||||
|
||||
variable string description
|
||||
|
||||
description:Set["${effect.Get["description"]}"]
|
||||
|
||||
if ${description.Left[8].NotEqual["Inflicts"]}
|
||||
echo "Checking forWho ${forWho}"
|
||||
if ${MRApi.IsForMe["${forWho}"]}
|
||||
{
|
||||
echo "0"
|
||||
return 0
|
||||
echo "This is for me!"
|
||||
}
|
||||
|
||||
variable int64 minDamage
|
||||
variable int64 maxDamage
|
||||
variable string damageType
|
||||
|
||||
minDamage:Set["${description.Token[2, " "].Replace[",", ""]}"]
|
||||
if ${description.Token[3, " "].Equal["-"]}
|
||||
else
|
||||
{
|
||||
maxDamage:Set["${description.Token[4, " "].Replace[",", ""]}"]
|
||||
damageType:Set["${description.Token[5, " "]}"]
|
||||
echo "This is not for me!"
|
||||
}
|
||||
else
|
||||
{
|
||||
maxDamage:Set["${description.Token[2, " "].Replace[",", ""]}"]
|
||||
damageType:Set["${description.Token[3, " "]}"]
|
||||
}
|
||||
|
||||
echo "${description}"
|
||||
echo "${minDamage} - ${maxDamage} ${damageType} damage"
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user