Update() public method

public Update ( PlayerFieldFlags updateFields = PlayerFieldFlags.All ) : void
updateFields PlayerFieldFlags
return void
Esempio n. 1
0
        public void AddNewClient(ClientProcess process, ClientVersion version = null)
        {
            var player = new Player(process) { Version = version };
              player.PropertyChanged += Player_PropertyChanged;

              if (player.Version == null)
              {
            player.Version = ClientVersionManager.Instance.Versions.First(v => v.Key != "Auto-Detect");
              }

              AddPlayer(player);
              player.Update();
        }
Esempio n. 2
0
        public void ImportMacroState(Player player, SavedMacroState state)
        {
            if (player == null)
            throw new ArgumentNullException("player");

              if (state == null)
            throw new ArgumentNullException("state");

              var macro = GetMacroState(player);
              if (macro == null)
            return;

              macro.Stop();

              var process = Process.GetCurrentProcess();

              if (player.HasHotkey)
              {
            HotkeyManager.Instance.UnregisterHotkey(process.MainWindowHandle, player.Hotkey);
            player.Hotkey = null;
              }

              player.Skillbook.ClearActiveSkills();
              macro.ClearSpellQueue();
              macro.ClearFlowerQueue();

              player.Update(PlayerFieldFlags.Spellbook);
              macro.UseLyliacVineyard = player.HasLyliacVineyard && state.UseLyliacVineyard;
              macro.FlowerAlternateCharacters = player.HasLyliacPlant && state.FlowerAlternateCharacters;

              player.Update(PlayerFieldFlags.Skillbook);
              foreach (var skill in state.Skills)
              {
            if (!player.Skillbook.ContainSkill(skill.SkillName))
              continue;

            player.Skillbook.ToggleActive(skill.SkillName, true);
              }

              foreach (var spell in state.Spells)
              {
            if (!player.Spellbook.ContainSpell(spell.SpellName))
              continue;

            var spellInfo = player.Spellbook.GetSpell(spell.SpellName);
            if (spellInfo == null)
              continue;

            var queueItem = new SpellQueueItem(spellInfo, spell);
            macro.AddToSpellQueue(queueItem);
              }

              if (player.HasLyliacPlant)
            foreach (var flower in state.Flowers)
            {
              if (flower.TargetMode == TargetCoordinateUnits.None)
            continue;

              var queueItem = new FlowerQueueItem(flower);
              macro.AddToFlowerQueue(queueItem);
            }

              var windowHandle = Process.GetCurrentProcess().MainWindowHandle;

              if (state.HotkeyKey != Key.None && (state.HotkeyModifiers != ModifierKeys.None || Hotkey.IsFunctionKey(state.HotkeyKey)))
              {
            var hotkey = new Hotkey(state.HotkeyModifiers, state.HotkeyKey);

            if (HotkeyManager.Instance.RegisterHotkey(windowHandle, hotkey))
              player.Hotkey = hotkey;
              }
        }