You need to sign in before continuing.

Commit 850c54f569826ca5bdfc6cd91fdd076ea0ed81fb

Authored by liuzujun
1 parent 814d9753

抽卡概率明示相关

.gitignore
... ... @@ -3,3 +3,4 @@ dump.rdb
3 3 .DS_Store
4 4 src/.idea
5 5 *.pyc
  6 +.idea/
... ...
src/actions/GmAction.lua
... ... @@ -1101,4 +1101,39 @@ function _M.do_lua(role, pms)
1101 1101 return "成功"
1102 1102 end
1103 1103  
  1104 +function _M.getDrawHeroPro(role, pms)
  1105 + -- 普池 10 up池 207 心愿单 20
  1106 + local poolDict = {
  1107 + [10] = "普通卡池",
  1108 + [207] = "UP卡池",
  1109 + [20] = "心愿单",
  1110 + }
  1111 + local result = {}
  1112 + for k,v in poolDict do
  1113 + local unit = csvdb["build_unit"][k]
  1114 + if unit then
  1115 + local w1 = unit["rare1"] or 0
  1116 + local w2 = unit["rare2"] or 0
  1117 + local w3 = unit["rare3"] or 0
  1118 + local up = unit["up_ssr_weight"] or 0
  1119 + local total = w1 + w2 + w3
  1120 + if total > 0 then
  1121 + local p1 = w1 / total
  1122 + local p2 = w2 / total
  1123 + local p3 = w3 / total
  1124 + local tmp = {}
  1125 + tmp["p1"] = p1
  1126 + tmp["p2"] = p2
  1127 + tmp["p3"] = p3
  1128 + tmp["up"] = up
  1129 + result[v] = tmp
  1130 + end
  1131 + end
  1132 + end
  1133 +
  1134 + local ret = redisproxy:lrange("drawHeroRecord", 0, -1)
  1135 + result["history"] = ret
  1136 + json.encode(result)
  1137 +end
  1138 +
1104 1139 return _M
1105 1140 \ No newline at end of file
... ...
src/actions/HeroAction.lua
... ... @@ -1034,6 +1034,28 @@ function _M.drawHeroRpc(agent, data)
1034 1034 -- 广播获得ssr英雄
1035 1035 local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")}
1036 1036 mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf))
  1037 + local record = {}
  1038 + record["uid"] = role:getProperty("uid")
  1039 + record["serverId"] = skynet.getenv("servId")
  1040 + local function userNick(name)
  1041 + local t = {}
  1042 + local index = 0
  1043 + for _, v in utf8.codes(name) do
  1044 + if index == 0 then
  1045 + table.insert(t, utf8.char(v))
  1046 + else
  1047 + table.insert(t, '*')
  1048 + end
  1049 + index = index + 1
  1050 + end
  1051 + return table.concat(t, '')
  1052 + end
  1053 +
  1054 + record["nick"] = userNick(role:getProperty("name"))
  1055 + record["hero"] = itemData.name
  1056 + record["quality"] = itemData.quality
  1057 +
  1058 + redisproxy:lpush("drawHeroRecord", json.encode(record))
1037 1059 end
1038 1060 end
1039 1061  
... ...