作者k0286 (出包不能亡!!)
看板WOW
標題Re: [問題] 拍賣的巨集
時間Sun Oct 18 16:14:17 2009
反正這類型巨集已經很普遍了,只是因為Ptt本身板風就比較少巨集和AH相關的討論
所以消息比較閉鎖。
是沒什麼好藏私的,只是有時候寫出來就會有人開始問一些,
"難以評論"的問題,所以心情上會覺得很麻煩。
(最常見就是開始爐著我說,為什麼他不能用,哪裡出問題)
(最後都發現 不是沒斷行就是沒複製好再不然就根本是他誤解巨集的意義)
============================
正文開始
============================
先介紹幾個拍賣有關的API
1.) GetAuctionItemInfo
n ,t ,c ,q ,u ,l ,mB ,mI ,bP ,bA ,hB ,o ,s = GetAuctionItemInfo("type", index)
└─────────回傳值───────┘ └─參數─┘
回傳值
n = Name 物品名稱
t = Texture 種類
c = Count 數量
q = Quality 品質(灰/白/綠/藍/紫/橘/紅)
u = canUse 可否使用(布林)
l = Level 需要等級
mB= minBid 競標起始價
mI= minIncrement 競標最低加價
bP= buyoutPrice 直購價
bA= bidAmount 目前最高出價
hB= highBidder 玩家是否為目前最高出價者(布林)
o = owner 賣家
s = saleStatus 是否賣出(布林)
參數
type 有三項
a.) list => 檢查AH的瀏覽視窗
b.) bidder => 檢查AH的競標視窗
c.) owner => 檢查AH的拍賣視窗
index 整數 1-50
檢查視窗中第x項物品
2.)
GetNumAuctionItems
batch,count = GetNumAuctionItems("type")
└─回傳值┘ └參數┘
回傳值
batch = 本頁有幾個值 (最大值50,因為一頁最多能顯示50筆資料)
count = 總共有幾個值 (總共有幾個值)
/*---
e.g.假設我搜尋裁縫配方,總過獲得109個結果
那當我在瀏覽Page1時,batch = 50 , count = 109
2 50 109
3 9 109
---*/
參數
type = {list,bidder,owner} 說明同上
3.)
GetAuctionItemTimeLeft
timeleft = GetAuctionItemTimeLeft("type", index);
└回傳值┘ └─參數─┘
回傳值
timeleft = 1 剩餘時間短 (少於30分鐘)
2 中 (30min~2hr)
3 長 (2hr~12hr)
4 非常常常常長 (12hr~48hr)
參數
type = {list,bidder,owner} 說明同上
index整數 1-50 檢查視窗中第x項物品
--------------------------------------------------------
解析最簡單的下架巨集
z - 17 - 20 - 37 (沒人下標的東西全下架.)
/跑 local
o,j,h="owner",GetNumAuctionItems("owner")
for i=j,1,-1 do h=select(11,GetAuctionItemInfo(o,i))
if not h
then CancelAuction(i)
end
end
//--- 第一行 設定變數 o =owner, j =GetNumAuctionItems("owner"), h =nil
/* PS 程式語言中出現 = 請想成是設定(set) ==才是等於(equal to) */
//--- 第二行 for迴圈 起始值 j 做到 1 增減變量 -1
//--- 宣告 h 是 GetAuctionItemInfo的第11個回傳值,也就是hB
//--- 第三行 如果h是flase則取消拍賣
/* hB 當玩家是最高出價者傳回值1 其他情況則是nil
但是自己拍賣的物品無法自行標價,所以系統會當成有人競標則傳回1 */
----------------------------------------
接下來是幾個類似功能的常見(意思是Google都很容易找到)變種版
取消無人競標且時間少於一定者
/run local o,j,h,t="owner",GetNumAuctionItems("owner")for i=j,1,-1 do
h,t=select(11,GetAuctionItemInfo(o,i)),GetAuctionItemTimeLeft(o,i)if not h
and t and
t==1 then CancelAuction(i)end end
t==1 短
2 中
3 長
4 非常長
--------------------------------------------
取消特定物品
/run local G,s,o,h,t=GetAuctionItemInfo,select,"owner"for
i=GetNumAuctionItems(o),1,-1 do n,h=s(1,G(o,i)),s(11,G(o,i))if not h and
strfind(n,"
紳士")then CancelAuction(i)end end
只要拍賣物品 含有"紳士" 就會取消
常見的就這兩種,需要更改條件就照上面的說明自己改
--------------------------------------------
另外還有很大一類是掃貨用巨集,語法結構和使用的API都很類似,邏輯結構上比較複雜
以下舉幾個例子
==============================
基本型 價格為XX 全拉
/run local l,d,b="list","bid"for i=1,GetNumAuctionItems(l)do
b=select(9,GetAuctionItemInfo(l,i))if b and b==
$$ then
PlaceAuctionBid(l,i,1)elseif CanSendAuctionQuery()then QueryAuctionItems()end
end
$$ 以C為單位 (1G=100S=10000C)
==============================
axb 大盤掃貨型 (設定不好不是斷線就是把整個AH掃下來)
A.)競標
/run local t,n,c,m,b,x,h=0;for i=1,GetNumAuctionItems("list")do
n,_,c,_,_,_,m,b,_,x,h = GetAuctionItemInfo("list",i)x=x==0 and m or x+b;if
not h and n=="
物品名"and c==
堆疊數 and x<
$$$ then
PlaceAuctionBid("list",i,x)t=t+1;if t==5 then break;end;end;end
B.)直購
/run local t,n,c,b,j=0;j=0;for i=1,GetNumAuctionItems("list")do
n,_,c,_,_,_,_,_,b,_,_ = GetAuctionItemInfo("list",i)if n=="
物品名"and c==
堆疊數
and b<
$$$ then PlaceAuctionBid("list",i,b)t=t+1;if t==5 then
break;end;end;end;
=================================
最後是國外討論區常有人問,Ptt和巴哈沒看過人問的
快速分堆/快速堆疊
1.) 將滑鼠懸停的物品分堆
/跑 for i=0,4 do for j=1,28 do local_,c,l=GetContainerItemInfo(i,j)if l and
c>1 then ClearCursor()SplitContainerItem(i,j,
個)for x=0,4 do for
y=1,GetContainerNumSlots(x)do if not GetContainerItemLink(x,y)then
PickupContainerItem(x,y)end end end end end end
一疊要分成幾個
2. )自動壓縮可堆疊物品
/run local t,x,c=GetCursorInfo()if t=="item"then for i=0,4 do for j=1,28 do
_,c,t=GetContainerItemInfo(i,j)if c and c>0 and c<select(8,GetItemInfo(x))and
not t and strmatch(GetContainerItemLink(i,j)or"","m:"..x)then
PickupContainerItem(i,j)end end end end
--
大概就這樣了,不過我已經Quit一段時間了。有錯誤我也解決不了。
--
2009.8.5
(Horde) Focus and Attitude
NightSong Raid營運結束
(Allience) 黑色禁衛軍
Lice和enchyi,你們辛苦了 我見證了兩個老公會的衰亡與結末
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.225.85
推 furbyyeh:直接丟給他wowwiki API就好了 10/18 16:21
推 powerkian:專業推 10/18 16:22
推 shenmi:推 真神 10/18 16:31
推 vendock:快推不然人家說我們看不懂 10/18 16:57
推 a2364983:喔 我剛好在搞拍賣 愛死這個了 馬上來用 10/18 17:12
推 Jaicabai:快推不然人家會知道我們看不懂 10/18 17:51