Skip to content

Commit

Permalink
资源更新_2281_24-05-28-13-45-33-2fd577/扫仓库特征提取更新/格式化代码/删掉无用变量/解包技能 (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyn101 authored and ZhaoZuohong committed Jun 5, 2024
1 parent 3786592 commit e8a58de
Show file tree
Hide file tree
Showing 14 changed files with 352 additions and 84 deletions.
2 changes: 1 addition & 1 deletion ArknightsGameResource
2 changes: 1 addition & 1 deletion arknights_mower/data/agent.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["芬", "梅", "宴", "砾", "孑", "吽", "红", "空", "黑", "W", "夕", "林", "令", "阿", "黍", "年", "山", "陈", "锏", "煌", "夜刀", "黑角", "杜林", "香草", "翎羽", "卡缇", "斑点", "炎熔", "芙蓉", "梓兰", "夜烟", "远山", "卡达", "深靛", "布丁", "流星", "红云", "白雪", "松果", "酸糖", "铅踝", "跃跃", "讯使", "红豆", "豆苗", "杜宾", "缠丸", "霜叶", "慕斯", "刻刀", "芳汀", "石英", "暗索", "末药", "清流", "褐果", "角峰", "泡泡", "露托", "古米", "坚雷", "地灵", "伊桑", "阿消", "维荻", "微风", "凛冬", "贾维", "青枳", "红隼", "苇草", "野鬃", "极境", "万顷", "夜半", "晓歌", "谜图", "鞭刃", "苍苔", "医生", "炎客", "摩根", "燧石", "断崖", "烈夏", "铎铃", "柏喙", "战车", "星极", "铸铁", "赤冬", "海沫", "奥达", "蓝毒", "白金", "灰喉", "四月", "隐现", "陨星", "慑砂", "截云", "苦艾", "雪绒", "天火", "惊蛰", "星源", "蜜蜡", "寒檀", "薄绿", "和弦", "蚀清", "耶拉", "洛洛", "至简", "折光", "温米", "梅尔", "稀音", "赫默", "亚叶", "锡兰", "絮雨", "图耶", "桑葚", "蜜莓", "刺玫", "明椒", "临光", "深律", "槐琥", "乌有", "雷蛇", "可颂", "拜松", "火神", "石棉", "暮落", "闪击", "暴雨", "灰毫", "火哨", "极光", "洋灰", "玫拉", "子月", "熔泉", "冰酿", "空构", "崖心", "雪雉", "杏仁", "初雪", "巫恋", "真理", "但书", "小满", "掠风", "海蒂", "月禾", "夏栎", "凛视", "狮蝎", "绮良", "罗宾", "霜华", "贝娜", "风丸", "双月", "空弦", "灰烬", "鸿雪", "远牙", "早露", "提丰", "莱伊", "风笛", "嵯峨", "琴柳", "焰尾", "伺夜", "异客", "澄闪", "黑键", "灵知", "铃兰", "魔王", "白铁", "塑心", "傀影", "老鲤", "温蒂", "水月", "艾拉", "闪灵", "夜莺", "流明", "星熊", "瑕光", "泥岩", "斥罪", "森蚺", "号角", "重岳", "银灰", "棘刺", "仇白", "左乐", "止颂", "暴行", "空爆", "猎蜂", "杰克", "夜魔", "巡林者", "12F", "玫兰莎", "泡普卡", "米格鲁", "克洛丝", "安赛尔", "格雷伊", "杰西卡", "安比尔", "清道夫", "桃金娘", "断罪者", "罗小黑", "休谟斯", "嘉维尔", "苏苏洛", "调香师", "蛇屠箱", "深海色", "波登可", "白面鸮", "诗怀雅", "芙兰卡", "因陀罗", "达格达", "幽灵鲨", "布洛卡", "导火索", "羽毛笔", "龙舌兰", "送葬人", "奥斯塔", "阿米娅", "特米米", "爱丽丝", "戴菲恩", "阿罗玛", "华法琳", "哈洛德", "卡夫卡", "车尔尼", "守林人", "安哲拉", "埃拉托", "九色鹿", "食铁兽", "见行者", "能天使", "迷迭香", "伊内丝", "刻俄柏", "逻各斯", "麦哲伦", "多萝西", "凯尔希", "塞雷娅", "赫德雷", "艾丽妮", "赫拉格", "帕拉斯", "玛恩纳", "月见夜", "格拉尼", "斯卡蒂", "安德切尔", "史都华德", "艾丝黛尔", "罗比菈塔", "德克萨斯", "拉普兰德", "莱恩哈特", "炎狱炎熔", "濯尘芙蓉", "普罗旺斯", "格劳克斯", "菲亚梅塔", "维什戴尔", "推进之王", "缪尔赛思", "伊芙利特", "莫斯提马", "艾雅法拉", "霍尔海雅", "卡涅利安", "安洁莉娜", "淬羽赫默", "歌蕾蒂娅", "阿斯卡纶", "焰影苇草", "史尔特尔", "薇薇安娜", "正义骑士号", "历阵锐枪芬", "火龙S黑角", "寒芒克洛丝", "承曦格雷伊", "假日威龙陈", "浊心斯卡蒂", "麒麟R夜刀", "琳琅诗怀雅", "归溟幽灵鲨", "涤火杰西卡", "百炼嘉维尔", "耀骑士临光", "圣约送葬人", "缄默德克萨斯", "纯烬艾雅法拉", "THRM-EX", "泰拉大陆调查团", "Lancet-2", "Castle-3", "PhonoR-0", "Friston-3", "U-Official"]
["芬", "梅", "宴", "砾", "孑", "吽", "红", "空", "黑", "W", "夕", "林", "令", "阿", "黍", "年", "山", "陈", "锏", "煌", "夜刀", "黑角", "杜林", "香草", "翎羽", "卡缇", "斑点", "炎熔", "芙蓉", "梓兰", "夜烟", "远山", "卡达", "深靛", "布丁", "流星", "红云", "白雪", "松果", "酸糖", "铅踝", "跃跃", "讯使", "红豆", "豆苗", "杜宾", "缠丸", "霜叶", "慕斯", "刻刀", "芳汀", "石英", "暗索", "末药", "清流", "褐果", "角峰", "泡泡", "露托", "古米", "坚雷", "地灵", "伊桑", "阿消", "维荻", "微风", "凛冬", "贾维", "青枳", "红隼", "苇草", "野鬃", "极境", "万顷", "夜半", "晓歌", "谜图", "鞭刃", "苍苔", "医生", "炎客", "摩根", "燧石", "断崖", "烈夏", "铎铃", "柏喙", "战车", "星极", "铸铁", "赤冬", "海沫", "奥达", "蓝毒", "白金", "灰喉", "四月", "隐现", "陨星", "慑砂", "截云", "苦艾", "雪绒", "天火", "惊蛰", "星源", "蜜蜡", "寒檀", "薄绿", "和弦", "蚀清", "耶拉", "洛洛", "至简", "折光", "温米", "梅尔", "稀音", "赫默", "亚叶", "锡兰", "絮雨", "图耶", "桑葚", "蜜莓", "刺玫", "明椒", "临光", "深律", "槐琥", "乌有", "雷蛇", "深巡", "可颂", "拜松", "火神", "石棉", "暮落", "闪击", "暴雨", "灰毫", "火哨", "极光", "洋灰", "玫拉", "子月", "熔泉", "冰酿", "空构", "崖心", "雪雉", "杏仁", "初雪", "巫恋", "海霓", "真理", "但书", "小满", "掠风", "海蒂", "月禾", "夏栎", "凛视", "狮蝎", "绮良", "罗宾", "霜华", "贝娜", "风丸", "双月", "空弦", "灰烬", "鸿雪", "远牙", "早露", "提丰", "莱伊", "风笛", "嵯峨", "琴柳", "焰尾", "伺夜", "异客", "澄闪", "黑键", "灵知", "铃兰", "魔王", "白铁", "塑心", "傀影", "老鲤", "温蒂", "水月", "艾拉", "闪灵", "夜莺", "流明", "星熊", "瑕光", "泥岩", "斥罪", "森蚺", "号角", "重岳", "银灰", "棘刺", "仇白", "左乐", "止颂", "暴行", "空爆", "猎蜂", "杰克", "夜魔", "巡林者", "12F", "玫兰莎", "泡普卡", "米格鲁", "克洛丝", "安赛尔", "格雷伊", "杰西卡", "安比尔", "清道夫", "桃金娘", "断罪者", "罗小黑", "休谟斯", "嘉维尔", "苏苏洛", "调香师", "蛇屠箱", "深海色", "波登可", "白面鸮", "诗怀雅", "芙兰卡", "因陀罗", "达格达", "幽灵鲨", "布洛卡", "导火索", "羽毛笔", "龙舌兰", "送葬人", "奥斯塔", "阿米娅", "特米米", "爱丽丝", "戴菲恩", "阿罗玛", "华法琳", "哈洛德", "卡夫卡", "车尔尼", "守林人", "安哲拉", "埃拉托", "九色鹿", "食铁兽", "见行者", "能天使", "迷迭香", "伊内丝", "刻俄柏", "逻各斯", "麦哲伦", "多萝西", "凯尔希", "塞雷娅", "赫德雷", "艾丽妮", "赫拉格", "帕拉斯", "玛恩纳", "月见夜", "格拉尼", "斯卡蒂", "安德切尔", "史都华德", "艾丝黛尔", "罗比菈塔", "德克萨斯", "拉普兰德", "莱恩哈特", "炎狱炎熔", "濯尘芙蓉", "普罗旺斯", "格劳克斯", "菲亚梅塔", "维什戴尔", "推进之王", "缪尔赛思", "伊芙利特", "莫斯提马", "艾雅法拉", "霍尔海雅", "卡涅利安", "安洁莉娜", "淬羽赫默", "歌蕾蒂娅", "阿斯卡纶", "焰影苇草", "乌尔比安", "史尔特尔", "薇薇安娜", "正义骑士号", "历阵锐枪芬", "火龙S黑角", "寒芒克洛丝", "承曦格雷伊", "假日威龙陈", "浊心斯卡蒂", "麒麟R夜刀", "琳琅诗怀雅", "归溟幽灵鲨", "涤火杰西卡", "百炼嘉维尔", "耀骑士临光", "圣约送葬人", "缄默德克萨斯", "纯烬艾雅法拉", "THRM-EX", "泰拉大陆调查团", "Lancet-2", "Castle-3", "PhonoR-0", "Friston-3", "U-Official"]
2 changes: 1 addition & 1 deletion arknights_mower/data/key_mapping.json

Large diffs are not rendered by default.

107 changes: 57 additions & 50 deletions auto_get_res_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def 检查图标代码匹配(目标图标代码):

self.物品_名称对 = {}
from PIL import Image

if not os.path.exists("./ui/public/depot/EXP.webp"):
png_image = Image.open("./ArknightsGameResource/item/EXP_PLAYER.png")
png_image.save("./ui/public/depot/EXP.webp", "WEBP")
Expand Down Expand Up @@ -138,7 +139,6 @@ def 添加干员(self):
print()

def 读取卡池(self):

抽卡 = self.抽卡表.get("gachaPoolClient", [])
卡池类型映射 = {
"SINGLE": "单人池",
Expand Down Expand Up @@ -202,9 +202,8 @@ def 读取活动关卡(self):
关卡掉落表 = self.关卡表["stages"][]["stageDropInfo"]["displayRewards"]
关卡掉落 = {"普通掉落": []}
for item in 关卡掉落表:
if not "side_token" in self.物品表["items"][item["id"]]["iconId"]:
if not item["dropType"] == 8:

if "side_token" not in self.物品表["items"][item["id"]]["iconId"]:
if item["dropType"] != 8:
关卡掉落["普通掉落"].append(
self.物品表["items"][item["id"]]["name"]
)
Expand Down Expand Up @@ -236,7 +235,7 @@ def load_recruit_data(self):
}
# for 干员代码, 干员数据 in self.干员表.items():
# print(干员代码,干员数据)
recruit_list = self.抽卡表['recruitDetail'].replace("\\n<@rc.eml>", "")
recruit_list = self.抽卡表["recruitDetail"].replace("\\n<@rc.eml>", "")
recruit_list = recruit_list.replace("\\n", "")
recruit_list = recruit_list.replace("\r", "")
recruit_list = recruit_list.replace("★", "")
Expand All @@ -247,13 +246,17 @@ def load_recruit_data(self):
recruit_list = recruit_list.replace("--------------------", "")
recruit_list = recruit_list.replace("<@rc.title>公开招募说明", "")
recruit_list = recruit_list.replace("<@rc.em>※稀有职业需求招募说明※", "")
recruit_list = recruit_list.replace("<@rc.em>当职业需求包含高级资深干员,且招募时限为9小时时,招募必得6星干员",
"")
recruit_list = recruit_list.replace(
"<@rc.em>当职业需求包含资深干员同时不包含高级资深干员,且招募时限为9小时,则该次招募必得5星干员", "")
"<@rc.em>当职业需求包含高级资深干员,且招募时限为9小时时,招募必得6星干员",
"",
)
recruit_list = recruit_list.replace(
"<@rc.em>当职业需求包含资深干员同时不包含高级资深干员,且招募时限为9小时,则该次招募必得5星干员",
"",
)
recruit_list = recruit_list.replace("<@rc.subtitle>※全部可能出现的干员※", "")
recruit_list = recruit_list.replace("绿色高亮的不可寻访干员,可以在此招募", "")
recruit_list = recruit_list.split('\n')
recruit_list = recruit_list.split("\n")

profession = {
"MEDIC": "医疗干员",
Expand All @@ -263,57 +266,60 @@ def load_recruit_data(self):
"CASTER": "术师干员",
"TANK": "重装干员",
"SUPPORT": "辅助干员",
"PIONEER": "先锋干员"
"PIONEER": "先锋干员",
}

for 干员代码, 干员数据 in self.干员表.items():
干员名 = 干员数据["name"]

if 干员数据['profession'] not in profession:
if 干员数据["profession"] not in profession:
continue

if 干员名 in recruit_list:
tag = 干员数据['tagList']
tag = 干员数据["tagList"]
# 数据中稀有度从0-5
干员数据['rarity'] = 干员数据['rarity'] + 1
干员数据["rarity"] = 干员数据["rarity"] + 1
if len(干员名) <= 4:
recruit_result_data[len(干员名)].append(干员代码)
else:
recruit_result_data[-1].append(干员代码)
if 干员数据['rarity'] == 5:
if 干员数据["rarity"] == 5:
tag.append("资深干员")
elif 干员数据['rarity'] == 6:
elif 干员数据["rarity"] == 6:
tag.append("高级资深干员")

if 干员数据['position'] == "MELEE":
if 干员数据["position"] == "MELEE":
tag.append("近战位")
elif 干员数据['position'] == "RANGED":
elif 干员数据["position"] == "RANGED":
tag.append("远程位")

tag.append(profession[干员数据['profession']])
tag.append(profession[干员数据["profession"]])

recruit_data[干员代码] = {
"name": 干员名,
"stars": 干员数据['rarity'],
"tags": 干员数据['tagList']
"stars": 干员数据["rarity"],
"tags": 干员数据["tagList"],
}
print("{} stars:{} tags:{}".format(干员名, 干员数据['rarity'], 干员数据['tagList']))
print(
"{} stars:{} tags:{}".format(
干员名, 干员数据["rarity"], 干员数据["tagList"]
)
)
print("载入公招干员数据{}个".format(len(recruit_data)))
with open("./arknights_mower/data/recruit.json", "w", encoding="utf-8") as f:
json.dump(recruit_data, f, ensure_ascii=False,indent=4)
json.dump(recruit_data, f, ensure_ascii=False, indent=4)

with open("./arknights_mower/data/recruit_result.json", "w", encoding="utf-8") as f:
json.dump(recruit_result_data, f, ensure_ascii=False,indent=4)
with open(
"./arknights_mower/data/recruit_result.json", "w", encoding="utf-8"
) as f:
json.dump(recruit_result_data, f, ensure_ascii=False, indent=4)

def load_recruit_template(self):
# !/usr/bin/env python3
with open(
"./arknights_mower/data/recruit.json", "r",
encoding='utf-8') as f:
with open("./arknights_mower/data/recruit.json", "r", encoding="utf-8") as f:
recruit_operators = json.load(f)

font = ImageFont.truetype(
"FZDYSK.TTF", 120)
font = ImageFont.truetype("FZDYSK.TTF", 120)
print(len(recruit_operators))
for operator in recruit_operators:
im = Image.new(mode="RGBA", size=(1920, 1080))
Expand All @@ -339,7 +345,7 @@ def 提取特征点(模板):
def 加载图片特征点_标签(模板类型):
特征点列表 = []
标签列表 = []
for [目标文件路径, 源文件路径] in (self.装仓库物品的字典[模板类型]):
for [目标文件路径, 源文件路径] in self.装仓库物品的字典[模板类型]:
模板 = cv2.imread(源文件路径)
模板 = cv2.resize(模板, (213, 213))
特征点 = 提取特征点(模板)
Expand All @@ -363,20 +369,14 @@ def 保存knn模型(classifier, filename):
保存knn模型(knn模型, 模型保存路径)

def 批量训练并保存扫仓库模型(self):
self.训练仓库的knn模型(
"NORMAL", "./arknights_mower/models/NORMAL.pkl"
)
self.训练仓库的knn模型(
"CONSUME", "./arknights_mower/models/CONSUME.pkl"
)
self.训练仓库的knn模型(
"MATERIAL", "./arknights_mower/models/MATERIAL.pkl"
)
self.训练仓库的knn模型("NORMAL", "./arknights_mower/models/NORMAL.pkl")
self.训练仓库的knn模型("CONSUME", "./arknights_mower/models/CONSUME.pkl")
self.训练仓库的knn模型("MATERIAL", "./arknights_mower/models/MATERIAL.pkl")

def 训练在房间内的干员名的模型(self):

font = ImageFont.truetype(
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 37)
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 37
)

data = {}

Expand All @@ -390,10 +390,11 @@ def 训练在房间内的干员名的模型(self):
img = thres2(img, 200)
dilation = cv2.dilate(img, kernel, iterations=1)
contours, _ = cv2.findContours(
dilation, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
dilation, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE
)
rect = map(lambda c: cv2.boundingRect(c), contours)
x, y, w, h = sorted(rect, key=lambda c: c[0])[0]
img = img[y: y + h, x: x + w]
img = img[y : y + h, x : x + w]
tpl = np.zeros((46, 265), dtype=np.uint8)
tpl[: img.shape[0], : img.shape[1]] = img
# cv2.imwrite(f"/home/zhao/Desktop/data/{operator}.png", tpl)
Expand All @@ -404,11 +405,14 @@ def 训练在房间内的干员名的模型(self):

def 训练选中的干员名的模型(self):
font31 = ImageFont.truetype(
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 31)
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 31
)
font30 = ImageFont.truetype(
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 30)
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 30
)
font25 = ImageFont.truetype(
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 25)
"arknights_mower/fonts/SourceHanSansCN-Medium.otf", 25
)

data = {}

Expand All @@ -428,10 +432,11 @@ def 训练选中的干员名的模型(self):
img = thres2(img, 140)
dilation = cv2.dilate(img, kernel, iterations=1)
contours, _ = cv2.findContours(
dilation, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
dilation, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE
)
rect = map(lambda c: cv2.boundingRect(c), contours)
x, y, w, h = sorted(rect, key=lambda c: c[0])[0]
img = img[y: y + h, x: x + w]
img = img[y : y + h, x : x + w]
tpl = np.zeros((42, 200), dtype=np.uint8)
tpl[: img.shape[0], : img.shape[1]] = img
# cv2.imwrite(f"/home/zhao/Desktop/data/{operator}.png", tpl)
Expand All @@ -450,8 +455,6 @@ def 训练选中的干员名的模型(self):
数据处理器.读取卡池()
数据处理器.读取活动关卡()

数据处理器.load_recruit_data()
数据处理器.load_recruit_template()

数据处理器.批量训练并保存扫仓库模型()
print("批量训练并保存扫仓库模型,完成")
Expand All @@ -461,3 +464,7 @@ def 训练选中的干员名的模型(self):
print("训练在房间内的干员名的模型,完成")
数据处理器.训练选中的干员名的模型()
print("训练选中的干员名的模型,完成")


数据处理器.load_recruit_data()
数据处理器.load_recruit_template()
Binary file added ui/public/avatar/乌尔比安.webp
Binary file not shown.
Binary file added ui/public/avatar/海霓.webp
Binary file not shown.
Binary file added ui/public/avatar/深巡.webp
Binary file not shown.
Binary file added ui/public/depot/乌尔比安的信物.webp
Binary file not shown.
Binary file added ui/public/depot/海霓的信物.webp
Binary file not shown.
Binary file added ui/public/depot/深巡的信物.webp
Binary file not shown.
13 changes: 4 additions & 9 deletions ui/src/components/MaaWeeklyNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { h, ref } from 'vue'
const currentDay = ref(new Date().getDay())
const daysOfWeek = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
const dayOfWeek = ['', '', '', '', '', '', '']
const togglePlanAndStage = (plan, day) => {
plan[day] = plan[day] === 1 ? 2 : 1
maa_weekly_plan.value.slice(0, daysOfWeek.length).forEach((p, i) => {
Expand Down Expand Up @@ -108,7 +107,7 @@ function create_tag(label) {
}
}
}
const aaabbbccc = [
const 默认 = [
{
stage: 'Annihilation',
周一: 1,
Expand Down Expand Up @@ -301,7 +300,7 @@ const aaabbbccc = [
}
]
function clear() {
maa_weekly_plan1.value = aaabbbccc
maa_weekly_plan1.value = 默认
}
</script>

Expand Down Expand Up @@ -345,12 +344,8 @@ function clear() {
<thead>
<tr>
<th>关卡</th>
<th
v-for="(day, index) in dayOfWeek"
:key="index"
:class="{ today: currentDay === index }"
>
{{ day }}{{ currentDay === (index + 1) % 7 ? ' (今天)' : '' }}
<th v-for="(day, index) in daysOfWeek" :key="index">
{{ day[1] }}{{ currentDay === (index + 1) % 7 ? ' (今天)' : '' }}
</th>
</tr>
<tr>
Expand Down
Loading

0 comments on commit e8a58de

Please sign in to comment.