예제 #1
0
        public override bool TakeAction()
        {
            var guildData = new ShareCacheStruct <GuildsCache>().FindKey(GetGuild.GuildID);

            if (guildData == null)
            {
                return(false);
            }


            if (Current.UserId == _DestUid ||
                (guildData.FindAtevent().UserID != Current.UserId && guildData.FindVice(Current.UserId) == null))
            {
                receipt = RequestGuildResult.NoAuthority;
                return(true);
            }

            var basis  = UserHelper.FindUserBasis(_DestUid);
            var guild  = UserHelper.FindUserGuild(_DestUid);
            var member = guildData.FindMember(_DestUid);

            if (basis == null || member == null)
            {
                return(false);
            }


            GuildLogData log = new GuildLogData()
            {
                UserId   = basis.UserID,
                UserName = basis.NickName,
                LogTime  = DateTime.Now,
                Content  = string.Format("玩家 {0} 被移出公会。", basis.NickName),
            };

            guildData.NewLog(log);

            foreach (var v in guildData.MemberList)
            {
                PushMessageHelper.GuildMemberRemoveNotification(GameSession.Get(v.UserID), _DestUid);
                PushMessageHelper.NewGuildLogNotification(GameSession.Get(v.UserID));
            }

            guildData.RemoveMember(member);
            guild.GuildID = string.Empty;
            GlobalRemoteService.SendUserData(basis, guild.GuildID);

            receipt = RequestGuildResult.Successfully;
            return(true);
        }