| ----------------------------------------------------------------------------
| SUB: Check GiveTo - Based on code from el_nene's autobot. Used with permission.
| Autobot is available at www.Macroquest2.com VIP macro section.
| Updated and Revised for KissAssist
| ----------------------------------------------------------------------------
Sub GiveTo(string GItem, int GTarget)
DEBUGBUFF GiveTo Enter
/declare ItemSummoned int local 0
/if (${Target.ID}!=${GTarget}) {
/target id ${GTarget}
/delay 2s ${Target.ID}==${GTarget}
}
/if (${Target.Distance}>4 && ${Target.Distance}<=${CampRadius}) {
/moveto id ${Target.ID} mdist 4
/delay 65 ${MoveTo.Stopped}
}
/if (${Me.Mount.ID}) {
/dismount
/delay 20 !${Me.Mount.ID}
}
/if (${Me.Levitating}) {
/removelev
/delay 20 !${Me.Levitating}
}
/if (!${Cursor.ID}) {
/if (${FindItemCount[=${GItem}]}>0) {
/shift /itemnotify "${GItem}" leftmouseup
/delay 2s ${Cursor.ID}
} else {
/echo Item: ${GItem} Not Found in Inventory. Are you sure the Item Name is Correct?
/return
}
}
/while (${Cursor.ID} && ${Cursor.NoRent}) {
/if (${Cursor.ID}==${FindItem[=${GItem}].ID}) {
/varset ItemSummoned 1
/face id ${Target.ID}
/delay 1s
/nomodkey /click left target
} else {
/echo Item: ${GItem} Not Found in Inventory. Are you sure the Item Name is Correct?
/return
}
/delay 1s ${Cursor.ID}
}
/delay 2s ${Window[GiveWnd].Open}
/if (${ItemSummoned} && ${Window[GiveWnd].Open}) {
/delay 1s
/notify GiveWnd GVW_Give_Button leftmouseup
/echo Giving ${GItem} to ${Target.CleanName}
} else {
/echo Item is NOT SUMMONED canceling trade
/notify GiveWnd GVW_Cancel_Button leftmouseup
}
/delay 20
| New pet patch gives back item if pet has equipped. Delete item from cursor.
/if (${Cursor.ID} && (${Cursor.NoRent} || ${Cursor.Name.Find[muzzle]} || ${Cursor.Name.Find[visor]} || ${Cursor.Name.Find[belt]}) && ${Cursor.ID}==${FindItem[=${GItem}].ID}) {
/while (${Cursor.ID}) {
/destroy
/delay 10
}
}
/delay 200 !${Window[GiveWnd].Open}
DEBUGBUFF GiveTo Leave
/return