예제 #1
0
        public static void NonlocalOverheadMessage(this Item item, MessageType type, int hue, bool ascii, string text)
        {
            if (item == null || item.Map == null)
            {
                return;
            }

            Packet p;

            if (ascii)
            {
                p = new AsciiMessage(item.Serial, item.ItemID, type, hue, 3, item.Name, text);
            }
            else
            {
                p = new UnicodeMessage(item.Serial, item.ItemID, type, hue, 3, "ENU", item.Name, text);
            }

            p.Acquire();

            var eable = item.Map.GetClientsInRange(item.Location, item.GetMaxUpdateRange());

            foreach (var state in eable.Where(state => state.Mobile.CanSee(item)))
            {
                state.Send(p);
            }

            eable.Free();

            Packet.Release(p);
        }
예제 #2
0
        public static void NonlocalOverheadMessage(this Item item, MessageType type, int hue, int number, string args)
        {
            if (item == null || item.Map == null)
            {
                return;
            }

            var p = Packet.Acquire(new MessageLocalized(item.Serial, item.ItemID, type, hue, 3, number, item.Name, args));

            var eable = item.Map.GetClientsInRange(item.Location, item.GetMaxUpdateRange());

            foreach (var state in eable.Where(state => state.Mobile.CanSee(item)))
            {
                state.Send(p);
            }

            eable.Free();

            Packet.Release(p);
        }
예제 #3
0
        public static void PublicOverheadItemMessage(Item item, MessageType type, int hue, int font, string text)
        {
            if (item != null && item.Map != null)
            {
                Packet p = null;
                Point3D worldLoc = item.GetWorldLocation();

                IPooledEnumerable eable = item.Map.GetClientsInRange(worldLoc, item.GetMaxUpdateRange());

                foreach (NetState state in eable)
                {
                    Mobile m = state.Mobile;

                    if (m.CanSee(item) && m.InRange(worldLoc, item.GetUpdateRange(m)))
                    {
                        if (p == null)
                        {
                            p = new AsciiMessage(item.Serial, item.ItemID, type, hue, font, item.Name, text);

                            p.Acquire();
                        }

                        state.Send(p);
                    }
                }

                Packet.Release(p);

                eable.Free();
            }
        }