Would this be correct?
Code:
if (Calculation.PercentSuccess(20))
{
Struct.ItemGround IG = new Struct.ItemGround();
if (Calculation.PercentSuccess(20))
IG.ItemID = 723085;
else
IG.ItemID = 729911;
[COLOR="Red"]IG.Map = 2021;[/COLOR]
IG.X = (X - Nano.Rand.Next(4) + Nano.Rand.Next(4));
IG.Y = (Y - Nano.Rand.Next(4) + Nano.Rand.Next(4));
if (Nano.Maps.ContainsKey(IG.Map))
{
Struct.DmapData Mapping = Nano.Maps[IG.Map];
byte tries = 0;
while (!Mapping.CheckLoc((ushort)IG.X, (ushort)IG.Y))
{
IG.X = (X - Nano.Rand.Next(4) + Nano.Rand.Next(4));
IG.Y = (Y - Nano.Rand.Next(4) + Nano.Rand.Next(4));
tries++;
if (tries > 8)
break;
}
}
IG.OwnerOnly = new System.Timers.Timer();
IG.OwnerOnly.Interval = 10000;
IG.OwnerOnly.AutoReset = false;
IG.OwnerID = Killer;
IG.UID = Nano.Rand.Next(1000, 9999999);
while (Nano.ItemFloor.ContainsKey(IG.UID))
{
IG.UID = Nano.Rand.Next(1000, 9999999);
}
//TODO: UID generation that is better.
IG.Dispose = new System.Timers.Timer();
IG.Dispose.Interval = 60000;
IG.Dispose.AutoReset = false;
IG.Dispose.Elapsed += delegate { IG.Disappear(); };
IG.Dispose.Start();
IG.OwnerOnly.Start();
//lock(Nano.ItemFloor)
//{
try
{
Monitor.Enter(Nano.ItemFloor);
Nano.ItemFloor.Add(IG.UID, IG);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
finally
{
Monitor.Exit(Nano.ItemFloor);
}
//}
ConquerPacket.ToLocal(ConquerPacket.DropItem(IG.UID, IG.ItemID, IG.X, IG.Y, IG.Color), IG.X, IG.Y, IG.Map, 0, 0);
}






