Beispiel #1
0
        public static bool TryGetDef <T>(int id, out T def) where T : BaseVobDef
        {
            BaseVobInstance instance;

            if (BaseVobInstance.TryGet(id, out instance) && instance.ScriptObject is T)
            {
                def = (T)instance.ScriptObject;
                return(true);
            }
            def = default(T);
            return(false);
        }
Beispiel #2
0
        public void ReadEquipProperties(PacketReader stream)
        {
            this.ID = stream.ReadByte();

            ushort       instanceID = stream.ReadUShort();
            ItemInstance inst;

            if (!BaseVobInstance.TryGet(instanceID, out inst))
            {
                throw new Exception("ItemInstance-ID not found! " + instanceID);
            }
            SetInstance(inst);

            this.ScriptObject.ReadEquipProperties(stream);
        }
Beispiel #3
0
        public void ReadInventoryProperties(PacketReader stream)
        {
            ushort       instanceid = stream.ReadUShort();
            ItemInstance inst;

            if (!BaseVobInstance.TryGet(instanceid, out inst))
            {
                throw new Exception("Instance-ID not found! " + instanceid);
            }
            SetInstance(inst);

            this.amount = stream.ReadUShort();

            this.ScriptObject.ReadInventoryProperties(stream);
        }
Beispiel #4
0
        protected override void ReadProperties(PacketReader stream)
        {
            base.ReadProperties(stream);

            int             instanceID = stream.ReadUShort();
            BaseVobInstance inst;

            if (!BaseVobInstance.TryGet(instanceID, out inst))
            {
                throw new Exception("Instance ID not found! " + instanceID);
            }
            SetInstance(inst);

            this.pos = stream.ReadVec3f();
            this.ang = stream.ReadAngles();
        }