package config // Zhgww2 指挥官-二战 type ( Zhgww2 struct { GiftEffect struct { FreeRestoreHealth []int64 // 免费回血 RestoreHealth []int64 // 恢复生命值 SupportSkill []int64 // 技能 Paratroops []int64 // 空降小队 Reborn []int64 // 复活 } TankMulThreshold int64 // 坦克血量比例阈值 TankMulRatio float32 // 坦克血量阈值内对于金瓜子比例 TankRatio float32 // 坦克血量对于金瓜子比例 } GiftType int32 ) const ( GiftTypeUnknown GiftType = iota GiftFreeRestoreHealth GiftRestoreHealth GiftSupportSkill GiftReborn GiftTank GiftSpecial ) func (z Zhgww2) ParseGiftType(id int64) GiftType { if z.isContains(id, z.GiftEffect.FreeRestoreHealth) { return GiftFreeRestoreHealth } else if z.isContains(id, z.GiftEffect.RestoreHealth) { return GiftRestoreHealth } else if z.isContains(id, z.GiftEffect.SupportSkill) { return GiftSupportSkill } else if z.isContains(id, z.GiftEffect.Reborn) { return GiftReborn } else if z.isContains(id, z.GiftEffect.Paratroops) { return GiftSpecial } return GiftTypeUnknown } func (z Zhgww2) isContains(id int64, arr []int64) bool { for _, s := range arr { if s == id { return true } } return false }