Quote:
Originally Posted by JobvdH
Check your packet?
Perhaps your packets are wrong.
|
What that does is send a ranged packet to the server with the NpcSpawnPacket to act as the visible "flag" npc.
Code:
public bool StartVending(uint lParam)
{
if (m_IsVending)
return false;
Dictionary<uint, INpc> npcs;
if (Kernel.Npcs.TryGetValue(Owner.Entity.MapID, out npcs))
{
ushort vendx = (ushort)(Owner.Entity.X - 2);
ushort vendy = Owner.Entity.Y;
foreach (INpc npc in npcs.Values)
{
if (npc.X == vendx && npc.Y == vendy && !npc.IsVendor)
{
m_VendorNpc = npc;
m_VendorNpc.ConvertToVendor(Owner.Entity.Name);
m_VendorNpc.UID = lParam;
[COLOR="Red"]PacketKernel.SendRangedPacket(1036, vendx, vendy, ((NpcSpawnPacket)m_VendorNpc).Packet);[/COLOR]
VendingItems = new Dictionary<uint, VendingItem>();
m_IsVending = true;
break;
}
}
}
return m_IsVending;
}
THIS, is the SendRangedPacket method it uses for sending the Npc reply to the appointed map, 1036, as said above, with INPC acting as the "flag".
Code:
public static void SendRangedPacket(ushort MapID, ushort X, ushort Y, byte[] Packet)
{
foreach (GameClient DE in Kernel.Clients)
if (DE.Entity.MapID.ID == MapID)
if (Kernel.GetDistance(X, Y, DE.Entity.X, DE.Entity.Y) < DataStructures.ViewDistance)
DE.Send(Packet);
}
this seems fairly fine to me, don't know why it wouldn't work.