Advertisement
namofure

DPt Slot RNG

Apr 21st, 2025
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.40 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4.  
  5. namespace DPt_Slot_RNG_Tool
  6. {
  7.     internal class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             do
  12.             {
  13.                 Console.WriteLine("");
  14.                 Console.WriteLine("======================================");
  15.                 Console.Write("DPt Slot RNG Tool\n");
  16.                 Console.Write("Enter Daily SEED : 0x");   // 日替わりSEED入力
  17.  
  18.                 if (uint.TryParse(Console.ReadLine(), System.Globalization.NumberStyles.HexNumber, null, out uint Seed))
  19.                 {
  20.                     byte[] data = { 0x00, 0x05, 0x01, 0x01, 0x04, 0x04, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03 };
  21.                     int iCount = 11;
  22.                     int D = 0;
  23.  
  24.                     using (StreamWriter writer = new StreamWriter("test.txt"))
  25.                     {
  26.                         for (int n = 0; n < 12; n++)
  27.                         {
  28.                             for (int i = 0; i < iCount; i++)
  29.                             {
  30.                                 Seed = NextSeed(Seed);
  31.                                 uint Swap = (Seed >> 16) % 0xC;
  32.  
  33.                                 byte temp = data[D];
  34.                                 data[D] = data[Swap];
  35.                                 data[Swap] = temp;
  36.  
  37.                                 //writer.WriteLine($"[SEED = 0x{Seed:X8}, Swap = {Swap}, D = {D}] " +
  38.                                                  //string.Join(" ", data.Select(b => b.ToString("X2"))));
  39.                             }
  40.                             D++;
  41.                             iCount--;
  42.                         }
  43.                     }
  44.  
  45.                     Console.WriteLine("\nSlot Table:");
  46.                     Console.WriteLine(string.Join(" ", data.Select(b => b.ToString("X2"))));
  47.  
  48.                     Console.WriteLine("\nSlot Layout:");
  49.                     DisplayGrid(data);
  50.                     Console.WriteLine("======================================");
  51.  
  52.                     Console.WriteLine("\nPress 'R' to run again or any other key to exit.\n");
  53.                 }
  54.             }
  55.             while (Console.ReadKey().Key == ConsoleKey.R);  // 'R'キーで再実行
  56.         }
  57.  
  58.         static uint NextSeed(uint Seed)
  59.         {
  60.             ulong a = 1103515245;
  61.             ulong b = 24691;
  62.             ulong result = (a * Seed + b) & 0xFFFFFFFF;
  63.             return (uint)result;
  64.         }
  65.  
  66.         static void DisplayGrid(byte[] data)
  67.         {
  68.             string[,] grid = new string[4, 4];
  69.  
  70.             grid[0, 0] = "N";
  71.             grid[1, 2] = "N";
  72.             grid[2, 3] = "N";
  73.             grid[3, 0] = "N";
  74.  
  75.             int[,] positions = new int[,]
  76.             {
  77.                 {0, 2}, {1, 3}, {1, 0},
  78.                 {2, 0}, {3, 3}, {0, 1},
  79.                 {1, 1}, {2, 1}, {3, 1},
  80.                 {0, 3}, {2, 2}, {3, 2},
  81.             };
  82.  
  83.             for (int i = 0; i < 12; i++)
  84.             {
  85.                 int row = positions[i, 0];
  86.                 int col = positions[i, 1];
  87.                 grid[row, col] = data[i].ToString("X");
  88.             }
  89.  
  90.             for (int i = 0; i < 4; i++)
  91.             {
  92.                 for (int j = 0; j < 4; j++)
  93.                 {
  94.                     Console.Write((grid[i, j] ?? " ").PadLeft(2) + " ");
  95.                 }
  96.                 Console.WriteLine();
  97.             }
  98.         }
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement