public static int NewText( PopupTextContext context, Item newItem, int stack, bool noStack = false, bool longText = false) { if (!Main.showItemText || newItem.Name == null || (!newItem.active || Main.netMode == 2)) { return(-1); } bool flag = newItem.type >= 71 && newItem.type <= 74; for (int index = 0; index < 20; ++index) { if (Main.popupText[index].active && !Main.popupText[index].notActuallyAnItem && (Main.popupText[index].name == newItem.AffixName() || flag && Main.popupText[index].coinText) && (!Main.popupText[index].NoStack && !noStack)) { string str1 = newItem.Name + " (" + (object)(Main.popupText[index].stack + stack) + ")"; string str2 = newItem.Name; if (Main.popupText[index].stack > 1) { str2 = str2 + " (" + (object)Main.popupText[index].stack + ")"; } FontAssets.MouseText.Value.MeasureString(str2); Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(str1); if (Main.popupText[index].lifeTime < 0) { Main.popupText[index].scale = 1f; } if (Main.popupText[index].lifeTime < 60) { Main.popupText[index].lifeTime = 60; } if (flag && Main.popupText[index].coinText) { int num = 0; if (newItem.type == 71) { num += stack; } else if (newItem.type == 72) { num += 100 * stack; } else if (newItem.type == 73) { num += 10000 * stack; } else if (newItem.type == 74) { num += 1000000 * stack; } Main.popupText[index].coinValue += num; string name = PopupText.ValueToName(Main.popupText[index].coinValue); vector2 = FontAssets.MouseText.Value.MeasureString(name); Main.popupText[index].name = name; if (Main.popupText[index].coinValue >= 1000000) { if (Main.popupText[index].lifeTime < 300) { Main.popupText[index].lifeTime = 300; } Main.popupText[index].color = new Color(220, 220, 198); } else if (Main.popupText[index].coinValue >= 10000) { if (Main.popupText[index].lifeTime < 240) { Main.popupText[index].lifeTime = 240; } Main.popupText[index].color = new Color(224, 201, 92); } else if (Main.popupText[index].coinValue >= 100) { if (Main.popupText[index].lifeTime < 180) { Main.popupText[index].lifeTime = 180; } Main.popupText[index].color = new Color(181, 192, 193); } else if (Main.popupText[index].coinValue >= 1) { if (Main.popupText[index].lifeTime < 120) { Main.popupText[index].lifeTime = 120; } Main.popupText[index].color = new Color(246, 138, 96); } } Main.popupText[index].stack += stack; Main.popupText[index].scale = 0.0f; Main.popupText[index].rotation = 0.0f; Main.popupText[index].position.X = (float)((double)newItem.position.X + (double)newItem.width * 0.5 - (double)vector2.X * 0.5); Main.popupText[index].position.Y = (float)((double)newItem.position.Y + (double)newItem.height * 0.25 - (double)vector2.Y * 0.5); Main.popupText[index].velocity.Y = -7f; Main.popupText[index].context = context; Main.popupText[index].npcNetID = 0; if (Main.popupText[index].coinText) { Main.popupText[index].stack = 1; } return(index); } } int nextItemTextSlot = PopupText.FindNextItemTextSlot(); if (nextItemTextSlot >= 0) { string str = newItem.AffixName(); if (stack > 1) { str = str + " (" + (object)stack + ")"; } Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(str); Main.popupText[nextItemTextSlot].alpha = 1f; Main.popupText[nextItemTextSlot].alphaDir = -1; Main.popupText[nextItemTextSlot].active = true; Main.popupText[nextItemTextSlot].scale = 0.0f; Main.popupText[nextItemTextSlot].NoStack = noStack; Main.popupText[nextItemTextSlot].rotation = 0.0f; Main.popupText[nextItemTextSlot].position.X = (float)((double)newItem.position.X + (double)newItem.width * 0.5 - (double)vector2.X * 0.5); Main.popupText[nextItemTextSlot].position.Y = (float)((double)newItem.position.Y + (double)newItem.height * 0.25 - (double)vector2.Y * 0.5); Main.popupText[nextItemTextSlot].color = Color.White; Main.popupText[nextItemTextSlot].master = false; if (newItem.rare == 1) { Main.popupText[nextItemTextSlot].color = new Color(150, 150, (int)byte.MaxValue); } else if (newItem.rare == 2) { Main.popupText[nextItemTextSlot].color = new Color(150, (int)byte.MaxValue, 150); } else if (newItem.rare == 3) { Main.popupText[nextItemTextSlot].color = new Color((int)byte.MaxValue, 200, 150); } else if (newItem.rare == 4) { Main.popupText[nextItemTextSlot].color = new Color((int)byte.MaxValue, 150, 150); } else if (newItem.rare == 5) { Main.popupText[nextItemTextSlot].color = new Color((int)byte.MaxValue, 150, (int)byte.MaxValue); } else if (newItem.rare == -13) { Main.popupText[nextItemTextSlot].master = true; } else if (newItem.rare == -11) { Main.popupText[nextItemTextSlot].color = new Color((int)byte.MaxValue, 175, 0); } else if (newItem.rare == -1) { Main.popupText[nextItemTextSlot].color = new Color(130, 130, 130); } else if (newItem.rare == 6) { Main.popupText[nextItemTextSlot].color = new Color(210, 160, (int)byte.MaxValue); } else if (newItem.rare == 7) { Main.popupText[nextItemTextSlot].color = new Color(150, (int)byte.MaxValue, 10); } else if (newItem.rare == 8) { Main.popupText[nextItemTextSlot].color = new Color((int)byte.MaxValue, (int)byte.MaxValue, 10); } else if (newItem.rare == 9) { Main.popupText[nextItemTextSlot].color = new Color(5, 200, (int)byte.MaxValue); } else if (newItem.rare == 10) { Main.popupText[nextItemTextSlot].color = new Color((int)byte.MaxValue, 40, 100); } else if (newItem.rare >= 11) { Main.popupText[nextItemTextSlot].color = new Color(180, 40, (int)byte.MaxValue); } Main.popupText[nextItemTextSlot].expert = newItem.expert; Main.popupText[nextItemTextSlot].name = newItem.AffixName(); Main.popupText[nextItemTextSlot].stack = stack; Main.popupText[nextItemTextSlot].velocity.Y = -7f; Main.popupText[nextItemTextSlot].lifeTime = 60; Main.popupText[nextItemTextSlot].context = context; Main.popupText[nextItemTextSlot].npcNetID = 0; if (longText) { Main.popupText[nextItemTextSlot].lifeTime *= 5; } Main.popupText[nextItemTextSlot].coinValue = 0; Main.popupText[nextItemTextSlot].coinText = newItem.type >= 71 && newItem.type <= 74; if (Main.popupText[nextItemTextSlot].coinText) { if (newItem.type == 71) { Main.popupText[nextItemTextSlot].coinValue += Main.popupText[nextItemTextSlot].stack; } else if (newItem.type == 72) { Main.popupText[nextItemTextSlot].coinValue += 100 * Main.popupText[nextItemTextSlot].stack; } else if (newItem.type == 73) { Main.popupText[nextItemTextSlot].coinValue += 10000 * Main.popupText[nextItemTextSlot].stack; } else if (newItem.type == 74) { Main.popupText[nextItemTextSlot].coinValue += 1000000 * Main.popupText[nextItemTextSlot].stack; } Main.popupText[nextItemTextSlot].ValueToName(); Main.popupText[nextItemTextSlot].stack = 1; int index = nextItemTextSlot; if (Main.popupText[index].coinValue >= 1000000) { if (Main.popupText[index].lifeTime < 300) { Main.popupText[index].lifeTime = 300; } Main.popupText[index].color = new Color(220, 220, 198); } else if (Main.popupText[index].coinValue >= 10000) { if (Main.popupText[index].lifeTime < 240) { Main.popupText[index].lifeTime = 240; } Main.popupText[index].color = new Color(224, 201, 92); } else if (Main.popupText[index].coinValue >= 100) { if (Main.popupText[index].lifeTime < 180) { Main.popupText[index].lifeTime = 180; } Main.popupText[index].color = new Color(181, 192, 193); } else if (Main.popupText[index].coinValue >= 1) { if (Main.popupText[index].lifeTime < 120) { Main.popupText[index].lifeTime = 120; } Main.popupText[index].color = new Color(246, 138, 96); } } } return(nextItemTextSlot); }