private static void ApplyHiddenItemsAndCoordinates(ItemManager gatherables, AetheryteManager aetherytes, Dictionary <uint, Node> baseIdToNode) { var hidden = new NodeHidden(gatherables); foreach (var node in baseIdToNode) { NodeCoords.SetCoords(node.Value, aetherytes); hidden.SetHiddenItems(node.Value); } }
public World(DalamudPluginInterface pi, GatherBuddyConfiguration config) { _pi = pi; Language = pi.ClientState.ClientLanguage; Territories = new TerritoryManager(); Aetherytes = new AetheryteManager(pi, Territories); Items = new ItemManager(pi); Nodes = new NodeManager(pi, config, this, Aetherytes, Items); Fish = new FishManager(pi, this, Aetherytes); PluginLog.Verbose("{Count} regions collected.", Territories.Regions.Count); PluginLog.Verbose("{Count} territories collected.", Territories.Territories); }
public NodeManager(DalamudPluginInterface pi, GatherBuddyConfiguration config, World territories, AetheryteManager aetherytes, ItemManager gatherables) { var baseSheet = pi.Data.GetExcelSheet <GatheringPointBase>(); var nodeSheet = pi.Data.GetExcelSheet <GatheringPoint>(); Dictionary <uint, Node> baseIdToNode = new((int)baseSheet.RowCount); NodeIdToNode = new Dictionary <uint, Node>((int)nodeSheet.RowCount); foreach (var nodeRow in nodeSheet) { var baseId = nodeRow.GatheringPointBase.Row; if (baseId >= baseSheet.RowCount) { continue; } if (baseIdToNode.TryGetValue(baseId, out var node)) { NodeIdToNode[nodeRow.RowId] = node; if ((node.Nodes !.Territory?.Id ?? 0) != nodeRow.TerritoryType.Row) { PluginLog.Error($"Different gathering nodes to the same base {baseId} have different territories."); } if (!node.Nodes.Nodes.ContainsKey(nodeRow.RowId)) { node.Nodes.Nodes[nodeRow.RowId] = null; } continue; } if (nodeRow.TerritoryType.Row < 2) { continue; } node = new Node { PlaceNameEn = FFName.FromPlaceName(pi, nodeRow.PlaceName.Row)[Dalamud.ClientLanguage.English], Nodes = new SubNodes() { Territory = territories.FindOrAddTerritory(nodeRow.TerritoryType.Value), }, }; node.Nodes.Nodes[nodeRow.RowId] = null; if (node.Nodes.Territory == null) { continue; } var(times, type) = GetTimes(pi, nodeRow.RowId); node.Times = times; var baseRow = baseSheet.GetRow(baseId); node.Meta = new NodeMeta(baseRow, type); if (node.Meta.GatheringType >= GatheringType.Spearfishing) { continue; } node.Items = new NodeItems(node, baseRow.Item, gatherables); if (node.Items.NoItems()) { PluginLog.Debug("Gathering node {RowId} has no items, skipped.", nodeRow.RowId); continue; } baseIdToNode[baseId] = node; NodeIdToNode[nodeRow.RowId] = node; } Records = new NodeRecorder(pi, this, config.Records); PluginLog.Verbose("{Count} unique gathering nodes collected.", NodeIdToNode.Count); PluginLog.Verbose("{Count} base gathering nodes collected.", baseIdToNode.Count); ApplyHiddenItemsAndCoordinates(gatherables, aetherytes, baseIdToNode); }