OPENWOW SERVER - INSTALL GUIDE
==============================

Host your own World of Warcraft 1.12.1 realm on a Windows 10/11 PC and play on it with
friends. About 30-45 minutes the first time, most of it downloads.

You need
--------
  1. Windows 10 or 11, 64-bit, about 15 GB free (SSD recommended).
  2. Python 3.11 or newer           https://www.python.org/downloads/windows/
                                    (in the installer, tick "Add python.exe to PATH")
  3. SPP Classics V2 (the realm:    https://github.com/celguar/spp-classics-cmangos/releases
     database + login + world)      file: SPP_Classics_V2.exe
  4. This folder (OpenWoW-Server).
  5. To PLAY: a WoW 1.12.1 client. The OpenWoW launcher can download one for you
     (Home > GET WOW 1.12.1).


EASY WAY: the OpenWoW launcher
------------------------------
  Launcher > HOST > DOWNLOAD SERVER opens a 4-step setup page. Each step shows a green tick
  when it's done:
    1. Python          - GET PYTHON opens python.org; install, then press CHECK AGAIN.
    2. SPP Classics    - DOWNLOAD SPP fetches SPP_Classics_V2.exe and opens it. Pick a folder,
                         click Extract, then follow "Step 2" below. Press LOCATE FOLDER and
                         pick the SPP_Server folder.
    3. Server software - DOWNLOAD & UNPACK puts this package in a folder and links it to SPP.
    4. Start           - OPEN CONTROL PANEL runs Setup_And_Launch.bat for you.
  If any step fails, use the manual way below; it does the same thing by hand.


MANUAL WAY (if the launcher doesn't work for you)
-------------------------------------------------
Step 1 - Python
  Install Python 3.11+ from python.org. Tick "Add python.exe to PATH". Open a new Command
  Prompt and check:  py -3 --version

Step 2 - SPP Classics V2 (one time, ~300 MB more downloads)
  a. Download SPP_Classics_V2.exe from the link above. Do NOT install over an old SPP.
  b. Run it, choose a folder (e.g. C:\SPP_Classics_V2) and click Extract.
  c. In that folder run Server_Update.bat. Wait for the downloads.
  d. At the expansion menu type 1 (Vanilla / Classic 1.12) and press Enter. Wait again.
  e. When it offers "Start Servers", you can start them once to check, then shut them down
     from the menu ("0 - Shutdown all servers"), not with the window's X.
  Your SPP_Server folder is the one that contains Server\Database and Settings.

Step 3 - This package
  a. Unzip OpenWoW-Server.zip anywhere, e.g. C:\OpenWoW-Server.
  b. Copy openwow.example.json to openwow.json, open it in Notepad and set
       "spp_root": "C:\\SPP_Classics_V2\\SPP_Server"
     (use double backslashes). Change mysql_password only if you changed SPP's default.

Step 4 - Start
  Double-click Setup_And_Launch.bat. It checks Python, installs the packages once, and opens
  the control panel. Press START / RESTART ALL SERVICES. MySQL (3310), login (3724),
  world (8085) and the web backend (18090) go green.

Step 5 - Make your admin account
  Control panel > Player & GM Admin Manager > create an account, role Administrator (GM 3).
  Use a strong password if anyone else can reach the server.

Step 6 - Play on it
  In the OpenWoW launcher: SERVERS > MY SERVERS > ADD THIS PC, then PLAY.
  With a stock client: set realmlist.wtf to   set realmlist 127.0.0.1


LETTING FRIENDS IN
------------------
  Set the realm address players are sent to (use your LAN IP for friends on your network,
  your public IP or domain for the internet). Open Command Prompt and run, with your own
  SPP path and address (it asks for the MySQL password, 123456 by default):
    "C:\SPP_Classics_V2\SPP_Server\Server\Database\bin\mysql.exe" -h 127.0.0.1 -P 3310 -u root -p
         classicrealmd -e "UPDATE realmlist SET address='203.0.113.10'"
  (one line). Restart the services afterwards.

  Over the internet, also:
    1. Forward TCP 3724 and 8085 on your router to this PC.
    2. Allow them in Windows Firewall (Command Prompt as administrator):
         netsh advfirewall firewall add rule name=OpenWoW-Game dir=in action=allow protocol=TCP localport=3724,8085
    3. Friends add your server in their launcher (SERVERS > ADD) or set their realmlist.
  Browser play for friends also needs the HTTPS gateway (ports 80, 443, 8090), the OpenWoW
  web client build in www\ and extracted game data in Data\ - see README.md, "Letting
  friends in from anywhere". It's optional; the desktop client works without it.

  Security: never expose port 3310 (MySQL). Change SPP's MySQL root password before going
  public, then put it in openwow.json.


IF SOMETHING GOES WRONG
-----------------------
  "py is not recognized"         Reinstall Python with "Add python.exe to PATH" ticked, or
                                 run:  python -m pip install --user -r requirements.txt
  pip fails / no internet         Install packages by hand:  py -3 -m pip install aiohttp pillow
  Control panel says SPP missing  spp_root in openwow.json is wrong. It must be the folder
                                  that contains Server\Database.
  MySQL won't start              Another MySQL uses port 3310, or SPP isn't set up: run
                                  Server_Update.bat in SPP once more and pick 1.
  Login says "information is not valid"
                                  The account was made before the server was ready. Delete it
                                  in the Admin Manager and create it again.
  Friends can't connect          Check the port forward with a port checker for 3724 and 8085,
                                  and that the realm address is your PUBLIC IP, not 127.0.0.1.
  Still stuck                     Post in the OpenWoW Discord #bug-reports with a screenshot
                                  of the control panel's log tab.


ALTERNATIVES
------------
  * Plain SPP: SPP Classics V2 runs on its own with its own menu (Server_Start.bat). You lose
    the control panel, web sign-up and browser play, but the realm works for desktop clients.
  * Linux / a rented server: see the hetzner\ folder in the OpenWoW GitHub repository
    (https://github.com/Chumpton/openwow) for a one-command VPS setup.
  * Docker: hetzner\docker-compose.yml runs the database, web backend and HTTPS proxy.
