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

◆ SpawnAllowed_Merchant()

static bool Terraria.NPC.SpawnAllowed_Merchant ( )
inlinestatic

Definition at line 1211 of file NPC.cs.

1212 {
1214 {
1215 return true;
1216 }
1217 double num = 5000.0;
1218 int num2 = 0;
1219 for (int i = 0; i < 255; i++)
1220 {
1221 Player player = Main.player[i];
1222 if (!player.active)
1223 {
1224 continue;
1225 }
1226 for (int j = 0; j < 58; j++)
1227 {
1228 Item item = player.inventory[j];
1229 if (item != null && item.stack > 0)
1230 {
1231 if (item.type == 71)
1232 {
1233 num2 += item.stack;
1234 }
1235 if (item.type == 72)
1236 {
1237 num2 += item.stack * 100;
1238 }
1239 if (item.type == 73)
1240 {
1241 num2 += item.stack * 10000;
1242 }
1243 if (item.type == 74)
1244 {
1245 num2 += item.stack * 1000000;
1246 }
1247 if ((double)num2 >= num)
1248 {
1249 return true;
1250 }
1251 }
1252 }
1253 }
1254 return false;
1255 }
static bool unlockedMerchantSpawn
Definition NPC.cs:323

References Terraria.Entity.active, Terraria.Player.inventory, System.item, Terraria.Main.player, and Terraria.NPC.unlockedMerchantSpawn.

Referenced by Terraria.Main.UpdateTime_SpawnTownNPCs().