mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Implement Memoirs Protect/Unprotect and ConsumableItemService.UseEffectItem
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -7,7 +7,8 @@ import (
|
||||
)
|
||||
|
||||
type ConsumableItemCatalog struct {
|
||||
All map[int32]EntityMConsumableItem
|
||||
All map[int32]EntityMConsumableItem
|
||||
Effects map[int32][]EntityMConsumableItemEffect
|
||||
}
|
||||
|
||||
func LoadConsumableItemCatalog() (*ConsumableItemCatalog, error) {
|
||||
@@ -15,12 +16,20 @@ func LoadConsumableItemCatalog() (*ConsumableItemCatalog, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load consumable item table: %w", err)
|
||||
}
|
||||
effects, err := utils.ReadTable[EntityMConsumableItemEffect]("m_consumable_item_effect")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load consumable item effect table: %w", err)
|
||||
}
|
||||
|
||||
catalog := &ConsumableItemCatalog{
|
||||
All: make(map[int32]EntityMConsumableItem, len(rows)),
|
||||
All: make(map[int32]EntityMConsumableItem, len(rows)),
|
||||
Effects: make(map[int32][]EntityMConsumableItemEffect, len(effects)),
|
||||
}
|
||||
for _, row := range rows {
|
||||
catalog.All[row.ConsumableItemId] = row
|
||||
}
|
||||
for _, e := range effects {
|
||||
catalog.Effects[e.ConsumableItemId] = append(catalog.Effects[e.ConsumableItemId], e)
|
||||
}
|
||||
return catalog, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user