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

◆ SpawnAllowed_Merchant()

static bool Terraria.NPC.SpawnAllowed_Merchant ( )
inlinestatic

Definition at line 2020 of file NPC.cs.

2021 {
2023 {
2024 return true;
2025 }
2026 double num = 5000.0;
2027 int num2 = 0;
2028 for (int i = 0; i < 255; i++)
2029 {
2030 Player player = Main.player[i];
2031 if (!player.active)
2032 {
2033 continue;
2034 }
2035 for (int j = 0; j < 58; j++)
2036 {
2037 Item item = player.inventory[j];
2038 if (item != null && item.stack > 0)
2039 {
2040 if (item.type == 71)
2041 {
2042 num2 += item.stack;
2043 }
2044 if (item.type == 72)
2045 {
2046 num2 += item.stack * 100;
2047 }
2048 if (item.type == 73)
2049 {
2050 num2 += item.stack * 10000;
2051 }
2052 if (item.type == 74)
2053 {
2054 num2 += item.stack * 1000000;
2055 }
2056 if ((double)num2 >= num)
2057 {
2058 return true;
2059 }
2060 }
2061 }
2062 }
2063 return false;
2064 }
static bool unlockedMerchantSpawn
Definition NPC.cs:762

References Terraria.Entity.active, Terraria.Player.inventory, Terraria.Main.player, Terraria.Item.stack, Terraria.Item.type, and Terraria.NPC.unlockedMerchantSpawn.

Referenced by Terraria.Main.UpdateTime_SpawnTownNPCs().

+ Here is the caller graph for this function: