/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 10:51:44</remarks> public bool Update(DicItemEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicItem_Update"); database.AddInParameter(commandWrapper, "@ItemCode", DbType.Int32, entity.ItemCode); database.AddInParameter(commandWrapper, "@ItemName", DbType.String, entity.ItemName); database.AddInParameter(commandWrapper, "@ItemType", DbType.Int32, entity.ItemType); database.AddInParameter(commandWrapper, "@SubType", DbType.Int32, entity.SubType); database.AddInParameter(commandWrapper, "@ThirdType", DbType.Int32, entity.ThirdType); database.AddInParameter(commandWrapper, "@FourthType", DbType.Int32, entity.FourthType); database.AddInParameter(commandWrapper, "@ImageId", DbType.Int32, entity.ImageId); database.AddInParameter(commandWrapper, "@LinkId", DbType.Int32, entity.LinkId); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 是否是合同页 /// </summary> /// <param name="card"></param> /// <returns></returns> public bool IsContract(DicItemEntity card) { if (card.ItemType == (int)EnumItemType.MallItem && card.MallEffectType == (int)EnumMallEffectType.TheContract) { return(true); } return(false); }
static PlayerCardDescriptionEntity BuildPlayerCardDescription(DicItemEntity itemEntity, DicPlayerEntity playerEntity) { var entity = new PlayerCardDescriptionEntity(); entity.ItemCode = itemEntity.ItemCode; entity.ItemType = itemEntity.ItemType; entity.Name = itemEntity.ItemName; entity.ImageId = itemEntity.ImageId; entity.CardLevel = playerEntity.CardLevel; entity.Attack = Math.Round((playerEntity.Speed + playerEntity.Shoot + playerEntity.FreeKick) / 3, 2); entity.Body = Math.Round((playerEntity.Balance + playerEntity.Physique + playerEntity.Bounce) / 3, 2); entity.Defense = Math.Round((playerEntity.Aggression + playerEntity.Disturb + playerEntity.Interception) / 3, 2); entity.Organize = Math.Round((playerEntity.Dribble + playerEntity.Pass + playerEntity.Mentality) / 3, 2); entity.Goalkeep = Math.Round((playerEntity.Response + playerEntity.Positioning + playerEntity.HandControl) / 3, 2); entity.CombSkill = ""; entity.Kpi = playerEntity.Kpi; entity.KpiLevel = playerEntity.KpiLevel; entity.Capacity = playerEntity.Capacity; entity.LeagueLevel = playerEntity.LeagueLevel; entity.PlayerId = playerEntity.Idx; entity.Club = playerEntity.Club; entity.Birthday = playerEntity.Birthday; entity.Description = playerEntity.Description; entity.Nationality = playerEntity.Nationality; entity.Stature = playerEntity.Stature.ToString("f2"); entity.Weight = playerEntity.Weight.ToString("f2"); entity.AllPosition = playerEntity.AllPosition.Trim(); entity.Specific = playerEntity.Specific; entity.Position = playerEntity.Position; entity.Speed = playerEntity.Speed; entity.Shoot = playerEntity.Shoot; entity.FreeKick = playerEntity.FreeKick; entity.Balance = playerEntity.Balance; entity.Physique = playerEntity.Physique; entity.Bounce = playerEntity.Bounce; entity.Aggression = playerEntity.Aggression; entity.Disturb = playerEntity.Disturb; entity.Interception = playerEntity.Interception; entity.Dribble = playerEntity.Dribble; entity.Pass = playerEntity.Pass; entity.Mentality = playerEntity.Mentality; entity.Response = playerEntity.Response; entity.Positioning = playerEntity.Positioning; entity.HandControl = playerEntity.HandControl; entity.Acceleration = playerEntity.Acceleration; entity.Power = playerEntity.Power; entity.EnName = playerEntity.NameEn; return(entity); }
/// <summary> /// 将IDataReader的当前记录读取到DicItemEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public DicItemEntity LoadSingleRow(IDataReader reader) { var obj = new DicItemEntity(); obj.ItemCode = (System.Int32)reader["ItemCode"]; obj.ItemName = (System.String)reader["ItemName"]; obj.ItemType = (System.Int32)reader["ItemType"]; obj.SubType = (System.Int32)reader["SubType"]; obj.ThirdType = (System.Int32)reader["ThirdType"]; obj.FourthType = (System.Int32)reader["FourthType"]; obj.ImageId = (System.Int32)reader["ImageId"]; obj.LinkId = (System.Int32)reader["LinkId"]; return(obj); }
static BallsoulDescriptionEntity BuildBallsoulDescription(DicItemEntity itemEntity, DicBallsoulEntity ballsoulEntity) { var entity = new BallsoulDescriptionEntity(); entity.ItemCode = itemEntity.ItemCode; entity.ItemType = itemEntity.ItemType; entity.Name = itemEntity.ItemName; entity.ImageId = itemEntity.ImageId; entity.Idx = ballsoulEntity.Idx; entity.Color = ballsoulEntity.Color; entity.Level = ballsoulEntity.Level; entity.Description = ballsoulEntity.Description; entity.Type = ballsoulEntity.Type; return(entity); }
/// <summary> /// GetById /// </summary> /// <param name="itemCode">itemCode</param> /// <returns>DicItemEntity</returns> /// <remarks>2015/10/19 10:51:44</remarks> public DicItemEntity GetById(System.Int32 itemCode) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_DicItem_GetById"); database.AddInParameter(commandWrapper, "@ItemCode", DbType.Int32, itemCode); DicItemEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
static MallItemDescriptionEntity BuildMallDescription(DicItemEntity itemEntity, DicMallitemEntity mallEntity) { var entity = new MallItemDescriptionEntity(); entity.ItemCode = itemEntity.ItemCode; entity.ItemType = itemEntity.ItemType; entity.Name = itemEntity.ItemName; entity.ImageId = itemEntity.ImageId; entity.Idx = mallEntity.MallCode; entity.ItemIntro = mallEntity.ItemIntro; entity.ItemTip = mallEntity.ItemTip; entity.UseMsg = mallEntity.UseMsg; entity.UseNote = mallEntity.UseNote; entity.Quality = mallEntity.Quality; entity.UseLevel = mallEntity.UseLevel; entity.ImageId = itemEntity.ImageId; entity.ShowUse = mallEntity.ShowUse ? 1 : 0; entity.ShowBatch = mallEntity.ShowBatch ? 1 : 0; return(entity); }
/// <summary> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2015/10/19 10:51:44</remarks> public bool Update(DicItemEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 10:51:44</remarks> public bool Insert(DicItemEntity entity) { return(Insert(entity, null)); }
public static bool Update(DicItemEntity dicItemEntity, DbTransaction trans = null, string zoneId = "") { var provider = new DicItemProvider(zoneId); return(provider.Update(dicItemEntity, trans)); }
LotteryEntity ScoutingLottery(int scoutingId, int count, int limitedOrangeCount, bool isFree) { bool isTen = count == 10; //是否十连抽 var configScouting = CacheFactory.ScoutingCache.GetEntity(scoutingId); if (configScouting == null) { return(null); } var scoutingType = configScouting.Type; LotteryEntity lottery = null; List <int> cardList = null; List <int> limitedCardList = new List <int>(); if (isTen) { if (!configScouting.HasTen) { return(null); } lottery = CacheFactory.LotteryCache.ScoutingTen(scoutingType, configScouting.OrangeLib, configScouting.LowLib, out cardList, limitedOrangeCount, out limitedCardList); } else { lottery = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.Scouting, scoutingType); } if (lottery == null) { return(null); } int loopCount = 0; if (!isTen) //新手引导点券抽卡 { var card = ItemsdicCache.Instance.GetItem(lottery.PrizeItemCode); if (isFree) { scoutingType = 4; //免费抽卡卡库 loopCount = 0; WriteLog("while 1,start"); //免费抽卡不能抽到87以上能力值的卡 while (loopCount < 200 && card.PlayerKpi > 87) { loopCount++; lottery = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.Scouting, scoutingType); card = ItemsdicCache.Instance.GetItem(lottery.PrizeItemCode); } WriteLog("while 1,loopCount:{0}", loopCount); } //友情点抽卡十次必得80-84橙卡 if (scoutingType == 3) { loopCount = 0; WriteLog("while 2,start"); while (loopCount < 200 && !(card.PlayerKpi >= 80 && card.PlayerKpi <= 84)) { loopCount++; lottery = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.Scouting, scoutingType); card = ItemsdicCache.Instance.GetItem(lottery.PrizeItemCode); } WriteLog("while 2,loopCount:{0}", loopCount); } //金币抽卡十次必得80-84橙卡碎片 if (scoutingType == 1) { var playerItemcode = 0; var playerItem = new DicItemEntity(); if (IsContract(card)) { playerItemcode = CacheFactory.ItemsdicCache.GetTheContractItemCode(card.ItemCode); playerItem = ItemsdicCache.Instance.GetItem(playerItemcode); } loopCount = 0; WriteLog("while 3,start"); while (card.MallEffectType != (int)EnumMallEffectType.TheContract || (IsContract(card) && !(playerItem.PlayerKpi >= 80 && playerItem.PlayerKpi <= 84))) { loopCount++; lottery = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.Scouting, scoutingType); card = ItemsdicCache.Instance.GetItem(lottery.PrizeItemCode); if (IsContract(card)) { playerItemcode = CacheFactory.ItemsdicCache.GetTheContractItemCode(card.ItemCode); playerItem = ItemsdicCache.Instance.GetItem(playerItemcode); if (playerItem == null) { WriteLog("playerItem is null,card.ItemCode={0},playerItemcode={1}", card.ItemCode, playerItemcode); } } if (loopCount == 200) { break; } } WriteLog("while 3,loopCount:{0}", loopCount); } if (configScouting.Type == 2 && scoutingType == 4) { //第一次必得托雷斯 lottery.PrizeItemCode = 130153; var itemstring = lottery.ItemString.Split(','); itemstring[1] = lottery.PrizeItemCode.ToString(); lottery.ItemString = string.Join(",", itemstring); } //钻石抽卡十次必得84-87橙卡 if (scoutingType == 2) { loopCount = 0; WriteLog("while 4,start"); while (!(card.PlayerKpi >= 84 && card.PlayerKpi <= 87)) { loopCount++; lottery = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.Scouting, scoutingType); card = ItemsdicCache.Instance.GetItem(lottery.PrizeItemCode); if (loopCount == 200) { break; } } WriteLog("while 4,loopCount:{0}", loopCount); } //C罗、梅西外每天只能出3张89以上的橙卡 if (limitedOrangeCount >= 3) { loopCount = 0; WriteLog("while 5,start"); while (card.PlayerKpi >= 89 || card.LinkId == 30001 || card.LinkId == 30002) { loopCount++; lottery = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.Scouting, scoutingType); card = ItemsdicCache.Instance.GetItem(lottery.PrizeItemCode); if (loopCount == 200) { break; } } WriteLog("while 5,loopCount:{0}", loopCount); } else { if (card.PlayerKpi >= 89 && (card.LinkId != 30001 || card.LinkId != 30002)) { limitedCardList = new List <int>(); limitedCardList.Add(card.ItemCode); } } } return(lottery); }
static EquipmentDescriptionEntity BuildEquipmentDescription(DicItemEntity itemEntity, DicEquipmentEntity equipmentEntity) { var entity = new EquipmentDescriptionEntity(); entity.ItemCode = itemEntity.ItemCode; entity.ItemType = itemEntity.ItemType; entity.Name = itemEntity.ItemName; entity.ImageId = itemEntity.ImageId; entity.Quality = equipmentEntity.Quality; entity.SuitId = equipmentEntity.SuitId; entity.SuitType = equipmentEntity.SuitType; entity.Idx = equipmentEntity.Idx; entity.Property1 = equipmentEntity.PropertyType1; entity.Property2 = equipmentEntity.PropertyType2; if (equipmentEntity.SuitType == 4) { #region 处理散装前缀 string s = equipmentEntity.Name.Substring(0, 2); switch (s) { case "迅捷": entity.Prefix = 1; break; case "灵感": entity.Prefix = 2; break; case "精准": entity.Prefix = 3; break; case "专制": entity.Prefix = 4; break; case "活力": entity.Prefix = 5; break; case "旋风": entity.Prefix = 6; break; case "狂热": entity.Prefix = 7; break; case "尘暴": entity.Prefix = 8; break; case "犀利": entity.Prefix = 9; break; case "驭风": entity.Prefix = 10; break; case "弧光": entity.Prefix = 11; break; case "灵动": entity.Prefix = 12; break; case "反射": entity.Prefix = 13; break; case "空间": entity.Prefix = 14; break; case "触感": entity.Prefix = 15; break; } #endregion #region 处理散装后缀 var ss = equipmentEntity.Name.Substring(2); switch (ss) { case "战靴": entity.ImageId = 1; break; case "护目镜": entity.ImageId = 2; break; case "护踝": entity.ImageId = 3; break; case "护臂": entity.ImageId = 4; break; case "护腿板": entity.ImageId = 5; break; case "耳环": entity.ImageId = 6; break; case "头带": entity.ImageId = 7; break; case "护腕": entity.ImageId = 8; break; case "护膝": entity.ImageId = 9; break; case "护袜": entity.ImageId = 10; break; case "手镯": entity.ImageId = 11; break; case "戒指": entity.ImageId = 12; break; case "指贴": entity.ImageId = 13; break; case "球帽": entity.ImageId = 14; break; case "手套": entity.ImageId = 15; break; } #endregion } return(entity); }