Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 02:08

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[QUESTION] How to correctly display online status of associates?

Discussion on [QUESTION] How to correctly display online status of associates? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
[QUESTION] How to correctly display online status of associates?

I've noticed that most public servers have an odd way of communicating the online status of associates to the client.

Most use these types:

What most sources seem to do:
When I log in, my friend is sent:
Packet with RemoveFriend followed by a packet with AddFriend, Online = true.

When I log out, my friend is sent:
Packet with RemoveFriend followed by a packet with AddFriend, Online = false;

I simply use SetOnlineFriend in situation 1. The weird thing is, when I use SetFriendOffline in situation 2 it doesn't work.

What do you guys think is the correct way of communicating with the client?
Basser is offline  
Old 09/22/2013, 14:31   #2
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
When u login you should send all the player Friends 2 Times 1st Packet to send containing ID = RemoveENemy , 2nd Packet is FriendList Packet with ID = AddFriend (this to Prevent Duplicate Friend in your List ) Duplicate Friends means that you see your Friend Twice in List and sure u dont want to smthing like that to happen.. then you should send all the Friends the player have a message telling them that their friend is Online ( if they are Online for sure ) .. when Disconnecting you should send the Online Friends in your char Same 2 Packets but make sure that the offset responsible for player Online state = 1 ( i guess its offset 20 or 16 i dont remember ) and message telling them that their friend is offline now that how you should handle the Friend

BTW the FriendShip Request Part is Wrongly coded and leads to Getting Bugs Which are :-
lets say i sent u request it would show to u that i need to make FriendShip with u in form of MessageBox (which is Wrong cuz Friendship packet can handle that) .. and u pressed No everytime u get Invitation in form of messageBox and u pressed no u are going to get message telling u that the player u sent request has Declined your Request .. althought u didnt send any1 FriendRequest AT that Time .. u know y this bug is caused .. cause of these USELESS Codes client.OKMessageBox , client.CancelMessageBox

Note if you know what u r doing then i recommend u to Recode the Whole system its not hard at all took me about 1 - 2 Hours to understand , code everything ..if u got any question feel free to ask

Hope i helped you
shadowman123 is offline  
Old 09/22/2013, 17:15   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 259
Received Thanks: 159
put one breakpoints
where you send packet, to see if they really sent

Code:
Client.GamePackets.KnowPersons request = new Client.GamePackets.KnowPersons();
                            request.Name = client.Player.Name;
                            request.Online = false;
                            request.Type   =Client.GamePackets.KnowPersons.AddOffline;
                            request.UID = client.Player.UID;
                            clients.Enqueue(request.ToArray());
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Project_Terror.Client.GamePackets
{
    public class KnowPersons : ServerSocket.Packet
    {
        public const byte
            RequestFriendship = 10,
            AcceptRequest = 11,
            AddOnline = 12,
            AddOffline = 13,
            RemovePerson = 14,
            AddFriend = 15,

            RemoveEnemy = 18,
            AddEnemy = 19;

        public KnowPersons()
            : base(80, true)
        {

            WriteUshort(72, 0);
            WriteUshort((ushort)CMD.GamePackets.KnowPersons, 2);
        }

        public uint UID
        {
            get { return ReadUint(4); }
            set { WriteUint(value, 4); }
        }

        public byte Type
        {
            get { return ReadByte(8); }
            set { WriteByte(value, 8); }
        }

        public bool Online
        {
            get { return ReadByte(9) == 1; }
            set { WriteByte((byte)(value == true ? (byte)1 : (byte)0), 9); }
        }

        public string Name
        {
            get
            {
                return ReadString(20, 16);
            }
            set
            {
                WriteString(value, 20);
            }
        }
    }
}
this work sure
teroareboss1 is offline  
Old 09/22/2013, 21:22   #4
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
It works for me, but why is there a SetOnlineFriend if that doesn't work?
I personally feel that sending to packets to remove and add the friend isn't necessary to change it's online/offline status.

Not sure what TQ does, but it seemed to me the removing and adding again worked best (which doesn't mean it is the best, haven't tried everything...)

I was hoping someone could tell me what the correct way was - yes, still assuming two packets aren't necessary

Quote:
Originally Posted by shadowman123 View Post
BTW the FriendShip Request Part is Wrongly coded and leads to Getting Bugs Which are :-
lets say i sent u request it would show to u that i need to make FriendShip with u in form of MessageBox (which is Wrong cuz Friendship packet can handle that) .. and u pressed No everytime u get Invitation in form of messageBox and u pressed no u are going to get message telling u that the player u sent request has Declined your Request .. althought u didnt send any1 FriendRequest AT that Time .. u know y this bug is caused .. cause of these USELESS Codes client.OKMessageBox , client.CancelMessageBox

Note if you know what u r doing then i recommend u to Recode the Whole system its not hard at all took me about 1 - 2 Hours to understand , code everything ..if u got any question feel free to ask

Hope i helped you
Not sure what source you're referring to, I don't use a message box for friend requests (pretty sure it wasn't done like that at patch 5065?). Besides my friend system is from scratch as it is a very basic feature.
Basser is offline  
Old 09/22/2013, 21:46   #5
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Quote:
Originally Posted by Basser View Post
Not sure what source you're referring to, I don't use a message box for friend requests (pretty sure it wasn't done like that at patch 5065?). Besides my friend system is from scratch as it is a very basic feature.
aha fine .. try using Type = AddFriend and see results
shadowman123 is offline  
Old 09/22/2013, 21:50   #6
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
Quote:
Originally Posted by shadowman123 View Post
aha fine .. try using Type = AddFriend and see results
AddFriend should only be sent at initial log in, not to change the online/offline status...
I know it will duplicate, obviously that will happen.
Basser is offline  
Old 09/22/2013, 22:07   #7
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Quote:
Originally Posted by Basser View Post
AddFriend should only be sent at initial log in, not to change the online/offline status...
I know it will duplicate, obviously that will happen.
what controls Online and offline state of player is offset 9 not the Type ,...End of story
shadowman123 is offline  
Old 09/22/2013, 22:17   #8
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
Quote:
Originally Posted by shadowman123 View Post
what controls Online and offline state of player is offset 9 not the Type ,...End of story
And that's how TQ does it? Why are there so many types there?
Basser is offline  
Old 09/23/2013, 11:41   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Ok, this is fairly simple, on login you do a few things:

First: Send AddFriend (0x0F) for every friend associated with the Online bool set to true if the friend is online (This populates the logging in character's list).
Second: Send SetFriendOnline (0x0C) with the bool marked as true, to every friend to tell them that your character has just logged in (this updates the friend's friend list).

Then you rinse/repeat for enemies.

When a character logs out, you notify each of that characters friends that they are now offline by sending SetFriendOffline with the bool marked as false.

And that is it.
Korvacs is offline  
Thanks
2 Users
Old 09/23/2013, 16:55   #10
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
Quote:
Originally Posted by Korvacs View Post
Ok, this is fairly simple, on login you do a few things:

First: Send AddFriend (0x0F) for every friend associated with the Online bool set to true if the friend is online (This populates the logging in character's list).
Second: Send SetFriendOnline (0x0C) with the bool marked as true, to every friend to tell them that your character has just logged in (this updates the friend's friend list).

Then you rinse/repeat for enemies.

When a character logs out, you notify each of that characters friends that they are now offline by sending SetFriendOffline with the bool marked as false.

And that is it.
Thats what I assumed, but for some reason enemies will stay offline (using SetEnemyOnline)

EDIT:
Not sure what I did differently this time, but it seems to work now, so thanks!
Basser is offline  
Reply


Similar Threads Similar Threads
[ZSZC Tool] Char status display
08/17/2010 - SRO PServer Guides & Releases - 10 Replies
Hello people, So if you're botting you're probrally doing something else on your pc, or just sleeping. Because of that you'll have to check if you're not dead, or that the character is still connected. Also when you level up you'll have to distribute your stat points. So I made this tool. .:ZSZC Checker:. .:Functions:.
[Question]How do I combine the database with the client correctly?
05/14/2010 - EO PServer Hosting - 6 Replies
Well, you see, the guide at the top: ( http://www.elitepvpers.com/forum/eo-pserver-hosting /339763-guide-detialed-how-setup-server.html ) Has this screen shot here: http://i92.photobucket.com/albums/l33/Drenferalis /extract.jpg What I don't understand is how to take the files from this thread:
Hot to answer correctly to the antibot question
10/24/2009 - Dragonica - 8 Replies
i was wondering if there's something that we can do to answer that question that pops up everytime, like "how many '8' there are bellow?". thanks in advance!
[Question]How to chnage the Login display?
09/30/2009 - Dekaron Private Server - 6 Replies
Hello, I want to ask you how can i change the login display (Background and loginfield) Only helpful answers please! Thanks, Maurice



All times are GMT +2. The time now is 02:08.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.