建档
This commit is contained in:
135
source_game/Global/Script/CharacterConfig.cpp
Normal file
135
source_game/Global/Script/CharacterConfig.cpp
Normal file
@@ -0,0 +1,135 @@
|
||||
#include "CharacterConfig.h"
|
||||
#include "Asset/AssetManager.h"
|
||||
#include "Tool/Tool_String.h"
|
||||
namespace GlobalCharacterScript
|
||||
{
|
||||
JobConfig InitJobConfig(std::string JobInfoPath)
|
||||
{
|
||||
JobConfig Config;
|
||||
ScriptData Data = AssetManager::GetInstance().GetScriptInfo(JobInfoPath);
|
||||
while (!Data.IsEnd())
|
||||
{
|
||||
std::string Segment = Data.Get();
|
||||
if (Segment == "[职业名称]")
|
||||
Config.name = Data.Get();
|
||||
else if (Segment == "[生命值上限]")
|
||||
Config.maxHP = std::stof(Data.Get());
|
||||
else if (Segment == "[魔法值上限]")
|
||||
Config.maxMP = std::stof(Data.Get());
|
||||
else if (Segment == "[生命值回复速率]")
|
||||
Config.hpRecoverRate = std::stof(Data.Get());
|
||||
else if (Segment == "[魔法值回复速率]")
|
||||
Config.mpRecoverRate = std::stof(Data.Get());
|
||||
else if (Segment == "[力量]")
|
||||
Config.strength = std::stof(Data.Get());
|
||||
else if (Segment == "[智力]")
|
||||
Config.intelligence = std::stof(Data.Get());
|
||||
else if (Segment == "[体力]")
|
||||
Config.stamina = std::stof(Data.Get());
|
||||
else if (Segment == "[精神]")
|
||||
Config.spirit = std::stof(Data.Get());
|
||||
else if (Segment == "[移动速度]")
|
||||
Config.moveSpeed = std::stof(Data.Get());
|
||||
else if (Segment == "[攻击速度]")
|
||||
Config.attackSpeed = std::stof(Data.Get());
|
||||
else if (Segment == "[释放速度]")
|
||||
Config.castSpeed = std::stof(Data.Get());
|
||||
else if (Segment == "[硬直]")
|
||||
Config.stunResist = std::stof(Data.Get());
|
||||
else if (Segment == "[跳跃力]")
|
||||
Config.jumpPower = std::stof(Data.Get());
|
||||
else if (Segment == "[跳跃速度]")
|
||||
Config.jumpSpeed = std::stof(Data.Get());
|
||||
else if (Segment == "[火属性抗性]")
|
||||
Config.fireResist = std::stof(Data.Get());
|
||||
else if (Segment == "[冰属性抗性]")
|
||||
Config.iceResist = std::stof(Data.Get());
|
||||
else if (Segment == "[光属性抗性]")
|
||||
Config.lightResist = std::stof(Data.Get());
|
||||
else if (Segment == "[暗属性抗性]")
|
||||
Config.darkResist = std::stof(Data.Get());
|
||||
else if (Segment == "[默认技能]")
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
std::string Ret = Data.Get();
|
||||
if (Ret == "[/默认技能]")
|
||||
break;
|
||||
Config.skillList.push_back(std::stoi(Ret));
|
||||
}
|
||||
}
|
||||
else if (Segment == "[默认时装]")
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
std::string Ret = Data.Get();
|
||||
if (Ret == "[/默认时装]")
|
||||
break;
|
||||
std::string Index = Data.Get();
|
||||
Config.defaultAvatarList[Ret] = std::stoi(Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Config;
|
||||
}
|
||||
|
||||
CharacterConfig InitCharacterConfig(std::string JobInfoPath)
|
||||
{
|
||||
CharacterConfig Config;
|
||||
ScriptData Data = AssetManager::GetInstance().GetScriptInfo(std::string("character/") + JobInfoPath);
|
||||
while (!Data.IsEnd())
|
||||
{
|
||||
std::string Segment = Data.Get();
|
||||
if (Segment == "[职业标签]")
|
||||
{
|
||||
std::string JobTab = Data.Get();
|
||||
Config.jobTag = JobTab.substr(1, JobTab.size() - 2);
|
||||
}
|
||||
else if (Segment == "[基础职业属性]")
|
||||
{
|
||||
Config.baseGrowtypePath = Data.Get();
|
||||
Config.baseJobConfig = InitJobConfig(Tool_toLowerCase(Config.baseGrowtypePath));
|
||||
}
|
||||
else if (Segment == "[转职职业属性]")
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
std::string Ret = Data.Get();
|
||||
if (Ret == "[/转职职业属性]")
|
||||
break;
|
||||
Config.growtypePath.push_back(Ret);
|
||||
Config.growtypeJobConfig.push_back(InitJobConfig(Tool_toLowerCase(Ret)));
|
||||
}
|
||||
}
|
||||
else if (Segment == "[动作动画]")
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
std::string Ret = Data.Get();
|
||||
if (Ret == "[/动作动画]")
|
||||
break;
|
||||
std::string path = Data.Get();
|
||||
Config.animationPath[Ret] = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Config;
|
||||
}
|
||||
|
||||
std::vector<CharacterConfig> InitCharacterLst()
|
||||
{
|
||||
std::vector<CharacterConfig> Config;
|
||||
// 先读取角色职业lst
|
||||
ScriptData Data = AssetManager::GetInstance().GetScriptInfo("character/character.lst");
|
||||
while (!Data.IsEnd())
|
||||
{
|
||||
std::string Index = Data.Get();
|
||||
std::string JobInfoPath = Data.Get();
|
||||
// 读取职业 //TODO 现在只有鬼剑士更改了文件 其他职业读了会炸
|
||||
if (std::stoi(Index) <= 0)
|
||||
Config.push_back(InitCharacterConfig(Tool_toLowerCase(JobInfoPath)));
|
||||
}
|
||||
return Config;
|
||||
}
|
||||
}
|
||||
79
source_game/Global/Script/CharacterConfig.h
Normal file
79
source_game/Global/Script/CharacterConfig.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
namespace GlobalCharacterScript
|
||||
{
|
||||
|
||||
// 职业配置
|
||||
struct JobConfig
|
||||
{
|
||||
// 职业名称
|
||||
std::string name;
|
||||
// HP最大值
|
||||
float maxHP;
|
||||
// MP最大值
|
||||
float maxMP;
|
||||
// HP恢复速率
|
||||
float hpRecoverRate;
|
||||
// MP恢复速率
|
||||
float mpRecoverRate;
|
||||
// 力量
|
||||
float strength;
|
||||
// 智力
|
||||
float intelligence;
|
||||
// 体力
|
||||
float stamina;
|
||||
// 精神
|
||||
float spirit;
|
||||
// 移动速度
|
||||
float moveSpeed;
|
||||
// 攻击速度
|
||||
float attackSpeed;
|
||||
// 释放速度
|
||||
float castSpeed;
|
||||
// 硬直
|
||||
float stunResist;
|
||||
// 跳跃力
|
||||
float jumpPower;
|
||||
// 跳跃速度
|
||||
float jumpSpeed;
|
||||
// 火属性抗性
|
||||
float fireResist;
|
||||
// 冰属性抗性
|
||||
float iceResist;
|
||||
// 光属性抗性
|
||||
float lightResist;
|
||||
// 暗属性抗性
|
||||
float darkResist;
|
||||
|
||||
// 初始技能列表
|
||||
std::vector<int> skillList;
|
||||
// 默认时装列表
|
||||
std::map<std::string, int> defaultAvatarList;
|
||||
};
|
||||
|
||||
// 角色类信息
|
||||
struct CharacterConfig
|
||||
{
|
||||
// 基础职业标识
|
||||
std::string jobTag;
|
||||
// 基础职业路径
|
||||
std::string baseGrowtypePath;
|
||||
// 基础职业配置
|
||||
JobConfig baseJobConfig;
|
||||
// 转职配置路径
|
||||
std::vector<std::string> growtypePath;
|
||||
// 转职职业配置
|
||||
std::vector<JobConfig> growtypeJobConfig;
|
||||
// 动画路径
|
||||
std::map<std::string, std::string> animationPath;
|
||||
};
|
||||
|
||||
// 读取角色Lst信息
|
||||
std::vector<CharacterConfig> InitCharacterLst();
|
||||
// 读取角色信息
|
||||
CharacterConfig InitCharacterConfig(std::string JobInfoPath);
|
||||
// 读取职业信息
|
||||
JobConfig InitJobConfig(std::string JobConfigPath);
|
||||
}
|
||||
19
source_game/Global/Script/EquipmentConfig.cpp
Normal file
19
source_game/Global/Script/EquipmentConfig.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "EquipmentConfig.h"
|
||||
#include "Asset/AssetManager.h"
|
||||
#include "Tool/Tool_String.h"
|
||||
namespace GlobalEquipmentScript
|
||||
{
|
||||
|
||||
std::map<int, std::string> InitEquipmentLst()
|
||||
{
|
||||
std::map<int, std::string> EquipList;
|
||||
ScriptData Data = AssetManager::GetInstance().GetScriptInfo("equipment/equipment.lst");
|
||||
while (!Data.IsEnd())
|
||||
{
|
||||
std::string Index = Data.Get();
|
||||
std::string EquipInfoPath = std::string("equipment/") + Data.Get();
|
||||
EquipList[std::stoi(Index)] = EquipInfoPath;
|
||||
}
|
||||
return EquipList;
|
||||
}
|
||||
}
|
||||
9
source_game/Global/Script/EquipmentConfig.h
Normal file
9
source_game/Global/Script/EquipmentConfig.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
namespace GlobalEquipmentScript
|
||||
{
|
||||
|
||||
std::map<int, std::string> InitEquipmentLst();
|
||||
}
|
||||
Reference in New Issue
Block a user