public List <long> GetMemberList() { string memberStr = FileOptions.GetInstance().GetOptions()["Member"]; if (memberStr == "0") { return(null); } if (member != null) { return(member); } string[] list = memberStr.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries); List <long> output = new List <long>(); for (int i = 0; i < list.Length; ++i) { long num; if (!long.TryParse(list[i], out num)) { ApiModel.CQLog.Warning("MemberListData", "成员列表读取失败,格式不正确!"); return(null); } output.Add(num); } member = output; return(output); }
/// <summary> /// Type=1003 应用被启用<para/> /// 处理 酷Q 的插件启动事件回调 /// </summary> /// <param name="sender">事件的触发对象</param> /// <param name="e">事件的附加参数</param> public void AppEnable(object sender, CQAppEnableEventArgs e) { // 当应用被启用后,将收到此事件。 // 如果酷Q载入时应用已被启用,则在_eventStartup(Type=1001,酷Q启动)被调用后,本函数也将被调用一次。 // 如非必要,不建议在这里加载窗口。(可以添加菜单,让用户手动打开窗口) try { ApiModel.setModel(e.CQApi, e.CQLog); SQLiteManager.GetInstance(); FileOptions.GetInstance(); GuildBattle.InitFile(); DirectoryInfo root = new DirectoryInfo(e.CQApi.AppDirectory); FileInfo[] files = root.GetFiles(); string pattern = @"Data\-(\d+)\.ini"; foreach (FileInfo info in files) { if (Regex.IsMatch(info.Name, pattern)) { Match temp = Regex.Match(info.Name, pattern); GuildBattle.GetInstance(long.Parse(temp.Groups[1].Value)); } } } catch (Exception exception) { e.CQLog.Warning("AppEnable", exception); } }
public static void InitFile() { FileOptions.GetInstance(); if (!File.Exists(ApiModel.CQApi.AppDirectory + "Boss.ini")) { WriteToFile(ApiModel.CQApi.AppDirectory + "Boss.ini", "6000000,8000000,10000000,12000000,20000000"); } }
private void SendHelpTroopMessage(long account, long helper) { if (!FileOptions.GetInstance().CanHelpSignal()) { return; } ApiModel.CQApi.SendPrivateMessage(account, "[" + GuildBattle.GetUserName(group, helper) + "] 代刀中,请注意避免重复登录导致不必要的损失"); }
public static long GetDamageLimit() { if (damageLimit != long.MaxValue) { return(damageLimit); } long output; if (!long.TryParse(FileOptions.GetInstance().GetOptions()["DamageLimit"], out output)) { return(long.MaxValue); } damageLimit = output; return(damageLimit); }
private void SendHelpTroopEndMessage(long account, long helper, bool isSuccess = true) { if (!FileOptions.GetInstance().CanHelpSignal()) { return; } if (isSuccess) { ApiModel.CQApi.SendPrivateMessage(account, "[" + GuildBattle.GetUserName(group, helper) + "] 已完成本次出刀\n(如造成骚扰可屏蔽本窗口对话)"); } else { ApiModel.CQApi.SendPrivateMessage(account, "[" + GuildBattle.GetUserName(group, helper) + "] 已取消本次出刀\n(如造成骚扰可屏蔽本窗口对话)"); } }
//获取彩蛋语句 protected string getEasterEggStr(string room_id) { // 如果未开启开关,则跳出 if (getOptions()["EasterEgg"] == "0") { return(""); } Dictionary <string, string> strDict = FileOptions.GetInstance().GetSentencesOptions(); if (strDict.ContainsKey(room_id)) { return(strDict[room_id].Trim()); } else { return(""); } }
public bool isAdmin(long qq) { string adminStr = FileOptions.GetInstance().GetOptions()["Admin"]; string[] list = adminStr.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < list.Length; ++i) { long num; if (!long.TryParse(list[i], out num)) { ApiModel.CQLog.Warning("AdminData", "管理员列表读取失败,格式不正确!"); return(false); } if (num == 0 || num == qq) { return(true); } } return(false); }
private string GetTreeAdminStr() { string treeAdminStr = FileOptions.GetInstance().GetOptions()["TreeAdmin"]; if (treeAdminStr == "0" || treeAdminStr == "") { return(""); } string[] list = treeAdminStr.Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries); string output = ""; for (int i = 0; i < list.Length; ++i) { long num; if (!long.TryParse(list[i], out num)) { ApiModel.CQLog.Warning("TreeAdminData", "挂树通知列表读取失败,格式不正确!"); return(""); } output += "[CQ:at,qq=" + num + "] "; } return(output); }
public void CQStartup(object sender, CQStartupEventArgs e) { ApiModel.setModel(e.CQApi, e.CQLog); FileOptions.GetInstance(); }
protected Dictionary <string, string> getOptions() { return(FileOptions.GetInstance().GetOptions()); }
public void GroupMessage(object sender, CQGroupMessageEventArgs e) { try { if (e.IsFromAnonymous) { e.Handler = false; return; } if (e.Message.Text.Contains("#启用公会战工具") && isAdmin(e)) { if (GuildBattle.GetInstance(e.FromGroup.Id).GetActive()) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "工具已启用,该指令无效!"); } //else if (GuildBattle.GetInstance(e.FromGroup.Id).GetGroup() != -1) e.CQApi.SendGroupMessage(e.FromGroup.Id, "已在其它群启用工具,请先禁用!"); else { GuildBattle.GetInstance(e.FromGroup.Id).SetActive(true); e.CQApi.SendGroupMessage(e.FromGroup.Id, "已成功启用!"); } e.Handler = true; return; } if (e.Message.Text.Equals("#help")) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "[指令列表]\n" + "https://docs.qq.com/sheet/DYXBDZ1RmRXdXR0dH"); e.Handler = true; return; } // 未启用公会战工具时,拦截以下指令 if (!GuildBattle.GetInstance(e.FromGroup.Id).GetActive()) { e.Handler = false; return; } if (e.Message.Text.Contains("#禁用公会战工具") && isAdmin(e)) { if (!GuildBattle.GetInstance(e.FromGroup.Id).GetActive()) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "工具已禁用,该指令无效!"); } else { GuildBattle.GetInstance(e.FromGroup.Id).SetActive(false); e.CQApi.SendGroupMessage(e.FromGroup.Id, "已成功禁用!"); } e.Handler = true; return; } if (e.Message.Text.Contains("#重置公会战数据") && isAdmin(e)) { // 重置BOSS GuildBattle.GetInstance(e.FromGroup.Id).SetFrequency(1, 1); // 清空出刀 GuildBattle.GetInstance(e.FromGroup.Id).ClearBattleUser(); // 清空留言 GuildBattle.GetInstance(e.FromGroup.Id).ClearMessage(); // 清空预约 GuildBattle.GetInstance(e.FromGroup.Id).ClearSubscribe(); e.Handler = true; return; } if (e.Message.Text.Equals("公会战状态")) { List <string> logs = SQLiteManager.GetInstance().GetLogs(e.FromGroup.Id); string text = "【日志记录】"; for (int i = 0; i < logs.Count; ++i) { text += "\n" + logs[i]; } text += "\n\n" + "【战斗列表】" + "\n" + GuildBattle.PrintList(e.FromGroup.Id, GuildBattle.GetInstance(e.FromGroup.Id).GetBattleUser()); text += "\n\n" + "【挂树列表】" + "\n" + GuildBattle.PrintList(e.FromGroup.Id, GuildBattle.GetInstance(e.FromGroup.Id).GetTreeUser()); e.CQApi.SendGroupMessage(e.FromGroup.Id, text); e.Handler = true; return; } if (e.Message.Text.Equals("出刀列表")) { string text = "【战斗列表】" + "\n" + GuildBattle.PrintList(e.FromGroup.Id, GuildBattle.GetInstance(e.FromGroup.Id).GetBattleUser()); e.CQApi.SendGroupMessage(e.FromGroup.Id, text); e.Handler = true; return; } if (e.Message.Text.Equals("挂树列表")) { string text = "【挂树列表】" + "\n" + GuildBattle.PrintList(e.FromGroup.Id, GuildBattle.GetInstance(e.FromGroup.Id).GetTreeUser()); e.CQApi.SendGroupMessage(e.FromGroup.Id, text); e.Handler = true; return; } if (e.Message.Text.Equals("我挂树了") || e.Message.Text.Equals("救救救") || e.Message.Text.Equals("申请挂树")) { GuildBattle.GetInstance(e.FromGroup.Id).AddTreeUser(e.FromQQ.Id); e.Handler = true; return; } if ((e.Message.Text.StartsWith("他挂树了 [CQ:at,qq=") || e.Message.Text.StartsWith("他挂树了[CQ:at,qq="))) { long qq = GetOperateQQ(e.Message.Text); GuildBattle.GetInstance(e.FromGroup.Id).AddTreeUser(qq); e.Handler = true; return; } if (e.Message.Text.Contains("我去去就来") || e.Message.Text.Equals("申请出刀")) { GuildBattle.GetInstance(e.FromGroup.Id).AddBattleUser(e.FromQQ.Id); e.Handler = true; return; } if ((e.Message.Text.StartsWith("申请出刀 [CQ:at,qq=") || e.Message.Text.StartsWith("代刀中 [CQ:at,qq="))) { long qq = GetOperateQQ(e.Message.Text); GuildBattle.GetInstance(e.FromGroup.Id).AddBattleUser(qq, e.FromQQ.Id); e.Handler = true; return; } if ((e.Message.Text.StartsWith("取消挂树 [CQ:at,qq=") || e.Message.Text.StartsWith("取消挂树[CQ:at,qq="))) { long qq = GetOperateQQ(e.Message.Text); GuildBattle.GetInstance(e.FromGroup.Id).RemoveTreeUser(qq); e.Handler = true; return; } if ((e.Message.Text.StartsWith("取消出刀 [CQ:at,qq=") || e.Message.Text.StartsWith("取消出刀[CQ:at,qq="))) { long qq = GetOperateQQ(e.Message.Text); GuildBattle.GetInstance(e.FromGroup.Id).RemoveBattleUser(qq, e.FromQQ.Id); e.Handler = true; return; } if (e.Message.Text.Equals("取消挂树")) { GuildBattle.GetInstance(e.FromGroup.Id).RemoveTreeUser(e.FromQQ.Id); e.Handler = true; return; } if (e.Message.Text.Equals("取消出刀")) { GuildBattle.GetInstance(e.FromGroup.Id).RemoveBattleUser(e.FromQQ.Id, e.FromQQ.Id); e.Handler = true; return; } if ((e.Message.Text.StartsWith("伤害 [CQ:at,qq=") || e.Message.Text.StartsWith("修改伤害 [CQ:at,qq="))) { long qq = GetOperateQQ(e.Message.Text); string[] temp = e.Message.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int troop_num; long damage; if (temp.Length != 4 || !int.TryParse(temp[2], out troop_num) || !long.TryParse(temp[3], out damage)) { e.CQApi.SendGroupMessage(e.FromGroup, "输入格式与要求不符!"); e.Handler = true; return; } if (e.Message.Text.StartsWith("修改伤害 [CQ:at,qq=")) { GuildBattle.GetInstance(e.FromGroup.Id).PushDamage(qq, troop_num, damage, true); } else { GuildBattle.GetInstance(e.FromGroup.Id).PushDamage(qq, troop_num, damage, false, e.FromQQ.Id); } e.Handler = true; return; } if (e.Message.Text.StartsWith("伤害 ") || e.Message.Text.StartsWith("修改伤害 ")) { string[] temp = e.Message.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int troop_num; long damage; if (temp.Length != 3 || !int.TryParse(temp[1], out troop_num) || !long.TryParse(temp[2], out damage)) { e.CQApi.SendGroupMessage(e.FromGroup, "输入格式与要求不符!"); e.Handler = true; return; } if (e.Message.Text.StartsWith("修改伤害 ")) { GuildBattle.GetInstance(e.FromGroup.Id).PushDamage(e.FromQQ.Id, troop_num, damage, true); } else { GuildBattle.GetInstance(e.FromGroup.Id).PushDamage(e.FromQQ.Id, troop_num, damage, false); } e.Handler = true; return; } if (e.Message.Text.StartsWith("设置BOSS ") && isAdmin(e)) { string[] temp = e.Message.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); int frequency, boss_num; if (temp.Length != 3 || !int.TryParse(temp[1], out frequency) || !int.TryParse(temp[2], out boss_num)) { e.CQApi.SendGroupMessage(e.FromGroup, "输入格式与要求不符!"); e.Handler = true; return; } GuildBattle.GetInstance(e.FromGroup.Id).SetFrequency(frequency, boss_num); e.Handler = true; return; } if (e.Message.Text.StartsWith("设置血量 ") && isAdmin(e)) { string[] temp = e.Message.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (temp.Length != 2) { e.CQApi.SendGroupMessage(e.FromGroup, "输入格式与要求不符!"); } long blood; if (!long.TryParse(temp[1], out blood)) { e.CQApi.SendGroupMessage(e.FromGroup, "输入格式与要求不符!"); } GuildBattle.GetInstance(e.FromGroup.Id).SetDamage(blood); e.Handler = true; return; } if (e.Message.Text.Equals("清空出刀") && isAdmin(e)) { GuildBattle.GetInstance(e.FromGroup.Id).ClearBattleUser(); e.CQApi.SendGroupMessage(e.FromGroup.Id, "战斗列表已清空!"); e.Handler = true; return; } if (e.Message.Text.Equals("清空挂树") && isAdmin(e)) { GuildBattle.GetInstance(e.FromGroup.Id).ClearTreeUser(); e.CQApi.SendGroupMessage(e.FromGroup.Id, "挂树列表已清空!"); e.Handler = true; return; } if (e.Message.Text.StartsWith("今日伤害 [CQ:at,qq=") && isAdmin(e) && !FileOptions.GetInstance().IsDisableAt()) { long qq = GetOperateQQ(e.Message.Text); e.CQApi.SendPrivateMessage(e.FromQQ.Id, GetTodayDamage(e.FromGroup.Id, qq)); //e.CQApi.SendPrivateMessage(qq, "[" + GuildBattle.GetUserName(e.FromGroup.Id, e.FromQQ.Id) + "] 查询了您的今日伤害数据"); e.CQApi.SendGroupMessage(e.FromGroup.Id, "相关数据已通过私聊发送!"); e.Handler = true; return; } if (Regex.IsMatch(e.Message.Text, @"今日伤害 (\d+)") && isAdmin(e)) { Match match = Regex.Match(e.Message.Text, @"今日伤害 (\d+)"); long qq; if (!long.TryParse(match.Groups[1].Value, out qq)) { return; } e.CQApi.SendPrivateMessage(e.FromQQ.Id, GetTodayDamage(e.FromGroup.Id, qq)); e.CQApi.SendPrivateMessage(qq, "[" + GuildBattle.GetUserName(e.FromGroup.Id, e.FromQQ.Id) + "] 查询了您的今日伤害数据"); e.CQApi.SendGroupMessage(e.FromGroup.Id, "相关数据已通过私聊发送!"); e.Handler = true; return; } if (e.Message.Text.Equals("今日伤害")) { e.CQApi.SendGroupMessage(e.FromGroup.Id, GetTodayDamage(e.FromGroup.Id, e.FromQQ.Id)); e.Handler = true; return; } if (e.Message.Text.StartsWith("查看总伤害 [CQ:at,qq=") && isAdmin(e) && !FileOptions.GetInstance().IsDisableAt()) { long qq = GetOperateQQ(e.Message.Text); e.CQApi.SendPrivateMessage(e.FromQQ.Id, GetRecentDaysDamages(e.FromGroup.Id, qq)); //e.CQApi.SendPrivateMessage(qq, "[" + GuildBattle.GetUserName(e.FromGroup.Id, e.FromQQ.Id) + "] 查询了您的今日伤害数据"); e.CQApi.SendGroupMessage(e.FromGroup.Id, "相关数据已通过私聊发送!"); e.Handler = true; return; } if (Regex.IsMatch(e.Message.Text, @"查看总伤害 (\d+)") && isAdmin(e)) { Match match = Regex.Match(e.Message.Text, @"查看总伤害 (\d+)"); long qq; if (!long.TryParse(match.Groups[1].Value, out qq)) { return; } e.CQApi.SendPrivateMessage(e.FromQQ.Id, GetRecentDaysDamages(e.FromGroup.Id, qq)); e.CQApi.SendPrivateMessage(qq, "[" + GuildBattle.GetUserName(e.FromGroup.Id, e.FromQQ.Id) + "] 查询了您的今日伤害数据"); e.CQApi.SendGroupMessage(e.FromGroup.Id, "相关数据已通过私聊发送!"); e.Handler = true; return; } if (e.Message.Text.Equals("查看总伤害")) { e.CQApi.SendGroupMessage(e.FromGroup.Id, GetRecentDaysDamages(e.FromGroup.Id, e.FromQQ.Id)); e.Handler = true; return; } if (e.Message.Text.Equals("查看公会总伤害") && isAdmin(e)) { e.CQApi.SendGroupMessage(e.FromGroup.Id, GetRecentDaysGuildTotalDamages(e.FromGroup.Id)); e.Handler = true; return; } if (e.Message.Text.Equals("出刀统计") && isAdmin(e)) { e.CQApi.SendGroupMessage(e.FromGroup, BattleStatistics(e)); e.Handler = true; return; } if (e.Message.Text.Equals("代刀统计") && isAdmin(e)) { e.CQApi.SendGroupMessage(e.FromGroup, GuildBattle.GetInstance(e.FromGroup.Id).GetHelpTroopNum()); e.Handler = true; return; } if (e.Message.Text.Equals("查看留言板") || e.Message.Text.Equals("查看留言")) { string output = "【留言板】"; Dictionary <long, string> messages = new Dictionary <long, string>(GuildBattle.GetInstance(e.FromGroup.Id).GetMessages()); //简单粗暴解决并发问题,有待优化 if (messages == null || messages.Count == 0) { output += "\n无记录"; } else { foreach (KeyValuePair <long, string> kvp in messages) { output += "\n" + "[" + GuildBattle.GetUserName(e.FromGroup.Id, kvp.Key) + "] " + kvp.Value; } } e.CQApi.SendGroupMessage(e.FromGroup, output); e.Handler = true; return; } if (e.Message.Text.StartsWith("留言 ")) { string[] temp = e.Message.Text.Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries); string addMessage = Regex.Replace(temp[1], @"\[CQ[^\s\]]+\]", ""); GuildBattle.GetInstance(e.FromGroup.Id).AddMessage(e.FromQQ.Id, addMessage.Trim()); e.CQApi.SendGroupMessage(e.FromGroup.Id, "设置留言成功!"); e.Handler = true; return; } if (e.Message.Text.Equals("删除留言") || e.Message.Text.Equals("取消留言")) { GuildBattle.GetInstance(e.FromGroup.Id).RemoveMessage(e.FromQQ.Id); e.CQApi.SendGroupMessage(e.FromGroup.Id, "删除留言成功!"); e.Handler = true; return; } if (e.Message.Text.Equals("清空留言") && isAdmin(e)) { GuildBattle.GetInstance(e.FromGroup.Id).ClearMessage(); e.CQApi.SendGroupMessage(e.FromGroup.Id, "已成功清空所有留言!"); e.Handler = true; return; } if (e.Message.Text.StartsWith("预约 ")) { string[] temp = e.Message.Text.Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries); int boss_num = 0; if (!int.TryParse(temp[1], out boss_num) || boss_num <1 || boss_num> GuildBattle.BOSS_MAX) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "参数错误!"); e.Handler = true; return; } if (GuildBattle.GetInstance(e.FromGroup.Id).AddSubscribe(e.FromQQ.Id, boss_num)) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "已成功为[CQ:at,qq=" + e.FromQQ.Id.ToString() + "] 预约第" + temp[1] + "号BOSS" + "\n" + "注:只能同时预约一个BOSS,多次预约的数据将被覆盖"); } else { e.CQApi.SendGroupMessage(e.FromGroup.Id, "当前已经是第" + temp[1] + "号BOSS,预约无效"); } e.Handler = true; return; } if (e.Message.Text.Equals("取消预约")) { GuildBattle.GetInstance(e.FromGroup.Id).RemoveSubscribe(e.FromQQ.Id); e.CQApi.SendGroupMessage(e.FromGroup.Id, "取消成功!"); e.Handler = true; return; } if (e.Message.Text.Equals("清空预约") && isAdmin(e)) { GuildBattle.GetInstance(e.FromGroup.Id).ClearSubscribe(); e.CQApi.SendGroupMessage(e.FromGroup.Id, "已成功清空所有预约!"); e.Handler = true; return; } if (e.Message.Text.Equals("查看预约") || e.Message.Text.Equals("预约列表")) { List <string> list = GuildBattle.GetInstance(e.FromGroup.Id).GetSubscribeList(); string text = "【预约列表】"; for (int i = 0; i < list.Count; ++i) { text += "\n" + list[i]; } if (list.Count == 0) { text += "\n无记录"; } e.CQApi.SendGroupMessage(e.FromGroup.Id, text); e.Handler = true; return; } if (e.Message.Text.Equals("状态")) { e.CQApi.SendGroupMessage(e.FromGroup.Id, GuildBattle.GetInstance(e.FromGroup.Id).GetBossStatus()); e.Handler = true; return; } if (e.Message.Text.ToUpper().Equals("申请SL") || e.Message.Text.ToUpper().StartsWith("申请SL [CQ:at,qq=", true, null)) { long qq = e.FromQQ.Id; if (e.Message.Text.ToUpper().StartsWith("申请SL [CQ:at,qq=", true, null)) { qq = GetOperateQQ(e.Message.Text); } if (GuildBattle.GetInstance(e.FromGroup.Id).SetSL(qq)) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "今日SL次数使用状态已记录!\n[今日SL使用状态] 已使用\n[使用时间] " + SQLiteManager.ConvertIntDateTime(SQLiteManager.GetTimeStamp())); } else { e.CQApi.SendGroupMessage(e.FromGroup.Id, "今日SL次数已用完!指令无效!"); } e.Handler = true; return; } if (e.Message.Text.ToUpper().Equals("撤销SL") || e.Message.Text.ToUpper().StartsWith("撤销SL [CQ:at,qq=", true, null)) { long qq = e.FromQQ.Id; if (e.Message.Text.ToUpper().StartsWith("撤销SL [CQ:at,qq=", true, null)) { qq = GetOperateQQ(e.Message.Text); } if (GuildBattle.GetInstance(e.FromGroup.Id).RemoveSL(qq)) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "今日SL使用状态已成功撤销!\n[今日SL使用状态] 未使用\n[使用时间] 无"); } else { e.CQApi.SendGroupMessage(e.FromGroup.Id, "今日SL次数仍未被使用!指令无效!"); } e.Handler = true; return; } if (e.Message.Text.ToUpper().Equals("查询SL") || e.Message.Text.ToUpper().StartsWith("查询SL [CQ:at,qq=", true, null)) { long qq = e.FromQQ.Id; if (e.Message.Text.ToUpper().StartsWith("查询SL [CQ:at,qq=", true, null)) { qq = GetOperateQQ(e.Message.Text); } long checkTime = GuildBattle.GetInstance(e.FromGroup.Id).GetSLStatus(qq); if (checkTime > -1) { e.CQApi.SendGroupMessage(e.FromGroup.Id, "[今日SL使用状态] 已使用\n[使用时间] " + SQLiteManager.ConvertIntDateTime(checkTime)); } else { e.CQApi.SendGroupMessage(e.FromGroup.Id, "[今日SL使用状态] 未使用\n[使用时间] 无"); } e.Handler = true; return; } } catch (Exception exception) { e.CQLog.Warning("GroupMessage", exception); } }
public static string GetSignChar() { return(FileOptions.GetInstance().GetOptions()["MemberChar"]); }
public void PushDamage(long qq, int troop_num, long damage, bool can_modify = false, long troop_operator = -1) { if (troop_num > MAX_TROOP || troop_num < 1) { ApiModel.CQApi.SendGroupMessage(group, "输入的队伍编号不正确,应为1~3(补刀可填4~6)!"); return; } if (damage >= GetDamageLimit()) { ApiModel.CQApi.SendGroupMessage(group, "输入伤害超出系统限制(" + GetDamageLimit().ToString() + ")!"); return; } if (data.battleUser.Contains(qq)) { data.battleUser.Remove(qq); } if (data.treeUser.Contains(qq)) { data.treeUser.Remove(qq); } if (FileOptions.GetInstance().CanHelpSignal() && troop_operator > 0) { SendHelpTroopEndMessage(qq, troop_operator); } long addDamage; if (can_modify) { addDamage = SQLiteManager.GetInstance().ModifyDamage(group, qq, troop_num, damage, GetBossLessDamage(), data.frequency, data.bossNumber); } else { bool isLastTroop = (damage >= GetBossLessDamage()); if (SQLiteManager.GetInstance().CreateDamage(group, qq, troop_num, Min(damage, GetBossLessDamage()), data.frequency, data.bossNumber, troop_operator, isLastTroop, SQLiteManager.GetInstance().IsRemiburseTroopToday(group, qq))) { addDamage = long.MinValue; } else { addDamage = 0; //指令无效 } } string text = ""; if (addDamage == long.MinValue) // 新增伤害 { data.allDamage += Min(damage, GetBossLessDamage()); data.damage += damage; SQLiteManager.GetInstance().AddLog(group, "[" + GetUserName(group, qq) + "] 的第" + troop_num.ToString() + "队对第" + data.frequency.ToString() + "周目 " + data.bossNumber.ToString() + "号BOSS造成了" + damage.ToString() + "伤害"); text += "[第" + data.frequency.ToString() + "周目 " + data.bossNumber.ToString() + "号BOSS]"; text += "\n" + "[" + GetUserName(group, qq) + "] 的第" + troop_num.ToString() + "队共造成了" + damage.ToString() + "伤害"; } else if (addDamage != 0) // 修改伤害 { data.allDamage += addDamage; CaculateFrequency(); SQLiteManager.GetInstance().AddLog(group, "[" + GetUserName(group, qq) + "] 将第" + troop_num.ToString() + "队造成的伤害由" + (damage - addDamage).ToString() + "修改为" + damage.ToString()); text += "[第" + data.frequency.ToString() + "周目 " + data.bossNumber.ToString() + "号BOSS]"; text += "\n" + "[" + GetUserName(group, qq) + "] 将第" + troop_num.ToString() + "队造成的伤害由" + (damage - addDamage).ToString() + "修改为" + damage.ToString(); } else { if (can_modify) { text += "您本次的伤害数据已经被正确记录!该指令无效!"; } else { text += "您本队伍的伤害数据已有记录!该指令无效!"; } } if (data.damage >= bossdata[data.bossNumber - 1]) { SQLiteManager.GetInstance().AddLog(group, "第" + data.frequency.ToString() + "周目 " + data.bossNumber.ToString() + "号BOSS已被击败"); data.damage = 0; data.treeUser.Clear(); data.battleUser.Clear(); data.bossNumber += 1; if (data.bossNumber > BOSS_MAX) { data.bossNumber = 1; data.frequency += 1; } text += "\n" + "该BOSS已被击败,下一个BOSS为:" + "\n" + "第" + data.frequency.ToString() + "周目 " + data.bossNumber.ToString() + "号BOSS HP: " + GetBossLessDamage().ToString(); ApiModel.CQApi.SendGroupMessage(group, text); string atStr = GetSubscribeStr(data.bossNumber); if (atStr != "") { ApiModel.CQApi.SendGroupMessage(group, "[BOSS预约提醒] 您预约的BOSS已出现,请及时出刀\n" + atStr); } } else { text += "\n" + "当前BOSS剩余血量: " + GetBossLessDamage().ToString(); ApiModel.CQApi.SendGroupMessage(group, text); } SaveData(); }