Exemplo n.º 1
0
 public string GetStoryPoint(int id)
 {
     if (storyProgression.ContainsKey(id))
     {
         var locations = new FFVIIILocation();
         return(locations.locationList[storyProgression[id]]);
     }
     return("???");
 }
        public void GetFieldValues()
        {
            List <FFVIIIComponent> addresses = new List <FFVIIIComponent>();

            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FE9C8, ByteLength = 2, Description = "SeeD Pts"
            });
            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FE764, ByteLength = 4, Description = "Gil"
            });

            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FE9CC, ByteLength = 2, Description = "Battles Won"
            });
            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FE9D2, ByteLength = 2, Description = "Battles Escaped"
            });

            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FE928, ByteLength = 4, Description = "Play Time"
            });

            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FEAB8, ByteLength = 2, Description = "Story Progress"
            });

            //Centra
            addresses.Add(new FFVIIIComponent {
                AddressOffset = 0x18FE940, ByteLength = 1, Description = "Tonberry Kills"
            });

            Dictionary <string, string> fieldStats = new Dictionary <string, string>();

            foreach (FFVIIIComponent viiiComponent in addresses)
            {
                int i = ReadMemoryAddress(viiiComponent.AddressOffset, viiiComponent.ByteLength);

                string output = i.ToString();

                //Play Time
                if (viiiComponent.AddressOffset == 0x18FE928)
                {
                    TimeSpan t = TimeSpan.FromSeconds(i);

                    output = string.Format("{0:D2}:{1:D2}",
                                           t.Hours,
                                           t.Minutes);
                }
                //SeeD Pts
                else if (viiiComponent.AddressOffset == 0x18FE9C8)
                {
                    output = output + "(Lv. " + (i / 100) + ")";
                }

                fieldStats.Add(viiiComponent.Description, output);
            }

            /*********** MAP LOCATION ***********/

            //Are we in a local map or the world map?
            //This will be 0 on world map and 1 in local maps
            //EXCEPT, it will also be 1 when in menu.
            //So we'll combine it with a model loading flag
            var townMapLoadedAddress = new FFVIIIComponent {
                AddressOffset = 0x1C3ED2C, ByteLength = 2, Description = "In Town"
            };
            var partyLoadedAddress = new FFVIIIComponent {
                AddressOffset = 0x18C2A34, ByteLength = 2, Description = "Party Loaded"
            };
            var  townMapLoaded = ReadMemoryAddress(townMapLoadedAddress.AddressOffset, townMapLoadedAddress.ByteLength);
            var  partyLoaded   = ReadMemoryAddress(partyLoadedAddress.AddressOffset, partyLoadedAddress.ByteLength);
            bool inTown        = false;

            if (townMapLoaded == 1 && partyLoaded == 1)
            {
                //We're truly in town
                inTown = true;
            }
            if (inTown)
            {
                //Where are we?
                var locations = new FFVIIILocation();
                var maps      = new FFVIIIMap();
                var thisMap   = new FFVIIIComponent {
                    AddressOffset = 0x18D2FC0, ByteLength = 2, Description = "Current Map"
                };
                int    thisMapId         = ReadMemoryAddress(thisMap.AddressOffset, thisMap.ByteLength);
                int    thisMapLocationId = maps.getLocation(thisMapId);
                string thisMapName       = locations.getName(thisMapLocationId);

                fieldStats.Add("Location", thisMapName);
            }
            else
            {
                fieldStats.Add("Location", "World Map");
            }

            MakeWebpage(fieldStats);
        }