Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.ModPrefix Class Reference
+ Collaboration diagram for Terraria.ModLoader.ModPrefix:

Public Member Functions

virtual void Apply (Item item)
 Applies the custom data stats set in SetStats to the given item. More...
 
virtual void AutoDefaults ()
 
virtual bool Autoload (ref string name)
 
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 SetDefaults ()
 Allows you to set the prefix's name/translations and to set its category. 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...
 
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...
 

Static Public Member Functions

static ModPrefix GetPrefix (byte type)
 Returns the ModPrefix associated with specified type If not a ModPrefix, returns null. More...
 
static List< ModPrefixGetPrefixesInCategory (PrefixCategory category)
 Returns a list of all modded prefixes of a certain category. More...
 

Public Attributes

virtual PrefixCategory Category => PrefixCategory.Custom
 The category your prefix belongs to, PrefixCategory.Custom by default More...
 

Static Public Attributes

static byte PrefixCount => nextPrefix
 

Properties

ModTranslation DisplayName [get, set]
 
Mod mod [get, set]
 
string Name [get, set]
 
byte Type [get, set]
 

Static Private Member Functions

static ModPrefix ()
 

Static Private Attributes

static byte nextPrefix = PrefixID.Count
 

Detailed Description

Definition at line 10 of file ModPrefix.cs.

Constructor & Destructor Documentation

static Terraria.ModLoader.ModPrefix.ModPrefix ( )
staticprivate

Definition at line 18 of file ModPrefix.cs.

References Terraria.ModLoader.ModNet.AllowVanillaClients.

18  {
19  categoryPrefixes = new Dictionary<PrefixCategory, IList<ModPrefix>>();
20  foreach (PrefixCategory category in Enum.GetValues(typeof(PrefixCategory))) {
21  categoryPrefixes[category] = new List<ModPrefix>();
22  }
23  }

Member Function Documentation

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

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

Parameters
item

Definition at line 159 of file ModPrefix.cs.

159  {
160  }
virtual void Terraria.ModLoader.ModPrefix.AutoDefaults ( )
virtual

Definition at line 130 of file ModPrefix.cs.

Referenced by Terraria.ModLoader.Mod.LoadEffect().

130  {
131  if (DisplayName.IsDefault())
132  DisplayName.SetDefault(Regex.Replace(Name, "([A-Z])", " $1").Trim());
133  }
ModTranslation DisplayName
Definition: ModPrefix.cs:97

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.ModPrefix.Autoload ( ref string  name)
virtual

Definition at line 126 of file ModPrefix.cs.

Referenced by Terraria.ModLoader.Mod.AutoloadPrefix().

126  {
127  return mod.Properties.Autoload;
128  }
ModProperties Properties
Definition: Mod.cs:49
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...

+ Here is the caller graph for this function:

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

Parameters
item
Returns

Definition at line 117 of file ModPrefix.cs.

117  {
118  return RollChance(item) > 0;
119  }
virtual float RollChance(Item item)
The roll chance of your prefix relative to a vanilla prefix, 1f by default.
Definition: ModPrefix.cs:107
static ModPrefix Terraria.ModLoader.ModPrefix.GetPrefix ( byte  type)
static

Returns the ModPrefix associated with specified type If not a ModPrefix, returns null.

Parameters
type
Returns

Definition at line 40 of file ModPrefix.cs.

Referenced by Terraria.ModLoader.IO.ItemIO.Save().

40  {
41  return type >= PrefixID.Count && type < PrefixCount ? prefixes[type - PrefixID.Count] : null;
42  }

+ Here is the caller graph for this function:

static List<ModPrefix> Terraria.ModLoader.ModPrefix.GetPrefixesInCategory ( PrefixCategory  category)
static

Returns a list of all modded prefixes of a certain category.

Parameters
category
Returns

Definition at line 49 of file ModPrefix.cs.

49  {
50  return new List<ModPrefix>(categoryPrefixes[category]);
51  }
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.

Definition at line 165 of file ModPrefix.cs.

165  {
166  }
virtual float Terraria.ModLoader.ModPrefix.RollChance ( Item  item)
virtual

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

Parameters
item
Returns

Definition at line 107 of file ModPrefix.cs.

107  {
108  return 1f;
109  }
virtual void Terraria.ModLoader.ModPrefix.SetDefaults ( )
virtual

Allows you to set the prefix's name/translations and to set its category.

Definition at line 138 of file ModPrefix.cs.

Referenced by Terraria.ModLoader.Mod.LoadEffect().

138  {
139  }

+ Here is the caller graph for this function:

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.

Definition at line 144 of file ModPrefix.cs.

145  {
146  }
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).

Definition at line 152 of file ModPrefix.cs.

152  {
153  }

Member Data Documentation

virtual PrefixCategory Terraria.ModLoader.ModPrefix.Category => PrefixCategory.Custom

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

Definition at line 124 of file ModPrefix.cs.

Referenced by Terraria.ModLoader.Mod.AddPrefix().

byte Terraria.ModLoader.ModPrefix.nextPrefix = PrefixID.Count
staticprivate

Definition at line 12 of file ModPrefix.cs.

byte Terraria.ModLoader.ModPrefix.PrefixCount => nextPrefix
static

Definition at line 53 of file ModPrefix.cs.

Property Documentation

ModTranslation Terraria.ModLoader.ModPrefix.DisplayName
getset
Mod Terraria.ModLoader.ModPrefix.mod
getset
string Terraria.ModLoader.ModPrefix.Name
getset
byte Terraria.ModLoader.ModPrefix.Type
getset