public void SetVisual(String aVisual, String aBodyMesh, String aHeadMesh, int aBodyTex, int aSkinColor, int aHeadTex, int aTeethTex)
        {
            String _visual    = aVisual.ToUpper().Trim();
            bool   sameVisual = _visual == this.Visual;

            this.Visual    = _visual;
            this.BodyMesh  = aBodyMesh;
            this.BodyTex   = aBodyTex;
            this.SkinColor = aSkinColor;
            this.HeadMesh  = aHeadMesh;
            this.HeadTex   = aHeadTex;
            this.TeethTex  = aTeethTex;

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

            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, this.Address);

            if (sameVisual)
            {
                npc.SetAdditionalVisuals(BodyMesh, bodyTex, skinColor, HeadMesh, headTex, teethTex, -1);
            }
            else
            {
                npc.ClearOverlays();
                this.Overlays.Clear();


                npc.CloseSpellBook(true);
                npc.SetWeaponMode2(0);
                npc.AniCtrl.SearchStandAni();


                npc.Shrink();

                npc.MDSName.Set(_visual);
                npc.SetAdditionalVisuals(BodyMesh, bodyTex, skinColor, HeadMesh, headTex, teethTex, -1);


                if (this == Player.Hero)
                {
                    npc.UnShrink();
                }
                else
                {
                    npc.AvoidShrink(1000);
                }



                this.setWeaponMode(this.WeaponMode);

                //00AB1F28
            }
        }
Exemple #2
0
        public override zCVob CreateVob(zCVob vob = null)
        {
            oCNpc ret = (vob == null || !(vob is oCNpc)) ? oCNpc.Create() : (oCNpc)vob;

            base.CreateVob(ret);

            ret.Instance = this.ID;
            ret.Name.Set(Name);
            ret.SetAdditionalVisuals(BodyMesh, BodyTex, 0, HeadMesh, HeadTex, 0, -1);
            ret.Guild     = this.Guild;
            ret.TrueGuild = this.guild;
            return(ret);
        }
Exemple #3
0
        static void CreatePlayerVob(Hook hook, RegisterMemory rmem)
        {
            try
            {
                oCNpc player = oCNpc.Create();
                //player.SetVisual("HUMANS.MDS");
                //player.SetAdditionalVisuals("hum_body_Naked0", 9, 0, "Hum_Head_Pony", 2, 0, -1);
                player.SetVisual("Scavenger.mds");
                player.SetAdditionalVisuals("Sca_Body", 0, 0, "", 0, 0, -1);
                player.SetToFistMode();

                player.HPMax = 10;
                player.HP    = 10;

                rmem[Registers.EAX] = player.Address;
            }
            catch (Exception e)
            {
                Logger.LogError(e);
            }
        }
        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);
        }