2 using System.Collections.Generic;
14 namespace Loot.Api.Core
23 Modifiers = modifiers ??
new List<Modifier>();
28 Modifiers.ForEach(mod => mod.Apply(item));
39 public Mod Mod {
get;
internal set; }
41 Mod ILoadableContentSetter.Mod
46 public uint Type {
get;
internal set; }
48 uint ILoadableContentSetter.Type
53 public string Name => GetType().Name;
57 internal void CacheAttributes()
64 if (_populatePoolFrom != null)
66 var classes = _populatePoolFrom.
GetClasses().SelectMany(x => x.Value);
68 foreach (var
@class in classes)
78 foreach (
Modifier m
in GetModifiers())
87 public virtual IEnumerable<Modifier> GetModifiers()
95 protected internal IEnumerable<Modifier> GetRollableModifiers(
ModifierContext ctx)
96 => _GetModifiers().Where(x => x._CanRoll(ctx));
110 public virtual float RollChance => 1f;
126 => ctx.
Item?.IsModifierRollableItem() ??
true;
132 internal void ApplyModifiers(Item item)
164 public virtual void NetReceive(Item item, BinaryReader reader)
171 public virtual void NetSend(Item item, BinaryWriter writer)
179 public virtual void Load(Item item, TagCompound tag)
188 public virtual void Save(Item item, TagCompound tag)
virtual void Clone(ref ModifierPool clone)
Allows modders to do custom cloning Happens after default cloning
Defines a modifier, which is an unloaded GlobalItem Making it a GlobalItem gives easy access to all h...
Defines a context in which a Modifier might be rolled Which fields are available (not null) depends o...
static ModifierContent Modifier
Will populate a ModifierPool based on a namespace All Modifiers in that namespace will become part of...
virtual void NetSend(Item item, BinaryWriter writer)
Allows modder to do custom NetSend here
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 TC to pull data you saved using Save(Item...
Defines a modifier pool. A modifier pool holds a certain amount of effects in an array It allows to r...
readonly List< Modifier > Modifiers
Dictionary< string, List< Type > > GetClasses()
Defines a piece of loadable content The interface is used in classes where the deriving class already...
FiniteModifierPool(List< Modifier > modifiers)
PopulatePoolFromAttribute _populatePoolFrom
This class holds all Content holders of this mod You can use this to access content loaded into the m...
IEnumerable< Modifier > _GetModifiers()
virtual void NetReceive(Item item, BinaryReader reader)
Allows the modder to do custom NetReceive