72 lines
1.6 KiB
Go
72 lines
1.6 KiB
Go
package friendCfg
|
|
|
|
import (
|
|
"server/gamedata"
|
|
|
|
"gitea.bywaystudios.com/pet_home/leaf/log"
|
|
)
|
|
|
|
const (
|
|
CFG_NPC_FRIENDS = "NPCFriends"
|
|
CFG_CONST = "FriendConst"
|
|
)
|
|
|
|
func init() {
|
|
gamedata.InitCfg(CFG_NPC_FRIENDS)
|
|
gamedata.InitCfg(CFG_CONST)
|
|
}
|
|
|
|
func IsNpcFriend(Id int) bool {
|
|
_, err := gamedata.GetDataByIntKey(CFG_NPC_FRIENDS, Id)
|
|
if err != nil {
|
|
log.Debug("IsNpcFriend err:%v, Id=%d", err, Id)
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func GetFriendSponsorNum() int {
|
|
data, err := gamedata.GetDataByKey(CFG_CONST, "friend_energy_bonus")
|
|
if err != nil {
|
|
log.Debug("GetFriendSponsorNum err:%v", err)
|
|
return 0
|
|
}
|
|
return gamedata.GetIntValue(data, "Value")
|
|
}
|
|
|
|
func GetFriendLimitNum() int {
|
|
data, err := gamedata.GetDataByKey(CFG_CONST, "friend_limit")
|
|
if err != nil {
|
|
log.Debug("GetFriendLimitNum err:%v", err)
|
|
return 0
|
|
}
|
|
return gamedata.GetIntValue(data, "Value")
|
|
}
|
|
|
|
func GetDailyRecommendLimit() int {
|
|
data, err := gamedata.GetDataByKey(CFG_CONST, "friend_daily_recommend_limit")
|
|
if err != nil {
|
|
log.Debug("GetDailyRecommendLimit err:%v", err)
|
|
return 0
|
|
}
|
|
return gamedata.GetIntValue(data, "Value")
|
|
}
|
|
|
|
func GetApplyListLimit() int {
|
|
data, err := gamedata.GetDataByKey(CFG_CONST, "friend_apply_list_limit")
|
|
if err != nil {
|
|
log.Debug("GetApplyListLimit err:%v", err)
|
|
return 0
|
|
}
|
|
return gamedata.GetIntValue(data, "Value")
|
|
}
|
|
|
|
func GetDailyGetApplyLimit() int {
|
|
data, err := gamedata.GetDataByKey(CFG_CONST, "friend_daily_get_apply_limit")
|
|
if err != nil {
|
|
log.Debug("GetDailyGetApplyLimit err:%v", err)
|
|
return 0
|
|
}
|
|
return gamedata.GetIntValue(data, "Value")
|
|
}
|