init
This commit is contained in:
32
game_server/resource/configdb/avatar_config.py
Normal file
32
game_server/resource/configdb/avatar_config.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from dataclasses import dataclass, field
|
||||
from game_server.resource.base_resource import BaseResource, T
|
||||
from game_server.resource.decorators import GameResource
|
||||
from game_server.resource.configdb.avatar_skill_tree_config import AvatarSkillTreeConfig
|
||||
|
||||
@dataclass
|
||||
@GameResource("resources/ExcelOutput/AvatarConfig.json")
|
||||
class AvatarConfig(BaseResource):
|
||||
AvatarID: int
|
||||
AvatarSkills: dict[int, int]
|
||||
|
||||
def on_load(self: T) -> bool:
|
||||
from game_server.resource import ResourceManager
|
||||
|
||||
self.AvatarSkills = {}
|
||||
|
||||
skill_tree_config = ResourceManager.instance().find_all_by_index(
|
||||
AvatarSkillTreeConfig, self.AvatarID
|
||||
)
|
||||
|
||||
for skill in skill_tree_config:
|
||||
skill_id = skill.PointID
|
||||
skill_level = skill.MaxLevel
|
||||
|
||||
skill = self.AvatarSkills.get(skill_id)
|
||||
if not skill:
|
||||
self.AvatarSkills[skill_id] = skill_level
|
||||
return True
|
||||
|
||||
|
||||
def get_index(self) -> str:
|
||||
return str(self.AvatarID)
|
||||
Reference in New Issue
Block a user