tModLoader v0.11.8.9
A mod to make and play Terraria mods
GlobalItem.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.Collections.ObjectModel;
6using System.IO;
8using Terraria.Utilities;
9
10namespace Terraria.ModLoader
11{
15 public class GlobalItem
16 {
20 public Mod mod {
21 get;
22 internal set;
23 }
24
28 public string Name {
29 get;
30 internal set;
31 }
32
33 internal int index;
34 internal int instanceIndex;
35
39 public virtual bool Autoload(ref string name) {
40 return mod.Properties.Autoload;
41 }
42
48 public virtual bool InstancePerEntity => false;
49
50 public GlobalItem Instance(Item item) => InstancePerEntity ? item.globalItems[instanceIndex] : this;
51
56 public virtual bool CloneNewInstances => false;
57
63 public virtual GlobalItem Clone() => (GlobalItem)MemberwiseClone();
64
71 public virtual GlobalItem Clone(Item item, Item itemClone) => NewInstance(item);
72
79 public virtual GlobalItem NewInstance(Item item) {
81 return Clone();
82
83 var copy = (GlobalItem)Activator.CreateInstance(GetType());
84 copy.mod = mod;
85 copy.Name = Name;
86 copy.index = index; //not necessary, but consistency
87 copy.instanceIndex = instanceIndex;//shouldn't be used, but someone might
88 return copy;
89 }
90
94 public virtual void SetDefaults(Item item) {
95 }
96
101 public virtual int ChoosePrefix(Item item, UnifiedRandom rand) => -1;
102
116 public virtual bool? PrefixChance(Item item, int pre, UnifiedRandom rand) => null;
117
121 public virtual bool AllowPrefix(Item item, int pre) => true;
122
126 public virtual bool CanUseItem(Item item, Player player) {
127 return true;
128 }
129
133 public virtual void UseStyle(Item item, Player player) {
134 }
135
139 public virtual void HoldStyle(Item item, Player player) {
140 }
141
145 public virtual void HoldItem(Item item, Player player) {
146 }
147
152 public virtual float UseTimeMultiplier(Item item, Player player) {
153 return 1f;
154 }
155
160 public virtual float MeleeSpeedMultiplier(Item item, Player player) {
161 return 1f;
162 }
163
171 public virtual void GetHealLife(Item item, Player player, bool quickHeal, ref int healValue) {
172 }
173
181 public virtual void GetHealMana(Item item, Player player, bool quickHeal, ref int healValue) {
182 }
183
191 public virtual void ModifyManaCost(Item item, Player player, ref float reduce, ref float mult) {
192 }
193
202 public virtual void OnMissingMana(Item item, Player player, int neededMana) {
203 }
204
211 public virtual void OnConsumeMana(Item item, Player player, int manaConsumed) {
212 }
213
224 [Obsolete("Use ModifyWeaponDamage", true)]
225 public virtual void GetWeaponDamage(Item item, Player player, ref int damage) {
226 }
227
235 [Obsolete("Use ModifyWeaponDamage overload with the additional flat parameter")]
236 public virtual void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult) {
237 }
238
247 public virtual void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat) {
248 }
249
260 public virtual void GetWeaponKnockback(Item item, Player player, ref float knockback) {
261 }
262
274 public virtual void GetWeaponCrit(Item item, Player player, ref int crit) {
275 }
276
287 public virtual void PickAmmo(Item weapon, Item ammo, Player player, ref int type, ref float speed, ref int damage, ref float knockback) {
288 }
289
290 [Obsolete("PickAmmo now has a weapon parameter that represents the item using the ammo.")]
291 public virtual void PickAmmo(Item item, Player player, ref int type, ref float speed, ref int damage, ref float knockback) {
292 }
293
298 public virtual bool ConsumeAmmo(Item item, Player player) {
299 return true;
300 }
301
306 public virtual void OnConsumeAmmo(Item item, Player player) {
307 }
308
321 public virtual bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) {
322 return true;
323 }
324
328 public virtual void UseItemHitbox(Item item, Player player, ref Rectangle hitbox, ref bool noHitbox) {
329 }
330
334 public virtual void MeleeEffects(Item item, Player player, Rectangle hitbox) {
335 }
336
340 public virtual bool? CanHitNPC(Item item, Player player, NPC target) {
341 return null;
342 }
343
347 public virtual void ModifyHitNPC(Item item, Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) {
348 }
349
353 public virtual void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit) {
354 }
355
359 public virtual bool CanHitPvp(Item item, Player player, Player target) {
360 return true;
361 }
362
366 public virtual void ModifyHitPvp(Item item, Player player, Player target, ref int damage, ref bool crit) {
367 }
368
372 public virtual void OnHitPvp(Item item, Player player, Player target, int damage, bool crit) {
373 }
374
378 public virtual bool UseItem(Item item, Player player) {
379 return false;
380 }
381
386 public virtual bool ConsumeItem(Item item, Player player) {
387 return true;
388 }
389
394 public virtual void OnConsumeItem(Item item, Player player) {
395 }
396
400 public virtual bool UseItemFrame(Item item, Player player) {
401 return false;
402 }
403
407 public virtual bool HoldItemFrame(Item item, Player player) {
408 return false;
409 }
410
414 public virtual bool AltFunctionUse(Item item, Player player) {
415 return false;
416 }
417
421 public virtual void UpdateInventory(Item item, Player player) {
422 }
423
427 public virtual void UpdateEquip(Item item, Player player) {
428 }
429
433 public virtual void UpdateAccessory(Item item, Player player, bool hideVisual) {
434 }
435
443 public virtual string IsArmorSet(Item head, Item body, Item legs) {
444 return "";
445 }
446
453 public virtual void UpdateArmorSet(Player player, string set) {
454 }
455
463 public virtual string IsVanitySet(int head, int body, int legs) {
464 Item headItem = new Item();
465 if (head >= 0) {
466 headItem.SetDefaults(Item.headType[head], true);
467 }
468 Item bodyItem = new Item();
469 if (body >= 0) {
470 bodyItem.SetDefaults(Item.bodyType[body], true);
471 }
472 Item legItem = new Item();
473 if (legs >= 0) {
474 legItem.SetDefaults(Item.legType[legs], true);
475 }
476 return IsArmorSet(headItem, bodyItem, legItem);
477 }
478
485 public virtual void PreUpdateVanitySet(Player player, string set) {
486 }
487
493 public virtual void UpdateVanitySet(Player player, string set) {
494 }
495
502 public virtual void ArmorSetShadows(Player player, string set) {
503 }
504
517 public virtual void SetMatch(int armorSlot, int type, bool male, ref int equipSlot, ref bool robes) {
518 }
519
523 public virtual bool CanRightClick(Item item) {
524 return false;
525 }
526
530 public virtual void RightClick(Item item, Player player) {
531 }
532
542 public virtual bool PreOpenVanillaBag(string context, Player player, int arg) {
543 return true;
544 }
545
555 public virtual void OpenVanillaBag(string context, Player player, int arg) {
556 }
557
563 public virtual bool ReforgePrice(Item item, ref int reforgePrice, ref bool canApplyDiscount) {
564 return true;
565 }
566
572 public virtual bool NewPreReforge(Item item) {
573 return true;
574 }
575
576 // @todo: PreReforge marked obsolete until v0.11
577 [method: Obsolete("PreReforge now returns a bool to control whether the reforge takes place. For now, use NewPreReforge")]
578 public virtual void PreReforge(Item item) {
579 NewPreReforge(item);
580 }
581
586 public virtual void PostReforge(Item item) {
587 }
588
595 public virtual void DrawHands(int body, ref bool drawHands, ref bool drawArms) {
596 }
597
603 public virtual void DrawHair(int head, ref bool drawHair, ref bool drawAltHair) {
604 }
605
611 public virtual bool DrawHead(int head) {
612 return true;
613 }
614
620 public virtual bool DrawBody(int body) {
621 return true;
622 }
623
629 public virtual bool DrawLegs(int legs, int shoes) {
630 return true;
631 }
632
638 public virtual void DrawArmorColor(EquipType type, int slot, Player drawPlayer, float shadow, ref Color color,
639 ref int glowMask, ref Color glowMaskColor) {
640 }
641
647 public virtual void ArmorArmGlowMask(int slot, Player drawPlayer, float shadow, ref int glowMask, ref Color color) {
648 }
649
653 public virtual void VerticalWingSpeeds(Item item, Player player, ref float ascentWhenFalling, ref float ascentWhenRising,
654 ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) {
655 }
656
660 public virtual void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) {
661 }
662
671 public virtual bool WingUpdate(int wings, Player player, bool inUse) {
672 return false;
673 }
674
678 public virtual void Update(Item item, ref float gravity, ref float maxFallSpeed) {
679 }
680
684 public virtual bool CanBurnInLava(Item item) {
685 return false;
686 }
687
691 public virtual void PostUpdate(Item item) {
692 }
693
697 public virtual void GrabRange(Item item, Player player, ref int grabRange) {
698 }
699
703 public virtual bool GrabStyle(Item item, Player player) {
704 return false;
705 }
706
710 public virtual bool CanPickup(Item item, Player player) {
711 return true;
712 }
713
717 public virtual bool OnPickup(Item item, Player player) {
718 return true;
719 }
720
724 public virtual bool ItemSpace(Item item, Player player) {
725 return false;
726 }
727
731 public virtual Color? GetAlpha(Item item, Color lightColor) {
732 return null;
733 }
734
738 public virtual bool PreDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) {
739 return true;
740 }
741
745 public virtual void PostDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) {
746 }
747
751 public virtual bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame,
752 Color drawColor, Color itemColor, Vector2 origin, float scale) {
753 return true;
754 }
755
759 public virtual void PostDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame,
760 Color drawColor, Color itemColor, Vector2 origin, float scale) {
761 }
762
771 public virtual Vector2? HoldoutOffset(int type) {
772 return null;
773 }
774
782 public virtual Vector2? HoldoutOrigin(int type) {
783 return null;
784 }
785
792 public virtual bool CanEquipAccessory(Item item, Player player, int slot) {
793 return true;
794 }
795
803 public virtual void ExtractinatorUse(int extractType, ref int resultType, ref int resultStack) {
804 }
805
809 public virtual void CaughtFishStack(int type, ref int stack) {
810 }
811
818 public virtual bool IsAnglerQuestAvailable(int type) {
819 return true;
820 }
821
828 public virtual void AnglerChat(int type, ref string chat, ref string catchLocation) {
829 }
830
834 public virtual void AddRecipes() {
835 }
836
840 public virtual void OnCraft(Item item, Recipe recipe) {
841 }
842
851 public virtual bool PreDrawTooltip(Item item, ReadOnlyCollection<TooltipLine> lines, ref int x, ref int y) {
852 return true;
853 }
854
860 public virtual void PostDrawTooltip(Item item, ReadOnlyCollection<DrawableTooltipLine> lines) {
861 }
862
870 public virtual bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) {
871 return true;
872 }
873
879 public virtual void PostDrawTooltipLine(Item item, DrawableTooltipLine line) {
880 }
881
885 public virtual void ModifyTooltips(Item item, List<TooltipLine> tooltips) {
886 }
887
891 public virtual bool NeedsSaving(Item item) {
892 return false;
893 }
894
898 public virtual TagCompound Save(Item item) {
899 return null;
900 }
901
905 public virtual void Load(Item item, TagCompound tag) {
906 }
907
911 public virtual void LoadLegacy(Item item, BinaryReader reader) {
912 }
913
917 public virtual void NetSend(Item item, BinaryWriter writer) {
918 }
919
923 public virtual void NetReceive(Item item, BinaryReader reader) {
924 }
925 }
926}
This class serves as a way to store information about a line that will be drawn of tooltip for an ite...
This class allows you to modify and use hooks for all items, including vanilla items....
Definition: GlobalItem.cs:16
virtual void PickAmmo(Item weapon, Item ammo, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
Allows you to modify the projectile created by a weapon based on the ammo it is using.
Definition: GlobalItem.cs:287
virtual void NetSend(Item item, BinaryWriter writer)
Allows you to send custom data for the given item between client and server.
Definition: GlobalItem.cs:917
virtual void DrawHands(int body, ref bool drawHands, ref bool drawArms)
Allows you to determine whether the skin/shirt on the player's arms and hands are drawn when a body a...
Definition: GlobalItem.cs:595
virtual void DrawArmorColor(EquipType type, int slot, Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor)
Allows you to modify the colors in which the player's armor and their surrounding accessories are dra...
Definition: GlobalItem.cs:638
virtual void GrabRange(Item item, Player player, ref int grabRange)
Allows you to modify how close an item must be to the player in order to move towards the player.
Definition: GlobalItem.cs:697
virtual void OpenVanillaBag(string context, Player player, int arg)
Allows you to make vanilla bags drop your own items in addition to the default items....
Definition: GlobalItem.cs:555
virtual void ExtractinatorUse(int extractType, ref int resultType, ref int resultStack)
Allows you to modify what item, and in what quantity, is obtained when an item of the given type is f...
Definition: GlobalItem.cs:803
virtual void OnHitPvp(Item item, Player player, Player target, int damage, bool crit)
Allows you to create special effects when a melee weapon hits a player.
Definition: GlobalItem.cs:372
virtual bool PreDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
Allows you to draw things behind an item, or to modify the way an item is drawn in the world....
Definition: GlobalItem.cs:738
virtual void HoldStyle(Item item, Player player)
Allows you to modify the location and rotation of the item the player is currently holding.
Definition: GlobalItem.cs:139
virtual void UpdateEquip(Item item, Player player)
Allows you to give effects to armors and accessories, such as increased damage.
Definition: GlobalItem.cs:427
virtual ? Color GetAlpha(Item item, Color lightColor)
Allows you to determine the color and transparency in which an item is drawn. Return null to use the ...
Definition: GlobalItem.cs:731
virtual void OnCraft(Item item, Recipe recipe)
Allows you to make anything happen when the player crafts the given item using the given recipe.
Definition: GlobalItem.cs:840
virtual void Load(Item item, TagCompound tag)
Allows you to load custom data that you have saved for the given item.
Definition: GlobalItem.cs:905
virtual void OnConsumeAmmo(Item item, Player player)
Allows you to make things happen when ammo is consumed. Called both by the gun and by the ammo....
Definition: GlobalItem.cs:306
virtual bool WingUpdate(int wings, Player player, bool inUse)
Allows for Wings to do various things while in use. "inUse" is whether or not the jump button is curr...
Definition: GlobalItem.cs:671
virtual void PreUpdateVanitySet(Player player, string set)
Allows you to create special effects (such as the necro armor's hurt noise) when the player wears the...
Definition: GlobalItem.cs:485
virtual bool CanBurnInLava(Item item)
Returns whether or not this item burns when it is thrown into lava despite item.rare not being 0....
Definition: GlobalItem.cs:684
virtual float UseTimeMultiplier(Item item, Player player)
Allows you to change the effective useTime of an item.
Definition: GlobalItem.cs:152
virtual bool DrawHead(int head)
Return false to hide the player's head when a head armor is worn. Returns true by default....
Definition: GlobalItem.cs:611
virtual void GetWeaponKnockback(Item item, Player player, ref float knockback)
Allows you to temporarily modify this weapon's knockback based on player buffs, etc....
Definition: GlobalItem.cs:260
virtual void GetWeaponCrit(Item item, Player player, ref int crit)
Allows you to temporarily modify this weapon's crit chance based on player buffs, etc....
Definition: GlobalItem.cs:274
virtual void UpdateInventory(Item item, Player player)
Allows you to make things happen when an item is in the player's inventory (for example,...
Definition: GlobalItem.cs:421
virtual ? bool PrefixChance(Item item, int pre, UnifiedRandom rand)
To prevent putting the item in the tinkerer slot, return false when pre is -3. To prevent rolling of ...
virtual bool CanUseItem(Item item, Player player)
Returns whether or not any item can be used. Returns true by default. The inability to use a specific...
Definition: GlobalItem.cs:126
virtual bool UseItemFrame(Item item, Player player)
Allows you to modify the player's animation when an item is being used. Return true if you modify the...
Definition: GlobalItem.cs:400
virtual void PostDrawTooltipLine(Item item, DrawableTooltipLine line)
Allows you to do things after a tooltip line of this item is drawn. The line contains draw info.
Definition: GlobalItem.cs:879
virtual void NetReceive(Item item, BinaryReader reader)
Definition: GlobalItem.cs:923
virtual bool InstancePerEntity
Whether to create a new GlobalItem instance for every Item that exists. Useful for storing informatio...
Definition: GlobalItem.cs:48
virtual void PreReforge(Item item)
Definition: GlobalItem.cs:578
virtual bool AltFunctionUse(Item item, Player player)
Allows you to make an item usable by right-clicking. Returns false by default. When the item is used ...
Definition: GlobalItem.cs:414
virtual void OnConsumeItem(Item item, Player player)
Allows you to make things happen when this item is consumed. Called before the item stack is reduced.
Definition: GlobalItem.cs:394
virtual bool ReforgePrice(Item item, ref int reforgePrice, ref bool canApplyDiscount)
Returns if the normal reforge pricing is applied. If true or false is returned and the price is alter...
Definition: GlobalItem.cs:563
virtual bool ConsumeAmmo(Item item, Player player)
Whether or not ammo will be consumed upon usage. Called both by the gun and by the ammo; if at least ...
Definition: GlobalItem.cs:298
string Name
The name of this GlobalItem instance.
Definition: GlobalItem.cs:28
virtual void PostDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
Allows you to draw things in front of an item. This method is called even if PreDrawInWorld returns f...
Definition: GlobalItem.cs:745
virtual ? Vector2 HoldoutOffset(int type)
Allows you to determine the offset of an item's sprite when used by the player. This is only used for...
Definition: GlobalItem.cs:771
virtual bool Autoload(ref string name)
Allows you to automatically load a GlobalItem instead of using Mod.AddGlobalItem. Return true to allo...
Definition: GlobalItem.cs:39
virtual ? bool CanHitNPC(Item item, Player player, NPC target)
Allows you to determine whether a melee weapon can hit the given NPC when swung. Return true to allow...
Definition: GlobalItem.cs:340
virtual void ModifyHitNPC(Item item, Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
Allows you to modify the damage, knockback, etc., that a melee weapon does to an NPC.
Definition: GlobalItem.cs:347
virtual bool IsAnglerQuestAvailable(int type)
Whether or not specific conditions have been satisfied for the Angler to be able to request the given...
Definition: GlobalItem.cs:818
virtual void CaughtFishStack(int type, ref int stack)
Allows you to modify how many of an item a player obtains when the player fishes that item.
Definition: GlobalItem.cs:809
virtual void PostDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
Allows you to draw things in front of an item in the inventory. This method is called even if PreDraw...
Definition: GlobalItem.cs:759
virtual TagCompound Save(Item item)
Allows you to save custom data for the given item. Only called when NeedsCustomSaving returns true....
Definition: GlobalItem.cs:898
virtual void PostDrawTooltip(Item item, ReadOnlyCollection< DrawableTooltipLine > lines)
Allows you to do things after this item's tooltip is drawn. The lines contain draw information as thi...
Definition: GlobalItem.cs:860
virtual void Update(Item item, ref float gravity, ref float maxFallSpeed)
Allows you to customize an item's movement when lying in the world. Note that this will not be called...
Definition: GlobalItem.cs:678
virtual void RightClick(Item item, Player player)
Allows you to make things happen when an item is right-clicked in the inventory. Useful for goodie ba...
Definition: GlobalItem.cs:530
virtual float MeleeSpeedMultiplier(Item item, Player player)
Allows you to change the effective useAnimation of an item.
Definition: GlobalItem.cs:160
virtual void LoadLegacy(Item item, BinaryReader reader)
Allows you to load pre-v0.9 custom data that you have saved for the given item.
Definition: GlobalItem.cs:911
virtual void ModifyTooltips(Item item, List< TooltipLine > tooltips)
Allows you to modify all the tooltips that display for the given item. See here for information about...
Definition: GlobalItem.cs:885
virtual void PostReforge(Item item)
This hook gets called immediately after an item gets reforged by the Goblin Tinkerer....
Definition: GlobalItem.cs:586
virtual bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
This is called before the weapon creates a projectile. You can use it to create special effects,...
Definition: GlobalItem.cs:321
virtual void PickAmmo(Item item, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
Definition: GlobalItem.cs:291
virtual bool CloneNewInstances
Whether instances of this GlobalItem are created through Clone or constructor (by default implementat...
Definition: GlobalItem.cs:56
virtual void UpdateArmorSet(Player player, string set)
Allows you to give set bonuses to your armor set with the given name. The set name will be the same a...
Definition: GlobalItem.cs:453
virtual void OnMissingMana(Item item, Player player, int neededMana)
Allows you to make stuff happen when a player doesn't have enough mana for an item they are trying to...
Definition: GlobalItem.cs:202
virtual bool PreOpenVanillaBag(string context, Player player, int arg)
Allows you to make vanilla bags drop your own items and stop the default items from being dropped....
Definition: GlobalItem.cs:542
virtual void SetMatch(int armorSlot, int type, bool male, ref int equipSlot, ref bool robes)
Allows you to modify the equipment that the player appears to be wearing.
Definition: GlobalItem.cs:517
virtual bool CanEquipAccessory(Item item, Player player, int slot)
Allows you to disallow the player from equipping an accessory. Return false to disallow equipping the...
Definition: GlobalItem.cs:792
virtual void ModifyManaCost(Item item, Player player, 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: GlobalItem.cs:191
virtual void ModifyHitPvp(Item item, Player player, Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that a melee weapon does to a player.
Definition: GlobalItem.cs:366
virtual bool GrabStyle(Item item, Player player)
Allows you to modify the way an item moves towards the player. Return false to allow the vanilla grab...
Definition: GlobalItem.cs:703
virtual void PostUpdate(Item item)
Allows you to make things happen when an item is lying in the world. This will always be called,...
Definition: GlobalItem.cs:691
virtual bool NewPreReforge(Item item)
This hook gets called when the player clicks on the reforge button and can afford the reforge....
Definition: GlobalItem.cs:572
virtual bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
Allows you to draw things behind an item in the inventory. Return false to stop the game from drawing...
Definition: GlobalItem.cs:751
virtual bool OnPickup(Item item, Player player)
Allows you to make special things happen when the player picks up an item. Return false to stop the i...
Definition: GlobalItem.cs:717
virtual bool CanRightClick(Item item)
Returns whether or not an item does something when right-clicked in the inventory....
Definition: GlobalItem.cs:523
virtual string IsArmorSet(Item head, Item body, Item legs)
Allows you to determine whether the player is wearing an armor set, and return a name for this set....
Definition: GlobalItem.cs:443
virtual void ArmorSetShadows(Player player, string set)
Allows you to determine special visual effects a vanity has on the player without having to code them...
Definition: GlobalItem.cs:502
virtual bool NeedsSaving(Item item)
Whether or not the given item needs to save custom data. Returning false will save on the memory used...
Definition: GlobalItem.cs:891
virtual GlobalItem Clone()
Returns a clone of this GlobalItem. By default this will return a memberwise clone; you will want to ...
virtual bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset)
Allows you to do things before a tooltip line of this item is drawn. The line contains draw info.
Definition: GlobalItem.cs:870
virtual bool CanHitPvp(Item item, Player player, Player target)
Allows you to determine whether a melee weapon can hit the given opponent player when swung....
Definition: GlobalItem.cs:359
virtual bool CanPickup(Item item, Player player)
Allows you to determine whether or not the item can be picked up
Definition: GlobalItem.cs:710
virtual void ModifyWeaponDamage(Item item, Player player, 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: GlobalItem.cs:247
virtual void GetHealMana(Item item, Player player, bool quickHeal, ref int healValue)
Allows you to temporarily modify the amount of mana a mana healing item will heal for,...
Definition: GlobalItem.cs:181
virtual void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
Allows you to create special effects when a melee weapon hits an NPC (for example how the Pumpkin Swo...
Definition: GlobalItem.cs:353
virtual int ChoosePrefix(Item item, UnifiedRandom rand)
Allows you to manually choose what prefix an item will get.
virtual void DrawHair(int head, ref bool drawHair, ref bool drawAltHair)
Allows you to determine whether the player's hair or alt (hat) hair will be drawn when a head armor i...
Definition: GlobalItem.cs:603
virtual void ArmorArmGlowMask(int slot, Player drawPlayer, float shadow, ref int glowMask, ref Color color)
Allows you to modify which glow mask and in what color is drawn on the player's arms....
Definition: GlobalItem.cs:647
virtual void UpdateAccessory(Item item, Player player, bool hideVisual)
Allows you to give effects to accessories. The hideVisual parameter is whether the player has marked ...
Definition: GlobalItem.cs:433
virtual bool HoldItemFrame(Item item, Player player)
Allows you to modify the player's animation when the player is holding an item. Return true if you mo...
Definition: GlobalItem.cs:407
virtual void HoldItem(Item item, Player player)
Allows you to make things happen when the player is holding an item (for example, torches make light ...
Definition: GlobalItem.cs:145
virtual void UseItemHitbox(Item item, Player player, ref Rectangle hitbox, ref bool noHitbox)
Changes the hitbox of a melee weapon when it is used.
Definition: GlobalItem.cs:328
virtual void AddRecipes()
This is essentially the same as Mod.AddRecipes or ModItem.AddRecipes. Use whichever method makes orga...
Definition: GlobalItem.cs:834
virtual void SetDefaults(Item item)
Allows you to set the properties of any and every item that gets created.
Definition: GlobalItem.cs:94
virtual bool ConsumeItem(Item item, Player player)
If the item is consumable and this returns true, then the item will be consumed upon usage....
Definition: GlobalItem.cs:386
virtual void UseStyle(Item item, Player player)
Allows you to modify the location and rotation of any item in its use animation.
Definition: GlobalItem.cs:133
virtual bool UseItem(Item item, Player player)
Allows you to make things happen when an item is used. Return true if using the item actually does st...
Definition: GlobalItem.cs:378
virtual void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration)
Allows you to modify the horizontal flight speed and acceleration of wings.
Definition: GlobalItem.cs:660
virtual GlobalItem NewInstance(Item item)
Create a new instance of this GlobalItem for an Item instance. Called at the end of Item....
Definition: GlobalItem.cs:79
virtual bool AllowPrefix(Item item, int pre)
Force a re-roll of a prefix by returning false.
virtual void AnglerChat(int type, ref string chat, ref string catchLocation)
Allows you to set what the Angler says when the Quest button is clicked in his chat....
Definition: GlobalItem.cs:828
virtual void UpdateVanitySet(Player player, string set)
Allows you to create special effects (such as dust) when the player wears the vanity set with the giv...
Definition: GlobalItem.cs:493
virtual void OnConsumeMana(Item item, Player player, int manaConsumed)
Allows you to make stuff happen when a player consumes mana on use of an item.
Definition: GlobalItem.cs:211
virtual GlobalItem Clone(Item item, Item itemClone)
Create a copy of this instanced GlobalItem. Called when an item is cloned. Defaults to NewInstance(it...
virtual void VerticalWingSpeeds(Item item, Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
Allows you to modify the speeds at which you rise and fall when wings are equipped.
Definition: GlobalItem.cs:653
virtual bool DrawLegs(int legs, int shoes)
Return false to hide the player's legs when a leg armor or shoe accessory is worn....
Definition: GlobalItem.cs:629
virtual void GetHealLife(Item item, Player player, bool quickHeal, ref int healValue)
Allows you to temporarily modify the amount of life a life healing item will heal for,...
Definition: GlobalItem.cs:171
virtual bool PreDrawTooltip(Item item, ReadOnlyCollection< TooltipLine > lines, ref int x, ref int y)
Allows you to do things before this item's tooltip is drawn.
Definition: GlobalItem.cs:851
virtual ? Vector2 HoldoutOrigin(int type)
Allows you to determine the point on an item's sprite that the player holds onto when using the item....
Definition: GlobalItem.cs:782
virtual void MeleeEffects(Item item, Player player, Rectangle hitbox)
Allows you to give melee weapons special effects, such as creating light or dust.
Definition: GlobalItem.cs:334
virtual bool ItemSpace(Item item, Player player)
Return true to specify that the item can be picked up despite not having enough room in inventory....
Definition: GlobalItem.cs:724
virtual void GetWeaponDamage(Item item, Player player, ref int damage)
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for ...
Definition: GlobalItem.cs:225
virtual bool DrawBody(int body)
Return false to hide the player's body when a body armor is worn. Returns true by default....
Definition: GlobalItem.cs:620
virtual void ModifyWeaponDamage(Item item, Player player, 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: GlobalItem.cs:236
GlobalItem Instance(Item item)
Mod mod
The mod to which this GlobalItem belongs.
Definition: GlobalItem.cs:20
virtual string IsVanitySet(int head, int body, int legs)
Returns whether or not the head armor, body armor, and leg armor textures make up a set....
Definition: GlobalItem.cs:463
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
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:7
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...