local wanfa = {}; -- 规则文本 wanfa.RuleText = { --[1] = { title = "基础规则", content = { "1、游戏人数:3人或2人。", "2、游戏用牌:一副牌去掉大小王、3个2、黑桃A,剩48张牌,每人16张牌。", "3、出牌顺序:逆时针方向出牌,首轮出牌者为持有黑桃3玩家,第二小局出牌者为上一轮获胜者。", }, }, --[2] = --[[{ title = "牌型介绍", content = { "1、单张:任意一张牌,2>A>K>Q>J>10>9>8>7>6>5>4>3。", "2、对子:2张点数相同的牌,A>K>Q>J>10>9>8>7>6>5>4>3。", "3、3带2:3张点数相同的牌带2张牌,带的两张牌不限,A>K>Q>J>10>9>8>7>6>5>4>3。", "4、3带1和3条:只能是在玩家只剩下最后4张和3条同张的情况才允许打出。", "5、顺子:任意5张或者5张以上点数相连的牌,可以从3连到A,到A的顺子最大,无同花顺。2不能出现在顺子中。", "6、连对:2对或者2对以上的点数相连的牌,可以从3连到,A>K>Q>J>10>9>8>7>6>5>4>3。", "7、飞机:点数相连的2个及以上的3同张,可以从3连到A,A>K>Q>J>10>9>8>7>6>5>4>3。", "8、炸弹:4张点数相同的牌,K>Q>J>10>9>8>7>6>5>4>3。", "9、春天:有一家牌全部出完后,其他一家或者两家没有出一张牌。", } },--]] --[3] = --[[{ title = "算分规则", content = { "1、当玩家最后3同张大于其他玩家的3同张的时候可不带牌或者少带牌出完。", "2、最先出完为赢,保单玩家无输赢,输家手上有1张牌计1分,以此类推。", "3、炸弹:其他两位玩家每人-10分,拿炸弹者得分20分。", "4、炸弹被其他玩家炸弹压住时不得分。", "5、春天:被春天者扣分为16*2=32分,有炸弹累加。", } },--]] --[4] = --[[{ title = "用词解释", content = { "1. 庄闲规则:每局都有一个庄家,其它玩家则是闲家,闲家在游戏中下注,庄家不用下注。当一个人抢庄时,则抢庄玩家坐庄,当多人抢庄时,随机一名玩家坐庄,无人抢庄时,则从所有玩家随机一名坐庄。", "2. 亮牌:玩家将手牌量亮出给所有玩家看。", "3. 比牌:庄家跟闲家比牌型大小,按照牌型顺序大小顺序。", "4. 结算:闲家跟庄家一一结算,根据闲家下注分数及双方牌型计算输赢积分。", "5. 如玩家因接电话或有事离线,系统默认下注最小分数。", } },--]] } -- 玩法 -- 必须跟服务器保持一致,增删都需要和server及web确认 wanfa.GameTypes = { Normal = 1, Swz = 2, } -- 聊天快捷语 wanfa.ChatMessages = { [1] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_1.ogg",txt = "不好意思俺刚接了个电话。"}, [2] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_2.ogg",txt = "房间没满房主再找几个嘛!"}, [3] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_3.ogg",txt = "爆发吧我的小宇宙,这把我要通吃!"}, [4] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_4.ogg",txt = "哥这招一柱擎天,稳如泰山!"}, [5] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_5.ogg",txt = "别磨蹭了,时间就是金钱!"}, [6] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_6.ogg",txt = "哎我滴妈呀手气有点旺!"}, [7] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_7.ogg",txt = "把把都是赢你咋不上天!"}, } wanfa.GameTypesStr = { [1] = "经典玩法", [2] = "十五张玩法", } wanfa.GamePlayerCount = { [0] = "2人玩", [1] = "3人玩", [2] = "快速成局", } wanfa.GameWanfa = { [0] = "必须管", [1] = "可不要", } wanfa.BombScore = { [5] = "炸弹5分", [10] = "炸弹10分", } wanfa.CreateParamsMean = { [0x0001] = '红桃10扎鸟', [0x0002] = '可4带3', [0x0004] = '炸弹可拆', [0x0008] = '',--3张,飞机少带接完 [0x0010] = '首局先出黑桃三', [0x0020] = '显示牌的张数', [0x0040] = '第一手必含最小牌', [0x0080] = 'AAA为炸弹', [0x0200] = '3必带2', [0x0400] = '可4带2', [0x0800] = '反春天', } function wanfa.getClubWaFaInfo (ruleStr, jushu) local jsonData = json.decode(ruleStr) local temp = {} if jushu then local jushuText = string.format("%d 局", jushu); table.insert(temp, 1, {name = "局数", value = {jushuText}}) end if jsonData.deductRule and jsonData.deductRule >= 0 then local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费" if specStr ~= "" then table.insert(temp, {name = "房费", value = {specStr}}) end end if jsonData.gamerule and jsonData.gamerule>0 then local specStr = wanfa.GameTypesStr[jsonData.gamerule] or "" if specStr ~= "" then table.insert(temp, {name = "玩法", value = {specStr}}) end end if jsonData.playerNum and jsonData.playerNum>=0 then local specStr = wanfa.GamePlayerCount[jsonData.playerNum] or "" if specStr ~= "" then table.insert(temp, {name = "人数", value = {specStr}}) end end if jsonData.allowPass and jsonData.allowPass >= 0 then local specStr = wanfa.GameWanfa[jsonData.allowPass] or "" if specStr ~= "" then table.insert(temp, {name = "玩法", value = {specStr}}) end end if jsonData.bombScore and jsonData.bombScore >= 0 then local specStr = wanfa.BombScore[jsonData.bombScore] or "" if specStr ~= "" then table.insert(temp, {name = "炸弹", value = {specStr}}) end end local function getRule( rule ) local CreateParamsMean = wanfa.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 getNumBand(rule, 0x0200)>0 then ruleStr = ruleStr..CreateParamsMean[0x0200].." " end if getNumBand(rule, 0x0400)>0 then ruleStr = ruleStr..CreateParamsMean[0x0400].." " end if getNumBand(rule, 0x0800)>0 then ruleStr = ruleStr..CreateParamsMean[0x0800].." " 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(temp, {name = "规则", value = {specStr}}) end end if jsonData.baseMulti and jsonData.baseMulti > 0 then table.insert(temp, {name = "积分倍数", value = {"积分倍数x" .. jsonData.baseMulti}}) end -- if jsonData.forbidProp and jsonData.forbidProp > 0 then -- table.insert(temp, {name = "其他", value = {"屏蔽聊天与互动道具"}}) -- end if jsonData.forbidProp and jsonData.forbidProp > 0 then table.insert(temp, {name = "其他", value = {"屏蔽快捷语与道具"}}) end if jsonData.forbidVoice and jsonData.forbidVoice > 0 then table.insert(temp, {name = "其他", value = {"屏蔽语音"}}) end return temp; end function wanfa.getRuleFromString (gameId, jushu, ruleStr,arena) local str = wanfa.getClubWaFaInfo(ruleStr, jushu) return str end function wanfa.getClubTableRuleString (gameId, ruleStr, playerNum) local str = "" local jsonData=json.decode(ruleStr) if jsonData.playerNum == 2 then str = str .. "快速成局 " else if playerNum then str = str .. tostring(playerNum) .. "人 " else str = str .. tostring(jsonData.playnum) .. "人 " end end return str end return wanfa;