Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
ModifierRarity.cs
Go to the documentation of this file.
1 using System;
2 using System.IO;
3 using Loot.Api.Content;
4 using Microsoft.Xna.Framework;
5 using Terraria;
6 using Terraria.ModLoader;
7 using Terraria.ModLoader.IO;
8 
9 namespace Loot.Api.Core
10 {
14  public abstract class ModifierRarity : ILoadableContent, ILoadableContentSetter, ICloneable
15  {
16  public Mod Mod { get; internal set; }
17 
18  Mod ILoadableContentSetter.Mod
19  {
20  set => Mod = value;
21  }
22 
23  public uint Type { get; internal set; }
24 
25  uint ILoadableContentSetter.Type
26  {
27  set => Type = value;
28  }
29 
30  public string Name => GetType().Name;
31 
32  public virtual string RarityName => Name;
33  public virtual Color? OverrideNameColor => null;
34  public virtual string ItemPrefix => null;
35  public virtual string ItemSuffix => null;
36 
41  public virtual float? UpgradeChance => null;
42 
47  public virtual float? DowngradeChance => null;
48 
49  public virtual float ExtraMagnitudePower => 0f;
50  public virtual float ExtraLuck => 0f;
51  public virtual Type Downgrade => null;
52  public virtual Type Upgrade => null;
53 
54  public abstract Color Color { get; }
55 
56  public virtual void Clone(ref ModifierRarity clone)
57  {
58  }
59 
60  public object Clone()
61  {
62  ModifierRarity clone = (ModifierRarity)MemberwiseClone();
63  clone.Mod = Mod;
64  clone.Type = Type;
65  Clone(ref clone);
66  return clone;
67  }
68 
74  public virtual void NetReceive(Item item, BinaryReader reader)
75  {
76  }
77 
83  public virtual void NetSend(Item item, BinaryWriter writer)
84  {
85  }
86 
91  public virtual void Load(Item item, TagCompound tag)
92  {
93  }
94 
99  public virtual void Save(Item item, TagCompound tag)
100  {
101  }
102  }
103 }
virtual void NetReceive(Item item, BinaryReader reader)
Allows the modder to do custom NetReceive
Defines the rarity of a modifier
virtual void Clone(ref ModifierRarity clone)
virtual void Save(Item item, TagCompound tag)
Allows modder to do custom saving here Use the given TC to put data you want to save, which can be loaded using Load(Item,TagCompound)
virtual void Load(Item item, TagCompound tag)
Allows modder to do custom loading here Use the given TagCompound to pull data you saved using Save(I...
Defines a piece of loadable content The interface is used in classes where the deriving class already...
virtual void NetSend(Item item, BinaryWriter writer)
Allows modder to do custom NetSend here