每日任务更新
This commit is contained in:
parent
4f5adaab9b
commit
56f9db57ef
@ -226,3 +226,29 @@ func GetMoodEffect(Id int) (int, int) {
|
||||
}
|
||||
return gamedata.GetIntValue(data, "MType"), gamedata.GetIntValue(data, "MEffect")
|
||||
}
|
||||
|
||||
func IsStokeCat(Id int) bool {
|
||||
data, err := gamedata.GetDataByKey(CFG_PLAYROOM_CONST, "StokeCatId")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return gamedata.GetIntValue(data, "Value") == Id
|
||||
}
|
||||
|
||||
func IsTakeCat(Id int) bool {
|
||||
data, err := gamedata.GetDataByKey(CFG_PLAYROOM_CONST, "TakeCatId")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
Ids := gamedata.GetIntSliceValue(data, "Value")
|
||||
return GoUtil.InArray(Id, Ids)
|
||||
}
|
||||
|
||||
func IsPlayCat(Id int) bool {
|
||||
data, err := gamedata.GetDataByKey(CFG_PLAYROOM_CONST, "PlayCatId")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
Ids := gamedata.GetIntSliceValue(data, "Value")
|
||||
return GoUtil.InArray(Id, Ids)
|
||||
}
|
||||
|
||||
@ -3025,18 +3025,20 @@ func ReqPlayroomInteract(player *Player, buf []byte) error {
|
||||
})
|
||||
return err
|
||||
}
|
||||
if req.Id == 2 {
|
||||
if playroomCfg.IsStokeCat(int(req.Id)) {
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_STOKECAT})
|
||||
}
|
||||
if playroomCfg.IsPlayCat(int(req.Id)) {
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_PLAYCAT})
|
||||
}
|
||||
if playroomCfg.IsTakeCat(int(req.Id)) {
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_TAKECAT})
|
||||
}
|
||||
switch req.Type {
|
||||
case playroom.MOOD_TYPE_CLEAN:
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_CLEANCAT})
|
||||
case playroom.MOOD_TYPE_FOOD:
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_FEEDCAT})
|
||||
case playroom.MOOD_TYPE_PLAY:
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_PLAYCAT})
|
||||
case playroom.MOOD_TYPE_TAKE:
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_TAKECAT})
|
||||
}
|
||||
player.PlayMod.save()
|
||||
LimitedTimePlayroomTrigger(player)
|
||||
|
||||
@ -129,6 +129,23 @@ func GetIntValue(a interface{}, key string) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func GetIntSliceValue(a interface{}, key string) []int {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
if v, ok := a.(map[string]interface{})[key]; ok {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
var r []int
|
||||
for _, v := range v.([]interface{}) {
|
||||
r = append(r, int(v.(float64)))
|
||||
}
|
||||
return r
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetFloatValue(a interface{}, key string) float64 {
|
||||
if a == nil {
|
||||
return 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user