GenshinUser GetUser(EcUser user, GroupClient group) { string id = group.Group.Id + "_" + user.QQId; if (users.ContainsKey(id)) { return(users[id]); } GenshinUser _user = new GenshinUser(); _user.EcUser = user; users.Add(id, _user); return(users[id]); }
ToolUser GetUser(EcUser user, GroupClient group) { string id = group.Group.Id + "_" + user.QQId; if (users.ContainsKey(id)) { return(users[id]); } ToolUser _user = new ToolUser() { EcUser = user }; users.Add(id, _user); return(users[id]); }
public ToolCommand() { Reg["MD5加密"] = (v, content) => { EcUser user = CommandSystem.GetModule(typeof(EcommerceCommand)).GetPlugInter("get").Invoke(content); if (user.Gold < 100) { return($"{user.QQName}呀,你的钱,还不够呀!"); } user.Gold -= 100; MD5 md5 = MD5.Create(); byte[] md5buffer = md5.ComputeHash(Encoding.UTF8.GetBytes(v)); string str = ""; foreach (byte b in md5buffer) { str += b.ToString("x2"); } return($"已扣除[{user.QQName}]100金\r\n[{v}]的加密结果是[{str}]"); }; Reg["算卦"] = (v, content) => { EcUser user = CommandSystem.GetModule(typeof(EcommerceCommand)).GetPlugInter("get").Invoke(content); ToolUser tooluser = GetUser(user, content.FromGroup); if (DateTime.Now.ToString("yyyy-MM-dd") == tooluser.LastGua.ToString("yyyy-MM-dd")) { return($"{user.QQName}施主!今天你已经算过卦啦!明天再来吧!"); } if (user.Gold < 100) { return($"{user.QQName}施主!您的香火钱不够呀!"); } tooluser.LastGua = DateTime.Now; user.Gold -= 100; return(YiJing.GetGua()); }; Reg["算命"] = Reg["算卦"]; Reg["抽签"] = Reg["算卦"]; }
public GenshinCommand() { Reg["原神抽卡"] = (v, content) => { return("原神抽卡系统v0.00001\n" + "单次抽卡只需60金币! 10连仅需550金币\n" + "[可选指令]\n" + "#原神单抽 卡池名称\n" + "#原神十连 卡池名称\n" + "[可选卡池]\n" + "常驻,角色,武器\n" + "[最新资讯]\n" + "新角色阿贝多UP 火热好评中!"); }; Reg["原神单抽"] = (v, content) => { EcUser user = CommandSystem.GetModule(typeof(EcommerceCommand)).GetPlugInter("get").Invoke(content); GenshinUser genshinuser = GetUser(user, content.FromGroup); if (user.Gold < 60) { return($"{user.QQName}呀,你的钱,还不够呀!"); } int pool = GetPool(v); if (pool < 0) { return($"{user.QQName}呀,没有这个卡池,可选卡池为[常驻,角色,武器]!"); } user.Gold -= 60; var item = Gacha(pool, genshinuser); string result = $"{user.QQName} 本次抽到的结果如下\n"; result += item.GetFullName() + "\n"; if (item.Level == "5") { result += "哇!单抽出奇迹啊!"; } else if (item.Level == "4" && item.Type == "character") { result += "单抽出4星角色血赚!"; } else { result += "很遗憾..什么都没出,不过单抽也是正常的嘛...不试试10连么?"; } return(result); }; Reg["原神十连"] = (v, content) => { EcUser user = CommandSystem.GetModule(typeof(EcommerceCommand)).GetPlugInter("get").Invoke(content); GenshinUser genshinuser = GetUser(user, content.FromGroup); if (user.Gold < 550) { return($"{user.QQName}呀,你的钱,还不够呀!"); } int pool = GetPool(v); if (pool < 0) { return($"{user.QQName}呀,没有这个卡池,可选卡池为[常驻,角色,武器]!"); } user.Gold -= 550; var items = Gacha10(pool, genshinuser); string result = $"{user.QQName} 本次抽到的10连如下\n"; bool has4char = false; bool has5 = false; foreach (var item in items) { result += item.GetFullName() + "\n"; if (item.Level == "4" && item.Type == "character") { has4char = true; } else if (item.Level == "5") { has5 = true; } } if (has5) { result += "哇!你的运气不错哦~"; } else if (has4char) { result += "嘛~ 出了4星角色也不亏啦"; } else { result += "很遗憾..什么都没出"; } return(result); }; }