Register for your free account! | Forgot your password?

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

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

Advertisement



Weird spawning problem

Discussion on Weird spawning problem within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Weird spawning problem

I downgraded Albetros to 5017 but I have this weird problem with spawning players. I can see mobs and NPCs just fine but when I log in a second client, the first client sees the character on the second client a shadow, name is there and I can click on it with the view gear thing. I know the mesh is correct (tried some breakpointing) but it simply doesn't spawn =/
Kiyono is offline  
Old 02/04/2012, 13:25   #2


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
The spawn entity packet layout is correct for a character right?
Korvacs is offline  
Old 02/04/2012, 15:02   #3

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
I copied it from my 5017 version of Project Manifest so it should work.
//edit
Code:
public unsafe struct SpawnPlayerPacket
    {
        public uint Id; //4
        public uint Lookface; //8
        public ulong Effect1; //12
        public ushort GuildId; //20
        public byte Unknown1; //22
        public GuildRank GuildRank; //23
        public uint GarmentType; //24
        public uint HelmetType; //28
        public uint ArmorType; //32
        public uint WeaponLType; //36
        public uint WeaponRType; //40
        public uint Unknown2; //44
        public ushort Life; //48
        public ushort MobLevel; //50
        public ushort PositionX; //52
        public ushort PositionY; //54
        public ushort Hair; //56
        public byte Direction; //58
        public byte Action; //59
        public byte Rebirth; //60
        public byte Unknown3; //61
        public ushort Level; //62
        public byte Unknown4; //64
        public uint Nobility; //65
        public byte Unknown5; //69
        public uint Unknown6; //70
        public uint Unknown7; //74
        public ushort Unknown8; //78
        public NetStringPacker Strings; //80

        public static SpawnPlayerPacket Create(Monster entity)
        {
            var packet = new SpawnPlayerPacket();
            packet.Strings = new NetStringPacker();
            packet.Lookface = entity.BaseMonster.Mesh;
            packet.Id = entity.UID;
            packet.PositionX = entity.X;
            packet.PositionY = entity.Y;
            packet.Direction = entity.Direction;
            packet.MobLevel  = entity.BaseMonster.Level;         
            packet.Life = (ushort) entity.Health;          
            packet.Effect1 = entity._stateff1;
            packet.Strings.AddString(entity.BaseMonster.Name);
            packet.Strings.AddString(string.Empty);
            return packet;
        }
        public static SpawnPlayerPacket Create(AI entity)
        {
            var packet = new SpawnPlayerPacket();
            packet.Lookface = entity.Mesh;
            packet.Id = entity.UID;
            packet.Effect1 = entity.StatusEffect1;
            if (entity.HeadGear != null)
            {
                packet.HelmetType = entity.HeadGear.StaticID;
            }
            if (entity.Armor != null)
            {
                packet.ArmorType = entity.Armor.StaticID;
            }
            if (entity.WeaponL != null)
            {
                packet.WeaponLType = entity.WeaponL.StaticID;
            }
            if (entity.WeaponR != null)
            {
                packet.WeaponRType = entity.WeaponR.StaticID;
            }
            if (entity.Garment != null)
            {
                packet.GarmentType = entity.Garment.StaticID;
            }
            packet.Life = (ushort)entity.Health;
            packet.Hair = entity.Hair;
            packet.PositionX = entity.X;
            packet.PositionY = entity.Y;
            packet.Direction = entity.Direction;
            packet.Action = (byte)entity.Action;
            packet.Rebirth = entity.Reborn;
            packet.Level = entity.Level;
            packet.Strings = new NetStringPacker();
            packet.Strings.AddString(entity.Name);
            packet.Strings.AddString(string.Empty);
            return packet;
        }
        public static SpawnPlayerPacket Create(Player entity)
        {
            var packet = new SpawnPlayerPacket();
            packet.Lookface = entity.Mesh;
            packet.Id = entity.UID;
            packet.GuildId = (ushort)entity.GuildId;
            packet.GuildRank = entity.GuildRank;
            packet.Effect1 = entity.StatusEffect1;
            if (entity.Equipment.Headgear != null)
            {
                packet.HelmetType = entity.Equipment.Headgear.StaticID;
            }
            if (entity.Equipment.Armor != null)
            {
                packet.ArmorType = entity.Equipment.Armor.StaticID;
            }
            if (entity.Equipment.WeaponL != null)
            {
                packet.WeaponLType = entity.Equipment.WeaponL.StaticID;
            }
            if (entity.Equipment.WeaponR != null)
            {
                packet.WeaponRType = entity.Equipment.WeaponR.StaticID;
            }
            if (entity._disguiseGarment != null)
                packet.GarmentType = entity._disguiseGarment.StaticID;
            else if (entity.Equipment.Garment != null)
                packet.GarmentType = entity.Equipment.Garment.StaticID;

            packet.Life = (ushort)entity.Health;
            packet.Hair = entity.Hair;
            packet.PositionX = entity.X;
            packet.PositionY = entity.Y;
            packet.Direction = entity.Direction;
            packet.Action = (byte)entity.Action;
            packet.Rebirth = entity.Reborn;
            packet.Level = entity.Level;
            packet.Strings = new NetStringPacker();
            packet.Strings.AddString(entity.Name);
            packet.Strings.AddString(string.Empty);
            return packet;
        }

        public static implicit operator byte[](SpawnPlayerPacket packet)
        {//216
            var buffer = new byte[220 + packet.Strings.Length];
            fixed (byte* ptr = buffer)
            {
                PacketBuilder.AppendHeader(ptr, buffer.Length, 1014);
                *((uint*)(ptr + 4)) = packet.Id;
                *((uint*) (ptr + 8)) = packet.Lookface;
                *((ulong*)(ptr + 12)) = packet.Effect1;
                *((ushort*) (ptr + 20)) = packet.GuildId;
                *(ptr + 22) = packet.Unknown1;
                *((GuildRank*) (ptr + 23)) = packet.GuildRank;
                *((uint*)(ptr + 24)) = packet.GarmentType;
                *((uint*)(ptr + 28)) = packet.HelmetType;
                *((uint*) (ptr + 32)) = packet.ArmorType;
                *((uint*) (ptr + 36)) = packet.WeaponLType;
                *((uint*) (ptr + 40)) = packet.WeaponRType;
                *((uint*)(ptr + 44)) = packet.Unknown2;
                *((ushort*)(ptr + 48)) = packet.Life;
                *((ushort*)(ptr + 50)) = packet.MobLevel;
                *((ushort*)(ptr + 52)) = packet.PositionX;
                *((ushort*)(ptr + 54)) = packet.PositionY;
                *((ushort*)(ptr + 56)) = packet.Hair;
                *(ptr + 58) = packet.Direction;
                *(ptr + 59) = packet.Action;
                *(ptr + 60) = packet.Rebirth;
                *(ptr + 61) = packet.Unknown3;
                *((ushort*) (ptr + 62)) = packet.Level;
                *(ptr + 64) = packet.Unknown4;
                *(ptr + 65) = (byte) packet.Nobility;
                *(ptr + 69) = packet.Unknown5;
                *((uint*)(ptr + 70)) = packet.Unknown6;
                *((uint*)(ptr + 74)) = packet.Unknown7;
                *((ushort*)(ptr + 78)) = packet.Unknown8;
                PacketBuilder.AppendNetStringPacker(ptr + 80, packet.Strings);
            }
            return buffer;
        }
    }
Kiyono is offline  
Old 02/04/2012, 22:38   #4
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Structures that are large may get packed slightly differently than you expect.
For instance, fields that are marked ushort, might actually be treated as ints for a better performance gain.

tl;dr of me going on how a compiler figures how the best packing, use StructLayout Explicit, and define a FieldOffset for every individual field.

-- nvm ignore this post, I thought you were using the same method as I often used as just making a pointer to the structure then copying it out of memory; I didn't notice you had an explicit constructor for the byte[]
InfamousNoone is offline  
Old 02/04/2012, 23:43   #5
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
The mesh could be showing as missing if an item equipped is nonexistant. Are you naked when testing the spawn packet?
Spirited is offline  
Thanks
1 User
Old 02/05/2012, 10:42   #6

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Quote:
Originally Posted by Fаng View Post
The mesh could be showing as missing if an item equipped is nonexistant. Are you naked when testing the spawn packet?
I thought that they were naked but it seemed that pro made newly created chars auto-equip a coat which was obviously the wrong item ID so they were wearing non-existing items which caused the problem. Thanks.
Kiyono is offline  
Reply


Similar Threads Similar Threads
Hello Problem With Spawning
01/14/2012 - SRO Private Server - 0 Replies
Hey. I Got a Problem With Items , They Seem Like They Work But they Don't. I Made a Ghost Summon Scroll and I Used it & I Got DC. Everytime i Login i Get Crash :(. Now I Want To Find in My VSRO Server , How To Get That (Numer of This Code) ITEM_COS_P_GHOST_SCROLL ?
Weird problem
09/29/2011 - CO2 Private Server - 0 Replies
#Closed, Fixed :D.
I have a problem spawning entities
07/28/2011 - CO2 Programming - 4 Replies
what is The problem Heroes can be Spawned at the 1st time i set it's locations in but if i moved +18 Coords and tried to re-spawn again it doesn't spawn while the packet being send to all the Entities with the right location . what am trying to do is: getting all the NearByEntities and re-spawn it between range 18.. what's happening: is when i set the location for the 1st time i will be able to spawn and re-spawn within 18 coords where i located , if i moved out my location +18 coords...
Weird problem
12/21/2009 - Dekaron Private Server - 1 Replies
Hmm ive searcged forum but no such topic,ive tried everything but still no succes. It seems i cant login my server because there is no Channel to login into . Im using difference client and diffrence server files that silkbotter posted. I got it running on a virtual machine xp sp3 1 gb of ram,40gb hdd. Server is running fine launches etc,and register works. Im using W7 with 2gb -1gb to vm.
[PROBlem] Spawning a shopflag
07/02/2009 - CO2 Private Server - 0 Replies
Ok i wanna test shopflags out but they wont spawn in my database... here is what i have can someone tell me if something is wrong? 800 1080 ShopFlag 16 6 158 176 1036 4



All times are GMT +1. The time now is 10:55.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.