1using Microsoft.Xna.Framework;
 
    2using Microsoft.Xna.Framework.Graphics;
 
    4using System.Collections.Generic;
 
    7using System.Linq.Expressions;
 
    8using System.Reflection;
 
    9using Terraria.DataStructures;
 
   10using Terraria.GameInput;
 
   11using Terraria.ModLoader.Default;
 
   22        private static readonly IList<ModPlayer> 
players = 
new List<ModPlayer>();
 
   26            public int[] 
arr = 
new int[0];
 
   34        private static List<HookList> 
hooks = 
new List<HookList>();
 
   42        internal static void Add(
ModPlayer player) {
 
   47        internal static void RebuildHooks() {
 
   48            foreach (var hook 
in hooks) {
 
   49                hook.arr = 
ModLoader.BuildGlobalHook(
players, hook.method).Select(p => p.index).ToArray();
 
   53        internal static void Unload() {
 
   57        internal static void SetupPlayer(Player player) {
 
   58            player.modPlayers = 
players.Select(modPlayer => modPlayer.CreateFor(player)).ToArray();
 
   65                player.modPlayers[index].ResetEffects();
 
   73                player.modPlayers[index].UpdateDead();
 
   81            IList<Item> items = 
new List<Item>();
 
   83            item.SetDefaults(3507);
 
   87            item.SetDefaults(3509);
 
   91            item.SetDefaults(3506);
 
   94            if (Main.cEd && !mediumcoreDeath) {
 
   96                item.SetDefaults(603);
 
  100                player.modPlayers[index].SetupStartInventory(items, mediumcoreDeath);
 
  103                player.modPlayers[index].SetupStartInventory(items);
 
  105            IDictionary<int, int> counts = 
new Dictionary<int, int>();
 
  106            foreach (
Item item0 
in items) {
 
  107                if (item0.maxStack > 1) {
 
  108                    if (!counts.ContainsKey(item0.netID)) {
 
  109                        counts[item0.netID] = 0;
 
  111                    counts[item0.netID] += item0.stack;
 
  115            while (k < items.Count) {
 
  117                int id = items[k].netID;
 
  118                if (counts.ContainsKey(
id)) {
 
  119                    items[k].stack = counts[id];
 
  120                    if (items[k].stack > items[k].maxStack) {
 
  121                        items[k].stack = items[k].maxStack;
 
  123                    counts[id] -= items[k].stack;
 
  124                    if (items[k].stack <= 0) {
 
  137            if (items.Count <= 50) {
 
  138                for (
int k = 0; k < items.Count && k < 49; k++)
 
  139                    player.inventory[k] = items[k];
 
  142                for (
int k = 0; k < 49; k++) {
 
  143                    player.inventory[k] = items[k];
 
  146                bag.SetDefaults(
ModContent.ItemType<StartBag>());
 
  147                for (
int k = 49; k < items.Count; k++) {
 
  148                    ((StartBag)bag.modItem).AddItem(items[k]);
 
  150                player.inventory[49] = bag;
 
  162                player.modPlayers[index].PreSavePlayer();
 
  170                player.modPlayers[index].PostSavePlayer();
 
  178                player.modPlayers[index].UpdateBiomes();
 
  186                if (!player.modPlayers[index].CustomBiomesMatch(other)) {
 
  197                player.modPlayers[index].CopyCustomBiomesTo(other);
 
  206            using (MemoryStream stream = 
new MemoryStream()) {
 
  213                    customWriter.Flush();
 
  214                    data = stream.ToArray();
 
  223            using (MemoryStream stream = 
new MemoryStream()) {
 
  226                    customWriter.Flush();
 
  227                    data = stream.ToArray();
 
  230            if (data.Length > 0) {
 
  231                writer.Write(modPlayer.
mod.
Name);
 
  232                writer.Write(modPlayer.
Name);
 
  233                writer.Write((
byte)data.Length);
 
  241            int count = reader.ReadUInt16();
 
  242            for (
int k = 0; k < count; k++) {
 
  243                string modName = reader.ReadString();
 
  244                string name = reader.ReadString();
 
  245                byte[] data = reader.ReadBytes(reader.ReadByte());
 
  247                ModPlayer modPlayer = mod == 
null ? null : player.GetModPlayer(mod, name);
 
  248                if (modPlayer != 
null) {
 
  249                    using (MemoryStream stream = 
new MemoryStream(data)) {
 
  266                player.modPlayers[index].UpdateBiomeVisuals();
 
  274                player.modPlayers[index].clientClone(
clientClone.modPlayers[index]);
 
  280        public static void SyncPlayer(Player player, 
int toWho, 
int fromWho, 
bool newPlayer) {
 
  282                player.modPlayers[index].SyncPlayer(toWho, fromWho, newPlayer);
 
  290                player.modPlayers[index].SendClientChanges(clientPlayer.modPlayers[index]);
 
  297            Texture2D texture = 
null;
 
  299                texture = player.modPlayers[index].GetMapBackgroundImage();
 
  300                if (texture != 
null) {
 
  311                player.modPlayers[index].UpdateBadLifeRegen();
 
  319                player.modPlayers[index].UpdateLifeRegen();
 
  328                player.modPlayers[index].NaturalLifeRegen(ref regen);
 
  336                player.modPlayers[index].UpdateAutopause();
 
  344                player.modPlayers[index].PreUpdate();
 
  352                player.modPlayers[index].SetControls();
 
  360                player.modPlayers[index].PreUpdateBuffs();
 
  368                player.modPlayers[index].PostUpdateBuffs();
 
  372        private delegate 
void DelegateUpdateEquips(ref 
bool wallSpeedBuff, ref 
bool tileSpeedBuff, ref 
bool tileRangeBuff);
 
  375        public static void UpdateEquips(Player player, ref 
bool wallSpeedBuff, ref 
bool tileSpeedBuff, ref 
bool tileRangeBuff) {
 
  377                player.modPlayers[index].UpdateEquips(ref wallSpeedBuff, ref tileSpeedBuff, ref tileRangeBuff);
 
  385                player.modPlayers[index].UpdateVanityAccessories();
 
  393                player.modPlayers[index].PostUpdateEquips();
 
  401                player.modPlayers[index].PostUpdateMiscEffects();
 
  409                player.modPlayers[index].PostUpdateRunSpeeds();
 
  417                player.modPlayers[index].PreUpdateMovement();
 
  425                player.modPlayers[index].PostUpdate();
 
  433                player.modPlayers[index].FrameEffects();
 
  437        private delegate 
bool DelegatePreHurt(
bool pvp, 
bool quiet, ref 
int damage, ref 
int hitDirection,
 
  438            ref 
bool crit, ref 
bool customDamage, ref 
bool playSound, ref 
bool genGore, ref PlayerDeathReason damageSource);
 
  441        public static bool PreHurt(Player player, 
bool pvp, 
bool quiet, ref 
int damage, ref 
int hitDirection,
 
  442            ref 
bool crit, ref 
bool customDamage, ref 
bool playSound, ref 
bool genGore, ref PlayerDeathReason damageSource) {
 
  445                if (!player.modPlayers[index].PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage,
 
  446                        ref playSound, ref genGore, ref damageSource)) {
 
  453        private static HookList HookHurt = AddHook<Action<bool, bool, double, int, bool>>(p => p.Hurt);
 
  455        public static void Hurt(Player player, 
bool pvp, 
bool quiet, 
double damage, 
int hitDirection, 
bool crit) {
 
  457                player.modPlayers[index].Hurt(pvp, quiet, damage, hitDirection, crit);
 
  463        public static void PostHurt(Player player, 
bool pvp, 
bool quiet, 
double damage, 
int hitDirection, 
bool crit) {
 
  465                player.modPlayers[index].PostHurt(pvp, quiet, damage, hitDirection, crit);
 
  469        private delegate 
bool DelegatePreKill(
double damage, 
int hitDirection, 
bool pvp, ref 
bool playSound,
 
  470            ref 
bool genGore, ref PlayerDeathReason damageSource);
 
  473        public static bool PreKill(Player player, 
double damage, 
int hitDirection, 
bool pvp, ref 
bool playSound,
 
  474            ref 
bool genGore, ref PlayerDeathReason damageSource) {
 
  477                if (!player.modPlayers[index].PreKill(damage, hitDirection, pvp, ref playSound, ref genGore, ref damageSource)) {
 
  484        private static HookList HookKill = AddHook<Action<double, int, bool, PlayerDeathReason>>(p => p.Kill);
 
  486        public static void Kill(Player player, 
double damage, 
int hitDirection, 
bool pvp, PlayerDeathReason damageSource) {
 
  488                player.modPlayers[index].Kill(damage, hitDirection, pvp, damageSource);
 
  497                result &= player.modPlayers[index].PreItemCheck();
 
  506                player.modPlayers[index].PostItemCheck();
 
  513            float multiplier = 1f;
 
  514            if (item.IsAir) 
return multiplier;
 
  516                multiplier *= player.modPlayers[index].UseTimeMultiplier(item);
 
  525        public static int TotalUseTime(
float useTime, Player player, Item item) {
 
  532            float multiplier = 1f;
 
  533            if (item.IsAir) 
return multiplier;
 
  535                multiplier *= player.modPlayers[index].MeleeSpeedMultiplier(item);
 
  552        public static void GetHealLife(Player player, Item item, 
bool quickHeal, ref 
int healValue) {
 
  557                player.modPlayers[index].GetHealLife(item, quickHeal, ref healValue);
 
  564        public static void GetHealMana(Player player, Item item, 
bool quickHeal, ref 
int healValue) {
 
  569                player.modPlayers[index].GetHealMana(item, quickHeal, ref healValue);
 
  576        public static void ModifyManaCost(Player player, Item item, ref 
float reduce, ref 
float mult) {
 
  581                player.modPlayers[index].ModifyManaCost(item, ref reduce, ref mult);
 
  587        public static void OnMissingMana(Player player, Item item, 
int manaNeeded) {
 
  592                player.modPlayers[index].OnMissingMana(item, manaNeeded);
 
  598        public static void OnConsumeMana(Player player, Item item, 
int manaConsumed) {
 
  603                player.modPlayers[index].OnConsumeMana(item, manaConsumed);
 
  616                player.modPlayers[index].GetWeaponDamage(item, ref damage);
 
  627        public static void ModifyWeaponDamage(Player player, Item item, ref 
float add, ref 
float mult, ref 
float flat) {
 
  632                player.modPlayers[index].ModifyWeaponDamage(item, ref add, ref mult);
 
  635                player.modPlayers[index].ModifyWeaponDamage(item, ref add, ref mult, ref flat);
 
  643                player.modPlayers[index].ProcessTriggers(triggersSet);
 
  655                player.modPlayers[index].GetWeaponKnockback(item, ref knockback);
 
  663            if (item.IsAir) 
return;
 
  665                player.modPlayers[index].GetWeaponCrit(item, ref crit);
 
  671        public static bool ConsumeAmmo(Player player, Item weapon, Item ammo) {
 
  673                if (!player.modPlayers[index].ConsumeAmmo(weapon, ammo)) {
 
  684                player.modPlayers[index].OnConsumeAmmo(weapon, ammo);
 
  687        private delegate 
bool DelegateShoot(Item item, ref Vector2 position, ref 
float speedX, ref 
float speedY, ref 
int type, ref 
int damage, ref 
float knockBack);
 
  690        public static bool Shoot(Player player, Item item, ref Vector2 position, ref 
float speedX, ref 
float speedY, ref 
int type, ref 
int damage, ref 
float knockBack) {
 
  692                if (!player.modPlayers[index].Shoot(item, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack)) {
 
  701        public static void MeleeEffects(Player player, Item item, Rectangle hitbox) {
 
  703                player.modPlayers[index].MeleeEffects(item, hitbox);
 
  709        public static void OnHitAnything(Player player, 
float x, 
float y, Entity victim) {
 
  711                player.modPlayers[index].OnHitAnything(x, y, victim);
 
  717        public static bool? 
CanHitNPC(Player player, Item item, NPC target) {
 
  720                bool? canHit = player.modPlayers[index].CanHitNPC(item, target);
 
  721                if (canHit.HasValue && !canHit.Value) {
 
  724                if (canHit.HasValue) {
 
  731        private delegate 
void DelegateModifyHitNPC(Item item, NPC target, ref 
int damage, ref 
float knockback, ref 
bool crit);
 
  734        public static void ModifyHitNPC(Player player, Item item, NPC target, ref 
int damage, ref 
float knockback, ref 
bool crit) {
 
  736                player.modPlayers[index].ModifyHitNPC(item, target, ref damage, ref knockback, ref crit);
 
  742        public static void OnHitNPC(Player player, Item item, NPC target, 
int damage, 
float knockback, 
bool crit) {
 
  744                player.modPlayers[index].OnHitNPC(item, target, damage, knockback, crit);
 
  751            if (proj.npcProj || proj.trap) {
 
  754            Player player = Main.player[proj.owner];
 
  757                bool? canHit = player.modPlayers[index].CanHitNPCWithProj(proj, target);
 
  758                if (canHit.HasValue && !canHit.Value) {
 
  761                if (canHit.HasValue) {
 
  768        private delegate 
void DelegateModifyHitNPCWithProj(Projectile proj, NPC target, ref 
int damage, ref 
float knockback, ref 
bool crit, ref 
int hitDirection);
 
  771        public static void ModifyHitNPCWithProj(Projectile proj, NPC target, ref 
int damage, ref 
float knockback, ref 
bool crit, ref 
int hitDirection) {
 
  772            if (proj.npcProj || proj.trap) {
 
  775            Player player = Main.player[proj.owner];
 
  777                player.modPlayers[index].ModifyHitNPCWithProj(proj, target, ref damage, ref knockback, ref crit, ref hitDirection);
 
  783        public static void OnHitNPCWithProj(Projectile proj, NPC target, 
int damage, 
float knockback, 
bool crit) {
 
  784            if (proj.npcProj || proj.trap) {
 
  787            Player player = Main.player[proj.owner];
 
  789                player.modPlayers[index].OnHitNPCWithProj(proj, target, damage, knockback, crit);
 
  795        public static bool CanHitPvp(Player player, Item item, Player target) {
 
  797                if (!player.modPlayers[index].CanHitPvp(item, target)) {
 
  807        public static void ModifyHitPvp(Player player, Item item, Player target, ref 
int damage, ref 
bool crit) {
 
  809                player.modPlayers[index].ModifyHitPvp(item, target, ref damage, ref crit);
 
  815        public static void OnHitPvp(Player player, Item item, Player target, 
int damage, 
bool crit) {
 
  817                player.modPlayers[index].OnHitPvp(item, target, damage, crit);
 
  824            Player player = Main.player[proj.owner];
 
  826                if (!player.modPlayers[index].CanHitPvpWithProj(proj, target)) {
 
  837            Player player = Main.player[proj.owner];
 
  839                player.modPlayers[index].ModifyHitPvpWithProj(proj, target, ref damage, ref crit);
 
  845        public static void OnHitPvpWithProj(Projectile proj, Player target, 
int damage, 
bool crit) {
 
  846            Player player = Main.player[proj.owner];
 
  848                player.modPlayers[index].OnHitPvpWithProj(proj, target, damage, crit);
 
  855        public static bool CanBeHitByNPC(Player player, NPC npc, ref 
int cooldownSlot) {
 
  857                if (!player.modPlayers[index].CanBeHitByNPC(npc, ref cooldownSlot)) {
 
  867        public static void ModifyHitByNPC(Player player, NPC npc, ref 
int damage, ref 
bool crit) {
 
  869                player.modPlayers[index].ModifyHitByNPC(npc, ref damage, ref crit);
 
  875        public static void OnHitByNPC(Player player, NPC npc, 
int damage, 
bool crit) {
 
  877                player.modPlayers[index].OnHitByNPC(npc, damage, crit);
 
  885                if (!player.modPlayers[index].CanBeHitByProjectile(proj)) {
 
  897                player.modPlayers[index].ModifyHitByProjectile(proj, ref damage, ref crit);
 
  905                player.modPlayers[index].OnHitByProjectile(proj, damage, crit);
 
  909        private delegate 
void DelegateCatchFish(Item fishingRod, Item bait, 
int power, 
int liquidType, 
int poolSize, 
int worldLayer, 
int questFish, ref 
int caughtType, ref 
bool junk);
 
  912        public static void CatchFish(Player player, Item fishingRod, 
int power, 
int liquidType, 
int poolSize, 
int worldLayer, 
int questFish, ref 
int caughtType, ref 
bool junk) {
 
  915                if (player.inventory[i].stack > 0 && player.inventory[i].bait > 0) {
 
  921                player.modPlayers[index].CatchFish(fishingRod, player.inventory[i], power, liquidType, poolSize, worldLayer, questFish, ref caughtType, ref junk);
 
  928        public static void GetFishingLevel(Player player, Item fishingRod, Item bait, ref 
int fishingLevel) {
 
  930                player.modPlayers[index].GetFishingLevel(fishingRod, bait, ref fishingLevel);
 
  936        public static void AnglerQuestReward(Player player, 
float rareMultiplier, List<Item> rewardItems) {
 
  938                player.modPlayers[index].AnglerQuestReward(rareMultiplier, rewardItems);
 
  946                player.modPlayers[index].GetDyeTraderReward(rewardPool);
 
  956                modPlayers[index].DrawEffects(drawInfo, ref r, ref g, ref b, ref a, ref fullBright);
 
  964            ModPlayer[] modPlayers = drawInfo.drawPlayer.modPlayers;
 
  973            List<PlayerLayer> layers = 
new List<PlayerLayer> {
 
  982            if (drawPlayer.wearsRobe) {
 
  998            if (drawPlayer.mount.Cart) {
 
 1015                layer.visible = 
true;
 
 1018                drawPlayer.modPlayers[index].ModifyDrawLayers(layers);
 
 1026            List<PlayerHeadLayer> layers = 
new List<PlayerHeadLayer> {
 
 1031                PlayerHeadLayer.FaceAcc
 
 1034                layer.visible = 
true;
 
 1037                drawPlayer.modPlayers[index].ModifyDrawHeadLayers(layers);
 
 1046                player.modPlayers[index].ModifyScreenPosition();
 
 1055                player.modPlayers[index].ModifyZoom(ref zoom);
 
 1062            var player = Main.player[playerIndex];
 
 1064                player.modPlayers[index].PlayerConnect(player);
 
 1071            var player = Main.player[playerIndex];
 
 1073                player.modPlayers[index].PlayerDisconnect(player);
 
 1081            var player = Main.player[playerIndex];
 
 1083                player.modPlayers[index].OnEnterWorld(player);
 
 1091                player.modPlayers[index].OnRespawn(player);
 
 1097        public static bool ShiftClickSlot(Player player, Item[] inventory, 
int context, 
int slot) {
 
 1099                if (player.modPlayers[index].ShiftClickSlot(inventory, context, slot)) {
 
 1106        private static bool HasMethod(Type t, 
string method, params Type[] args) {
 
 1107            return t.GetMethod(method, args).DeclaringType != typeof(
ModPlayer);
 
 1110        internal static void VerifyGlobalItem(
ModPlayer player) {
 
 1111            var type = player.GetType();
 
 1113            int netCustomBiomeMethods = 0;
 
 1114            if (
HasMethod(type, 
"CustomBiomesMatch", typeof(Player))) netCustomBiomeMethods++;
 
 1115            if (
HasMethod(type, 
"CopyCustomBiomesTo", typeof(Player))) netCustomBiomeMethods++;
 
 1118            if (netCustomBiomeMethods > 0 && netCustomBiomeMethods < 4)
 
 1119                throw new Exception(type + 
" must override all of (CustomBiomesMatch/CopyCustomBiomesTo/SendCustomBiomes/ReceiveCustomBiomes) or none");
 
 1121            int netClientMethods = 0;
 
 1123            if (
HasMethod(type, 
"SyncPlayer", typeof(
int), typeof(
int), typeof(
bool))) netClientMethods++;
 
 1125            if (netClientMethods > 0 && netClientMethods < 3)
 
 1126                throw new Exception(type + 
" must override all of (clientClone/SyncPlayer/SendClientChanges) or none");
 
 1128            int saveMethods = 0;
 
 1129            if (
HasMethod(type, 
"Save")) saveMethods++;
 
 1131            if (saveMethods == 1)
 
 1132                throw new Exception(type + 
" must override all of (Save/Load) or none");
 
 1137            if (netMethods == 1)
 
 1138                throw new Exception(type + 
" must override both of (NetSend/NetReceive) or none");
 
 1143        public static void PostSellItem(Player player, NPC npc, Item[] shopInventory, Item item) {
 
 1145                player.modPlayers[index].
PostSellItem(npc, shopInventory, item);
 
 1152        public static bool CanSellItem(Player player, NPC npc, Item[] shopInventory, Item item) {
 
 1154                if (!player.modPlayers[index].
CanSellItem(npc, shopInventory, item))
 
 1162        public static void PostBuyItem(Player player, NPC npc, Item[] shopInventory, Item item) {
 
 1164                player.modPlayers[index].
PostBuyItem(npc, shopInventory, item);
 
 1170        public static bool CanBuyItem(Player player, NPC npc, Item[] shopInventory, Item item) {
 
 1172                if (!player.modPlayers[index].
CanBuyItem(npc, shopInventory, item))
 
 1181        public static bool ModifyNurseHeal(Player p, NPC npc, ref 
int health, ref 
bool removeDebuffs, ref 
string chat) {
 
 1183                if (!p.modPlayers[index].ModifyNurseHeal(npc, ref health, ref removeDebuffs, ref chat))
 
 1192        public static void ModifyNursePrice(Player p, NPC npc, 
int health, 
bool removeDebuffs, ref 
int price) {
 
 1194                p.modPlayers[index].ModifyNursePrice(npc, health, removeDebuffs, ref price);
 
 1200        public static void PostNurseHeal(Player player, NPC npc, 
int health, 
bool removeDebuffs, 
int price) {
 
 1202                player.modPlayers[index].
PostNurseHeal(npc, health, removeDebuffs, price);
 
This serves as the central class from which item-related functions are carried out....
 
static float UseTimeMultiplier(Item item, Player player)
 
static float MeleeSpeedMultiplier(Item item, Player player)
 
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
 
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
 
virtual string Name
Stores the name of the mod. This name serves as the mod's identification, and also helps with saving ...
 
This serves as the central class which loads mods. It contains many static fields and methods related...
 
static Mod GetMod(string name)
Gets the instance of the Mod with the specified name.
 
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPla...
 
string Name
The name of this ModPlayer. Used for distinguishing between multiple ModPlayers added by a single Mod...
 
virtual void PostSellItem(NPC vendor, Item[] shopInventory, Item item)
Called whenever the player sells an item to an NPC.
 
virtual void ModifyDrawInfo(ref PlayerDrawInfo drawInfo)
Allows you to modify the drawing parameters of the player before drawing begins.
 
virtual void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price)
Called on the Client after the player heals themselves with the Nurse NPC.
 
virtual void ReceiveCustomBiomes(BinaryReader reader)
Allows you to do things with the custom biome information you send between client and server.
 
virtual void PostBuyItem(NPC vendor, Item[] shopInventory, Item item)
Called whenever the player buys an item from an NPC.
 
virtual void SendCustomBiomes(BinaryWriter writer)
Allows you to send custom biome information between client and server.
 
Mod mod
The mod that added this type of ModPlayer.
 
virtual bool CanSellItem(NPC vendor, Item[] shopInventory, Item item)
Return false to prevent a transaction. Called before the transaction.
 
virtual bool CanBuyItem(NPC vendor, Item[] shopInventory, Item item)
Return false to prevent a transaction. Called before the transaction.
 
This class represents a DrawLayer for the player's map icon, and uses PlayerDrawHeadInfo as its InfoT...
 
static readonly PlayerHeadLayer AltHair
Draws the player's alternate (hat) hair.
 
static readonly PlayerHeadLayer Head
Draws the player's face and eyes.
 
static readonly PlayerHeadLayer Armor
Draws the player's head armor.
 
static readonly PlayerHeadLayer Hair
Draws the player's hair.
 
HookList(MethodInfo method)
 
readonly MethodInfo method
 
This is where all ModPlayer hooks are gathered and called.
 
static HookList HookPreHurt
 
delegate void DelegateModifyNursePrice(NPC npc, int health, bool removeDebuffs, ref int price)
 
static HookList HookGetHealLife
 
delegate void DelegateGetWeaponKnockback(Item item, ref float knockback)
 
delegate void DelegateCatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
 
static void PostUpdateRunSpeeds(Player player)
 
static HookList HookModifyHitNPC
 
static HookList HookPreKill
 
static bool PreHurt(Player player, 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)
 
delegate void DelegateModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
 
static HookList HookModifyScreenPosition
 
static void PreUpdateBuffs(Player player)
 
static HookList HookModifyWeaponDamageOld
 
static HookList HookPostBuyItem
 
static HookList HookPostUpdate
 
static HookList HookModifyHitNPCWithProj
 
delegate void DelegateModifyManaCost(Item item, ref float reduce, ref float mult)
 
static HookList HookSetupStartInventoryOld
 
static bool ShiftClickSlot(Player player, Item[] inventory, int context, int slot)
 
static bool CanHitPvpWithProj(Projectile proj, Player target)
 
static HookList HookPreUpdate
 
static HookList HookSyncPlayer
 
static void PostHurt(Player player, bool pvp, bool quiet, double damage, int hitDirection, bool crit)
 
static float TotalMeleeSpeedMultiplier(Player player, Item item)
 
static HookList HookSetControls
 
delegate void DelegateGetHealLife(Item item, bool quickHeal, ref int healValue)
 
static HookList HookUpdateBiomes
 
static void UpdateBadLifeRegen(Player player)
 
static HookList HookPreUpdateMovement
 
static HookList HookOnHitNPC
 
static HookList HookOnHitByNPC
 
static HookList HookPostUpdateMiscEffects
 
static HookList HookCanBeHitByNPC
 
static HookList HookNaturalLifeRegen
 
static int TotalUseTime(float useTime, Player player, Item item)
 
static void PostBuyItem(Player player, NPC npc, Item[] shopInventory, Item item)
 
static void PostNurseHeal(Player player, NPC npc, int health, bool removeDebuffs, int price)
 
delegate void DelegateGetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel)
 
static void PostSavePlayer(Player player)
 
delegate bool DelegateModifyNurseHeal(NPC npc, ref int health, ref bool removeDebuffs, ref string chatText)
 
static void CopyCustomBiomesTo(Player player, Player other)
 
static HookList HookGetWeaponKnockback
 
static void Kill(Player player, double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
 
static void GetHealLife(Player player, Item item, bool quickHeal, ref int healValue)
 
static HookList HookModifyHitByProjectile
 
static void SyncPlayer(Player player, int toWho, int fromWho, bool newPlayer)
 
static HookList HookGetDyeTraderReward
 
static HookList HookMeleeSpeedMultiplier
 
static HookList HookPostUpdateRunSpeeds
 
static void PreUpdateMovement(Player player)
 
static void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
 
static void UpdateBiomes(Player player)
 
static bool HasMethod(Type t, string method, params Type[] args)
 
static HookList HookOnHitPvp
 
static void PostUpdateBuffs(Player player)
 
static void FrameEffects(Player player)
 
static bool ConsumeAmmo(Player player, Item weapon, Item ammo)
 
static HookList HookCanBeHitByProjectile
 
static HookList HookGetWeaponDamage
 
static HookList HookUseTimeMultiplier
 
static HookList HookModifyHitPvpWithProj
 
static void ModifyNursePrice(Player p, NPC npc, int health, bool removeDebuffs, ref int price)
 
static readonly IList< ModPlayer > players
 
static void Hurt(Player player, bool pvp, bool quiet, double damage, int hitDirection, bool crit)
 
static HookList HookOnHitNPCWithProj
 
static void PostUpdateMiscEffects(Player player)
 
static float MeleeSpeedMultiplier(Player player, Item item)
 
static HookList HookResetEffects
 
static HookList HookPostUpdateEquips
 
static HookList HookModifyNursePrice
 
delegate void DelegateGetWeaponDamage(Item item, ref int damage)
 
static HookList HookOnConsumeMana
 
static void OnEnterWorld(int playerIndex)
 
delegate void DelegateNaturalLifeRegen(ref float regen)
 
static void OnConsumeAmmo(Player player, Item weapon, Item ammo)
 
static HookList HookCustomBiomesMatch
 
static HookList HookGetFishingLevel
 
static HookList HookClientClone
 
static void GetWeaponKnockback(Player player, Item item, ref float knockback)
 
static ? bool CanHitNPCWithProj(Projectile proj, NPC target)
 
static void PlayerConnect(int playerIndex)
 
static HookList HookPostSellItem
 
static void ModifyHitPvp(Player player, Item item, Player target, ref int damage, ref bool crit)
 
static void OnHitPvp(Player player, Item item, Player target, int damage, bool crit)
 
static HookList HookSendCustomBiomes
 
static HookList HookShoot
 
static HookList HookCanHitPvp
 
static HookList HookSendClientChanges
 
static void PostSellItem(Player player, NPC npc, Item[] shopInventory, Item item)
 
static HookList HookCatchFish
 
static void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 
static List< PlayerHeadLayer > GetDrawHeadLayers(Player drawPlayer)
 
static void SetControls(Player player)
 
delegate void DelegateGetHealMana(Item item, bool quickHeal, ref int healValue)
 
static void ModifyHitByProjectile(Player player, Projectile proj, ref int damage, ref bool crit)
 
static void SendCustomBiomes(Player player, BinaryWriter writer)
 
static void AnglerQuestReward(Player player, float rareMultiplier, List< Item > rewardItems)
 
static HookList HookOnHitAnything
 
static HookList HookPlayerConnect
 
static void OnHitByNPC(Player player, NPC npc, int damage, bool crit)
 
static void PreSavePlayer(Player player)
 
static HookList HookPlayerDisconnect
 
static bool CustomBiomesMatch(Player player, Player other)
 
delegate void DelegateModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 
static void UpdateAutopause(Player player)
 
static HookList HookShiftClickSlot
 
static void ModifyZoom(Player player, ref float zoom)
 
delegate bool DelegatePreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
 
static void GetFishingLevel(Player player, Item fishingRod, Item bait, ref int fishingLevel)
 
static void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
 
static HookList HookUpdateVanityAccessories
 
delegate void DelegateDrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
 
static void ModifyHitByNPC(Player player, NPC npc, ref int damage, ref bool crit)
 
static void ReceiveCustomBiomes(Player player, BinaryReader reader)
 
static HookList HookGetWeaponCrit
 
static HookList HookCopyCustomBiomesTo
 
static HookList HookOnHitPvpWithProj
 
static HookList HookModifyNurseHeal
 
static HookList HookCanBuyItem
 
static HookList HookUpdateBadLifeRegen
 
static HookList AddHook< F >(Expression< Func< ModPlayer, F > > func)
 
static float UseTimeMultiplier(Player player, Item item)
 
static void OnConsumeMana(Player player, Item item, int manaConsumed)
 
static HookList HookOnConsumeAmmo
 
static Texture2D GetMapBackgroundImage(Player player)
 
static float TotalUseTimeMultiplier(Player player, Item item)
 
static void PreUpdate(Player player)
 
static void PostItemCheck(Player player)
 
static HookList HookModifyDrawInfo
 
static void ProcessTriggers(Player player, TriggersSet triggersSet)
 
static HookList HookDrawEffects
 
static int TotalMeleeTime(float useAnimation, Player player, Item item)
 
delegate void DelegateModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
 
static bool CanBuyItem(Player player, NPC npc, Item[] shopInventory, Item item)
 
static bool CanHitPvp(Player player, Item item, Player target)
 
static HookList HookPostNurseHeal
 
static HookList HookModifyHitByNPC
 
static bool ModifyNurseHeal(Player p, NPC npc, ref int health, ref bool removeDebuffs, ref string chat)
 
static bool CanSellItem(Player player, NPC npc, Item[] shopInventory, Item item)
 
static void ModifyDrawInfo(ref PlayerDrawInfo drawInfo)
 
static void ModifyHitNPC(Player player, Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
 
static void clientClone(Player player, Player clientClone)
 
static bool PreItemCheck(Player player)
 
delegate bool DelegateCanBeHitByNPC(NPC npc, ref int cooldownSlot)
 
static HookList HookPostUpdateBuffs
 
static void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit)
 
static void NaturalLifeRegen(Player player, ref float regen)
 
delegate bool DelegateShoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 
delegate void DelegateModifyWeaponDamageOld(Item item, ref float add, ref float mult)
 
static HookList HookSetupStartInventory
 
static HookList HookUpdateEquips
 
static HookList HookOnRespawn
 
static HookList HookCanHitPvpWithProj
 
static HookList HookCanHitNPCWithProj
 
static HookList HookOnHitByProjectile
 
delegate void DelegateModifyZoom(ref float zoom)
 
static void CatchFish(Player player, Item fishingRod, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
 
static void UpdateBiomeVisuals(Player player)
 
static void PostUpdate(Player player)
 
delegate bool DelegatePreHurt(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)
 
static HookList HookModifyManaCost
 
static void OnHitByProjectile(Player player, Projectile proj, int damage, bool crit)
 
static HookList HookOnMissingMana
 
static void ModifyManaCost(Player player, Item item, ref float reduce, ref float mult)
 
static void UpdateLifeRegen(Player player)
 
delegate void DelegateUpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff)
 
static HookList HookPostHurt
 
static void PostUpdateEquips(Player player)
 
static HookList HookModifyDrawLayers
 
static void ResetEffects(Player player)
 
static void UpdateVanityAccessories(Player player)
 
static HookList HookGetMapBackgroundImage
 
static void SendClientChanges(Player player, Player clientPlayer)
 
static void OnHitNPC(Player player, Item item, NPC target, int damage, float knockback, bool crit)
 
static HookList HookUpdateAutopause
 
static ? bool CanHitNPC(Player player, Item item, NPC target)
 
delegate void DelegateModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
 
static List< PlayerLayer > GetDrawLayers(Player drawPlayer)
 
static void MeleeEffects(Player player, Item item, Rectangle hitbox)
 
static HookList HookAnglerQuestReward
 
static void ModifyWeaponDamage(Player player, Item item, ref float add, ref float mult, ref float flat)
Calls ModItem.HookModifyWeaponDamage, then all GlobalItem.HookModifyWeaponDamage hooks.
 
static HookList HookMeleeEffects
 
static void GetDyeTraderReward(Player player, List< int > rewardPool)
 
static void PlayerDisconnect(int playerIndex)
 
static bool Shoot(Player player, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 
static void SetStartInventory(Player player, IList< Item > items)
 
static HookList HookProcessTriggers
 
static HookList HookModifyWeaponDamage
 
delegate void DelegateGetWeaponCrit(Item item, ref int crit)
 
static void ModifyScreenPosition(Player player)
 
static IList< Item > SetupStartInventory(Player player, bool mediumcoreDeath=false)
 
static void UpdateDead(Player player)
 
static HookList HookGetHealMana
 
static HookList HookCanHitNPC
 
static HookList HookUpdateDead
 
static void OnRespawn(Player player)
 
static void SetStartInventory(Player player)
 
static bool SendCustomBiomes(ModPlayer modPlayer, BinaryWriter writer)
 
static void GetHealMana(Player player, Item item, bool quickHeal, ref int healValue)
 
static void OnHitAnything(Player player, float x, float y, Entity victim)
 
static HookList HookModifyDrawHeadLayers
 
static HookList HookConsumeAmmo
 
delegate void DelegateModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
 
static HookList HookPreUpdateBuffs
 
static List< HookList > hooks
 
static HookList HookCanSellItem
 
static bool PreKill(Player player, double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
 
static void UpdateEquips(Player player, ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff)
 
static void OnMissingMana(Player player, Item item, int manaNeeded)
 
static bool CanBeHitByNPC(Player player, NPC npc, ref int cooldownSlot)
 
static HookList HookUpdateBiomeVisuals
 
static void GetWeaponCrit(Player player, Item item, ref int crit)
 
static HookList HookPostSavePlayer
 
static HookList HookModifyZoom
 
static HookList HookPreItemCheck
 
static void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
 
static HookList HookFrameEffects
 
static HookList HookUpdateLifeRegen
 
delegate void DelegateModifyDrawInfo(ref PlayerDrawInfo drawInfo)
 
static HookList HookPostItemCheck
 
static HookList HookModifyHitPvp
 
static HookList HookPreSavePlayer
 
static void GetWeaponDamage(Player player, Item item, ref int damage)
 
delegate void DelegateModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat)
 
delegate void DelegateModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
 
static bool CanBeHitByProjectile(Player player, Projectile proj)
 
static HookList HookOnEnterWorld
 
This class represents a DrawLayer for the player, and uses PlayerDrawInfo as its InfoType....
 
static readonly PlayerLayer Legs
Draws the player's leg armor or pants and shoes.
 
static readonly PlayerLayer MountBack
Draws the back textures of the player's mount. Also draws the player's magic carpet.
 
static readonly PlayerLayer MiscEffectsFront
Draws miscellaneous effects in front of the player.
 
static readonly PlayerLayer Face
Draws the player's face and eyes.
 
static readonly PlayerLayer SolarShield
Draws the player's solar shield if the player has one.
 
static readonly PlayerLayer NeckAcc
Draws the player's neck accessory.
 
static readonly PlayerLayer FrontAcc
Draws the player's front accessory.
 
static readonly PlayerLayer BackAcc
Draws the player's back accessory and held item's backpack.
 
static readonly PlayerLayer FaceAcc
Draws the player's face accessory.
 
static readonly PlayerLayer Wings
Draws the layer's wings.
 
static readonly PlayerLayer Hair
Draws the player's hair.
 
static readonly PlayerLayer HeldProjFront
Draws the player's held projectile if it should be drawn in front of the held item and arms.
 
static readonly PlayerLayer HairBack
Draws the player's hair. To be honest this layer seems kind of useless.
 
static readonly PlayerLayer Arms
Draws the player's arms (including the armor's arms if applicable).
 
static readonly PlayerLayer Head
Draws the player's head armor.
 
static readonly PlayerLayer WaistAcc
Draws the player's waist accessory.
 
static readonly PlayerLayer BalloonAcc
Draws the player's balloon accessory.
 
static readonly PlayerLayer ShieldAcc
Draws the player's shield accessory.
 
static readonly PlayerLayer HeldItem
Draws the player's held item.
 
static readonly PlayerLayer Body
Draws the player's body armor or shirts.
 
static readonly PlayerLayer HandOnAcc
Draws the player's hand on accessory. Also draws the player's held item if the player is in the middl...
 
static readonly PlayerLayer ShoeAcc
Draws the player's shoe accessory.
 
static readonly PlayerLayer HandOffAcc
Draws the player's hand off accessory.
 
static readonly PlayerLayer HeldProjBack
Draws the player's held projectile if it should be drawn behind the held item and arms.
 
static readonly PlayerLayer MiscEffectsBack
Draws miscellaneous effects behind the player.
 
static readonly PlayerLayer MountFront
Draws the front textures of the player's mount. Also draws the pulley if the player is hanging on a r...
 
A struct that contains information that may help with PlayerLayer drawing.
 
Player drawPlayer
The player that is being drawn.