Пример #1
0
        private void SaveGetNextEffectAward(GameClient client, int day, CoupleWishManager.EWishEffectAwardType awardType, int get)
        {
            string szEffectAward = Global.GetRoleParamByName(client, "34");

            string[] awardFields = (!string.IsNullOrEmpty(szEffectAward)) ? szEffectAward.Split(new char[]
            {
                ','
            }) : null;
            int[] newFlag = new int[5];
            newFlag[0] = (int)awardType;
            newFlag[1] = day;
            if (awardFields != null && awardFields.Length == 5 && Convert.ToInt32(awardFields[1]) == day)
            {
                for (int i = 0; i < 3; i++)
                {
                    newFlag[2 + i] = Convert.ToInt32(awardFields[2 + i]);
                }
            }
            newFlag[(int)(2 + awardType)] = (int)Math.Min(2147483647L, (long)(newFlag[(int)(2 + awardType)] + get));
            Global.SaveRoleParamsStringToDB(client, "34", string.Format("{0},{1},{2},{3},{4}", new object[]
            {
                newFlag[0],
                newFlag[1],
                newFlag[2],
                newFlag[3],
                newFlag[4]
            }), true);
        }
Пример #2
0
        private bool GetNextCanEffectAward(GameClient client, int day, out CoupleWishManager.EWishEffectAwardType awardType, out int canGetMax)
        {
            awardType = CoupleWishManager.EWishEffectAwardType.None;
            canGetMax = 0;
            string szEffectAward = Global.GetRoleParamByName(client, "34");

            string[] awardFields = (!string.IsNullOrEmpty(szEffectAward)) ? szEffectAward.Split(new char[]
            {
                ','
            }) : null;
            bool result;

            if (awardFields == null || awardFields.Length != 5)
            {
                awardType = CoupleWishManager.EWishEffectAwardType.BangJin;
                canGetMax = this.WishEffectDayMaxAward[awardType];
                result    = true;
            }
            else if (Convert.ToInt32(awardFields[1]) != day)
            {
                awardType = (EWishEffectAwardType)((Convert.ToInt32(awardFields[0]) + (int)EWishEffectAwardType.BangZuan) % (int)EWishEffectAwardType.Max);
                canGetMax = this.WishEffectDayMaxAward[awardType];
                result    = true;
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    int nextType   = (Convert.ToInt32(awardFields[0]) + i + 1) % 3;
                    int nextHadGet = Convert.ToInt32(awardFields[2 + nextType]);
                    if (this.WishEffectDayMaxAward[(CoupleWishManager.EWishEffectAwardType)nextType] > nextHadGet)
                    {
                        awardType = (CoupleWishManager.EWishEffectAwardType)nextType;
                        canGetMax = this.WishEffectDayMaxAward[awardType] - nextHadGet;
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }