示例#1
0
 public void DropAnItem(ushort X, ushort Y, byte Level, uint OwnerUID)
 {
     lock (syncroot)
     {
         for (short x = -1; x < 2; x++)
         {
             for (short y = -1; y < 2; y++)
             {
                 ushort nX = (ushort)(X + x);
                 ushort nY = (ushort)(Y + y);
                 if (Coords[nX, nY] < 3)
                 {
                     Coords[nX, nY] += 2;
                     Items.FloorItem Itm = new Items.FloorItem();
                     Itm.ItemID   = (uint)Calculations.GetDropID(Level);
                     Itm.OwnerUID = OwnerUID;
                     Itm.DropTime = Environment.TickCount;
                     Itm.Plus     = Calculations.GetPlus();
                     Itm.UniqueID = Increments.NextItemUID;
                     Itm.X        = nX;
                     Itm.Y        = nY;
                     FloorItems.TryAdd(Itm.UniqueID, Itm);
                     foreach (SocketClient Client in Players.Values)
                     {
                         if (Calculations.GetDistance(Client.Character.X, Client.Character.Y, nX, nY) <= Constants.ScreenDistance)
                         {
                             Client.Character.Screen.Insert(Itm);
                         }
                     }
                     return;
                 }
             }
         }
     }
 }
示例#2
0
 public bool Insert(Items.FloorItem Item)
 {
     if (FloorItems.TryAdd(Item.UniqueID, Item))
     {
         Owner.Send(Packets.ToSend.ItemDrop(Item, Item.X, Item.Y, false));
         return(true);
     }
     return(false);
 }
示例#3
0
        public static byte[] ItemDrop(Items.FloorItem I, ushort X, ushort Y, bool Remove)
        {
            Writer PWR = new Writer(21);

            PWR.Fill((ushort)21, 0);
            PWR.Fill((ushort)1101, 2);
            PWR.Fill(I.UniqueID, 4);
            PWR.Fill(I.ItemID, 8);
            PWR.Fill(X, 12);
            PWR.Fill(Y, 14);
            PWR.Fill((byte)(Remove ? 2 : 1), 16);
            PWR.Fill(Environment.TickCount, 17);
            return(PWR.Bytes);
        }
示例#4
0
 public void DropAnItem(ushort X, ushort Y, byte Level, uint OwnerUID)
 {
     lock (syncroot)
     {
         for (short x = -1; x < 2; x++)
         {
             for (short y = -1; y < 2; y++)
             {
                 ushort nX = (ushort)(X + x);
                 ushort nY = (ushort)(Y + y);
                 if (Coords[nX, nY] < 3)
                 {
                     Coords[nX, nY] += 2;
                     Items.FloorItem Itm = new Items.FloorItem();
                     Itm.ItemID = (uint)Calculations.GetDropID(Level);
                     Itm.OwnerUID = OwnerUID;
                     Itm.DropTime = Environment.TickCount;
                     Itm.Plus = Calculations.GetPlus();
                     Itm.UniqueID = Increments.NextItemUID;
                     Itm.X = nX;
                     Itm.Y = nY;
                     FloorItems.TryAdd(Itm.UniqueID, Itm);
                     foreach (SocketClient Client in Players.Values)
                         if (Calculations.GetDistance(Client.Character.X, Client.Character.Y, nX, nY) <= Constants.ScreenDistance)
                             Client.Character.Screen.Insert(Itm);
                     return;
                 }
             }
         }
     }
 }