[Help] ClanMember packet,

06/22/2012 15:02 vincentvdb#1
Hello,

Im doing the clan packets, got some features working, but i'm stuck now,,
So far what I got :
-Showing Clan name
-Players can join, donate etc,

Need help with:
-Memberlist, erhmm the donation is not displaying well..
Here I got the folowing:

Code:
            uint membercount = (uint)client.Myclan.Members.Count;
            buffer = new byte[56 + (36 * client.Myclan.Members.Count)];
            Packets.WriteUInt16((ushort)(buffer.Length - 8), 0, buffer);
            Packets.WriteUInt16(1312, 2, buffer);
            buffer[4] = 4;

            int Pos = 16;
            foreach (Game.ClanMembers member in Kernel.ServerClans[client.Myclan.ClanId].Members.Values)
            {
                Packets.WriteUInt32(membercount, 0 + Pos, buffer);
                Packets.WriteString(member.Name, 4 + Pos, buffer);
                Packets.WriteUInt32(member.Level, 20 + Pos, buffer);
                Packets.WriteUInt16((ushort)member.Rank, 24 + Pos, buffer);
                if (Kernel.Clients.ContainsKey(member.UID))
                    Packets.WriteUInt16(1, 26 + Pos, buffer);
                Packets.WriteUInt32(member.Class, 28 + Pos, buffer);
                Packets.WriteUInt32(member.Donation, 32 + Pos, buffer);
                membercount -= 1;
                Pos += 36;
            }

-When I look at other players, which are in the same clan their 'ClanName' will be white instead of yellow? (Like the guilds have, members of the same guild will show a yellow guild name)

At the PlayerSpawnPacket i got :
at position 155 the ClanID
at position 159 the ClanRank (leader etc,)


-ClanRanking, I know rank 100 is the ClanLeader, but what is the member? Seems I can't find it,, tried everything?

Someone who can help me out?
Would be appriciated. ;)
06/22/2012 23:31 Zeroxelli#2
For the member list, if it's like the guild system which it should be, the member list is a string packet. For the clan name color, you have to send a string packet most likely, just like guilds, with the appropriate type for neutral/enemy/ally. If it's not displaying as yellow, the clan ID may be at the wrong offset or wrong itself, or they added another string type for that.
06/24/2012 14:29 vincentvdb#3
Hmm well, still can't get the clan to work,,

I'm sending the right clan ID,
The member list is working well with one member, but if there are more members it will put the donation wrong, which I dont get..
06/24/2012 19:09 Zeroxelli#4
How is the donation wrong? Is it a small difference, i.e. an offset? Or is it literally wrong? Because if it's literally wrong, your offsets may be incorrect.
06/25/2012 23:09 vincentvdb#5
Than I'll guess my offset is wrong,
Either I have not found why the clan name is not displaying yellow on clan members.
06/26/2012 00:41 Zeroxelli#6
Quote:
Originally Posted by vincentvdb View Post
Than I'll guess my offset is wrong,
Either I have not found why the clan name is not displaying yellow on clan members.
Well, like I said before:

Quote:
Originally Posted by Zeroxelli View Post
For the member list, if it's like the guild system which it should be, the member list is a string packet. For the clan name color, you have to send a string packet most likely, just like guilds, with the appropriate type for neutral/enemy/ally. If it's not displaying as yellow, the clan ID may be at the wrong offset or wrong itself, or they added another string type for that.
06/27/2012 22:34 vincentvdb#7
I think the ClanRank is wrong, well, sending the wrong value i guess.
100 is the ClanLeader, but which one is the ClanMember?

You may know that?
06/28/2012 00:08 Zeroxelli#8
If it's the same as the old guild system, 100 = leader, 50 = member. Might want to try 90 and 75, too, though.
06/28/2012 00:36 vincentvdb#9
Found out that it's 10, to be a clan member, but that does not fix the Clan color name,,
used breakpoints to check the values but from both characters they are the same, well the clanID's.

Need to check if there's another offset for the clan, but I don't think so,
Guilds is working the the ID and rank aswell,,
06/28/2012 00:45 Zeroxelli#10
Hmm, that is strange.. Must be a new string packet or something in the clan packet?
06/29/2012 00:26 vincentvdb#11
Alright, I'm one step ahead.:cool:
Fixed the packet for the Enemies and Allies. They now display as red and green name and are shown in the Enemies/Allies list ;)

Just the Yellow clanname packet left, Got no idea, but I think its just the same as the ally/enemy packet with other values?
Correct me if im wrong :rolleyes:
06/29/2012 00:39 Zeroxelli#12
Could be. Like I said, ally/enemy/neutral, so it could be just a different value for the type/subtype.
06/29/2012 01:27 -Shunsui-#13
Code:
public class Game_ClanMembers : IPacket
    {
        private Byte[] mData;
        private Int32 Offset = 16;

        public Game_ClanMembers(Clan clan)
        {
            mData = new Byte[56 + (36 * clan.Members.Count)];
            PBuilder.Write((UInt16)mData.Length, 0, mData);
            PBuilder.Write((UInt16)1312, 2, mData);

            UInt32 Count = (UInt32)clan.Members.Count();
            foreach (ClanMember member in clan.Members.ThreadSafeArray())
            {
                PBuilder.Write(Count, Offset, mData); Offset += 4;
                PBuilder.WriteNoLength(member.Name, Offset, mData); Offset += 16;
                PBuilder.Write((UInt32)member.Level, Offset, mData); Offset += 4;
                PBuilder.Write(Convert.ToUInt16(member.Rank), Offset, mData); Offset += 2;
                PBuilder.Write(Convert.ToUInt16(World.isOnline(member.Identifier)), Offset, mData); Offset += 2;
                PBuilder.Write((UInt32)member.Class, Offset, mData); Offset += 4;
                PBuilder.Write((UInt32)member.Donation, Offset, mData); Offset += 4;

                Count -= 1;
            }
            Offset = 16;
        }
        public Clan.Types Type
        {
            get { return (Clan.Types)mData[4]; }
            set { PBuilder.Write((Byte)value, 4, mData); }
        }
        public Byte[] Serialize { get { return this.mData; } }
        public void Deserialize(Byte[] d)
        {
            this.mData = new Byte[d.Length];
            d.CopyTo(this.mData, 0);
        }
    }
06/29/2012 16:09 vincentvdb#14
@-Shunsui-, thanks for sharing :) But it makes no difference at all ;( Still having the problem with the Donation not displaying well.

You may know how to show the 'Yellow' clanname from other clanmembers?
06/29/2012 16:15 Zeroxelli#15
As I said, it's probably a new packet or just another value and subtype for the strings packet..