l2p.lol helper (version 6)
=========================

The one tool an officer runs. It sends the Hammerlog addon's saved file
(Hammerlog.lua) and your finished combat logs to the site, and brings back
the site's gear data for Hammerlog (each guild member's latest known gear,
which the addon shares with the guild in game) and your guild's newest
reports. Optional: the site's pages do
each of these by hand.

Setup
-----
1. Unzip this folder anywhere.
2. Open l2p-helper.conf in a text editor. If TOKEN= is empty, make a
   token on the site's Addon page and paste it after TOKEN=.
3. If your game isn't in the usual place, set GAME_DIR= to the folder that
   holds _classic_beta_ (WoW Forever's, during the beta) or similar,
   written as it is - spaces are fine,
   no quotes or backslashes needed; ~ means your home folder, e.g.
   GAME_DIR=D:\Games\World of Warcraft
   GAME_DIR=~/Games/World of Warcraft

Use
---
After playing (log out or /reload first - that's when the game saves the
file):
  Windows:        double-click l2p-helper.cmd
                  (the first time, Windows may ask whether to run a file
                  from the internet - it's this script)
  macOS / Linux:  sh l2p-helper.sh

To keep it checking every 2 minutes while you play, run
  l2p-helper.cmd -Watch      (Windows)
  sh l2p-helper.sh --watch   (macOS / Linux)
and close the window (or press Ctrl+C) to stop.

What it does - and doesn't
--------------------------
- It finds <game>\_*_\WTF\Account\*\SavedVariables\Hammerlog.lua (or, in an
  account that has none yet, the old WowparseLoot.lua), and
  sends each one that changed since it last sent it. It prints each file
  before sending and what the site added after.
  If there's none (Hammerlog isn't installed), it says so and goes on
  with the logs and reports.
- That file holds only what the addon recorded: loot, quest rewards, vendor
  items, XP. No character, guild or realm names.
- It sends your finished combat logs: each
  <game>\_*_\Logs\WoWCombatLog*.txt nothing has written to for 10
  minutes (so never the one the game is still writing), changed in the
  last 7 days (LOGS_DAYS= in l2p-helper.conf to change that), and not
  sent before. Zipped first (on macOS / Linux, if zip is installed).
  They're shared with your token's guild (or private, for a token without
  one); change that on the site any time. Sending the same log again, or
  a longer copy of one sent before (the game adds to the same file), adds
  to that report on the site - same link - rather than making another.
  To turn this off, put LOGS=no in l2p-helper.conf.
- Then it downloads the site's gear data and writes it as Keyframe.lua
  into each Interface\AddOns\Hammerlog folder it finds (only addons
  new enough to read it; an older one is left alone, with a note).
  /reload in game to load it. Before writing, it checks the file is
  exactly the one line of data the addon reads, because the game runs
  whatever an addon's files contain: anything else is refused and nothing
  is written. With --watch / -Watch it fetches at most every 10 minutes.
  To turn this off, put KEYFRAME=no in l2p-helper.conf.
- Then it downloads the newest reports shared with your token's guild and
  writes them as Import.lua into each Interface\AddOns\Hammerlog
  folder. /reload in game takes them in, and the addon shares them with
  the guild. It checks every line is plain data first, for the same
  reason. To turn this off, put REPORTS=no in l2p-helper.conf.
- Nothing else on your computer is read or sent. Nothing is installed, and
  nothing keeps running once it's done.
- It remembers what it sent in l2p-helper.state and
  l2p-helper.logs (file paths, sizes and SHA-256 fingerprints), next
  to the script. Delete them any time: the site recognises a log it
  already has.
- The scripts are plain text: open l2p-helper.ps1 or
  l2p-helper.sh in a text editor to read every step.

The token
---------
The token lets this script upload the addon's file and your combat logs
to your account, and download the guild's gear data and the reports
shared with the token's guild - and nothing else: it can't read other
reports, change settings or log in. Keep it to yourself. Revoke it on
the site's Addon page any time; the script then says the token wasn't
accepted.

Automating it (only if you want to)
-----------------------------------
Windows: Task Scheduler > Create Basic Task > "When I log on" or daily >
  Start a program: l2p-helper.cmd
macOS / Linux: crontab -e, then e.g. hourly:
  0 * * * * sh "/path/to/l2p-helper/l2p-helper.sh"
  On macOS, cron itself still runs, but System Settings > Privacy &
  Security may silently block it from reading your game folder (no error -
  the job just never finds anything) unless you grant Full Disk Access to
  /usr/sbin/cron (or to Terminal, if that's what you used to add the job).
  If a cron job seems to do nothing, check there first.
