コード例 #1
0
ファイル: Habbo.cs プロジェクト: aromaa/Skylight
 public int GetHALInterval()
 {
     if (this.IsJonny)
     {
         return(0);
     }
     else
     {
         PermissionRank rank = Skylight.GetGame().GetPermissionManager().TryGetRank(this.Rank);
         if (rank != null)
         {
             return(rank.HalInterval);
         }
         else
         {
             return(int.MaxValue);
         }
     }
 }
コード例 #2
0
ファイル: Habbo.cs プロジェクト: aromaa/Skylight
 public int GetWiredConditionLimit()
 {
     if (this.IsJonny)
     {
         return(int.MaxValue);
     }
     else
     {
         PermissionRank rank = Skylight.GetGame().GetPermissionManager().TryGetRank(this.Rank);
         if (rank != null)
         {
             return(rank.WiredConditionLimit);
         }
         else
         {
             return(0);
         }
     }
 }
コード例 #3
0
ファイル: Habbo.cs プロジェクト: aromaa/Skylight
 public int GetFloodTime()
 {
     if (this.IsJonny)
     {
         return(0);
     }
     else
     {
         PermissionRank rank = Skylight.GetGame().GetPermissionManager().TryGetRank(this.Rank);
         if (rank != null)
         {
             return(rank.Floodtime);
         }
         else
         {
             return(30);
         }
     }
 }
コード例 #4
0
ファイル: ChatHub.cs プロジェクト: Ryan-Afzal/Chat-V2
        public async Task ConnectedToGroup(ConnectedToGroupArgs args)
        {
            var membership = await ChatContext.Membership
                             .Include(m => m.ChatUser)
                             .Include(m => m.Group)
                             .ThenInclude(g => g.Memberships)
                             .ThenInclude(m => m.ChatUser)
                             .FirstOrDefaultAsync(m => m.MembershipID == args.MembershipID);

            if (!ValidateUser(membership.ChatUser))
            {
                return;
            }

            membership.IsOnlineInGroup = true;
            await ChatContext.SaveChangesAsync();

            await GetPreviousMessages(new GetPreviousMessagesArgs()
            {
                MembershipID = args.MembershipID,
                StartIndex   = 0,
                Count        = 50
            });

            var proxy = await GetClientsInGroupAsync(membership.GroupID);

            if (membership is PersonalGroupMembership p)
            {
                var otherUser = p.PersonalGroup.GetOtherUser(p.ChatUser);

                await Clients.Caller.SendAsync(
                    "ReceivePersonalGroupData",
                    new ReceivePersonalGroupDataArgs(
                        p.Group.GroupID,
                        otherUser.Id,
                        otherUser.UserName,
                        FileOperationProvider.FileLoadURL + "/" + otherUser.ProfileImage)
                    );

                foreach (var _m in p.PersonalGroup.PersonalGroupMemberships)
                {
                    if (_m.IsOnlineInGroup)
                    {
                        await Clients.Caller.SendAsync(
                            "OtherUserConnectedToPersonalGroup",
                            new OtherUserConnectedToPersonalGroupArgs(
                                _m.GroupID,
                                _m.ChatUserID
                                )
                            );

                        if (_m.IsActiveInGroup)
                        {
                            await Clients.Caller.SendAsync(
                                "OtherUserActiveInPersonalGroup",
                                new OtherUserActiveInPersonalGroupArgs(
                                    _m.GroupID,
                                    _m.ChatUserID
                                    )
                                );
                        }
                        else
                        {
                            await Clients.Caller.SendAsync(
                                "OtherUserInactiveInPersonalGroup",
                                new OtherUserInactiveInPersonalGroupArgs(
                                    _m.GroupID,
                                    _m.ChatUserID
                                    )
                                );
                        }
                    }
                }

                await proxy
                .SendAsync(
                    "OtherUserConnectedToPersonalGroup",
                    new OtherUserConnectedToPersonalGroupArgs(
                        p.GroupID,
                        p.ChatUserID
                        )
                    );

                await proxy
                .SendAsync(
                    "OtherUserActiveInPersonalGroup",
                    new OtherUserActiveInPersonalGroupArgs(membership.GroupID, membership.ChatUserID)
                    );
            }
            else if (membership is MultiuserGroupMembership m)
            {
                await Clients.Caller.SendAsync(
                    "ReceiveGroupData",
                    new ReceiveGroupDataArgs(m.Group.GroupID, m.MultiuserGroup.Name, m.Group.Memberships.Count())
                    );

                foreach (var _m in m.MultiuserGroup.Memberships.OfType <MultiuserGroupMembership>())
                {
                    if (_m.IsOnlineInGroup)
                    {
                        await Clients.Caller.SendAsync(
                            "OtherUserConnectedToGroup",
                            new OtherUserConnectedToGroupArgs(
                                _m.GroupID,
                                _m.ChatUserID,
                                _m.ChatUser.UserName,
                                FileOperationProvider.FileLoadURL + "/" + _m.ChatUser.ProfileImage,
                                PermissionRank.GetPermissionRankByOrdinal(_m.Rank).Name)
                            );

                        if (_m.IsActiveInGroup)
                        {
                            await Clients.Caller.SendAsync(
                                "OtherUserActiveInGroup",
                                new OtherUserActiveInGroupArgs(_m.GroupID, _m.ChatUserID)
                                );
                        }
                        else
                        {
                            await Clients.Caller.SendAsync(
                                "OtherUserInactiveInGroup",
                                new OtherUserInactiveInGroupArgs(_m.GroupID, _m.ChatUserID)
                                );
                        }
                    }
                }

                await proxy
                .SendAsync(
                    "OtherUserConnectedToGroup",
                    new OtherUserConnectedToGroupArgs(
                        m.GroupID,
                        m.ChatUserID,
                        m.ChatUser.UserName,
                        FileOperationProvider.FileLoadURL + "/" + m.ChatUser.ProfileImage,
                        PermissionRank.GetPermissionRankByOrdinal(m.Rank).Name)
                    );

                await proxy
                .SendAsync(
                    "OtherUserActiveInGroup",
                    new OtherUserActiveInGroupArgs(membership.GroupID, membership.ChatUserID)
                    );
            }
            else
            {
                throw new InvalidOperationException();
            }
        }