tModLoader v0.11.8.9
A mod to make and play Terraria mods
ModPlayer.cs
Go to the documentation of this file.
1using Microsoft.Xna.Framework;
2using Microsoft.Xna.Framework.Graphics;
3using System;
4using System.Collections.Generic;
5using System.IO;
6using Terraria.DataStructures;
7using Terraria.GameInput;
9
10namespace Terraria.ModLoader
11{
15 public class ModPlayer
16 {
20 public Mod mod {
21 get;
22 internal set;
23 }
24
28 public string Name {
29 get;
30 internal set;
31 }
32
36 public Player player {
37 get;
38 internal set;
39 }
40
41 internal int index;
42
43 internal ModPlayer CreateFor(Player newPlayer) {
44 ModPlayer modPlayer = (ModPlayer)(CloneNewInstances ? MemberwiseClone() : Activator.CreateInstance(GetType()));
45 modPlayer.Name = Name;
46 modPlayer.mod = mod;
47 modPlayer.player = newPlayer;
48 modPlayer.index = index;
49 modPlayer.Initialize();
50 return modPlayer;
51 }
52
53 public bool TypeEquals(ModPlayer other) {
54 return mod == other.mod && Name == other.Name;
55 }
56
60 public virtual bool CloneNewInstances => true;
61
67 public virtual bool Autoload(ref string name) {
68 return mod.Properties.Autoload;
69 }
70
74 public virtual void Initialize() {
75 }
76
80 public virtual void ResetEffects() {
81 }
82
86 public virtual void UpdateDead() {
87 }
88
92 public virtual void PreSaveCustomData() {
93 }
94
99 public virtual TagCompound Save() {
100 return null;
101 }
102
107 public virtual void Load(TagCompound tag) {
108 }
109
114 public virtual void LoadLegacy(BinaryReader reader) {
115 }
116
122 public virtual void SetupStartInventory(IList<Item> items, bool mediumcoreDeath) {
123 }
124
125 // @todo: SetupStartInventory marked obsolete until v0.11
126 [method: Obsolete("SetupStartInventory now has an overload with a mediumcoreDeath bool argument, please use that.")]
127 public virtual void SetupStartInventory(IList<Item> items) {
128 }
129
133 public virtual void PreSavePlayer() {
134 }
135
139 public virtual void PostSavePlayer() {
140 }
141
145 public virtual void UpdateBiomes() {
146 }
147
153 public virtual bool CustomBiomesMatch(Player other) {
154 return true;
155 }
156
161 public virtual void CopyCustomBiomesTo(Player other) {
162 }
163
168 public virtual void SendCustomBiomes(BinaryWriter writer) {
169 }
170
175 public virtual void ReceiveCustomBiomes(BinaryReader reader) {
176 }
177
181 public virtual void UpdateBiomeVisuals() {
182 }
183
188 public virtual void clientClone(ModPlayer clientClone) {
189 }
190
197 public virtual void SyncPlayer(int toWho, int fromWho, bool newPlayer) {
198 }
199
204 public virtual void SendClientChanges(ModPlayer clientPlayer) {
205 }
206
211 public virtual Texture2D GetMapBackgroundImage() {
212 return null;
213 }
214
218 public virtual void UpdateBadLifeRegen() {
219 }
220
224 public virtual void UpdateLifeRegen() {
225 }
226
231 public virtual void NaturalLifeRegen(ref float regen) {
232 }
233
238 public virtual void UpdateAutopause() {
239 }
240
244 public virtual void PreUpdate() {
245 }
246
251 public virtual void ProcessTriggers(TriggersSet triggersSet) {
252 }
253
257 public virtual void SetControls() {
258 }
259
263 public virtual void PreUpdateBuffs() {
264 }
265
269 public virtual void PostUpdateBuffs() {
270 }
271
278 public virtual void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff) {
279 }
280
284 public virtual void PostUpdateEquips() {
285 }
286
290 public virtual void PostUpdateMiscEffects() {
291 }
292
296 public virtual void PostUpdateRunSpeeds() {
297 }
298
302 public virtual void PreUpdateMovement() {
303 }
304
308 public virtual void PostUpdate() {
309 }
310
314 public virtual void UpdateVanityAccessories() {
315 }
316
320 public virtual void FrameEffects() {
321 }
322
336 public virtual bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit,
337 ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) {
338 return true;
339 }
340
349 public virtual void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) {
350 }
351
360 public virtual void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) {
361 }
362
373 public virtual bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore,
374 ref PlayerDeathReason damageSource) {
375 return true;
376 }
377
385 public virtual void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) {
386 }
387
392 public virtual bool PreItemCheck() {
393 return true;
394 }
395
399 public virtual void PostItemCheck() {
400 }
401
407 public virtual float UseTimeMultiplier(Item item) {
408 return 1f;
409 }
410
416 public virtual float MeleeSpeedMultiplier(Item item) {
417 return 1f;
418 }
419
426 public virtual void GetHealLife(Item item, bool quickHeal, ref int healValue) {
427 }
428
435 public virtual void GetHealMana(Item item, bool quickHeal, ref int healValue) {
436 }
437
444 public virtual void ModifyManaCost(Item item, ref float reduce, ref float mult) {
445 }
446
454 public virtual void OnMissingMana(Item item, int neededMana) {
455 }
456
462 public virtual void OnConsumeMana(Item item, int manaConsumed) {
463 }
464
470 [Obsolete("Use ModifyWeaponDamage", true)]
471 public virtual void GetWeaponDamage(Item item, ref int damage) {
472 }
473
480 [Obsolete("Use ModifyWeaponDamage overload with the additional flat parameter")]
481 public virtual void ModifyWeaponDamage(Item item, ref float add, ref float mult) {
482 }
483
491 public virtual void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) {
492 }
493
499 public virtual void GetWeaponKnockback(Item item, ref float knockback) {
500 }
501
507 public virtual void GetWeaponCrit(Item item, ref int crit) {
508 }
509
517 public virtual bool ConsumeAmmo(Item weapon, Item ammo) {
518 return true;
519 }
520
528 public virtual void OnConsumeAmmo(Item weapon, Item ammo) {
529 }
530
542 public virtual bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) {
543 return true;
544 }
545
551 public virtual void MeleeEffects(Item item, Rectangle hitbox) {
552 }
553
560 public virtual void OnHitAnything(float x, float y, Entity victim) {
561 }
562
569 public virtual bool? CanHitNPC(Item item, NPC target) {
570 return null;
571 }
572
581 public virtual void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) {
582 }
583
592 public virtual void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) {
593 }
594
601 public virtual bool? CanHitNPCWithProj(Projectile proj, NPC target) {
602 return null;
603 }
604
614 public virtual void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) {
615 }
616
625 public virtual void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit) {
626 }
627
634 public virtual bool CanHitPvp(Item item, Player target) {
635 return true;
636 }
637
645 public virtual void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit) {
646 }
647
655 public virtual void OnHitPvp(Item item, Player target, int damage, bool crit) {
656 }
657
664 public virtual bool CanHitPvpWithProj(Projectile proj, Player target) {
665 return true;
666 }
667
675 public virtual void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit) {
676 }
677
685 public virtual void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) {
686 }
687
694 public virtual bool CanBeHitByNPC(NPC npc, ref int cooldownSlot) {
695 return true;
696 }
697
704 public virtual void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) {
705 }
706
713 public virtual void OnHitByNPC(NPC npc, int damage, bool crit) {
714 }
715
721 public virtual bool CanBeHitByProjectile(Projectile proj) {
722 return true;
723 }
724
731 public virtual void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) {
732 }
733
740 public virtual void OnHitByProjectile(Projectile proj, int damage, bool crit) {
741 }
742
755 public virtual void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) {
756 }
757
764 public virtual void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) {
765 }
766
772 public virtual void AnglerQuestReward(float rareMultiplier, List<Item> rewardItems) {
773 }
774
779 public virtual void GetDyeTraderReward(List<int> rewardPool) {
780 }
781
791 public virtual void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) {
792 }
793
798 public virtual void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) {
799 }
800
805 public virtual void ModifyDrawLayers(List<PlayerLayer> layers) {
806 }
807
812 public virtual void ModifyDrawHeadLayers(List<PlayerHeadLayer> layers) {
813 }
814
818 public virtual void ModifyScreenPosition() {
819 }
820
825 public virtual void ModifyZoom(ref float zoom) {
826 }
827
832 public virtual void PlayerConnect(Player player) {
833 }
834
839 public virtual void PlayerDisconnect(Player player) {
840 }
841
846 public virtual void OnEnterWorld(Player player) {
847 }
848
853 public virtual void OnRespawn(Player player) {
854 }
855
863 public virtual bool ShiftClickSlot(Item[] inventory, int context, int slot) {
864 return false;
865 }
866
873 public virtual void PostSellItem(NPC vendor, Item[] shopInventory, Item item) {
874 }
875
883 public virtual bool CanSellItem(NPC vendor, Item[] shopInventory, Item item) {
884 return true;
885 }
886
893 public virtual void PostBuyItem(NPC vendor, Item[] shopInventory, Item item) {
894 }
895
903 public virtual bool CanBuyItem(NPC vendor, Item[] shopInventory, Item item) {
904 return true;
905 }
906
915 public virtual bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) {
916 return true;
917 }
918
926 public virtual void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) {
927 }
928
936 public virtual void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) {
937 }
938 }
939}
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
Definition: Mod.cs:25
ModProperties Properties
Definition: Mod.cs:52
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPla...
Definition: ModPlayer.cs:16
virtual void GetWeaponDamage(Item item, ref int damage)
Allows you to temporarily modify a weapon's damage based on player buffs, etc. This is useful for cre...
Definition: ModPlayer.cs:471
virtual void PreSavePlayer()
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer....
Definition: ModPlayer.cs:133
virtual void UpdateBiomeVisuals()
Allows you to create special visual effects in the area around the player. For example,...
Definition: ModPlayer.cs:181
virtual void UpdateDead()
Similar to UpdateDead, except this is only called when the player is dead. If this is called,...
Definition: ModPlayer.cs:86
virtual void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
Allows you to change the item the player gains from catching a fish. The fishingRod and bait paramete...
Definition: ModPlayer.cs:755
virtual void SendClientChanges(ModPlayer clientPlayer)
Allows you to sync any information that has changed between the server and client....
Definition: ModPlayer.cs:204
virtual void ModifyDrawHeadLayers(List< PlayerHeadLayer > layers)
Allows you to modify the drawing of the player head on the minimap. This is done by removing from,...
Definition: ModPlayer.cs:812
virtual void ResetEffects()
This is where you reset any fields you add to your ModPlayer subclass to their default states....
Definition: ModPlayer.cs:80
virtual void FrameEffects()
Allows you to modify the armor and accessories that visually appear on the player....
Definition: ModPlayer.cs:320
virtual void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
Allows you to modify the damage, knockback, etc., that a projectile created by this player does to an...
Definition: ModPlayer.cs:614
virtual bool CanBeHitByNPC(NPC npc, ref int cooldownSlot)
Allows you to determine whether the given NPC can hit this player. Return false to block this player ...
Definition: ModPlayer.cs:694
virtual void PostUpdate()
This is called at the very end of the Player.Update method. Final general update tasks can be placed ...
Definition: ModPlayer.cs:308
virtual void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
Allows you to make anything happen when the player takes damage.
Definition: ModPlayer.cs:360
virtual void UpdateLifeRegen()
Allows you to increase the player's life regeneration based on its state. This can be done by increme...
Definition: ModPlayer.cs:224
virtual bool ShiftClickSlot(Item[] inventory, int context, int slot)
Called whenever the player shift-clicks an item slot. This can be used to override default clicking b...
Definition: ModPlayer.cs:863
virtual void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel)
Allows you to modify the player's fishing power. As an example of the type of stuff that should go he...
Definition: ModPlayer.cs:764
virtual Texture2D GetMapBackgroundImage()
Allows you to change the background that displays when viewing the map. Return null if you do not wan...
Definition: ModPlayer.cs:211
virtual void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that a hostile projectile does to this player.
Definition: ModPlayer.cs:731
virtual void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
Allows you to create special effects when this player hits an NPC by swinging a melee weapon (for exa...
Definition: ModPlayer.cs:592
virtual void LoadLegacy(BinaryReader reader)
Allows you to load pre-v0.9 custom data you have saved for this player.
Definition: ModPlayer.cs:114
virtual bool CanHitPvp(Item item, Player target)
Allows you to determine whether a melee weapon swung by this player can hit the given opponent player...
Definition: ModPlayer.cs:634
string Name
The name of this ModPlayer. Used for distinguishing between multiple ModPlayers added by a single Mod...
Definition: ModPlayer.cs:28
virtual void PostSellItem(NPC vendor, Item[] shopInventory, Item item)
Called whenever the player sells an item to an NPC.
Definition: ModPlayer.cs:873
virtual void Load(TagCompound tag)
Allows you to load custom data you have saved for this player.
Definition: ModPlayer.cs:107
virtual void PostItemCheck()
Allows you to do anything after the update code for the player's held item is run....
Definition: ModPlayer.cs:399
virtual void SyncPlayer(int toWho, int fromWho, bool newPlayer)
Allows you to sync information about this player between server and client. The toWho and fromWho par...
Definition: ModPlayer.cs:197
virtual void ModifyDrawInfo(ref PlayerDrawInfo drawInfo)
Allows you to modify the drawing parameters of the player before drawing begins.
Definition: ModPlayer.cs:798
virtual bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
This is called before this player's weapon creates a projectile. You can use it to create special eff...
Definition: ModPlayer.cs:542
virtual void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that an NPC does to this player.
Definition: ModPlayer.cs:704
virtual void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price)
Called on the Client after the player heals themselves with the Nurse NPC.
Definition: ModPlayer.cs:936
virtual void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
Allows you to make anything happen when the player dies.
Definition: ModPlayer.cs:385
virtual ? bool CanHitNPC(Item item, NPC target)
Allows you to determine whether a player can hit the given NPC by swinging a melee weapon....
Definition: ModPlayer.cs:569
virtual void MeleeEffects(Item item, Rectangle hitbox)
Allows you to give this player's melee weapon special effects, such as creating light or dust.
Definition: ModPlayer.cs:551
virtual void SetControls()
Use this to modify the control inputs that the player receives. For example, the Confused debuff swap...
Definition: ModPlayer.cs:257
virtual void OnHitPvp(Item item, Player target, int damage, bool crit)
Allows you to create special effects when this player's melee weapon hits an opponent player.
Definition: ModPlayer.cs:655
virtual void GetWeaponKnockback(Item item, ref float knockback)
Allows you to temporarily modify a weapon's knockback based on player buffs, etc. This allows you to ...
Definition: ModPlayer.cs:499
virtual void PostSavePlayer()
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer....
Definition: ModPlayer.cs:139
virtual void UpdateBiomes()
Allows you to set biome variables in your ModPlayer class based on tile counts.
Definition: ModPlayer.cs:145
virtual void GetHealLife(Item item, bool quickHeal, ref int healValue)
Allows you to temporarily modify the amount of life a life healing item will heal for,...
Definition: ModPlayer.cs:426
virtual void ModifyWeaponDamage(Item item, ref float add, ref float mult)
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for ...
Definition: ModPlayer.cs:481
virtual void CopyCustomBiomesTo(Player other)
In this hook, you should copy the custom biome variables from this player to the other player paramet...
Definition: ModPlayer.cs:161
virtual bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
This hook is called whenever the player is about to be killed after reaching 0 health....
Definition: ModPlayer.cs:373
virtual void PlayerDisconnect(Player player)
Called when a player disconnects.
Definition: ModPlayer.cs:839
virtual void PlayerConnect(Player player)
Called on clients when a player connects.
Definition: ModPlayer.cs:832
virtual void OnConsumeAmmo(Item weapon, Item ammo)
Allows you to make things happen when ammo is consumed. Called before the ammo stack is reduced.
Definition: ModPlayer.cs:528
virtual void OnEnterWorld(Player player)
Called on the LocalPlayer when that player enters the world. SP and Client. Only called on the player...
Definition: ModPlayer.cs:846
virtual bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText)
Called on the Client while the nurse chat is displayed. Return false to prevent the player from heali...
Definition: ModPlayer.cs:915
virtual void SetupStartInventory(IList< Item > items, bool mediumcoreDeath)
Allows you to modify the inventory newly created players or killed mediumcore players will start with...
Definition: ModPlayer.cs:122
virtual void Initialize()
Called whenever the player is loaded (on the player selection screen). This can be used to initialize...
Definition: ModPlayer.cs:74
virtual void OnHitAnything(float x, float y, Entity victim)
This hook is called when a player damages anything, whether it be an NPC or another player,...
Definition: ModPlayer.cs:560
virtual bool CloneNewInstances
Whether each player gets a ModPlayer by cloning the ModPlayer added to the Mod or by creating a new M...
Definition: ModPlayer.cs:60
virtual void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that a projectile created by this player does to an opponent p...
Definition: ModPlayer.cs:675
virtual void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price)
Called on the Client while the nurse chat is displayed and after ModifyNurseHeal. Allows custom prici...
Definition: ModPlayer.cs:926
virtual void clientClone(ModPlayer clientClone)
Allows you to copy information about this player to the clientClone parameter. You should copy inform...
Definition: ModPlayer.cs:188
virtual void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that a melee weapon swung by this player does to an opponent p...
Definition: ModPlayer.cs:645
virtual void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
Allows you to create special effects when this player is drawn, such as creating dust,...
Definition: ModPlayer.cs:791
virtual void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit)
Allows you to create special effects when a projectile created by this player hits an opponent player...
Definition: ModPlayer.cs:685
virtual bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
This hook is called before every time the player takes damage. The pvp parameter is whether the damag...
Definition: ModPlayer.cs:336
virtual void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
Allows you to create special effects when a projectile created by this player hits an NPC (for exampl...
Definition: ModPlayer.cs:625
virtual void ProcessTriggers(TriggersSet triggersSet)
Use this to check on hotkeys you have registered. While SetControls is set even while in text entry m...
Definition: ModPlayer.cs:251
virtual void OnHitByNPC(NPC npc, int damage, bool crit)
Allows you to create special effects when an NPC hits this player (for example, inflicting debuffs).
Definition: ModPlayer.cs:713
virtual void GetHealMana(Item item, bool quickHeal, ref int healValue)
Allows you to temporarily modify the amount of mana a mana healing item will heal for,...
Definition: ModPlayer.cs:435
virtual void PreUpdateBuffs()
This is called sometime after SetControls is called, and right before all the buffs update on this pl...
Definition: ModPlayer.cs:263
virtual void PreUpdateMovement()
This is called right before modifying the player's position based on velocity. Use this to make direc...
Definition: ModPlayer.cs:302
bool TypeEquals(ModPlayer other)
Definition: ModPlayer.cs:53
virtual void OnMissingMana(Item item, int neededMana)
Allows you to make stuff happen when a player doesn't have enough mana for the item they are trying t...
Definition: ModPlayer.cs:454
virtual TagCompound Save()
Allows you to save custom data for this player. Returns null by default.
Definition: ModPlayer.cs:99
virtual void ModifyDrawLayers(List< PlayerLayer > layers)
Allows you to modify the drawing of the player. This is done by removing from, adding to,...
Definition: ModPlayer.cs:805
virtual void PreSaveCustomData()
Currently never gets called, so this is useless.
Definition: ModPlayer.cs:92
virtual void ModifyScreenPosition()
Use this hook to modify Main.screenPosition after weapon zoom and camera lerp have taken place.
Definition: ModPlayer.cs:818
virtual void ModifyManaCost(Item item, ref float reduce, ref float mult)
Allows you to temporarily modify the amount of mana an item will consume on use, based on player buff...
Definition: ModPlayer.cs:444
virtual float UseTimeMultiplier(Item item)
Allows you to multiply an item's regular use time. Returns 1f by default. Values greater than 1 incre...
Definition: ModPlayer.cs:407
virtual void PostUpdateRunSpeeds()
This is called after the player's horizontal speeds are modified, which is sometime after PostUpdateM...
Definition: ModPlayer.cs:296
virtual void GetDyeTraderReward(List< int > rewardPool)
Allows you to modify what items are possible for the player to earn when giving a Strange Plant to th...
Definition: ModPlayer.cs:779
virtual void ModifyZoom(ref float zoom)
Use this to modify the zoom factor for the player. The zoom correlates to the percentage of half the ...
Definition: ModPlayer.cs:825
virtual void OnRespawn(Player player)
Called when a player respawns in the world.
Definition: ModPlayer.cs:853
virtual ? bool CanHitNPCWithProj(Projectile proj, NPC target)
Allows you to determine whether a projectile created by this player can hit the given NPC....
Definition: ModPlayer.cs:601
virtual void ReceiveCustomBiomes(BinaryReader reader)
Allows you to do things with the custom biome information you send between client and server.
Definition: ModPlayer.cs:175
virtual float MeleeSpeedMultiplier(Item item)
Allows you to multiply an item's regular melee speed. Returns 1f by default. Values greater than 1 in...
Definition: ModPlayer.cs:416
virtual void UpdateVanityAccessories()
This is called after VanillaUpdateVanityAccessory() in player.UpdateEquips()
Definition: ModPlayer.cs:314
virtual void PostUpdateBuffs()
This is called right after all of this player's buffs update on the player. This can be used to modif...
Definition: ModPlayer.cs:269
virtual void OnHitByProjectile(Projectile proj, int damage, bool crit)
Allows you to create special effects when a hostile projectile hits this player.
Definition: ModPlayer.cs:740
virtual void PostBuyItem(NPC vendor, Item[] shopInventory, Item item)
Called whenever the player buys an item from an NPC.
Definition: ModPlayer.cs:893
virtual void UpdateBadLifeRegen()
Allows you to give the player a negative life regeneration based on its state (for example,...
Definition: ModPlayer.cs:218
virtual void SendCustomBiomes(BinaryWriter writer)
Allows you to send custom biome information between client and server.
Definition: ModPlayer.cs:168
virtual void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
Allows you to make anything happen right before damage is subtracted from the player's health.
Definition: ModPlayer.cs:349
virtual void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
Allows you to modify the damage, knockback, etc., that this player does to an NPC by swinging a melee...
Definition: ModPlayer.cs:581
virtual void SetupStartInventory(IList< Item > items)
Definition: ModPlayer.cs:127
virtual bool CanHitPvpWithProj(Projectile proj, Player target)
Allows you to determine whether a projectile created by this player can hit the given opponent player...
Definition: ModPlayer.cs:664
virtual void PostUpdateEquips()
This is called right after all of this player's equipment and armor sets update on the player,...
Definition: ModPlayer.cs:284
virtual void UpdateAutopause()
Allows you to modify the player's stats while the game is paused due to the autopause setting being o...
Definition: ModPlayer.cs:238
virtual void NaturalLifeRegen(ref float regen)
Allows you to modify the power of the player's natural life regeneration. This can be done by multipl...
Definition: ModPlayer.cs:231
virtual bool CustomBiomesMatch(Player other)
Whether or not this player and the other player parameter have the same custom biome variables....
Definition: ModPlayer.cs:153
virtual bool CanBeHitByProjectile(Projectile proj)
Allows you to determine whether the given hostile projectile can hit this player. Return false to blo...
Definition: ModPlayer.cs:721
virtual bool ConsumeAmmo(Item weapon, Item ammo)
Whether or not ammo will be consumed upon usage. Return false to stop the ammo from being depleted....
Definition: ModPlayer.cs:517
virtual bool Autoload(ref string name)
Allows you to automatically add a ModPlayer instead of using Mod.AddPlayer. Return true to allow auto...
Definition: ModPlayer.cs:67
virtual void PostUpdateMiscEffects()
This is called after miscellaneous update code is called in Player.Update, which is sometime after Po...
Definition: ModPlayer.cs:290
Mod mod
The mod that added this type of ModPlayer.
Definition: ModPlayer.cs:20
Player player
The Player instance that this ModPlayer instance is attached to.
Definition: ModPlayer.cs:36
virtual void OnConsumeMana(Item item, int manaConsumed)
Allows you to make stuff happen when a player consumes mana on use of an item.
Definition: ModPlayer.cs:462
virtual void AnglerQuestReward(float rareMultiplier, List< Item > rewardItems)
Allows you to add to, change, or remove from the items the player earns when finishing an Angler ques...
Definition: ModPlayer.cs:772
virtual bool CanSellItem(NPC vendor, Item[] shopInventory, Item item)
Return false to prevent a transaction. Called before the transaction.
Definition: ModPlayer.cs:883
virtual void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff)
Called after Update Accessories.
Definition: ModPlayer.cs:278
virtual bool PreItemCheck()
Allows you to do anything before the update code for the player's held item is run....
Definition: ModPlayer.cs:392
virtual void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat)
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for ...
Definition: ModPlayer.cs:491
virtual bool CanBuyItem(NPC vendor, Item[] shopInventory, Item item)
Return false to prevent a transaction. Called before the transaction.
Definition: ModPlayer.cs:903
virtual void PreUpdate()
This is called at the beginning of every tick update for this player, after checking whether the play...
Definition: ModPlayer.cs:244
virtual void GetWeaponCrit(Item item, ref int crit)
Allows you to temporarily modify a weapon's crit chance based on player buffs, etc.
Definition: ModPlayer.cs:507
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...
A struct that contains information that may help with PlayerLayer drawing.
Definition: DrawInfo.cs:10