package config // Zhgww2 指挥官-二战 type ( Zhgww2 struct { GiftEffect struct { Free []int64 // 免费礼物 RestoreHealth []int64 // 恢复生命值 SupportSkill []int64 // 技能 Paratroops []int64 // 空降小队 Reborn []int64 // 复活 Overtime []int64 // 加时道具 Commander []int64 // 指挥官道具 Tank []int64 // 坦克礼物 } TankMulThreshold int64 // 坦克血量比例阈值 TankMulRatio float32 // 坦克血量阈值内对于金瓜子比例 TankRatio float32 // 坦克血量对于金瓜子比例 OvertimeRatio int64 // 加时时长比例 电池*ratio = s } GiftType int32 ) const ( GiftTypeUnknown GiftType = iota GiftFree GiftRestoreHealth GiftSupportSkill GiftReborn GiftTank GiftSpecial GiftOvertime GiftCommander ) func (z Zhgww2) ParseGiftType(id int64) GiftType { if z.isContains(id, z.GiftEffect.Free) { return GiftFree } 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 } else if z.isContains(id, z.GiftEffect.Overtime) { return GiftOvertime } else if z.isContains(id, z.GiftEffect.Commander) { return GiftCommander } else if z.isContains(id, z.GiftEffect.Tank) { return GiftTank } return GiftTypeUnknown } func (z Zhgww2) isContains(id int64, arr []int64) bool { for _, s := range arr { if s == id { return true } } return false }