Exemple #1
0
        public async Task ProcessCfPop(ContentFinderCondition cfc)
        {
            if (!this.IsConnected)
            {
                return;
            }

            var contentName = cfc.Name;

            if (this.config.CfNotificationChannel == null)
            {
                return;
            }

            var channel = await GetChannel(this.config.CfNotificationChannel);

            var iconFolder = (cfc.Image / 1000) * 1000;

            var embedBuilder = new EmbedBuilder {
                Title     = "Duty is ready: " + contentName,
                Timestamp = DateTimeOffset.Now,
                Color     = new Color(0x297c00),
                ImageUrl  = "https://xivapi.com" + $"/i/{iconFolder}/{cfc.Image}.png"
            };

            await channel.SendMessageAsync(embed : embedBuilder.Build());
        }
 private void ClientStateOnCfPop(object sender, ContentFinderCondition e)
 {
     this.Discord.MessageQueue.Enqueue(new QueuedContentFinderEvent
     {
         ContentFinderCondition = e
     });
 }
Exemple #3
0
        public static void SetInstanceIcon(ContentFinderCondition sContentFinderCondition, dynamic obj)
        {
            if (sContentFinderCondition.Content.Key == 55001)
            {
                // Aquapolis
                obj.fullIcon = 1;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55002)
            {
                // Lost Canals of Uznair
                obj.fullIcon = 2;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55003)
            {
                // Hidden Canals of Uznair
                obj.fullIcon = 3;
                return;
            }

            if (sContentFinderCondition.Image.Path.EndsWith("000000.tex"))
            {
                DatabaseBuilder.PrintLine($"Content {sContentFinderCondition.Content.Key} {sContentFinderCondition.Content} has no icon");
                return;
            }

            obj.fullIcon = IconDatabase.EnsureEntry("instance", sContentFinderCondition.Image);
        }
Exemple #4
0
        public static void Init(DalamudPluginInterface pluginInterface)
        {
            //	Get the game sheets that we need to populate a zone dictionary.
            ExcelSheet <Lumina.Excel.GeneratedSheets.TerritoryType>          territorySheet     = pluginInterface.Data.GetExcelSheet <Lumina.Excel.GeneratedSheets.TerritoryType>();
            ExcelSheet <Lumina.Excel.GeneratedSheets.ContentFinderCondition> contentFinderSheet = pluginInterface.Data.GetExcelSheet <Lumina.Excel.GeneratedSheets.ContentFinderCondition>();
            ExcelSheet <Lumina.Excel.GeneratedSheets.Map> mapSheet = pluginInterface.Data.GetExcelSheet <Lumina.Excel.GeneratedSheets.Map>();

            //	Clean out anything that we had before.
            mZoneInfoDict.Clear();
            mTerritoryTypeIDToContentFinderIDDict.Clear();

            //	Populate the zero entries ahead of time since there may be a many to one relationship with some zero IDs.
            mZoneInfoDict[0] = ZoneInfo.Unknown;
            mTerritoryTypeIDToContentFinderIDDict[0] = 0;

            //	Get the name for every "MapID" that is an instance zone.  This is spread out over a few different sheets.  The ID number that gets used in the actual preset is the column 10 in
            //	TerritoryType.  The zone name is correlated in PlaceName, and the duty name and ContentLink IDs are in ContentFinderCondition.  We are using the Content link because that's what's
            //	returned by the best (working) function that I have been able to find so far for the current instance zone.  Confusingly, as scope has changed a bit, we want to store the actual
            //	ID of the maps for these zones too.  The best solution (for the time being) seems to be to store a pseudo map name string (the base of the map names for that zone) that can be cross-referenced later.
            foreach (TerritoryType zone in territorySheet.ToList())
            {
                if (zone.ExclusiveType == 2 && !mZoneInfoDict.ContainsKey(zone.Unknown10))
                {
                    ContentFinderCondition contentRow = contentFinderSheet.GetRow(zone.Unknown10);
                    if (contentRow != null &&
                        contentRow.ContentLinkType > 0 &&
                        contentRow.ContentLinkType < 3)
                    {
                        if (!mZoneInfoDict.ContainsKey(zone.Unknown10))
                        {
                            string dutyName = contentRow.Name.Trim();
                            if (dutyName.Length > 0)
                            {
                                dutyName = dutyName.First().ToString().ToUpper() + dutyName.Substring(1);
                            }
                            mZoneInfoDict.Add(zone.Unknown10, new ZoneInfo(dutyName, zone.PlaceName.Value.Name, zone.RowId, zone.Map.Value.Id.Split('/')[0], zone.Unknown10, contentRow.Content));
                        }
                        if (!mTerritoryTypeIDToContentFinderIDDict.ContainsKey(zone.RowId))
                        {
                            mTerritoryTypeIDToContentFinderIDDict.Add(zone.RowId, zone.Unknown10);
                        }
                    }
                }
            }

            //	Now get all of the map info for each territory.  We're doing it this way rather than solely taking the map column
            //	from the TerritoryType sheet because it's easier to handle when a territory has multiple maps this way, rather than
            //	testing each map name for something other than a "/00" and then incrementing until we find where the maps stop existing.
            foreach (Map map in mapSheet.ToList())
            {
                string mapZoneKey = map.Id.Split('/')[0];

                if (!mMapInfoDict.ContainsKey(mapZoneKey))
                {
                    mMapInfoDict.Add(mapZoneKey, new List <MapInfo>());
                }

                mMapInfoDict[mapZoneKey].Add(new MapInfo(map.Id, map.SizeFactor, map.OffsetX, map.OffsetY, map.PlaceNameSub.Value.Name));
            }
        }
Exemple #5
0
        public static void SetInstanceIcon(ContentFinderCondition sContentFinderCondition, dynamic obj)
        {
            if (sContentFinderCondition.Content.Key == 55001)
            {
                // Aquapolis
                obj.fullIcon = 1;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55002)
            {
                // Lost Canals of Uznair
                obj.fullIcon = 2;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55003)
            {
                // Hidden Canals of Uznair
                obj.fullIcon = 3;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55004)
            {
                // The Shifting Altars of Uznair
                obj.fullIcon = 4;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55006)
            {
                // The Dungeons of Lyhe Ghiah
                obj.fullIcon = 5;
                return;
            }

            if (sContentFinderCondition.Content.Key == 55008)
            {
                // The Shifting Oubliettes of Lyhe Ghiah
                obj.fullIcon = 6;
                return;
            }

            if (sContentFinderCondition.Image == null)
            {
                DatabaseBuilder.PrintLine($"Content {sContentFinderCondition.Content.Key} {sContentFinderCondition.Content} has no icon");
                return;
            }

            obj.fullIcon = IconDatabase.EnsureEntry("instance", sContentFinderCondition.Image);
        }
Exemple #6
0
 private void NetworkHandlersOnCfPop(object sender, ContentFinderCondition e)
 {
     CfPop?.Invoke(this, e);
 }
Exemple #7
0
        public override async Task <bool> InvokeAsync(string paramList)
        {
            string CsvFileFormat = "exd/map5x.csv";

            IEnumerable <string> filesToExport;


            //var target = new FileInfo(Path.Combine(_Realm.GameVersion, CsvFileFormat));
            //	if (!target.Directory.Exists)
            //		target.Directory.Create();
            FileHelperEngine <MappyNPC> engine = new FileHelperEngine <MappyNPC>();

            MappyNPC[] result = engine.ReadFile(@"H:\xivapi_mappy_2019-10-13-10-11-12.csv");

            var DeepDungeons = _Realm.GameData.GetSheet("DeepDungeon");
            var Pomandander  = _Realm.GameData.GetSheet("DeepDungeonItem");
            // var ContentFinderCond = _Realm.GameData.GetSheet("ContentFinderCondition");
            var ContentFinderCond = _Realm.GameData.GetSheet <ContentFinderCondition>();
            var InstanceContent   = _Realm.GameData.GetSheet("InstanceContent");
            //var TerritoryType = _Realm.GameData.GetSheet("TerritoryType");
            var TerritoryType = _Realm.GameData.GetSheet <TerritoryType>();
            var Aetheryte     = _Realm.GameData.GetSheet("Aetheryte");
            var Quests        = _Realm.GameData.GetSheet <Quest>();
            var PlaceName     = _Realm.GameData.GetSheet <PlaceName>();
            var test          = _Realm.Packs.GetFile(@"bg/ffxiv/fst_f1/cnt/f1c1/collision/f1c1_a1_ge01a.pcb");

            var poms            = Pomanders();
            var DeepDungeonList = new List <DeepDungeon>();

            foreach (var dd in DeepDungeons.Where(i => i.Key > 0))
            {
                var CurrentDeepDungeon =
                    new DeepDungeon(dd.Key, dd["Name"].ToString(), dd.AsInt32("ContentFinderCondition"));
                var pomanderMap = new Dictionary <int, int>();
                // OutputInformation($"Deep Dungeon: {dd["Name"]}");

                for (int i = 1; i < 17; i++)
                {
                    pomanderMap.Add(dd.AsInt32($"Inventory{i}"), i - 1);
                }
                //OutputInformation($"{dd.AsInt32($"Inventory{i}")} , {i-1}");

                CurrentDeepDungeon.PomanderMapping = pomanderMap;

                //ContentFinderCondition Gives us the info of different conditions for the DD floors.
                ContentFinderCondition CF = new ContentFinderCondition(ContentFinderCond,
                                                                       ContentFinderCond[dd.AsInt32("ContentFinderCondition")]);
                CurrentDeepDungeon.ContentFinderId = CF.Key;

                TerritoryType ter = TerritoryType[CF.As <TerritoryType>("TerritoryType").Key];
                //TerritoryType.First(i => i.Key == CF.As<TerritoryType>("TerritoryType").Key);


                // OutputInformation($"Name: {CF.Name} ({ter.PlaceName.NameWithoutArticle})");
                CurrentDeepDungeon.NameWithoutArticle = ter.PlaceName.NameWithoutArticle;

                //Get Lobby mapid
                var lobby = TerritoryType.First(i =>
                                                i.PlaceName == ter.PlaceName && i.AsInt32("TerritoryIntendedUse") == 12);
                //  OutputInformation($"Lobby: {lobby.Key} ");
                CurrentDeepDungeon.LobbyId = lobby.Key;

                var questid = CF.As <Quest>("UnlockQuest");
                // OutputInformation($"Quest: {questid.Name} ({questid.Key})");
                CurrentDeepDungeon.UnlockQuest = questid.Key;

                MappyNPC    npc  = result.First(i => i.ENpcResidentID == questid.TargetENpc.Key);
                EntranceNpc enpc = new EntranceNpc(npc, lobby.As <XivRow>("Aetheryte").Key);
                CurrentDeepDungeon.Npc = enpc;


                //  OutputInformation($"{enpc}");

                //  OutputInformation($"hmm: {Aetheryte[enpc.AetheryteId].As<PlaceName>("PlaceName").Name}");


                //OutputInformation($"hmm: {Aetheryte[enpc.AetheryteId].As<PlaceName>("PlaceName").Name}");
                //OutputInformation($"Location ZonePlaceName: {ter.ZonePlaceName} Key: {ter.Key}");
                //   OutputInformation("");
                DeepDungeonList.Add(CurrentDeepDungeon);
            }

            foreach (var DeepIndex in DeepDungeonList)
            {
                OutputInformation($"{DeepIndex}");
                bool foundSecond = false;
                foreach (var ct in ContentFinderCond.Where(i =>
                                                           i.ContentType.Name == "Deep Dungeons" && i.Name.ToString().Contains(DeepIndex.NameWithoutArticle)))
                {
                    var ter = TerritoryType.First(i => i.Key == ct.As <TerritoryType>("TerritoryType").Key);
                    ContentFinderCondition CF = new ContentFinderCondition(ContentFinderCond, ct); //Content
                    InstanceContent        ic = new InstanceContent(InstanceContent, CF.Content);
                    var questid = CF.As <Quest>("UnlockQuest");


                    // OutputInformation($"Name: {ct.Name} MapId: {ter.Key} Quest: {questid.Key} ContentFinderId: {CF.Key} InstanceID: {ic.Key}");
                    var name = ct.Name.ToString();

                    var name1 = name.Substring(name.IndexOf('(') + 1, name.IndexOf(')') - name.IndexOf('(') - 1);
                    var name2 = name1.Split(' ')[1].Split('-');
                    int start;
                    int.TryParse(name2[0], out start);
                    int end;
                    int.TryParse(name2[1], out end);

                    DeepIndex.Floors.Add(new FloorSetting(ct.Name, ic.Key, CF.Key, ter.Key, questid.Key, start, end));
                    //OutputInformation($"{start} to floor {end}");

/*
 *                  if (!foundSecond && ter.Key > DeepIndex.LobbyId)
 *                  {
 *                      DeepIndex.StartAt = start;
 *                      DeepIndex.StartAtContentFinderId = CF.Key;
 *                      foundSecond = true;
 *                  }
 */
                }

                foreach (var floor in DeepIndex.Floors)
                {
                    // OutputInformation($"{floor}");
                }

                //OutputInformation($"You can start at floor {DeepIndex.StartAt} ({(ContentFinderCond[DeepIndex.StartAtContentFinderId].Name)})");
            }
            //21
            //JsonConvert.SerializeObject(DeepDungeonList)
            using (StreamWriter outputFile = new StreamWriter("DeepDungeons.json", false))
            {
                outputFile.Write(JsonConvert.SerializeObject(DeepDungeonList, Formatting.Indented));
            }



            // var pcb = new PcbFile(test);
            // foreach (var p in pcb.Data)
            //  {
            //     OutputInformation($"{p.ToString()}");
            // }
            //  OutputInformation($"{pcb.ToString()}");


            //CsvFileFormat = "collision/{0}";
            //var target = new FileInfo(Path.Combine(_Realm.GameVersion, string.Format(CsvFileFormat,"f1c1_a1_ge01a.pcb")));
            //if (!target.Directory.Exists)
            //    target.Directory.Create();
            //
            //System.IO.File.WriteAllBytes(target.FullName, Makeobj);

            //MapCol();

            //SaveAsCsv(data, Language.English, "d:\\out.csv");


            // OutputInformation($"Count: {result.Length}");
            // MappyNPC npc = result.First(i => i.ENpcResidentID == 1025846);
            // OutputInformation($"Mappy: {npc.Name} {npc.CoordinateX} {npc.CoordinateY} {npc.CoordinateZ}");

            return(true);
        }