本帖最后由 ahsin 于 2021-12-18 16:26 编辑
刚才手抖按了ctrl发帖了。。。然后编辑完帖子又说超过5分钟不能改了,哈哈哈,只能跟帖了
基于http://bbs.cgmsv.com/thread-1083-1-1.html的帖子,做的改进
在此之前也在用muscipluar究极大佬的框架http://bbs.cgmsv.com/thread-1036-1-1.html只能太尼玛牛逼了来形容
修改内容有:
1、保留老lua,使用module,不用modules。主要原因是老lua要拦截talk,所以在新框架里会收不到talk msg,技术有限,只能挪出来用
2、限制每职的佣兵只能召唤1位
3、命令调整/aig /aij /aiq /aif /aim /aigd(弓、剑、骑、斧、魔、格)4、添加/killai,开除佣兵
5、玩家下线后,佣兵一起kill,不再堵地图上
6、佣兵能力根据玩家bp的80~100%来生成,不再固定,后期不辣鸡
7、注意,我把佣兵造型改了,如果你的服没对应图档,建议改一个图档编号
步骤一、
不要覆盖init.lua,把大佬框架的init.lua添加进老init.lua即可,其他都不冲突,全部丢进lua文件夹
步骤二、
autoBattle.lua放在modules里,修改了如下(注意autoBattle.lua里的佣兵名字要和yb.lua里的一样,否则不战斗)
- local Module = ModuleBase:createModule('autoBattle')
-
- --local disCacheCom = {}
- --disCacheCom[0] = 1;
- --disCacheCom[1] = 1;
- --disCacheCom[2] = 1;
- --disCacheCom[3] = 1;
- --disCacheCom[5] = 1;
- --disCacheCom[6] = 1;
- --disCacheCom[7] = 1;
- --disCacheCom[8] = 1;
- --disCacheCom[9] = 1;
- --disCacheCom[0xe] = 1;
- --disCacheCom[0x1a] = 1;
- --disCacheCom[0x9CB] = 1;
- --disCacheCom[0x9CC] = 1;
- --disCacheCom[0xDAC] = 1;
-
- --local charData = {};
-
- local battleData = {};
-
- function Module:onLoad()
- self:logInfo('load')
- --self:regCallback('TalkEvent', Func.bind(Module.handleChat, self))
- --self:regCallback('LogoutEvent', Func.bind(Module.cleanUp, self))
- --self:regCallback('BattleActionEvent', Func.bind(Module.battleActionEventCallBack, self))
- self:regCallback('BattleOverEvent', Func.bind(Module.battleOverEventCallback, self))
- self:regCallback('BeforeBattleTurnEvent', Func.bind(Module.handleBattleAutoCommand, self))
- end
-
- function Module:battleOverEventCallback(battleIndex)
- battleData[battleIndex] = nil;
- end
-
- function Module:handleBattleAutoCommand(battleIndex)
- local turn = Battle.GetTurn(battleIndex)
- if battleData[battleIndex] == turn then
- return
- end
- battleData[battleIndex] = turn;
- local hasAutoBattle = false;
- self:logDebug('handleBattleAutoCommand', battleIndex)
- self:logDebug('turn', turn);
- local hasPlayer = false;
- for i = 0, 9 do
- local charIndex = Battle.GetPlayer(battleIndex, i);
- if charIndex >= 0 then
- --if Char.GetData(charIndex, CONST.CHAR_类型) == CONST.对象类型_人 then
- if Char.IsDummy(charIndex) then
- local petIndex = Battle.GetPlayer(battleIndex, math.fmod(i + 5, 10));
- self:logDebug('auto battle', charIndex, petIndex);
- hasAutoBattle = true;
- if Battle.IsWaitingCommand(charIndex) and Char.GetData(charIndex,%对象_名字%) == "恶魔猎手" then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_P_RANDOMSHOT, 10, 9509);
- end
- if Battle.IsWaitingCommand(charIndex) and Char.GetData(charIndex,%对象_名字%) == "剑圣" then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_FIRSTATTACK, 10, 26209);
- end
- if Battle.IsWaitingCommand(charIndex) and Char.GetData(charIndex,%对象_名字%) == "法国榔头" then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_P_PARAMETER, 10, 309);
- end
- if Battle.IsWaitingCommand(charIndex) and Char.GetData(charIndex,%对象_名字%) == "Archer" then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_P_PARAMETER, 10, 109);
- end
- if Battle.IsWaitingCommand(charIndex) and Char.GetData(charIndex,%对象_名字%) == "加盐纯净水" then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_P_SPIRACLESHOT, 10, 409);
- end
- if Battle.IsWaitingCommand(charIndex) and Char.GetData(charIndex,%对象_名字%) == "马猴烧酒" then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_P_MAGIC, 10, 2209);
- end
- if petIndex >= 0 then
- Battle.ActionSelect(petIndex, CONST.BATTLE_COM.BATTLE_COM_ATTACK, 10, -1);
- else
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_ATTACK, 10, -1);
- end
- else
- hasPlayer = true;
- end
- --local data = charData[charIndex]
- --if type(data) == 'table' and Char.GetData(charIndex, CONST.CHAR_BattleMode) == 2 then
- -- hasAutoBattle = true;
- -- Char.SetData(charIndex, CONST.CHAR_BattleMode, 3);
- -- Char.SetData(charIndex, CONST.CHAR_BattleCom1, data.comA1 or 0);
- -- Char.SetData(charIndex, CONST.CHAR_BattleCom2, data.comA2 or -1);
- -- Char.SetData(charIndex, CONST.CHAR_BattleCom3, data.comA3 or -1);
- -- Char.SetData(charIndex, CONST.CHAR_Battle2Com1, data.comB1 or 0);
- -- Char.SetData(charIndex, CONST.CHAR_Battle2Com2, data.comB2 or -1);
- -- Char.SetData(charIndex, CONST.CHAR_Battle2Com3, data.comB3 or -1);
- --end
- --end
- end
- end
- self:logDebug(hasAutoBattle, hasPlayer, not hasPlayer)
- if not hasPlayer and hasAutoBattle then
- for i = 0, 9 do
- local charIndex = Battle.GetPlayer(battleIndex, i);
- if charIndex >= 0 and Char.GetData(charIndex, CONST.CHAR_类型) == CONST.对象类型_人 then
- local petIndex = Battle.GetPlayer(battleIndex, math.fmod(i + 5, 10));
- self:logDebug('auto battle', charIndex, petIndex);
- hasAutoBattle = true;
- if Battle.IsWaitingCommand(charIndex) then
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_ESCAPE, -1, -1);
- end
- if petIndex >= 0 then
- Battle.ActionSelect(petIndex, CONST.BATTLE_COM.BATTLE_COM_ATTACK, -1, -1);
- else
- Battle.ActionSelect(charIndex, CONST.BATTLE_COM.BATTLE_COM_ESCAPE, -1, -1);
- end
- end
- end
- end
- return hasAutoBattle;
- end
-
- --function Module:handleChat(charIndex, msg, color, range, size)
- -- if msg == '/battle auto' then
- -- charData[charIndex] = true;
- -- NLG.SystemMessage(charIndex, '开启自动战斗');
- -- return 0;
- -- elseif msg == '/battle off' then
- -- charData[charIndex] = nil;
- -- NLG.SystemMessage(charIndex, '关闭自动战斗');
- -- return 0;
- -- end
- -- return 1
- --end
-
- --function Module:cleanUp(charIndex)
- -- if charData[charIndex] then
- -- charData[charIndex] = nil;
- -- end
- -- return 0;
- --end
-
- --function Module:battleActionEventCallBack(charIndex, battleIndex, com1, com2, com3, actionNum)
- -- if charData[charIndex] then
- -- local data = { }
- -- charData[charIndex] = data;
- -- local flag = 'A';
- -- data['comA1'] = 0;
- -- data['comA2'] = -1;
- -- data['comA3'] = -1;
- -- data['comB1'] = 0;
- -- data['comB2'] = -1;
- -- data['comB3'] = -1;
- -- if disCacheCom[com1] then
- -- charData[charIndex] = true;
- -- return
- -- end
- -- if actionNum == 2 then
- -- flag = 'B';
- -- end
- -- data['com' .. flag .. '1'] = com1;
- -- data['com' .. flag .. '2'] = com2;
- -- data['com' .. flag .. '3'] = com3;
- -- end
- --end
-
- function Module:onUnload()
- self:logInfo('unload');
- --self.hook.uninstall();
- end
-
- return Module;
复制代码
步骤三、
yb.lua放到module文件夹里,注意modules文件夹里哦
- ---模块类
- local ybModule = ModuleBase:createModule('yb')
- local allyb = 0
- -- 普通玩家命令
- --local commandsNormal = {}
-
- wanjia = {}--玩家表
- for bbb = 0,800 do
- wanjia[bbb] = {}
- wanjia[bbb][1] = 0
- wanjia[bbb][2] = 0
- wanjia[bbb][3] = 0
- wanjia[bbb][4] = 0
- wanjia[bbb][5] = 0
- wanjia[bbb][6] = 0
- end
-
- Delegate.RegDelTalkEvent("yb_TalkEvent");--说话触发
- Delegate.RegDelAllOutEvent("yboffline");--玩家下线触发
-
- function yboffline(player)--玩家下线清空自己召唤的ai
- if wanjia[player][1] > 0 then
- Char.DelDummy(wanjia[player][1])
- end
- if wanjia[player][2] > 0 then
- Char.DelDummy(wanjia[player][2])
- end
- if wanjia[player][3] > 0 then
- Char.DelDummy(wanjia[player][3])
- end
- if wanjia[player][4] > 0 then
- Char.DelDummy(wanjia[player][4])
- end
- if wanjia[player][5] > 0 then
- Char.DelDummy(wanjia[player][5])
- end
- if wanjia[player][6] > 0 then
- Char.DelDummy(wanjia[player][6])
- end
- end
-
- --[[
- function ybteam(player,player2,status)--组队事件
- t1 = Char.IsDummy(player)
- t2 = Char.PartyNum(player)
- ni2 = tonumber(player)
- if t2 < 1 then--检测到离队
- Char.DelDummy(wanjia[ni2][1])
- Char.DelDummy(wanjia[ni2][2])
- Char.DelDummy(wanjia[ni2][3])
- Char.DelDummy(wanjia[ni2][4])
- wanjia[ni2][1] = 0
- wanjia[ni2][2] = 0
- wanjia[ni2][3] = 0
- wanjia[ni2][4] = 0
- end
- --print(Char.PartyNum(player))
- end
- ]]
-
- --function commandsNormal.yb01(player, args)
- function yb_TalkEvent(player,msg,color,range,size)
-
- suiji = math.random(80,100)--生成80~100的随机数--然后ai参考人物生成浮动bp
- rlv = Char.GetData(player,%对象_等级%)
- rlv = rlv /100 * suiji
- rx = Char.GetData(player,%对象_体力%)
- rx = rx / 100 * suiji
- rm = Char.GetData(player,%对象_魔法%)
- rm = rm / 100 * suiji
- rg = Char.GetData(player,%对象_力量%)
- rg = rg / 100 * suiji
- --print(rg)
- rf = Char.GetData(player,%对象_强度%)
- rf = rf / 100 * suiji
- rs = Char.GetData(player,%对象_速度%)
- rs = rs / 100 * suiji
- --print(rm)
-
- if msg == "/killai" or msg == "、killai" then--干掉ai的命令
- if wanjia[player][1] > 0 then
- Char.DelDummy(wanjia[player][1])
- wanjia[player][1] = 0
- end
- if wanjia[player][2] > 0 then
- Char.DelDummy(wanjia[player][2])
- wanjia[player][2] = 0
- end
- if wanjia[player][3] > 0 then
- Char.DelDummy(wanjia[player][3])
- wanjia[player][3] = 0
- end
- if wanjia[player][4] > 0 then
- Char.DelDummy(wanjia[player][4])
- wanjia[player][4] = 0
- end
- if wanjia[player][5] > 0 then
- Char.DelDummy(wanjia[player][5])
- wanjia[player][5] = 0
- end
- if wanjia[player][6] > 0 then
- Char.DelDummy(wanjia[player][6])
- wanjia[player][6] = 0
- end
- NLG.SystemMessage(player, '已开除所有佣兵。' )
- end
-
- if msg == "/aig" or msg == "、aig" then
- if Char.GetData(player,%对象_战宠%) == -1 then
- NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
- elseif allyb > 750 then
- NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
- else
- if wanjia[player][1] == 0 then
- local charIndex1 = Char.CreateDummy()--生成ai佣兵
- allyb = charIndex1
- print("编号:"..charIndex1.."")
- wanjia[player][1] = charIndex1
-
- Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
- Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
- Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
- Char.SetData(charIndex1, CONST.CHAR_名字, '恶魔猎手');
- Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
- Char.SetData(charIndex1, CONST.CHAR_形象, 100269);
- Char.SetData(charIndex1, CONST.CHAR_原形, 105791);
- Char.SetData(charIndex1, CONST.CHAR_原始图档, 100269);
- print('charIndex1', charIndex1)
- --print(player)
- Char.SetData(charIndex1, CONST.CHAR_体力, rx);
- Char.SetData(charIndex1, CONST.CHAR_力量, rg);
- Char.SetData(charIndex1, CONST.CHAR_强度, rf);
- Char.SetData(charIndex1, CONST.CHAR_速度, rs);
- Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
- Char.SetData(charIndex1, CONST.CHAR_风属性, 100);
- Char.SetData(charIndex1, CONST.CHAR_闪躲, 30);
- Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
- Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
- Char.SetData(charIndex1, CONST.CHAR_种族, 0);
- NLG.UpChar(charIndex1);
- Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
- Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
- Char.GiveItem(charIndex1, 2100, 1, false);
- Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
- Char.SetData(charIndex1, CONST.CHAR_职业, 44);
- Char.SetData(charIndex1, CONST.CHAR_职类ID, 40);
- Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
- Char.AddSkill(charIndex1, 95);
- --Char.GivePet(charIndex1, 3004);
- --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
- --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
- --local petIndex = Char.GetPet(charIndex1, 0);
- --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
- NLG.SystemMessage(player, '召唤佣兵: 弓箭手' )
- Char.JoinParty(charIndex1, player);
- else
- NLG.SystemMessage(player, '只能召唤1位弓箭手。' )
- end
- end
-
- elseif msg == "/aij" or msg == "、aij" then
- if Char.GetData(player,%对象_战宠%) == -1 then
- NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
- elseif allyb > 750 then
- NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
- else
- if wanjia[player][2] == 0 then
- local charIndex1 = Char.CreateDummy()--生成ai佣兵
- allyb = charIndex1
- print("编号:"..charIndex1.."")
- wanjia[player][2] = charIndex1
-
- Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
- Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
- Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
- Char.SetData(charIndex1, CONST.CHAR_名字, '剑圣');
- Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
- Char.SetData(charIndex1, CONST.CHAR_形象, 100528);
- Char.SetData(charIndex1, CONST.CHAR_原形, 101127);
- Char.SetData(charIndex1, CONST.CHAR_原始图档, 100528);
- print('charIndex1', charIndex1)
- Char.SetData(charIndex1, CONST.CHAR_体力, rx);
- Char.SetData(charIndex1, CONST.CHAR_力量, rg);
- Char.SetData(charIndex1, CONST.CHAR_强度, rf);
- Char.SetData(charIndex1, CONST.CHAR_速度, rs);
- Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
- Char.SetData(charIndex1, CONST.CHAR_地属性, 100);
- Char.SetData(charIndex1, CONST.CHAR_命中, 30);
- Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
- Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
- Char.SetData(charIndex1, CONST.CHAR_种族, 0);
- NLG.UpChar(charIndex1);
- Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
- Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
- --Char.GiveItem(charIndex1, 900048, 1, false);
- --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
- Char.SetData(charIndex1, CONST.CHAR_职业, 14);
- Char.SetData(charIndex1, CONST.CHAR_职类ID, 10);
- Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
- Char.AddSkill(charIndex1, 1006);
- --Char.GivePet(charIndex1, 3004);
- --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
- --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
- --local petIndex = Char.GetPet(charIndex1, 0);
- --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
- NLG.SystemMessage(player, '召唤佣兵: 剑士' )
- Char.JoinParty(charIndex1, player);
- else
- NLG.SystemMessage(player, '只能召唤1位剑士。' )
- end
- end
-
-
- elseif msg == "/aif" or msg == "、aif" then
- if Char.GetData(player,%对象_战宠%) == -1 then
- NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
- elseif allyb > 750 then
- NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
- else
- if wanjia[player][3] == 0 then
- local charIndex1 = Char.CreateDummy()--生成ai佣兵
- allyb = charIndex1
- print("编号:"..charIndex1.."")
- wanjia[player][3] = charIndex1
-
- Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
- Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
- Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
- Char.SetData(charIndex1, CONST.CHAR_名字, '法国榔头');
- Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
- Char.SetData(charIndex1, CONST.CHAR_形象, 100125);
- Char.SetData(charIndex1, CONST.CHAR_原形, 105997);
- Char.SetData(charIndex1, CONST.CHAR_原始图档, 100125);
- print('charIndex1', charIndex1)
- Char.SetData(charIndex1, CONST.CHAR_体力, rx);
- Char.SetData(charIndex1, CONST.CHAR_力量, rg);
- Char.SetData(charIndex1, CONST.CHAR_强度, rf);
- Char.SetData(charIndex1, CONST.CHAR_速度, rs);
- Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
- Char.SetData(charIndex1, CONST.CHAR_火属性, 100);
- Char.SetData(charIndex1, CONST.CHAR_必杀, 30);
- Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
- Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
- Char.SetData(charIndex1, CONST.CHAR_种族, 0);
- NLG.UpChar(charIndex1);
- Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
- Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
- --Char.GiveItem(charIndex1, 900049, 1, false);
- --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
- Char.SetData(charIndex1, CONST.CHAR_职业, 24);
- Char.SetData(charIndex1, CONST.CHAR_职类ID, 20);
- Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
- Char.AddSkill(charIndex1, 3);
- --Char.GivePet(charIndex1, 3004);
- --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
- --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
- --local petIndex = Char.GetPet(charIndex1, 0);
- --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
- NLG.SystemMessage(player, '召唤佣兵: 战斧' )
- Char.JoinParty(charIndex1, player);
- else
- NLG.SystemMessage(player, '只能召唤1位战斧。' )
- end
- end
-
- elseif msg == "/aiq" or msg == "、aiq" then
- if Char.GetData(player,%对象_战宠%) == -1 then
- NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
- elseif allyb > 750 then
- NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
- else
- if wanjia[player][4] == 0 then
- local charIndex1 = Char.CreateDummy()--生成ai佣兵
- allyb = charIndex1
- print("编号:"..charIndex1.."")
- wanjia[player][4] = charIndex1
-
- Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
- Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
- Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
- Char.SetData(charIndex1, CONST.CHAR_名字, 'Archer');
- Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
- Char.SetData(charIndex1, CONST.CHAR_形象, 100073);
- Char.SetData(charIndex1, CONST.CHAR_原形, 101142);
- Char.SetData(charIndex1, CONST.CHAR_原始图档, 100073);
- print('charIndex1', charIndex1)
- Char.SetData(charIndex1, CONST.CHAR_体力, rx);
- Char.SetData(charIndex1, CONST.CHAR_力量, rg);
- Char.SetData(charIndex1, CONST.CHAR_强度, rf);
- Char.SetData(charIndex1, CONST.CHAR_速度, rs);
- Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
- Char.SetData(charIndex1, CONST.CHAR_水属性, 100);
- Char.SetData(charIndex1, CONST.CHAR_反击, 30);
- Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
- Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
- Char.SetData(charIndex1, CONST.CHAR_种族, 0);
- NLG.UpChar(charIndex1);
- Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
- Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
- --Char.GiveItem(charIndex1, 2100, 1, false);
- --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
- Char.SetData(charIndex1, CONST.CHAR_职业, 34);
- Char.SetData(charIndex1, CONST.CHAR_职类ID, 30);
- Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
- Char.AddSkill(charIndex1, 1);
- --Char.GivePet(charIndex1, 3004);
- --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
- --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
- --local petIndex = Char.GetPet(charIndex1, 0);
- --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
- NLG.SystemMessage(player, '召唤佣兵: 骑士' )
- Char.JoinParty(charIndex1, player);
- else
- NLG.SystemMessage(player, '只能召唤1位骑士。' )
- end
- end
-
- elseif msg == "/aigd" or msg == "、aigd" then
- if Char.GetData(player,%对象_战宠%) == -1 then
- NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
- elseif allyb > 750 then
- NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
- else
- if wanjia[player][5] == 0 then
- local charIndex1 = Char.CreateDummy()--生成ai佣兵
- allyb = charIndex1
- print("编号:"..charIndex1.."")
- wanjia[player][5] = charIndex1
-
- Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
- Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
- Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
- Char.SetData(charIndex1, CONST.CHAR_名字, '加盐纯净水');
- Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
- Char.SetData(charIndex1, CONST.CHAR_形象, 100108);
- Char.SetData(charIndex1, CONST.CHAR_原形, 119500);
- Char.SetData(charIndex1, CONST.CHAR_原始图档, 100108);
- print('charIndex1', charIndex1)
- Char.SetData(charIndex1, CONST.CHAR_体力, rx);
- Char.SetData(charIndex1, CONST.CHAR_力量, rg);
- Char.SetData(charIndex1, CONST.CHAR_强度, rf);
- Char.SetData(charIndex1, CONST.CHAR_速度, rs);
- Char.SetData(charIndex1, CONST.CHAR_魔法, rm);
- Char.SetData(charIndex1, CONST.CHAR_地属性, 100);
- Char.SetData(charIndex1, CONST.CHAR_命中, 30);
- Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
- Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
- Char.SetData(charIndex1, CONST.CHAR_种族, 0);
- NLG.UpChar(charIndex1);
- Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
- Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
- --Char.GiveItem(charIndex1, 2100, 1, false);
- --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
- Char.SetData(charIndex1, CONST.CHAR_职业, 144);
- Char.SetData(charIndex1, CONST.CHAR_职类ID, 140);
- Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
- Char.AddSkill(charIndex1, 4);
- --Char.GivePet(charIndex1, 3004);
- --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
- --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
- --local petIndex = Char.GetPet(charIndex1, 0);
- --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
- NLG.SystemMessage(player, '召唤佣兵: 格斗' )
- Char.JoinParty(charIndex1, player);
- else
- NLG.SystemMessage(player, '只能召唤1位格斗。' )
- end
- end
-
- elseif msg == "/aim" or msg == "、aim" then
- if Char.GetData(player,%对象_战宠%) == -1 then
- NLG.SystemMessage(player, '不带宠,无法召唤佣兵。' )
- elseif allyb > 750 then
- NLG.SystemMessage(player, '当前线路人口爆满,无法添加佣兵了。' )
- else
- if wanjia[player][6] == 0 then
- local charIndex1 = Char.CreateDummy()--生成ai佣兵
- allyb = charIndex1
- print("编号:"..charIndex1.."")
- wanjia[player][6] = charIndex1
-
- Char.SetData(charIndex1, CONST.CHAR_X, Char.GetData(player, CONST.CHAR_X));
- Char.SetData(charIndex1, CONST.CHAR_Y, Char.GetData(player, CONST.CHAR_Y));
- Char.SetData(charIndex1, CONST.CHAR_地图, Char.GetData(player, CONST.CHAR_地图));
- Char.SetData(charIndex1, CONST.CHAR_名字, '马猴烧酒');
- Char.SetData(charIndex1, CONST.CHAR_地图类型, Char.GetData(player, CONST.CHAR_地图类型));
- Char.SetData(charIndex1, CONST.CHAR_形象, 100322);
- Char.SetData(charIndex1, CONST.CHAR_原形, 104968);
- Char.SetData(charIndex1, CONST.CHAR_原始图档, 100322);
- print('charIndex1', charIndex1)
- Char.SetData(charIndex1, CONST.CHAR_体力, rx/2);
- Char.SetData(charIndex1, CONST.CHAR_力量, 0);
- Char.SetData(charIndex1, CONST.CHAR_强度, rf);
- Char.SetData(charIndex1, CONST.CHAR_速度, rs);
- Char.SetData(charIndex1, CONST.CHAR_魔法, rm*10);
- Char.SetData(charIndex1, CONST.CHAR_风属性, 100);
- Char.SetData(charIndex1, CONST.CHAR_闪躲, 30);
- Char.SetData(charIndex1, CONST.CHAR_魅力, 100);
- Char.SetData(charIndex1, CONST.CHAR_等级, rlv);
- Char.SetData(charIndex1, CONST.CHAR_种族, 0);
- NLG.UpChar(charIndex1);
- Char.SetData(charIndex1, CONST.CHAR_血, Char.GetData(charIndex1, CONST.CHAR_最大血));
- Char.SetData(charIndex1, CONST.CHAR_魔, Char.GetData(charIndex1, CONST.CHAR_最大魔));
- --Char.GiveItem(charIndex1, 2100, 1, false);
- --Char.MoveItem(charIndex1, 8, CONST.EQUIP_左手, -1);
- Char.SetData(charIndex1, CONST.CHAR_职业, 74);
- Char.SetData(charIndex1, CONST.CHAR_职类ID, 70);
- Char.SetData(charIndex1, CONST.CHAR_职阶, 3);
- Char.AddSkill(charIndex1, 22);
- --Char.GivePet(charIndex1, 3004);
- --Char.SetPetDepartureState(charIndex1, 0, CONST.PET_STATE_战斗);
- --Char.SetData(charIndex1, CONST.CHAR_战宠, 0);
- --local petIndex = Char.GetPet(charIndex1, 0);
- --Char.SetData(petIndex, CONST.PET_DepartureBattleStatus, CONST.PET_STATE_战斗);
- NLG.SystemMessage(player, '召唤佣兵: 法师')
- Char.JoinParty(charIndex1, player);
- else
- NLG.SystemMessage(player, '只能召唤1位法师。' )
- end
- end
-
- end
- end
-
-
- --[[
- function ybModule:handleTalkEvent(player, msg)
- local command = msg:match('^/([%w]+)')
- if commandsNormal[command] then
- local arg = msg:match('^/[%w]+ +(.+)$')
- arg = arg and string.split(arg, ' ') or {}
- commandsNormal[command](player, arg);
- return
- end
- return 1;
- end
- ]]
- --- 加载模块钩子
- function ybModule:onLoad()
- self:logInfo('load')
- self:regCallback('TalkEvent', Func.bind(self.handleTalkEvent, self))
- end
-
- --- 卸载模块钩子
- function ybModule:onUnload()
- self:logInfo('unload')
- end
-
- return ybModule;
复制代码
补充内容 (2021-12-24 22:34):
一套lua在20楼
最新yb.lua代码在34楼 |