void DeleteNodeWindow(int id, int idOfType) { EntityDeleted(id); EditorInfo.NodesIndexes.RemoveAt(idOfType); EditorInfo.NodesOptionsFoldouts.Remove(idOfType); EditorInfo.Nodes--; DialogueNodeActionsFoldouts.RemoveAt(idOfType); DialogueNodeOptionsFoldouts.RemoveAt(idOfType); CurrentNodes.RemoveAt(idOfType); ClearAllConnectionsPending(); DecrementIndexes(id); UpdateTargetAfterDeletion(id, idOfType, NodeType.Node); int[] keys = new int[EditorInfo.NodesOptionsFoldouts.Count]; EditorInfo.NodesOptionsFoldouts.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { int key = keys[i]; Dictionary <int, bool> tempVal = EditorInfo.NodesOptionsFoldouts[key]; if (key > idOfType) { EditorInfo.NodesOptionsFoldouts.Remove(key); key--; EditorInfo.NodesOptionsFoldouts.Add(key, tempVal); } } WriteDebug("Deleting node " + idOfType + " and it's associations."); }
public override void DeleteMultipleItems() { if (CurrentNodes.Length == 1) { SystemFile file = (SystemFile)CurrentNodes[0].DataItem; if (!MessageService.Confirm(GettextCatalog.GetString("Are you sure you want to permanently delete the file {0}?", file.Path), AlertButton.Delete)) { return; } } else { if (!MessageService.Confirm(GettextCatalog.GetString("Are you sure you want to permanently delete all selected files?"), AlertButton.Delete)) { return; } } foreach (SystemFile file in CurrentNodes.Select(n => (SystemFile)n.DataItem)) { try { FileService.DeleteFile(file.Path); } catch { MessageService.ShowError(GettextCatalog.GetString("The file {0} could not be deleted", file.Path)); } } }
public void LoadProfile(IDungeonProfile profile) { Reset(); DungeonProfile = profile; // filter out already checked nodes DungeonNode closestDungeonNode = DungeonProfile.Path.OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)).FirstOrDefault(); bool shouldAddNodes = closestDungeonNode == null; foreach (DungeonNode d in DungeonProfile.Path) { // skip all already completed nodes if (!shouldAddNodes && d == closestDungeonNode) { shouldAddNodes = true; } if (shouldAddNodes) { CurrentNodes.Enqueue(d); } } TotalNodes = CurrentNodes.Count; }
public void Reset() { HasFinishedDungeon = false; AllPlayersArrived = false; DungeonProfile = null; CurrentNodes.Clear(); Progress = 0.0; TotalNodes = 0; }
public override void DeleteMultipleItems() { int nodeCount = CurrentNodes.Count(); if (nodeCount == 1) { DeleteItem(); } else if (nodeCount > 0) { var nodes = CurrentNodes.Select(node => (PackageDependencyNode)node.DataItem).ToArray(); RemoveMultiplePackages(nodes); } }
private static IReadOnlyList <SyntaxNode> GetCurrentNodeFromTrueRoots(SyntaxNode trueRoot, SyntaxNode node) { var id = GetId(node); if (id != null) { CurrentNodes tracked = s_rootToCurrentNodesMap.GetValue(trueRoot, r => new CurrentNodes(r)); return(tracked.GetNodes(id)); } else { return(SpecializedCollections.EmptyReadOnlyList <SyntaxNode>()); } }
private static List <SyntaxNode> GetCurrentNodeFromTrueRoots(SyntaxNode trueRoot, SyntaxNode node) { var id = GetId(node); if (id != null) { CurrentNodes tracked = rootToCurrentNodesMap.GetValue(trueRoot, r => new CurrentNodes(r)); return(tracked.GetNodes(id)); } else { return(null); } }
public void LoadProfile(IDungeonProfile profile) { Profile = profile; // DungeonNode closestNode = profile.Nodes.OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)).FirstOrDefault(); // int closestNodeIndex = profile.Nodes.IndexOf(closestNode); for (int i = 0; i < profile.Nodes.Count; ++i) { CurrentNodes.Enqueue(profile.Nodes[i]); } WowInterface.CombatClass.PriorityTargetDisplayIds = profile.PriorityUnits; TotalNodes = CurrentNodes.Count; }
public void OnOpenFolder() { var paths = new Dictionary <string, HashSet <string> > (); foreach (var ob in CurrentNodes.Select(node => node.DataItem)) { if (ob is IFileItem) { string path = ((IFileItem)ob).FileName; if (!string.IsNullOrEmpty(path)) { var dirPath = (FilePath)System.IO.Path.GetDirectoryName(path); //if folder doesn't exist, walk up to parent that does while (!dirPath.IsNullOrEmpty && !dirPath.IsDirectory) { dirPath = dirPath.ParentDirectory; } if (!string.IsNullOrEmpty(dirPath)) { if (!paths.ContainsKey(dirPath)) { paths.Add(dirPath, new HashSet <string> ()); } paths [dirPath].Add(path); } } } else if (ob is IFolderItem) { var path = ((IFolderItem)ob).BaseDirectory; //if folder doesn't exist, walk up to parent that does while (!path.IsNullOrEmpty && !path.IsDirectory) { path = path.ParentDirectory; } if (!paths.ContainsKey(path)) { paths.Add(path, new HashSet <string> ()); } } } foreach (var folder in paths) { IdeServices.DesktopService.OpenFolder(folder.Key, folder.Value.Select((f) => (FilePath)f).ToArray()); } }
public void IncludeFileToProject() { Set <SolutionEntityItem> projects = new Set <SolutionEntityItem> (); Set <Solution> solutions = new Set <Solution> (); var nodesByProject = CurrentNodes.GroupBy(n => n.GetParentDataItem(typeof(Project), true) as Project); foreach (var projectGroup in nodesByProject) { Project project = projectGroup.Key; List <FilePath> newFiles = new List <FilePath> (); foreach (ITreeNavigator node in projectGroup) { SystemFile file = (SystemFile)node.DataItem; if (project != null) { newFiles.Add(file.Path); projects.Add(project); } else { SolutionFolder folder = node.GetParentDataItem(typeof(SolutionFolder), true) as SolutionFolder; if (folder != null) { folder.Files.Add(file.Path); solutions.Add(folder.ParentSolution); } else { Solution sol = node.GetParentDataItem(typeof(Solution), true) as Solution; sol.RootFolder.Files.Add(file.Path); solutions.Add(sol); } } } if (newFiles.Count > 0) { project.AddFiles(newFiles); } } IdeApp.ProjectOperations.Save(projects); foreach (Solution sol in solutions) { IdeApp.ProjectOperations.Save(sol); } }
public override void DeleteMultipleItems() { var project = CurrentNode.GetParentDataItem(typeof(FolderBasedProject), true) as FolderBasedProject; if (CurrentNodes.Length == 1) { var file = (SystemFolder)CurrentNodes [0].DataItem; if (!MessageService.Confirm(GettextCatalog.GetString("Are you sure you want to permanently delete the directory {0}?", file.Path), AlertButton.Delete)) { return; } } else { if (!MessageService.Confirm(GettextCatalog.GetString("Are you sure you want to permanently delete all selected directories?"), AlertButton.Delete)) { return; } } var foundFiles = new List <FilePath> (); foreach (SystemFolder folder in CurrentNodes.Select(n => (SystemFolder)n.DataItem)) { try { foundFiles = foundFiles.Concat(Array.ConvertAll( Directory.GetFiles(folder.Path, "*", SearchOption.AllDirectories), (input) => (FilePath)input)).ToList(); FileService.DeleteDirectory(folder.Path); } catch (Exception ex) { MessageService.ShowError(GettextCatalog.GetString("The directory {0} could not be deleted", folder.Path), ex); } } var tb = Tree.BuilderContext.GetTreeBuilder(CurrentNode); tb.MoveToParent(); tb.UpdateChildren(); if (project == null) { return; } project.OnFilesRemoved(foundFiles); }
void CreateDialogueNode() { DialogueNode newNode = new DialogueNode(); newNode.NodeID = EditorInfo.Nodes; CurrentNodes.Add(newNode); EditorInfo.Windows.Add(new Rect(10 + scrollPosition.x, 10 + scrollPosition.y, 200, 5)); EditorInfo.WindowTypes.Add(NodeType.Node); EditorInfo.NodeTypesIDs.Add(EditorInfo.Nodes++); EditorInfo.NodesIndexes.Add(EditorInfo.Windows.Count - 1); DialogueNodeActionsFoldouts.Add(false); DialogueNodeOptionsFoldouts.Add(false); WriteDebug("Adding node"); SaveChanges("Create Dialogue Node"); }
private bool ShouldWaitForGroup() { // we need to be prepared for the bossfight double minPercentages = CurrentNodes.Peek().Type == Enums.DungeonNodeType.Boss ? 100.0 : 75.0; // do we need to wait for some members to regen life or mana if (WowInterface.ObjectManager.Partymembers.OfType <WowUnit>().Any(e => e.HealthPercentage < minPercentages || e.ManaPercentage < minPercentages)) { return(true); } // are my group members not in range of the CurrentNode if (WowInterface.ObjectManager.GetNearFriends <WowPlayer>(CurrentNodes.Peek().Position, 30).Count() < WowInterface.ObjectManager.Partymembers.Count) { return(true); } // go ahead return(false); }
private void FilterOutAlreadyCompletedNodes() { AmeisenLogger.Instance.Log("Dungeon", "FilterOutAlreadyCompletedNodes called..."); DungeonNode closestDungeonNode = DungeonProfile.Path.OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)).FirstOrDefault(); bool shouldAddNodes = closestDungeonNode == null; foreach (DungeonNode d in DungeonProfile.Path) { // skip all already completed nodes if (!shouldAddNodes) { if (d == closestDungeonNode) { shouldAddNodes = true; } } else { CurrentNodes.Enqueue(d); } } }
public void ParseMaplePacket(MaplePacket packet) { tree.Nodes.Clear(); subNodes.Clear(); packet.Reset(); // Seek back to beginning this.packet = packet; try { scriptManager.ExecuteScript(packet.Locale, packet.Version, packet.Outbound, packet.Opcode); } catch (Exception ex) { ScriptEngine engine = scriptManager.GetEngine(packet.Locale, packet.Version); var exceptionOperations = engine.GetService <ExceptionOperations>(); string message = exceptionOperations.FormatException(ex); logger.Error(message); MessageBox.Show(ex.Message, "Script Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (this.packet.Available > 0) { CurrentNodes.Add(new StructureNode("Undefined", this.packet.GetReadSegment(this.packet.Available))); this.packet.Skip(this.packet.Available); } }
public static void AddToNodeList(Unit newSender) { CurrentNodes.Add(newSender); // RefreshSenderCollectionEvent?.Invoke(newSenderId); }
public void Execute() { if (!HasFinishedDungeon && DungeonProfile != null && CurrentNodes.Count > 0) { // we are fighting if ((WowInterface.ObjectManager.Player.IsInCombat && StateMachine.IsAnyPartymemberInCombat()) || WowInterface.ObjectManager.Player.IsCasting) { return; } if (Progress == 100.0) { // exit dungeon HasFinishedDungeon = true; return; } // wait for all players to arrive if (!AllPlayersArrived) { AllPlayersArrived = AreAllPlayersPresent(); } else { if (!ShouldWaitForGroup()) { if (WowInterface.ObjectManager.Player.Position.GetDistance(CurrentNodes.Peek().Position) > 5) { WowInterface.MovementEngine.SetState(MovementEngineState.Moving, CurrentNodes.Peek().Position); WowInterface.MovementEngine.Execute(); return; } else { DungeonNode dungeonNode = CurrentNodes.Peek(); if (dungeonNode.Type == Enums.DungeonNodeType.Door || dungeonNode.Type == Enums.DungeonNodeType.Collect || dungeonNode.Type == Enums.DungeonNodeType.Use) { WowGameobject obj = WowInterface.ObjectManager.WowObjects.OfType <WowGameobject>() .OrderBy(e => e.Position.GetDistance(dungeonNode.Position)) .FirstOrDefault(); if (obj != null && obj.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 5) { WowInterface.CharacterManager.InteractWithObject(obj); } } CompletedNodes.Add(CurrentNodes.Dequeue()); Progress = ((double)CompletedNodes.Count / (double)TotalNodes) * 100; HasFinishedDungeon = Progress >= 100.0; } } } } else if (!HasFinishedDungeon && DungeonProfile == null && CurrentNodes.Count == 0) { LoadProfile(TryLoadProfile()); } else { // find a way to exit the dungeon, maybe hearthstone } }
public void OnUpdateUnload(CommandInfo info) { info.Enabled = CurrentNodes.All(nav => ((UnknownSolutionItem)nav.DataItem).Enabled); }
bool DrawNodesOptions(int id, int typeid, DialogueNode currentNode) { bool result = false; DialogueNodeOptionsFoldouts[typeid] = EditorGUILayout.Foldout(DialogueNodeOptionsFoldouts[typeid], "Options: " + currentNode.OptionsAttached.Length); if (DialogueNodeOptionsFoldouts[typeid]) { bool restoreFoldout = !EditorInfo.NodesOptionsFoldouts.ContainsKey(typeid); foreach (int optionIndex in currentNode.OptionsAttached) { if (restoreFoldout) { EditorInfo.RestoreFoldouts(CurrentNodes.ToArray()); break; } restoreFoldout |= !EditorInfo.NodesOptionsFoldouts[typeid].ContainsKey(optionIndex); } EditorGUILayout.BeginVertical(Config.FoldoutInteriorStyle); { foreach (int optionIndex in currentNode.OptionsAttached) { if (!EditorInfo.NodesOptionsFoldouts.ContainsKey(typeid) || !EditorInfo.NodesOptionsFoldouts[typeid].ContainsKey(optionIndex)) { Debug.Log("Zawiera type id " + typeid + ": " + EditorInfo.NodesOptionsFoldouts.ContainsKey(typeid)); Debug.Log("Zawiera option id " + optionIndex + ": " + EditorInfo.NodesOptionsFoldouts[typeid].ContainsKey(optionIndex)); } DialogueOption currentOption = CurrentOptions[optionIndex]; StringBuilder textToShow = new StringBuilder(currentOption.OptionText); if (textToShow.Length > Config.MaxQuotasLength) { textToShow.Length = Config.MaxQuotasLength - 3; textToShow.Append("..."); } string titleQuote = (textToShow.Length > 0) ? textToShow.ToString(0, (textToShow.Length >= 20) ? 20 : textToShow.Length) : ""; EditorInfo.NodesOptionsFoldouts[typeid][optionIndex] = EditorGUILayout.Foldout( EditorInfo.NodesOptionsFoldouts[typeid][optionIndex], "Option " + optionIndex + ": " + titleQuote, true ); if (EditorInfo.NodesOptionsFoldouts[typeid][optionIndex]) { Rect foldoutRect = EditorGUILayout.BeginHorizontal(Config.FoldoutInteriorStyle); { EditorGUILayout.BeginVertical(Config.InteriorLighterBackgroundStyle); { //GUILayout.Label("\"" + textToShow + "\"", Config.WrappedLabelStyle); float tempWid = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 105f; EditorGUILayout.LabelField("Text: ", "\"" + textToShow + "\"", Config.WrappedLabelStyle); if (currentOption.VisitOnce) { EditorGUILayout.LabelField("Visit Once", "Yes", EditorStyles.boldLabel); } if (currentOption.EntryConditionSet) { EditorGUILayout.LabelField("Entry Condition", "Set", EditorStyles.boldLabel); } EditorGUIUtility.labelWidth = tempWid; GUILayout.BeginHorizontal(); { DrawJumpToButton("Go To", EditorInfo.Windows[EditorInfo.OptionsIndexes[optionIndex]], GUILayout.Width(50)); } GUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); if (GUILayout.Button("x", GUILayout.Width(20))) { List <int> optionsAttachedWithout = new List <int>(currentNode.OptionsAttached); optionsAttachedWithout.Remove(optionIndex); currentNode.OptionsAttached = optionsAttachedWithout.ToArray(); EditorInfo.NodesOptionsFoldouts[typeid].Remove(optionIndex); result |= true; } } GUILayout.EndHorizontal(); } } } EditorGUILayout.EndVertical(); } return(result); }
public void Execute() { if (!Entered) { EntryTime = DateTime.Now; Entered = true; } if (DungeonProfile != null) { if (!HasFinishedDungeon) { if (CurrentNodes.Count() == 0) { LoadNodes(); } else { bool isMePartyleader = WowInterface.ObjectManager.Player.Guid == WowInterface.ObjectManager.PartyleaderGuid || WowInterface.ObjectManager.PartyleaderGuid == 0; if (isMePartyleader) { // wait for all players to arrive if (AreAllPlayersPresent()) { AllPlayerPresentDistance = 48; if (!ShouldWaitForGroup()) // ShouldWaitForGroup() { FollowNodePath(WowInterface.MovementSettings.WaypointCheckThreshold); } } else { // wait until the players are near us AllPlayerPresentDistance = 16; } } else { if (!MoveToGroupLeader()) { // wait for the group leader } } } } else { if (ExitDungeonEvent.Run()) { // find a way to exit the dungeon, maybe hearthstone if (WowInterface.HookManager.IsInLfgGroup()) { WowInterface.HookManager.LuaDoString("LFGTeleport(true);"); } } } } else { LoadProfile(TryLoadProfile()); } }
public void OnUpdateUnload(CommandInfo info) { info.Enabled = CurrentNodes.All(nav => ((Project)nav.DataItem).Enabled); }
public void OnEditProjectUpdate(CommandInfo info) { info.Visible = info.Enabled = CurrentNodes.All(nav => File.Exists(((Project)nav.DataItem).FileName)); }
IEnumerable <String> GetCurrentDirectories() { return(CurrentNodes.Select(n => GetDir(n.DataItem)).Where(d => !string.IsNullOrEmpty(d)).Distinct()); }