public Prediction GetPrediction(ZodiacType zodiacType, TimeIntervalType timeIntervalType) { var zodiac = GetZodiac(zodiacType); var timeInterval = GetTimeInterval(timeIntervalType); return(Factory.CreatePrediction(GetPredictionDataReader(zodiac, timeInterval), zodiac, timeInterval)); }
/// <summary> /// 属相克制伤害 /// </summary> /// <param name="userID1"></param> /// <param name="userID2"></param> /// <returns></returns> public static decimal TrumpZodiacHarm(CombatGeneral general, string userID2) { if (general.GeneralID != LanguageManager.GetLang().GameUserGeneralID) { return(0); } ZodiacType zodiacType1 = GetZodiacType(general.UserID); ZodiacType zodiacType2 = GetZodiacType(userID2); return(ZodiacRestraint(zodiacType1, zodiacType2)); }
/// <summary> 星座名(略記号)を星座タイプに変換 </summary> static public ZodiacType ShortNameToZodiacType(string _zodiacName) { ZodiacType zod = ZodiacType.None; if (_zodiacName.Contains(zodShortNames[1])) { zod = ZodiacType.Taurus; } else if (_zodiacName.Contains(zodShortNames[2])) { zod = ZodiacType.Taurus; } else if (_zodiacName.Contains(zodShortNames[3])) { zod = ZodiacType.Gemini; } else if (_zodiacName.Contains(zodShortNames[4])) { zod = ZodiacType.Cancer; } else if (_zodiacName.Contains(zodShortNames[5])) { zod = ZodiacType.Leo; } else if (_zodiacName.Contains(zodShortNames[6])) { zod = ZodiacType.Virgo; } else if (_zodiacName.Contains(zodShortNames[7])) { zod = ZodiacType.Libra; } else if (_zodiacName.Contains(zodShortNames[8])) { zod = ZodiacType.Scorpius; } else if (_zodiacName.Contains(zodShortNames[9])) { zod = ZodiacType.Sagittarius; } else if (_zodiacName.Contains(zodShortNames[10])) { zod = ZodiacType.Capricornus; } else if (_zodiacName.Contains(zodShortNames[11])) { zod = ZodiacType.Aquarius; } else if (_zodiacName.Contains(zodShortNames[12])) { zod = ZodiacType.Pisces; } return(zod); }
private SQLiteDataReader GetZodiacDataReader(ZodiacType zodiacType) { using var command = _connection.CreateCommand(); command.Connection = _connection; command.CommandText = $"select {Zodiac.GetIdColumnName()}, {Zodiac.GetNameColumnName()}, {Zodiac.GetTypeColumnName()} " + $"from {Zodiac.GetTableName()} " + $"where {Zodiac.GetTypeColumnName()} = :enum_number;"; command.Parameters.AddWithValue("enum_number", (int)zodiacType); Console.WriteLine("Execute SQL: " + command.CommandText); return(command.ExecuteReader()); }
public Compatibility GetCompatibility(ZodiacType zodiacType1, ZodiacType zodiacType2) { using var command = _connection.CreateCommand(); command.Connection = _connection; command.CommandText = $"select {Compatibility.GetIdColumnName()}, {Compatibility.GetZodiac1ColumnName()}, {Compatibility.GetZodiac2ColumnName()}, " + $"{Compatibility.GetCompatibilityValueColumnName()}, {Compatibility.GetTextValueColumnName()} " + $"from {Compatibility.GetTableName()} " + $"where {Compatibility.GetZodiac1ColumnName()} = :zodiac1Type " + $"and {Compatibility.GetZodiac2ColumnName()} = :zodiac2Type;"; command.Parameters.AddWithValue("zodiac1Type", zodiacType1); command.Parameters.AddWithValue("zodiac2Type", zodiacType2); Console.WriteLine("Execute SQL: " + command.CommandText); return(Factory.CreateCompatibility(command.ExecuteReader(), this)); }
/// <summary> /// 被克制属相 /// </summary> /// <param name="zodiacType">玩家属相</param> /// <param name="typeID">类型 1.克制 2 被克制 3.全部属相</param> /// <returns></returns> public static TDictionary <short, decimal> ZodiacRestraint(ZodiacType zodiacType, int typeID) { TDictionary <short, decimal> zodiacTDList = new TDictionary <short, decimal>(); string[] zodiacArray = ConfigEnvSet.GetString("Trump.ZodiacRestraint").Split(','); foreach (string s in zodiacArray) { string[] zodiacStr = s.Split('='); if (typeID == 1) { if (zodiacStr.Length > 2 && zodiacType == zodiacStr[0].ToEnum <ZodiacType>()) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { zodiacTDList.Add(s1.ToShort(), zodiacStr[2].ToDecimal()); } } } if (typeID == 2) { if (zodiacStr.Length > 2) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { if (s1 != ZodiacType.NoZodiac.ToString() && s1.ToEnum <ZodiacType>() == zodiacType) { zodiacTDList.Add(s1.ToShort(), zodiacStr[0].ToDecimal()); } } } } if (typeID == 3) { if (zodiacStr.Length > 2 && zodiacStr[0].ToEnum <ZodiacType>() != zodiacType) { zodiacTDList.Add(s.ToShort(), zodiacStr[2].ToDecimal()); } } } return(zodiacTDList); }
/// <summary> /// 随机一个属相 /// </summary> /// <param name="zodiacType"></param> /// <returns></returns> public static ZodiacType GetZodiacType(ZodiacType zodiacType) { ZodiacType zType = new ZodiacType(); Array zodiacTDArray = Enum.GetValues(typeof(ZodiacType)); List <ZodiacType> zodiacTDList = new List <ZodiacType>(); foreach (ZodiacType array in zodiacTDArray) { if (array.ToEnum <ZodiacType>() == zodiacType || array.ToEnum <ZodiacType>() == ZodiacType.NoZodiac) { continue; } zodiacTDList.Add(array); } if (zodiacTDList.Count > 0) { int index2 = RandomUtils.GetRandom(0, zodiacTDList.Count); zType = zodiacTDList[index2].ToEnum <ZodiacType>(); } return(zType); }
/// <summary> /// 克制属相 /// </summary> /// <param name="zodiacType1">玩家属相1</param> /// <param name="zodiacType2">玩家属相2</param> /// <returns></returns> public static decimal ZodiacRestraint(ZodiacType zodiacType1, ZodiacType zodiacType2) { string[] zodiacArray = ConfigEnvSet.GetString("Trump.ZodiacRestraint").Split(','); foreach (string s in zodiacArray) { string[] zodiacStr = s.Split('='); if (zodiacStr.Length > 2 && zodiacType1 == zodiacStr[0].ToEnum <ZodiacType>()) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { if (s1.ToEnum <ZodiacType>() == zodiacType2) { return(zodiacStr[2].ToDecimal()); } } } } return(0); }
protected override object this[string index] { get { #region switch (index) { case "UserID": return(UserID); case "TrumpID": return(TrumpID); case "TrumpLv": return(TrumpLv); case "WorshipLv": return(WorshipLv); case "LiftNum": return(LiftNum); case "Experience": return(Experience); case "MatureNum": return(MatureNum); case "Zodiac": return(Zodiac); case "SkillInfo": return(SkillInfo); case "PropertyInfo": return(PropertyInfo); default: throw new ArgumentException(string.Format("UserTrump index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "TrumpID": _TrumpID = value.ToInt(); break; case "TrumpLv": _TrumpLv = value.ToShort(); break; case "WorshipLv": _WorshipLv = value.ToShort(); break; case "LiftNum": _LiftNum = value.ToInt(); break; case "Experience": _Experience = value.ToInt(); break; case "MatureNum": _MatureNum = value.ToShort(); break; case "Zodiac": _Zodiac = value.ToEnum <ZodiacType>(); break; case "SkillInfo": _SkillInfo = ConvertCustomField <CacheList <SkillInfo> >(value, index); break; case "PropertyInfo": _PropertyInfo = ConvertCustomField <CacheList <GeneralProperty> >(value, index); break; default: throw new ArgumentException(string.Format("UserTrump index[{0}] isn't exist.", index)); } #endregion } }
public Compatibility GetCompatibility(ZodiacType zodiac1Type, ZodiacType zodiac2Type) { return(GetDatabaseConnection().GetCompatibility(zodiac1Type, zodiac2Type)); }
public Zodiac GetZodiac(ZodiacType zodiacType) { return(GetDatabaseConnection().GetZodiac(zodiacType)); }
public Prediction GetPrediction(ZodiacType zodiacType, TimeIntervalType timeIntervalType) { return(GetDatabaseConnection().GetPrediction(zodiacType, timeIntervalType)); }
public Zodiac(int id, string name, ZodiacType type) { Id = id; Name = name; Type = type; }
public Article(string title, string content, ZodiacType zodiacType) { Title = title; Content = content; ZodiacType = zodiacType; }
/// <summary> /// 被克制属相 /// </summary> /// <param name="zodiacType">玩家属相</param> /// <param name="typeID">类型 1.克制 2 被克制 3.全部属相</param> /// <returns></returns> public static Dictionary<short, decimal> ZodiacRestraint(ZodiacType zodiacType, int typeID) { Dictionary<short, decimal> zodiacTDList = new Dictionary<short, decimal>(); string[] zodiacArray = ConfigEnvSet.GetString("Trump.ZodiacRestraint").Split(','); foreach (string s in zodiacArray) { string[] zodiacStr = s.Split('='); if (typeID == 1) { if (zodiacStr.Length > 2 && zodiacType == zodiacStr[0].ToEnum<ZodiacType>()) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { zodiacTDList.Add(s1.ToShort(), zodiacStr[2].ToDecimal()); } } } if (typeID == 2) { if (zodiacStr.Length > 2) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { if (s1 != ZodiacType.NoZodiac.ToString() && s1.ToEnum<ZodiacType>() == zodiacType) { zodiacTDList.Add(s1.ToShort(), zodiacStr[0].ToDecimal()); } } } } if (typeID == 3) { if (zodiacStr.Length > 2 && zodiacStr[0].ToEnum<ZodiacType>() != zodiacType) { zodiacTDList.Add(s.ToShort(), zodiacStr[2].ToDecimal()); } } } return zodiacTDList; }
/// <summary> /// 克制属相 /// </summary> /// <param name="zodiacType1">玩家属相1</param> /// <param name="zodiacType2">玩家属相2</param> /// <returns></returns> public static decimal ZodiacRestraint(ZodiacType zodiacType1, ZodiacType zodiacType2) { string[] zodiacArray = ConfigEnvSet.GetString("Trump.ZodiacRestraint").Split(','); foreach (string s in zodiacArray) { string[] zodiacStr = s.Split('='); if (zodiacStr.Length > 2 && zodiacType1 == zodiacStr[0].ToEnum<ZodiacType>()) { string[] zodiacList = zodiacStr[1].Split('|'); foreach (string s1 in zodiacList) { if (s1.ToEnum<ZodiacType>() == zodiacType2) { return zodiacStr[2].ToDecimal(); } } } } return 0; }
static public string ZodiacTypeToShortName(ZodiacType _zodiac) { return(zodShortNames[(int)_zodiac]); }
/// <summary> /// 随机一个属相 /// </summary> /// <param name="zodiacType"></param> /// <returns></returns> public static ZodiacType GetZodiacType(ZodiacType zodiacType) { ZodiacType zType = new ZodiacType(); Array zodiacTDArray = Enum.GetValues(typeof(ZodiacType)); List<ZodiacType> zodiacTDList = new List<ZodiacType>(); foreach (ZodiacType array in zodiacTDArray) { if (array.ToEnum<ZodiacType>() == zodiacType || array.ToEnum<ZodiacType>() == ZodiacType.NoZodiac) { continue; } zodiacTDList.Add(array); } if (zodiacTDList.Count > 0) { int index2 = RandomUtils.GetRandom(0, zodiacTDList.Count); zType = zodiacTDList[index2].ToEnum<ZodiacType>(); } return zType; }
public Zodiac GetZodiac(ZodiacType zodiacType) { return(Factory.CreateZodiac(GetZodiacDataReader(zodiacType))); }
protected override object this[string index] { get { #region switch (index) { case "UserID": return UserID; case "TrumpID": return TrumpID; case "TrumpLv": return TrumpLv; case "WorshipLv": return WorshipLv; case "LiftNum": return LiftNum; case "Experience": return Experience; case "MatureNum": return MatureNum; case "Zodiac": return Zodiac; case "SkillInfo": return SkillInfo; case "PropertyInfo": return PropertyInfo; default: throw new ArgumentException(string.Format("UserTrump index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "TrumpID": _TrumpID = value.ToInt(); break; case "TrumpLv": _TrumpLv = value.ToShort(); break; case "WorshipLv": _WorshipLv = value.ToShort(); break; case "LiftNum": _LiftNum = value.ToInt(); break; case "Experience": _Experience = value.ToInt(); break; case "MatureNum": _MatureNum = value.ToShort(); break; case "Zodiac": _Zodiac = value.ToEnum<ZodiacType>(); break; case "SkillInfo": _SkillInfo =ConvertCustomField<CacheList<SkillInfo>>(value, index); break; case "PropertyInfo": _PropertyInfo =ConvertCustomField<CacheList<GeneralProperty>>(value, index); break; default: throw new ArgumentException(string.Format("UserTrump index[{0}] isn't exist.", index)); } #endregion } }
public Zodiac(string name, ZodiacType type) { Name = name; Type = type; }