public unsafe void Initialize(DalamudPluginInterface pluginInterface) { Interface = pluginInterface; Configuration = pluginInterface.GetPluginConfig() as JobIconsConfiguration ?? new JobIconsConfiguration(); Address = new PluginAddressResolver(); Address.Setup(pluginInterface.TargetModuleScanner); XivApi.Initialize(Interface, Address); IconSet.Initialize(this); SetNamePlateHook = new Hook <SetNamePlateDelegate>(Address.AddonNamePlate_SetNamePlatePtr, new SetNamePlateDelegate(SetNamePlateDetour), this); SetNamePlateHook.Enable(); EmptySeStringPtr = XivApi.StringToSeStringPtr(""); var commandInfo = new CommandInfo(CommandHandler) { HelpMessage = "Opens Job Icons config.", ShowInHelp = true }; Interface.CommandManager.AddHandler(Command1, commandInfo); Interface.CommandManager.AddHandler(Command2, commandInfo); Task.Run(() => FixNamePlates(FixNonPlayerCharacterNamePlatesTokenSource.Token)); PluginGui = new JobIconsGui(this); }
internal IconSet GetIconSet(uint jobID) { var job = (Job)jobID; var jobRole = job.GetRole(); return(jobRole switch { JobRole.Tank => IconSet.Get(TankIconSetName), JobRole.Heal => IconSet.Get(HealIconSetName), JobRole.Melee => IconSet.Get(MeleeIconSetName), JobRole.Ranged => IconSet.Get(RangedIconSetName), JobRole.Magical => IconSet.Get(MagicalIconSetName), JobRole.Crafter => IconSet.Get(CraftingIconSetName), JobRole.Gatherer => IconSet.Get(GatheringIconSetName), _ => throw new ArgumentException($"Unknown jobID {(int)job}"), });
public static void Add(string name, int[] icons, float scaleMultiplier = DEFAULT_SCALE_MULTIPLIER) { IconSets[name] = new IconSet(name, icons, scaleMultiplier); }
public static void Add(string name, Func <Job, int> iconMethod, float scaleMultiplier = DEFAULT_SCALE_MULTIPLIER) { IconSets[name] = new IconSet(name, iconMethod, scaleMultiplier); }