Esempio n. 1
0
        private static byte[] GetZoneBytes(EncounterTable8 zone, IReadOnlyDictionary <ulong, byte> zoneLoc)
        {
            byte locID = zoneLoc[zone.ZoneID];
            var  list  = new List <Slot8>();

            for (int i = 0; i < zone.SubTables.Length; i++)
            {
                var weather = (SWSHEncounterType)(1 << i);
                var table   = zone.SubTables[i];
                var min     = table.LevelMin;
                var max     = table.LevelMax;
                foreach (var s in table.Slots)
                {
                    var s8 = new Slot8(s.Species, s.Form, min, max)
                    {
                        EncounterType = weather
                    };
                    var match = list.Find(z => z.Equals(s8));
                    if (match == null)
                    {
                        list.Add(s8);
                    }
                    else
                    {
                        match.EncounterType |= weather;
                    }
                }
            }

            return(SerializeSlot8(locID, list));
        }
Esempio n. 2
0
        private static DumpableLocation GetDumpable(EncounterTable8 zone, IReadOnlyDictionary <ulong, byte> zoneLoc, IReadOnlyDictionary <ulong, byte> zoneType)
        {
            // Don't dump data that we can't correlate to a zone
            if (!zoneLoc.TryGetValue(zone.ZoneID, out var tmp))
            {
                return(DumpableLocation.Empty);
            }

            // Try to get the table type. Skip inaccessible tables.
            if (!zoneType.TryGetValue(zone.ZoneID, out var slottype) || slottype == (byte)Inaccessible)
            {
                return(DumpableLocation.Empty);
            }

            byte locID = tmp;
            var  list  = new List <Slot8>();

            for (int i = 0; i < zone.SubTables.Length; i++)
            {
                var weather = (SWSHEncounterType)(1 << i);

                if (!IsPermittedWeather(locID, weather, slottype))
                {
                    continue;
                }

                var table = zone.SubTables[i];
                var min   = table.LevelMin;
                var max   = table.LevelMax;
                foreach (var s in table.Slots)
                {
                    if (s.Species == 0)
                    {
                        continue;
                    }

                    var s8 = new Slot8(s.Species, s.Form, min, max)
                    {
                        EncounterType = weather
                    };
                    var match = list.Find(z => z.Equals(s8));
                    if (match == null)
                    {
                        list.Add(s8);
                    }
                    else
                    {
                        match.EncounterType |= weather;
                    }
                }
            }

            return(new DumpableLocation(list, locID, slottype));
        }
Esempio n. 3
0
        private static byte[] GetZoneBytes(EncounterTable8 zone, IReadOnlyDictionary <ulong, byte> zoneLoc)
        {
            // Don't dump data that we can't correlate to a zone
            if (!zoneLoc.TryGetValue(zone.ZoneID, out var tmp))
            {
                return(Array.Empty <byte>());
            }

            byte locID = tmp;
            var  list  = new List <Slot8>();

            for (int i = 0; i < zone.SubTables.Length; i++)
            {
                var weather = (SWSHEncounterType)(1 << i);
                var table   = zone.SubTables[i];
                var min     = table.LevelMin;
                var max     = table.LevelMax;
                foreach (var s in table.Slots)
                {
                    var s8 = new Slot8(s.Species, s.Form, min, max)
                    {
                        EncounterType = weather
                    };
                    var match = list.Find(z => z.Equals(s8));
                    if (match == null)
                    {
                        list.Add(s8);
                    }
                    else
                    {
                        match.EncounterType |= weather;
                    }
                }
            }

            return(SerializeSlot8(locID, list));
        }
Esempio n. 4
0
 public void SetSlot(string Slot)
 {
     if (Slot == "wood")
     {
         if (CheckWood() == 0)
         {
             if (CheckSlot() == 1)
             {
                 Slot1.GetComponent <RawImage>().texture = wood;
                 Text1.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 2)
             {
                 Slot2.GetComponent <RawImage>().texture = wood;
                 Text2.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 3)
             {
                 Slot3.GetComponent <RawImage>().texture = wood;
                 Text3.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 4)
             {
                 Slot4.GetComponent <RawImage>().texture = wood;
                 Text4.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 5)
             {
                 Slot5.GetComponent <RawImage>().texture = wood;
                 Text5.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 6)
             {
                 Slot6.GetComponent <RawImage>().texture = wood;
                 Text6.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 7)
             {
                 Slot7.GetComponent <RawImage>().texture = wood;
                 Text7.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 8)
             {
                 Slot8.GetComponent <RawImage>().texture = wood;
                 Text8.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 9)
             {
                 Slot9.GetComponent <RawImage>().texture = wood;
                 Text9.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 10)
             {
                 Slot10.GetComponent <RawImage>().texture = wood;
                 Text10.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 11)
             {
                 Slot11.GetComponent <RawImage>().texture = wood;
                 Text11.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 12)
             {
                 Slot12.GetComponent <RawImage>().texture = wood;
                 Text12.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 13)
             {
                 Slot13.GetComponent <RawImage>().texture = wood;
                 Text13.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 14)
             {
                 Slot14.GetComponent <RawImage>().texture = wood;
                 Text14.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 15)
             {
                 Slot15.GetComponent <RawImage>().texture = wood;
                 Text15.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
         }
         else if (CheckWood() == 1)
         {
             Text1.text = ("" + Player.GetComponent <PlayerSatatus>().wood);
         }
         else if (CheckWood() == 2)
         {
             Text2.text = ("" + Player.GetComponent <PlayerSatatus>().wood);
         }
     }
     else if (Slot == "stone")
     {
         if (CheckStone() == 0)
         {
             if (CheckSlot() == 1)
             {
                 Slot1.GetComponent <RawImage>().texture = stone;
                 Text1.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 2)
             {
                 Slot2.GetComponent <RawImage>().texture = stone;
                 Text2.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 3)
             {
                 Slot3.GetComponent <RawImage>().texture = stone;
                 Text3.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 4)
             {
                 Slot4.GetComponent <RawImage>().texture = stone;
                 Text4.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 5)
             {
                 Slot5.GetComponent <RawImage>().texture = stone;
                 Text5.text = ("" + Player.GetComponent <PlayerSatatus>().stone);
             }
             else if (CheckSlot() == 6)
             {
                 Slot6.GetComponent <RawImage>().texture = stone;
                 Text6.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 7)
             {
                 Slot7.GetComponent <RawImage>().texture = stone;
                 Text7.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 8)
             {
                 Slot8.GetComponent <RawImage>().texture = stone;
                 Text8.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 9)
             {
                 Slot9.GetComponent <RawImage>().texture = stone;
                 Text9.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 10)
             {
                 Slot10.GetComponent <RawImage>().texture = stone;
                 Text10.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 11)
             {
                 Slot11.GetComponent <RawImage>().texture = stone;
                 Text11.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 12)
             {
                 Slot12.GetComponent <RawImage>().texture = stone;
                 Text12.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 13)
             {
                 Slot13.GetComponent <RawImage>().texture = stone;
                 Text13.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 14)
             {
                 Slot14.GetComponent <RawImage>().texture = stone;
                 Text14.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 15)
             {
                 Slot15.GetComponent <RawImage>().texture = stone;
                 Text15.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
         }
         else if (CheckStone() == 1)
         {
             Text1.text = ("" + Player.GetComponent <PlayerSatatus>().stone);
         }
         else if (CheckStone() == 2)
         {
             Text2.text = ("" + Player.GetComponent <PlayerSatatus>().stone);
         }
     }
 }
Esempio n. 5
0
 int CheckStone()
 {
     if (Slot1.GetComponent <RawImage>().texture == stone)
     {
         return(1);
     }
     else if (Slot2.GetComponent <RawImage>().texture == stone)
     {
         return(2);
     }
     else if (Slot3.GetComponent <RawImage>().texture == stone)
     {
         return(3);
     }
     else if (Slot4.GetComponent <RawImage>().texture == stone)
     {
         return(4);
     }
     else if (Slot5.GetComponent <RawImage>().texture == stone)
     {
         return(5);
     }
     else if (Slot6.GetComponent <RawImage>().texture == stone)
     {
         return(6);
     }
     else if (Slot7.GetComponent <RawImage>().texture == stone)
     {
         return(7);
     }
     else if (Slot8.GetComponent <RawImage>().texture == stone)
     {
         return(8);
     }
     else if (Slot9.GetComponent <RawImage>().texture == stone)
     {
         return(9);
     }
     else if (Slot10.GetComponent <RawImage>().texture == stone)
     {
         return(10);
     }
     else if (Slot11.GetComponent <RawImage>().texture == stone)
     {
         return(11);
     }
     else if (Slot12.GetComponent <RawImage>().texture == stone)
     {
         return(12);
     }
     else if (Slot13.GetComponent <RawImage>().texture == stone)
     {
         return(13);
     }
     else if (Slot14.GetComponent <RawImage>().texture == stone)
     {
         return(14);
     }
     else if (Slot15.GetComponent <RawImage>().texture == stone)
     {
         return(15);
     }
     else
     {
         return(0);
     }
 }