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

◆ UpdatePetLight()

void Terraria.Player.UpdatePetLight ( int i)
inline

Definition at line 15658 of file Player.cs.

15659 {
15660 //IL_00e0: Unknown result type (might be due to invalid IL or missing references)
15661 if (i != Main.myPlayer || miscEquips[1].buffType < 1 || miscEquips[1].stack < 1)
15662 {
15663 return;
15664 }
15665 int num = miscEquips[1].buffType;
15666 if ((!Main.vanityPet[num] && !Main.lightPet[num]) || hideMisc[1] || (miscEquips[1].type == 603 && !Main.runningCollectorsEdition))
15667 {
15668 return;
15669 }
15670 int num2 = FindBuffIndex(num);
15671 if (num == 27 && num2 == -1)
15672 {
15673 num2 = FindBuffIndex(102);
15674 }
15675 if (num == 27 && num2 == -1)
15676 {
15677 num2 = FindBuffIndex(101);
15678 }
15679 if (num2 == -1)
15680 {
15681 if (num == 27)
15682 {
15683 num = Utils.SelectRandom<int>(Main.rand, 27, 102, 101);
15684 }
15685 AddBuff(num, 3600);
15687 }
15688 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int stack
The current stack of the item. F:Terraria.Item.maxStack indicates the max possible stack.
Definition Item.cs:396
int buffType
The Buff ID of the buff given by this item on use. To have a potion give multiple buffs,...
Definition Item.cs:683
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
BitsByte hideMisc
Definition Player.cs:1882
int FindBuffIndex(int type)
Definition Player.cs:5676
Item[] miscEquips
The player's equipment items. From indexes 0-4: Pet, Light Pet, Minecart, Mount, and Hook.
Definition Player.cs:1658
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Gives the player the provided buff. This accounts for if the player is immune to the buff....
Definition Player.cs:5700

References Terraria.Player.AddBuff(), Terraria.Item.buffType, Terraria.Player.FindBuffIndex(), Terraria.Player.hideMisc, Terraria.Main.lightPet, Terraria.Player.miscEquips, Terraria.Main.myPlayer, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.Main.runningCollectorsEdition, Terraria.Item.stack, Terraria.Item.type, and Terraria.Main.vanityPet.

Referenced by Terraria.Player.Update().

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