GoldToText() public static method

public static GoldToText ( double gold ) : string
gold double
return string
コード例 #1
0
        private void itemSelectionBox_TextChanged(object sender, EventArgs e)
        {
            Item item = StorageManager.getItem(itemSelectionBox.Text);

            if (item != null)
            {
                itemPropertyItemBox.Image = item.image;
                stackableValueLabel.Text  = item.stackable ? "True" : "False";
                vendorValueLabel.Text     = StyleManager.GoldToText(item.vendor_value);
                actualValueLabel.Text     = StyleManager.GoldToText(item.actual_value);
                capacityLabel.Text        = String.Format("{0:0.00}", item.capacity);
                discardValueLabel.Text    = item.discard ? "True" : "False";
                convertValueLabel.Text    = item.convert_to_gold ? "True" : "False";
                categoryValueLabel.Text   = item.category;
            }
        }
コード例 #2
0
        private void CreateRatioDisplay(List <string> itemList, int baseX, int baseY, List <Control> discardControls, List <Control> convertControls)
        {
            int it = 0;

            foreach (string itemName in itemList)
            {
                Item       item       = StorageManager.getItem(itemName);
                PictureBox pictureBox = new PictureBox();
                pictureBox.Image                 = item.image;
                pictureBox.Location              = new Point(baseX + it * 52, baseY);
                pictureBox.BackgroundImage       = StyleManager.GetImage("item_background.png");
                pictureBox.BackgroundImageLayout = ImageLayout.Zoom;
                pictureBox.SizeMode              = PictureBoxSizeMode.Zoom;
                pictureBox.Size = new Size(48, 48);
                pictureBox.Name = itemName;

                double goldRatio = item.GetMaxValue() / item.capacity;
                Label  label     = new Label();
                label.Text      = String.Format(goldRatio < 100 ? "{0:0.#}" : "{0:0.}", goldRatio);
                label.Location  = new Point(pictureBox.Location.X, pictureBox.Location.Y + pictureBox.Size.Height);
                label.Font      = new Font(FontFamily.GenericSansSerif, 10.0f, FontStyle.Bold);
                label.Size      = new Size(48, 24);
                label.ForeColor = StyleManager.MainFormButtonColor;
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Name      = itemName + ":" + goldRatio.ToString(CultureInfo.InvariantCulture);
                label.Click    += SetDiscardRatio;
                discardControls.Add(label);

                Label convertLabel = new Label();
                convertLabel.Text      = StyleManager.GoldToText(item.GetMaxValue()).ToString();
                convertLabel.Location  = new Point(pictureBox.Location.X, label.Location.Y + label.Size.Height);
                convertLabel.Font      = new Font(FontFamily.GenericSansSerif, 10.0f, FontStyle.Bold);
                convertLabel.Size      = new Size(48, 24);
                convertLabel.ForeColor = StyleManager.MainFormButtonColor;
                convertLabel.TextAlign = ContentAlignment.MiddleCenter;
                convertLabel.Name      = itemName + ":" + goldRatio.ToString(CultureInfo.InvariantCulture);
                convertLabel.Click    += SetConvertValue;
                convertControls.Add(convertLabel);

                this.Controls.Add(pictureBox);
                this.Controls.Add(label);
                this.Controls.Add(convertLabel);
                it++;
            }
        }
コード例 #3
0
ファイル: CreatureStatsForm.cs プロジェクト: umdez/Tibialyzer
        public override void LoadForm()
        {
            this.SuspendForm();
            int horizontal, left, right;

            this.statsButton.Name = creature.GetName().ToLower();
            this.huntButton.Name  = creature.GetName().ToLower();
            int health     = creature.health;
            int experience = creature.experience;
            List <Resistance> resistances = new List <Resistance>();

            resistances.Add(new Resistance("Ice", creature.res_ice));
            resistances.Add(new Resistance("Holy", creature.res_holy));
            resistances.Add(new Resistance("Death", creature.res_death));
            resistances.Add(new Resistance("Phys", creature.res_phys));
            resistances.Add(new Resistance("Earth", creature.res_earth));
            resistances.Add(new Resistance("Energy", creature.res_energy));
            resistances.Add(new Resistance("Fire", creature.res_fire));
            // load image from the creature
            this.mainImage.Image = creature.GetImage();
            // set health of creature
            this.healthLabel.Text = (health > 0 ? health.ToString() + " Health" : "Unknown");
            horizontal            = 96 - healthLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.healthLabel.Padding = new Padding(left, 2, right, 2);
            // set exp of creature
            this.expLabel.Text = (experience >= 0 ? experience.ToString() : "Unknown") + " Exp";
            horizontal         = 96 - expLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.expLabel.Padding = new Padding(left, 2, right, 2);
            // add resistances of creature in order
            AddResistances(resistances);
            // set background of actual form to transparent
            this.BackColor      = StyleManager.NotificationBackgroundColor;
            this.nameLabel.Text = this.creature.displayname.ToTitle();
            Font f        = StyleManager.FontList[0];
            Font prevFont = f;

            for (int i = 0; i < StyleManager.FontList.Count; i++)
            {
                Font font  = StyleManager.FontList[i];
                int  width = TextRenderer.MeasureText(this.nameLabel.Text, font).Width;
                if (width < this.mainImage.Size.Width)
                {
                    f = prevFont;
                }
                else
                {
                    break;
                }
                prevFont = font;
            }

            string goldstring  = "";
            double averageGold = 0;

            foreach (ItemDrop itemDrop in creature.itemdrops)
            {
                if (itemDrop.percentage > 0)
                {
                    Item item = StorageManager.getItem(itemDrop.itemid);
                    averageGold += ((itemDrop.max + itemDrop.min) / 2.0) * itemDrop.percentage * item.GetMaxValue() / 100;
                }
            }
            goldstring = StyleManager.GoldToText((long)averageGold);
            this.averageGoldLabel.Text = "Average Gold: " + goldstring;

            this.maxDamageLabel.Text        = "Max Damage: " + (this.creature.maxdamage >= 0 ? this.creature.maxdamage.ToString() : "-");
            this.abilitiesLabel.Text        = RemoveTextInBrackets(this.creature.abilities.Replace(", ", "\n"));
            this.abilitiesLabel.BorderStyle = BorderStyle.FixedSingle;

            // average gold of creature
            this.averageGoldCenterLabel.Text = goldstring.Replace("Average Gold:", "") + " Gold";
            horizontal = 96 - averageGoldCenterLabel.Size.Width;
            left       = horizontal / 2;
            right      = horizontal - left;
            this.averageGoldCenterLabel.Padding = new Padding(left, 2, right, 2);
            // max damage of creature
            this.maxDamageCenterLabel.Text = (this.creature.maxdamage > 0 ? this.creature.maxdamage.ToString() + " Dmg" : "Unknown");
            horizontal = 96 - maxDamageCenterLabel.Size.Width;
            left       = horizontal / 2;
            right      = horizontal - left;
            this.maxDamageCenterLabel.Padding   = new Padding(left, 2, right, 2);
            this.maxDamageCenterLabel.ForeColor = StyleManager.MainFormSmallDangerColor;

            string tooltip;

            this.illusionableBox.Image = creature.illusionable ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.illusionable ? "Creature illusion works for this creature." : "Creature illusion does not work for this creature.";
            resistance_tooltip.SetToolTip(illusionableBox, tooltip);
            resistance_tooltip.SetToolTip(illusionableLabel, tooltip);
            this.summonableBox.Image = creature.summoncost > 0 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.summoncost > 0 ? "This creature can be summoned for " + creature.summoncost + " mana." : "This creature cannot be summoned.";
            resistance_tooltip.SetToolTip(summonableBox, tooltip);
            resistance_tooltip.SetToolTip(summonableLabel, tooltip);
            this.invisibleBox.Image = !creature.senseinvis ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = !creature.senseinvis ? "This creature does not detect invisibility." : "This creature detects invisibility.";
            resistance_tooltip.SetToolTip(invisibleBox, tooltip);
            resistance_tooltip.SetToolTip(invisibleLabel, tooltip);
            this.paralysableBox.Image = creature.paralysable ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.paralysable ? "This creature can be paralysed." : "This creature cannot be paralysed.";
            resistance_tooltip.SetToolTip(paralysableBox, tooltip);
            resistance_tooltip.SetToolTip(paralysableLabel, tooltip);
            this.pushableBox.Image = creature.pushable ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.pushable ? "This creature can be pushed." : "This creature cannot be pushed.";
            resistance_tooltip.SetToolTip(pushableBox, tooltip);
            resistance_tooltip.SetToolTip(pushableLabel, tooltip);
            this.pushesBox.Image = creature.pushes ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png");
            tooltip = creature.pushes ? "This creature pushes smaller creatures." : "This creature cannot push smaller creatures.";
            resistance_tooltip.SetToolTip(pushesBox, tooltip);
            resistance_tooltip.SetToolTip(pushesLabel, tooltip);

            this.Size           = new Size(this.Size.Width, (int)Math.Max(this.abilitiesLabel.Location.Y + this.abilitiesLabel.Size.Height + 10, this.expLabel.Location.Y + this.expLabel.Height + 10));
            this.nameLabel.Font = f;
            this.nameLabel.Left = this.mainImage.Left + (mainImage.Width - this.nameLabel.Size.Width) / 2;
            base.NotificationInitialize();
            RefreshTaskList(this.Size.Height);
            base.NotificationFinalize();
            this.RefreshForm();
            this.ResumeForm();
        }