@sjtdev/koishi-plugin-dota2tracker 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +154 -82
- package/package.json +2 -2
- package/readme.md +1 -1
- package/template/guild_member/guild_member.ejs +1 -0
- package/template/hero/hero_1.ejs +4 -3
- package/template/match/match_1.ejs +10 -7
- package/template/match/match_2.ejs +6 -3
- package/template/player/player_1/private.ejs +5 -0
- package/template/player/player_1.ejs +412 -360
- package/template/rank/rank.ejs +3 -2
- package/template/rank/rank_fun.ejs +1 -0
- package/template/report/daily.ejs +3 -2
package/lib/index.js
CHANGED
|
@@ -38,14 +38,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
38
38
|
// src/locales/en-US.schema.yml
|
|
39
39
|
var require_en_US_schema = __commonJS({
|
|
40
40
|
"src/locales/en-US.schema.yml"(exports2, module2) {
|
|
41
|
-
module2.exports = { _config: { base: { $desc: "Basic Settings", STRATZ_API_TOKEN: "Required. API TOKEN from stratz.com, available at https://stratz.com/api.", dataParsingTimeoutMinutes: "Time to wait for match data parsing (in minutes). If the data parsing time exceeds the waiting time, the report will be generated directly without waiting for the parsing to complete.", urlInMessageType: { $desc: "Include links in messages, <br/>please select the message type:", $inner: ["Include stratz match page link in match query and report messages", "Include stratz player page link in player information query messages", "Include Dota Encyclopedia hero page link in hero data query messages"] } }, rank: { rankBroadSwitch: "Rank change broadcast", rankBroadStar: "Star change broadcast", rankBroadLeader: "Leaderboard rank change broadcast", rankBroadFun: "Fun broadcast template" }, report: { $desc: "Summary Settings", dailyReportSwitch: "Daily Report Function", dailyReportHours: "Daily report time in hours", dailyReportShowCombi: "Show combinations in daily report", weeklyReportSwitch: "Weekly Report Function", weeklyReportDayHours: "Weekly report published on (day) at (hour)", weeklyReportShowCombi: "Show combinations in weekly report" }, template: { $desc: "Template Settings", template_match: "Template used to generate match information images, see https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki for template display.", template_player: "Template used to generate player information images. (Currently only one template available)", template_hero: "Template used to generate hero information images. (Currently only one template available)" } } };
|
|
41
|
+
module2.exports = { _config: { base: { $desc: "Basic Settings", STRATZ_API_TOKEN: "Required. API TOKEN from stratz.com, available at https://stratz.com/api.", dataParsingTimeoutMinutes: "Time to wait for match data parsing (in minutes). If the data parsing time exceeds the waiting time, the report will be generated directly without waiting for the parsing to complete.", urlInMessageType: { $desc: "Include links in messages, <br/>please select the message type:", $inner: ["Include stratz match page link in match query and report messages", "Include stratz player page link in player information query messages", "Include Dota Encyclopedia hero page link in hero data query messages"] } }, rank: { rankBroadSwitch: "Rank change broadcast", rankBroadStar: "Star change broadcast", rankBroadLeader: "Leaderboard rank change broadcast", rankBroadFun: "Fun broadcast template" }, report: { $desc: "Summary Settings", dailyReportSwitch: "Daily Report Function", dailyReportHours: "Daily report time in hours", dailyReportShowCombi: "Show combinations in daily report", weeklyReportSwitch: "Weekly Report Function", weeklyReportDayHours: "Weekly report published on (day) at (hour)", weeklyReportShowCombi: "Show combinations in weekly report" }, template: { $desc: "Template Settings", template_match: "Template used to generate match information images, see https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki for template display.", template_player: "Template used to generate player information images. (Currently only one template available)", template_hero: "Template used to generate hero information images. (Currently only one template available)", playerRankEstimate: "Estimate the rank of players without a rank in the player template <br>Estimated rank will be displayed as a gray image" } } };
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
// src/locales/zh-CN.schema.yml
|
|
46
46
|
var require_zh_CN_schema = __commonJS({
|
|
47
47
|
"src/locales/zh-CN.schema.yml"(exports2, module2) {
|
|
48
|
-
module2.exports = { _config: { base: { $desc: "基础设置", STRATZ_API_TOKEN: "※必须。stratz.com的API TOKEN,可在 https://stratz.com/api 获取。", dataParsingTimeoutMinutes: "等待比赛数据解析的时间(单位:分钟)。如果数据解析时间超过等待时间,将直接生成战报而不再等待解析完成。", urlInMessageType: { $desc: "在消息中附带链接,<br/>请选择消息类型:", $inner: ["在查询比赛与战报消息中附带stratz比赛页面链接", "在查询玩家信息消息中附带stratz玩家页面链接", "在查询英雄数据消息中附带刀塔百科对应英雄页面链接"] } }, rank: { rankBroadSwitch: "段位变动播报", rankBroadStar: "星级变动播报", rankBroadLeader: "冠绝名次变动播报", rankBroadFun: "整活播报模板" }, report: { $desc: "总结设置", dailyReportSwitch: "日报功能", dailyReportHours: "日报时间小时", dailyReportShowCombi: "日报是否显示组合", weeklyReportSwitch: "周报功能", weeklyReportDayHours: "周报发布于周(几)的(几)点", weeklyReportShowCombi: "周报是否显示组合" }, template: { $desc: "模板设置", template_match: "生成比赛信息图片使用的模板,见 https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki 有模板展示。", template_player: "生成玩家信息图片使用的模板。(目前仅有一张模板)", template_hero: "生成英雄信息图片使用的模板。(目前仅有一张模板)" } } };
|
|
48
|
+
module2.exports = { _config: { base: { $desc: "基础设置", STRATZ_API_TOKEN: "※必须。stratz.com的API TOKEN,可在 https://stratz.com/api 获取。", dataParsingTimeoutMinutes: "等待比赛数据解析的时间(单位:分钟)。如果数据解析时间超过等待时间,将直接生成战报而不再等待解析完成。", urlInMessageType: { $desc: "在消息中附带链接,<br/>请选择消息类型:", $inner: ["在查询比赛与战报消息中附带stratz比赛页面链接", "在查询玩家信息消息中附带stratz玩家页面链接", "在查询英雄数据消息中附带刀塔百科对应英雄页面链接"] } }, rank: { rankBroadSwitch: "段位变动播报", rankBroadStar: "星级变动播报", rankBroadLeader: "冠绝名次变动播报", rankBroadFun: "整活播报模板" }, report: { $desc: "总结设置", dailyReportSwitch: "日报功能", dailyReportHours: "日报时间小时", dailyReportShowCombi: "日报是否显示组合", weeklyReportSwitch: "周报功能", weeklyReportDayHours: "周报发布于周(几)的(几)点", weeklyReportShowCombi: "周报是否显示组合" }, template: { $desc: "模板设置", template_match: "生成比赛信息图片使用的模板,见 https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki 有模板展示。", template_player: "生成玩家信息图片使用的模板。(目前仅有一张模板)", template_hero: "生成英雄信息图片使用的模板。(目前仅有一张模板)", playerRankEstimate: "在player模板中对没有段位的玩家进行段位估算 <br>估算的段位将以灰色图片显示" } } };
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -347,7 +347,7 @@ var require_zh_CN_constants = __commonJS({
|
|
|
347
347
|
ALL_PICK_RANKED: "全英雄选择",
|
|
348
348
|
TURBO: "加速模式",
|
|
349
349
|
MUTATION: "",
|
|
350
|
-
UNKNOWN: ""
|
|
350
|
+
UNKNOWN: "未知"
|
|
351
351
|
},
|
|
352
352
|
lobby_types: {
|
|
353
353
|
INVALID: "",
|
|
@@ -589,7 +589,7 @@ var require_en_US_command = __commonJS({
|
|
|
589
589
|
// src/locales/en-US.template.yml
|
|
590
590
|
var require_en_US_template = __commonJS({
|
|
591
591
|
"src/locales/en-US.template.yml"(exports2, module2) {
|
|
592
|
-
module2.exports = { dota2tracker: { template: { radiant: "Radiant", dire: "Dire", won: "Won", lost: "Lost", match_id_: "Match ID: {0}", game_mode_: "Mode: {0}", start_time_: "Start Time: {0}", end_time_: "End Time: {0}", pick_order: "#{0}", random: "R", hero_damage_: "Damage: {0}", building_damage_: "Building: {0}", damage_received_: "Received: {0}", lasthit_: "LastHit: {0}", deny_: "Deny: {0}", "lh/dn_": "LH/DN: {0}", GPM: "GPM", XPM: "XPM", heal_: "Heal: {0}", crowd_control_duration_: "CCD: {0}", "GPM/XPM_": "GPM/XPM: {0}", lane: "Lane", lane_: "Lane: ", lane_advantage: "Lane +", lane_disadvantage: "Lane -", lane_jungle: "Jungle", lane_stomp: "Lane+++", lane_stomped: "Lane---", lane_tie: "Lane ==", analysis_successful: "Analysis successful", analysis_incomplete: "Analysis incomplete", kill: "Kill", kill_contribution_: "KC: {0}", position: "Position", position_: "Position: ", position_1: "Carry", position_2: "Mid", position_3: "OffLane", position_4: "Softsup", position_5: "Hardsup", dire_won: "Dire Won", radiant_won: "Radiant Won", total_damage: "Damage", total_experience: "Exp.", total_gold: "Gold", region_: "Region: {0}", duration_: "Duration: {0}", position_undefined: "?", top10_: "Top 10 Heroes by Matches: ", match_count_: "Matches: ", last25matches_: "Last 25 Matches: ", winrate_: "Winrate: ", imp_: "IMP: ", lane_advantage_rate_: "Lane Advantage Rate: ", hero: "Hero", all_matches_: "All Matches: ", match_count: "Matches", winrate: "Winrate", imp: "IMP", win_count: "Wins", lose_count: "Losses", recently_heroes: "Heroes used more than once recently: ", recently_positions: "Performance in the last 25 matches across all positions: ", winning_streak: "Winning Streak", losing_streak: "Losing Streak", id: "ID", mode: "Mode", kda_kc: "KDA(KC)", time: "Time", duration: "Duration", rank: "Rank", un_parsed: "(Unparsed)", combined_win_loss_summary: "Combined Win/Loss Summary: ", yesterdays_summary: "Yesterday's Summary", last_weeks_summary: "Last Week's Summary", report_won: "W", report_lost: "L", report_winrate: "WR" } } };
|
|
592
|
+
module2.exports = { dota2tracker: { template: { radiant: "Radiant", dire: "Dire", won: "Won", lost: "Lost", match_id_: "Match ID: {0}", game_mode_: "Mode: {0}", start_time_: "Start Time: {0}", end_time_: "End Time: {0}", pick_order: "#{0}", random: "R", hero_damage_: "Damage: {0}", building_damage_: "Building: {0}", damage_received_: "Received: {0}", lasthit_: "LastHit: {0}", deny_: "Deny: {0}", "lh/dn_": "LH/DN: {0}", GPM: "GPM", XPM: "XPM", heal_: "Heal: {0}", crowd_control_duration_: "CCD: {0}", "GPM/XPM_": "GPM/XPM: {0}", lane: "Lane", lane_: "Lane: ", lane_advantage: "Lane +", lane_disadvantage: "Lane -", lane_jungle: "Jungle", lane_stomp: "Lane+++", lane_stomped: "Lane---", lane_tie: "Lane ==", analysis_successful: "Analysis successful", analysis_incomplete: "Analysis incomplete", kill: "Kill", kill_contribution_: "KC: {0}", position: "Position", position_: "Position: ", position_1: "Carry", position_2: "Mid", position_3: "OffLane", position_4: "Softsup", position_5: "Hardsup", dire_won: "Dire Won", radiant_won: "Radiant Won", total_damage: "Damage", total_experience: "Exp.", total_gold: "Gold", region_: "Region: {0}", duration_: "Duration: {0}", position_undefined: "?", top10_: "Top 10 Heroes by Matches: ", match_count_: "Matches: ", last25matches_: "Last 25 Matches: ", winrate_: "Winrate: ", imp_: "IMP: ", lane_advantage_rate_: "Lane Advantage Rate: ", hero: "Hero", all_matches_: "All Matches: ", match_count: "Matches", winrate: "Winrate", imp: "IMP", win_count: "Wins", lose_count: "Losses", recently_heroes: "Heroes used more than once recently: ", recently_positions: "Performance in the last 25 matches across all positions: ", winning_streak: "Winning Streak", losing_streak: "Losing Streak", id: "ID", mode: "Mode", kda_kc: "KDA(KC)", time: "Time", duration: "Duration", rank: "Rank", un_parsed: "(Unparsed)", combined_win_loss_summary: "Combined Win/Loss Summary: ", yesterdays_summary: "Yesterday's Summary", last_weeks_summary: "Last Week's Summary", report_won: "W", report_lost: "L", report_winrate: "WR", anonymous_player_1: "This profile is private.", anonymous_player_2: "Background is for display purposes only. It is not {player}’s data." } } };
|
|
593
593
|
}
|
|
594
594
|
});
|
|
595
595
|
|
|
@@ -610,14 +610,14 @@ var require_zh_CN_command = __commonJS({
|
|
|
610
610
|
// src/locales/zh-CN.template.yml
|
|
611
611
|
var require_zh_CN_template = __commonJS({
|
|
612
612
|
"src/locales/zh-CN.template.yml"(exports2, module2) {
|
|
613
|
-
module2.exports = { dota2tracker: { template: { radiant: "天辉", dire: "夜魇", won: "获胜", lost: "失败", match_id_: "比赛编号:{0}", game_mode_: "模式:{0}", start_time_: "起始时间:{0}", end_time_: "结束时间:{0}", pick_order: "第{0}手", random: "随机", hero_damage_: "英雄伤害:{0}", building_damage_: "建筑伤害:{0}", damage_received_: "受到伤害:{0}", lasthit_: "补刀:{0}", deny_: "反补:{0}", "lh/dn_": "补刀:{0}/{1}", GPM: "GPM", XPM: "XPM", heal_: "治疗量:{0}", crowd_control_duration_: "控制时间:{0}", "GPM/XPM_": "GPM/XPM:{0}", lane: "对线", lane_: "对线:", lane_advantage: "对线优势", lane_disadvantage: "对线劣势", lane_stomp: "对线碾压", lane_stomped: "对线被碾", lane_tie: "对线平手", lane_jungle: "野区霸主", analysis_successful: "录像分析成功", analysis_incomplete: "分析结果不完整", kill: "击杀", kill_contribution_: "参战率:{0}", position: "位置", position_: "位置:", position_1: "优势路", position_2: "中路", position_3: "烈士路", position_4: "采灵芝", position_5: "工具人", position_undefined: "?", total_damage: "总伤害", total_gold: "总经济", total_experience: "总经验", radiant_won: "天辉获胜", dire_won: "夜魇获胜", duration_: "持续时间:{0}", region_: "地区:{0}", match_count_: "场次:", last25matches_: "最近25场:", winrate_: "胜率:", imp_: "表现:", lane_advantage_rate_: "线优率:", top10_: "全期场次前十的英雄:", hero: "英雄", all_matches_: "全期场次:", match_count: "场次", winrate: "胜率", imp: "表现", win_count: "胜场", lose_count: "败场", recently_heroes: "近期使用场次大于1的英雄:", recently_positions: "近25场各个位置的表现:", winning_streak: "连胜", losing_streak: "连败", id: "ID", mode: "模式", kda_kc: "KDA(参战率)", time: "时间", duration: "时长", rank: "段位", un_parsed: "(未解析)", combined_win_loss_summary: "组合胜负情况:", yesterdays_summary: "昨日总结", last_weeks_summary: "上周总结", report_won: "胜", report_lost: "负", report_winrate: "胜率" } } };
|
|
613
|
+
module2.exports = { dota2tracker: { template: { radiant: "天辉", dire: "夜魇", won: "获胜", lost: "失败", match_id_: "比赛编号:{0}", game_mode_: "模式:{0}", start_time_: "起始时间:{0}", end_time_: "结束时间:{0}", pick_order: "第{0}手", random: "随机", hero_damage_: "英雄伤害:{0}", building_damage_: "建筑伤害:{0}", damage_received_: "受到伤害:{0}", lasthit_: "补刀:{0}", deny_: "反补:{0}", "lh/dn_": "补刀:{0}/{1}", GPM: "GPM", XPM: "XPM", heal_: "治疗量:{0}", crowd_control_duration_: "控制时间:{0}", "GPM/XPM_": "GPM/XPM:{0}", lane: "对线", lane_: "对线:", lane_advantage: "对线优势", lane_disadvantage: "对线劣势", lane_stomp: "对线碾压", lane_stomped: "对线被碾", lane_tie: "对线平手", lane_jungle: "野区霸主", analysis_successful: "录像分析成功", analysis_incomplete: "分析结果不完整", kill: "击杀", kill_contribution_: "参战率:{0}", position: "位置", position_: "位置:", position_1: "优势路", position_2: "中路", position_3: "烈士路", position_4: "采灵芝", position_5: "工具人", position_undefined: "?", total_damage: "总伤害", total_gold: "总经济", total_experience: "总经验", radiant_won: "天辉获胜", dire_won: "夜魇获胜", duration_: "持续时间:{0}", region_: "地区:{0}", match_count_: "场次:", last25matches_: "最近25场:", winrate_: "胜率:", imp_: "表现:", lane_advantage_rate_: "线优率:", top10_: "全期场次前十的英雄:", hero: "英雄", all_matches_: "全期场次:", match_count: "场次", winrate: "胜率", imp: "表现", win_count: "胜场", lose_count: "败场", recently_heroes: "近期使用场次大于1的英雄:", recently_positions: "近25场各个位置的表现:", winning_streak: "连胜", losing_streak: "连败", id: "ID", mode: "模式", kda_kc: "KDA(参战率)", time: "时间", duration: "时长", rank: "段位", un_parsed: "(未解析)", combined_win_loss_summary: "组合胜负情况:", yesterdays_summary: "昨日总结", last_weeks_summary: "上周总结", report_won: "胜", report_lost: "负", report_winrate: "胜率", anonymous_player_1: "数据未公开", anonymous_player_2: "背景仅供展示目的,不属于{player}的数据。" } } };
|
|
614
614
|
}
|
|
615
615
|
});
|
|
616
616
|
|
|
617
617
|
// src/locales/zh-CN.yml
|
|
618
618
|
var require_zh_CN = __commonJS({
|
|
619
619
|
"src/locales/zh-CN.yml"(exports2, module2) {
|
|
620
|
-
module2.exports = { dota2tracker: { heroes_nicknames: { "0": '请严格遵循 "", "" 格式填写(如下方默认数据,注意是英文半角符号),如果格式有误将仅使用英雄默认名称。可以不包含英雄默认名称。', "1": '"敌法师", "敌法", "AM"', "2": '"斧王"', "3": '"祸乱之源", "祸乱", "水桶腰"', "4": '"血魔"', "5": '"水晶室女", "冰女", "CM"', "6": '"卓尔游侠", "小黑"', "7": '"撼地者", "小牛", "牛头"', "8": '"主宰", "剑圣", "jugg", "奶棒人"', "9": '"米拉娜", "白虎", "pom"', "10": '"变体精灵", "水人"', "11": '"影魔", "影魔王", "SF", "影儿魔儿"', "12": '"幻影长矛手", "PL"', "13": '"帕克"', "14": '"帕吉", "屠夫", "扒鸡", "啪唧"', "15": '"雷泽", "电魂", "电棍"', "16": '"沙王", "SK"', "17": '"风暴之灵", "蓝猫"', "18": '"斯温", "流浪剑客", "流浪"', "19": '"小小"', "20": '"复仇之魂", "复仇", "VS"', "21": '"风行者", "风行", "WR"', "22": '"宙斯"', "23": '"昆卡", "船长"', "25": '"莉娜", "火女"', "26": '"莱恩", "恶魔巫师", "Lion"', "27": '"暗影萨满", "小Y", "小歪"', "28": '"斯拉达", "大鱼", "大鱼人"', "29": '"潮汐猎人", "潮汐", "西瓜皮"', "30": '"巫医"', "31": '"巫妖"', "32": '"力丸", "隐形刺客", "隐刺"', "33": '"谜团"', "34": '"修补匠", "TK", "Tinker"', "35": '"狙击手", "矮人火枪手", "火枪", "传说哥"', "36": '"瘟疫法师", "死灵法", "NEC"', "37": '"术士", "Warlock"', "38": '"兽王"', "39": '"痛苦女王", "女王", "QOP"', "40": '"剧毒术士", "剧毒"', "41": '"虚空假面", "虚空", "JB脸"', "42": '"冥魂大帝", "骷髅王"', "43": '"死亡先知", "DP"', "44": '"幻影刺客", "幻刺", "PA"', "45": '"帕格纳", "骨法", "湮灭法师"', "46": '"圣堂刺客", "圣堂", "TA"', "47": '"冥界亚龙", "毒龙", "Viper"', "48": '"露娜", "月骑", "Luna"', "49": '"龙骑士", "龙骑"', "50": '"戴泽", "暗影牧师", "暗牧"', "51": '"发条技师", "发条"', "52": '"拉席克", "老鹿"', "53": '"先知"', "54": '"噬魂鬼", "小狗"', "55": '"黑暗贤者", "黑贤"', "56": '"克林克兹", "小骷髅"', "57": '"全能骑士", "全能"', "58": '"魅惑魔女", "小鹿"', "59": '"哈斯卡", "神灵", "神灵武士"', "60": '"暗夜魔王", "夜魔"', "61": '"育母蜘蛛", "蜘蛛"', "62": '"赏金猎人", "赏金"', "63": '"编织者", "蚂蚁"', "64": '"杰奇洛", "双头龙"', "65": '"蝙蝠骑士", "蝙蝠"', "66": '"陈", "老陈"', "67": '"幽鬼", "SPE", "UG"', "68": '"远古冰魄", "冰魂"', "69": '"末日使者", "末日", "Doom"', "70": '"熊战士", "拍拍", "拍拍熊"', "71": '"裂魂人", "白牛", "sb"', "72": '"矮人直升机", "飞机"', "73": '"炼金术士", "炼金"', "74": '"祈求者", "卡尔"', "75": '"沉默术士", "沉默"', "76": '"殁境神蚀者", "黑鸟"', "77": '"狼人"', "78": '"酒仙", "熊猫", "熊猫酒仙"', "79": '"暗影恶魔", "毒狗"', "80": '"德鲁伊", "熊德"', "81": '"混沌骑士", "混沌", "CK"', "82": '"米波"', "83": '"树精卫士", "大树", "树精"', "84": '"食人魔魔法师", "蓝胖"', "85": '"不朽尸王", "尸王"', "86": '"拉比克"', "87": '"干扰者", "萨尔"', "88": '"司夜刺客", "小强"', "89": '"娜迦海妖", "小娜迦"', "90": '"光之守卫", "光法"', "91": '"艾欧", "小精灵", "精灵", "IO"', "92": '"维萨吉", "死灵龙", "死灵飞龙"', "93": '"斯拉克", "小鱼", "小鱼人"', "94": '"美杜莎", "一姐", "美杜莎"', "95": '"巨魔战将", "巨魔", "巨馍蘸酱"', "96": '"半人马战行者", "人马", "半人马"', "97": '"马格纳斯", "猛犸"', "98": '"伐木机", "花母鸡"', "99": '"钢背兽", "钢背"', "100": '"巨牙海民", "海民"', "101": '"天怒法师", "天怒"', "102": '"亚巴顿"', "103": '"上古巨神", "大牛"', "104": '"军团指挥官", "军团"', "105": '"工程师", "炸弹", "炸弹人"', "106": '"灰烬之灵", "火猫"', "107": '"大地之灵", "土猫"', "108": '"孽主", "大屁股"', "109": '"恐怖利刃", "TB"', "110": '"凤凰", "烧鸡"', "111": '"神谕者", "神谕"', "112": '"寒冬飞龙", "冰龙"', "113": '"天穹守望者", "电狗"', "114": '"齐天大圣", "大圣"', "119": '"邪影芳灵", "小仙女", "花仙子"', "120": '"石鳞剑士", "滚滚"', "121": '"天涯墨客", "墨客"', "123": '"森海飞霞", "松鼠", "小松鼠", "小松许"', "126": '"虚无之灵", "紫猫"', "128": '"电炎绝手", "老奶奶"', "129": '"玛尔斯"', "131": '"百戏大王"', "135": '"破晓辰星", "大锤"', "136": '"玛西"', "137": '"獸", "畜"', "138": '"琼英碧灵", "奶绿", "绿奶奶"', "145": '"凯", "鸟人"' }, broadcast: { WIN_NEGATIVE: '"侥幸赢得了比赛", "走狗屎运赢得了比赛", "躺赢了比赛", "打团都没来, 队友4V5赢得了比赛"', WIN_POSITIVE: '"带领团队走向了胜利", "暴打对面后赢得了胜利", " CARRY全场赢得了胜利", "把对面当猪宰了, 赢得了胜利", "又赢了, 这游戏就是这么枯燥, 且乏味", "直接进行一个比赛的赢"', LOSE_NEGATIVE: '"被人按在地上摩擦, 输掉了这场比赛", "悲惨地输掉了比赛", "头都被打歪了, 心态爆炸地输掉了比赛", "捕鱼被鱼吃了, 输掉了比赛", "打的是个几把", "直接进行一个比赛的输"', LOSE_POSITIVE: '"无力回天输掉了比赛", "尽力了, 但还是输了比赛", "背靠世界树, 虽败犹荣", "带不动队友, 输了比赛", "又输了, 很难受, 宁愿输的是我"', message: "{name}的{hero_name}{comment}。\nKDA:{kda},GPM/XPM:{gpm_xpm},补刀/反补:{lh_dn},伤害/塔伤:{damage},参战/参葬率:{kc_dc}" }, logger: { fetch_guilds_failed: "获取群组信息失败。", match_tracked: "追踪到来自{#each messageToLogger as item}群组 {item.platform}:{item.guildId} 的用户[{#each item.players as player}{player.nickName}({player.steamId}){#if player === item.players[item.players.length - 1]}{/if}{#if player !== item.players[item.players.length - 1]}、{/if}{/each}]{#if item !== messageToLogger[messageToLogger.length - 1]}、{/if}{/each}的尚未播报过的最新比赛 {match.id}。", parse_request_sent: "比赛 {matchId} 解析请求已成功发送至STRATZ服务器。", parse_request_failed: "比赛 {matchId} 解析请求发送失败。", match_parsed: "比赛 {matchId} 已解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", match_unparsed: "比赛 {matchId} 超过等待时间[{timeout}]仍未解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", waiting_for_parse: "比赛 {matchId} 尚未解析完成,继续等待。", report_sent: "发布{title}于{platform}:{guildId}。", rank_sent: "向{platform}:{guildId}发布{player.nickName}(
|
|
620
|
+
module2.exports = { dota2tracker: { heroes_nicknames: { "0": '请严格遵循 "", "" 格式填写(如下方默认数据,注意是英文半角符号),如果格式有误将仅使用英雄默认名称。可以不包含英雄默认名称。', "1": '"敌法师", "敌法", "AM"', "2": '"斧王"', "3": '"祸乱之源", "祸乱", "水桶腰"', "4": '"血魔"', "5": '"水晶室女", "冰女", "CM"', "6": '"卓尔游侠", "小黑"', "7": '"撼地者", "小牛", "牛头"', "8": '"主宰", "剑圣", "jugg", "奶棒人"', "9": '"米拉娜", "白虎", "pom"', "10": '"变体精灵", "水人"', "11": '"影魔", "影魔王", "SF", "影儿魔儿"', "12": '"幻影长矛手", "PL"', "13": '"帕克"', "14": '"帕吉", "屠夫", "扒鸡", "啪唧"', "15": '"雷泽", "电魂", "电棍"', "16": '"沙王", "SK"', "17": '"风暴之灵", "蓝猫"', "18": '"斯温", "流浪剑客", "流浪"', "19": '"小小"', "20": '"复仇之魂", "复仇", "VS"', "21": '"风行者", "风行", "WR"', "22": '"宙斯"', "23": '"昆卡", "船长"', "25": '"莉娜", "火女"', "26": '"莱恩", "恶魔巫师", "Lion"', "27": '"暗影萨满", "小Y", "小歪"', "28": '"斯拉达", "大鱼", "大鱼人"', "29": '"潮汐猎人", "潮汐", "西瓜皮"', "30": '"巫医"', "31": '"巫妖"', "32": '"力丸", "隐形刺客", "隐刺"', "33": '"谜团"', "34": '"修补匠", "TK", "Tinker"', "35": '"狙击手", "矮人火枪手", "火枪", "传说哥"', "36": '"瘟疫法师", "死灵法", "NEC"', "37": '"术士", "Warlock"', "38": '"兽王"', "39": '"痛苦女王", "女王", "QOP"', "40": '"剧毒术士", "剧毒"', "41": '"虚空假面", "虚空", "JB脸"', "42": '"冥魂大帝", "骷髅王"', "43": '"死亡先知", "DP"', "44": '"幻影刺客", "幻刺", "PA"', "45": '"帕格纳", "骨法", "湮灭法师"', "46": '"圣堂刺客", "圣堂", "TA"', "47": '"冥界亚龙", "毒龙", "Viper"', "48": '"露娜", "月骑", "Luna"', "49": '"龙骑士", "龙骑"', "50": '"戴泽", "暗影牧师", "暗牧"', "51": '"发条技师", "发条"', "52": '"拉席克", "老鹿"', "53": '"先知"', "54": '"噬魂鬼", "小狗"', "55": '"黑暗贤者", "黑贤"', "56": '"克林克兹", "小骷髅"', "57": '"全能骑士", "全能"', "58": '"魅惑魔女", "小鹿"', "59": '"哈斯卡", "神灵", "神灵武士"', "60": '"暗夜魔王", "夜魔"', "61": '"育母蜘蛛", "蜘蛛"', "62": '"赏金猎人", "赏金"', "63": '"编织者", "蚂蚁"', "64": '"杰奇洛", "双头龙"', "65": '"蝙蝠骑士", "蝙蝠"', "66": '"陈", "老陈"', "67": '"幽鬼", "SPE", "UG"', "68": '"远古冰魄", "冰魂"', "69": '"末日使者", "末日", "Doom"', "70": '"熊战士", "拍拍", "拍拍熊"', "71": '"裂魂人", "白牛", "sb"', "72": '"矮人直升机", "飞机"', "73": '"炼金术士", "炼金"', "74": '"祈求者", "卡尔"', "75": '"沉默术士", "沉默"', "76": '"殁境神蚀者", "黑鸟"', "77": '"狼人"', "78": '"酒仙", "熊猫", "熊猫酒仙"', "79": '"暗影恶魔", "毒狗"', "80": '"德鲁伊", "熊德"', "81": '"混沌骑士", "混沌", "CK"', "82": '"米波"', "83": '"树精卫士", "大树", "树精"', "84": '"食人魔魔法师", "蓝胖"', "85": '"不朽尸王", "尸王"', "86": '"拉比克"', "87": '"干扰者", "萨尔"', "88": '"司夜刺客", "小强"', "89": '"娜迦海妖", "小娜迦"', "90": '"光之守卫", "光法"', "91": '"艾欧", "小精灵", "精灵", "IO"', "92": '"维萨吉", "死灵龙", "死灵飞龙"', "93": '"斯拉克", "小鱼", "小鱼人"', "94": '"美杜莎", "一姐", "美杜莎"', "95": '"巨魔战将", "巨魔", "巨馍蘸酱"', "96": '"半人马战行者", "人马", "半人马"', "97": '"马格纳斯", "猛犸"', "98": '"伐木机", "花母鸡"', "99": '"钢背兽", "钢背"', "100": '"巨牙海民", "海民"', "101": '"天怒法师", "天怒"', "102": '"亚巴顿"', "103": '"上古巨神", "大牛"', "104": '"军团指挥官", "军团"', "105": '"工程师", "炸弹", "炸弹人"', "106": '"灰烬之灵", "火猫"', "107": '"大地之灵", "土猫"', "108": '"孽主", "大屁股"', "109": '"恐怖利刃", "TB"', "110": '"凤凰", "烧鸡"', "111": '"神谕者", "神谕"', "112": '"寒冬飞龙", "冰龙"', "113": '"天穹守望者", "电狗"', "114": '"齐天大圣", "大圣"', "119": '"邪影芳灵", "小仙女", "花仙子"', "120": '"石鳞剑士", "滚滚"', "121": '"天涯墨客", "墨客"', "123": '"森海飞霞", "松鼠", "小松鼠", "小松许"', "126": '"虚无之灵", "紫猫"', "128": '"电炎绝手", "老奶奶"', "129": '"玛尔斯"', "131": '"百戏大王"', "135": '"破晓辰星", "大锤"', "136": '"玛西"', "137": '"獸", "畜"', "138": '"琼英碧灵", "奶绿", "绿奶奶"', "145": '"凯", "鸟人"' }, broadcast: { WIN_NEGATIVE: '"侥幸赢得了比赛", "走狗屎运赢得了比赛", "躺赢了比赛", "打团都没来, 队友4V5赢得了比赛"', WIN_POSITIVE: '"带领团队走向了胜利", "暴打对面后赢得了胜利", " CARRY全场赢得了胜利", "把对面当猪宰了, 赢得了胜利", "又赢了, 这游戏就是这么枯燥, 且乏味", "直接进行一个比赛的赢"', LOSE_NEGATIVE: '"被人按在地上摩擦, 输掉了这场比赛", "悲惨地输掉了比赛", "头都被打歪了, 心态爆炸地输掉了比赛", "捕鱼被鱼吃了, 输掉了比赛", "打的是个几把", "直接进行一个比赛的输"', LOSE_POSITIVE: '"无力回天输掉了比赛", "尽力了, 但还是输了比赛", "背靠世界树, 虽败犹荣", "带不动队友, 输了比赛", "又输了, 很难受, 宁愿输的是我"', message: "{name}的{hero_name}{comment}。\nKDA:{kda},GPM/XPM:{gpm_xpm},补刀/反补:{lh_dn},伤害/塔伤:{damage},参战/参葬率:{kc_dc}" }, logger: { fetch_guilds_failed: "获取群组信息失败。", match_tracked: "追踪到来自{#each messageToLogger as item}群组 {item.platform}:{item.guildId} 的用户[{#each item.players as player}{player.nickName}({player.steamId}){#if player === item.players[item.players.length - 1]}{/if}{#if player !== item.players[item.players.length - 1]}、{/if}{/each}]{#if item !== messageToLogger[messageToLogger.length - 1]}、{/if}{/each}的尚未播报过的最新比赛 {match.id}。", parse_request_sent: "比赛 {matchId} 解析请求已成功发送至STRATZ服务器。", parse_request_failed: "比赛 {matchId} 解析请求发送失败。", match_parsed: "比赛 {matchId} 已解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", match_unparsed: "比赛 {matchId} 超过等待时间[{timeout}]仍未解析,生成图片并发布于{#each guilds as guild}{guild.platform}:{guild.guildId}{#if guild !== guilds[guilds.length - 1]}、{/if}{/each}。", waiting_for_parse: "比赛 {matchId} 尚未解析完成,继续等待。", report_sent: "发布{title}于{platform}:{guildId}。", rank_sent: "向{platform}:{guildId}发布{player.nickName}({player.steamId})的段位变动信息。", ejs_error: "EJS模板渲染错误:{error}" } } };
|
|
621
621
|
}
|
|
622
622
|
});
|
|
623
623
|
|
|
@@ -632,7 +632,7 @@ __export(src_exports, {
|
|
|
632
632
|
usage: () => usage
|
|
633
633
|
});
|
|
634
634
|
module.exports = __toCommonJS(src_exports);
|
|
635
|
-
var
|
|
635
|
+
var import_koishi2 = require("koishi");
|
|
636
636
|
|
|
637
637
|
// src/utils.ts
|
|
638
638
|
var utils_exports = {};
|
|
@@ -641,6 +641,7 @@ __export(utils_exports, {
|
|
|
641
641
|
HeroDescType: () => HeroDescType,
|
|
642
642
|
ImageFormat: () => ImageFormat,
|
|
643
643
|
ImageType: () => ImageType,
|
|
644
|
+
enhancedSimpleHashToSeed: () => enhancedSimpleHashToSeed,
|
|
644
645
|
formatHeroDesc: () => formatHeroDesc,
|
|
645
646
|
formatNumber: () => formatNumber,
|
|
646
647
|
getFormattedHeroData: () => getFormattedHeroData,
|
|
@@ -659,6 +660,8 @@ __export(utils_exports, {
|
|
|
659
660
|
var import_fs = __toESM(require("fs"));
|
|
660
661
|
var dotaconstants = __toESM(require("dotaconstants"));
|
|
661
662
|
var import_path = __toESM(require("path"));
|
|
663
|
+
var import_koishi = require("koishi");
|
|
664
|
+
var pluginDir = import_path.default.join(__dirname, "..");
|
|
662
665
|
var CONFIGS = { STRATZ_API: { URL: "https://api.stratz.com/graphql", TOKEN: "" } };
|
|
663
666
|
var http = null;
|
|
664
667
|
var setTimeout;
|
|
@@ -704,8 +707,7 @@ async function query(queryName, variables) {
|
|
|
704
707
|
}
|
|
705
708
|
__name(query, "query");
|
|
706
709
|
function loadGraphqlFile(queryName) {
|
|
707
|
-
|
|
708
|
-
return import_fs.default.readFileSync(filepath, { encoding: "utf-8" }).replace(/[\r\n]+/g, " ");
|
|
710
|
+
return import_fs.default.readFileSync(import_path.default.join(pluginDir, "queries", `${queryName}.graphql`), { encoding: "utf-8" }).replace(/[\r\n]+/g, " ");
|
|
709
711
|
}
|
|
710
712
|
__name(loadGraphqlFile, "loadGraphqlFile");
|
|
711
713
|
async function queryHeroFromValve(heroId, languageTag = "zh-CN") {
|
|
@@ -743,8 +745,8 @@ var ImageFormat = /* @__PURE__ */ ((ImageFormat2) => {
|
|
|
743
745
|
function getImageUrl(image, type = "local" /* Local */, format = "png" /* png */) {
|
|
744
746
|
if (type === "local" /* Local */) {
|
|
745
747
|
try {
|
|
746
|
-
if (format === "svg" /* svg */) return import_fs.default.readFileSync(
|
|
747
|
-
const imageData = import_fs.default.readFileSync(
|
|
748
|
+
if (format === "svg" /* svg */) return import_fs.default.readFileSync(import_path.default.join(pluginDir, "template", "images", `${image}.svg`));
|
|
749
|
+
const imageData = import_fs.default.readFileSync(import_path.default.join(pluginDir, "template", "images", `${image}.${format}`));
|
|
748
750
|
const base64Data = imageData.toString("base64");
|
|
749
751
|
return `data:image/png;base64,${base64Data}`;
|
|
750
752
|
} catch (error) {
|
|
@@ -1034,9 +1036,35 @@ function getFormattedMatchData(matchQuery, constantsQuery) {
|
|
|
1034
1036
|
return match;
|
|
1035
1037
|
}
|
|
1036
1038
|
__name(getFormattedMatchData, "getFormattedMatchData");
|
|
1037
|
-
function getFormattedPlayerData(
|
|
1039
|
+
function getFormattedPlayerData(param) {
|
|
1040
|
+
const { playerQuery, playerExtraQuery, genHero, estimateRank } = param;
|
|
1038
1041
|
const player = playerQuery.player;
|
|
1039
1042
|
const playerExtra = playerExtraQuery?.player;
|
|
1043
|
+
if (player.steamAccount.isAnonymous) {
|
|
1044
|
+
for (let index = 0; index < 25; index++) {
|
|
1045
|
+
const random2 = new import_koishi.Random(() => enhancedSimpleHashToSeed(`${player.steamAccount.id}-${index}`));
|
|
1046
|
+
player.matches.push({
|
|
1047
|
+
id: 1e9 + index,
|
|
1048
|
+
gameMode: "UNKNOWN",
|
|
1049
|
+
lobbyType: "UNRANKED",
|
|
1050
|
+
didRadiantWin: random2.bool(0.5),
|
|
1051
|
+
rank: random2.int(0, 8) * 10,
|
|
1052
|
+
radiantKills: [random2.int(0, 30)],
|
|
1053
|
+
direKills: [random2.int(0, 30)],
|
|
1054
|
+
parsedDateTime: 1,
|
|
1055
|
+
players: [
|
|
1056
|
+
{
|
|
1057
|
+
steamAccount: { id: player.steamAccount.id },
|
|
1058
|
+
isRadiant: true,
|
|
1059
|
+
kills: random2.int(0, 20),
|
|
1060
|
+
deaths: random2.int(0, 20),
|
|
1061
|
+
assists: random2.int(0, 20),
|
|
1062
|
+
hero: { id: random2.pick(Object.keys(dotaconstants.heroes)), shortName: dotaconstants.heroes[random2.pick(Object.keys(dotaconstants.heroes))].name.match(/^npc_dota_hero_(.+)$/)[1] }
|
|
1063
|
+
}
|
|
1064
|
+
]
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1040
1068
|
let filteredDotaPlus = {};
|
|
1041
1069
|
playerExtra?.dotaPlus?.forEach((item) => {
|
|
1042
1070
|
if (!filteredDotaPlus[item.heroId] || filteredDotaPlus[item.heroId].level < item.level) {
|
|
@@ -1053,6 +1081,44 @@ function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
|
1053
1081
|
filteredDotaPlus[hero.hero.id].matchCount = hero.matchCount;
|
|
1054
1082
|
}
|
|
1055
1083
|
});
|
|
1084
|
+
if (!player.steamAccount.seasonRank && estimateRank && !player.steamAccount.isAnonymous) {
|
|
1085
|
+
let estimateWeightedRank = function(player2) {
|
|
1086
|
+
const ranks = player2.matches.map((match) => match.rank);
|
|
1087
|
+
const validRanks = ranks.filter(validateRank);
|
|
1088
|
+
if (validRanks.length === 0) {
|
|
1089
|
+
return "Unknown";
|
|
1090
|
+
}
|
|
1091
|
+
const totalWeight = validRanks.reduce((sum, _, index) => sum + calculateWeight(index, validRanks.length), 0);
|
|
1092
|
+
const weightedAverage = validRanks.reduce((sum, rank, index) => {
|
|
1093
|
+
const value = rankToValue(rank);
|
|
1094
|
+
const weight = calculateWeight(index, validRanks.length);
|
|
1095
|
+
return sum + value * weight;
|
|
1096
|
+
}, 0) / totalWeight;
|
|
1097
|
+
const tier = Math.floor(weightedAverage / 6);
|
|
1098
|
+
const stars = Math.round(weightedAverage % 6);
|
|
1099
|
+
return tier * 10 + stars;
|
|
1100
|
+
function rankToValue(rank) {
|
|
1101
|
+
const tier2 = Math.floor(rank / 10);
|
|
1102
|
+
const stars2 = rank % 10;
|
|
1103
|
+
return tier2 * 6 + stars2;
|
|
1104
|
+
}
|
|
1105
|
+
__name(rankToValue, "rankToValue");
|
|
1106
|
+
function calculateWeight(index, total) {
|
|
1107
|
+
return 1 - 0.5 / (total - 1) * index;
|
|
1108
|
+
}
|
|
1109
|
+
__name(calculateWeight, "calculateWeight");
|
|
1110
|
+
function validateRank(rank) {
|
|
1111
|
+
if (rank === 80) return true;
|
|
1112
|
+
const tier2 = Math.floor(rank / 10);
|
|
1113
|
+
const stars2 = rank % 10;
|
|
1114
|
+
return tier2 >= 1 && tier2 <= 8 && stars2 >= 0 && stars2 <= 5;
|
|
1115
|
+
}
|
|
1116
|
+
__name(validateRank, "validateRank");
|
|
1117
|
+
};
|
|
1118
|
+
__name(estimateWeightedRank, "estimateWeightedRank");
|
|
1119
|
+
player.isEstimatedRank = true;
|
|
1120
|
+
player.steamAccount.seasonRank = estimateWeightedRank(player);
|
|
1121
|
+
}
|
|
1056
1122
|
player.rank = {
|
|
1057
1123
|
medal: parseInt(player.steamAccount.seasonRank?.toString().split("")[0] ?? 0),
|
|
1058
1124
|
star: parseInt(player.steamAccount.seasonRank?.toString().split("")[1] ?? 0),
|
|
@@ -1066,7 +1132,7 @@ function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
|
1066
1132
|
}
|
|
1067
1133
|
return a.heroId - b.heroId;
|
|
1068
1134
|
});
|
|
1069
|
-
player.heroesPerformanceTop10 = playerExtra?.heroesPerformance.slice(0, 10);
|
|
1135
|
+
player.heroesPerformanceTop10 = playerExtra?.heroesPerformance.slice(0, 10) ?? [];
|
|
1070
1136
|
if (genHero) {
|
|
1071
1137
|
const { matchCount, winCount, imp } = player.heroesPerformanceTop10[0];
|
|
1072
1138
|
player.matchCount = matchCount;
|
|
@@ -1075,8 +1141,6 @@ function getFormattedPlayerData(playerQuery, playerExtraQuery, genHero) {
|
|
|
1075
1141
|
player.dotaPlus = player.dotaPlus.filter((dpHero) => dpHero.heroId == genHero.heroId);
|
|
1076
1142
|
player.genHero = genHero;
|
|
1077
1143
|
}
|
|
1078
|
-
if (player.steamAccount.isAnonymous) {
|
|
1079
|
-
}
|
|
1080
1144
|
return player;
|
|
1081
1145
|
}
|
|
1082
1146
|
__name(getFormattedPlayerData, "getFormattedPlayerData");
|
|
@@ -1181,7 +1245,7 @@ __name(formatNumber, "formatNumber");
|
|
|
1181
1245
|
function readDirectoryFilesSync(directoryPath) {
|
|
1182
1246
|
try {
|
|
1183
1247
|
const files = import_fs.default.readdirSync(directoryPath);
|
|
1184
|
-
const fileNames = files.
|
|
1248
|
+
const fileNames = files.filter((file) => import_path.default.extname(file).toLowerCase() === ".ejs").map((file) => import_path.default.basename(file, ".ejs"));
|
|
1185
1249
|
return fileNames;
|
|
1186
1250
|
} catch (error) {
|
|
1187
1251
|
console.error("Error reading directory:", error);
|
|
@@ -1259,13 +1323,26 @@ function formatHeroDesc(template, special_values, type = "normal" /* Normal */)
|
|
|
1259
1323
|
});
|
|
1260
1324
|
}
|
|
1261
1325
|
__name(formatHeroDesc, "formatHeroDesc");
|
|
1326
|
+
function enhancedSimpleHashToSeed(inputString) {
|
|
1327
|
+
const encoded = btoa(inputString);
|
|
1328
|
+
let total = 0;
|
|
1329
|
+
let complexFactor = 1;
|
|
1330
|
+
for (let i = 0; i < encoded.length; i++) {
|
|
1331
|
+
total += encoded.charCodeAt(i) * complexFactor;
|
|
1332
|
+
complexFactor++;
|
|
1333
|
+
total %= 9973;
|
|
1334
|
+
}
|
|
1335
|
+
total = total % 9973 * (total % 9973) % 9973;
|
|
1336
|
+
return total % 1e3 / 1e3;
|
|
1337
|
+
}
|
|
1338
|
+
__name(enhancedSimpleHashToSeed, "enhancedSimpleHashToSeed");
|
|
1262
1339
|
|
|
1263
1340
|
// src/index.ts
|
|
1264
1341
|
var import_fs2 = __toESM(require("fs"));
|
|
1265
1342
|
var import_path2 = __toESM(require("path"));
|
|
1266
1343
|
var import_moment = __toESM(require("moment"));
|
|
1267
1344
|
var dotaconstants2 = __toESM(require("dotaconstants"));
|
|
1268
|
-
var
|
|
1345
|
+
var import_koishi3 = require("koishi");
|
|
1269
1346
|
var ejs = __toESM(require("ejs"));
|
|
1270
1347
|
|
|
1271
1348
|
// require("./locales/**/*.schema.yml") in src/index.ts
|
|
@@ -1308,64 +1385,66 @@ var globRequire_locales_template_yml = __glob({
|
|
|
1308
1385
|
var name = "dota2tracker";
|
|
1309
1386
|
var usage = "";
|
|
1310
1387
|
var inject = ["http", "database", "cron", "puppeteer", "cache"];
|
|
1311
|
-
var
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1388
|
+
var pluginDir2 = import_path2.default.resolve(__dirname, "..");
|
|
1389
|
+
var GraphqlLanguageEnum = /* @__PURE__ */ ((GraphqlLanguageEnum2) => {
|
|
1390
|
+
GraphqlLanguageEnum2["en-US"] = "ENGLISH";
|
|
1391
|
+
GraphqlLanguageEnum2["zh-CN"] = "S_CHINESE";
|
|
1392
|
+
return GraphqlLanguageEnum2;
|
|
1393
|
+
})(GraphqlLanguageEnum || {});
|
|
1394
|
+
var Config = import_koishi2.Schema.intersect([
|
|
1395
|
+
import_koishi2.Schema.object({
|
|
1396
|
+
STRATZ_API_TOKEN: import_koishi2.Schema.string().required().role("secret"),
|
|
1397
|
+
dataParsingTimeoutMinutes: import_koishi2.Schema.number().default(60).min(0).max(1440),
|
|
1398
|
+
urlInMessageType: import_koishi2.Schema.array(import_koishi2.Schema.union([import_koishi2.Schema.const("match"), import_koishi2.Schema.const("player"), import_koishi2.Schema.const("hero")])).role("checkbox")
|
|
1399
|
+
}).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.base, acc), {})),
|
|
1400
|
+
import_koishi2.Schema.intersect([
|
|
1401
|
+
import_koishi2.Schema.object({
|
|
1402
|
+
rankBroadSwitch: import_koishi2.Schema.boolean().default(false)
|
|
1320
1403
|
}),
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
rankBroadSwitch:
|
|
1324
|
-
rankBroadStar:
|
|
1325
|
-
rankBroadLeader:
|
|
1326
|
-
rankBroadFun:
|
|
1404
|
+
import_koishi2.Schema.union([
|
|
1405
|
+
import_koishi2.Schema.object({
|
|
1406
|
+
rankBroadSwitch: import_koishi2.Schema.const(true).required(),
|
|
1407
|
+
rankBroadStar: import_koishi2.Schema.boolean().default(true),
|
|
1408
|
+
rankBroadLeader: import_koishi2.Schema.boolean().default(true),
|
|
1409
|
+
rankBroadFun: import_koishi2.Schema.boolean().default(false)
|
|
1327
1410
|
}),
|
|
1328
|
-
|
|
1411
|
+
import_koishi2.Schema.object({})
|
|
1329
1412
|
])
|
|
1330
|
-
]).i18n(
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
dailyReportSwitch:
|
|
1413
|
+
]).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.rank, acc), {})),
|
|
1414
|
+
import_koishi2.Schema.intersect([
|
|
1415
|
+
import_koishi2.Schema.object({
|
|
1416
|
+
dailyReportSwitch: import_koishi2.Schema.boolean().default(false)
|
|
1334
1417
|
}),
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
dailyReportSwitch:
|
|
1338
|
-
dailyReportHours:
|
|
1339
|
-
dailyReportShowCombi:
|
|
1418
|
+
import_koishi2.Schema.union([
|
|
1419
|
+
import_koishi2.Schema.object({
|
|
1420
|
+
dailyReportSwitch: import_koishi2.Schema.const(true).required(),
|
|
1421
|
+
dailyReportHours: import_koishi2.Schema.number().min(0).max(23).default(6),
|
|
1422
|
+
dailyReportShowCombi: import_koishi2.Schema.boolean().default(true)
|
|
1340
1423
|
}),
|
|
1341
|
-
|
|
1424
|
+
import_koishi2.Schema.object({})
|
|
1342
1425
|
]),
|
|
1343
|
-
|
|
1344
|
-
weeklyReportSwitch:
|
|
1426
|
+
import_koishi2.Schema.object({
|
|
1427
|
+
weeklyReportSwitch: import_koishi2.Schema.boolean().default(false)
|
|
1345
1428
|
}),
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
weeklyReportSwitch:
|
|
1349
|
-
weeklyReportDayHours:
|
|
1350
|
-
weeklyReportShowCombi:
|
|
1429
|
+
import_koishi2.Schema.union([
|
|
1430
|
+
import_koishi2.Schema.object({
|
|
1431
|
+
weeklyReportSwitch: import_koishi2.Schema.const(true).required(),
|
|
1432
|
+
weeklyReportDayHours: import_koishi2.Schema.tuple([import_koishi2.Schema.number().min(1).max(7), import_koishi2.Schema.number().min(0).max(23)]).default([1, 10]),
|
|
1433
|
+
weeklyReportShowCombi: import_koishi2.Schema.boolean().default(true)
|
|
1351
1434
|
}),
|
|
1352
|
-
|
|
1435
|
+
import_koishi2.Schema.object({})
|
|
1353
1436
|
])
|
|
1354
|
-
]).i18n(
|
|
1355
|
-
|
|
1356
|
-
template_match:
|
|
1357
|
-
template_player:
|
|
1358
|
-
template_hero:
|
|
1359
|
-
|
|
1437
|
+
]).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.report, acc), {})),
|
|
1438
|
+
import_koishi2.Schema.object({
|
|
1439
|
+
template_match: import_koishi2.Schema.union([...readDirectoryFilesSync(import_path2.default.join(pluginDir2, "template", "match"))]).default("match_1"),
|
|
1440
|
+
template_player: import_koishi2.Schema.union([...readDirectoryFilesSync(import_path2.default.join(pluginDir2, "template", "player"))]).default("player_1"),
|
|
1441
|
+
template_hero: import_koishi2.Schema.union([...readDirectoryFilesSync(import_path2.default.join(pluginDir2, "template", "hero"))]).default("hero_1"),
|
|
1442
|
+
playerRankEstimate: import_koishi2.Schema.boolean().default(true)
|
|
1443
|
+
}).i18n(Object.keys(GraphqlLanguageEnum).reduce((acc, cur) => (acc[cur] = globRequire_locales_schema_yml(`./locales/${cur}.schema.yml`)._config.template, acc), {}))
|
|
1360
1444
|
]);
|
|
1361
1445
|
var pendingMatches = [];
|
|
1362
|
-
var random = new
|
|
1446
|
+
var random = new import_koishi3.Random(() => Math.random());
|
|
1363
1447
|
var days_30 = 2592e6;
|
|
1364
|
-
var GraphqlLanguageEnum = /* @__PURE__ */ ((GraphqlLanguageEnum2) => {
|
|
1365
|
-
GraphqlLanguageEnum2["en-US"] = "ENGLISH";
|
|
1366
|
-
GraphqlLanguageEnum2["zh-CN"] = "S_CHINESE";
|
|
1367
|
-
return GraphqlLanguageEnum2;
|
|
1368
|
-
})(GraphqlLanguageEnum || {});
|
|
1369
1448
|
var constantLocales = {};
|
|
1370
1449
|
async function apply(ctx, config) {
|
|
1371
1450
|
init(ctx.http, ctx.setTimeout, config.STRATZ_API_TOKEN);
|
|
@@ -1572,7 +1651,7 @@ async function apply(ctx, config) {
|
|
|
1572
1651
|
let idsToFind = guild.players.map((player) => player.steamId);
|
|
1573
1652
|
let broadPlayers = match.players.filter((item) => idsToFind.includes(item.steamAccountId));
|
|
1574
1653
|
for (let player of broadPlayers) {
|
|
1575
|
-
const random2 = new
|
|
1654
|
+
const random2 = new import_koishi3.Random(() => enhancedSimpleHashToSeed(`${match.id}-${player.steamAccountId}-${player.playerSlot}`));
|
|
1576
1655
|
let comment;
|
|
1577
1656
|
if (player.isRadiant == match.didRadiantWin) {
|
|
1578
1657
|
if (player.deathContribution < 0.2 || player.killContribution > 0.75 || player.heroDamage / player.networth > 1.5 || player.towerDamage > 1e4 || player.imp > 0)
|
|
@@ -1707,8 +1786,8 @@ async function apply(ctx, config) {
|
|
|
1707
1786
|
}
|
|
1708
1787
|
session.send(session.text(".querying_player"));
|
|
1709
1788
|
let heroId = findingHero(options.hero);
|
|
1710
|
-
let steamId = flagBindedPlayer?.steamId ?? input_data;
|
|
1711
1789
|
try {
|
|
1790
|
+
let steamId = Number(flagBindedPlayer?.steamId ?? input_data);
|
|
1712
1791
|
const playerQuery = await query("PlayerInfoWith25Matches", {
|
|
1713
1792
|
steamAccountId: steamId,
|
|
1714
1793
|
heroIds: heroId
|
|
@@ -1724,7 +1803,12 @@ async function apply(ctx, config) {
|
|
|
1724
1803
|
dotaPlus: null
|
|
1725
1804
|
}
|
|
1726
1805
|
};
|
|
1727
|
-
const player = getFormattedPlayerData(
|
|
1806
|
+
const player = getFormattedPlayerData({
|
|
1807
|
+
playerQuery,
|
|
1808
|
+
playerExtraQuery,
|
|
1809
|
+
genHero: heroId ? { heroId, name: constantLocales[languageTag].dota2tracker.template.hero_names[heroId] } : null,
|
|
1810
|
+
estimateRank: config.playerRankEstimate
|
|
1811
|
+
});
|
|
1728
1812
|
session.send(
|
|
1729
1813
|
(ctx.config.urlInMessageType.some((type) => type == "player") ? "https://stratz.com/players/" + player.steamAccount.id : "") + await ctx.puppeteer.render(await genImageHTML(player, config.template_player, "player" /* Player */, ctx, languageTag))
|
|
1730
1814
|
);
|
|
@@ -2091,7 +2175,7 @@ async function apply(ctx, config) {
|
|
|
2091
2175
|
}
|
|
2092
2176
|
__name($t, "$t");
|
|
2093
2177
|
async function genImageHTML(data, template, type, ctx2, languageTag) {
|
|
2094
|
-
const templatePath = import_path2.default.join(
|
|
2178
|
+
const templatePath = import_path2.default.join(pluginDir2, "template", type, `${template}.ejs`);
|
|
2095
2179
|
const templateData = {
|
|
2096
2180
|
data,
|
|
2097
2181
|
utils: utils_exports,
|
|
@@ -2101,7 +2185,8 @@ async function apply(ctx, config) {
|
|
|
2101
2185
|
moment: import_moment.default,
|
|
2102
2186
|
eh: escapeHTML,
|
|
2103
2187
|
$t: templateI18nHelper,
|
|
2104
|
-
languageTag
|
|
2188
|
+
languageTag,
|
|
2189
|
+
Random: import_koishi3.Random
|
|
2105
2190
|
};
|
|
2106
2191
|
function templateI18nHelper(key, param) {
|
|
2107
2192
|
return $t(languageTag, key, param);
|
|
@@ -2111,7 +2196,7 @@ async function apply(ctx, config) {
|
|
|
2111
2196
|
const html = await ejs.renderFile(templatePath, templateData, {
|
|
2112
2197
|
strict: false
|
|
2113
2198
|
});
|
|
2114
|
-
if (process.env.NODE_ENV === "development") import_fs2.default.writeFileSync("
|
|
2199
|
+
if (process.env.NODE_ENV === "development") import_fs2.default.writeFileSync(import_path2.default.join(pluginDir2, "temp.html"), html);
|
|
2115
2200
|
return html;
|
|
2116
2201
|
} catch (error) {
|
|
2117
2202
|
ctx2.logger.error(error);
|
|
@@ -2121,19 +2206,6 @@ async function apply(ctx, config) {
|
|
|
2121
2206
|
__name(genImageHTML, "genImageHTML");
|
|
2122
2207
|
}
|
|
2123
2208
|
__name(apply, "apply");
|
|
2124
|
-
function enhancedSimpleHashToSeed(inputString) {
|
|
2125
|
-
const encoded = btoa(inputString);
|
|
2126
|
-
let total = 0;
|
|
2127
|
-
let complexFactor = 1;
|
|
2128
|
-
for (let i = 0; i < encoded.length; i++) {
|
|
2129
|
-
total += encoded.charCodeAt(i) * complexFactor;
|
|
2130
|
-
complexFactor++;
|
|
2131
|
-
total %= 9973;
|
|
2132
|
-
}
|
|
2133
|
-
total = total % 9973 * (total % 9973) % 9973;
|
|
2134
|
-
return total % 1e3 / 1e3;
|
|
2135
|
-
}
|
|
2136
|
-
__name(enhancedSimpleHashToSeed, "enhancedSimpleHashToSeed");
|
|
2137
2209
|
function escapeHTML(str) {
|
|
2138
2210
|
if (str == null) return "";
|
|
2139
2211
|
return str.replace(/[&<>"']/g, function(match) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjtdev/koishi-plugin-dota2tracker",
|
|
3
3
|
"description": "koishi插件-追踪群友的DOTA2对局",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"moment": "^2.30.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"koishi": "^4.18.
|
|
35
|
+
"koishi": "^4.18.7"
|
|
36
36
|
},
|
|
37
37
|
"koishi": {
|
|
38
38
|
"preview": "true",
|
package/readme.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@sjtdev/koishi-plugin-dota2tracker)
|
|
7
7
|
[](https://www.npmjs.com/package/@sjtdev/koishi-plugin-dota2tracker)
|
|
8
8
|
> [!TIP]
|
|
9
|
-
>
|
|
9
|
+
> 两个标签取版本号最高为最新版本
|
|
10
10
|
|
|
11
11
|
DOTA2Bot插件-提供自动追踪群友的最新对局的功能(需群友绑定),以及一系列查询功能。
|
|
12
12
|
### 安装
|
package/template/hero/hero_1.ejs
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
background-color: black;
|
|
12
12
|
color: white;
|
|
13
13
|
width: 800px;
|
|
14
|
+
font-family: 'MiSans', sans-serif;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.wrapper > *:not(.skills) {
|
|
@@ -818,13 +819,13 @@
|
|
|
818
819
|
<div class="attributes">
|
|
819
820
|
${item.special_values
|
|
820
821
|
.filter(sv => sv.heading_loc)
|
|
821
|
-
.map((sv) =>
|
|
822
|
+
.map((sv) =>
|
|
822
823
|
`<p>
|
|
823
824
|
<span class="heading">${sv.heading_loc}</span>
|
|
824
825
|
<span class="values">
|
|
825
826
|
${!(sv.values_float.every(value => value === 0) || sv.values_float.length == 0) ?
|
|
826
827
|
`<span class="primary${(sv.values_float.every(value => value === 0) || sv.values_float.length == 0)?" empty":""}">
|
|
827
|
-
${(!((sv.values_float.every(value => value === 0) || sv.values_float.length == 0) && (sv.values_scepter.length || sv.values_shard.length || sv.facet_bonus.name))
|
|
828
|
+
${(!((sv.values_float.every(value => value === 0) || sv.values_float.length == 0) && (sv.values_scepter.length || sv.values_shard.length || sv.facet_bonus.name))
|
|
828
829
|
? (sv.values_float.map(value => value + (sv.is_percentage ? "%" : "")).join(" / ")) : "")}
|
|
829
830
|
</span>` : "" }
|
|
830
831
|
${sv.values_scepter && sv.values_scepter.length ?
|
|
@@ -839,7 +840,7 @@
|
|
|
839
840
|
`<span class="alternative facet">
|
|
840
841
|
<span class="facet"><span class="name_back type_${hero.facets.find(facet=>facet.name==sv.facet_bonus.name).color}"><img src="${utils.getImageUrl(hero.facets.find(facet=>facet.name==sv.facet_bonus.name).icon, ImageType.IconsFacets)}" />${sv.facet_bonus.values.map(value => value + (sv.is_percentage ? "%" : "")).join(" / ")}</span></span>
|
|
841
842
|
</span>` : "" }
|
|
842
|
-
${sv.bonuses.length ?
|
|
843
|
+
${sv.bonuses.length ?
|
|
843
844
|
`<span class="alternative talent">
|
|
844
845
|
${sv.bonuses.map(bonus=>` <img src="${utils.getImageUrl("talents","icons","svg")}"/>${(bonus.value>0?'<span class="plus">+</span>':"")+bonus.value+(sv.is_percentage?"%":"")}`).join(" ")}
|
|
845
846
|
</span>` : "" }
|