1024 lines
26 KiB
Lua
1024 lines
26 KiB
Lua
require("Envir/wlua/verfx/lib996.lua")
|
||
|
||
function jhxbbgame.s2f(f,s,m)
|
||
local wsz = -1
|
||
m = m or "w+"
|
||
local w, e = io.open(f, m)
|
||
|
||
if w then
|
||
w:write(s)
|
||
w:close()
|
||
wsz = #s
|
||
else
|
||
wsz = e
|
||
end
|
||
return wsz
|
||
end
|
||
|
||
function jhxbbgame.f2s(f,def,m)
|
||
m = m or "r"
|
||
local ret = def
|
||
local r = io.open(f, m)
|
||
if r then
|
||
ret = r:read("*all")
|
||
r:close()
|
||
end
|
||
return ret
|
||
end
|
||
|
||
jhxbbgame.dbgout = jhxbbgame.log
|
||
|
||
local function aab()
|
||
|
||
zbcfg._CD=json2tbl(
|
||
[[{
|
||
"兽族嘶吼":30,
|
||
"末路黄泉":180,
|
||
"潜龙王御敌指环":180,
|
||
"天堂有路":1,
|
||
"奴隶之戒":0,
|
||
"疾风之戒":60,
|
||
"横行霸道":300,
|
||
"暗龙之戒":180,
|
||
"鸣龙王御敌指环":3600,
|
||
"听天由命":180,
|
||
"龙神之战斗锤":300,
|
||
|
||
|
||
"恶魔爪牙":0,
|
||
"教皇之争":0,
|
||
"杀戮之甲":0,
|
||
"暗龙王御敌指环":0,
|
||
"镇魂链甲":0,
|
||
"地狱无门":360,
|
||
"怒火中烧":0,
|
||
"滴水穿石":0,
|
||
"天龙王御敌指环":0,
|
||
"刹那之间":0,
|
||
"寒冰之契":0,
|
||
"猝亡之戒":0,
|
||
|
||
"目空一切":0,
|
||
"刹那之失":10,
|
||
"玲珑八面":0,
|
||
"极度深寒":15,
|
||
"死神之拒":10,
|
||
"来世再做我的英雄":0,
|
||
"目空一切[史诗]":0,
|
||
"刹那之失[史诗]":10,
|
||
"玲珑八面[史诗]":0,
|
||
"极度深寒[史诗]":15,
|
||
"死神之拒[史诗]":10,
|
||
"来世再做我的英雄[史诗]":0,
|
||
|
||
"抵抗的决心":180,
|
||
"暗龙王的毒液":180,
|
||
"千里暮云带":10,
|
||
"龙骨吞噬者":20,
|
||
"烈焰之石":30,
|
||
"雷霆之石":15,
|
||
"暗黑魔之趾":60,
|
||
"九天繁星衣":120,
|
||
"凛冬铁壁带":60,
|
||
"寂雪之冠":30,
|
||
"寂静星魔铠":60,
|
||
"千年冰甲":60,
|
||
"末日灵魂披风":120,
|
||
"黑暗君王袍":60,
|
||
"幽冥魔护带":60,
|
||
"叹息之咒怨":120,
|
||
"天启守护者之链":60,
|
||
"霜魔低语":60,
|
||
"荒漠统领之链":30,
|
||
"雪夜狼踪履":30,
|
||
"霜蹄驭者扣":120,
|
||
"九尾千金裘":60,
|
||
"焰足蜥行履":60,
|
||
"凛冬之寒":30,
|
||
"魔音使者之杖":300,
|
||
"俩生纷争之杖":300,
|
||
"蛰伏之影":60,
|
||
"腐化晶核":60,
|
||
"幽暗骨守之衣":50,
|
||
"炎蜥噬雷刃":60,
|
||
"骨龙之心":300,
|
||
"赤焰蛛带":60,
|
||
"炎狱魔猪之皮":60,
|
||
"夜幕霸主之铠":60,
|
||
"冰龙神卫之冠":60,
|
||
"冰霜王者靴":60,
|
||
"邪法低语带":60,
|
||
"霜寒龙吟刀":60,
|
||
"狂暴龙炎之心":300,
|
||
"火焰领主之冠":300,
|
||
"天狐掩月盔":60,
|
||
"天启之姿":60,
|
||
"荒野奔腾之斧":60,
|
||
"天启皇者带":60,
|
||
"血肉震荡者":120,
|
||
"邪恶星界衣":60,
|
||
"暗影孤鸿长剑":120,
|
||
"炼狱炎蝠之袍":60,
|
||
"寒霜之吻":60,
|
||
"魔影祭祀之靴":60,
|
||
"暗幕破晓者":60,
|
||
"虹魔之拥":30,
|
||
"冰魄战甲":60,
|
||
"蛮蹄护心铠":60,
|
||
"沉默暗影裘":60,
|
||
"狂暴雷霆之靴":60,
|
||
"幽冥之怨":60,
|
||
"死水沼泽靴":60,
|
||
"横行沼泽带":60,
|
||
"炎狱行者靴":60,
|
||
"天狼蛛牙":60,
|
||
"幽影编织者":60,
|
||
"钢牙追猎者":60,
|
||
"沉默血痕带":60,
|
||
"双生魔影袍":300,"魔影护卫者之冠":60}]]
|
||
)
|
||
zbcfg.idxs = {"天龙王御敌指环","潜龙王御敌指环","坠天使之心","暗龙王御敌指环","鸣龙王御敌指环",
|
||
"横行霸道","目空一切","目空一切[史诗]","极度深寒","极度深寒[史诗]"
|
||
,"来世再做我的英雄","来世再做我的英雄[史诗]","炎君赤羽衣","末日灵魂披风"
|
||
,"时空沙漏","燃烧的图腾","财神","疾风之戒","滴水穿石","罪孽深重","正邪两立","猝亡之戒"}
|
||
|
||
release_print("-------------------dbg:zbcfg.idxs")
|
||
function jhxbbgame.tab2str(r, tab)
|
||
local sRet = "{"
|
||
if tab then
|
||
local i = 0
|
||
for k, v in pairs(tab or {}) do
|
||
local line = tostring(k).."="..jhxbbgame.any2str2(r, v) ..(i > 0 and "," or "")
|
||
sRet = sRet .. (line)
|
||
i = i + 1
|
||
end
|
||
end
|
||
sRet = sRet .. "}"
|
||
return sRet
|
||
end
|
||
|
||
function jhxbbgame.any2str2(ret, ...)
|
||
local sRet = ""
|
||
local tbl = { ... }
|
||
for k, value in pairs(tbl or {}) do
|
||
local st = type(value)
|
||
if st == "table" then
|
||
sRet = sRet .. jhxbbgame.tab2str(ret, value)
|
||
else
|
||
sRet = sRet .. tostring(value)
|
||
end
|
||
if ret then
|
||
sRet = sRet .. "\n\r"
|
||
end
|
||
end
|
||
return sRet
|
||
end
|
||
|
||
function jhxbbgame.any2str(...)
|
||
return jhxbbgame.any2str2(false, ...)
|
||
end
|
||
function isValidVariableName(str)
|
||
if string.match(str, "^%d") then -- 检查是否以数字开头
|
||
return false
|
||
end
|
||
return string.match(str, "^%a[%w_]*$") ~= nil -- 检查是否是字母开头,后面跟字母、数字或下划线
|
||
end
|
||
|
||
tblccc= nil
|
||
function jhxbbgame.any2lua(...)
|
||
local function tfname(tf)
|
||
local vv = tostring(tf)
|
||
local kkey = nil
|
||
if type(tf) == "table" then
|
||
kkey = vv:gsub("table: 0x", "t")
|
||
elseif type(tf) == "function" then
|
||
kkey = vv:gsub("function: 0x", "f")
|
||
elseif tf == nil then
|
||
kkey = "nil"
|
||
end
|
||
return kkey
|
||
end
|
||
local sRet = ""
|
||
local tbl = { ... }
|
||
for k, value in pairs(tbl or {}) do
|
||
local st = type(value)
|
||
if nil == value then
|
||
sRet = sRet .. st
|
||
elseif tblccc == value then
|
||
elseif st == "table" then
|
||
sRet = sRet .. "{\n"--string.format("{--%s(%d)\n",tfname(value),jhxbbgame.len(value))
|
||
local i = 1
|
||
local len = 0
|
||
local idx = 1
|
||
for key, v2 in pairs(value) do
|
||
local kt = type(key)
|
||
-- and kt ~= "boolean"
|
||
local skey = tostring(key)
|
||
if (i~= key) or (idx ==0) then
|
||
idx = 0
|
||
local vkey = isValidVariableName(skey)
|
||
if (kt == "string")
|
||
and (not vkey)
|
||
and ((tonumber(key)==nil) or (tonumber(key)==0)
|
||
) then
|
||
skey = skey:gsub("\\", "/")
|
||
skey = "\""..skey.."\""
|
||
vkey = false
|
||
elseif (kt == "boolean") then
|
||
vkey = false
|
||
end
|
||
if not vkey then
|
||
skey = "["..skey.."]"
|
||
end
|
||
key = skey.."="
|
||
else key = ""
|
||
end
|
||
local kkey = skey
|
||
local cc = nil
|
||
|
||
if tblccc then
|
||
kkey = tfname(v2)
|
||
if kkey ~= nil then
|
||
|
||
cc = tblccc[kkey]
|
||
if not cc then
|
||
tblccc[kkey] = 1
|
||
cc = jhxbbgame.any2lua(v2)
|
||
else
|
||
cc = kkey
|
||
end
|
||
else cc = jhxbbgame.any2lua(v2)
|
||
end
|
||
|
||
else cc = jhxbbgame.any2lua(v2)
|
||
|
||
end
|
||
|
||
local add = key..cc
|
||
if i > 1 then
|
||
add = ","..add
|
||
end
|
||
sRet = sRet ..add
|
||
len = len + #add
|
||
i = i + 1
|
||
if len > 80 then
|
||
sRet = sRet .."\r"
|
||
len = 0
|
||
end
|
||
end
|
||
sRet = sRet .. "}"
|
||
elseif st == "function" then
|
||
local vv = tostring(value)
|
||
sRet = sRet ..vv:gsub(": ", '(a')..")end"
|
||
elseif st == "string" then
|
||
if value:find("\n") then
|
||
value = value:gsub("%[%[%]%]", '""')
|
||
value = "[["..value.."]]"
|
||
else
|
||
value = value:gsub("\\", "/")
|
||
value = "\""..value.."\""
|
||
end
|
||
sRet = sRet .. value
|
||
else
|
||
sRet = sRet .. tostring(value)
|
||
end
|
||
sRet = sRet .. ","
|
||
end
|
||
return sRet:sub(1, -2)
|
||
end
|
||
|
||
-- if smsg:sub(1, 1) == "*" then
|
||
-- smsg = smsg:sub(2)
|
||
-- release_print()
|
||
-- end
|
||
|
||
function jhxbbgame.allcall(actor, fun)
|
||
if isplayer(actor) then
|
||
if checkkuafu(actor) and checkkuafuserver() then
|
||
--release_print("本服通知触发跨服QF")
|
||
kfbackcall(21, getbaseinfo(actor, 2), fun)
|
||
return
|
||
end
|
||
local funs = fun:split(",")
|
||
jhxbbgame.log(actor, "allcall.= ", fun, type(_G[fun]))
|
||
local fn = funs[1]
|
||
table.remove(funs,1)
|
||
_G[fn](actor,unpack(funs))
|
||
end
|
||
end
|
||
function jhxbbgame.log2(...)
|
||
end
|
||
|
||
function jhxbbgame.log(...)
|
||
local arg = { ... }
|
||
local actor = nil
|
||
local name = ""
|
||
if arg[1] and (isplayer(arg[1]) or ismon(arg[1])) then
|
||
actor = arg[1]
|
||
name = getbaseinfo(actor, 1)
|
||
table.remove(arg,1)
|
||
end
|
||
|
||
local smsg = ""
|
||
for key, value in pairs(arg or {}) do
|
||
smsg = smsg..tostring(value or "nil")..","
|
||
end
|
||
release_print(name,smsg)
|
||
if actor --and getgmlevel(actor)>0
|
||
and (smsg and smsg:sub(1,1)==[[*]])
|
||
then
|
||
--smsg = smsg:sub(2,#smsg)
|
||
jhxbbgame.sendmsg(actor,smsg)
|
||
|
||
end
|
||
return smsg
|
||
end
|
||
|
||
function jhxbbgame.dbgout(actor,...)
|
||
jhxbbgame.log(actor,"*",...)
|
||
end
|
||
|
||
function jhxbbgame.dbgoutr(...)
|
||
release_print(jhxbbgame.any2str(true, ...))
|
||
end
|
||
|
||
|
||
function jhxbbgame.in2ii(iname)
|
||
return tonumber(getstditeminfo(iname,0))
|
||
end
|
||
|
||
|
||
|
||
--jhxbbgame.s2f("jhxbbgame.lua", "local game = "..jhxbbgame.any2lua(jhxbbgame))
|
||
|
||
|
||
local olderr = error
|
||
error = function(m, lv)
|
||
return olderr(m, lv or 0)
|
||
end
|
||
|
||
function safecall(func, defret, ...)
|
||
local aret = nil
|
||
local pass, result, errinfo = pcall(func, ...)
|
||
if pass then
|
||
return result, nil
|
||
else
|
||
jhxbbgame.log("safecall.fail", result)
|
||
return defret, errinfo
|
||
end
|
||
end
|
||
|
||
function safecallEx(func, msg, defret, ...)
|
||
local aret = nil
|
||
local pass,result, errinfo = pcall(func, ...)
|
||
if pass then
|
||
return result, nil
|
||
else
|
||
jhxbbgame.log("safecall.fail", result)
|
||
return msg..tostring(errinfo), defret, result
|
||
end
|
||
end
|
||
|
||
function jhxbbgame.makekf(wfn)
|
||
local namesact = { "群骑竞赛", "夺宝战场", "杀戮证道", "据点争夺", "跨服沙巴克","辉煌的凤栖寺院", "泽坤的恩赐", }
|
||
|
||
|
||
local wf = function (key,fn)
|
||
local content = io.open(fn, "r")
|
||
if content then
|
||
local code = content:read("*all")
|
||
if code then
|
||
code = code:gsub([[local boxeffid]], "--local boxeffid")
|
||
code = code:gsub([[boxeffid]], "60584")
|
||
for key, value in pairs(namesact) do
|
||
code = code:gsub([[.actname == "]]..value, ".i == "..key)
|
||
code = code:gsub(key..[[" then]], key.." then")
|
||
code = code:gsub(key..[[" and]], key.." and")
|
||
|
||
end
|
||
content:close()
|
||
release_print("makekf----------------",#code)
|
||
if wfn then
|
||
jhxbbgame.s2f(wfn,code)
|
||
end
|
||
return code
|
||
end
|
||
else
|
||
release_print("Fail...",fn)
|
||
end
|
||
return nil
|
||
end
|
||
return wf(nil,"wlua\\verfx\\kfsystem.lua")
|
||
|
||
end
|
||
local function makecd()
|
||
zbcfg.CD = {}
|
||
local cdcnt = 0
|
||
local lu = ""
|
||
for key, value in pairs(zbcfg._CD) do
|
||
value = tonumber(value)
|
||
if value > 0 then
|
||
lu = "U"..149-cdcnt
|
||
zbcfg.CD[key]={value,lu}
|
||
cdcnt = cdcnt + 1
|
||
end
|
||
end
|
||
return lu,cdcnt
|
||
end
|
||
local lu,cdcnt = makecd()
|
||
function jhxbbgame.make()
|
||
local w = io.open("wlua\\trigger\\zszb.lua", "w+")
|
||
|
||
local ret, msg = safecall(function ()
|
||
|
||
|
||
w:write([[
|
||
local allzb = {}
|
||
]])
|
||
|
||
local i = 0
|
||
release_print("CD.Var========= ", i)
|
||
local savecd = {}
|
||
for key, value in pairs(zbcfg.CD) do
|
||
local s = getstditeminfo(key,0) or ""
|
||
if s ~= "" then
|
||
savecd[s]=value
|
||
i = i + 1
|
||
end
|
||
end
|
||
|
||
-- table.sort(savecd,function (a, b)
|
||
-- return a.k > b.k
|
||
-- end)
|
||
savecd=jhxbbgame.any2lua(savecd)
|
||
|
||
local lidxsa = {}
|
||
for key, value in pairs(zbcfg.idxs) do
|
||
lidxsa[key]=getstditeminfo(value,0)
|
||
end
|
||
local lidxs=jhxbbgame.any2lua(lidxsa)
|
||
|
||
local zz = jhxbbgame.zb
|
||
local wf = function (key,fn)
|
||
local content = io.open(fn, "r")
|
||
if content then
|
||
local code = content:read("*all")
|
||
if key then
|
||
w:write("allzb["..key.."] = function ()\n\r")
|
||
end
|
||
code = code:gsub("jhxbbgame.GetRate%(", "(math.random(1,10000)<=")
|
||
for key2, value in pairs(lidxsa) do
|
||
code = code:gsub("zbcfg.idxs%["..key2.."%]", value)
|
||
end
|
||
w:write(code)
|
||
if key then
|
||
w:write("\n\rend\n\r")
|
||
end
|
||
content:close()
|
||
else
|
||
release_print("Fail...",fn)
|
||
end
|
||
end
|
||
w:write("zbcfg.CD = "..savecd.."\n")
|
||
w:write("zbcfg.idxs = "..lidxs.."\n")
|
||
w:write([[release_print("-----------res--------:zbcfg.idxs")]])
|
||
w:write("--"..cdcnt.."/"..lu.."\r")
|
||
|
||
wf(nil,"wlua\\verfx\\equipeff.lua")
|
||
--jhxbbgame.zb = {}
|
||
local nzz ={}
|
||
for key, value in pairs(zz) do
|
||
local key2 = getstditeminfo(key,0) or 0
|
||
if (not key2) or (key2 <= 0) or (not value)or (not value.fn) then
|
||
release_print("无效的专属装备名字...",key,value)
|
||
else
|
||
local cfff = {k=tonumber(key2),fn=value.fn}
|
||
nzz[#nzz+1]=cfff
|
||
end
|
||
end
|
||
|
||
release_print("#nzz:"..#nzz)
|
||
table.sort(nzz,function (a, b)
|
||
return a.k > b.k
|
||
end)
|
||
zz = nzz
|
||
for key, value in pairs(zz) do
|
||
--release_print(value.k,key)
|
||
wf(value.k,value.fn)
|
||
end
|
||
|
||
|
||
w:write([[
|
||
jhxbbgame.zb = {}
|
||
for key, value in pairs(allzb) do
|
||
jhxbbgame.zb[key]=value()
|
||
end
|
||
zbcfg.build()
|
||
release_print("专属装备.ok",jhxbbgame.len(zbcfg.CD),(zbcfg.CD[50376]and zbcfg.CD[50376][2])or nil)
|
||
|
||
]])
|
||
return "OK"
|
||
end)
|
||
w:close()
|
||
return tostring(ret)..tostring(msg)
|
||
end
|
||
|
||
jhxbbgame.zb = {}
|
||
for k, v in pairs(getenvirfilelist()) do
|
||
if string.match(v, "%.([^%.]+)$") == "lua" then
|
||
if string.match(v, "wlua\\verfx\\专属") then
|
||
local mode_path = string.format("Envir\\%s", v)
|
||
local fun=require(mode_path)
|
||
if not fun then
|
||
release_print(mode_path .. ":加载专属失败 ")
|
||
else
|
||
local vv = string.gsub(v, "wlua\\verfx\\专属\\", "")
|
||
vv = string.gsub(vv, ".lua", "")
|
||
if string.match(v, "wlua\\verfx\\专属") then
|
||
--release_print(vv .. ":加载专属 ")
|
||
fun.fn = v
|
||
vv = string.gsub(vv, "verfx\\专属\\", "")
|
||
jhxbbgame.zb[vv] = fun
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
release_print("专属装备:=>",safecall(zbcfg.build),jhxbbgame.zb[1])
|
||
|
||
|
||
function zbcfg.makelua()
|
||
for key, value in pairs(zbcfg.CD) do
|
||
local fn = "wlua\\专属\\"..key..".lua"
|
||
local w = io.open(fn, "r")
|
||
if w == nil then
|
||
jhxbbgame.log("fn:",fn)
|
||
fn = fn:gsub("\\专属","\\专属\\tmp")
|
||
jhxbbgame.s2f(fn,[[--专属装备 by jhxbb
|
||
local cfg = {
|
||
}
|
||
|
||
cfg[1] = function(actor, -- object 玩家对象
|
||
Target, -- object 受击对象
|
||
Hiter, -- object 攻击对象
|
||
MagicId, -- integer 技能ID
|
||
Damage, -- integer 伤害
|
||
Model, -- integer 引擎64_23.10.24新增 当前攻击模式
|
||
vdata
|
||
)
|
||
local v = 1
|
||
if jhxbbgame.GetRate(100) then
|
||
jhxbbgame.log(Target, "]]..key..[[ = ", vdata.tmax_hp * 0.01)
|
||
|
||
jhxbbgame.HintEff(actor, "]]..key..[[")
|
||
return true
|
||
end
|
||
return false
|
||
end
|
||
|
||
return cfg
|
||
]])
|
||
end
|
||
end
|
||
|
||
end
|
||
--zbcfg.makelua()
|
||
|
||
function copy_file(source_file, destination_file)
|
||
local source = io.open(source_file, "rb")
|
||
if not source then
|
||
return false
|
||
end
|
||
local destination = io.open(destination_file, "wb")
|
||
if not destination then
|
||
--print("无法打开目标文件")
|
||
source:close()
|
||
return false
|
||
end
|
||
local content = source:read("*all")
|
||
destination:write(content)
|
||
source:close()
|
||
destination:close()
|
||
return true
|
||
end
|
||
|
||
copy_file("data\\cfg_buff2.xls","data\\cfg_buff.xls")
|
||
-- copy_file("wlua/verfx/tesxbb.lua","wlua/clmsgs/tesxbb.lua")
|
||
-- copy_file("wlua/verfx/ui1118.lua","wlua/ui/ui1118.lua")
|
||
|
||
|
||
function jhxbbgame.BodyItem(actor, bidx)
|
||
local ret = (getconst(actor, "<$USEITEMNAME[" .. bidx .. "]>"))
|
||
if not ret or ret =="" then
|
||
return nil
|
||
else
|
||
return ret
|
||
end
|
||
end
|
||
|
||
function zbcfg.idx(actor,item)
|
||
return getiteminfo(actor,item,2)
|
||
end
|
||
function jhxbbgame.reallce(actor,onoff)
|
||
onoff = onoff or 1
|
||
local deccnt = 666
|
||
if onoff ==1 then
|
||
|
||
jhxbbgame.HintEff(actor,"setskilldeccd")
|
||
SetVarInt(actor,"N$cd烈火剑法",1)
|
||
SetVarInt(actor,"N$cd野蛮冲撞",1)
|
||
SetVarInt(actor,"N$cd彻地钉",1)
|
||
SetVarInt(actor,"N$cd双龙斩",1)
|
||
SetVarInt(actor,"N$cd狮子吼",1)
|
||
SetVarInt(actor,"N$cd龙影剑法",1)
|
||
SetVarInt(actor,"N$cd雷霆剑法",1)
|
||
SetVarInt(actor,"N$cd逐日剑法",1)
|
||
SetVarInt(actor,"N$cd开天斩",1)
|
||
SetVarInt(actor,"N$cd擒龙手",1)
|
||
SetVarInt(actor,"N$cd纵横剑术",1)
|
||
SetVarInt(actor,"N$cd十步一杀",1)
|
||
else
|
||
deccnt = 0
|
||
jhxbbgame.HintEff(actor,"skillrestcd")
|
||
end
|
||
|
||
setskilldeccd(actor,"烈火剑法","=",deccnt)
|
||
setskilldeccd(actor,"野蛮冲撞","=",deccnt)
|
||
setskilldeccd(actor,"彻地钉","=",deccnt)
|
||
setskilldeccd(actor,"双龙斩","=",deccnt)
|
||
setskilldeccd(actor,"狮子吼","=",deccnt)
|
||
setskilldeccd(actor,"龙影剑法","=",deccnt)
|
||
setskilldeccd(actor,"雷霆剑法","=",deccnt)
|
||
setskilldeccd(actor,"逐日剑法","=",deccnt)
|
||
setskilldeccd(actor,"开天斩","=",deccnt)
|
||
setskilldeccd(actor,"擒龙手","=",deccnt)
|
||
setskilldeccd(actor,"纵横剑术","=",deccnt)
|
||
setskilldeccd(actor,"十步一杀","=",deccnt)
|
||
end
|
||
function jhxbbgame.GetRate(ratetag)
|
||
return true
|
||
end
|
||
|
||
function math.round(num)
|
||
return num >= 0 and math.floor(num + 0.5) or math.ceil(num - 0.5)
|
||
end
|
||
|
||
function math.sign(num)
|
||
if num > 0 then
|
||
return 1
|
||
elseif num < 0 then
|
||
return -1
|
||
else
|
||
return 0
|
||
end
|
||
end
|
||
local oldhumanhp = humanhp
|
||
function humanhp2(actor,...)
|
||
jhxbbgame.log(actor,"*humanhp",...)
|
||
--oldhumanhp(actor,...)
|
||
end
|
||
local oldaddhpper = addhpper
|
||
function addhpper2(actor,...)
|
||
jhxbbgame.log(actor,"*addhpper",...)
|
||
--oldaddhpper(actor,...)
|
||
end
|
||
local oldstartup= startup
|
||
function dbgstartup(sysobj)
|
||
release_print("startup",getstditeminfo("霜蹄驭者扣",0))
|
||
|
||
if not checkkuafuserver() then
|
||
genmon("k0108",6,11,"练功师",1,1,233)
|
||
genmon("k0108",9,11,"一大陆-僵尸洞",1,1,233)
|
||
|
||
end
|
||
genmon("0",139,153,"练功师",0,1,233)
|
||
genmon("0",143,157,"练功师",0,1,233)
|
||
|
||
if oldstartup then
|
||
oldstartup(sysobj)
|
||
end
|
||
end
|
||
startup = dbgstartup
|
||
--[[
|
||
<Text|x=397|y=132.0|size=18|color=251|text=我要改名|link=@@InputString2(请输入您想改的新昵称:)>
|
||
<Text|x=42|y=133.0|size=18|color=251|text=查看改名名单>>|link=@查看改名名单>
|
||
|
||
|
||
[@InputString2]
|
||
#IF
|
||
#ACT
|
||
MOV S$改名判断
|
||
|
||
#IF
|
||
Equal S2
|
||
#ACT
|
||
MESSAGEBOX \ \ \[提示]:请输入一个正确的名称!
|
||
MOV S2
|
||
Break
|
||
]]
|
||
function makegolddata(actor)
|
||
local josvdata = {}
|
||
josvdata["jj2yy"] = {["庾黄磊"]={{323,123},{623,223}}}
|
||
josvdata["yy2jj"] = {["庾黄磊"]={{123,23},{523,73}}}
|
||
setsysvar("A18",tbl2json(josvdata))
|
||
local svdata = json2tbl(getsysvar("A18") or "{}") or {}
|
||
jhxbbgame.log("svdata:",tbl2json(svdata))
|
||
local i = 1
|
||
local ii = 1
|
||
local function makeitem(x,src,des)
|
||
local tmpitem =[[
|
||
<Layout|note=0|id=i%d|children={b%d1,t%d1}|x=267.0|y=108.0|width=320|height=50|rotate=0|color=%d>
|
||
<Button|id=b%d1|ax=0.0|x=250.0|y=4.0|height=33|nimg=Image/public/1900000678_3.png|color=255|size=18|text=购买|link=@buygm%d>
|
||
<Text|id=t%d1|x=9.0|y=11.0|color=255|size=16|text=%s>
|
||
]]
|
||
local tmp= [[
|
||
<Img|id=ii%d|children={tcap%d,lv%d,menu%d}|ax=0.0|x=%d.0|y=19.0|width=350|height=410|rotate=0|esc=0|img=Image/private/auction/14.png|show=4>
|
||
<Button|id=tcap%d|x=96.0|y=-11.0|color=251|size=18|nimg=Image/public/1900000678.png|text=%s|link=@sell%d>
|
||
<ListView|note=0|id=lv%d|children={%s}|x=7.0|y=27.0|width=320|height=320|rotate=0|margin=0|color=0|direction=1>%s
|
||
<MenuItem|id=menu%d|menuid=S%d|x=180|y=166|itemname=裁决之杖#骨玉权杖#龙纹剑#1000元宝|a=3|direction=1|fontcolor=255|selectcolor=254|fontsize=20|select=选择物品|itemhei=30|link=@tpsel%d>
|
||
]]
|
||
local tmp3 = ""
|
||
local opname = "%s2%s"
|
||
opname = opname:format(src,des)
|
||
local typehuilv = ""
|
||
local allisrc = 0
|
||
local allides = 0
|
||
setplaydef(actor,"S$"..opname,"")
|
||
local schildids = "i"..i
|
||
for k, v in pairs(svdata[opname] or {}) do
|
||
for kk,vv in pairs(v) do
|
||
local isrc = vv[1]
|
||
local ides = vv[2]
|
||
allisrc = allisrc + isrc
|
||
allides = allides + ides
|
||
local txhl = ""--"汇率:"..(string.format("%.2f", ides/isrc))
|
||
local txt = isrc..src..",价格"..ides..des..txhl
|
||
tmp3 = tmp3..tmpitem:format(i,i,i,i,i,i,i,txt)
|
||
i = i + 1
|
||
schildids = schildids..",i"..i
|
||
end
|
||
end
|
||
--typehuilv = "均汇率:"..(string.format("%.2f", allides/allisrc))
|
||
local tmp2 = tmp:format(ii,ii,ii,ii,x,ii,opname..typehuilv,ii,ii,schildids,tmp3,ii,ii,ii)
|
||
ii = ii + 1
|
||
setplaydef(actor,"S$"..opname,tmp2)
|
||
end
|
||
makeitem(15,"yy","jj")
|
||
makeitem(15+350,"jj","yy")
|
||
end
|
||
function sell1(actor,...)
|
||
local buyid = getplaydef(actor,"S$buyid")
|
||
local sel = getconst(actor,"<$NPCPARAMS(0,S$buyid)>")
|
||
|
||
jhxbbgame.GMLog(actor, "*sell1:",sel,buyid, ...)
|
||
end
|
||
function sell2(actor,...)
|
||
local buyid = getplaydef(actor,"S$buyid")
|
||
jhxbbgame.GMLog(actor, "*sell2:",buyid, ...)
|
||
end
|
||
|
||
function tpsel1(actor,...)
|
||
local sel = getconst(actor,"<$NPCPARAMS(4,S1)>")
|
||
|
||
jhxbbgame.GMLog(actor, "*tpsel1:",sel,tostring(npcparams), ...)
|
||
end
|
||
function tpsel2(actor,...)
|
||
local sel = getconst(actor,"<$NPCPARAMS(4,S2)>")
|
||
jhxbbgame.GMLog(actor, "*tpsel2:",sel, ...)
|
||
end
|
||
|
||
function buygm1(actor,...)
|
||
local buyid = getplaydef(actor,"S$buyid")
|
||
jhxbbgame.GMLog(actor, "*buygm1:",buyid, ...)
|
||
end
|
||
function buygm2(actor,...)
|
||
local buyid = getplaydef(actor,"S$buyid")
|
||
jhxbbgame.GMLog(actor, "*buygm2:",buyid, ...)
|
||
end
|
||
function testsay2(actor)
|
||
makegolddata(actor)
|
||
say(actor, [[
|
||
[@main]
|
||
<Img|children={10005,hlp,ii1,ii2}|ax=0|ay=1|x=-13.0|y=-83.0|width=750.0|height=390.0|rotate=0|reset=1|bg=1|move=1|show=4|img=public/1900000610.png>
|
||
<Layout|id=10005|children={10006}|ax=0.5|ay=0.5|percentx=98.4|percenty=4.9|width=80|height=80|link=@exit>
|
||
<Button|id=10006|ax=0.5|ay=0.5|percentx=46.0|percenty=51.8|nimg=public/1900000510.png|pimg=public/1900000511.png|link=@exit>
|
||
<Button|id=hlp|x=391.0|y=3.0|nimg=Image/public/1900001024.png|size=18|mimg=Image/public/1900001024.png|color=255|pimg=Image/public/1900001024.png>
|
||
]]..getplaydef(actor,"S$jj2yy")..getplaydef(actor,"S$yy2jj"))
|
||
|
||
end
|
||
function testsay(actor)
|
||
if npcid == 34 then
|
||
say(actor, [[
|
||
[@main]
|
||
<Img|children={10005,hlp,ii1,ii2}|ax=0|ay=1|x=-13.0|y=-83.0|width=750.0|height=390.0|rotate=0|reset=1|bg=1|move=1|show=4|img=public/1900000610.png>
|
||
<Layout|id=10005|children={10006}|ax=0.5|ay=0.5|percentx=98.4|percenty=4.9|width=80|height=80|link=@exit>
|
||
<Button|id=10006|ax=0.5|ay=0.5|percentx=46.0|percenty=51.8|nimg=public/1900000510.png|pimg=public/1900000511.png|link=@exit>
|
||
<Button|id=hlp|x=391.0|y=3.0|nimg=Image/public/1900001024.png|size=18|mimg=Image/public/1900001024.png|color=255|pimg=Image/public/1900001024.png>
|
||
]]..getplaydef(actor,"S$金币换元宝")..getplaydef(actor,"S$元宝换金币"))
|
||
return
|
||
end
|
||
edcode = require("Envir/wlua/edcode.lua")
|
||
local function compress(data)
|
||
return edcode:CompressDeflate(data)
|
||
end
|
||
|
||
local function decompress(data)
|
||
return edcode:DecompressDeflate(data)
|
||
end
|
||
|
||
-- jhxbbgame.encom = compress
|
||
-- jhxbbgame.endecom = decompress
|
||
local function t2(...)
|
||
-- 测试
|
||
local original_data = jhxbbgame.ui.ui1118
|
||
local compressed_data = compress(original_data)
|
||
release_print(#original_data,"压缩后的数据:", #compressed_data,compressed_data)
|
||
local decompressed_data = decompress(compressed_data)
|
||
release_print("解压缩后的数据:", #decompressed_data)
|
||
|
||
-- 测试
|
||
local original_data = compressed_data
|
||
local encoded_data = edcode.ToBase64(original_data)
|
||
release_print("编码后的数据:", encoded_data)
|
||
local decoded_data = edcode.FromBase64(encoded_data)
|
||
release_print("解码后的数据:", decoded_data)
|
||
release_print(".zbcfg.load() =2 ",jhxbbgame.any2lua(dd),jhxbbgame.any2lua(cc))
|
||
release_print(".zbcfg.load() =2.::",jhxbbgame.any2lua(dd1),jhxbbgame.any2lua(cc1))
|
||
release_print("解码后的数据:", decoded_data)
|
||
end
|
||
|
||
end
|
||
testsay()
|
||
end
|
||
require("Envir/wlua/verfx/equipeff.lua")
|
||
local cc= {}
|
||
local dd= {}
|
||
for key, value in pairs(jhxbbgame.zb) do
|
||
local s1 = getstditeminfo(key,2) or 0
|
||
|
||
local a=0
|
||
if s1 >= 300 then
|
||
a = 71 + (s1 - 300)
|
||
dd[a] = s1
|
||
else
|
||
cc[s1] = (cc[s1] or 0)+1
|
||
end
|
||
end
|
||
local cc1= {}
|
||
local dd1= {}
|
||
for key, value in pairs(zbcfg.idxs) do
|
||
local s1 = getstditeminfo(value,2) or 0
|
||
|
||
local a=0
|
||
if s1 >= 300 then
|
||
a = 71 + (s1 - 300)
|
||
dd1[a] = s1
|
||
else
|
||
cc1[s1] = (cc1[s1] or 0)+1
|
||
end
|
||
end
|
||
|
||
for key, value in pairs(dd) do
|
||
table.remove(cc,value)
|
||
end
|
||
local eqidxtab = {
|
||
}
|
||
|
||
for key, value in pairs(zbcfg.eqpos) do
|
||
eqidxtab[value] = "<$USEITEMID[" .. value .. "]>"
|
||
end
|
||
|
||
jhxbbgame.eqidxtab = eqidxtab
|
||
aab()
|
||
jhxbbgame.s2f("wlua/verfx/aaa.lua",jhxbbgame.any2lua(eqidxtab))
|
||
--jhxbbgame.msgsv.reg(require("Envir/wlua/合服礼包.lua"))
|
||
function jhxbbgame.makedbg()
|
||
|
||
jhxbbgame.localdata=jhxbbgame.recfile({dbg1118=jhxbbgame.ui.dbg1118,
|
||
--ui=jhxbbgame.any2lua(jhxbbgame.ui),
|
||
--dbg=jhxbbgame.f2s("wlua/verfx/dbgsvbuding.lua")
|
||
dbgsv=jhxbbgame.f2s("wlua/verfx/texbb.lua")
|
||
},true)
|
||
|
||
jhxbbgame.s2f("wlua/verfx/lst.txt",tbl2json(jhxbbgame.localdata))
|
||
jhxbbgame.log("*jhxbbgame.makedbg()")
|
||
end
|
||
|
||
--require("Envir/wlua/verfx/dbgsvbuding.lua")
|
||
local rr = require("Envir/wlua/verfx/texbb.lua")
|
||
jhxbbgame.msgsv.reg(rr)
|
||
|
||
--
|
||
jhxbbgame.reloadui("dbg1118",nil,jhxbbgame.f2s("wlua/verfx/dbg1118.lua"))
|
||
|
||
jhxbbgame.makedbg()
|
||
local kfcode = jhxbbgame.makekf()
|
||
--local w = io.open("wlua\\clmsgs\\kuafusysproc.lua", "w+")
|
||
--w:write(code)
|
||
--w:close()
|
||
jhxbbgame.reloadui("kuafusysproc",kfcode,nil)
|
||
local wret = jhxbbgame.s2f([[\wlua\clmsgs\kuafusysproc.lua]],kfcode)
|
||
jhxbbgame.log("*jhxbbgame.111111()--------",#kfcode, wret)
|
||
local oldhumanhp = humanhp
|
||
function humanhp22(actor,operate,nvalue,effid,delay,hiter,isSend,isRob)
|
||
jhxbbgame.log(actor,"*humanhp",operate,nvalue)
|
||
end
|
||
|
||
function makeposfile()
|
||
local function getCirclePoints(x0, y0, r)
|
||
local points = {}
|
||
local step = math.pi / 8 -- 每次增加的角度
|
||
local function add(xy)
|
||
points[xy.x.."_"..xy.y] = {x=xy.x,y=xy.y}
|
||
|
||
end
|
||
for a = 0, 2 * math.pi, step do
|
||
local x1 = math.floor(x0 + r * math.cos(a) + 0.5)
|
||
local y1 = math.floor(y0 + r * math.sin(a) + 0.5)
|
||
if (x1 - x0)^2 + (y1 - y0)^2 <= r^2 then
|
||
add({x = x1, y = y1})
|
||
end
|
||
add({x = x0 - (x1 - x0), y = y1})
|
||
add({x = x1, y = y0 - (y1 - y0)})
|
||
add({x = x0 - (x1 - x0), y = y0 - (y1 - y0)})
|
||
end
|
||
local ret = {}
|
||
for key, value in pairs(points) do
|
||
ret[#ret+1] = value
|
||
end
|
||
return ret
|
||
end
|
||
local function name(i)
|
||
local aa = tbl2json(getCirclePoints(0,0,i))
|
||
aa= string.gsub(aa, ":", "=")
|
||
aa= string.gsub(aa, "\"", "")
|
||
aa= string.gsub(aa, "]", "")
|
||
aa= string.gsub(aa, "%[", "")
|
||
return aa
|
||
end
|
||
local w = io.open("wlua\\trigger\\rpos.lua", "w+")
|
||
w:write("jhxbbgame.rpos ={","[2]={"..name(2)
|
||
.."},","[4]={"..
|
||
(name(4)).."},","[6]={"..
|
||
(name(6)).."}}")
|
||
w:close()
|
||
|
||
SL:HTTPRequestGet("https://www.baidu.com/", function (success, response)
|
||
|
||
SL:Print("HTTPRequestGet...",success, response)
|
||
-- success: boolean 请求是否成功
|
||
-- response: string 请求返回数据
|
||
end)
|
||
|
||
end
|
||
|
||
-- local qfitem ={{Index=11,pic=22},{Index=11,pic=3}}
|
||
-- table.sort(qfitem,function(a,b)
|
||
-- return a.pic < b.pic
|
||
-- end)
|
||
|
||
-- print(jhxbbgame.any2lua(qfitem))
|
||
|
||
|
||
-- function myOtherCoroutine()
|
||
-- print("协程开始执行")
|
||
-- coroutine.yield()
|
||
-- print("协程恢复执行")
|
||
-- end
|
||
--print("-------------------玲珑八面",getstditeminfo("玲珑八面[史诗]",0))
|
||
-- local co = coroutine.create(myOtherCoroutine);
|
||
-- print(coroutine.status(co));
|
||
-- coroutine.resume(co);
|
||
-- print(coroutine.status(co));
|
||
|
||
|
||
|
||
function aaafafaaa()
|
||
local cd = os.time()
|
||
local function _run(actor)
|
||
if jhxbbgame.GetRate(2500) then
|
||
local curtime = os.time()
|
||
if curtime > cd then
|
||
--cd = curtime + 5
|
||
local x = getbaseinfo(actor,4)
|
||
local y = getbaseinfo(actor,5)
|
||
local eff = {{1,470},{7,527,5000},{10,511},{5,458}}
|
||
local e =eff[2]--[math.random(#eff)]
|
||
rangeharm(actor,
|
||
x,
|
||
y,
|
||
8,
|
||
0,
|
||
e[1],
|
||
0,
|
||
0,
|
||
0,
|
||
e[2],
|
||
999)
|
||
end
|
||
|
||
end
|
||
end
|
||
|
||
end |