Exemplo n.º 1
0
 public LootDropForm(string command)
 {
     string[] split = command.Split('@');
     if (split.Length >= 2) {
         huntName = split[1];
     }
     if (split.Length >= 3) {
         creatureName = split[2];
     }
     if (split.Length >= 4) {
         rawName = split[3];
     }
     lootCreature = StorageManager.getCreature(creatureName);
     InitializeComponent();
     value_tooltip.AutoPopDelay = 60000;
     value_tooltip.InitialDelay = 500;
     value_tooltip.ReshowDelay = 0;
     value_tooltip.ShowAlways = true;
     value_tooltip.UseFading = true;
     this.Name = "Tibialyzer (Loot Form)";
     updateTimer = new System.Timers.Timer(500);
     updateTimer.AutoReset = false;
     updateTimer.Elapsed += (s, e) => {
         ActuallyRefreshForm();
     };
 }
Exemplo n.º 2
0
        public static void ShowCreatureDrops(Creature c, string comm)
        {
            if (c == null) return;
            CreatureDropsForm f = new CreatureDropsForm();
            f.creature = c;

            ShowNotification(f, comm);
        }
Exemplo n.º 3
0
 public LootDropForm(string command)
 {
     string[] split = command.Split('@');
     if (split.Length >= 2) {
         huntName = split[1];
     }
     if (split.Length >= 3) {
         creatureName = split[2];
     }
     if (split.Length >= 4) {
         rawName = split[3];
     }
     lootCreature = MainForm.getCreature(creatureName);
     InitializeComponent();
     value_tooltip.AutoPopDelay = 60000;
     value_tooltip.InitialDelay = 500;
     value_tooltip.ReshowDelay = 0;
     value_tooltip.ShowAlways = true;
     value_tooltip.UseFading = true;
 }
Exemplo n.º 4
0
 public static void deleteCreatureFromLog(Creature cr)
 {
     activeHunt.DeleteCreature(cr);
     LootDatabaseManager.UpdateLoot();
 }
Exemplo n.º 5
0
 public static void InsertSkin(Creature cr, int count = 1)
 {
     var time = DateTime.Now;
     int hour = time.Hour;
     int minute = time.Minute;
     int stamp = TimestampManager.getDayStamp();
     string timestamp = String.Format("{0}:{1}", (hour < 10 ? "0" + hour.ToString() : hour.ToString()), (minute < 10 ? "0" + minute.ToString() : minute.ToString()));
     Item item = StorageManager.getItem(cr.skin.dropitemid);
     if (item == null) return;
     string message = String.Format("{0} Loot of a {1}: {2} {3}", timestamp, cr.displayname.ToLower(), count, item.displayname.ToLower());
     Hunt h = HuntManager.activeHunt;
     LootDatabaseManager.InsertMessage(h, stamp, hour, minute, message);
     HuntManager.AddSkin(h, message, cr, item, count, timestamp);
     LootDatabaseManager.UpdateLoot();
 }
Exemplo n.º 6
0
        public void RefreshLoot()
        {
            foreach (Control c in createdControls)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            createdControls.Clear();
            if (page < 0)
            {
                page = 0;
            }

            int  base_x = 20, base_y = 30;
            int  x = 0, y = 0;
            int  item_spacing = 4;
            Size item_size    = new Size(32, 32);
            int  max_x        = SettingsManager.getSettingInt("LootFormWidth");

            if (max_x < minLootWidth)
            {
                max_x = minLootWidth;
            }
            int width_x = max_x + item_spacing * 2;

            long total_value = 0;
            int  currentPage = 0;
            bool prevPage    = page > 0;
            bool nextPage    = false;

            averageGold = 0;
            foreach (KeyValuePair <Creature, int> tpl in creatures)
            {
                double average = 0;
                foreach (ItemDrop dr in tpl.Key.itemdrops)
                {
                    Item it = StorageManager.getItem(dr.itemid);
                    if (!it.discard && it.GetMaxValue() > 0 && dr.percentage > 0)
                    {
                        average += ((dr.min + dr.max) / 2.0) * (dr.percentage / 100.0) * it.GetMaxValue();
                    }
                }
                averageGold += (int)(average * tpl.Value);
            }

            foreach (Tuple <Item, int> tpl in items)
            {
                total_value += tpl.Item1.GetMaxValue() * tpl.Item2;
            }
            Dictionary <Item, List <PictureBox> > newItemControls = new Dictionary <Item, List <PictureBox> >();

            foreach (Tuple <Item, int> tpl in items)
            {
                Item item  = tpl.Item1;
                int  count = tpl.Item2;
                while (count > 0)
                {
                    if (base_x + x >= (max_x - item_size.Width - item_spacing))
                    {
                        x = 0;
                        if (y + item_size.Height + item_spacing > pageHeight)
                        {
                            currentPage++;
                            if (currentPage > page)
                            {
                                nextPage = true;
                                break;
                            }
                            else
                            {
                                y = 0;
                            }
                        }
                        else
                        {
                            y = y + item_size.Height + item_spacing;
                        }
                    }
                    int mitems = 1;
                    if (item.stackable || SettingsManager.getSettingBool("StackAllItems"))
                    {
                        mitems = Math.Min(count, 100);
                    }
                    count -= mitems;
                    if (currentPage == page)
                    {
                        PictureBox picture_box;
                        if (itemControls.ContainsKey(item))
                        {
                            picture_box = itemControls[item][0];
                            itemControls[item].RemoveAt(0);
                            if (itemControls[item].Count == 0)
                            {
                                itemControls.Remove(item);
                            }
                            picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                            if (picture_box.TabIndex != mitems && (item.stackable || mitems > 1))
                            {
                                picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                            }
                            picture_box.TabIndex = mitems;
                            long individualValue = Math.Max(item.actual_value, item.vendor_value);
                            value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + (individualValue >= 0 ? (individualValue * mitems).ToString() : "Unknown"));
                        }
                        else
                        {
                            picture_box          = new PictureBox();
                            picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                            picture_box.Name     = item.GetName();
                            picture_box.Size     = new System.Drawing.Size(item_size.Width, item_size.Height);
                            picture_box.TabIndex = mitems;
                            picture_box.TabStop  = false;
                            if (item.stackable || mitems > 1)
                            {
                                picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                            }
                            else
                            {
                                picture_box.Image = item.GetImage();
                            }

                            picture_box.SizeMode        = PictureBoxSizeMode.StretchImage;
                            picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                            picture_box.Click          += openItemBox;
                            long individualValue = Math.Max(item.actual_value, item.vendor_value);
                            value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + (individualValue >= 0 ? (individualValue * mitems).ToString() : "Unknown"));
                            this.Controls.Add(picture_box);
                        }
                        if (!newItemControls.ContainsKey(item))
                        {
                            newItemControls.Add(item, new List <PictureBox>());
                        }
                        newItemControls[item].Add(picture_box);
                    }

                    x += item_size.Width + item_spacing;
                }
                if (currentPage > page)
                {
                    break;
                }
            }
            if (page > currentPage)
            {
                page = currentPage;
                RefreshLoot();
                return;
            }

            foreach (KeyValuePair <Item, List <PictureBox> > kvp in itemControls)
            {
                foreach (PictureBox p in kvp.Value)
                {
                    this.Controls.Remove(p);
                    p.Dispose();
                }
            }
            itemControls = newItemControls;

            y = y + item_size.Height + item_spacing;
            if (prevPage)
            {
                PictureBox prevpage = new PictureBox();
                prevpage.Location  = new Point(10, base_y + y);
                prevpage.Size      = new Size(97, 23);
                prevpage.Image     = StyleManager.GetImage("prevpage.png");
                prevpage.BackColor = Color.Transparent;
                prevpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                prevpage.Click    += Prevpage_Click;
                this.Controls.Add(prevpage);
                createdControls.Add(prevpage);
            }
            if (nextPage)
            {
                PictureBox nextpage = new PictureBox();
                nextpage.Location  = new Point(width_x - 108, base_y + y);
                nextpage.Size      = new Size(98, 23);
                nextpage.BackColor = Color.Transparent;
                nextpage.Image     = StyleManager.GetImage("nextpage.png");
                nextpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                nextpage.Click    += Nextpage_Click;
                this.Controls.Add(nextpage);
                createdControls.Add(nextpage);
            }
            if (prevPage || nextPage)
            {
                y += 23;
            }

            x      = 0;
            base_x = 5;
            Size creature_size = new Size(1, 1);
            Size labelSize     = new Size(1, 1);

            foreach (KeyValuePair <Creature, int> tpl in creatures)
            {
                Creature creature = tpl.Key;
                creature_size.Width  = Math.Max(creature_size.Width, creature.GetImage().Width);
                creature_size.Height = Math.Max(creature_size.Height, creature.GetImage().Height);
            }
            {
                Dictionary <Creature, Tuple <PictureBox, Label> > newCreatureControls = new Dictionary <Creature, Tuple <PictureBox, Label> >();
                int i = 0;
                foreach (Creature cr in creatures.Keys.OrderByDescending(o => creatures[o] * (1 + o.experience)).ToList <Creature>())
                {
                    Creature creature  = cr;
                    int      killCount = creatures[cr];
                    if (x >= max_x - creature_size.Width - item_spacing * 2)
                    {
                        x = 0;
                        y = y + creature_size.Height + 23;
                        if (y > maxCreatureHeight)
                        {
                            break;
                        }
                    }
                    int xoffset = (creature_size.Width - creature.GetImage().Width) / 2;
                    int yoffset = (creature_size.Height - creature.GetImage().Height) / 2;

                    Label      count;
                    PictureBox picture_box;
                    if (creatureControls.ContainsKey(creature))
                    {
                        picture_box = creatureControls[creature].Item1;
                        count       = creatureControls[creature].Item2;
                        creatureControls.Remove(creature);

                        picture_box.Location = new System.Drawing.Point(base_x + x + xoffset, base_y + y + yoffset + (creature_size.Height - creature.GetImage().Height) / 2);
                        count.Location       = new Point(base_x + x + xoffset, base_y + y + creature_size.Height);
                        count.Text           = killCount.ToString() + "x";
                    }
                    else
                    {
                        count           = new Label();
                        count.Text      = killCount.ToString() + "x";
                        count.Font      = loot_font;
                        count.Size      = new Size(1, 10);
                        count.Location  = new Point(base_x + x + xoffset, base_y + y + creature_size.Height);
                        count.AutoSize  = true;
                        count.TextAlign = ContentAlignment.MiddleCenter;
                        count.ForeColor = StyleManager.NotificationTextColor;
                        count.BackColor = Color.Transparent;

                        picture_box           = new PictureBox();
                        picture_box.Location  = new System.Drawing.Point(base_x + x + xoffset, base_y + y + yoffset + (creature_size.Height - creature.GetImage().Height) / 2);
                        picture_box.Name      = creature.GetName();
                        picture_box.Size      = new System.Drawing.Size(creature.GetImage().Width, creature.GetImage().Height);
                        picture_box.TabIndex  = 1;
                        picture_box.TabStop   = false;
                        picture_box.Image     = creature.GetImage();
                        picture_box.SizeMode  = PictureBoxSizeMode.StretchImage;
                        picture_box.Click    += openCreatureDrops;
                        picture_box.BackColor = Color.Transparent;

                        this.Controls.Add(picture_box);
                        this.Controls.Add(count);
                    }
                    int measured_size = (int)count.CreateGraphics().MeasureString(count.Text, count.Font).Width;
                    int width         = Math.Max(measured_size, creature.GetImage().Width);

                    if (width > creature.GetImage().Width)
                    {
                        picture_box.Location = new Point(picture_box.Location.X + (width - creature.GetImage().Width) / 2, picture_box.Location.Y);
                    }
                    else
                    {
                        count.Location = new Point(count.Location.X + (width - measured_size) / 2, count.Location.Y);
                    }
                    newCreatureControls.Add(creature, new Tuple <PictureBox, Label>(picture_box, count));

                    labelSize = count.Size;

                    i++;
                    x += width + xoffset;
                }
                y = y + creature_size.Height + labelSize.Height * 2;
                foreach (KeyValuePair <Creature, Tuple <PictureBox, Label> > kvp in creatureControls)
                {
                    this.Controls.Remove(kvp.Value.Item1);
                    this.Controls.Remove(kvp.Value.Item2);
                    kvp.Value.Item1.Dispose();
                    kvp.Value.Item2.Dispose();
                }
                creatureControls = newCreatureControls;
            }

            int xPosition = width_x - totalValueValue.Size.Width - 5;

            y = base_y + y + item_spacing + 10;
            huntNameLabel.Text       = hunt.name.ToString();
            totalValueLabel.Location = new Point(5, y);
            totalValueValue.Location = new Point(xPosition, y);
            totalValueValue.Text     = total_value.ToString();
            value_tooltip.SetToolTip(totalValueValue, String.Format("Average gold for these creature kills: {0} gold.", averageGold));
            totalExpLabel.Location  = new Point(5, y += 20);
            totalExpValue.Location  = new Point(xPosition, y);
            totalExpValue.Text      = hunt.totalExp.ToString();
            totalTimeLabel.Location = new Point(5, y += 20);
            totalTimeValue.Location = new Point(xPosition, y);

            long   totalSeconds  = (long)hunt.totalTime;
            string displayString = "";

            if (totalSeconds >= 3600)
            {
                displayString += (totalSeconds / 3600).ToString() + "h ";
                totalSeconds   = totalSeconds % 3600;
            }
            if (totalSeconds >= 60)
            {
                displayString += (totalSeconds / 60).ToString() + "m ";
                totalSeconds   = totalSeconds % 60;
            }
            displayString += totalSeconds.ToString() + "s";

            totalTimeValue.Text = displayString;
            y += 20;


            int widthSize = width_x / 3 - 5;

            lootButton.Size        = new Size(widthSize, lootButton.Size.Height);
            lootButton.Location    = new Point(5, y);
            allLootButton.Size     = new Size(widthSize, lootButton.Size.Height);
            allLootButton.Location = new Point(7 + widthSize, y);
            rawLootButton.Size     = new Size(widthSize, lootButton.Size.Height);
            rawLootButton.Location = new Point(10 + 2 * widthSize, y);

            y += allLootButton.Size.Height + 2;

            huntNameLabel.Size   = new Size(width_x, huntNameLabel.Size.Height);
            this.Size            = new Size(width_x, y + 5);
            lootLarger.Location  = new Point(Size.Width - lootLarger.Size.Width - 4, 4);
            lootSmaller.Location = new Point(Size.Width - 2 * lootLarger.Size.Width - 4, 4);
        }
Exemplo n.º 7
0
 public static void AddSkin(Hunt h, string message, Creature cr, Item item, int count, string timestamp)
 {
     h.AddSkin(message, cr, item, count, timestamp);
 }
Exemplo n.º 8
0
 private void insertSkin(Creature cr, int count = 1)
 {
     var time = DateTime.Now;
     int hour = time.Hour;
     int minute = time.Minute;
     int stamp = getDayStamp();
     string timestamp = String.Format("{0}:{1}", (hour < 10 ? "0" + hour.ToString() : hour.ToString()), (minute < 10 ? "0" + minute.ToString() : minute.ToString()));
     Item item = getItem(cr.skin.dropitemid);
     if (item == null) return;
     string message = String.Format("{0} Loot of a {1}: {2} {3}", timestamp, cr.displayname.ToLower(), count, item.displayname.ToLower());
     SQLiteCommand command = new SQLiteCommand(String.Format("INSERT INTO \"{4}\" VALUES({0}, {1}, {2}, \"{3}\");", stamp, hour, minute, message.Replace("\"", "\\\""), activeHunt.GetTableName()), lootConn);
     command.ExecuteNonQuery();
     lock (hunts) {
         if (!activeHunt.loot.logMessages.ContainsKey(timestamp)) activeHunt.loot.logMessages.Add(timestamp, new List<string>());
         activeHunt.loot.logMessages[timestamp].Add(message);
         if (!activeHunt.loot.creatureLoot.ContainsKey(cr)) {
             activeHunt.loot.creatureLoot.Add(cr, new Dictionary<Item, int>());
         }
         foreach (Item i in activeHunt.loot.creatureLoot[cr].Keys) {
             if (i.id == cr.skin.dropitemid) {
                 activeHunt.loot.creatureLoot[cr][i] += count;
                 return;
             }
         }
         activeHunt.loot.creatureLoot[cr].Add(item, count);
     }
     LootChanged();
 }
Exemplo n.º 9
0
        public static Tuple<Dictionary<Creature, int>, List<Tuple<Item, int>>> GenerateLootInformation(Hunt hunt, string rawName, Creature lootCreature)
        {
            Dictionary<Creature, int> creatureKills;
            List<Tuple<Item, int>> itemDrops = new List<Tuple<Item, int>>();

            bool raw = rawName == "raw";
            bool all = raw || rawName == "all";
            List<Creature> displayedCreatures = null;
            if (!hunt.trackAllCreatures && hunt.trackedCreatures.Length > 0) {
                displayedCreatures = hunt.GetTrackedCreatures();
            } else if (SettingsManager.getSettingBool("IgnoreLowExperience")) {
                displayedCreatures = new List<Creature>();
                foreach (Creature cr in hunt.IterateCreatures()) {
                    if (cr.experience >= SettingsManager.getSettingInt("IgnoreLowExperienceValue")) {
                        displayedCreatures.Add(cr);
                    }
                }
            }

            if (lootCreature != null) {
                //the command is loot@<creature>, so we only display the kills and loot from the specified creature
                creatureKills = hunt.GetCreatureKills(lootCreature);
            } else if (displayedCreatures == null) {
                creatureKills = hunt.GetCreatureKills(); //display all creatures //loot.killCount;
            } else {
                // only display tracked creatures
                creatureKills = hunt.GetCreatureKills(displayedCreatures); // new Dictionary<Creature, int>();
            }

            // now handle item drops, gather a count for every item
            Dictionary<Item, int> itemCounts = new Dictionary<Item, int>();
            foreach (KeyValuePair<Creature, Dictionary<Item, int>> kvp in hunt.IterateLoot()) {
                if (lootCreature != null && kvp.Key != lootCreature) continue; // if lootCreature is specified, only consider loot from the specified creature
                if (displayedCreatures != null && !displayedCreatures.Contains(kvp.Key)) continue;
                foreach (KeyValuePair<Item, int> kvp2 in kvp.Value) {
                    Item item = kvp2.Key;
                    int value = kvp2.Value;
                    if (!itemCounts.ContainsKey(item)) itemCounts.Add(item, value);
                    else itemCounts[item] += value;
                }
            }

            // now we do item conversion
            long extraGold = 0;
            foreach (KeyValuePair<Item, int> kvp in itemCounts) {
                Item item = kvp.Key;
                int count = kvp.Value;
                // discard items that are set to be discarded (as long as all/raw mode is not enabled)
                if (item.discard && !all) continue;
                // convert items to gold (as long as raw mode is not enabled), always gather up all the gold coins found
                if ((!raw && item.convert_to_gold) || item.displayname == "gold coin" || item.displayname == "platinum coin" || item.displayname == "crystal coin") {
                    extraGold += item.GetMaxValue() * count;
                } else {
                    itemDrops.Add(new Tuple<Item, int>(item, count));
                }
            }

            // handle coin drops, we always convert the gold to the highest possible denomination (so if gold = 10K, we display a crystal coin)
            long currentGold = extraGold;
            if (currentGold > 10000) {
                itemDrops.Add(new Tuple<Item, int>(StorageManager.getItem("crystal coin"), (int)(currentGold / 10000)));
                currentGold = currentGold % 10000;
            }
            if (currentGold > 100) {
                itemDrops.Add(new Tuple<Item, int>(StorageManager.getItem("platinum coin"), (int)(currentGold / 100)));
                currentGold = currentGold % 100;
            }
            if (currentGold > 0) {
                itemDrops.Add(new Tuple<Item, int>(StorageManager.getItem("gold coin"), (int)(currentGold)));
            }

            // now order by value so most valuable items are placed first
            // we use a special value for the gold coins so the gold is placed together in the order crystal > platinum > gold
            // gold coins = <gold total> - 2, platinum coins = <gold total> - 1, crystal coins = <gold total>
            itemDrops = itemDrops.OrderByDescending(o => o.Item1.displayname == "gold coin" ? extraGold - 2 : (o.Item1.displayname == "platinum coin" ? extraGold - 1 : (o.Item1.displayname == "crystal coin" ? extraGold : o.Item1.GetMaxValue() * o.Item2))).ToList();
            return new Tuple<Dictionary<Creature, int>, List<Tuple<Item, int>>>(creatureKills, itemDrops);
        }
Exemplo n.º 10
0
 private static Creature registerCreature(Creature cr)
 {
     if (cr == null) return null;
     lock (CreatureLock) {
         if (_creatureIdMap.ContainsKey(cr.id)) {
             cr.image.Dispose();
             return _creatureIdMap[cr.id];
         }
         _creatureIdMap.Add(cr.id, cr);
         string name = cr.GetName().ToLower();
         if (!_creatureNameMap.ContainsKey(name)) {
             _creatureNameMap.Add(cr.GetName().ToLower(), cr);
         }
     }
     return cr;
 }
Exemplo n.º 11
0
 public Image RecentDropsBox(Creature creature, List<Tuple<Item, int>> items, int imageHeight, List<ItemRegion> regions)
 {
     Bitmap bitmap = new Bitmap(BlockWidth, imageHeight);
     using (Graphics gr = Graphics.FromImage(bitmap)) {
         using (Brush brush = new SolidBrush(StyleManager.MainFormButtonColor)) {
             gr.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
         }
         gr.DrawRectangle(Pens.Black, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1));
         Rectangle creatureRegion = new Rectangle(1, 1, imageHeight - 1, imageHeight - 1);
         RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, imageHeight - 2, imageHeight - 2));
         RenderImageResized(gr, creature.GetImage(), creatureRegion);
         regions.Add(new ItemRegion { item = creature, region = creatureRegion });
         int count = 0;
         foreach (Tuple<Item, int> item in items) {
             Rectangle region = new Rectangle(8 + (imageHeight - 1) * ++count, 1, imageHeight - 2, imageHeight - 2);
             regions.Add(new ItemRegion { item = item.Item1, region = region });
             RenderImageResized(gr, StyleManager.GetImage("item_background.png"), region);
             RenderItemCount(gr, item, region);
         }
     }
     return bitmap;
 }
Exemplo n.º 12
0
        public SimpleLootNotification(Creature cr, List<Tuple<Item, int>> items)
            : base()
        {
            this.InitializeComponent();
            this.creature = cr;

            this.InitializeSimpleNotification();

            creatureBox.Click -= c_Click;

            ToolTip value_tooltip = new ToolTip();
            value_tooltip.AutoPopDelay = 60000;
            value_tooltip.InitialDelay = 500;
            value_tooltip.ReshowDelay = 0;
            value_tooltip.ShowAlways = true;
            value_tooltip.UseFading = true;

            int max_x = 300;
            int base_x = 64, base_y = 20;
            int x = 0;
            int y = 0;
            int item_spacing = 4;
            Size item_size = new Size(32, 32);

            List<Tuple<Item, int>> updatedItems = new List<Tuple<Item, int>>();
            foreach (Tuple<Item, int> tpl in items) {
                if (tpl.Item1.GetName().ToLower() == "gold coin" && tpl.Item2 > 100) {
                    Item platinumCoin = StorageManager.getItem("platinum coin");
                    updatedItems.Add(new Tuple<Item, int>(platinumCoin, tpl.Item2 / 100));
                    updatedItems.Add(new Tuple<Item,int>(tpl.Item1, tpl.Item2 % 100));
                } else {
                    updatedItems.Add(tpl);
                }
            }
            updatedItems = updatedItems.OrderByDescending(o => o.Item1.GetMaxValue() * o.Item2).ToList();

            foreach (Tuple<Item, int> tpl in updatedItems) {
                Item item = tpl.Item1;
                int count = tpl.Item2;
                while (count > 0) {
                    if (x >= (max_x - item_size.Width - item_spacing)) {
                        x = 0;
                        y = y + item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable) mitems = Math.Min(count, 100);
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name = item.GetName();
                    picture_box.Size = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop = false;
                    picture_box.Click += openItem_Click;
                    if (item.stackable) {
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    } else {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode = PictureBoxSizeMode.StretchImage;
                    picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                    value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + Math.Max(item.actual_value, item.vendor_value) * mitems);
                    this.Controls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            Image creatureImage = cr.GetImage();
            if (creatureImage.Size.Width <= creatureBox.Width && creatureImage.Size.Height <= creatureBox.Height) {
                creatureBox.SizeMode = PictureBoxSizeMode.CenterImage;
            } else {
                creatureBox.SizeMode = PictureBoxSizeMode.Zoom;
            }
            this.creatureBox.Image = cr.GetImage();
            this.creatureDropLabel.Text = String.Format("Loot of {0}.", cr.displayname);
        }
Exemplo n.º 13
0
        private void ShowCreatureStats(Creature c, string comm)
        {
            if (c == null) return;
            CreatureStatsForm f = new CreatureStatsForm();
            f.creature = c;

            ShowNotification(f, comm);
        }
Exemplo n.º 14
0
 private static void UpdateTaskKills(Creature creature)
 {
     lock(killUpdate) {
         foreach (var kvp in trackedTasks) {
             if (kvp.Value) {
                 Task task = StorageManager.getTask(kvp.Key);
                 if (task.creatures.Contains(creature.id)) {
                     int newKills = taskKills[kvp.Key] + 1;
                     LootDatabaseManager.ExecuteNonQuery(String.Format("UPDATE TrackedTasks SET kills={0} WHERE taskid={1}", newKills, kvp.Key));
                     taskKills[kvp.Key] = newKills;
                     if (TaskUpdated != null) TaskUpdated(task, newKills);
                 }
             }
         }
     }
 }
Exemplo n.º 15
0
        private PictureBox CreateCreatureDropsBox(Creature creature, List<Tuple<Item, int>> items, string message, int x, ref int y, List<Control> controls, int imageHeight, List<ItemRegion> region = null, int index = 0)
        {
            Image image = RecentDropsBox(creature, items, imageHeight, region);
            PictureBox box = new PictureBox();
            box.Size = image.Size;
            box.BackColor = Color.Transparent;
            box.Location = new Point(x, y);
            box.Image = image;
            box.Name = index.ToString();
            this.Controls.Add(box);
            controls.Add(box);
            // copy button
            PictureBox copyButton = new PictureBox();
            copyButton.Size = new Size(box.Size.Height - 4, box.Size.Height - 4);
            copyButton.BackColor = StyleManager.MainFormButtonColor;
            copyButton.Location = new Point(box.Location.X + box.Size.Width - box.Size.Height + 2, y + 2);
            copyButton.Click += CopyLootText;
            copyButton.Name = message;
            copyButton.Image = StyleManager.GetImage("copyicon.png");
            copyButton.SizeMode = PictureBoxSizeMode.Zoom;
            this.Controls.Add(copyButton);
            controls.Add(copyButton);
            copyButton.BringToFront();

            y += box.Height;
            return box;
        }
Exemplo n.º 16
0
 private void CreateCreatureBox(Creature creature, int count, int x, ref int y, List<Control> controls)
 {
     Image image = CreatureBox(creature, count);
     PictureBox box = new PictureBox();
     box.Size = image.Size;
     box.BackColor = Color.Transparent;
     box.Location = new Point(x, y);
     box.Image = image;
     box.Name = "creature" + Constants.CommandSymbol + creature.title;
     box.Click += CommandClick;
     this.Controls.Add(box);
     controls.Add(box);
     y += box.Height;
 }
Exemplo n.º 17
0
 public void AddSkin(string message, Creature cr, Item item, int count, string timestamp)
 {
     lock (huntLock) {
         if (!this.loot.logMessages.ContainsKey(timestamp)) this.loot.logMessages.Add(timestamp, new List<string>());
         this.loot.logMessages[timestamp].Add(message);
         if (!this.loot.creatureLoot.ContainsKey(cr)) {
             this.loot.creatureLoot.Add(cr, new Dictionary<Item, int>());
         }
         foreach (Item i in this.loot.creatureLoot[cr].Keys) {
             if (i.id == cr.skin.dropitemid) {
                 this.loot.creatureLoot[cr][i] += count;
                 return;
             }
         }
         this.loot.creatureLoot[cr].Add(item, count);
     }
 }
Exemplo n.º 18
0
        public SimpleLootNotification(Creature cr, List<Tuple<Item, int>> items, string message)
            : base()
        {
            this.InitializeComponent();
            this.creature = cr;

            this.Size = new Size(SettingsManager.getSettingInt("SimpleNotificationWidth"), this.Size.Height);
            bool showCopyButton = SettingsManager.getSettingBool("SimpleNotificationCopyButton");

            this.InitializeSimpleNotification();

            creatureBox.Click -= c_Click;

            ToolTip value_tooltip = new ToolTip();
            value_tooltip.AutoPopDelay = 60000;
            value_tooltip.InitialDelay = 500;
            value_tooltip.ReshowDelay = 0;
            value_tooltip.ShowAlways = true;
            value_tooltip.UseFading = true;

            int max_x = this.Size.Width - creatureBox.Width - (showCopyButton ? 32 : 4);
            int base_x = 64, base_y = 20;
            int x = 0;
            int y = 0;
            int item_spacing = 4;
            Size item_size = new Size(32, 32);

            List<Tuple<Item, int>> updatedItems = new List<Tuple<Item, int>>();
            foreach (Tuple<Item, int> tpl in items) {
                if (tpl.Item1.GetName().ToLower() == "gold coin" && tpl.Item2 > 100) {
                    Item platinumCoin = StorageManager.getItem("platinum coin");
                    updatedItems.Add(new Tuple<Item, int>(platinumCoin, tpl.Item2 / 100));
                    updatedItems.Add(new Tuple<Item, int>(tpl.Item1, tpl.Item2 % 100));
                } else {
                    updatedItems.Add(tpl);
                }
            }
            updatedItems = updatedItems.OrderByDescending(o => o.Item1.GetMaxValue() * o.Item2).ToList();

            x = 0;
            foreach (Tuple<Item, int> tpl in updatedItems) {
                Item item = tpl.Item1;
                int count = tpl.Item2;
                while (count > 0) {
                    if (x >= (max_x - item_size.Width - item_spacing)) {
                        item_size = new Size(24, 24);
                        x = 0;
                        base_y = 4;
                        creatureDropLabel.Visible = false;
                        break;
                    }
                    int mitems = 1;
                    if (item.stackable) mitems = Math.Min(count, 100);
                    count -= mitems;

                    x += item_size.Width + item_spacing;
                }
                if (x == 0) break;
            }

            x = 0;
            foreach (Tuple<Item, int> tpl in updatedItems) {
                Item item = tpl.Item1;
                int count = tpl.Item2;
                while (count > 0) {
                    if (x >= (max_x - item_size.Width - item_spacing)) {
                        x = 0;
                        y = y + item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable) mitems = Math.Min(count, 100);
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name = item.GetName();
                    picture_box.Size = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop = false;
                    picture_box.Click += openItem_Click;
                    if (item.stackable) {
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    } else {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode = PictureBoxSizeMode.Zoom;
                    picture_box.BackgroundImage = StyleManager.GetImage("item_background.png");
                    picture_box.BackgroundImageLayout = ImageLayout.Zoom;
                    value_tooltip.SetToolTip(picture_box, item.displayname.ToTitle() + " value: " + item.GetMaxValue() * mitems);
                    this.Controls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            Image creatureImage = cr.GetImage();
            if (creatureImage.Size.Width <= creatureBox.Width && creatureImage.Size.Height <= creatureBox.Height) {
                creatureBox.SizeMode = PictureBoxSizeMode.CenterImage;
            } else {
                creatureBox.SizeMode = PictureBoxSizeMode.Zoom;
            }
            this.creatureBox.Image = cr.GetImage();
            this.creatureDropLabel.Text = String.Format("Loot of {0}.", cr.displayname);

            if (showCopyButton) {
                PictureBox copyButton = new PictureBox();
                copyButton.Size = new Size(32, 32);
                copyButton.BackColor = Color.Transparent;
                copyButton.Location = new Point(this.Size.Width - copyButton.Size.Width - 4, base_y == 4 ? (this.Size.Height - copyButton.Size.Height) / 2 : base_y);
                copyButton.Click += CopyLootText;
                copyButton.Name = message;
                copyButton.Image = StyleManager.GetImage("copyicon.png");
                copyButton.SizeMode = PictureBoxSizeMode.Zoom;
                this.Controls.Add(copyButton);
            }
        }
Exemplo n.º 19
0
 private bool TrackCreature(Creature cr)
 {
     if (SettingsManager.getSettingBool("IgnoreLowExperience")) {
         return cr.experience >= SettingsManager.getSettingInt("IgnoreLowExperienceValue");
     }
     return true;
 }
Exemplo n.º 20
0
 public Image CreatureBox(Creature creature, int amount = 0)
 {
     Bitmap bitmap = new Bitmap(BlockWidth, BlockHeight);
     using (Graphics gr = Graphics.FromImage(bitmap)) {
         Color backColor = StyleManager.GetElementColor(creature.GetStrength());
         using (Brush brush = new SolidBrush(backColor)) {
             gr.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
         }
         gr.DrawRectangle(Pens.Black, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1));
         RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2));
         RenderImageResized(gr, creature.GetImage(), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2));
         RenderText(gr, creature.displayname.ToTitle(), BlockHeight + 2, Color.Empty, StyleManager.NotificationTextColor, Color.Black, BlockHeight);
         if (amount > 0) {
             RenderText(gr, amount.ToString(), -BlockWidth, Color.FromArgb(backColor.R / 2, backColor.G / 2, backColor.B / 2), StyleManager.NotificationTextColor, Color.Black, BlockHeight);
         }
     }
     return bitmap;
 }
Exemplo n.º 21
0
        private static Creature createCreature(SQLiteDataReader reader)
        {
            SQLiteCommand command;

            if (!reader.Read()) {
                return null;
            }

            Creature cr = new Creature();
            cr.permanent = true;
            cr.id = reader.GetInt32(0);
            cr.displayname = reader["name"].ToString();
            cr.health = reader.IsDBNull(2) ? DATABASE_NULL : reader.GetInt32(2);
            cr.experience = reader.IsDBNull(3) ? DATABASE_NULL : reader.GetInt32(3);
            cr.maxdamage = reader.IsDBNull(4) ? DATABASE_NULL : reader.GetInt32(4);
            cr.summoncost = reader.IsDBNull(5) ? DATABASE_NULL : reader.GetInt32(5);
            cr.illusionable = reader.GetBoolean(6);
            cr.pushable = reader.GetBoolean(7);
            cr.pushes = reader.GetBoolean(8);
            cr.res_phys = reader.IsDBNull(9) ? 100 : reader.GetInt32(9);
            cr.res_holy = reader.IsDBNull(10) ? 100 : reader.GetInt32(10);
            cr.res_death = reader.IsDBNull(11) ? 100 : reader.GetInt32(11);
            cr.res_fire = reader.IsDBNull(12) ? 100 : reader.GetInt32(12);
            cr.res_energy = reader.IsDBNull(13) ? 100 : reader.GetInt32(13);
            cr.res_ice = reader.IsDBNull(14) ? 100 : reader.GetInt32(14);
            cr.res_earth = reader.IsDBNull(15) ? 100 : reader.GetInt32(15);
            cr.res_drown = reader.IsDBNull(16) ? 100 : reader.GetInt32(16);
            cr.res_lifedrain = reader.IsDBNull(17) ? 100 : reader.GetInt32(17);
            cr.paralysable = reader.GetBoolean(18);
            cr.senseinvis = reader.GetBoolean(19);
            cr.abilities = reader.IsDBNull(20) ? DATABASE_STRING_NULL : reader["abilities"].ToString();
            cr.title = reader[21].ToString();
            cr.speed = reader.IsDBNull(22) ? DATABASE_NULL : reader.GetInt32(22);
            cr.armor = reader.IsDBNull(23) ? DATABASE_NULL : reader.GetInt32(23);
            cr.boss = reader.GetInt32(24) > 0;
            if (reader.IsDBNull(25)) {
                return null;
            }
            cr.image = Image.FromStream(reader.GetStream(25));

            command = new SQLiteCommand(String.Format("SELECT skinitemid, knifeitemid, percentage FROM Skins WHERE creatureid={0}", cr.id), mainForm.conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                Skin skin = new Skin();
                skin.dropitemid = reader.GetInt32(0);
                skin.skinitemid = reader.GetInt32(1);
                skin.percentage = reader.IsDBNull(2) ? DATABASE_NULL : reader.GetFloat(2);
                cr.skin = skin;
            }

            command = new SQLiteCommand(String.Format("SELECT itemid, percentage, min, max FROM CreatureDrops WHERE creatureid={0}", cr.id), mainForm.conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                ItemDrop itemDrop = new ItemDrop();
                itemDrop.creatureid = cr.id;
                itemDrop.itemid = reader.GetInt32(0);
                itemDrop.percentage = reader.IsDBNull(1) ? DATABASE_NULL : reader.GetFloat(1);
                if (itemDrop.percentage > 100) {
                    itemDrop.min = 1;
                    itemDrop.max = (int)(itemDrop.percentage / 100.0 * 2.0);
                    itemDrop.percentage = 100;
                } else {
                    itemDrop.min = Math.Max(reader.GetInt32(2), 1);
                    itemDrop.max = Math.Max(reader.GetInt32(3), itemDrop.min);
                }
                cr.itemdrops.Add(itemDrop);
            }

            return cr;
        }
Exemplo n.º 22
0
 public bool ContainsLootCreature(Creature cr)
 {
     lock (huntLock) {
         return lootCreatures.Contains(cr.GetName(), StringComparer.OrdinalIgnoreCase);
     }
 }
Exemplo n.º 23
0
 private void deleteCreatureFromLog(Creature cr)
 {
     lock (hunts) {
         if (activeHunt.loot.killCount.ContainsKey(cr)) {
             activeHunt.loot.killCount.Remove(cr);
         }
         if (activeHunt.loot.creatureLoot.ContainsKey(cr)) {
             activeHunt.loot.creatureLoot.Remove(cr);
         }
         using (var transaction = lootConn.BeginTransaction()) {
             SQLiteCommand command;
             foreach (KeyValuePair<string, List<string>> kvp in activeHunt.loot.logMessages) {
                 foreach (string msg in kvp.Value) {
                     if (ParseCreatureFromLootMessage(msg) == cr) {
                         command = new SQLiteCommand(String.Format("DELETE FROM \"{0}\" WHERE message=\"{1}\"", activeHunt.GetTableName(), msg.Replace("\"", "\\\"")), lootConn, transaction);
                         command.ExecuteNonQuery();
                     }
                 }
             }
             transaction.Commit();
         }
     }
     LootChanged();
 }
Exemplo n.º 24
0
 public void DeleteCreature(Creature cr)
 {
     lock (huntLock) {
         if (this.loot.killCount.ContainsKey(cr)) {
             this.loot.killCount.Remove(cr);
         }
         if (this.loot.creatureLoot.ContainsKey(cr)) {
             this.loot.creatureLoot.Remove(cr);
         }
         using (var transaction = LootDatabaseManager.BeginTransaction()) {
             foreach (KeyValuePair<string, List<string>> kvp in this.loot.logMessages) {
                 foreach (string msg in kvp.Value) {
                     if (Parser.ParseCreatureFromLootMessage(msg) == cr) {
                         LootDatabaseManager.DeleteMessage(this, msg, transaction);
                     }
                 }
             }
             transaction.Commit();
         }
     }
 }
Exemplo n.º 25
0
        public SimpleLootNotification(Creature cr, List<Tuple<Item, int>> items) : base() {
            this.InitializeComponent();
            this.creature = cr;
            
            this.InitializeSimpleNotification();

            creatureBox.Click -= c_Click;

            ToolTip value_tooltip = new ToolTip();
            value_tooltip.AutoPopDelay = 60000;
            value_tooltip.InitialDelay = 500;
            value_tooltip.ReshowDelay = 0;
            value_tooltip.ShowAlways = true;
            value_tooltip.UseFading = true;

            int max_x = 300;
            int base_x = 64, base_y = 20;
            int x = 0;
            int y = 0;
            int item_spacing = 4;
            Size item_size = new Size(32, 32);

            List<Tuple<Item, int>> updatedItems = new List<Tuple<Item, int>>();
            foreach (Tuple<Item, int> tpl in items) {
                if (tpl.Item1.GetName().ToLower() == "gold coin" && tpl.Item2 > 100) {
                    Item platinumCoin = MainForm.getItem("platinum coin");
                    updatedItems.Add(new Tuple<Item, int>(platinumCoin, tpl.Item2 / 100));
                    updatedItems.Add(new Tuple<Item,int>(tpl.Item1, tpl.Item2 % 100));
                } else {
                    updatedItems.Add(tpl);
                }
            }

            foreach (Tuple<Item, int> tpl in updatedItems) {
                Item item = tpl.Item1;
                int count = tpl.Item2;
                while (count > 0) {
                    if (x >= (max_x - item_size.Width - item_spacing)) {
                        x = 0;
                        y = y + item_size.Height + item_spacing;
                    }
                    int mitems = 1;
                    if (item.stackable) mitems = Math.Min(count, 100);
                    count -= mitems;

                    PictureBox picture_box = new PictureBox();
                    picture_box.Location = new System.Drawing.Point(base_x + x, base_y + y);
                    picture_box.Name = item.GetName();
                    picture_box.Size = new System.Drawing.Size(item_size.Width, item_size.Height);
                    picture_box.TabIndex = 1;
                    picture_box.TabStop = false;
                    picture_box.Click += openItem_Click;
                    if (item.stackable) {
                        /*
                        Bitmap image = LootDropForm.GetStackImage(item.image, mitems, item);
                        Graphics gr = Graphics.FromImage(image);
                        int numbers = (int)Math.Floor(Math.Log(mitems, 10)) + 1;
                        int xoffset = 1, logamount = mitems;
                        for (int i = 0; i < numbers; i++) {
                            int imagenr = logamount % 10;
                            xoffset = xoffset + MainForm.image_numbers[imagenr].Width + 1;
                            gr.DrawImage(MainForm.image_numbers[imagenr],
                                new Point(image.Width - xoffset, image.Height - MainForm.image_numbers[imagenr].Height - 3));
                            logamount /= 10;
                        }*/
                        picture_box.Image = LootDropForm.DrawCountOnItem(item, mitems);
                    } else {
                        picture_box.Image = item.GetImage();
                    }

                    picture_box.SizeMode = PictureBoxSizeMode.StretchImage;
                    picture_box.BackgroundImage = MainForm.item_background;
                    value_tooltip.SetToolTip(picture_box, System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item.displayname) + " value: " + Math.Max(item.actual_value, item.vendor_value) * mitems);
                    this.Controls.Add(picture_box);

                    x += item_size.Width + item_spacing;
                }
            }

            this.creatureBox.Image = cr.GetImage();
            this.creatureDropLabel.Text = String.Format("Loot of {0}.", cr.displayname);
        }
Exemplo n.º 26
0
 public Dictionary<Creature, int> GetCreatureKills(Creature filter)
 {
     return GetCreatureKills(new List<Creature> { filter });
 }
Exemplo n.º 27
0
 private void lootButton_Click(object sender, EventArgs e)
 {
     rawName = "";
     creatureName = "";
     lootCreature = null;
     this.UpdateLootInternal();
     this.UpdateCommand();
 }
Exemplo n.º 28
0
        public static Tuple <Dictionary <Creature, int>, List <Tuple <Item, int> > > GenerateLootInformation(Hunt hunt, string rawName, Creature lootCreature)
        {
            Dictionary <Creature, int> creatureKills;
            List <Tuple <Item, int> >  itemDrops = new List <Tuple <Item, int> >();

            lock (HuntManager.hunts) {
                bool            raw = rawName == "raw";
                bool            all = raw || rawName == "all";
                List <Creature> displayedCreatures = null;
                if (!hunt.trackAllCreatures && hunt.trackedCreatures.Length > 0)
                {
                    displayedCreatures = new List <Creature>();
                    foreach (string creature in hunt.lootCreatures)
                    {
                        Creature cr = StorageManager.getCreature(creature.ToLower());
                        if (cr != null)
                        {
                            displayedCreatures.Add(cr);
                        }
                    }
                }
                else if (SettingsManager.getSettingBool("IgnoreLowExperience"))
                {
                    displayedCreatures = new List <Creature>();
                    foreach (Creature cr in hunt.loot.killCount.Keys)
                    {
                        if (cr.experience >= SettingsManager.getSettingInt("IgnoreLowExperienceValue"))
                        {
                            displayedCreatures.Add(cr);
                        }
                    }
                }

                if (lootCreature != null)
                {
                    //the command is loot@<creature>, so we only display the kills and loot from the specified creature
                    creatureKills = new Dictionary <Creature, int>();
                    if (hunt.loot.killCount.ContainsKey(lootCreature))
                    {
                        creatureKills.Add(lootCreature, hunt.loot.killCount[lootCreature]);
                    }
                    else
                    {
                        creatureKills = new Dictionary <Creature, int>(); //empty dictionary
                    }
                }
                else if (displayedCreatures == null)
                {
                    creatureKills = hunt.loot.killCount; //display all creatures
                }
                else
                {
                    // only display tracked creatures
                    creatureKills = new Dictionary <Creature, int>();
                    foreach (Creature cr in displayedCreatures)
                    {
                        if (!hunt.loot.killCount.ContainsKey(cr))
                        {
                            continue;
                        }

                        creatureKills.Add(cr, hunt.loot.killCount[cr]);
                    }
                }

                // now handle item drops, gather a count for every item
                Dictionary <Item, int> itemCounts = new Dictionary <Item, int>();
                foreach (KeyValuePair <Creature, Dictionary <Item, int> > kvp in hunt.loot.creatureLoot)
                {
                    if (lootCreature != null && kvp.Key != lootCreature)
                    {
                        continue;                                                  // if lootCreature is specified, only consider loot from the specified creature
                    }
                    if (displayedCreatures != null && !displayedCreatures.Contains(kvp.Key))
                    {
                        continue;
                    }
                    foreach (KeyValuePair <Item, int> kvp2 in kvp.Value)
                    {
                        Item item  = kvp2.Key;
                        int  value = kvp2.Value;
                        if (!itemCounts.ContainsKey(item))
                        {
                            itemCounts.Add(item, value);
                        }
                        else
                        {
                            itemCounts[item] += value;
                        }
                    }
                }

                // now we do item conversion
                long extraGold = 0;
                foreach (KeyValuePair <Item, int> kvp in itemCounts)
                {
                    Item item  = kvp.Key;
                    int  count = kvp.Value;
                    // discard items that are set to be discarded (as long as all/raw mode is not enabled)
                    if (item.discard && !all)
                    {
                        continue;
                    }
                    // convert items to gold (as long as raw mode is not enabled), always gather up all the gold coins found
                    if ((!raw && item.convert_to_gold) || item.displayname == "gold coin" || item.displayname == "platinum coin" || item.displayname == "crystal coin")
                    {
                        extraGold += Math.Max(item.actual_value, item.vendor_value) * count;
                    }
                    else
                    {
                        itemDrops.Add(new Tuple <Item, int>(item, count));
                    }
                }

                // handle coin drops, we always convert the gold to the highest possible denomination (so if gold = 10K, we display a crystal coin)
                long currentGold = extraGold;
                if (currentGold > 10000)
                {
                    itemDrops.Add(new Tuple <Item, int>(StorageManager.getItem("crystal coin"), (int)(currentGold / 10000)));
                    currentGold = currentGold % 10000;
                }
                if (currentGold > 100)
                {
                    itemDrops.Add(new Tuple <Item, int>(StorageManager.getItem("platinum coin"), (int)(currentGold / 100)));
                    currentGold = currentGold % 100;
                }
                if (currentGold > 0)
                {
                    itemDrops.Add(new Tuple <Item, int>(StorageManager.getItem("gold coin"), (int)(currentGold)));
                }

                // now order by value so most valuable items are placed first
                // we use a special value for the gold coins so the gold is placed together in the order crystal > platinum > gold
                // gold coins = <gold total> - 2, platinum coins = <gold total> - 1, crystal coins = <gold total>
                itemDrops = itemDrops.OrderByDescending(o => o.Item1.displayname == "gold coin" ? extraGold - 2 : (o.Item1.displayname == "platinum coin" ? extraGold - 1 : (o.Item1.displayname == "crystal coin" ? extraGold : Math.Max(o.Item1.actual_value, o.Item1.vendor_value) * o.Item2))).ToList();
            }
            return(new Tuple <Dictionary <Creature, int>, List <Tuple <Item, int> > >(creatureKills, itemDrops));
        }