Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AnimalIslandBalloonPredictor
- {
- internal static class Logic
- {
- private static readonly string[] Names = {
- "Fossils",
- "Furniture",
- "Gyroids",
- "Apples",
- "Oranges",
- "Peaches",
- "Pears",
- "Cherries",
- "Turnips",
- "Mushrooms",
- "Candy",
- "100 Bells",
- "Chest (Seedlings, Diaries, Tickets, & Grab Bags)",
- "Signboards",
- "Shirts",
- "Trash",
- "Pitfall",
- "Conch Shell",
- "Lion's Paw Shell",
- "Coral",
- "Purple Cosmos",
- "Blue Cosmos",
- "Yellow Cosmos",
- "Red Tulips",
- "White Tulips",
- "Yellow Tulips",
- "White Pansies",
- "Purple Pansies",
- "Yellow Pansies",
- "Flower Leaves",
- "Coconuts",
- "Player Cabana",
- "Islander House",
- "Saplings",
- "Small Trees",
- "Medium Trees",
- "Large Trees",
- "Fully Grown Trees",
- "Dead Saplings",
- "Apple Trees",
- "Orange Trees",
- "Peach Trees",
- "Pear Trees",
- "Cherry Trees",
- "Small Stumps",
- "Medium Stumps",
- "Large Stumps",
- "Fully Grown Stumps",
- "Palm Saplings",
- "Small Palm Trees",
- "Medium Palm Trees",
- "Large Palm Trees",
- "Palm Trees",
- "Dead Palm Saplings",
- "Palm Trees with Coconuts",
- "Small Palm Stumps",
- "Medium Palm Stumps",
- "Large Palm Stumps",
- "Fully Grown Palm Stumps",
- "Island Flagpole",
- "Holes",
- "Buried Pitfalls",
- "Cedar Saplings",
- "Dead Cedar Saplings",
- "Weeds",
- "Rocks",
- "1,000 Bell Bags",
- "10,000 Bell Bags",
- "30,000 Bell Bags",
- "Nets",
- "Golden Nets",
- "Axes",
- "Golden Axes",
- "Shovels",
- "Golden Shovels",
- "Fishing Rods",
- "Golden Rods",
- "Umbrellas",
- "Paint Cans",
- "Balloons",
- "Pinwheels",
- "Fans",
- "Carpets",
- "Wallpaper",
- "K.K. Airchecks",
- "NES Games",
- "Flower Bags",
- "Reserved Tile"
- };
- private sealed class ItemGenerationGroup
- {
- private readonly ushort item_no;
- private readonly byte tile_no;
- private readonly byte unk;
- private readonly string? name;
- public ItemGenerationGroup(ushort ino, byte tno, byte u, string? n = null)
- {
- item_no = ino;
- tile_no = tno;
- unk = u;
- name = n;
- }
- public string Name => name ?? Names[tile_no];
- }
- private static readonly ushort[][] rngTable = new ushort[160][]
- {
- new ushort[]{ 0x0001, 0x0016 }, new ushort[]{ 0x0052, 0x001a }, new ushort[]{ 0x0053, 0x001c }, new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x001e, 0x0005 }, new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x004d, 0x0022 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0017 }, new ushort[]{ 0x0052, 0x001b }, new ushort[]{ 0x0053, 0x001d }, new ushort[]{ 0x000e, 0x001f }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x0009, 0x0006 }, new ushort[]{ 0x0043, 0x000a }, new ushort[]{ 0x004d, 0x0022 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0043, 0x000a }, new ushort[]{ 0x0007, 0x0004 }, new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x0007, 0x0004 }, new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0007, 0x0004 }, new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0007, 0x0004 }, new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0044, 0x000b }, new ushort[]{ 0x0009, 0x0006 }, new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0043, 0x000a }, new ushort[]{ 0x0009, 0x0006 }, new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x0009, 0x0006 }, new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0042, 0x0009 }, new ushort[]{ 0x0009, 0x0006 }, new ushort[]{ 0x000b, 0x0008 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0002, 0x0021 }, new ushort[]{ 0x0001, 0x0017 }, new ushort[]{ 0x000e, 0x001f }, new ushort[]{ 0x004d, 0x0022 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0016 }, new ushort[]{ 0x0052, 0x001a }, new ushort[]{ 0x0053, 0x001c }, new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0019 }, new ushort[]{ 0x0001, 0x0018 }, new ushort[]{ 0x0002, 0x0021 }, new ushort[]{ 0x000e, 0x001f }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0017 }, new ushort[]{ 0x0052, 0x001b }, new ushort[]{ 0x0053, 0x001d }, new ushort[]{ 0x000e, 0x001f }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000e, 0x001e }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0018 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0017 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0016 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0016 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0055, 0x0024 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0019 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0017 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 },
- new ushort[]{ 0x0001, 0x0017 }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0010, 0x000c }, new ushort[]{ 0x000f, 0x0025 }, new ushort[]{ 0x0000, 0x0000 }
- };
- private static readonly ItemGenerationGroup[] grps =
- {
- new ItemGenerationGroup(0x2800, 0x03, 0x00), // 00
- new ItemGenerationGroup(0x2804, 0x04, 0x00), // 01
- new ItemGenerationGroup(0x2803, 0x05, 0x00), // 02
- new ItemGenerationGroup(0x2802, 0x06, 0x00), // 03
- new ItemGenerationGroup(0x2801, 0x07, 0x00), // 04
- new ItemGenerationGroup(0x2807, 0x1e, 0x00), // 05
- new ItemGenerationGroup(0x2805, 0x09, 0x00), // 06
- new ItemGenerationGroup(0x2806, 0x0a, 0x00), // 07
- new ItemGenerationGroup(0x2103, 0x0b, 0x00), // 08
- new ItemGenerationGroup(0x2100, 0x42, 0x00), // 09
- new ItemGenerationGroup(0x2101, 0x43, 0x00), // 0A
- new ItemGenerationGroup(0x2102, 0x44, 0x00), // 0B
- new ItemGenerationGroup(0x2512, 0x10, 0x00), // 0C
- new ItemGenerationGroup(0x0849, 0x56, 0x00), // 0D
- new ItemGenerationGroup(0x084a, 0x56, 0x00), // 0E
- new ItemGenerationGroup(0x0848, 0x56, 0x00), // 0F
- new ItemGenerationGroup(0x084b, 0x56, 0x00), // 10
- new ItemGenerationGroup(0x084c, 0x56, 0x00), // 11
- new ItemGenerationGroup(0x084d, 0x56, 0x00), // 12
- new ItemGenerationGroup(0x0845, 0x56, 0x00), // 13
- new ItemGenerationGroup(0x0846, 0x56, 0x00), // 14
- new ItemGenerationGroup(0x0847, 0x56, 0x00), // 15
- new ItemGenerationGroup(0x0000, 0x01, 0x01, "Common Furniture"), // 16
- new ItemGenerationGroup(0x0001, 0x01, 0x01, "Rare Furniture"), // 17
- new ItemGenerationGroup(0x0002, 0x01, 0x01, "50/50 Lottery/Event Furniture"), // 18
- new ItemGenerationGroup(0x0003, 0x01, 0x01, "Island Furniture"), // 19
- new ItemGenerationGroup(0x0009, 0x52, 0x01, "Common Carpet"), // 1A
- new ItemGenerationGroup(0x000a, 0x52, 0x01, "Rare Carpet"), // 1B
- new ItemGenerationGroup(0x000b, 0x53, 0x01, "Common Wallpaper"), // 1C
- new ItemGenerationGroup(0x000c, 0x53, 0x01, "Rare Wallpaper"), // 1D
- new ItemGenerationGroup(0x000d, 0x0e, 0x01, "Common Clothes"), // 1E
- new ItemGenerationGroup(0x000e, 0x0e, 0x01, "Rare Clothes"), // 1F
- new ItemGenerationGroup(0x0005, 0x00, 0x01, "50/50 Single-part Fossil/Multi-part Fossil"), // 20
- new ItemGenerationGroup(0x0007, 0x02, 0x01, "Gyroid"), // 21
- new ItemGenerationGroup(0x0008, 0x4d, 0x01, "Umbrella"), // 22
- new ItemGenerationGroup(0x0006, 0x54, 0x01, "K.K. Aircheck"), // 23
- new ItemGenerationGroup(0x0004, 0x55, 0x01, "Island NES"), // 24
- new ItemGenerationGroup(0x0011, 0x0f, 0x01, "Trash") // 25
- };
- private static readonly int[] hour_adjust =
- {
- 0, 0, 0, 0,
- 0, 0, 1, 1,
- 1, 2, 2, 2,
- 3, 3, 3, 4,
- 4, 4, 5, 5,
- 5, 6, 6, 6
- };
- private static readonly int[] mood_adjust =
- {
- 0x5, 0x15, 0xA, 0x0
- };
- private static readonly int[] villager_adjust =
- {
- 1, 1, 1, 0,
- 1, 1, 0, 0,
- 1, 1, 0, 0,
- 1, 0, 1, 0,
- 0, 1
- };
- private static readonly ushort[] base_index_adjust =
- {
- 0x0000, 0x0078, 0x0028, 0x0050, 0x0000, 0x0050, 0x0000, 0x0000, 0x0078, 0x0028,
- 0x0028, 0x0028, 0x0000, 0x0050, 0x0000, 0x0028, 0x0050, 0x0028, 0x0078, 0x0028,
- 0x0000, 0x0000, 0x0050, 0x0028, 0x0000, 0x0000, 0x0078, 0x0050, 0x0000, 0x0028,
- 0x0078, 0x0028, 0x0050, 0x0000, 0x0028, 0x0000, 0x0000, 0x0050, 0x0078, 0x0028,
- 0x0028, 0x0028, 0x0000, 0x0050, 0x0028, 0x0050, 0x0078, 0x0000, 0x0000, 0x0000,
- 0x0050, 0x0050, 0x0028, 0x0000, 0x0078, 0x0000, 0x0000, 0x0028, 0x0050, 0x0000,
- 0x0078, 0x0028, 0x0028, 0x0000, 0x0028, 0x0050, 0x0000, 0x0078, 0x0000, 0x0050,
- 0x0000, 0x0028, 0x0050, 0x0000, 0x0078, 0x0000, 0x0078, 0x0000, 0x0028, 0x0078,
- 0x0028, 0x0000, 0x0050, 0x0028, 0x0000, 0x0000, 0x0078, 0x0028, 0x0050, 0x0028,
- 0x0028, 0x0000, 0x0078, 0x0000, 0x0028, 0x0000, 0x0050, 0x0078, 0x0000, 0x0078,
- 0x0050, 0x0028, 0x0000, 0x0078, 0x0000, 0x0000, 0x0000, 0x0050, 0x0078, 0x0050,
- 0x0028, 0x0000, 0x0000, 0x0000, 0x0000, 0x0050, 0x0028, 0x0078, 0x0050, 0x0000,
- 0x0028, 0x0050, 0x0028, 0x0078, 0x0028, 0X0000
- };
- public static Dictionary<string, float> GetPercentages(int islanderIdx, int hour, int mood_group, bool goldenShovel)
- {
- Dictionary<string, float> percentages = new();
- if (mood_group == 0)
- {
- mood_group = 2 - villager_adjust[islanderIdx];
- }
- else if (mood_group == 1)
- {
- mood_group = 0;
- }
- else
- {
- mood_group = 3;
- }
- int base_ofs = base_index_adjust[islanderIdx * 7 + hour_adjust[hour]] + mood_adjust[mood_group];
- if (goldenShovel)
- {
- base_ofs += 20;
- }
- if (base_ofs >= 160)
- {
- base_ofs = 0;
- }
- for (int i = 0; i < 4; i++) // i < 5
- {
- ushort val = rngTable[base_ofs + i][1];
- string s = val == 4 ? "Random Fruit" : grps[val].Name;
- if (percentages.ContainsKey(s))
- {
- percentages[s]++;
- }
- else
- {
- percentages.Add(s, 1);
- }
- }
- foreach (var kv in percentages)
- {
- //percentages[kv.Key] = (kv.Value / 5.0f) * 100.0f;
- percentages[kv.Key] = (kv.Value / 4.0f) * 100.0f;
- }
- return percentages;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement