Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 21:46

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


[Release] CharacterData, EntitySpawn

Discussion on [Release] CharacterData, EntitySpawn within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old 05/20/2019, 18:55   #16
 
elite*gold: 0
Join Date: Apr 2009
Posts: 2,183
Received Thanks: 2,397
Another mistake I found:
OwnerUniqueID & OwnerName is sent if TypeID4 != 1. (ride pet)
You should not look for these values if the COS TypeID4 is 1.



sarkoplata is offline  
Thanks
1 User
Old 05/28/2019, 21:33   #17
 
elite*gold: 0
Join Date: Sep 2018
Posts: 55
Received Thanks: 26
PHP Code:
if(obj.TypeID3 == 2)
{
    
// NPC_MOB
    
1   byte   Rarity
    
if(obj.TypeID4 == || obj.TypeID4 == 3)
    {
        
1   byte   Appearance //Randomized by server.
    
}

Is this correct? All has been working as intended but on parsing NPC looks like all are "NPC_MOB" with this condition and it's having packet reading error..

I can't find some reference about this string for checking his ID's .. is not very important but I would like to keep on track everything!


JellyBitz is offline  
Old 05/28/2019, 22:54   #18
 
elite*gold: 0
Join Date: Jan 2009
Posts: 240
Received Thanks: 446
Quote:
Originally Posted by JellyBitz View Post
PHP Code:
if(obj.TypeID3 == 2)
{
    
// NPC_MOB
    
1   byte   Rarity
    
if(obj.TypeID4 == || obj.TypeID4 == 3)
    {
        
1   byte   Appearance //Randomized by server.
    
}

Is this correct? All has been working as intended but on parsing NPC looks like all are "NPC_MOB" with this condition and it's having packet reading error..

I can't find some reference about this string for checking his ID's .. is not very important but I would like to keep on track everything!
obj.TypeID3 == 2 is NPC_NPC where it should obviously be NPC_MOB.
I should probably delete this altogether, it's poorly transcribed and incorrect in so many places.

Code:
        if(obj.TypeID3 == 1)
        {
            //NPC_MOB
            1   byte    Monster.Rarity
            if(obj.TypeID4 == 2 || obj.TypeID4 == 3)
            {
                //NPC_MOB_TIEF, NPC_MOB_HUNTER
                1   byte    Monster.Appearance  //Randomized by server.
            }
        }
DaxterSoul is offline  
Thanks
1 User
Old 06/10/2019, 23:48   #19
 
elite*gold: 0
Join Date: Sep 2018
Posts: 55
Received Thanks: 26
Working nicely, I think it's better subdivide the packet as seems on other source bots but is not my priority at the moment.

But I'm having an issue today (testing more servers) at skill ID, specificaly at Buffs loading. The skill ID is not found (not a reading problem since everything around it is parsing smooth). My though it's look for model id and extract the skill id from there, but no sounds like a solution. Where I should look apart from skilldata.txt? have something to do with skills encoded? Nevermind, solved.

Code as reference:
PHP Code:
public static void EntitySpawn(Packet packet)
{
    
SRObject entity = new SRObject(packet.ReadUInt(), SRObject.Type.Entity);
    if (
entity.ID1 == 1)
    {
        
// BIONIC:
        // - CHARACTER
        // - NPC
        //   - NPC_FORTRESS_STRUCT
        //   - NPC_MOB
        //   - NPC_COS
        //   - NPC_FORTRESS_COS
        
if (entity.ID2 == 1)
        {
            
// CHARACTER
            
entity[SRAttribute.Scale] = packet.ReadByte();
            
entity[SRAttribute.BerserkLevel] = packet.ReadByte();
            
entity[SRAttribute.PVPCape] = packet.ReadByte();
            
entity[SRAttribute.ExpType] = packet.ReadByte();
            
// Inventory
            
SRObjectCollection inventory = new SRObjectCollection(packet.ReadByte());
            
byte inventoryCount packet.ReadByte();
            for (
byte i 0inventoryCounti++)
            {
                
inventory[i] = new SRObject(packet.ReadUInt(), SRObject.Type.Item);
                if (
inventory[i].ID1 == && inventory[i].ID2 == 1)
                {
                    
inventory[i][SRAttribute.ItemOptLevel] = packet.ReadByte();
                }
            }
            
entity[SRAttribute.Inventory] = inventory;
            
// AvatarInventory
            
SRObjectCollection inventoryAvatar = new SRObjectCollection(packet.ReadByte());
            
byte inventoryAvatarCount packet.ReadByte();
            for (
byte i 0inventoryAvatarCounti++)
            {
                
inventoryAvatar[i] = new SRObject(packet.ReadUInt(), SRObject.Type.Item);
                if (
inventoryAvatar[i].ID1 == && inventoryAvatar[i].ID2 == 1)
                {
                    
inventoryAvatar[i][SRAttribute.ItemOptLevel] = packet.ReadByte();
                }
            }
            
entity[SRAttribute.InventoryAvatar] = inventoryAvatar;
            
// Mask
            
byte hasMask packet.ReadByte();
            
entity[SRAttribute.hasMask] = hasMask;
            if (
hasMask == 1)
            {
                
SRObject mask = new SRObject(packet.ReadUInt(), SRObject.Type.Model);
                if (
mask.ID1 == entity.ID1 && mask.ID2 == entity.ID2)
                {
                    
// Clone
                    
mask[SRAttribute.Scale] = packet.ReadByte();
                    
SRObjectCollection maskItems = new SRObjectCollection(packet.ReadByte());
                    for (
int i 0maskItems.Capacityi++)
                    {
                        
maskItems[i] = new SRObject(packet.ReadUInt(), SRObject.Type.Item);
                    }
                    
mask[SRAttribute.MaskItems] = maskItems;
                }
                
entity[SRAttribute.Mask] = mask;
            }

        }
        else if (
entity.ID2 == && entity.ID3 == 5)
        {
            
// NPC_FORTRESS_STRUCT
            
entity[SRAttribute.HP] = packet.ReadUInt();
            
entity[SRAttribute.refEventStructID] = packet.ReadUInt();
            
entity[SRAttribute.LifeState] = packet.ReadUShort();
        }
        
// Position
        
entity[SRAttribute.UniqueID] = packet.ReadUInt();
        
entity[SRAttribute.Region] = packet.ReadUShort();
        
entity[SRAttribute.X] = packet.ReadSingle();
        
entity[SRAttribute.Y] = packet.ReadSingle();
        
entity[SRAttribute.Z] = packet.ReadSingle();
        
entity[SRAttribute.Angle] = packet.ReadUShort();
        
// Movement
        
byte hasDestination packet.ReadByte();
        
entity[SRAttribute.hasDestination] = hasDestination;
        
entity[SRAttribute.MovementType] = packet.ReadByte();
        if (
hasDestination == 1)
        {
            
// Mouse movement
            
entity[SRAttribute.DestinationRegion] = packet.ReadUShort();
            if ((
ushort)entity[SRAttribute.Region] < short.MaxValue)
            {
                
// World
                
entity[SRAttribute.DestinationOffsetX] = packet.ReadUShort();
                
entity[SRAttribute.DestinationOffsetY] = packet.ReadUShort();
                
entity[SRAttribute.DestinationOffsetZ] = packet.ReadUShort();
            }
            else
            {
                
// Dungeon
                
entity[SRAttribute.DestinationOffsetX] = packet.ReadUInt();
                
entity[SRAttribute.DestinationOffsetY] = packet.ReadUInt();
                
entity[SRAttribute.DestinationOffsetZ] = packet.ReadUInt();
            }
        }
        else
        {
            
entity[SRAttribute.MovementSource] = packet.ReadByte();
            
// Represents the new angle, character is looking at
            
entity[SRAttribute.MovementAngle] = packet.ReadUShort();
        }
        
// State
        
entity[SRAttribute.LifeState] = packet.ReadByte();
        
entity[SRAttribute.unkByte3] = packet.ReadByte();
        
entity[SRAttribute.MotionState] = packet.ReadByte();
        
entity[SRAttribute.PlayerStatus] = packet.ReadByte();
        
// Speed
        
entity[SRAttribute.WalkSpeed] = packet.ReadSingle();
        
entity[SRAttribute.RunSpeed] = packet.ReadSingle();
        
entity[SRAttribute.BerserkSpeed] = packet.ReadSingle();
        
// Buffs
        
SRObjectCollection buffs = new SRObjectCollection(packet.ReadByte());
        for (
int i 0buffs.Capacityi++)
        {
            
uint id packet.ReadUInt();
            
buffs[i] = new SRObject(idSRObject.Type.Skill);
            
buffs[i][SRAttribute.Duration] = packet.ReadUInt();
            if (
buffs[i].isAutoTransferEffect())
            {
                
buffs[i][SRAttribute.isCreator] = packet.ReadByte();
            }
        }
        
entity[SRAttribute.Buffs] = buffs;
        if (
entity.ID3 == 1)
        {
            
// MOB
            
packet.ReadByte(); // 2
            
entity[SRAttribute.MobType] = packet.ReadByte();
            
packet.ReadByte(); // 5
            
packet.ReadByte(); // 0
        
}
        else if (
entity.ID2 == 1)
        {
            
// CHARACTER
            
entity[SRAttribute.Name] = packet.ReadAscii();
            
entity[SRAttribute.JobType] = packet.ReadByte();
            
entity[SRAttribute.JobLevel] = packet.ReadByte();
            
entity[SRAttribute.PVPState] = packet.ReadByte();
            
bool hasTransport packet.ReadByte() == 1;
            
entity[SRAttribute.hasTransport] = hasTransport;
            
entity[SRAttribute.isFighting] = packet.ReadByte();
            if (
hasTransport)
            {
                
entity[SRAttribute.TransportUniqueID] = packet.ReadUInt();
            }
            
entity[SRAttribute.ScrollMode] = packet.ReadByte();
            
entity[SRAttribute.InteractMode] = packet.ReadByte();
            
entity[SRAttribute.unkByte4] = packet.ReadByte();
            
// Guild
            
entity[SRAttribute.GuildName] = packet.ReadAscii();
            if (!((
SRObjectCollection)entity[SRAttribute.Inventory]).ContainsJobEquipment())
            {
                
entity[SRAttribute.GuildID] = packet.ReadUInt();
                
entity[SRAttribute.GuildMemberName] = packet.ReadAscii();
                
entity[SRAttribute.GuildLastCrestRev] = packet.ReadUInt();
                
entity[SRAttribute.UnionID] = packet.ReadUInt();
                
entity[SRAttribute.UnionLastCrestRev] = packet.ReadUInt();
                
entity[SRAttribute.GuildisFriendly] = packet.ReadByte();
                
entity[SRAttribute.GuildMemberAuthorityType] = packet.ReadByte();
            }
            if ((
byte)entity[SRAttribute.InteractMode] == Types.InteractMode.P2N_TALK)
            {
                
entity[SRAttribute.StallName] = packet.ReadAscii();
                
entity[SRAttribute.DecorationItemID] = packet.ReadUInt();
            }
            
entity[SRAttribute.EquipmentCooldown] = packet.ReadByte();
            
entity[SRAttribute.PVPCaptureTheFlagType] = packet.ReadByte();
        }
        else if (
entity.ID2 == 2)
        {
            
// NPC
            
entity[SRAttribute.hasTalk] = packet.ReadByte() != 0;
            if ((bool)
entity[SRAttribute.hasTalk])
            {
                
entity[SRAttribute.TalkOptions] = packet.ReadUInt8Array(packet.ReadByte());
            }
            if (
entity.ID3 == 1)
            {
                
// NPC_MOB
                
entity[SRAttribute.Rarity] = packet.ReadByte();
                if (
entity.ID4 == || entity.ID4 == 4)
                {
                    
// has multiple appearances (Selected by server)
                    
entity[SRAttribute.Appearance] = packet.ReadByte();
                }
            }
            if (
entity.ID3 == 3)
            {
                
// NPC_COS
                
if (entity.ID4 == || entity.ID4 == 4)
                {
                    
//NPC_COS_P (Growth / Ability)
                    
entity[SRAttribute.Name] = packet.ReadAscii();
                }
                if (
entity.ID4 == 5)
                {
                    
// NPC_COS_GUILD
                    
entity[SRAttribute.GuildName] = packet.ReadAscii();
                }
                else if (
entity.ID4 != 1)
                {
                    
entity[SRAttribute.OwnerName] = packet.ReadAscii();
                }
                if (
entity.ID4 == || entity.ID4 == || entity.ID4 == || entity.ID4 == 5)
                {
                    
// NPC_COS_T
                    // NPC_COS_P (Growth / Ability)
                    // NPC_COS_GUILD
                    
entity[SRAttribute.JobType] = packet.ReadByte();
                    if (
entity.ID4 != 4)
                    {
                        
// Not pet pick (Ability)
                        
entity[SRAttribute.PVPState] = packet.ReadByte();
                    }
                    if (
entity.ID4 == 5)
                    {
                        
// NPC_COS_GUILD
                        
entity[SRAttribute.OwnerRefObjID] = packet.ReadUInt();
                    }
                }
                if (
entity.ID4 != 1)
                {
                    
entity[SRAttribute.OwnerUniqueID] = packet.ReadUInt();
                }
            }
            else if (
entity.ID3 == 4)
            {
                
// NPC_FORTRESS_COS
                
entity[SRAttribute.GuildID] = packet.ReadUInt();
                
entity[SRAttribute.GuildName] = packet.ReadAscii();
            }
        }
    }
    else if (
entity.ID1 == 3)
    {
        
// ITEM_
        // - ITEM_EQUIP
        // - ITEM_ETC
        //   - ITEM_ETC_MONEY_GOLD
        //   - ITEM_ETC_TRADE
        //   - ITEM_ETC_QUEST   
        
if (entity.ID2 == 1)
        {
            
// ITEM_EQUIP
            
entity[SRAttribute.ItemOptLevel] = packet.ReadByte();
        }
        else if (
entity.ID2 == 3)
        {
            
// ITEM_ETC
            
if (entity.ID3 == && entity.ID4 == 0)
            {
                
// ITEM_ETC_MONEY_GOLD
                
entity[SRAttribute.Gold] = packet.ReadUInt();
            }
            else if (
entity.ID3 == || entity.ID3 == 9)
            {
                
// ITEM_ETC_TRADE
                // ITEM_ETC_QUEST
                
entity[SRAttribute.OwnerName] = packet.ReadAscii();
            }
        }
        
entity[SRAttribute.UniqueID] = packet.ReadUInt();
        
entity[SRAttribute.Region] = packet.ReadUShort();
        
entity[SRAttribute.X] = packet.ReadSingle();
        
entity[SRAttribute.Y] = packet.ReadSingle();
        
entity[SRAttribute.Z] = packet.ReadSingle();
        
entity[SRAttribute.Angle] = packet.ReadUShort();
        
entity[SRAttribute.hasOwner] = packet.ReadByte();
        if ((
byte)entity[SRAttribute.hasOwner] == 1)
        {
            
entity[SRAttribute.OwnerJID] = packet.ReadUInt();
        }
        
entity[SRAttribute.Rarity] = packet.ReadByte();
    }
    else if (
entity.ID1 == 4)
    {
        
// PORTALS
        // - STORE
        // - INS_TELEPORTER
        
entity[SRAttribute.UniqueID] = packet.ReadUInt();
        
entity[SRAttribute.Region] = packet.ReadUShort();
        
entity[SRAttribute.X] = packet.ReadSingle();
        
entity[SRAttribute.Y] = packet.ReadSingle();
        
entity[SRAttribute.Z] = packet.ReadSingle();
        
entity[SRAttribute.Angle] = packet.ReadUShort();

        
entity[SRAttribute.unkByte0] = packet.ReadByte();
        
entity[SRAttribute.unkByte1] = packet.ReadByte();
        
entity[SRAttribute.unkByte2] = packet.ReadByte();
        
entity[SRAttribute.unkByte3] = packet.ReadByte();
        if ((
byte)entity[SRAttribute.unkByte3] == 1)
        {
            
// Regular
            
entity[SRAttribute.unkUInt0] = packet.ReadUInt();
            
entity[SRAttribute.unkUInt1] = packet.ReadUInt();
        }
        else if ((
byte)entity[SRAttribute.unkByte3] == 3)
        {
            
// Dimensional Hole
            
entity[SRAttribute.OwnerName] = packet.ReadAscii();
            
entity[SRAttribute.OwnerUniqueID] = packet.ReadUInt();
        }
        if ((
byte)entity[SRAttribute.unkByte1] == 1)
        {
            
// STORE_EVENTZONE_DEFAULT
            
entity[SRAttribute.unkUInt2] = packet.ReadUInt();
            
entity[SRAttribute.unkByte5] = packet.ReadByte();
        }
    }
    else if (
entity.ID == uint.MaxValue)
    {
        
// EVENT_ZONE (Traps, Buffzones, ...)
        
entity[SRAttribute.unkUShort0] = packet.ReadUShort();
        
entity[SRAttribute.refSkillID] = packet.ReadUInt();
        
entity[SRAttribute.UniqueID] = packet.ReadUInt();
        
entity[SRAttribute.Region] = packet.ReadUShort();
        
entity[SRAttribute.X] = packet.ReadSingle();
        
entity[SRAttribute.Y] = packet.ReadSingle();
        
entity[SRAttribute.Z] = packet.ReadSingle();
        
entity[SRAttribute.Angle] = packet.ReadUShort();
    }
    if (
packet.Opcode == Agent.Opcode.SERVER_ENTITY_SPAWN)
    {
        if (
entity.ID1 == || entity.ID1 == 4)
        {
            
// BIONIC or STORE
            
entity[SRAttribute.unkByte6] = packet.ReadByte();
        }
        else if (
entity.ID1 == 3)
        {
            
// DROP
            
entity[SRAttribute.DropSource] = packet.ReadByte();
            
entity[SRAttribute.UniqueID] = packet.ReadUInt();
        }
    }
    
// End of Packet

    // Keep the track of the entity
    
Info.Get.EntityList.Add(entity);

    
// Update GUI
    
Window w Window.Get;
    
w.TESTING_AddSpawn(entity);



JellyBitz is offline  
Reply



« Style Janghan How to change ? | Movement packets »

Similar Threads
EntitySpawn (5378+)
03/26/2011 - CO2 PServer - Discussions / Questions - 7 Replies
Thank you .Kinshi, Thank you Impulse. Thank you Moderator for closing this (in advance) :D #request close.
[RELEASE] 5298 EntitySpawn Packet Structures
09/13/2010 - CO2 PServer Guides & Releases - 12 Replies
Entity Spawn: (10014) Spoiler: Offset| Type | Value 0 | Short | Size 2 | Short | Type 75 | Byte | Level 78 | Short | HairStyle 80 | Short | CharX 82 | Short | CharY 123 | int | QuizPoints



All times are GMT +2. The time now is 21:46.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 3KeUpz52VCbhmLwuwydqxu6U1xsgbT8YT5
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2019 elitepvpers All Rights Reserved.