}
export async function updatePlayerSkills(playerId: string, playerSkills:Map<SkillID, Skill>, skillExpDiff: Record<SkillID, number>) {
-
const sql = [];
each(skillExpDiff, (val, skillId: SkillID) => {
const skill = playerSkills.get(skillId);
if(skill.exp >= def.expToLevel(skill.level + 1)) {
skill.level++;
skill.exp -= def.expToLevel(skill.level);
- sql.push(`update player_skills set exp = ${skill.exp}, level = ${skill.level} where id = '${skillId}' and player_id = '${playerId}'`);
}
+ sql.push(`update player_skills set exp = ${skill.exp}, level = ${skill.level} where id = '${skillId}' and player_id = '${playerId}'`);
}
});