Exemplo n.º 1
0
        private static string GetActionBarSlotHotkey(ActionBarSource a)
        {
            if (a.Key.StartsWith(KeyReader.BR))
            {
                return(CalculateActionNumber(a.Key, KeyReader.BR, KeyReader.BRIdx));
            }

            if (a.Key.StartsWith(KeyReader.BL))
            {
                return(CalculateActionNumber(a.Key, KeyReader.BL, KeyReader.BLIdx));
            }

            return(CalculateActionNumber(a.Key, "", 0));
        }
Exemplo n.º 2
0
        private static string GetFunction(ActionBarSource a)
        {
            if (a.Item)
            {
                return("PickupItem");
            }

            if (char.IsLower(a.Name[0]))
            {
                return("PickupMacro");
            }

            return("PickupSpellBookItem");
        }
Exemplo n.º 3
0
        private static string ScriptBuilder(ActionBarSource a)
        {
            string nameOrId = $"\"{a.Name}\"";

            if (int.TryParse(a.Name, out int id))
            {
                nameOrId = id.ToString();
            }

            string func = GetFunction(a);
            string slot = GetActionBarSlotHotkey(a);

            return($"/run {func}({nameOrId})PlaceAction({slot})ClearCursor()--");
        }
        private string GetActionBarSlotHotkey(ActionBarSource a)
        {
            if (a.Key.StartsWith(KeyReader.BR))
            {
                return(CalculateActionNumber(a, a.Key, KeyReader.BR, KeyReader.BRIdx));
            }

            if (a.Key.StartsWith(KeyReader.BL))
            {
                return(CalculateActionNumber(a, a.Key, KeyReader.BL, KeyReader.BLIdx));
            }

            // "-" "=" keys
            if (KeyReader.ActionBarSlotMap.ContainsKey(a.Key))
            {
                return(CalculateActionNumber(a, KeyReader.ActionBarSlotMap[a.Key].ToString(), "", 0));
            }

            return(CalculateActionNumber(a, a.Key, "", 0));
        }
Exemplo n.º 5
0
        private void AddUnique(KeyAction a)
        {
            if (!KeyReader.KeyMapping.ContainsKey(a.Key))
            {
                return;
            }
            if (sources.Any(i => i.Key == a.Key))
            {
                return;
            }

            var source = new ActionBarSource
            {
                Name        = a.Name,
                Key         = a.Key,
                Item        = false,
                Requirement = a.Requirement
            };

            sources.Add(source);
        }
        private void AddUnique(KeyAction a)
        {
            if (!KeyReader.KeyMapping.ContainsKey(a.Key))
            {
                return;
            }
            if (sources.Any(i => i.KeyAction.ConsoleKeyFormHash == a.ConsoleKeyFormHash))
            {
                return;
            }

            var source = new ActionBarSource
            {
                Name      = a.Name,
                Key       = a.Key,
                Item      = false,
                KeyAction = a
            };

            sources.Add(source);
        }
        private string CalculateActionNumber(ActionBarSource a, string key, string prefix, int offset)
        {
            if (!string.IsNullOrEmpty(prefix))
            {
                key = key.Replace(prefix, "");
            }

            if (int.TryParse(key, out int hotkey))
            {
                if (offset == 0 && hotkey <= 12)
                {
                    offset += Stance.RuntimeSlotToActionBar(a.KeyAction, addonReader.PlayerReader, hotkey);
                }

                if (hotkey == 0)
                {
                    return((offset + 10).ToString());
                }

                return((offset + hotkey).ToString());
            }

            return(key);
        }