Пример #1
0
        public override bool TakeAction()
        {
            var guild = new ShareCacheStruct <GuildsCache>().FindKey(guildId);

            if (guild == null)
            {
                receipt = RequestGuildResult.NoGuild;
                return(true);
            }
            if (guild.MemberList.Count >= 50)
            {
                receipt = RequestGuildResult.Full;
                return(true);
            }
            if (guild.FindRequest(Current.UserId) != null)
            {
                receipt = RequestGuildResult.HadRequest;
                return(true);
            }

            GuildCharacter character = new GuildCharacter()
            {
                UserID = Current.UserId,
                Date   = DateTime.Now
            };

            guild.AddNewRequest(character);

            foreach (var v in guild.MemberList)
            {
                PushMessageHelper.NewGuildRequestNotification(GameSession.Get(v.UserID), Current.UserId);
            }


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