public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int plID, value;
            byte changeType;
            byte talentType;

            stream.Read(out plID);
            stream.Read(out changeType);
            stream.Read(out talentType);
            stream.Read(out value);

            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
                throw new Exception("Vob not found!");
            Vob vob = sWorld.VobDict[plID];
            if (!(vob is NPCProto))
                throw new Exception("Vob is not an NPC!");

            NPCProto proto = (NPCProto)vob;

            if (changeType == (byte)ChangeSkillType.Hitchances)
                proto.Hitchances[talentType] = value;
            else if (changeType == (byte)ChangeSkillType.Skill)
                proto.TalentSkills[talentType] = value;
            else if (changeType == (byte)ChangeSkillType.Value)
                proto.TalentValues[talentType] = value;
            else
                throw new Exception("Does not know type: "+changeType);

            if (vob.Address == 0)
                return;

            Process process = Process.ThisProcess();
            oCNpc npc = new oCNpc(process, vob.Address);
            if (changeType == (byte)ChangeSkillType.Hitchances)
                npc.SetHitChances(talentType, value);
            else if (changeType == (byte)ChangeSkillType.Skill)
                npc.SetTalentSkill(talentType, value);
            else if (changeType == (byte)ChangeSkillType.Value)
                npc.SetTalentValue(talentType, value);
            
        }
        public override void Spawn(String map, Vec3f position, Vec3f direction)
        {
            this.Map       = map;
            this.Position  = position;
            this.Direction = direction;

            spawned = true;

            if (this.Address != 0)
            {
                return;
            }

            if (this.Map != Player.Hero.Map)
            {
                return;
            }
            Process process = Process.ThisProcess();
            oCNpc   npc     = oCObjectFactory.GetFactory(process).CreateNPC("OTHERS_NPC");

            this.Address = npc.Address;
            sWorld.SpawnedVobDict.Add(npc.Address, this);

            if (npc.MagBook == null || npc.MagBook.Address == 0)
            {
                npc.MagBook = oCMag_Book.Create(process);
                npc.MagBook.SetOwner(npc);
            }


            setHideNames(this.hideName);

            for (int i = 0; i < this.Attributes.Length; i++)
            {
                npc.setAttributes((byte)i, this.Attributes[i]);
            }

            for (int i = 0; i < this.TalentSkills.Length; i++)
            {
                npc.SetTalentSkill(i, this.TalentSkills[i]);
            }
            for (int i = 0; i < this.TalentValues.Length; i++)
            {
                npc.SetTalentValue(i, this.TalentValues[i]);
            }
            for (int i = 0; i < this.Hitchances.Length; i++)
            {
                npc.SetHitChances(i, this.Hitchances[i]);
            }

            npc.SetVisual(this.Visual);
            npc.SetAdditionalVisuals(BodyMesh, bodyTex, skinColor, HeadMesh, headTex, teethTex, -1);



            //npc.HumanAI = new oCAiHuman(process, 0);
            //npc.AniCtrl = new oCAniCtrl_Human(process, 0);



            this.setDirection(direction);
            //Enable(Position);



            foreach (Item it in itemList)
            {
                this.addItemToContainer(it);
            }
            foreach (Item it in EquippedList)
            {
                if (!it.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_ARMOR) && !it.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_FF) && !it.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_NF))
                {
                    hNpc.blockSendEquip = true;
                    npc.Equip(new oCItem(process, it.Address));
                }
            }
            //if (this.Armor != null)
            //    setArmor(this.Armor);
            if (this.Weapon != null)
            {
                setWeapon(this.Weapon);
            }
            if (this.RangeWeapon != null)
            {
                setRangeWeapon(this.RangeWeapon);
            }

            for (int i = 0; i < Slots.Length; i++)
            {
                if (Slots[i] != null)
                {
                    setSlotItem(i, Slots[i]);
                }
            }

            foreach (String act in Overlays)
            {
                zString overlayStr = zString.Create(process, act);
                npc.ApplyOverlay(overlayStr);
                overlayStr.Dispose();
            }



            setScale(this.Scale);
            setFatness(this.Fatness);
            setWeaponMode(this.WeaponMode);

            if (enabled)
            {
                Enable(this.Position);
            }

            this.setInvisible(this.IsInvisible);
        }