simonw代码@痕记

导航

WOW插件:让ShortKey更好的为你工作(2006.10.4)


        ShortKey使用说明:http://simonw.cnblogs.com/archive/2005/10/20/258271.html

        自ShortKey发布以来得到不少朋友的支持当然也包括疑问,为了让大家更好的使用这个插件,于是写了这个补充说明,更详细其他职业用例会根据更多朋友的实践慢慢补全。也希望更多朋友展示出你们的职业用例。
1.10以后Blz对插件的限制更加严格, SpellStopTargeting 以及Movement系列API被禁止, 会影响用户以前自己的配置
StopCast 参数失效, 请酌情修改.

ShortKey的优势:
1.静态配置易于保存迁移相互交流,免除了你在不同场所游戏的配置痛苦。
2.强大的功能和可扩展性为你提供了一个支持条件,延时,组合,保留目标,脚本等功能的平台,灵活使用你可以以最简单的方式定制出符合你自己习惯的强大操作方式。
3.许多朋友经常在寻找一些绷带,自我施法,施法后保留目标,装备切换,脱衣服,无需固定包中位置使用物品,组合延时施法等等常用功能,而使用ShortKey可以轻松实现。
4.对界面元素的鼠标动作绑定使你完全可以放弃那些庞大复杂的治疗插件.

ShortKey二次开发指南:
1.API:SK_DoAction,执行一个动作包括装备,物品,技能使用以及自定义动作。参数args需是这样的一个数据结构Array = {Type = Type.SkillType, Name = "SkillName", Rank = "N", ToggleBuff = "BuffName", Target = "Unit", StopCast = false, HoldTarget = true, Condition = {...}, Parameters = {...}}
API:SK_DoActions,执行一个动作组,可以任意设置延时,循环次数,循环间隔,多动作映射等参数。参数args需要为ShortKey配置文件中的一个组合动作的数据结构。
2.Action与Condition的自定义扩展可以添加到ShortKeyExtLib.lua文件中单独发布。
3.延时库的应用,其中延时库所处理的数据结构为
array = {
    [0] = {Cycle = N, Interval = N},
    [N] = {"FunctionName", {"arg1","arg2",...}, DelayTime, KeyPress},...}
调用方式为
SK_Delay_SetTable(array);--设置延时表
SK_Delay_Register();--注册到延时引擎,交由引擎执行
如果你的数据结构想使用ShortKey的延时库,需要重写ShortKey.lua文件中--Read Delay Data Structure Function--注释以下的5个函数来读取你的数据结构。      

鼠标绑定示例:
对队友栏实现不同的鼠标动作.
SK_Config_Frame = {PartyMemberFrame1, PartyMemberFrame2, PartyMemberFrame3, PartyMemberFrame4}
SK_Config_FrameEvent = {"PartyMemberFrame_OnClick"}
SK_Config_MouseSpell = {
 --牧师--
 [SK_Constant_Class_PRIEST] = {
  ["LeftButton"]  = {Name = "快速治疗", Rank = "7"},  
  ["LeftButton_Alt"] = {Name = "强效治疗术", Rank = "4"},
  ["LeftButton_Shift"] = {Name = "TargetUnit"},
  ["LeftButton_Control"] = {Name = "真言术:韧", Rank = "6"},

  ["RightButton"]  = {Name = "真言术:盾", Rank = "10"},
  --["RightButton_Alt"] = 'PartyDropDown',
  ["RightButton_Shift"] = {Name = "AssistUnit"},
  ["RightButton_Control"] = {Name = "防护暗影", Rank = "3"},

  ["MiddleButton"] = {Name = "恢复", Rank = "9"},
  ["MiddleButton_Alt"] = {Name = "复活术", Rank = "1"},
 },
}

示例:
1.组合技能,当短暂能量护符有效时施放短暂能量+痛
[0] = {Name = "短暂能量+痛", Condition = {Name = Condition.IsItemUseable, State = true, Parameters = {"短暂能量护符"}}},  
[1] = {Type = Type.Equip, Name = "饰品1"},   
[2] = {Type = Type.Spell, Name = "暗言术:痛", Rank = "8", Target = "target"},  

2.组合技能,切换鱼杆和法杖然后跳起来说话
[0] = {Name = "装备切换"},
[1] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"主手", "奥金钓鱼竿", "细碎法杖"}},
[2] = {Type = Type.Action, Name = Action.Jump},
[3] = {Type = Type.Action, Name = Action.Say, Parameters = {"我换,我换,我换换换!"}},

3.组合技能,生命小于75%的时候吃面包,魔法小于80%的时候喝水
[0] = {Name = "面包+水"},  
[1] = {Type = Type.Item, Name = "晨露酒",Condition = {Name = Condition.IsMpInRange, State = true, Parameters = {"player", "<", "0.8"}}}, 
[2] = {Type = Type.Item, Name = "面包",Condition = {Name = Condition.IsHpInRange, State = true, Parameters = {"player", "<", "0.75"}}}, 

4.法术技能,当身没有恢复buff的时候施放恢复魔法
[1] = {Name = "恢复", Rank = "9", Target = "player", HoldTarget = true, Condition = {Name = Condition.IsBuffUp, State = false, Parameters = {"player", "Renew"}}},

5.组合技能,每隔3秒说话一次
[0] = {Name = "延时倒计数"},   
[1] = {Type = Type.Action, Name = Action.Say, Parameters = {"5"}, Delay = 3},
 [2] = {Type = Type.Action, Name = Action.Say, Parameters = {"4"}, Delay = 3},
[3] = {Type = Type.Action, Name = Action.Say, Parameters = {"3"}, Delay = 3},
[4] = {Type = Type.Action, Name = Action.Say, Parameters = {"2"}, Delay = 3},
[5] = {Type = Type.Action, Name = Action.Say, Parameters = {"1"}, Delay = 3},

6.组合技能,脚本命令
[0] = {Name = "Script演示"},
[1] = {Type = Type.Action, Name = "", Script = "DEFAULT_CHAT_FRAME:AddMessage(\"Script演示....\")"},

7.物品使用,自我帮绷带同时保留当前目标不丢失
[1] = {Name = "绷带", Target = "player", HoldTarget = true, StopCast = false},

8.组合技能,脱衣舞(由霜之嫁衣朋友提供)
[0] = {Name = "装备切换-脱衣舞"},
[1] = {Type = Type.Action, Name = Action.Say, Parameters = {"马上就是帽子了!"},Delay=1},
[2] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"头部", "预言头饰"},Delay=1},
[3] = {Type = Type.Action, Name = Action.Say, Parameters = {"马上就是项链了!"},Delay=1},
[4] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"颈部", "凯维恩的珠宝护符"},Delay=1},
[5] = {Type = Type.Action, Name = Action.Say, Parameters = {"马上就是披肩了!"},Delay=1},
[6] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"肩部", "鬼雾衬肩]"},Delay=1},
[7] = {Type = Type.Action, Name = Action.Say, Parameters = {"马上就是我的小披风了!"},Delay=1},
[8] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"背部", "野性之皮"},Delay=1},
[9] = {Type = Type.Action, Name = Action.Say, Parameters = {"关键时刻来拉.....!"},Delay=1},
[10] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"胸部", "信仰外衣"},Delay=1},
[11] = {Type = Type.Action, Name = Action.Say, Parameters = {"我的手镯!"},Delay=1},
[12] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"手腕", "庄严护腕"},Delay=1},
[13] = {Type = Type.Action, Name = Action.Say, Parameters = {"靓女也有武器!"},Delay=1},
[14] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"主手", "银色十字军"},Delay=1},
[15] = {Type = Type.Action, Name = Action.Say, Parameters = {"远程武器...厉害吧!!!"},Delay=1},
[16] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"远程", "治疗之烁星魔棒"},Delay=1},
[17] = {Type = Type.Action, Name = Action.Say, Parameters = {"现在是慢慢是我的手套了!!"},Delay=1},
[18] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"手", "预言手套"},Delay=1},
[19] = {Type = Type.Action, Name = Action.Say, Parameters = {"腰带松了!大家屏住呼吸!"},Delay=1},
[20] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"腰部", "预言束带"},Delay=1},
[21] = {Type = Type.Action, Name = Action.Say, Parameters = {"裤子 !!裤子 !裤子!!!"},Delay=1},
[22] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"腿部", "预言短裤"},Delay=1},
[23] = {Type = Type.Action, Name = Action.Say, Parameters = {"小金莲....."},Delay=1},
[24] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"脚", "龙骑兵长靴"},Delay=1},
[25] = {Type = Type.Action, Name = Action.Say, Parameters = {"靠!干吗呢?醒醒,我们只劫财不劫色!戒指取下来~快点!"},Delay=1},
[26] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"手指1", "碧绿烈焰戒指"},Delay=1},
[27] = {Type = Type.Action, Name = Action.Say, Parameters = {"还有一个呢??"},Delay=1},
[28] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"手指2", "魔法导师的封印"},Delay=1},
[29] = {Type = Type.Action, Name = Action.Say, Parameters = {"居然忘记了耳环!也交出来!!"},Delay=1},
[30] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"饰品2", "埃雷萨拉斯皇家徽记"},Delay=1},
[31] = {Type = Type.Action, Name = Action.Say, Parameters = {"55555大哥!你把我的财产都拿光了!!我怎么活呀...干脆你把我也要了吧!!!","emote"},Delay=2},

9.组合技能,锁定PVP目标,让目标不在丢失
[0] = {Name = "锁定PVP目标"},
[1] = {Type = Type.Action, Name = Action.LockTarget},

10.组合技能,复活并且随机喊话(由霜之嫁衣朋友提供)
[1] = {
[0] = {Name = "复活1"},
[1] = {
Type = Type.Spell, Name = "复活术", Rank = "5",Target = "target",StopCast = false
},
[2] = {Type = Type.Action, Name = "", Script = "SAY={\"%t,乖,快起来~姐姐给你吃糖~\",\"%t,起来吧起来吧,不要赖皮~\",\"%t就要复活了,大家开不开心丫~ %t答:开心~[嫁衣]是最棒的~oh~yeah~\",\"%t,猪撞树上,你撞猪上了,起来起来~\",\"扑在%t的身上开始人工呼吸。%t睁开了美丽的双眼,饱含热泪的扑进[嫁衣]的怀抱大声说:[嫁衣]你救了我,无以为报,让我嫁给你吧\",\"%t,太阳都晒PP了,便便啦~\",\"感谢CCTV,MTV,SMG,上海文广,星空卫视,无线卫视。。。和一直支持,热爱我的FANS给我这次复活%t的机会。%t~以至高无上滴偶的名义,站起来,为偶战斗吧!\",\"请求%t为我冲值点卡,愿意的请点同意\"};"},
[3] = {Type = Type.Action, Name = "", Script = "SendChatMessage(SAY[math.random(1,9)],\"emote\");"},
},

passarella提供的猎人配置:

--猎人--
        [SK_Constant_Class_HUNTER] = {
                [1] = {
                        [0] = {Name = "假死+跳跃+冰冻陷阱", HoldTarget = true},
                        [1] = {Type = Type.Spell, Name = "假死"},
                        [2] = {Type = Type.Action, Name = Action.Jump},
                        [3] = {Type = Type.Spell, Name = "冰冻陷阱", Rank = "3"},
                        [4] = {Type = Type.Action, Name = Action.Say, Parameters = {"敌人靠近我了9999我!"}},
                },
                [2] = {
                        [0] = {Name = "跳跃+摔绊+反击", HoldTarget = true},
                        [1] = {Type = Type.Spell, Name = "猛禽一击", Rank = "8", Target = "target"},
                        [2] = {Type = Type.Action, Name = Action.Jump},
                        [3] = {Type = Type.Spell, Name = "摔绊", Rank = "3", Target = "target",
                                Condition = {Name = Condition.IsDebuffUp, State = false, Parameters = {"target", "Ability_Warrior_Challange"}}
                        },
                        [4] = {Type = Type.Spell, Name = "反击", Rank = "3", Target = "target",
                                Condition = {Name = Condition.IsDebuffUp, State = false, Parameters = {"target", "Ability_Warrior_Challange"}}
                        },
                        [5] = {Type = Type.Spell, Name = "猫鼬撕咬", Rank = "3", Target = "target"},
                },
                [3] = {
                        [0] = {Name = "急速射击+魔暴龙之怒", HoldTarget = true},
                        [1] = {Type = Type.Equip, Name = "饰品1"},
                        [2] = {Type = Type.Spell, Name = "急速射击", Rank = "3", Target = "player"},
                        [3] = {Type = Type.Spell, Name = "影遁"},
                        [4] = {Type = Type.Spell, Name = "瞄准射击", Rank = "6", Target = "target"},
                },
                [4] = {
                        [0] = {Name = "逃脱L3+冰冻陷阱", HoldTarget = true},
                        [1] = {Type = Type.Spell, Name = "逃脱", Rank = "3", Target = "target"},
                        [2] = {Type = Type.Spell, Name = "冰冻陷阱", Rank = "3"},
                },
                [5] = {
                        [0] = {Name = "联盟徽章换魔暴龙眼"},
                        [1] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"饰品1", "联盟徽章", "魔暴龙眼"}},
                        [2] = {Type = Type.Action, Name = Action.SwitchEquip, Parameters = {"远程", "觅血者", "血木猎弓"}},
                        [3] = {Type = Type.Action, Name = Action.Jump},
                        [4] = {Type = Type.Action, Name = Action.Say, Parameters = {"我换,魔暴龙眼,联盟徽章!"}},
                },
                [6] = {
                        [0] = {Name = "冰冻陷阱", HoldTarget = true},
                        [1] = {Type = Type.Spell, Name = "冰冻陷阱", Rank = "3"},
                },
                [7] = {
                        [0] = {Name = "魔法甜面包+魔法晶水"},               
                        [1] = {
                                Type = Type.Item, Name = "魔法晶水",
                                Condition = {Name = Condition.IsMpInRange, State = true, Parameters = {"player", "<", "0.8"}}
                        },       
                        [2] = {
                                Type = Type.Item, Name = "魔法甜面包",
                                Condition = {Name = Condition.IsHpInRange, State = true, Parameters = {"player", "<", "0.75"}}
                        },                               
                        [3] = {Type = Type.Spell, Name = "影遁"},
                },
                [8] = {
                        [0] = {Name = "魔法甜面包+魔法苏打水"},               
                        [1] = {
                                Type = Type.Item, Name = "魔法苏打水",
                                Condition = {Name = Condition.IsMpInRange, State = true, Parameters = {"player", "<", "0.8"}}
                        },       
                        [2] = {
                                Type = Type.Item, Name = "魔法甜面包",
                                Condition = {Name = Condition.IsHpInRange, State = true, Parameters = {"player", "<", "0.75"}}
                        },                               
                        [3] = {Type = Type.Spell, Name = "影遁"},
                },
                [9] = {
                        [0] = {Name = "影遁"},                                       
                        [1] = {Type = Type.Spell, Name = "影遁"},
                },
                [10] = {
                        [0] = {Name = "联盟徽章", HoldTarget = true},
                        [1] = {Type = Type.Equip, Name = "饰品1"},
                },
                [11] = {
                        [0] = {Name = "快速暗影反射器", HoldTarget = true},
                        [1] = {Type = Type.Equip, Name = "饰品1"},
                },
        },



FAQ:

1.保存config文件出现乱码怎么办?
这是由于保存文件的格式不正确,应该将文件保存为utf-8或者unicode的格式。

2.如何准确获取技能名称?
中文技能名称如果把握不准确可以在wow中打开宏设置编辑一个宏,按住shift点击你法术书中的技能就会出现中文名,复制下来即可。

3.如何获取buff、debuff的英文名称?
在ShortKey默认配置中有组合技能“查看目标buff/debuff”一项,绑定按键后选中目标按键即可查看。从末尾取最后一个单词即可。

4.我的script为什么不能执行?
需要把你的脚本复制到Script="...your script"中,其中你的脚本中凡是带"的都要替换成\" 不支持宏形如/say这样的代码。

5.延时功能合法么,为什么我的技能无法延时?
延时是利用wow api提供的合法功能实现的,因此可以放心使用。其实很多插件支持延时功能,例如著名的flexbar,Cosmos,不少进度条插件等等。延时指令对所有魔法技能无效,这是wow游戏的限制。

posted on 2005-10-31 14:25  simonw  阅读(15236)  评论(55编辑  收藏  举报