Classic[4267] GuildMemeber List!

10/02/2013 13:53 Mr_PoP#1
Code:
public void GuildMemebers(IEnumerable<WorldModel.Syndicate.IGuildMember> members)
        {
            List<string> mems = new List<string>(members.Count());
            foreach (IGuildMember mem in members)
            {
                if (world.Entities.BattleEntities.OnlineHeros.TryGetValue(mem.HeroId, out hero))
                {
                    mems.Add(hero.Name + " " + hero.Level + " 1");
                }
                else if ((hero = world.Database.HeroManager.GetHeroById(mem.HeroId)) != null)
                {
                    mems.Add(hero.Name + " " + hero.Level + " 0");
                }
            }
            Send(new StringPacket(mems) { strType = StringType.GuildList });

}
Code:
//string packet..
public StringPacket(List<string> list) :
            base(PacketType.Strings, (ushort)(11 + list.Sum(x => x.Length)))
        {
            WriteUInt32(4, (uint)list.Count + 1);
            WriteStringList(9, list);
        }
when I send it the client crashes , any clue what am doing wrong here?!
10/02/2013 14:06 Korvacs#2
Lets see this method - WriteStringList
10/02/2013 14:39 Mr_PoP#3
Quote:
Originally Posted by Korvacs View Post
Lets see this method - WriteStringList
Code:
void WriteStringList(int location, List<String> list) {
            WriteByte(location++, (Byte)list.Count);
            foreach (var str in list) {
                WriteByte(location++, (Byte)str.Length);
                WriteString(location, str, str.Length);
                location += str.Length;
            }
#fixed that thread can be closed now :)