您的位置:首页 > 理论基础 > 计算机网络

验证了网络上流传魔兽世界dly的几个宏,绝对可用,给大家参考

2007-01-22 22:27 344 查看
国内2.0久久不发布,无聊中学习了些魔兽宏的编写。将网上流传的dly宏整理了一下,验证可用后,贴出来供广大玩家参考。
    由于wow自带的宏有256字数限制,我使用了supermacro进行了扩展,使其支持7000字的超大宏,这样就可以编写自己的个性宏。
    下面是一些编写宏的公共函数,将其添加到supermacro的lua区即可。
--施放魔法,检查魔法值

--锁敌
function TE()
    if UnitName("target") == nil or UnitIsDead("target") then
        TargetNearestEnemy()
    elseif UnitIsFriend("player","target") then
        if UnitCanAssist("player","target") then
            AssistUnit("target")
        else
            TargetNearestEnemy()
        end
    end
end
function C(s,m)
        if m==nil or UnitMana("player")>=m then
                CastSpellByName(s)
        end
end
--检查目标的减益魔法
function BU(s,p)
if p==nil then
        p="target"
end
for i=1,16 do
    f=UnitDebuff(p,i)
--SendChatMessage(f)
    if f then
            if string.find(f,s) then
                    return true
            end
    else
            return false
        end
end
return false
end
--检查目标的增益魔法
function B(s,p)
if p==nil then
        p="target"
end
for i=1,16 do
    f=UnitBuff(p,i)
--SendChatMessage(f)
    if f then
            if strfind(f,s) then
                    return true
            end
    else
            return false
        end
end
return false
end
--检查能量点
function CP(s,m,e)
        if GetComboPoints()>=e and UnitMana("player")>=m then
                CastSpellByName(s)
        end
end
--精灵之火
function FA()
        if not BU("Faerie") then
                C("精灵之火")
        end
end
--猛虎之怒
function TG()
        if not B("猛虎之怒","player") then
                C("猛虎之怒",30)
        end
end
      接下来的是一些实用宏,将他们也添加到lua的公共代码区即可。
--根据目标的等级释放野性印记
function yexing()
    l={1,10,20,30,40,50,60}
    t=UnitLevel("target")
    for j=7,1,-1 do
        if (t>=l[j]-10) then
            CastSpellByName("野性印记(等级 "..j..")")
            break
        end
    end
end
--根据目标的等级释放荆棘
function jingji()
    l={6,14,24,34,44,54}
    t=UnitLevel("target")
    for j=6,1,-1 do
        if (t>=l[j]-10) then
            CastSpellByName("荆棘术(等级 "..j..")")
            break
        end
    end
end
--判断玩家身上的已有buff决定释放哪种buff
function buff()
--野性印记
    if B("Regeneration") == false then
        yexing()
--荆棘光环
    elseif B("Thorns") == false then
        jingji()
    end
end
--释放愤怒之前判断目标是否有减益魔法,没有则释放之
function fenlu()
    if not  BU("StarFall") then
        C("月火术(等级 10)")
    elseif not BU("FaerieFire") then
        C("精灵之火(等级 4)")
    else
        C("愤怒(等级 8)")
    end
end
--给目标上dot
function dot()
    if BU("StarFall") == false then
        C("月火术(等级 10)")
    elseif BU("FaerieFire") == false then
        C("精灵之火(等级 4)")
    --elseif BU("虫群") == false then
        --C("虫群")
    end
end    

--猫形态攻击
function catAttack()
    TE()
    CP("凶猛撕咬",35,5)
    if not BU("GhoulFrenzy") then
        CP("撕扯",30,4)
    end
    if not BU("Disembowel") then
        C("扫击",40)
    end
    --C("畏缩",60)
    C("爪击",45)
    TG()
    if(not PlayerFrame.inCombat) then
        C("攻击")
    end
end
--猫形态背刺
function beici()
    TE()
  if B("Ambush","player") then
    C("毁灭",60)
  else
      C("撕碎",60)
  end
end
--猫形态偷袭
function touxi()
    TE()
    if B("Ambush","player") then
        C("突袭",50)
    else
        C("撕碎",60)
    end
end
--熊形态攻击
function bearAttack()
    TE()
    if not BU("Physical") then
        C("低吼")
    end
    if not BU("Demoralizing") then
        C("挫志咆哮",10)
    end
    C("槌击",10)
    if(not PlayerFrame.inCombat) then
        C("攻击")
    end
end
    使用方法,新建一个宏,调用相应的函数即可
例如:
创建一个给目标上dot的宏,只用新建一个宏,添加如下代码:
/script dot()

      关于宏的编制,大家有什么好的想法可以讨论下。献丑了,呵呵。

附件中有supermacro,解压后添加到addons下就可以了。里面没有可执行文件,怕有木马的朋友可以自己去信任的网站下载这个插件。 (不好意思,不会添加附件

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  网络 function c lua 扩展
相关文章推荐