MigYo v9
========

What is in this zip
-------------------
MigYo-v9/                 The website. Upload the files INSIDE this folder to your hosting (public_html).
MigYo-v9-Guide.docx       Full install and admin guide (Banglish).
extras/v6-translations/   The nine language files of version 6. Not used by the site. See extras/README.txt.

The one currency is USDC on BNB Smart Chain (BEP-20). Every member gets a deposit address of their own;
withdrawals go to any BNB Smart Chain address.

New in v9
---------
- Games: 60 s to join (the starter may give up to 180 s) with a live countdown banner in the room, 5 s of rules,
  then 30 s rounds. In Dice, LowCard, Cricket and Knock Out every player draws with !d (or is drawn for when the
  time is up); the lowest is out each round, a tie draws again, and GameBot ends with who went out in which round.
  Dice are drawn in colour. XP for playing and for winning. Every game has its own settings (Admin > Games).
- The main admin can edit everything in any account (also their own level), "Log in as" a member and come back,
  and every admin change is kept in Admin > Admin log.
- XP for each task and the level needed for each action are set in Admin > Settings, including how many rooms a
  member may own at which level ("Rooms by level", e.g. 5:1, 20:2, 50:3).
- Rooms: the creator is the owner for good (not transferable). Owners set name, topic, welcome message, password,
  lowest level, size, lock and game bot, appoint head moderators and moderators, and can delete the room.
  Head moderators appoint moderators. Moderators kick (for a time), ban, gag, lock, switch the game bot and announce.
- Profiles list "Gifts received" (who sent what) and "Games won"; each member chooses who sees them
  (Everyone, Followers, Friends, Only me).
- Pages refresh themselves (profile, wallet, leaderboard, room list, admin overview).

New install
-----------
1. Create a MySQL database, a user and a password in your hosting panel.
2. Upload everything inside MigYo-v9/ (including the hidden .htaccess files).
3. Open https://your-site/install.php, check that every line of "Server check" is green, fill in the form.
   The wallet needs the PHP GMP or BCMath extension (one of them is enough).
4. install.php deletes itself. Log in with the admin account you just made.
The site must run on HTTPS.

Upgrade from version 6, 7 or 8
------------------------------
1. Back up the database, app/config.php and the uploads/ folder.
2. Upload the v9 files over the old ones. Keep app/config.php and everything in uploads/. Do not upload install.php.
   Delete app/pi.php if it is there.
3. Open the site once: the database upgrades itself.
   From v8: a game that is running is called off and every stake goes back (shown as "game refund" in the
   wallet history); the old room limit becomes the first "Rooms by level" step. Nothing in the wallet changes.
4. From v7 (Pi): nobody gets a USDC balance automatically. Running game stakes and waiting withdrawals are
   given back first, then each Pi balance is kept aside as old credits (1 Pi = 100 credits).
   From v6: prices become USDC at 100 credits = 1 USDC; old credit balances are kept aside.
5. Admin > Wallet > "Old balances from an earlier version": convert old credits to USDC once, at the rate you
   choose, or leave them.

Setting up the wallet (Admin > Wallet)
--------------------------------------
- Start on Testnet. Tick "Make a new phrase for me", save with your admin password, and WRITE THE 12 WORDS DOWN.
  On Testnet, enter a test BEP-20 token under Advanced > USDC token contract.
- Account 1 of the phrase is the main wallet. Put a working amount of USDC and some BNB (for network fees) in it.
- On Mainnet, leave the token empty: USDC on BNB Smart Chain (0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d) is used.
- Node addresses: empty = the free public BNB Chain nodes. A paid node can be added there later, one per line.
- Optional cron job for a quiet site: the link is under Admin > Wallet > Scheduled job.

Adding a language later
-----------------------
1. Copy assets/lang/en.json to assets/lang/<code>.json (for example bn.json) and translate the text on the right
   of each line. Do not change the keys on the left or the {n}, {u} style markers.
2. Add the language to assets/lang/index.json:   { "en": "English", "bn": "বাংলা" }

Before going live
-----------------
- Everything was tested against a simulated BNB Smart Chain node that checks every transaction with the
  reference Ethereum library, not the real chain. Run the whole flow on Testnet first, then small amounts on Mainnet.
- Crypto payments and games played for real-money stakes may be restricted where you or your members live.
  Get legal advice before opening the site to the public. Games can be switched off in Admin > Settings.
- Keep only a working balance in the main wallet, keep the 12 words safe, and never share or lose app/config.php.
