Problem:
Quote:
items are not dropping everything but items drop and i cant figure out why items are not dropping could someone look at the code and see if theres anything wrong
Code:
void DropAnItem(uint Owner, byte OwnerLevel)
{
try
{
ArrayList Arr = (ArrayList)DropRates.Specifics[MobID];
if (Arr != null)
{
foreach (DropRates.RateItemInfo R in Arr)
{
if (MyMath.ChanceSuccess(R.DropChance) && Level + 20 > OwnerLevel)
{
DroppedItem DI = new DroppedItem();
DI.DropTime = DateTime.Now;
DI.UID = (uint)Rnd.Next(10000000);
DI.Loc = new Location();
DI.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
DI.Loc.Map = Loc.Map;
DI.Info = new Item();
DI.Info.ID = R.ID;
DI.Info.UID = (uint)Rnd.Next(10000000);
DI.Info.Plus = R.Plus;
DI.Info.Bless = R.Bless;
if (R.Sockets >= 1)
DI.Info.Soc1 = Item.Gem.EmptySocket;
if (R.Sockets >= 2)
DI.Info.Soc2 = Item.Gem.EmptySocket;
try
{
DI.Info.MaxDur = DI.Info.DBInfo.Durability;
DI.Info.CurDur = DI.Info.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
DI.Owner = Owner;
if (!DI.FindPlace((Hashtable)Game.World.H_Items[Loc.Map]))
{
DI.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
}
if (!DI.FindPlace((Hashtable)Game.World.H_Items[Loc.Map])) continue;
DI.Drop();
}
}
}
DroppedItem DI2 = new DroppedItem();
DI2.DropTime = DateTime.Now;
DI2.UID = (uint)Rnd.Next(10000000);
DI2.Loc = new Location();
DI2.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI2.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
DI2.Loc.Map = Loc.Map;
DI2.Info = new Item();
DI2.Info.UID = (uint)Rnd.Next(10000000);
DI2.Owner = Owner;
Game.Character Char = null;
if (Game.World.H_Chars.ContainsKey(Owner))
Char = (Character)Game.World.H_Chars[Owner];
#region Misc
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 1)
{
if (Char.queststatictc == 1)
{
if (Char.QuestTc <= 50) { Char.QuestTc += 1; Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills."); return; }
else Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills.,Congration you finish the quest,go back in TwinCity");
}
}
}
// Console.Write("ajung 1");
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 27)
{
if (Char.queststatictc == 2)
{
if (Char.QuestTc <= 50) { Char.QuestTc += 1; Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills."); return; }
else Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills.,Congration you finish the quest,go back in TwinCity");
}
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 40)
{
if (Char.queststatictc == 3)
{
if (Char.QuestTc <= 50) { Char.QuestTc += 1; Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills."); return; }
else Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills.,Congration you finish the quest,go back in TwinCity");
}
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 52)
{
if (Char.queststatictc == 4)
{
if (Char.QuestTc <= 50) { Char.QuestTc += 1; Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills."); return; }
else Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills.,Congration you finish the quest,go back in TwinCity");
}
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 17)
{
if (Char.queststatictc == 5)
{
if (Char.QuestTc <= 50) { Char.QuestTc += 1; Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills."); return; }
else Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills.,Congration you finish the quest,go back in TwinCity");
}
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 63)
{
if (Char.queststatictc == 6)
{
if (Char.QuestTc <= 50) { Char.QuestTc += 1; Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills."); return; }
else Char.MyClient.LocalMessage(2000, "You have " + Char.QuestTc + " monsters kills.,Congration you finish the quest,go back in TwinCity");
}
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 5053)
{
if (Char.Job >= 10 && Char.Job <= 15) { if (Char.DisKO <= 802) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 800 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 20 && Char.Job <= 25) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 40 && Char.Job <= 45) { if (Char.DisKO <= 1302) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1300 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 50 && Char.Job <= 55) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 132 && Char.Job <= 135) { if (Char.DisKO <= 602) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 600 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 142 && Char.Job <= 145) { if (Char.DisKO <= 1002) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1000 monster go back at npc!he teleport you left/right."); }
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 5055)
{
if (Char.Job >= 10 && Char.Job <= 15) { if (Char.DisKO <= 802) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 800 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 20 && Char.Job <= 25) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 40 && Char.Job <= 45) { if (Char.DisKO <= 1302) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1300 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 50 && Char.Job <= 55) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 132 && Char.Job <= 135) { if (Char.DisKO <= 602) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 600 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 142 && Char.Job <= 145) { if (Char.DisKO <= 1002) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1000 monster go back at npc!he teleport you left/right."); }
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 5054)
{
if (Char.Job >= 10 && Char.Job <= 15) { if (Char.DisKO <= 802) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 800 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 20 && Char.Job <= 25) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 40 && Char.Job <= 45) { if (Char.DisKO <= 1302) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1300 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 50 && Char.Job <= 55) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 132 && Char.Job <= 135) { if (Char.DisKO <= 602) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 600 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 142 && Char.Job <= 145) { if (Char.DisKO <= 1002) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1000 monster go back at npc!he teleport you left/right."); }
}
}
if (MyMath.ChanceSuccess(90))
{
if (Char != null)
if (MobID == 5056)
{
if (Char.Job >= 10 && Char.Job <= 15) { if (Char.DisKO <= 802) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 800 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 20 && Char.Job <= 25) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 40 && Char.Job <= 45) { if (Char.DisKO <= 1302) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1300 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 50 && Char.Job <= 55) { if (Char.DisKO <= 902) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 900 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 132 && Char.Job <= 135) { if (Char.DisKO <= 602) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 600 monster go back at npc!he teleport you left/right."); }
else if (Char.Job >= 142 && Char.Job <= 145) { if (Char.DisKO <= 1002) { Char.DisKO++; return; } else Char.MyClient.LocalMessage(2000, "You finish kill 1000 monster go back at npc!he teleport you left/right."); }
}
#endregion
}
if (MyMath.ChanceSuccess(30))
{
DI2.Silvers = (uint)(Rnd.Next(MinSilvers, MaxSilvers) * 2000);
if (Char != null)
if (Char.VipLevel >= 8)
{
Char.Silvers += DI2.Silvers;
return;
}
DI2.UID = (uint)Rnd.Next(10000000);
DI2.Loc.X = (ushort)(Loc.X + Rnd.Next(4) - Rnd.Next(4));
DI2.Loc.Y = (ushort)(Loc.Y + Rnd.Next(4) - Rnd.Next(4));
if (DI2.Silvers < 10)
DI2.Info.ID = 1090000;
else if (DI2.Silvers < 100)
DI2.Info.ID = 1090010;
else if (DI2.Silvers < 1000)
DI2.Info.ID = 1090020;
else if (DI2.Silvers < 3000)
DI2.Info.ID = 1091000;
else if (DI2.Silvers < 10000)
DI2.Info.ID = 1091010;
else
DI2.Info.ID = 1091020;
if (!DI2.FindPlace((Hashtable)Game.World.H_Items[Loc.Map])) return;
DI2.Drop();
}
else
{
if (MyMath.ChanceSuccess(1.9))
{
DI2.Info.ID = 1002020;//Vanilla
DI2.Info.ID = 1001020;//PearlOintment
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(0.5))
{
DI2.Info.ID = 1088000;//Dragonball
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(0.7))
{
DI2.Info.ID = 1088001;//Meteor
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(1))
{
DI2.Info.ID = 729912;//CPBackpack
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(1))
{
DI2.Info.ID = 780000;//PointCard
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(1.8) && Name == "HillMonster")
{
DI2.Info.ID = 1080001;//Emerald
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(1.8) && Name == "GoldGhost")
{
DI2.Info.ID = 721537;//SkyToken
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(1.8) && Name == "AgileRat")
{
DI2.Info.ID = 721538;//EarthToken
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(1.8) && Name == "FiendBat")
{
DI2.Info.ID = 721539;//SoulToken
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
#region NightDevil
else if (MyMath.ChanceSuccess(0.5) && Name == "HeavyGhostL23")
{
DI2.Info.ID = (uint)(725016);
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(0.5) && Name == "Poltergeist")
{
DI2.Info.ID = (uint)(725016);
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
#endregion
else if (MyMath.ChanceSuccess(0.5) && Name == "WaterDevilz")
{
DI2.Info.ID = 721258;//CleanWater
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(2.0))
{
DI2.Info.ID = (uint)(700001 + Rnd.Next(8) * 10);
if (MyMath.ChanceSuccess(15)) DI2.Info.ID = 700121;
if (MyMath.ChanceSuccess(15)) DI2.Info.ID = 700101;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
}
else if (MyMath.ChanceSuccess(DropRates.Item))
{
Item.ItemQuality Q = Item.ItemQuality.Simple;
if (MyMath.ChanceSuccess(DropRates.Refined))
Q = Item.ItemQuality.Refined;
if (MyMath.ChanceSuccess(DropRates.Unique))
Q = Item.ItemQuality.Unique;
if (MyMath.ChanceSuccess(DropRates.Elite))
Q = Item.ItemQuality.Elite;
if (MyMath.ChanceSuccess(DropRates.Super))
Q = Item.ItemQuality.Super;
uint ItemID = 0;
ArrayList From = new ArrayList();
foreach (DatabaseItem D in Database.DatabaseItems.Values)
{
if (D.LevReq + 5 > Level && D.LevReq - 5 <= Level)
{
if (D.LevReq != 0)
From.Add(D.ID);
}
}
if (From != null)
{
byte Tries = (byte)Rnd.Next(0, From.Count);
ItemID = (uint)From[Tries];
}
if (ItemID != 0)
{
DI2.Info.ID = ItemID;
if (DI2.Info.DBInfo.LevReq != 1)
{
ItemIDManipulation E = new ItemIDManipulation(ItemID);
E.QualityChange(Q);
DI2.Info.ID = E.ToID();
}
DI2.Info.Color = Item.ArmorColor.Orange;
if (ItemIDManipulation.Digit(DI2.Info.ID, 1) == 4 || ItemIDManipulation.Digit(DI2.Info.ID, 1) == 5)
{
if (MyMath.ChanceSuccess(DropRates.OneSoc))
DI2.Info.Soc1 = Item.Gem.EmptySocket;
if (MyMath.ChanceSuccess(DropRates.TwoSoc))
{
DI2.Info.Soc1 = Item.Gem.EmptySocket;
DI2.Info.Soc2 = Item.Gem.EmptySocket;
}
}
if (MyMath.ChanceSuccess(DropRates.PlusOne))
DI2.Info.Plus = 1;
DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
DI2.Info.CurDur = DI2.Info.MaxDur;
if (Q == Item.ItemQuality.Super || Q == Item.ItemQuality.Elite)
if (Char != null)
if (Char.VipLevel >= 9)
{
if (Char.Inventory.Count <= 39)
{
Char.AddItem(DI2.Info.ID);
return;
}
}
}
}
if (DI2.Info.ID != 0)
{
if (!DI2.FindPlace((Hashtable)Game.World.H_Items[Loc.Map])) return;
DI2.Drop();
}
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
Code:
public void Drop()
{
if (Info.ID != 0 && UID != 0 && Info.DBInfo.ID != 0)
{
if (Info.UID == 0)
Info.UID = (uint)World.Rnd.Next(10000000);
if (!World.H_Items.Contains(Loc.Map))
World.H_Items.Add(Loc.Map, new Hashtable());
Hashtable Map = (Hashtable)World.H_Items[Loc.Map];
for (byte i = 0; i < 10; i++)
{
if (Map.Contains(UID))
UID = (uint)World.Rnd.Next(10000000);
else break;
}
if (!Map.Contains(UID))
{
World.Action(this, Packets.ItemDrop(this).Get);
Map.Add(UID, this);
}
}
}






