mrbot/utilities/NpcHelpers.iss
2023-12-08 15:07:11 -06:00

85 lines
2.0 KiB
Plaintext

objectdef QuestHelpers
{
member:bool IsQuestPending()
{
return ${EQ2UIPage[PopUp,RewardPack].Child[button,RewardPack.ButtonComposite.Accept](exists)}
}
method AcceptQuest()
{
EQ2UIPage[PopUp,RewardPack].Child[button,RewardPack.ButtonComposite.Accept]:LeftClick
}
}
objectdef NpcHelpers
{
variable QuestHelpers QuestHelper
function GetQuestFromNpc(... params)
{
if ${params.Size} < 1
{
echo "Usage: GetQuestFromNpc <NPC Name> [...Dialog Choices(optional)]"
return
}
variable string npcName = ${params[1]};
Actor[Query, Name =- "${npcName}"]:DoubleClick
if ${params.Size} > 1
{
variable int idx
for (idx:Set[2]; ${idx} <= ${params.Size}; idx:Inc)
{
variable string choice = ${params[i]};
EQ2UIPage[ProxyActor,Conversation].Child[composite,replies].Child[button,choice]:LeftClick
wait 5
}
}
else
{
variable int dialogOptionsTaken = 0;
do
{
dialogOptionsTaken:Inc
EQ2UIPage[ProxyActor,Conversation].Child[composite,replies].Child[button,1]:LeftClick
wait 5
}
while !${RewardWindow(exists)} && ${dialogOptionsTaken} < 10
}
wait 5
if ${QuestHelper.IsQuestPending}
{
wait 5
QuestHelper:AcceptQuest
}
else
{
echo "Quest not offered"
return
}
}
}
atom atexit()
{
echo "Exiting..."
}
function main()
{
; variable NpcHelpers NpcHelper
; variable NavHelpers NavHelper
; echo "Starting test"
; /*
; 910.060730,12.070809,239.235611
; 913.628540,10.217931,170.337494
; 907.632385,10.002500,152.857849
; 897.398376,10.180861,146.060623
; */
; ; wait 5
; ; call NpcHelper.GetQuestFromNpc "Germa"
; call NavHelper.FollowPath()
; return
}