|
You last visited: Today at 15:04
Advertisement
[Release]Guild Member List String Packet
Discussion on [Release]Guild Member List String Packet within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
12/05/2011, 01:50
|
#1
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
[Release]Guild Member List String Packet
Well, im sure that this isnt anything new to anyone. But every source I looked at either didnt have the packet added yet, or the member list was bugged. So I just decided to toggle with it until it was working flawlessly for me.
PHP Code:
ushort PacketLength, Offset = 0
ushort PacketType, Offset = 2
uint GuildID, Offset = 4
byte Type, Offset = 8 //Value of 0xB for member list
byte Count, Offset = 9 //How many members are being listed
For Each Member:
byte MemberStringLength, Offset = 10 + Current Offset
string MemberString, Offset = 11 + Current Offset
Then for the member string, I use:
PHP Code:
MemberName + " " + MemberLevel + " " + (byte)MemberOnline + "\n"
Im not 100% sure if the new line char is necessary but I stuck it there anyways haha.
#Edit: This should work for any version.
|
|
|
12/05/2011, 02:12
|
#2
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Use StringBuilder.
Code:
StringBuilder sb = new StringBuilder();
sb.Append(MemberName);
sb.Append(" ");
sb.Append(MemberLevel);
sb.Append(" ");
sb.Append(MemberOnline);
sb.Append("\n");
string MemberString = sb.ToString();
|
|
|
12/05/2011, 02:56
|
#3
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
eh, either works, i was just too lazy to write all that out + add the system.text namespace.
is there a performance difference between the two methods?
|
|
|
12/05/2011, 14:45
|
#4
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by 12k
eh, either works, i was just too lazy to write all that out + add the system.text namespace.
is there a performance difference between the two methods?
|
Using string += string + string + string + string etc. will create a new string for every time, where StringBuilder writes in memory, so it's way faster and efficient and that's what you should focus at when creating a server, not if it works.
|
|
|
12/05/2011, 14:52
|
#5
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Fairly certain the '\n' isn't necessary, our implementation doesn't need it.
|
|
|
12/07/2011, 01:29
|
#6
|
elite*gold: 0
Join Date: Jan 2008
Posts: 1,443
Received Thanks: 1,175
|
Hum. Your implementation will fail for big guilds. Imagine a guild with 100+ member? Your packet will be too big... And its limit the members to 255. Not the real implementation. You need to split the members per pages.
It's not the optimal implementation, but it's the way you should do it.
Code:
Player Player = Client.User;
if (Player == null)
return;
if (Player.Syndicate == null)
return;
Syndicate.Info Syn = Player.Syndicate;
String[] List = Syn.GetMemberList();
if (Data == -1)
Data = 0;
Int32 Amount = List.Length - (Data * 10);
if (Amount > 10)
Amount = 10;
String[] Tmp = new String[Amount];
Array.Copy(List, Data * 10, Tmp, 0, Amount);
Player.Send(MsgName.Create(Data + 1, Tmp, Action.MemberList));
|
|
|
12/07/2011, 03:02
|
#7
|
elite*gold: 0
Join Date: Aug 2010
Posts: 11
Received Thanks: 3
|
hmmm i have to start learning it, i just know edit npcs, and some system
someone can say where i can start
|
|
|
12/07/2011, 04:29
|
#8
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
as cpt said I'd combine the idea of using a stringbuilder with a 'sendpage' option. Tq only sends one page of members at a time and when you scroll through them it uses the page index to pull just the next... 10 entries for example to send per packet.
You would still use stringbuilder, just not clog it up with EVERY member in the entire guild.
|
|
|
 |
Similar Threads
|
How do I interpret the 4 byte value packet 0x3F7 subtype 0x0B? (list guild members)
10/27/2011 - CO2 Private Server - 1 Replies
For clients < 51xx; though it may be more, it just appears to have changed in the current version. No source that I've seen has this done correctly. I've analyzed it with olly; I figure a picture of what I've discovered so far is more helpful than explaining it. Read comments to the right.
http://img11.imageshack.us/img11/6769/unledofq.jp g
Yeah, I have no idea why they don't just pass the index as the value since it'd be much easier to use and it's already obviously defined either.
|
[Release] String/Float Value List
10/22/2010 - S4 League Hacks, Bots, Cheats & Exploits - 42 Replies
I Think
the title
say all
Screen:
http://www3.pic-upload.de/21.10.10/p267csthj81k.p ng
VirusTotal is Down? o.ô
Updatelog:
|
Play sound via Packet Send?? [Question String Packet]
07/14/2010 - CO2 Private Server - 5 Replies
Yow im trying to figure out why i cant play music with the string packet
What im doin is;
MyChar.Client.SendPacket(Game.Packet.String(MyCha r.UID, 20, Splitter));
My Packet is:
public byte String(long CharId, byte Type, string name)
|
All times are GMT +1. The time now is 15:05.
|
|