November | ||||||
---|---|---|---|---|---|---|
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
27 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
改了个WOW插件-法师自动补全施法材料
开始重操旧业玩起了WOW,只不过这次玩的是法师。法师有三种施法材料:魔粉,传送符文,传送门符文。用光了会被人质疑为不够专业。材料在包裹里20个一组占一个格子,所以一次买的时候最好买齐20个,省的老是回来补。手动买其实也没啥不方便的,不过能自动还是自动吧,懒人自然有懒想法。
这个功能倒是很常见的功能了,从古到今,带这功能的各种插件和宏都流传了不少。不过我这不是没装嘛。特地去为了这点事情而找个东西,实在太费劲了,不如自己直接添上。我在已经装了的一个叫AutoRepair的插件上开始修改。AutoRepair,顾名思义就是自动修理装备用的,修理装备会需要打开商店界面,用到MERCHANT_SHOW这个事件,这样就省得我自己去注册了。
AutoRepair插件分三个文件,一个AutoRepair.toc,一个AutoRepair.xml,一个AutoRepair.lua。 toc结尾的文件可以无视,xml文件则如下:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\FrameXML\UI.xsd"> <Script file="AutoRepair.lua"/> <Frame name="frmautorepair"> <Scripts> <OnEvent> arEvent(); </OnEvent> <OnLoad> arInit(); </OnLoad> </Scripts> </Frame> </Ui>
很简单明了,arInit() 里面注册了事件,arEvent()则是事件处理。那么很明显,我需要在arEvent()里面加点东西。
AutoRepair.lua的arEvent():
function arevent(self, event) if armode==nil then armode=0; end if (event=="MERCHANT_SHOW" and CanMerchantRepair()==1) then repairAllCost, canRepair = GetRepairAllCost(); if (canRepair==1) then if(armode<=1) then if( repairAllCost<=GetMoney() ) then RepairAllItems(0); DEFAULT_CHAT_FRAME:AddMessage("Your items have been repaired for "..GetCoinText(repairAllCost,", ")..".",255,255,0); else DEFAULT_CHAT_FRAME:AddMessage("You don't have enough money for repair!",255,0,0); end end if(armode==2 or armode==3)then RepairAllItems(1); end if(armode==2) then if( repairAllCost<=GetMoney() ) then RepairAllItems(0); DEFAULT_CHAT_FRAME:AddMessage("Your items have been repaired for "..GetCoinText(repairAllCost,", ")..".",255,255,0); else DEFAULT_CHAT_FRAME:AddMessage("You don't have enough money for repair!",255,0,0); end end end end if (event=="VARIABLES_LOADED") then arStatus(); end end
它把事件处理放在了一个 if 中,只不过后面又跟了个判断是否可以修理的CanMerchantRepair(),这样的话我还是不要直接塞进它的 if 里面,而是跟在最后面比较好。在第二个事件 VARIABLE_LOADED 处理了之后,加上:
if (event =="MERCHANT_SHOW" ) then local itemid = 17020; --魔粉 fillItem(itemid); itemid = 17031; --传送符文 fillItem(itemid); itemid = 17032; -- 传送门符文 fillItem(itemid); end
itemid 是物品编号,这个是从在线数据库查的,肯定准。这里加了一个函数fillItem, 内容如下:
function fillItem(itemid) local item_name = GetItemInfo(itemid); local item_count = GetItemCount(itemid); for i=0,GetMerchantNumItems() do if GetMerchantItemInfo(i) == item_name then BuyMerchantItem(i,20-item_count); DEFAULT_CHAT_FRAME:AddMessage("Buy "..item_name.." "..(20-item_count)); end end end
主要是调用了几个API,查API可以到wowwiki上找,很全很好用。
添加完后,保存关闭,进游戏,找到材料商人,状况良好:
Wed, 19 Jul 2023 14:04:49 +0000
Aus persönlichen Gründen werden einige Benutzer ihre Instagram-Konten löschen. Bevor Sie ihr Konto löschen, sollten Sie genau prüfen, ob Sie es wirklich wollen oder nicht. Weil es so einfach ist, sich anzumelden und Ihr Konto jederzeit zu kündigen. instagram löschen link Sobald Sie mit dem Löschen fortfahren, gibt es keine Möglichkeit, das Konto wiederherzustellen, und Sie verlieren alle Ihre Timeline-Posts, Reels, Follower, Kommentare und Favoriten.
Tue, 22 Aug 2023 12:02:37 +0000
Gujarat Board Primary School Academic Year Close in Every Year Month of April, Gujarat Board Elementary School new Academic Year Open in Every Year Month of Jun, Every Year Gujarat State Wise Class More Than 50 Laks of Students Attended, Every Year Primary School Education Department Government of Gujarat Distribution in Textbook in Gujarati / English / Hindi Medium.The Printed Gujarat Class GSSTB 4th Class Book 2024 Textbook 2024 are Distributed Through Cooperative Institutions All over Gujarat. Vendors are Linked to the Distribution of Textbooks with Distributors in each District. Gujarat Board Class Book 2024 are easily Accessible to All Students of This System, This will assist in improving the Quality of Teaching by Understanding the Type of Difficulties Faced by Students.
Mon, 06 Nov 2023 12:22:39 +0000
I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post. Excellent read, Positive site, where did u come up with the information on this posting?I
Fri, 05 Jan 2024 11:45:33 +0000
Board Model Papers 2024 Download with Suggestions for 10th Class Textbooks 2024 Pdf Download and SSLC New Syllabus Sample Question Paper 2024 and different types of model papers boardmodelpaper.com and question papers for following the website and Arts, Science, Commerce Stream Subject Wise Solved Question Bank for Hindi & English Medium Students with Exam Pattern & Blueprint and subject Wise with 11th & 12th Question Bank 2024 for General & Vocational Course Languages & Subjects Important Question for the above link.
Tue, 16 Jan 2024 11:15:39 +0000
Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. Cheers for sharing with us your blo
Sat, 13 Jul 2024 00:56:49 +0000
Ww88 la trang dai ly chinh thuc, chuyen cung cap link dang nhap vao nha cai W88 chinh xac nhat ma ban khong phai lo truy cap phai trang gia mao.
Noi ve nha cai W88 co le khong dan me bong da nao lai khong thay mot lan cac doi bong ngoai hang anh mac ao do cong ty nay tai tro. https://ww88-vn.com/
Mon, 15 Jul 2024 01:43:34 +0000
C54 la mot trong nhung cong tro choi online hang dau duoc PAGCOR o Philippines chung nhan hoat dong hop phap. Cong game C54 da thiet lap moi lien ket voi nhieu nha san xuat hang dau trong nganh tro choi truc tuyen va duoc cong dong game thu danh gia cao https://c54-vn.org/
Mon, 22 Jul 2024 08:01:14 +0000
Nha cai Wi88 la mot trong nhung nha cai uy tin, chat luong cao tai thi truong chau A noi chung va tai Viet Nam noi rieng, duoc thanh lap boi nha cai danh tieng W88 hon 10 nam lien. Website : https://wi88.social/
Mon, 02 Sep 2024 02:40:37 +0000
Go88 là Huyền Thoại game đổi thưởng Online số 1 tại Việt Nam năm 2024. Được thành lập vào 08/08/2008 tại Việt Nam, Go 88 nổi bật với Game bài đổi thưởng, Tài Xỉu online, Nổ Hũ online, Bắn Cá online,… và hơn 888 sản phẩm game đổi thưởng trực tuyến khác. https://maxborn.net/
Wed, 06 Nov 2024 06:34:30 +0000
Fun88 la thuong hieu nha cai uy tin voi nhung tro choi ca cuoc hap dan hang dau thi truong. Fun 88 duoc bao ho boi Pagcor ngay tu khi ra mat vao nam 2008. Website: https://fun88tc.com