Ejemplo n.º 1
0
        MessageCode Tran_SaveMatch(DbTransaction transaction, NbManagerEntity manager, NbManagerextraEntity managerex, BaseMatchData pkmatchData,
                                   Guid lotteryMatchId, int win, int lose, int draw, int prizeExp, int prizeCoin, int prizeItemCode, string prizeItemString
                                   , bool isrevenge, long revengeRecordId, ref long outRevengeRecordId, PlayerkillInfoEntity info, int prizeItemCount)
        {
            if (prizeCoin > 0 || prizeExp > 0)
            {
                if (!ManagerUtil.SaveManagerData(manager, managerex, transaction))
                {
                    return(MessageCode.NbUpdateFail);
                }
                else
                {
                    ManagerUtil.SaveManagerAfter(manager, managerex, transaction);
                }
                if (!NbManagerextraMgr.Update(managerex, transaction))
                {
                    return(MessageCode.NbUpdateFail);
                }
            }
            PlayerkillInfoMgr.Update(info);
            PlayerkillInfoMgr.SaveFightResult(pkmatchData.Home.ManagerId, manager.Logo, pkmatchData.Away.ManagerId, lotteryMatchId,
                                              win, lose, draw, DateTime.Now,
                                              pkmatchData.MatchId, pkmatchData.Home.Name, pkmatchData.Away.Name,
                                              pkmatchData.Home.Score, pkmatchData.Away.Score, prizeExp, prizeCoin,
                                              prizeItemCode
                                              , prizeItemString, isrevenge, revengeRecordId, prizeItemCount, ref outRevengeRecordId, transaction);

            return(MessageCode.Success);
        }
Ejemplo n.º 2
0
        void RefreshOpponent(PlayerkillInfoEntity info, int kpi)
        {
            LogHelper.Insert("refresh opponent:" + info.ManagerId, LogType.Info);
            var opponents = CacheFactory.PlayerKillCache.GetOpponents(info.ManagerId, kpi);

            if (opponents != null)
            {
                info.Opponents = new List <PlayerKillOpponentEntity>(opponents.Count);
                foreach (var entity in opponents)
                {
                    info.Opponents.Add(entity.Clone());
                }
            }
            info.OpponentInfo        = SerializationHelper.ToByte(info.Opponents);
            info.OpponentRefreshTime = DateTime.Now.AddHours(2);
            PlayerkillInfoMgr.Update(info);
        }
Ejemplo n.º 3
0
        public PlayerkillInfoEntity InnerGetInfo(Guid managerId)
        {
            var info = PlayerkillInfoMgr.GetById(managerId);

            if (info == null)
            {
                info                     = new PlayerkillInfoEntity();
                info.ManagerId           = managerId;
                info.RecordDate          = DateTime.Now.Date;
                info.RowTime             = DateTime.Now;
                info.UpdateTime          = DateTime.Now;
                info.RemainByTimes       = 1000;
                info.RemainTimes         = 0;
                info.LotteryMatchId      = Guid.Empty;
                info.OpponentInfo        = new byte[0];
                info.OpponentRefreshTime = DateTime.Now;
                info.SpecialItemNumber   = 0;
                PlayerkillInfoMgr.Insert(info);
            }
            else if (info.RecordDate != DateTime.Today)
            {
                info.RecordDate        = DateTime.Today;
                info.RemainByTimes     = 1000;
                info.RemainTimes       = 0;
                info.DayWinTimes       = 0;
                info.BuyTimes          = 0;
                info.UpdateTime        = DateTime.Now;
                info.DayPoint          = 0;
                info.SpecialItemNumber = 0;
                PlayerkillInfoMgr.Update(info);
            }
            else
            {
                if (info.RemainTimes < 0)
                {
                    info.RemainTimes = 0;
                }
                if (info.RemainByTimes < 0)
                {
                    info.RemainByTimes = 0;
                }
            }
            return(info);
        }