本帖最后由 rolaka 于 2009-7-22 17:17 编辑 Func _GardenGetConf($_fuid)
For $i = 0 To 5
_IENavigate($object, "http://www.kaixin001.com/!house/!garden//getconf.php?verify=" & $token & "&fuid=" & $_fuid & "&r=0." & TimerInit())
$temp = _IEBodyReadHTML($object)
If StringInStr($temp, "</RANK>") Then
Return BinaryToString(StringToBinary("<CONF><ACCOUNT><RANK>" & $temp, 4), 4)
EndIf
Next
EndFunc ;==>_GardenGetConf
Func _GardenManage($_fuid)
Writelog("取得xml信息文件...")
_XMLLoadXML(_GardenGetConf($_fuid))
Writelog("ok!", 1)
;遍历
For $i = 1 To 15
;地的编号
$farmnum = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/FARMNUM")
;状态: 1-可耕種, 0-不可耕種
$status = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/STATUS")
;水: 0-6, 小于6表示需要浇水
$water = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/WATER")
;草: 0-没有, 1-有
$grass = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/GRASS")
;害虫: 0-没有, 1-有
$vermin = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/VERMIN")
;种子id
$seedid = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/SEEDID")
;好友共享地: 1-是, 0-不是
$shared = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/SHARED")
;html信息
$crops = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/CROPS")
;所有者好友id
$fuid = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/FUID")
;判断是否可耕种
Writelog("地块编号: " & $farmnum[1])
;农作物生长状态: -1-已偷光, 1-生长中, 2-可收割, 3-收割完
If $status[1] == 0 Then
Writelog("...不能耕种 放弃!", 1)
ExitLoop
EndIf
$cropsstatus = _XMLGetValue("/CONF/GARDEN/ITEM[" & $i & "]/CROPSSTATUS")
If @error Then
Writelog("...未耕种 放弃!", 1)
ContinueLoop
EndIf
;判断是否需要浇水
If $water[1] < 5 Then
;浇水
Writelog("浇水中...")
_GardenWater($_fuid, $farmnum[1])
Writelog("ok!", 1)
EndIf
;是否需要除虫
If $vermin[1] == 1 Then
;除虫
Writelog("捉虫中...")
_GardenVermin($_fuid, $farmnum[1])
Writelog("ok!", 1)
EndIf
;是否需要除草
If $grass[1] == 1 Then
;拔草
Writelog("除草中...")
_GardenGrass($_fuid, $farmnum[1])
Writelog("ok!", 1)
EndIf
;是否可收割
If $cropsstatus[1] == 2 Then
Writelog("已成熟...")
;判断是否可偷/收获
If Not StringInStr($crops[1], "偷") And Not StringInStr($crops[1], "不") Then
;判断是否是爱心地
If $shared[1] == 1 Then
Writelog("是爱心地...", 1)
;是不是我的地
If $fuid[1] == $myuid Or $_fuid == 0 Then
;偷菜/收获
Writelog("可收获...", 1)
_GardenHavest($_fuid, $farmnum[1])
Writelog("ok!", 1)
Else
Writelog("不可收获 放弃!", 1)
EndIf
;如果不是爱心地
Else
Writelog("可收获...", 1)
_GardenHavest($_fuid, $farmnum[1])
Writelog("ok!", 1)
EndIf
Else
Writelog("不可收获 放弃!", 1)
EndIf
EndIf
Next
EndFunc ;==>_GardenManage
Func Writelog($str, $line = 0)
If $str == "" Then
FileWrite($fp, "+-----------------------------------------+" & @CRLF)
FileWrite($fp, "| |" & @CRLF)
FileWrite($fp, "| Hyperion's Log |" & @CRLF)
FileWrite($fp, "| |" & @CRLF)
FileWrite($fp, "+-----------------------------------------+")
Else
If $line == 0 Then
FileWrite($fp, @CRLF & "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] " & $str)
Else
FileWrite($fp, $str)
EndIf
EndIf
EndFunc ;==>Writelog
需要ie.au3 XMLDomWrapper.au3 支持 这是我那个外挂取得资料的部分...
这还不是完整的哦 |