--[[
飺
    ڴ֮üѪΧסˣ˽űǿΧĸѪ
֮ߡ

ʹ˵
    趨Ŀݼʱĸλõܣϴð
ΧסзӢۡĬϿݼΪBʹõ78ĵߡ޸ģ޸λüű
ġ
    ע⣺ʹõĵ78ܹ4ϵİӣ꾡ΧӢ
۵Ĵ

ע
ǷŲȫĸ볢ȫģʽϵ
ڶ°Ӳ̫죬ӳٵҲԵʱû⣬ϵҡ
ڶӲshiftԲ벻̫Զ޷¡
ӵλòʣ޸ģϵҡ
ݻӭ飬qq:167849866 bbs.myebe.com

л
stan Ĳ
                                      ߣǡ
                                                    ]]

--űģ


--û޸Ĵ
dropkey=66        --66Bļ룬޸OΪ79
dropitem1=103     --1037޸ģ1Ϊ97
dropitem2=104	  --1048޸ģ2Ϊ98
itemn=7           --ʹõĵߵλã77ʹõ1Ϊ1
--û޸Ĵ

itemtab={}                          --ǵλñοֵ
itemtab[7]={x=0.666,y=0.833}        --7
itemtab[8]={x=0.7125,y=0.833}       --8
itemtab[4]={x=0.666,y=0.9}          --4
itemtab[5]={x=0.7125,y=0.9}         --5
itemtab[1]={x=0.666,y=0.963}        --1
itemtab[2]={x=0.7125,y=0.963}       --2

if getwshscriptversion() < 3 then
    msgbox('ʹ2.5汾')
end

mousetab={}
mousetab[1]={x=0,y=0.045}          --ĸӵλñ
mousetab[2]={x=0,y=-0.045}
mousetab[3]={x=0.045,y=0}
mousetab[4]={x=-0.045,y=0}

setkeywatch('keyhookfunc')

function keyhookfunc(keycode, controlkey, downorup)
    if 0==iswar3front() then return 0 end
    if 1==ischat() then return 0 end
    if downorup==1 then return 0 end
    if keycode==dropkey and downorup==0 then
        currentx,currenty = getcursorpos()
        sleep(20)
        war3w = getwar3window()
        war3wl,war3wr,war3wt,war3wb = getwindowrect(war3w)
        war3wlc,war3wrc,war3wtc,war3wbc = getclientrect(war3w)
        itemx=war3wrc*itemtab[itemn]["x"]
        itemy=war3wbc*itemtab[itemn]["y"]    
	isitem=getpixel(war3w,itemx, itemy)
	dropitem=dropitem1
        j=0
        sleep(50)
	for i = 1,4,1 do
            isitemt=getpixel(war3w,itemx, itemy)
            sleep(100)
	    if isitem~=isitemt or j>2 then dropitem=dropitem2 end
            sleep(10)
            mousex=currentx+(war3wr-war3wl)*mousetab[i]["x"]
	    mousey=currenty+(war3wb-war3wt)*mousetab[i]["y"]
	    setcursorpos(mousex, mousey)
	    sleep(10)
	    lockmouse(mousex, mousey)
	    sleep(10)
	    keydown(dropitem)
	    sleep(10)
	    keyup(dropitem)
	    sleep(20)
            mouseclick(0)
	    sleep(20)
	    lockmouse(-1, -1)
            j=j+1
	    sleep(230)      --һ֮ӳ٣Ĭ230ms޸
	end
        sleep(10)
    return 1
    end
end

