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);

            zVec3 pos = npc.GetPosition();

            npc.ResetPos(pos);
            pos.Dispose();
        }
示例#2
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server)
        {
            int itemID = 0;
            int amount = 0;

            stream.Read(out itemID);
            stream.Read(out amount);


            if (itemID == 0 || !sWorld.VobDict.ContainsKey(itemID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[itemID];

            if (!(vob is Item))
            {
                throw new Exception("Vob is not an item");
            }

            Item item = (Item)vob;

            if (item.Container is NPCProto)
            {
                NPCProto proto = (NPCProto)item.Container;
                proto.removeItem(item, amount);

                Scripting.Objects.Character.NPCProto.isOnUseItem(proto.ScriptingNPC, item.ScriptingProto, -1, -2);
            }

            Write(item, packet.systemAddress);
        }
示例#3
0
        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 Player))
            {
                throw new Exception("Vob is not an Player!");
            }

            if (Player.Hero == vob)
            {
                return;
            }

            vob.Despawn();
            sWorld.removeVob(vob);
        }
示例#4
0
        public static void Write(NPCProto proto, Item itm, Vob target, Spell spell, AddressOrGUID guidExclude)
        {
            BitStream stream = Program.server.SendBitStream;

            stream.Reset();
            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.CastSpell);

            stream.Write(itm.ID);
            stream.Write(proto.ID);
            if (target == null)
            {
                stream.Write(0);
            }
            else
            {
                stream.Write(target.ID);
            }
            if (spell == null)
            {
                stream.Write(0);
            }
            else
            {
                stream.Write(spell.ID);
            }

            if (guidExclude == null)
            {
                guidExclude = RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS;
            }
            Program.server.ServerInterface.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, guidExclude, true);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int playerID = 0;
            int slot = 0, itemID = 0;

            stream.Read(out playerID);
            stream.Read(out slot);
            stream.Read(out itemID);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            Vob  itemVob = null;
            Item item    = null;

            if (itemID != 0)
            {
                sWorld.VobDict.TryGetValue(itemID, out itemVob);
            }
            if (itemVob != null && itemVob is Item)
            {
                item = (Item)itemVob;
            }

            //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Set Slot Item 3: " + slot + "; NewItem: " + item + ", " + itemVob + ", " + itemID + ", " + playerID, 0, "NPCProto.Client.cs", 0);
            ((NPCProto)vob).setSlotItem(slot, item);
        }
示例#6
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   playerID = 0;
            float fatness  = 1f;

            stream.Read(out playerID);
            stream.Read(out fatness);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            ((NPCProto)vob).Fatness = fatness;

            if (vob.Address != 0)
            {
                ((NPCProto)vob).setFatness(fatness);
            }
        }
示例#7
0
        public static Int32 oCStartAnim_ModelAnim(String message)
        {
            int     address = Convert.ToInt32(message);
            Process process = Process.ThisProcess();
            int     err     = 0;

            try
            {
                err = 1;
                zCModel thisModel = new zCModel(process, process.ReadInt(address));
                err = 2;
                int ownerAddress = thisModel.Owner.Address;
                err = 3;
                if (!sWorld.SpawnedVobDict.ContainsKey(ownerAddress))
                {
                    return(0);
                }
                Vob v = sWorld.SpawnedVobDict[ownerAddress];
                if (!(v is NPCProto))
                {
                    return(0);
                }

                NPCProto player = (NPCProto)v;
                if (player == null)
                {
                    return(0);
                }

                if (player != Player.Hero)
                {
                    return(0);
                }

                zCModelAni modelAni = new zCModelAni(process, process.ReadInt(address + 4));
                if (modelAni == null || modelAni.Address == 0)
                {
                    return(0);
                }



                int aniID = modelAni.GetAniID();
                //String name = modelAni.AniName.Value.Trim();//Works
                if (player.Animation == aniID)
                {
                    return(0);
                }

                player.Animation = (short)aniID;
                AnimationUpdateMessage.Write(player);
            }
            catch (Exception ex)
            {
                zERROR.GetZErr(process).Report(2, 'G', err + "Exception: " + ex.Message + " " + ex.StackTrace + " " + ex.Source, 0, "Program.cs", 0);
            }


            return(0);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   plID     = 0;
            Vec3f position = new Vec3f();
            bool  enabled  = false;

            stream.Read(out plID);
            stream.Read(out position);
            stream.Read(out enabled);


            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
            {
                throw new Exception("Vob not found! " + plID);
            }
            Vob vob = sWorld.VobDict[plID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPC!");
            }

            //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Enable: "+enabled, 0, "Program.cs", 0);

            if (enabled)
            {
                ((NPCProto)vob).Enable(position);
            }
            else
            {
                ((NPCProto)vob).Disable();
            }
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int playerID   = 0;
            int weaponMode = 0;

            stream.Read(out playerID);
            stream.Read(out weaponMode);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            ((NPCProto)vob).WeaponMode = weaponMode;

            if (vob.Address != 0)
            {
                ((NPCProto)vob).setWeaponMode(weaponMode);
            }
        }
示例#10
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int casterID = 0, targetID = 0, spellID = 0, itemID = 0;

            stream.Read(out itemID);
            stream.Read(out casterID);
            stream.Read(out targetID);
            stream.Read(out spellID);


            Vob  itemVob = null;
            Item item    = null;

            Vob   casterVob = null;
            Spell spell     = null;

            NPCProto caster = null;
            Vob      target = null;

            sWorld.VobDict.TryGetValue(casterID, out casterVob);
            sWorld.VobDict.TryGetValue(itemID, out itemVob);

            if (casterVob == null)
            {
                throw new Exception("Caster was not found!");
            }
            if (!(casterVob is NPCProto))
            {
                throw new Exception("Caster was not a npcproto " + casterVob);
            }
            caster = (NPCProto)casterVob;
            if (targetID != 0)
            {
                sWorld.VobDict.TryGetValue(targetID, out target);
            }

            Spell.SpellDict.TryGetValue(spellID, out spell);
            if (spell == null)
            {
                throw new Exception("Spell can not be null!");
            }



            if (caster.Address == 0)
            {
                return;
            }
            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, caster.Address);

            if (target != null)
            {
                npc.MagBook.Spell_Setup(npc, new zCVob(process, target.Address), 0);
            }
            //npc.MagBook.GetSelectedSpell().Target = new zCVob(process, target.Address);
            npc.MagBook.SpellCast();

            zERROR.GetZErr(process).Report(2, 'G', "Cast Spell! 2 ", 0, "Program.cs", 0);
        }
        public override void update(ActionTimer timer)
        {
            if (mToNpc == 0)
            {
                //Startup.chat.MessageBox.addLine(new ColorRGBA(mR, mG, mB, mA), mMessage);
                ChatMessage message = new ChatMessage(null, null, ChatMessageType.PM, mMessage);
                message.Color = new ColorRGBA(mR, mG, mB, mA);
                NotificationManager.GetNotificationManager().DisplayNotification(message);
                completed = true;
            }
            else
            {
                Vob v = Player.getVob(mToNpc);
                if (v != null && v is Player)
                {
                    //Startup.chat.MessageBox.addLine((Player)v, new ColorRGBA(mR, mG, mB, mA), mMessage);
                    ChatMessage message = new ChatMessage(null, (Player)v, ChatMessageType.PM, mMessage);
                    message.Color = new ColorRGBA(mR, mG, mB, mA);
                    NotificationManager.GetNotificationManager().DisplayNotification(message);
                    completed = true;
                }
            }



            isFinished = true;
            timer.removeAction(this);
        }
        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);
        }
示例#13
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int callBackID = 0, npcID = 0, vobID = 0;

            stream.Read(out callBackID);
            stream.Read(out npcID);
            stream.Read(out vobID);

            if (!sWorld.VobDict.ContainsKey(npcID) || !sWorld.VobDict.ContainsKey(vobID))
            {
                throw new Exception("Vob or NPC weren't in the List!");
            }

            NPCProto proto = (NPCProto)sWorld.VobDict[npcID];
            Vob      vob   = (Vob)sWorld.VobDict[vobID];

            bool canSee = false;

            if (proto.Address != 0 && vob.Address == 0)
            {
                canSee = (new oCNpc(Process.ThisProcess(), proto.Address).CanSee(new zCVob(Process.ThisProcess(), vob.Address), 0) == 1) ? true : false;
            }

            stream.Reset();
            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.CallbackNPCCanSee);
            stream.Write(callBackID);
            stream.Write(proto.ID);
            stream.Write(vob.ID);
            stream.Write(canSee);

            Program.client.client.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS, true);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server)
        {
            int casterID = 0;

            stream.Read(out casterID);


            Vob      casterVob = null;
            NPCProto caster    = null;

            sWorld.VobDict.TryGetValue(casterID, out casterVob);


            if (casterVob == null)
            {
                throw new Exception("Caster was not found!");
            }
            if (!(casterVob is NPCProto))
            {
                throw new Exception("Caster was not a npcproto " + casterVob);
            }
            caster = (NPCProto)casterVob;



            Write(caster, packet.guid);
        }
示例#15
0
        public static Int32 AniCtrl_InitAnimations(String message)
        {
            Process Process = Process.ThisProcess();

            try
            {
                int address = Convert.ToInt32(message);

                oCAniCtrl_Human aniCtrl = new oCAniCtrl_Human(Process, Process.ReadInt(address));

                int npcAddress = aniCtrl.NPC.Address;

                Vob vob = null;
                sWorld.SpawnedVobDict.TryGetValue(npcAddress, out vob);

                if (vob == null)
                {
                    return(0);
                }

                aniCtrl.WMode = ((NPCProto)vob).WeaponMode;
            }
            catch (Exception ex)
            {
                zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Exception: " + ex.Message + " " + ex.StackTrace + " " + ex.Source, 0, "Program.cs", 0);
            }
            return(0);
        }
示例#16
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int  plID, value;
            byte attribType;

            stream.Read(out plID);
            stream.Read(out attribType);
            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;

            proto.Attributes[attribType] = value;

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

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

            npc.setAttributes(attribType, value);
        }
示例#17
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server)
        {
            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 oldAnim = ((NPCProto)vob).Animation;

            ((NPCProto)vob).Animation = anim;


            Write((NPCProto)vob, packet.guid);

            Scripting.Objects.Character.NPCProto.isOnAnimation(((NPCProto)vob).ScriptingNPC, anim, oldAnim);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server)
        {
            int vobCount = 0;

            stream.Read(out vobCount);

            List <Vob> vobList = new List <Vob>();

            for (int i = 0; i < vobCount; i++)
            {
                int   vobID = 0;
                Vec3f pos, dir;

                stream.Read(out vobID);
                stream.Read(out pos);
                stream.Read(out dir);

                if (vobID == 0 || !sWorld.VobDict.ContainsKey(vobID))
                {
                    throw new Exception("Vob not found!");
                }
                Vob vob = sWorld.VobDict[vobID];
                vob.Position  = pos;
                vob.Direction = dir;

                vobList.Add(vob);
            }


            Write(vobList, packet.systemAddress);
        }
示例#19
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   playerID = 0;
            Vec3f scale    = new Vec3f();

            stream.Read(out playerID);
            stream.Read(out scale);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            ((NPCProto)vob).Scale = scale;

            if (vob.Address != 0)
            {
                ((NPCProto)vob).setScale(scale);
            }
        }
示例#20
0
        internal Model(Vob vob, IScriptModel scriptObject) : base(scriptObject)
        {
            if (vob == null)
            {
                throw new ArgumentNullException("Vob is null!");
            }

            this.vob = vob;
            pConstruct();
        }
示例#21
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int    vobID = 0, targetID = 0, effectLevel = 0, damage = 0, damageType = 0;
            bool   isProjectile = false;
            String effect       = "";

            stream.Read(out vobID);
            stream.Read(out effect);
            stream.Read(out targetID);
            stream.Read(out effectLevel);
            stream.Read(out damage);
            stream.Read(out damageType);
            stream.Read(out isProjectile);


            Vob vob = null;

            sWorld.VobDict.TryGetValue(vobID, out vob);
            if (vob == null)
            {
                throw new Exception("Vob was not found: " + vobID);
            }

            Vob targetVob = null;

            if (vobID != 0)
            {
                sWorld.VobDict.TryGetValue(targetID, out targetVob);
                if (targetVob == null)
                {
                    throw new Exception("Target-Vob was not found: " + vobID);
                }
            }

            if (vob.Address == 0 || !vob.IsSpawned)
            {
                return;
            }
            Process process    = Process.ThisProcess();
            zCVob   gVob       = new zCVob(process, vob.Address);
            zCVob   gTargetVob = null;

            if (targetVob != null && targetVob.Address != 0 && targetVob.IsSpawned)
            {
                gTargetVob = new zCVob(process, targetVob.Address);
            }
            else
            {
                gTargetVob = new zCVob(process, 0);
            }


            using (zString str = zString.Create(process, effect))
                oCVisualFX.CreateAndPlay(process, str, gVob, gTargetVob, effectLevel, damage, damageType, isProjectile ? 1 : 0);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int itemID = 0, amount = 0;

            stream.Read(out itemID);
            stream.Read(out amount);

            if (itemID == 0 || !sWorld.VobDict.ContainsKey(itemID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[itemID];

            if (!(vob is Item))
            {
                throw new Exception("Vob is not an Item!");
            }

            Item item = (Item)vob;

            item.Amount = amount;


            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Item-Change-Amount message!", 0, "Program.cs", 0);

            if (item.Address != 0)
            {
                Process process = Process.ThisProcess();
                oCItem  gI      = new oCItem(process, item.Address);


                if (item.Amount <= 0)
                {
                    if (item.Container is NPCProto)
                    {
                        new oCNpc(process, ((NPCProto)item.Container).Address).RemoveFromInv(gI, gI.Amount);
                    }
                    else if (item.Container is MobContainer)
                    {
                        new oCMobContainer(process, ((MobContainer)item.Container).Address).Remove(gI, gI.Amount);
                    }
                    else if (item.Container is World)
                    {
                        oCGame.Game(process).World.RemoveVob(gI);
                    }
                }

                gI.Amount = item.Amount;
            }

            if (item.Amount <= 0)
            {
                sWorld.removeVob(item);
            }
        }
示例#23
0
        public static void Write(Vob vob, AddressOrGUID addguid)
        {
            BitStream stream = Program.server.SendBitStream;

            stream.Reset();

            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.DespawnVobMessage);
            stream.Write(vob.ID);

            Program.server.ServerInterface.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, addguid, true);
        }
示例#24
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int itemID, containerID;

            stream.Read(out itemID);
            stream.Read(out containerID);

            if (!sWorld.VobDict.ContainsKey(itemID))
            {
                throw new Exception("ItemID was not found!: " + itemID);
            }
            if (!sWorld.VobDict.ContainsKey(containerID))
            {
                throw new Exception("ContainerID was not found!: " + itemID);
            }

            Vob itemVob      = sWorld.VobDict[itemID];
            Vob containerVob = sWorld.VobDict[containerID];

            if (!(itemVob is Item))
            {
                throw new Exception("ItemVob is not an Item! " + itemVob);
            }
            if (!(containerVob is IContainer))
            {
                throw new Exception("Container is not an IContainer! " + containerVob);
            }

            Item       item      = (Item)itemVob;
            IContainer container = (IContainer)containerVob;

            if (item.Container is MobContainer)
            {
                MobContainer itC = (MobContainer)item.Container;
                if (itC.Address != 0)
                {
                    new oCMobContainer(Process.ThisProcess(), itC.Address).Remove(new oCItem(Process.ThisProcess(), item.Address));
                }
            }
            else if (item.Container is NPCProto)
            {
                NPCProto itC = (NPCProto)item.Container;
                if (itC.Address != 0)
                {
                    new oCNpc(Process.ThisProcess(), itC.Address).RemoveFromInv(new oCItem(Process.ThisProcess(), item.Address), item.Amount);
                }
            }

            container.addItem(item);

            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Item-Change-Container message!", 0, "Program.cs", 0);
        }
示例#25
0
        protected void cast(NPCProto caster, Spell spell, Vob target)
        {
            if (target == null || !(target is NPCProto))
            {
                return;
            }

            NPCProto targetNPC = (NPCProto)target;

            //targetNPC.setScale(new Types.Vec3f(0.2f, 0.2f, 0.2f));

            ShrinkTimer st = new ShrinkTimer(targetNPC);
        }
示例#26
0
        public static void Write(Vob proto, AddressOrGUID addGuild)
        {
            BitStream stream = Program.server.SendBitStream;

            stream.Reset();
            stream.Write((byte)RakNet.DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            stream.Write((byte)NetworkID.SetVobPosDirMessage);
            stream.Write(proto.ID);

            stream.Write(proto.Position);
            stream.Write(proto.Direction);

            Program.server.ServerInterface.Send(stream, PacketPriority.LOW_PRIORITY, PacketReliability.UNRELIABLE_SEQUENCED, (char)0, addGuild, true);
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int vobID = 0;

            stream.Read(out vobID);

            if (vobID == 0 || !sWorld.VobDict.ContainsKey(vobID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[vobID];

            sWorld.getWorld(vob.Map).removeVob(vob);
            vob.Despawn();
        }
示例#28
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Server server)
        {
            int    plID      = 0;
            String levelName = "";

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

            Vob pl = sWorld.VobDict[plID];

            sWorld.getWorld(levelName).addVob(pl);

            stream.ResetReadPointer();
            Program.server.ServerInterface.Send(stream, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, packet.guid, true);
        }
        public static void log_Event(LOGEventTypes let, Player player, Vob interact, String message)
        {
            if (player.getAccount() == null || !player.IsSpawned())
            {
                return;
            }

            long  accountID   = player.getAccount().accountID;
            long  interactID  = 0;
            short lastPing    = (short)player.LastPing;
            short averagePing = (short)player.AveragePing;
            long  now         = DateTime.Now.Ticks;

            if (message == null)
            {
                message = "";
            }

            if (interact != null && !(interact is Player))
            {
                message += "Interact-Vob: " + interact.ID + ": " + interact.Visual + ", " + interact;
            }
            else if (interact != null && interact is Player && ((Player)interact).getAccount() != null)
            {
                interactID = ((Player)interact).getAccount().accountID;
            }


            lock (connection)
            {
                using (SQLiteCommand command = new SQLiteCommand(connection))
                {
                    command.CommandText  = "INSERT INTO `logEvents` (";
                    command.CommandText += "  `id`, `accountID`, `InteractAccountID`, `type`, `lastPing`, `averagePing`, `time`, `message`)";
                    command.CommandText += "VALUES( NULL, @accID, @interID, @type, @lastPing, @aPing, @time, @message)";

                    command.Parameters.AddWithValue("@accID", accountID);
                    command.Parameters.AddWithValue("@interID", interactID);
                    command.Parameters.AddWithValue("@type", (int)let);
                    command.Parameters.AddWithValue("@lastPing", lastPing);
                    command.Parameters.AddWithValue("@aPing", averagePing);
                    command.Parameters.AddWithValue("@time", now);
                    command.Parameters.AddWithValue("@message", message);

                    command.ExecuteNonQuery();
                }
            }
        }
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   vobID = 0;
            Vec3f dir;

            stream.Read(out vobID);
            stream.Read(out dir);

            if (vobID == 0 || !sWorld.VobDict.ContainsKey(vobID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[vobID];

            vob.setDirection(dir);
        }