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

◆ AI_061_FishingBobber_GiveItemToPlayer()

void Terraria.Projectile.AI_061_FishingBobber_GiveItemToPlayer ( Player thePlayer,
int itemType )
inlineprivate

Definition at line 44084 of file Projectile.cs.

44085 {
44086 Item item = new Item();
44087 item.SetDefaults(itemType);
44088 if (itemType == 3196)
44089 {
44090 int finalFishingLevel = thePlayer.GetFishingConditions().FinalFishingLevel;
44091 int minValue = (finalFishingLevel / 20 + 3) / 2;
44092 int num = (finalFishingLevel / 10 + 6) / 2;
44093 if (Main.rand.Next(50) < finalFishingLevel)
44094 {
44095 num++;
44096 }
44097 if (Main.rand.Next(100) < finalFishingLevel)
44098 {
44099 num++;
44100 }
44101 if (Main.rand.Next(150) < finalFishingLevel)
44102 {
44103 num++;
44104 }
44105 if (Main.rand.Next(200) < finalFishingLevel)
44106 {
44107 num++;
44108 }
44109 int stack = Main.rand.Next(minValue, num + 1);
44110 item.stack = stack;
44111 }
44112 if (itemType == 3197)
44113 {
44114 int finalFishingLevel2 = thePlayer.GetFishingConditions().FinalFishingLevel;
44115 int minValue2 = (finalFishingLevel2 / 4 + 15) / 2;
44116 int num2 = (finalFishingLevel2 / 2 + 40) / 2;
44117 if (Main.rand.Next(50) < finalFishingLevel2)
44118 {
44119 num2 += 6;
44120 }
44121 if (Main.rand.Next(100) < finalFishingLevel2)
44122 {
44123 num2 += 6;
44124 }
44125 if (Main.rand.Next(150) < finalFishingLevel2)
44126 {
44127 num2 += 6;
44128 }
44129 if (Main.rand.Next(200) < finalFishingLevel2)
44130 {
44131 num2 += 6;
44132 }
44133 int stack2 = Main.rand.Next(minValue2, num2 + 1);
44134 item.stack = stack2;
44135 }
44136 item.newAndShiny = true;
44137 Item item2 = thePlayer.GetItem(owner, item, default(GetItemSettings));
44138 if (item2.stack > 0)
44139 {
44140 int number = Item.NewItem(new EntitySource_FishedOut(this), (int)position.X, (int)position.Y, width, height, itemType, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
44141 if (Main.netMode == 1)
44142 {
44143 NetMessage.SendData(21, -1, -1, null, number, 1f);
44144 }
44145 }
44146 else
44147 {
44148 item.position.X = base.Center.X - (float)(item.width / 2);
44149 item.position.Y = base.Center.Y - (float)(item.height / 2);
44150 item.active = true;
44151 PopupText.NewText(PopupTextContext.RegularItemPickup, item, 0);
44152 }
44153 }
Vector2 position
Definition Entity.cs:14

References System.item, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.PopupText.NewText(), Terraria.Main.rand, Terraria.NetMessage.SendData(), Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.