public void DrawHover(SpriteBatch spriteBatch, Item item) { //Initialize Scalar Value int ScalarText = 20; int widestString = 0; foreach (Affix afx in item.AffixList) { double textWidth1 = item.Font1.MeasureString(afx.Desc).X; if (textWidth1 > widestString) { widestString = (int)textWidth1; } } float textWidth2; float WeaponBaseDisplay = 0; if (item.ItemSlot == Item.itemSlot.OneHanded || item.ItemSlot == Item.itemSlot.TwoHanded) { WeaponBaseDisplay = GlobalVariables.CalculateMeleePhysStat(item.AffixList, item.BaseStat); } if (item.BaseStat != WeaponBaseDisplay) { textWidth2 = GlobalVariables.Font16.MeasureString(((int)(WeaponBaseDisplay) - 20).ToString() + " - " + ((int)(WeaponBaseDisplay) + 20).ToString()).X; } else { textWidth2 = GlobalVariables.Font16.MeasureString((item.BaseStat - 20).ToString() + " - " + (item.BaseStat + 20).ToString()).X; } if (widestString < textWidth2) { widestString = (int)textWidth2; } float textWidth3 = (float)(0.0); if (item.BaseAttackSpeed > 0) { textWidth3 = GlobalVariables.font14.MeasureString("Attack Speed : " + item.BaseAttackSpeed.ToString()).X; } if (widestString < textWidth3) { widestString = (int)textWidth3; } //Store location Vector2 loc = item.location; List <string> ItemDesc = new List <string>(); if (item.ItemType == 1) { ItemDesc = GlobalVariables.GenerateDescList(item.ItemDescription, widestString + (item.ItemTexture.Width * .75), item.Font1); } else if (item.ItemType == 2 || item.ItemType == 5 || item.ItemType == 6 || item.ItemType == 7 || item.ItemType == 8 || item.ItemType == 9) { ItemDesc = GlobalVariables.GenerateDescList(item.ItemDescription, widestString + (item.ItemTexture.Width * .35), item.Font1); } else if (item.ItemType == 3) { ItemDesc = GlobalVariables.GenerateDescList(item.ItemDescription, widestString + (item.ItemTexture.Width * .2), item.Font1); } else if (item.ItemType == 4) { ItemDesc = GlobalVariables.GenerateDescList(item.ItemDescription, widestString + (item.ItemTexture.Width * .3), item.Font1); } //check to render on screen item.location = GlobalVariables.newLocation(item.location, widestString + 40, 70 + (int)(22 * item.affixes) + (int)(22 * ItemDesc.Count)); //Draw Shaded backgorund GlobalVariables.WaitToDraw(0, new Vector2((item.location.X + 80), (item.location.Y)), new Rectangle(0, 0, widestString + 40 + (int)(item.ItemTexture.Width * .75), 70 + (int)(22 * item.affixes) + (int)(22 * ItemDesc.Count) + 60), Color.Black, null, GlobalVariables.TestSquare); GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + 30)), new Rectangle(0, 0, 0, 0), item.RarityColor, item.Font1, null, item.ItemName); //Draw small item in top right if (item.ItemType == 1) { GlobalVariables.WaitToDraw(0, new Vector2((item.location.X + 175 + (widestString - item.ItemTexture.Width)), item.location.Y + 25), new Rectangle(0, 0, item.ItemTexture.Width, item.ItemTexture.Height), item.ItemColor, null, item.ItemTexture); } else if (item.ItemType == 2 || item.ItemType == 5 || item.ItemType == 6 || item.ItemType == 7 || item.ItemType == 8 || item.ItemType == 9) { GlobalVariables.WaitToDraw(0, new Vector2((item.location.X + 115 + (widestString - item.ItemTexture.Width)), item.location.Y + 25), new Rectangle(0, 0, item.ItemTexture.Width, item.ItemTexture.Height), item.ItemColor, null, item.ItemTexture); } else if (item.ItemType == 3 || item.ItemType == 4) { GlobalVariables.WaitToDraw(0, new Vector2((item.location.X + 140 + (widestString - item.ItemTexture.Width)), item.location.Y + 5), new Rectangle(0, 0, item.ItemTexture.Width, item.ItemTexture.Height), item.ItemColor, null, item.ItemTexture); } //Draw Base Stat if (item.ItemSlot == Item.itemSlot.OneHanded || item.ItemSlot == Item.itemSlot.TwoHanded) { if (item.BaseStat != (int)(WeaponBaseDisplay)) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.DarkSlateBlue, GlobalVariables.Font16, null, item.BaseStatName + " : " + ((int)(WeaponBaseDisplay) - 20).ToString() + " - " + ((int)(WeaponBaseDisplay) + 20).ToString()); } else { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, GlobalVariables.Font16, null, item.BaseStatName + " : " + (item.BaseStat - 20).ToString() + " - " + (item.BaseStat + 20).ToString()); } ScalarText += 30; } else if (item.ItemSlot == Item.itemSlot.Boots || item.ItemSlot == Item.itemSlot.Pants || item.ItemSlot == Item.itemSlot.Gloves || item.ItemSlot == Item.itemSlot.Chest || item.ItemSlot == Item.itemSlot.Helmet || item.ItemSlot == Item.itemSlot.Shoulders) { int newValue = GlobalVariables.CalculateEvasion(item.AffixList, item.BaseStat); if (newValue != item.BaseStat) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.DarkSlateBlue, GlobalVariables.Font16, null, item.BaseStatName + " : " + newValue.ToString()); } else { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, GlobalVariables.Font16, null, item.BaseStatName + " : " + item.BaseStat.ToString()); } ScalarText += 30; } //Draw Attack Speed if applicable if (item.ItemSlot == Item.itemSlot.OneHanded || item.ItemSlot == Item.itemSlot.TwoHanded) { float newAtkSpd = GlobalVariables.CalculateMeleeAttackSpeed(item.AffixList, (float)item.BaseAttackSpeed); if ((float)newAtkSpd != (float)item.BaseAttackSpeed) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.DarkSlateBlue, GlobalVariables.font14, null, "Attack Speed : " + newAtkSpd.ToString()); } else { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, GlobalVariables.font14, null, "Attack Speed : " + item.BaseAttackSpeed.ToString()); } ScalarText += 30; } //Draw Item aFfixes for (int intlc = 0; intlc < item.AffixList.Count; intlc++) { if (intlc < 4) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.White, item.Font1, null, item.AffixList[intlc].Desc); ScalarText += 20; } if (intlc == 4) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Orange, item.Font1, null, item.AffixList[intlc].Desc); ScalarText += 20; } if (intlc == 5) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Purple, item.Font1, null, item.AffixList[intlc].Desc); ScalarText += 20; } if (intlc > 5) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Brown, item.Font1, null, item.AffixList[intlc].Desc); ScalarText += 20; } } foreach (string str in ItemDesc) { GlobalVariables.WaitToDraw(1, new Vector2((item.location.X + 100), (item.location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, item.Font1, null, str); ScalarText += 20; } item.location = loc; }
public void Draw(SpriteBatch spriteBatch, Vector2 location, bool Clamp = false) { if (Clamp) { spriteBatch.Draw(ItemTexture, new Rectangle((int)location.X, (int)location.Y, ItemTexture.Width, ItemTexture.Height), ItemColor); return; } if (quality == 1) { spriteBatch.Draw(ItemTexture, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.White); RarityColor = Color.White; ItemColor = Color.White; } if (quality == 2) { spriteBatch.Draw(ItemTexture, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.AliceBlue); RarityColor = Color.AliceBlue; ItemColor = Color.AliceBlue; } if (quality == 3) { spriteBatch.Draw(ItemTexture, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.DeepSkyBlue); RarityColor = Color.DeepSkyBlue; ItemColor = Color.DeepSkyBlue; } if (quality == 4) { spriteBatch.Draw(ItemTexture, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.Orange); RarityColor = Color.Orange; ItemColor = Color.Orange; } if (quality == 5) { spriteBatch.Draw(LegendaryBg, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.White); spriteBatch.Draw(ItemTexture, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.NavajoWhite); RarityColor = Color.Purple; ItemColor = Color.NavajoWhite; } if (quality == 6) { spriteBatch.Draw(LegendaryBg, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.White); spriteBatch.Draw(ItemTexture, new Rectangle(Convert.ToInt32(location.X), Convert.ToInt32(location.Y), ItemTexture.Width, ItemTexture.Height), Color.White); RarityColor = Color.Brown; ItemColor = Color.White; } if (hover) { if (GlobalVariables.TheGame.blnEquip || GlobalVariables.TheGame.blnOpen) { if (GlobalVariables.ShowItemNames) { double textWidth = Font1.MeasureString(ItemName).X; if (ItemType == 1) { int offset = (int)(textWidth * .025); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 2 || ItemType == 5 || ItemType == 7 || ItemType == 8 || ItemType == 9) { int offset = (int)(textWidth * .275); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 3 || ItemType == 4) { int offset = (int)(textWidth * .15); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 6) { int offset = (int)(textWidth * .30); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } } return; } if (GlobalVariables.TheGame.ItemHovered) { if (GlobalVariables.ShowItemNames) { double textWidth = Font1.MeasureString(ItemName).X; if (ItemType == 1) { int offset = (int)(textWidth * .025); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 2 || ItemType == 5 || ItemType == 7 || ItemType == 8 || ItemType == 9) { int offset = (int)(textWidth * .275); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 3 || ItemType == 4) { int offset = (int)(textWidth * .15); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 6) { int offset = (int)(textWidth * .30); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } } return; } else { GlobalVariables.TheGame.ItemHovered = true; } if (GlobalVariables.ShowItemNames) { double textWidth = Font1.MeasureString(ItemName).X; if (ItemType == 1) { int offset = (int)(textWidth * .025); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 2 || ItemType == 5 || ItemType == 7 || ItemType == 8 || ItemType == 9) { int offset = (int)(textWidth * .275); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 3 || ItemType == 4) { int offset = (int)(textWidth * .15); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 6) { int offset = (int)(textWidth * .3); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } } int widestString = 0; foreach (Affix afx in AffixList) { double textWidth1 = Font1.MeasureString(afx.Desc).X; if (textWidth1 > widestString) { widestString = (int)textWidth1; } } float WeaponBaseDisplay = 0; if (ItemSlot == itemSlot.OneHanded || ItemSlot == itemSlot.TwoHanded) { WeaponBaseDisplay = GlobalVariables.CalculateMeleePhysStat(AffixList, BaseStat); } float textWidth2; if (BaseStat != WeaponBaseDisplay) { textWidth2 = GlobalVariables.Font16.MeasureString(((int)(WeaponBaseDisplay) - 20).ToString() + " - " + ((int)(WeaponBaseDisplay) + 20).ToString()).X; } else { textWidth2 = GlobalVariables.Font16.MeasureString((BaseStat - 20).ToString() + " - " + (BaseStat + 20).ToString()).X; } if (widestString < textWidth2) { widestString = (int)textWidth2; } float textWidth3 = (float)(0.0); if (BaseAttackSpeed > 0) { textWidth3 = GlobalVariables.font14.MeasureString("Attack Speed : " + BaseAttackSpeed.ToString()).X; } if (widestString < textWidth3) { widestString = (int)textWidth3; } //Store location Vector2 loc = location; List <string> ItemDesc = new List <string>(); if (ItemType == 1) { ItemDesc = GlobalVariables.GenerateDescList(ItemDescription, widestString + (ItemTexture.Width * .8), Font1); } else if (ItemType == 2 || ItemType == 5 || ItemType == 6 || ItemType == 7 || ItemType == 8 || ItemType == 9) { ItemDesc = GlobalVariables.GenerateDescList(ItemDescription, widestString + (ItemTexture.Width * .4), Font1); } else if (ItemType == 3) { ItemDesc = GlobalVariables.GenerateDescList(ItemDescription, widestString + (ItemTexture.Width * .2), Font1); } else if (ItemType == 4) { ItemDesc = GlobalVariables.GenerateDescList(ItemDescription, widestString + (ItemTexture.Width * .3), Font1); } //check to render on screen location = GlobalVariables.newLocation(location, widestString + 40, 70 + (int)(22 * affixes) + (int)(22 * ItemDesc.Count) + 40); //Draw Shaded backgorund GlobalVariables.WaitToDraw(0, new Vector2((location.X + 80), (location.Y)), new Rectangle(0, 0, widestString + 40 + (int)(ItemTexture.Width * .75), 70 + (int)(22 * affixes) + (int)(22 * ItemDesc.Count) + 60), Color.Black, null, GlobalVariables.TestSquare); //Draw small item in top right if (ItemType == 1) { GlobalVariables.WaitToDraw(0, new Vector2((location.X + 175 + (widestString - ItemTexture.Width)), location.Y + 25), new Rectangle(0, 0, ItemTexture.Width, ItemTexture.Height), ItemColor, null, ItemTexture); } else if (ItemType == 2 || ItemType == 5 || ItemType == 6 || ItemType == 7 || ItemType == 8 || ItemType == 9) { GlobalVariables.WaitToDraw(0, new Vector2((location.X + 115 + (widestString - ItemTexture.Width)), location.Y + 25), new Rectangle(0, 0, ItemTexture.Width, ItemTexture.Height), ItemColor, null, ItemTexture); } else if (ItemType == 3 || ItemType == 4) { GlobalVariables.WaitToDraw(0, new Vector2((location.X + 140 + (widestString - ItemTexture.Width)), location.Y + 15), new Rectangle(0, 0, ItemTexture.Width, ItemTexture.Height), ItemColor, null, ItemTexture); } GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + 30)), new Rectangle(0, 0, 0, 0), RarityColor, Font1, null, ItemName); int ScalarText = 10; //Draw Base Stat if (ItemSlot == itemSlot.OneHanded || ItemSlot == itemSlot.TwoHanded) { if (BaseStat != (int)(WeaponBaseDisplay)) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.DarkSlateBlue, GlobalVariables.Font16, null, BaseStatName + " : " + ((int)(WeaponBaseDisplay) - 20).ToString() + " - " + ((int)(WeaponBaseDisplay) + 20).ToString()); } else { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, GlobalVariables.Font16, null, BaseStatName + " : " + (BaseStat - 20).ToString() + " - " + (BaseStat + 20).ToString()); } ScalarText += 30; } else if (ItemSlot == itemSlot.Boots || ItemSlot == itemSlot.Pants || ItemSlot == itemSlot.Chest || ItemSlot == itemSlot.Gloves || ItemSlot == itemSlot.Helmet || ItemSlot == itemSlot.Shoulders) { int newValue = GlobalVariables.CalculateEvasion(AffixList, BaseStat); if (newValue != BaseStat) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.DarkSlateBlue, GlobalVariables.Font16, null, BaseStatName + " : " + newValue.ToString()); } else { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, GlobalVariables.Font16, null, BaseStatName + " : " + BaseStat.ToString()); } ScalarText += 30; } //Draw Attack Speed if applicable if (ItemSlot == itemSlot.OneHanded || ItemSlot == itemSlot.TwoHanded) { float newAtkSpd = GlobalVariables.CalculateMeleeAttackSpeed(AffixList, (float)BaseAttackSpeed); if ((float)newAtkSpd != (float)BaseAttackSpeed) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.DarkSlateBlue, GlobalVariables.font14, null, "Attack Speed : " + newAtkSpd.ToString()); } else { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, GlobalVariables.font14, null, "Attack Speed : " + BaseAttackSpeed.ToString()); } ScalarText += 30; } //Draw Item aFfixes for (int intlc = 0; intlc < AffixList.Count; intlc++) { if (intlc < 4) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.White, Font1, null, AffixList[intlc].Desc); ScalarText += 20; } if (intlc == 4) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Orange, Font1, null, AffixList[intlc].Desc); ScalarText += 20; } if (intlc == 5) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Purple, Font1, null, AffixList[intlc].Desc); ScalarText += 20; } if (intlc > 5) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Brown, Font1, null, AffixList[intlc].Desc); ScalarText += 20; } } foreach (string str in ItemDesc) { GlobalVariables.WaitToDraw(1, new Vector2((location.X + 100), (location.Y + ScalarText + 50)), new Rectangle(0, 0, 0, 0), Color.Gray, Font1, null, str); ScalarText += 20; } location = loc; } else { if (GlobalVariables.ShowItemNames) { double textWidth = Font1.MeasureString(ItemName).X; if (ItemType == 1) { int offset = (int)(textWidth * .025); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 2 || ItemType == 5 || ItemType == 7 || ItemType == 8 || ItemType == 9) { int offset = (int)(textWidth * .275); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 3 || ItemType == 4) { int offset = (int)(textWidth * .15); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } else if (ItemType == 6) { int offset = (int)(textWidth * .30); spriteBatch.DrawString(Font1, ItemName, new Vector2(location.X - offset, (location.Y - 20)), RarityColor); } } } }