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

◆ SetupTravelShop()

static void Terraria.Chest.SetupTravelShop ( )
inlinestatic

Sets up the F:Terraria.ID.NPCID.TravellingMerchant's shop.

Definition at line 1607 of file Chest.cs.

1608 {
1609 for (int i = 0; i < 40; i++)
1610 {
1611 Main.travelShop[i] = 0;
1612 }
1613 Player player = null;
1614 for (int j = 0; j < 255; j++)
1615 {
1616 Player player2 = Main.player[j];
1617 if (player2.active && (player == null || player.luck < player2.luck))
1618 {
1619 player = player2;
1620 }
1621 }
1622 if (player == null)
1623 {
1624 player = new Player();
1625 }
1626 int num = Main.rand.Next(4, 7);
1627 if (player.RollLuck(4) == 0)
1628 {
1629 num++;
1630 }
1631 if (player.RollLuck(8) == 0)
1632 {
1633 num++;
1634 }
1635 if (player.RollLuck(16) == 0)
1636 {
1637 num++;
1638 }
1639 if (player.RollLuck(32) == 0)
1640 {
1641 num++;
1642 }
1643 if (Main.expertMode && player.RollLuck(2) == 0)
1644 {
1645 num++;
1646 }
1647 if (NPC.peddlersSatchelWasUsed)
1648 {
1649 num++;
1650 }
1651 if (Main.tenthAnniversaryWorld)
1652 {
1653 if (!Main.getGoodWorld)
1654 {
1655 num++;
1656 }
1657 num++;
1658 }
1659 int count = 0;
1660 int added = 0;
1661 int[] array = new int[6] { 100, 200, 300, 400, 500, 600 };
1662 int[] rarity = array;
1663 int num2 = 0;
1664 if (Main.hardMode)
1665 {
1666 int it = 0;
1667 while (num2 < 5000)
1668 {
1669 num2++;
1671 SetupTravelShop_GetItem(player, rarity, ref it, 2);
1673 {
1675 break;
1676 }
1677 }
1678 }
1679 while (added < num)
1680 {
1681 int it2 = 0;
1682 SetupTravelShop_GetItem(player, array, ref it2);
1684 {
1686 }
1687 }
1688 rarity = array;
1689 num2 = 0;
1690 int it3 = 0;
1691 while (num2 < 5000)
1692 {
1693 num2++;
1695 SetupTravelShop_GetPainting(player, rarity, ref it3);
1697 {
1699 break;
1700 }
1701 }
1702 NPCLoader.SetupTravelShop(Main.travelShop, ref count);
1703 }
static void SetupTravelShop_GetPainting(Player playerWithHighestLuck, int[] rarity, ref int it, int minimumRarity=0)
Definition Chest.cs:1171
static void SetupTravelShop_GetItem(Player playerWithHighestLuck, int[] rarity, ref int it, int minimumRarity=0)
Definition Chest.cs:1314
static bool SetupTravelShop_CanAddItemToShop(int it)
Definition Chest.cs:1147
static void SetupTravelShop_AdjustSlotRarities(int slotItemAttempts, ref int[] rarity)
Definition Chest.cs:1286
static void SetupTravelShop_AddToShop(int it, ref int added, ref int count)
Definition Chest.cs:1065
static void SetupTravelShop(int[] shop, ref int nextSlot)
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26

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.ModLoader.NPCLoader.SetupTravelShop(), 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().

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