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

◆ SetupTravelShop()

static void Terraria.Chest.SetupTravelShop ( )
inlinestatic

Definition at line 1303 of file Chest.cs.

1304 {
1305 for (int i = 0; i < 40; i++)
1306 {
1307 Main.travelShop[i] = 0;
1308 }
1309 Player player = null;
1310 for (int j = 0; j < 255; j++)
1311 {
1312 Player player2 = Main.player[j];
1313 if (player2.active && (player == null || player.luck < player2.luck))
1314 {
1315 player = player2;
1316 }
1317 }
1318 if (player == null)
1319 {
1320 player = new Player();
1321 }
1322 int num = Main.rand.Next(4, 7);
1323 if (player.RollLuck(4) == 0)
1324 {
1325 num++;
1326 }
1327 if (player.RollLuck(8) == 0)
1328 {
1329 num++;
1330 }
1331 if (player.RollLuck(16) == 0)
1332 {
1333 num++;
1334 }
1335 if (player.RollLuck(32) == 0)
1336 {
1337 num++;
1338 }
1339 if (Main.expertMode && player.RollLuck(2) == 0)
1340 {
1341 num++;
1342 }
1343 if (NPC.peddlersSatchelWasUsed)
1344 {
1345 num++;
1346 }
1347 if (Main.tenthAnniversaryWorld)
1348 {
1349 if (!Main.getGoodWorld)
1350 {
1351 num++;
1352 }
1353 num++;
1354 }
1355 int count = 0;
1356 int added = 0;
1357 int[] array = new int[6] { 100, 200, 300, 400, 500, 600 };
1358 int[] rarity = array;
1359 int num2 = 0;
1360 if (Main.hardMode)
1361 {
1362 int it = 0;
1363 while (num2 < 5000)
1364 {
1365 num2++;
1367 SetupTravelShop_GetItem(player, rarity, ref it, 2);
1369 {
1371 break;
1372 }
1373 }
1374 }
1375 while (added < num)
1376 {
1377 int it2 = 0;
1378 SetupTravelShop_GetItem(player, array, ref it2);
1380 {
1382 }
1383 }
1384 rarity = array;
1385 num2 = 0;
1386 int it3 = 0;
1387 while (num2 < 5000)
1388 {
1389 num2++;
1391 SetupTravelShop_GetPainting(player, rarity, ref it3);
1393 {
1395 break;
1396 }
1397 }
1398 }
static void SetupTravelShop_GetPainting(Player playerWithHighestLuck, int[] rarity, ref int it, int minimumRarity=0)
Definition Chest.cs:870
static void SetupTravelShop_GetItem(Player playerWithHighestLuck, int[] rarity, ref int it, int minimumRarity=0)
Definition Chest.cs:1013
static bool SetupTravelShop_CanAddItemToShop(int it)
Definition Chest.cs:846
static void SetupTravelShop_AdjustSlotRarities(int slotItemAttempts, ref int[] rarity)
Definition Chest.cs:985
static void SetupTravelShop_AddToShop(int it, ref int added, ref int count)
Definition Chest.cs:764

References Terraria.Main.expertMode, Terraria.Main.getGoodWorld, Terraria.Main.hardMode, Terraria.Player.luck, Terraria.NPC.peddlersSatchelWasUsed, Terraria.Main.player, Terraria.Main.rand, Terraria.Player.RollLuck(), Terraria.Chest.SetupTravelShop_AddToShop(), Terraria.Chest.SetupTravelShop_AdjustSlotRarities(), Terraria.Chest.SetupTravelShop_CanAddItemToShop(), Terraria.Chest.SetupTravelShop_GetItem(), Terraria.Chest.SetupTravelShop_GetPainting(), Terraria.Main.tenthAnniversaryWorld, and Terraria.Main.travelShop.

Referenced by Terraria.Main.Initialize_AlmostEverything(), and Terraria.WorldGen.SpawnTravelNPC().