local b2i = { [false] = 0, [true] = 1 } local waittimesec = 3*60 local namesact = { [0] = "跨服", "群骑竞赛", "夺宝战场", "杀戮证道", "据点争夺", "跨服沙巴克","辉煌的凤栖寺院", "泽坤的恩赐", } local tims = { [0] = { (14 * 60 + 0), (23 * 60 + 30) } , { (16 * 60 + 30), (16 * 60 + 50) }--群骑竞赛 , { (18 * 60 + 10), (18 * 60 + 25) }--夺宝战场 ,nil--, { (20 * 60 + 00), (20 * 60 + 10) }--杀戮证道 , { (19 * 60 + 00), (19 * 60 + 20) }--据点争夺 每周二四六开启21:00:00 , { (19 * 60 + 00), (19 * 60 + 50) }--跨服沙巴克 每周二四六开启21:00:00 , { (20 * 60 + 00), (20 * 60 + 50) }--辉煌的凤栖寺院 , { (19 * 60 + 00), (19 * 60 + 50) }--泽坤的恩赐 周日21:00:00 } local txcl = {[0]="14:00-23:30", "每天16:30-16:50",--群骑竞赛 "每天18:10-18:25",--夺宝战场 "关闭",--"每天20:00-20:10",--杀戮证道 "每周一三五19:00-19:20",--据点争夺 "每周二四六19:00-19:50",--跨服沙巴克 "每天20:00-20:50",--辉煌的凤栖寺院 "周日19:00-19:50"--泽坤的恩赐 } local boxeffid = 60584 -- local tims = { [0] = nil, nil,nil,nil,nil,nil,nil,{ (18 * 60 + 30), (18 * 60 + 50) }--群骑竞赛 -- } -- local tims = { [0] = nil, nil,{ (18 * 60 + 30), (18 * 60 + 50) }--群骑竞赛 -- } --@ff xdt306 130 208 @ff xdt246 192 178 local maps = { { "xdt306", 283, 283 }, { "xdt293", 26, 52 }, { "xdt292", 33, 35 }, { "xdt294", 83, 90 }, { "kf3", 650, 300 }, { "xdt292", 33, 35 }, { "xdt316" }, { "xdt292", 33, 35 }, } local avtime = {[0]=0, 60, 120, -20, 600, 600, 60*10, 600 } local jfmaps ={[0]={},{ "xdt306" }, { "xdt293" }, { "xdt292" }, { "xdt294","jddd"}, { "kf3", "kf0150" }, { "xdt297", "xdt298", "xdt299", "xdt300", "xdt301", "xdt302", "xdt303", }, { "xdt316"}, { "xdt292" }, { "xdt292" }, { "xdt292" }} local zypos = {{40,41}} local zyname = {"红","蓝"} local stpos = {{59,26},{16,55}} local zystmen = {{45,144},{127,45}} local oneguild = "" local AllGuilds = {} local castleguid = "" local castleoldguid = "" local dieflag = 0 local dieflag2 = 0 local jlitems = { [0]= {""}, [1] = { "代购币#10&绑定元宝#98888&绑定金币#18888888&书页#40#339&布料#40#339&龙玉勋章#1#339", "代购币#10&绑定元宝#78888&绑定金币#15888888&书页#30#339&布料#30#339&龙玉勋章#1#339", "代购币#10&绑定元宝#58888&绑定金币#12888888&书页#20#339&布料#20#339&龙玉勋章#1#339", "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", }, [2] = { "代购币#10&绑定元宝#98888&绑定金币#18888888&书页#40#339&布料#40#339&龙玉勋章#1#339", "代购币#10&绑定元宝#78888&绑定金币#15888888&书页#30#339&布料#30#339&龙玉勋章#1#339", "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", }, [3] = { "代购币#10&绑定元宝#98888&绑定金币#18888888&书页#40#339&布料#40#339&龙玉勋章#1#339", "代购币#10&绑定元宝#78888&绑定金币#15888888&书页#30#339&布料#30#339&龙玉勋章#1#339", "代购币#10&绑定元宝#58888&绑定金币#12888888&书页#20#339&布料#20#339&龙玉勋章#1#339", "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", }, [4] = { "代购币#10&绑定元宝#98888&绑定金币#18888888&书页#40#339&布料#40#339&龙玉勋章#1#339", "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", }, [5] = { "代购币#10&绑定元宝#98888&绑定金币#18888888&书页#40#339&布料#40#339&龙玉勋章#10#339", "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#10#339", }, [6] = { "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#10#339", }, [7] = { "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", } , [8] = { "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", } , [9] = { "代购币#10&绑定元宝#38888&绑定金币#5888888&书页#10#339&布料#10#339&龙玉勋章#1#339", } } release_print("-----跨服玩家消息处理") kuafusys = { maps=tbl2json(jfmaps), msgproc = {}, bmHour = 25, roomopen=0, diedrop=false, sun=true, kaimentime = 0, actstate = { }, curact = nil } local kuafusys = kuafusys local recfile="QuestDiary/跨服报名.ini" function kuafusys.read(actor,k) local ss = tostring(getconst(actor, "<$USERNAME>"))..math.floor(os.time()/86400) return tonumber(readini(recfile, k, ss)) end function kuafusys.write(actor,k, v) local ss = tostring(getconst(actor, "<$USERNAME>"))..math.floor(os.time()/86400) local old = kuafusys.read(actor,k) writeini(recfile, k, ss, v) jhxbbgame.log(actor,getbaseinfo(actor, 1), getbaseinfo(actor, 2), ss,".write=>",k, v,old) end function kuafusys_setzy(actor,zy) zy = zy or {z=0} jhxbbgame.log(actor,"setcamp:",zy.z,getbaseinfo(actor,1),getbaseinfo(actor,2)) setcamp(actor, zy.z or 0) jhxbbgame.topui.upzy(actor,zy.z or 0) end function kuafusys.setzy(actor,zy) setcamp(actor, zy) jhxbbgame.bfcall(actor,"kuafusys_setzy",{z=zy}) jhxbbgame.log(actor,"kuafusys.setzy:",zy) end function kuafusys_regohome(actor,zy) local ca = kuafusys.curact jhxbbgame.IncHP(actor, 0.999) jhxbbgame.log(actor,"阵营复活:",zy,getbaseinfo(actor,1),getbaseinfo(actor,2)) if ca and ca.i == 4 and ca.runing == 1 then local spd = kuafusys.getdataEx(actor, ca.i) local x,y = getbaseinfo(actor,4),getbaseinfo(actor,5) if spd.pd.zy > 0 then local ax,ay = stpos[spd.pd.zy][1],stpos[spd.pd.zy][2] if not kuafusys.InRange(ax,ay,x,y) then kuafusys.JoinMap(actor,maps[ca.i],spd,spd.pd.zy) return end end end mapmove(actor, "xdt246", 192, 178, 5) end function kuafusys.gohome(actor,re) re = re or 0 kuafusys.setzy(actor,0) jhxbbgame.IncHP(actor, 0.999) jhxbbgame.log(actor,"kuafusys.gohome:",re) if re == 1 then jhxbbgame.kfcall(actor,"kuafusys_regohome",{re=1}) else mapmove(actor, "xdt246", 192, 178, 5) end kuafusys.NColor(actor, 255) jhxbbgame.TimeMsg(actor,"",0) jhxbbgame.take(actor,"传奇宝箱") jhxbbgame.bfcall(actor,"___xiamaauto",{u=1}) kuafusys.clearbxeff(actor) kuafusys.RetAttackMode(actor) end function kuafusys.init(i) i = tonumber(i) jhxbbgame.log("kuafusys.init:", i) local t = tims[i] local s = {joineds={},playdatas={},ranks={},runing=0} s.i = i s.actname = namesact[i] if t then s.bgtime = t[1] * 60 s.edtime = t[2] * 60 local sun = jhxbbgame.daysun() if s.actname == "据点争夺" then if ((sun ==1) or (sun ==3) or (sun ==5)) then elseif ((sun ==6)) then s.bgtime = s.bgtime + 2*86400 s.edtime = s.edtime + 2*86400 else s.bgtime = s.bgtime + 86400 s.edtime = s.edtime + 86400 end elseif s.actname == "跨服沙巴克" then if ((sun ==2) or (sun ==4) or (sun ==6)) then elseif ((sun ==7)) then s.bgtime = s.bgtime + 3*86400 s.edtime = s.edtime + 3*86400 else s.bgtime = s.bgtime + 86400 s.edtime = s.edtime + 86400 end elseif s.actname == "泽坤的恩赐" then if ((sun ==7)) then else local dc = 7-sun s.bgtime = s.bgtime + dc*86400 s.edtime = s.edtime + dc*86400 end end -- s.bgtime = jhxbbgame.nowsec()+20 -- s.edtime = s.bgtime + 3 * 60 else s.bgtime = 0 s.edtime = 0 end kuafusys.actstate[i] = s return kuafusys.actstate[i] end --release_print("kuafusys:", tbl2json(kuafusys.actstate)) function kuafusys_pubmsg(actor,cfg) sendmovemsg(actor, 1, 249, 0, 150, 1, cfg.t) end function kuafusys.pubmsg(ca,smsg) jhxbbgame.log(nil,"-------kf.pubmsg",ca.actname..smsg) jhxbbgame.bfcall("0","kuafusys_pubmsg",{t="<" .. ca.actname .. "/FCOLOR=250>{"..smsg.."/FCOLOR=253}"}) end function kuafusys.connected() return checkkuafuserver() or checkkuafuconnect() end function kuafusys.primsg(actor, ca,smsg) local caname = (ca and ca.actname) or "跨服" jhxbbgame.log(actor,"-------kf.primsg",caname,smsg) --jhxbbgame.sendmsg(actor, ca.actname..":"..smsg) jhxbbgame.HintEff(actor, caname..":"..smsg,"00FF00") end function kuafusys.nonerun(actor) end function kuafusys.run(actor) --kuafusys._run(actor) end function kuafusys.paopush(actor) jhxbbgame.log(actor,"------------kuafusys.paopush") jhxbbgame.kfcall(actor, "kuafusys_paopush") end function kuafusys_paopush(actor) local ca = kuafusys.curact if ca and ca.actname == "群骑竞赛" and ca.runing == 1 then local lv = kuafusys.RecRank(actor, ca) if lv > 0 then end else --kuafusys.give(actor,getbaseinfo(actor, 2),"代购币#10&元宝#98888","群骑竞赛") jhxbbgame.log(actor,"------------kuafusys.paopush.失败活动无效", tbl2json(ca)) jhxbbgame.sendmsg(actor, "失败活动无效!") end end function kuafusys.give(actor,uid,itm,tile) kuafusys.sendkfmail(actor,uid,itm,tile,"跨服活动奖励") end function kuafusys_mail(actor,a) jhxbbgame.log(actor,"------------.kuafusys_mail.",tbl2json(a)) if a and a.t and a.u then --local aactor = getplayerbyid(a.u) --if aactor then sendmail(a.u, 1, a.t, a.tt, a.i) --end end end function kuafusys.sendkfmail(actor,uid,itm,tile,t2) jhxbbgame.bfcall(actor,"kuafusys_mail",{u=uid,i=itm,t=tile,tt=t2}) end function clearkfgate() delmapgate("G1","xdt306") delmapeffect(131313) delmapgate("G3","xdt294") delmapgate("G31","xdt294") end function kuafusys.begact(sysact,ca) jhxbbgame.log(nil,"------------kuafusys.begact",ca.actname) ca.ranks = ca.ranks or {} kuafusys.pking = kuafusys.pknone kuafusys.endguildWar(sysact) if ca.actname == "群骑竞赛" then kuafusys.run = kuafusys._run --local x,y =275,279 local x,y =273,273 --mapeffect(131313, "xdt306", x, y, 490, 15, 0) -- jhxbbgame.MapPlayRun(maps[1][1], function (actor) -- sendcentermsg(actor,180,251,"还剩余%d后活动开始.",0,180) -- --sendmapmsg(maps[1][1],tbl2json({Msg=ca.actname.."活动结束!",FColor=255,BColor=155,Type=1,Time=3})) -- end) local t = waittimesec - (jhxbbgame.nowsec()- ca.bgtime) if t > 3 then kuafusys.kaimentime = os.time()+t addmapgate("G1","xdt306",273,273,6,"xdt306",282,282,2000000) else kuafusys.kaimentime = 0 end elseif ca.actname == "夺宝战场" then if getmoncount("xdt293",-1,true)<1 then genmon("xdt293", 26, 52, "宝藏巨蟹",5,1,255) end kuafusys.act2playupid = kuafusys.act2playupid or "" kuafusys.act2monkillplayid = kuafusys.act2monkillplayid or "" kuafusys.bxx = kuafusys.bxx or 17 kuafusys.bxy = kuafusys.bxy or 56 elseif ca.actname == "据点争夺" then local function initzy() return {pw=0,plays={},ptjf={0,0,0,0,0}, jf=0} end ca.zydata = ca.zydata or {initzy(),initzy()} ca.jdzt= ca.jdzt or {0,0,0,0,0} -- addmapgate("G3","xdt294",zystmen[1][1],zystmen[1][2],5,"xdt294",36,153,2000000) -- addmapgate("G31","xdt294",zystmen[2][1],zystmen[2][2],5,"xdt294",136,36,2000000) local t = 60 - (jhxbbgame.nowsec()- ca.bgtime) if t > 3 then kuafusys.kaimentime = os.time()+t else kuafusys.kaimentime = 0 end --genmon("xdt293", 26, 52, "宝藏巨蟹",5,1,255) elseif ca.actname == "跨服沙巴克" then if getmoncount("kf3",1001,true)<1 then genmon("kf3", 624, 278, "LeftWall",0,1,255) end if getmoncount("kf3",1002,true)<1 then genmon("kf3", 627, 278, "CenterWall",0,1,255) end if getmoncount("kf3",1003,true)<1 then genmon("kf3", 634, 271, "RightWall",0,1,255) end castleguid = castleguid or "" elseif ca.actname == "辉煌的凤栖寺院" then --kuafusys.pking = kuafusys._pkingfx --genmon("xdt296", 35, 34, "意念掌控者",0,1,254) if getmoncount("xdt297",-1,true)<1 then genmon("xdt297", 26, 25, "意念掌控者",0,1,254)end if getmoncount("xdt298",-1,true)<1 then genmon("xdt298", 25, 26, "记忆抹杀者",0,1,254)end if getmoncount("xdt299",-1,true)<1 then genmon("xdt299", 25, 26, "时空潜行者",0,1,254)end if getmoncount("xdt300",-1,true)<1 then genmon("xdt300", 26, 27, "巨龙驾驭者",0,1,254)end if getmoncount("xdt301",-1,true)<1 then genmon("xdt301", 26, 26, "邪恶守护者",0,1,254)end if getmoncount("xdt302",-1,true)<1 then genmon("xdt302", 26, 26, "亡魂守灵者",0,1,254)end if getmoncount("xdt303",-1,true)<1 then genmon("xdt303", 25, 25, "恐惧支配者蓝焰翼龙",0,1,254) end ca.mon = 1 --genmon("xdt304", 29, 22, "CenterWall",0,1,255) --genmon("kf3", 634, 271, "RightWall",0,1,255) elseif ca.actname == "泽坤的恩赐" then kuafusys.pking = kuafusys._pking kuafusys.makenpc(0) local ps = kuafusys.makenpc(1) end end function kuafusys.pknone(actor) end function kuafusys._pking(actor) if isplayer(actor) then SetVarInt(actor, "U023", 1) jhxbbgame.topui.hidebar(actor) end end function kuafusys._pkingfx(tag,actor,dam) local ca = kuafusys.curact if ismon(tag) and checkkuafuserver() and ca and ca.runing and ca.actname == "辉煌的凤栖寺院" then local spd = kuafusys.getdataEx(actor, ca.i) if spd and spd.pd.jf < 3*10000 then spd.pd.jf = spd.pd.jf + 1 jhxbbgame.log(actor,tag,"------------kuafusys.delnpc",dam) if spd.pd.jf > 300 then kuafusys.dcjoin(actor,ca,spd,"达成活跃!!") end end end end function kuafusys.dcjoin(actor,ca,spd,s) kuafusys.primsg(actor, ca,s) spd.pd.mapjoin = 1 ca.joineds[#ca.joineds + 1] = { getbaseinfo(actor, 2), getbaseinfo(actor, 1),getbaseinfo(actor, 36) } end local keys = {"188代购币","88代购币","58代购币","10代购币"} kuafusys.pking = kuafusys.pknone function kuafusys_delnpc(actor,a) a = a or {} local id = a[1] local key = keys[a[2]] jhxbbgame.log(actor,id,"------------kuafusys.delnpc", key) delnpc(key..id,"xdt316") delnpc(id,"xdt316") end local caijicfg = {} function kfcaijiok(actor) local id = VarInt(actor, "U023") if id >= 1118*8 then local cfg = caijicfg[id] if cfg and cfg[2] then if cfg[0] == 1 then jhxbbgame.sendmsg(actor, "采集失败!!!") return end cfg[0] = cfg[0] or 1 caijicfg[id] = cfg local key = cfg[2] --jhxbbgame.kfcall(actor, "kuafusys_delnpc", tbl2json({id, key})) jhxbbgame.log(actor,id,"------------kuafusys.kfcaijiok", key) if key == 1 then gives(actor,"代购币#188","kfcaijiok") elseif key == 2 then gives(actor,"代购币#88","kfcaijiok") elseif key == 3 then gives(actor,"代购币#58","kfcaijiok") elseif key == 4 then gives(actor,"代购币#10","kfcaijiok") end kuafusys_delnpc(actor,{id, key}) return else jhxbbgame.sendmsg(actor, "已经被过采集了!!") end cfg[0] = 0 caijicfg[id] = cfg else jhxbbgame.sendmsg(actor, "采集失败!") SetVarInt(actor, "U023", 0) jhxbbgame.log(actor,id,"------------kuafusys.kfcaijiok", id) end end function npcxy(npc_id) local npc = getnpcbyindex(npc_id) return getbaseinfo(npc,4),getbaseinfo(npc,5) end function kuafusys.clickcaiji(actor, npcid) local time= caijicfg[npcid] if time and time[1] then local x,y = getbaseinfo(actor,4),getbaseinfo(actor,5) local nx,ny = npcxy(npcid) local absx = math.abs(nx - x) local absy = math.abs(ny - y) if (absx <= 2) and (absy <= 2) then else jhxbbgame.sendmsg(actor, "距离太远了!!!") return end SetVarInt(actor, "U023", npcid) --jhxbbgame.sendmsg(actor, npcid.."采集:"..keys[time[2]]..","..time[3]..","..time[4]) showprogressbardlg(actor, time[1], "@kfcaijiok", "正在采集,进度%d%.....", 1, nil) else jhxbbgame.sendmsg(actor, "已经被过采集了!") jhxbbgame.log(actor,npcid,"------------kuafusys.clickcaiji", "无配置数据") kuafusys_delnpc(actor,{npcid, tostring(time[2])}) end end --{id,key, x,y} local npccfg = {{1,60,1097,151}, {2,40,1094,249}, {3,20,1093,254}, {35,10,1098,255}, } function kuafusys_makenpc(actor,a) local id, key,x,y= a[1],a[2],a[3],a[4] local value = npccfg[key] local npcInfo = { ["Idx"] = id, -- 自定义NPC的Idx,NPC点击触发时,触发参数会传回Idx值 ["npcname"] = keys[key]..id, -- NPC名称 ["appr"] = value[3], -- NPC外形效果 ["color"] = value[4], -- NPC外形效果 ["limit"] = 60*60, -- 生命周期 (秒) 引擎64_24.05.23新增 } caijicfg[id]={value[2],key, x,y} createnpc("xdt316",x,y,tbl2json(npcInfo)) end function kuafusys.makenpc(a) local id = 1118*8 jhxbbgame.log(nil,"------------kuafusys.makenpc,") local dmp = {} for key, value in pairs(npccfg) do -- genmon("xdt316", 25, 25, key,66,value[1],254) for i = 1, value[1], 1 do local npcInfo = { ["Idx"] = id, -- 自定义NPC的Idx,NPC点击触发时,触发参数会传回Idx值 ["npcname"] = keys[key]..id, -- NPC名称 ["appr"] = value[3], -- NPC外形效果 ["color"] = value[4], -- NPC外形效果 ["limit"] = 60*60, -- 生命周期 (秒) 引擎64_24.05.23新增 } --genmon("xdt316", 25, 25, key,66,value[1],254) local function mk(x,y) local ret = nil ret = createnpc("xdt316",x,y,tbl2json(npcInfo)) jhxbbgame.log(nil,id,"------------kuafusys.createnpc", ret,keys[key]..id,x,y) caijicfg[id]={value[2],key, x,y} jhxbbgame.bfcall("0","kuafusys_makenpc",{id,key, x,y}) id = id + 1 end if a == 0 then kuafusys_delnpc(nil,{id, key}) else for i = 1, 100, 1 do local x,y = math.random(1,30)+math.random(1,30),math.random(1,30)+math.random(1,30) if gridattr("xdt316",x ,y,1) and not dmp[x.."_"..y] then dmp[x.."_"..y] = true mk(x,y) break end end end end end if a == 0 then jhxbbgame.log(nil,"------------kuafusys.delnpc", #caijicfg) caijicfg ={} else return caijicfg end end function kuafusys.endact(sysact,ca) local xbb = jhxbbgame local itemg = jlitems[ca.i] local avid = #itemg xbb.log(nil,"------------kuafusys.endact", ca.actname,#ca.ranks,#ca.joineds, kuafusys.act2playupid,kuafusys.act2monkillplayid) kuafusys.run = kuafusys.nonerun xbb.log(nil,"------------kuafusys.endactjoineds",tbl2json(ca.joineds)) local jfok = {} local jfnotok = {} local jfabs = math.abs(avtime[ca.i]) for uid, lpd in pairs(ca.playdatas) do local jf = lpd.jf or 0 if (jf >= jfabs) and (jfabs > 0) then jfok[uid]=lpd elseif (jfabs > 0) then jfnotok[uid]=lpd end end xbb.log(nil,ca.actname,"------------kuafusys.endactjfok",tbl2json(jfok)) xbb.log(nil,ca.actname,"------------kuafusys.endactjfnotok",tbl2json(jfnotok)) xbb.log(nil,ca.actname,"------------kuafusys.endactplaydatas",tbl2json(ca.playdatas)) local sendpass = {} local function giv(r, info,mc) local uid = info[1] if uid and uid ~= "" and not sendpass[uid] then local aa = itemg[r] local actor = getplayerbyid(uid) if aa and aa ~= "" then sendpass[uid] = true if not mc then mc = "第" .. r .. "名" if r > 3 then mc = "安慰" else --kuafusys.note(ca,"恭喜["..info[2].."]获得第"..r.."名。获得丰厚奖励!!!") end end jhxbbgame.log(actor,"------------kf.endact发放奖励",info[2] or "",uid,ca.actname,mc,aa) kuafusys.give("0",uid,aa,ca.actname .. mc .. "奖励") end end end if ca.actname == "群骑竞赛" then kuafusys.run = kuafusys.nonerun xbb.MapPlayRun(jfmaps[ca.i],function (actor,m) xbb.bfcall(actor,"___xiamaauto",{u=1}) end) elseif ca.actname == "夺宝战场" then local actor = getplayerbyid(kuafusys.act2playupid) if actor then kuafusys.give("0",kuafusys.act2playupid,itemg[1],ca.actname .. "巅峰奖励") sendpass[kuafusys.act2playupid] = true kuafusys.clearbxeff(actor) kuafusys.pubmsg(ca, "恭喜"..tostring(getbaseinfo(actor, 1)).."获得限时称号奖励!") deprivetitle(actor, "宝箱称号") confertitle(actor, "宝箱称号", 1) xbb.bfcall(actor,"kuafusys_bxtop",{u=1}) kuafusys.primsg(actor, ca,"恭喜获得限时称号奖励") end local actor = getplayerbyid(kuafusys.act2monkillplayid) if actor and (not sendpass[kuafusys.act2monkillplayid]) then kuafusys.give("0",kuafusys.act2monkillplayid,itemg[2],ca.actname .. "击杀奖励") sendpass[kuafusys.act2monkillplayid] = true end for key, value in pairs(ca.joineds) do local uid = value[1] if not sendpass[uid] then kuafusys.give("0",uid,itemg[3],ca.actname .. "参与奖励") sendpass[uid] = true end end xbb.MapPlayRun(nil,function (actor,m) xbb.dbgout(actor, "收宝箱!") xbb.take(actor,"传奇宝箱") end) kuafusys.act2monkillplayidold = kuafusys.act2monkillplayid kuafusys.act2playupidold = kuafusys.act2playupid kuafusys.act2monkillplayid = "" kuafusys.act2playupid = "" elseif ca.actname == "杀戮证道" then ca.ranks = {} ca.joineds = {} for key, value in pairs(ca.playdatas) do if value.jf >= 20 then local rd = { key, value.name, value.jf} ca.ranks[#ca.ranks + 1] = rd ca.joineds[#ca.joineds + 1] = rd end end table.sort(ca.ranks,function (a, b) return a[3] > b[3] end) xbb.MapPlayRun(nil,function (actor,m) kuafusys.setzy(actor,0) xbb.SetDefColor(actor) end) elseif ca.actname == "据点争夺" then local zyjf = {{jf=ca.zydata[1].jf,pw=ca.zydata[1].pw},{jf=ca.zydata[2].jf,pw=ca.zydata[2].pw}} local win = 0 local lost = {} if zyjf[1].jf == zyjf[2].jf then if zyjf[1].pw > zyjf[2].pw then win = 1 else win = 2 end elseif zyjf[1].jf > zyjf[2].jf then win = 1 end if win == 1 then lost = {2} else win =2 lost = {1} end ca.ranks = {} ca.joineds = {} for _, z in pairs(lost) do local zyd = ca.zydata[z] for uid, value in pairs(zyd.plays) do local spd = kuafusys.getUiddataEx(uid,ca.i) if spd and spd.pd.mapjoin == 1 then giv(2, {uid}, "参与") else local actor = getplayerbyid(uid) if actor then kuafusys.primsg(actor, ca,"未达成活跃无法领奖!") end end end end local max = 0 local top = nil for _, z in pairs({1,2}) do local zyd = ca.zydata[z] for uid, value in pairs(zyd.plays) do --giv(2, {uid}, "参与") local spd = kuafusys.getUiddataEx(uid,ca.i) if spd and (spd.pd.jfkill or 0> max) then top = uid end end end local cc = "" if top then local actor = getplayerbyid(top) if actor then cc = "!" kuafusys.pubmsg(ca, "恭喜"..tostring(getbaseinfo(actor, 1)).."获得限时称号奖励!") deprivetitle(actor, "据点称号") confertitle(actor, "据点称号", 1) xbb.bfcall(actor,"kuafusys_jdtop",{j=1}) kuafusys.primsg(actor, ca,"恭喜获得限时称号奖励") end end if win > 0 then kuafusys.pubmsg(ca, "恭喜"..zyname[win].."方获得巅峰奖励!"..cc) xbb.log("","据点争夺:Win"..zyname[win]) local zyd = ca.zydata[win] for uid, value in pairs(zyd.plays) do giv(1, {uid}, "巅峰") end end xbb.MapPlayRun(nil,function (actor,m) kuafusys.setzy(actor,0) xbb.SetDefColor(actor) end) ca.zydata = nil ca.jdzt= nil elseif ca.actname == "跨服沙巴克" then kuafusys.endguildWar(sysact) for key, value in pairs(ca.joineds) do if value[3] == castleguid then giv(1, value, "巅峰") end end castleoldguid = castleguid castleguid = "" avid = 2 elseif ca.actname == "泽坤的恩赐" then kuafusys.pking = kuafusys.pknone kuafusys.makenpc(0) avid = 1 end ca.ranks[#ca.ranks + 1] = { "", "" } ca.ranks[#ca.ranks + 1] = { "", "" } ca.ranks[#ca.ranks + 1] = { "", "" } giv(1, ca.ranks[1]) giv(2, ca.ranks[2]) giv(3, ca.ranks[3]) if itemg[avid] then for key, value in pairs(ca.joineds) do giv(avid, value,"参与") end end for uid, value in pairs(jfnotok) do if sendpass[uid] then else kuafusys.sendkfmail("0",uid,"",ca.actname,ca.actname .. "未达成活跃!您的活跃积分:"..(value.jf)) end end for key, m in pairs(jfmaps[ca.i] or {}) do sendmapmsg(m,tbl2json({Msg=ca.actname.." 活动结束!",FColor=255,BColor=155,Type=1,Time=3})) movemapplay(sysact,m,"xdt246", 192, 178, 3) end ca.joineds = {} ca.ranks = {} end function kuafusys_bxtop(actor,cfg) deprivetitle(actor, "宝箱称号") confertitle(actor, "宝箱称号", 1) jhxbbgame.log(actor, getbaseinfo(actor,1),":宝箱称号") end function kuafusys_jdtop(actor,cfg) deprivetitle(actor, "据点称号") confertitle(actor, "据点称号", 1) jhxbbgame.log(actor, getbaseinfo(actor,1),":据点称号") end function kuafusys_end(actor,cfg) jhxbbgame.log(actor,"*kuafusys_end:"..1) kuafusys.changedMap(actor,"*kfend") end function kuafusys.kend(actor) kuafusys.clearbxeff(actor,boxeffid) jhxbbgame.take(actor,"传奇宝箱") --setattackmode(actor,-1,666) kuafusys.RetAttackMode(actor) local cc = {zy=0} kuafusys_ncmod(actor, cc) jhxbbgame.log(actor,"*kend:"..1) SetVarInt(actor, "U020", 0) jhxbbgame.kfcall(actor, "kuafusys_end", tbl2json({uid=getbaseinfo(actor, 2)}),true) end function kuafusys.InRange(ax,ay,x2,y2) local x = math.abs(ax-x2) local y = math.abs(ay-y2) local dis = x*x + ((y*y)*1.1) dis=dis^0.5 return dis <= 4.518 end function kuafusys.getjd(x,y) for key, value in pairs(zypos) do if kuafusys.InRange(x,y,value[1],value[2]) then return key end end return -1 end function kuafusys.jdjfAdd(ca,zy,x,y,v) local key = kuafusys.getjd(x,y) if key >= 1 then local cur = ca.zydata[zy].ptjf[key] +v ca.zydata[zy].ptjf[key] = cur ca.zydata[zy].jf = ca.zydata[zy].jf + v jhxbbgame.log("","jdjfAdd:",zy,x,y,v,cur) -- if cur >= 300 and ca.jdzt[key] == 0 then -- ca.jdzt[key] = zy -- kuafusys.pubmsg(ca,zyname[zy].."方阵营,成功拿下一个据点!") -- else local zdpos = zypos[key] for uid, actor in pairs(ca.zydata[zy].plays) do if isnotnull(actor) then local ax = getbaseinfo(actor, 4)-zdpos[1] local ay = getbaseinfo(actor, 5)-zdpos[2] if (math.abs(ax)<= 10) and (math.abs(ay)<= 10) then kuafusys.jdclick(actor, key) end end end --end return cur end return -1 end function kuafusys.jdclick(actor, id) local ca = kuafusys.curact if checkkuafuserver() and ca and ca.runing == 1 and ca.actname == "据点争夺" then local v1,v2 = ca.zydata[1].jf,ca.zydata[2].jf v1,v2 = math.floor(v1),math.floor(v2) if ca.jdzt[id] == 0 then kuafusys.primsg(actor, ca,"当前据点积分:"..zyname[1].."方="..v1..","..zyname[2].."方="..v2) else kuafusys.primsg(actor, ca,"当前据点已被"..zyname[ca.jdzt[id]].."占领!") end end end function kuafusys.die(actor,killer) local ca = kuafusys.curact if checkkuafuserver() then local isplay = isplayer(killer) local t2 = "你在" .. getbaseinfo(actor, 45) if isplay then t2=t2.. "被【" .. getbaseinfo(killer, 1) .. "】击杀" else t2=t2.. "被怪物【" .. getbaseinfo(killer, 1) .. "】击杀" end kuafusys.sendkfmail(actor,getbaseinfo(actor, 2),nil,"跨服死亡",t2) if kuafusys.diedrop and jhxbbgame.GetRate(10) then dieflag2 = os.time() dieflag = dieflag2 callscriptex(actor, "HumanDropUseItem", "-1","S0") dieflag = 0 jhxbbgame.log(actor, "*跨服死亡掉落::"..VarStr(actor,"S0")) if jhxbbgame.GetRate(1000) then dieflag = os.time() callscriptex(actor, "HumanDropUseItem", "-1","S0") dieflag = 0 jhxbbgame.log(actor, "*跨服死亡掉落2::"..VarStr(actor,"S0")) end end if ca and ca.runing and isplayer(actor) then jhxbbgame.log(actor, "*-----kuafusys.die "..ca.actname) if ca.actname == "夺宝战场" then kuafusys.changedMap(actor,"*die") elseif not isplayer(killer) then elseif ca.actname == "杀戮证道" then local spd = kuafusys.getdataEx(actor, ca.i) if spd.pd.join == 1 then spd.pd.jf = spd.pd.jf + 1 kuafusys.primsg(actor, ca,"积分+1,当前:"..spd.pd.jf) end spd = kuafusys.getdataEx(killer, ca.i) if spd.pd.join == 1 then spd.pd.jf = spd.pd.jf + 3 kuafusys.primsg(killer, ca,"积分+3,当前:"..spd.pd.jf) end elseif ca.actname == "据点争夺" then local spdk = kuafusys.getdataEx(killer, ca.i) local spd2 = kuafusys.getdataEx(actor, ca.i) if spdk == nil or spdk == nil then jhxbbgame.log(actor, "*据点争夺数据异常!",actor) elseif spdk.pd.zy ~= 0 and spd2.pd.zy ~= spdk.pd.zy then local x,y = getbaseinfo(actor,4),getbaseinfo(actor,5) local z = kuafusys.getjd(x,y) if z >= 0 then ca.zydata[z].jf = ca.zydata[z].jf +1 spdk.pd.jfkill = (spdk.pd.jfkill or 0) + 1 kuafusys.primsg(actor, ca,"当前积分:"..spdk.pd.jfkill..",本方总积分:"..ca.zydata[z].jf) end -- local v1 = kuafusys.jdjfAdd(ca,spdk.pd.zy,x,y,3) -- if v1 > 0 then -- kuafusys.jdclick(actor, spdk.pd.zy) -- end end end end end end function kuafusys.LockAttackMode(actor,m) jhxbbgame.log(actor, "*LockAttackMode",m) callscriptex(actor, "SetHumAttackMode",tostring(m), "3600") end function kuafusys.RetAttackMode(actor, chk) if not chk or (chk == getattackmode(actor)) then local old = VarInt(actor,"U024") jhxbbgame.log(actor, "*RetAttackMode",old) callscriptex(actor, "SetHumAttackMode",tostring(old), "0") changeattackmode(actor,old) end end function kuafusys.changedMap(actor,mapid) mapid = mapid or "" kuafusys.pking(actor) local ca = kuafusys.curact if checkkuafuserver() then if ((jfmaps[4][1] ~= mapid) and (jfmaps[4][2] ~= mapid)) and getcamp(actor)>0 then kuafusys_ncmod(actor, {zy=0}) kuafusys.RetAttackMode(actor,8) end if mapid ~= maps[2][1] then kuafusys.clearbxeff(actor) jhxbbgame.log(actor,"changedMap:"..mapid) if kuafusys.act2playupid == getbaseinfo(actor, 2) then kuafusys.changeitemplay(nil) end end end end function kuafusys.pickup(actor, item) if checkkuafuserver() then jhxbbgame.log(actor, "*kuafusys.pickup.= ") local itmname = getiteminfo(actor, item, 7) if itmname == "传奇宝箱" then kuafusys.changeitemplay(actor) end end end function kuafusys.clearbxeff(actor) jhxbbgame.showeff(actor, boxeffid, 1, 20,80) clearplayeffect(actor, boxeffid) end function kuafusys.changeitemplay(actor) local ca = kuafusys.curact if checkkuafuserver() and ca and ca.runing then jhxbbgame.log(actor or "nil", "*-----kuafusys.changeitemplay ",ca.actname,kuafusys.act2playupid) if ca.actname == "夺宝战场" then local old = nil if kuafusys.act2playupid ~= "" then old = getplayerbyid(kuafusys.act2playupid) if old then kuafusys.clearbxeff(old) jhxbbgame.take(old,"传奇宝箱") jhxbbgame.dbgout(actor, "换地图删除宝箱!") end end if actor and isplayer(actor) then kuafusys.act2playupid = getbaseinfo(actor, 2) kuafusys.pubmsg(ca, getbaseinfo(actor, 1).."获得了传奇宝箱!") jhxbbgame.showeff(actor, boxeffid, 999999, 20,80) jhxbbgame.take(actor,"传奇宝箱") jhxbbgame.ChatMsg(actor, "获得传奇宝箱!") SetVarInt(actor, "U020", 1) return elseif old then kuafusys.act2playupid = "" kuafusys.clearbxeff(old) SetVarInt(old, "U020", 0) jhxbbgame.ChatMsg(old, "失去传奇宝箱!") jhxbbgame.take(old,"传奇宝箱") end kuafusys.dropbx(kuafusys.bxx,kuafusys.bxy,1,18) end end --jhxbbgame.log(actor, "kuafusys.changeitemplay.= ",kuafusys.act2playupid,"new.",getbaseinfo(actor, 2)) end function kuafusys.dropbx(x,y,r,aa) if getmoncount("xdt293",-1,true)<1 then local oo = false jhxbbgame.MapPlayRun({maps[2][1]}, function(o) if getiteminfo(nil,o,7) == "传奇宝箱" then oo = true end end,8) jhxbbgame.dbgout(nil,"kuafusys.dropbx:",aa,oo) if not oo then clearitemmap(maps[2][1],0,0,999,"传奇宝箱") throwitem("0",maps[2][1],x,y,r,"传奇宝箱", 1,99999999,1,true,false,false,1,false) end end end function beforeroute(actor,dm,dx,dy) jhxbbgame.log(actor,"beforeroute",dm,dx,dy,type(dx),getbaseinfo(actor, 36)) local ret = true --kf3 630,274 -> kf0150 22,26 local ca = kuafusys.curact if checkkuafuserver() then if ca and ca.runing then if kuafusys.kaimentime > 0 and kuafusys.kaimen(actor) <=0 then kuafusys.pubmsg(ca,"比赛开始!!!") ret = false end if dm == "kf0150" and dx == 22 and dy == 26 then ret = castleguid == getbaseinfo(actor, 36) end end end return ret end function kuafusys.kaimen(actor) local a = kuafusys.kaimentime - os.time() if a > 0 then --jhxbbgame.sendmsg(actor, a.."秒后活动开始.") return a elseif kuafusys.kaimentime ~= 0 then kuafusys.kaimentime = 0 clearkfgate() return 0 end return a end function bfdropbodyitem(actor,a) jhxbbgame.log(actor,"bfdropbodyitem.",tbl2json(a)) if a and a.i then takew(actor,a.i,1,"跨服掉落") end end function kuafusys.drop(actor, dropItem,itemName,m) if itemName == "传奇宝箱" and kuafusys.act2playupid == getbaseinfo(actor, 2) then jhxbbgame.log(actor, "*kuafusys.drop1.= ",itemName,m) kuafusys.changeitemplay(nil) end if (checkkuafuserver() and m == 1) then if (checkitemstate(dropItem,1) or checkitemstate(dropItem,5)) then jhxbbgame.log(actor, "*kuafusys.drop1.禁止= ",itemName,m) return false end if dieflag == dieflag2 then jhxbbgame.bfcall(actor,"bfdropbodyitem",{i=itemName}) end end end function kuafusys.killmon(actor, mon,monName) if checkkuafu(actor) and checkkuafuserver() then jhxbbgame.log(actor,"*kfkillmon",monName) local ca = kuafusys.curact if ca and ca.runing then if ca.actname == "夺宝战场" then if "宝藏巨蟹" == monName then--一大陆-骷髅洞 kuafusys.act2monkillplayid = getbaseinfo(actor, 2) end end end end end function kuafusys.RecRank(actor, ca) local ret = -1 if ca.actname == "群骑竞赛" then local mapid = getbaseinfo(actor, 3) --jhxbbgame.log(actor, "*RecRank,mapid",mapid,tbl2json(ca)) if mapid == maps[1][1] and ca and ca.runing == 1 then local x = getbaseinfo(actor, 4) local y = getbaseinfo(actor, 5) local absx = math.abs(x - 128) local absy = math.abs(y - 213) if (absx <= 10) and (absy <= 10) then local info = { getbaseinfo(actor, 2), getbaseinfo(actor, 1) } local spd = kuafusys.getdataEx(actor, ca.i) if spd.pd.join ~= 1 then jhxbbgame.sendmsg(actor, "未参加活动!"..tostring(spd.pd)) return ret end for key, value in pairs(ca.ranks) do if info[1] == value[1] then jhxbbgame.sendmsg(actor, "您已经获得了第["..key.."]名!") jhxbbgame.sendmsg(actor, "您已经获得了第["..key.."]名!") jhxbbgame.sendmsg(actor, "您已经获得了第["..key.."]名!") kuafusys.gohome(actor) return key end end local i = #ca.ranks + 1 ret = i ca.ranks[i] = info jhxbbgame.log(actor, "*跑酷名次" .. i) if i <= 3 then kuafusys.pubmsg(ca,"恭喜["..info[2].."]获得第"..i.."名。稍后获得丰厚奖励!!!") jhxbbgame.sendmsg(actor, "您已经获得了第["..i.."]名!") jhxbbgame.sendmsg(actor, "您已经获得了第["..i.."]名!") jhxbbgame.sendmsg(actor, "您已经获得了第["..i.."]名!") end else jhxbbgame.sendmsg(actor, "距离终点太远了!") end else jhxbbgame.sendmsg(actor, "活动结束!") end end return ret end local cd = os.time() function kuafusys._run(actor) local mapid = getbaseinfo(actor, 3) local ca = kuafusys.curact if mapid == maps[1][1] and ca and ca.runing == 1 then --128 213 --jhxbbgame.log(actor,"*跑酷1111名次"..mapid) local x = getbaseinfo(actor, 4) local y = getbaseinfo(actor, 5) if jhxbbgame.GetRate(5000) then local curtime = os.time() if curtime > cd then cd = curtime + 3 --local eff = {{1,470},{7,527,5000},{10,511},{5,458}} local eff = { { 12, 470 }, { 13, 527 } } local e = eff[math.random(#eff)] local plays = {actor}--getobjectinmap(mapid, x, y, 8, 1) for key, value in pairs(plays) do --if jhxbbgame.GetRate(6500) then --jhxbbgame.mapSelfeff(value, e[2]) makeposion(value, e[1], 3) --end end end end end end local optmode = -1 function kuafusys_opact(actor,op) local ca = kuafusys.curact local cab = kuafusys.actstate[op[1]] local opmode = op[2] jhxbbgame.log(actor, "kuafusys_opact:", op[1],op[2]) if ca and opmode < 10 then if ca.runing == 1 and ca.i ~= 0 then jhxbbgame.log(actor, "-------kuafusys_opact:Close.", ca.actname) ca.edtime = jhxbbgame.nowsec()-1 kuafusys.doClose(actor,ca) end end optmode = op[1] if cab and opmode < 10 then if cab.runing == 1 and cab.i ~= 0 and ca ~= cab then cab.edtime = jhxbbgame.nowsec()-1 kuafusys.doClose(actor,cab) end if opmode >= 1 then cab.bgtime = jhxbbgame.nowsec()-1 if opmode == 1 then cab.edtime = cab.bgtime + 50 * 60 else cab.edtime = cab.bgtime + 3 * 60 end kuafusys.doOpen(actor,cab) kuafusys.pubmsg(cab,"已经开始!") end return end if opmode == 11 then optmode = -1 elseif opmode == 12 then kuafusys.diedrop =false elseif opmode == 13 then kuafusys.diedrop =true elseif opmode == 15 then kuafusys.sun = false elseif opmode == 16 then kuafusys.sun = true elseif opmode == 20 then kuafusys.roomopen = 0 elseif opmode == 21 then kuafusys.roomopen = 1 elseif opmode == 17 then savekfdata("{}") readkfdata() end jhxbbgame.log(actor, "kuafusys.opact:17 ", opmode,kuafusys.roomopen,kuafusys.sun,kuafusys.diedrop) jhxbbgame.sendmsg(actor, "跨服开关: "..opmode.." ok "..kuafusys.roomopen) end function kuafusys.opact(actor,id, p2) jhxbbgame.log(actor, "kuafusys.opact:", id,p2) jhxbbgame.kfcall(actor, "kuafusys_opact", tbl2json({id, p2})) end function kuafusys.doOpen(sysact,ca) ca.runing = 1 ca.ranks={} jhxbbgame.log(sysact, ca.actname, ".开始") kuafusys.pubmsg(ca,"已经开启请去跨服参加活动!") if kuafusys.curact then end kuafusys.curact = ca kuafusys.begact(sysact,ca) end function kuafusys.doClose(sysact,ca) ca.runing = 0 jhxbbgame.log(sysact, ca.actname, ".结束") kuafusys.pubmsg(ca,"已经结束!") kuafusys.endact(sysact,ca) if kuafusys.curact and kuafusys.curact.actname == ca.actname then kuafusys.curact = nil end end local sed = "" local runtime = 5*1000 local runtimey = 0 local runed = false local readday = 0 local tt = 0 function jhxbbgame_kfact(sysact) local curtime = jhxbbgame.nowsec() or 0 --delmapgate("G1","xdt306") grobaldelaygoto(runtime, "jhxbbgame_kfact") if checkkuafuserver() then local d = math.floor(os.time()/86400) if readday ~= d then readday = d jhxbbgame.log("跨服活动---跨天初始化!!!!!11!!!!!!!!!") savekfdata("{}") readkfdata() end if not runed then readkfdata() jhxbbgame.log("跨服活动定时器开启!!!!!11!!!!!!!!!") end runed = true if curtime > runtimey then jhxbbgame.MapPlayRun(nil, function (actor, m) if jhxbbgame.CInt(actor,"<$PKPOINT>") >= 300 then mapmove(actor, "0", "131", "137", 3) kuafusys.primsg(actor,kuafusys.actstate[0], "红名禁止进入!") return end if kuafusys.actstate[0] and (kuafusys.actstate[0].runing ~= 1) and (getgmlevel(actor)<=0) then kuafusys.primsg(actor,kuafusys.actstate[0],"活动结束安全回城!") mapmove(actor, "0", "131", "137", 3) end end) runtimey = runtimey + 60 end else tims = { [0] = tims[0]} runtime = 10*1000 if checkkuafuconnect() then if not runed then jhxbbgame.log("跨服活动定时器=>本服开启!!!!!!!!!!!!!!") end runed = true runtime = 5*1000 elseif runed then jhxbbgame.log("跨服断开!!!!!!!!!!!!!!") if kuafusys.curact and kuafusys.curact.runing == 1 then kuafusys.endact(sysact, kuafusys.curact) kuafusys.curact = nil end runed = false end end --jhxbbgame.log("跨服活动定时器+++++++++++++++++",kuafusys.cont) --release_print("jhxbbgame_kfact..",curtime) kuafusys.cont = kuafusys.connected() runtime = 0 if kuafusys.cont then for key, value in pairs(tims) do key = tonumber(key) local ca = kuafusys.actstate[key] or kuafusys.init(key) if ca then local timein = (curtime > ca.bgtime) and (curtime < ca.edtime) ca.i = key if ca.i == 11111 then release_print("jhxbbgame_kfact..",curtime,timein,ca.runing,tbl2json(ca)) end if optmode < 0 or optmode == key then if timein and ca.runing ~= 1 then local sun = jhxbbgame.daysun() while true do if kuafusys.sun then if ca.actname == "据点争夺" then if ((sun ==1) or (sun ==3) or (sun ==5)) then else break end elseif ca.actname == "跨服沙巴克" then if ((sun ==2) or (sun ==4) or (sun ==6)) then else break end elseif ca.actname == "泽坤的恩赐" then if ((sun ==7)) then else break end end end kuafusys.doOpen(sysact,ca) break end end if not timein and ca.runing == 1 then kuafusys.doClose(sysact,ca) end end if ca.runing == 1 then local actmap = jfmaps[ca.i] --release_print(ca.i.."jhxbbgame_kfact..",tbl2json(mm or {})) local zyaddok = {{0,0,0,0,0},{0,0,0,0,0}} if (kuafusys.kaimentime > 0) and ca.actname == "据点争夺" then runtime = 1*1000 if kuafusys.kaimen(nil) <= 0 then kuafusys.pubmsg(ca,"比赛开始!!!") jhxbbgame.MapPlayRun({"jddd"}, function (actor, m) local spd = kuafusys.getdataEx(actor, ca.i) if spd.pd.zy > 0 then kuafusys.primsg(actor, ca,"活动已经开始!") kuafusys.JoinMap(actor,maps[ca.i],spd,spd.pd.zy) else jhxbbgame.log(actor,"据点争夺=>异常!!!!!!!!!!!!!!",spd.pd.zy,spd.pd.name,spd.pd.join, spd.pd.mapjoin) kuafusys.primsg(actor, ca,"您已经安回城!") kuafusys.gohome(actor) end end) end else runtime = 5*1000 end if true then local guilds={} local guildnoe = "" jhxbbgame.MapPlayRun(actmap, function (actor, m) local spd = kuafusys.getdataEx(actor, ca.i) --callscriptex(actor, "CHANGEPKPOINT", "=", "0") if ca.actname == "据点争夺" then runtime = 5*1000 if spd.pd.zy > 0 then local x,y=getbaseinfo(actor,4),getbaseinfo(actor,5) local id = kuafusys.getjd(x,y) if id >= 0 then spd.pd.jfkill = (spd.pd.jfkill or 0)+1 ca.zydata[spd.pd.zy].jf = ca.zydata[spd.pd.zy].jf + 1 kuafusys.primsg(actor, ca,"当前积分:"..spd.pd.jfkill..",本方总积分:"..ca.zydata[spd.pd.zy].jf) end -- if id > 0 and zyaddok[spd.pd.zy][id] == 0 then -- zyaddok[spd.pd.zy][id] = 1 -- kuafusys.jdjfAdd(ca,spd.pd.zy,x,y,0.416) -- end end elseif ca.actname == "跨服沙巴克" then if not getbaseinfo(actor, 0) and (m == "kf0150") then guildnoe = getbaseinfo(actor, 36) guilds[guildnoe] = 1 end runtime = 1*1000 elseif ca.i == 6 then runtime = 1*1000 elseif ca.i == 7 then runtime = 1*1000 end if (spd.pd.join == 1) then if (ca.i ~= 3) and kuafusys.kaimentime <= 0 then spd.pd.jf = spd.pd.jf + math.floor(runtime/1000) if (avtime[ca.i] > 0) and (spd.pd.mapjoin == 0) and (ca.i ~= 3) then if spd.pd.jf >= avtime[ca.i] then kuafusys.dcjoin(actor,ca,spd,"达成活跃!") end end end else kuafusys.primsg(actor, ca,"未报名本次活动,已经安回城!") kuafusys.gohome(actor) end end) --地图上个玩家处理结束 if ca.actname == "跨服沙巴克" then if jhxbbgame.len(guilds) == 1 and guildnoe ~= "" and guildnoe ~= castleguid then castleguid = guildnoe kuafusys.pubmsg(ca,castleguid.."成功占领了皇宫!") end elseif ca.actname == "夺宝战场" then local actor = getplayerbyid(kuafusys.act2playupid) if kuafusys.act2playupid ~="" and actor and getbaseinfo(actor,3) == maps[2][1] then jhxbbgame.showeff(actor, boxeffid , 999999, 20,80) kuafusys.bxx,kuafusys.bxy=getbaseinfo(actor, 4),getbaseinfo(actor, 5) else kuafusys.dropbx(17,56,3,111) end end end end end kuafusys.actstate[key] = ca end end if runtime < 1000 then if (kuafusys.curact == nil) or (kuafusys.curact.runing ~= 1) then runtime = 1*1000 else runtime = 5*1000 end end local vv = tbl2json(kuafusys.actstate) if checkkuafuserver() and sed ~= vv then sed = vv savekfdata(vv) end end function savekfdata(d) local jo = {acts=json2tbl(d)} local w = io.open("/wlua/kfdata25.txt", "w+") if w then local tx = "" pcall(function (...) jo.readday = readday jo.oneguild = oneguild jo.AllGuilds = AllGuilds jo.castleguid = castleguid jo.castleoldguid = castleoldguid jo.act2playupid = kuafusys.act2playupid jo.act2monkillplayid = kuafusys.act2monkillplayid jo.bxx = kuafusys.bxx jo.bxy = kuafusys.bxy tx = tbl2json(jo) end) --release_print("/wlua/kfdata.txt write -----------",tx) w:write(tx) w:close() end end function readkfdata() local r = io.open("/wlua/kfdata25.txt", "r") kuafusys.actstate = {} if not r then release_print("/wlua/kfdata.txt read fail-----------") savekfdata("{}") else local ret = r:read("*all") r:close() release_print("/wlua/kfdata.txt read -----------",md5str(ret),ret) if (ret) and (ret ~= "") then jhxbbgame.s2f("/wlua/kfdatar.txt", ret) local read = json2tbl(ret) or {} for key, value in pairs(read.acts or {}) do kuafusys.actstate[tonumber(key)] = value value.runing = 0 end readday = read.readday oneguild = read.oneguild AllGuilds = read.AllGuilds castleguid = read.castleguid castleoldguid = read.castleoldguid kuafusys.act2playupid = read.act2playupid kuafusys.act2monkillplayid = read.act2monkillplayid kuafusys.act2playupidold = read.act2playupidold kuafusys.act2monkillplayidold = read.act2monkillplayidold kuafusys.bxx = read.bxx kuafusys.bxy = read.bxy end end end local dd = "" function kuafusys_login(actor, cfg) if cfg.i == 0 then dd = "" elseif cfg.i == 1 then dd = dd .. cfg.d elseif cfg.i == 2 then dd = dd .. cfg.d local lcfg = json2tbl(dd) jhxbbgame.log(actor, "-----222-kuafusys_login====>", #dd) setvarval(actor, lcfg) --confertitle(actor, jhxbbgame.titleName.kbzl,1) login(actor) end end function kflogined(actor) local cfg = getvarval(actor) local scfg = tbl2json(cfg) jhxbbgame.log(actor, "-----222-sent.kflogined",#scfg) local a = #scfg jhxbbgame.kfcall(actor, "kuafusys_login",tbl2json({i=0})) local ii = 1 for i = 1, math.floor(a/118), 1 do local cc = scfg:sub(ii,ii+118-1) ii = ii+118 jhxbbgame.kfcall(actor, "kuafusys_login",tbl2json({i=1,d=cc})) end local cc = scfg:sub(ii,math.min(ii+118,a)) jhxbbgame.kfcall(actor, "kuafusys_login",tbl2json({i=2,d=cc})) zbcfg.reload(actor,0xff,-1) end function kuafusys.click(actor, ui, btn,bt2) jhxbbgame.log(actor, "kuafusys.click()"..kuafusys.roomopen, ui, btn, bt2) local spd = kuafusys.getdataEx(actor, ui) local curtime = jhxbbgame.nowsec() if ui == 0 then if not checkkuafuconnect() then jhxbbgame.sendmsg(actor, "跨服未开启!") return end if jhxbbgame.CInt(actor,"<$PKPOINT>") >= 300 then jhxbbgame.sendmsg(actor, "红名禁止进入!") return end if kuafusys.roomopen ~= 1 then if ((not checktitle(actor, jhxbbgame.titleName.kbzl)) or (getbaseinfo(actor, 39) < 5)) and (not jhxbbgame.IsWQ(actor)) then jhxbbgame.sendmsg(actor, "条件不足,无法进入跨服!") return end local c1,c2,c3 = (curtime >= spd.s.edtime) , (curtime <= spd.s.bgtime), (spd.s.runing ~= 1) if c1 or c2 or c3 then jhxbbgame.sendmsg(actor, "活动还未开始!") jhxbbgame.log(actor, "*活动还未开始!",c1,c2,c3) return end end SetVarInt(actor,"U024",getattackmode(actor)) kuafusys.gohome(actor) --jhxbbgame.topui.hide(actor) --mapmove(actor, "xdt246", 192,179,3) elseif ui >= 1 and ui <= 8 then if getgmlevel(actor)> 5 then -- kuafusys.endguildWar(actor) -- setcamp(actor, 1) --kuafusys.endguildWar(actor) --kuafusys.NColor(actor, 47) aaa = aaa or 12366666 aaa = aaa + 1 --setcamp(actor, aaa) jhxbbgame.log(actor, "*狂暴:",checktitle(actor, jhxbbgame.titleName.kbzl) ) end --报名 if (btn == 1) then if (spd.pd.join == 1) then jhxbbgame.sendmsg(actor, "已经报名!"..tostring(spd.pd)) return end if ((tonumber(getconst(actor, "<$HOUR>")) >= kuafusys.bmHour)) then jhxbbgame.sendmsg(actor, "已过报名截止时间!") return end if not takes(actor, "金币#1000000",0) then jhxbbgame.sendmsg(actor, "没有足够的金币!") return end if (curtime >= spd.s.edtime) then jhxbbgame.sendmsg(actor, "活动已经结束!") return end spd.pd.join = 1 local lcfg = kuafusys.getdata(actor, ui) jhxbbgame.hfsv.Incjd(actor, 6, 1) kuafusys.primsg(actor,spd.s,"报名成功!") jhxbbgame.refUI(actor, namesact[ui], lcfg) kuafusys.write(actor,ui,1) elseif (btn == 2) then --入场 if (spd.pd.join ~= 1) then jhxbbgame.sendmsg(actor, "失败!未报名无法参加!!") return end if (curtime <= spd.s.bgtime) or spd.s.runing ~= 1 then jhxbbgame.sendmsg(actor, "活动还未开始!") return end if (curtime >= spd.s.edtime) then jhxbbgame.sendmsg(actor, "活动已经结束!") return end -- if jhxbbgame.CInt(actor, "<$HUMAN(坐骑穿戴)>") <= 0 then -- jhxbbgame.sendmsg(actor, "你没有坐骑!") -- return -- end local m = maps[ui] --jhxbbgame.log(actor,"*mapmove",tbl2json(m)) if getconst(actor, "<$MAP>") == m[1] then return end IncVar(actor, "u32", 1 * (2 ^ ui)) kuafusys.JoinMap(actor, m, spd,bt2) end end end function kuafusys.nextcen(actor, c,pass) local ca = kuafusys.curact if checkkuafuserver() then if ca and ca.runing and ca.actname == "辉煌的凤栖寺院" then local mc = getmoncount("xdt"..(296+ca.mon),-1,true) jhxbbgame.log(actor, "*"..(296+ca.mon)..".info!"..mc) if (not pass) and c >= ca.mon and mc > 0 then jhxbbgame.sendmsg(actor, "怪物击杀后才可以进入下层!") return end if ca.mon <= c and mc == 0 then jhxbbgame.log(actor,ca.mon..".辉煌的凤栖寺院.地图无怪未触发!") ca.mon= ca.mon + 1 end if 296+ca.mon == 304 then local spd = kuafusys.getdataEx(actor, ca.i) if spd.pd.mapjoin == 0 then jhxbbgame.sendmsg(actor, "您的还未达成活跃,回城后无法再进入活动地图!") else kuafusys.gohome(actor) end else map(actor, "xdt"..(296+ca.mon)) end end end end function kuafusys.NColor(actor, acl) --jhxbbgame.bfcall(actor,"kuafusys_ncmod",{cl=acl}) kuafusys_ncmod(actor, {cl=acl}) end function kuafusys_ncmod(actor, pd) jhxbbgame.log(actor, "ncmod:",pd.cl) if pd.cl then callscriptex(actor, "changenamecolor", tostring(pd.cl)) elseif (pd.zy == 0) then jhxbbgame.SetDefColor(actor) elseif (pd.zy == 1) then callscriptex(actor, "changenamecolor", tostring(249)) else callscriptex(actor, "changenamecolor", tostring(252)) end end function kuafusys.JoinMap(actor, m, spd,bt2) local ca = spd.s local name = getbaseinfo(actor, 1) --jhxbbgame.log(actor, "JoinMap:",ca.actname) local mid,x,y = m[1], m[2], m[3] if ca.actname == "据点争夺" then local pwall = ca.zydata[1].pw+ca.zydata[2].pw+1 local apw = getbaseinfo(actor, 20) if spd.pd.zy == 0 then if ca.zydata[1].pw/pwall > 0.5 then spd.pd.zy = 2 else spd.pd.zy = 1 end ca.zydata[spd.pd.zy].pw = ca.zydata[spd.pd.zy].pw + apw end ca.zydata[spd.pd.zy].plays[getbaseinfo(actor, 2)] = actor mid = jfmaps[4][1] if kuafusys.kaimentime > 0 then mid = jfmaps[4][2] end x,y = stpos[spd.pd.zy][1], stpos[spd.pd.zy][2] kuafusys.setzy(actor, spd.pd.zy) jhxbbgame.bfcall(actor,"kuafusys_ncmod",{zy=spd.pd.zy}) kuafusys_ncmod(actor, {zy=spd.pd.zy}) kuafusys.LockAttackMode(actor,8) if tonumber(bt2) ~= 1 then --kuafusys.primsg(actor,ca,name.."进入活动地图,当前阵营"..zyname[spd.pd.zy]) jhxbbgame.log(actor, "*JoinMap:",spd.pd.zy, apw,pwall,getcamp(actor)) end kuafusys.primsg(actor,ca,name.."进入活动地图,当前阵营"..zyname[spd.pd.zy]) local a = kuafusys.kaimentime - os.time() if a > 0 then jhxbbgame.TimeMsg(actor,"还剩余%d后活动开始.",a) end elseif ca.actname == "跨服沙巴克" then if bt2 == "沙仓库" then x,y = 641, 247 elseif bt2 == "衣服店" then x,y = 671, 281 elseif bt2 == "沙大门" then x,y = 678, 336 elseif bt2 == "首饰店" then x,y = 684, 292 elseif bt2 == "武器店" then x,y = 632, 320 end if not kuafusys.addg(actor) then jhxbbgame.sendmsg(actor, "无行会!") return end kuafusys.LockAttackMode(actor,5) kuafusys.guildWar(actor,1) elseif ca.actname == "辉煌的凤栖寺院" then kuafusys.nextcen(actor, 0, true) return elseif ca.actname == "杀戮证道" then kuafusys.LockAttackMode(actor,0) elseif ca.actname == "夺宝战场" then kuafusys.LockAttackMode(actor,5) elseif ca.actname == "泽坤的恩赐" then local a = ca.edtime - jhxbbgame.nowsec() if a < 60*5 then jhxbbgame.sendmsg(actor, "活动最后5分钟无法再进入!") return end elseif ca.actname == "群骑竞赛" then local a = kuafusys.kaimentime - os.time() if a > 0 then jhxbbgame.TimeMsg(actor,"还剩余%d后活动开始.",a) end jhxbbgame.bfcall(actor,"___shangmaauto",{u=1,i=1,t=1}) --delskill(actor, 27) end if m[2] then mapmove(actor, mid, x,y, 3) else map(actor, mid) end if ca.actname == "杀戮证道" then kuafusys.NColor(actor, 251) end -- local endt = ca.edtime-jhxbbgame.nowsec() -- if ca.i == 1 and VarInt(actor,"J10"..ca.i) == 0 then -- sendcentermsg(actor,180,251,"等待%d秒后活动开始.",0,endt) -- SetVarInt(actor,"J10"..ca.i,1) -- end --sendcentermsg(actor,180,251,ca.actname.."还剩余%d秒后活动结束.",0,endt) end function kuafusys.addg(actor) local g = getbaseinfo(actor, 36) if (not g) or (g == "") then return false end if oneguild == "" then oneguild = g end AllGuilds[g] = 1 return true end function kuafusys.endguildWar(actor) AllGuilds = {} kuafusys.guildWar(actor,0) end function kuafusys.guildWar(actor,t) if AllGuilds == nil or #AllGuilds == 0 then AllGuilds = {} oneguild = "" jhxbbgame.MapPlayRun(nil, function (a) kuafusys.addg(a) end) end end function kuafusys.getdata(actor, ui) ui = ui or 0 if ui < 0 then local lcfg = {} if ui == -1 then lcfg.cnts = {VarInt(actor,"U021")} for i = 2, 8, 1 do lcfg.cnts[i] = VarInt(actor,"J0"..(20+i)) end elseif ui == -2 then lcfg.lv = VarInt(actor,"U022") end return lcfg end local cur = jhxbbgame.nowsec() local spd = kuafusys.getdataEx(actor, ui) local lcfg = {jf=0} if spd then if cur >= spd.s.edtime then lcfg.bgtime = (86400 - cur) + spd.s.bgtime else if cur >= spd.s.bgtime then lcfg.bgtime = 0 else lcfg.bgtime = spd.s.bgtime-cur end end lcfg.join = spd.pd.join lcfg.jf = spd.pd.jf lcfg.zy = spd.pd.zy lcfg.mon = spd.s.mon lcfg.tx = txcl[spd.s.i] if ui == 0 then lcfg.cont = kuafusys.cont end if spd.pd.zy > 0 and spd.s.zydata then lcfg.jf = math.floor(spd.s.zydata[spd.pd.zy].jf) end end --jhxbbgame.log(actor, ui .. ".kuafusys.getdata::", tbl2json(lcfg)) return lcfg end function kuafusys.getdataEx(actor, ui) local ret = kuafusys.getUiddataEx(getbaseinfo(actor, 2), ui) if ret then ret.pd.name = getbaseinfo(actor, 1) return ret end end function kuafusys.getUiddataEx(uid, ui) ui = ui or 0 local ls = kuafusys.actstate[ui] if ls then local lpd = ls.playdatas[uid] if lpd == nil then local aname= "" local actor = getplayerbyid(uid) if actor then aname=getbaseinfo(actor, 1) end lpd = {name = aname,join = kuafusys.read(actor,ui), jf = 0,mapjoin=0,zy=0 } ls.playdatas[uid] = lpd end kuafusys.actstate[ui] = ls return { s = ls, pd = lpd } end end function kuafusys_openui(actor, ui) local cj = ui[2] or 0 ui = ui[1] release_print("-----kuafusys_openui=>",ui) if cj == 1 then kuafusys.clickcaiji(actor, ui) return end if ui >100000 then kuafusys.jdclick(actor, ui - 100000) return end local npcid = 691+ui --706-712 local snpcid = tonumber(npcid) if ui >= 15 then ui = ui -14 kuafusys.nextcen(actor, ui) else sendluamsg(actor, 31118, npcid, 0, 0, tbl2json({ fn = namesact[ui], cfg = kuafusys.getdata(actor,ui), code = jhxbbgame.ui[namesact[ui]], npcid = npcid })) end end function kuafusys.openui(actor, ui,cj) cj = cj or 0 jhxbbgame.kfcall(actor, "kuafusys_openui", tbl2json({ui,cj})) end function kuafusys_click(actor,a) kuafusys.click(actor, a[1], a[2], a[3]) end kuafusys.msgproc[1381] = function(actor, msgid, n1, n2, n3, sMsg) if n1 == 0 then kuafusys.click(actor, n1, n2) elseif n1 == 1118 then if n2 >= 1 and n2 <= 8 then local cntsmax ={1,1,5,10,10,10,10,10} local cfg = kuafusys.getdata(actor, -1) if cfg.cnts[n2] >= cntsmax[n2] then jhxbbgame.sendmsg(actor, "限购次数用尽!") return end local need= { "龙玉勋章#20", "龙玉勋章#5", "龙玉勋章#2", "龙玉勋章#1", "龙玉勋章#1", "龙玉勋章#1", "龙玉勋章#1", "龙玉勋章#1", } local giv={ "封印符咒#1#339", "滚烫的龙族心脏#1#339", "起源之火#1#339", "寒冰精魄#1#339", "沉默本源#1#339", "远古记忆#1#339", "上古遗石#1#339", "太古神石#1#339", } if not takes(actor,need[n2],"军需兑换") then jhxbbgame.sendmsg(actor, "材料不够!") else gives(actor,giv[n2],"军需兑换") if n2 == 1 then IncVar(actor,"U021") else IncVar(actor,"J0"..(20+n2)) end cfg = kuafusys.getdata(actor, -1) jhxbbgame.refUI(actor, "npc704", cfg) end elseif n2 == 1118 then local curlv = VarInt(actor,"U022") if curlv >= 10 then jhxbbgame.sendmsg(actor, "已经满级!") --SetVarInt(actor,"U022",0) return end local need= { 10, 1000, 1000, 30 ,2000,2000, 60 ,3000,3000, 100 ,4000,4000, 200 ,5000,5000, 300 ,6000,6000, 350 ,7000,7000, 400 ,8000,8000, 450 ,9000,9000, 500 ,10000,10000, } local sneed = "龙玉勋章#"..need[curlv*3+1] sneed = sneed.."&万物之灵#"..need[curlv*3+2] sneed = sneed.."&金刚石#"..need[curlv*3+3] if not takes(actor,sneed,"游林升级") then jhxbbgame.sendmsg(actor, "材料不够!") else IncVar(actor,"U022") local til = { "战争荣耀LV.1", "战争荣耀LV.2", "战争荣耀LV.3", "战争荣耀LV.4", "战争荣耀LV.5", "战争荣耀LV.6", "战争荣耀LV.7", "战争荣耀LV.8", "战争荣耀LV.9", "战争荣耀LV.MAX", } curlv= curlv+1 --低级 for k,v in pairs(til) do deprivetitle(actor, v) end confertitle(actor, til[curlv]) jhxbbgame.refUI(actor, "npc705", kuafusys.getdata(actor, -2)) end end else jhxbbgame.kfcall(actor, "kuafusys_click", tbl2json({n1, n2, sMsg})) end --jhxbbgame.openUI(actor, "进入跨服", lcfg,"kf00") end --genmon("kf3", 672, 278, "MainDoor",0,1,255) for key, value in pairs(zypos) do delmapeffect(1118+key) mapeffect(1118+key, "xdt294", value[1], value[2], 70250, -1, 0) end -- killmapmon("xdt293",0,0,99999,"*",0,1) -- killmapmon("xdt246",0,0,99999,"*",0,1) -- genmon("xdt293", 26, 52, "一大陆-骷髅洞",5,1,255) -- genmon("xdt246", 185, 169, "一大陆-骷髅洞",5,1,255) -- --genmon("xdt246", 185, 169, "石墓猪王6",1,1,255) -- throwitem("0",maps[2][1],26, 52,2,"传奇宝箱",1,0,1,true,false,false,1,false) clearkfgate() grobalcleardelaygoto("jhxbbgame_kfact") grobaldelaygoto(100, "jhxbbgame_kfact") return kuafusys