feat.完成基建制造站配置及资源

This commit is contained in:
MistEO
2021-10-16 23:46:51 +08:00
parent bd6f771eca
commit 6c5202e1a0
45 changed files with 278 additions and 7 deletions

189
resource/infrast.json Normal file
View File

@@ -0,0 +1,189 @@
{
"facility": [ "Mfg" ],
"Mfg": {
"Mfg_Doc": "制造站",
"skills_Doc": "技能ID默认就是模板名不带.pngname和intro实际都不产生作用给人看的",
"skills": [
{
"name": [ "咪波·制造型" ],
"intro": "进驻制造站时,生产力+30%",
"template": "Bskill_man_spd3.png"
},
{
"name": [ "标准化·β", "莱茵科技·β", "红松骑士团·β" ],
"intro": "进驻制造站时,生产力+25%",
"template": "Bskill_man_spd2.png"
},
{
"name": [ "标准化·α", "莱茵科技·α", "红松骑士团·α", "磐蟹·豆豆" ],
"intro": "进驻制造站时,生产力+15%",
"template": "Bskill_man_spd1.png"
},
{
"name": [ "大就是好!" ],
"intro": "进驻制造站时当前制造站内干员根据自身提升的仓库容量提供一定的生产力。提升16格以下的每格仓库容量提供1%生产力提升大于16格的每格仓库容量提供3%生产力(无法与回收利用叠加,且优先生效)",
"template": "Bskill_man_spd_variable31.png"
},
{
"name": [ "配合意识" ],
"intro": "进驻制造站时当前制造站内其他干员提供的每5%生产力不包含根据设施数量提供加成的生产力额外提供5%生产力最多提供40%生产力",
"template": "Bskill_man_spd_variable21.png"
},
{
"name": [ "回收利用" ],
"intro": "进驻制造站时当前制造站内干员提升的每格仓库容量提供2%生产力",
"template": "Bskill_man_spd_variable11.png"
},
{
"name": [ "意识实体" ],
"intro": "进驻制造站时每1点思维链环+1%生产力",
"template": "Bskill_man_spd_bd2.png"
},
{
"name": [ "念力" ],
"intro": "进驻制造站时每2点思维链环+1%生产力",
"template": "Bskill_man_spd_bd1.png"
},
{
"name": [ "超感" ],
"intro": "进驻制造站时宿舍内每有1名干员则感知信息+1同时每1点感知信息转化为1点思维链环",
"template": "Bskill_man_spd_bd_n1.png"
},
{
"name": [ "慢性子", "延时摄影" ],
"intro": "进驻制造站后,生产力首小时+15%,此后每小时+2%,最终达到+25%",
"template": "Bskill_man_spd_add2.png"
},
{
"name": [ "急性子", "“等不及”" ],
"intro": "进驻制造站后,生产力首小时+20%,此后每小时+1%,最终达到+25%",
"template": "Bskill_man_spd_add1.png"
},
{
"name": [ "再生能源" ],
"intro": "进驻制造站时,每个贸易站为当前制造站贵金属类配方的生产力+20%",
"template": "Bskill_man_spd&trade.png"
},
{
"name": [ "仿生海龙" ],
"intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+15%的生产力",
"template": "Bskill_man_spd&power3.png"
},
{
"name": [ "自动化·β" ],
"intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+10%的生产力",
"template": "Bskill_man_spd&power2.png"
},
{
"name": [ "自动化·α" ],
"intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+5%的生产力",
"template": "Bskill_man_spd&power1.png"
},
{
"name": [ "仓库整备·β" ],
"intro": "进驻制造站时,仓库容量上限+10生产力+10%",
"template": "Bskill_man_spd&limit3.png"
},
{
"name": [ "仓库整备·α" ],
"intro": "进驻制造站时,仓库容量上限+6生产力+10%",
"template": "Bskill_man_spd&limit1.png"
},
{
"name": [ "“可靠”助手" ],
"intro": "进驻制造站时,生产力-20%,仓库容量上限+17心情每小时消耗-0.25",
"template": "Bskill_man_spd&limit&cost4.png"
},
{
"name": [ "特立独行", "麻烦制造者" ],
"intro": "",
"template": "Bskill_man_spd&limit&cost3.png"
},
{
"name": [ "工匠精神·β" ],
"intro": "进驻制造站时,生产力-5%,仓库容量上限+19心情每小时消耗-0.25",
"template": "Bskill_man_spd&limit&cost2.png"
},
{
"name": [ "工匠精神·α" ],
"intro": "进驻制造站时,生产力-5%,仓库容量上限+16心情每小时消耗-0.15",
"template": "Bskill_man_spd&limit&cost1.png"
},
{
"name": [ "意识协议" ],
"intro": "进驻制造站时,当前制造站内每个标准化类技能为自身+5%的生产力",
"template": "Bskill_man_skill_spd.png"
},
{
"name": [ "源石工艺·β", "地质学·β", "火山学家", "源石研究" ],
"intro": "进驻制造站时,源石类配方的生产力+35%",
"template": "Bskill_man_originium2.png"
},
{
"name": [ "源石工艺·α", "地质学·α" ],
"intro": "进驻制造站时,源石类配方的生产力+30%",
"template": "Bskill_man_originium1.png"
},
{
"name": [ "探险者" ],
"intro": "进驻制造站时,仓库容量上限+16心情每小时消耗-0.25",
"template": "Bskill_man_limit&cost3.png"
},
{
"name": [ "囤积者" ],
"intro": "进驻制造站时,仓库容量上限+10心情每小时消耗-0.25",
"template": "Bskill_man_limit&cost2.png"
},
{
"name": [ "拾荒者", "智慧之境", "“都想要”", "磐蟹·阿盘" ],
"intro": "进驻制造站时,仓库容量上限+8心情每小时消耗-0.25",
"template": "Bskill_man_limit&cost1.png"
},
{
"name": [ "金属工艺·β" ],
"intro": "进驻制造站时,贵金属类配方的生产力+35%",
"template": "Bskill_man_gold2.png"
},
{
"name": [ "金属工艺·α" ],
"intro": "进驻制造站时,贵金属类配方的生产力+30%",
"template": "Bskill_man_gold1.png"
},
{
"name": [ "拳术指导录像" ],
"intro": "进驻制造站时,作战记录类配方的生产力+35%",
"template": "Bskill_man_exp3.png"
},
{
"name": [ "作战指导录像" ],
"intro": "进驻制造站时,作战记录类配方的生产力+30%",
"template": "Bskill_man_exp2.png"
},
{
"name": [ "胜利之计" ],
"intro": "进驻制造站时,作战记录类配方的生产力+25%",
"template": "Bskill_man_exp1.png"
},
{
"name": [ "剪辑·β" ],
"intro": "进驻制造站时,生产作战记录类配方时,仓库容量上限+15",
"template": "Bskill_man_exp&limit2.png"
},
{
"name": [ "剪辑·α" ],
"intro": "进驻制造站时,生产作战记录类配方时,仓库容量上限+12",
"template": "Bskill_man_exp&limit1.png"
},
{
"name": [ "Vlog" ],
"intro": "进驻制造站时,生产作战记录类配方时,心情每小时消耗-0.25",
"template": "Bskill_man_exp&cost.png"
},
{
"name": [ "团队精神" ],
"intro": "进驻制造站时,消除当前制造站内所有干员自身心情消耗的影响",
"template": "Bskill_man_cost_all.png"
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,26 @@
#include "InfrastConfiger.h"
#include <json.h>
bool asst::InfrastConfiger::parse(const json::value& json)
{
for (const json::value& facility : json.at("facility").as_array()) {
for (const json::value& skill_json : json.at(facility.as_string()).as_array()) {
InfrastSkill skill;
skill.templ_name = skill_json.at("template").as_string();
m_templ_required.emplace(skill.templ_name);
std::string id = skill_json.get("id", skill.templ_name);
skill.id = id;
if (skill_json.exist("name")) {
for (const json::value& skill_names : skill_json.at("name").as_array()) {
skill.names.emplace_back(skill_names.as_string());
}
}
skill.intro = skill_json.get("intro", std::string());
m_skills.emplace(std::move(id), std::move(skill));
}
}
return false;
}

View File

@@ -0,0 +1,33 @@
#pragma once
#include "AbstractConfiger.h"
#include <unordered_map>
#include <unordered_set>
namespace asst {
struct InfrastSkill {
std::string id;
std::string templ_name;
std::vector<std::string> names; // 很多基建技能是一样的就是名字不同。所以一个技能id可能对应多个名字
std::string intro;
};
class InfrastConfiger : public AbstractConfiger
{
public:
virtual ~InfrastConfiger() = default;
const std::unordered_set<std::string>& get_templ_required() const noexcept {
return m_templ_required;
}
const std::unordered_map<std::string, InfrastSkill>& get_skills() const noexcept {
return m_skills;
}
protected:
virtual bool parse(const json::value& json) override;
std::unordered_map<std::string, InfrastSkill> m_skills;
std::unordered_set<std::string> m_templ_required;
};
}

View File

@@ -24,6 +24,7 @@
<ClInclude Include="CreditShopImageAnalyzer.h" />
<ClInclude Include="GeneralConfiger.h" />
<ClInclude Include="CreditShoppingTask.h" />
<ClInclude Include="InfrastConfiger.h" />
<ClInclude Include="InfrastShiftTask.h" />
<ClInclude Include="InfrastSkillsImageAnalyzer.h" />
<ClInclude Include="InfrastSmileyImageAnalyzer.h" />
@@ -55,6 +56,7 @@
<ClCompile Include="AbstractTask.cpp" />
<ClCompile Include="CreditShopImageAnalyzer.cpp" />
<ClCompile Include="CreditShoppingTask.cpp" />
<ClCompile Include="InfrastConfiger.cpp" />
<ClCompile Include="InfrastShiftTask.cpp" />
<ClCompile Include="InfrastSkillsImageAnalyzer.cpp" />
<ClCompile Include="InfrastSmileyImageAnalyzer.cpp" />
@@ -82,7 +84,7 @@
</ItemGroup>
<ItemGroup>
<None Include="..\..\resource\config.json" />
<None Include="..\..\resource\recruit.json" />
<None Include="..\..\resource\infrast.json" />
<None Include="..\..\resource\tasks.json" />
</ItemGroup>
<PropertyGroup Label="Globals">

View File

@@ -165,6 +165,9 @@
<ClInclude Include="InfrastSmileyImageAnalyzer.h">
<Filter>头文件\ImageAnalyzer\Infrast</Filter>
</ClInclude>
<ClInclude Include="InfrastConfiger.h">
<Filter>头文件\Resource</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Controller.cpp">
@@ -257,15 +260,18 @@
<ClCompile Include="OcrImageAnalyzer.cpp">
<Filter>源文件\ImageAnalyzer\General</Filter>
</ClCompile>
<ClCompile Include="InfrastConfiger.cpp">
<Filter>源文件\Resource</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\resource\config.json">
<Filter>资源文件</Filter>
</None>
<None Include="..\..\resource\recruit.json">
<None Include="..\..\resource\tasks.json">
<Filter>资源文件</Filter>
</None>
<None Include="..\..\resource\tasks.json">
<None Include="..\..\resource\infrast.json">
<Filter>资源文件</Filter>
</None>
</ItemGroup>

View File

@@ -15,6 +15,7 @@ bool asst::Resource::load(const std::string& dir)
constexpr static const char* TaskDataFilename = "tasks.json";
constexpr static const char* RecruitCfgFilename = "recruit.json";
constexpr static const char* ItemCfgFilename = "item_index.json";
constexpr static const char* InfrastCfgFilename = "infrast.json";
constexpr static const char* UserCfgFilename = "..\\user.json";
constexpr static const char* OcrResourceFilename = "OcrLiteOnnx";
constexpr static const char* PenguinResourceFilename = "penguin-stats-recognize";
@@ -48,7 +49,11 @@ bool asst::Resource::load(const std::string& dir)
const auto& opt = m_general_cfg_unique_ins.get_options();
/* 加载模板图片资源 */
m_templ_resource_unique_ins.set_load_required(m_task_data_unique_ins.get_templ_required());
// task所需要的模板资源
m_templ_resource_unique_ins.append_load_required(m_task_data_unique_ins.get_templ_required());
// 基建所需要的模板资源
m_templ_resource_unique_ins.append_load_required(m_infrast_cfg_unique_ins.get_templ_required());
if (!m_templ_resource_unique_ins.load(dir + TemplsFilename)) {
m_last_error = m_templ_resource_unique_ins.get_last_error();
return false;

View File

@@ -12,6 +12,7 @@
#include "TaskData.h"
#include "RecruitConfiger.h"
#include "ItemConfiger.h"
#include "InfrastConfiger.h"
#include "UserConfiger.h"
#include "OcrPack.h"
#include "PenguinPack.h"
@@ -44,6 +45,9 @@ namespace asst {
ItemConfiger& item() noexcept {
return m_item_cfg_unique_ins;
}
InfrastConfiger& infrast() noexcept {
return m_infrast_cfg_unique_ins;
}
OcrPack& ocr() noexcept {
return m_ocr_pack_unique_ins;
}
@@ -66,6 +70,9 @@ namespace asst {
const ItemConfiger& item() const noexcept {
return m_item_cfg_unique_ins;
}
const InfrastConfiger& infrast() const noexcept {
return m_infrast_cfg_unique_ins;
}
const OcrPack& ocr() const noexcept {
return m_ocr_pack_unique_ins;
}
@@ -83,6 +90,7 @@ namespace asst {
TaskData m_task_data_unique_ins;
RecruitConfiger m_recruit_cfg_unique_ins;
ItemConfiger m_item_cfg_unique_ins;
InfrastConfiger m_infrast_cfg_unique_ins;
UserConfiger m_user_cfg_unique_ins;
OcrPack m_ocr_pack_unique_ins;
PenguinPack m_penguin_pack_unique_ins;

View File

@@ -4,9 +4,11 @@
#include <array>
#include <string_view>
void asst::TemplResource::set_load_required(std::unordered_set<std::string> required) noexcept
void asst::TemplResource::append_load_required(std::unordered_set<std::string> required) noexcept
{
m_templs_filename = std::move(required);
m_templs_filename.insert(
std::make_move_iterator(required.begin()),
std::make_move_iterator(required.end()));
}
bool asst::TemplResource::load(const std::string& dir)

View File

@@ -16,7 +16,7 @@ namespace asst {
virtual ~TemplResource() = default;
void set_load_required(std::unordered_set<std::string> required) noexcept;
void append_load_required(std::unordered_set<std::string> required) noexcept;
virtual bool load(const std::string& dir) override;
bool exist_templ(const std::string& key) const noexcept;