public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int plID = 0;

            stream.Read(out plID);

            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!");
            }

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

            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, vob.Address);
            //npc.StartDialogAni();
            zString str = zString.Create(process, "T_DIALOGGESTURE_09");

            npc.GetModel().StartAnimation(str);
            str.Dispose();

            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "npc StartDialog: " + vob.Address, 0, "Client.cs", 0);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   plID = 0;
            short anim = 0;

            stream.Read(out plID);
            stream.Read(out anim);

            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!");
            }

            short oldAni = ((NPCProto)vob).Animation;

            ((NPCProto)vob).Animation          = anim;
            ((NPCProto)vob).AnimationStartTime = Program.Now;

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

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

            if (oldAni != short.MaxValue)
            {
                npc.GetModel().StopAni(oldAni);
            }
            npc.GetModel().StartAni(anim, 0);

            //npc.GetModel().GetAniFromAniID(anim).AniName.Value;
        }
Exemple #3
0
        public void setPosition(Vec3f pos)
        {
            this.Position = pos;



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


            if (this is NPCProto)
            {
                NPCProto proto = (NPCProto)this;

                if (proto.Animation == GUC.States.StartupState.StartJumpID)
                {
                    return;
                }

                if ((proto.Animation == GUC.States.StartupState.TurnLeftID || proto.Animation == GUC.States.StartupState.TurnRightID) && proto.AnimationStartTime + 10000 * 1000 < Program.Now)
                {
                    oCNpc npc = new oCNpc(Process.ThisProcess(), this.Address);
                    npc.GetModel().StopAni(proto.Animation);
                    proto.Animation = short.MaxValue;
                }
            }



            Process process = Process.ThisProcess();
            zCVob   vob     = new zCVob(process, this.Address);

            vob.TrafoObjToWorld.setPosition(this.Position.Data);
            vob.SetPositionWorld(this.Position.Data);
            vob.TrafoObjToWorld.setPosition(this.Position.Data);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            String animation = "";
            byte   start     = 0;
            int    plID      = 0;

            stream.Read(out plID);
            stream.Read(out animation);
            stream.Read(out start);

            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 a NPC!");
            }

            NPCProto npcProto = (NPCProto)vob;

            if (start == 1 && !npcProto.AnimationList.Contains(animation))
            {
                npcProto.AnimationList.Add(animation);
            }
            else if (start == 0 && npcProto.AnimationList.Contains(animation))
            {
                npcProto.AnimationList.Remove(animation);
            }
            else if (start == 2)
            {
                npcProto.Overlays.Add(animation);
            }
            else if (start == 3)
            {
                npcProto.Overlays.Remove(animation);
            }
            else if (start == 4)
            {
                npcProto.Overlays.Clear();
            }
            else if (start == 5 && vob.Address == 0)
            {
                npcProto.AnimationList.Clear();
            }


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

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


            zString str = zString.Create(process, animation);

            if (start == 1)
            {
                npc.GetModel().StartAnimation(str);
            }
            else if (start == 0)
            {
                npc.GetModel().StopAnimation(str);
            }
            else if (start == 2)
            {
                npc.ApplyOverlay(str);
            }
            else if (start == 3)
            {
                npc.RemoveOverlay(str);
            }
            else if (start == 4)
            {
                zCArray <zString> overlays = npc.ActiveOverlays;
                int size = overlays.Size;
                for (int i = size - 1; i >= 0; i--)
                {
                    npc.RemoveOverlay(overlays.get(i));
                }
            }
            else if (start == 5)
            {
                foreach (String iAnim in npcProto.AnimationList)
                {
                    zString iStr = zString.Create(process, iAnim);
                    npc.GetModel().StopAnimation(iStr);
                    iStr.Dispose();
                }
                npcProto.AnimationList.Clear();
            }
            str.Dispose();
        }