TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetAlpha()

Color Terraria.Item.GetAlpha ( Color newColor)
inline

Definition at line 49238 of file Item.cs.

49239 {
49240 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
49241 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
49242 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
49243 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
49244 //IL_0029: Unknown result type (might be due to invalid IL or missing references)
49245 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
49246 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
49247 //IL_0342: Unknown result type (might be due to invalid IL or missing references)
49248 //IL_0561: Unknown result type (might be due to invalid IL or missing references)
49249 //IL_0536: Unknown result type (might be due to invalid IL or missing references)
49250 //IL_053b: Unknown result type (might be due to invalid IL or missing references)
49251 //IL_0541: Unknown result type (might be due to invalid IL or missing references)
49252 //IL_0559: Unknown result type (might be due to invalid IL or missing references)
49253 //IL_04cc: Unknown result type (might be due to invalid IL or missing references)
49254 //IL_03ca: Unknown result type (might be due to invalid IL or missing references)
49255 //IL_0365: Unknown result type (might be due to invalid IL or missing references)
49256 //IL_03fb: Unknown result type (might be due to invalid IL or missing references)
49257 //IL_045c: Unknown result type (might be due to invalid IL or missing references)
49258 //IL_03e1: Unknown result type (might be due to invalid IL or missing references)
49259 //IL_04a6: Unknown result type (might be due to invalid IL or missing references)
49260 //IL_0476: Unknown result type (might be due to invalid IL or missing references)
49261 //IL_037f: Unknown result type (might be due to invalid IL or missing references)
49262 //IL_048c: Unknown result type (might be due to invalid IL or missing references)
49263 //IL_050d: Unknown result type (might be due to invalid IL or missing references)
49264 //IL_0512: Unknown result type (might be due to invalid IL or missing references)
49265 //IL_0518: Unknown result type (might be due to invalid IL or missing references)
49266 //IL_0530: Unknown result type (might be due to invalid IL or missing references)
49267 //IL_04ed: Unknown result type (might be due to invalid IL or missing references)
49268 //IL_0507: Unknown result type (might be due to invalid IL or missing references)
49269 //IL_0446: Unknown result type (might be due to invalid IL or missing references)
49270 //IL_04c6: Unknown result type (might be due to invalid IL or missing references)
49271 //IL_0399: Unknown result type (might be due to invalid IL or missing references)
49272 //IL_0314: Unknown result type (might be due to invalid IL or missing references)
49273 //IL_0315: Unknown result type (might be due to invalid IL or missing references)
49274 //IL_031f: Unknown result type (might be due to invalid IL or missing references)
49275 //IL_0412: Unknown result type (might be due to invalid IL or missing references)
49276 //IL_042c: Unknown result type (might be due to invalid IL or missing references)
49277 //IL_03b0: Unknown result type (might be due to invalid IL or missing references)
49278 //IL_0726: Unknown result type (might be due to invalid IL or missing references)
49279 //IL_06b9: Unknown result type (might be due to invalid IL or missing references)
49280 Color? val = ItemLoader.GetAlpha(this, newColor);
49281 if (val.HasValue)
49282 {
49283 return val.GetValueOrDefault();
49284 }
49285 if (ItemID.Sets.BossBag[type])
49286 {
49287 return Color.Lerp(newColor, Color.White, 0.4f);
49288 }
49289 switch (type)
49290 {
49291 case 1326:
49292 case 5335:
49293 return Color.Lerp(newColor, Color.White, 0.75f);
49294 case 5043:
49295 return new Color(255, 255, 255, ((Color)(ref newColor)).A - alpha);
49296 case 3065:
49297 case 4956:
49298 return new Color(255, 255, 255, ((Color)(ref newColor)).A - alpha);
49299 case 75:
49300 case 3858:
49301 return new Color(255, 255, 255, 255);
49302 case 119:
49303 case 120:
49304 case 121:
49305 case 122:
49306 case 217:
49307 case 218:
49308 case 219:
49309 case 220:
49310 return new Color(255, 255, 255, 255);
49311 case 501:
49312 return new Color(200, 200, 200, 50);
49313 case 757:
49314 case 1306:
49315 case 3456:
49316 case 3457:
49317 case 3458:
49318 case 3459:
49319 return new Color(255, 255, 255, 200);
49320 case 520:
49321 case 521:
49322 case 522:
49323 case 547:
49324 case 548:
49325 case 549:
49326 case 575:
49327 case 1332:
49328 case 3453:
49329 case 3454:
49330 case 3455:
49331 case 3580:
49332 return new Color(255, 255, 255, 50);
49333 case 58:
49334 case 184:
49335 case 1734:
49336 case 1735:
49337 case 1867:
49338 case 1868:
49339 return new Color(200, 200, 200, 200);
49340 case 1572:
49341 return new Color(200, 200, 255, 125);
49342 case 787:
49343 return new Color(255, 255, 255, 175);
49344 case 1826:
49345 return new Color(255, 255, 255, 200);
49346 case 1508:
49347 return new Color(200, 200, 200, 0);
49348 case 502:
49349 return new Color(255, 255, 255, 150);
49350 case 51:
49351 return new Color(255, 255, 255, 0);
49352 case 1260:
49353 return new Color(255, 255, 255, 175);
49354 case 1446:
49355 case 1506:
49356 case 1507:
49357 case 1543:
49358 case 1544:
49359 case 1545:
49360 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, (int)Main.gFade);
49361 case 198:
49362 case 199:
49363 case 200:
49364 case 201:
49365 case 202:
49366 case 203:
49367 case 3764:
49368 case 3765:
49369 case 3766:
49370 case 3767:
49371 case 3768:
49372 case 3769:
49373 case 4258:
49374 case 4259:
49375 return Color.White;
49376 case 2763:
49377 case 2764:
49378 case 2765:
49379 case 2782:
49380 case 2783:
49381 case 2784:
49382 case 2785:
49383 case 2786:
49384 case 3522:
49385 return new Color(250, 250, 250, 255 - alpha);
49386 case 3191:
49387 return new Color(250, 250, 250, 200);
49388 case 3822:
49389 return Color.Lerp(Color.White, newColor, 0.5f) * ((255f - (float)alpha) / 255f);
49390 case 4143:
49391 return Color.Lerp(Color.White, newColor, 0f) * ((255f - (float)alpha) / 255f);
49392 case 4354:
49393 case 4377:
49394 case 4378:
49395 case 4389:
49396 case 5127:
49397 case 5128:
49398 {
49399 Color color = default(Color);
49400 switch (type)
49401 {
49402 default:
49403 ((Color)(ref color))._002Ector(255, 150, 150, 200);
49404 break;
49405 case 4377:
49406 ((Color)(ref color))._002Ector(50, 255, 50, 200);
49407 break;
49408 case 4378:
49409 ((Color)(ref color))._002Ector(50, 200, 255, 255);
49410 break;
49411 case 4389:
49412 ((Color)(ref color))._002Ector(255, 50, 125, 200);
49413 break;
49414 case 5127:
49415 ((Color)(ref color))._002Ector(150, 50, 250, 200);
49416 break;
49417 case 5128:
49418 ((Color)(ref color))._002Ector(Main.DiscoR, Main.DiscoG, Main.DiscoB, 200);
49419 break;
49420 }
49421 if (((Color)(ref newColor)).R > ((Color)(ref color)).R)
49422 {
49423 ((Color)(ref color)).R = ((Color)(ref newColor)).R;
49424 }
49425 if (((Color)(ref newColor)).G > ((Color)(ref color)).G)
49426 {
49427 ((Color)(ref color)).G = ((Color)(ref newColor)).G;
49428 }
49429 if (((Color)(ref newColor)).B > ((Color)(ref color)).B)
49430 {
49431 ((Color)(ref color)).B = ((Color)(ref newColor)).B;
49432 }
49433 if (((Color)(ref newColor)).A > ((Color)(ref color)).A)
49434 {
49435 ((Color)(ref color)).A = ((Color)(ref newColor)).A;
49436 }
49437 return color;
49438 }
49439 default:
49440 {
49441 float num = (float)(255 - alpha) / 255f;
49442 int num3 = (int)((float)(int)((Color)(ref newColor)).R * num);
49443 int g = (int)((float)(int)((Color)(ref newColor)).G * num);
49444 int b = (int)((float)(int)((Color)(ref newColor)).B * num);
49445 int num2 = ((Color)(ref newColor)).A - alpha;
49446 if (num2 < 0)
49447 {
49448 num2 = 0;
49449 }
49450 if (num2 > 255)
49451 {
49452 num2 = 255;
49453 }
49454 return new Color(num3, g, b, num2);
49455 }
49456 }
49457 }
static bool[] BossBag
Set for all boss bags. Causes bags to drop dev armor and creates a glow around the item when dropped ...
Definition ItemID.cs:1565
int alpha
Set to a value from 0 to 255 to control how transparent the item will appear when drawn....
Definition Item.cs:512
Color color
Draws the item sprite with a colored tint. Gel and Sharkfin use this to spawn different colored items...
Definition Item.cs:506
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static ? Color GetAlpha(Item item, Color lightColor)
Calls all GlobalItem.GetAlpha hooks then ModItem.GetAlpha, until one of them returns a color,...
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26

References Terraria.Item.alpha, Terraria.ID.ItemID.Sets.BossBag, Terraria.Item.color, Terraria.Main.DiscoB, Terraria.Main.DiscoG, Terraria.Main.DiscoR, Terraria.ModLoader.ItemLoader.GetAlpha(), Terraria.Main.gFade, and Terraria.Item.type.

Referenced by Terraria.UI.ItemSlot.Draw(), Terraria.UI.ItemSlot.DrawItemIcon(), Terraria.DataStructures.PlayerDrawLayers.DrawPlayer_27_HeldItem(), Terraria.DataStructures.PlayerDrawLayers.DrawPlayer_30_BladedGlove(), and Terraria.ModLoader.Config.UI.ItemDefinitionOptionElement.DrawSelf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: