Learn costs for creation where taken from the wrong source

This commit is contained in:
2026-01-12 17:11:06 +01:00
parent 6cd9681fc3
commit 8e030ee6c9
4 changed files with 135 additions and 3 deletions
+132 -1
View File
@@ -1806,9 +1806,13 @@ func GetAllSkillsWithLE() (map[string][]gin.H, error) {
continue
}
// For character creation, use reduced costs based on category and difficulty
// Regular learning costs (LearnCost) are for existing characters
creationCost := getSkillCreationCost(category.Name, scd.SkillDifficulty.Name)
skillInfo := gin.H{
"name": scd.Skill.Name,
"leCost": scd.LearnCost,
"leCost": creationCost,
"difficulty": scd.SkillDifficulty.Name,
}
@@ -1828,6 +1832,133 @@ func GetAllSkillsWithLE() (map[string][]gin.H, error) {
return skillsByCategory, nil
}
// getSkillCreationCost returns the LE cost for learning a skill during character creation
// These costs are much lower than regular learning costs, as they represent initial training
// Costs vary by both category and difficulty level
func getSkillCreationCost(category string, difficulty string) int {
// Normalize difficulty string for comparison
difficultyLower := strings.ToLower(difficulty)
// Define cost mapping per category and difficulty
switch category {
case "Alltag":
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 1
case "schwer":
return 2
default:
return 1
}
case "Freiland":
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 2
case "schwer":
return 2
default:
return 2
}
case "Halbwelt":
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 2
case "schwer":
return 2
default:
return 2
}
case "Kampf":
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 2
case "schwer":
return 3
default:
return 2
}
case "Körper":
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 1
case "schwer":
return 2
default:
return 1
}
case "Sozial":
switch difficultyLower {
case "leicht":
return 2
case "normal":
return 2
case "schwer":
return 4
default:
return 2
}
case "Unterwelt":
switch difficultyLower {
case "leicht":
return 2
case "normal":
return 4
case "schwer":
return 6
default:
return 4
}
case "Waffen":
switch difficultyLower {
case "leicht":
return 2
case "normal":
return 4
case "schwer":
return 6
case "sehr schwer":
return 8
default:
return 4
}
case "Wissen":
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 2
case "schwer":
return 2
default:
return 2
}
default:
// Default fallback for unknown categories
switch difficultyLower {
case "leicht":
return 1
case "normal":
return 2
case "schwer":
return 3
case "sehr schwer":
return 4
default:
return 2
}
}
}
// GetWeaponSkillsWithLE returns all weapon skills with their learning costs
func GetWeaponSkillsWithLE() ([]gin.H, error) {
// Query weapon skills from gsm_weaponskills table
@@ -509,6 +509,7 @@ export default {
// Try to find by learning category mapping first (most likely scenario)
const learningCategory = this.learningCategories?.find(cat => cat.name === selectedCategoryName)
if (learningCategory && this.availableSkillsByCategory[learningCategory.displayName]) {
return learningCategory.displayName
}
+1 -1
View File
@@ -420,7 +420,7 @@ export default {
previousAttributes: 'Zurück: Attribute',
recalculate: 'Aus Attributen neu berechnen',
calculating: 'Berechne...',
nextSkills: 'Weiter: Fertigkeiten & Zauber',
nextSkills: 'Weiter: Fertigkeiten',
paRollTooltip: 'PA würfeln: 1d100 + 4×(In/10) - 20',
wkRollTooltip: 'WK würfeln: 1d100 + 2×(Ko/10 + In/10) - 20',
lpRollTooltip: 'LP würfeln: 1d3 + 7 + (Ko/10)',
+1 -1
View File
@@ -416,7 +416,7 @@ export default {
previousAttributes: 'Previous: Attributes',
recalculate: 'Recalculate from Attributes',
calculating: 'Calculating...',
nextSkills: 'Next: Skills & Spells',
nextSkills: 'Next: Skills',
paRollTooltip: 'Roll PA: 1d100 + 4×(In/10) - 20',
wkRollTooltip: 'Roll WK: 1d100 + 2×(Ko/10 + In/10) - 20',
lpRollTooltip: 'Roll LP: 1d3 + 7 + (Ko/10)',