|
- --获取创建房间选项配置
- local PDKDefine = require("luaScript.SubGameDefine.PDKDefine")
- local Define_28 = import("luaScript.SubGameDefine.Poker.Define_28")
- local Define_53 = import("luaScript.SubGameDefine.Poker.Define_53")
-
- function getRuleFromString(gameId, jushu, ruleStr)
-
- local config=getSubGameConfig(tonumber(gameId))
- if config and type(config.wanfaConfig) == "string" then
- local isRequired, wanfa = pcall(require, config.wanfaConfig)
- if isRequired and wanfa and type(wanfa.getRuleFromString) == "function" then
- local tt = wanfa.getRuleFromString(gameId, jushu, ruleStr)
- return tt or {}
- end
- end
-
- local tt = {}
- local jsonData = json.decode(ruleStr);
- --"{\"kun\":14,\"gamerule\":0,\"baozi\":10,\"minHuShu\":18,\"specRule\":1}",
- -- 局数
- local jushuText = string.format("%d 局",jushu);
- table.insert(tt, {name = "局数", value = {jushuText}})
-
- if tonumber(gameId) == GAME_IDS.PaoDeKuai then--deductRule gamerule playerNum specialRule
- if jsonData.deductRule and jsonData.deductRule >= 0 then
- local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
- if specStr ~= "" then
- table.insert(tt, {name = "房费", value = {specStr}})
- end
- end
- if jsonData.gamerule and jsonData.gamerule>0 then
- local specStr = PDKDefine.GameTypesStr[jsonData.gamerule] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "玩法", value = {specStr}})
- end
- end
- if jsonData.playerNum and jsonData.playerNum>=0 then
- local specStr = PDKDefine.GamePlayerCount[jsonData.playerNum] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "人数", value = {specStr}})
- end
- end
- if jsonData.allowPass and jsonData.allowPass >= 0 then
- local specStr = PDKDefine.GameWanfa[jsonData.allowPass] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "玩法", value = {specStr}})
- end
- end
- local function getRule( rule )
- local CreateParamsMean = PDKDefine.CreateParamsMean
- local ruleStr = ""
- if getNumBand(rule, 0x0001)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0001]..","
- end
- if getNumBand(rule, 0x0002)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0002]..","
- end
- if getNumBand(rule, 0x0004)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0004]..","
- end
- -- if getNumBand(rule, 0x0008)>0 then
- -- -- ruleStr = ruleStr..CreateParamsMean[0x0008]..","
- -- end
- if getNumBand(rule, 0x0010)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0010]..","
- end
- if getNumBand(rule, 0x0020)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0020]..","
- end
- if getNumBand(rule, 0x0040)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0040]..","
- end
- if getNumBand(rule, 0x0080)>0 then
- ruleStr = ruleStr..CreateParamsMean[0x0080]..","
- end
- if string.len(ruleStr) > 0 then
- ruleStr = string.sub(ruleStr, 1, string.len(ruleStr)-1)
- end
- return ruleStr
- end
- if jsonData.specialRule and jsonData.specialRule>=0 then
- local specStr = getRule(jsonData.specialRule)
- if specStr ~= "" then
- table.insert(tt, {name = "规则", value = {specStr}})
- end
- end
- -- elseif tonumber(gameId) == GAME_IDS.zgWuRenDouDiZhu then
- -- local wrDdzDefine = require("luaScript.SubGameDefine.zgwrDdzDefine")
- -- local tt1 = wrDdzDefine.getClubWaFaInfo(ruleStr)
- -- table.insertTo(tt,tt1)
- -- elseif tonumber(gameId) == GAME_IDS.DouDiZhu then
- -- if jsonData.multLimit and jsonData.multLimit >= 0 then
- -- local specStr = Define_28.GAME_RULE.multLimit["" .. jsonData.multLimit] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "倍数", value = {specStr}})
- -- end
- -- end
-
- -- if jsonData.lordType and jsonData.lordType >= 0 then
- -- local specStr = Define_28.GAME_RULE.lordType["" .. jsonData.lordType] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "地主", value = {specStr}})
- -- end
- -- end
-
- -- if jsonData.nobLord and jsonData.nobLord >= 0 then
- -- local specStr = Define_28.GAME_RULE.nobLord["" .. jsonData.nobLord] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "无人叫牌", value = {specStr}})
- -- end
- -- end
-
- -- if jsonData.sanDai and jsonData.sanDai >= 0 then
- -- local specStr = Define_28.GAME_RULE.sanDai["" .. jsonData.sanDai] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "三带", value = {specStr}})
- -- end
- -- end
-
- -- if jsonData.siDai and jsonData.siDai >= 0 then
- -- local specStr = Define_28.GAME_RULE.siDai["" .. jsonData.siDai] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "四带", value = {specStr}})
- -- end
- -- end
-
- -- if jsonData.piaoType and jsonData.piaoType >= 0 then
- -- local specStr = Define_28.GAME_RULE.piaoType["" .. jsonData.piaoType] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "飘分", value = {specStr}})
- -- end
- -- end
-
- -- if jsonData.extPlay and jsonData.extPlay >= 0 then
- -- local specStr = Define_28.GAME_RULE.extPlay["" .. jsonData.extPlay] or ""
- -- if specStr ~= "" then
- -- table.insert(tt, {name = "其它", value = {specStr}})
- -- end
- -- end
- elseif tonumber(gameId) == GAME_IDS.NanChongDouDiZhu then
- if jsonData.multLimit and jsonData.multLimit >= 0 then
- local specStr = Define_53.GAME_RULE.multLimit["" .. jsonData.multLimit] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "封顶", value = {specStr}})
- end
- end
- if jsonData.piaoType and jsonData.piaoType >= 0 then
- local specStr = Define_53.GAME_RULE.piaoType["" .. jsonData.piaoType] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "漂分", value = {specStr}})
- end
- end
- if jsonData.calcFan and jsonData.calcFan >= 0 then
- local specStr = Define_53.GAME_RULE.calcFan["" .. jsonData.calcFan] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "算番", value = {specStr}})
- end
- end
- if jsonData.playRule and jsonData.playRule >= 0 then
- local specStr = Define_53.GAME_RULE.playRule["" .. jsonData.playRule] or ""
- if specStr ~= "" then
- table.insert(tt, {name = "玩法", value = {specStr}})
- end
- end
- elseif tonumber(gameId) == GAME_IDS.BanZiPao then
- tt = PKFramework.ImportWanFa("luaScript.SubGameDefine.PuKe.PKWanFa", gameId).getClubRuleInfo(ruleStr)
- --手动添加局数
- table.insert(tt, 1, {name = "局数", value = {jushuText}})
- end
-
- --判断游戏配置是麻将
- local config=getSubGameConfig(tonumber(gameId))
- if config and config.belongType==3 then
- if jsonData.deductRule and jsonData.deductRule >= 0 then
- local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
- if specStr ~= "" then
- table.insert(tt, {name = "房费", value = {specStr}})
- end
- end
-
- local MJWanFa=MJFramework.ImportWanFa("luaScript.SubGameDefine.MaJiang.MJWanFa",gameId)
- table.insertTo(tt,MJWanFa.getClubWaFaInfo(ruleStr))
- elseif config and config.belongType==2 then
- if jsonData.deductRule and jsonData.deductRule >= 0 then
- local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
- if specStr ~= "" then
- table.insert(tt, {name = "房费", value = {specStr}})
- end
- end
- --[[-- 是否已下载
- local isDownGame = app.subGameManager:isInstaller(tonumber(gameId))
- -- 是否需要更新
- local isUpdate = app.subGameManager:isNeedUpdate(tonumber(gameId))
- if isDownGame == false or isUpdate == true then
- return tt
- end--]]
- local ZPWanFa = ZPFramework.ImportWanFa("luaScript.SubGameDefine.ZiPai.ZPWanFa",gameId)
- table.insertTo(tt,ZPWanFa.getClubRuleInfo(ruleStr))
- end
-
- return tt;
- end
-
- function getClubMatchRule(arena,isUseName)
- local tt = {}
- if app.club_php:getIsQuanMinSai(app.club_php.clubID) then
- if arena and arena ~= "" then
- isUseName = isUseName or ""
- local arena = json.decode(arena)
- str = "排名赛参与门槛"..tostring(arena.enterHongHua).."排名分"
- table.insert(tt, {name = "", value = {str}})
-
- str = "解散房间最低排名分"..tostring(arena.disHongHua or -500)
- table.insert(tt, {name = "", value = {str}})
- --抽奖区间下午写
- for k,v in pairsByKeys(arena.list) do
- str = "分数>="..tostring(v.min).."分扣除"..tostring(v.score).."排名分"
- table.insert(tt, {name = "", value = {str}})
- end
- else
- table.insert(tt, {name = isUseName, value = {"未设置排名规则"}})
- end
- else
- if arena and arena ~= "" then
- isUseName = isUseName or ""
- local arena = json.decode(arena)
- local str = tostring(arena.numHongHua).."红花=1游戏分"
- table.insert(tt, {name = isUseName, value = {str}})
- str = "最低"..tostring(arena.enterHongHua).."红花可以进房"
- table.insert(tt, {name = "", value = {str}})
- str = "大赢家>="..tostring(arena.prizedGreen).."分送"..tostring(arena.subGreen).."红花"
- table.insert(tt, {name = "", value = {str}})
- if arena.prizedGreen2 and arena.subGreen2 then
- str = "大赢家>="..tostring(arena.prizedGreen2).."分送"..tostring(arena.subGreen2).."红花"
- table.insert(tt, {name = "", value = {str}})
- end
- str = "解散房间红花数"..tostring(arena.disHongHua or -500)
- table.insert(tt, {name = "", value = {str}})
- else
- table.insert(tt, {name = isUseName, value = {"未设置比赛规则"}})
- end
- end
- return tt
- end
-
- function getClubCestRule(arena,isUseName)
- local tt = {}
- if app.club_php:getCestIsOpen(app.club_php.clubID) then
- if arena and arena ~= "" then
- isUseName = isUseName or ""
- local arena = json.decode(arena)
- str = "赛事参与门槛"..tostring(arena.enterHongHua).."比赛分"
- table.insert(tt, {name = "", value = {str}})
-
- str = "解散房间最低比赛分"..tostring(arena.disHongHua or -500)
- table.insert(tt, {name = "", value = {str}})
-
-
- if arena.contributelist then
- for k, v in pairs(arena.contributelist) do
- str = "分数>="..tostring(v.min).."分奖励"..tostring(v.score).."赛点"
- table.insert(tt, {name = "", value = {str}})
- end
- end
-
- if arena.contribute then
- str = "冠军奖励"..tostring(arena.contribute).."赛点"
- table.insert(tt, {name = "", value = {str}})
- end
-
- else
- table.insert(tt, {name = isUseName, value = {"未设置排名规则"}})
- end
- end
- return tt
- end
-
- --获取包间多玩法桌子上显示的信息
- function getClubTableRuleString(gameId, ruleStr,playerNum)
- --判断游戏配置是麻将
- local str =""
- local config=getSubGameConfig(tonumber(gameId))
-
- if config and type(config.wanfaConfig) == "string" then
- local isRequired, wanfa = pcall(require, config.wanfaConfig)
- if isRequired and wanfa and type(wanfa.getClubTableRuleString) == "function" then
- local str = wanfa.getClubTableRuleString(gameId, ruleStr, playerNum)
- return str or ""
- end
- end
-
- if config and (config.belongType==3 or config.belongType==2) then
- str = tostring(playerNum).."人"
- else
- if tonumber(gameId) == 36 then--经典跑得快没有内容显示,显示人数
- str = tostring(playerNum).."人"
- end
- end
-
- --俱乐部切换多玩法桌子显示的玩法
- local jsonData=json.decode(ruleStr)
- if jsonData.startMode == 1 then
- str = "快速成局"
- else
- if tonumber(gameId) == GAME_IDS.PaoDeKuai then
- if jsonData.playerNum == 2 then
- str = str .. "快速成局"
- else
- str = tostring(playerNum) .. "人"
- end
- end
- end
-
- if config and config.belongType==3 then
- local MJWanFa=MJFramework.ImportWanFa("luaScript.SubGameDefine.MaJiang.MJWanFa",gameId)
- str = str..MJWanFa.getClubTableWanFaInfo(ruleStr)
- elseif config and config.belongType==2 then
- local ZPWanFa = ZPFramework.ImportWanFa("luaScript.SubGameDefine.ZiPai.ZPWanFa",gameId)
- str = str..ZPWanFa.getClubTableWanFaInfo(ruleStr)
- end
-
- if tonumber(gameId) == GAME_IDS.PaoDeKuai then
- local PDKDefine = require("luaScript.SubGameDefine.PDKDefine")
- str = str..PDKDefine.getClubTableWanFaInfo(ruleStr)
- elseif tonumber(gameId) == GAME_IDS.NanChongDouDiZhu then
- local wrDdzDefine = require("luaScript.SubGameDefine.Poker.Define_53")
- str = str..wrDdzDefine.getClubTableWanFaInfo(ruleStr)
- elseif tonumber(gameId) == GAME_IDS.BanZiPao then
- local bzpWanFa = require("luaScript.SubGameDefine.PuKe.bzpWanFa")
- str = str..bzpWanFa.getClubTableWanFaString(ruleStr)
- end
-
- return str;
- end
|