rendered paste body;+-----------------------------------------------------------------------------------------------------
;| Name: FindChest
;| In: none
;| Returns: none
;| Description: Searches for a chest, mines, herbs etc
;|
;| ©2005 Fippy
;+-----------------------------------------------------------------------------------------------------
function FindChest()
{
declare Index int 1
declare ChestList guidlist local
declare ChestGUID string local
declare RangeMod float local 1
;call UpdateHudStatus "Look for GameObjects"
;Use the object search to find all nearby lootable Chests
;debug("FindChest: DistPointLine ${Me.X} ${Me.Y} ${LastWaypointX} ${LastWaypointY} ${CurrentWaypointX} ${CurrentWaypointY}")
;call DistPointLine ${Me.X} ${Me.Y} ${LastWaypointX} ${LastWaypointY} ${CurrentWaypointX} ${CurrentWaypointY}
;debug("FindChest: ${Return} ${MaxRoam}")
;Set the range to search for based upon our distance from the path
;if ${Return}>0 && ${Return}<${MaxRoam}
; RangeMod:Set[${MaxRoam}-${Return}]
;debug("FindChest: ChestList:Search[-gameobjects,-chest,-usable,-unlocked,-nearest,-range 0-${RangeMod}]")
ChestList:Search[-gameobjects,-mine,-usable,-nearest,-range 0-50]
if ${ChestList.Count}
{
do
{
ChestGUID:Set[${ChestList.GUID[${Index}]}]
;Make sure we have actualy found something to loot and its not too far off.
if ${GameObject[${ChestGUID}](exists)} && ${Object[${ChestGUID}].Field[15]} == 1 && !${GameObject[${ChestGUID}].Locked}
{
debug("FindChest:Found ${GameObject[${ChestGUID}].Name}")
TargetGUID:Set[${ChestGUID}]
NoObjectCount:Set[0]
return
}
}
while ${Index:Inc}<=${ChestList.Count}&&!${Me.InCombat}
}
else
{
ChestList:Search[-gameobjects,-herb,-usable,-nearest,-range 0-50]
if ${ChestList.Count}
{
do
{
ChestGUID:Set[${ChestList.GUID[${Index}]}]
;Make sure we have actualy found something to loot and its not too far off.
if ${GameObject[${ChestGUID}](exists)} && ${Object[${ChestGUID}].Field[15]} == 1 && !${GameObject[${ChestGUID}].Locked}
{
debug("FindChest:Found ${GameObject[${ChestGUID}].Name}")
TargetGUID:Set[${ChestGUID}]
NoObjectCount:Set[0]
return
}
}
while ${Index:Inc}<=${ChestList.Count}&&!${Me.InCombat}
}
}
;If we didnt find anything report it
NoObjectCount:Inc
debug("No Objects found (${NoObjectCount})")
return "NOTARGET"
}