128 lines
2.4 KiB
C#
128 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using LLib.GameData;
|
|
|
|
namespace LLib.Gear;
|
|
|
|
public sealed class StatPriority
|
|
{
|
|
private readonly IReadOnlyDictionary<EBaseParam, float> _weights;
|
|
|
|
public IReadOnlyDictionary<EBaseParam, float> Weights => _weights;
|
|
|
|
public StatPriority(IReadOnlyDictionary<EBaseParam, float> weights)
|
|
{
|
|
_weights = weights;
|
|
}
|
|
|
|
public float Score(EquipmentStats stats)
|
|
{
|
|
float num = 0f;
|
|
foreach (var (param, num3) in _weights)
|
|
{
|
|
if (num3 != 0f)
|
|
{
|
|
num += (float)stats.Get(param) * num3;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
|
|
public static StatPriority ForJob(EClassJob job)
|
|
{
|
|
EBaseParam[] relevantParams = GetRelevantParams(job);
|
|
Dictionary<EBaseParam, float> dictionary = new Dictionary<EBaseParam, float>(relevantParams.Length);
|
|
EBaseParam[] array = relevantParams;
|
|
foreach (EBaseParam key in array)
|
|
{
|
|
dictionary[key] = 1f;
|
|
}
|
|
return new StatPriority(dictionary);
|
|
}
|
|
|
|
private static EBaseParam[] GetRelevantParams(EClassJob job)
|
|
{
|
|
if (job.IsCrafter())
|
|
{
|
|
return new EBaseParam[3]
|
|
{
|
|
EBaseParam.CP,
|
|
EBaseParam.Control,
|
|
EBaseParam.Craftsmanship
|
|
};
|
|
}
|
|
if (job.IsGatherer())
|
|
{
|
|
return new EBaseParam[3]
|
|
{
|
|
EBaseParam.GP,
|
|
EBaseParam.Gathering,
|
|
EBaseParam.Perception
|
|
};
|
|
}
|
|
if (job.IsHealer())
|
|
{
|
|
return new EBaseParam[5]
|
|
{
|
|
EBaseParam.Mind,
|
|
EBaseParam.Piety,
|
|
EBaseParam.SpellSpeed,
|
|
EBaseParam.Determination,
|
|
EBaseParam.Crit
|
|
};
|
|
}
|
|
if (job.IsTank())
|
|
{
|
|
return new EBaseParam[7]
|
|
{
|
|
EBaseParam.Strength,
|
|
EBaseParam.Vitality,
|
|
EBaseParam.Determination,
|
|
EBaseParam.Tenacity,
|
|
EBaseParam.DirectHit,
|
|
EBaseParam.Crit,
|
|
EBaseParam.SkillSpeed
|
|
};
|
|
}
|
|
bool flag = job.IsPhysicalRanged();
|
|
if (!flag)
|
|
{
|
|
bool flag2 = ((job - 29 <= EClassJob.Gladiator || job == EClassJob.Viper) ? true : false);
|
|
flag = flag2;
|
|
}
|
|
if (flag)
|
|
{
|
|
return new EBaseParam[5]
|
|
{
|
|
EBaseParam.Dexterity,
|
|
EBaseParam.Determination,
|
|
EBaseParam.DirectHit,
|
|
EBaseParam.Crit,
|
|
EBaseParam.SkillSpeed
|
|
};
|
|
}
|
|
if (job.IsMelee())
|
|
{
|
|
return new EBaseParam[5]
|
|
{
|
|
EBaseParam.Strength,
|
|
EBaseParam.Determination,
|
|
EBaseParam.DirectHit,
|
|
EBaseParam.Crit,
|
|
EBaseParam.SkillSpeed
|
|
};
|
|
}
|
|
if (job.IsCaster())
|
|
{
|
|
return new EBaseParam[5]
|
|
{
|
|
EBaseParam.Intelligence,
|
|
EBaseParam.Determination,
|
|
EBaseParam.DirectHit,
|
|
EBaseParam.Crit,
|
|
EBaseParam.SpellSpeed
|
|
};
|
|
}
|
|
return Array.Empty<EBaseParam>();
|
|
}
|
|
}
|