Пример #1
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            PluginInterface     = pluginInterface;
            PluginConfiguration = pluginInterface.GetPluginConfig() as VisibilityConfiguration ?? new VisibilityConfiguration();
            PluginConfiguration.Init(this, pluginInterface);

            PluginInterface.CommandManager.AddHandler(PluginCommandName, new CommandInfo(PluginCommand)
            {
                HelpMessage = $"Shows the config for the visibility plugin.\nAdditional help available via '{PluginCommandName} help'",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(VoidCommandName, new CommandInfo(VoidPlayer)
            {
                HelpMessage = $"Adds player to void list.\nUsage: {VoidCommandName} <charactername> <worldname> <reason>",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(VoidTargetCommandName, new CommandInfo(VoidTargetPlayer)
            {
                HelpMessage = $"Adds targeted player to void list.\nUsage: {VoidTargetCommandName} <reason>",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(WhitelistCommandName, new CommandInfo(WhitelistPlayer)
            {
                HelpMessage = $"Adds player to whitelist.\nUsage: {WhitelistCommandName} <charactername> <worldname>",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(WhitelistTargetCommandName, new CommandInfo(WhitelistTargetPlayer)
            {
                HelpMessage = $"Adds targeted player to whitelist.\nUsage: {WhitelistTargetCommandName}",
                ShowInHelp  = true
            });

            _characterDrawResolver = new CharacterDrawResolver();
            _characterDrawResolver.Init(pluginInterface, PluginConfiguration);

            Common            = new XivCommonBase(PluginInterface, Hooks.ContextMenu);
            PluginContextMenu = new ContextMenu(this);

            if (PluginConfiguration.EnableContextMenu)
            {
                PluginContextMenu.Toggle();
            }

            PluginInterface.Framework.OnUpdateEvent          += FrameworkOnOnUpdateEvent;
            PluginInterface.UiBuilder.OnBuildUi              += BuildUi;
            PluginInterface.UiBuilder.OnOpenConfigUi         += OpenConfigUi;
            PluginInterface.Framework.Gui.Chat.OnChatMessage += OnChatMessage;
        }
Пример #2
0
 public void UpdateCards(IDictionary <DataComposition, VisibilityConfiguration> cards)
 {
     if (this.initialized)
     {
         if (float.IsNaN(this.startTime))
         {
             using (IEnumerator <KeyValuePair <DataComposition, VisibilityConfiguration> > enumerator = this.initialPositions.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     KeyValuePair <DataComposition, VisibilityConfiguration> keyValuePair = enumerator.Current;
                     cards[keyValuePair.Key] = keyValuePair.Value;
                 }
                 return;
             }
         }
         if (this.paths == null)
         {
             this.configurePaths(cards);
         }
         float num = Time.time - this.startTime;
         foreach (KeyValuePair <DataComposition, PathAnimator> keyValuePair2 in this.paths)
         {
             DataComposition         key   = keyValuePair2.Key;
             PathAnimator            value = keyValuePair2.Value;
             VisibilityConfiguration visibilityConfiguration = cards[key];
             GlobalTransform         transform = visibilityConfiguration.Transform;
             float num2;
             this.delays.TryGetValue(key, out num2);
             value.EndTransform = transform;
             visibilityConfiguration.Transform = value.GetTransformAtTime(Mathf.Max(0f, num - num2));
             visibilityConfiguration.Show      = this.DoShow;
             if (this.animatingCards.Contains(key))
             {
                 visibilityConfiguration.GetOne <j.V>().A = true;
                 f.E.DisplayMode display = this.initialPositions[key].GetOne <f.E>().display;
                 visibilityConfiguration.GetOne <f.E>().display = display;
                 visibilityConfiguration.GetOne <f.c>().A       = false;
             }
         }
         if (num >= this.duration)
         {
             this.set_Completed(true);
             this.initialized = false;
         }
     }
 }
        public unsafe void Init(DalamudPluginInterface pluginInterface, VisibilityConfiguration pluginConfig)
        {
            _pluginInterface = pluginInterface;
            _address.Setup(pluginInterface.TargetModuleScanner);
            _config = pluginConfig;

            LocalPlayer = *(BattleChara **)_address.LocalPlayerAddress.ToPointer();

            hookCharacterEnableDraw  = new Hook <CharacterEnableDrawPrototype>(_address.CharacterEnableDrawAddress, new CharacterEnableDrawPrototype(CharacterEnableDrawDetour), this);
            hookCharacterDisableDraw = new Hook <CharacterDisableDrawPrototype>(_address.CharacterDisableDrawAddress, new CharacterDisableDrawPrototype(CharacterDisableDrawDetour), this);
            hookCompanionEnableDraw  = new Hook <CompanionEnableDrawPrototype>(_address.CompanionEnableDrawAddress, new CompanionEnableDrawPrototype(CompanionEnableDrawDetour), this);
            hookCharacterDtor        = new Hook <CharacterDtorPrototype>(_address.CharacterDtorAddress, new CharacterDtorPrototype(CharacterDtorDetour), this);

            hookCharacterEnableDraw.Enable();
            hookCharacterDisableDraw.Enable();
            hookCompanionEnableDraw.Enable();
            hookCharacterDtor.Enable();
        }
Пример #4
0
        public VisibilityPlugin()
        {
            Instance           = this;
            this.Configuration = PluginInterface.GetPluginConfig() as VisibilityConfiguration ??
                                 new VisibilityConfiguration();
            this.Configuration.Init(ClientState.TerritoryType);
            this.PluginLocalization = new Localization(this.Configuration.Language);

            CommandManager.AddHandler(
                PluginCommandName,
                new CommandInfo(this.PluginCommand)
            {
                HelpMessage = this.PluginLocalization.PluginCommandHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                VoidCommandName,
                new CommandInfo(this.VoidPlayer)
            {
                HelpMessage = this.PluginLocalization.VoidPlayerHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                VoidTargetCommandName,
                new CommandInfo(this.VoidTargetPlayer)
            {
                HelpMessage = this.PluginLocalization.VoidTargetPlayerHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                WhitelistCommandName,
                new CommandInfo(this.WhitelistPlayer)
            {
                HelpMessage = this.PluginLocalization.WhitelistPlayerHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                WhitelistTargetCommandName,
                new CommandInfo(this.WhitelistTargetPlayer)
            {
                HelpMessage = this.PluginLocalization.WhitelistTargetPlayerHelpMessage,
                ShowInHelp  = true
            });

            this.characterDrawResolver = new CharacterDrawResolver();
            this.characterDrawResolver.Init();

            Framework.Update += this.FrameworkOnOnUpdateEvent;

            PluginInterface.UiBuilder.Draw         += this.BuildUi;
            PluginInterface.UiBuilder.OpenConfigUi += this.OpenConfigUi;
            ChatGui.ChatMessage          += this.OnChatMessage;
            ClientState.TerritoryChanged += this.ClientStateOnTerritoryChanged;

            this.Api         = new VisibilityApi();
            this.IpcProvider = new VisibilityProvider(this.Api);
        }
 public LanguageWriterConfiguration()
 {
     Visibility = new VisibilityConfiguration();
 }