Beispiel #1
0
 public EntranceNpc(MappyNPC npc, int aetheryteId)
 {
     Location    = new [] { npc.CoordinateX, npc.CoordinateZ, npc.CoordinateY };
     NpcId       = npc.ENpcResidentID;
     Name        = npc.Name.Replace('"', ' ').Trim();
     MapId       = npc.MapTerritoryID;
     AetheryteId = aetheryteId;
 }
Beispiel #2
0
        private void ParseGather(GatheringPoint g, IEnumerable <MapMarker> maps)
        {
            //Beast Tribe and Leve Quests get Territory type 1 most of the time....
            if (g.Base.Key == 0 || g.TerritoryType.Key == 1 || g.Base.GatheringLevel == 0 || !g.Base.Items.Any() || g.Base.Items.All(i => i.Item.Key >= 2000000 && i.Item.Key < 3000000))
            {
                return;
            }
            var ng = new GatheringData();

            ng.NodeId = Convert.ToUInt32(g.Key);

            if (g.GatheringPointBonus.Length >= 1)
            {
                ng.Bonus = Convert.ToUInt32(g.GatheringPointBonus[0].Key);
            }


            ng.Level = Convert.ToUInt32(g.TerritoryType.Key);

            ng.Position = LevelBuilder.Level(_Realm.GameData.GetSheet <SaintCoinach.Xiv.Level>().FirstOrDefault(i => i.Object == g));



            /// <summary>
            /// 0 -> Mining
            /// 1 -> Quarrying
            /// 2 -> Logging
            /// 3 -> Harrvesting
            /// 4 -> SpearFishing
            /// </summary>

            var type = Convert.ToByte(g.Base.Type.Key); //

            if (type < 2)
            {
                ng.Job = 16; //miner
            }
            else if (type < 4)
            {
                ng.Job = 17; //bot
            }
            else
            {
                ng.Job = 18; //fisher
            }
            if (g.GatheringSubCategory == null)
            {
                ng.RequiredBook = 0;
            }
            else
            {
                ng.RequiredBook = Convert.ToUInt32(g.GatheringSubCategory.Item.Key);
            }



            ng.Territory = Convert.ToUInt32(g.TerritoryType.Key);

            ng.TerritoryName = g.TerritoryType.Name.ToString();


            if (g.PlaceName.Key != 0)
            {
                ng.Place = Convert.ToUInt32(g.PlaceName.Key);

                ng.PlaceName = g.PlaceName.Name.ToString();

                var map = g.TerritoryType.Map;
                var X   = maps.Where(i => i.Place.Key == g.PlaceName.Key);
                //hard coded fix for hell's lid
                if (g.PlaceName.Key == 2762)
                {
                    X = X.Where(i => i.Key == 17);
                }
                if (X.Count() == 0)
                {
                    var Y = _Realm.GameData.GetSheet <SpearfishingNotebook>().Where(t => t.PlaceName.Key == g.PlaceName.Key);
                    if (Y.Count() == 0 || Y.Count() > 1)
                    {
                        Debugger.Break();
                    }

                    ng.PlaceX = (float)map.ToMapCoordinate3d(Y.First().X, map.OffsetX);
                    ng.PlaceY = (float)map.ToMapCoordinate3d(Y.First().Y, map.OffsetY);
                }
                else if (X.Count() > 1)
                {
                    Debugger.Break();
                }
                else
                {
                    ng.PlaceX = (float)map.ToMapCoordinate3d(X.First().X, map.OffsetX);
                    ng.PlaceY = (float)map.ToMapCoordinate3d(X.First().Y, map.OffsetY);
                }
            }
            ng.Timed = g.Base.IsLimited;
            var bg = g.Base.Key;

            MappyNPC npc = mappyDataResult.First(i => i.ENpcResidentID == ng.NodeId);

            //OutputInformation($"{g.Base.Key} count - {mappyDataResult.Count(i => i.ENpcResidentID == ng.NodeId)} ");
            if (ng.Timed)
            {
                var garland = GarlandBellGathering.First(i => i.Id == bg);
                ng.Timer    = new List <uint>(garland.Time);
                ng.Duration = garland.Uptime;
            }
            if (ng.Position != null)
            {
                OutputInformation($"{ng.NodeId} {g.Base.Key}  {ng.Position.ZoneId} {ng.NodeId} {ng.Position.ToVec3<Vector3>()}");
            }
            else
            {
                OutputInformation($"{ng.NodeId} {g.Base.Items.FirstOrDefault().Item.Name} ({npc.CoordinateX}, {npc.CoordinateZ}, {npc.CoordinateY})");
            }
            GatherData.Add(ng.NodeId, ng);
        }
Beispiel #3
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);
        }