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); }
/// <summary> /// 比赛抽卡 /// </summary> /// <param name="managerId"></param> /// <param name="matchId"></param> /// <returns></returns> public TourLotteryResponse Lottery(Guid managerId, Guid matchId) { var pkMatch = PlayerkillMatchMgr.GetById(matchId); if (pkMatch == null || pkMatch.HomeId != managerId) { return(ResponseHelper.InvalidParameter <TourLotteryResponse>()); } var pkInfo = PlayerkillInfoMgr.GetById(managerId); if (pkInfo == null || pkInfo.LotteryMatchId != matchId) { return(ResponseHelper.InvalidParameter <TourLotteryResponse>()); } //var itemBinding = ShareUtil.GetItemBinding(EnumItemPrizeType.PlayerKillPrize, ManagerUtil.GetVipLevel(managerId)); var itemBinding = true; //处理抽奖 if (pkMatch.Status == -1) { var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.FriendShip); var itemDic = CacheFactory.ItemsdicCache.GetItem(pkMatch.PrizeItemCode); if (itemDic == null) { return(ResponseHelper.InvalidParameter <TourLotteryResponse>()); } MailBuilder mail = null; EquipmentProperty equipmentProperty = null; MessageCode result = MessageCode.Success; var itemCount = 1; int point = 0; if (itemDic.ItemType == (int)EnumItemType.Equipment) { equipmentProperty = CacheFactory.EquipmentCache.RandomEquipmentProperty(itemDic.LinkId); result = package.AddEquipment(pkMatch.PrizeItemCode, itemBinding, false, equipmentProperty); } else if (itemDic.ItemType == (int)EnumItemType.FriendshipPoint)//友情点 { itemCount = itemDic.FourthType; var manager = ManagerCore.Instance.GetManager(managerId); ManagerCore.Instance.UpdateFriendShipPoint(manager, itemDic.FourthType, EnumActionType.Add); } else if (itemDic.ItemType == (int)EnumItemType.Point)//钻石 { itemCount = pkMatch.PrizeItemCount; point = itemCount; //欧洲杯狂欢 ActivityExThread.Instance.EuropeCarnival(5, ref point); } else { result = package.AddItem(pkMatch.PrizeItemCode, itemBinding, false); } if (result != MessageCode.Success) { package = null; mail = new MailBuilder(managerId, pkMatch.PrizeItemCode, itemBinding, equipmentProperty, pkMatch.AwayName); } point += 1;//场次获胜额外获得1钻石 //var code = SaveLottery(pkMatch.Idx, pkMatch.HomeId, package, mail, (int)MessageCode.TourLotteryRepeat); var code = SaveLottery(pkMatch.Idx, pkMatch.HomeId, (int)MessageCode.TourLotteryRepeat, package, mail, point); if (code == MessageCode.Success) { var response = ResponseHelper.CreateSuccess <TourLotteryResponse>(); response.Data = new TourLotteryEntity(); response.Data.ItemCode = pkMatch.PrizeItemCode; response.Data.EquipmentProperty = equipmentProperty; response.Data.IsBinding = itemBinding; response.Data.ItemCount = 1; if (itemDic.ItemType == (int)EnumItemType.Point) //钻石 友情点 { response.Data.ItemCount = point - 1; } else if (itemDic.ItemType == (int)EnumItemType.FriendshipPoint) { response.Data.ItemCount = itemCount; } //奥运金牌掉落 response.Data.OlympicTheGoldMedalId = OlympicCore.Instance.GetOlympicTheGoldMedal( managerId, EnumOlympicGeyType.FriendMatch); return(response); } else { return(ResponseHelper.Create <TourLotteryResponse>(code)); } } else { return(ResponseHelper.Create <TourLotteryResponse>(MessageCode.TourLotteryRepeat)); } }