public void RemoveFollower(string followerName) { if (string.IsNullOrEmpty(followerName)) { return; } FollowerCommandsDataClass follower = FollowerCommandsDataSet.First(a => a.FollowerName == followerName); FollowerCommandsDataSet.Remove(follower); }
public void AddNewFollower(string followerName) { if (string.IsNullOrEmpty(followerName)) { return; } bool contains = FollowerCommandsDataSet.Select(a => a.FollowerName == followerName).FirstOrDefault(); if (contains) { return; } FollowerCommandsDataClass follower = new FollowerCommandsDataClass(followerName); FollowerCommandsDataSet.Add(follower); }
private void SendPickupItemSignal() { int index; if (Input.GetKeyState(Keys.D1)) { index = 0; } else if (Input.GetKeyState(Keys.D2)) { index = 1; } else if (Input.GetKeyState(Keys.D3)) { index = 2; } else if (Input.GetKeyState(Keys.D4)) { index = 3; } else if (Input.GetKeyState(Keys.D5)) { index = 4; } else if (Input.GetKeyState(Keys.D6)) { index = 5; } else if (Input.GetKeyState(Keys.D7)) { index = 6; } else if (Input.GetKeyState(Keys.D8)) { index = 7; } else if (Input.GetKeyState(Keys.D9)) { index = 8; } else if (Input.GetKeyState(Keys.D0)) { index = 9; } else { LogMsgWithVerboseDebug("*** No proper number key pressed found"); return; } int len = Settings.LeaderModeSettings.FollowerCommandSetting.FollowerCommandsDataSet.Count; if (index > len - 1) { LogMsgWithVerboseDebug("*** index was larger than length"); return; } FollowerCommandsDataClass follower = Settings.LeaderModeSettings.FollowerCommandSetting.FollowerCommandsDataSet.ElementAt(index); Entity targetedEntity = GameController.EntityListWrapper.Entities .Where(e => e.GetComponent <Targetable>() != null) .Where(e => e.Type != EntityType.Player) .Where(e => e.Type != EntityType.Monster) .FirstOrDefault(e => e.GetComponent <Targetable>().isTargeted); if (targetedEntity == null) { LogMsgWithVerboseDebug("*** No targeted item found"); return; } int entityId = (int)targetedEntity.Id; LogMsgWithVerboseDebug($"*** Setting follower {follower.FollowerName} to pick item id {entityId}"); follower.SetPickupNormalItem(entityId); }