public L2Character(int objectId, CharTemplate template) : base(objectId) { Template = template; CharacterStat = new CharacterStat(this); InitializeCharacterStatus(); Calculators = new Calculator[Models.Stats.Stats.Values.Count()]; AddFuncsToNewCharacter(); _updatePositionTime.Elapsed += UpdatePositionTask; }
public void AddStatFunc(Func func) { if (func == null) { return; } var statId = Array.IndexOf(Models.Stats.Stats.Values.ToArray(), func.Stat); lock (Calculators) { if (Calculators[statId] == null) { Calculators[statId] = new Calculator(); } Calculators[statId].AddFunc(func); } }