Project

General

Profile

 

Also available in: PDF

The LootWindow

The following script illustrates advanced topics on how to obtain information from and manipulate the LootWindow.   The comments provided, along with the ISXEQ2 wiki, should provide the documentation necessary to work with the LootWindow in all modes.

function main()
{
    ;; If no lootwindow is up/available, we can't do very much
    if !${LootWindow(exists)}
    {
        echo "No LootWindow Available"
        return
    }
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; List all entries in the GroupMembers 'eq2dropdownbox'
    variable index:collection:string GroupMembers
    variable iterator GroupMembersIterator
    variable int GroupMembersCounter = 0
    
    LootWindow.GroupMembers:GetOptions[GroupMembers]
    GroupMembers:GetIterator[GroupMembersIterator]
    
    echo "The 'GroupMembers' DropDownBox has ${GroupMembers.Used} options:"
    
    if (${GroupMembersIterator:First(exists)})
    {
        do
        {
            if (${GroupMembersIterator.Value.FirstKey(exists)})
            {
                do
                {
                     echo "#${GroupMembersCounter}::  '${GroupMembersIterator.Value.CurrentKey}' => '${GroupMembersIterator.Value.CurrentValue}'"
                }
                while ${GroupMembersIterator.Value.NextKey(exists)}
                echo "------"
            }
            GroupMembersCounter:Inc
        }
        while ${GroupMembersIterator:Next(exists)}
    }
    
    ;;;; NOTES:
    ;;;;   1. To select a groupmember from the dropdownbox (i.e., when using "Leader Only" loot), simply call the Set
    ;;;;      METHOD of the eq2dropdownbox with the index of the one you want.  For example, using the routine above, 
    ;;;;      once you matched the name of the person you wanted:  LootWindow.GroupMembers:Set[${GroupMembersCounter}]
    ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; List Items as 'iteminfo' types
    variable int ItemsCounter = 1
    
    do
    {
        echo "Item #${ItemsCounter}:  ${LootWindow.Item[${ItemsCounter}]}  (ID: ${LootWindow.Item[${ItemsCounter}].ID})"
    }
    while (${ItemsCounter:Inc} <= ${LootWindow.NumItems})
    ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; List Items as 'eq2icon' types
    variable int ChildrenCounter = 1
    
    do
    {
        ;; The "ItemsPage" MEMBER of the 'eq2lootwindow' datatype has various UI elements as children.  This script
        ;; is only interested in the 'eq2icon' children, as there will be an icon for every item and it is the "icon"
        ;; that needs to be LeftClicked to indicate selection.
        if (${LootWindow.ItemsPage.Child[${ChildrenCounter}].Type.Find[eq2icon]})
        {
            ;; if the icon's "NodeID" is less than or equal to zero, then it's a blank placeholder, and we skip it.
            if (${LootWindow.ItemsPage.Child[${ChildrenCounter}].NodeID} <= 0)
                continue
                
            echo "Icon #${ChildrenCounter}: This icon is for ItemID ${LootWindow.ItemsPage.Child[${ChildrenCounter}].NodeID}"
        }
    }
    while (${ChildrenCounter:Inc} < ${LootWindow.ItemsPage.NumChildren})
    
    ;;;; NOTES:
    ;;;;   1. To select an item in the window (i.e., when using "Leader Only" loot), simply call the LeftClick 
    ;;;;      METHOD of the icon that has the NodeID that matches the ItemID for the item you wish to select.
    ;;;;      For example, LootWindow.ItemsPage.Child[${ChildrenCounter}]:LeftClick
    ;;
    ;;        (UPDATE:  Per the issue raised in http://forge.isxgames.com/issues/1780, it may be necessary
    ;;        to LeftClick the corresponding eq2text rather than eq2icon.)
    ;;
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; If using "Leader Only" loot, once the script has set the correct group member's name from the 
    ;; GroupMembers, and selected the intended item from the ItemsList, all that is left is to call:
    ;; LootWindow.LeaderAssign:LeftClick
}