副本脚本流程说明
--这只是一个脚本的流程使用说明 更多的指令填充见各个开源的脚本和BF脚本编写指令说明。
--这个指令让核心进入调用副本流程模式
local profile = BF.Kern.InitProfile()
Wait=BF.Kern.Core.Wait
pmsg=BF.Log.Print
TimeDelayTrue=BF.TimeDelayTrue
--首先,我们关闭BF核心内置的逻辑,不让核心逻辑干扰脚本运行。要想使用那种逻辑,把下面各种设为false。
profile.IgnoreGotoTown =true--关闭内置的回城逻辑,建议不使用内置的回城逻辑,使用下面的回城函数 function SRM()
profile.IgnoreCoreNavigateToCorpse=true--关闭内置的跑尸逻辑,使用脚本设置的跑尸程序。因为内置的跑尸只跑到尸体点,副本死亡点一般在副本里
profile.IgnoreRest = true --关闭内置的回复逻辑,使BF核心的回复失效,内置的回复坐下就进行回复。
BF.AutoFight(false)--关闭内置的战斗逻辑,这个开启是BF.AutoFight(true)
function TestScript()
print("我可以在这个函数里测试指令")
end
--脚本执行主体
function profile.Logic()
TestScript()
InitSet()
--while true do
GoInInstance()
print("刷副本进行这里执行")
--如果需要回复就回复
HF()
GoOutInstance()
--如果需要回城就回城
if BF.NeedGotoTown() then
SRM()
end
Wait(100)
--end
end
--脚本跑尸函数,在这里填写你想如何进行跑尸,如果有尸体坐标,x,y,z是尸体坐标,mapId一般返回nil
function profile.NavigateToCorpse(x, y, z, mapId)
pmsg("我死亡了,要在这里执行跑尸")
end
--脚本开始执行,这个函数中不能进行耗费时间的动作操作,建议注册事件,填写提示。
function profile.OnStart()
pmsg("脚本在这里开始")
end
--脚本结束执行,这个函数和脚本开始执行函数一样。
function profile.OnStop()
pmsg("脚本结束")
end
--这个函数每一帧调用一次,如50帧,则20毫秒调用一次。
function profile.Pulse()
if TimeDelayTrue("pulse",5) then
BF.Log.Debug("我在这里每帧执行一次,但是我进行了限制,5秒执行一次")
end
--BF.Log.Debug("我每帧调用一次")
end
--建议在这里初始化设置
function InitSet()
print("进行了脚本初始化设置")
--pmsg("进行了脚本初始化设置")
UI =BF.UI.Profile
if not UI.Init('BF-副本模板设置') then
UI.AddHeader('这个只设置文字')
UI.AddToggle('是否执行这个', '这个设置是否开关', true)
UI.AddRange('这个是设置范围值的', '如果脚本需要设置一个自定义范围值可以这里设置', 1, 100, 1, 10, true)--自己
UI.AddDropdown('这里设置下拉框的', '可以设置多个选项选择', {'选项1', '选项2', '选项3'}, 1, true)--true,false 代表是否一整行
UI.AddInput('这个设置输入信息', '如果想设置输入信息,可以在这里设置', '我是默认输入文字', false)
UI.Show()
end
end
--建议这里设置如何进副本
function GoInInstance()
print("我进入了副本")
end
--建议这里设置如何出副本
function GoOutInstance()
print("我退出了副本")
end
--恢复血蓝,你可以在这里重写你自己的回复逻辑
function HF()
Dismount()
Wait(1000)
profile.IgnoreRest =false--开启内置的回复,坐下就回复
--设置内置回复最低标准,饮料比例
BF.CurrentSettings.DrinkPercent = 60
--设置内置回复最低标准,饮料比例
BF.CurrentSettings.DrinkMaxPercent = 100
--设置内置回复最低标准,食物比例
BF.CurrentSettings.FoodPercent = 60
--设置内置回复最低标准,食物比例
BF.CurrentSettings.FoodMaxPercent = 100
--制作吃喝
if GetItemCount(8079, false, false) < 10 and GetItemCount(8078, false, false) < 10 and BF.Me.FreeBagSlots >= 1 then
print('制造魔法水')
if IsSpellKnown(10140) then
CastSpellByID(10140)
else
CastSpellByID(10139)
end
Wait(3500)
end
if GetItemCount(8076, false, false) < 10 and BF.Me.FreeBagSlots >= 1 then
print('制造魔法面包')
if IsSpellKnown(10145) then
CastSpellByID(10145)
end
Wait(3500)
end
if GetItemCount(5514, false, false) == 0 and BF.Me.FreeBagSlots >= 1 then
print('制造法力玛瑙')
CastSpellByID(759)
Wait(4500)
end
if GetItemCount(5513, false, false) ==0 and BF.Me.FreeBagSlots >= 1 then
print('制造法力翡翠')
CastSpellByID(3552)
Wait(4500)
end
--如果你没有关闭内置的回复,可以坐下回复
if (UnitPower('player', 0) / UnitPowerMax('player', 0) * 100) < 50 then
print('坐下回蓝')
DoEmote('SIT')
Wait(3500)
end
--回复最好设置超时
for i=1,180 do
if BF.Me.HP >= 99 and BF.Me.PowerPct >= 99 then
profile.IgnoreRest = true
print('满血满蓝,关闭内置的回复')
break
end
Wait(1000)
end
end
--这个函数里设置回城售卖和修理NPC名称,和邮箱位置。
function SRM()
local npc,mail
if BF.Me.FactionGroup == 'Horde' then
print('初始化部落NPC')
npc = {
ID = 1146,
Name = '维哈尔',
Position = {-12357.7744, 155.5521, 4.2480},
}
mail= {
ID = 163645,
Name = '邮箱',
Position = {-12388.0088, 146.6871, 2.6226},
}
else
print('初始化联盟NPC')
npc = {
ID = 226,
Name = '莫格·纳尔特里',
Position = {-10590.5215, -1155.9293, 30.0596},
}
mail = {
ID = 142089,
Name = '邮箱',
Position = {-10547.3916, -1157.2557, 27.8954},
}
end
BF.NavTo(npc.Position[1], npc.Position[2], npc.Position[3])
local unit = BF.ObjectManager.GetWoWUnitById(npc.ID)
if unit then
BF.MovementManager.MoveTo(npc.Position[1], npc.Position[2], npc.Position[3])
BF.MovementManager.Stop()
Wait(500)
unit:TargetUnit()
Wait(500)
unit:Interact()
Wait(1000)
BF.Frames.GossipFrame.SelectGossipOption('vendor')
Wait(1000)
BF.AutoVendor.DoRepair()
Wait(1000)
BF.AutoVendor.DoRepair()
Wait(1000)
BF.AutoVendor.DoRepair()
Wait(1000)
CloseAllWindows()
end
if BF.Settings.profile.UseMail then
print("邮寄")
BF.NavTo(mail.Position[1], mail.Position[2], mail.Position[3])
if not BF.AutoVendor.NeedMail() then
BF.Log.Warning("不需要邮寄物品")
BF.VendorStatus = "VendorComplete"
return
end
local mailbox = BF.ObjectManager.GetGameObjectById(mail.ID)
if mailbox then
BF.ObjectInteract(mailbox.Pointer)
BF.Delay(2)
if MailFrame:IsVisible() then
BF.Log.Status("邮寄中")
BF.AutoVendor.AutoMail()
BF.Delay(2)
BF.VendorStatus = "VendorComplete"
else
BF.Delay(1)
end
else
pmsg("找不到邮箱")
end
end
end
Previous:Tinkr最新地图包下载链接
Next:野外采集打怪编写例子