private bool ChatCommandOpen(BmpChatListener.Command cmd) { if (IsCommandPermitted(cmd)) { Performance.Instrument instrument = Player.PreferredInstrument; if (!string.IsNullOrEmpty(cmd.param)) { if (!FFXIV.GetPerformanceInstrument(cmd.param, out instrument)) { Log(string.Format("Cannot open [\"{0}\"] - that isn't an instrument.", cmd.param)); return(false); } } if (!FFXIV.GetHotkeyForInstrument(instrument, out FFXIVKeybindDat.Keybind keybind)) { Log(string.Format("Cannot open [{0}] - that performance action isn't placed on your hotbar.", instrument.ToString())); return(false); } if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None) { if (FFXIV.IsPlayerJobReady()) { FFXIV.hook.SendSyncKeybind(keybind); } } else { Log(string.Format("Cannot open [{0}] - no keybind is assigned to that hotbar slot.", instrument.ToString())); } } return(true); }
public bool GetHotkeyForInstrument(Performance.Instrument ins, out FFXIVKeybindDat.Keybind keybind) { string keyMap = hotbar.GetInstrumentKeyMap(ins); if (!string.IsNullOrEmpty(keyMap)) { keybind = hotkeys[keyMap]; return(true); } keybind = new FFXIVKeybindDat.Keybind(); return(false); }
public bool GetPerformanceInstrument(string ins, out Performance.Instrument ins2) { if (!string.IsNullOrEmpty(ins)) { if (!Enum.TryParse(ins, out ins2)) { if (int.TryParse(ins, out int intInst)) { ins2 = (Performance.Instrument)intInst; return(true); } } else { return(true); } } ins2 = Performance.Instrument.Piano; return(false); }