Beispiel #1
0
 public Aetheryte(int id, int x, int y)
 {
     Id       = id;
     XCoord   = x;
     YCoord   = y;
     NameList = new FFName();
 }
Beispiel #2
0
 public Bait(uint id, FFName name)
 {
     Id   = id;
     Name = name;
 }
Beispiel #3
0
        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);
        }