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

◆ DrawNPCHousesInWorld()

void Terraria.Main.DrawNPCHousesInWorld ( )
inlineprotected

Definition at line 52401 of file Main.cs.

52402 {
52403 //IL_0273: Unknown result type (might be due to invalid IL or missing references)
52404 //IL_0289: Unknown result type (might be due to invalid IL or missing references)
52405 //IL_028e: Unknown result type (might be due to invalid IL or missing references)
52406 //IL_029e: Unknown result type (might be due to invalid IL or missing references)
52407 //IL_02b8: Unknown result type (might be due to invalid IL or missing references)
52408 //IL_0346: Unknown result type (might be due to invalid IL or missing references)
52409 //IL_034b: Unknown result type (might be due to invalid IL or missing references)
52410 //IL_0356: Unknown result type (might be due to invalid IL or missing references)
52411 //IL_0360: Unknown result type (might be due to invalid IL or missing references)
52412 //IL_036a: Unknown result type (might be due to invalid IL or missing references)
52413 //IL_0374: Unknown result type (might be due to invalid IL or missing references)
52414 //IL_037e: Unknown result type (might be due to invalid IL or missing references)
52415 //IL_0302: Unknown result type (might be due to invalid IL or missing references)
52416 //IL_030e: Unknown result type (might be due to invalid IL or missing references)
52417 //IL_042f: Unknown result type (might be due to invalid IL or missing references)
52418 //IL_0450: Unknown result type (might be due to invalid IL or missing references)
52419 //IL_045e: Unknown result type (might be due to invalid IL or missing references)
52420 //IL_0488: Unknown result type (might be due to invalid IL or missing references)
52421 //IL_048f: Unknown result type (might be due to invalid IL or missing references)
52422 //IL_04af: Unknown result type (might be due to invalid IL or missing references)
52423 //IL_04e2: Unknown result type (might be due to invalid IL or missing references)
52424 //IL_04fc: Unknown result type (might be due to invalid IL or missing references)
52425 _npcsWithBannersToDraw.Clear();
52427 for (int i = 0; i < 200; i++)
52428 {
52429 if (npc[i].active && npc[i].townNPC && !npc[i].homeless && npc[i].homeTileX > 0 && npc[i].homeTileY > 0 && npc[i].type != 37)
52430 {
52432 }
52433 }
52435 for (int j = 0; j < _npcsWithBannersToDraw.Count; j++)
52436 {
52438 NPC nPC = npc[num];
52439 if (!nPC.active || !nPC.townNPC || nPC.homeless || nPC.homeTileX <= 0 || nPC.homeTileY <= 0 || nPC.type == 37)
52440 {
52441 continue;
52442 }
52443 int num6 = 0;
52444 int housingCategory = nPC.housingCategory;
52445 int homeTileX = nPC.homeTileX;
52446 int num7 = nPC.homeTileY - 1;
52447 WorldGen.TownManager.AddOccupantsToList(homeTileX, num7 + 1, _occupantsListToDrawNPCHouses);
52448 if (_occupantsListToDrawNPCHouses.Contains(nPC.type))
52449 {
52450 num6 = 1;
52451 }
52452 int num8 = 0;
52453 for (int num9 = _npcsWithBannersToDraw.Count - 1; num9 > j; num9--)
52454 {
52456 if (npc[num10].homeTileX == homeTileX && npc[num10].homeTileY == num7 + 1)
52457 {
52458 num8++;
52459 }
52460 }
52461 int num11 = num8 * 26;
52462 if (tile[homeTileX, num7] == null)
52463 {
52464 continue;
52465 }
52466 bool flag = false;
52467 while (!tile[homeTileX, num7].active() || !tileSolid[tile[homeTileX, num7].type])
52468 {
52469 num7--;
52470 if (num7 < 10)
52471 {
52472 break;
52473 }
52474 if (tile[homeTileX, num7] == null)
52475 {
52476 flag = true;
52477 break;
52478 }
52479 }
52480 if (flag)
52481 {
52482 continue;
52483 }
52484 int num12 = 8;
52485 int num13 = 18;
52486 if (tile[homeTileX, num7].type == 19)
52487 {
52488 num13 -= 8;
52489 }
52490 num7++;
52491 int num2 = 0;
52492 float num3 = num7 * 16;
52493 num3 += (float)num11;
52494 SpriteEffects effects = (SpriteEffects)0;
52495 Texture2D value = TextureAssets.HouseBanner.Value;
52496 Rectangle value2 = value.Frame(2, 2);
52497 if (num6 > 0)
52498 {
52499 value2.X += value2.Width * num6;
52500 }
52501 if (housingCategory > 0)
52502 {
52503 value2.Y += value2.Height * housingCategory;
52504 }
52505 if (player[myPlayer].gravDir == -1f)
52506 {
52507 num3 -= screenPosition.Y;
52508 num3 = screenPosition.Y + (float)screenHeight - num3;
52509 num3 -= (float)value2.Height;
52510 effects = (SpriteEffects)2;
52511 num2 = 4;
52512 }
52513 spriteBatch.Draw(value, new Vector2((float)(homeTileX * 16 - (int)screenPosition.X + num12), num3 - (float)(int)screenPosition.Y + (float)num13 + (float)num2), (Rectangle?)value2, Lighting.GetColor(homeTileX, num7), 0f, new Vector2((float)(value2.Width / 2), (float)(value2.Height / 2)), 1f, effects, 0f);
52515 float scale = 1f;
52516 float num4 = 0f;
52517 num4 = ((TextureAssets.NpcHead[headIndexSafe].Width() <= TextureAssets.NpcHead[headIndexSafe].Height()) ? ((float)TextureAssets.NpcHead[headIndexSafe].Height()) : ((float)TextureAssets.NpcHead[headIndexSafe].Width()));
52518 if (num4 > 24f)
52519 {
52520 scale = 24f / num4;
52521 }
52522 spriteBatch.Draw(TextureAssets.NpcHead[headIndexSafe].Value, new Vector2((float)(homeTileX * 16 - (int)screenPosition.X + num12), num3 - (float)(int)screenPosition.Y + (float)num13 + 2f), (Rectangle?)new Rectangle(0, 0, TextureAssets.NpcHead[headIndexSafe].Width(), TextureAssets.NpcHead[headIndexSafe].Height()), Lighting.GetColor(homeTileX, num7), 0f, new Vector2((float)(TextureAssets.NpcHead[headIndexSafe].Width() / 2), (float)(TextureAssets.NpcHead[headIndexSafe].Height() / 2)), scale, effects, 0f);
52523 homeTileX = homeTileX * 16 - (int)screenPosition.X + num12 - value2.Width / 2;
52524 num7 = (int)num3 - (int)screenPosition.Y + 4;
52525 int num5 = -8;
52526 if (mouseX >= homeTileX && mouseX <= homeTileX + value2.Width && mouseY >= num7 && mouseY <= num7 + value2.Height + num5)
52527 {
52528 string nPCHouseBannerText = Lang.GetNPCHouseBannerText(nPC, num6);
52531 {
52532 mouseRightRelease = false;
52533 WorldGen.kickOut(num);
52535 }
52536 }
52537 }
52538 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
static Asset< Texture2D >[] NpcHead
static Asset< Texture2D > HouseBanner
static SpriteBatch spriteBatch
Definition Main.cs:1043
static int myPlayer
The index in F:Terraria.Main.player of this client's Player. If this is 255, this client is the ser...
Definition Main.cs:1958
static bool mouseRight
Definition Main.cs:644
int NPCBannerSorter(int npcIndex1, int npcIndex2)
Definition Main.cs:52396
static int screenHeight
Definition Main.cs:1870
static Vector2 screenPosition
The position of the top left corner of the screen in world coordinates. Modify in M:Terraria....
Definition Main.cs:1864
static bool[] tileSolid
Definition Main.cs:1601
List< int > _occupantsListToDrawNPCHouses
Definition Main.cs:2510
static bool mouseRightRelease
Definition Main.cs:1910
List< int > _npcsWithBannersToDraw
Definition Main.cs:2512
static NPC[] npc
Definition Main.cs:1830
static int mouseY
Definition Main.cs:634
static Tilemap tile
Definition Main.cs:1820
static Player[] player
Definition Main.cs:1960
void MouseText(string cursorText, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0)
Definition Main.cs:19466
static int mouseX
Definition Main.cs:632

References Terraria.Main._npcsWithBannersToDraw, Terraria.Main._occupantsListToDrawNPCHouses, Terraria.Lighting.GetColor(), Terraria.GameContent.TownNPCProfiles.GetHeadIndexSafe(), Terraria.Lang.GetNPCHouseBannerText(), Terraria.GameContent.TextureAssets.HouseBanner, Terraria.WorldGen.kickOut(), Terraria.Main.mouseRight, Terraria.Main.mouseRightRelease, Terraria.Main.MouseText(), Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.Main.myPlayer, Terraria.Main.npc, Terraria.Main.NPCBannerSorter(), Terraria.GameContent.TextureAssets.NpcHead, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.spriteBatch, Terraria.Main.tile, Terraria.Main.tileSolid, and Terraria.WorldGen.TownManager.

Referenced by Terraria.Main.DrawInterface_7_TownNPCHouseBanners().

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