tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.NPCLoader Class Reference

This serves as the central class from which NPC-related functions are carried out. It also stores a list of mod NPCs by ID. More...

+ Collaboration diagram for Terraria.ModLoader.NPCLoader:

Classes

class  HookList
 

Static Public Member Functions

static void AI (NPC npc)
 
static void BossBag (NPC npc, ref int bagType)
 
static void BossHeadRotation (NPC npc, ref float rotation)
 
static void BossHeadSlot (NPC npc, ref int index)
 
static void BossHeadSpriteEffects (NPC npc, ref SpriteEffects spriteEffects)
 
static void BossLoot (NPC npc, ref string name, ref int potionType)
 
static void BuffTownNPC (ref float damageMult, ref int defense)
 
static ? bool CanBeHitByItem (NPC npc, Player player, Item item)
 
static ? bool CanBeHitByProjectile (NPC npc, Projectile projectile)
 
static bool CanChat (NPC npc, bool vanillaCanChat)
 
static bool CanGoToStatue (NPC npc, bool toKingStatue, bool vanillaCanGo)
 
static ? bool CanHitNPC (NPC npc, NPC target)
 
static bool CanHitPlayer (NPC npc, Player target, ref int cooldownSlot)
 
static void CanTownNPCSpawn (int numTownNPCs, int money)
 
static bool CheckActive (NPC npc)
 
static bool CheckConditions (int type)
 
static bool CheckDead (NPC npc)
 
static ? int ChooseSpawn (NPCSpawnInfo spawnInfo)
 
static void DrawEffects (NPC npc, ref Color drawColor)
 
static bool DrawHealthBar (NPC npc, ref float scale)
 
static void DrawTownAttackGun (NPC npc, ref float scale, ref int item, ref int closeness)
 
static void DrawTownAttackSwing (NPC npc, ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)
 
static void EditSpawnRange (Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY)
 
static void EditSpawnRate (Player player, ref int spawnRate, ref int maxSpawns)
 
static void FindFrame (NPC npc, int frameHeight)
 
static ? Color GetAlpha (NPC npc, Color lightColor)
 
static void GetChat (NPC npc, ref string chat)
 
static ModNPC GetNPC (int type)
 Gets the ModNPC instance corresponding to the specified type. More...
 
static void HitEffect (NPC npc, int hitDirection, double damage)
 
static void ModifyHitByItem (NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit)
 
static void ModifyHitByProjectile (NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 
static void ModifyHitNPC (NPC npc, NPC target, ref int damage, ref float knockback, ref bool crit)
 
static void ModifyHitPlayer (NPC npc, Player target, ref int damage, ref bool crit)
 
static void NPCAI (NPC npc)
 
static void NPCLoot (NPC npc)
 
static void OnCatchNPC (NPC npc, Player player, Item item)
 
static void OnChatButtonClicked (bool firstButton)
 
static void OnGoToStatue (NPC npc, bool toKingStatue)
 
static void OnHitByItem (NPC npc, Player player, Item item, int damage, float knockback, bool crit)
 
static void OnHitByProjectile (NPC npc, Projectile projectile, int damage, float knockback, bool crit)
 
static void OnHitNPC (NPC npc, NPC target, int damage, float knockback, bool crit)
 
static void OnHitPlayer (NPC npc, Player target, int damage, bool crit)
 
static void PostAI (NPC npc)
 
static void PostDraw (NPC npc, SpriteBatch spriteBatch, Color drawColor)
 
static bool PreAI (NPC npc)
 
static bool PreChatButtonClicked (bool firstButton)
 
static bool PreDraw (NPC npc, SpriteBatch spriteBatch, Color drawColor)
 
static bool PreNPCLoot (NPC npc)
 
static void ReceiveExtraAI (NPC npc, BinaryReader reader)
 
static void ResetEffects (NPC npc)
 
static void ScaleExpertStats (NPC npc, int numPlayers, float bossLifeScale)
 
static void SendExtraAI (NPC npc, BinaryWriter writer)
 
static void SetChatButtons (ref string button, ref string button2)
 
static void SetupShop (int type, Chest shop, ref int nextSlot)
 
static void SetupTravelShop (int[] shop, ref int nextSlot)
 
static int SpawnNPC (int type, int tileX, int tileY)
 
static bool SpecialNPCLoot (NPC npc)
 
static bool StrikeNPC (NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
 
static void TownNPCAttackCooldown (NPC npc, ref int cooldown, ref int randExtraCooldown)
 
static void TownNPCAttackMagic (NPC npc, ref float auraLightMultiplier)
 
static void TownNPCAttackProj (NPC npc, ref int projType, ref int attackDelay)
 
static void TownNPCAttackProjSpeed (NPC npc, ref float multiplier, ref float gravityCorrection, ref float randomOffset)
 
static void TownNPCAttackShoot (NPC npc, ref bool inBetweenShots)
 
static void TownNPCAttackStrength (NPC npc, ref int damage, ref float knockback)
 
static void TownNPCAttackSwing (NPC npc, ref int itemWidth, ref int itemHeight)
 
static string TownNPCName (int type)
 
static void UpdateLifeRegen (NPC npc, ref int damage)
 
static bool UsesPartyHat (NPC npc)
 

Static Public Attributes

static readonly IList< int > blockLoot = new List<int>()
 Allows you to stop an NPC from dropping loot by adding item IDs to this list. This list will be cleared whenever NPCLoot ends. Useful for either removing an item or change the drop rate of an item in the NPC's loot table. To change the drop rate of an item, use the PreNPCLoot hook, spawn the item yourself, then add the item's ID to this list. More...
 

Properties

static int NPCCount [get]
 

Private Member Functions

delegate void DelegateBossHeadRotation (NPC npc, ref float rotation)
 
delegate void DelegateBossHeadSlot (NPC npc, ref int index)
 
delegate void DelegateBossHeadSpriteEffects (NPC npc, ref SpriteEffects spriteEffects)
 
delegate void DelegateBuffTownNPC (ref float damageMult, ref int defense)
 
delegate bool DelegateCanHitPlayer (NPC npc, Player target, ref int cooldownSlot)
 
delegate void DelegateDrawEffects (NPC npc, ref Color drawColor)
 
delegate? bool DelegateDrawHealthBar (NPC npc, byte bhPosition, ref float scale, ref Vector2 position)
 
delegate void DelegateDrawTownAttackGun (NPC npc, ref float scale, ref int item, ref int closeness)
 
delegate void DelegateDrawTownAttackSwing (NPC npc, ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)
 
delegate void DelegateEditSpawnRange (Player player, ref int spawnRangeX, ref int spawnRangeY, ref int safeRangeX, ref int safeRangeY)
 
delegate void DelegateEditSpawnRate (Player player, ref int spawnRate, ref int maxSpawns)
 
delegate void DelegateGetChat (NPC npc, ref string chat)
 
delegate void DelegateModifyHitByItem (NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit)
 
delegate void DelegateModifyHitByProjectile (NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 
delegate void DelegateModifyHitNPC (NPC npc, NPC target, ref int damage, ref float knockback, ref bool crit)
 
delegate void DelegateModifyHitPlayer (NPC npc, Player target, ref int damage, ref bool crit)
 
delegate void DelegateOnChatButtonClicked (NPC npc, bool firstButton)
 
delegate void DelegateSetupShop (int type, Chest shop, ref int nextSlot)
 
delegate void DelegateSetupTravelShop (int[] shop, ref int nextSlot)
 
delegate bool DelegateStrikeNPC (NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
 
delegate void DelegateTownNPCAttackCooldown (NPC npc, ref int cooldown, ref int randExtraCooldown)
 
delegate void DelegateTownNPCAttackMagic (NPC npc, ref float auraLightMultiplier)
 
delegate void DelegateTownNPCAttackProj (NPC npc, ref int projType, ref int attackDelay)
 
delegate void DelegateTownNPCAttackProjSpeed (NPC npc, ref float multiplier, ref float gravityCorrection, ref float randomOffset)
 
delegate void DelegateTownNPCAttackShoot (NPC npc, ref bool inBetweenShots)
 
delegate void DelegateTownNPCAttackStrength (NPC npc, ref int damage, ref float knockback)
 
delegate void DelegateTownNPCAttackSwing (NPC npc, ref int itemWidth, ref int itemHeight)
 
delegate void DelegateUpdateLifeRegen (NPC npc, ref int damage)
 

Static Private Member Functions

static NPCLoader ()
 
static HookList AddHook< F > (Expression< Func< GlobalNPC, F > > func)
 
static void DrawHealthBar (NPC npc, Vector2 position, float scale)
 
static bool HasMethod (Type t, string method, params Type[] args)
 

Static Private Attributes

static HookList HookAI = AddHook<Action<NPC>>(g => g.AI)
 
static HookList HookBossHeadRotation = AddHook<DelegateBossHeadRotation>(g => g.BossHeadRotation)
 
static HookList HookBossHeadSlot = AddHook<DelegateBossHeadSlot>(g => g.BossHeadSlot)
 
static HookList HookBossHeadSpriteEffects = AddHook<DelegateBossHeadSpriteEffects>(g => g.BossHeadSpriteEffects)
 
static HookList HookBuffTownNPC = AddHook<DelegateBuffTownNPC>(g => g.BuffTownNPC)
 
static HookList HookCanBeHitByItem = AddHook<Func<NPC, Player, Item, bool?>>(g => g.CanBeHitByItem)
 
static HookList HookCanBeHitByProjectile = AddHook<Func<NPC, Projectile, bool?>>(g => g.CanBeHitByProjectile)
 
static HookList HookCanChat = AddHook<Func<NPC, bool?>>(g => g.CanChat)
 
static HookList HookCanGoToStatue = AddHook<Func<NPC, bool, bool?>>(g => g.CanGoToStatue)
 
static HookList HookCanHitNPC = AddHook<Func<NPC, NPC, bool?>>(g => g.CanHitNPC)
 
static HookList HookCanHitPlayer = AddHook<DelegateCanHitPlayer>(g => g.CanHitPlayer)
 
static HookList HookCheckActive = AddHook<Func<NPC, bool>>(g => g.CheckActive)
 
static HookList HookCheckDead = AddHook<Func<NPC, bool>>(g => g.CheckDead)
 
static HookList HookDrawBehind = AddHook<Action<NPC, int>>(g => g.DrawBehind)
 
static HookList HookDrawEffects = AddHook<DelegateDrawEffects>(g => g.DrawEffects)
 
static HookList HookDrawHealthBar = AddHook<DelegateDrawHealthBar>(g => g.DrawHealthBar)
 
static HookList HookDrawTownAttackGun = AddHook<DelegateDrawTownAttackGun>(g => g.DrawTownAttackGun)
 
static HookList HookDrawTownAttackSwing = AddHook<DelegateDrawTownAttackSwing>(g => g.DrawTownAttackSwing)
 
static HookList HookEditSpawnPool = AddHook<Action<Dictionary<int, float>, NPCSpawnInfo>>(g => g.EditSpawnPool)
 
static HookList HookEditSpawnRange = AddHook<DelegateEditSpawnRange>(g => g.EditSpawnRange)
 
static HookList HookEditSpawnRate = AddHook<DelegateEditSpawnRate>(g => g.EditSpawnRate)
 
static HookList HookFindFrame = AddHook<Action<NPC, int>>(g => g.FindFrame)
 
static HookList HookGetAlpha = AddHook<Func<NPC, Color, Color?>>(g => g.GetAlpha)
 
static HookList HookGetChat = AddHook<DelegateGetChat>(g => g.GetChat)
 
static HookList HookHitEffect = AddHook<Action<NPC, int, double>>(g => g.HitEffect)
 
static HookList HookModifyHitByItem = AddHook<DelegateModifyHitByItem>(g => g.ModifyHitByItem)
 
static HookList HookModifyHitByProjectile = AddHook<DelegateModifyHitByProjectile>(g => g.ModifyHitByProjectile)
 
static HookList HookModifyHitNPC = AddHook<DelegateModifyHitNPC>(g => g.ModifyHitNPC)
 
static HookList HookModifyHitPlayer = AddHook<DelegateModifyHitPlayer>(g => g.ModifyHitPlayer)
 
static HookList HookNPCLoot = AddHook<Action<NPC>>(g => g.NPCLoot)
 
static HookList HookOnCatchNPC = AddHook<Action<NPC, Player, Item>>(g => g.OnCatchNPC)
 
static HookList HookOnChatButtonClicked = AddHook<DelegateOnChatButtonClicked>(g => g.OnChatButtonClicked)
 
static HookList HookOnGoToStatue = AddHook<Action<NPC, bool>>(g => g.OnGoToStatue)
 
static HookList HookOnHitByItem = AddHook<Action<NPC, Player, Item, int, float, bool>>(g => g.OnHitByItem)
 
static HookList HookOnHitByProjectile = AddHook<Action<NPC, Projectile, int, float, bool>>(g => g.OnHitByProjectile)
 
static HookList HookOnHitNPC = AddHook<Action<NPC, NPC, int, float, bool>>(g => g.OnHitNPC)
 
static HookList HookOnHitPlayer = AddHook<Action<NPC, Player, int, bool>>(g => g.OnHitPlayer)
 
static HookList HookPostAI = AddHook<Action<NPC>>(g => g.PostAI)
 
static HookList HookPostDraw = AddHook<Action<NPC, SpriteBatch, Color>>(g => g.PostDraw)
 
static HookList HookPreAI = AddHook<Func<NPC, bool>>(g => g.PreAI)
 
static HookList HookPreChatButtonClicked = AddHook<Func<NPC, bool, bool>>(g => g.PreChatButtonClicked)
 
static HookList HookPreDraw = AddHook<Func<NPC, SpriteBatch, Color, bool>>(g => g.PreDraw)
 
static HookList HookPreNPCLoot = AddHook<Func<NPC, bool>>(g => g.PreNPCLoot)
 
static HookList HookResetEffects = AddHook<Action<NPC>>(g => g.ResetEffects)
 
static List< HookListhooks = new List<HookList>()
 
static HookList HookScaleExpertStats = AddHook<Action<NPC, int, float>>(g => g.ScaleExpertStats)
 
static HookList HookSetDefaults = AddHook<Action<NPC>>(g => g.SetDefaults)
 
static HookList HookSetupShop = AddHook<DelegateSetupShop>(g => g.SetupShop)
 
static HookList HookSetupTravelShop = AddHook<DelegateSetupTravelShop>(g => g.SetupTravelShop)
 
static HookList HookSpawnNPC = AddHook<Action<int, int, int>>(g => g.SpawnNPC)
 
static HookList HookSpecialNPCLoot = AddHook<Func<NPC, bool>>(g => g.SpecialNPCLoot)
 
static HookList HookStrikeNPC = AddHook<DelegateStrikeNPC>(g => g.StrikeNPC)
 
static HookList HookTownNPCAttackCooldown = AddHook<DelegateTownNPCAttackCooldown>(g => g.TownNPCAttackCooldown)
 
static HookList HookTownNPCAttackMagic = AddHook<DelegateTownNPCAttackMagic>(g => g.TownNPCAttackMagic)
 
static HookList HookTownNPCAttackProj = AddHook<DelegateTownNPCAttackProj>(g => g.TownNPCAttackProj)
 
static HookList HookTownNPCAttackProjSpeed = AddHook<DelegateTownNPCAttackProjSpeed>(g => g.TownNPCAttackProjSpeed)
 
static HookList HookTownNPCAttackShoot = AddHook<DelegateTownNPCAttackShoot>(g => g.TownNPCAttackShoot)
 
static HookList HookTownNPCAttackStrength = AddHook<DelegateTownNPCAttackStrength>(g => g.TownNPCAttackStrength)
 
static HookList HookTownNPCAttackSwing = AddHook<DelegateTownNPCAttackSwing>(g => g.TownNPCAttackSwing)
 
static HookList HookUpdateLifeRegen = AddHook<DelegateUpdateLifeRegen>(g => g.UpdateLifeRegen)
 
static int nextNPC = NPCID.Count
 
static readonly int[] shopToNPC = new int[Main.MaxShopIDs - 1]
 
static int vanillaSkeletonCount = NPCID.Sets.Skeletons.Count
 

Detailed Description

This serves as the central class from which NPC-related functions are carried out. It also stores a list of mod NPCs by ID.

Definition at line 19 of file NPCLoader.cs.

Constructor & Destructor Documentation

◆ NPCLoader()

static Terraria.ModLoader.NPCLoader.NPCLoader ( )
staticprivate

Definition at line 54 of file NPCLoader.cs.

54 {
55 shopToNPC[1] = NPCID.Merchant;
56 shopToNPC[2] = NPCID.ArmsDealer;
57 shopToNPC[3] = NPCID.Dryad;
58 shopToNPC[4] = NPCID.Demolitionist;
59 shopToNPC[5] = NPCID.Clothier;
60 shopToNPC[6] = NPCID.GoblinTinkerer;
61 shopToNPC[7] = NPCID.Wizard;
62 shopToNPC[8] = NPCID.Mechanic;
63 shopToNPC[9] = NPCID.SantaClaus;
64 shopToNPC[10] = NPCID.Truffle;
65 shopToNPC[11] = NPCID.Steampunker;
66 shopToNPC[12] = NPCID.DyeTrader;
67 shopToNPC[13] = NPCID.PartyGirl;
68 shopToNPC[14] = NPCID.Cyborg;
69 shopToNPC[15] = NPCID.Painter;
70 shopToNPC[16] = NPCID.WitchDoctor;
71 shopToNPC[17] = NPCID.Pirate;
72 shopToNPC[18] = NPCID.Stylist;
73 shopToNPC[19] = NPCID.TravellingMerchant;
74 shopToNPC[20] = NPCID.SkeletonMerchant;
75 shopToNPC[21] = NPCID.DD2Bartender;
76 }
static readonly int[] shopToNPC
Definition: NPCLoader.cs:30

References Terraria.ModLoader.NPCLoader.shopToNPC.

Member Function Documentation

◆ AddHook< F >()

static HookList Terraria.ModLoader.NPCLoader.AddHook< F > ( Expression< Func< GlobalNPC, F > >  func)
staticprivate

Definition at line 48 of file NPCLoader.cs.

48 {
49 var hook = new HookList(ModLoader.Method(func));
50 hooks.Add(hook);
51 return hook;
52 }
static List< HookList > hooks
Definition: NPCLoader.cs:46

References Terraria.ModLoader.NPCLoader.hooks.

◆ AI()

static void Terraria.ModLoader.NPCLoader.AI ( NPC  npc)
static

Definition at line 270 of file NPCLoader.cs.

270 {
271 npc.modNPC?.AI();
272
273 foreach (GlobalNPC g in HookAI.arr) {
274 g.Instance(npc).AI(npc);
275 }
276 }
static HookList HookAI
Definition: NPCLoader.cs:268

References Terraria.ModLoader.GlobalNPC.AI(), Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookAI, and Terraria.ModLoader.GlobalNPC.Instance().

Referenced by Terraria.ModLoader.NPCLoader.NPCAI().

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

◆ BossBag()

static void Terraria.ModLoader.NPCLoader.BossBag ( NPC  npc,
ref int  bagType 
)
static

Definition at line 435 of file NPCLoader.cs.

435 {
436 if (npc.modNPC != null) {
437 bagType = npc.modNPC.bossBag;
438 }
439 }

◆ BossHeadRotation()

static void Terraria.ModLoader.NPCLoader.BossHeadRotation ( NPC  npc,
ref float  rotation 
)
static

Definition at line 654 of file NPCLoader.cs.

654 {
655 npc.modNPC?.BossHeadRotation(ref rotation);
656
657 foreach (GlobalNPC g in HookBossHeadRotation.arr) {
658 g.Instance(npc).BossHeadRotation(npc, ref rotation);
659 }
660 }
static HookList HookBossHeadRotation
Definition: NPCLoader.cs:652

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.BossHeadRotation(), Terraria.ModLoader.NPCLoader.HookBossHeadRotation, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ BossHeadSlot()

static void Terraria.ModLoader.NPCLoader.BossHeadSlot ( NPC  npc,
ref int  index 
)
static

Definition at line 643 of file NPCLoader.cs.

643 {
644 npc.modNPC?.BossHeadSlot(ref index);
645
646 foreach (GlobalNPC g in HookBossHeadSlot.arr) {
647 g.Instance(npc).BossHeadSlot(npc, ref index);
648 }
649 }
static HookList HookBossHeadSlot
Definition: NPCLoader.cs:641

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.BossHeadSlot(), Terraria.ModLoader.NPCLoader.HookBossHeadSlot, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ BossHeadSpriteEffects()

static void Terraria.ModLoader.NPCLoader.BossHeadSpriteEffects ( NPC  npc,
ref SpriteEffects  spriteEffects 
)
static

Definition at line 665 of file NPCLoader.cs.

665 {
666 npc.modNPC?.BossHeadSpriteEffects(ref spriteEffects);
667
668 foreach (GlobalNPC g in HookBossHeadSpriteEffects.arr) {
669 g.Instance(npc).BossHeadSpriteEffects(npc, ref spriteEffects);
670 }
671 }
static HookList HookBossHeadSpriteEffects
Definition: NPCLoader.cs:663

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.BossHeadSpriteEffects(), Terraria.ModLoader.NPCLoader.HookBossHeadSpriteEffects, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ BossLoot()

static void Terraria.ModLoader.NPCLoader.BossLoot ( NPC  npc,
ref string  name,
ref int  potionType 
)
static

Definition at line 431 of file NPCLoader.cs.

431 {
432 npc.modNPC?.BossLoot(ref name, ref potionType);
433 }

◆ BuffTownNPC()

static void Terraria.ModLoader.NPCLoader.BuffTownNPC ( ref float  damageMult,
ref int  defense 
)
static

Definition at line 994 of file NPCLoader.cs.

994 {
995 foreach (GlobalNPC g in HookBuffTownNPC.arr) {
996 g.BuffTownNPC(ref damageMult, ref defense);
997 }
998 }
static HookList HookBuffTownNPC
Definition: NPCLoader.cs:992

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.BuffTownNPC(), and Terraria.ModLoader.NPCLoader.HookBuffTownNPC.

+ Here is the call graph for this function:

◆ CanBeHitByItem()

static ? bool Terraria.ModLoader.NPCLoader.CanBeHitByItem ( NPC  npc,
Player  player,
Item  item 
)
static

Definition at line 534 of file NPCLoader.cs.

534 {
535 bool? flag = null;
536 foreach (GlobalNPC g in HookCanBeHitByItem.arr) {
537 bool? canHit = g.Instance(npc).CanBeHitByItem(npc, player, item);
538 if (canHit.HasValue && !canHit.Value) {
539 return false;
540 }
541 if (canHit.HasValue) {
542 flag = canHit.Value;
543 }
544 }
545 if (npc.modNPC != null) {
546 bool? canHit = npc.modNPC.CanBeHitByItem(player, item);
547 if (canHit.HasValue && !canHit.Value) {
548 return false;
549 }
550 if (canHit.HasValue) {
551 flag = canHit.Value;
552 }
553 }
554 return flag;
555 }
static HookList HookCanBeHitByItem
Definition: NPCLoader.cs:532

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CanBeHitByItem(), Terraria.ModLoader.NPCLoader.HookCanBeHitByItem, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CanBeHitByProjectile()

static ? bool Terraria.ModLoader.NPCLoader.CanBeHitByProjectile ( NPC  npc,
Projectile  projectile 
)
static

Definition at line 580 of file NPCLoader.cs.

580 {
581 bool? flag = null;
582 foreach (GlobalNPC g in HookCanBeHitByProjectile.arr) {
583 bool? canHit = g.Instance(npc).CanBeHitByProjectile(npc, projectile);
584 if (canHit.HasValue && !canHit.Value) {
585 return false;
586 }
587 if (canHit.HasValue) {
588 flag = canHit.Value;
589 }
590 }
591 if (npc.modNPC != null) {
592 bool? canHit = npc.modNPC.CanBeHitByProjectile(projectile);
593 if (canHit.HasValue && !canHit.Value) {
594 return false;
595 }
596 if (canHit.HasValue) {
597 flag = canHit.Value;
598 }
599 }
600 return flag;
601 }
static HookList HookCanBeHitByProjectile
Definition: NPCLoader.cs:578

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CanBeHitByProjectile(), Terraria.ModLoader.NPCLoader.HookCanBeHitByProjectile, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CanChat()

static bool Terraria.ModLoader.NPCLoader.CanChat ( NPC  npc,
bool  vanillaCanChat 
)
static

Definition at line 861 of file NPCLoader.cs.

861 {
862 bool defaultCanChat = npc.modNPC?.CanChat() ?? vanillaCanChat;
863
864 foreach (GlobalNPC g in HookCanChat.arr) {
865 bool? canChat = g.Instance(npc).CanChat(npc);
866 if (canChat.HasValue) {
867 if (!canChat.Value) {
868 return false;
869 }
870 defaultCanChat = true;
871 }
872 }
873
874 return defaultCanChat;
875 }
static HookList HookCanChat
Definition: NPCLoader.cs:859

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CanChat(), Terraria.ModLoader.NPCLoader.HookCanChat, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CanGoToStatue()

static bool Terraria.ModLoader.NPCLoader.CanGoToStatue ( NPC  npc,
bool  toKingStatue,
bool  vanillaCanGo 
)
static

Definition at line 965 of file NPCLoader.cs.

965 {
966 bool defaultCanGo = npc.modNPC?.CanGoToStatue(toKingStatue) ?? vanillaCanGo;
967
968 foreach (GlobalNPC g in HookCanGoToStatue.arr) {
969 bool? canGo = g.Instance(npc).CanGoToStatue(npc, toKingStatue);
970 if (canGo.HasValue) {
971 if (!canGo.Value) {
972 return false;
973 }
974 defaultCanGo = true;
975 }
976 }
977
978 return defaultCanGo;
979 }
static HookList HookCanGoToStatue
Definition: NPCLoader.cs:963

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CanGoToStatue(), Terraria.ModLoader.NPCLoader.HookCanGoToStatue, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CanHitNPC()

static ? bool Terraria.ModLoader.NPCLoader.CanHitNPC ( NPC  npc,
NPC  target 
)
static

Definition at line 489 of file NPCLoader.cs.

489 {
490 bool? flag = null;
491 foreach (GlobalNPC g in HookCanHitNPC.arr) {
492 bool? canHit = g.Instance(npc).CanHitNPC(npc, target);
493 if (canHit.HasValue && !canHit.Value) {
494 return false;
495 }
496 if (canHit.HasValue) {
497 flag = canHit.Value;
498 }
499 }
500 if (npc.modNPC != null) {
501 bool? canHit = npc.modNPC.CanHitNPC(target);
502 if (canHit.HasValue && !canHit.Value) {
503 return false;
504 }
505 if (canHit.HasValue) {
506 flag = canHit.Value;
507 }
508 }
509 return flag;
510 }
static HookList HookCanHitNPC
Definition: NPCLoader.cs:487

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CanHitNPC(), Terraria.ModLoader.NPCLoader.HookCanHitNPC, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CanHitPlayer()

static bool Terraria.ModLoader.NPCLoader.CanHitPlayer ( NPC  npc,
Player  target,
ref int  cooldownSlot 
)
static

Definition at line 454 of file NPCLoader.cs.

454 {
455 foreach (GlobalNPC g in HookCanHitPlayer.arr) {
456 if (!g.Instance(npc).CanHitPlayer(npc, target, ref cooldownSlot)) {
457 return false;
458 }
459 }
460 if (npc.modNPC != null) {
461 return npc.modNPC.CanHitPlayer(target, ref cooldownSlot);
462 }
463 return true;
464 }
static HookList HookCanHitPlayer
Definition: NPCLoader.cs:452

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CanHitPlayer(), Terraria.ModLoader.NPCLoader.HookCanHitPlayer, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CanTownNPCSpawn()

static void Terraria.ModLoader.NPCLoader.CanTownNPCSpawn ( int  numTownNPCs,
int  money 
)
static

Definition at line 835 of file NPCLoader.cs.

835 {
836 foreach (ModNPC npc in npcs) {
837 if (npc.npc.townNPC && NPC.TypeToHeadIndex(npc.npc.type) >= 0 && !NPC.AnyNPCs(npc.npc.type) &&
838 npc.CanTownNPCSpawn(numTownNPCs, money)) {
839 Main.townNPCCanSpawn[npc.npc.type] = true;
840 if (WorldGen.prioritizedTownNPC == 0) {
841 WorldGen.prioritizedTownNPC = npc.npc.type;
842 }
843 }
844 }
845 }

References Terraria.ModLoader.ModNPC.CanTownNPCSpawn(), and Terraria.ModLoader.ModNPC.npc.

+ Here is the call graph for this function:

◆ CheckActive()

static bool Terraria.ModLoader.NPCLoader.CheckActive ( NPC  npc)
static

Definition at line 358 of file NPCLoader.cs.

358 {
359 if (npc.modNPC != null && !npc.modNPC.CheckActive()) {
360 return false;
361 }
362 foreach (GlobalNPC g in HookCheckActive.arr) {
363 if (!g.Instance(npc).CheckActive(npc)) {
364 return false;
365 }
366 }
367 return true;
368 }
static HookList HookCheckActive
Definition: NPCLoader.cs:356

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CheckActive(), Terraria.ModLoader.NPCLoader.HookCheckActive, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ CheckConditions()

static bool Terraria.ModLoader.NPCLoader.CheckConditions ( int  type)
static

Definition at line 847 of file NPCLoader.cs.

847 {
848 return GetNPC(type)?.CheckConditions(WorldGen.roomX1, WorldGen.roomX2, WorldGen.roomY1, WorldGen.roomY2) ?? true;
849 }
virtual bool CheckConditions(int left, int right, int top, int bottom)
Allows you to define special conditions required for this town NPC's house. For example,...
Definition: ModNPC.cs:588
static ModNPC GetNPC(int type)
Gets the ModNPC instance corresponding to the specified type.
Definition: NPCLoader.cs:93

References Terraria.ModLoader.ModNPC.CheckConditions(), and Terraria.ModLoader.NPCLoader.GetNPC().

+ Here is the call graph for this function:

◆ CheckDead()

static bool Terraria.ModLoader.NPCLoader.CheckDead ( NPC  npc)
static

Definition at line 372 of file NPCLoader.cs.

372 {
373 bool result = true;
374
375 if (npc.modNPC != null) {
376 result = npc.modNPC.CheckDead();
377 }
378
379 foreach (GlobalNPC g in HookCheckDead.arr) {
380 result &= g.Instance(npc).CheckDead(npc);
381 }
382
383 return result;
384 }
static HookList HookCheckDead
Definition: NPCLoader.cs:370

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.CheckDead(), Terraria.ModLoader.NPCLoader.HookCheckDead, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ ChooseSpawn()

static ? int Terraria.ModLoader.NPCLoader.ChooseSpawn ( NPCSpawnInfo  spawnInfo)
static

Definition at line 789 of file NPCLoader.cs.

789 {
790 NPCSpawnHelper.Reset();
791 NPCSpawnHelper.DoChecks(spawnInfo);
792 IDictionary<int, float> pool = new Dictionary<int, float>();
793 pool[0] = 1f;
794 foreach (ModNPC npc in npcs) {
795 float weight = npc.SpawnChance(spawnInfo);
796 if (weight > 0f) {
797 pool[npc.npc.type] = weight;
798 }
799 }
800 foreach (GlobalNPC g in HookEditSpawnPool.arr) {
801 g.EditSpawnPool(pool, spawnInfo);
802 }
803 float totalWeight = 0f;
804 foreach (int type in pool.Keys) {
805 if (pool[type] < 0f) {
806 pool[type] = 0f;
807 }
808 totalWeight += pool[type];
809 }
810 float choice = (float)Main.rand.NextDouble() * totalWeight;
811 foreach (int type in pool.Keys) {
812 float weight = pool[type];
813 if (choice < weight) {
814 return type;
815 }
816 choice -= weight;
817 }
818 return null;
819 }
static HookList HookEditSpawnPool
Definition: NPCLoader.cs:787

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.EditSpawnPool(), Terraria.ModLoader.NPCLoader.HookEditSpawnPool, Terraria.ModLoader.ModNPC.npc, and Terraria.ModLoader.ModNPC.SpawnChance().

+ Here is the call graph for this function:

◆ DelegateBossHeadRotation()

delegate void Terraria.ModLoader.NPCLoader.DelegateBossHeadRotation ( NPC  npc,
ref float  rotation 
)
private

◆ DelegateBossHeadSlot()

delegate void Terraria.ModLoader.NPCLoader.DelegateBossHeadSlot ( NPC  npc,
ref int  index 
)
private

◆ DelegateBossHeadSpriteEffects()

delegate void Terraria.ModLoader.NPCLoader.DelegateBossHeadSpriteEffects ( NPC  npc,
ref SpriteEffects  spriteEffects 
)
private

◆ DelegateBuffTownNPC()

delegate void Terraria.ModLoader.NPCLoader.DelegateBuffTownNPC ( ref float  damageMult,
ref int  defense 
)
private

◆ DelegateCanHitPlayer()

delegate bool Terraria.ModLoader.NPCLoader.DelegateCanHitPlayer ( NPC  npc,
Player  target,
ref int  cooldownSlot 
)
private

◆ DelegateDrawEffects()

delegate void Terraria.ModLoader.NPCLoader.DelegateDrawEffects ( NPC  npc,
ref Color  drawColor 
)
private

◆ DelegateDrawHealthBar()

delegate? bool Terraria.ModLoader.NPCLoader.DelegateDrawHealthBar ( NPC  npc,
byte  bhPosition,
ref float  scale,
ref Vector2  position 
)
private

◆ DelegateDrawTownAttackGun()

delegate void Terraria.ModLoader.NPCLoader.DelegateDrawTownAttackGun ( NPC  npc,
ref float  scale,
ref int  item,
ref int  closeness 
)
private

◆ DelegateDrawTownAttackSwing()

delegate void Terraria.ModLoader.NPCLoader.DelegateDrawTownAttackSwing ( NPC  npc,
ref Texture2D  item,
ref int  itemSize,
ref float  scale,
ref Vector2  offset 
)
private

◆ DelegateEditSpawnRange()

delegate void Terraria.ModLoader.NPCLoader.DelegateEditSpawnRange ( Player  player,
ref int  spawnRangeX,
ref int  spawnRangeY,
ref int  safeRangeX,
ref int  safeRangeY 
)
private

◆ DelegateEditSpawnRate()

delegate void Terraria.ModLoader.NPCLoader.DelegateEditSpawnRate ( Player  player,
ref int  spawnRate,
ref int  maxSpawns 
)
private

◆ DelegateGetChat()

delegate void Terraria.ModLoader.NPCLoader.DelegateGetChat ( NPC  npc,
ref string  chat 
)
private

◆ DelegateModifyHitByItem()

delegate void Terraria.ModLoader.NPCLoader.DelegateModifyHitByItem ( NPC  npc,
Player  player,
Item  item,
ref int  damage,
ref float  knockback,
ref bool  crit 
)
private

◆ DelegateModifyHitByProjectile()

delegate void Terraria.ModLoader.NPCLoader.DelegateModifyHitByProjectile ( NPC  npc,
Projectile  projectile,
ref int  damage,
ref float  knockback,
ref bool  crit,
ref int  hitDirection 
)
private

◆ DelegateModifyHitNPC()

delegate void Terraria.ModLoader.NPCLoader.DelegateModifyHitNPC ( NPC  npc,
NPC  target,
ref int  damage,
ref float  knockback,
ref bool  crit 
)
private

◆ DelegateModifyHitPlayer()

delegate void Terraria.ModLoader.NPCLoader.DelegateModifyHitPlayer ( NPC  npc,
Player  target,
ref int  damage,
ref bool  crit 
)
private

◆ DelegateOnChatButtonClicked()

delegate void Terraria.ModLoader.NPCLoader.DelegateOnChatButtonClicked ( NPC  npc,
bool  firstButton 
)
private

◆ DelegateSetupShop()

delegate void Terraria.ModLoader.NPCLoader.DelegateSetupShop ( int  type,
Chest  shop,
ref int  nextSlot 
)
private

◆ DelegateSetupTravelShop()

delegate void Terraria.ModLoader.NPCLoader.DelegateSetupTravelShop ( int[]  shop,
ref int  nextSlot 
)
private

◆ DelegateStrikeNPC()

delegate bool Terraria.ModLoader.NPCLoader.DelegateStrikeNPC ( NPC  npc,
ref double  damage,
int  defense,
ref float  knockback,
int  hitDirection,
ref bool  crit 
)
private

◆ DelegateTownNPCAttackCooldown()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackCooldown ( NPC  npc,
ref int  cooldown,
ref int  randExtraCooldown 
)
private

◆ DelegateTownNPCAttackMagic()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackMagic ( NPC  npc,
ref float  auraLightMultiplier 
)
private

◆ DelegateTownNPCAttackProj()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackProj ( NPC  npc,
ref int  projType,
ref int  attackDelay 
)
private

◆ DelegateTownNPCAttackProjSpeed()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackProjSpeed ( NPC  npc,
ref float  multiplier,
ref float  gravityCorrection,
ref float  randomOffset 
)
private

◆ DelegateTownNPCAttackShoot()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackShoot ( NPC  npc,
ref bool  inBetweenShots 
)
private

◆ DelegateTownNPCAttackStrength()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackStrength ( NPC  npc,
ref int  damage,
ref float  knockback 
)
private

◆ DelegateTownNPCAttackSwing()

delegate void Terraria.ModLoader.NPCLoader.DelegateTownNPCAttackSwing ( NPC  npc,
ref int  itemWidth,
ref int  itemHeight 
)
private

◆ DelegateUpdateLifeRegen()

delegate void Terraria.ModLoader.NPCLoader.DelegateUpdateLifeRegen ( NPC  npc,
ref int  damage 
)
private

◆ DrawEffects()

static void Terraria.ModLoader.NPCLoader.DrawEffects ( NPC  npc,
ref Color  drawColor 
)
static

Definition at line 688 of file NPCLoader.cs.

688 {
689 npc.modNPC?.DrawEffects(ref drawColor);
690
691 foreach (GlobalNPC g in HookDrawEffects.arr) {
692 g.Instance(npc).DrawEffects(npc, ref drawColor);
693 }
694 }
static HookList HookDrawEffects
Definition: NPCLoader.cs:686

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.DrawEffects(), Terraria.ModLoader.NPCLoader.HookDrawEffects, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ DrawHealthBar() [1/2]

static bool Terraria.ModLoader.NPCLoader.DrawHealthBar ( NPC  npc,
ref float  scale 
)
static

Definition at line 733 of file NPCLoader.cs.

733 {
734 Vector2 position = new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.gfxOffY);
735 if (Main.HealthBarDrawSettings == 1) {
736 position.Y += npc.height + 10f + Main.NPCAddHeight(npc.whoAmI);
737 }
738 else if (Main.HealthBarDrawSettings == 2) {
739 position.Y -= 24f + Main.NPCAddHeight(npc.whoAmI) / 2f;
740 }
741 foreach (GlobalNPC g in HookDrawHealthBar.arr) {
742 bool? result = g.Instance(npc).DrawHealthBar(npc, Main.HealthBarDrawSettings, ref scale, ref position);
743 if (result.HasValue) {
744 if (result.Value) {
745 DrawHealthBar(npc, position, scale);
746 }
747 return false;
748 }
749 }
750 if (NPCLoader.IsModNPC(npc)) {
751 bool? result = npc.modNPC.DrawHealthBar(Main.HealthBarDrawSettings, ref scale, ref position);
752 if (result.HasValue) {
753 if (result.Value) {
754 DrawHealthBar(npc, position, scale);
755 }
756 return false;
757 }
758 }
759 return true;
760 }
static bool DrawHealthBar(NPC npc, ref float scale)
Definition: NPCLoader.cs:733
static HookList HookDrawHealthBar
Definition: NPCLoader.cs:731

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.DrawHealthBar(), Terraria.ModLoader.NPCLoader.DrawHealthBar(), Terraria.ModLoader.NPCLoader.HookDrawHealthBar, and Terraria.ModLoader.GlobalNPC.Instance().

Referenced by Terraria.ModLoader.NPCLoader.DrawHealthBar().

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

◆ DrawHealthBar() [2/2]

static void Terraria.ModLoader.NPCLoader.DrawHealthBar ( NPC  npc,
Vector2  position,
float  scale 
)
staticprivate

Definition at line 762 of file NPCLoader.cs.

762 {
763 float alpha = Lighting.Brightness((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f));
764 Main.instance.DrawHealthBar(position.X, position.Y, npc.life, npc.lifeMax, alpha, scale);
765 }

◆ DrawTownAttackGun()

static void Terraria.ModLoader.NPCLoader.DrawTownAttackGun ( NPC  npc,
ref float  scale,
ref int  item,
ref int  closeness 
)
static

Definition at line 1097 of file NPCLoader.cs.

1097 {
1098 npc.modNPC?.DrawTownAttackGun(ref scale, ref item, ref closeness);
1099
1100 foreach (GlobalNPC g in HookDrawTownAttackGun.arr) {
1101 g.Instance(npc).DrawTownAttackGun(npc, ref scale, ref item, ref closeness);
1102 }
1103 }
static HookList HookDrawTownAttackGun
Definition: NPCLoader.cs:1095

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.DrawTownAttackGun(), Terraria.ModLoader.NPCLoader.HookDrawTownAttackGun, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ DrawTownAttackSwing()

static void Terraria.ModLoader.NPCLoader.DrawTownAttackSwing ( NPC  npc,
ref Texture2D  item,
ref int  itemSize,
ref float  scale,
ref Vector2  offset 
)
static

Definition at line 1108 of file NPCLoader.cs.

1108 {
1109 npc.modNPC?.DrawTownAttackSwing(ref item, ref itemSize, ref scale, ref offset);
1110
1111 foreach (GlobalNPC g in HookDrawTownAttackSwing.arr) {
1112 g.Instance(npc).DrawTownAttackSwing(npc, ref item, ref itemSize, ref scale, ref offset);
1113 }
1114 }
static HookList HookDrawTownAttackSwing
Definition: NPCLoader.cs:1106

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.DrawTownAttackSwing(), Terraria.ModLoader.NPCLoader.HookDrawTownAttackSwing, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ EditSpawnRange()

static void Terraria.ModLoader.NPCLoader.EditSpawnRange ( Player  player,
ref int  spawnRangeX,
ref int  spawnRangeY,
ref int  safeRangeX,
ref int  safeRangeY 
)
static

Definition at line 780 of file NPCLoader.cs.

781 {
782 foreach (GlobalNPC g in HookEditSpawnRange.arr) {
783 g.EditSpawnRange(player, ref spawnRangeX, ref spawnRangeY, ref safeRangeX, ref safeRangeY);
784 }
785 }
static HookList HookEditSpawnRange
Definition: NPCLoader.cs:778

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.EditSpawnRange(), and Terraria.ModLoader.NPCLoader.HookEditSpawnRange.

+ Here is the call graph for this function:

◆ EditSpawnRate()

static void Terraria.ModLoader.NPCLoader.EditSpawnRate ( Player  player,
ref int  spawnRate,
ref int  maxSpawns 
)
static

Definition at line 770 of file NPCLoader.cs.

770 {
771 foreach (GlobalNPC g in HookEditSpawnRate.arr) {
772 g.EditSpawnRate(player, ref spawnRate, ref maxSpawns);
773 }
774 }
static HookList HookEditSpawnRate
Definition: NPCLoader.cs:768

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.EditSpawnRate(), and Terraria.ModLoader.NPCLoader.HookEditSpawnRate.

+ Here is the call graph for this function:

◆ FindFrame()

static void Terraria.ModLoader.NPCLoader.FindFrame ( NPC  npc,
int  frameHeight 
)
static

Definition at line 320 of file NPCLoader.cs.

320 {
321 int type = npc.type;
322 if (npc.modNPC != null && npc.modNPC.animationType > 0) {
323 npc.type = npc.modNPC.animationType;
324 }
325 npc.VanillaFindFrame(frameHeight);
326 npc.type = type;
327 npc.modNPC?.FindFrame(frameHeight);
328
329 foreach (GlobalNPC g in HookFindFrame.arr) {
330 g.Instance(npc).FindFrame(npc, frameHeight);
331 }
332 }
static HookList HookFindFrame
Definition: NPCLoader.cs:318

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.FindFrame(), Terraria.ModLoader.NPCLoader.HookFindFrame, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ GetAlpha()

static ? Color Terraria.ModLoader.NPCLoader.GetAlpha ( NPC  npc,
Color  lightColor 
)
static

Definition at line 675 of file NPCLoader.cs.

675 {
676 foreach (GlobalNPC g in HookGetAlpha.arr) {
677 Color? color = g.Instance(npc).GetAlpha(npc, lightColor);
678 if (color.HasValue) {
679 return color.Value;
680 }
681 }
682 return npc.modNPC?.GetAlpha(lightColor);
683 }
static HookList HookGetAlpha
Definition: NPCLoader.cs:673

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.GetAlpha(), Terraria.ModLoader.NPCLoader.HookGetAlpha, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ GetChat()

static void Terraria.ModLoader.NPCLoader.GetChat ( NPC  npc,
ref string  chat 
)
static

Definition at line 880 of file NPCLoader.cs.

880 {
881 if (npc.modNPC != null) {
882 chat = npc.modNPC.GetChat();
883 }
884 else if (chat.Equals("")) {
885 chat = Language.GetTextValue("tModLoader.DefaultTownNPCChat");
886 }
887 foreach (GlobalNPC g in HookGetChat.arr) {
888 g.Instance(npc).GetChat(npc, ref chat);
889 }
890 }
static HookList HookGetChat
Definition: NPCLoader.cs:878

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.GetChat(), Terraria.ModLoader.NPCLoader.HookGetChat, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ GetNPC()

static ModNPC Terraria.ModLoader.NPCLoader.GetNPC ( int  type)
static

Gets the ModNPC instance corresponding to the specified type.

Parameters
typeThe type of the npc
Returns
The ModNPC instance in the npcs array, null if not found.

Definition at line 93 of file NPCLoader.cs.

93 {
94 return type >= NPCID.Count && type < NPCCount ? npcs[type - NPCID.Count] : null;
95 }

References Terraria.ModLoader.NPCLoader.NPCCount.

Referenced by Terraria.ModLoader.NPCLoader.CheckConditions(), Terraria.ModLoader.NPCLoader.SetupShop(), Terraria.ModLoader.NPCLoader.SpawnNPC(), and Terraria.ModLoader.NPCLoader.TownNPCName().

+ Here is the caller graph for this function:

◆ HasMethod()

static bool Terraria.ModLoader.NPCLoader.HasMethod ( Type  t,
string  method,
params Type[]  args 
)
staticprivate

Definition at line 1116 of file NPCLoader.cs.

1116 {
1117 return t.GetMethod(method, args).DeclaringType != typeof(GlobalNPC);
1118 }

◆ HitEffect()

static void Terraria.ModLoader.NPCLoader.HitEffect ( NPC  npc,
int  hitDirection,
double  damage 
)
static

Definition at line 336 of file NPCLoader.cs.

336 {
337 npc.VanillaHitEffect(hitDirection, damage);
338 npc.modNPC?.HitEffect(hitDirection, damage);
339
340 foreach (GlobalNPC g in HookHitEffect.arr) {
341 g.Instance(npc).HitEffect(npc, hitDirection, damage);
342 }
343 }
static HookList HookHitEffect
Definition: NPCLoader.cs:334

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.GlobalNPC.HitEffect(), Terraria.ModLoader.NPCLoader.HookHitEffect, and Terraria.ModLoader.GlobalNPC.Instance().

+ Here is the call graph for this function:

◆ ModifyHitByItem()

static void Terraria.ModLoader.NPCLoader.ModifyHitByItem ( NPC  npc,
Player  player,
Item  item,
ref int  damage,
ref float  knockback,
ref bool  crit 
)
static

Definition at line 560 of file NPCLoader.cs.

560 {
561 npc.modNPC?.ModifyHitByItem(player, item, ref damage, ref knockback, ref crit);
562
563 foreach (GlobalNPC g in HookModifyHitByItem.arr) {
564 g.Instance(npc).ModifyHitByItem(npc, player, item, ref damage, ref knockback, ref crit);
565 }
566 }
static HookList HookModifyHitByItem
Definition: NPCLoader.cs:558

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookModifyHitByItem, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.ModifyHitByItem().

+ Here is the call graph for this function:

◆ ModifyHitByProjectile()

static void Terraria.ModLoader.NPCLoader.ModifyHitByProjectile ( NPC  npc,
Projectile  projectile,
ref int  damage,
ref float  knockback,
ref bool  crit,
ref int  hitDirection 
)
static

Definition at line 606 of file NPCLoader.cs.

606 {
607 npc.modNPC?.ModifyHitByProjectile(projectile, ref damage, ref knockback, ref crit, ref hitDirection);
608
609 foreach (GlobalNPC g in HookModifyHitByProjectile.arr) {
610 g.Instance(npc).ModifyHitByProjectile(npc, projectile, ref damage, ref knockback, ref crit, ref hitDirection);
611 }
612 }
static HookList HookModifyHitByProjectile
Definition: NPCLoader.cs:604

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookModifyHitByProjectile, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.ModifyHitByProjectile().

+ Here is the call graph for this function:

◆ ModifyHitNPC()

static void Terraria.ModLoader.NPCLoader.ModifyHitNPC ( NPC  npc,
NPC  target,
ref int  damage,
ref float  knockback,
ref bool  crit 
)
static

Definition at line 515 of file NPCLoader.cs.

515 {
516 npc.modNPC?.ModifyHitNPC(target, ref damage, ref knockback, ref crit);
517
518 foreach (GlobalNPC g in HookModifyHitNPC.arr) {
519 g.Instance(npc).ModifyHitNPC(npc, target, ref damage, ref knockback, ref crit);
520 }
521 }
static HookList HookModifyHitNPC
Definition: NPCLoader.cs:513

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookModifyHitNPC, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.ModifyHitNPC().

+ Here is the call graph for this function:

◆ ModifyHitPlayer()

static void Terraria.ModLoader.NPCLoader.ModifyHitPlayer ( NPC  npc,
Player  target,
ref int  damage,
ref bool  crit 
)
static

Definition at line 469 of file NPCLoader.cs.

469 {
470 npc.modNPC?.ModifyHitPlayer(target, ref damage, ref crit);
471
472 foreach (GlobalNPC g in HookModifyHitPlayer.arr) {
473 g.Instance(npc).ModifyHitPlayer(npc, target, ref damage, ref crit);
474 }
475 }
static HookList HookModifyHitPlayer
Definition: NPCLoader.cs:467

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookModifyHitPlayer, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.ModifyHitPlayer().

+ Here is the call graph for this function:

◆ NPCAI()

static void Terraria.ModLoader.NPCLoader.NPCAI ( NPC  npc)
static

Definition at line 239 of file NPCLoader.cs.

239 {
240 if (PreAI(npc)) {
241 int type = npc.type;
242 bool useAiType = npc.modNPC != null && npc.modNPC.aiType > 0;
243 if (useAiType) {
244 npc.type = npc.modNPC.aiType;
245 }
246 npc.VanillaAI();
247 if (useAiType) {
248 npc.type = type;
249 }
250 AI(npc);
251 }
252 PostAI(npc);
253 }
static void AI(NPC npc)
Definition: NPCLoader.cs:270
static void PostAI(NPC npc)
Definition: NPCLoader.cs:280
static bool PreAI(NPC npc)
Definition: NPCLoader.cs:257

References Terraria.ModLoader.NPCLoader.AI(), Terraria.ModLoader.NPCLoader.PostAI(), and Terraria.ModLoader.NPCLoader.PreAI().

+ Here is the call graph for this function:

◆ NPCLoot()

static void Terraria.ModLoader.NPCLoader.NPCLoot ( NPC  npc)
static

Definition at line 422 of file NPCLoader.cs.

422 {
423 npc.modNPC?.NPCLoot();
424
425 foreach (GlobalNPC g in HookNPCLoot.arr) {
426 g.Instance(npc).NPCLoot(npc);
427 }
428 blockLoot.Clear();
429 }
static readonly IList< int > blockLoot
Allows you to stop an NPC from dropping loot by adding item IDs to this list. This list will be clear...
Definition: NPCLoader.cs:34
static HookList HookNPCLoot
Definition: NPCLoader.cs:420

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.blockLoot, Terraria.ModLoader.NPCLoader.HookNPCLoot, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.NPCLoot().

+ Here is the call graph for this function:

◆ OnCatchNPC()

static void Terraria.ModLoader.NPCLoader.OnCatchNPC ( NPC  npc,
Player  player,
Item  item 
)
static

Definition at line 443 of file NPCLoader.cs.

443 {
444 npc.modNPC?.OnCatchNPC(player, item);
445
446 foreach (GlobalNPC g in HookOnCatchNPC.arr) {
447 g.Instance(npc).OnCatchNPC(npc, player, item);
448 }
449 }
static HookList HookOnCatchNPC
Definition: NPCLoader.cs:441

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnCatchNPC, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.OnCatchNPC().

+ Here is the call graph for this function:

◆ OnChatButtonClicked()

static void Terraria.ModLoader.NPCLoader.OnChatButtonClicked ( bool  firstButton)
static

Definition at line 920 of file NPCLoader.cs.

920 {
921 NPC npc = Main.npc[Main.LocalPlayer.talkNPC];
922 bool shop = false;
923
924 if (npc.modNPC != null) {
925 npc.modNPC.OnChatButtonClicked(firstButton, ref shop);
926 Main.PlaySound(SoundID.MenuTick);
927 if (shop) {
928 Main.playerInventory = true;
929 Main.npcChatText = "";
930 Main.npcShop = Main.MaxShopIDs - 1;
931 Main.instance.shop[Main.npcShop].SetupShop(npc.type);
932 }
933 }
934 foreach (GlobalNPC g in HookOnChatButtonClicked.arr) {
935 g.Instance(npc).OnChatButtonClicked(npc, firstButton);
936 }
937 }
static HookList HookOnChatButtonClicked
Definition: NPCLoader.cs:918

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnChatButtonClicked, Terraria.ModLoader.GlobalNPC.Instance(), Terraria.ModLoader.ModNPC.npc, and Terraria.ModLoader.GlobalNPC.OnChatButtonClicked().

+ Here is the call graph for this function:

◆ OnGoToStatue()

static void Terraria.ModLoader.NPCLoader.OnGoToStatue ( NPC  npc,
bool  toKingStatue 
)
static

Definition at line 983 of file NPCLoader.cs.

983 {
984 npc.modNPC?.OnGoToStatue(toKingStatue);
985
986 foreach (GlobalNPC g in HookOnGoToStatue.arr) {
987 g.OnGoToStatue(npc, toKingStatue);
988 }
989 }
static HookList HookOnGoToStatue
Definition: NPCLoader.cs:981

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnGoToStatue, and Terraria.ModLoader.GlobalNPC.OnGoToStatue().

+ Here is the call graph for this function:

◆ OnHitByItem()

static void Terraria.ModLoader.NPCLoader.OnHitByItem ( NPC  npc,
Player  player,
Item  item,
int  damage,
float  knockback,
bool  crit 
)
static

Definition at line 570 of file NPCLoader.cs.

570 {
571 npc.modNPC?.OnHitByItem(player, item, damage, knockback, crit);
572
573 foreach (GlobalNPC g in HookOnHitByItem.arr) {
574 g.Instance(npc).OnHitByItem(npc, player, item, damage, knockback, crit);
575 }
576 }
static HookList HookOnHitByItem
Definition: NPCLoader.cs:568

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnHitByItem, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.OnHitByItem().

+ Here is the call graph for this function:

◆ OnHitByProjectile()

static void Terraria.ModLoader.NPCLoader.OnHitByProjectile ( NPC  npc,
Projectile  projectile,
int  damage,
float  knockback,
bool  crit 
)
static

Definition at line 616 of file NPCLoader.cs.

616 {
617 npc.modNPC?.OnHitByProjectile(projectile, damage, knockback, crit);
618
619 foreach (GlobalNPC g in HookOnHitByProjectile.arr) {
620 g.Instance(npc).OnHitByProjectile(npc, projectile, damage, knockback, crit);
621 }
622 }
static HookList HookOnHitByProjectile
Definition: NPCLoader.cs:614

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnHitByProjectile, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.OnHitByProjectile().

+ Here is the call graph for this function:

◆ OnHitNPC()

static void Terraria.ModLoader.NPCLoader.OnHitNPC ( NPC  npc,
NPC  target,
int  damage,
float  knockback,
bool  crit 
)
static

Definition at line 525 of file NPCLoader.cs.

525 {
526 npc.modNPC?.OnHitNPC(target, damage, knockback, crit);
527 foreach (GlobalNPC g in HookOnHitNPC.arr) {
528 g.Instance(npc).OnHitNPC(npc, target, damage, knockback, crit);
529 }
530 }
static HookList HookOnHitNPC
Definition: NPCLoader.cs:523

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnHitNPC, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.OnHitNPC().

+ Here is the call graph for this function:

◆ OnHitPlayer()

static void Terraria.ModLoader.NPCLoader.OnHitPlayer ( NPC  npc,
Player  target,
int  damage,
bool  crit 
)
static

Definition at line 479 of file NPCLoader.cs.

479 {
480 npc.modNPC?.OnHitPlayer(target, damage, crit);
481
482 foreach (GlobalNPC g in HookOnHitPlayer.arr) {
483 g.Instance(npc).OnHitPlayer(npc, target, damage, crit);
484 }
485 }
static HookList HookOnHitPlayer
Definition: NPCLoader.cs:477

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookOnHitPlayer, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.OnHitPlayer().

+ Here is the call graph for this function:

◆ PostAI()

static void Terraria.ModLoader.NPCLoader.PostAI ( NPC  npc)
static

Definition at line 280 of file NPCLoader.cs.

280 {
281 npc.modNPC?.PostAI();
282
283 foreach (GlobalNPC g in HookPostAI.arr) {
284 g.Instance(npc).PostAI(npc);
285 }
286 }
static HookList HookPostAI
Definition: NPCLoader.cs:278

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookPostAI, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.PostAI().

Referenced by Terraria.ModLoader.NPCLoader.NPCAI().

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

◆ PostDraw()

static void Terraria.ModLoader.NPCLoader.PostDraw ( NPC  npc,
SpriteBatch  spriteBatch,
Color  drawColor 
)
static

Definition at line 711 of file NPCLoader.cs.

711 {
712 npc.modNPC?.PostDraw(spriteBatch, drawColor);
713
714 foreach (GlobalNPC g in HookPostDraw.arr) {
715 g.Instance(npc).PostDraw(npc, spriteBatch, drawColor);
716 }
717 }
static HookList HookPostDraw
Definition: NPCLoader.cs:709

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookPostDraw, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.PostDraw().

+ Here is the call graph for this function:

◆ PreAI()

static bool Terraria.ModLoader.NPCLoader.PreAI ( NPC  npc)
static

Definition at line 257 of file NPCLoader.cs.

257 {
258 bool result = true;
259 foreach (GlobalNPC g in HookPreAI.arr) {
260 result &= g.Instance(npc).PreAI(npc);
261 }
262 if (result && npc.modNPC != null) {
263 return npc.modNPC.PreAI();
264 }
265 return result;
266 }
static HookList HookPreAI
Definition: NPCLoader.cs:255

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookPreAI, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.PreAI().

Referenced by Terraria.ModLoader.NPCLoader.NPCAI().

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

◆ PreChatButtonClicked()

static bool Terraria.ModLoader.NPCLoader.PreChatButtonClicked ( bool  firstButton)
static

Definition at line 901 of file NPCLoader.cs.

901 {
902 NPC npc = Main.npc[Main.LocalPlayer.talkNPC];
903
904 bool result = true;
905 foreach (GlobalNPC g in HookPreChatButtonClicked.arr) {
906 result &= g.Instance(npc).PreChatButtonClicked(npc, firstButton);
907 }
908
909 if (!result) {
910 Main.PlaySound(SoundID.MenuTick);
911 return false;
912 }
913
914 return true;
915 }
static HookList HookPreChatButtonClicked
Definition: NPCLoader.cs:899

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookPreChatButtonClicked, Terraria.ModLoader.GlobalNPC.Instance(), Terraria.ModLoader.ModNPC.npc, and Terraria.ModLoader.GlobalNPC.PreChatButtonClicked().

+ Here is the call graph for this function:

◆ PreDraw()

static bool Terraria.ModLoader.NPCLoader.PreDraw ( NPC  npc,
SpriteBatch  spriteBatch,
Color  drawColor 
)
static

Definition at line 698 of file NPCLoader.cs.

698 {
699 bool result = true;
700 foreach (GlobalNPC g in HookPreDraw.arr) {
701 result &= g.Instance(npc).PreDraw(npc, spriteBatch, drawColor);
702 }
703 if (result && npc.modNPC != null) {
704 return npc.modNPC.PreDraw(spriteBatch, drawColor);
705 }
706 return result;
707 }
static HookList HookPreDraw
Definition: NPCLoader.cs:696

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookPreDraw, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.PreDraw().

+ Here is the call graph for this function:

◆ PreNPCLoot()

static bool Terraria.ModLoader.NPCLoader.PreNPCLoot ( NPC  npc)
static

Definition at line 402 of file NPCLoader.cs.

402 {
403 bool result = true;
404 foreach (GlobalNPC g in HookPreNPCLoot.arr) {
405 result &= g.Instance(npc).PreNPCLoot(npc);
406 }
407
408 if (result && npc.modNPC != null) {
409 result = npc.modNPC.PreNPCLoot();
410 }
411
412 if (!result) {
413 blockLoot.Clear();
414 return false;
415 }
416
417 return true;
418 }
static HookList HookPreNPCLoot
Definition: NPCLoader.cs:400

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.blockLoot, Terraria.ModLoader.NPCLoader.HookPreNPCLoot, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.PreNPCLoot().

+ Here is the call graph for this function:

◆ ReceiveExtraAI()

static void Terraria.ModLoader.NPCLoader.ReceiveExtraAI ( NPC  npc,
BinaryReader  reader 
)
static

Definition at line 305 of file NPCLoader.cs.

305 {
306 if (npc.modNPC != null) {
307 byte[] extraAI = reader.ReadBytes(reader.ReadByte());
308 if (extraAI.Length > 0) {
309 using (MemoryStream stream = new MemoryStream(extraAI)) {
310 using (BinaryReader modReader = new BinaryReader(stream)) {
311 npc.modNPC.ReceiveExtraAI(modReader);
312 }
313 }
314 }
315 }
316 }

◆ ResetEffects()

static void Terraria.ModLoader.NPCLoader.ResetEffects ( NPC  npc)
static

Definition at line 231 of file NPCLoader.cs.

231 {
232 npc.modNPC?.ResetEffects();
233
234 foreach (GlobalNPC g in HookResetEffects.arr) {
235 g.Instance(npc).ResetEffects(npc);
236 }
237 }
static HookList HookResetEffects
Definition: NPCLoader.cs:229

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookResetEffects, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.ResetEffects().

+ Here is the call graph for this function:

◆ ScaleExpertStats()

static void Terraria.ModLoader.NPCLoader.ScaleExpertStats ( NPC  npc,
int  numPlayers,
float  bossLifeScale 
)
static

Definition at line 221 of file NPCLoader.cs.

221 {
222 npc.modNPC?.ScaleExpertStats(numPlayers, bossLifeScale);
223
224 foreach (GlobalNPC g in HookScaleExpertStats.arr) {
225 g.Instance(npc).ScaleExpertStats(npc, numPlayers, bossLifeScale);
226 }
227 }
static HookList HookScaleExpertStats
Definition: NPCLoader.cs:219

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookScaleExpertStats, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.ScaleExpertStats().

+ Here is the call graph for this function:

◆ SendExtraAI()

static void Terraria.ModLoader.NPCLoader.SendExtraAI ( NPC  npc,
BinaryWriter  writer 
)
static

Definition at line 288 of file NPCLoader.cs.

288 {
289 if (npc.modNPC != null) {
290 byte[] data;
291 using (MemoryStream stream = new MemoryStream()) {
292 using (BinaryWriter modWriter = new BinaryWriter(stream)) {
293 npc.modNPC.SendExtraAI(modWriter);
294 modWriter.Flush();
295 data = stream.ToArray();
296 }
297 }
298 writer.Write((byte)data.Length);
299 if (data.Length > 0) {
300 writer.Write(data);
301 }
302 }
303 }

◆ SetChatButtons()

static void Terraria.ModLoader.NPCLoader.SetChatButtons ( ref string  button,
ref string  button2 
)
static

Definition at line 892 of file NPCLoader.cs.

892 {
893 if (Main.player[Main.myPlayer].talkNPC >= 0) {
894 NPC npc = Main.npc[Main.player[Main.myPlayer].talkNPC];
895 npc.modNPC?.SetChatButtons(ref button, ref button2);
896 }
897 }

References Terraria.ModLoader.ModNPC.npc.

◆ SetupShop()

static void Terraria.ModLoader.NPCLoader.SetupShop ( int  type,
Chest  shop,
ref int  nextSlot 
)
static

Definition at line 942 of file NPCLoader.cs.

942 {
943 if (type < shopToNPC.Length) {
944 type = shopToNPC[type];
945 }
946 else {
947 GetNPC(type)?.SetupShop(shop, ref nextSlot);
948 }
949 foreach (GlobalNPC g in HookSetupShop.arr) {
950 g.SetupShop(type, shop, ref nextSlot);
951 }
952 }
virtual void SetupShop(Chest shop, ref int nextSlot)
Allows you to add items to this NPC's shop. Add an item by setting the defaults of shop....
Definition: ModNPC.cs:645
static HookList HookSetupShop
Definition: NPCLoader.cs:940

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.GetNPC(), Terraria.ModLoader.NPCLoader.HookSetupShop, Terraria.ModLoader.ModNPC.SetupShop(), Terraria.ModLoader.GlobalNPC.SetupShop(), and Terraria.ModLoader.NPCLoader.shopToNPC.

+ Here is the call graph for this function:

◆ SetupTravelShop()

static void Terraria.ModLoader.NPCLoader.SetupTravelShop ( int[]  shop,
ref int  nextSlot 
)
static

Definition at line 957 of file NPCLoader.cs.

957 {
958 foreach (GlobalNPC g in HookSetupTravelShop.arr) {
959 g.SetupTravelShop(shop, ref nextSlot);
960 }
961 }
static HookList HookSetupTravelShop
Definition: NPCLoader.cs:955

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookSetupTravelShop, and Terraria.ModLoader.GlobalNPC.SetupTravelShop().

+ Here is the call graph for this function:

◆ SpawnNPC()

static int Terraria.ModLoader.NPCLoader.SpawnNPC ( int  type,
int  tileX,
int  tileY 
)
static

Definition at line 823 of file NPCLoader.cs.

823 {
824 var npc = type >= NPCID.Count ?
825 GetNPC(type).SpawnNPC(tileX, tileY) :
826 NPC.NewNPC(tileX * 16 + 8, tileY * 16, type);
827
828 foreach (GlobalNPC g in HookSpawnNPC.arr) {
829 g.Instance(Main.npc[npc]).SpawnNPC(npc, tileX, tileY);
830 }
831
832 return npc;
833 }
virtual int SpawnNPC(int tileX, int tileY)
Allows you to customize how this NPC is created when it naturally spawns (for example,...
Definition: ModNPC.cs:566
static HookList HookSpawnNPC
Definition: NPCLoader.cs:821

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.GetNPC(), Terraria.ModLoader.NPCLoader.HookSpawnNPC, Terraria.ModLoader.GlobalNPC.Instance(), Terraria.ModLoader.GlobalNPC.SpawnNPC(), and Terraria.ModLoader.ModNPC.SpawnNPC().

+ Here is the call graph for this function:

◆ SpecialNPCLoot()

static bool Terraria.ModLoader.NPCLoader.SpecialNPCLoot ( NPC  npc)
static

Definition at line 388 of file NPCLoader.cs.

388 {
389 foreach (GlobalNPC g in HookSpecialNPCLoot.arr) {
390 if (g.Instance(npc).SpecialNPCLoot(npc)) {
391 return true;
392 }
393 }
394 if (npc.modNPC != null) {
395 return npc.modNPC.SpecialNPCLoot();
396 }
397 return false;
398 }
static HookList HookSpecialNPCLoot
Definition: NPCLoader.cs:386

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookSpecialNPCLoot, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.SpecialNPCLoot().

+ Here is the call graph for this function:

◆ StrikeNPC()

static bool Terraria.ModLoader.NPCLoader.StrikeNPC ( NPC  npc,
ref double  damage,
int  defense,
ref float  knockback,
int  hitDirection,
ref bool  crit 
)
static

Definition at line 627 of file NPCLoader.cs.

627 {
628 bool flag = true;
629 if (npc.modNPC != null) {
630 flag = npc.modNPC.StrikeNPC(ref damage, defense, ref knockback, hitDirection, ref crit);
631 }
632 foreach (GlobalNPC g in HookStrikeNPC.arr) {
633 if (!g.Instance(npc).StrikeNPC(npc, ref damage, defense, ref knockback, hitDirection, ref crit)) {
634 flag = false;
635 }
636 }
637 return flag;
638 }
static HookList HookStrikeNPC
Definition: NPCLoader.cs:625

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookStrikeNPC, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.StrikeNPC().

+ Here is the call graph for this function:

◆ TownNPCAttackCooldown()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackCooldown ( NPC  npc,
ref int  cooldown,
ref int  randExtraCooldown 
)
static

Definition at line 1029 of file NPCLoader.cs.

1029 {
1030 npc.modNPC?.TownNPCAttackCooldown(ref cooldown, ref randExtraCooldown);
1031
1032 foreach (GlobalNPC g in HookTownNPCAttackCooldown.arr) {
1033 g.Instance(npc).TownNPCAttackCooldown(npc, ref cooldown, ref randExtraCooldown);
1034 }
1035 }
static HookList HookTownNPCAttackCooldown
Definition: NPCLoader.cs:1027

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackCooldown, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackCooldown().

+ Here is the call graph for this function:

◆ TownNPCAttackMagic()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackMagic ( NPC  npc,
ref float  auraLightMultiplier 
)
static

Definition at line 1075 of file NPCLoader.cs.

1075 {
1076 npc.modNPC?.TownNPCAttackMagic(ref auraLightMultiplier);
1077
1078 foreach (GlobalNPC g in HookTownNPCAttackMagic.arr) {
1079 g.Instance(npc).TownNPCAttackMagic(npc, ref auraLightMultiplier);
1080 }
1081 }
static HookList HookTownNPCAttackMagic
Definition: NPCLoader.cs:1073

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackMagic, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackMagic().

+ Here is the call graph for this function:

◆ TownNPCAttackProj()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackProj ( NPC  npc,
ref int  projType,
ref int  attackDelay 
)
static

Definition at line 1040 of file NPCLoader.cs.

1040 {
1041 npc.modNPC?.TownNPCAttackProj(ref projType, ref attackDelay);
1042
1043 foreach (GlobalNPC g in HookTownNPCAttackProj.arr) {
1044 g.Instance(npc).TownNPCAttackProj(npc, ref projType, ref attackDelay);
1045 }
1046 }
static HookList HookTownNPCAttackProj
Definition: NPCLoader.cs:1038

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackProj, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackProj().

+ Here is the call graph for this function:

◆ TownNPCAttackProjSpeed()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackProjSpeed ( NPC  npc,
ref float  multiplier,
ref float  gravityCorrection,
ref float  randomOffset 
)
static

Definition at line 1052 of file NPCLoader.cs.

1053 {
1054 npc.modNPC?.TownNPCAttackProjSpeed(ref multiplier, ref gravityCorrection, ref randomOffset);
1055
1056 foreach (GlobalNPC g in HookTownNPCAttackProjSpeed.arr) {
1057 g.Instance(npc).TownNPCAttackProjSpeed(npc, ref multiplier, ref gravityCorrection, ref randomOffset);
1058 }
1059 }
static HookList HookTownNPCAttackProjSpeed
Definition: NPCLoader.cs:1050

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackProjSpeed, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackProjSpeed().

+ Here is the call graph for this function:

◆ TownNPCAttackShoot()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackShoot ( NPC  npc,
ref bool  inBetweenShots 
)
static

Definition at line 1064 of file NPCLoader.cs.

1064 {
1065 npc.modNPC?.TownNPCAttackShoot(ref inBetweenShots);
1066
1067 foreach (GlobalNPC g in HookTownNPCAttackShoot.arr) {
1068 g.Instance(npc).TownNPCAttackShoot(npc, ref inBetweenShots);
1069 }
1070 }
static HookList HookTownNPCAttackShoot
Definition: NPCLoader.cs:1062

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackShoot, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackShoot().

+ Here is the call graph for this function:

◆ TownNPCAttackStrength()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackStrength ( NPC  npc,
ref int  damage,
ref float  knockback 
)
static

Definition at line 1018 of file NPCLoader.cs.

1018 {
1019 npc.modNPC?.TownNPCAttackStrength(ref damage, ref knockback);
1020
1021 foreach (GlobalNPC g in HookTownNPCAttackStrength.arr) {
1022 g.Instance(npc).TownNPCAttackStrength(npc, ref damage, ref knockback);
1023 }
1024 }
static HookList HookTownNPCAttackStrength
Definition: NPCLoader.cs:1016

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackStrength, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackStrength().

+ Here is the call graph for this function:

◆ TownNPCAttackSwing()

static void Terraria.ModLoader.NPCLoader.TownNPCAttackSwing ( NPC  npc,
ref int  itemWidth,
ref int  itemHeight 
)
static

Definition at line 1086 of file NPCLoader.cs.

1086 {
1087 npc.modNPC?.TownNPCAttackSwing(ref itemWidth, ref itemHeight);
1088
1089 foreach (GlobalNPC g in HookTownNPCAttackSwing.arr) {
1090 g.Instance(npc).TownNPCAttackSwing(npc, ref itemWidth, ref itemHeight);
1091 }
1092 }
static HookList HookTownNPCAttackSwing
Definition: NPCLoader.cs:1084

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookTownNPCAttackSwing, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.TownNPCAttackSwing().

+ Here is the call graph for this function:

◆ TownNPCName()

static string Terraria.ModLoader.NPCLoader.TownNPCName ( int  type)
static

Definition at line 851 of file NPCLoader.cs.

851 {
852 return GetNPC(type)?.TownNPCName() ?? "";
853 }
virtual string TownNPCName()
Allows you to give this town NPC any name when it spawns. By default returns something embarrassing.
Definition: ModNPC.cs:596

References Terraria.ModLoader.NPCLoader.GetNPC(), and Terraria.ModLoader.ModNPC.TownNPCName().

+ Here is the call graph for this function:

◆ UpdateLifeRegen()

static void Terraria.ModLoader.NPCLoader.UpdateLifeRegen ( NPC  npc,
ref int  damage 
)
static

Definition at line 348 of file NPCLoader.cs.

348 {
349 npc.modNPC?.UpdateLifeRegen(ref damage);
350
351 foreach (GlobalNPC g in HookUpdateLifeRegen.arr) {
352 g.Instance(npc).UpdateLifeRegen(npc, ref damage);
353 }
354 }
static HookList HookUpdateLifeRegen
Definition: NPCLoader.cs:346

References Terraria.ModLoader.NPCLoader.HookList.arr, Terraria.ModLoader.NPCLoader.HookUpdateLifeRegen, Terraria.ModLoader.GlobalNPC.Instance(), and Terraria.ModLoader.GlobalNPC.UpdateLifeRegen().

+ Here is the call graph for this function:

◆ UsesPartyHat()

static bool Terraria.ModLoader.NPCLoader.UsesPartyHat ( NPC  npc)
static

Definition at line 855 of file NPCLoader.cs.

855 {
856 return npc.modNPC?.UsesPartyHat() ?? true;
857 }

Member Data Documentation

◆ blockLoot

readonly IList<int> Terraria.ModLoader.NPCLoader.blockLoot = new List<int>()
static

Allows you to stop an NPC from dropping loot by adding item IDs to this list. This list will be cleared whenever NPCLoot ends. Useful for either removing an item or change the drop rate of an item in the NPC's loot table. To change the drop rate of an item, use the PreNPCLoot hook, spawn the item yourself, then add the item's ID to this list.

Definition at line 34 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.NPCLoot(), Terraria.ModLoader.NPCLoader.PreNPCLoot(), and Terraria.ModLoader.ItemLoader.PreOpenVanillaBag().

◆ HookAI

HookList Terraria.ModLoader.NPCLoader.HookAI = AddHook<Action<NPC>>(g => g.AI)
staticprivate

Definition at line 268 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.AI().

◆ HookBossHeadRotation

HookList Terraria.ModLoader.NPCLoader.HookBossHeadRotation = AddHook<DelegateBossHeadRotation>(g => g.BossHeadRotation)
staticprivate

Definition at line 652 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.BossHeadRotation().

◆ HookBossHeadSlot

HookList Terraria.ModLoader.NPCLoader.HookBossHeadSlot = AddHook<DelegateBossHeadSlot>(g => g.BossHeadSlot)
staticprivate

Definition at line 641 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.BossHeadSlot().

◆ HookBossHeadSpriteEffects

HookList Terraria.ModLoader.NPCLoader.HookBossHeadSpriteEffects = AddHook<DelegateBossHeadSpriteEffects>(g => g.BossHeadSpriteEffects)
staticprivate

Definition at line 663 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.BossHeadSpriteEffects().

◆ HookBuffTownNPC

HookList Terraria.ModLoader.NPCLoader.HookBuffTownNPC = AddHook<DelegateBuffTownNPC>(g => g.BuffTownNPC)
staticprivate

Definition at line 992 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.BuffTownNPC().

◆ HookCanBeHitByItem

HookList Terraria.ModLoader.NPCLoader.HookCanBeHitByItem = AddHook<Func<NPC, Player, Item, bool?>>(g => g.CanBeHitByItem)
staticprivate

Definition at line 532 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CanBeHitByItem().

◆ HookCanBeHitByProjectile

HookList Terraria.ModLoader.NPCLoader.HookCanBeHitByProjectile = AddHook<Func<NPC, Projectile, bool?>>(g => g.CanBeHitByProjectile)
staticprivate

Definition at line 578 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CanBeHitByProjectile().

◆ HookCanChat

HookList Terraria.ModLoader.NPCLoader.HookCanChat = AddHook<Func<NPC, bool?>>(g => g.CanChat)
staticprivate

Definition at line 859 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CanChat().

◆ HookCanGoToStatue

HookList Terraria.ModLoader.NPCLoader.HookCanGoToStatue = AddHook<Func<NPC, bool, bool?>>(g => g.CanGoToStatue)
staticprivate

Definition at line 963 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CanGoToStatue().

◆ HookCanHitNPC

HookList Terraria.ModLoader.NPCLoader.HookCanHitNPC = AddHook<Func<NPC, NPC, bool?>>(g => g.CanHitNPC)
staticprivate

Definition at line 487 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CanHitNPC().

◆ HookCanHitPlayer

HookList Terraria.ModLoader.NPCLoader.HookCanHitPlayer = AddHook<DelegateCanHitPlayer>(g => g.CanHitPlayer)
staticprivate

Definition at line 452 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CanHitPlayer().

◆ HookCheckActive

HookList Terraria.ModLoader.NPCLoader.HookCheckActive = AddHook<Func<NPC, bool>>(g => g.CheckActive)
staticprivate

Definition at line 356 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CheckActive().

◆ HookCheckDead

HookList Terraria.ModLoader.NPCLoader.HookCheckDead = AddHook<Func<NPC, bool>>(g => g.CheckDead)
staticprivate

Definition at line 370 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.CheckDead().

◆ HookDrawBehind

HookList Terraria.ModLoader.NPCLoader.HookDrawBehind = AddHook<Action<NPC, int>>(g => g.DrawBehind)
staticprivate

Definition at line 719 of file NPCLoader.cs.

◆ HookDrawEffects

HookList Terraria.ModLoader.NPCLoader.HookDrawEffects = AddHook<DelegateDrawEffects>(g => g.DrawEffects)
staticprivate

Definition at line 686 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.DrawEffects().

◆ HookDrawHealthBar

HookList Terraria.ModLoader.NPCLoader.HookDrawHealthBar = AddHook<DelegateDrawHealthBar>(g => g.DrawHealthBar)
staticprivate

Definition at line 731 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.DrawHealthBar().

◆ HookDrawTownAttackGun

HookList Terraria.ModLoader.NPCLoader.HookDrawTownAttackGun = AddHook<DelegateDrawTownAttackGun>(g => g.DrawTownAttackGun)
staticprivate

Definition at line 1095 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.DrawTownAttackGun().

◆ HookDrawTownAttackSwing

HookList Terraria.ModLoader.NPCLoader.HookDrawTownAttackSwing = AddHook<DelegateDrawTownAttackSwing>(g => g.DrawTownAttackSwing)
staticprivate

Definition at line 1106 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.DrawTownAttackSwing().

◆ HookEditSpawnPool

HookList Terraria.ModLoader.NPCLoader.HookEditSpawnPool = AddHook<Action<Dictionary<int, float>, NPCSpawnInfo>>(g => g.EditSpawnPool)
staticprivate

Definition at line 787 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ChooseSpawn().

◆ HookEditSpawnRange

HookList Terraria.ModLoader.NPCLoader.HookEditSpawnRange = AddHook<DelegateEditSpawnRange>(g => g.EditSpawnRange)
staticprivate

Definition at line 778 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.EditSpawnRange().

◆ HookEditSpawnRate

HookList Terraria.ModLoader.NPCLoader.HookEditSpawnRate = AddHook<DelegateEditSpawnRate>(g => g.EditSpawnRate)
staticprivate

Definition at line 768 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.EditSpawnRate().

◆ HookFindFrame

HookList Terraria.ModLoader.NPCLoader.HookFindFrame = AddHook<Action<NPC, int>>(g => g.FindFrame)
staticprivate

Definition at line 318 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.FindFrame().

◆ HookGetAlpha

HookList Terraria.ModLoader.NPCLoader.HookGetAlpha = AddHook<Func<NPC, Color, Color?>>(g => g.GetAlpha)
staticprivate

Definition at line 673 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.GetAlpha().

◆ HookGetChat

HookList Terraria.ModLoader.NPCLoader.HookGetChat = AddHook<DelegateGetChat>(g => g.GetChat)
staticprivate

Definition at line 878 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.GetChat().

◆ HookHitEffect

HookList Terraria.ModLoader.NPCLoader.HookHitEffect = AddHook<Action<NPC, int, double>>(g => g.HitEffect)
staticprivate

Definition at line 334 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.HitEffect().

◆ HookModifyHitByItem

HookList Terraria.ModLoader.NPCLoader.HookModifyHitByItem = AddHook<DelegateModifyHitByItem>(g => g.ModifyHitByItem)
staticprivate

Definition at line 558 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ModifyHitByItem().

◆ HookModifyHitByProjectile

HookList Terraria.ModLoader.NPCLoader.HookModifyHitByProjectile = AddHook<DelegateModifyHitByProjectile>(g => g.ModifyHitByProjectile)
staticprivate

Definition at line 604 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ModifyHitByProjectile().

◆ HookModifyHitNPC

HookList Terraria.ModLoader.NPCLoader.HookModifyHitNPC = AddHook<DelegateModifyHitNPC>(g => g.ModifyHitNPC)
staticprivate

Definition at line 513 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ModifyHitNPC().

◆ HookModifyHitPlayer

HookList Terraria.ModLoader.NPCLoader.HookModifyHitPlayer = AddHook<DelegateModifyHitPlayer>(g => g.ModifyHitPlayer)
staticprivate

Definition at line 467 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ModifyHitPlayer().

◆ HookNPCLoot

HookList Terraria.ModLoader.NPCLoader.HookNPCLoot = AddHook<Action<NPC>>(g => g.NPCLoot)
staticprivate

Definition at line 420 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.NPCLoot().

◆ HookOnCatchNPC

HookList Terraria.ModLoader.NPCLoader.HookOnCatchNPC = AddHook<Action<NPC, Player, Item>>(g => g.OnCatchNPC)
staticprivate

Definition at line 441 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnCatchNPC().

◆ HookOnChatButtonClicked

HookList Terraria.ModLoader.NPCLoader.HookOnChatButtonClicked = AddHook<DelegateOnChatButtonClicked>(g => g.OnChatButtonClicked)
staticprivate

Definition at line 918 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnChatButtonClicked().

◆ HookOnGoToStatue

HookList Terraria.ModLoader.NPCLoader.HookOnGoToStatue = AddHook<Action<NPC, bool>>(g => g.OnGoToStatue)
staticprivate

Definition at line 981 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnGoToStatue().

◆ HookOnHitByItem

HookList Terraria.ModLoader.NPCLoader.HookOnHitByItem = AddHook<Action<NPC, Player, Item, int, float, bool>>(g => g.OnHitByItem)
staticprivate

Definition at line 568 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnHitByItem().

◆ HookOnHitByProjectile

HookList Terraria.ModLoader.NPCLoader.HookOnHitByProjectile = AddHook<Action<NPC, Projectile, int, float, bool>>(g => g.OnHitByProjectile)
staticprivate

Definition at line 614 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnHitByProjectile().

◆ HookOnHitNPC

HookList Terraria.ModLoader.NPCLoader.HookOnHitNPC = AddHook<Action<NPC, NPC, int, float, bool>>(g => g.OnHitNPC)
staticprivate

Definition at line 523 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnHitNPC().

◆ HookOnHitPlayer

HookList Terraria.ModLoader.NPCLoader.HookOnHitPlayer = AddHook<Action<NPC, Player, int, bool>>(g => g.OnHitPlayer)
staticprivate

Definition at line 477 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.OnHitPlayer().

◆ HookPostAI

HookList Terraria.ModLoader.NPCLoader.HookPostAI = AddHook<Action<NPC>>(g => g.PostAI)
staticprivate

Definition at line 278 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.PostAI().

◆ HookPostDraw

HookList Terraria.ModLoader.NPCLoader.HookPostDraw = AddHook<Action<NPC, SpriteBatch, Color>>(g => g.PostDraw)
staticprivate

Definition at line 709 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.PostDraw().

◆ HookPreAI

HookList Terraria.ModLoader.NPCLoader.HookPreAI = AddHook<Func<NPC, bool>>(g => g.PreAI)
staticprivate

Definition at line 255 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.PreAI().

◆ HookPreChatButtonClicked

HookList Terraria.ModLoader.NPCLoader.HookPreChatButtonClicked = AddHook<Func<NPC, bool, bool>>(g => g.PreChatButtonClicked)
staticprivate

Definition at line 899 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.PreChatButtonClicked().

◆ HookPreDraw

HookList Terraria.ModLoader.NPCLoader.HookPreDraw = AddHook<Func<NPC, SpriteBatch, Color, bool>>(g => g.PreDraw)
staticprivate

Definition at line 696 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.PreDraw().

◆ HookPreNPCLoot

HookList Terraria.ModLoader.NPCLoader.HookPreNPCLoot = AddHook<Func<NPC, bool>>(g => g.PreNPCLoot)
staticprivate

Definition at line 400 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.PreNPCLoot().

◆ HookResetEffects

HookList Terraria.ModLoader.NPCLoader.HookResetEffects = AddHook<Action<NPC>>(g => g.ResetEffects)
staticprivate

Definition at line 229 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ResetEffects().

◆ hooks

List<HookList> Terraria.ModLoader.NPCLoader.hooks = new List<HookList>()
staticprivate

Definition at line 46 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.AddHook< F >().

◆ HookScaleExpertStats

HookList Terraria.ModLoader.NPCLoader.HookScaleExpertStats = AddHook<Action<NPC, int, float>>(g => g.ScaleExpertStats)
staticprivate

Definition at line 219 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.ScaleExpertStats().

◆ HookSetDefaults

HookList Terraria.ModLoader.NPCLoader.HookSetDefaults = AddHook<Action<NPC>>(g => g.SetDefaults)
staticprivate

Definition at line 190 of file NPCLoader.cs.

◆ HookSetupShop

HookList Terraria.ModLoader.NPCLoader.HookSetupShop = AddHook<DelegateSetupShop>(g => g.SetupShop)
staticprivate

Definition at line 940 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.SetupShop().

◆ HookSetupTravelShop

HookList Terraria.ModLoader.NPCLoader.HookSetupTravelShop = AddHook<DelegateSetupTravelShop>(g => g.SetupTravelShop)
staticprivate

Definition at line 955 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.SetupTravelShop().

◆ HookSpawnNPC

HookList Terraria.ModLoader.NPCLoader.HookSpawnNPC = AddHook<Action<int, int, int>>(g => g.SpawnNPC)
staticprivate

Definition at line 821 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.SpawnNPC().

◆ HookSpecialNPCLoot

HookList Terraria.ModLoader.NPCLoader.HookSpecialNPCLoot = AddHook<Func<NPC, bool>>(g => g.SpecialNPCLoot)
staticprivate

Definition at line 386 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.SpecialNPCLoot().

◆ HookStrikeNPC

HookList Terraria.ModLoader.NPCLoader.HookStrikeNPC = AddHook<DelegateStrikeNPC>(g => g.StrikeNPC)
staticprivate

Definition at line 625 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.StrikeNPC().

◆ HookTownNPCAttackCooldown

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackCooldown = AddHook<DelegateTownNPCAttackCooldown>(g => g.TownNPCAttackCooldown)
staticprivate

Definition at line 1027 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackCooldown().

◆ HookTownNPCAttackMagic

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackMagic = AddHook<DelegateTownNPCAttackMagic>(g => g.TownNPCAttackMagic)
staticprivate

Definition at line 1073 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackMagic().

◆ HookTownNPCAttackProj

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackProj = AddHook<DelegateTownNPCAttackProj>(g => g.TownNPCAttackProj)
staticprivate

Definition at line 1038 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackProj().

◆ HookTownNPCAttackProjSpeed

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackProjSpeed = AddHook<DelegateTownNPCAttackProjSpeed>(g => g.TownNPCAttackProjSpeed)
staticprivate

Definition at line 1050 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackProjSpeed().

◆ HookTownNPCAttackShoot

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackShoot = AddHook<DelegateTownNPCAttackShoot>(g => g.TownNPCAttackShoot)
staticprivate

Definition at line 1062 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackShoot().

◆ HookTownNPCAttackStrength

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackStrength = AddHook<DelegateTownNPCAttackStrength>(g => g.TownNPCAttackStrength)
staticprivate

Definition at line 1016 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackStrength().

◆ HookTownNPCAttackSwing

HookList Terraria.ModLoader.NPCLoader.HookTownNPCAttackSwing = AddHook<DelegateTownNPCAttackSwing>(g => g.TownNPCAttackSwing)
staticprivate

Definition at line 1084 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.TownNPCAttackSwing().

◆ HookUpdateLifeRegen

HookList Terraria.ModLoader.NPCLoader.HookUpdateLifeRegen = AddHook<DelegateUpdateLifeRegen>(g => g.UpdateLifeRegen)
staticprivate

Definition at line 346 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.UpdateLifeRegen().

◆ nextNPC

int Terraria.ModLoader.NPCLoader.nextNPC = NPCID.Count
staticprivate

Definition at line 22 of file NPCLoader.cs.

◆ shopToNPC

readonly int [] Terraria.ModLoader.NPCLoader.shopToNPC = new int[Main.MaxShopIDs - 1]
staticprivate

◆ vanillaSkeletonCount

int Terraria.ModLoader.NPCLoader.vanillaSkeletonCount = NPCID.Sets.Skeletons.Count
staticprivate

Definition at line 29 of file NPCLoader.cs.

Property Documentation

◆ NPCCount

int Terraria.ModLoader.NPCLoader.NPCCount
staticget

Definition at line 86 of file NPCLoader.cs.

Referenced by Terraria.ModLoader.NPCLoader.GetNPC().