| RedeemWorkVoucher.mac
| October 10, 2011 5:34 PM
| 1.0.0
| MMOBugs.com
|
| FUNCTION: Macro to turn in ALL of your Worker Vouchers to
| Hobbs in Steamfont Mountains. You must be very close
| to Hobbs for the macro to run, less than 10 meters.
|
| REQUIREMENTS: MQ2ReachIt, MQ2Reward.
|
| WARNING: This macro assumes that you have no pending rewards in
| your reward window. The macro will select the first reward option
| to claim the item.
|
| OPTIONS: Change desiredTask variable the name of the quest that
| you want, the default is Animal pelts.
|
| Available options include:
| Fabulous Prize! - Fantastic Animal Pelt
| Fabulous Prize! - Fantastic Marrow
| Fabulous Prize! - Fantastic Silk
| Fabulous Prize! - Fantastic Spinneret Fluid
| Fabulous Prize! - Heavy Lifting Device
| Fabulous Prize! - Osmium Ore
| Fabulous Prize! - Shimmering Loam
| Fabulous Prize! - Ship in a Bottle
| Fabulous Prize! - Veilbreaker Escape Module
| Fabulous Prize! - Veilbreaker Executive Escape Device
| Fabulous Prize! - Veilbreaker Souvenir
SUB main
/declare desiredTask string outer Fabulous Prize! - Fantastic Animal Pelt
/declare taskGiverName string outer Hobbs
/declare taskKeyword string outer prize
/declare taskStartZoneId int outer 448
/declare desiredTaskId int outer 0
/declare requiredItem string outer Work Voucher
/if (!${Plugin[MQ2Reward].Name.Equal[MQ2Reward]}) {
/echo MQ2Reward is required to run this macro.
/endmacro
}
/if (!${Plugin[MQ2ReachIt].Name.Equal[MQ2ReachIt]}) {
/echo MQ2Reward is required to run this macro.
/endmacro
}
/call checkLocation
:dloop
/if (${Window[TaskWnd].Child[TASK_TaskList].List[=${desiredTask}, 2]}) {
/call handInRequiredItem
} else {
/call checkForRequiredItem
/call requestTaskList
/call getTask
}
/delay 3s
/goto :dloop
/return
SUB checkLocation
/if (${Zone.ID} != ${taskStartZoneId}) /echo This macro only runs in Steamfont Mountains.
/if (${Zone.ID} == ${taskStartZoneId} && ${Spawn[npc ${taskGiverName}].Distance} > 10) /echo Move closer to Hobbs, within 10 meters.
/if (${Zone.ID} != ${taskStartZoneId} || ${Spawn[npc ${taskGiverName}].Distance} > 10) /endmacro
/return
SUB checkInvis
/if (${Me.Invis}) {
/echo You must be visible to run this macro. Terminating.
/endmacro
}
/return
SUB requestTaskList
/call targetTaskGiver
/delay 1s
/if (${Target.CleanName.Equal[${taskGiverName}]}) {
/call checkInvis
/call checkLocation
/say ${taskKeyword}
/delay 2s
} else {
/echo Could not target task giver npc ${taskGiverName}.
/endmacro
}
/return
SUB targetTaskGiver
/call checkLocation
/squelch /target clear
/squelch /target npc ${taskGiverName}
/return
SUB getTask
/call checkLocation
/declare failedAcceptAttempts int inner 0
:acceptTask
/if (${Window[TaskSelectWnd].Open}) {
/varset desiredTaskId ${Window[TaskSelectWnd].Child[TSEL_TaskList].List[=${desiredTask}]}
/delay 1s
/notify TaskSelectWnd TaskList listselect ${desiredTaskId}
/delay 1s
/notify TaskSelectWnd AcceptButton leftmouseup
/delay 1s
/if (${Window[TaskWnd].Child[TASK_TaskList].List[=${desiredTask}, 2]} && ${failedAcceptAttempts} < 4) {
/varcalc failedAcceptAttempts ${failedAcceptAttempts} + 1
/if (${Window[TaskSelectWnd].Open}) /goto :acceptTask
} else /if (${failedAcceptAttempts} > 3) {
/echo Failed to accept the task
/endmacro
}
} else {
/echo Failed to get the task list
/endmacro
}
/squelch /cleanup
/return
SUB checkForRequiredItem
/if (${FindItemCount[=${requiredItem}]} == 0) {
/echo You do not have any more ${requiredItem}s.
/endmacro
}
/return
SUB handInRequiredItem
/declare retrieveItemFailedAttemptsCount int inner 0
:getRequiredItem
/call getRequiredItemFromInventory
/delay 2s
/if (!${Cursor.ID} && ${retrieveItemFailedAttemptsCount} < 4) {
/autoinventory
/varcalc retrieveItemFailedAttemptsCount ${retrieveItemFailedAttemptsCount} + 1
/echo ${retrieveItemFailedAttemptsCount}
/goto :getRequiredItem
} else /if (${retrieveItemFailedAttemptsCount} >= 3) {
/echo Could not get the required item
/endmacro
}
:handInItem
/call targetTaskGiver
/if (${Cursor.ID} && ${Target.ID}) {
/ubertrade
/delay 2s ${Window[GiveWnd].Open}
/if (${Window[GiveWnd].Open}) {
/notify GiveWnd GVW_Give_Button leftmouseup
}
/delay 2s !${Window[GiveWnd].Open}
}
/if (${Cursor.ID} || ${Window[GiveWnd.Open]}) {
/echo Failed to turn in required item
/endmacro
}
/if (${Window[RewardSelectionWnd].Open}) {
/reward 1
/delay 2s !${Window[RewardSelectionWnd].Open}
/squelch /cleanup
}
/return
SUB getRequiredItemFromInventory
/call checkForRequiredItem
/ctrl /itemnotify ${FindItem[=${requiredItem}].InvSlot} leftmouseup
/return