well maybe u will see this thread and will think "wtf is this guy doing!", but this is the first time i try to structure a packet.
I'm trying to see a guild's status window, but i know i'm missing something but don't know what :c
this is the packet
Code:
using System;
namespace Conquer_Online_Server.Network.GamePackets
{
class GuildInfo : Writer, Interfaces.IPacket
{
public byte[] ToArray()
{
return Buffer;
}
byte[] Buffer;
public uint UID
{
get { return BitConverter.ToUInt32(Buffer, 4); }
set { Writer.WriteUInt32(value, 4, Buffer); }
}
public void Deserialize(byte[] Packet)
{
this.Buffer = Packet;
}
public byte[] Serialize()
{
return Buffer;
}
public void Send(Client.GameState Hero)
{
Hero.Send(Buffer);
}
public ushort Lenght
{
set
{
WriteUInt16(value, 0, Buffer);
}
}
public uint ID
{
set
{
WriteUInt16((ushort)value, 2, Buffer);
}
}
public uint Donation
{
set { WriteUInt32(value, 8, Buffer); }
get { return BitConverter.ToUInt16(Buffer, 8); }
}
public uint Fund
{
set { WriteUInt32(value, 12, Buffer); }
get { return BitConverter.ToUInt16(Buffer, 12); }
}
public uint Members
{
set { WriteUInt32(value, 20, Buffer); }
}
public byte Rank
{
set { WriteByte(value, 24, Buffer); }
}
public string LeaderName
{
set { WriteString(value, 25, Buffer); }
}
}
}
Code:
using System.Collections.Generic;
namespace Conquer_Online_Server.Game.ConquerStructures
{
public class Guild
{
uint guildfund;
string guildleader, bulletin;
public string GuildName;
public uint GuildID;
public Dictionary<uint, Entity> Members;
public List <uint> Allies, Enemies;
public string Bulletin
{
get
{
return bulletin;
}
set
{
bulletin = value;
foreach (Entity entity in Members.Values)
{
//sendpacket
}
}
}
public string GuildLeader
{
get
{
return guildleader;
}
set
{
guildleader = value;
//for send packet purposes
}
}
public uint GuildFund
{
get
{
return guildfund;
}
set
{
guildfund = value;
//for send packet purposes
}
}
public uint MembersCount
{
get
{
return (uint)Members.Count;
}
}
public Guild(string Name, Entity entity, uint ID)
{
GuildID = 12;
GuildFund = 1000000;
GuildLeader = entity.Name;
GuildName = Name;
Bulletin = "Una guild";
Members.Add(entity.UID, entity);
Network.GamePackets.GuildInfo GuildPacket = new Network.GamePackets.GuildInfo();
GuildPacket.ID = ID;
GuildPacket.Donation = entity.GuildDonation;
GuildPacket.Fund = GuildFund;
GuildPacket.LeaderName = GuildLeader;
GuildPacket.Lenght = (ushort)(28 + GuildLeader.Length);
GuildPacket.Members = MembersCount;
GuildPacket.Rank = (byte)entity.GuildPosition;
GuildPacket.UID = GuildID;
GuildPacket.Send(entity.Owner);
}
}
}
Code:
case 1106:
{
client.Entity.guild = new Game.ConquerStructures.Guild("Xdd", client.Entity, 1106);
break;
}
case 1107:
{
client.Entity.guild = new Game.ConquerStructures.Guild("Xdd", client.Entity, 1107);
break;
}
i got the structure frome here
if it mattersthanks






