so for example. (sorry for the noob-ness)
if I were to make a mobs system (which I am currently making) how would I make the mobs handle the item drops? it seems like I am having a bit of problem on items. not that many problems on Silvers and CPs though.
here is what I have so far for Item dropping on mobs. (some stuff mentioned is not implemented) take a look at the code in the red (which means the things that are not implemented, therefore the code still needs a bit of fixing):
Code:
#region Items
if (Program.Rate(Program.ItemDropRate))
{
int quality = 5;
if (Calculations.ChanceSuccess(1.8))
quality = 6;
if (Calculations.ChanceSuccess(0.8))
quality = 7;
if (Calculations.ChanceSuccess(0.08))
quality = 8;
if (Calculations.ChanceSuccess(0.008))
quality = 9;
int times = 50;
List<uint> itemdroplist = ItemDropCache[Level];
retry:
times--;
int generateItemId = Program.Rnd.Next(itemdroplist.Count);
uint id = itemdroplist[generateItemId];
if ([COLOR="Red"]Database.ConquerItemInformation.BaseInfos[/COLOR][id].Level > 121 && times > 0)
goto retry;
id = (id / 10) * 10 + (uint)quality;
if (![COLOR="red"]Database.ConquerItemInformation.BaseInfos[/COLOR].ContainsKey(id))
{
id = itemdroplist[generateItemId];
}
if (id >= 724350 && id <= 724499)
goto retry;
if (id >= 800000 && id <= 899999)
goto retry;
var infos = [COLOR="red"]Database.ConquerItemInformation.BaseInfos[/COLOR][id];
ushort X = Owner.X, Y = Owner.Y;
Map Map = Program.Maps[Owner.MapID];
if (Map.SelectCoordonates(ref X, ref Y))
{
FloorItem floorItem = new FloorItem(true);
floorItem.Item = new [COLOR="Red"]ConquerItem[/COLOR](true);
floorItem.Item.Color = (Enum.Color)Program.Rnd.Next(4, 8);
floorItem.Item.ID = id;
floorItem.Item.MaximDurability = infos.Durability;
if (quality >= 6)
floorItem.Item.Durability = (ushort)(infos.Durability - Program.Rnd.Next(500));
else
floorItem.Item.Durability = (ushort)(Program.Rnd.Next(infos.Durability / 10));
floorItem.Item.UID = [COLOR="red"]ConquerItem.ItemUID.Next[/COLOR];
floorItem.ValueType = FloorItem.FloorValueType.Item;
floorItem.ItemID = id;
floorItem.MapID = Owner.MapID;
floorItem.MapObjType = MapObjectType.Item;
floorItem.X = X;
floorItem.Y = Y;
floorItem.Type = FloorItem.Drop;
floorItem.OnFloor = Time32.Now;
floorItem.ItemColor = floorItem.Item.Color;
floorItem.UID = FloorItem.FloorUID.Next;
while (Map.Npcs.ContainsKey(floorItem.UID))
floorItem.UID = FloorItem.FloorUID.Next;
Map.AddFloorItem(floorItem);
SendScreenSpawn(floorItem);
}
}
#endregion
I set a random value for item drops and the multiplier for them in Program.cs btw
thanks for any help you can hep me with, sir.