tModLoader  0.12 Alpha
A mod to make and play Terraria mods
Terraria.ModLoader.ModPrefix Class Reference

Inherits Terraria.ModLoader.ModType.

Public Member Functions

virtual void Apply (Item item)
 Applies the custom data stats set in SetStats to the given item. More...
 
virtual void AutoStaticDefaults ()
 
virtual bool CanRoll (Item item)
 Returns if your ModPrefix can roll on the given item By default returns RollChance(item) > 0 More...
 
virtual void ModifyValue (ref float valueMult)
 Allows you to modify the sell price of the item based on the prefix or changes in custom data stats. This also influences the item's rarity. More...
 
virtual float RollChance (Item item)
 The roll chance of your prefix relative to a vanilla prefix, 1f by default. More...
 
virtual void SetStats (ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus)
 Sets the stat changes for this prefix. If data is not already pre-stored, it is best to store custom data changes to some static variables. More...
 
sealed override void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. More...
 
virtual void ValidateItem (Item item, ref bool invalid)
 Validates whether this prefix with the custom data stats set from SetStats is allowed on the given item. It is not allowed if one of the stat changes do not cause any change (eg. percentage being too small to make a difference). More...
 
- Public Member Functions inherited from Terraria.ModLoader.ModType
virtual bool IsLoadingEnabled (Mod mod)
 Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More...
 
virtual void Load ()
 Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More...
 
virtual void SetStaticDefaults ()
 Allows you to modify the properties after initial loading has completed. More...
 
virtual void Unload ()
 Allows you to safely unload things you added in Load. More...
 

Protected Member Functions

sealed override void Register ()
 If you make a new ModType, seal this override. More...
 

Properties

virtual PrefixCategory Category [get]
 The category your prefix belongs to, PrefixCategory.Custom by default More...
 
ModTranslation DisplayName [get, set]
 
int Type [get, set]
 
- Properties inherited from Terraria.ModLoader.ModType
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
Mod Mod [get, set]
 The mod this belongs to. More...
 
virtual string Name [get]
 The internal name of this. More...
 
- Properties inherited from Terraria.ModLoader.IModType
string FullName [get]
 => $"{Mod.Name}/{Name}" More...
 
Mod Mod [get]
 The mod this belongs to. More...
 
string Name [get]
 The internal name of this instance. More...
 

Member Function Documentation

◆ Apply()

virtual void Terraria.ModLoader.ModPrefix.Apply ( Item  item)
virtual

Applies the custom data stats set in SetStats to the given item.

◆ CanRoll()

virtual bool Terraria.ModLoader.ModPrefix.CanRoll ( Item  item)
virtual

Returns if your ModPrefix can roll on the given item By default returns RollChance(item) > 0

◆ ModifyValue()

virtual void Terraria.ModLoader.ModPrefix.ModifyValue ( ref float  valueMult)
virtual

Allows you to modify the sell price of the item based on the prefix or changes in custom data stats. This also influences the item's rarity.

◆ Register()

sealed override void Terraria.ModLoader.ModPrefix.Register ( )
protectedvirtual

If you make a new ModType, seal this override.

Implements Terraria.ModLoader.ModType.

◆ RollChance()

virtual float Terraria.ModLoader.ModPrefix.RollChance ( Item  item)
virtual

The roll chance of your prefix relative to a vanilla prefix, 1f by default.

◆ SetStats()

virtual void Terraria.ModLoader.ModPrefix.SetStats ( ref float  damageMult,
ref float  knockbackMult,
ref float  useTimeMult,
ref float  scaleMult,
ref float  shootSpeedMult,
ref float  manaMult,
ref int  critBonus 
)
virtual

Sets the stat changes for this prefix. If data is not already pre-stored, it is best to store custom data changes to some static variables.

◆ SetupContent()

sealed override void Terraria.ModLoader.ModPrefix.SetupContent ( )
virtual

If you make a new ModType, seal this override, and call SetStaticDefaults in it.

Reimplemented from Terraria.ModLoader.ModType.

◆ ValidateItem()

virtual void Terraria.ModLoader.ModPrefix.ValidateItem ( Item  item,
ref bool  invalid 
)
virtual

Validates whether this prefix with the custom data stats set from SetStats is allowed on the given item. It is not allowed if one of the stat changes do not cause any change (eg. percentage being too small to make a difference).

Property Documentation

◆ Category

virtual PrefixCategory Terraria.ModLoader.ModPrefix.Category
get

The category your prefix belongs to, PrefixCategory.Custom by default