public void UpdateLootForm()
{
Hunt hunt = HuntManager.activeHunt;
int minheight, maxheight;
ClearControlList(lootControls, out minheight, out maxheight);
int counter;
int y = minheight;
if (maxheight < 0)
{
y = 30;
foreach (Control c in summaryControls)
{
y = Math.Max(c.Location.Y + c.Height, y);
}
}
var loot = LootDropForm.GenerateLootInformation(hunt, "", null);
totalValue = 0;
foreach (Tuple <Item, int> tpl in loot.Item2)
{
totalValue += tpl.Item1.GetMaxValue() * tpl.Item2;
}
averageValue = LootDropForm.GetAverageGold(loot.Item1);
int maxDrops = SettingsManager.getSettingInt("SummaryMaxItemDrops");
if (maxDrops < 0)
{
maxDrops = 5;
}
if (maxDrops > 0)
{
List <ItemRegion> region;
int imageHeight = SettingsManager.getSettingInt("SummaryLootItemSize");
imageHeight = imageHeight < 0 ? BlockHeight : imageHeight;
CreateHeaderLabel("Item Drops", x, ref y, lootControls);
counter = 0;
bool display = true;
int width = 0;
var items = new List <Tuple <Item, int> >();
foreach (Tuple <Item, int> tpl in loot.Item2)
{
int amount = tpl.Item2;
while (amount > 0)
{
int count = Math.Min(100, amount);
amount -= count;
items.Add(new Tuple <Item, int>(tpl.Item1, count));
width += imageHeight + 2;
if (width > BlockWidth - imageHeight)
{
region = new List <ItemRegion>();
CreateItemList(items, x, ref y, lootControls, imageHeight, region, counter).MouseDown += OpenLootWindow;
lootRegions[counter] = region;
items.Clear();
width = 0;
if (++counter >= maxDrops)
{
display = false;
break;
}
}
}
if (!display)
{
break;
}
}
if (items.Count > 0)
{
region = new List <ItemRegion>();
CreateItemList(items, x, ref y, lootControls, imageHeight, region, counter).MouseDown += OpenLootWindow;
lootRegions[counter] = region;
items.Clear();
}
}
int maxCreatures = SettingsManager.getSettingInt("SummaryMaxCreatures");
if (maxCreatures < 0)
{
maxCreatures = 5;
}
if (maxCreatures > 0)
{
CreateHeaderLabel("Creature Kills", x, ref y, lootControls);
counter = 0;
foreach (Creature cr in loot.Item1.Keys.OrderByDescending(o => loot.Item1[o] * (1 + o.experience)).ToList <Creature>())
{
CreateCreatureBox(cr, loot.Item1[cr], x, ref y, lootControls);
if (++counter >= maxCreatures)
{
break;
}
}
}
int maxRecentDrops = SettingsManager.getSettingInt("SummaryMaxRecentDrops");
if (maxRecentDrops < 0)
{
maxRecentDrops = 5;
}
if (maxRecentDrops > 0)
{
CreateHeaderLabel("Recent Drops", x, ref y, lootControls);
int imageHeight = SettingsManager.getSettingInt("SummaryRecentDropsItemSize");
imageHeight = imageHeight < 0 ? BlockHeight : imageHeight;
var recentDrops = ScanningManager.GetRecentDrops(maxRecentDrops);
int index = 0;
foreach (var drops in recentDrops)
{
List <ItemRegion> region = new List <ItemRegion>();
CreateCreatureDropsBox(drops.Item1, drops.Item2, drops.Item3, x, ref y, lootControls, imageHeight, region, index).MouseDown += OpenRecentDropsWindow;
recentDropsRegions[index++] = region;
}
}
UpdateDamageForm();
}