From ca4a7fa406324e30866e01babf78990926d8bdca Mon Sep 17 00:00:00 2001 From: Zhao Zuohong Date: Mon, 14 Aug 2023 12:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=88=E7=8E=87=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/riic_report_analysis.py | 80 ++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/apps/riic_report_analysis.py b/apps/riic_report_analysis.py index 8bee06a..9c638f6 100644 --- a/apps/riic_report_analysis.py +++ b/apps/riic_report_analysis.py @@ -35,20 +35,32 @@ class RIICReportAnalysis: err_msg += "千梵 243烟火 单推狮蝎\n" err_msg += "琉璃 243-153" + use_tequila = False + if not card: await chain.onebot_reply(Text(err_msg)) return elif "153" in card or "243" in card: - await chain.onebot_reply(Text("3电站,龙舌兰")) + use_tequila = True elif "252" in card: if m := re.search(r"([1-3][1-3])贸", card): - await chain.onebot_reply(Text(f"252,贸易站等级是{m.group(1)}")) + if "3" in m.group(1): + if m.group(1) != "33": + await chain.onebot_reply(Text("暂不支持此类基建布局")) + return + else: + use_tequila = True else: await chain.onebot_reply(Text(err_msg)) return elif "342" in card: if m := re.search(r"([1-3][1-3][1-3])贸", card): - await chain.onebot_reply(Text(f"342,贸易站等级是{m.group(1)}")) + if "3" in m.group(1): + if m.group(1) != "333": + await chain.onebot_reply(Text("暂不支持此类基建布局")) + return + else: + use_tequila = True else: await chain.onebot_reply(Text(err_msg)) return @@ -86,14 +98,76 @@ class RIICReportAnalysis: exp_list.sort(key=lambda x: x[0]) output = "" + lmb_avg = 0 + order_avg = 0 + gold_avg = 0 + exp_avg = 0 + external_gold = 5000 try: for i in range(len(date_list)): + lmb_avg += int(lmb_list[2 * i][1]) + order_avg += int(lmb_list[2 * i + 1][1]) + gold_avg += int(gold_list[i][1]) + exp_avg += int(exp_list[i][1]) + output += f"【{date_list[i][1]}】\n" output += f"💵 {lmb_list[2 * i][1]}订单({lmb_list[2 * i + 1][1]})\n" output += f"🧈 {gold_list[i][1]}赤金\n" output += f"📼 {exp_list[i][1]}经验\n\n" + lmb_avg /= len(date_list) + order_avg /= len(date_list) + gold_avg /= len(date_list) + exp_avg /= len(date_list) + + if use_tequila: + trading_efficiency = lmb_avg / 1.62 / 500 * 70.138 / 24 / 60 + gold_by_e = trading_efficiency * 0.07 * 24 * 60 / 72 * 500 + balanced_gold_by_e = lmb_avg - external_gold - gold_by_e + overflow_gold_by_e = gold_avg - balanced_gold_by_e + more_exp_by_e = overflow_gold_by_e * 0.8 + balanced_exp_by_e = exp_avg + more_exp_by_e + lmb_exp_ratio_by_e = (lmb_avg + 43483) / (balanced_exp_by_e + 36284) + total_by_e = lmb_avg + balanced_exp_by_e + + gold_by_order = order_avg * 0.2 * 500 + balanced_gold_by_order = lmb_avg - external_gold - gold_by_order + overflow_gold_by_order = gold_avg - balanced_gold_by_order + more_exp_by_order = overflow_gold_by_order * 0.8 + balanced_exp_by_order = exp_avg + more_exp_by_order + lmb_exp_ratio_by_order = (lmb_avg + 43483) / ( + balanced_exp_by_order + 36284 + ) + total_by_order = lmb_avg + balanced_exp_by_order + + output += "====计算结果====\n\n" + output += f"订单平均:{lmb_avg:.0f}\n\n" + output += "-----效率算法-----\n" + output += f"贸易效率:{trading_efficiency * 100:.0f}%\n" + output += f"等效赤金:{gold_by_e:.0f}\n" + output += f"经验调平:{balanced_exp_by_e:.0f}\n" + output += f"钱书比例:{lmb_exp_ratio_by_e:.2f}\n" + output += f"调平总和:{total_by_e:.0f}\n\n" + output += "-----数量算法-----\n" + output += f"等效赤金:{gold_by_order:.0f}\n" + output += f"经验调平:{balanced_exp_by_order:.0f}\n" + output += f"钱书比例:{lmb_exp_ratio_by_order:.2f}\n" + output += f"调平总和:{total_by_order:.0f}" + else: + balanced_gold = lmb_avg - external_gold + overflow_gold = gold_avg - balanced_gold + more_exp = overflow_gold * 0.8 + balanced_exp = exp_avg + more_exp + lmb_exp_ratio = (lmb_avg + 43483) / (balanced_exp + 36284) + total = lmb_avg + balanced_exp + + output += "====计算结果====\n" + output += f"订单平均:{lmb_avg:.0f}\n" + output += f"经验调平:{balanced_exp:.0f}\n" + output += f"钱书比例:{lmb_exp_ratio:.2f}\n" + output += f"调平总和:{total:.0f}" + await chain.onebot_reply(Text(output.strip())) except: err_msg = "出错啦!\n"