//private static bool HandleItemMove(Client c, MoveItemInfo m, BaseItem item) //{ // if (c.MyCharacter.Bags[m.ToBag - 1].MoveItem(item, m.ToBag, m.ToSlot, out BaseItem)) // { // item.Slot = (byte)(m.ToSlot); // item.Bag = (byte)(m.ToBag); // if (m.FromBag != m.ToBag && m.FromBag > 0) // { // c.MyCharacter.Bags[m.FromBag - 1].RemoveItem(item); // } // return true; // } // return false; //} void c_ClientDropItemInfo(object sender, ClientDropItemEventArgs e) { Client c = (Client)sender; DropItemInfo d = e.Info; //Equipment item = channelManager.GetItemByItemID(d.ItemID); BaseItem item = c.MyCharacter.Bags[d.FromBag - 1].Items.Where(x => x.ItemID == d.ItemID).First(); MapItem m = mapEngine.PlayerDropItem(item, d.ToX, d.ToY, d.ToZ, c.Map.MapID); c.MyCharacter.Bags[d.FromBag - 1].RemoveItem(item); Client[] nearbyClients = GetNearByClients(c); byte[] SendRemoveItem = PacketManager.SendRemoveItem(d.FromBag, d.FromSlot); c.Send(SendRemoveItem); byte[] SendItemOnGround = PacketManager.SendItemOnGround(m); SendSpecific(nearbyClients, SendItemOnGround); }
//private static bool HandleItemMove(Client c, MoveItemInfo m, BaseItem item) //{ // if (c.MyCharacter.Bags[m.ToBag - 1].MoveItem(item, m.ToBag, m.ToSlot, out BaseItem)) // { // item.Slot = (byte)(m.ToSlot); // item.Bag = (byte)(m.ToBag); // if (m.FromBag != m.ToBag && m.FromBag > 0) // { // c.MyCharacter.Bags[m.FromBag - 1].RemoveItem(item); // } // return true; // } // return false; //} void c_ClientDropItemInfo(object sender, ClientDropItemEventArgs e) { Client c = (Client)sender; DropItemInfo d = e.Info; //Equipment item = channelManager.GetItemByItemID(d.ItemID); BaseItem item = c.MyCharacter.Bags[d.FromBag - 1].Items.Where(x => x.ItemID == d.ItemID).First(); MapItem m = mapEngine.PlayerDropItem(item, d.ToX, d.ToY, d.ToZ, c.Map.MapID); c.MyCharacter.Bags[d.FromBag - 1].RemoveItem(item); Client[] nearbyClients = GetNearByClients(c); byte[] SendRemoveItem = PacketManager.SendRemoveItem(d.FromBag, d.FromSlot); c.Send(SendRemoveItem); byte[] SendItemOnGround = PacketManager.SendItemOnGround(m); SendSpecific(nearbyClients, SendItemOnGround); }
void c_ClientDropItemInfo(object sender, ClientDropItemEventArgs e) { Client c = (Client)sender; DropItemInfo d = e.Info; MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId); try { //Equipment item = channelManager.GetItemByItemID(d.ItemID); BaseItem item = c.MyCharacter.Bags[d.FromBag - 1].Items.Where(x => x.ItemID == d.ItemID).First(); MapItem m = mapEngine.PlayerDropItem(c.MyCharacter.CharacterId, item, d.ToX, d.ToY, d.ToZ, c.Map.MapID); c.MyCharacter.Bags[d.FromBag - 1].RemoveItem(item); Client[] clients = GetClientsForChars(mapEngine.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray()); byte[] SendRemoveItem = PacketManager.SendRemoveItem(d.FromBag, d.FromSlot); c.Send(SendRemoveItem); byte[] SendItemOnGround = PacketManager.SendItemOnGround(m); SendToClients(SendItemOnGround, clients); } catch { } }