mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Add authentication server, dev CLI, Docker multi-service setup, and cross-platform improvements
This commit is contained in:
@@ -7,63 +7,37 @@ import (
|
||||
"lunar-tear/server/internal/utils"
|
||||
)
|
||||
|
||||
type PartsRow struct {
|
||||
PartsId int32 `json:"PartsId"`
|
||||
RarityType model.RarityType `json:"RarityType"`
|
||||
PartsGroupId int32 `json:"PartsGroupId"`
|
||||
PartsStatusMainLotteryGroupId int32 `json:"PartsStatusMainLotteryGroupId"`
|
||||
}
|
||||
|
||||
type PartsRarityRow struct {
|
||||
RarityType model.RarityType `json:"RarityType"`
|
||||
PartsLevelUpRateGroupId int32 `json:"PartsLevelUpRateGroupId"`
|
||||
PartsLevelUpPriceGroupId int32 `json:"PartsLevelUpPriceGroupId"`
|
||||
SellPriceNumericalFunctionId int32 `json:"SellPriceNumericalFunctionId"`
|
||||
}
|
||||
|
||||
type partsLevelUpRateRow struct {
|
||||
PartsLevelUpRateGroupId int32 `json:"PartsLevelUpRateGroupId"`
|
||||
LevelLowerLimit int32 `json:"LevelLowerLimit"`
|
||||
SuccessRatePermil int32 `json:"SuccessRatePermil"`
|
||||
}
|
||||
|
||||
type partsLevelUpPriceRow struct {
|
||||
PartsLevelUpPriceGroupId int32 `json:"PartsLevelUpPriceGroupId"`
|
||||
LevelLowerLimit int32 `json:"LevelLowerLimit"`
|
||||
Gold int32 `json:"Gold"`
|
||||
}
|
||||
|
||||
type PartsCatalog struct {
|
||||
PartsById map[int32]PartsRow
|
||||
PartsById map[int32]EntityMParts
|
||||
DefaultPartsStatusMainByLotteryGroup map[int32]int32
|
||||
RarityByRarityType map[model.RarityType]PartsRarityRow
|
||||
RarityByRarityType map[model.RarityType]EntityMPartsRarity
|
||||
RateByGroupAndLevel map[int32]map[int32]int32
|
||||
PriceByGroupAndLevel map[int32]map[int32]int32
|
||||
SellPriceByRarity map[model.RarityType]NumericalFunc
|
||||
}
|
||||
|
||||
func LoadPartsCatalog() (*PartsCatalog, error) {
|
||||
partsRows, err := utils.ReadJSON[PartsRow]("EntityMPartsTable.json")
|
||||
partsRows, err := utils.ReadTable[EntityMParts]("m_parts")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load parts table: %w", err)
|
||||
}
|
||||
|
||||
rarityRows, err := utils.ReadJSON[PartsRarityRow]("EntityMPartsRarityTable.json")
|
||||
rarityRows, err := utils.ReadTable[EntityMPartsRarity]("m_parts_rarity")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load parts rarity table: %w", err)
|
||||
}
|
||||
|
||||
rateRows, err := utils.ReadJSON[partsLevelUpRateRow]("EntityMPartsLevelUpRateGroupTable.json")
|
||||
rateRows, err := utils.ReadTable[EntityMPartsLevelUpRateGroup]("m_parts_level_up_rate_group")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load parts level up rate table: %w", err)
|
||||
}
|
||||
|
||||
priceRows, err := utils.ReadJSON[partsLevelUpPriceRow]("EntityMPartsLevelUpPriceGroupTable.json")
|
||||
priceRows, err := utils.ReadTable[EntityMPartsLevelUpPriceGroup]("m_parts_level_up_price_group")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load parts level up price table: %w", err)
|
||||
}
|
||||
|
||||
partsById := make(map[int32]PartsRow, len(partsRows))
|
||||
partsById := make(map[int32]EntityMParts, len(partsRows))
|
||||
for _, p := range partsRows {
|
||||
partsById[p.PartsId] = p
|
||||
}
|
||||
@@ -84,7 +58,7 @@ func LoadPartsCatalog() (*PartsCatalog, error) {
|
||||
return nil, fmt.Errorf("load function resolver: %w", err)
|
||||
}
|
||||
|
||||
rarityByRarityType := make(map[model.RarityType]PartsRarityRow, len(rarityRows))
|
||||
rarityByRarityType := make(map[model.RarityType]EntityMPartsRarity, len(rarityRows))
|
||||
sellPriceByRarity := make(map[model.RarityType]NumericalFunc, len(rarityRows))
|
||||
for _, r := range rarityRows {
|
||||
rarityByRarityType[r.RarityType] = r
|
||||
|
||||
Reference in New Issue
Block a user