You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 regels
8.1 KiB

  1. local wanfa = {};
  2. -- 规则文本
  3. wanfa.RuleText =
  4. {
  5. --[1] =
  6. {
  7. title = "基础规则",
  8. content =
  9. {
  10. "1、游戏人数:3人或2人。",
  11. "2、游戏用牌:一副牌去掉大小王、3个2、黑桃A,剩48张牌,每人16张牌。",
  12. "3、出牌顺序:逆时针方向出牌,首轮出牌者为持有黑桃3玩家,第二小局出牌者为上一轮获胜者。",
  13. },
  14. },
  15. --[2] =
  16. --[[{
  17. title = "牌型介绍",
  18. content =
  19. {
  20. "1、单张:任意一张牌,2>A>K>Q>J>10>9>8>7>6>5>4>3。",
  21. "2、对子:2张点数相同的牌,A>K>Q>J>10>9>8>7>6>5>4>3。",
  22. "3、3带2:3张点数相同的牌带2张牌,带的两张牌不限,A>K>Q>J>10>9>8>7>6>5>4>3。",
  23. "4、3带1和3条:只能是在玩家只剩下最后4张和3条同张的情况才允许打出。",
  24. "5、顺子:任意5张或者5张以上点数相连的牌,可以从3连到A,到A的顺子最大,无同花顺。2不能出现在顺子中。",
  25. "6、连对:2对或者2对以上的点数相连的牌,可以从3连到,A>K>Q>J>10>9>8>7>6>5>4>3。",
  26. "7、飞机:点数相连的2个及以上的3同张,可以从3连到A,A>K>Q>J>10>9>8>7>6>5>4>3。",
  27. "8、炸弹:4张点数相同的牌,K>Q>J>10>9>8>7>6>5>4>3。",
  28. "9、春天:有一家牌全部出完后,其他一家或者两家没有出一张牌。",
  29. }
  30. },--]]
  31. --[3] =
  32. --[[{
  33. title = "算分规则",
  34. content =
  35. {
  36. "1、当玩家最后3同张大于其他玩家的3同张的时候可不带牌或者少带牌出完。",
  37. "2、最先出完为赢,保单玩家无输赢,输家手上有1张牌计1分,以此类推。",
  38. "3、炸弹:其他两位玩家每人-10分,拿炸弹者得分20分。",
  39. "4、炸弹被其他玩家炸弹压住时不得分。",
  40. "5、春天:被春天者扣分为16*2=32分,有炸弹累加。",
  41. }
  42. },--]]
  43. --[4] =
  44. --[[{
  45. title = "用词解释",
  46. content =
  47. {
  48. "1. 庄闲规则:每局都有一个庄家,其它玩家则是闲家,闲家在游戏中下注,庄家不用下注。当一个人抢庄时,则抢庄玩家坐庄,当多人抢庄时,随机一名玩家坐庄,无人抢庄时,则从所有玩家随机一名坐庄。",
  49. "2. 亮牌:玩家将手牌量亮出给所有玩家看。",
  50. "3. 比牌:庄家跟闲家比牌型大小,按照牌型顺序大小顺序。",
  51. "4. 结算:闲家跟庄家一一结算,根据闲家下注分数及双方牌型计算输赢积分。",
  52. "5. 如玩家因接电话或有事离线,系统默认下注最小分数。",
  53. }
  54. },--]]
  55. }
  56. -- 玩法
  57. -- 必须跟服务器保持一致,增删都需要和server及web确认
  58. wanfa.GameTypes =
  59. {
  60. Normal = 1,
  61. Swz = 2,
  62. }
  63. -- 聊天快捷语
  64. wanfa.ChatMessages =
  65. {
  66. [1] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_1.ogg",txt = "不好意思俺刚接了个电话。"},
  67. [2] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_2.ogg",txt = "房间没满房主再找几个嘛!"},
  68. [3] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_3.ogg",txt = "爆发吧我的小宇宙,这把我要通吃!"},
  69. [4] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_4.ogg",txt = "哥这招一柱擎天,稳如泰山!"},
  70. [5] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_5.ogg",txt = "别磨蹭了,时间就是金钱!"},
  71. [6] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_6.ogg",txt = "哎我滴妈呀手气有点旺!"},
  72. [7] = {oggStandard = "", oggLocal = "res/sound/faceSound/chat_man_7.ogg",txt = "把把都是赢你咋不上天!"},
  73. }
  74. wanfa.GameTypesStr =
  75. {
  76. [1] = "经典玩法",
  77. [2] = "十五张玩法",
  78. }
  79. wanfa.GamePlayerCount = {
  80. [0] = "2人玩",
  81. [1] = "3人玩",
  82. [2] = "快速成局",
  83. }
  84. wanfa.GameWanfa = {
  85. [0] = "必须管",
  86. [1] = "可不要",
  87. }
  88. wanfa.BombScore = {
  89. [5] = "炸弹5分",
  90. [10] = "炸弹10分",
  91. }
  92. wanfa.CreateParamsMean = {
  93. [0x0001] = '红桃10扎鸟',
  94. [0x0002] = '可4带3',
  95. [0x0004] = '炸弹可拆',
  96. [0x0008] = '',--3张,飞机少带接完
  97. [0x0010] = '首局先出黑桃三',
  98. [0x0020] = '显示牌的张数',
  99. [0x0040] = '第一手必含最小牌',
  100. [0x0080] = 'AAA为炸弹',
  101. [0x0200] = '3必带2',
  102. [0x0400] = '可4带2',
  103. [0x0800] = '反春天',
  104. }
  105. function wanfa.getClubWaFaInfo (ruleStr, jushu)
  106. local jsonData = json.decode(ruleStr)
  107. local temp = {}
  108. if jushu then
  109. local jushuText = string.format("%d 局", jushu);
  110. table.insert(temp, 1, {name = "局数", value = {jushuText}})
  111. end
  112. if jsonData.deductRule and jsonData.deductRule >= 0 then
  113. local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
  114. if specStr ~= "" then
  115. table.insert(temp, {name = "房费", value = {specStr}})
  116. end
  117. end
  118. if jsonData.gamerule and jsonData.gamerule>0 then
  119. local specStr = wanfa.GameTypesStr[jsonData.gamerule] or ""
  120. if specStr ~= "" then
  121. table.insert(temp, {name = "玩法", value = {specStr}})
  122. end
  123. end
  124. if jsonData.playerNum and jsonData.playerNum>=0 then
  125. local specStr = wanfa.GamePlayerCount[jsonData.playerNum] or ""
  126. if specStr ~= "" then
  127. table.insert(temp, {name = "人数", value = {specStr}})
  128. end
  129. end
  130. if jsonData.allowPass and jsonData.allowPass >= 0 then
  131. local specStr = wanfa.GameWanfa[jsonData.allowPass] or ""
  132. if specStr ~= "" then
  133. table.insert(temp, {name = "玩法", value = {specStr}})
  134. end
  135. end
  136. if jsonData.bombScore and jsonData.bombScore >= 0 then
  137. local specStr = wanfa.BombScore[jsonData.bombScore] or ""
  138. if specStr ~= "" then
  139. table.insert(temp, {name = "炸弹", value = {specStr}})
  140. end
  141. end
  142. local function getRule( rule )
  143. local CreateParamsMean = wanfa.CreateParamsMean
  144. local ruleStr = ""
  145. if getNumBand(rule, 0x0001)>0 then
  146. ruleStr = ruleStr..CreateParamsMean[0x0001].." "
  147. end
  148. if getNumBand(rule, 0x0002)>0 then
  149. ruleStr = ruleStr..CreateParamsMean[0x0002].." "
  150. end
  151. if getNumBand(rule, 0x0004)>0 then
  152. ruleStr = ruleStr..CreateParamsMean[0x0004].." "
  153. end
  154. -- if getNumBand(rule, 0x0008)>0 then
  155. -- -- ruleStr = ruleStr..CreateParamsMean[0x0008]..","
  156. -- end
  157. if getNumBand(rule, 0x0010)>0 then
  158. ruleStr = ruleStr..CreateParamsMean[0x0010].." "
  159. end
  160. if getNumBand(rule, 0x0020)>0 then
  161. ruleStr = ruleStr..CreateParamsMean[0x0020].." "
  162. end
  163. if getNumBand(rule, 0x0040)>0 then
  164. ruleStr = ruleStr..CreateParamsMean[0x0040].." "
  165. end
  166. if getNumBand(rule, 0x0080)>0 then
  167. ruleStr = ruleStr..CreateParamsMean[0x0080].." "
  168. end
  169. if getNumBand(rule, 0x0200)>0 then
  170. ruleStr = ruleStr..CreateParamsMean[0x0200].." "
  171. end
  172. if getNumBand(rule, 0x0400)>0 then
  173. ruleStr = ruleStr..CreateParamsMean[0x0400].." "
  174. end
  175. if getNumBand(rule, 0x0800)>0 then
  176. ruleStr = ruleStr..CreateParamsMean[0x0800].." "
  177. end
  178. if string.len(ruleStr) > 0 then
  179. ruleStr = string.sub(ruleStr, 1, string.len(ruleStr)-1)
  180. end
  181. return ruleStr
  182. end
  183. if jsonData.specialRule and jsonData.specialRule>=0 then
  184. local specStr = getRule(jsonData.specialRule)
  185. if specStr ~= "" then
  186. table.insert(temp, {name = "规则", value = {specStr}})
  187. end
  188. end
  189. if jsonData.baseMulti and jsonData.baseMulti > 0 then
  190. table.insert(temp, {name = "积分倍数", value = {"积分倍数x" .. jsonData.baseMulti}})
  191. end
  192. -- if jsonData.forbidProp and jsonData.forbidProp > 0 then
  193. -- table.insert(temp, {name = "其他", value = {"屏蔽聊天与互动道具"}})
  194. -- end
  195. if jsonData.forbidProp and jsonData.forbidProp > 0 then
  196. table.insert(temp, {name = "其他", value = {"屏蔽快捷语与道具"}})
  197. end
  198. if jsonData.forbidVoice and jsonData.forbidVoice > 0 then
  199. table.insert(temp, {name = "其他", value = {"屏蔽语音"}})
  200. end
  201. return temp;
  202. end
  203. function wanfa.getRuleFromString (gameId, jushu, ruleStr,arena)
  204. local str = wanfa.getClubWaFaInfo(ruleStr, jushu)
  205. return str
  206. end
  207. function wanfa.getClubTableRuleString (gameId, ruleStr, playerNum)
  208. local str = ""
  209. local jsonData=json.decode(ruleStr)
  210. if jsonData.playerNum == 2 then
  211. str = str .. "快速成局 "
  212. else
  213. if playerNum then
  214. str = str .. tostring(playerNum) .. "人 "
  215. else
  216. str = str .. tostring(jsonData.playnum) .. "人 "
  217. end
  218. end
  219. return str
  220. end
  221. return wanfa;