コード例 #1
0
        private static bool GetPayment(int game, int server, string account, string userID)
        {
            try
            {
                GameUser userInfo = new PersonalCacheStruct<GameUser>().FindKey(userID);
                if (userInfo == null) return false;
                var chatService = new TjxChatService();
                OrderInfo[] model = PayManager.getPayment(game, server, account);
                foreach (OrderInfo order in model)
                {
                    userInfo.PayGold = MathUtils.Addition(userInfo.PayGold, order.GameCoins, int.MaxValue);
                    //userInfo.Update();
                    PayManager.Abnormal(order.OrderNO);

                    DialHelper.ReturnRatioGold(userID, order.GameCoins);  //大转盘抽奖奖励充值返还
                    chatService.SystemSendWhisper(userInfo, string.Format(LanguageManager.GetLang().PaySuccessMsg, order.GameCoins));

                    DoGiff(userID, order);
                    FestivalHelper.GetPayReward(userInfo, order.GameCoins, FestivalType.PayReward);
                }
                return true;
            }
            catch (Exception ex)
            {
                BaseLog log = new BaseLog("PaymentLog");
                log.SaveLog(ex);
                return false;
            }
        }
コード例 #2
0
        /// <summary>
        /// 竞技场每日奖励
        /// </summary>
        /// <param name="user"></param>
        public static void DailySportsRankPrize(GameUser user)
        {
            UserDailyRestrain dailyRestrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(user.UserID);
            if (IsGainSportsReward(user.UserID) && dailyRestrain != null && dailyRestrain.UserExtend != null)
            {
                //var envSet = ServerEnvSet.Get(ServerEnvKey.JingJiChangReward, "");
                SportsRewardInfo sportsInfo = new ConfigCacheSet<SportsRewardInfo>().FindKey(dailyRestrain.UserExtend.UserRankID);
                //if (envSet != null && sportsInfo != null && envSet.ToDateTime().Date > dailyRestrain.Funtion11.Date &&
                // dailyRestrain.UserExtend.UserRankID > 0)
                if (sportsInfo != null && DateTime.Now.Date != dailyRestrain.Funtion11.Date &&
                 dailyRestrain.UserExtend.UserRankID > 0)
                {
                    dailyRestrain.Funtion11 = DateTime.Now;
                    dailyRestrain.UserExtend.UserRankID = 0;

                    user.SportsIntegral = MathUtils.Addition(user.SportsIntegral, sportsInfo.RewardObtian,
                                                             int.MaxValue);
                    user.GameCoin = MathUtils.Addition(user.GameCoin, sportsInfo.RewardGoin, int.MaxValue);
                    string sportContent = string.Format(LanguageManager.GetLang().St5106_JingJiChangRankReward,
                                                        sportsInfo.RewardObtian, sportsInfo.RewardGoin);
                    var chatService = new TjxChatService();
                    chatService.SystemSendWhisper(user, sportContent);
                }
            }
        }
コード例 #3
0
ファイル: Action9204.cs プロジェクト: daneric/Scut-samples
 public override bool TakeAction()
 {
     var chatService = new TjxChatService(ContextUser);
     _currVersion = chatService.CurrVersion;
     _chatArray = chatService.Receive();
     ContextUser.ChatVesion = _currVersion;
     //查找背包中的聊天道具
     int chatItemId = ConfigEnvSet.GetInt("UserItem.ChatItemID");
     _charItemNum=UserItemHelper.CheckItemNum(ContextUser.UserID, chatItemId);
     return true;
 }
コード例 #4
0
ファイル: DialHelper.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 获得灵件
 /// </summary>
 /// <param name="user"></param>
 /// <param name="spareID"></param>
 public static void AppendSpare(GameUser user, int spareID)
 {
     SparePartInfo partInfo = new ConfigCacheSet<SparePartInfo>().FindKey(spareID);
     UserSparePart sparePart = UserSparePart.GetRandom(spareID);
     if (partInfo == null || sparePart == null || !SparePartInfo.IsExist(spareID))
     {
         return;
     }
     if (!UserHelper.AddSparePart(user, sparePart))
     {
         var chatService = new TjxChatService();
         //掉落灵件
         chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().St4303_SparePartFalling, partInfo.Name));
     }
 }
コード例 #5
0
ファイル: ActivitiesAward.cs プロジェクト: 0jpq0/Scut
 /// <summary>
 /// 七夕、端午节奖励
 /// </summary>
 public static void DragonBoatFestival(string userID, int festivalID)
 {
     GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
     FestivalRestrain restrain = new GameDataCacheSet<FestivalRestrain>().FindKey(userID, festivalID);
     FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festivalID);
     var chatService = new TjxChatService();
     if (festival != null)
     {
         CacheList<PrizeInfo> rewardsArray = festival.Reward;
         if (NoviceHelper.IsFestivalOpen(festivalID))
         {
             if (restrain != null && restrain.RestrainNum <= festival.RestrainNum)
             {
                 restrain.RestrainNum = MathUtils.Addition(restrain.RestrainNum, 1, int.MaxValue);
                 restrain.RefreashDate = DateTime.Now;
                 //restrain.Update();
                 foreach (PrizeInfo reward in rewardsArray)
                 {
                     GameUserReward(userID, reward.Type, reward.ItemID, reward.Num);
                 }
                 if (userInfo != null && festival.FestivalExtend != null)
                 {
                     chatService.SystemSendWhisper(userInfo, festival.FestivalExtend.Desc);
                 }
             }
             else if (restrain == null)
             {
                 foreach (PrizeInfo reward in rewardsArray)
                 {
                     GameUserReward(userID, reward.Type, reward.ItemID, reward.Num);
                 }
                 if (userInfo != null && festival.FestivalExtend != null)
                 {
                     chatService.SystemSendWhisper(userInfo, festival.FestivalExtend.Desc);
                 }
                 restrain = new FestivalRestrain
                                {
                                    UserID = userID,
                                    FestivalID = festivalID,
                                    RefreashDate = DateTime.Now,
                                    RestrainNum = 1,
                                };
                 new GameDataCacheSet<FestivalRestrain>().Add(restrain, GameEnvironment.CacheUserPeriod);
             }
         }
     }
 }
コード例 #6
0
ファイル: Action9201.cs プロジェクト: jinfei426/Scut
        public override bool TakeAction()
        {

            int chatLeng = ConfigEnvSet.GetInt("Chat.ContentLeng");
            if (_content.IndexOf("<label") >= 0)
            {
                chatLeng += 150;
            }
            GameUser toUser = new GameDataCacheSet<GameUser>().FindKey(_toUserID);
            if (toUser == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9103_DoesNotExistTheUser;
                return false;
            }
            if (_content.Trim().Length == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9201_contentNotEmpty;
                return false;
            }
            if (_content.Length > chatLeng)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St9201_TheInputTextTooLong;
                return false;
            }
            //if (!CacheChat.IsAllow(ContextUser))
            //{
            //    ErrorCode = LanguageManager.GetLang().ErrorCode;
            //    ErrorInfo = LanguageManager.GetLang().St9203_ChatNotSend;
            //    return false;
            //}
            var chatService = new TjxChatService(ContextUser);
            chatService.SendWhisper(toUser, _content);
            UserFriends friends = new ShareCacheStruct<UserFriends>().FindKey(ContextUser.UserID, _toUserID);
            if (friends != null)
            {
                friends.ChatTime = DateTime.Now;
                //friends.Update();
            }

            return true;
        }
コード例 #7
0
ファイル: UserHelper.cs プロジェクト: rongxiong/Scut
        internal static void ProcessPetPrize(PetRunPool petRunPool)
        {
            if (petRunPool == null) return;
            if (petRunPool.PetID > 0)
            {
                var user = UserCacheGlobal.LoadOffline(petRunPool.UserID);
                if (user != null)
                {

                    if (user.UserExtend == null) user.UserExtend = new GameUserExtend();
                    //问题:在赛跑时有重刷点亮宠物后,等赛跑完服务端与客户端记录宠物ID不一致,原因是赛跑完有将宠物ID清除
                    //user.UserExtend.UpdateChildren(user.UserExtend, obj => obj.LightPetID = 0);
                    user.GameCoin = MathUtils.Addition(user.GameCoin, petRunPool.GameCoin, int.MaxValue);
                    user.ObtainNum = MathUtils.Addition(user.ObtainNum, petRunPool.ObtainNum, int.MaxValue);
                    //user.Update();
                    var chatService = new TjxChatService();
                    chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().Chat_PetRunSucess,
                   (new ConfigCacheSet<PetInfo>().FindKey(petRunPool.PetID) ?? new PetInfo()).PetName, petRunPool.GameCoin, petRunPool.ObtainNum));
                }
                petRunPool.PetID = 0;
                //petRunPool.Update();
            }
        }
コード例 #8
0
ファイル: PlotHelper.cs プロジェクト: 0jpq0/Scut
 /// <summary>
 /// 天地劫副本奖励
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="plotNpcID"></param>
 /// <returns></returns>
 public static CacheList<PrizeItemInfo> GetKalpaPlotMonsterItems(string userID, int plotID, int plotNpcID)
 {
     var chatService = new TjxChatService();
     CacheList<PrizeItemInfo> itemList = new CacheList<PrizeItemInfo>();
     GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
     if (userInfo == null)
     {
         return itemList;
     }
     PlotNPCInfo npcInfo = new ConfigCacheSet<PlotNPCInfo>().FindKey(plotNpcID);
     GetKalpaplotSparePart(userInfo, itemList, npcInfo, chatService);
     GetKalpaplotEnchant(userInfo, itemList, plotID);
     return itemList;
 }
コード例 #9
0
ファイル: Action1022.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 灵件ID=数量=属性ID:区间|属性ID:区间
        /// </summary>
        /// <param name="list"></param>
        /// <param name="userID"></param>
        private static void PutSparePackage(string[] list, string userID)
        {
            var chatService = new TjxChatService();
            foreach (var item in list)
            {
                if (string.IsNullOrEmpty(item)) continue;
                string[] itemList = item.Split(new char[] { '=' });

                int spareID = itemList.Length > 0 ? Convert.ToInt32(itemList[0]) : 0;
                int spareNum = itemList.Length > 1 ? Convert.ToInt32(itemList[1]) : 0;
                string[] propertys = itemList.Length > 2 ? itemList[2].ToNotNullString().Split('|') : new string[0];
                var sparePartInfo = new ConfigCacheSet<SparePartInfo>().FindKey(spareID);
                if (spareNum > 0 && propertys.Length > 0 && sparePartInfo != null)
                {
                    for (int i = 0; i < spareNum; i++)
                    {
                        UserSparePart sparePart = UserSparePart.CreateSparePart(spareID, propertys, ':');
                        if (sparePart == null) continue;
                        GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID);
                        if (!UserHelper.AddSparePart(user, sparePart))
                        {
                            chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().St4303_SparePartFalling, sparePartInfo.Name) + "*" + spareNum);
                        }
                    }
                }
                else
                {
                    new Base.BaseLog().SaveLog("领取灵件异常", new Exception(string.Format("userID:{3},spareID:{0},spareNum:{1},propertys:{2}", spareID, spareNum, propertys.Length, userID)));

                }
            }
        }
コード例 #10
0
ファイル: NoviceHelper.cs プロジェクト: daneric/Scut-samples
        /// <summary>
        /// 八月第二周活动
        /// </summary>
        /// <param name="user"></param>
        public static void AugustSecondWeek(GameUser user)
        {
            int festivalID = 0;// 1014;
            int itemID = 0;
            var chatService = new TjxChatService();
            FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festivalID);
            if (festival != null)
            {
                if (IsFestivalOpen(festivalID))
                {
                    string systemContent = string.Empty;
                    FestivalRestrain restrain = new PersonalCacheStruct<FestivalRestrain>().FindKey(user.UserID, festivalID);
                    List<PrizeInfo> prizeInfosArray = festival.Reward.ToList();
                    foreach (PrizeInfo reward in prizeInfosArray)
                    {
                        if (DateTime.Now.Date == reward.RefreshDate.Date)
                        {
                            if (reward.Type == RewardType.Item && UserHelper.IsBeiBaoFull(user)) break;
                            if (reward.Type == RewardType.CrystalId && CrystalHelper.IsCrystalNumFull(user)) break;
                            if (reward.Type == RewardType.CrystalId)
                            {
                                itemID = reward.ItemID;
                            }
                            else
                            {
                                itemID = reward.ItemID;
                            }
                            if (restrain != null && restrain.RefreashDate.Date != DateTime.Now.Date)
                            {
                                if (restrain.RefreashDate.Date != DateTime.Now.Date)
                                {
                                    restrain.RestrainNum = 1;
                                    restrain.RefreashDate = DateTime.Now;
                                    //restrain.Update();
                                }

                                systemContent = ActivitiesAward.GameUserUniversalNocite(user.UserID, reward.Type, itemID, reward.Num, LanguageManager.GetLang().St_AugustSecondWeek);
                                break;
                            }
                            else if (restrain == null)
                            {
                                var cacheSet = new PersonalCacheStruct<FestivalRestrain>();
                                restrain = new FestivalRestrain()
                                        {
                                            UserID = user.UserID,
                                            FestivalID = 1014,
                                            RestrainNum = 1,
                                            RefreashDate = DateTime.Now,
                                        };
                                cacheSet.Add(restrain);

                                systemContent = ActivitiesAward.GameUserUniversalNocite(user.UserID, reward.Type, itemID, reward.Num, LanguageManager.GetLang().St_AugustSecondWeek);
                                break;
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(systemContent))
                    {
                        chatService.SystemSendWhisper(user, systemContent);
                    }
                }
            }
        }
コード例 #11
0
ファイル: NoviceHelper.cs プロジェクト: daneric/Scut-samples
        /// <summary>
        /// 暑期第四弹 --登陆游戏获得奖励
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static void GianLoginReward(GameUser user)
        {
            int festID = 0;// 1011;
            var chatService = new TjxChatService();
            FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festID);
            if (festival != null)
            {
                if (IsFestivalOpen(festID))
                {
                    string level = string.Empty;
                    List<PrizeInfo> rewardsList = new List<PrizeInfo>(festival.Reward).FindAll(m => m.UserLv <= user.UserLv);
                    int rid = 0;
                    int itemID = 0;
                    string content = string.Empty;

                    UserDailyRestrain dailyRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(user.UserID);
                    if (dailyRestrain != null && dailyRestrain.UserExtend != null)
                    {
                        level = dailyRestrain.UserExtend.Leveling;
                    }
                    foreach (PrizeInfo reward in rewardsList)
                    {
                        rid = MathUtils.Addition(rid, 1, int.MaxValue);
                        if (!IsReceive(user.UserID, reward.UserLv.ToString(), rid))
                        {
                            if (reward.Type == RewardType.GameGoin)
                            {
                                content = content + string.Format(LanguageManager.GetLang().St_GameCoin, reward.Num) + ",";
                            }
                            if (reward.Type == RewardType.Obtion)
                            {
                                content = content + string.Format(LanguageManager.GetLang().St_ObtionNum + reward.Num) + ",";
                            }
                            if (reward.Type == RewardType.CrystalId)
                            {
                                if (UserHelper.IsCrystalBeiBaoFull(user))
                                {
                                    break;
                                }
                                CrystalInfo crystal = new ShareCacheStruct<CrystalInfo>().FindKey(reward.ItemID);
                                if (crystal != null)
                                {
                                    content = content + crystal.CrystalName + ",";
                                }
                            }
                            else if (reward.Type == RewardType.Item)
                            {
                                if (UserHelper.IsBeiBaoFull(user))
                                {
                                    break;
                                }
                                itemID = reward.ItemID;
                                ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(itemID);
                                if (itemInfo != null)
                                {
                                    content = content + itemInfo.ItemName + ",";
                                }
                            }
                            ActivitiesAward.GameUserReward(user.UserID, reward.Type, reward.ItemID, reward.Num);
                            level = level + reward.UserLv + ",";
                        }
                    }
                    if (!string.IsNullOrEmpty(content))
                    {
                        chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().St_SummerLeveling, content));
                    }
                    if (dailyRestrain != null && !string.IsNullOrEmpty(level))
                    {
                        if (!string.IsNullOrEmpty(level))
                        {
                            if (dailyRestrain.UserExtend == null)
                            {
                                dailyRestrain.UserExtend = new DailyUserExtend();
                            }
                            dailyRestrain.UserExtend.UpdateNotify(obj =>
                                {
                                    dailyRestrain.UserExtend.Leveling = level;
                                    return true;
                                });
                            //dailyRestrain.Update();
                        }
                    }
                }
            }
        }
コード例 #12
0
ファイル: NoviceHelper.cs プロジェクト: daneric/Scut-samples
        /// <summary>
        /// 暑期第四弹 --多人副本,尽享战友礼包!
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static void GianComradesPack(GameUser user)
        {
            int festID = 0;// 1010;
            var chatService = new TjxChatService();
            FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festID);
            if (festival != null)
            {
                if (IsFestivalOpen(festID))
                {
                    List<PrizeInfo> rewardsArray = festival.Reward.ToList();

                    UserDailyRestrain dailyRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(user.UserID);
                    if (dailyRestrain != null && dailyRestrain.UserExtend != null)
                    {
                        if (dailyRestrain.UserExtend.Comrades.Date != DateTime.Now.Date)
                        {
                            if (!UserHelper.IsBeiBaoFull(user))
                            {
                                foreach (PrizeInfo reward in rewardsArray)
                                {
                                    ItemBaseInfo iteminfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(reward.ItemID);
                                    if (iteminfo != null)
                                    {
                                        ActivitiesAward.GameUserReward(user.UserID, reward.Type, reward.ItemID, reward.Num);
                                        chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().St_SummerComradesItemNotice, iteminfo.ItemName));
                                    }
                                }
                                dailyRestrain.UserExtend.UpdateNotify(obj =>
                                {
                                    dailyRestrain.UserExtend.Comrades = DateTime.Now;
                                    return true;
                                });
                                //dailyRestrain.Update();
                            }

                        }
                    }
                }
            }
        }
コード例 #13
0
ファイル: NoviceHelper.cs プロジェクト: daneric/Scut-samples
 /// <summary>
 /// 点击第五个命运水晶获得额外
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static bool IsGianCrystalPack(GameUser user)
 {
     int festID = 0;//1009;
     var chatService = new TjxChatService();
     FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festID);
     if (festival != null)
     {
         if (IsFestivalOpen(festID))
         {
             int itemid = 5020;
             var package = UserItemPackage.Get(user.UserID);
             var userItemsArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus == ItemStatus.BeiBao);
             if (userItemsArray.Count < user.GridNum)
             {
                 UserItemHelper.AddUserItem(user.UserID, itemid, 1);
                 chatService.SystemSendWhisper(user, LanguageManager.GetLang().St1305_GainCrystalBackpack);
                 return true;
             }
             return false;
         }
         return true;
     }
     return true;
 }
コード例 #14
0
ファイル: NoviceHelper.cs プロジェクト: daneric/Scut-samples
 /// <summary>
 /// 渠道登录领好礼类型活动
 /// </summary>
 /// <param name="user"></param>
 public static void RetailLoginDaysReceive(GameUser user)
 {
     var chatService = new TjxChatService();
     var festivalInfosArray = new ShareCacheStruct<FestivalInfo>().FindAll(m => m.FestivalType == FestivalType.RetailLogin);
     foreach (FestivalInfo info in festivalInfosArray)
     {
         bool isChange = false;
         if (IsFestivalOpen(info.FestivalID))
         {
             FestivalRestrain restrain = new PersonalCacheStruct<FestivalRestrain>().FindKey(user.UserID, info.FestivalID);
             var rewardsArray = info.Reward;
             foreach (PrizeInfo reward in rewardsArray)
             {
                 if (reward.RetailID == user.RetailID && restrain == null)
                 {
                     ActivitiesAward.GameUserRewardNocite(user.UserID, reward.Type, reward.ItemID, reward.Num, reward.CrystalType);
                     isChange = true;
                 }
             }
             if (isChange && info.TaskConfig.Count > 0)
             {
                 foreach (TaskConfigInfo configInfo in info.TaskConfig)
                 {
                     chatService.SystemSendWhisper(user, configInfo.Desc);
                     if (restrain == null)
                     {
                         restrain = new FestivalRestrain()
                         {
                             UserID = user.UserID,
                             FestivalID = info.FestivalID,
                             RefreashDate = DateTime.Now,
                             RestrainNum = 1,
                         };
                         new PersonalCacheStruct<FestivalRestrain>().Add(restrain);
                     }
                 }
             }
         }
     }
 }
コード例 #15
0
ファイル: NoviceHelper.cs プロジェクト: daneric/Scut-samples
 /// <summary>
 /// 通关精英副本获得奖励
 /// </summary>
 /// <param name="user"></param>
 public static void ElitePlotFestivalList(GameUser user)
 {
     var festivalInfosArray = new ShareCacheStruct<FestivalInfo>().FindAll(m => m.FestivalType == FestivalType.EliteCount);
     var chatService = new TjxChatService();
     foreach (FestivalInfo info in festivalInfosArray)
     {
         if (IsFestivalOpen(info.FestivalID))
         {
             if (info.TaskConfig != null)
             {
                 FestivalRestrainNum(user.UserID, info.FestivalID);
                 int maxNum = 0;
                 var configInfos = info.TaskConfig;
                 foreach (TaskConfigInfo configInfo in configInfos)
                 {
                     maxNum = MathUtils.Addition(maxNum, 1);
                     var plotInfosArray = new ShareCacheStruct<PlotInfo>().FindAll(m => configInfo.CityID.IndexOf(m.CityID.ToString()) >= 0 && m.PlotType == configInfo.PlotType);
                     if (IsEliteClearance(user.UserID, info.FestivalID, plotInfosArray, maxNum))
                     {
                         ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(configInfo.item);
                         if (itemInfo != null)
                         {
                             UserItemHelper.AddUserItem(user.UserID, configInfo.item, configInfo.Num);
                             GetFestivalRestrain(info, user, maxNum, info.FestivalID);
                             chatService.SystemSend(ChatType.World, string.Format(configInfo.Desc, user.NickName, itemInfo.ItemName));
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #16
0
ファイル: PlotHelper.cs プロジェクト: 0jpq0/Scut
 /// <summary>
 /// 天地劫获取灵件
 /// </summary>
 /// <param name="userInfo"></param>
 /// <param name="itemList"></param>
 /// <param name="npcInfo"></param>
 /// <param name="chatService"></param>
 private static void GetKalpaplotSparePart(GameUser userInfo, CacheList<PrizeItemInfo> itemList, PlotNPCInfo npcInfo, TjxChatService chatService)
 {
     if (npcInfo != null && RandomUtils.IsHit(npcInfo.SparePartProbability))
     {
         SparePartInfo partInfo = new ConfigCacheSet<SparePartInfo>().FindKey(npcInfo.SparePartID);
         if (partInfo != null && SparePartInfo.IsExist(npcInfo.SparePartID))
         {
             UserSparePart sparePart = UserSparePart.GetRandom(npcInfo.SparePartID);
             if (sparePart != null)
             {
                 PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == npcInfo.SparePartID);
                 if (itemInfo == null)
                 {
                     itemInfo = new PrizeItemInfo
                     {
                         Type = 1,
                         ItemID = npcInfo.SparePartID,
                         Num = 1
                     };
                     itemList.Add(itemInfo);
                 }
                 else
                 {
                     itemInfo.Num += 1;
                 }
                 if (UserHelper.AddSparePart(userInfo, sparePart))
                 {
                     //userInfo.Update();
                 }
                 else
                 {
                     //掉落灵件
                     chatService.SystemSendWhisper(userInfo, string.Format(LanguageManager.GetLang().St4303_SparePartFalling, partInfo.Name));
                 }
             }
         }
     }
 }
コード例 #17
0
ファイル: PlotHelper.cs プロジェクト: 0jpq0/Scut
        /// <summary>
        /// 添加副本掉落的附魔符
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="enchantID"></param>
        public static void EnchantAddUser(GameUser userInfo, int enchantID)
        {
            UserEnchantInfo userenchant = EnchantHelper.GetUserEnchantInfo(enchantID);
            EnchantInfo enchantInfo = new ConfigCacheSet<EnchantInfo>().FindKey(enchantID);
            var package = UserEnchant.Get(userInfo.UserID);
            if (userenchant != null && enchantInfo != null && package != null)
            {
                int enchantNum = package.EnchantPackage.FindAll(m => string.IsNullOrEmpty(m.UserItemID)).Count;

                if (userInfo.UserExtend != null && userInfo.UserExtend.EnchantGridNum > enchantNum)
                {
                    UserLogHelper.AppenEnchantLog(userInfo.UserID, 1, userenchant, new CacheList<SynthesisInfo>());
                    package.SaveEnchant(userenchant);
                }
                else
                {
                    var chatService = new TjxChatService();
                    chatService.SystemSendWhisper(userInfo, string.Format(LanguageManager.GetLang().St4303_EnchantingCharacterFalling, enchantInfo.EnchantName));
                    UserLogHelper.AppenEnchantLog(userInfo.UserID, 6, userenchant, new CacheList<SynthesisInfo>());
                }
            }
        }
コード例 #18
0
ファイル: Action1022.cs プロジェクト: rongxiong/Scut
        private bool doProcessPrize(UserTakePrize userPrize)
        {
            Base.BaseLog log = new Base.BaseLog();
            if (userPrize == null) return false;
            string userID = userPrize.UserID.ToString();
            var gameUser = new GameDataCacheSet<GameUser>().FindKey(userID);
            if (gameUser == null) return false;

            log.SaveDebugLog(string.Format("玩家{0}领取奖励{1}:{2}", userID, userPrize.ID, userPrize.MailContent));
            userPrize.IsTasked = true;
            userPrize.TaskDate = DateTime.Now;
            //userPrize.Update();

            gameUser.ObtainNum = MathUtils.Addition(gameUser.ObtainNum, userPrize.ObtainNum);
            gameUser.EnergyNum = MathUtils.Addition(gameUser.EnergyNum, userPrize.EnergyNum.ToShort());
            gameUser.GameCoin = MathUtils.Addition(gameUser.GameCoin, userPrize.GameCoin);
            gameUser.GiftGold = MathUtils.Addition(gameUser.GiftGold, userPrize.Gold);
            gameUser.ExpNum = MathUtils.Addition(gameUser.ExpNum, userPrize.ExpNum);
            if (gameUser.UserExtend == null)
            {
                gameUser.UserExtend = new GameUserExtend();
            }
            gameUser.UserExtend.GainBlessing = MathUtils.Addition(gameUser.UserExtend.GainBlessing, userPrize.GainBlessing);
            if (userPrize.VipLv > 0)
            {
                var vipLv = new ConfigCacheSet<VipLvInfo>().FindKey(userPrize.VipLv.ToShort()) ?? new VipLvInfo();
                gameUser.ExtGold = vipLv.PayGold;
            }
            //gameUser.Update();

            PutItemPackage(userPrize.ItemPackage.Split(','), userID);
            PutCrystal(userPrize.CrystalPackage.Split(','), userID);
            PutSparePackage(userPrize.SparePackage.Split(','), userID);
            if (!string.IsNullOrEmpty(userPrize.EnchantPackage))
            {
                PutEnchant(userPrize.EnchantPackage.Split(','), userID);
            }
            var chatService = new TjxChatService();
            chatService.SystemSendWhisper(gameUser, string.Format("{0}", userPrize.MailContent));

            return true;
        }
コード例 #19
0
ファイル: Action3206.cs プロジェクト: 0jpq0/Scut
        public override bool TakeAction()
        {
            if (_userId.Equals(Uid))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St3206_PetInterceptError;
                return false;
            }
            if (new GameDataCacheSet<UserDailyRestrain>().FindKey(Uid) != null)
            {
                var userRestrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(Uid);
                int maxNum = new ShareCacheStruct<DailyRestrainSet>().FindKey(RestrainType.PetIntercept).MaxNum;
                if (userRestrain.UserExtend != null && userRestrain.UserExtend.PetIntercept >= maxNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St3206_PetInterceptTimesOut;
                    return false;
                }
            }

            var petRunPool = new ShareCacheStruct<PetRunPool>().FindKey(_userId);
            if (petRunPool == null || !petRunPool.IsRunning)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St3206_PetInterceptFaild;
                return false;
            }
            if (!string.IsNullOrEmpty(petRunPool.FriendID) && petRunPool.FriendID.Equals(Uid))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St3206_PetFriendError;
                return false;
            }

            if (!string.IsNullOrEmpty(petRunPool.InterceptUser))
            {
                string[] InterceptUserList = petRunPool.InterceptUser.Split(',');
                foreach (string intercept in InterceptUserList)
                {
                    if (intercept == ContextUser.UserID)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St3206_PetInterceptFull;
                        return false;
                    }
                }
                petRunPool.InterceptUser = petRunPool.InterceptUser + ContextUser.UserID + ",";
            }
            else
            {
                petRunPool.InterceptUser = ContextUser.UserID + ",";
            }
            //petRunPool.Update();
            var chatService = new TjxChatService();
            string toUserId = petRunPool.UserID;
            if (!string.IsNullOrEmpty(petRunPool.FriendID))
            {
                toUserId = petRunPool.FriendID;
            }
            GameUser toGameUser = UserCacheGlobal.LoadOffline(toUserId);
            ISingleCombat combatProxy = CombatFactory.TriggerTournament(ContextUser, toGameUser);
            isWin = combatProxy.Doing();
            combatProcessList = (CombatProcessContainer)combatProxy.GetProcessResult();
            if (isWin)
            {
                _interceptGameCoin = petRunPool.InterceptGameCoin;
                _interceptObtainNum = petRunPool.InterceptObtainNum;

                petRunPool.GameCoin = MathUtils.Subtraction(petRunPool.GameCoin, _interceptGameCoin, 0);
                petRunPool.ObtainNum = MathUtils.Subtraction(petRunPool.ObtainNum, _interceptObtainNum, 0);
                //petRunPool.Update();

                ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, _interceptGameCoin);
                ContextUser.ObtainNum = MathUtils.Addition(ContextUser.ObtainNum, _interceptObtainNum);
                //ContextUser.Update();
                var user = UserCacheGlobal.LoadOffline(petRunPool.UserID) ?? new GameUser();
                chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().Chat_PetWasBlocked,
                    (new ConfigCacheSet<PetInfo>().FindKey(petRunPool.PetID) ?? new PetInfo()).PetName, ContextUser.NickName, _interceptGameCoin, _interceptObtainNum
                    ));

                chatService.SystemSendWhisper(ContextUser, string.Format(LanguageManager.GetLang().Chat_PetInterceptSucess,
                    ContextUser.NickName,
                    user.NickName,
                    (new ConfigCacheSet<PetInfo>().FindKey(petRunPool.PetID) ?? new PetInfo()).PetName,
                    _interceptGameCoin,
                    _interceptObtainNum));

            }
            //日志
            UserCombatLog log = new UserCombatLog();
            log.CombatLogID = Guid.NewGuid().ToString();
            log.UserID = Uid;
            log.CityID = ContextUser.CityID;
            log.PlotID = 0;
            log.NpcID = 0;
            log.CombatType = CombatType.PetRun;
            log.HostileUser = toUserId;
            log.IsWin = isWin;
            log.CombatProcess = JsonUtils.Serialize(combatProcessList);
            log.PrizeItem = new CacheList<PrizeItemInfo>();
            log.CreateDate = DateTime.Now;

            var sender = DataSyncManager.GetDataSender();
            sender.Send(log);

            if (new GameDataCacheSet<UserDailyRestrain>().FindKey(Uid) != null)
            {
                var restrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(Uid);

                restrain.UserExtend.UpdateNotify(obj =>
                                                   {
                                                       restrain.UserExtend.PetIntercept = MathUtils.Addition(restrain.UserExtend.PetIntercept, 1);
                                                       return true;
                                                   });
                //restrain.Update();
            }
            return true;
        }
コード例 #20
0
ファイル: UserItemHelper.cs プロジェクト: jinfei426/Scut
        /// <summary>
        /// 增加物品
        /// </summary>
        public static void AddUserItem(string userID, int itemID, int itemNum, ItemStatus itemStatus, short itemLv, List<UniversalInfo> universalInfoList = null)
        {
            // 增加玩家集邮册
            AddUserAlbum(userID,itemID);

            var chatService = new TjxChatService();
            GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID);

            ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
            if (user == null || itemInfo == null)
            {
                return;
            }
            AddUniversalInfo(universalInfoList, itemInfo, itemNum);

            if (itemInfo.ItemType == ItemType.DaoJu && itemInfo.PropType == 17)
            {
                for (int i = 0; i < itemNum; i++)
                {

                    if (!PackIsFull(userID, BackpackType.HunJi, 1))
                    {

                        AddUserAbility(itemInfo.EffectNum, userID.ToInt(), 0, 0);
                    }
                }

            }
            else
            {
                if (itemInfo.ItemType == ItemType.DaoJu && itemInfo.PropType == 20)
                {
                    AddGeneralSoul(userID, itemInfo.ItemID, itemNum);

                }
                else
                {
                    int gridMaxNum = 0;
                    if (itemInfo.ItemType == ItemType.ZhuangBei)
                    {
                        gridMaxNum = GetPackTypePositionNum(BackpackType.ZhuangBei, userID);
                    }
                    else
                    {
                        gridMaxNum = GetPackTypePositionNum(BackpackType.BeiBao, userID);
                    }
                    int packNum = itemNum / itemInfo.PackMaxNum;
                    int num = itemNum % itemInfo.PackMaxNum;
                    ////判断背包是否有空位
                    //bool isOut = false;
                    //if (itemStatus == ItemStatus.BeiBao)
                    //{
                    //    isOut = CheckItemOut(user, itemStatus);
                    //}

                    var package = UserItemPackage.Get(userID);
                    var itemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemStatus.Equals(ItemStatus.BeiBao));
                    //背包中是否有余
                    var packItemList = package.ItemPackage.FindAll(
                        m => !m.IsRemove && m.ItemStatus.Equals(itemStatus) &&
                             m.ItemID == itemID &&
                             m.Num < itemInfo.PackMaxNum);

                    //当前空位
                    int currGridNum = gridMaxNum - itemList.Count;
                    // if ((isOut && packItemList.Count == 0) || currGridNum < packNum)
                    if (packItemList.Count == 0 && currGridNum <= 0)
                    {
                        AddItemLog(userID, itemID, itemNum, 1, 0, null);
                        chatService.SystemSendWhisper(user, string.Format("掉落物品{0}*{1}", itemInfo.ItemName, itemNum));
                        return;
                    }
                    currGridNum = MathUtils.Subtraction(currGridNum, packNum, 0);

                    for (int i = 0; i < packNum; i++)
                    {
                        //增加整包
                        UserItemInfo userItem = new UserItemInfo();
                        string uitemID = SetUserItem(userItem, userID, itemInfo, itemStatus, itemLv);
                        userItem.Num = itemInfo.PackMaxNum;

                        package.SaveItem(userItem);
                        AddItemLog(userID, itemID, userItem.Num, userItem.ItemLv, 1, uitemID);
                    }
                    //背包中是否有余
                    foreach (var item in packItemList)
                    {
                        if (num == 0) break;

                        int gridNum = itemInfo.PackMaxNum - item.Num;
                        int tempNum = gridNum > num ? num : gridNum;

                        item.Num = MathUtils.Addition(item.Num, tempNum, itemInfo.PackMaxNum);

                        package.SaveItem(item);
                        num = num > tempNum ? num - tempNum : 0;
                    }
                    //数据是否有余
                    if (num > 0)
                    {
                        if (currGridNum <= 0)
                        {
                            AddItemLog(userID, itemInfo.ItemID, num, 1, 0, null);
                            chatService.SystemSendWhisper(user, string.Format("掉落物品{0}*{1}", itemInfo.ItemName, num));
                        }
                        else
                        {
                            var userItem = new UserItemInfo();
                            string uitemID = SetUserItem(userItem, userID, itemInfo, itemStatus, itemLv);
                            userItem.Num = num;
                            package.SaveItem(userItem);

                            AddItemLog(userID, itemID, userItem.Num, userItem.ItemLv, 1, uitemID);
                        }
                    }
                }
            }
        }
コード例 #21
0
ファイル: ActivitiesAward.cs プロジェクト: 0jpq0/Scut
 /// <summary>
 /// 假日狂欢活动通关获得金币
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="plotID"></param>
 public static void GetHolidayFestivalReward(string userID, int plotID)
 {
     var chatService = new TjxChatService();
     int festivalID = 0;// 1003;
     FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festivalID);
     if (festival != null)
     {
         GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
         PlotInfo plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotID);
         if (plotInfo != null)
         {
             TimePriod priod = festival.TimePriod;
             if (NoviceHelper.IsFestivalOpen(festivalID))
             {
                 DateTime priodStart = DateTime.Parse(DateTime.Now.ToString("d") + " " + priod.Start.ToString("T"));
                 DateTime priodEnd = DateTime.Parse(DateTime.Now.ToString("d") + " " + priod.End.ToString("T"));
                 if (priodStart <= DateTime.Now && DateTime.Now < priodEnd)
                 {
                     if (RandomUtils.IsHit(plotInfo.FestivalProbability))
                     {
                         List<FestivalReward> rewardsArray = plotInfo.FestivalReward.ToList();
                         double[] probability = new double[rewardsArray.Count];
                         for (int i = 0; i < rewardsArray.Count; i++)
                         {
                             probability[i] = rewardsArray[i].Probability;
                         }
                         int index2 = RandomUtils.GetHitIndex(probability);
                         int itemID = rewardsArray[index2].Item;
                         UserItemHelper.AddUserItem(userID, itemID, 1);
                         ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
                         if (userInfo != null && itemInfo != null)
                         {
                             string content = string.Empty;
                             if (itemID == 5008)
                             {
                                 content = string.Format(LanguageManager.GetLang().St_HolidayFestivalGift, itemInfo.ItemName);
                                 chatService.SystemSendWhisper(userInfo, content);
                             }
                             else if (itemID == 5009)
                             {
                                 content = string.Format(LanguageManager.GetLang().St_HolidayFestivalGift, itemInfo.ItemName);
                                 chatService.SystemSendWhisper(userInfo, content);
                             }
                             else if (itemID == 5010)
                             {
                                 content = string.Format(LanguageManager.GetLang().St_HolidayFestivalGift, itemInfo.ItemName);
                                 chatService.SystemSendWhisper(userInfo, content);
                             }
                             else if (itemID == 5011)
                             {
                                 content = string.Format(LanguageManager.GetLang().St_HolidayFestivalGoinGift, userInfo.NickName);
                                 new TjxChatService().SystemSend(ChatType.World, content);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #22
0
ファイル: GeneralHelper.cs プロジェクト: daneric/Scut-samples
 /// <summary>
 /// 替换佣兵功能开启相关数值
 /// </summary>
 /// <param name="user"></param>
 public static void OpenReplaceGeneral(GameUser user)
 {
     var cachePrize = new ShareCacheStruct<UserTakePrize>();
     string generalPrize = ConfigEnvSet.GetString("General.ReplaceGeneralPrize");
     string content = LanguageManager.GetLang().St1901_OpenGeneralReplace;
     List<PrizeInfo> prizeList = new List<PrizeInfo>();
     if (!string.IsNullOrEmpty(generalPrize))
     {
         prizeList = JsonUtils.Deserialize<List<PrizeInfo>>(generalPrize);
     }
     foreach (PrizeInfo info in prizeList)
     {
         var takePrize = GetUserTake(info, user.UserID);
         cachePrize.Add(takePrize);
     }
     var chatService = new TjxChatService(user);
     chatService.SystemSendWhisper(user, content);
 }
コード例 #23
0
ファイル: UserHelper.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 竞技场公告
        /// </summary>
        public static void SprostSystemChat(UserRank rank, UserRank toRank)
        {
            if (rank == null || toRank == null)
            {
                return;
            }
            int topId = rank.RankId;
            int totopID = toRank.RankId;
            int winNum = 0;
            int winMaxNum = 0;
            string content = string.Empty;
            string winMaxUserID = string.Empty;
            var chatService = new TjxChatService();
            if (topId == 1 && topId > totopID)
            {
                content = string.Format(LanguageManager.GetLang().St5107_JingJiChangOneRank, rank.NickName, toRank.NickName);
                chatService.SystemSend(ChatType.World, content);
            }
            GameUser gameUser = UserCacheGlobal.LoadOffline(rank.UserID);
            if (gameUser != null)
            {
                IList<SportsCombat> userSportsCombats = gameUser.GetSportsCombat();

                if (userSportsCombats.Count > 0)
                {
                    if (totopID == 1 && userSportsCombats[userSportsCombats.Count - 1].IsWin)
                    {
                        content = string.Format(LanguageManager.GetLang().St5107_JingJiChangOneRank, toRank.NickName,
                                                rank.NickName);
                        chatService.SystemSend(ChatType.World, content);
                    }
                    winNum = userSportsCombats[userSportsCombats.Count - 1].WinNum;
                }
                //连胜第一名
                winMaxUserID = ServerEnvSet.Get(ServerEnvKey.SportFirstUser, "");
                winMaxNum = ServerEnvSet.Get(ServerEnvKey.SportFirstWinNum, 0).ToInt();

                Ranking<UserRank> ranking = RankingFactory.Get<UserRank>(CombatRanking.RankingKey);
                UserRank rankInfo = ranking.Find(s => s.UserID == winMaxUserID);
                //打破全服最高连胜的发通知
                if (winNum > winMaxNum)
                {
                    ServerEnvSet.Set(ServerEnvKey.SportFirstUser, rank.UserID);
                    ServerEnvSet.Set(ServerEnvKey.SportFirstWinNum, winNum);
                    if (rankInfo != null && rank.UserID != winMaxUserID && !string.IsNullOrEmpty(winMaxUserID))
                    {
                        content = string.Format(LanguageManager.GetLang().St5107_ZuiGaoLianSha, rank.NickName,
                                                rankInfo.NickName);
                        chatService.SystemSend(ChatType.World, content);
                    }
                    else if (winMaxNum > 5)
                    {
                        content = string.Format(LanguageManager.GetLang().St5107_JingJiChangWinNum, rank.NickName,
                                                winNum);
                        chatService.SystemSend(ChatType.World, content);
                    }
                }
                //int upRankID = MathUtils.Subtraction(totopID, topId, 0);
                //if (upRankID > 20)
                //{
                //    UserRank urankInfo = ranking.Find(s => s.UserID == rank.UserID);
                //    if (urankInfo != null && !string.IsNullOrEmpty(urankInfo.UserID))
                //    {
                //        content = string.Format(LanguageManager.GetLang().St5107_JingJiChangMoreNum, rank.NickName,
                //                                upRankID);
                //        chatService.SystemSend(ChatType.World, content);
                //    }
                //}
            }
        }
コード例 #24
0
ファイル: GuildBossCombat.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 处理伤害奖励
        /// </summary>
        private void DoDamagePrize(GameUser user, int damageNum, BossCombatProcess bossCombatProcess)
        {
            BossActivePrize bossPrize = UserGuild.BossPrize;
            if (bossPrize == null)
            {
                return;
            }
            int obtainNum = MathUtils.Addition(((int)Math.Ceiling((double)damageNum / bossPrize.ObtainRate)), 0, bossPrize.MaxObtain);
            int maxCoin = user.UserLv * bossPrize.MaxCoin;
            int gameCoin = MathUtils.Addition((int)Math.Ceiling((double)damageNum / bossPrize.CoinRate), 0, maxCoin);

            user.ObtainNum = MathUtils.Addition(user.ObtainNum, obtainNum, int.MaxValue);
            user.GameCoin = MathUtils.Addition(user.GameCoin, gameCoin, int.MaxValue);
            if (gameCoin <= 0)
            {
                gameCoin = 1;
            }
            if (obtainNum <= 0)
            {
                obtainNum = 1;
            }
            bossCombatProcess.ObtainNum = obtainNum;
            bossCombatProcess.GameCoin = gameCoin;
            CountryCombat.Contribution(user.UserID, obtainNum); //公会贡献

            //发到聊天里
            var chatService = new TjxChatService();
            chatService.SystemSendWhisper(user, string.Format(LanguageManager.GetLang().St6105_CombatHarmReward, gameCoin, obtainNum));
        }
コード例 #25
0
ファイル: CountryCombat.cs プロジェクト: daneric/Scut-samples
        private static void SendMessage(CountryLvGroup lvGroup)
        {
            List<KeyValuePair<string, CountryUser>> cuserList = lvGroup.UserList.ToList();

            var chatService = new TjxChatService();
            foreach (KeyValuePair<string, CountryUser> keyPair in cuserList)
            {
                CountryUser cuser = keyPair.Value;
                GameUser gameUser = new PersonalCacheStruct<GameUser>().FindKey(cuser.UserId);
                if (gameUser != null)
                {
                    gameUser.UserStatus = UserStatus.Normal;
                    gameUser.GroupType = CountryType.None;
                    //领土战礼包
                    UserItemHelper.AddUserItem(gameUser.UserID, 5013, 1);
                    CombatHelper.EmbattlePostion(gameUser.UserID);
                }
                string content = string.Format(LanguageManager.GetLang().St5204_CombatTransfusion,
                    cuser.WinCount, cuser.FailCount, cuser.GameCoin, cuser.ObtainNum);
                chatService.SystemSendWhisper(cuser.UserId, cuser.UserName, cuser.UserVipLv, content);
            }
        }
コード例 #26
0
ファイル: Action10006.cs プロジェクト: jinfei426/Scut
        public override bool TakeAction()
        {
            short optype = 0;
            short plantQuality = 0;
            PlantType pType = (PlantType)Enum.Parse(typeof(PlantType), plantType.ToString());
            if (pType == PlantType.Experience)
            {
                optype = 6;
            }
            else
            {
                optype = 7;
            }
            short generalLv = 0;
            UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, generalID);
            if (userGeneral == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().LoadDataError;
                return false;
            }
            generalLv = userGeneral.GeneralLv;

            if (pType == PlantType.Experience)
            {
                generalLv = ContextUser.UserLv;
            }
            else if (pType == PlantType.GameGoin)
            {
                generalLv = userGeneral.GeneralLv;
            }
            int upexpNum = 0;
            int expeNum = 0;
            double addNum = FestivalHelper.SurplusPurchased(ContextUser.UserID, FestivalType.ManorAddition);//活动加成
            UserLand userLand = new GameDataCacheSet<UserLand>().FindKey(ContextUser.UserID, landPositon);
            if (userLand != null)
            {
                if (userLand.IsGain == 2 || userLand.GeneralID == 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().LoadDataError;
                    return false;
                }
                plantQuality = (short)userLand.PlantQuality;
                PlantInfo plantInfo = new ConfigCacheSet<PlantInfo>().FindKey(generalLv, plantType, userLand.PlantQuality);
                if (plantInfo != null)
                {
                    if (userLand.IsGain == 1)
                    {
                        userLand.GeneralID = 0;
                        userLand.PlantType = PlantType.Experience;
                        userLand.IsGain = 2;
                        userLand.GainDate = DateTime.Now;
                        userLand.PlantQuality = PlantQualityType.PuTong;
                    }
                    else
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        return false;
                    }
                    gainNum = plantInfo.GainNum;
                    UserLand land = new GameDataCacheSet<UserLand>().FindKey(ContextUser.UserID, landPositon);
                    if (land != null && land.IsRedLand == 1)
                    {
                        gainNum = MathUtils.Addition(gainNum, (int)(gainNum * 0.2), int.MaxValue);
                    }
                    if (land != null && land.IsBlackLand == 1)
                    {
                        gainNum = MathUtils.Addition(gainNum, (int)(gainNum * 0.4), int.MaxValue);
                    }
                    gainNum = (gainNum * addNum).ToInt();
                    if (pType == PlantType.Experience)
                    {
                        expeNum = MathUtils.Addition(userGeneral.CurrExperience, gainNum, int.MaxValue);

                        GeneralEscalateInfo generalEscalate = new ConfigCacheSet<GeneralEscalateInfo>().FindKey(userGeneral.GeneralLv);
                        if (generalEscalate != null)
                        {
                            upexpNum = generalEscalate.UpExperience;
                        }

                        if (gainNum > 0)
                        {
                            userGeneral.Experience2 = MathUtils.Addition(userGeneral.Experience2, gainNum, int.MaxValue);
                            //userGeneral.CurrExperience = MathUtils.Addition(userGeneral.CurrExperience, gainNum, int.MaxValue);
                            UserHelper.TriggerGeneral(userGeneral, gainNum);
                        }
                    }
                    else if (pType == PlantType.GameGoin)
                    {
                        if (gainNum > 0)
                        {
                            ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, gainNum, int.MaxValue);
                        }

                    }
                }
                UserLogHelper.AppenLandLog(ContextUser.UserID, optype, generalID, landPositon, 0, plantQuality, gainNum, 0);
            }
            
            if (pType == PlantType.Experience && expeNum >= upexpNum)
            {
                var chatService = new TjxChatService();
                string content = string.Format(LanguageManager.GetLang().St10006_UserGeneralUpLv,
                                   userGeneral.GeneralName,
                                   userGeneral.GeneralLv);
                chatService.SystemSendWhisper(ContextUser, content);
            }
            
            return true;
        }
コード例 #27
0
ファイル: DialHelper.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 奖励物品
        /// </summary>
        /// <param name="prize"></param>
        /// <returns></returns>
        public static void ChestGainTreasureInfo(GameUser user, DialInfo dialInfo, int count)
        {
            var treasure = new TreasureInfo();
            treasure.UserID = user.UserID;
            treasure.Type = dialInfo.RewardType;
            treasure.ItemID = dialInfo.ItemID;
            treasure.Num = dialInfo.ItemNum;
            treasure.ItemLv = 1;
            UserDial userDial = new GameDataCacheSet<UserDial>().FindKey(user.UserID);
            if (userDial == null)
            {
                userDial = new UserDial();
            }
            userDial.GroupID = 0;
            userDial.RefreshDate = DateTime.Now;
            userDial.Treasure.Add(treasure);
            if (count == 0)
            {
                userDial.PrizeInfo = treasure;
                userDial.HeadID = dialInfo.HeadID;
            }
            if (GameConfigSet.Treasure > 0 && userDial.Treasure.Count > GameConfigSet.Treasure)
            {
                for (int i = 0; i < userDial.Treasure.Count - GameConfigSet.Treasure; i++)
                {
                    userDial.Treasure.Remove(userDial.Treasure[i]);
                }
            }

            if (dialInfo.IsShow)
            {
                var cacheSet = new ShareCacheStruct<ServerEnvSet>();
                var serverEnvSet = cacheSet.FindKey(ServerEnvKey.UserTreasure);
                if (serverEnvSet == null)
                {
                    serverEnvSet = new ServerEnvSet();
                    serverEnvSet.EnvKey = ServerEnvKey.UserTreasure;
                    cacheSet.Add(serverEnvSet, GameEnvironment.CacheGlobalPeriod);
                }
                var treasureInfoList = ServerEnvSetTreasure(treasure);
                serverEnvSet.EnvValue = JsonUtils.Serialize(treasureInfoList);
            }

            if (dialInfo.IsBroadcast && !string.IsNullOrEmpty(dialInfo.BroadContent))
            {
                TjxChatService chatService = new TjxChatService();
                chatService.SystemSend(ChatType.World, string.Format(dialInfo.BroadContent, user.NickName));

            }
            if (dialInfo.RewardType == RewardType.Again || dialInfo.RewardType == RewardType.Mood || dialInfo.RewardType == RewardType.Recharge)
            {
                if (dialInfo.RewardType == RewardType.Recharge)
                {
                    userDial.ReturnRatio = treasure.Num;
                }
                return;
            }
            ChestGetUserTake(treasure, user);
        }
コード例 #28
0
ファイル: Action1305.cs プロジェクト: jinfei426/Scut
        public override bool TakeAction()
        {
            UserHelper.GetUserLightOpen(ContextUser.UserID);
            short opType = 0;
            int huntingID2 = 0;
            if (huntingID < 1005)
            {
                huntingID2 = MathUtils.Addition(huntingID, 1, int.MaxValue);
            }
            else
            {
                huntingID2 = 1001; //huntingID;
            }
            UserHelper.ChechDailyRestrain(ContextUser.UserID);

            if (!CrystalHelper.CheckAllowCrystall(ContextUser))
            {
                ErrorCode = 1000;
                ErrorInfo = LanguageManager.GetLang().St1305_FateBackpackFull;
                return false;
            }
            else
            {
                if (!CrystalHelper.CheckAllowCrystall(ContextUser))
                {
                    ErrorCode = errorNum;
                    ErrorInfo = LanguageManager.GetLang().St1305_FateBackpackFull;
                    return false;
                }
            }

            ProbabilityInfo probabilityInfo = null;
            if (ops == 1)
            {
                #region
                opType = 1;
                UserDailyRestrain userRestrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(ContextUser.UserID);
                probabilityInfo = new ConfigCacheSet<ProbabilityInfo>().FindKey(huntingID); //当前猎命人物的概率
                if (probabilityInfo == null)
                {
                    return false;
                }
                ProbabilityInfo probability1 = new ConfigCacheSet<ProbabilityInfo>().FindKey(huntingID2);
                if (userRestrain != null && userRestrain.Funtion2 >= VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.MianFeiLieMing) && DateTime.Now.Date == userRestrain.RefreshDate.Date)
                {
                    if (probabilityInfo.Price > ContextUser.GameCoin)
                    {
                        ErrorCode = errorNum;
                        ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                        return false;
                    }
                }
                //暑期第三弹
                if (huntingID2 == 1001 && !NoviceHelper.IsGianCrystalPack(ContextUser))
                {
                    ErrorCode = errorNum;
                    ErrorInfo = LanguageManager.GetLang().St1305_BeiBaoBackpackFull;
                    return false;
                }
                var lightCacheSet = new GameDataCacheSet<UserLight>();
                if (huntingID != 1001)
                {
                    UserLight userLight1 = lightCacheSet.FindKey(ContextUser.UserID, huntingID);
                    if (userLight1.IsLight == 2)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        return false;
                    }

                    if (userLight1.IsLight == 1)
                    {
                        userLight1.IsLight = 2;
                        //userLight1.Update();
                    }
                }
                UserLight userLight = new GameDataCacheSet<UserLight>().FindKey(ContextUser.UserID, huntingID2);
                if (RandomUtils.IsHit(probability1.Light))
                {
                    ErrorCode = ErrorCode;
                    ErrorInfo = probability1.HuntingName;

                    if (userLight != null)
                    {
                        userLight.IsLight = 1;
                        //userLight.Update();
                    }
                    else
                    {
                        userLight = new UserLight()
                        {
                            UserID = ContextUser.UserID,
                            HuntingID = huntingID2,
                            IsLight = 1
                        };
                        lightCacheSet.Add(userLight);
                    }
                }

                if (userRestrain != null)
                {
                    if (userRestrain.Funtion2 >= VipHelper.GetVipUseNum(ContextUser.VipLv, RestrainType.MianFeiLieMing) && DateTime.Now.Date == userRestrain.RefreshDate.Date)
                    {
                        ContextUser.GameCoin = MathUtils.Subtraction(ContextUser.GameCoin, probabilityInfo.Price, 0);
                        //ContextUser.Update();
                    }
                    else
                    {
                        userRestrain.Funtion2 = MathUtils.Addition(userRestrain.Funtion2, 1, int.MaxValue);
                        //userRestrain.Update();
                    }
                }
                else
                {
                    ContextUser.GameCoin = MathUtils.Subtraction(ContextUser.GameCoin, probabilityInfo.Price, 0);
                    //ContextUser.Update();
                }

                lightArray = new GameDataCacheSet<UserLight>().FindAll(ContextUser.UserID);
                #endregion
            }
            else if (ops == 2)
            {
                #region
                opType = 2;
                if (ContextUser.VipLv < 5)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_VipNotEnough;
                    return false;
                }

                probabilityInfo = new ConfigCacheSet<ProbabilityInfo>().FindKey(huntingID); //当前猎命人物的概率
                if (probabilityInfo == null)
                {
                    return false;
                }

                if (ContextUser.GoldNum < probabilityInfo.Price)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }
                UserLight uLightInfo = new GameDataCacheSet<UserLight>().FindKey(ContextUser.UserID, probabilityInfo.GoldHunting);
                if (uLightInfo != null && uLightInfo.IsLight == 1)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1305_HuntingIDLight;
                    return false;
                }
                else if (uLightInfo != null && (uLightInfo.IsLight == 2 || uLightInfo.IsLight == 0))
                {
                    uLightInfo.IsLight = 1;
                }
                else
                {
                    uLightInfo = new UserLight()
                    {
                        UserID = ContextUser.UserID,
                        HuntingID = probabilityInfo.GoldHunting,
                        IsLight = 1
                    };
                    new GameDataCacheSet<UserLight>().Add(uLightInfo);
                }

                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, probabilityInfo.Price, int.MaxValue);
                lightArray = new GameDataCacheSet<UserLight>().FindAll(ContextUser.UserID);
                #endregion
            }

            //每种品质的概率
            double[] probabilityArray2 = { (double)probabilityInfo.Gray, (double)probabilityInfo.Green, (double)probabilityInfo.Blue, (double)probabilityInfo.Purple, (double)probabilityInfo.Yellow, (double)probabilityInfo.Red };
            int index2 = RandomUtils.GetHitIndex(probabilityArray2);
            CrystalQualityType qualityType = (CrystalQualityType)Enum.Parse(typeof(CrystalQualityType), (index2 + 1).ToString());
            List<CrystalInfo> crystalArray2 = new ConfigCacheSet<CrystalInfo>().FindAll(u => u.CrystalQuality == qualityType && u.DemandLv <= ContextUser.UserLv);
            if (crystalArray2.Count > 0)
            {
                int randomNum = RandomUtils.GetRandom(0, crystalArray2.Count);
                crystal = new ConfigCacheSet<CrystalInfo>().FindKey(crystalArray2[randomNum].CrystalID);
                if (crystal != null && crystal.CrystalQuality == CrystalQualityType.Gray)
                {
                    //wuzf修改 8-15 灰色放在临时背包不存DB
                    CrystalHelper.AppendGrayCrystal(ContextUser, crystal.CrystalID);
                }
                else if (crystal != null)
                {
                    var package = UserCrystalPackage.Get(Uid);

                    UserCrystalInfo userCrystal = new UserCrystalInfo()
                    {
                        UserCrystalID = Guid.NewGuid().ToString(),
                        CrystalID = crystal.CrystalID,
                        CrystalLv = 1,
                        CurrExprience = 0,
                        GeneralID = 0,
                        IsSale = 1,
                        CreateDate = DateTime.Now
                    };
                    package.SaveCrystal(userCrystal);
                    UserLogHelper.AppenCtystalLog(ContextUser.UserID, opType, crystal.CrystalID, probabilityInfo.Price, probabilityInfo.Price, null, 1, 0);
                    //高品质聊天通知);
                    if (crystal.CrystalQuality >= CrystalQualityType.Yellow)
                    {
                        var cacheChat = new TjxChatService();
                        string content = string.Format(LanguageManager.GetLang().St1305_HighQualityNotice,
                            ContextUser.NickName,
                           CrystalHelper.GetQualityName(crystal.CrystalQuality),
                            crystal.CrystalName
                            );
                        cacheChat.SystemSend(ChatType.World, content);
                    }
                }
            }

            //日常任务-猎命
            TaskHelper.TriggerDailyTask(Uid, 4009);
            return true;
        }
コード例 #29
0
        private void DoCombat(MorePlotTeam team)
        {
            //初始阵形
            var plotNpcTeam = new ShareCacheStruct<PlotNPCInfo>().FindAll(m => m.PlotID == team.MorePlot.PlotID);
            List<MonsterQueue> monsterQueueList = new List<MonsterQueue>(plotNpcTeam.Count);
            var userEmbattleList = new List<UserEmbattleQueue>(team.UserList.Count);
            foreach (var npcInfo in plotNpcTeam)
            {
                monsterQueueList.Add(new MonsterQueue(npcInfo.PlotNpcID));
            }
            foreach (var user in team.UserList)
            {
                var gameUser = new PersonalCacheStruct<GameUser>().FindKey(user.UserId);
                userEmbattleList.Add(new UserEmbattleQueue(user.UserId, gameUser.UseMagicID, 0, CombatType.MultiPlot));
            }
            bool isLoop = true;
            int maxCount = 0;
            while (isLoop)
            {
                if (maxCount > 500)
                {
                    break;
                }
                int overNum = 0;
                for (int i = 0; i < userEmbattleList.Count; i++)
                {
                    maxCount++;
                    int position;
                    var userEmbattle = userEmbattleList[i];
                    if (userEmbattle.IsOver)
                    {
                        overNum++;
                        continue;
                    }
                    var monster = GetMonster(monsterQueueList, i, out position);
                    if (monster == null || monster.IsOver)
                    {
                        team.CombatResult = true;
                        isLoop = false;
                        break;
                    }
                    ICombatController controller =  new TjxCombatController();
                    ISingleCombat plotCombater = controller.GetSingleCombat(CombatType.MultiPlot);
                    plotCombater.SetAttack(userEmbattle);
                    plotCombater.SetDefend(monster);
                    bool IsWin = plotCombater.Doing();


                    var processLost = new TeamCombatProcess
                    {
                        TeamID = team.TeamID,
                        PlotID = team.MorePlot.PlotID,
                        Position = position,
                        ProcessContainer = (CombatProcessContainer)plotCombater.GetProcessResult(),
                        UserId = team.UserList[i].UserId,
                        PlotNpcID = plotNpcTeam[position].PlotNpcID,
                        IsWin = IsWin
                    };
                    //new BaseLog().SaveDebuLog(string.Format("多人副本>>{4}组队{0}打{1}位置{2}结果{3}", processLost.UserId, processLost.PlotNpcID, position + 1, IsWin, team.TeamID));

                    AppendLog(team.TeamID, processLost);
                }
                if (overNum == userEmbattleList.Count)
                {
                    team.CombatResult = false;
                    isLoop = false;
                }
            }

            //奖励
            if (team.CombatResult)
            {
                //new BaseLog().SaveDebuLog(string.Format("多人副本>>组队{0}结果{1}", team.TeamID, team.CombatResult));
                SetCombatResult(team.TeamID, team.CombatResult);

                var chatService = new TjxChatService();
                foreach (var user in team.UserList)
                {
                    GameUser gameUser = new PersonalCacheStruct<GameUser>().FindKey(user.UserId);
                    gameUser.ExpNum = MathUtils.Addition(gameUser.ExpNum, team.MorePlot.ExpNum, int.MaxValue);
                    //gameUser.Update();
                    UserItemHelper.AddUserItem(user.UserId, team.MorePlot.ItemId, team.MorePlot.ItemNum);
                    new BaseLog("参加多人副本获得奖励:" + team.MorePlot.ItemName);
                    SetWinNum(user.UserId, team.MorePlot.PlotID);
                    CombatHelper.DailyMorePlotRestrainNum(gameUser.UserID, team.MorePlot.PlotID); // 多人副本获胜加一次
                    chatService.SystemSendWhisper(gameUser, string.Format(LanguageManager.GetLang().St4211_MorePlotReward,
                        team.MorePlot.ExpNum, team.MorePlot.ItemName, team.MorePlot.ItemNum));

                }
            }
        }
コード例 #30
0
ファイル: CrystalHelper.cs プロジェクト: jinfei426/Scut
        public static string HuntingLife(GameUser user, out string errStr)
        {
            #region
            errStr = string.Empty;
            int huntingID = UserLightLit(user.UserID);
            int huntingID2 = UserNextLight(user.UserID, huntingID);
            UserDailyRestrain userRestrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(user.UserID);
            var probabilityInfo = new ConfigCacheSet<ProbabilityInfo>().FindKey(huntingID); //当前猎命人物的概率
            if (probabilityInfo == null)
            {
                return errStr;
            }
            ProbabilityInfo probability1 = new ConfigCacheSet<ProbabilityInfo>().FindKey(huntingID2);
            if (userRestrain != null && userRestrain.Funtion2 >= VipHelper.GetVipUseNum(user.VipLv, RestrainType.MianFeiLieMing) && DateTime.Now.Date == userRestrain.RefreshDate.Date)
            {
                if (probabilityInfo.Price > user.GameCoin)
                {
                    errStr = LanguageManager.GetLang().St_GameCoinNotEnough;
                    return errStr;
                }
            }
            //暑期第三弹
            if (huntingID2 == 1001 && !NoviceHelper.IsGianCrystalPack(user))
            {
                errStr = LanguageManager.GetLang().St1305_BeiBaoBackpackFull;
                return errStr;
            }
            var lightCacheSet = new GameDataCacheSet<UserLight>();
            if (huntingID != 1001)
            {
                UserLight userLight1 = lightCacheSet.FindKey(user.UserID, huntingID);
                if (userLight1.IsLight == 2)
                {
                    return string.Empty;
                }
                if (userLight1.IsLight == 1)
                {
                    userLight1.IsLight = 2;
                }
            }
            UserLight userLight = new GameDataCacheSet<UserLight>().FindKey(user.UserID, huntingID2);
            if (RandomUtils.IsHit(probability1.Light))
            {
                if (userLight != null)
                {
                    userLight.IsLight = 1;
                    if (userLight.HuntingID == 1005)
                    {
                        errStr = LanguageManager.GetLang().St1305_HuntingIDLight;
                    }
                }
                else
                {
                    userLight = new UserLight()
                    {
                        UserID = user.UserID,
                        HuntingID = huntingID2,
                        IsLight = 1
                    };
                    lightCacheSet.Add(userLight);
                }
            }

            if (userRestrain != null)
            {
                if (userRestrain.Funtion2 >= VipHelper.GetVipUseNum(user.VipLv, RestrainType.MianFeiLieMing) && DateTime.Now.Date == userRestrain.RefreshDate.Date)
                {
                    user.GameCoin = MathUtils.Subtraction(user.GameCoin, probabilityInfo.Price, 0);
                }
                else
                {
                    userRestrain.Funtion2 = MathUtils.Addition(userRestrain.Funtion2, 1, int.MaxValue);
                }
            }
            else
            {
                user.GameCoin = MathUtils.Subtraction(user.GameCoin, probabilityInfo.Price, 0);
            }

            //每种品质的概率
            double[] probabilityArray2 = { (double)probabilityInfo.Gray, (double)probabilityInfo.Green, (double)probabilityInfo.Blue, (double)probabilityInfo.Purple, (double)probabilityInfo.Yellow, (double)probabilityInfo.Red };
            int index2 = RandomUtils.GetHitIndex(probabilityArray2);
            CrystalQualityType qualityType = (CrystalQualityType)Enum.Parse(typeof(CrystalQualityType), (index2 + 1).ToString());
            List<CrystalInfo> crystalArray2 = new ConfigCacheSet<CrystalInfo>().FindAll(u => u.CrystalQuality == qualityType && u.DemandLv <= user.UserLv);
            if (crystalArray2.Count > 0)
            {
                int randomNum = RandomUtils.GetRandom(0, crystalArray2.Count);
                var crystal = new ConfigCacheSet<CrystalInfo>().FindKey(crystalArray2[randomNum].CrystalID);
                if (crystal != null && crystal.CrystalQuality == CrystalQualityType.Gray)
                {
                    //wuzf修改 8-15 灰色放在临时背包不存DB
                    CrystalHelper.AppendGrayCrystal(user, crystal.CrystalID);
                }
                else if (crystal != null)
                {
                    var package = UserCrystalPackage.Get(user.UserID);

                    UserCrystalInfo userCrystal = new UserCrystalInfo()
                    {
                        UserCrystalID = Guid.NewGuid().ToString(),
                        CrystalID = crystal.CrystalID,
                        CrystalLv = 1,
                        CurrExprience = 0,
                        GeneralID = 0,
                        IsSale = 1,
                        CreateDate = DateTime.Now
                    };
                    package.SaveCrystal(userCrystal);
                    UserLogHelper.AppenCtystalLog(user.UserID, 5, crystal.CrystalID, probabilityInfo.Price, 0, null, 1, 0);
                    //高品质聊天通知);
                    if (crystal.CrystalQuality >= CrystalQualityType.Yellow)
                    {
                        var cacheChat = new TjxChatService();
                        string content = string.Format(LanguageManager.GetLang().St1305_HighQualityNotice,
                            user.NickName,
                           CrystalHelper.GetQualityName(crystal.CrystalQuality),
                            crystal.CrystalName
                            );
                        cacheChat.SystemSend(ChatType.World, content);
                    }
                }
            }
            return errStr;
            #endregion
        }