コード例 #1
0
ファイル: HabboMessenger.cs プロジェクト: Habbotard/Firewind
        internal void OnNewFriendship(int friendID)
        {
            GameClient friend = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID);

            MessengerBuddy newFriend;

            if (friend == null || friend.GetHabbo() == null)
            {
                DataRow dRow;
                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT username,motto,look,last_online FROM users WHERE id = " + friendID);
                    dRow = dbClient.getRow();
                }

                newFriend = new MessengerBuddy(friendID, (string)dRow["username"], (string)dRow["look"], (string)dRow["motto"], (string)dRow["last_online"]);
            }
            else
            {
                Habbo user = friend.GetHabbo();
                newFriend = new MessengerBuddy(friendID, user.Username, user.Look, user.Motto, string.Empty);
                newFriend.UpdateUser(friend);
            }

            if (!friends.ContainsKey(friendID))
            {
                friends.Add(friendID, newFriend);
            }

            GetClient().SendMessage(SerializeUpdate(newFriend));
        }
コード例 #2
0
        internal static ServerMessage SerializeUpdate(MessengerBuddy friend)
        {
            ServerMessage reply = new ServerMessage(Outgoing.FriendUpdate);
            reply.AppendInt32(0); // category
            reply.AppendInt32(1); // number of updates
            reply.AppendInt32(0); // don't know

            friend.Serialize(reply);
            reply.AppendBoolean(false);

            return reply;
        }
コード例 #3
0
ファイル: HabboMessenger.cs プロジェクト: Habbotard/Firewind
        internal static ServerMessage SerializeUpdate(MessengerBuddy friend)
        {
            ServerMessage reply = new ServerMessage(Outgoing.FriendUpdate);

            reply.AppendInt32(0); // category
            reply.AppendInt32(1); // number of updates
            reply.AppendInt32(0); // don't know

            friend.Serialize(reply);
            reply.AppendBoolean(false);

            return(reply);
        }
コード例 #4
0
        internal void OnNewFriendship(int friendID)
        {
            GameClient friend = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID);

            MessengerBuddy newFriend;
            if (friend == null || friend.GetHabbo() == null)
            {
                DataRow dRow;
                using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT username,motto,look,last_online FROM users WHERE id = " + friendID);
                    dRow = dbClient.getRow();
                }

                newFriend = new MessengerBuddy(friendID, (string)dRow["username"], (string)dRow["look"], (string)dRow["motto"], (string)dRow["last_online"]);
            }
            else
            {
                Habbo user = friend.GetHabbo();
                newFriend = new MessengerBuddy(friendID, user.Username, user.Look, user.Motto, string.Empty);
                newFriend.UpdateUser(friend);
            }

            if (!friends.ContainsKey(friendID))
                friends.Add(friendID, newFriend);

            GetClient().SendMessage(SerializeUpdate(newFriend));
        }