예제 #1
0
        public WorldObjectRef ReadNextWorldObjectRef(Stream src)
        {
            WorldObjectRef objRef = new WorldObjectRef();

            objRef.rootObject   = ReadNextString(src);
            objRef.instanceName = ReadNextString(src);

            if (objRef.rootObject == string.Empty && objRef.instanceName == string.Empty)
            {
                return(null);
            }

            return(objRef);
        }
예제 #2
0
        public WorldObjectProperties ReadNextWorldObjectProperties(Stream src, Int32 objectType)
        {
            WorldObjectProperties properties = new WorldObjectProperties();

            properties.properties = new List <WorldObjectProperty>();
            properties.size       = ReadNextInt32(src);
            Int64 start = src.Position;

            // entity
            if (objectType == 1)
            {
                properties.parentId      = ReadNextWorldObjectRef(src);
                properties.childrenCount = ReadNextInt32(src);

                for (int i = 0; i < properties.childrenCount; i++)
                {
                    WorldObjectRef child = ReadNextWorldObjectRef(src);
                    if (child != null)
                    {
                        if (properties.children == null)
                        {
                            properties.children = new List <WorldObjectRef>();
                        }

                        properties.children.Add(child);
                    }
                }
            }

            long notReaded = start + properties.size - src.Position;

            while (notReaded > 0)
            {
                WorldObjectProperty prop = ReadNextWorldObjectProperty(src);
                notReaded = start + properties.size - src.Position;
                if (prop == null)
                {
                    break;
                }

                properties.properties.Add(prop);
            }

            if (notReaded > 0)
            {
                src.Position += notReaded; // skip unknown
            }

            return(properties);
        }
예제 #3
0
        public WorldObject(Models.WorldObject obj2, Models.WorldObject obj1)
        {
            this.id = obj2 != null ? obj2.id : obj1.id;
            bool obj2Null = obj2 == null;
            bool obj1Null = obj1 == null;

            this._type     = new Property <Int32>();
            this._typePath = new Property <string>();
            this._value    = new WorldObjectData();

            if (obj2 != null)
            {
                this._type.to     = obj2.type;
                this._typePath.to = obj2.typePath;
                this._value.objTo = obj2.value;
            }

            if (obj1 != null)
            {
                this._type.from     = obj1.type;
                this._typePath.from = obj1.typePath;
                this._value.objFrom = obj1.value;
            }
        }