Add durable recipe discovery and profession crafting

This commit is contained in:
dingo
2026-09-09 13:28:07 -04:00
parent 940a345613
commit b65f3e8562
42 changed files with 2183 additions and 136 deletions
+147 -14
View File
@@ -6,12 +6,15 @@ type Protocol struct {
CatalogChange *ContentChange `json:"catalogChange,omitempty"`
CatalogPreview *ContentPreview `json:"catalogPreview,omitempty"`
CatalogResult *ContentResult `json:"catalogResult,omitempty"`
CraftRequest *CraftRequest `json:"craftRequest,omitempty"`
CraftResult *CraftResult `json:"craftResult,omitempty"`
Intent Intent `json:"intent"`
Snapshot Snapshot `json:"snapshot"`
}
type ContentCatalog struct {
Combat *CombatContent `json:"combat,omitempty"`
Crafting *CraftingContent `json:"crafting,omitempty"`
EffectSets []EffectSet `json:"effectSets,omitempty"`
Gathering *GatheringContent `json:"gathering,omitempty"`
Items []ItemDefinition `json:"items"`
@@ -95,6 +98,56 @@ type MobSpawn struct {
Z float64 `json:"z"`
}
type CraftingContent struct {
Materials []CraftMaterial `json:"materials"`
Professions []GatheringSkill `json:"professions"`
Recipes []CraftRecipe `json:"recipes"`
Rules CraftRules `json:"rules"`
}
type CraftMaterial struct {
Description string `json:"description"`
ID string `json:"id"`
Name string `json:"name"`
}
type GatheringSkill struct {
BaseXP int64 `json:"baseXp"`
Description string `json:"description"`
ID string `json:"id"`
MaxLevel int64 `json:"maxLevel"`
Name string `json:"name"`
XPPerLevel int64 `json:"xpPerLevel"`
}
type CraftRecipe struct {
Description string `json:"description"`
ID string `json:"id"`
Inputs map[string]int64 `json:"inputs"`
Level int64 `json:"level"`
Name string `json:"name"`
Outputs map[string]int64 `json:"outputs"`
Profession string `json:"profession"`
Revision int64 `json:"revision"`
Stats map[string]float64 `json:"stats"`
Titles []string `json:"titles"`
XP int64 `json:"xp"`
}
type CraftRules struct {
BaseFailure float64 `json:"baseFailure"`
BaseLoss float64 `json:"baseLoss"`
Cooldown float64 `json:"cooldown"`
LossDecay float64 `json:"lossDecay"`
MaxFailure float64 `json:"maxFailure"`
MaxQualityBias float64 `json:"maxQualityBias"`
MinFailure float64 `json:"minFailure"`
MinLoss float64 `json:"minLoss"`
OverLevelDecay float64 `json:"overLevelDecay"`
QualityPerLevel float64 `json:"qualityPerLevel"`
UnderLevelGrowth float64 `json:"underLevelGrowth"`
}
type EffectSet struct {
Description string `json:"description"`
ID string `json:"id"`
@@ -151,17 +204,10 @@ type ResourceDefinition struct {
XP int64 `json:"xp"`
}
type GatheringSkill struct {
BaseXP int64 `json:"baseXp"`
Description string `json:"description"`
ID string `json:"id"`
MaxLevel int64 `json:"maxLevel"`
Name string `json:"name"`
XPPerLevel int64 `json:"xpPerLevel"`
}
type ItemDefinition struct {
AttackID *string `json:"attackId,omitempty"`
CraftPool []CraftStat `json:"craftPool,omitempty"`
CraftRolls *int64 `json:"craftRolls,omitempty"`
Description string `json:"description"`
DropChance float64 `json:"dropChance"`
ID string `json:"id"`
@@ -172,6 +218,14 @@ type ItemDefinition struct {
Weight float64 `json:"weight"`
}
type CraftStat struct {
Max float64 `json:"max"`
Min float64 `json:"min"`
Percent bool `json:"percent"`
Stat string `json:"stat"`
Weight float64 `json:"weight"`
}
type ItemRequirements struct {
Level int64 `json:"level"`
Stats map[string]float64 `json:"stats"`
@@ -215,6 +269,10 @@ type ContentChange struct {
Attack *CombatAttackDraft `json:"attack,omitempty"`
Biome *BiomeDefinitionDraft `json:"biome,omitempty"`
Consumable *GatheringConsumableDraft `json:"consumable,omitempty"`
CraftMaterial *CraftMaterialDraft `json:"craftMaterial,omitempty"`
CraftProfession *GatheringSkillDraft `json:"craftProfession,omitempty"`
CraftRecipe *CraftRecipeDraft `json:"craftRecipe,omitempty"`
CraftRules *CraftRules `json:"craftRules,omitempty"`
EffectSet *EffectSetDraft `json:"effectSet,omitempty"`
EffectSetIDS []string `json:"effectSetIds,omitempty"`
ExpectedVersion int64 `json:"expectedVersion"`
@@ -271,11 +329,10 @@ type GatheringConsumableDraft struct {
Seconds float64 `json:"seconds"`
}
type EffectSetDraft struct {
Description string `json:"description"`
ID *string `json:"id,omitempty"`
Modifiers []StatModifier `json:"modifiers"`
Name string `json:"name"`
type CraftMaterialDraft struct {
Description string `json:"description"`
ID *string `json:"id,omitempty"`
Name string `json:"name"`
}
type GatheringSkillDraft struct {
@@ -287,8 +344,31 @@ type GatheringSkillDraft struct {
XPPerLevel int64 `json:"xpPerLevel"`
}
type CraftRecipeDraft struct {
Description string `json:"description"`
ID *string `json:"id,omitempty"`
Inputs map[string]int64 `json:"inputs"`
Level int64 `json:"level"`
Name string `json:"name"`
Outputs map[string]int64 `json:"outputs"`
Profession string `json:"profession"`
Revision *int64 `json:"revision,omitempty"`
Stats map[string]float64 `json:"stats"`
Titles []string `json:"titles"`
XP int64 `json:"xp"`
}
type EffectSetDraft struct {
Description string `json:"description"`
ID *string `json:"id,omitempty"`
Modifiers []StatModifier `json:"modifiers"`
Name string `json:"name"`
}
type ItemDraft struct {
AttackID *string `json:"attackId,omitempty"`
CraftPool []CraftStat `json:"craftPool,omitempty"`
CraftRolls *int64 `json:"craftRolls,omitempty"`
Description string `json:"description"`
DropChance float64 `json:"dropChance"`
ID *string `json:"id,omitempty"`
@@ -382,6 +462,28 @@ type ContentResult struct {
Version int64 `json:"version"`
}
type CraftRequest struct {
CharacterID string `json:"characterId"`
ID string `json:"id"`
Ingredients map[string]int64 `json:"ingredients"`
Profession string `json:"profession"`
}
type CraftResult struct {
Consumed map[string]int64 `json:"consumed"`
Created []string `json:"created"`
ID string `json:"id"`
Message string `json:"message"`
Recipe *KnownRecipe `json:"recipe,omitempty"`
Success bool `json:"success"`
Valid bool `json:"valid"`
}
type KnownRecipe struct {
DiscoveredAt float64 `json:"discoveredAt"`
Recipe CraftRecipe `json:"recipe"`
}
type Intent struct {
Op string `json:"op"`
Seq int64 `json:"seq"`
@@ -465,6 +567,9 @@ type Character struct {
Attack *CombatAttack `json:"attack,omitempty"`
CarryWeight float64 `json:"carryWeight"`
Consumables []GatheringConsumable `json:"consumables,omitempty"`
CraftedStacks []CraftedStack `json:"craftedStacks,omitempty"`
Crafting map[string]CraftProgress `json:"crafting,omitempty"`
DiscoveredRecipes map[string]KnownRecipe `json:"discoveredRecipes,omitempty"`
Entity Entity `json:"entity"`
Equipment map[string]string `json:"equipment"`
Experience int64 `json:"experience"`
@@ -491,6 +596,33 @@ type Character struct {
Titles []TitleAward `json:"titles"`
}
type CraftedStack struct {
ID string `json:"id"`
Item string `json:"item"`
Provenance CraftProvenance `json:"provenance"`
Quantity int64 `json:"quantity"`
}
type CraftProvenance struct {
At float64 `json:"at"`
CharacterID string `json:"characterId"`
CrafterName string `json:"crafterName"`
Level int64 `json:"level"`
Profession string `json:"profession"`
RecipeID string `json:"recipeId"`
RecipeRevision int64 `json:"recipeRevision"`
WorldID string `json:"worldId"`
}
type CraftProgress struct {
ID string `json:"id"`
Level int64 `json:"level"`
LossPercent float64 `json:"lossPercent"`
Name string `json:"name"`
XP int64 `json:"xp"`
XPToNextLevel int64 `json:"xpToNextLevel"`
}
type SkillProgress struct {
EffectiveLevel int64 `json:"effectiveLevel"`
Experience StatValue `json:"experience"`
@@ -525,6 +657,7 @@ type ItemInstance struct {
ID string `json:"id"`
Modifiers []StatModifier `json:"modifiers"`
Name string `json:"name"`
Provenance *CraftProvenance `json:"provenance,omitempty"`
RequirementMessage string `json:"requirementMessage"`
Requirements ItemRequirements `json:"requirements"`
Slot string `json:"slot"`