1785 {
1786 Player player = Main.player[Main.myPlayer];
1788 float inventoryScale = Main.inventoryScale;
1791 {
1792 color = lightColor;
1793 }
1794 bool flag = false;
1795 int num = 0;
1798 {
1799 flag = UILinkPointNavigator.CurrentPoint == gamepadPointForSlot;
1801 {
1802 flag = false;
1803 }
1804 if (context == 0)
1805 {
1806 num = player.DpadRadial.GetDrawMode(slot);
1808 {
1809 num = 0;
1810 }
1811 }
1812 }
1814 Color color2 = Main.inventoryBack;
1815 bool flag2 = false;
1817 if (
item.type > 0 &&
item.stack > 0 &&
item.favorited && context != 13 && context != 21 && context != 22 && context != 14)
1818 {
1820 if (context == 32)
1821 {
1823 }
1824 }
1825 else if (
item.type > 0 &&
item.stack > 0 && Options.HighlightNewItems &&
item.newAndShiny && context != 13 && context != 21 && context != 14 && context != 22)
1826 {
1828 float num2 = (float)(int)Main.mouseTextColor / 255f;
1829 num2 = num2 * 0.2f + 0.8f;
1830 color2 = color2.MultiplyRGBA(
new Color(num2, num2, num2));
1831 }
1832 else if (!highlightThingsForMouse &&
item.type > 0 &&
item.stack > 0 && num != 0 && context != 13 && context != 21 && context != 22)
1833 {
1835 float num3 = (float)(int)Main.mouseTextColor / 255f;
1836 num3 = num3 * 0.2f + 0.8f;
1837 color2 = ((num != 1) ? color2.MultiplyRGBA(
new Color(num3 / 2f, num3, num3 / 2f)) : color2.MultiplyRGBA(new
Color(num3, num3 / 2f, num3 / 2f)));
1838 }
1839 else if (context == 0 && slot < 10)
1840 {
1842 }
1843 else
1844 {
1845 switch (context)
1846 {
1847 case 28:
1850 break;
1851 case 16:
1852 case 17:
1853 case 18:
1854 case 19:
1855 case 20:
1857 break;
1858 case 8:
1859 case 10:
1862 break;
1863 case 23:
1864 case 24:
1865 case 26:
1867 break;
1868 case 9:
1869 case 11:
1872 break;
1873 case 25:
1874 case 27:
1875 case 33:
1877 break;
1878 case 12:
1881 break;
1882 case 3:
1884 break;
1885 case 4:
1886 case 32:
1888 break;
1889 case 5:
1890 case 7:
1892 break;
1893 case 6:
1895 break;
1896 case 13:
1897 {
1898 byte b = 200;
1899 if (slot == Main.player[Main.myPlayer].selectedItem)
1900 {
1902 b = byte.MaxValue;
1903 }
1904 color2 =
new Color(b, b, b, b);
1905 break;
1906 }
1907 case 14:
1908 case 21:
1909 flag2 = true;
1910 break;
1911 case 15:
1913 break;
1914 case 29:
1915 color2 =
new Color(53, 69, 127, 255);
1917 break;
1918 case 30:
1919 flag2 = !flag;
1920 break;
1921 case 22:
1924 {
1927 float num4 = (float)(int)color2.A / 255f;
1928 num4 = ((!(num4 < 0.7f)) ? 1f : Utils.GetLerpValue(0f, 0.7f, num4, clamped: true));
1929 color2 = Color.White * num4;
1930 }
1931 break;
1932 }
1933 }
1934 if ((context == 0 || context == 2) &&
inventoryGlowTime[slot] > 0 && !inv[slot].favorited && !inv[slot].IsAir)
1935 {
1936 float num5 = Main.invAlpha / 255f;
1937 Color value2 =
new Color(63, 65, 151, 255) * num5;
1940 num6 *= num6;
1941 color2 =
Color.
Lerp(value2, value3, num6 / 2f);
1943 }
1944 if ((context == 4 || context == 32 || context == 3) &&
inventoryGlowTimeChest[slot] > 0 && !inv[slot].favorited && !inv[slot].IsAir)
1945 {
1946 float num7 = Main.invAlpha / 255f;
1947 Color value4 =
new Color(130, 62, 102, 255) * num7;
1948 if (context == 3)
1949 {
1950 value4 =
new Color(104, 52, 52, 255) * num7;
1951 }
1954 num8 *= num8;
1955 color2 =
Color.
Lerp(value4, value5, num8 / 2f);
1957 }
1958 if (flag)
1959 {
1963 {
1965 }
1966 }
1967 if (context == 28 && Main.MouseScreen.Between(position, position +
value.Size() * inventoryScale) && !player.mouseInterface)
1968 {
1971 }
1972 if (!flag2)
1973 {
1975 }
1976 int num9 = -1;
1977 switch (context)
1978 {
1979 case 8:
1980 case 23:
1981 if (slot == 0)
1982 {
1983 num9 = 0;
1984 }
1985 if (slot == 1)
1986 {
1987 num9 = 6;
1988 }
1989 if (slot == 2)
1990 {
1991 num9 = 12;
1992 }
1993 break;
1994 case 26:
1995 num9 = 0;
1996 break;
1997 case 9:
1998 if (slot == 10)
1999 {
2000 num9 = 3;
2001 }
2002 if (slot == 11)
2003 {
2004 num9 = 9;
2005 }
2006 if (slot == 12)
2007 {
2008 num9 = 15;
2009 }
2010 break;
2011 case 10:
2012 case 24:
2013 num9 = 11;
2014 break;
2015 case 11:
2016 num9 = 2;
2017 break;
2018 case 12:
2019 case 25:
2020 case 27:
2021 case 33:
2022 num9 = 1;
2023 break;
2024 case 16:
2025 num9 = 4;
2026 break;
2027 case 17:
2028 num9 = 13;
2029 break;
2030 case 19:
2031 num9 = 10;
2032 break;
2033 case 18:
2034 num9 = 7;
2035 break;
2036 case 20:
2037 num9 = 17;
2038 break;
2039 }
2040 if ((
item.type <= 0 ||
item.stack <= 0) && num9 != -1)
2041 {
2043 Rectangle rectangle = value6.Frame(3, 6, num9 % 3, num9 / 3);
2044 rectangle.Width -= 2;
2045 rectangle.Height -= 2;
2046 spriteBatch.
Draw(value6, position +
value.Size() / 2f * inventoryScale, rectangle, Color.White * 0.35f, 0f, rectangle.Size() / 2f, inventoryScale,
SpriteEffects.None, 0f);
2047 }
2049 if (
item.type > 0 &&
item.stack > 0)
2050 {
2051 float scale =
DrawItemIcon(
item, context, spriteBatch, position + vector / 2f, inventoryScale, 32f, color);
2053 {
2054 spriteBatch.
Draw(
TextureAssets.
Wire.Value, position +
new Vector2(40f, 40f) * inventoryScale,
new Rectangle(4, 58, 8, 8), color, 0f,
new Vector2(4f), 1f,
SpriteEffects.None, 0f);
2055 }
2057 {
2061 spriteBatch.
Draw(value7, position + vector2 +
new Vector2(40f, 40f) * inventoryScale, rectangle2, color, 0f, rectangle2.Size() / 2f, 1f,
SpriteEffects.None, 0f);
2062 }
2063 if (
item.type == 5324 ||
item.type == 5329 ||
item.type == 5330)
2064 {
2067 {
2068 case 5324:
2069 {
2071 Rectangle rectangle5 = value10.Frame(3, 1, 2);
2072 spriteBatch.
Draw(value10, position + vector3 +
new Vector2(40f, 40f) * inventoryScale, rectangle5, color, 0f, rectangle5.Size() / 2f, 1f,
SpriteEffects.None, 0f);
2073 break;
2074 }
2075 case 5329:
2076 {
2078 Rectangle rectangle4 = value9.Frame(3, 1, 1);
2079 spriteBatch.
Draw(value9, position + vector3 +
new Vector2(40f, 40f) * inventoryScale, rectangle4, color, 0f, rectangle4.Size() / 2f, 1f,
SpriteEffects.None, 0f);
2080 break;
2081 }
2082 case 5330:
2083 {
2086 spriteBatch.
Draw(value8, position + vector3 +
new Vector2(40f, 40f) * inventoryScale, rectangle3, color, 0f, rectangle3.Size() / 2f, 1f,
SpriteEffects.None, 0f);
2087 break;
2088 }
2089 }
2090 }
2092 {
2093 ChatManager.
DrawColorCodedStringWithShadow(spriteBatch,
FontAssets.
ItemStack.Value,
item.stack.ToString(), position +
new Vector2(10f, 26f) * inventoryScale, color, 0f,
Vector2.
Zero,
new Vector2(inventoryScale), -1f, inventoryScale);
2094 }
2095 int num10 = -1;
2096 if (context == 13)
2097 {
2099 {
2100 for (
int i = 0;
i < 58;
i++)
2101 {
2102 if (inv[i].
type == 3822)
2103 {
2104 num10 += inv[
i].stack;
2105 }
2106 }
2107 if (num10 >= 0)
2108 {
2109 num10++;
2110 }
2111 }
2112 if (
item.useAmmo > 0)
2113 {
2114 int useAmmo =
item.useAmmo;
2115 num10 = 0;
2116 for (int j = 0; j < 58; j++)
2117 {
2118 if (inv[j].ammo == useAmmo)
2119 {
2120 num10 += inv[j].stack;
2121 }
2122 }
2123 }
2124 if (
item.fishingPole > 0)
2125 {
2126 num10 = 0;
2127 for (int k = 0; k < 58; k++)
2128 {
2129 if (inv[k].bait > 0)
2130 {
2131 num10 += inv[k].stack;
2132 }
2133 }
2134 }
2135 if (
item.tileWand > 0)
2136 {
2137 int tileWand =
item.tileWand;
2138 num10 = 0;
2139 for (int l = 0; l < 58; l++)
2140 {
2141 if (inv[l].
type == tileWand)
2142 {
2143 num10 += inv[l].stack;
2144 }
2145 }
2146 }
2147 if (
item.type == 509 ||
item.type == 851 ||
item.type == 850 ||
item.type == 3612 ||
item.type == 3625 ||
item.type == 3611)
2148 {
2149 num10 = 0;
2150 for (int m = 0; m < 58; m++)
2151 {
2152 if (inv[m].
type == 530)
2153 {
2154 num10 += inv[m].stack;
2155 }
2156 }
2157 }
2158 }
2159 if (num10 != -1)
2160 {
2161 ChatManager.
DrawColorCodedStringWithShadow(spriteBatch,
FontAssets.
ItemStack.Value, num10.ToString(), position +
new Vector2(8f, 30f) * inventoryScale, color, 0f,
Vector2.
Zero,
new Vector2(inventoryScale * 0.8f), -1f, inventoryScale);
2162 }
2163 if (context == 13)
2164 {
2165 string text =
string.Concat(slot + 1);
2167 {
2169 }
2170 ChatManager.
DrawColorCodedStringWithShadow(spriteBatch,
FontAssets.
ItemStack.Value,
text, position +
new Vector2(8f, 4f) * inventoryScale, color, 0f,
Vector2.
Zero,
new Vector2(inventoryScale), -1f, inventoryScale);
2171 }
2172 if (context == 13 &&
item.potion)
2173 {
2175 Color color3 =
item.GetAlpha(color) * ((float)player.potionDelay / (
float)player.potionDelayTime);
2177 }
2178 if ((context == 10 || context == 18) && item.expertOnly && !Main.expertMode)
2179 {
2183 }
2184 }
2185 else if (context == 6)
2186 {
2188 Vector2 position4 = position +
value.Size() * inventoryScale / 2f - value11.Size() * inventoryScale / 2f;
2189 spriteBatch.
Draw(value11, position4,
null,
new Color(100, 100, 100, 100), 0f,
default(
Vector2), inventoryScale,
SpriteEffects.None, 0f);
2190 }
2191 if (context == 0 && slot < 10)
2192 {
2193 float num11 = inventoryScale;
2194 string text2 = string.Concat(slot + 1);
2195 if (text2 == "10")
2196 {
2197 text2 = "0";
2198 }
2199 Color baseColor = Main.inventoryBack;
2200 int num12 = 0;
2201 if (Main.player[Main.myPlayer].selectedItem == slot)
2202 {
2204 baseColor.A = 200;
2205 num12 -= 2;
2206 num11 *= 1.4f;
2207 }
2208 ChatManager.
DrawColorCodedStringWithShadow(spriteBatch,
FontAssets.
ItemStack.Value, text2, position +
new Vector2(6f, 4 + num12) * inventoryScale, baseColor, 0f,
Vector2.
Zero,
new Vector2(inventoryScale), -1f, inventoryScale);
2209 }
2210 if (gamepadPointForSlot != -1)
2211 {
2213 }
2214 }
void Draw(Texture2D texture, Vector2 position, Color color)
static Asset< DynamicSpriteFont > ItemStack
static Asset< Texture2D > InventoryBack13
static Asset< Texture2D > InventoryBack7
static Asset< Texture2D > InventoryBack8
static Asset< Texture2D > InventoryBack9
static Asset< Texture2D > InventoryBack
static Asset< Texture2D > Cd
static Asset< Texture2D > InventoryBack5
static Asset< Texture2D > Trash
static Asset< Texture2D > InventoryBack4
static Asset< Texture2D > InventoryBack14
static Asset< Texture2D > InventoryBack6
static Asset< Texture2D > InventoryBack18
static Asset< Texture2D >[] Extra
static Asset< Texture2D > InventoryBack3
static Asset< Texture2D > InventoryBack19
static Asset< Texture2D > Wire
static Asset< Texture2D > InventoryBack15
static Asset< Texture2D > InventoryBack17
static Asset< Texture2D > InventoryBack12
static Asset< Texture2D > InventoryBack2
static Asset< Texture2D > InventoryBack10
static bool[] DrawUnsafeIndicator
static Vector2 DrawColorCodedStringWithShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth=-1f, float spread=2f)
static void SetPosition(int ID, Vector2 Position)
static float[] inventoryGlowHueChest
static Color GetColorByLoadout(int slot, int context)
static float DrawItemIcon(Item item, int context, SpriteBatch spriteBatch, Vector2 screenPositionForItemCenter, float scale, float sizeLimit, Color environmentColor)
static int[] inventoryGlowTime
static int[] inventoryGlowTimeChest
static bool DrawGoldBGForCraftingMaterial
static float[] inventoryGlowHue
static int GetGamepadPointForSlot(Item[] inv, int context, int slot)
static Color Lerp(Color value1, Color value2, float amount)