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

◆ GetAnglerReward_Decoration()

void Terraria.Player.GetAnglerReward_Decoration ( IEntitySource source,
int questsDone,
float rarityReduction,
ref GetItemSettings anglerRewardSettings )
inlineprivate

Definition at line 53001 of file Player.cs.

53002 {
53003 float value = 1f - rarityReduction;
53004 int num = 100;
53005 float num2 = MathHelper.Lerp(value, 1f, Math.Min(1f, (float)questsDone / (float)num));
53006 if (!(num2 >= 1f) && !(Main.rand.NextFloat() <= num2))
53007 {
53008 return;
53009 }
53010 Item item = new Item();
53011 item.type = 0;
53012 item.SetDefaults(Main.rand.Next(19) switch
53013 {
53014 1 => 2443,
53015 2 => 2444,
53016 3 => 2445,
53017 4 => 2497,
53018 5 => 2495,
53019 6 => 2446,
53020 7 => 2447,
53021 8 => 2448,
53022 9 => 2449,
53023 10 => 2490,
53024 11 => 2496,
53025 12 => 5235,
53026 13 => 5252,
53027 14 => 5256,
53028 15 => 5259,
53029 16 => 5263,
53030 17 => 5264,
53031 18 => 5265,
53032 _ => 2442,
53033 });
53034 item.position = base.Center;
53035 Item item2 = GetItem(whoAmI, item, GetItemSettings.NPCEntityToPlayerInventorySettings);
53036 if (item2.stack > 0)
53037 {
53038 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
53039 if (Main.netMode == 1)
53040 {
53041 NetMessage.SendData(21, -1, -1, null, number, 1f);
53042 }
53043 }
53044 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static byte Min(byte val1, byte val2)
Definition Math.cs:912
Vector2 position
Definition Entity.cs:14
Item GetItem(int plr, Item newItem, GetItemSettings settings)
Definition Player.cs:37130

References System.item, Microsoft.Xna.Framework.MathHelper.Lerp(), System.Math.Min(), Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.GetItemSettings.NPCEntityToPlayerInventorySettings, Terraria.Main.rand, Terraria.NetMessage.SendData(), System.source, and System.value.