DTOBuffMemberView GetMembers4Db(Guid managerId, ManagerSkillUseWrap use, ArenaTeammemberFrame arenaFrame) { if (!FrameConfig.SWAPBuffDataReadDb || null == use || use.Raw.SyncFlag != 0) { return(null); } var rawMembers = BuffUtil.GetRawMembers(managerId, true, arenaFrame); var members = NbManagerbuffmemberMgr.GetByMid(managerId, ShareUtil.GetTableMod(managerId)); //var extra = NbManagerextraMgr.GetById(managerId); var dic = new Dictionary <Guid, NbManagerbuffmemberEntity>(members.Count); DicPlayerEntity cfg = null; foreach (var item in members) { cfg = PlayersdicCache.Instance.GetPlayer(Math.Abs(item.Pid)); if (null == cfg) { continue; } FillBuffMemberProp(item, cfg); item.ReadySkillList = item.ReadySkills.Split(',').ToList(); item.LiveSkillList = item.LiveSkills.Split(',').ToList(); } var data = CreateBuffView(managerId, use, rawMembers.ToDictionary(i => i.Idx, i => i)); data.Kpi = arenaFrame.Kpi; data.SyncIdleFlag = false; data.BuffMembers = dic; return(data); }
DTOBuffPlayer CreateBuffPlayer(DicPlayerEntity cfg, int showOrder, int pid = 0) { if (null == cfg) { return(null); } var rawProps = cfg.GetRawProps(); var obj = new DTOBuffPlayer(); obj.Pid = pid == 0 ? cfg.Idx : pid; obj.Pos = cfg.Position; obj.Clr = cfg.CardLevel; obj.Club = cfg.Club; obj.Nationality = cfg.Nationality; obj.Props = new DTOBuffProp[rawProps.Length]; obj.PosOn = -1; obj.ShowOrder = showOrder; for (int i = 0; i < rawProps.Length; ++i) { obj.Props[i] = new DTOBuffProp { Orig = rawProps[i] }; } rawProps = null; return(obj); }
NbManagerbuffmemberEntity BuildBuffMember(DicPlayerEntity dic) { NbManagerbuffmemberEntity member = new NbManagerbuffmemberEntity(); member.PPos = dic.Position; member.IsMain = true; var props = dic.GetRawProps(); member.SpeedCount += props[0]; member.ShootCount += props[1]; member.FreeKickCount += props[2]; member.BalanceCount += props[3]; member.PhysiqueCount += props[4]; member.BounceCount += props[5]; member.AggressionCount += props[6]; member.DisturbCount += props[7]; member.InterceptionCount += props[8]; member.DribbleCount += props[9]; member.PassCount += props[10]; member.MentalityCount += props[11]; member.ResponseCount += props[12]; member.PositioningCount += props[13]; member.HandControlCount += props[14]; member.AccelerationCount += props[15]; return(member); }
public List <string> CheckClubSkills(int[] pIds) { if (null == pIds || pIds.Length == 0) { return(null); } var dic = new Dictionary <string, int>(16); var lst = new List <string>(8); DicPlayerEntity cfg = null; int skillVal; foreach (int pid in pIds) { cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg) { continue; } if (dic.ContainsKey(cfg.Club)) { dic[cfg.Club]--; } else { if (TryGetClubSkillValue(out skillVal, cfg.Club)) { dic[cfg.Club] = skillVal - 1; } } if (dic.ContainsKey(cfg.Nationality)) { dic[cfg.Nationality]--; } else { if (TryGetClubSkillValue(out skillVal, cfg.Nationality)) { dic[cfg.Nationality] = skillVal - 1; } } } string skillCode; foreach (var kvp in dic) { if (kvp.Value > 0) { continue; } if (!TryGetClubSkill(out skillCode, kvp.Key)) { continue; } lst.Add(skillCode); } dic.Clear(); return(lst); }
/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/5/18 20:12:02</remarks> public bool Update(DicPlayerEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicPlayer_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@Name", DbType.String, entity.Name); database.AddInParameter(commandWrapper, "@Area", DbType.Int32, entity.Area); database.AddInParameter(commandWrapper, "@AllPosition", DbType.StringFixedLength, entity.AllPosition); database.AddInParameter(commandWrapper, "@Position", DbType.Int32, entity.Position); database.AddInParameter(commandWrapper, "@PositionDesc", DbType.AnsiString, entity.PositionDesc); database.AddInParameter(commandWrapper, "@CardLevel", DbType.Int32, entity.CardLevel); database.AddInParameter(commandWrapper, "@KpiLevel", DbType.AnsiString, entity.KpiLevel); database.AddInParameter(commandWrapper, "@LeagueLevel", DbType.Int32, entity.LeagueLevel); database.AddInParameter(commandWrapper, "@NameEn", DbType.String, entity.NameEn); database.AddInParameter(commandWrapper, "@Specific", DbType.Double, entity.Specific); database.AddInParameter(commandWrapper, "@Kpi", DbType.Double, entity.Kpi); database.AddInParameter(commandWrapper, "@Capacity", DbType.Int32, entity.Capacity); database.AddInParameter(commandWrapper, "@Speed", DbType.Double, entity.Speed); database.AddInParameter(commandWrapper, "@Shoot", DbType.Double, entity.Shoot); database.AddInParameter(commandWrapper, "@FreeKick", DbType.Double, entity.FreeKick); database.AddInParameter(commandWrapper, "@Balance", DbType.Double, entity.Balance); database.AddInParameter(commandWrapper, "@Physique", DbType.Double, entity.Physique); database.AddInParameter(commandWrapper, "@Power", DbType.Double, entity.Power); database.AddInParameter(commandWrapper, "@Aggression", DbType.Double, entity.Aggression); database.AddInParameter(commandWrapper, "@Disturb", DbType.Double, entity.Disturb); database.AddInParameter(commandWrapper, "@Interception", DbType.Double, entity.Interception); database.AddInParameter(commandWrapper, "@Dribble", DbType.Double, entity.Dribble); database.AddInParameter(commandWrapper, "@Pass", DbType.Double, entity.Pass); database.AddInParameter(commandWrapper, "@Mentality", DbType.Double, entity.Mentality); database.AddInParameter(commandWrapper, "@Response", DbType.Double, entity.Response); database.AddInParameter(commandWrapper, "@Positioning", DbType.Double, entity.Positioning); database.AddInParameter(commandWrapper, "@HandControl", DbType.Double, entity.HandControl); database.AddInParameter(commandWrapper, "@Acceleration", DbType.Double, entity.Acceleration); database.AddInParameter(commandWrapper, "@Bounce", DbType.Double, entity.Bounce); database.AddInParameter(commandWrapper, "@Club", DbType.String, entity.Club); database.AddInParameter(commandWrapper, "@Birthday", DbType.AnsiString, entity.Birthday); database.AddInParameter(commandWrapper, "@Stature", DbType.Double, entity.Stature); database.AddInParameter(commandWrapper, "@Weight", DbType.Double, entity.Weight); database.AddInParameter(commandWrapper, "@Nationality", DbType.String, entity.Nationality); database.AddInParameter(commandWrapper, "@Description", DbType.String, entity.Description); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
void FillBuffPack(DTOBuffPack buffPack, bool homeFlag, Guid managerId, ArenaTeammemberFrame arenaFrame, List <TeammemberEntity> rawMembers = null, string siteId = "") { FillBuffPackRaw(buffPack, homeFlag, managerId, arenaFrame, rawMembers, siteId); var dicAll = buffPack.GetBuffPlayers(homeFlag); var lstOn = buffPack.GetOnBuffPlayers(homeFlag); if (null != dicAll && null != lstOn) { return; } var members = buffPack.GetRawMembers(homeFlag); var pids = buffPack.GetOnPids(homeFlag); var form = buffPack.GetSolution(homeFlag); dicAll = new Dictionary <Guid, DTOBuffPlayer>(members.Count); lstOn = new List <DTOBuffPlayer>(12); int pid = 0; Guid tid = Guid.Empty; DicPlayerEntity cfg = null; DTOBuffPlayer buffP = null; int showOrder = 1; foreach (var kvp in form.PlayerDic) { pid = kvp.Key; cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg || !pids.TryGetValue(pid, out tid)) { throw new Exception(string.Format("BuffDataCore:Manager[{0}] Miss Player[{1}] With Config Or Member", managerId, pid)); } buffP = CreateBuffPlayer(cfg, showOrder++); buffP.Pos = buffP.PosOn = kvp.Value.Position; buffP.ActionSkill = kvp.Value.SkillCode; dicAll[tid] = buffP; lstOn.Add(buffP); } foreach (var kvp in members) { pid = kvp.Value.PlayerId; tid = kvp.Key; if (dicAll.ContainsKey(tid)) { continue; } cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg) { continue; } buffP = CreateBuffPlayer(cfg, showOrder++, -cfg.Idx); dicAll[tid] = buffP; } buffPack.SetBuffPlayers(homeFlag, dicAll); buffPack.SetOnBuffPlayers(homeFlag, lstOn); }
public static DicPlayerEntity GetDicPlayer(Guid teammemberId, int playerId) { DicPlayerEntity dicPlayer = CacheFactory.PlayersdicCache.GetPlayer(playerId); if (null == dicPlayer) { throw new TransferException(string.Format("can't find player,teammemberId:{0},playerId:{1}", teammemberId, playerId)); } return(dicPlayer); }
public static double[] GetRawProps(this DicPlayerEntity src) { return(new double[] { src.Speed, src.Shoot, src.FreeKick, src.Balance, src.Physique, src.Power, src.Aggression, src.Disturb, src.Interception, src.Dribble, src.Pass, src.Mentality, src.Response, src.Positioning, src.HandControl, src.Acceleration, src.Bounce }); }
public List <NbManagerbuffpoolEntity> CheckTeamBuffPools(Guid mid, string siteId = "") { var form = MemcachedFactory.SolutionClient.Get <NbSolutionEntity>(mid); if (null == form) { form = NbSolutionMgr.GetById(mid, siteId); } if (null == form) { return(null); } var pids = FrameUtil.CastIntList(form.PlayerString, ','); string club = string.Empty; string nation = string.Empty; DicPlayerEntity cfg = null; foreach (int pid in pids) { cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg) { continue; } if (club == string.Empty) { club = cfg.Club; } if (nation == string.Empty) { nation = cfg.Nationality; } if (null != club && cfg.Club != club) { club = null; } if (null != nation && cfg.Nationality != nation) { nation = null; } } if (null != club || null != nation) { return(BuffCache.Instance().GenManagerPoolList(SKILLTeamBuff)); } return(null); }
public TeammemberPropertyBuff(DicPlayerEntity player, int strength, int buff) { this.PlayerId = player.Idx; this.Original = new double[] { player.Speed , player.Shoot , player.FreeKick , player.Balance , player.Physique , player.Power , player.Aggression , player.Disturb , player.Interception , player.Dribble , player.Pass , player.Mentality , player.Response , player.Positioning , player.HandControl , player.Acceleration , player.Bounce }; this.Percent = new double[this.Original.Length]; this.Point = new double[this.Original.Length]; this.Trains = new double[this.Original.Length]; if (strength > 0) { Strength = 1 + (strength - 1) * 0.35; } else { Strength = 1; } if (buff > 0) { BuffScale = buff / 100.00; } else { BuffScale = 1; } }
/// <summary> /// 将IDataReader的当前记录读取到DicPlayerEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public DicPlayerEntity LoadSingleRow(IDataReader reader) { var obj = new DicPlayerEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.Name = (System.String)reader["Name"]; obj.Area = (System.Int32)reader["Area"]; obj.AllPosition = (System.String)reader["AllPosition"]; obj.Position = (System.Int32)reader["Position"]; obj.PositionDesc = (System.String)reader["PositionDesc"]; obj.CardLevel = (System.Int32)reader["CardLevel"]; obj.KpiLevel = (System.String)reader["KpiLevel"]; obj.LeagueLevel = (System.Int32)reader["LeagueLevel"]; obj.NameEn = (System.String)reader["NameEn"]; obj.Specific = (System.Double)reader["Specific"]; obj.Kpi = (System.Double)reader["Kpi"]; obj.Capacity = (System.Int32)reader["Capacity"]; obj.Speed = (System.Double)reader["Speed"]; obj.Shoot = (System.Double)reader["Shoot"]; obj.FreeKick = (System.Double)reader["FreeKick"]; obj.Balance = (System.Double)reader["Balance"]; obj.Physique = (System.Double)reader["Physique"]; obj.Power = (System.Double)reader["Power"]; obj.Aggression = (System.Double)reader["Aggression"]; obj.Disturb = (System.Double)reader["Disturb"]; obj.Interception = (System.Double)reader["Interception"]; obj.Dribble = (System.Double)reader["Dribble"]; obj.Pass = (System.Double)reader["Pass"]; obj.Mentality = (System.Double)reader["Mentality"]; obj.Response = (System.Double)reader["Response"]; obj.Positioning = (System.Double)reader["Positioning"]; obj.HandControl = (System.Double)reader["HandControl"]; obj.Acceleration = (System.Double)reader["Acceleration"]; obj.Bounce = (System.Double)reader["Bounce"]; obj.Club = (System.String)reader["Club"]; obj.Birthday = (System.String)reader["Birthday"]; obj.Stature = (System.Double)reader["Stature"]; obj.Weight = (System.Double)reader["Weight"]; obj.Nationality = (System.String)reader["Nationality"]; obj.Description = (System.String)reader["Description"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>DicPlayerEntity</returns> /// <remarks>2016/5/18 20:12:02</remarks> public DicPlayerEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_DicPlayer_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); DicPlayerEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// 球员卡是否可以上阵 /// </summary> /// <param name="player"></param> /// <param name="arenaType"></param> /// <returns></returns> public bool IsPlayerMeetTheRequirements(DicPlayerEntity player, int arenaType) { try { if (!_arenaUpFormationAskFor.ContainsKey(arenaType)) { return(false); } var info = _arenaUpFormationAskFor[arenaType]; switch (info.AskForType) { case 1: //身高 return(player.Stature >= ConvertHelper.ConvertToInt(info.AskForValues)); case 2: //体重 return(player.Weight >= ConvertHelper.ConvertToInt(info.AskForValues)); case 3: //年龄 return(Convert.ToDateTime(player.Birthday) >= Convert.ToDateTime(info.AskForValues)); case 4: //年龄 排除元老 if (player.CardLevel == (int)EnumPlayerCardLevel.Gold || player.CardLevel == (int)EnumPlayerCardLevel.Silver) { return(false); } return(Convert.ToDateTime(player.Birthday) <= Convert.ToDateTime(info.AskForValues)); case 5: //卡等级 return(info.AskForValues.IndexOf(player.KpiLevel) > -1); } } catch { return(false); } return(false); }
public LocalDicPlayer(DicPlayerEntity dicPlayer) { this.Idx = dicPlayer.Idx; this.Name = dicPlayer.Name; this.CardLevel = dicPlayer.CardLevel; this.LeagueLevel = dicPlayer.LeagueLevel; this.Speed = dicPlayer.Speed.ToString("f0"); this.Shoot = dicPlayer.Shoot.ToString("f0"); this.FreeKick = dicPlayer.FreeKick.ToString("f0"); this.Balance = dicPlayer.Balance.ToString("f0"); this.Physique = dicPlayer.Physique.ToString("f0"); this.Bounce = dicPlayer.Bounce.ToString("f0"); this.Aggression = dicPlayer.Aggression.ToString("f0"); this.Disturb = dicPlayer.Disturb.ToString("f0"); this.Interception = dicPlayer.Interception.ToString("f0"); this.Dribble = dicPlayer.Dribble.ToString("f0"); this.Pass = dicPlayer.Pass.ToString("f0"); this.Mentality = dicPlayer.Mentality.ToString("f0"); this.Response = dicPlayer.Response.ToString("f0"); this.Positioning = dicPlayer.Positioning.ToString("f0"); this.HandControl = dicPlayer.HandControl.ToString("f0"); this.Acceleration = dicPlayer.Acceleration.ToString("f0"); }
void FillBuffMemberProp(NbManagerbuffmemberEntity member, DicPlayerEntity cfg) { if (null == member || null == cfg) { return; } member.SpeedConst = cfg.Speed; member.ShootConst = cfg.Shoot; member.FreeKickConst = cfg.FreeKick; member.BalanceConst = cfg.Balance; member.PhysiqueConst = cfg.Physique; member.PowerConst = cfg.Power; member.BounceConst = cfg.Bounce; member.AggressionConst = cfg.Aggression; member.DisturbConst = cfg.Disturb; member.InterceptionConst = cfg.Interception; member.DribbleConst = cfg.Dribble; member.PassConst = cfg.Pass; member.MentalityConst = cfg.Mentality; member.ResponseConst = cfg.Response; member.PositioningConst = cfg.Positioning; member.HandControlConst = cfg.HandControl; member.AccelerationConst = cfg.Acceleration; }
public TeammemberPropertyBuff(DicPlayerEntity player, int strength) : this(player, strength, 100) { }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/5/18 20:12:02</remarks> public bool Insert(DicPlayerEntity entity) { return(Insert(entity, null)); }
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> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2016/5/18 20:12:02</remarks> public bool Update(DicPlayerEntity entity) { return(Update(entity, null)); }
static DTOBuffPlayer BuildPlayer(int level, int propertyPoint, int strength, int playerId, int equipId, string skill, int position, int buffScale, ref Dictionary <int, List <int> > suitDic, ref Dictionary <int, int> suitTypeDic) { DicPlayerEntity cfg = MatchDataUtil.GetDicPlayer(Guid.Empty, playerId); var rawProps = cfg.GetRawProps(); var obj = new DTOBuffPlayer(); obj.Pid = cfg.Idx; obj.Pos = position; obj.Clr = cfg.CardLevel; obj.Props = new DTOBuffProp[rawProps.Length]; for (int i = 0; i < rawProps.Length; ++i) { obj.Props[i] = new DTOBuffProp { Orig = rawProps[i] }; obj.Props[i].Percent = (buffScale - 100) / 100.00; } if (propertyPoint > 0) { switch (position) { case (int)EnumPosition.Forward: obj.Props[0].Point += propertyPoint; obj.Props[1].Point += propertyPoint; obj.Props[2].Point += propertyPoint; obj.Props[3].Point += propertyPoint; break; case (int)EnumPosition.Midfielder: obj.Props[10].Point += propertyPoint; obj.Props[11].Point += propertyPoint; obj.Props[12].Point += propertyPoint; obj.Props[3].Point += propertyPoint; break; case (int)EnumPosition.Fullback: obj.Props[7].Point += propertyPoint; obj.Props[8].Point += propertyPoint; obj.Props[9].Point += propertyPoint; break; case (int)EnumPosition.Goalkeeper: obj.Props[13].Point += propertyPoint; obj.Props[14].Point += propertyPoint; obj.Props[15].Point += propertyPoint; break; } } rawProps = null; obj.Level = level; obj.Strength = strength; obj.SBMList = new List <string>(); obj.ActionSkill = skill; //obj.StarSkill = CacheFactory.PlayersdicCache.GetStarSkill(obj.AsPid, obj.Strength); EquipmentUsedEntity equipment = null; if (equipId > 0) { equipment = new EquipmentUsedEntity(); equipment.Property = CacheFactory.EquipmentCache.RandomEquipmentPropertyForNpc(equipId); } //装备和副卡 //TeammemberDataHelper.FillEquipData(obj, equipment, null, null, ref suitDic, ref suitTypeDic); return(obj); }
public static bool Update(DicPlayerEntity dicPlayerEntity, DbTransaction trans = null, string zoneId = "") { var provider = new DicPlayerProvider(zoneId); return(provider.Update(dicPlayerEntity, trans)); }