コード例 #1
0
        public override bool TakeAction()
        {
            GlobalRemoteService.SendUserData(GetBasis, GetGuild.GuildID);

            string content = "欢迎进入勇者之怒!";

            GlobalRemoteService.SendSystemChat(Current.UserId, content);
            return(true);
        }
コード例 #2
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);
        }
コード例 #3
0
        public override bool TakeAction()
        {
            bool isAtevent = false;
            var  guildsSet = new ShareCacheStruct <GuildsCache>();
            var  guildData = guildsSet.FindKey(GetGuild.GuildID);

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


            var member = guildData.FindMember(Current.UserId);

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

            isAtevent = member.JobTitle == GuildJobTitle.Atevent;


            guildData.RemoveMember(member);
            GetGuild.GuildID = string.Empty;

            if (guildData.MemberList.Count > 0)
            {
                if (isAtevent)
                {
                    var ac = guildData.FindAteventCandidate();
                    if (ac != null)
                    {
                        ac.JobTitle = GuildJobTitle.Atevent;
                        foreach (var v in guildData.MemberList)
                        {
                            PushMessageHelper.GuildMemberChangeNotification(GameSession.Get(v.UserID), ac.UserID);
                        }
                    }
                }

                GuildLogData log = new GuildLogData()
                {
                    UserId   = Current.UserId,
                    UserName = GetBasis.NickName,
                    LogTime  = DateTime.Now,
                    Content  = string.Format("玩家 {0} 退出了公会。", GetBasis.NickName),
                };
                guildData.NewLog(log);

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


            GlobalRemoteService.SendUserData(GetBasis, GetGuild.GuildID);

            receipt = true;
            return(true);
        }
コード例 #4
0
        public override bool TakeAction()
        {
            var guildsSet = new ShareCacheStruct <GuildsCache>();

            if (!GetGuild.GuildID.IsEmpty())
            {
                var oldguild = guildsSet.FindKey(GetGuild.GuildID);
                if (oldguild != null && oldguild.FindMember(Current.UserId) != null)
                {
                    return(false);
                }
            }

            int needDiamond = ConfigEnvSet.GetInt("User.CreateGuildNeedDiamond");

            if (GetBasis.DiamondNum < needDiamond)
            {
                receipt = RequestGuildResult.NoDiamond;
                return(true);
            }
            if (guildsSet.Find(t => t.GuildName == _guildName) != null)
            {
                receipt = RequestGuildResult.HadName;
                return(true);
            }

            GuildsCache guild = new GuildsCache()
            {
                GuildID    = Guid.NewGuid().ToString(),
                GuildName  = _guildName,
                Liveness   = 0,
                RankID     = 0,
                CreateDate = DateTime.Now,
                Lv         = 1
            };

            GuildCharacter member = new GuildCharacter()
            {
                UserID   = Current.UserId,
                JobTitle = GuildJobTitle.Atevent,
                Liveness = 0
            };

            guild.AddNewMember(member);

            GuildLogData log = new GuildLogData()
            {
                UserId   = Current.UserId,
                UserName = GetBasis.NickName,
                LogTime  = DateTime.Now,
                Content  = string.Format("玩家 {0} 创建了公会。", GetBasis.NickName),
            };

            guild.NewLog(log);

            guildsSet.Add(guild);
            guildsSet.Update();
            GetGuild.GuildID = guild.GuildID;
            PushMessageHelper.JoinGuildNotification(Current);

            GlobalRemoteService.SendUserData(GetBasis, GetGuild.GuildID);

            receipt = RequestGuildResult.Successfully;
            return(true);
        }
コード例 #5
0
        public override bool TakeAction()
        {
            var guildData = new ShareCacheStruct <GuildsCache>().FindKey(GetGuild.GuildID);

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

            var guildcfg = new ShareCacheStruct <Config_Society>().FindKey(guildData.Lv);

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


            if (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);

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



            if (_isAgree)
            {
                if (guildData.MemberList.Count >= guildcfg.Number)
                {
                    receipt = RequestGuildResult.Full;
                }

                else if (!guild.GuildID.IsEmpty())
                {
                    receipt = RequestGuildResult.HadGuild;
                }
                else
                {
                    GuildCharacter member = new GuildCharacter()
                    {
                        UserID   = basis.UserID,
                        JobTitle = GuildJobTitle.Normal,
                        Liveness = 0
                    };

                    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.NewGuildMemberNotification(GameSession.Get(v.UserID), _DestUid);
                        PushMessageHelper.NewGuildLogNotification(GameSession.Get(v.UserID));
                    }

                    guildData.AddNewMember(member);
                    guild.GuildID  = guildData.GuildID;
                    guild.IsSignIn = false;

                    // 通知新成员公会信息
                    PushMessageHelper.JoinGuildNotification(GameSession.Get(_DestUid));

                    GlobalRemoteService.SendUserData(basis, guild.GuildID);

                    receipt = RequestGuildResult.Successfully;
                }
            }
            // 从邀请列表里清除
            guildData.RemoveRequest(_DestUid);

            foreach (var v in guildData.MemberList)
            {
                PushMessageHelper.GuildApplyRemoveNotification(GameSession.Get(v.UserID), _DestUid);
            }
            return(true);
        }