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

◆ GetDyeTraderReward()

void Terraria.Player.GetDyeTraderReward ( NPC dyeTrader)
inline

Definition at line 57634 of file Player.cs.

57635 {
57636 //IL_01d5: Unknown result type (might be due to invalid IL or missing references)
57637 //IL_01da: Unknown result type (might be due to invalid IL or missing references)
57638 int num = -1;
57640 List<int> list = new List<int>
57641 {
57642 3560, 3028, 3041, 3040, 3025, 3190, 3027, 3026, 3554, 3553,
57643 3555, 2872, 3534, 2871
57644 };
57645 if (Main.hardMode)
57646 {
57647 list.Add(3039);
57648 list.Add(3038);
57649 list.Add(3598);
57650 list.Add(3597);
57651 list.Add(3600);
57652 list.Add(3042);
57653 list.Add(3533);
57654 list.Add(3561);
57655 if (NPC.downedMechBossAny)
57656 {
57657 list.Add(2883);
57658 list.Add(2869);
57659 list.Add(2873);
57660 list.Add(2870);
57661 }
57662 if (NPC.downedPlantBoss)
57663 {
57664 list.Add(2878);
57665 list.Add(2879);
57666 list.Add(2884);
57667 list.Add(2885);
57668 }
57669 if (NPC.downedMartians)
57670 {
57671 list.Add(2864);
57672 list.Add(3556);
57673 }
57674 if (NPC.downedMoonlord)
57675 {
57676 list.Add(3024);
57677 }
57678 }
57679 PlayerLoader.GetDyeTraderReward(this, list);
57680 num = list[Main.rand.Next(list.Count)];
57681 Item item = new Item();
57682 item.SetDefaults(num);
57683 item.stack = 6;
57684 item.position = base.Center;
57685 Item item2 = GetItem(whoAmI, item, GetItemSettings.NPCEntityToPlayerInventorySettings);
57686 if (item2.stack > 0)
57687 {
57688 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
57689 if (Main.netMode == 1)
57690 {
57691 NetMessage.SendData(21, -1, -1, null, number, 1f);
57692 }
57693 }
57694 }
Used when NPCs or pets/minions give gifts or rewards to a player.
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static void GetDyeTraderReward(Player player, List< int > rewardPool)
This is where all ModPlayer hooks are gathered and called.
Item GetItem(int plr, Item newItem, GetItemSettings settings)
Definition Player.cs:38131

References Terraria.NPC.downedMartians, Terraria.NPC.downedMechBossAny, Terraria.NPC.downedMoonlord, Terraria.NPC.downedPlantBoss, Terraria.ModLoader.PlayerLoader.GetDyeTraderReward(), Terraria.Player.GetItem(), Terraria.Main.hardMode, Terraria.Entity.height, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.GetItemSettings.NPCEntityToPlayerInventorySettings, Terraria.Entity.position, Terraria.Main.rand, Terraria.NetMessage.SendData(), Terraria.Item.SetDefaults(), Terraria.Entity.whoAmI, and Terraria.Entity.width.

+ Here is the call graph for this function: