public override bool TakeAction() { m_ResponsePacket.ChanceType = m_RequestPacket.ChanceType; PlayerLogic p = new PlayerLogic(); p.SetUser(m_UserId); PlayerChanceLogic pc = new PlayerChanceLogic(); pc.SetUserAndType(m_UserId, m_RequestPacket.ChanceType); if (!pc.ResetRewards(false)) { ErrorCode = (int)ErrorType.RequireNotMet; ErrorInfo = "You have not enough money"; return(false); } m_ResponsePacket.PlayerInfo = new PBPlayerInfo() { Id = m_UserId, Coin = p.MyPlayer.Coin, Money = p.MyPlayer.Money }; foreach (var item in pc.MyChance.UnopenedChanceRewards) { m_ResponsePacket.GoodInfo.Add(new PBItemInfo() { Type = item.Value.ItemId, Count = item.Value.ItemCount }); } m_ResponsePacket.FreeChanceTimes = pc.MyChance.TotalFreeCount; return(true); }