Add housing storage, guest permissions, and timed key destruction
This commit is contained in:
+23
-13
@@ -35,20 +35,22 @@ type ItemRequirements struct {
|
||||
Titles []string `json:"titles" yaml:"titles"`
|
||||
}
|
||||
type ItemDefinition struct {
|
||||
WeaponType string `json:"weaponType,omitempty" yaml:"weaponType"`
|
||||
CraftPool []CraftStat `json:"craftPool,omitempty" yaml:"craftPool"`
|
||||
CraftRolls int64 `json:"craftRolls,omitempty" yaml:"craftRolls"`
|
||||
AttackID string `json:"attackId,omitempty" yaml:"attackId"`
|
||||
ID string `json:"id" yaml:"id"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Slot string `json:"slot" yaml:"slot"`
|
||||
Weight float64 `json:"weight" yaml:"weight"`
|
||||
DropChance float64 `json:"dropChance" yaml:"dropChance"`
|
||||
Requirements ItemRequirements `json:"requirements" yaml:"requirements"`
|
||||
Modifiers []StatModifier `json:"modifiers" yaml:"modifiers"`
|
||||
Furniture *FurnitureProfile `json:"furniture,omitempty" yaml:"furniture"`
|
||||
WeaponType string `json:"weaponType,omitempty" yaml:"weaponType"`
|
||||
CraftPool []CraftStat `json:"craftPool,omitempty" yaml:"craftPool"`
|
||||
CraftRolls int64 `json:"craftRolls,omitempty" yaml:"craftRolls"`
|
||||
AttackID string `json:"attackId,omitempty" yaml:"attackId"`
|
||||
ID string `json:"id" yaml:"id"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Slot string `json:"slot" yaml:"slot"`
|
||||
Weight float64 `json:"weight" yaml:"weight"`
|
||||
DropChance float64 `json:"dropChance" yaml:"dropChance"`
|
||||
Requirements ItemRequirements `json:"requirements" yaml:"requirements"`
|
||||
Modifiers []StatModifier `json:"modifiers" yaml:"modifiers"`
|
||||
}
|
||||
type Catalog struct {
|
||||
HousingVersion int `json:"housingVersion,omitempty"`
|
||||
Building *BuildingContent `json:"building,omitempty"`
|
||||
Powers *PowerContent `json:"powers,omitempty"`
|
||||
Crafting *CraftingContent `json:"crafting,omitempty"`
|
||||
@@ -105,6 +107,14 @@ func ValidItemSlot(slot string) bool {
|
||||
return slices.Contains([]string{"helmet", "mask", "chest", "shoulders", "pants", "boots", "gloves", "earrings", "necklace", "ring", "weapon", "offhand", "cape", "bag"}, slot)
|
||||
}
|
||||
func (item ItemDefinition) Validate() error {
|
||||
if item.Furniture != nil {
|
||||
if item.Slot != "bag" {
|
||||
return fmt.Errorf("furniture must use bag slot")
|
||||
}
|
||||
if e := item.Furniture.Validate(); e != nil {
|
||||
return e
|
||||
}
|
||||
}
|
||||
if err := ValidateCraftPool(item); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -219,5 +229,5 @@ func DefaultCatalog() (Catalog, error) {
|
||||
if err != nil {
|
||||
return Catalog{}, err
|
||||
}
|
||||
return Catalog{Building: b.Building, Powers: b.Powers, Crafting: b.Crafting, Combat: b.Combat, Gathering: b.Gathering, Version: 1, Titles: b.Titles, Items: b.Items, Stats: *b.Stats}, nil
|
||||
return Catalog{HousingVersion: 1, Building: b.Building, Powers: b.Powers, Crafting: b.Crafting, Combat: b.Combat, Gathering: b.Gathering, Version: 1, Titles: b.Titles, Items: b.Items, Stats: *b.Stats}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user