public static void Init()
 {
     foreach (var item in sConnectServerSet.FindAll(false))
     {
         sConnectServerSet.Delete(item);
     }
     foreach (var item in sRoomServerSet.FindAll(false))
     {
         sRoomServerSet.Delete(item);
     }
 }
Пример #2
0
        public override void BuildPacket()
        {
            var cacheSetItem = new ShareCacheStruct <ItemBaseInfo>();

            PushIntoStack(_cityInfoList.Count);
            foreach (var city in _cityInfoList)
            {
                List <PlotInfo> plotList = _cacheSetPlot.FindAll(s => s.CityID == city.CityID && s.PlotType == plotType);

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(plotList.Count);
                foreach (PlotInfo item in plotList)
                {
                    UserPlotInfo userPlot   = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, item.PlotID);
                    int          isKill     = PlotHelper.IsKill(ContextUser.UserID, item.PlotID, cityID) ? 1 : 0;
                    DataStruct   dsItemPlot = new DataStruct();
                    dsItemPlot.PushIntoStack(item.PlotID);
                    dsItemPlot.PushIntoStack(item.PlotSeqNo.ToShort());
                    dsItemPlot.PushIntoStack(item.PlotName.ToNotNullString());
                    dsItemPlot.PushIntoStack(item.BossHeadID.ToNotNullString());
                    dsItemPlot.PushIntoStack(GetPlotStatus(userPlot, plotType));
                    dsItemPlot.PushIntoStack(userPlot == null ? 1 : (int)userPlot.StarScore);
                    dsItemPlot.PushIntoStack(isKill);
                    dsItemPlot.PushIntoStack(item.HonourNum);
                    dsItemPlot.PushIntoStack(item.GameCoin);
                    dsItemPlot.PushIntoStack(item.PlotDesc);
                    dsItemPlot.PushIntoStack(item.PlotLv);
                    dsItemPlot.PushIntoStack(ConfigEnvSet.GetInt("Plot.BattleEnergyNum"));
                    dsItemPlot.PushIntoStack(PlotHelper.GetPlotChallengeNum(UserId.ToString(), item.PlotID));
                    dsItemPlot.PushIntoStack(item.ChallengeNum);
                    dsItemPlot.PushIntoStack(userPlot == null ? 0 : userPlot.PlotNum);
                    dsItem.PushIntoStack(dsItemPlot);
                    var itemArray = item.ItemRank.Split(',');
                    dsItemPlot.PushIntoStack(itemArray.Length);
                    foreach (var s in itemArray)
                    {
                        var        sArray     = s.Split('=');
                        var        itemInfo   = cacheSetItem.FindKey(sArray.Length > 0 ? sArray[0].ToInt() : 0);
                        DataStruct dsItemInfo = new DataStruct();
                        dsItemInfo.PushIntoStack(itemInfo != null ? itemInfo.ItemName : string.Empty);
                        dsItemInfo.PushIntoStack(sArray.Length > 1 ? sArray[1].ToInt() : 0);
                        dsItemPlot.PushIntoStack(dsItemInfo);
                    }
                }

                dsItem.PushIntoStack(city.CityID);
                dsItem.PushIntoStack(city.CityName.ToNotNullString());

                PushIntoStack(dsItem);
            }
            PushIntoStack(resetNum);
            PushIntoStack(_backpackType);
        }
Пример #3
0
        public int ConvertLevel()
        {
            var societySet = new ShareCacheStruct <Config_Society>();
            var socitylist = societySet.FindAll(t => t.Liveness <= Liveness);

            return(socitylist[socitylist.Count - 1].ID);
        }
Пример #4
0
        public override void BuildPacket()
        {
            var cacheSetItemEqu = new ShareCacheStruct <ItemEquAttrInfo>();

            PushIntoStack(_userItemArray.Count);
            foreach (UserItemInfo item in _userItemArray)
            {
                ItemBaseInfo itemInfo    = new ShareCacheStruct <ItemBaseInfo>().FindKey(item.ItemID);
                var          general     = new PersonalCacheStruct <UserGeneral>().FindKey(Uid, item.GeneralID);
                var          itemEquList = cacheSetItemEqu.FindAll(e => e.ItemID.Equals(item.ItemID));
                DataStruct   dsItem      = new DataStruct();
                dsItem.PushIntoStack(item.UserItemID.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack(item.ItemLv);
                dsItem.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : (short)itemInfo.QualityType);
                dsItem.PushIntoStack(general != null ? general.GeneralName : string.Empty);
                PushIntoStack(dsItem);
                dsItem.PushIntoStack(itemEquList.Count);
                foreach (var itemEquAttrInfo in itemEquList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(itemEquAttrInfo.AttributeID.ToInt());
                    int strengNum = 0;
                    strengNum = MathUtils.Addition(itemEquAttrInfo.BaseNum, (itemEquAttrInfo.IncreaseNum * item.ItemLv), int.MaxValue);
                    //    dsItem1.PushIntoStack(itemEqu.BaseNum);
                    dsItem1.PushIntoStack(strengNum);
                    dsItem.PushIntoStack(dsItem1);
                }
            }
        }
Пример #5
0
 protected override void OnStartAffer()
 {
     try
     {
         var setting = new EnvironmentSetting();
         setting.EntityAssembly = Assembly.Load("GameRanking.Model");
         ScriptEngines.AddReferencedAssembly("GameRanking.Model.dll");
         ActionFactory.SetActionIgnoreAuthorize(1000, 1001);
         var cacheSetting = new CacheSetting();
         cacheSetting.ChangedHandle += OnChangedNotify;
         GameEnvironment.Start(setting, cacheSetting);
         var       cache = new ShareCacheStruct <UserRanking>();
         Stopwatch t     = new Stopwatch();
         t.Start();
         var list = cache.FindAll(false);
         t.Stop();
         if (list.Count > 0)
         {
         }
         Console.WriteLine("The server is staring...");
     }
     catch (Exception ex)
     {
         TraceLog.WriteError("App star error:{0}", ex);
     }
 }
Пример #6
0
        public void ResetCache(int profession)
        {
            SkillList.Clear();
            CarryList.Clear();

            var skillConfig = new ShareCacheStruct <Config_Skill>();
            var list        = skillConfig.FindAll(t => (
                                                      t.SkillGroup == profession /* && (t.SkillID % 10000 == 0 || t.SkillID % 10000 == 1)*/)
                                                  );

            foreach (var v in list)
            {
                AddSkill(v.SkillID);
            }

            if (list.Count > 3)
            {
                Random random = new Random();
                while (CarryList.Count < 3)
                {
                    int index      = random.Next(list.Count);
                    int addSkillId = list[index].SkillID;
                    if (addSkillId == 10000 || addSkillId == 20000)
                    {
                        continue;
                    }
                    if (CarryList.Find(t => t == addSkillId) == 0)
                    {
                        CarryList.Add(addSkillId);
                    }
                }
            }
        }
Пример #7
0
        public override void BuildPacket()
        {
            var cacheSetItemEqu = new ShareCacheStruct<ItemEquAttrInfo>();
            PushIntoStack(_userItemArray.Count);
            foreach (UserItemInfo item in _userItemArray)
            {
                ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(item.ItemID);
                var general = new PersonalCacheStruct<UserGeneral>().FindKey(Uid, item.GeneralID);
                var itemEquList = cacheSetItemEqu.FindAll(e => e.ItemID.Equals(item.ItemID));
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(item.UserItemID.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack(item.ItemLv);
                dsItem.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : (short)itemInfo.QualityType);
                dsItem.PushIntoStack(general != null ? general.GeneralName : string.Empty);
                PushIntoStack(dsItem);
                dsItem.PushIntoStack(itemEquList.Count);
                foreach (var itemEquAttrInfo in itemEquList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(itemEquAttrInfo.AttributeID.ToInt());
                    int strengNum = 0;
                    strengNum = MathUtils.Addition(itemEquAttrInfo.BaseNum, (itemEquAttrInfo.IncreaseNum * item.ItemLv), int.MaxValue);
                    //    dsItem1.PushIntoStack(itemEqu.BaseNum);
                    dsItem1.PushIntoStack(strengNum);
                    dsItem.PushIntoStack(dsItem1);
                }
               


            }
        }
Пример #8
0
 public override bool TakeAction() {
     var cache = new ShareCacheStruct<UserRanking>();
     rankingList = cache.FindAll(false);
     rankingList = MathUtils.QuickSort<UserRanking>(rankingList, compareTo);
     rankingList = rankingList.GetPaging(pageIndex, pageSize, out pageCount);
     return true;
 }
Пример #9
0
        public override bool TakeAction()
        {
            GuildMember member = new ShareCacheStruct <GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID);

            if (member != null)
            {
                if (member.PostType == PostType.Member)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St6007_AuditPermissions;
                    return(false);
                }
                else
                {
                    var cacheSet = new ShareCacheStruct <UserApply>();
                    List <UserApply> userApplyArray = cacheSet.FindAll(m => m.GuildID == member.GuildID);
                    foreach (UserApply apply in userApplyArray)
                    {
                        List <GuildMember> gMemberArray = new ShareCacheStruct <GuildMember>().FindAll(m => m.UserID == apply.UserID);
                        if (gMemberArray.Count > 0)
                        {
                            cacheSet.Delete(apply);
                        }
                    }
                    applyArray = userApplyArray.GetPaging(pageIndex, pageSize, out pageCount);
                }
            }
            return(true);
        }
Пример #10
0
 public override bool TakeAction()
 {
     var cache = new ShareCacheStruct<UserScore>();
     _dsItemList_1 = cache.FindAll(false);
     _dsItemList_1 = MathUtils.QuickSort<UserScore>(_dsItemList_1, compareTo);
     _dsItemList_1 = _dsItemList_1.GetPaging(_pindex, _psize, out _pcount);
     return true;
 }
Пример #11
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public UserRanking[] GetUserRankingList()
 {
     var cache = new ShareCacheStruct<UserRanking>();
     var rankingList = cache.FindAll(false);
     //rankingList = MathUtils.QuickSort<UserRanking>(rankingList, compareTo);
     //rankingList = rankingList.GetPaging(PageIndex, PageSize, out PageCount);
     return rankingList.ToArray();
 }
Пример #12
0
        public override bool TakeAction()
        {
            var cache = new ShareCacheStruct <UserRanking>(UUID);

            rankingList = cache.FindAll(false);
            rankingList = MathUtils.QuickSort <UserRanking>(rankingList, compareTo);
            rankingList = rankingList.GetPaging(PageIndex, PageSize, out PageCount);
            return(true);
        }
Пример #13
0
        public override bool TakeAction()
        {
            int totalDate = (ConfigEnvSet.GetInt("UserQueue.GuildMemberDel") * 60 * 60);
            var memberSet = new ShareCacheStruct <GuildMember>();
            List <GuildMember> memberArray = memberSet.FindAll(m => m.GuildID == guildID);
            GuildMember        userMember  = memberSet.FindKey(guildID, ContextUser.UserID);

            if (userMember != null && userMember.PostType == PostType.Chairman && memberArray.Count > 1)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6010_Chairman;
                return(false);
            }
            if (userMember != null)
            {
                if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
                {
                    memberSet.Delete(userMember);
                    ContextUser.MercenariesID = string.Empty;
                    //ContextUser.Update();
                    CombatHelper.RemoveGuildAbility(ContextUser);
                }
                var       guildSet  = new ShareCacheStruct <UserGuild>();
                UserGuild guildInfo = guildSet.FindKey(guildID);
                if (guildInfo != null && userMember.PostType == PostType.Chairman && memberArray.Count <= 1)
                {
                    guildSet.Delete(guildInfo);
                }

                List <UserQueue> queueArray = new PersonalCacheStruct <UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.TuiChuGongHui);
                if (queueArray.Count > 0)
                {
                    UserQueue queue = queueArray[0];
                    queue.Timing        = DateTime.Now;
                    queue.TotalColdTime = totalDate;
                    queue.ColdTime      = totalDate;
                    //queue.Update();
                }
                else
                {
                    UserQueue userQueue = new UserQueue()
                    {
                        QueueID =
                            Guid.NewGuid().ToString(),
                        QueueName     = QueueType.TuiChuGongHui.ToString(),
                        QueueType     = QueueType.TuiChuGongHui,
                        TotalColdTime = totalDate,
                        ColdTime      = totalDate,
                        Timing        = DateTime.Now,
                        IsSuspend     = false,
                        UserID        = ContextUser.UserID
                    };
                    new PersonalCacheStruct <UserQueue>().Add(userQueue);
                }
            }
            return(true);
        }
Пример #14
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public UserRanking[] GetUserRankingList()
        {
            var cache       = new ShareCacheStruct <UserRanking>();
            var rankingList = cache.FindAll(false);

            //rankingList = MathUtils.QuickSort<UserRanking>(rankingList, compareTo);
            //rankingList = rankingList.GetPaging(PageIndex, PageSize, out PageCount);
            return(rankingList.ToArray());
        }
Пример #15
0
        public override bool TakeAction()
        {
            int totalDate = (ConfigEnvSet.GetInt("UserQueue.GuildMemberDel") * 60 * 60);
            var memberSet = new ShareCacheStruct<GuildMember>();
            List<GuildMember> memberArray = memberSet.FindAll(m => m.GuildID == guildID);
            GuildMember userMember = memberSet.FindKey(guildID, ContextUser.UserID);
            if (userMember != null && userMember.PostType == PostType.Chairman && memberArray.Count > 1)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6010_Chairman;
                return false;
            }
            if (userMember != null)
            {
                if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
                {
                    memberSet.Delete(userMember);
                    ContextUser.MercenariesID = string.Empty;
                    //ContextUser.Update();
                    CombatHelper.RemoveGuildAbility(ContextUser);
                }
                var guildSet = new ShareCacheStruct<UserGuild>();
                UserGuild guildInfo = guildSet.FindKey(guildID);
                if (guildInfo != null && userMember.PostType == PostType.Chairman && memberArray.Count <= 1)
                {
                    guildSet.Delete(guildInfo);
                }

                List<UserQueue> queueArray = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.TuiChuGongHui);
                if (queueArray.Count > 0)
                {
                    UserQueue queue = queueArray[0];
                    queue.Timing = DateTime.Now;
                    queue.TotalColdTime = totalDate;
                    queue.ColdTime = totalDate;
                    //queue.Update();
                }
                else
                {
                    UserQueue userQueue = new UserQueue()
                    {
                        QueueID =
                            Guid.NewGuid().ToString(),
                        QueueName = QueueType.TuiChuGongHui.ToString(),
                        QueueType = QueueType.TuiChuGongHui,
                        TotalColdTime = totalDate,
                        ColdTime = totalDate,
                        Timing = DateTime.Now,
                        IsSuspend = false,
                        UserID = ContextUser.UserID
                    };
                    new PersonalCacheStruct<UserQueue>().Add(userQueue);
                }
            }
            return true;
        }
Пример #16
0
        /// <summary>
        /// 业务逻辑处理
        /// </summary>
        /// <returns>false:中断后面的方式执行并返回Error</returns>
        public override bool TakeAction()
        {
            var serverCache = new ShareCacheStruct<StaticServer>();

            staticServerList = serverCache.FindAll(false);

            //StaticServer serverData;

                return true;
        }
Пример #17
0
 public override bool TakeAction()
 {
     var cache = new ShareCacheStruct<UserRanking>();
     rankingList = cache.FindAll(false);
     int count = rankingList.Count;
     rankingList = MathUtils.QuickSort<UserRanking>(rankingList, compareTo);
     rankingList = rankingList.GetPaging(PageIndex, PageSize, out PageCount);
     int rcount = rankingList.Count;
     Console.WriteLine("count:{0}/{1}", rcount, count);
     return true;
 }
Пример #18
0
        /// <summary>
        /// 业务逻辑处理
        /// </summary>
        /// <returns>false:中断后面的方式执行并返回Error</returns>
        public override bool TakeAction()
        {
            var serverCache = new ShareCacheStruct <StaticServer>();

            staticServerList = serverCache.FindAll(false);

            //StaticServer serverData;



            return(true);
        }
Пример #19
0
        public void FindCache()
        {
            var cache  = new ShareCacheStruct <ChildData>();
            var result = cache.FindAll();

            Trace.WriteLine("child data count:" + result.Count);
            Assert.IsTrue(cache.LoadingStatus == LoadingStatus.Success, "ChildData load fail.");

            var friendCache = new PersonalCacheStruct <UserFriend>();

            friendCache.LoadFrom(t => true);
            Assert.IsTrue(!friendCache.IsEmpty, "UserFriend is null.");
        }
Пример #20
0
 public override bool TakeAction()
 {
     var cacheSet = new ShareCacheStruct<UserApply>();
     List<UserApply> applyArray = cacheSet.FindAll(m => m.GuildID==guildID);
     if (applyArray.Count > 0)
     {
         foreach (UserApply apply in applyArray)
         {
             cacheSet.Delete(apply);
         }
     }
     return true;
 }
Пример #21
0
        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct <UserApply>();
            List <UserApply> applyArray = cacheSet.FindAll(m => m.GuildID == guildID);

            if (applyArray.Count > 0)
            {
                foreach (UserApply apply in applyArray)
                {
                    cacheSet.Delete(apply);
                }
            }
            return(true);
        }
Пример #22
0
        public override bool TakeAction()
        {
            var cache = new ShareCacheStruct <UserRanking>();

            rankingList = cache.FindAll(false);
            int count = rankingList.Count;

            rankingList = MathUtils.QuickSort <UserRanking>(rankingList, compareTo);
            rankingList = rankingList.GetPaging(PageIndex, PageSize, out PageCount);
            int rcount = rankingList.Count;

            Console.WriteLine("count:{0}/{1}", rcount, count);
            return(true);
        }
Пример #23
0
        /// <summary>
        /// 获取我的战绩列表
        /// </summary>
        /// <returns></returns>
        public static List <CombatGainInfoSD> GetCombatGainList(int _userid)
        {
            List <CombatGainInfoSD> _CombatGainList = new List <CombatGainInfoSD>();
            //取指定userid最近一天的一次房间结算OVER的记录
            var          cacheSettable = new ShareCacheStruct <tb_TableMoneyLog>();
            var          cacheRank     = new GameDataCacheSet <tb_Rank>();
            DbDataFilter filter1       = new DbDataFilter();

            cacheRank.TryRecoverFromDb(filter1);
            tb_Rank rank = cacheRank.FindKey(_userid.ToString());

            if (rank == null || !rank.records.Any())
            {
                return(_CombatGainList);
            }
            List <Record> records = rank.records.OrderByDescending(w => w.CreateDate).Take(10).ToList();

            foreach (var record in records)
            {
                CombatGainInfoSD _tempGain = new CombatGainInfoSD();
                _tempGain.tablenum     = record.MatchCode;
                _tempGain._starttime   = record.CreateDate.ToString("yyyy-MM-dd HH:mm:ss");
                _tempGain._tableRecord = new List <CombatTableRecordSD>();
                //找到同桌的人
                var          cacheSettable2 = new ShareCacheStruct <tb_TableMoneyLog>();
                DbDataFilter filter         = new DbDataFilter();
                filter.Condition = "MatchCode=@MatchCode";
                filter.Parameters.Add("MatchCode", record.MatchCode);
                cacheSettable2.TryRecoverFromDb(filter);
                List <tb_TableMoneyLog> tablemoneylog2list = cacheSettable2.FindAll((r) => { return(r.MatchCode == record.MatchCode && r._isover); });

                if (tablemoneylog2list.Any())
                {
                    foreach (var moneylog2 in tablemoneylog2list)
                    {
                        CombatTableRecordSD _combatTable = new CombatTableRecordSD();
                        _combatTable.userid     = moneylog2.UserID;
                        _combatTable._username  = tb_UserEx.GetUserNameByUserID(moneylog2.UserID);
                        _combatTable._winorlost = (int)moneylog2.AddorReduceMoney;
                        _tempGain._tableRecord.Add(_combatTable);
                    }
                }
                _CombatGainList.Add(_tempGain);
                //_lastCount++;
                //if (_lastCount >= 10) break;//暂时只取10条
            }

            return(_CombatGainList);
        }
        public void AppandSoulAttribute(UserSoulCache soul)
        {
            var soulSet = new ShareCacheStruct <Config_Soulstrong>();
            var list    = soulSet.FindAll(t => (t.Soulid < soul.SoulID));

            foreach (var v in soul.OpenList)
            {
                list.Add(soulSet.FindKey(v));
            }

            foreach (var v in list)
            {
                switch (v.Attdef)
                {
                case SoulAddType.Atk:
                    Atk += v.AddValue;
                    break;

                case SoulAddType.Def:
                    Def += v.AddValue;
                    break;

                case SoulAddType.Hp:
                    Hp += v.AddValue;
                    break;

                case SoulAddType.Crit:
                    Crit += v.AddValue;
                    break;

                case SoulAddType.Hit:
                    Hit += v.AddValue;
                    break;

                case SoulAddType.Dodge:
                    Dodge += v.AddValue;
                    break;

                case SoulAddType.Tenacity:
                    Tenacity += v.AddValue;
                    break;

                case SoulAddType.Skill:
                    // GetSoul.Atk += soulcfg.AddValue;
                    break;
                }
            }
        }
Пример #25
0
        /// <summary>
        /// 圣吉塔战役
        /// </summary>
        /// <param name="plotNpcID"></param>
        /// <param name="difficultNum"></param>
        public MonsterQueue(int plotNpcID, double difficultNum)
        {
            var sjtEmbattleList = new ShareCacheStruct<SJTPlotEmbattleInfo>().FindAll();
            sjtEmbattleList = sjtEmbattleList.FindAll(m => m.PlotNpcID == plotNpcID);
            foreach (SJTPlotEmbattleInfo embattle in sjtEmbattleList)
            {
                int index = embattle.GridSeqNo - 1;

                IGeneral general = Create(embattle, difficultNum);
                if (general != null)
                {
                    SetQueue(index, general);
                }
            }
            this.PriorityNum = 0;
        }
Пример #26
0
        /// <summary>
        /// 圣吉塔战役
        /// </summary>
        /// <param name="plotNpcID"></param>
        /// <param name="difficultNum"></param>
        public MonsterQueue(int plotNpcID, double difficultNum)
        {
            var sjtEmbattleList = new ShareCacheStruct <SJTPlotEmbattleInfo>().FindAll();

            sjtEmbattleList = sjtEmbattleList.FindAll(m => m.PlotNpcID == plotNpcID);
            foreach (SJTPlotEmbattleInfo embattle in sjtEmbattleList)
            {
                int index = embattle.GridSeqNo - 1;

                IGeneral general = Create(embattle, difficultNum);
                if (general != null)
                {
                    SetQueue(index, general);
                }
            }
            this.PriorityNum = 0;
        }
Пример #27
0
        public override bool TakeAction()
        {
            int pageCount;
            var cache = new ShareCacheStruct<UserRanking>();
            var rankingList = cache.FindAll(false);
            rankingList = MathUtils.QuickSort<UserRanking>(rankingList, compareTo);
            rankingList = rankingList.GetPaging(requestPack.PageIndex, requestPack.PageSize, out pageCount);

            responsePack = new Response1001Pack();
            responsePack.PageCount = pageCount;
            responsePack.Items = new List<RankData>();
            foreach (var item in rankingList)
            {
                responsePack.Items.Add(new RankData() { UserName = item.UserName, Score = item.Score });
            }
            return true;
        }
Пример #28
0
        /// <summary>
        /// 每天统计一次排行榜内容
        /// </summary>
        public static void SetRankListEveryDay()
        {
            var cacheSettable = new ShareCacheStruct <tb_tablerecord>();
            List <tb_TableMoneyLog> _tmListall = new List <tb_TableMoneyLog>();//有最优的SQL语句或存储过程来执行的    还需要按UserID分组 按AddorReduceMoney从大到小排序
            //取一天前的数据
            List <tb_tablerecord> _tabList = cacheSettable.FindAll((t_user) => { return(t_user.gameid == 4 && t_user._isover == true && t_user.EndTime > System.DateTime.Now.AddDays(-1)); });

            foreach (tb_tablerecord t_tab in _tabList)
            {
                var cacheSet = new ShareCacheStruct <tb_TableMoneyLog>();
                _tmListall.AddRange(cacheSet.FindAll((t_user) => { return(t_user._guid == t_tab._guid && t_user._isover == true); }));
            }
            //最前5名
            if (_tmListall.Count < 5)
            {
                return;
            }
        }
Пример #29
0
        /// <summary>
        /// 初始化大厅
        /// </summary>
        public void Initi()
        {
            Gameid = 41;
            var roomInfo = new ShareCacheStruct <tb_GameInfo>();
            var temp     = roomInfo.FindAll(false);//DOTO 取了一个房间配置 后面在根据情况在来处理

            //====================begin============================================
            BullColorRoom._instance.Awake();
            var roomList = new ShareCacheStruct <tb_gamelevelinfo>().FindAll((g) => { return(g.gameid == Gameid); });

            foreach (var _roomInfo in roomList)
            {
                var roomData = new BullColorRoom(_roomInfo);
                BullColorRoom.roomCache.TryAdd(roomData.RoomId + "", roomData);
                roomData.CreateTableByRobot();
            }
            //===================end
            _dicUserStatus = new ConcurrentDictionary <int, UserStatus>();
        }
Пример #30
0
        /// <summary>
        /// 增加仇敌
        /// </summary>
        /// <param name="user"></param>
        /// <param name="toUser"></param>
        private static void AddFoe(GameUser user, GameUser toUser)
        {
            var cacheSet      = new ShareCacheStruct <UserFriends>();
            var friends       = cacheSet.Find(s => s.FriendID == user.UserID && s.UserID == toUser.UserID && s.FriendType == FriendType.Friend);
            var choudiFriends = cacheSet.Find(s => s.FriendID == user.UserID && s.UserID == toUser.UserID && s.FriendType == FriendType.ChouDi);

            if (friends == null && choudiFriends == null)
            {
                var list = cacheSet.FindAll(s => s.UserID == toUser.UserID && s.FriendType == FriendType.ChouDi);
                if (list.Count >= 50)
                {
                    list.QuickSort((x, y) =>
                    {
                        if (x == null && y == null)
                        {
                            return(0);
                        }
                        if (x != null && y == null)
                        {
                            return(1);
                        }
                        if (x == null)
                        {
                            return(-1);
                        }
                        return((x.FightTime).CompareTo(y.FightTime));
                    });
                    int count = list.Count - 49 + 1;
                    for (int i = 0; i < count; i++)
                    {
                        cacheSet.Delete(list[i]);
                    }
                }
                var userFriends = new UserFriends();
                userFriends.UserID     = toUser.UserID;
                userFriends.FriendID   = user.UserID;
                userFriends.FightTime  = DateTime.Now;
                userFriends.FriendType = FriendType.ChouDi;
                userFriends.ChatTime   = DateTime.Now;
                cacheSet.Add(userFriends);
            }
        }
Пример #31
0
        /// <summary>
        /// 默认玩家注册获得背包格子数
        /// </summary>
        /// <param name="userId"></param>
        public static void AddUserPack(string userId)
        {
            var userPack = _cacheSetUserPack.FindKey(userId);

            var backpackList = _cacheSetBackpack.FindAll();

            backpackList.ForEach(backpack =>
            {
                if (userPack == null)
                {
                    userPack              = new UserPack(userId.ToInt());
                    userPack.CreateDate   = DateTime.Now;
                    var packType          = new PackType();
                    packType.BackpackType = backpack.BackpackType;
                    packType.OpenNum      = 0;
                    packType.Position     = backpack.DefaultNum;
                    userPack.PackTypeList.Add(packType);
                    _cacheSetUserPack.Add(userPack, userId.ToInt());
                }
                else
                {
                    var packType = userPack.PackTypeList != null
                                                                ? userPack.PackTypeList.Find(
                        s => s.BackpackType == backpack.BackpackType)
                                                                : null;
                    if (packType == null)
                    {
                        packType = new PackType();
                        packType.BackpackType = backpack.BackpackType;
                        packType.OpenNum      = 0;
                        packType.Position     = backpack.DefaultNum;
                        userPack.PackTypeList.Add(packType);
                    }
                    else
                    {
                        packType.BackpackType = backpack.BackpackType;
                        packType.OpenNum      = 0;
                        packType.Position     = backpack.DefaultNum;
                    }
                }
            });
        }
Пример #32
0
        public override bool TakeAction()
        {
            int pageCount;
            var cache       = new ShareCacheStruct <UserRanking>();
            var rankingList = cache.FindAll(false);

            rankingList = MathUtils.QuickSort <UserRanking>(rankingList, compareTo);
            rankingList = rankingList.GetPaging(requestPack.PageIndex, requestPack.PageSize, out pageCount);

            responsePack           = new Response1001Pack();
            responsePack.PageCount = pageCount;
            responsePack.Items     = new List <RankData>();
            foreach (var item in rankingList)
            {
                responsePack.Items.Add(new RankData()
                {
                    UserName = item.UserName, Score = item.Score
                });
            }
            return(true);
        }
Пример #33
0
        void doCheck_compensation()
        {
            var      persionCache = new PersonalCacheStruct <GameUser>();
            GameUser gu           = persionCache.FindKey(requestPack.UserID.ToString());

            if (null == gu)
            {
                responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.compensation_not_findUser;
                return;
            }

            var compensationCache          = new ShareCacheStruct <CompensationInfo>();
            List <CompensationInfo> Lstcsi = compensationCache.FindAll((o) => {
                return(gu.CompensationDate < o.CreateDate);
            }, true);

            if (Lstcsi.Count <= 0)
            {
                responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.no_data01;
                return;
            }
            CompensationInfo csi = Lstcsi[Lstcsi.Count - 1];

            if (null == csi)
            {
                responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.no_data02;
                return;
            }

            // has got the new Compensation
            gu.ModifyLocked(() => {
                gu.CompensationDate = csi.CreateDate;
            });

            responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.ok;
            string info = csi.type + "," + csi.CreateDate.ToString() + "," + csi.message + "," + csi.ItemInfo;

            responsePack.extInfo = info;
        }
Пример #34
0
        /// <summary>
        /// 佣兵升级
        /// </summary>
        /// <param name="userGeneral"></param>
        public static void GeneralUp(UserGeneral userGeneral)
        {
            var   cacheSetGeneralEscalate = new ShareCacheStruct <GeneralEscalateInfo>();
            var   GeneralEscalateList     = cacheSetGeneralEscalate.FindAll(s => s.GeneralType == GeneralType.YongBing && s.UpExperience <= userGeneral.CurrExperience);
            short generalLv = userGeneral.GeneralLv;
            GeneralEscalateInfo generalEscalateInfo = new GeneralEscalateInfo();

            GeneralEscalateList.ForEach(item =>
            {
                if (item.GeneralLv > generalLv)
                {
                    generalLv           = item.GeneralLv;
                    generalEscalateInfo = item;
                }
            });
            if (generalLv > userGeneral.GeneralLv)
            {
                userGeneral.GeneralLv = generalLv;

                userGeneral.CurrExperience = MathUtils.Subtraction(userGeneral.CurrExperience, generalEscalateInfo.UpExperience);
            }
        }
Пример #35
0
        void doDelete()
        {
            var    urCatch  = new ShareCacheStruct <UserRanking>();
            string paramStr = requestPack.param;

            string[] arrStr = paramStr.Split(',');
            if (arrStr[0] == "byName")
            {
                //  var deleteLst = urCatch.FindAll(o => o.UserName.Contains(arrStr[1]));
                //  foreach (UserRanking ur in deleteLst)
                //  {
                //      urCatch.Delete(ur);
                //  }
            }
            else if (arrStr[0] == "byScore")
            {
                var deleteLst = urCatch.FindAll(o => o.Score > int.Parse(arrStr[1]));
                System.Console.WriteLine("deleteLst Count:{0}", deleteLst.Count);
                foreach (UserRanking ur in deleteLst)
                {
                    urCatch.Delete(ur);
                }
            }
        }
Пример #36
0
        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct<UserFriends>();
            _isSuccess = 1;
            if (_friendId != "")
            {
                //找到本玩家的数据
                List<UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                //添加的好友上限
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return false;
                }
                //查看是否在user库中有该玩家
                GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(_friendId);
                if (userInfo == null)
                {
                    UserCacheGlobal.LoadOffline(_friendId);
                    userInfo = new GameDataCacheSet<GameUser>().FindKey(_friendId);
                }
                if (userInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_NotFriendsUserID;
                    return false;
                }

                //在好友表中查找本玩家 和添加好友的关系
                var userFriend = cacheSet.FindKey(ContextUser.UserID, _friendId);
                var userFriend1 = cacheSet.FindKey(_friendId, ContextUser.UserID);

                if (userFriend == null)
                {
                    //创建新的数据 并且添加成关注类型
                    var friends = new UserFriends
                                      {
                                          UserID = ContextUser.UserID,
                                          FriendID = _friendId,
                                          FriendType = FriendType.Attention
                                      };
                    cacheSet.Add(friends, GameEnvironment.CacheGlobalPeriod);
                    //todo test
                    friends.ChatTime = DateTime.Now;

                }
                //如果玩家数据不为空
                else
                {
                    //判断两个玩家的关系
                    if (userFriend.FriendType == FriendType.Friend)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                        return false;
                    }

                    ////如果已经发送请求就不在继续发
                    //if (userFriend.FriendType == FriendType.Attention)
                    //{
                    //    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    //    ErrorInfo = LanguageManager.GetLang().St_FirendNoticeTip;
                    //    return false;
                    //}

                    //加好友都是变为关注 从仇敌那里也能转换为关注
                    if (userFriend.FriendType != FriendType.Friend)
                    {
                        userFriend.FriendType = FriendType.Attention;
                    }

                }

                //判断对方是否有和本玩家的数据 如果没有创建 有改状态
                if (userFriend1 == null)
                {
                    var friends2 = new UserFriends
                    {
                        UserID = _friendId,
                        FriendID = ContextUser.UserID,
                        FriendType = FriendType.Fans,
                    };
                    cacheSet.Add(friends2, GameEnvironment.CacheGlobalPeriod);
                    //todo test
                    friends2.ChatTime = DateTime.Now;
                }

                // 发送系统信件
                try
                {
                    Guid newGuid = Guid.NewGuid();
                    UserMail userMail = new UserMail(newGuid);
                    userMail.UserId = Int32.Parse(_friendId);
                    userMail.MailType = (int)MailType.Friends;
                    userMail.Title = LanguageManager.GetLang().St_AskFirendMailTitle;
                    userMail.Content = string.Format(LanguageManager.GetLang().St_AskFirendTip, ContextUser.NickName);
                    userMail.SendDate = DateTime.Now;
                    userMail.IsReply = true;
                    userMail.ReplyStatus = 0;
                    userMail.FromUserId = Int32.Parse(ContextUser.UserID);
                    userMail.FromUserName = ContextUser.NickName;
                    TjxMailService mailService = new TjxMailService(ContextUser);
                    mailService.Send(userMail);
                }
                catch (Exception)
                {

                }
            }
            //上传的好友名字不为空
            else if (_friendName != null)
            {
                List<UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return false;
                }
                GameUser friend = null;
                new GameDataCacheSet<GameUser>().Foreach((personalId, key, user) =>
                {
                    if (user.NickName == _friendName)
                    {
                        friend = user;
                        return false;
                    }
                    return true;
                });
                if (friend != null)
                {
                    GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(friend.UserID);
                    UserFriends userFriend = cacheSet.FindKey(ContextUser.UserID, _friendId);
                    if (userFriend != null)
                    {
                        if (userFriend.FriendType == FriendType.Fans)
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasTheFansIn;
                            return false;
                        }
                        else if (userFriend.FriendType == FriendType.Blacklist)
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasTheBlacklist;
                            return false;
                        }
                        else
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                            return false;
                        }
                    }
                    UserFriends friends = new UserFriends()
                    {
                        UserID = ContextUser.UserID,
                        FriendID = gameUser.UserID,
                        FriendType = FriendType.Attention
                    };
                    cacheSet.Add(friends, GameEnvironment.CacheGlobalPeriod);

                    UserFriends friends2 = new UserFriends()
                    {
                        UserID = gameUser.UserID,
                        FriendID = ContextUser.UserID,
                        FriendType = FriendType.Fans,
                    };
                    cacheSet.Add(friends2, GameEnvironment.CacheGlobalPeriod);
                }
                else
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St9103_DoesNotExistTheUser;
                    return false;
                }
            }
            return true;
        }
Пример #37
0
        public override bool TakeAction()
        {
            if (magicType == 0)
            {
                userMagicArray = new PersonalCacheStruct<UserMagic>().FindAll(ContextUser.UserID).GetPaging(pageIndex, pageSize, out pageCount);
            }
            else
            {
                userMagicArray = new PersonalCacheStruct<UserMagic>().FindAll(ContextUser.UserID, m => m.MagicType == magicType).GetPaging(pageIndex, pageSize, out pageCount);
                //List<UserMagic> tempList = new List<UserMagic>(userMagicArray);
                //userMagicArray = tempList.FindAll(m => m.MagicID != new GameUser().UserMagicID);
            }
            userMagicArray.ForEach(obj =>
            {
                obj.IsOpen = true;
            });
            if (magicType == MagicType.MoFaZhen)
            {
                var cacheSetMagic = new ShareCacheStruct<MagicInfo>();
                var magicList = cacheSetMagic.FindAll(s => s.MagicType == MagicType.MoFaZhen && s.DemandLv > ContextUser.UserLv);

                magicList.ForEach(mgic =>
                {
                    if (userMagicArray.Find(s => s.MagicID == mgic.MagicID) == null)
                    {
                        UserMagic userMagic = new UserMagic();
                        userMagic.IsOpen = mgic.DemandLv <= ContextUser.UserLv ? true : false;
                        userMagic.MagicID = mgic.MagicID;
                        userMagic.UserID = string.Empty;
                        userMagic.MagicLv = 0;
                        userMagic.MagicType = MagicType.MoFaZhen;
                        userMagic.IsLv = mgic.DemandLv;
                        userMagicArray.Add(userMagic);
                    }
                });
            }
            pageCount = MathUtils.Subtraction(pageCount, 1, 0);

            //List<UserQueue> userQueueArray = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.MagicStrong);
            //if (userQueueArray.Count > 0 && userQueueArray[0].StrengNum >= 2)
            //{
            //    queueID = userQueueArray[0].QueueID;
            //    coldTime = userQueueArray[0].DoRefresh();
            //}
            userMagicArray.QuickSort((x, y) =>
            {
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                return x.MagicID.CompareTo(y.MagicID);
            });
            ////记录操作日志
            //UserOperationLog userOperationLog = new UserOperationLog();
            //userOperationLog.UserID = ContextUser.UserID;
            //userOperationLog.ActionID = ActionIDDefine.Cst_Action1501;
            //userOperationLog.FunctionID = "魔术列表";
            //userOperationLog.CreateDate = DateTime.Now;
            //userOperationLog.Num = 1;
            //userOperationLog.Append();
            return true;
        }
Пример #38
0
        public override bool TakeAction()
        {
            GuildMember member = new ShareCacheStruct<GuildMember>().FindKey(guildID, ContextUser.UserID);
            if (member != null && member.PostType == PostType.Member)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6007_AuditPermissions;
                return false;
            }

            List<GuildMember> memberArray = new ShareCacheStruct<GuildMember>().FindAll(m => m.GuildID == guildID);
            UserGuild guildInfo = new ShareCacheStruct<UserGuild>().FindKey(guildID);
            if (guildInfo != null)
            {
                GuildLvInfo guildLvInfo = new ShareCacheStruct<GuildLvInfo>().FindKey(guildInfo.GuildLv);
                if (guildLvInfo != null)
                {
                    int maxPeople = MathUtils.Addition(guildInfo.AddMember, guildLvInfo.MaxPeople);
                    if (memberArray.Count > 0 && memberArray.Count >= maxPeople)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St6019_GuildMaxPeople;
                        return false;
                    }
                }
            }
            GameUser userInfo = UserCacheGlobal.CheckLoadUser(memberID);
            if (userInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;

            }
            var memberList = new ShareCacheStruct<GuildMember>().FindAll(s => s.UserID == memberID);
            if (memberList.Count > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6019_AddGuild;
                return false;
            }

            GuildMember gMember = new GuildMember()
            {
                GuildID = guildID,
                UserID = memberID,
                PostType = PostType.Member,
                Contribution = 0,
                TotalContribution = 0,
                IncenseNum = 0,
                DevilNum = 0,
                IsDevil = 0,
                InsertDate = DateTime.Now
            };
            new ShareCacheStruct<GuildMember>().Add(gMember);
            userInfo.MercenariesID = guildID;
            CombatHelper.LoadGuildAbility(userInfo.UserID); //加载公会技能

            var cacheSet = new ShareCacheStruct<UserApply>();
            List<UserApply> appliesArray = cacheSet.FindAll(m => m.UserID == memberID);
            foreach (UserApply apply in appliesArray)
            {
                cacheSet.Delete(apply);
            }

            return true;
        }
Пример #39
0
        public override bool TakeAction()
        {
            receipt = new LotteryData();

            var itemSet = new ShareCacheStruct <Config_Item>();

            int times = isFiveTimes ? 5 : 1;

            if (GetLottery.LotteryTimes <= times)
            {
                int needDiamond = ConfigEnvSet.GetInt("User.BuyLotteryTimesNeedDiamond") * (times - GetLottery.LotteryTimes);
                if (GetBasis.DiamondNum < needDiamond)
                {
                    receipt.Result = RequestLotteryResult.NoDiamond;
                    return(true);
                }
                UserHelper.ConsumeDiamond(Current.UserId, needDiamond);
                //receipt.Result = RequestLotteryResult.NoTimes;
                //return true;
            }

            BigInteger      awardGold    = 0;
            int             awardDiamond = 0;
            List <ItemData> awardItem    = new List <ItemData>();

            int lotteryId = 0;
            LotteryAwardType awardType = LotteryAwardType.Gold;

            GetLottery.StealTimes = 0;
            GetLottery.RobTimes   = 0;
            for (int i = 0; i < times; ++i)
            {
                if (GetLottery.TotalCount == 0)
                {
                    lotteryId = 7;
                    awardType = LotteryAwardType.Steal;
                }
                else if (GetLottery.TotalCount == 1)
                {
                    lotteryId = 8;
                    awardType = LotteryAwardType.Rob;
                }
                else
                {
                    var randlottery = UserHelper.RandomLottery(GetBasis.UserLv);
                    if (randlottery != null)
                    {
                        lotteryId = randlottery.ID;
                        awardType = randlottery.Type;
                    }
                }

                Config_Lottery lott = new ShareCacheStruct <Config_Lottery>().FindKey(lotteryId);
                if (lott == null)
                {
                    return(false);
                }

                LottItem item = new LottItem();
                item.ID   = lotteryId;
                item.Type = awardType;
                switch (lott.Type)
                {
                case LotteryAwardType.Gold:
                {
                    BigInteger resourceNum = BigInteger.Parse(lott.Content);
                    BigInteger value       = Math.Ceiling(GetBasis.UserLv / 50.0).ToInt() * resourceNum;
                    awardGold += value;

                    item.ItemID = 0;
                    item.Num    = value.ToString();
                }
                break;

                case LotteryAwardType.Diamond:
                {
                    awardDiamond += lott.Content.ToInt();
                    item.ItemID   = 0;
                    item.Num      = lott.Content;
                }
                break;

                case LotteryAwardType.Gem:
                {
                    int maxCount = lott.Content.ToInt();
                    if (maxCount > 0)
                    {
                        var lotteryGem = UserHelper.RandomLotteryGem();

                        item.ItemID = lotteryGem.ID;
                        item.Num    = maxCount.ToString();

                        awardItem.Add(new ItemData()
                            {
                                ID = lotteryGem.ID, Num = maxCount
                            });
                    }
                }
                break;

                case LotteryAwardType.Debris:
                {
                    var debris = itemSet.FindAll(t => (t.ItemType == ItemType.Debris));
                    foreach (var v in GetElf.ElfList)
                    {
                        var elfCard = itemSet.Find(t => t.ResourceNum.ToInt() == v.ID);
                        if (elfCard == null)
                        {
                            continue;
                        }

                        debris.RemoveAll(t => (t.ResourceNum.ToInt() == elfCard.ItemID));
                    }
                    if (debris.Count == 0)
                    {
                        debris = itemSet.FindAll(t => (t.ItemType == ItemType.Debris));
                    }

                    int maxCount = lott.Content.ToInt();
                    if (maxCount > 0)
                    {
                        int index   = random.Next(debris.Count);
                        int awardId = debris[index].ItemID;

                        item.ItemID = awardId;
                        item.Num    = maxCount.ToString();

                        awardItem.Add(new ItemData()
                            {
                                ID = awardId, Num = maxCount
                            });
                    }
                }
                break;

                case LotteryAwardType.Elf:
                {
                    item.ItemID = lott.Content.ToInt();
                    item.Num    = "1";

                    awardItem.Add(new ItemData()
                        {
                            ID = lott.Content.ToInt(), Num = 1
                        });

                    var itemcfg = new ShareCacheStruct <Config_Item>().FindKey(item.ItemID);
                    if (itemcfg != null)
                    {
                        string context = string.Format("恭喜 {0} 在幸运大夺宝中获得精灵 {1}",
                                                       GetBasis.NickName, itemcfg.ItemName);
                        GlobalRemoteService.SendNotice(NoticeMode.World, context);
                    }
                }
                break;

                case LotteryAwardType.Steal:
                {
                    GetLottery.StealTimes++;
                    UserHelper.RandomStealTarget(Current.UserId);
                }
                break;

                case LotteryAwardType.Rob:
                {
                    GetLottery.RobTimes++;
                    UserHelper.RandomRobTarget(Current.UserId);
                }
                break;

                case LotteryAwardType.Vit:
                {
                    GetBasis.Vit += lott.Content.ToInt();
                    PushMessageHelper.UserVitChangedNotification(Current);
                }
                break;
                }
                receipt.AwardList.Add(item);

                GetLottery.TotalCount++;
            }

            UserHelper.RewardsGold(Current.UserId, awardGold, UpdateCoinOperate.NormalReward, true);
            UserHelper.RewardsDiamond(Current.UserId, awardDiamond);
            UserHelper.RewardsItems(Current.UserId, awardItem);

            if (GetLottery.LotteryTimes == ConfigEnvSet.GetInt("User.LotteryTimesMax"))
            {
                GetLottery.StartRestoreLotteryTimesDate = DateTime.Now;
            }
            if (GetLottery.LotteryTimes > 0)
            {
                GetLottery.LotteryTimes = MathUtils.Subtraction(GetLottery.LotteryTimes, times, 0);
            }

            UserHelper.EveryDayTaskProcess(Current.UserId, TaskType.Lottery, times);

            receipt.Result = RequestLotteryResult.OK;

            return(true);
        }
Пример #40
0
 /// <summary>
 /// ��ȡ�¼�����
 /// </summary>
 /// <param name="parentTaskID"></param>
 /// <returns></returns>
 public static IList<StoryTaskInfo> GetNextTask(int parentTaskID)
 {
     var cacheSet = new ShareCacheStruct<StoryTaskInfo>();
     return cacheSet.FindAll(m => m.PreTaskID.Any(taskId => taskId == parentTaskID));
 }
Пример #41
0
 /// <summary>
 /// 增加仇敌
 /// </summary>
 /// <param name="user"></param>
 /// <param name="toUser"></param>
 private static void AddFoe(GameUser user, GameUser toUser)
 {
     var cacheSet = new ShareCacheStruct<UserFriends>();
     var friends = cacheSet.Find(s => s.FriendID == user.UserID && s.UserID == toUser.UserID && s.FriendType == FriendType.Friend);
     var choudiFriends = cacheSet.Find(s => s.FriendID == user.UserID && s.UserID == toUser.UserID && s.FriendType == FriendType.ChouDi);
     if (friends == null && choudiFriends == null)
     {
         var list = cacheSet.FindAll(s => s.UserID == toUser.UserID && s.FriendType == FriendType.ChouDi);
         if (list.Count >= 50)
         {
             list.QuickSort((x, y) =>
             {
                 if (x == null && y == null) return 0;
                 if (x != null && y == null) return 1;
                 if (x == null) return -1;
                 return (x.FightTime).CompareTo(y.FightTime);
             });
             int count = list.Count - 49 + 1;
             for (int i = 0; i < count; i++)
             {
                 cacheSet.Delete(list[i]);
             }
         }
         var userFriends = new UserFriends();
         userFriends.UserID = toUser.UserID;
         userFriends.FriendID = user.UserID;
         userFriends.FightTime = DateTime.Now;
         userFriends.FriendType = FriendType.ChouDi;
         userFriends.ChatTime = DateTime.Now;
         cacheSet.Add(userFriends, GameEnvironment.CacheGlobalPeriod);
     }
 }
Пример #42
0
        protected override void OnStartAffer()
        {
            try
            {
                var setting = new EnvironmentSetting();
                setting.EntityAssembly = Assembly.Load("GameRanking.Model");
                setting.ScriptStartBeforeHandle += () =>
                {
                    ScriptEngines.AddReferencedAssembly("GameRanking.Model.dll");
                    ActionFactory.SetActionIgnoreAuthorize(1000, 1001);

                    var cache = new ShareCacheStruct<UserRanking>();
                    Stopwatch t = new Stopwatch();
                    t.Start();
                    var list = cache.FindAll(false);
                    t.Stop();
                    if(list.Count > 0)
                    {

                    }
                };

                var cacheSetting = new CacheSetting();
                cacheSetting.ChangedHandle += OnChangedNotify;
                GameEnvironment.Start(setting, cacheSetting);
                Console.WriteLine("The server is staring...");
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("App star error:{0}", ex);
            }
        }
Пример #43
0
        void doCheck_compensation()
        {
            var persionCache = new PersonalCacheStruct<GameUser>();
            GameUser gu = persionCache.FindKey(requestPack.UserID.ToString());
            if(null == gu)
            {
                responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.compensation_not_findUser;
                return;
            }

            var compensationCache = new ShareCacheStruct<CompensationInfo>();
            List<CompensationInfo> Lstcsi = compensationCache.FindAll((o) => {
                return (gu.CompensationDate < o.CreateDate);
            },true);

            if(Lstcsi.Count <= 0)
            {
                responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.no_data01;
                return;
            }
            CompensationInfo csi = Lstcsi[Lstcsi.Count-1];
            if(null==csi)
            {
                responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.no_data02;
                return;
            }

            // has got the new Compensation
            gu.ModifyLocked(() => {
                gu.CompensationDate = csi.CreateDate;
            });

            responsePack.errorCode = (byte)Response1004Pack.EnumErrorCode.ok;
            string info = csi.type+","+csi.CreateDate.ToString()+","+csi.message+","+csi.ItemInfo;
            responsePack.extInfo   = info;
        }
Пример #44
0
        /// <summary>
        /// 屏蔽敏感词
        /// </summary>
        /// <param name="keyWord"></param>
        /// <returns></returns>
        public static bool GetKeyWordSubstitution(string keyWord)
        {
            keyWord = keyWord.Trim();
            bool IsWord = false;
            ShareCacheStruct<ChatKeyWord> cacheSet = new ShareCacheStruct<ChatKeyWord>();
            List<ChatKeyWord> chatKeyWordArray = cacheSet.FindAll();
            foreach (ChatKeyWord chatKeyWord in chatKeyWordArray)
            {
                if (keyWord.IndexOf(chatKeyWord.KeyWord) >= 0)
                {
                    IsWord = true;
                    break;
                }

            }
            return IsWord;
        }
Пример #45
0
        public override bool TakeAction()
        {
            GuildMember member = new ShareCacheStruct <GuildMember>().FindKey(guildID, ContextUser.UserID);

            if (member != null && member.PostType == PostType.Member)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6007_AuditPermissions;
                return(false);
            }

            List <GuildMember> memberArray = new ShareCacheStruct <GuildMember>().FindAll(m => m.GuildID == guildID);
            UserGuild          guildInfo   = new ShareCacheStruct <UserGuild>().FindKey(guildID);

            if (guildInfo != null)
            {
                GuildLvInfo guildLvInfo = new ShareCacheStruct <GuildLvInfo>().FindKey(guildInfo.GuildLv);
                if (guildLvInfo != null)
                {
                    int maxPeople = MathUtils.Addition(guildInfo.AddMember, guildLvInfo.MaxPeople);
                    if (memberArray.Count > 0 && memberArray.Count >= maxPeople)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St6019_GuildMaxPeople;
                        return(false);
                    }
                }
            }
            GameUser userInfo = UserCacheGlobal.CheckLoadUser(memberID);

            if (userInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            var memberList = new ShareCacheStruct <GuildMember>().FindAll(s => s.UserID == memberID);

            if (memberList.Count > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6019_AddGuild;
                return(false);
            }

            GuildMember gMember = new GuildMember()
            {
                GuildID           = guildID,
                UserID            = memberID,
                PostType          = PostType.Member,
                Contribution      = 0,
                TotalContribution = 0,
                IncenseNum        = 0,
                DevilNum          = 0,
                IsDevil           = 0,
                InsertDate        = DateTime.Now
            };

            new ShareCacheStruct <GuildMember>().Add(gMember);
            userInfo.MercenariesID = guildID;
            CombatHelper.LoadGuildAbility(userInfo.UserID); //加载公会技能

            var cacheSet = new ShareCacheStruct <UserApply>();
            List <UserApply> appliesArray = cacheSet.FindAll(m => m.UserID == memberID);

            foreach (UserApply apply in appliesArray)
            {
                cacheSet.Delete(apply);
            }

            return(true);
        }
Пример #46
0
        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct<UserFriends>();
            if (_friendId != "" && _friendId != ContextUser.UserID)
            {
                //找到本玩家的数据
                List<UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                //添加的好友上限
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return false;
                }

                //查看是否在user库中有该玩家
                GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(_friendId);
                if (userInfo == null)
                {
                    UserCacheGlobal.LoadOffline(_friendId);
                    userInfo = new GameDataCacheSet<GameUser>().FindKey(_friendId);
                }
                if (userInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_NotFriendsUserID;
                    return false;
                }

                //在好友表中查找本玩家 和添加好友的关系
                var userFriend = cacheSet.FindKey(ContextUser.UserID, _friendId);
                var userFriend1 = cacheSet.FindKey(_friendId, ContextUser.UserID);
                //同意
                if (_ops == 1)
                {
                   //有信息表 没信息表
                   if (userFriend == null)
                   {
                       //创建新的数据 并且添加成关注类型
                       var friends = new UserFriends
                       {
                           UserID = ContextUser.UserID,
                           FriendID = _friendId,
                           FriendType = FriendType.Friend
                       };
                       cacheSet.Add(friends);
                       //todo test
                       friends.ChatTime = DateTime.Now;

                   }else
                   {
                       //玩家原来就有数据
                       //判断两个玩家的关系
                       if (userFriend.FriendType == FriendType.Friend)
                       {
                           ErrorCode = LanguageManager.GetLang().ErrorCode;
                           ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                           return false;
                       }
                       userFriend.FriendType = FriendType.Friend;
                   }

                   //判断对方是否有和本玩家的数据 如果没有创建 有改状态
                   if (userFriend1 == null)
                   {
                       var friends2 = new UserFriends
                       {
                           UserID = _friendId,
                           FriendID = ContextUser.UserID,
                           FriendType = FriendType.Friend,
                       };
                       cacheSet.Add(friends2);
                       //todo test
                       friends2.ChatTime = DateTime.Now;
                   }
                   else
                   {
                         userFriend1.FriendType = FriendType.Friend;
                    }

                    //加为好友成功后发送一条邮件
                   try
                   {
                       Guid newGuid = Guid.NewGuid();
                       UserMail userMail = new UserMail(newGuid);
                       userMail.UserId = Int32.Parse(_friendId);
                       userMail.MailType = (int)MailType.Friends;
                       userMail.Title = LanguageManager.GetLang().St_AskFirendMailTitle;
                       userMail.Content = string.Format(LanguageManager.GetLang().St_FirendNotice, ContextUser.NickName);
                       userMail.SendDate = DateTime.Now;
                       userMail.FromUserId = Int32.Parse(ContextUser.UserID);
                       userMail.FromUserName = ContextUser.NickName;
                       TjxMailService mailService = new TjxMailService(ContextUser);
                       mailService.Send(userMail);

                       var noticeMail = mailService.ReadMail(ContextUser.UserID, _mailId);
                       noticeMail.ReplyStatus = 1;

                   }
                   catch (Exception)
                   {

                   }

                }else
                {

                    //不同意
                    TjxMailService mailService = new TjxMailService(ContextUser);
                    var noticeMail = mailService.ReadMail(ContextUser.UserID, _mailId);
                    noticeMail.ReplyStatus = 1;

                }
            }
            return true;
        }
Пример #47
0
        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct <UserFriends>();

            _isSuccess = 1;
            if (_friendId != "")
            {
                //找到本玩家的数据
                List <UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                //添加的好友上限
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return(false);
                }
                //查看是否在user库中有该玩家
                GameUser userInfo = new GameDataCacheSet <GameUser>().FindKey(_friendId);
                if (userInfo == null)
                {
                    UserCacheGlobal.LoadOffline(_friendId);
                    userInfo = new GameDataCacheSet <GameUser>().FindKey(_friendId);
                }
                if (userInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_NotFriendsUserID;
                    return(false);
                }

                //在好友表中查找本玩家 和添加好友的关系
                var userFriend  = cacheSet.FindKey(ContextUser.UserID, _friendId);
                var userFriend1 = cacheSet.FindKey(_friendId, ContextUser.UserID);

                if (userFriend == null)
                {
                    //创建新的数据 并且添加成关注类型
                    var friends = new UserFriends
                    {
                        UserID     = ContextUser.UserID,
                        FriendID   = _friendId,
                        FriendType = FriendType.Attention
                    };
                    cacheSet.Add(friends);
                    //todo test
                    friends.ChatTime = DateTime.Now;
                }
                //如果玩家数据不为空
                else
                {
                    //判断两个玩家的关系
                    if (userFriend.FriendType == FriendType.Friend)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                        return(false);
                    }

                    ////如果已经发送请求就不在继续发
                    //if (userFriend.FriendType == FriendType.Attention)
                    //{
                    //    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    //    ErrorInfo = LanguageManager.GetLang().St_FirendNoticeTip;
                    //    return false;
                    //}

                    //加好友都是变为关注 从仇敌那里也能转换为关注
                    if (userFriend.FriendType != FriendType.Friend)
                    {
                        userFriend.FriendType = FriendType.Attention;
                    }
                }

                //判断对方是否有和本玩家的数据 如果没有创建 有改状态
                if (userFriend1 == null)
                {
                    var friends2 = new UserFriends
                    {
                        UserID     = _friendId,
                        FriendID   = ContextUser.UserID,
                        FriendType = FriendType.Fans,
                    };
                    cacheSet.Add(friends2);
                    //todo test
                    friends2.ChatTime = DateTime.Now;
                }

                // 发送系统信件
                try
                {
                    Guid     newGuid  = Guid.NewGuid();
                    UserMail userMail = new UserMail(newGuid);
                    userMail.UserId       = Int32.Parse(_friendId);
                    userMail.MailType     = (int)MailType.Friends;
                    userMail.Title        = LanguageManager.GetLang().St_AskFirendMailTitle;
                    userMail.Content      = string.Format(LanguageManager.GetLang().St_AskFirendTip, ContextUser.NickName);
                    userMail.SendDate     = DateTime.Now;
                    userMail.IsReply      = true;
                    userMail.ReplyStatus  = 0;
                    userMail.FromUserId   = Int32.Parse(ContextUser.UserID);
                    userMail.FromUserName = ContextUser.NickName;
                    TjxMailService mailService = new TjxMailService(ContextUser);
                    mailService.Send(userMail);
                }
                catch (Exception)
                {
                }
            }
            //上传的好友名字不为空
            else if (_friendName != null)
            {
                List <UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return(false);
                }
                GameUser friend = null;
                new GameDataCacheSet <GameUser>().Foreach((personalId, key, user) =>
                {
                    if (user.NickName == _friendName)
                    {
                        friend = user;
                        return(false);
                    }
                    return(true);
                });
                if (friend != null)
                {
                    GameUser    gameUser   = new GameDataCacheSet <GameUser>().FindKey(friend.UserID);
                    UserFriends userFriend = cacheSet.FindKey(ContextUser.UserID, _friendId);
                    if (userFriend != null)
                    {
                        if (userFriend.FriendType == FriendType.Fans)
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasTheFansIn;
                            return(false);
                        }
                        else if (userFriend.FriendType == FriendType.Blacklist)
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasTheBlacklist;
                            return(false);
                        }
                        else
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                            return(false);
                        }
                    }
                    UserFriends friends = new UserFriends()
                    {
                        UserID     = ContextUser.UserID,
                        FriendID   = gameUser.UserID,
                        FriendType = FriendType.Attention
                    };
                    cacheSet.Add(friends);

                    UserFriends friends2 = new UserFriends()
                    {
                        UserID     = gameUser.UserID,
                        FriendID   = ContextUser.UserID,
                        FriendType = FriendType.Fans,
                    };
                    cacheSet.Add(friends2);
                }
                else
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St9103_DoesNotExistTheUser;
                    return(false);
                }
            }
            return(true);
        }
Пример #48
0
        /// <summary>
        /// 佣兵升级
        /// </summary>
        /// <param name="userGeneral"></param>
        public static void GeneralUp(UserGeneral userGeneral)
        {

            var cacheSetGeneralEscalate = new ShareCacheStruct<GeneralEscalateInfo>();
            var GeneralEscalateList = cacheSetGeneralEscalate.FindAll(s => s.GeneralType == GeneralType.YongBing && s.UpExperience <= userGeneral.CurrExperience);
            short generalLv = userGeneral.GeneralLv;
            GeneralEscalateInfo generalEscalateInfo = new GeneralEscalateInfo();
            GeneralEscalateList.ForEach(item =>
            {
                if (item.GeneralLv > generalLv)
                {
                    generalLv = item.GeneralLv;
                    generalEscalateInfo = item;
                }
            });
            if (generalLv > userGeneral.GeneralLv)
            {
                userGeneral.GeneralLv = generalLv;

                userGeneral.CurrExperience = MathUtils.Subtraction(userGeneral.CurrExperience, generalEscalateInfo.UpExperience);

            }
        }
Пример #49
0
        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct <UserFriends>();

            if (_friendId != "" && _friendId != ContextUser.UserID)
            {
                //找到本玩家的数据
                List <UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                //添加的好友上限
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return(false);
                }

                //查看是否在user库中有该玩家
                GameUser userInfo = new GameDataCacheSet <GameUser>().FindKey(_friendId);
                if (userInfo == null)
                {
                    UserCacheGlobal.LoadOffline(_friendId);
                    userInfo = new GameDataCacheSet <GameUser>().FindKey(_friendId);
                }
                if (userInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_NotFriendsUserID;
                    return(false);
                }

                //在好友表中查找本玩家 和添加好友的关系
                var userFriend  = cacheSet.FindKey(ContextUser.UserID, _friendId);
                var userFriend1 = cacheSet.FindKey(_friendId, ContextUser.UserID);
                //同意
                if (_ops == 1)
                {
                    //有信息表 没信息表
                    if (userFriend == null)
                    {
                        //创建新的数据 并且添加成关注类型
                        var friends = new UserFriends
                        {
                            UserID     = ContextUser.UserID,
                            FriendID   = _friendId,
                            FriendType = FriendType.Friend
                        };
                        cacheSet.Add(friends, GameEnvironment.CacheGlobalPeriod);
                        //todo test
                        friends.ChatTime = DateTime.Now;
                    }
                    else
                    {
                        //玩家原来就有数据
                        //判断两个玩家的关系
                        if (userFriend.FriendType == FriendType.Friend)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                            return(false);
                        }
                        userFriend.FriendType = FriendType.Friend;
                    }

                    //判断对方是否有和本玩家的数据 如果没有创建 有改状态
                    if (userFriend1 == null)
                    {
                        var friends2 = new UserFriends
                        {
                            UserID     = _friendId,
                            FriendID   = ContextUser.UserID,
                            FriendType = FriendType.Friend,
                        };
                        cacheSet.Add(friends2, GameEnvironment.CacheGlobalPeriod);
                        //todo test
                        friends2.ChatTime = DateTime.Now;
                    }
                    else
                    {
                        userFriend1.FriendType = FriendType.Friend;
                    }

                    //加为好友成功后发送一条邮件
                    try
                    {
                        Guid     newGuid  = Guid.NewGuid();
                        UserMail userMail = new UserMail(newGuid);
                        userMail.UserId       = Int32.Parse(_friendId);
                        userMail.MailType     = MailType.Friends;
                        userMail.Title        = LanguageManager.GetLang().St_AskFirendMailTitle;
                        userMail.Content      = string.Format(LanguageManager.GetLang().St_FirendNotice, ContextUser.NickName);
                        userMail.SendDate     = DateTime.Now;
                        userMail.FromUserId   = Int32.Parse(ContextUser.UserID);
                        userMail.FromUserName = ContextUser.NickName;
                        TjxMailService mailService = new TjxMailService(ContextUser);
                        mailService.Send(userMail);

                        var noticeMail = mailService.ReadMail(ContextUser.UserID, _mailId);
                        noticeMail.ReplyStatus = 1;
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    //不同意
                    TjxMailService mailService = new TjxMailService(ContextUser);
                    var            noticeMail  = mailService.ReadMail(ContextUser.UserID, _mailId);
                    noticeMail.ReplyStatus = 1;
                }
            }
            return(true);
        }
Пример #50
0
 public override bool TakeAction()
 {
     GameRanking.Server.Script.Lib.TestHelper.Test();
     var cache = new ShareCacheStruct<UserRanking>();
     rankingList = cache.FindAll();
     rankingList = MathUtils.QuickSort<UserRanking>(rankingList, compareTo);
     rankingList = rankingList.GetPaging(PageIndex, PageSize, out PageCount);
     return true;
 }
Пример #51
0
        static public List <UserCenterUser> FindUserCenterUser(string openid, string retailId, int serverId)
        {
            var cache = new ShareCacheStruct <UserCenterUser>();

            return(cache.FindAll(t => (t.OpenID == openid && t.RetailID == retailId && t.ServerID == serverId)));
        }
Пример #52
0
 public override bool TakeAction()
 {
     GuildMember member = new ShareCacheStruct<GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID);
     if (member != null)
     {
         if (member.PostType == PostType.Member)
         {
             ErrorCode = LanguageManager.GetLang().ErrorCode;
             ErrorInfo = LanguageManager.GetLang().St6007_AuditPermissions;
             return false;
         }
         else
         {
             var cacheSet = new ShareCacheStruct<UserApply>();
             List<UserApply> userApplyArray = cacheSet.FindAll(m => m.GuildID == member.GuildID);
             foreach (UserApply apply in userApplyArray)
             {
                 List<GuildMember> gMemberArray = new ShareCacheStruct<GuildMember>().FindAll(m => m.UserID == apply.UserID);
                 if (gMemberArray.Count > 0)
                 {
                     cacheSet.Delete(apply);
                 }
             }
             applyArray = userApplyArray.GetPaging(pageIndex, pageSize, out pageCount);
         }
     }
     return true;
 }