棋子商店bug修改

This commit is contained in:
hahwu 2025-10-20 10:26:09 +08:00
parent 0d258ccf3e
commit 4305144472

View File

@ -1,7 +1,6 @@
package chargeCfg
import (
"encoding/json"
"server/GoUtil"
"server/game/mod/item"
"server/gamedata"
@ -90,16 +89,18 @@ func GetEnergyShopId(ChargeId int) int {
return 0
}
func GetWeeklyInfo(Id int) (int, int) {
func GetWeeklyInfo(Pos int) (int, int) {
data, err := gamedata.GetDataByKey(CFG_CHARGE_CONST, "weekly_chess_shop")
if err != nil {
return 0, 0
}
var r map[string]interface{}
json.Unmarshal([]byte(gamedata.GetStringValue(data, "Value")), &r)
if val, ok := r[GoUtil.String(Id)]; ok {
arr := val.(map[string]interface{})
return GoUtil.Int(arr["Discount"]), GoUtil.Int(arr["Limit"])
r := data["Value"].([]interface{})
for _, v := range r {
v1 := v.(map[string]interface{})
Id := GoUtil.Int(v1["Id"])
if Id == Pos {
return GoUtil.Int(v1["Discount"]), GoUtil.Int(v1["Limit"])
}
}
return 0, 0
}