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

◆ UpdateTime_StartNight()

static void Terraria.Main.UpdateTime_StartNight ( ref bool stopEvents)
inlinestatic

Definition at line 82261 of file Main.cs.

82262 {
82263 //IL_01bf: Unknown result type (might be due to invalid IL or missing references)
82264 //IL_0554: Unknown result type (might be due to invalid IL or missing references)
82265 //IL_02fe: Unknown result type (might be due to invalid IL or missing references)
82266 //IL_0386: Unknown result type (might be due to invalid IL or missing references)
82267 //IL_03f7: Unknown result type (might be due to invalid IL or missing references)
82268 //IL_045f: Unknown result type (might be due to invalid IL or missing references)
82270 {
82271 fastForwardTimeToDusk = false;
82273 }
82274 if (moondialCooldown > 0)
82275 {
82277 }
82278 NPC.ResetBadgerHatTime();
82279 NPC.freeCake = false;
82280 Star.NightSetup();
82281 NPC.setFireFlyChance();
82284 WorldGen.mysticLogsEvent.StartNight();
82285 WorldGen.prioritizedTownNPCType = 0;
82286 checkForSpawns = 0;
82287 if (rand.Next(50) == 0 && netMode != 1 && NPC.downedBoss2)
82288 {
82289 WorldGen.spawnMeteor = true;
82290 }
82292 {
82293 stopEvents = true;
82294 }
82295 if (eclipse && netMode != 1)
82296 {
82298 }
82299 eclipse = false;
82300 if (netMode != 1)
82301 {
82303 }
82305 {
82306 if (!NPC.downedBoss1 && netMode != 1)
82307 {
82308 bool flag = false;
82309 for (int i = 0; i < 255; i++)
82310 {
82311 if (player[i].active && player[i].ConsumedLifeCrystals >= 5 && (int)player[i].statDefense > 10)
82312 {
82313 flag = true;
82314 break;
82315 }
82316 }
82317 if (flag && rand.Next(3) == 0)
82318 {
82319 int num = 0;
82320 for (int j = 0; j < 200; j++)
82321 {
82322 if (npc[j].active && npc[j].townNPC)
82323 {
82324 num++;
82325 }
82326 }
82327 if (num >= 4)
82328 {
82329 WorldGen.spawnEye = true;
82330 if (netMode == 0)
82331 {
82332 NewText(Lang.misc[9].Value, 50, byte.MaxValue, 130);
82333 }
82334 else if (netMode == 2)
82335 {
82336 ChatHelper.BroadcastChatMessage(Lang.misc[9].ToNetworkText(), new Color(50, 255, 130));
82337 }
82338 }
82339 }
82340 }
82341 if (netMode != 1 && !pumpkinMoon && !DD2Event.Ongoing && !snowMoon && WorldGen.altarCount > 0 && hardMode && !WorldGen.spawnEye && rand.Next(10) == 0)
82342 {
82343 bool flag2 = false;
82344 for (int k = 0; k < 200; k++)
82345 {
82346 if (npc[k].active && npc[k].boss)
82347 {
82348 flag2 = true;
82349 }
82350 }
82351 if (!flag2 && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3))
82352 {
82353 if (remixWorld && getGoodWorld)
82354 {
82355 if (rand.Next(2) == 0)
82356 {
82357 WorldGen.spawnHardBoss = rand.Next(3) + 1;
82358 if (netMode == 0)
82359 {
82360 NewText(Lang.misc[108].Value, 50, byte.MaxValue, 130);
82361 }
82362 else if (netMode == 2)
82363 {
82364 ChatHelper.BroadcastChatMessage(Lang.misc[108].ToNetworkText(), new Color(50, 255, 130));
82365 }
82366 }
82367 }
82368 else
82369 {
82370 for (int l = 0; l < 1000; l++)
82371 {
82372 int num2 = rand.Next(3) + 1;
82373 if (num2 == 1 && !NPC.downedMechBoss1)
82374 {
82375 WorldGen.spawnHardBoss = num2;
82376 if (netMode == 0)
82377 {
82378 NewText(Lang.misc[28].Value, 50, byte.MaxValue, 130);
82379 }
82380 else if (netMode == 2)
82381 {
82382 ChatHelper.BroadcastChatMessage(Lang.misc[28].ToNetworkText(), new Color(50, 255, 130));
82383 }
82384 break;
82385 }
82386 if (num2 == 2 && !NPC.downedMechBoss2)
82387 {
82388 WorldGen.spawnHardBoss = num2;
82389 if (netMode == 0)
82390 {
82391 NewText(Lang.misc[29].Value, 50, byte.MaxValue, 130);
82392 }
82393 else if (netMode == 2)
82394 {
82395 ChatHelper.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Color(50, 255, 130));
82396 }
82397 break;
82398 }
82399 if (num2 == 3 && !NPC.downedMechBoss3)
82400 {
82401 WorldGen.spawnHardBoss = num2;
82402 if (netMode == 0)
82403 {
82404 NewText(Lang.misc[30].Value, 50, byte.MaxValue, 130);
82405 }
82406 else if (netMode == 2)
82407 {
82408 ChatHelper.BroadcastChatMessage(Lang.misc[30].ToNetworkText(), new Color(50, 255, 130));
82409 }
82410 break;
82411 }
82412 }
82413 }
82414 }
82415 }
82416 int maxValue = 9;
82418 {
82419 maxValue = 6;
82420 }
82421 if (!WorldGen.spawnEye && moonPhase != 4 && rand.Next(maxValue) == 0 && netMode != 1)
82422 {
82423 for (int m = 0; m < 255; m++)
82424 {
82425 if (player[m].active && player[m].ConsumedLifeCrystals > 1)
82426 {
82427 bloodMoon = true;
82428 break;
82429 }
82430 }
82431 if (bloodMoon)
82432 {
82433 sundialCooldown = 0;
82434 moondialCooldown = 0;
82436 if (netMode == 0)
82437 {
82438 NewText(Lang.misc[8].Value, 50, byte.MaxValue, 130);
82439 }
82440 else if (netMode == 2)
82441 {
82442 ChatHelper.BroadcastChatMessage(Lang.misc[8].ToNetworkText(), new Color(50, 255, 130));
82443 }
82444 }
82445 }
82446 }
82447 time = 0.0;
82448 dayTime = false;
82449 if (netMode == 2)
82450 {
82451 NetMessage.SendData(7);
82452 }
82453 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:51
static int checkForSpawns
Definition Main.cs:1407
static double time
The time that has passed since it last became day/night. Increased by F:Terraria....
Definition Main.cs:1375
static void NewText(object o, Color? color=null)
Definition Main.cs:81745
static int netMode
Denotes the current network mode: 0 for single player client, 1 for multiplayer client,...
Definition Main.cs:2182
static bool IsFastForwardingTime()
Definition Main.cs:6063
static bool dayTime
Definition Main.cs:1365
static bool bloodMoon
Definition Main.cs:1387
static int moonPhase
Definition Main.cs:1379
static bool getGoodWorld
Definition Main.cs:369
static int moondialCooldown
Definition Main.cs:2374
static bool eclipse
Definition Main.cs:1403
static UnifiedRandom rand
Definition Main.cs:2758
static NPC[] npc
Definition Main.cs:1830
static void UpdateTimeRate()
Definition Main.cs:6102
static bool tenthAnniversaryWorld
Definition Main.cs:371
static int sundialCooldown
Definition Main.cs:2370
static bool snowMoon
Definition Main.cs:1391
static bool pumpkinMoon
Definition Main.cs:1389
static bool hardMode
Definition Main.cs:1091
static Player[] player
Definition Main.cs:1960
static bool fastForwardTimeToDusk
Definition Main.cs:2372
static bool remixWorld
Definition Main.cs:377

References Terraria.WorldGen.altarCount, Terraria.Main.bloodMoon, Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.Main.checkForSpawns, Terraria.GameContent.Events.BirthdayParty.CheckNight(), Terraria.GameContent.Events.LanternNight.CheckNight(), Terraria.Main.dayTime, Terraria.NPC.downedBoss1, Terraria.NPC.downedBoss2, Terraria.NPC.downedMechBoss1, Terraria.NPC.downedMechBoss2, Terraria.NPC.downedMechBoss3, Terraria.Main.eclipse, Terraria.Main.fastForwardTimeToDusk, Terraria.Main.getGoodWorld, Terraria.Main.hardMode, Terraria.Main.IsFastForwardingTime(), Terraria.GameContent.Events.LanternNight.LanternsUp, Terraria.Lang.misc, Terraria.Main.moondialCooldown, Terraria.Main.moonPhase, Terraria.WorldGen.mysticLogsEvent, Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.Star.NightSetup(), Terraria.GameContent.Achievements.AchievementsHelper.NotifyProgressionEvent(), Terraria.Main.npc, Terraria.GameContent.Events.DD2Event.Ongoing, Terraria.Main.player, Terraria.Main.pumpkinMoon, Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.NPC.ResetBadgerHatTime(), Terraria.NetMessage.SendData(), Terraria.NPC.setFireFlyChance(), Terraria.Main.snowMoon, Terraria.WorldGen.spawnEye, Terraria.Main.sundialCooldown, Terraria.Main.tenthAnniversaryWorld, Terraria.Main.time, and Terraria.Main.UpdateTimeRate().

Referenced by Terraria.Main.SkipToTime(), and Terraria.Main.UpdateTime().

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