本帖最后由 ahsin 于 2021-12-23 03:47 编辑
修复
神奇的问题,初始化table,默认值不得为0,改成-1就好了
覆盖yb.lua即可
- ---模块类
- local ybModule = ModuleBase:createModule('yb')
- local allyb = 0
- -- 普通玩家命令
- --local commandsNormal = {}
-
- wanjia = {}--玩家表
- for bbb = 0,800 do
- wanjia[bbb] = {}
- wanjia[bbb][0] = 0--ai统计
- wanjia[bbb][1] = -1
- wanjia[bbb][2] = -1
- wanjia[bbb][3] = -1
- wanjia[bbb][4] = -1
- wanjia[bbb][5] = -1
- wanjia[bbb][6] = -1
- end
-
- Delegate.RegDelTalkEvent("yb_TalkEvent");--说话触发
- Delegate.RegDelAllOutEvent("yboffline");--玩家下线触发
- Delegate.RegDelAfterWarpEvent("ybwarp");--玩家传送触发
-
-
-
- function ybwarp(player,map,floor,x,y,aftermap,afterfloor,afterx,aftery)--传送后若ai掉队则加回队伍来
- print("player NO: "..player.."")
- if Char.PartyNum(wanjia[player][1]) == -1 then
- Char.Warp(wanjia[player][1],aftermap,afterfloor,afterx,aftery)
- Char.JoinParty(wanjia[player][1],player);
- end
- if Char.PartyNum(wanjia[player][2]) == -1 then
- Char.Warp(wanjia[player][2],aftermap,afterfloor,afterx,aftery)
- Char.JoinParty(wanjia[player][2],player);
- end
- if Char.PartyNum(wanjia[player][3]) == -1 then
- Char.Warp(wanjia[player][3],aftermap,afterfloor,afterx,aftery)
- Char.JoinParty(wanjia[player][3],player);
- end
- if Char.PartyNum(wanjia[player][4]) == -1 then
- Char.Warp(wanjia[player][4],aftermap,afterfloor,afterx,aftery)
- Char.JoinParty(wanjia[player][4],player);
- end
- if Char.PartyNum(wanjia[player][5]) == -1 then
- Char.Warp(wanjia[player][5],aftermap,afterfloor,afterx,aftery)
- Char.JoinParty(wanjia[player][5],player);
- end
- if Char.PartyNum(wanjia[player][6]) == -1 then
- Char.Warp(wanjia[player][6],aftermap,afterfloor,afterx,aftery)
- Char.JoinParty(wanjia[player][6],player);
- end
- end
-
-
- function yboffline(player)--玩家下线清空自己召唤的ai
- if wanjia[player][1] > 0 then
- Char.DelDummy(wanjia[player][1])
- wanjia[player][0] = 0
- end
- if wanjia[player][2] > 0 then
- Char.DelDummy(wanjia[player][2])
- wanjia[player][0] = 0
- end
- if wanjia[player][3] > 0 then
- Char.DelDummy(wanjia[player][3])
- wanjia[player][0] = 0
- end
- if wanjia[player][4] > 0 then
- Char.DelDummy(wanjia[player][4])
- wanjia[player][0] = 0
- end
- if wanjia[player][5] > 0 then
- Char.DelDummy(wanjia[player][5])
- wanjia[player][0] = 0
- end
- if wanjia[player][6] > 0 then
- Char.DelDummy(wanjia[player][6])
- wanjia[player][0] = 0
- end
- wanjia[player][0] = 0
- 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 == "/aiback" or msg == "、aiback" then
- wjmap = Char.GetData(player,%对象_MAP%)
- wjfloor = Char.GetData(player,%对象_地图%)
- wjx = Char.GetData(player,%对象_X%)
- wjy = Char.GetData(player,%对象_Y%)
- if Char.PartyNum(wanjia[player][1]) == -1 then
- Char.Warp(wanjia[player][1],wjmap,wjfloor,wjx,wjy)
- Char.JoinParty(wanjia[player][1],player);
- --print(Char.IsDummy(wanjia[player][1]))
- end
- if Char.PartyNum(wanjia[player][2]) == -1 then
- Char.Warp(wanjia[player][2],wjmap,wjfloor,wjx,wjy)
- Char.JoinParty(wanjia[player][2],player);
- end
- if Char.PartyNum(wanjia[player][3]) == -1 then
- Char.Warp(wanjia[player][3],wjmap,wjfloor,wjx,wjy)
- Char.JoinParty(wanjia[player][3],player);
- end
- if Char.PartyNum(wanjia[player][4]) == -1 then
- Char.Warp(wanjia[player][4],wjmap,wjfloor,wjx,wjy)
- Char.JoinParty(wanjia[player][4],player);
- end
- if Char.PartyNum(wanjia[player][5]) == -1 then
- Char.Warp(wanjia[player][5],wjmap,wjfloor,wjx,wjy)
- Char.JoinParty(wanjia[player][5],player);
- end
- if Char.PartyNum(wanjia[player][6]) == -1 then
- Char.Warp(wanjia[player][6],wjmap,wjfloor,wjx,wjy)
- Char.JoinParty(wanjia[player][6],player);
- end
- end
-
- if msg == "/killai" or msg == "、killai" then--干掉ai的命令
- if wanjia[player][1] > 0 then
- Char.DelDummy(wanjia[player][1])
- wanjia[player][1] = -1
- wanjia[player][0] = 0
- end
- if wanjia[player][2] > 0 then
- Char.DelDummy(wanjia[player][2])
- wanjia[player][2] = -1
- wanjia[player][0] = 0
- end
- if wanjia[player][3] > 0 then
- Char.DelDummy(wanjia[player][3])
- wanjia[player][3] = -1
- wanjia[player][0] = 0
- end
- if wanjia[player][4] > 0 then
- Char.DelDummy(wanjia[player][4])
- wanjia[player][4] = -1
- wanjia[player][0] = 0
- end
- if wanjia[player][5] > 0 then
- Char.DelDummy(wanjia[player][5])
- wanjia[player][5] = -1
- wanjia[player][0] = 0
- end
- if wanjia[player][6] > 0 then
- Char.DelDummy(wanjia[player][6])
- wanjia[player][6] = -1
- wanjia[player][0] = 0
- end
- NLG.SystemMessage(player, '已开除所有佣兵。' )
- end
-
- if msg == "/aig" or msg == "、aig" then--召唤弓箭手佣兵
- if wanjia[player][0] > 3 then
- NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
- elseif 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佣兵
- wanjia[player][0] = wanjia[player][0] + 1--统计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 wanjia[player][0] > 3 then
- NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
- elseif 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佣兵
- wanjia[player][0] = wanjia[player][0] + 1--统计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 wanjia[player][0] > 3 then
- NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
- elseif 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佣兵
- wanjia[player][0] = wanjia[player][0] + 1--统计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 wanjia[player][0] > 3 then
- NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
- elseif 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佣兵
- wanjia[player][0] = wanjia[player][0] + 1--统计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 wanjia[player][0] > 3 then
- NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
- elseif 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佣兵
- wanjia[player][0] = wanjia[player][0] + 1--统计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 wanjia[player][0] > 3 then
- NLG.SystemMessage(player, '您已经召唤了4位小伙伴了,不能再召唤了。' )
- elseif 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佣兵
- wanjia[player][0] = wanjia[player][0] + 1--统计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;
复制代码
|