Пример #1
0
        public static void SetBonusGot(int playerID, int bonusToClub, int clubID, int luckyPlayerID)
        {
            var sql = "UPDATE dbo.Arsenalcn_Config SET ConfigValue = 'true' WHERE ConfigKey = 'LuckyPlayerBonusGot'; ";

            sql = sql +
                  "UPDATE dbo.AcnClub_LogLuckyPlayer SET BonusGot = 1 WHERE [ID] = (SELECT TOP 1 [ID] FROM AcnClub_LogLuckyPlayer ORDER BY [Date] DESC); ";

            using (var con = SQLConn.GetConnection())
            {
                var com = new SqlCommand(sql, con);

                con.Open();

                com.ExecuteNonQuery();

                //con.Close();
            }

            var player  = PlayerStrip.GetPlayerInfoByPlayerID(playerID);
            var lPlayer = PlayerStrip.GetPlayerInfoByPlayerID(luckyPlayerID);

            if (player != null && clubID > 0)
            {
                var ch = new ClubHistory();
                ch.ClubID            = clubID;
                ch.ActionUserName    = lPlayer.UserName;
                ch.OperatorUserName  = player.UserName;
                ch.ActionType        = ClubHistoryActionType.LuckyPlayer.ToString();
                ch.ActionDescription = ClubLogic.BuildClubHistoryActionDesc(ClubHistoryActionType.LuckyPlayer,
                                                                            bonusToClub.ToString(), lPlayer.UserName);

                ClubLogic.SaveClubHistory(ch);
            }
        }
        internal static int CalcContributeFortune(int userID, int memberCredit, float memberMana, int memberFortune,
                                                  bool playerBonus)
        {
            var returnValue = (int)(ConfigGlobal.ClubFortuneIncrementVariable * Math.Pow(Math.Log10(memberCredit), 4)) +
                              (int)((memberMana + 1) * Math.Log10(memberFortune));

            if (returnValue < 0)
            {
                returnValue = 0;
            }

            //player contribution

            //returnValue += PlayerStrip.CalcPlayerPrice(userID);

            if (playerBonus)
            {
                returnValue = (int)(returnValue * (1 + PlayerStrip.CalcPlayerContributionBonusRate(userID)));
            }

            return(returnValue);
        }
Пример #3
0
        public static BingoResult AnalyzeFlashResult(int userID, string result, string resultType)
        {
            var br = new BingoResult();

            switch (resultType)
            {
            case "strip":
                br.Result = BingoResultType.Strip;
                if (result == "strip")
                {
                    br.ResultDetail = "strips";
                }
                else
                {
                    br.ResultDetail = result;
                }

                return(br);

            case "card":
                br.Result = BingoResultType.Card;
                if (result.Length == 36)
                {
                    br.ResultDetail = result;
                }
                else
                {
                    br.ResultDetail = "legend";
                }
                return(br);

            case "cash":
                br.Result = BingoResultType.Cash;
                var bonusCash = 0f;
                var bonusRate = ConfigGlobal.BingoBonusRate;

                if (result == "cash")
                {
                    var videoActiveCount = Entity.UserVideo.GetUserVideosByUserID(userID).Count;

                    var items = PlayerStrip.GetMyNumbers(userID);
                    items.RemoveAll(delegate(Card un) { return(!un.IsActive); });
                    var cardActiveCount = items.Count;

                    // Video & Card Cash Bonus
                    bonusCash += (videoActiveCount * 5 + cardActiveCount) * bonusRate;
                    bonusCash += Convert.ToSingle(ConfigGlobal.BingoGetCost) +
                                 Convert.ToSingle(ConfigGlobal.BingoCost);
                }
                else
                {
                    // Player Cash Bonus
                    bonusCash += Convert.ToSingle(ConfigGlobal.BingoGetCost) * bonusRate;
                    bonusCash += Convert.ToSingle(ConfigGlobal.BingoGetCost) +
                                 Convert.ToSingle(ConfigGlobal.BingoCost);
                }

                br.ResultDetail = Math.Floor(bonusCash).ToString();
                return(br);

            case "both":
                br.Result       = BingoResultType.Both;
                br.ResultDetail = result;
                return(br);

            default:
                br.Result       = BingoResultType.Null;
                br.ResultDetail = null;
                return(br);
            }
        }