public static string GenerateDragonImageUrl(DataModels.FlightRisingModels.DragonCache dragon, bool swapSilhouette = false) { var gender = swapSilhouette ? (dragon.Gender == Gender.Male ? Gender.Female : Gender.Male) : dragon.Gender; switch (dragon.DragonType) { case DragonType.Gaoler: return(GenerateDragonImageUrl(dragon.DragonType, gender, dragon.Age, (GaolerBodyGene)dragon.BodyGene, dragon.BodyColor, (GaolerWingGene)dragon.WingGene, dragon.WingColor, (GaolerTertGene)dragon.TertiaryGene, dragon.TertiaryColor, dragon.Element, dragon.EyeType)); case DragonType.Banescale: return(GenerateDragonImageUrl(dragon.DragonType, gender, dragon.Age, (BanescaleBodyGene)dragon.BodyGene, dragon.BodyColor, (BanescaleWingGene)dragon.WingGene, dragon.WingColor, (BanescaleTertGene)dragon.TertiaryGene, dragon.TertiaryColor, dragon.Element, dragon.EyeType)); case DragonType.Veilspun: return(GenerateDragonImageUrl(dragon.DragonType, gender, dragon.Age, (VeilspunBodyGene)dragon.BodyGene, dragon.BodyColor, (VeilspunWingGene)dragon.WingGene, dragon.WingColor, (VeilspunTertGene)dragon.TertiaryGene, dragon.TertiaryColor, dragon.Element, dragon.EyeType)); default: return(GenerateDragonImageUrl(dragon.DragonType, gender, dragon.Age, (BodyGene)dragon.BodyGene, dragon.BodyColor, (WingGene)dragon.WingGene, dragon.WingColor, (TertiaryGene)dragon.TertiaryGene, dragon.TertiaryColor, dragon.Element, dragon.EyeType)); } }
public static DragonCache FromString(string data) { var split = data.Split('_'); var dragon = new DragonCache { Gender = (Gender)int.Parse(split[0]), DragonType = (DragonType)int.Parse(split[1]) }; if (split.Length > 2) { dragon.Element = (Element)int.Parse(split[2]); } if (split.Length > 3) { dragon.EyeType = (EyeType)int.Parse(split[3]); } if (split.Length > 4) { dragon.BodyGene = (int)Enum.Parse(dragon.DragonType.PrimaryGeneType(), split[4]); } if (split.Length > 5) { dragon.BodyGene = (int)Enum.Parse(dragon.DragonType.SecondaryGeneType(), split[4]); } if (split.Length > 6) { dragon.BodyGene = (int)Enum.Parse(dragon.DragonType.TertiaryGeneType(), split[4]); } if (split.Length > 7) { dragon.BodyColor = (Color)int.Parse(split[7]); } if (split.Length > 8) { dragon.WingColor = (Color)int.Parse(split[8]); } if (split.Length > 9) { dragon.TertiaryColor = (Color)int.Parse(split[9]); } if (split.Length > 10) { dragon.Age = (Age)int.Parse(split[10]); } if (split.Length > 11) { dragon.Apparel = split[11].Replace('-', ','); } return(dragon); }