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

◆ DelBuff()

void Terraria.NPC.DelBuff ( int buffIndex)
inline

Removes the buff at the provided index and shuffles the remaining buff indexes down to fill the gap. The buff types and times will then be synced to clients. This method should only be called on the server or in single player.

Parameters
buffIndexThe index of the buff to remove.

Definition at line 106775 of file NPC.cs.

106776 {
106777 buffTime[buffIndex] = 0;
106778 buffType[buffIndex] = 0;
106779 for (int i = 0; i < maxBuffs - 1; i++)
106780 {
106781 if (buffTime[i] == 0 || buffType[i] == 0)
106782 {
106783 for (int j = i + 1; j < maxBuffs; j++)
106784 {
106785 buffTime[j - 1] = buffTime[j];
106786 buffType[j - 1] = buffType[j];
106787 buffTime[j] = 0;
106788 buffType[j] = 0;
106789 }
106790 }
106791 }
106792 if (Main.netMode == 2)
106793 {
106794 NetMessage.SendData(54, -1, -1, null, whoAmI);
106795 }
106796 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
static readonly int maxBuffs
Definition NPC.cs:647
int[] buffTime
Definition NPC.cs:651
int[] buffType
Definition NPC.cs:649

References Terraria.Main.netMode, and Terraria.NetMessage.SendData().

+ Here is the call graph for this function: