示例#1
0
        public static void F_INTERACT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
            {
                return;
            }

            if (cclient.Plr.IsDead)
            {
                return;
            }

            // don't change anything here or it will brake loot dyes and alot of other stuff !!!!!!!!!!!!!!!!

            InteractMenu Menu = new InteractMenu();

            Menu.Unk  = packet.GetUint16();
            Menu.Oid  = packet.GetUint16();
            Menu.Menu = packet.GetUint16();
            Menu.Page = packet.GetUint8();
            Menu.Num  = packet.GetUint8();
            //ushort unk1 = packet.GetUint16();
            Menu.Count = packet.GetUint16();

            // don't change anything here or it will brake loot dyes and alot of other stuff !!!!!!!!!!!!!!!!

            // loot need greed pass
            if (Menu.Oid == 4207 && cclient.Plr.PriorityGroup != null)
            {
                Menu.Packet = packet;
                cclient.Plr.PriorityGroup.LootVote(cclient.Plr, Menu.Num, Menu.Packet.GetUint16());
            }

            Object Obj = cclient.Plr.Region.GetObject(Menu.Oid);

            if (Obj == null)
            {
                return;
            }

            if (!Obj.AllowInteract(cclient.Plr))
            {
                //Log.Error("F_INTERACT", "Distance = " + Obj.GetDistanceBetweenObjects(cclient.Plr));
                return;
            }

            //this is to prevent double clicking on doors and getting ported back to original clicking position
            if (cclient.Plr.LastInteractTime.HasValue && DateTime.Now.Subtract(cclient.Plr.LastInteractTime.Value).TotalMilliseconds < 500)
            {
                //Log.Error("F_INTERACT", "InteractTime < 1500ms");
                return;
            }

            Menu.Packet = packet;
            Obj.SendInteract(cclient.Plr, Menu);
            if (Obj is GameObject)
            {
                cclient.Plr.LastInteractTime = DateTime.Now;
            }
        }