Classic 1.60: Battle.net friends, authenticator, social window, Discord two-way chat
Battle.net (bnetserver + worldserver tunnelled services) - Authenticator: TOTP secret per Battle.net account, login asks for the code (client AUTHENTICATOR state), secured accounts get the +4 backpack slots - BattleTag column, sent at login and in presence - Friends v2: subscribe, invitations, accept/ignore/revoke, remove, notes; friends kept in auth (battlenet_friends, battlenet_friend_invitations) - Presence v2: own and friends' presence (character, race, class, level, zone, faction group), status and broadcast passed through, appear offline - Whisper v2 between friends on the same realm - Unasked friends/block list Subscribe results and connection status as the official server sends them Social window and Group Finder - Social window side tabs: mirror vars (socialUIEnabledClient etc.), character name friends kept (legacyFriendSystemEnabledClient) - Recent Allies: party, raid, trade, whisper and fought-together interactions, online state and zone; RolodexType hotfix gives grouping a reason text - Group browser member roles, level and class; listing name/comment/play style - Party invite reads the Classic target realm address instead of proposed roles Character select and misc - Character list as regionwide entries: money and professions in the tooltip - Official feature flags and game rules (Classic.OfficialFeatureFlags) Discord - In-game Discord channel relayed both ways (.discord say, /join and /leave) - Bot: faction counts, uptime, show/announce switches, [A]/[H] tags, LFG posts with roles, tidy status channel Support site - Account page: Battle.net account, game accounts, characters, authenticator setup with QR code
This commit is contained in:
@@ -4,8 +4,10 @@ One bot for the whole server. It does three things:
|
||||
|
||||
| Feature | What players see |
|
||||
|---|---|
|
||||
| **Server status** | A message whenever something goes up or down (`🟢 Roleplay realm is up`, `🔴 Battle.net login is down`), plus one status board message that is kept up to date: every realm with its player count, the login server, the website and the database. |
|
||||
| **Realm chat** | Each realm's General, Trade, LookingForGroup and LocalDefense chat in that realm's own Discord channel: `[General] <Thrall> hi guys`. |
|
||||
| **Server status** | A message whenever something goes up or down (`🟢 Roleplay realm is up`, `🔴 Auth server is down`), plus one status board message that is kept up to date: every realm with its player count, Alliance and Horde online, and how long it has been up (or since when it is down), plus the login server, the website and the database. `/status` shows the same board to whoever asks. |
|
||||
| **Realm chat** | Each realm's General, Trade, LookingForGroup and LocalDefense chat in that realm's own Discord channel, with the faction: `[H] [General] <Thrall> hi guys`. |
|
||||
| **Discord ↔ game** | Players are in an in-game **Discord** channel (`/leave Discord` to opt out, `/join Discord` to come back). Messages written in the realm's Discord chat channel appear there as `[Discord] [Name]: text` (plain text only: no images, embeds or reactions); what players type in it appears in Discord. |
|
||||
| **LFG posts** | Every Group Finder listing becomes one post in the realm's LFG channel (e.g. `#lfg-normal`): the dungeon, the title and comment, and the members with level, class and roles (🛡️ tank, ➕ healer, 🗡️ damage). It is updated as people join or leave and removed when the group delists. |
|
||||
| **`/register`** | A form for an e-mail and password. The bot creates the game account, which works on every realm. |
|
||||
|
||||
Also available: `/status`, which shows the status board to whoever asks (only they see it).
|
||||
@@ -43,7 +45,8 @@ It runs on the same PC as the servers. You can start and stop it by hand or from
|
||||
```
|
||||
|
||||
- **Status:** every 10 seconds the bot tries to open a TCP connection to each port. A worldserver opens its port only once it has finished loading, so "up" means players can log in. "Down" is reported after 2 missed checks in a row, so a busy moment does not set it off.
|
||||
- **Player counts** come from the console command `server info`, which the bot runs on each realm through Remote Access (RA) once a minute.
|
||||
- **Player counts and uptime** come from the console command `server info`, which the bot runs on each realm through Remote Access (RA) once a minute.
|
||||
- **Alliance / Horde** counts come from each realm's characters database (online characters by race; Skyborne 95 is Alliance, 96 Horde), read at the same time. "Down since" is the time the bot saw the realm or service go down.
|
||||
- **Chat:** TrinityCore's `chat_log` script writes every message in a system channel (General, Trade, LookingForGroup, LocalDefense, city channels) to the log. One logger line in `worldserver.conf` sends those lines to `Chat.log`. The bot reads new lines every second and posts them every 2 seconds, several lines per Discord message. Item links become `[Linen Cloth]`. `@everyone` and role pings typed in game are neutralised. Whispers, party, guild, say and player-made channels are **never** relayed.
|
||||
- **`/register`** runs `bnetaccount create <email> <password>` through RA on the first realm that is up. Accounts live in the shared `auth` database, so the account works on every realm. The bot remembers which Discord user made which account (in `discord_bot_state.json`) and allows one account per Discord user by default.
|
||||
|
||||
@@ -55,14 +58,14 @@ It runs on the same PC as the servers. You can start and stop it by hand or from
|
||||
2. On the **Bot** page:
|
||||
- Click **Reset Token**, then **Copy**. This is the bot's password. It goes into `discord_bot.json` as `"token"`. Never post it anywhere. If it leaks, reset it here.
|
||||
- Turn **Public Bot** off, so only you can add it to servers.
|
||||
- The bot needs **no** privileged gateway intents. Leave Presence, Server Members and Message Content off.
|
||||
- Privileged gateway intents: leave Presence and Server Members off. Turn **Message Content** **on** only if you want Discord messages to reach the game (`chat.from_discord`); Discord hides message text from bots without it, and the bot then refuses to start with `from_discord` on and says so.
|
||||
3. On the **OAuth2** page, copy the **Client ID**, then open this link with your client ID filled in:
|
||||
|
||||
```
|
||||
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot+applications.commands&permissions=19456
|
||||
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot+applications.commands&permissions=84992
|
||||
```
|
||||
|
||||
Choose your Discord server and click **Authorize**. `19456` = View Channels + Send Messages + Embed Links, which is all the bot needs.
|
||||
Choose your Discord server and click **Authorize**. `84992` = View Channels + Send Messages + Embed Links + Read Message History, which is all the bot needs (the history lets it clean up its own old messages in the status channel). Already invited with the old link? Give its role **Read Message History** in the status channel instead of inviting again.
|
||||
4. Make sure the bot's role can see and write in the channels you give it. This matters for private channels, such as a staff log channel.
|
||||
|
||||
Suggested Discord channels:
|
||||
@@ -109,26 +112,38 @@ Check that it worked: `python -c "import discord; print(discord.__version__)"` p
|
||||
|
||||
---
|
||||
|
||||
## 5. Turn on the chat log in each worldserver
|
||||
## 5. Turn on the worldserver side
|
||||
|
||||
Skip this if you don't want the chat relay.
|
||||
|
||||
In **every** worldserver config (`worldserver.conf`, `worldserver_pvp.conf`, `worldserver_rp.conf`, `worldserver_hc.conf`) add one appender and one logger:
|
||||
Skip the parts you don't want. In **every** worldserver config (`worldserver.conf`, `worldserver_pvp.conf`, `worldserver_rp.conf`, `worldserver_hc.conf`):
|
||||
|
||||
```
|
||||
# next to the other Appender.* lines
|
||||
Appender.Chat=2,2,0,Chat.log,w
|
||||
Appender.GroupFinder=2,3,0,GroupFinder.log,w
|
||||
|
||||
# next to the other Logger.* lines
|
||||
Logger.chat.log.system=2,Chat
|
||||
Logger.chat.log.channel.Discord=2,Chat
|
||||
Logger.groupfinder=3,GroupFinder
|
||||
|
||||
# anywhere (the in-game Discord channel)
|
||||
Discord.Channel.Enable = 1
|
||||
Discord.Channel.Name = "Discord"
|
||||
```
|
||||
|
||||
- `Appender.Chat=2,2,0,Chat.log,w` = a file (2), debug level (2), no prefix (0), `Chat.log`, recreated at each start (`w`). The file goes into that realm's `LogsDir`. In the development setup that is `Chat.log` for Normal and `logs_pvp\`, `logs_rp\`, `logs_hc\` for the others. In the repack it is `server\logs\`, `server\logs_pvp\`, and so on.
|
||||
- `Logger.chat.log.system=2,Chat` = only the system channels. Addon messages use another logger name and are not written.
|
||||
| Lines | For |
|
||||
|---|---|
|
||||
| `Appender.Chat` + `Logger.chat.log.system` | **Realm chat** to Discord: General, Trade, LookingForGroup, LocalDefense and city channels go to `Chat.log`. |
|
||||
| `Logger.chat.log.channel.Discord` | What players type in the **in-game Discord channel** also goes to `Chat.log` (and from there to Discord). The last word is the channel name. |
|
||||
| `Discord.Channel.Enable` / `Name` | The **in-game Discord channel**: every player joins it at login. `/leave Discord` turns that off for the character (remembered), `/join Discord` turns it on again. Discord messages appear in it as `[Discord] [Name]: text`. |
|
||||
| `Appender.GroupFinder` + `Logger.groupfinder` | **Group Finder listings** to the LFG channels: every listing change goes to `GroupFinder.log`. |
|
||||
|
||||
Restart the worldservers. Then say something in General in game. A line like `Player Thrall tells channel General - Durotar: hi` should appear in that realm's `Chat.log`.
|
||||
- `Appender.X=2,2,0,X.log,w` = a file (2), log level, no prefix (0), recreated at each start (`w`). The files go into that realm's `LogsDir`: `Chat.log` / `GroupFinder.log` for Normal and `logs_pvp\`, `logs_rp\`, `logs_hc\` for the others in the development setup; `server\logs\`, `server\logs_pvp\`... in the repack.
|
||||
- The Discord channel needs the worldserver from 2026-10-06 or newer (the `.discord say` command and the `character_discord_optout` table in each characters database: `sql/custom/characters/2026_10_06_00_characters_discord_optout.sql`).
|
||||
|
||||
> The development configs in `build\bin\RelWithDebInfo\` already have these two lines (added 2026-10-06). The repack's configs do not yet.
|
||||
Restart the worldservers. Then say something in General in game. A line like `Player Thrall (H) tells channel General - Durotar: hi` should appear in that realm's `Chat.log`.
|
||||
|
||||
> The development configs in `build\bin\RelWithDebInfo\` already have all of these lines (2026-10-06).
|
||||
|
||||
---
|
||||
|
||||
@@ -142,7 +157,7 @@ Restart the worldservers. Then say something in General in game. A line like `Pl
|
||||
- Each realm's `chat_channel_id`: that realm's chat channel.
|
||||
- Each realm's `chat_log`: path to that realm's `Chat.log`. A relative path starts from the folder of `discord_bot.json`.
|
||||
- Optional: `accounts.channel_id`, `accounts.log_channel_id`.
|
||||
3. Check the realm and service names. They are exactly what Discord shows: `Normal realm`, `Roleplay realm`, `Battle.net login`...
|
||||
3. Check the realm and service names. They are exactly what Discord shows: `Normal realm`, `Roleplay realm`, `Auth server`...
|
||||
|
||||
The example file already has the right ports for this server (worlds 8085/8095/8105/8115, RA 3443–3446, bnet 1119, website 443, MySQL 3307). For the repack, set MySQL to **3317**, use `"chat_log": "../server/logs/Chat.log"` and so on, and set `"localservers": "../localservers.json"`.
|
||||
|
||||
@@ -237,12 +252,14 @@ Restart the launcher. The **Local server** tab then shows a **Discord bot** row
|
||||
| `interval_seconds` | `10` | Time between checks (minimum 5). |
|
||||
| `timeout_seconds` | `3` | How long a check waits for a connection. |
|
||||
| `fails_before_down` | `2` | Missed checks in a row before something counts as down. Coming up is reported at once. |
|
||||
| `players_interval_seconds` | `60` | How often player counts are read over RA. `0` = never. |
|
||||
| `players_interval_seconds` | `60` | How often player counts, uptime (over RA) and Alliance / Horde counts (database) are read. `0` = never. |
|
||||
| `mention_role_id` | `0` | A role pinged when something goes **down** (e.g. `@Staff`). The role must be "mentionable", or the bot needs the Mention @everyone permission. |
|
||||
| `announce` | `true` | Post up/down messages at all. With `false`, only the board changes. |
|
||||
| `announce_on_start` | `false` | Also post the state found when the bot starts. Normally the bot starts before the servers, so it reports them coming up anyway. |
|
||||
| `up_text` / `down_text` | `🟢 **{name}** is up` / `🔴 **{name}** is down` | Message text. `{name}` = the realm or service name. |
|
||||
| `title` | `<server_name> server status` | Board title. |
|
||||
| `tidy` | `true` | Keep the status channel clean: when a new up/down message is posted, the older ones are deleted. At start the bot also removes its own old messages there (needs **Read Message History** in that channel). The status board and messages of people are never deleted. |
|
||||
| `keep_messages` | `1` | How many of the newest up/down messages stay. `0` = none (only the board). |
|
||||
|
||||
### `realms` (one entry per worldserver)
|
||||
|
||||
@@ -250,23 +267,38 @@ Restart the launcher. The **Local server** tab then shows a **Discord bot** row
|
||||
|---|---|
|
||||
| `name` | Shown in Discord: `Normal realm`, `PvP realm`, `Roleplay realm`, `Hardcore realm`. |
|
||||
| `host`, `port` | The worldserver's `WorldServerPort` (8085, 8095, 8105, 8115). |
|
||||
| `ra_port` | The worldserver's `Ra.Port` (3443–3446). Used for player counts and `/register`. |
|
||||
| `ra_port` | The worldserver's `Ra.Port` (3443–3446). Used for player counts, uptime and `/register`. |
|
||||
| `characters_db` | The realm's characters database (`characters`, `characters_pvp`, `characters_rp`, `characters_hc`). Used for the Alliance / Horde counts, with the login from `db`. Leave it out for no faction counts. |
|
||||
| `chat_log` | Path to that realm's `Chat.log` (step 5). Leave it out for no chat relay. |
|
||||
| `chat_channel_id` | Discord channel for that realm's chat. `0` = no chat relay. Several realms may share a channel; then add `{realm}` to `chat.format`. |
|
||||
| `chat_channel_id` | Discord channel for that realm's chat. `0` = no chat relay. Several realms may share a channel; then add `{realm}` to `chat.format`. With `chat.from_discord` on, messages written in this channel go to the realm's in-game Discord channel. |
|
||||
| `lfg_log` | Path to that realm's `GroupFinder.log` (step 5). |
|
||||
| `lfg_channel_id` | Discord channel for that realm's Group Finder listings (e.g. `#lfg-normal`). `0` = no LFG posts for this realm. Best read-only for players: the bot keeps it tidy itself. |
|
||||
|
||||
### `services` (anything else to watch)
|
||||
|
||||
A list of `{ "name": "...", "host": "...", "port": N }`. The example has Battle.net login (1119), Support website (443) and Database (3307). Remove the ones you don't want, or add more, e.g. the bnet REST login `8081`.
|
||||
A list of `{ "name": "...", "host": "...", "port": N }`. The example has Auth server (1119), Support website (443) and Database (3307). Remove the ones you don't want, or add more, e.g. the bnet REST login `8081`.
|
||||
|
||||
**Show or hide** (realms and services alike): add `"show": false` to leave an entry off the status board and `/status`, and `"announce": false` to post no up/down messages for it. Both default to `true`. Example: `{ "name": "Database", "host": "127.0.0.1", "port": 3307, "show": false }` keeps the database off the public board but still posts when it goes down.
|
||||
|
||||
### `chat`
|
||||
|
||||
| Key | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `channels` | General, Trade, LookingForGroup, LocalDefense | Which in-game channels to relay, and the label each gets in Discord: `{"General": "General", "LookingForGroup": "LFG"}` shows `[LFG]`. An empty `{}` relays every system channel. |
|
||||
| `format` | `[{channel}] <{player}> {message}` | Line format. Placeholders: `{channel}`, `{player}`, `{message}`, `{zone}` (e.g. Durotar for General; empty for LFG), `{realm}`. Example: `**[{channel}]** <{player}> {message}`. |
|
||||
| `format` | `{faction}[{channel}] <{player}> {message}` | Line format. Placeholders: `{faction}` (`[A] ` or `[H] `), `{channel}`, `{player}`, `{message}`, `{zone}` (e.g. Durotar for General; empty for LFG), `{realm}`. Example: `**[{channel}]** <{player}> {message}`. |
|
||||
| `from_discord` | `false` | Discord to game: messages in a realm's `chat_channel_id` go to its in-game Discord channel (`.discord say` over RA). Needs the Message Content intent (step 2) and `Discord.Channel.Enable = 1` (step 5). Text only: attachments, embeds, stickers and reactions are dropped, mentions become names, line breaks become spaces, `|` becomes `/`, the server cuts it to 255 characters. Messages of bots (this one included) are ignored, so nothing echoes. |
|
||||
| `poll_seconds` | `1` | How often the logs are read. |
|
||||
| `flush_seconds` | `2` | How often waiting lines are posted. Lines are grouped, which keeps Discord's rate limits happy in a busy Trade chat. |
|
||||
|
||||
### `db` (optional: Alliance / Horde counts)
|
||||
|
||||
| Key | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `host`, `port` | `127.0.0.1`, `3306` | The MySQL server with the characters databases: 3307 in the development setup, 3317 in the repack. |
|
||||
| `user`, `password` | – | A MySQL login that can read the characters databases: the same one the worldservers use (`CharacterDatabaseInfo` in `worldserver.conf`, `trinity` / `trinity` by default). |
|
||||
|
||||
Without a `db` section the board leaves the faction line out. Needs the `pymysql` package (in `requirements.txt`; the repack's Python already has it).
|
||||
|
||||
### `ra`
|
||||
|
||||
| Key | Default | Meaning |
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
"token": "PUT-YOUR-BOT-TOKEN-HERE",
|
||||
"guild_id": 0,
|
||||
"control_port": 8190,
|
||||
|
||||
"status": {
|
||||
"channel_id": 0,
|
||||
"board": true,
|
||||
"board_channel_id": 0,
|
||||
"tidy": true,
|
||||
"keep_messages": 1,
|
||||
"interval_seconds": 10,
|
||||
"fails_before_down": 2,
|
||||
"players_interval_seconds": 60,
|
||||
@@ -16,67 +17,108 @@
|
||||
"up_text": "🟢 **{name}** is up",
|
||||
"down_text": "🔴 **{name}** is down"
|
||||
},
|
||||
|
||||
"realms": [
|
||||
{
|
||||
"name": "Normal realm",
|
||||
"host": "127.0.0.1",
|
||||
"port": 8085,
|
||||
"show": true,
|
||||
"announce": true,
|
||||
"ra_port": 3443,
|
||||
"characters_db": "characters",
|
||||
"chat_log": "../../build/bin/RelWithDebInfo/Chat.log",
|
||||
"chat_channel_id": 0
|
||||
"chat_channel_id": 0,
|
||||
"lfg_log": "../../build/bin/RelWithDebInfo/GroupFinder.log",
|
||||
"lfg_channel_id": 0
|
||||
},
|
||||
{
|
||||
"name": "PvP realm",
|
||||
"host": "127.0.0.1",
|
||||
"port": 8095,
|
||||
"show": true,
|
||||
"announce": true,
|
||||
"ra_port": 3444,
|
||||
"characters_db": "characters_pvp",
|
||||
"chat_log": "../../build/bin/RelWithDebInfo/logs_pvp/Chat.log",
|
||||
"chat_channel_id": 0
|
||||
"chat_channel_id": 0,
|
||||
"lfg_log": "../../build/bin/RelWithDebInfo/logs_pvp/GroupFinder.log",
|
||||
"lfg_channel_id": 0
|
||||
},
|
||||
{
|
||||
"name": "Roleplay realm",
|
||||
"host": "127.0.0.1",
|
||||
"port": 8105,
|
||||
"show": true,
|
||||
"announce": true,
|
||||
"ra_port": 3445,
|
||||
"characters_db": "characters_rp",
|
||||
"chat_log": "../../build/bin/RelWithDebInfo/logs_rp/Chat.log",
|
||||
"chat_channel_id": 0
|
||||
"chat_channel_id": 0,
|
||||
"lfg_log": "../../build/bin/RelWithDebInfo/logs_rp/GroupFinder.log",
|
||||
"lfg_channel_id": 0
|
||||
},
|
||||
{
|
||||
"name": "Hardcore realm",
|
||||
"host": "127.0.0.1",
|
||||
"port": 8115,
|
||||
"show": true,
|
||||
"announce": true,
|
||||
"ra_port": 3446,
|
||||
"characters_db": "characters_hc",
|
||||
"chat_log": "../../build/bin/RelWithDebInfo/logs_hc/Chat.log",
|
||||
"chat_channel_id": 0
|
||||
"chat_channel_id": 0,
|
||||
"lfg_log": "../../build/bin/RelWithDebInfo/logs_hc/GroupFinder.log",
|
||||
"lfg_channel_id": 0
|
||||
}
|
||||
],
|
||||
|
||||
"services": [
|
||||
{ "name": "Battle.net login", "host": "127.0.0.1", "port": 1119 },
|
||||
{ "name": "Support website", "host": "127.0.0.1", "port": 443 },
|
||||
{ "name": "Database", "host": "127.0.0.1", "port": 3307 }
|
||||
{
|
||||
"name": "Auth server",
|
||||
"host": "127.0.0.1",
|
||||
"port": 1119,
|
||||
"show": true,
|
||||
"announce": true
|
||||
},
|
||||
{
|
||||
"name": "Support website",
|
||||
"host": "127.0.0.1",
|
||||
"port": 443,
|
||||
"show": true,
|
||||
"announce": true
|
||||
},
|
||||
{
|
||||
"name": "Database",
|
||||
"host": "127.0.0.1",
|
||||
"port": 3307,
|
||||
"show": true,
|
||||
"announce": true
|
||||
}
|
||||
],
|
||||
|
||||
"chat": {
|
||||
"from_discord": false,
|
||||
"channels": {
|
||||
"General": "General",
|
||||
"Trade": "Trade",
|
||||
"LookingForGroup": "LookingForGroup",
|
||||
"LocalDefense": "LocalDefense"
|
||||
"LocalDefense": "LocalDefense",
|
||||
"Discord": "Discord"
|
||||
},
|
||||
"format": "[{channel}] <{player}> {message}",
|
||||
"format": "{faction}[{channel}] <{player}> {message}",
|
||||
"poll_seconds": 1,
|
||||
"flush_seconds": 2
|
||||
},
|
||||
|
||||
"db": {
|
||||
"host": "127.0.0.1",
|
||||
"port": 3307,
|
||||
"user": "trinity",
|
||||
"password": "trinity"
|
||||
},
|
||||
"ra": {
|
||||
"host": "127.0.0.1",
|
||||
"user": "",
|
||||
"password": "",
|
||||
"localservers": "%APPDATA%/ForeverLauncher/localservers.json"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"enabled": true,
|
||||
"channel_id": 0,
|
||||
|
||||
@@ -13,6 +13,7 @@ One bot for the whole server:
|
||||
Setup and every config key: README.md next to this file. Usage: python forever_bot.py [discord_bot.json]
|
||||
"""
|
||||
import asyncio
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -126,12 +127,16 @@ class Target:
|
||||
self.cfg = cfg
|
||||
self.realm = realm
|
||||
self.name = cfg.get('name') or ('%s:%s' % (cfg.get('host'), cfg.get('port')))
|
||||
self.show = cfg.get('show', True) # on the status board and /status
|
||||
self.announce = cfg.get('announce', True) # "... is up / is down" messages
|
||||
self.host = cfg.get('host', '127.0.0.1')
|
||||
self.port = int(cfg['port'])
|
||||
self.up = None # None = not checked yet
|
||||
self.fails = 0
|
||||
self.since = time.time()
|
||||
self.since = None # when the bot saw it go up or down (None: already so when the bot started)
|
||||
self.players = None # realms: "Connected players" from RA "server info"
|
||||
self.uptime = None # realms: "Server uptime" from RA "server info", e.g. "3 Hour(s) 12 Minute(s)"
|
||||
self.factions = None # realms: (alliance, horde) online characters from the characters database
|
||||
|
||||
|
||||
async def probe(host, port, timeout):
|
||||
@@ -148,11 +153,44 @@ async def probe(host, port, timeout):
|
||||
|
||||
|
||||
PLAYERS_RE = re.compile(r'Connected players:\s*(\d+)', re.IGNORECASE)
|
||||
UPTIME_RE = re.compile(r'Server uptime:\s*([^\r\n]+)', re.IGNORECASE)
|
||||
UPTIME_PART_RE = re.compile(r'(\d+)\s*(Day|Hour|Minute|Second)', re.IGNORECASE)
|
||||
|
||||
|
||||
def short_uptime(text):
|
||||
"""'2 Day(s) 3 Hour(s) 12 Minute(s) 5 Second(s)' -> '2d 3h 12m' (seconds only while under a minute)."""
|
||||
parts = [(int(n), unit[0].lower()) for n, unit in UPTIME_PART_RE.findall(text)]
|
||||
shown = [f'{n}{u}' for n, u in parts if u != 's' and n] or [f'{n}{u}' for n, u in parts if u == 's']
|
||||
return ' '.join(shown) or text
|
||||
|
||||
# Faction of each playable race (server RaceMask.h RACEMASK_ALLIANCE: Skyborne 95 = High Order / Alliance, 96 = Windshaper /
|
||||
# Horde); 24 = Pandaren before choosing a faction; every other playable race is Horde
|
||||
ALLIANCE_RACES = {1, 3, 4, 7, 11, 22, 25, 29, 30, 32, 34, 37, 52, 85, 86, 95}
|
||||
NEUTRAL_RACES = {24}
|
||||
|
||||
|
||||
def faction_counts(characters_db):
|
||||
"""(alliance, horde) characters online on one realm, from its characters database (config "db")."""
|
||||
import pymysql # only needed for faction counts; the repack's Python ships it
|
||||
db = CFG['db']
|
||||
conn = pymysql.connect(host=db.get('host', '127.0.0.1'), port=int(db.get('port', 3306)), user=db['user'],
|
||||
password=db.get('password', ''), database=characters_db, connect_timeout=5)
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute('SELECT race, COUNT(*) FROM characters WHERE online = 1 GROUP BY race')
|
||||
rows = cur.fetchall()
|
||||
finally:
|
||||
conn.close()
|
||||
alliance = sum(n for race, n in rows if race in ALLIANCE_RACES)
|
||||
horde = sum(n for race, n in rows if race not in ALLIANCE_RACES and race not in NEUTRAL_RACES)
|
||||
return alliance, horde
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- chat relay
|
||||
|
||||
CHAT_RE = re.compile(r'Player (\S+) tells channel (.+?): (.*)$')
|
||||
# "Player Thrall (H) tells channel General - Durotar: hi" (the faction is written by servers since 2026-10-06, older ones leave it out)
|
||||
CHAT_RE = re.compile(r'Player (\S+)(?: \(([AH])\))? tells channel (.+?): (.*)$')
|
||||
DEFAULT_CHAT_FORMAT = '{faction}[{channel}] <{player}> {message}'
|
||||
# WoW text escapes: colours (|cffRRGGBB, |cnIQ4:), hyperlinks (|Hitem:...|h[Name]|h -> [Name]), textures, line breaks
|
||||
WOW_ESCAPES = re.compile(r'\|c[0-9a-fA-F]{8}|\|cn[^:|]*:|\|H[^|]*\|h|\|h|\|r|\|T[^|]*\|t|\|A[^|]*\|a|\|n')
|
||||
|
||||
@@ -197,11 +235,11 @@ def discord_safe(text):
|
||||
|
||||
|
||||
def format_chat_line(line, realm):
|
||||
"""'Player Foo tells channel General - Elwynn Forest: hi' -> '[General] <Foo> hi', or None if not relayed."""
|
||||
"""'Player Foo (A) tells channel General - Elwynn Forest: hi' -> '[A] [General] <Foo> hi', or None if not relayed."""
|
||||
m = CHAT_RE.search(line)
|
||||
if not m:
|
||||
return None
|
||||
player, channel, message = m.groups()
|
||||
player, faction, channel, message = m.groups()
|
||||
base, _, zone = channel.partition(' - ')
|
||||
chat = CFG.get('chat', {})
|
||||
names = {k.lower(): v for k, v in (chat.get('channels') or {}).items()}
|
||||
@@ -210,9 +248,116 @@ def format_chat_line(line, realm):
|
||||
message = clean_wow_text(message)
|
||||
if not message:
|
||||
return None
|
||||
return chat.get('format', '[{channel}] <{player}> {message}').format(
|
||||
return chat.get('format', DEFAULT_CHAT_FORMAT).format(
|
||||
channel=names.get(base.lower(), base), zone=discord_safe(zone), player=discord_safe(player),
|
||||
message=discord_safe(message), realm=realm.get('name', ''))
|
||||
message=discord_safe(message), realm=realm.get('name', ''), faction='[%s] ' % faction if faction else '')
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- Discord -> game (the in-game Discord channel)
|
||||
|
||||
CUSTOM_EMOJI_RE = re.compile(r'<a?(:\w+:)\d+>') # <:pepe:1234> -> :pepe:
|
||||
NAME_KEEP_RE = re.compile(r'[^\w\-]', re.UNICODE)
|
||||
|
||||
|
||||
def discord_to_game(message):
|
||||
"""(sender, text) of a Discord message for the game, plain text only, or None when nothing is left to send.
|
||||
Attachments, embeds, stickers and reactions are dropped; mentions become plain names (clean_content); no '|' (WoW escapes),
|
||||
no line breaks; the server cuts the text to 255 characters."""
|
||||
text = CUSTOM_EMOJI_RE.sub(r'\1', message.clean_content)
|
||||
text = ' '.join(text.replace('|', '/').split())
|
||||
if not text:
|
||||
return None # only an image, a sticker...
|
||||
name = NAME_KEEP_RE.sub('', message.author.display_name.replace(' ', '_'))[:24] or 'Discord'
|
||||
return name, text
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- Group Finder listings -> LFG channels
|
||||
|
||||
CLASS_NAMES = {1: 'Warrior', 2: 'Paladin', 3: 'Hunter', 4: 'Rogue', 5: 'Priest', 6: 'Death Knight', 7: 'Shaman', 8: 'Mage',
|
||||
9: 'Warlock', 10: 'Monk', 11: 'Druid', 12: 'Demon Hunter', 13: 'Evoker'}
|
||||
_activity_names = None
|
||||
|
||||
|
||||
def activity_name(activity_id):
|
||||
"""GroupFinderActivity names from the client data (group_finder_activities.json next to this file)."""
|
||||
global _activity_names
|
||||
if _activity_names is None:
|
||||
try:
|
||||
with open(os.path.join(HERE, 'group_finder_activities.json'), encoding='utf-8') as f:
|
||||
_activity_names = {int(k): v for k, v in json.load(f).items()}
|
||||
except (OSError, ValueError):
|
||||
_activity_names = {}
|
||||
return _activity_names.get(activity_id, 'Activity %d' % activity_id)
|
||||
|
||||
|
||||
class LfgLog:
|
||||
"""The current listings of one realm, from its GroupFinder.log (one JSON line per change, written anew at server start)."""
|
||||
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
self.offset = 0
|
||||
self.listings = {} # listing id -> last listed/updated event
|
||||
self.restarted = False # the server started a new log: every post of this realm is stale
|
||||
|
||||
def read(self):
|
||||
"""Applies the new lines; returns True if anything changed."""
|
||||
try:
|
||||
size = os.path.getsize(self.path)
|
||||
except OSError:
|
||||
return False
|
||||
changed = False
|
||||
if size < self.offset:
|
||||
self.offset, self.listings, self.restarted, changed = 0, {}, True, True
|
||||
if size == self.offset:
|
||||
return changed
|
||||
with open(self.path, 'rb') as f:
|
||||
f.seek(self.offset)
|
||||
data = f.read(size - self.offset)
|
||||
cut = data.rfind(b'\n')
|
||||
if cut < 0:
|
||||
return changed
|
||||
self.offset += cut + 1
|
||||
for line in data[:cut].decode('utf-8', 'replace').splitlines():
|
||||
start = line.find('{')
|
||||
if start < 0:
|
||||
continue
|
||||
try:
|
||||
ev = json.loads(line[start:])
|
||||
except ValueError:
|
||||
continue
|
||||
if ev.get('event') == 'delisted':
|
||||
self.listings.pop(ev.get('id'), None)
|
||||
elif ev.get('event') in ('listed', 'updated'):
|
||||
self.listings[ev.get('id')] = ev
|
||||
changed = True
|
||||
return changed
|
||||
|
||||
|
||||
PLAY_STYLES = {1: 'Learning', 2: 'Relaxed', 3: 'Competitive', 4: 'Carry Offered'} # the listing's play style dropdown
|
||||
|
||||
|
||||
def lfg_embed(ev, realm_name):
|
||||
names = [activity_name(a) for a in ev.get('activities', [])]
|
||||
title = ', '.join(names[:3]) + (' +%d' % (len(names) - 3) if len(names) > 3 else '') or 'Group'
|
||||
alliance = ev.get('faction') == 'A'
|
||||
text = '\n'.join(discord_safe(t) for t in (ev.get('title'), ev.get('comment')) if t)[:900]
|
||||
style = ev.get('playstyle') or 0
|
||||
if style:
|
||||
# green: Discord colours "+" lines of a diff code block (desktop and mobile)
|
||||
text += ('\n' if text else '') + '```diff\n+ %s\n```' % PLAY_STYLES.get(style, 'Play style %d' % style)
|
||||
embed = discord.Embed(title=title[:250], colour=discord.Colour.blue() if alliance else discord.Colour.red(),
|
||||
description=text or None)
|
||||
lines = []
|
||||
for m in ev.get('members', []):
|
||||
roles = (' 🛡️' if m.get('tank') else '') + (' ➕' if m.get('healer') else '') + (' 🗡️' if m.get('damage') else '')
|
||||
lines.append('%s**%s** %d %s%s' % ('👑 ' if m.get('leader') else '', discord_safe(m.get('name', '?')), m.get('level', 0),
|
||||
CLASS_NAMES.get(m.get('class'), ''), roles))
|
||||
embed.add_field(name='%s · %d member%s' % ('Alliance' if alliance else 'Horde', len(lines), '' if len(lines) == 1 else 's'),
|
||||
value='\n'.join(lines)[:1000] or '-', inline=False)
|
||||
embed.set_footer(text='%s · listed' % realm_name)
|
||||
if ev.get('time'):
|
||||
embed.timestamp = datetime.datetime.fromtimestamp(ev['time'], datetime.timezone.utc)
|
||||
return embed
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- accounts
|
||||
@@ -241,9 +386,23 @@ def account_settings():
|
||||
|
||||
class ForeverBot(discord.Client):
|
||||
def __init__(self):
|
||||
super().__init__(intents=discord.Intents.default(), allowed_mentions=discord.AllowedMentions.none())
|
||||
intents = discord.Intents.default()
|
||||
# Discord -> game needs to read message text: the privileged Message Content intent (switched on in the Developer Portal)
|
||||
self.from_discord = bool(CFG.get('chat', {}).get('from_discord', False))
|
||||
intents.message_content = self.from_discord
|
||||
super().__init__(intents=intents, allowed_mentions=discord.AllowedMentions.none())
|
||||
self.tree = app_commands.CommandTree(self)
|
||||
self.realms = CFG.get('realms', [])
|
||||
# Discord channel id -> the realms whose in-game Discord channel gets its messages
|
||||
self.game_feeds = {}
|
||||
for r in self.realms:
|
||||
cid = channel_id(r.get('chat_channel_id'))
|
||||
if self.from_discord and cid and r.get('ra_port'):
|
||||
self.game_feeds.setdefault(cid, []).append(r)
|
||||
self.feed_locks = {} # ra port -> lock: one console command at a time per realm, in order
|
||||
# Group Finder: realm -> its log; no LFG channel set = nothing posted for that realm
|
||||
self.lfg = [(r, LfgLog(config_path(r['lfg_log']))) for r in self.realms
|
||||
if r.get('lfg_log') and channel_id(r.get('lfg_channel_id'))]
|
||||
self.targets = [Target(r, r) for r in self.realms] + [Target(s, None) for s in CFG.get('services', [])]
|
||||
self.tails = [(r, ChatTail(config_path(r['chat_log']))) for r in self.realms
|
||||
if r.get('chat_log') and channel_id(r.get('chat_channel_id'))]
|
||||
@@ -252,6 +411,7 @@ class ForeverBot(discord.Client):
|
||||
self.last_register = {} # discord user id -> time of the last /register try
|
||||
self.register_lock = asyncio.Lock()
|
||||
self.ra_error = None
|
||||
self.db_error = None
|
||||
self.add_commands()
|
||||
|
||||
# ------------------------------------------------ startup / shutdown
|
||||
@@ -275,7 +435,32 @@ class ForeverBot(discord.Client):
|
||||
self.loop.create_task(self.guard(self.status_loop))
|
||||
if self.tails:
|
||||
self.loop.create_task(self.guard(self.chat_loop))
|
||||
if self.lfg:
|
||||
self.loop.create_task(self.guard(self.lfg_loop))
|
||||
log.info('LFG posts: %s', ', '.join('%s -> #%s' % (r['name'], r['lfg_channel_id']) for r, _ in self.lfg))
|
||||
log.info('chat relay: %s', ', '.join('%s -> #%s' % (r['name'], r['chat_channel_id']) for r, _ in self.tails))
|
||||
if self.game_feeds:
|
||||
log.info('Discord -> game: %s', ', '.join('#%s -> %s' % (cid, ', '.join(r['name'] for r in rs)) for cid, rs in self.game_feeds.items()))
|
||||
|
||||
async def on_message(self, message):
|
||||
"""A message in a realm's Discord chat channel goes to that realm's in-game Discord channel (".discord say")."""
|
||||
realms = self.game_feeds.get(message.channel.id)
|
||||
if not realms or message.author.bot or message.webhook_id or message.type not in (discord.MessageType.default, discord.MessageType.reply):
|
||||
return # bots include this one: what it posts from the game never goes back in
|
||||
out = discord_to_game(message)
|
||||
if not out or not CFG['ra'].get('user'):
|
||||
return
|
||||
sender, text = out
|
||||
for realm in realms:
|
||||
port = realm['ra_port']
|
||||
lock = self.feed_locks.setdefault(port, asyncio.Lock())
|
||||
async with lock:
|
||||
try:
|
||||
reply = await ra_command(port, 'discord say %s %s' % (sender, text))
|
||||
if 'sent to' not in reply:
|
||||
log.warning('Discord -> %s: %s', realm['name'], reply.strip()[:200])
|
||||
except Exception as e:
|
||||
log.warning('Discord -> %s (RA port %s): %s', realm['name'], port, e)
|
||||
|
||||
async def guard(self, loop_fn):
|
||||
"""Keeps a background loop alive through unexpected errors (Discord hiccups, a log file in use...)."""
|
||||
@@ -335,11 +520,15 @@ class ForeverBot(discord.Client):
|
||||
'up_text': s.get('up_text', '🟢 **{name}** is up'),
|
||||
'down_text': s.get('down_text', '🔴 **{name}** is down'),
|
||||
'title': s.get('title', CFG.get('server_name', 'Forever') + ' server status'),
|
||||
'tidy': s.get('tidy', True), # delete older up/down messages, keep the board
|
||||
'keep': max(0, int(s.get('keep_messages', 1))), # how many of the newest up/down messages stay
|
||||
}
|
||||
|
||||
async def status_loop(self):
|
||||
sc = self.status_cfg()
|
||||
last_players = 0.0
|
||||
if sc['tidy']:
|
||||
await self.sweep_status_channel()
|
||||
await self.check_targets(first=True)
|
||||
while True:
|
||||
if sc['players_interval'] > 0 and time.time() - last_players >= sc['players_interval']:
|
||||
@@ -358,39 +547,99 @@ class ForeverBot(discord.Client):
|
||||
t.fails = 0
|
||||
if t.up is not True:
|
||||
changed.append((t, t.up))
|
||||
t.up, t.since = True, time.time()
|
||||
# found up when the bot started: since when is unknown (realms still show their own uptime)
|
||||
t.up, t.since = True, (time.time() if t.up is False else None)
|
||||
else:
|
||||
t.fails += 1
|
||||
# a single missed connect (busy server, restart in progress) is not "down" yet; on the final sweep it is
|
||||
if t.up is not False and (t.up is None or final or t.fails >= sc['fails_before_down']):
|
||||
changed.append((t, t.up))
|
||||
# found down when the bot started: since when is unknown
|
||||
t.up, t.since, t.players = False, (time.time() if t.up else None), None
|
||||
t.up, t.since, t.players, t.uptime, t.factions = False, (time.time() if t.up else None), None, None, None
|
||||
if not changed:
|
||||
return
|
||||
for t, before in changed:
|
||||
log.info('%s: %s', t.name, 'up' if t.up else 'down')
|
||||
if sc['announce'] and (not first or sc['announce_on_start']):
|
||||
announced = [(t, before) for t, before in changed if t.announce]
|
||||
if sc['announce'] and announced and (not first or sc['announce_on_start']):
|
||||
ch = await self.channel(sc['channel_id'])
|
||||
if ch:
|
||||
lines = [(sc['up_text'] if t.up else sc['down_text']).format(name=t.name) for t, _ in changed]
|
||||
lines = [(sc['up_text'] if t.up else sc['down_text']).format(name=t.name) for t, _ in announced]
|
||||
mention = ''
|
||||
if sc['mention_role_id'] and any(not t.up for t, _ in changed):
|
||||
if sc['mention_role_id'] and any(not t.up for t, _ in announced):
|
||||
mention = '<@&%d> ' % sc['mention_role_id']
|
||||
await self.send(ch, mention + '\n'.join(lines),
|
||||
allowed_mentions=discord.AllowedMentions(roles=bool(mention)))
|
||||
msg = await self.send(ch, mention + '\n'.join(lines),
|
||||
allowed_mentions=discord.AllowedMentions(roles=bool(mention)))
|
||||
if msg and sc['tidy']:
|
||||
await self.tidy_announcements(ch, msg.id)
|
||||
if any(t.realm and t.up for t, _ in changed):
|
||||
await self.read_player_counts()
|
||||
await self.update_board()
|
||||
|
||||
async def tidy_announcements(self, ch, new_id):
|
||||
"""Keeps only the newest 'keep_messages' up/down messages of the bot; the status board is never touched."""
|
||||
keep = self.status_cfg()['keep']
|
||||
posted = STATE.setdefault('status_messages', [])
|
||||
posted.append(new_id)
|
||||
old, STATE['status_messages'] = posted[:-keep] if keep else posted, posted[-keep:] if keep else []
|
||||
save_state()
|
||||
for mid in old:
|
||||
if mid != STATE.get('board_message_id'):
|
||||
await self.delete_message(ch.id, mid)
|
||||
|
||||
async def sweep_status_channel(self):
|
||||
"""At start: the bot's own older messages in the status channel (from before tidying, or a crash) go, except the board
|
||||
and the newest up/down messages. Messages of people are never touched. Needs Read Message History in that channel."""
|
||||
sc = self.status_cfg()
|
||||
ch = await self.channel(sc['channel_id'])
|
||||
if not ch:
|
||||
return
|
||||
mine = []
|
||||
try:
|
||||
async for m in ch.history(limit=500):
|
||||
if m.author.id == self.user.id and m.id != STATE.get('board_message_id'):
|
||||
mine.append(m) # newest first
|
||||
except discord.Forbidden:
|
||||
log.warning('status channel: cannot read its history to clean up old messages; give the bot "Read Message History" '
|
||||
'in #%s (new messages are tidied anyway)', getattr(ch, 'name', ch.id))
|
||||
return
|
||||
except discord.HTTPException as e:
|
||||
log.warning('status channel history: %s', e)
|
||||
return
|
||||
keep = sc['keep']
|
||||
STATE['status_messages'] = [m.id for m in reversed(mine[:keep])]
|
||||
save_state()
|
||||
removed = 0
|
||||
for m in mine[keep:]:
|
||||
try:
|
||||
await m.delete()
|
||||
removed += 1
|
||||
except discord.HTTPException:
|
||||
pass
|
||||
if removed:
|
||||
log.info('status channel: removed %d old messages', removed)
|
||||
|
||||
async def read_player_counts(self):
|
||||
for t in self.targets:
|
||||
if t.realm and t.up and t.realm.get('characters_db') and CFG.get('db'):
|
||||
try:
|
||||
t.factions = await asyncio.to_thread(faction_counts, t.realm['characters_db'])
|
||||
self.db_error = None
|
||||
except Exception as e:
|
||||
t.factions = None
|
||||
if str(e) != self.db_error:
|
||||
self.db_error = str(e)
|
||||
log.warning('faction counts from %s (database %s): %s', t.name, t.realm['characters_db'], e)
|
||||
if not CFG['ra'].get('user'):
|
||||
return
|
||||
for t in self.targets:
|
||||
if t.realm and t.up and t.realm.get('ra_port'):
|
||||
try:
|
||||
m = PLAYERS_RE.search(await ra_command(t.realm['ra_port'], 'server info'))
|
||||
info = await ra_command(t.realm['ra_port'], 'server info')
|
||||
m = PLAYERS_RE.search(info)
|
||||
t.players = int(m.group(1)) if m else None
|
||||
m = UPTIME_RE.search(info)
|
||||
t.uptime = short_uptime(m.group(1).strip()) if m else None
|
||||
self.ra_error = None
|
||||
except Exception as e:
|
||||
t.players = None
|
||||
@@ -400,19 +649,26 @@ class ForeverBot(discord.Client):
|
||||
|
||||
def board_embed(self, offline=False):
|
||||
sc = self.status_cfg()
|
||||
all_up = all(t.up for t in self.targets)
|
||||
shown = [t for t in self.targets if t.show]
|
||||
all_up = all(t.up for t in shown)
|
||||
embed = discord.Embed(title=sc['title'], timestamp=discord.utils.utcnow(),
|
||||
colour=discord.Colour.dark_grey() if offline else
|
||||
discord.Colour.green() if all_up else discord.Colour.red())
|
||||
for t in self.targets:
|
||||
for t in shown:
|
||||
if t.up is None:
|
||||
value = '⚪ Unknown'
|
||||
elif t.up:
|
||||
value = '🟢 Online'
|
||||
if t.players is not None:
|
||||
value += ' · %d player%s' % (t.players, '' if t.players == 1 else 's')
|
||||
if t.factions:
|
||||
value += '\nAlliance %d · Horde %d' % t.factions
|
||||
if t.uptime:
|
||||
value += '\nUp %s' % t.uptime
|
||||
elif t.since:
|
||||
value += '\nUp since <t:%d:R>' % t.since
|
||||
else:
|
||||
value = '🔴 Offline' + (' since <t:%d:R>' % t.since if t.since else '')
|
||||
value = '🔴 Offline' + ('\nDown since <t:%d:R>' % t.since if t.since else '')
|
||||
embed.add_field(name=t.name, value=value, inline=True)
|
||||
embed.set_footer(text='Status bot offline - last known state' if offline else 'Last checked')
|
||||
return embed
|
||||
@@ -443,6 +699,61 @@ class ForeverBot(discord.Client):
|
||||
|
||||
# ------------------------------------------------ chat relay
|
||||
|
||||
async def lfg_loop(self):
|
||||
"""Keeps one message per Group Finder listing in each realm's LFG channel: posted, edited as it changes, deleted."""
|
||||
posts = STATE.setdefault('lfg_posts', {}) # realm name -> {listing id: [channel id, message id]}
|
||||
# posts of an earlier run are not tied to this run's listings: remove them, the log rebuilds the current ones
|
||||
for realm, _ in self.lfg:
|
||||
for post in list(posts.get(realm['name'], {}).values()):
|
||||
await self.delete_message(post[0], post[1])
|
||||
posts[realm['name']] = {}
|
||||
save_state()
|
||||
while True:
|
||||
for realm, feed in self.lfg:
|
||||
if not feed.read():
|
||||
continue
|
||||
mine = posts.setdefault(realm['name'], {})
|
||||
if feed.restarted: # the realm restarted: no listing survives
|
||||
feed.restarted = False
|
||||
for post in list(mine.values()):
|
||||
await self.delete_message(post[0], post[1])
|
||||
mine.clear()
|
||||
ch = await self.channel(channel_id(realm['lfg_channel_id']))
|
||||
if not ch:
|
||||
continue
|
||||
for lid in [k for k in mine if int(k) not in feed.listings]:
|
||||
post = mine.pop(lid)
|
||||
await self.delete_message(post[0], post[1])
|
||||
for lid, ev in feed.listings.items():
|
||||
key = str(lid)
|
||||
sig = json.dumps(ev, sort_keys=True) # only listings that really changed are edited
|
||||
if key in mine and mine[key][2:] == [sig]:
|
||||
continue
|
||||
embed = lfg_embed(ev, realm['name'])
|
||||
if key in mine:
|
||||
try:
|
||||
await ch.get_partial_message(mine[key][1]).edit(embed=embed)
|
||||
mine[key] = mine[key][:2] + [sig]
|
||||
continue
|
||||
except discord.NotFound:
|
||||
del mine[key] # deleted by someone: post it again
|
||||
except discord.HTTPException as e:
|
||||
log.warning('LFG post: %s', e)
|
||||
continue
|
||||
msg = await self.send(ch, embed=embed)
|
||||
if msg:
|
||||
mine[key] = [ch.id, msg.id, sig]
|
||||
save_state()
|
||||
await asyncio.sleep(float(CFG.get('lfg', {}).get('poll_seconds', 2)))
|
||||
|
||||
async def delete_message(self, cid, mid):
|
||||
try:
|
||||
ch = await self.channel(cid)
|
||||
if ch:
|
||||
await ch.get_partial_message(mid).delete()
|
||||
except discord.HTTPException:
|
||||
pass # already gone
|
||||
|
||||
async def chat_loop(self):
|
||||
poll = float(CFG.get('chat', {}).get('poll_seconds', 1))
|
||||
flush_every = float(CFG.get('chat', {}).get('flush_seconds', 2))
|
||||
@@ -619,7 +930,8 @@ async def main():
|
||||
log.error('Discord rejected the bot token: copy it again from the Developer Portal (README.md)')
|
||||
return 1
|
||||
except discord.PrivilegedIntentsRequired:
|
||||
log.error('Discord refused the gateway intents (README.md, "Create the Discord bot")')
|
||||
log.error('Discord refused the Message Content intent that "from_discord" needs: Developer Portal -> your bot -> Bot -> '
|
||||
'Privileged Gateway Intents -> turn on MESSAGE CONTENT INTENT (or set chat.from_discord to false)')
|
||||
return 1
|
||||
finally:
|
||||
if bot.started:
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"796": "Wailing Caverns",
|
||||
"797": "Scholomance",
|
||||
"798": "Ragefire Chasm",
|
||||
"799": "Deadmines",
|
||||
"800": "Shadowfang Keep",
|
||||
"801": "Blackfathom Deeps",
|
||||
"802": "Stormwind Stockades",
|
||||
"803": "Gnomeregan",
|
||||
"804": "Razorfen Kraul",
|
||||
"805": "Scarlet Monastery - Graveyard",
|
||||
"806": "Razorfen Downs",
|
||||
"807": "Uldaman",
|
||||
"808": "Zul'Farrak",
|
||||
"809": "Maraudon",
|
||||
"810": "Sunken Temple",
|
||||
"811": "Blackrock Depths",
|
||||
"812": "Lower Blackrock Spire",
|
||||
"813": "Dire Maul (East)",
|
||||
"814": "Dire Maul (West)",
|
||||
"815": "Dire Maul (North)",
|
||||
"816": "Stratholme (Main Gate)",
|
||||
"827": "Scarlet Monastery - Armory",
|
||||
"828": "Scarlet Monastery - Cathedral",
|
||||
"829": "Scarlet Monastery - Library",
|
||||
"836": "Zul'Gurub",
|
||||
"837": "Upper Blackrock Spire",
|
||||
"838": "Onyxia's Lair",
|
||||
"839": "Molten Core",
|
||||
"840": "Blackwing Lair",
|
||||
"841": "Naxxramas",
|
||||
"842": "Ahn'Qiraj Ruins",
|
||||
"843": "Ahn'Qiraj Temple",
|
||||
"853": "Elwynn Forest",
|
||||
"854": "Westfall",
|
||||
"855": "Duskwood",
|
||||
"856": "Dun Morogh",
|
||||
"857": "Loch Modan",
|
||||
"858": "Wetlands",
|
||||
"859": "Stranglethorn Vale",
|
||||
"860": "Blasted Lands",
|
||||
"861": "Swamp of Sorrows",
|
||||
"862": "Redridge Mountains",
|
||||
"863": "Burning Steppes",
|
||||
"864": "Searing Gorge",
|
||||
"865": "Badlands",
|
||||
"866": "Arathi Highlands",
|
||||
"867": "Hillsbrad Foothills",
|
||||
"868": "Hinterlands",
|
||||
"869": "Western Plaguelands",
|
||||
"870": "Eastern Plaguelands",
|
||||
"871": "Tirisfal Glades",
|
||||
"872": "Silverpine Forest",
|
||||
"873": "Alterac Mountains",
|
||||
"874": "Durotar",
|
||||
"875": "Mulgore",
|
||||
"876": "The Barrens",
|
||||
"877": "Stonetalon Mountains",
|
||||
"878": "Thousand Needles",
|
||||
"879": "Desolace",
|
||||
"880": "Feralas",
|
||||
"881": "Dustwallow Marsh",
|
||||
"882": "Tanaris",
|
||||
"883": "Un'Goro Crater",
|
||||
"884": "Silithus",
|
||||
"885": "Teldrassil",
|
||||
"886": "Darkshore",
|
||||
"887": "Ashenvale",
|
||||
"888": "Felwood",
|
||||
"889": "Azshara",
|
||||
"890": "Winterspring",
|
||||
"919": "Warsong Gulch",
|
||||
"920": "Warsong Gulch",
|
||||
"921": "Warsong Gulch",
|
||||
"922": "Warsong Gulch",
|
||||
"923": "Warsong Gulch",
|
||||
"924": "Warsong Gulch",
|
||||
"926": "Arathi Basin",
|
||||
"927": "Arathi Basin",
|
||||
"928": "Arathi Basin",
|
||||
"929": "Arathi Basin",
|
||||
"930": "Arathi Basin",
|
||||
"932": "Alterac Valley",
|
||||
"1064": "Custom",
|
||||
"1603": "Stratholme (Service Gate)",
|
||||
"1604": "Blackfathom Deeps",
|
||||
"1605": "Gnomeregan",
|
||||
"1606": "Sunken Temple",
|
||||
"1607": "Demon Fall Canyon",
|
||||
"1608": "Storm Cliffs",
|
||||
"1609": "The Tainted Scar",
|
||||
"1610": "Nightmare Grove",
|
||||
"1611": "The Crystal Vale",
|
||||
"1612": "Onyxia's Lair",
|
||||
"1613": "Molten Core",
|
||||
"1614": "Ahn'Qiraj Temple",
|
||||
"1615": "Ahn'Qiraj Ruins",
|
||||
"1693": "Karazhan Crypts",
|
||||
"1710": "Scarlet Enclave",
|
||||
"1981": "Excavation Site: Wetlands",
|
||||
"1982": "Ruins of Lordaeron",
|
||||
"1983": "City of Dalaran",
|
||||
"1984": "Hall of Thanes",
|
||||
"1989": "Riverglades",
|
||||
"1990": "Zephras Isle",
|
||||
"1991": "Mount Hyjal",
|
||||
"1992": "Darkspear Islands",
|
||||
"1995": "Darkspear Islands",
|
||||
"1996": "Darkspear Islands",
|
||||
"1997": "Darkspear Islands"
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
discord.py>=2.3
|
||||
pymysql
|
||||
|
||||
@@ -344,3 +344,11 @@ details.faq .a { padding: 0 16px 14px; color: var(--muted); }
|
||||
.slot.empty { padding: 0; }
|
||||
.fac-img { width: 20px; height: 20px; vertical-align: middle; border-radius: 4px; }
|
||||
.char-head .fac-img { width: 30px; height: 30px; margin-left: 4px; }
|
||||
|
||||
/* ---------- account page ---------- */
|
||||
.qr { display: inline-block; padding: 8px; margin: 4px 0 14px; background: #fff; border-radius: var(--radius); line-height: 0; }
|
||||
.qr svg { display: block; max-width: 100%; height: auto; }
|
||||
.totp-key { font-size: 1.05rem; letter-spacing: .06em; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }
|
||||
.steps, .perks { margin: 0 0 14px; padding-left: 20px; }
|
||||
.steps li, .perks li { margin: 4px 0; }
|
||||
.perks li::marker { color: var(--gold); }
|
||||
@@ -9,8 +9,13 @@ Usage:
|
||||
py -3 support_server.py [config.json] run the site (default config: support_site.json next to this file)
|
||||
py -3 support_server.py --make-token <bnetAccountId> <realmId> [config.json]
|
||||
issue a 1 hour test token and print the URL (desktop browser test)
|
||||
Needs: pip install pymysql
|
||||
Account page (/account): Battle.net account, game accounts, characters on every realm, and the authenticator (TOTP, any
|
||||
authenticator app). bnetserver asks for its code at login; secured accounts get the +4 backpack slots in game.
|
||||
|
||||
Needs: pip install pymysql segno
|
||||
"""
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import html
|
||||
import json
|
||||
@@ -28,6 +33,11 @@ from urllib.parse import parse_qs, urlencode, urlsplit
|
||||
|
||||
import pymysql
|
||||
|
||||
try:
|
||||
import segno # QR code of the authenticator key (pip install segno); without it only the key is shown
|
||||
except ImportError:
|
||||
segno = None
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
STATIC_DIR = os.path.join(HERE, 'static')
|
||||
# cache buster for /static links: newest file time in static/
|
||||
@@ -68,8 +78,43 @@ ICONS = {
|
||||
'x': '<path d="M18 6 6 18M6 6l12 12"/>',
|
||||
'undo': '<path d="M3 7v6h6"/><path d="M3.5 13A9 9 0 1 0 6 6.3L3 9"/>',
|
||||
'search': '<circle cx="11" cy="11" r="7"/><path d="m20.5 20.5-4.5-4.5"/>',
|
||||
'lock': '<rect x="4.5" y="10.5" width="15" height="10.5" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"/>',
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------- authenticator (TOTP, RFC 6238: 6 digits, 30 s, SHA-1, like the
|
||||
# Battle.net and Google authenticator apps); bnetserver checks the same secret with Trinity::Crypto::TOTP
|
||||
|
||||
TOTP_STEP = 30
|
||||
|
||||
|
||||
def totp_new_secret():
|
||||
return base64.b32encode(secrets.token_bytes(20)).decode('ascii').rstrip('=')
|
||||
|
||||
|
||||
def totp_code(secret, timestamp):
|
||||
key = base64.b32decode(secret + '=' * (-len(secret) % 8))
|
||||
digest = hmac.new(key, int(timestamp // TOTP_STEP).to_bytes(8, 'big'), hashlib.sha1).digest()
|
||||
offset = digest[-1] & 0x0F
|
||||
return '%06d' % ((int.from_bytes(digest[offset:offset + 4], 'big') & 0x7FFFFFFF) % 1000000)
|
||||
|
||||
|
||||
def totp_check(secret, code):
|
||||
code = ''.join(ch for ch in code if ch.isdigit())
|
||||
now = time.time()
|
||||
return len(code) == 6 and any(hmac.compare_digest(totp_code(secret, now + d * TOTP_STEP), code) for d in (-1, 0, 1))
|
||||
|
||||
|
||||
def totp_uri(secret, email):
|
||||
issuer = CFG.get('server_name', 'Forever')
|
||||
return 'otpauth://totp/%s:%s?%s' % (issuer.replace(':', ''), email.replace(':', ''),
|
||||
urlencode({'secret': secret, 'issuer': issuer, 'algorithm': 'SHA1', 'digits': 6, 'period': TOTP_STEP}))
|
||||
|
||||
|
||||
def qr_svg(text):
|
||||
if not segno:
|
||||
return ''
|
||||
return segno.make(text, error='m', micro=False).svg_inline(scale=5, border=3, dark='#000000', light='#ffffff')
|
||||
|
||||
# ---------------------------------------------------------------- armory data
|
||||
|
||||
# equipment slot -> label; paper-doll columns like the game's character frame
|
||||
@@ -494,7 +539,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
if s:
|
||||
answered = query_one(auth_db(), "SELECT COUNT(*) AS n FROM support_tickets WHERE battlenetAccountId = %s AND status = 'answered'",
|
||||
(s['bnet'],))['n']
|
||||
items = [('/', 'home', 'Home', 0), ('/unstuck', 'pin', 'Unstuck', 0), ('/ticket/new?category=bug', 'bug', 'Report a bug', 0),
|
||||
items = [('/', 'home', 'Home', 0), ('/account', 'user', 'Account', 0), ('/unstuck', 'pin', 'Unstuck', 0), ('/ticket/new?category=bug', 'bug', 'Report a bug', 0),
|
||||
('/ticket/new', 'help', 'Get help', 0), ('/tickets', 'tickets', 'My tickets', answered), ('/faq', 'book', 'FAQ', 0)]
|
||||
if s['staff']:
|
||||
waiting = query_one(auth_db(), "SELECT COUNT(*) AS n FROM support_tickets WHERE status = 'open'")['n']
|
||||
@@ -676,6 +721,140 @@ class Handler(BaseHTTPRequestHandler):
|
||||
self.page('Frequently asked questions', panel('', items or '<div class="empty">Nothing here yet.</div>', flush=True),
|
||||
'Can\'t find your answer? <a href="/ticket/new">Ask us</a>.')
|
||||
|
||||
# account
|
||||
|
||||
def bnet_account(self):
|
||||
return query_one(auth_db(), 'SELECT id, email, joindate, last_login, online, locked, authenticator_secret FROM battlenet_accounts WHERE id = %s',
|
||||
(self.session['bnet'],))
|
||||
|
||||
def account_page(self, note=''):
|
||||
s = self.session
|
||||
bnet = self.bnet_account()
|
||||
if not bnet:
|
||||
return self.page('Account', alert('bad', 'Your Battle.net account was not found.'), status=404)
|
||||
secured = bool(bnet['authenticator_secret'])
|
||||
|
||||
def kv(rows):
|
||||
return ''.join('<div class="kv"><span class="muted">%s</span><span>%s</span></div>' % (k, v) for k, v in rows)
|
||||
|
||||
info = kv([
|
||||
('E-mail', esc(bnet['email'])),
|
||||
('Account number', '#%d' % bnet['id']),
|
||||
('BattleTag', '<span class="muted">Not available on this server yet</span>'),
|
||||
('Member since', esc(str(bnet['joindate'])[:10])),
|
||||
('Last login', esc(str(bnet['last_login'])[:16]) if bnet['last_login'] else '<span class="muted">Never</span>'),
|
||||
('Status', '<span class="tag green">Online</span>' if bnet['online'] else '<span class="tag">Offline</span>'),
|
||||
('Authenticator', '<span class="tag green">On</span>' if secured else '<span class="tag amber">Off</span>'),
|
||||
])
|
||||
|
||||
# security
|
||||
pending = s.get('totp_pending')
|
||||
if secured:
|
||||
security = ('<p>Your account is protected by an authenticator. The game asks for its code each time you log in.</p>'
|
||||
'<p class="muted">Lost your phone or reset the app? <a href="/ticket/new?category=account">Ask a game master</a> to remove it.</p>'
|
||||
'<form method="post" action="/account/authenticator/remove">%s<div class="field"><span>To remove it, enter a current code</span>'
|
||||
'<input type="text" name="code" inputmode="numeric" autocomplete="one-time-code" maxlength="7" required></div>'
|
||||
'<div class="actions"><button class="btn danger" type="submit">Remove authenticator</button></div></form>') % self.csrf_field()
|
||||
elif pending:
|
||||
qr = qr_svg(totp_uri(pending, bnet['email']))
|
||||
grouped = ' '.join(pending[i:i + 4] for i in range(0, len(pending), 4))
|
||||
security = (
|
||||
'<ol class="steps"><li>Install an authenticator app on your phone: the <b>Battle.net</b> app, Google Authenticator, '
|
||||
'Microsoft Authenticator or Authy.</li><li>In the app, add an account and scan this code%s.</li>'
|
||||
'<li>Type the 6-digit code the app shows and press <b>Turn on</b>.</li></ol>'
|
||||
'%s<div class="field"><span>Or type this key into the app (time based)</span><div class="mono totp-key">%s</div></div>'
|
||||
'<form method="post" action="/account/authenticator/confirm">%s<div class="field"><span>Code from the app</span>'
|
||||
'<input type="text" name="code" inputmode="numeric" autocomplete="one-time-code" maxlength="7" autofocus required></div>'
|
||||
'<div class="actions"><button class="btn primary" type="submit">Turn on</button>'
|
||||
'<button class="btn ghost" type="submit" formaction="/account/authenticator/cancel" formnovalidate>Cancel</button></div></form>') % (
|
||||
'' if qr else ' (or type the key below)', '<div class="qr">%s</div>' % qr if qr else '', esc(grouped), self.csrf_field())
|
||||
else:
|
||||
security = ('<p>Add an authenticator to protect your account. After your password, the game asks for a code from an app on your phone.</p>'
|
||||
'<ul class="perks"><li>4 extra backpack slots on all your characters</li><li>Full access to the Group Finder</li>'
|
||||
'<li>No "attach an Authenticator" reminders in game</li></ul>'
|
||||
'<form method="post" action="/account/authenticator/start">%s<div class="actions">'
|
||||
'<button class="btn primary" type="submit">Set up an authenticator</button></div></form>') % self.csrf_field()
|
||||
|
||||
# game accounts and characters
|
||||
accounts = query(auth_db(), 'SELECT id, username, expansion, last_login, online FROM account WHERE battlenet_account = %s ORDER BY battlenet_index',
|
||||
(bnet['id'],))
|
||||
chars = []
|
||||
if accounts:
|
||||
ids = tuple(a['id'] for a in accounts)
|
||||
marks = ','.join(['%s'] * len(ids))
|
||||
for realm_id in CFG['realms']:
|
||||
try:
|
||||
rows = query(characters_db(realm_id), 'SELECT name, race, class, level, online, logout_time, account FROM characters '
|
||||
'WHERE account IN (%s) AND deleteInfos_Account IS NULL' % marks, ids)
|
||||
except pymysql.MySQLError:
|
||||
continue
|
||||
for c in rows:
|
||||
c['realm'] = realm_name(realm_id)
|
||||
chars.append(c)
|
||||
chars.sort(key=lambda c: (-int(c['online'] or 0), -int(c['logout_time'] or 0)))
|
||||
|
||||
acc_rows = ''.join('<tr><td><b>%s</b></td><td class="num">%d</td><td>%s</td><td>%s</td></tr>' % (
|
||||
esc('WoW' + a['username'].split('#', 1)[1] if '#' in a['username'] else a['username']),
|
||||
sum(1 for c in chars if c['account'] == a['id']),
|
||||
esc(str(a['last_login'])[:16]) if a['last_login'] else '<span class="muted">Never</span>',
|
||||
'<span class="tag green">Online</span>' if a['online'] else '<span class="tag">Offline</span>') for a in accounts)
|
||||
acc_table = ('<div class="tbl-wrap"><table class="tbl"><thead><tr><th>Game account</th><th class="num">Characters</th><th>Last login</th>'
|
||||
'<th>Status</th></tr></thead><tbody>%s</tbody></table></div>') % acc_rows if accounts else '<div class="empty">No game accounts.</div>'
|
||||
|
||||
races = names('race') # client race names (".armory export"), the vanilla list until then
|
||||
char_rows = ''.join('<tr><td>%s</td><td class="num">%d</td><td class="hide-sm">%s %s</td><td>%s</td><td class="hide-sm">%s</td></tr>' % (
|
||||
char_name(c), c['level'], esc(races[c['race']][0] if c['race'] in races else RACES.get(c['race'], '')), esc(CLASSES.get(c['class'], '')),
|
||||
esc(c['realm']),
|
||||
'<span class="tag green">Online</span>' if c['online'] else (esc(fmt_ago(c['logout_time'])) if c['logout_time'] else '')) for c in chars)
|
||||
char_table = ('<div class="tbl-wrap"><table class="tbl"><thead><tr><th>Character</th><th class="num">Level</th><th class="hide-sm">Race and class</th>'
|
||||
'<th>Realm</th><th class="hide-sm">Last played</th></tr></thead><tbody>%s</tbody></table></div>') % char_rows \
|
||||
if chars else '<div class="empty">No characters yet.</div>'
|
||||
|
||||
body = note + '<div class="cols"><div class="stack">%s%s</div><div class="stack">%s%s</div></div>' % (
|
||||
panel('Characters', char_table, sub='%d on all realms' % len(chars), flush=True),
|
||||
panel('Game accounts', acc_table, flush=True),
|
||||
panel('Battle.net account', info),
|
||||
panel('Authenticator', security, right='<span class="tag green">Protected</span>' if secured else ''))
|
||||
self.page('Account', body, 'Your Battle.net account, game accounts and characters.')
|
||||
|
||||
def authenticator_start(self):
|
||||
bnet = self.bnet_account()
|
||||
if bnet and not bnet['authenticator_secret']:
|
||||
self.session['totp_pending'] = totp_new_secret()
|
||||
self.redirect('/account')
|
||||
|
||||
def authenticator_cancel(self):
|
||||
self.session.pop('totp_pending', None)
|
||||
self.redirect('/account')
|
||||
|
||||
def authenticator_confirm(self):
|
||||
pending = self.session.get('totp_pending')
|
||||
if not pending:
|
||||
return self.redirect('/account')
|
||||
if not rate_ok(self.client_address[0], 'totp', 10):
|
||||
return self.account_page(alert('bad', 'Too many tries. Wait a minute and try again.'))
|
||||
if not totp_check(pending, self.form.get('code', '')):
|
||||
return self.account_page(alert('bad', 'That code is not right. Check that the time on your phone is correct, then try the newest code.'))
|
||||
execute(auth_db(), 'UPDATE battlenet_accounts SET authenticator_secret = %s WHERE id = %s AND authenticator_secret IS NULL',
|
||||
(pending, self.session['bnet']))
|
||||
self.session.pop('totp_pending', None)
|
||||
log('authenticator added, bnet account', self.session['bnet'])
|
||||
self.account_page(alert('ok', 'Your authenticator is on. From your next login the game asks for its code. '
|
||||
'Log your character out and back in to get the 4 extra backpack slots.'))
|
||||
|
||||
def authenticator_remove(self):
|
||||
bnet = self.bnet_account()
|
||||
if not bnet or not bnet['authenticator_secret']:
|
||||
return self.redirect('/account')
|
||||
if not rate_ok(self.client_address[0], 'totp', 10):
|
||||
return self.account_page(alert('bad', 'Too many tries. Wait a minute and try again.'))
|
||||
if not totp_check(bnet['authenticator_secret'], self.form.get('code', '')):
|
||||
return self.account_page(alert('bad', 'That code is not right. Try the newest code from your app.'))
|
||||
execute(auth_db(), 'UPDATE battlenet_accounts SET authenticator_secret = NULL WHERE id = %s', (bnet['id'],))
|
||||
log('authenticator removed, bnet account', bnet['id'])
|
||||
self.account_page(alert('ok', 'The authenticator was removed. The 4 extra backpack slots go away at your next login '
|
||||
'(items in them are sent to you by mail).'))
|
||||
|
||||
# unstuck
|
||||
|
||||
def unstuck_form(self, note=''):
|
||||
@@ -1072,6 +1251,11 @@ DIRECT_ENTRY = {
|
||||
ROUTES = {
|
||||
('GET', '/'): Handler.home,
|
||||
('GET', '/faq'): Handler.faq,
|
||||
('GET', '/account'): Handler.account_page,
|
||||
('POST', '/account/authenticator/start'): Handler.authenticator_start,
|
||||
('POST', '/account/authenticator/cancel'): Handler.authenticator_cancel,
|
||||
('POST', '/account/authenticator/confirm'): Handler.authenticator_confirm,
|
||||
('POST', '/account/authenticator/remove'): Handler.authenticator_remove,
|
||||
('GET', '/unstuck'): Handler.unstuck_form,
|
||||
('POST', '/unstuck'): Handler.unstuck,
|
||||
('GET', '/ticket/new'): Handler.ticket_new_form,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Battle.net account authenticator (TOTP, RFC 6238, the code of any authenticator app). Set up from the support site account page;
|
||||
-- bnetserver asks for the code at login (client AUTHENTICATOR login state) and secured accounts get the +4 backpack slots in game.
|
||||
-- Base32 secret, NULL = no authenticator. Safe to run again.
|
||||
SET @col := (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'battlenet_accounts' AND COLUMN_NAME = 'authenticator_secret');
|
||||
SET @sql := IF(@col = 0, 'ALTER TABLE `battlenet_accounts` ADD COLUMN `authenticator_secret` VARCHAR(64) NULL DEFAULT NULL AFTER `LoginTicketExpiry`', 'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,7 @@
|
||||
-- Battle.net account BattleTag ("Name#1234"), sent to the client at Battle.net login (LogonRecord.battle_tag) and in the account info.
|
||||
-- The client only offers Battle.net friends (and shows the BattleTag in the Social window) when it has one. NULL = none. Safe to run again.
|
||||
SET @col := (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'battlenet_accounts' AND COLUMN_NAME = 'battle_tag');
|
||||
SET @sql := IF(@col = 0, 'ALTER TABLE `battlenet_accounts` ADD COLUMN `battle_tag` VARCHAR(32) NULL DEFAULT NULL AFTER `email`, ADD UNIQUE KEY `uk_battle_tag` (`battle_tag`)', 'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- Battle.net (BattleTag) friends for the Classic 1.60 client, kept in auth so every realm shares them (game/Services/FriendsService.cpp).
|
||||
-- A friendship is two rows (one per account). Safe to run again.
|
||||
CREATE TABLE IF NOT EXISTS `battlenet_friends` (
|
||||
`account_id` INT UNSIGNED NOT NULL COMMENT 'battlenet_accounts.id',
|
||||
`friend_account_id` INT UNSIGNED NOT NULL COMMENT 'battlenet_accounts.id',
|
||||
`created` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'unix time',
|
||||
`note` VARCHAR(127) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`account_id`, `friend_account_id`),
|
||||
KEY `idx_friend` (`friend_account_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Battle.net friends';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `battlenet_friend_invitations` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`inviter_account_id` INT UNSIGNED NOT NULL COMMENT 'battlenet_accounts.id',
|
||||
`invitee_account_id` INT UNSIGNED NOT NULL COMMENT 'battlenet_accounts.id',
|
||||
`created` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'unix time',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_pair` (`inviter_account_id`, `invitee_account_id`),
|
||||
KEY `idx_invitee` (`invitee_account_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Pending Battle.net friend invitations';
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Characters that left the in-game Discord channel with /leave: they are no longer joined to it at login (DiscordChannel.cpp,
|
||||
-- worldserver.conf Discord.Channel.Enable). /join Discord removes the row again. Safe to run again.
|
||||
CREATE TABLE IF NOT EXISTS `character_discord_optout` (
|
||||
`guid` bigint unsigned NOT NULL COMMENT 'characters.guid',
|
||||
PRIMARY KEY (`guid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='left the Discord channel';
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Classic 1.60 Social window, Allies tab (RecentAllies.cpp): players a character grouped with, one row per ally and interaction type,
|
||||
-- kept 30 days. Safe to run again.
|
||||
CREATE TABLE IF NOT EXISTS `character_recent_allies` (
|
||||
`guid` bigint unsigned NOT NULL COMMENT 'characters.guid',
|
||||
`ally` bigint unsigned NOT NULL COMMENT 'characters.guid of the other player',
|
||||
`type` tinyint unsigned NOT NULL COMMENT 'interaction type sent to the client (0x0B = grouped)',
|
||||
`time` bigint unsigned NOT NULL COMMENT 'unix time of the latest such interaction',
|
||||
`value` int unsigned NOT NULL DEFAULT 0 COMMENT 'interaction value (grouped: zone id)',
|
||||
PRIMARY KEY (`guid`, `ally`, `type`),
|
||||
KEY `idx_guid_time` (`guid`, `time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Allies tab of the Social window';
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Classic 1.60 (WoW Forever): Knight of Mourning greeting (gossip menu 45038, npc_text 10045038) as the official beta sends it,
|
||||
-- from the build 70235 sniff of 2026-10-06. Own hotfix_data id outside the sniff import range (990000-1989999). Safe to run again.
|
||||
DELETE FROM `broadcast_text` WHERE `ID` = 326872;
|
||||
INSERT INTO `broadcast_text` (`Text`,`Text1`,`ID`,`LanguageID`,`ConditionID`,`EmotesID`,`Flags`,`ChatBubbleDurationMs`,`VoiceOverPriorityID`,`SoundKitID1`,`SoundKitID2`,`EmoteID1`,`EmoteID2`,`EmoteID3`,`EmoteDelay1`,`EmoteDelay2`,`EmoteDelay3`,`VerifiedBuild`) VALUES
|
||||
('My oath binds me to this place. What brings you here, to this light-forsaken place?','',326872,0,0,0,256,0,4,0,0,0,0,0,0,0,0,70235);
|
||||
DELETE FROM `hotfix_data` WHERE `Id` = 2000001;
|
||||
INSERT INTO `hotfix_data` (`Id`,`UniqueId`,`TableHash`,`RecordId`,`Status`,`VerifiedBuild`) VALUES
|
||||
(2000001,1397720001,35137211,326872,1,70235);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Classic 1.60: the Social window Allies tab shows RolodexType.Description as the reason someone is a recent ally. The client data
|
||||
-- (RolodexType.db2, table hash 0xDA556D7C, layout 0x22D8CB1A: Name, Description strings) has no description for 1 Party Member and
|
||||
-- 2 Raid Member (Blizzard does not record them in Classic), so grouped allies showed with an empty reason. Give them one.
|
||||
-- Record blob = Name, NUL, Description, NUL. Own hotfix_data ids outside the sniff import range (990000-1989999). Safe to run again.
|
||||
DELETE FROM `hotfix_blob` WHERE `TableHash` = 3663031676 AND `RecordId` IN (1, 2);
|
||||
INSERT INTO `hotfix_blob` (`TableHash`,`RecordId`,`locale`,`Blob`,`VerifiedBuild`) VALUES
|
||||
(3663031676,1,'enUS',CONCAT('Party Member',CHAR(0),'Grouped Together',CHAR(0)),70235),
|
||||
(3663031676,2,'enUS',CONCAT('Raid Member',CHAR(0),'In a Raid Together',CHAR(0)),70235);
|
||||
DELETE FROM `hotfix_data` WHERE `Id` IN (2000002, 2000003);
|
||||
INSERT INTO `hotfix_data` (`Id`,`UniqueId`,`TableHash`,`RecordId`,`Status`,`VerifiedBuild`) VALUES
|
||||
(2000002,1397720002,3663031676,1,1,70235),
|
||||
(2000003,1397720003,3663031676,2,1,70235);
|
||||
@@ -0,0 +1,52 @@
|
||||
-- Classic 1.60: Seal of Righteousness adds Holy damage to melee swings, Judgement unleashes the active seal (it stays) and the
|
||||
-- paladin's swings keep Judgement of the Crusader up (classic_spell_scripts.cpp, sniff of the official beta 2026-10-06)
|
||||
-- Safe to run again.
|
||||
|
||||
-- Seal of Righteousness ranks: Forever rank 1 (20154), vanilla ranks 1-8
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (20154, 21084, 20287, 20288, 20289, 20290, 20291, 20292, 20293)
|
||||
AND `ScriptName` = 'classic_spell_pal_seal_of_righteousness';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(20154, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(21084, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20287, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20288, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20289, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20290, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20291, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20292, 'classic_spell_pal_seal_of_righteousness'),
|
||||
(20293, 'classic_spell_pal_seal_of_righteousness');
|
||||
|
||||
-- every landed melee swing (PROC_FLAG_DEAL_MELEE_SWING, normal and critical hits)
|
||||
DELETE FROM `spell_proc` WHERE `SpellId` IN (20154, 21084, 20287, 20288, 20289, 20290, 20291, 20292, 20293);
|
||||
INSERT INTO `spell_proc` (`SpellId`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `SpellFamilyMask3`,
|
||||
`ProcFlags`, `ProcFlags2`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `DisableEffectsMask`, `ProcsPerMinute`, `Chance`, `Cooldown`, `Charges`) VALUES
|
||||
(20154, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(21084, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20287, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20288, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20289, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20290, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20291, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20292, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0),
|
||||
(20293, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0);
|
||||
|
||||
-- Judgement: the Classic script instead of the retail ones (Holy Power, Judgment of Justice)
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 20271;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(20271, 'classic_spell_pal_judgement');
|
||||
|
||||
-- Judgement of the Crusader: the paladin's landed swings (25942, applied with the judgement) keep the debuff on the target (25943)
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 25943;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(25943, 'classic_spell_pal_judgement_of_the_crusader_refresh');
|
||||
DELETE FROM `spell_proc` WHERE `SpellId` = 25942;
|
||||
INSERT INTO `spell_proc` (`SpellId`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `SpellFamilyMask3`,
|
||||
`ProcFlags`, `ProcFlags2`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `DisableEffectsMask`, `ProcsPerMinute`, `Chance`, `Cooldown`, `Charges`) VALUES
|
||||
(25942, 0, 0, 0, 0, 0, 0, 0x4, 0, 0, 0, 0x3, 0, 0, 0, 100, 0, 0);
|
||||
|
||||
-- Holy Shock: all three trainer ranks heal or damage with their own spells (the retail script only knows rank 1)
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (20473, 20929, 20930);
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(20473, 'classic_spell_pal_holy_shock'),
|
||||
(20929, 'classic_spell_pal_holy_shock'),
|
||||
(20930, 'classic_spell_pal_holy_shock');
|
||||
@@ -0,0 +1,570 @@
|
||||
-- Classic 1.60 (WoW Forever): sniff of the official beta, build 70235 (2026-10-06, Tirisfal Glades and the Undead paladin start).
|
||||
-- Made with classic_re/sniff/sniff_import.py on that one sniff: new creature Coldrasp, creature levels, the quests with their
|
||||
-- objectives, quest givers and takers, quest POIs (objective areas), and the Knight of Mourning gossip. The patrol path section
|
||||
-- of the generator is left out (it clears the paths of map 2991, which this sniff does not contain). Safe to run again.
|
||||
|
||||
-- creatures
|
||||
DELETE FROM `creature_template` WHERE `entry` IN (274300);
|
||||
INSERT INTO `creature_template` (`entry`,`KillCredit1`,`KillCredit2`,`name`,`femaleName`,`subname`,`TitleAlt`,`IconName`,`RequiredExpansion`,`VignetteID`,`faction`,`npcflag`,`speed_walk`,`speed_run`,`scale`,`Classification`,`dmgschool`,`BaseAttackTime`,`RangeAttackTime`,`BaseVariance`,`RangeVariance`,`unit_class`,`unit_flags`,`unit_flags2`,`unit_flags3`,`family`,`trainer_class`,`type`,`VehicleId`,`AIName`,`MovementType`,`ExperienceModifier`,`RacialLeader`,`movementId`,`WidgetSetID`,`WidgetSetUnitConditionID`,`RegenHealth`,`CreatureImmunitiesId`,`flags_extra`,`ScriptName`,`VerifiedBuild`) VALUES
|
||||
(274300,0,0,'Coldrasp',NULL,NULL,NULL,NULL,0,0,38,0,1.0,1.142857,1.0,4,0,2000,2000,1,1,1,0,2048,0,1,0,1,0,'',0,1,0,1693,0,0,1,0,0,'',70124);
|
||||
DELETE FROM `creature_template_difficulty` WHERE `Entry` IN (274300);
|
||||
INSERT INTO `creature_template_difficulty` (`Entry`,`DifficultyID`,`LevelScalingDeltaMin`,`LevelScalingDeltaMax`,`ContentTuningID`,`HealthScalingExpansion`,`HealthModifier`,`ManaModifier`,`ArmorModifier`,`DamageModifier`,`CreatureDifficultyID`,`TypeFlags`,`TypeFlags2`,`TypeFlags3`,`LootID`,`PickPocketLootID`,`SkinLootID`,`GoldMin`,`GoldMax`,`VerifiedBuild`) VALUES
|
||||
(274300,0,0,0,0,0,1.25,1.0,1,1,358105,134217729,0,0,0,0,0,0,0,70124);
|
||||
DELETE FROM `creature_template_model` WHERE `CreatureID` IN (274300);
|
||||
INSERT INTO `creature_template_model` (`CreatureID`,`Idx`,`CreatureDisplayID`,`DisplayScale`,`Probability`,`VerifiedBuild`) VALUES
|
||||
(274300,0,2446,1.0,0.0,70124);
|
||||
INSERT IGNORE INTO `creature_model_info` (`DisplayID`,`BoundingRadius`,`CombatReach`,`DisplayID_Other_Gender`,`VerifiedBuild`) VALUES
|
||||
(2446,0.389,1.5,0,70124);
|
||||
|
||||
-- faction and unit flags of the Forever creatures that were added by hand before the sniffs
|
||||
UPDATE `creature_template` SET `faction` = 18, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 250282;
|
||||
UPDATE `creature_template` SET `faction` = 18, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 250283;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 250448;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 768, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 250539;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 768, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 250541;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 257655;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 259190;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 768, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 260101;
|
||||
UPDATE `creature_template` SET `faction` = 71, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 260102;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 269729;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 269730;
|
||||
UPDATE `creature_template` SET `faction` = 68, `unit_flags` = 0, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 276067;
|
||||
UPDATE `creature_template` SET `faction` = 35, `unit_flags` = 512, `unit_flags2` = 2048, `unit_flags3` = 0 WHERE `entry` = 276110;
|
||||
|
||||
-- creature levels seen in the sniffs (Forever creatures replaced, others only where missing)
|
||||
DELETE FROM `creature_classic_level` WHERE `entry` IN (250282,250283,250448,250539,250541,257655,259190,260101,260102,269729,269730,274300,276067,276110);
|
||||
INSERT IGNORE INTO `creature_classic_level` (`entry`,`level_min`,`level_max`) VALUES
|
||||
(1544,9,9),
|
||||
(1545,10,10),
|
||||
(5288,8,9),
|
||||
(6491,60,60),
|
||||
(246349,55,55),
|
||||
(246378,61,61),
|
||||
(246389,55,55),
|
||||
(246393,55,55),
|
||||
(246394,20,20),
|
||||
(250282,9,10),
|
||||
(250283,9,11),
|
||||
(250448,20,20),
|
||||
(250539,10,10),
|
||||
(250541,10,10),
|
||||
(257655,10,10),
|
||||
(259190,55,55),
|
||||
(260101,10,10),
|
||||
(260102,55,55),
|
||||
(269729,1,2),
|
||||
(269730,1,2),
|
||||
(274300,12,12),
|
||||
(276067,12,12),
|
||||
(276110,55,55);
|
||||
|
||||
-- permanent creature auras seen in the sniffs (full aura updates of at least half of the creatures units)
|
||||
INSERT INTO `creature_template_addon` (`entry`,`auras`) VALUES (6491,'9036') ON DUPLICATE KEY UPDATE `auras` = IF(`auras` IS NULL OR `auras` = '', '9036', `auras`);
|
||||
INSERT INTO `creature_template_addon` (`entry`,`auras`) VALUES (260102,'18950') ON DUPLICATE KEY UPDATE `auras` = '18950';
|
||||
|
||||
-- quests
|
||||
DELETE FROM `quest_template` WHERE `ID` IN (91208,91209,91285,91920,91921,94427,94434,94435,94436,94438,94440,94441,95314,95494,95495,95507,95774,95981,96607,96656,96895,96897,96898,97253,97558,97957,98389,98601,99134,99141,99142);
|
||||
INSERT INTO `quest_template` (`ID`,`QuestType`,`QuestPackageID`,`ContentTuningID`,`QuestSortID`,`QuestInfoID`,`SuggestedGroupNum`,`RewardNextQuest`,`RewardXPDifficulty`,`RewardXPMultiplier`,`RewardMoneyDifficulty`,`RewardMoneyMultiplier`,`RewardBonusMoney`,`RewardSpell`,`RewardHonor`,`RewardKillHonor`,`RewardFavor`,`RewardArtifactXPDifficulty`,`RewardArtifactXPMultiplier`,`RewardArtifactCategoryID`,`StartItem`,`Flags`,`FlagsEx`,`FlagsEx2`,`FlagsEx3`,`RewardItem1`,`RewardAmount1`,`ItemDrop1`,`ItemDropQuantity1`,`RewardItem2`,`RewardAmount2`,`ItemDrop2`,`ItemDropQuantity2`,`RewardItem3`,`RewardAmount3`,`ItemDrop3`,`ItemDropQuantity3`,`RewardItem4`,`RewardAmount4`,`ItemDrop4`,`ItemDropQuantity4`,`RewardChoiceItemID1`,`RewardChoiceItemQuantity1`,`RewardChoiceItemDisplayID1`,`RewardChoiceItemID2`,`RewardChoiceItemQuantity2`,`RewardChoiceItemDisplayID2`,`RewardChoiceItemID3`,`RewardChoiceItemQuantity3`,`RewardChoiceItemDisplayID3`,`RewardChoiceItemID4`,`RewardChoiceItemQuantity4`,`RewardChoiceItemDisplayID4`,`RewardChoiceItemID5`,`RewardChoiceItemQuantity5`,`RewardChoiceItemDisplayID5`,`RewardChoiceItemID6`,`RewardChoiceItemQuantity6`,`RewardChoiceItemDisplayID6`,`POIContinent`,`POIx`,`POIy`,`POIPriority`,`RewardTitle`,`RewardArenaPoints`,`RewardSkillLineID`,`RewardNumSkillUps`,`PortraitGiver`,`PortraitGiverMount`,`PortraitGiverModelSceneID`,`PortraitTurnIn`,`RewardFactionID1`,`RewardFactionValue1`,`RewardFactionOverride1`,`RewardFactionCapIn1`,`RewardFactionID2`,`RewardFactionValue2`,`RewardFactionOverride2`,`RewardFactionCapIn2`,`RewardFactionID3`,`RewardFactionValue3`,`RewardFactionOverride3`,`RewardFactionCapIn3`,`RewardFactionID4`,`RewardFactionValue4`,`RewardFactionOverride4`,`RewardFactionCapIn4`,`RewardFactionID5`,`RewardFactionValue5`,`RewardFactionOverride5`,`RewardFactionCapIn5`,`RewardFactionFlags`,`RewardCurrencyID1`,`RewardCurrencyQty1`,`RewardCurrencyID2`,`RewardCurrencyQty2`,`RewardCurrencyID3`,`RewardCurrencyQty3`,`RewardCurrencyID4`,`RewardCurrencyQty4`,`AcceptedSoundKitID`,`CompleteSoundKitID`,`AreaGroupID`,`TimeAllowed`,`AllowableRaces`,`Expansion`,`ManagedWorldStateID`,`QuestSessionBonus`,`ResetByScheduler`,`LogTitle`,`LogDescription`,`QuestDescription`,`AreaDescription`,`PortraitGiverText`,`PortraitGiverName`,`PortraitTurnInText`,`PortraitTurnInName`,`QuestCompletionLog`,`RewardDisplaySpell1`,`RewardDisplaySpell2`,`RewardDisplaySpell3`,`VerifiedBuild`) VALUES
|
||||
(91208,2,4,0,-141,0,0,91209,3,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'Coming to Terms','Find the Frightened Paladin in Deathknell.','Not all of our fellow Paladins who rise again are quick to acclimate to our new reality. Some struggle to reconcile that they are now, in a way, the very thing they spent their lives fighting against.\r\n\r\nThese individuals often simply need a kind gesture and a sympathetic ear. Unfortunately, many others are quick to turn violent. Find the frightened paladin who fled into the hills directly west of this chapel. Extend a hand in friendship. Lead them back into the light if you can.','','','','','','',0,0,0,70124),
|
||||
(91209,2,4,0,-141,0,0,0,2,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'Continue Your Training','Follow the road east out of Deathknell to find the town of Brill. Report to Shari Stilwell to continue your training.','Lordaeron may not be what it used to be, but our home still needs protection from all manner of threats and it\'s time for you to go out and face the world. Your next stop should be the town of Brill in central Tirisfal Glades. Go and meet with Shari Stilwell there. She can see to your continued training. \r\n\r\nOne last bit of advice before you go--take extra care as a paladin traveling through Forsaken lands. There are many in the Dark Lady\'s service who distrust us and our proximity to the light.','','','','','','',0,0,0,70124),
|
||||
(91285,2,7,0,-141,0,0,91294,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,246164,1,0,246165,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'Murlocs at the Gates','Slay $1oa Vile Fin Attackers and $2oa Vile Fin Seers and report back to Breton Samuels when it is done.','Normally we\'d show our newcomers a bit more hospitality, but we\'ve got a bit of a murloc problem at the moment.\r\n\r\nA tribe of murlocs used to use the keep as their spawning grounds. They\'ve been a problem since we moved in and kicked them out, but now it\'s starting to get out of hand. You look like you\'ve seen some action. Do you think you could help us drive back some of these pests? You\'ll find them lurking in the bluffs along the road to the east, and in the camps around the lake to the west.','','','','','','',0,0,0,70124),
|
||||
(91920,2,10,0,130,0,0,91921,3,1.0,3,1.0,0,0,0,0.0,0,0,1.0,0,0,8,0,0,0,4597,1,0,0,4596,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,18446744073709551615,-2,0,0,0,'Wild Eyes','Gather 3 murloc eyes and bring them to Apothecary Renferrel at the Sepulcher.','I wouldn\'t dare to question the effectiveness of Apothecary Renferrel\'s formulae, however I would be lying if I said that the potion made any noticeable difference.\r\n\r\nAlong the shore of Lake Lordamere are a swarm of murlocs, and of note, murlocs have eyes. I suspect the apothecary\'s willingness to try new things is suppressed by his recent obsession with hearts. Bring him a few.\r\n\r\nIf my choice is to inevitably die a second death or have Renferrel kill me for questioning his methods, I choose the latter.','','','','','','',0,0,0,70124),
|
||||
(91921,2,10,0,130,0,0,0,4,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,248930,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,4,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,18446744073709551615,-2,0,0,0,'Return to Quinn (Again)','Bring Quinn\'s potion to Quinn Yorick at the Ivar Patch, north of the Sepulcher.','Here is the new potion to aid in Quinn\'s recovery, made with love extracted from six whole hearts.\r\n\r\nNow, please excuse me before your presence necessitates more paperwork.','','','','','','',0,0,0,70124),
|
||||
(94427,2,12,0,-141,0,0,0,2,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Speak to Tanis Alderwood in the Undercity.','A key tenent of being a paladin is the pursuit of divinity. This is not the pursuit of godhood, but merely the pursuit of good itself, for good\'s sake. We\'ve all arrived at this place due to tragedy of one form or another, and it would be easy to lose that grace that defined us as paladins in life.\r\n\r\nGo to the Undercity and seek out Tanis Alderwood in the Trade Quarter. They are in need, and they could benefit greatly from some grace.','','','','','','',0,0,0,70124),
|
||||
(94434,2,12,0,-141,0,0,94435,5,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Bring 10 Linen Cloth to Tanis Alderwood in the Undercity.','Wait, you want to... help? Why would a paladin want to help a beggar like me?\r\n\r\nWell, I suppose that you could be of some assistance. \r\n\r\nIt\'s my wife you see. She, well... she\'s falling apart. I mean that literally. The apothecaries can stitch her back together right as rain, but they are about the Dark Lady\'s business and none are available to help. If you could perhaps bring me some fresh cloth then I could at least make her a wrapping to hold her together while we wait for the apothecaries.','','','','','','',0,0,0,70124),
|
||||
(94435,2,12,0,-141,0,0,94436,2,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,6866,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Return to Danitha Morr at Bandarion Keep.','I don\'t know why you\'d go out of your way to help me, but I appreciate it. If someone sent you my way, tell them I appreciate them too. You\'ll always have a friend in Tanis Alderwood, $c.','','','','','','',0,0,0,70124),
|
||||
(94436,2,12,0,-141,0,0,94438,1,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Speak with Deathguard Billmuth at Bandarion Keep.\r\n\r\nShould you misplace your Symbol of Life, return to Danitha Morr for a replacement.','It\'s time to demonstrate your ability to channel one of the light\'s greatest gifts.\r\n\r\nThe item I just gave you is called the Symbol of Life. Take care, as it may cause you some discomfort to handle a talisman of the light such as this. The light may be anathema to the force that created us, but it is still our guide and ally. The pain reminds us of this.\r\n\r\nGo see Deathguard Billmuth downstairs. He just arrived and he has petitioned us for aid. Show him and the Forsaken what a true paladin can do.','Speak with Deathguard Billmuth at Tyr\'s Watch.','','','','','Speak with Deathguard Billmuth at Tyr\'s Watch.',0,0,0,70124),
|
||||
(94438,2,12,0,-141,0,0,94440,5,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,4,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Take the Symbol of Life and use it to resurrect Deathguard Falgan at Venomweb Vale. \r\n\r\nShould you misplace your Symbol of Life, return to Danitha Morr for a replacement.','Falgan and I were sent on a mission to scout out scarlet activity in Venomweb Vale. We managed to sneak close enough to one of their camps to hear about new orders involving an attack on Brill. Before we could decide what to do next, I stepped on a twig and the noise alerted them to us.\r\n\r\nFalgan yelled at me to run, so I ran. By the time I realized he wasn\'t with me, I was halfway to Brill. That brave idiot probably stayed behind to hold them off for me.\r\n\r\nPlease, find my friend and help him if you can.','Take the Symbol of Life and use it to resurrect Deathguard Falgan at Venomweb Vale.','','','','','Take the Symbol of Life and use it to resurrect Deathguard Falgan at Venomweb Vale.',0,0,0,70124),
|
||||
(94440,2,12,0,-141,0,0,94441,4,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Retrieve the Scarlet Crusade Attack Plans from the Scarlet Crusaders at Venomweb Vale, and return to Deathguard Billmuth at Tyr\'s Watch.','These Scarlet Crusaders often carry satchels with their deployment orders. We know an attack is coming, but if we can recover their orders, we can warn the rest of the Deathguard and prepare an ambush. \r\n\r\nYou are clearly an impressive paladin. Kill these scarlet animals and retrieve a copy of their orders and bring them back to Deathguard Billmuth. He\'ll take it from there.','','','','','','',0,0,0,70124),
|
||||
(94441,2,12,0,-141,0,0,0,2,1.0,0,1.0,0,7329,0,0.0,0,0,1.0,0,0,2097152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Lesson in Divinity','Speak with Danitha Morr in the keep at Bandarion Keep.','Please give my thanks to Danitha Morr and tell her that the rest of the Deathguard will hear about the service that the paladins of Tyr\'s Watch performed for us. \r\n\r\nYou have a lot of promise as a paladin, and I am proud to have those like you among the ranks of the Forsaken. Dark Lady watch over you, $n.','','','','','','',7328,0,0,70124),
|
||||
(95314,2,7,0,85,0,0,0,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,18446744073709551615,-2,0,0,0,'That Shadowvale Green Elixir','Collect $1oa Bottles of Whispering Elixir from Shadowvale, then return to Carolai Anise in Brill.','Before the Scourge invasion, the reclusive village of Shadowvale was known for its Whispering Elixir. Distilled from herbs found only in Tyr\'s Fall, the elixir was sought by apothecaries, mystics, and poisoners alike even after being banned in the city.\r\n\r\nI\'ve had requests from a number of buyers eager to get their hands on some elixir. Travel to the ruins of Shadowvale deep in the Whispering Forest to the west. I\'m prepared to offer significant compensation if you can recover some bottles for me.','','','','','','',0,0,0,70124),
|
||||
(95494,2,14,0,17,0,0,95495,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,2097160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,76,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Bruised Pride and Lion Hides','Collect 6 Savannah Lion Hides from the Savannah Matriarchs and Savannah Patriarchs in the Barrens.','I need someone with a strong sword arm and some extra time on their hands to help me gather some lion hides. It stings my pride to ask a stranger for this aid, but I took an injury to my leg recently. Until I heal, I\'m in no shape to go hunting myself but I have obligations to keep.\r\n\r\nThe big ones in this area generally have the best hides, so start with those first.','','','','','','',0,0,0,70124),
|
||||
(95495,2,14,0,17,0,0,95621,2,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,269718,2097152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,76,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'The Hermit Tanner','Bring the Bundle of Hides to the hermit on the ridge overlooking the Dry Hills in the Barrens.','These hides are bound for a tanner who I often trade with. He is something of a hermit and he lives alone on the top of the ridge behind me. Climbing up a steep hillside isn\'t something I can manage easily right now so I\'d be in your debt if you could make this delivery for me.\r\n\r\nOh, and about this tanner\'s... appearance. You need not be alarmed. In spite of his looks, he is no threat. I swear this is true.','','','','','','',0,0,0,70124),
|
||||
(95507,2,14,0,17,0,0,95495,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,2097160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,76,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Vrang\'s Game','Collect 8 Trapped Game from traps found in Sprung Traps in the Barrens.','While you are out there, it would be of great help to me if you could check on my traps for me. I\'ve got them strewn all over the valley.\r\n\r\nBring back any small game that I\'ve caught. Keep your eye out for the other wildlife, though. This area can be dangerous if you aren\'t paying attention.','','','','','','',0,0,0,70124),
|
||||
(95774,2,14,0,17,0,0,0,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,36700168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Her Name Is Olgra','Slay quilboars and collect $1oa of Olgra\'s Adornments for Mankrik\'s memorial.','The healer who saved me could not save her, and she has died in battle. Her name is Olgra, and I will never forget her.\r\n\r\nYou did not find her adornments on her body? She wore many jewels of polished bone.\r\n\r\nSlay the Razormane Raiders near where she fell, and find her precious works of art!\r\n\r\nI will place them with the memorial that I build in her memory.','','','','','','',0,0,0,70124),
|
||||
(95981,2,10,0,130,0,0,480,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,36700168,0,0,0,281265,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Watching the Roads','Slay $1oa Dalaran Wizards and $2oa Dalaran Watchers for Shadow Priest Allister in the Sepulcher.','Taking away their pendants is just the first step. If the Kirin Tor really are shipping a steady supply of relics from Dalaran, we must stop them at the source.\r\n\r\nSearch the roads around Ambermill for Dalaran\'s wizards and watchers. Their presence has allowed free access across our borders for too long. If we can cull their numbers, that should put a stop to these pendants making it into Silverpine Forest in the first place.','','','','','','',0,0,0,70124),
|
||||
(96607,2,4,0,-666,0,0,0,4,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'The Great Outdoors','Sit near Eleanor\'s Basic Campfire and wait until you receive the Boosted Rest buff.','Greetings, $c. I can see you\'ve got the look of an adventurer about you. This is good. The world needs more of us restless souls, seeking fortune and glory.\r\n\r\nYou\'ll need to learn to thrive in the wilds to be successful in this line of work. Not sure how your outdoor skills are but I can probably teach you a thing or two, if you\'d be apt to learn.\r\n\r\nHave a seat near the fire and get comfortable. I\'ll walk you through it.','','','','','','',0,0,0,70124),
|
||||
(96656,2,4,0,-666,0,0,0,4,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'The Adventurer','Speak to Eleanor Shackleton near Brill.','$n, you have proven yourself trustworthy in your endeavors against the Scarlet Crusade so far. That is why I am now entrusting you with an unusual task.\r\n\r\nI\'ve heard of a new adventurer down the road by Brill. Go and see what she\'s doing.','','','','','','',0,0,0,70124),
|
||||
(96895,2,10,0,85,0,0,0,3,1.0,3,1.0,0,0,0,0.0,0,0,1.0,0,0,536870920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,529,6,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'The Argent Emissary','Find the Argent Dawn member near the entrance to the Undercity.','Not sure if you heard, but two emissaries of the Argent Dawn just passed through here. I don\'t mind the Argent Dawn, but I don\'t like them poking around Tirisfal unsupervised either. They were both Forsaken... but that doesn\'t make me any less nervous.\r\n\r\nOne of them just passed by here, headed southeast. There\'s a group of scourge cultists snooping around the outskirts of the city in that direction. If those two heard about them, there\'s no doubt that would have caught their attention.','','','','','','',0,0,0,70124),
|
||||
(96897,2,10,0,85,0,0,0,5,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,536870920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,529,6,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'The Cult of the Damned','Kill $1oa Dark Neophytes and $2oa Dark Enforcers in Tirisfal Glades.','The Scourge are a blight on our lands, and their living servants are the worst of them. The people of Tirisfal have enough to deal with between the mindless dead and the Scarlet Crusade. If you wish to do some good, help me put an end to this scum.','','','','','','',0,0,0,70124),
|
||||
(96898,2,10,0,85,0,0,0,5,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,536870920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,529,6,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Remnants of War','Gather $1oa Necrotic Crystal Fragments in Tirisfal Glades.','It wasn\'t long ago that the citadel of Naxxramas bore down upon this city, intent on wiping the Forsaken off the map. Both the Forsaken and the Argent Dawn lost much that day to secure the future of the Forsaken.\r\n\r\nDuring the battle, the great necrotic focusing crystal hanging beneath Naxxramas was shattered and its fragments were scattered all over this area. I suspect that is what the cultists are here for. Help me recover the fragments and deprive the Scourge of them.','','','','','','',0,0,0,70124),
|
||||
(97253,2,9,0,17,0,0,0,5,1.0,5,1.0,0,0,0,0.0,0,0,1.0,0,0,36700168,0,0,0,277332,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,18446744073709551615,-2,0,0,0,'Parts and Pieces','Collect $1oa Handfuls of Complicated Parts from the upper pirate camp south of Ratchet, then return to Wrenix the Wretched in Ratchet.','Hey, got a sec?\r\n\r\nSo, apparently, nobody I\'ve sent to deal with the recent pirate problem has come back alive. After five or six attempts I thought, "what if I sent a machine instead?" Turns out, scimitars double as screwdrivers in a pinch, and before I could redirect it home, it was already in pieces and scattered across their camp!\r\n\r\nI need those parts back, and since this is a quick little retrieval mission, I\'d wager your odds for survival are MUCH higher than the others. Whaddya say?','','','','','','',0,0,0,70124),
|
||||
(97558,2,6,0,85,0,0,0,4,1.0,4,1.0,0,0,0,0.0,0,0,1.0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,281283,1,0,281284,1,0,281285,1,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,4,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,18446744073709551615,-2,0,0,0,'Hides for the Forsaken','Bring Shelene Rhobart $1oa Duskbat Wing Membranes, $2oa Darkhound Hides and $3oa Vile Fin Murloc Skin.','One part of undeath no one mentions is what happens when we are injured. How does the skin of an undead heal itself?\r\n\r\nWell, it doesn\'t.\r\n\r\nOurs is a cursed life, $n. We must take from the living to further our own existence.\r\n\r\nWhen we sustain an injury, we must replace our skin which usually means animal hides. Since different hide thicknesses are better for different places on our bodies a variety is key!\r\n\r\nBring me wing membranes of a duskbat, hides from a darkhound and skin of a Vile Fin murloc.','','','','','','',0,0,0,70124),
|
||||
(97957,2,4,0,-666,0,0,0,3,1.0,0,1.0,0,1255251,0,0.0,0,0,1.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Camping 101: Herbalism','Speak with Faruza in Brill to learn to craft a camping item for your profession once you have shown proficiency in your skill.','Looks to me like you\'ve gained some skill in herbalism. Picking flowers isn\'t just for dilly-dallying, you know. It can be useful... and profitable.\r\n\r\nI reckon I know someone that can teach you how to craft an Incense Candle for your camp. High spirits are a key component to keeping healers and spellcasters in the fight, and an Incense Candle can provide a boost that magic users will surely appreciate.','','','','','','',1229705,0,0,70124),
|
||||
(98389,2,2,0,154,0,0,0,5,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,36700168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'A Light in the Darkness','Free $1oa Webbed Victims in Night\'s Web Hollow for Aramis Hammerhand in Deathknell.','Greetings, $c. Yes, I am a paladin. Not even death can stop the Light.\r\n\r\nThis is something my kind have in common with all Forsaken--we have overcome what the living view as their end. However, some even among our own fear us; they suspect we will smite them as some monstrosity.\r\n\r\nIn truth, our relationship with undeath is complex, but I am not here to hurt our own. Help me show the others this. Venture to Night\'s Web Hollow to the northwest and free the freshly raised fools trapped by the spiders there.','','','','','','',0,0,0,70124),
|
||||
(98601,2,1,0,-141,0,0,0,3,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,282423,19922944,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,3,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,16,-2,0,0,0,'A Difficult Path','Read the Consecrated Scroll and speak to Aramis Hammerhand in the church in Deathknell.','While you were off dealing with the mindless Scourge, this scroll arrived for you. It reeks of the light, so I imagine it\'s of some importance to a paladin like yourself.\r\n\r\nRead it before heading out again. Just please--step away when you do. Paladins make me quite uneasy.','','','','','','',0,0,0,70124),
|
||||
(99134,2,4,0,85,0,0,0,4,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,286176,36700160,0,0,0,0,0,286176,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Discipline','Punish $1oa Deathguards for Executor Zygand.','You are not a member of the Deathguard, and therefore have yet to disappoint me.\r\n\r\nAs a reward for your relative lack of incompetence, you shall punish those that have demonstrated such talents in excess.\r\n\r\nSwiftly now--$n, is it?--or I shall add your name to my ledger for someone else\'s reward.','','','','','','',0,0,0,70124),
|
||||
(99141,2,4,0,85,0,0,0,4,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,36700168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Patience','Obtain reports from Deathguard Dillinger, Deathguard Kristof, and Gordo for Executor Zygand.','Make no mistake, $c--the Dark Lady demands the perfect execution of her will. As an Executor, it is my duty to see that this happens.\r\n\r\nReports from several of my Deathguards are overdue. Needless to say, my patience has run out. Obtain their reports and bring them to me in the Dark Lady\'s name.\r\n\r\nYou will find Deathguard Dillinger just west of here, by the graveyard. Deathguard Kristof is stationed at the waystation to the east. And check on the abomination Gordo; he wanders west near Stillwater Pond.','','','','','','',0,0,0,70124),
|
||||
(99142,2,5,0,85,0,0,0,5,1.0,0,1.0,0,0,0,0.0,0,0,1.0,0,0,36700168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0,68,5,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,1,0,0,0,0,0,0,0,0,890,878,0,0,12261800583900083122,-2,0,0,0,'Tomb Weed','Collect $1oa Tomb Weed and deliver them back to Junior Apothecary Holland.','If you\'re heading east, towards the Balnir Farmstead, I have more you might do for me. Good help is ever so hard to find these days, as your run-in with Gordo illuminates ever so clearly.\r\n\r\nAs I acquire doom weed I perform some minor alchemical alterations and replant them on that farmstead to cultivate my ultimate creation. I call it tomb weed, and it shall be the herald of my glorious destiny.\r\n\r\nDo keep an eye on the Scourge in the area while you\'re there. They seem... drawn... to the weed. Curious.','','','','','','',0,0,0,70124);
|
||||
DELETE FROM `quest_objectives` WHERE `QuestID` IN (91208,91209,91285,91920,91921,94427,94434,94435,94436,94438,94440,94441,95314,95494,95495,95507,95774,95981,96607,96656,96895,96897,96898,97253,97558,97957,98389,98601,99134,99141,99142);
|
||||
INSERT INTO `quest_objectives` (`ID`,`QuestID`,`Type`,`Order`,`StorageIndex`,`ObjectID`,`Amount`,`ConditionalAmount`,`Flags`,`Flags2`,`ProgressBarWeight`,`ParentObjectiveID`,`Visible`,`Description`,`VerifiedBuild`) VALUES
|
||||
(462326,91208,0,0,1,246143,1,-842150451,32,0,0.0,0,1,'Offer aid to the Frightened Paladin',70124),
|
||||
(462329,91209,3,0,0,246152,1,-842150451,32,0,0.0,0,1,'Report to Shari Stilwell in Brill',70124),
|
||||
(462415,91285,0,0,0,250283,8,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(462416,91285,0,1,1,250282,8,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(463689,91920,1,0,0,730,3,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(463692,91921,1,0,0,248930,1,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(468578,94434,1,0,0,2589,10,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(468587,94440,1,0,0,264693,1,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(470252,95314,1,0,1,268801,8,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(470742,95494,1,0,1,269715,6,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(470745,95495,1,0,0,269718,1,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(470747,95507,1,0,1,269719,8,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(475545,95774,1,0,0,277277,4,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(477276,95981,0,0,0,1888,8,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(477277,95981,0,1,1,1889,8,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(473701,96607,14,0,2,227693,1,-842150451,32,0,0.0,0,1,'Sit near the campfire',70124),
|
||||
(473702,96607,14,1,3,227696,1,-842150451,32,0,0.0,0,1,'Gain the Boosted Rest buff',70124),
|
||||
(474506,96897,0,0,0,267006,8,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(474507,96897,0,1,1,275437,8,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(474508,96898,1,0,2,275851,12,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(475641,97253,1,0,0,277331,5,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(476113,97558,1,0,0,278242,8,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(476114,97558,1,1,1,278243,6,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(476115,97558,1,2,2,278244,3,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(476605,97957,14,0,0,231146,1,-842150451,32,0,0.0,0,1,'Raise your herbalism skill to 20',70124),
|
||||
(477518,98389,0,0,0,271961,6,-842150451,32,0,0.0,0,1,'Webbed Forsaken freed',70124),
|
||||
(478271,98601,1,0,0,282423,1,-842150451,32,0,0.0,0,1,'',70124),
|
||||
(479408,99134,0,0,0,1746,5,-842150451,32,0,0.0,0,1,'Deathguards motivated',70124),
|
||||
(479429,99141,1,0,0,286200,1,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(479430,99141,1,1,1,286201,1,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(479431,99141,1,2,2,286202,1,-842150451,32,1,0.0,0,1,'',70124),
|
||||
(479437,99142,1,0,0,286204,5,-842150451,32,1,0.0,0,1,'',70124);
|
||||
|
||||
-- quest chains of the Forever quests (seen in the sniffs: offered after the previous one was turned in)
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (91209,91208) ON DUPLICATE KEY UPDATE `PrevQuestID` = 91208;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (91921,91920) ON DUPLICATE KEY UPDATE `PrevQuestID` = 91920;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (94435,94434) ON DUPLICATE KEY UPDATE `PrevQuestID` = 94434;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (94436,94435) ON DUPLICATE KEY UPDATE `PrevQuestID` = 94435;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (94438,94436) ON DUPLICATE KEY UPDATE `PrevQuestID` = 94436;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (94440,94438) ON DUPLICATE KEY UPDATE `PrevQuestID` = 94438;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (94441,94440) ON DUPLICATE KEY UPDATE `PrevQuestID` = 94440;
|
||||
INSERT INTO `quest_template_addon` (`ID`,`PrevQuestID`) VALUES (95495,95507) ON DUPLICATE KEY UPDATE `PrevQuestID` = 95507;
|
||||
|
||||
-- quest givers and takers seen in the sniffs
|
||||
INSERT IGNORE INTO `creature_questender` (`id`,`quest`,`VerifiedBuild`) VALUES
|
||||
(1500,354,70124),
|
||||
(1495,356,70124),
|
||||
(1499,358,70124),
|
||||
(1500,362,70124),
|
||||
(1518,368,70124),
|
||||
(1515,370,70124),
|
||||
(1652,374,70124),
|
||||
(1515,398,70124),
|
||||
(1496,426,70124),
|
||||
(10665,5482,70124),
|
||||
(246349,91285,70124),
|
||||
(2132,95314,70124),
|
||||
(3549,97558,70124),
|
||||
(2114,97957,70124);
|
||||
|
||||
-- quest POIs (objective areas on the map and minimap)
|
||||
DELETE FROM `quest_poi` WHERE `QuestID` IN (354,356,358,362,368,370,374,398,426,5482,91285,95314,97558,97957);
|
||||
INSERT INTO `quest_poi` (`QuestID`,`BlobIndex`,`Idx1`,`ObjectiveIndex`,`QuestObjectiveID`,`QuestObjectID`,`MapID`,`UiMapID`,`Priority`,`Flags`,`WorldEffectID`,`PlayerConditionID`,`NavigationPlayerConditionID`,`SpawnTrackingID`,`AlwaysAllowMergingBlobs`,`VerifiedBuild`) VALUES
|
||||
(354,0,0,-1,0,0,0,1420,0,0,0,0,0,31508,0,70124),
|
||||
(354,0,1,0,381472,2829,0,1420,0,1,0,0,0,37729,0,70124),
|
||||
(354,0,2,1,381473,2828,0,1420,0,1,0,0,0,37727,0,70124),
|
||||
(354,0,3,2,381474,2830,0,1420,0,1,0,0,0,37730,0,70124),
|
||||
(354,0,4,32,0,0,0,1420,0,0,0,0,0,31508,0,70124),
|
||||
(356,0,0,-1,0,0,0,1420,0,0,0,0,0,31506,0,70124),
|
||||
(356,0,1,0,90003560,1529,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(356,0,2,1,90003561,1532,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(356,0,3,32,0,0,0,1420,0,0,0,0,0,31506,0,70124),
|
||||
(358,0,0,-1,0,0,0,1420,0,0,0,0,0,31507,0,70124),
|
||||
(358,0,1,0,90003580,1941,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(358,0,2,1,90003581,1675,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(358,0,3,2,380275,2834,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(358,0,4,32,0,0,0,1420,0,0,0,0,0,31507,0,70124),
|
||||
(362,0,0,-1,0,0,0,1420,0,0,0,0,0,31508,0,70124),
|
||||
(362,0,1,0,381265,2831,0,1420,0,1,0,0,0,37731,0,70124),
|
||||
(362,0,2,32,0,0,0,1420,0,0,0,0,0,31508,0,70124),
|
||||
(368,0,0,-1,0,0,0,1420,0,0,0,0,0,31519,0,70124),
|
||||
(368,0,1,0,381005,2859,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(368,1,2,0,381005,2859,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(368,0,3,32,0,0,0,1420,0,0,0,0,0,31519,0,70124),
|
||||
(370,0,0,-1,0,0,0,1420,0,0,0,0,0,31520,0,70124),
|
||||
(370,0,1,0,90003700,1662,0,1420,0,1,0,0,0,2372813,0,70124),
|
||||
(370,0,2,1,90003701,1537,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(370,1,3,1,90003701,1537,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(370,2,4,1,90003701,1537,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(370,0,5,2,90003702,1536,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(370,0,6,32,0,0,0,1420,0,0,0,0,0,31520,0,70124),
|
||||
(374,0,0,-1,0,0,0,1420,0,0,0,0,0,31902,0,70124),
|
||||
(374,0,1,0,380172,2875,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(374,1,2,0,380172,2875,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(374,2,3,0,380172,2875,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(374,3,4,0,380172,2875,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(374,4,5,0,380172,2875,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(374,0,6,32,0,0,0,1420,0,0,0,0,0,31902,0,70124),
|
||||
(398,0,0,-1,0,0,0,1420,0,0,0,0,0,31520,0,70124),
|
||||
(398,0,1,0,380308,3635,0,1420,0,1,0,0,0,36484,0,70124),
|
||||
(398,0,2,32,0,0,0,1420,0,0,0,0,0,0,0,70124),
|
||||
(426,0,0,-1,0,0,0,1420,0,0,0,0,0,31505,0,70124),
|
||||
(426,0,1,0,380288,3162,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(426,1,2,0,380288,3162,1,2482,0,1,0,0,0,0,0,70124),
|
||||
(426,2,3,0,380288,3162,1,2482,0,1,0,0,0,0,0,70124),
|
||||
(426,3,4,0,380288,3162,1,2482,0,1,0,0,0,0,0,70124),
|
||||
(426,0,5,1,380289,3163,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(426,0,6,32,0,0,0,1420,0,0,0,0,0,31505,0,70124),
|
||||
(5482,0,0,-1,0,0,0,1420,0,0,0,0,0,96819,0,70124),
|
||||
(5482,0,1,0,381387,13702,0,1420,0,1,0,0,0,0,0,70124),
|
||||
(5482,0,2,32,0,0,0,1420,0,0,0,0,0,96819,0,70124),
|
||||
(91285,0,0,-1,0,0,0,1420,0,0,0,0,0,2858957,0,70124),
|
||||
(91285,0,1,0,462415,250283,0,1420,0,2,0,0,0,0,0,70124),
|
||||
(91285,1,2,0,462415,250283,0,1420,0,0,0,0,0,0,0,70124),
|
||||
(91285,0,3,1,462416,250282,0,1420,0,2,0,0,0,0,0,70124),
|
||||
(91285,1,4,1,462416,250282,0,1420,0,0,0,0,0,0,0,70124),
|
||||
(91285,0,5,32,0,0,0,1420,0,0,0,0,0,2858957,0,70124),
|
||||
(95314,0,0,-1,0,0,0,1420,0,0,0,0,0,38970,0,70124),
|
||||
(95314,0,1,0,470252,268801,0,1420,0,0,0,0,0,0,0,70124),
|
||||
(95314,0,2,32,0,0,0,1420,0,0,0,0,0,38970,0,70124),
|
||||
(97558,0,0,-1,0,0,0,1420,0,0,0,0,0,57277,0,70124),
|
||||
(97558,0,1,0,476113,278242,0,1420,0,2,0,0,0,0,0,70124),
|
||||
(97558,0,2,1,476114,278243,0,1420,0,2,0,0,0,0,0,70124),
|
||||
(97558,1,3,1,476114,278243,0,1420,0,2,0,0,0,0,0,70124),
|
||||
(97558,0,4,2,476115,278244,0,1420,0,0,0,0,0,0,0,70124),
|
||||
(97558,1,5,2,476115,278244,0,1420,0,0,0,0,0,0,0,70124),
|
||||
(97558,0,6,32,0,0,0,1420,0,0,0,0,0,57277,0,70124),
|
||||
(97957,0,0,-1,0,0,0,1420,0,0,0,0,0,38967,0,70124),
|
||||
(97957,0,1,32,0,0,0,1420,0,8192,0,0,0,3267666,0,70124);
|
||||
DELETE FROM `quest_poi_points` WHERE `QuestID` IN (354,356,358,362,368,370,374,398,426,5482,91285,95314,97558,97957);
|
||||
INSERT INTO `quest_poi_points` (`QuestID`,`Idx1`,`Idx2`,`X`,`Y`,`Z`,`VerifiedBuild`) VALUES
|
||||
(354,0,0,2262,244,34,70124),
|
||||
(354,1,0,2952,964,122,70124),
|
||||
(354,2,0,2743,786,119,70124),
|
||||
(354,3,0,2857,1097,117,70124),
|
||||
(354,4,0,2262,244,34,70124),
|
||||
(356,0,0,2022,74,36,70124),
|
||||
(356,1,0,2016,-518,42,70124),
|
||||
(356,1,1,2049,-485,41,70124),
|
||||
(356,1,2,2044,-383,35,70124),
|
||||
(356,1,3,2040,-333,35,70124),
|
||||
(356,1,4,1950,-318,35,70124),
|
||||
(356,1,5,1948,-440,35,70124),
|
||||
(356,2,0,2045,-512,43,70124),
|
||||
(356,2,1,2071,-462,39,70124),
|
||||
(356,2,2,2083,-362,39,70124),
|
||||
(356,2,3,1984,-319,37,70124),
|
||||
(356,2,4,1966,-441,35,70124),
|
||||
(356,2,5,1994,-483,35,70124),
|
||||
(356,3,0,2022,74,36,70124),
|
||||
(358,0,0,2306,265,39,70124),
|
||||
(358,1,0,2552,411,30,70124),
|
||||
(358,1,1,2588,422,34,70124),
|
||||
(358,1,2,2621,454,26,70124),
|
||||
(358,1,3,2649,485,16,70124),
|
||||
(358,1,4,2656,531,16,70124),
|
||||
(358,1,5,2585,619,20,70124),
|
||||
(358,1,6,2514,605,28,70124),
|
||||
(358,1,7,2449,475,45,70124),
|
||||
(358,2,0,2717,281,28,70124),
|
||||
(358,2,1,2824,287,28,70124),
|
||||
(358,2,2,2858,292,28,70124),
|
||||
(358,2,3,2891,348,28,70124),
|
||||
(358,2,4,2903,379,30,70124),
|
||||
(358,2,5,2903,392,30,70124),
|
||||
(358,2,6,2822,487,31,70124),
|
||||
(358,2,7,2680,312,31,70124),
|
||||
(358,3,0,2717,281,28,70124),
|
||||
(358,3,1,2824,287,28,70124),
|
||||
(358,3,2,2858,292,28,70124),
|
||||
(358,3,3,2891,348,28,70124),
|
||||
(358,3,4,2903,379,30,70124),
|
||||
(358,3,5,2903,392,30,70124),
|
||||
(358,3,6,2822,487,31,70124),
|
||||
(358,3,7,2585,619,20,70124),
|
||||
(358,3,8,2514,605,28,70124),
|
||||
(358,3,9,2449,475,45,70124),
|
||||
(358,3,10,2502,352,34,70124),
|
||||
(358,4,0,2306,265,39,70124),
|
||||
(362,0,0,2262,244,34,70124),
|
||||
(362,1,0,2632,899,112,70124),
|
||||
(362,2,0,2262,244,34,70124),
|
||||
(368,0,0,2259,347,36,70124),
|
||||
(368,1,0,3055,-384,-1,70124),
|
||||
(368,1,1,3082,-284,-2,70124),
|
||||
(368,1,2,3100,-13,4,70124),
|
||||
(368,1,3,3052,426,7,70124),
|
||||
(368,1,4,2985,426,21,70124),
|
||||
(368,1,5,2969,387,16,70124),
|
||||
(368,1,6,2917,218,8,70124),
|
||||
(368,1,7,2919,82,7,70124),
|
||||
(368,1,8,3012,-362,7,70124),
|
||||
(368,1,9,3028,-376,10,70124),
|
||||
(368,1,10,3042,-383,0,70124),
|
||||
(368,2,0,2783,1185,1,70124),
|
||||
(368,2,1,2917,1286,2,70124),
|
||||
(368,2,2,2947,1314,-5,70124),
|
||||
(368,2,3,2716,1948,-18,70124),
|
||||
(368,2,4,2364,1954,106,70124),
|
||||
(368,2,5,2287,1946,107,70124),
|
||||
(368,2,6,2500,1379,7,70124),
|
||||
(368,3,0,2259,347,36,70124),
|
||||
(370,0,0,2278,296,37,70124),
|
||||
(370,1,0,1795,721,49,70124),
|
||||
(370,2,0,1750,584,34,70124),
|
||||
(370,2,1,1848,610,48,70124),
|
||||
(370,2,2,1890,755,40,70124),
|
||||
(370,2,3,1841,828,25,70124),
|
||||
(370,2,4,1746,726,48,70124),
|
||||
(370,2,5,1744,684,46,70124),
|
||||
(370,3,0,2186,-657,90,70124),
|
||||
(370,3,1,2240,-653,79,70124),
|
||||
(370,3,2,2187,-431,76,70124),
|
||||
(370,3,3,2174,-409,72,70124),
|
||||
(370,3,4,2127,-454,75,70124),
|
||||
(370,3,5,2118,-595,79,70124),
|
||||
(370,3,6,2122,-623,94,70124),
|
||||
(370,4,0,2555,-953,74,70124),
|
||||
(370,4,1,2581,-914,69,70124),
|
||||
(370,4,2,2587,-898,61,70124),
|
||||
(370,4,3,2583,-852,63,70124),
|
||||
(370,4,4,2550,-821,65,70124),
|
||||
(370,4,5,2521,-850,58,70124),
|
||||
(370,4,6,2514,-936,66,70124),
|
||||
(370,5,0,1750,584,34,70124),
|
||||
(370,5,1,1784,617,40,70124),
|
||||
(370,5,2,1817,651,39,70124),
|
||||
(370,5,3,1890,755,40,70124),
|
||||
(370,5,4,1869,867,29,70124),
|
||||
(370,5,5,1838,857,25,70124),
|
||||
(370,5,6,1766,769,57,70124),
|
||||
(370,5,7,1746,726,48,70124),
|
||||
(370,6,0,2278,296,37,70124),
|
||||
(374,0,0,2271,280,37,70124),
|
||||
(374,1,0,2555,-953,74,70124),
|
||||
(374,1,1,2581,-914,69,70124),
|
||||
(374,1,2,2587,-898,61,70124),
|
||||
(374,1,3,2583,-852,63,70124),
|
||||
(374,1,4,2550,-821,65,70124),
|
||||
(374,1,5,2485,-882,61,70124),
|
||||
(374,1,6,2514,-936,66,70124),
|
||||
(374,2,0,3102,-582,124,70124),
|
||||
(374,2,1,3120,-574,129,70124),
|
||||
(374,2,2,3101,-548,127,70124),
|
||||
(374,2,3,3074,-538,127,70124),
|
||||
(374,2,4,2850,-475,100,70124),
|
||||
(374,2,5,2792,-474,102,70124),
|
||||
(374,2,6,2770,-486,107,70124),
|
||||
(374,2,7,2750,-522,106,70124),
|
||||
(374,2,8,2750,-531,105,70124),
|
||||
(374,2,9,3058,-576,127,70124),
|
||||
(374,3,0,1750,584,34,70124),
|
||||
(374,3,1,1848,610,48,70124),
|
||||
(374,3,2,1890,755,40,70124),
|
||||
(374,3,3,1869,867,29,70124),
|
||||
(374,3,4,1838,857,25,70124),
|
||||
(374,3,5,1766,769,57,70124),
|
||||
(374,3,6,1746,726,48,70124),
|
||||
(374,3,7,1744,684,46,70124),
|
||||
(374,4,0,2186,-657,90,70124),
|
||||
(374,4,1,2240,-653,79,70124),
|
||||
(374,4,2,2187,-431,76,70124),
|
||||
(374,4,3,2174,-409,72,70124),
|
||||
(374,4,4,2127,-454,75,70124),
|
||||
(374,4,5,2113,-625,94,70124),
|
||||
(374,4,6,2123,-632,94,70124),
|
||||
(374,5,0,2398,1349,35,70124),
|
||||
(374,5,1,2479,1522,33,70124),
|
||||
(374,5,2,2485,1583,37,70124),
|
||||
(374,5,3,2434,1637,35,70124),
|
||||
(374,5,4,2348,1691,41,70124),
|
||||
(374,5,5,2321,1671,41,70124),
|
||||
(374,5,6,2304,1652,43,70124),
|
||||
(374,5,7,2299,1583,39,70124),
|
||||
(374,5,8,2301,1517,36,70124),
|
||||
(374,6,0,2271,280,37,70124),
|
||||
(398,0,0,2278,296,37,70124),
|
||||
(398,1,0,2911,383,32,70124),
|
||||
(398,2,0,2286,289,35,70124),
|
||||
(426,0,0,2288,403,34,70124),
|
||||
(426,1,0,2850,717,132,70124),
|
||||
(426,1,1,2984,851,100,70124),
|
||||
(426,1,2,2982,982,115,70124),
|
||||
(426,1,3,2969,1074,85,70124),
|
||||
(426,1,4,2825,1117,85,70124),
|
||||
(426,1,5,2777,1106,85,70124),
|
||||
(426,1,6,2649,1045,104,70124),
|
||||
(426,1,7,2585,1014,97,70124),
|
||||
(426,1,8,2552,980,91,70124),
|
||||
(426,1,9,2515,916,82,70124),
|
||||
(426,1,10,2504,829,121,70124),
|
||||
(426,1,11,2516,740,121,70124),
|
||||
(426,2,0,5084,-1865,1349,70124),
|
||||
(426,2,1,5337,-1701,1412,70124),
|
||||
(426,2,2,5253,-1665,1370,70124),
|
||||
(426,2,3,5152,-1664,1343,70124),
|
||||
(426,2,4,5013,-1705,1325,70124),
|
||||
(426,2,5,4984,-1725,1342,70124),
|
||||
(426,2,6,4860,-1848,1303,70124),
|
||||
(426,2,7,4881,-1864,1309,70124),
|
||||
(426,3,0,5206,-3043,1572,70124),
|
||||
(426,3,1,5200,-2983,1567,70124),
|
||||
(426,3,2,5177,-2930,1567,70124),
|
||||
(426,3,3,5164,-2976,1574,70124),
|
||||
(426,4,0,5437,-3157,1579,70124),
|
||||
(426,4,1,5554,-3137,1566,70124),
|
||||
(426,4,2,5617,-3126,1576,70124),
|
||||
(426,4,3,5699,-3098,1571,70124),
|
||||
(426,4,4,5722,-3024,1562,70124),
|
||||
(426,4,5,5734,-2909,1576,70124),
|
||||
(426,4,6,5661,-2925,1553,70124),
|
||||
(426,4,7,5624,-2957,1541,70124),
|
||||
(426,5,0,2850,717,132,70124),
|
||||
(426,5,1,2997,809,90,70124),
|
||||
(426,5,2,2969,1074,85,70124),
|
||||
(426,5,3,2825,1117,85,70124),
|
||||
(426,5,4,2777,1106,85,70124),
|
||||
(426,5,5,2552,980,91,70124),
|
||||
(426,5,6,2516,740,121,70124),
|
||||
(426,6,0,2288,403,34,70124),
|
||||
(5482,0,0,2363,427,34,70124),
|
||||
(5482,1,0,2613,375,35,70124),
|
||||
(5482,1,1,2628,375,35,70124),
|
||||
(5482,1,2,2806,417,20,70124),
|
||||
(5482,1,3,2818,429,19,70124),
|
||||
(5482,1,4,2795,491,19,70124),
|
||||
(5482,1,5,2663,560,16,70124),
|
||||
(5482,1,6,2567,563,14,70124),
|
||||
(5482,1,7,2538,556,16,70124),
|
||||
(5482,1,8,2534,525,17,70124),
|
||||
(5482,1,9,2533,476,27,70124),
|
||||
(5482,1,10,2544,400,33,70124),
|
||||
(5482,2,0,2363,427,34,70124),
|
||||
(91285,0,0,2475,2046,137,70124),
|
||||
(91285,1,0,2206,2078,0,70124),
|
||||
(91285,1,1,2310,2083,0,70124),
|
||||
(91285,1,2,2383,2120,0,70124),
|
||||
(91285,1,3,2413,2199,0,70124),
|
||||
(91285,1,4,2340,2338,0,70124),
|
||||
(91285,1,5,2254,2434,0,70124),
|
||||
(91285,1,6,2150,2457,0,70124),
|
||||
(91285,1,7,2092,2416,0,70124),
|
||||
(91285,1,8,2057,2353,0,70124),
|
||||
(91285,1,9,2037,2267,0,70124),
|
||||
(91285,1,10,2034,2214,0,70124),
|
||||
(91285,1,11,2090,2123,0,70124),
|
||||
(91285,2,0,2420,1797,47,70124),
|
||||
(91285,2,1,2493,1817,46,70124),
|
||||
(91285,2,2,2571,1852,16,70124),
|
||||
(91285,2,3,2595,1911,31,70124),
|
||||
(91285,2,4,2412,1893,56,70124),
|
||||
(91285,2,5,2360,1869,62,70124),
|
||||
(91285,3,0,2370,2105,0,70124),
|
||||
(91285,3,1,2411,2166,0,70124),
|
||||
(91285,3,2,2411,2277,0,70124),
|
||||
(91285,3,3,2380,2323,0,70124),
|
||||
(91285,3,4,2276,2462,0,70124),
|
||||
(91285,3,5,2128,2452,0,70124),
|
||||
(91285,3,6,2072,2369,0,70124),
|
||||
(91285,3,7,2006,2272,0,70124),
|
||||
(91285,3,8,2039,2166,0,70124),
|
||||
(91285,3,9,2087,2136,0,70124),
|
||||
(91285,3,10,2161,2103,0,70124),
|
||||
(91285,3,11,2249,2083,0,70124),
|
||||
(91285,4,0,2464,1751,61,70124),
|
||||
(91285,4,1,2612,1864,49,70124),
|
||||
(91285,4,2,2622,1892,48,70124),
|
||||
(91285,4,3,2398,1917,69,70124),
|
||||
(91285,4,4,2354,1844,59,70124),
|
||||
(91285,5,0,2475,2046,137,70124),
|
||||
(95314,0,0,2265,348,36,70124),
|
||||
(95314,1,0,1834,2497,116,70124),
|
||||
(95314,1,1,2052,2592,108,70124),
|
||||
(95314,1,2,2059,2614,120,70124),
|
||||
(95314,1,3,2045,2648,108,70124),
|
||||
(95314,1,4,1864,2648,108,70124),
|
||||
(95314,1,5,1821,2641,108,70124),
|
||||
(95314,1,6,1726,2573,100,70124),
|
||||
(95314,2,0,2265,348,36,70124),
|
||||
(97558,0,0,2026,77,35,70124),
|
||||
(97558,1,0,2663,-679,0,70124),
|
||||
(97558,1,1,2967,-512,0,70124),
|
||||
(97558,1,2,3035,-294,0,70124),
|
||||
(97558,1,3,2967,199,0,70124),
|
||||
(97558,1,4,2844,336,0,70124),
|
||||
(97558,1,5,2367,339,0,70124),
|
||||
(97558,1,6,2153,686,0,70124),
|
||||
(97558,1,7,1785,632,0,70124),
|
||||
(97558,1,8,1897,56,0,70124),
|
||||
(97558,1,9,1536,-359,0,70124),
|
||||
(97558,1,10,1536,-747,0,70124),
|
||||
(97558,1,11,2459,-771,0,70124),
|
||||
(97558,2,0,1999,680,0,70124),
|
||||
(97558,2,1,2428,687,0,70124),
|
||||
(97558,2,2,2605,949,0,70124),
|
||||
(97558,2,3,2640,1082,0,70124),
|
||||
(97558,2,4,2619,1290,0,70124),
|
||||
(97558,2,5,2500,1436,0,70124),
|
||||
(97558,2,6,2384,1446,0,70124),
|
||||
(97558,2,7,2268,1399,0,70124),
|
||||
(97558,2,8,1876,1194,0,70124),
|
||||
(97558,2,9,1740,1092,0,70124),
|
||||
(97558,2,10,1764,867,0,70124),
|
||||
(97558,2,11,1870,717,0,70124),
|
||||
(97558,3,0,2044,-807,0,70124),
|
||||
(97558,3,1,2255,-759,0,70124),
|
||||
(97558,3,2,2462,-688,0,70124),
|
||||
(97558,3,3,2878,-476,0,70124),
|
||||
(97558,3,4,2973,-333,0,70124),
|
||||
(97558,3,5,2977,-160,0,70124),
|
||||
(97558,3,6,2960,47,0,70124),
|
||||
(97558,3,7,2844,276,0,70124),
|
||||
(97558,3,8,2125,647,0,70124),
|
||||
(97558,3,9,1829,684,0,70124),
|
||||
(97558,3,10,1846,-122,0,70124),
|
||||
(97558,3,11,1515,-664,0,70124),
|
||||
(97558,4,0,2783,1185,1,70124),
|
||||
(97558,4,1,2917,1286,2,70124),
|
||||
(97558,4,2,2947,1314,-5,70124),
|
||||
(97558,4,3,2716,1948,-18,70124),
|
||||
(97558,4,4,2546,1841,18,70124),
|
||||
(97558,4,5,2460,1715,27,70124),
|
||||
(97558,4,6,2484,1454,8,70124),
|
||||
(97558,4,7,2500,1379,7,70124),
|
||||
(97558,5,0,3055,-384,-1,70124),
|
||||
(97558,5,1,3082,-284,-2,70124),
|
||||
(97558,5,2,3100,-13,4,70124),
|
||||
(97558,5,3,3045,417,1,70124),
|
||||
(97558,5,4,2990,397,8,70124),
|
||||
(97558,5,5,2970,389,16,70124),
|
||||
(97558,5,6,2917,218,8,70124),
|
||||
(97558,5,7,2919,82,7,70124),
|
||||
(97558,5,8,3012,-362,7,70124),
|
||||
(97558,5,9,3028,-376,10,70124),
|
||||
(97558,5,10,3042,-383,0,70124),
|
||||
(97558,6,0,2026,77,35,70124),
|
||||
(97957,0,0,2267,332,35,70124),
|
||||
(97957,1,0,2166,445,67,70124);
|
||||
|
||||
-- gossip menus (texts are Blizzard broadcast texts from the client data)
|
||||
DELETE FROM `gossip_menu` WHERE `MenuID` IN (45038);
|
||||
INSERT INTO `gossip_menu` (`MenuID`,`TextID`,`VerifiedBuild`) VALUES
|
||||
(45038,10045038,70124);
|
||||
DELETE FROM `npc_text` WHERE `ID` IN (10045038);
|
||||
INSERT INTO `npc_text` (`ID`,`Probability0`,`Probability1`,`Probability2`,`Probability3`,`Probability4`,`Probability5`,`Probability6`,`Probability7`,`BroadcastTextID0`,`BroadcastTextID1`,`BroadcastTextID2`,`BroadcastTextID3`,`BroadcastTextID4`,`BroadcastTextID5`,`BroadcastTextID6`,`BroadcastTextID7`,`VerifiedBuild`) VALUES
|
||||
(10045038,1.0,0,0,0,0,0,0,0,326872,0,0,0,0,0,0,0,70124);
|
||||
DELETE FROM `gossip_menu_option` WHERE `MenuID` IN (45038);
|
||||
DELETE FROM `creature_template_gossip` WHERE `CreatureID` IN (276110);
|
||||
INSERT IGNORE INTO `creature_template_gossip` (`CreatureID`,`MenuID`,`VerifiedBuild`) VALUES
|
||||
(6491,83,70124),
|
||||
(276110,45038,70124);
|
||||
|
||||
-- creature texts heard in the sniffs (not yet triggered by scripts)
|
||||
DELETE FROM `creature_text` WHERE `CreatureID` IN (250282);
|
||||
INSERT INTO `creature_text` (`CreatureID`,`GroupID`,`ID`,`Text`,`Type`,`Language`,`Probability`,`Emote`,`Duration`,`Sound`,`SoundPlayType`,`BroadcastTextId`,`TextRange`,`comment`) VALUES
|
||||
(250282,0,0,'%s attempts to run away in fear!',16,0,100,0,0,0,0,0,0,'Vile Fin Seer (sniff)');
|
||||
|
||||
-- loot of the Forever creatures (chance = drops / kills seen in the sniffs)
|
||||
UPDATE `creature_template_difficulty` SET `GoldMin` = 12, `GoldMax` = 12 WHERE `DifficultyID` = 0 AND `Entry` = 250282;
|
||||
|
||||
-- Coldrasp (274300, rare, Tirisfal Glades): one spawn where the sniff saw him (Wowhead shows 3 spawn points around 19.4, 64.7),
|
||||
-- loot from Wowhead (Stringy Wolf Meat in 2 of 2 kills; nothing else known yet).
|
||||
UPDATE `creature_template_difficulty` SET `LootID` = 274300 WHERE `Entry` = 274300 AND `DifficultyID` = 0;
|
||||
DELETE FROM `creature_loot_template` WHERE `Entry` = 274300;
|
||||
INSERT INTO `creature_loot_template` (`Entry`,`ItemType`,`Item`,`Chance`,`QuestRequired`,`LootMode`,`GroupId`,`MinCount`,`MaxCount`,`Comment`) VALUES
|
||||
(274300,0,2672,100,0,1,0,1,1,'Coldrasp - Stringy Wolf Meat');
|
||||
DELETE FROM `creature` WHERE `guid` = 21300001;
|
||||
INSERT INTO `creature` (`guid`,`id`,`map`,`zoneId`,`areaId`,`spawnDifficulties`,`phaseUseFlags`,`PhaseId`,`PhaseGroup`,`terrainSwapMap`,`position_x`,`position_y`,`position_z`,`orientation`,`modelid`,`equipment_id`,`spawntimesecs`,`wander_distance`,`currentwaypoint`,`curHealthPct`,`MovementType`,`npcflag`,`unit_flags`,`unit_flags2`,`unit_flags3`,`ScriptName`,`VerifiedBuild`) VALUES
|
||||
(21300001,274300,0,85,0,'0',0,0,0,-1,1758.7793,2246.8633,151.0726,0,0,0,2700,10,0,100,1,NULL,NULL,NULL,NULL,'',70235);
|
||||
|
||||
@@ -28,6 +28,12 @@ namespace Battlenet
|
||||
struct LoginSessionState : public Trinity::Net::Http::SessionState
|
||||
{
|
||||
std::unique_ptr<Trinity::Crypto::SRP::BnetSRP6Base> Srp;
|
||||
|
||||
// password accepted, waiting for the authenticator code (client AUTHENTICATOR login state)
|
||||
uint32 AuthenticatorAccountId = 0;
|
||||
std::string AuthenticatorSecret;
|
||||
std::string AuthenticatorServerM2;
|
||||
uint32 AuthenticatorTries = 0;
|
||||
};
|
||||
|
||||
class LoginHttpSession final : public Trinity::Net::Http::AbstractSocket, public std::enable_shared_from_this<LoginHttpSession>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "LoginRESTService.h"
|
||||
#include "Base32.h"
|
||||
#include "Base64.h"
|
||||
#include "Common.h"
|
||||
#include "Configuration/Config.h"
|
||||
@@ -26,7 +27,9 @@
|
||||
#include "ProtobufJSON.h"
|
||||
#include "Resolver.h"
|
||||
#include "SslContext.h"
|
||||
#include "StringConvert.h"
|
||||
#include "Timer.h"
|
||||
#include "TOTP.h"
|
||||
#include "Util.h"
|
||||
|
||||
namespace Battlenet
|
||||
@@ -91,6 +94,11 @@ bool LoginRESTService::StartNetwork(Trinity::Asio::IoContext& ioContext, std::st
|
||||
return HandlePostLogin(std::move(session), context);
|
||||
}, RequestHandlerFlag::DoNotLogRequestContent);
|
||||
|
||||
RegisterHandler(boost::beast::http::verb::post, "/bnetserver/login/authenticator/"sv, [this](std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context)
|
||||
{
|
||||
return HandlePostLogin(std::move(session), context);
|
||||
}, RequestHandlerFlag::DoNotLogRequestContent);
|
||||
|
||||
RegisterHandler(boost::beast::http::verb::post, "/bnetserver/login/srp/"sv, [](std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context)
|
||||
{
|
||||
return HandlePostLoginSrpChallenge(std::move(session), context);
|
||||
@@ -259,6 +267,11 @@ LoginRESTService::RequestHandlerResult LoginRESTService::HandlePostLogin(std::sh
|
||||
return "";
|
||||
};
|
||||
|
||||
// second step of an authenticator login: the code typed into the client's authenticator prompt
|
||||
for (int32 i = 0; i < loginForm->inputs_size(); ++i)
|
||||
if (loginForm->inputs(i).input_id() == "authenticator_input")
|
||||
return HandleAuthenticatorCode(std::move(session), context, loginForm->inputs(i).value());
|
||||
|
||||
std::string login(getInputValue(loginForm.get(), "account_name"));
|
||||
Utf8ToUpperOnlyLatin(login);
|
||||
|
||||
@@ -373,6 +386,28 @@ LoginRESTService::RequestHandlerResult LoginRESTService::HandlePostLogin(std::sh
|
||||
return;
|
||||
}
|
||||
|
||||
// account with an authenticator: ask for the code first (the client shows its authenticator prompt for this state and posts
|
||||
// authenticator_input to next_url with the same JSESSIONID); the ticket is issued in HandleAuthenticatorCode
|
||||
if (!fields[8].IsNull() && !fields[8].GetStringView().empty())
|
||||
{
|
||||
LoginSessionState* state = session->GetSessionState();
|
||||
state->AuthenticatorAccountId = accountId;
|
||||
state->AuthenticatorSecret = fields[8].GetString();
|
||||
state->AuthenticatorServerM2 = serverM2.value_or("");
|
||||
state->AuthenticatorTries = 0;
|
||||
|
||||
JSON::Login::LoginResult loginResult;
|
||||
loginResult.set_authentication_state(JSON::Login::AUTHENTICATOR);
|
||||
loginResult.set_next_url(GetAuthenticatorUrl(*session));
|
||||
if (serverM2)
|
||||
loginResult.set_server_evidence_m2(*serverM2);
|
||||
|
||||
context.response.set(boost::beast::http::field::content_type, "application/json;charset=utf-8");
|
||||
context.response.body() = ::JSON::Serialize(loginResult);
|
||||
session->SendResponse(context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (loginTicket.empty() || loginTicketExpiry < time(nullptr))
|
||||
loginTicket = "TC-" + ByteArrayToHexStr(Trinity::Crypto::GetRandomBytes<20>());
|
||||
|
||||
@@ -397,6 +432,84 @@ LoginRESTService::RequestHandlerResult LoginRESTService::HandlePostLogin(std::sh
|
||||
return RequestHandlerResult::Async;
|
||||
}
|
||||
|
||||
std::string LoginRESTService::GetAuthenticatorUrl(LoginHttpSession const& session) const
|
||||
{
|
||||
return Trinity::StringFormat("http{}://{}:{}/bnetserver/login/authenticator/", !SslContext::UsesDevWildcardCertificate() ? "s" : "",
|
||||
GetHostnameForClient(session.GetRemoteIpAddress()), _port);
|
||||
}
|
||||
|
||||
LoginRESTService::RequestHandlerResult LoginRESTService::HandleAuthenticatorCode(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context,
|
||||
std::string const& code) const
|
||||
{
|
||||
constexpr uint32 MaxAuthenticatorTries = 5;
|
||||
|
||||
auto respond = [](LoginHttpSession& session, HttpRequestContext& context, JSON::Login::LoginResult const& loginResult)
|
||||
{
|
||||
context.response.set(boost::beast::http::field::content_type, "application/json;charset=utf-8");
|
||||
context.response.body() = ::JSON::Serialize(loginResult);
|
||||
session.SendResponse(context);
|
||||
};
|
||||
|
||||
LoginSessionState* state = session->GetSessionState();
|
||||
if (!state || !state->AuthenticatorAccountId)
|
||||
{
|
||||
// no password step before this (or it expired): fail the login
|
||||
JSON::Login::LoginResult loginResult;
|
||||
loginResult.set_authentication_state(JSON::Login::DONE);
|
||||
respond(*session, context, loginResult);
|
||||
return RequestHandlerResult::Handled;
|
||||
}
|
||||
|
||||
std::string digits;
|
||||
for (char c : code)
|
||||
if (c >= '0' && c <= '9')
|
||||
digits += c;
|
||||
|
||||
Optional<std::vector<uint8>> secret = Trinity::Encoding::Base32::Decode(state->AuthenticatorSecret);
|
||||
Optional<uint32> token = digits.length() == 6 ? Trinity::StringTo<uint32>(digits) : Optional<uint32>();
|
||||
if (!secret || !token || !Trinity::Crypto::TOTP::ValidateToken(*secret, *token))
|
||||
{
|
||||
JSON::Login::LoginResult loginResult;
|
||||
if (++state->AuthenticatorTries >= MaxAuthenticatorTries)
|
||||
{
|
||||
TC_LOG_DEBUG("server.http.login", "[{}, Id {}] Too many wrong authenticator codes", session->GetClientInfo(), state->AuthenticatorAccountId);
|
||||
state->AuthenticatorAccountId = 0;
|
||||
state->AuthenticatorSecret.clear();
|
||||
loginResult.set_authentication_state(JSON::Login::DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
loginResult.set_authentication_state(JSON::Login::AUTHENTICATOR);
|
||||
loginResult.set_next_url(GetAuthenticatorUrl(*session));
|
||||
}
|
||||
respond(*session, context, loginResult);
|
||||
return RequestHandlerResult::Handled;
|
||||
}
|
||||
|
||||
uint32 const accountId = state->AuthenticatorAccountId;
|
||||
std::string serverM2 = std::move(state->AuthenticatorServerM2);
|
||||
state->AuthenticatorAccountId = 0;
|
||||
state->AuthenticatorSecret.clear();
|
||||
|
||||
std::string loginTicket = "TC-" + ByteArrayToHexStr(Trinity::Crypto::GetRandomBytes<20>());
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_AUTHENTICATION);
|
||||
stmt->setString(0, loginTicket);
|
||||
stmt->setUInt32(1, time(nullptr) + _loginTicketDuration);
|
||||
stmt->setUInt32(2, accountId);
|
||||
session->QueueQuery(LoginDatabase.AsyncQuery(stmt)
|
||||
.WithPreparedCallback([session, context = std::move(context), loginTicket = std::move(loginTicket), serverM2 = std::move(serverM2), respond](PreparedQueryResult) mutable
|
||||
{
|
||||
JSON::Login::LoginResult loginResult;
|
||||
loginResult.set_authentication_state(JSON::Login::DONE);
|
||||
loginResult.set_login_ticket(loginTicket);
|
||||
if (!serverM2.empty())
|
||||
loginResult.set_server_evidence_m2(serverM2);
|
||||
respond(*session, context, loginResult);
|
||||
}));
|
||||
|
||||
return RequestHandlerResult::Async;
|
||||
}
|
||||
|
||||
LoginRESTService::RequestHandlerResult LoginRESTService::HandlePostLoginSrpChallenge(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context)
|
||||
{
|
||||
JSON::Login::LoginForm loginForm;
|
||||
|
||||
@@ -70,6 +70,8 @@ private:
|
||||
RequestHandlerResult HandleGetPortal(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context) const;
|
||||
|
||||
RequestHandlerResult HandlePostLogin(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context) const;
|
||||
RequestHandlerResult HandleAuthenticatorCode(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context, std::string const& code) const;
|
||||
std::string GetAuthenticatorUrl(LoginHttpSession const& session) const;
|
||||
static RequestHandlerResult HandlePostLoginSrpChallenge(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context);
|
||||
RequestHandlerResult HandlePostRefreshLoginTicket(std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context) const;
|
||||
|
||||
|
||||
@@ -40,8 +40,9 @@ void Battlenet::AccountInfo::LoadResult(PreparedQueryResult result)
|
||||
LoginTicketExpiry = fields[5].GetUInt32();
|
||||
IsBanned = fields[6].GetUInt64() != 0;
|
||||
IsPermanenetlyBanned = fields[7].GetUInt64() != 0;
|
||||
BattleTag = fields[8].IsNull() ? "" : fields[8].GetString();
|
||||
|
||||
static constexpr uint32 GameAccountFieldsOffset = 8;
|
||||
static constexpr uint32 GameAccountFieldsOffset = 9;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Battlenet
|
||||
uint32 LoginTicketExpiry;
|
||||
bool IsBanned;
|
||||
bool IsPermanenetlyBanned;
|
||||
std::string BattleTag; // "Name#1234", empty = none
|
||||
|
||||
std::unordered_map<uint32, GameAccountInfo> GameAccounts;
|
||||
};
|
||||
|
||||
@@ -90,6 +90,8 @@ uint32 Account::HandleGetAccountInfo(account::v2::client::GetAccountInfoRequest
|
||||
account::v2::AccountInfo* info = response->mutable_info();
|
||||
|
||||
info->set_account_id(_session->GetAccountId());
|
||||
if (AccountInfo const* accountInfo = _session->GetAccountInfo(); accountInfo && !accountInfo->BattleTag.empty())
|
||||
info->set_battle_tag(accountInfo->BattleTag);
|
||||
info->add_flags(account::v2::AccountInfo::FLAG_IS_HIDDEN_FROM_FRIEND_FINDER);
|
||||
// Classic 1.60 catalog shop builds its storefront requests from the account's region, country and currency
|
||||
info->set_country("USA");
|
||||
|
||||
@@ -281,6 +281,9 @@ uint32 Authentication::HandleVerifyWebCredentials(std::string_view webCredential
|
||||
if (!country.empty())
|
||||
logonResult.set_geoip_country(country.data(), country.size());
|
||||
|
||||
if (!accountInfo->BattleTag.empty())
|
||||
logonResult.set_battle_tag(accountInfo->BattleTag);
|
||||
|
||||
std::array<uint8, 64> k = Trinity::Crypto::GetRandomBytes<64>();
|
||||
logonResult.set_session_key(k.data(), 64);
|
||||
|
||||
@@ -391,6 +394,10 @@ uint32 Authentication::HandleVerifyAuthToken(std::string_view authToken, std::fu
|
||||
if (!country.empty())
|
||||
logonRecord->set_geoip_country(country.data(), country.size());
|
||||
|
||||
// the client shows it in the Social window and only offers Battle.net friends when it has one
|
||||
if (!accountInfo->BattleTag.empty())
|
||||
logonRecord->set_battle_tag(accountInfo->BattleTag);
|
||||
|
||||
std::array<uint8, 64> k = Trinity::Crypto::GetRandomBytes<64>();
|
||||
logonRecord->set_session_key(k.data(), 64);
|
||||
|
||||
|
||||
@@ -117,10 +117,10 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(LOGIN_SEL_ACCOUNT_TOTP_SECRET, "SELECT totp_secret FROM account WHERE id = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(LOGIN_UPD_ACCOUNT_TOTP_SECRET, "UPDATE account SET totp_secret = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
|
||||
#define BnetAccountInfo "ba.id AS bnet_account_id, UPPER(ba.email), ba.locked, ba.lock_country, ba.last_ip, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, bab.unbandate = bab.bandate AS is_bnet_permanently_banned"
|
||||
#define BnetAccountInfo "ba.id AS bnet_account_id, UPPER(ba.email), ba.locked, ba.lock_country, ba.last_ip, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, bab.unbandate = bab.bandate AS is_bnet_permanently_banned, ba.battle_tag"
|
||||
#define BnetGameAccountInfo "a.id AS account_id, a.username, ab.bandate, ab.unbandate AS account_unbandate, ab.unbandate = ab.bandate AS is_banned, aa.SecurityLevel"
|
||||
|
||||
PrepareStatement(LOGIN_SEL_BNET_AUTHENTICATION, "SELECT ba.id, ba.srp_version, COALESCE(ba.salt, 0x0000000000000000000000000000000000000000000000000000000000000000), ba.verifier, ba.failed_logins, ba.LoginTicket, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id WHERE email = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_SEL_BNET_AUTHENTICATION, "SELECT ba.id, ba.srp_version, COALESCE(ba.salt, 0x0000000000000000000000000000000000000000000000000000000000000000), ba.verifier, ba.failed_logins, ba.LoginTicket, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ba.authenticator_secret FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id WHERE email = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_BNET_AUTHENTICATION, "UPDATE battlenet_accounts SET LoginTicket = ?, LoginTicketExpiry = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_SEL_BNET_EXISTING_AUTHENTICATION, "SELECT LoginTicketExpiry FROM battlenet_accounts WHERE LoginTicket = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_SEL_BNET_EXISTING_AUTHENTICATION_BY_ID, "SELECT LoginTicket FROM battlenet_accounts WHERE id = ?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -751,6 +751,27 @@ void Channel::Say(ObjectGuid const& guid, std::string const& what, uint32 lang)
|
||||
!playerInfo.IsModerator() && player ? player->GetSession()->GetAccountGUID() : ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
void Channel::SayAs(std::string const& senderName, std::string const& what) const
|
||||
{
|
||||
if (what.empty())
|
||||
return;
|
||||
|
||||
auto builder = [&](LocaleConstant locale)
|
||||
{
|
||||
LocaleConstant localeIdx = sWorld->GetAvailableDbcLocale(locale);
|
||||
|
||||
Trinity::PacketSenderOwning<WorldPackets::Chat::Chat>* packet = new Trinity::PacketSenderOwning<WorldPackets::Chat::Chat>();
|
||||
packet->Data.ChannelGUID = _channelGuid;
|
||||
packet->Data.Initialize(CHAT_MSG_CHANNEL, LANG_UNIVERSAL, nullptr, nullptr, what, 0, GetName(localeIdx));
|
||||
packet->Data.SenderName = senderName;
|
||||
packet->Data.FakeSenderName = true; // a name without a character behind it
|
||||
packet->Data.Write();
|
||||
return packet;
|
||||
};
|
||||
|
||||
SendToAll(builder);
|
||||
}
|
||||
|
||||
void Channel::AddonSay(ObjectGuid const& guid, std::string const& prefix, std::string const& what, bool isLogged) const
|
||||
{
|
||||
if (what.empty())
|
||||
|
||||
@@ -181,6 +181,7 @@ class TC_GAME_API Channel
|
||||
bool CheckPassword(std::string const& password) const { return _channelPassword.empty() || (_channelPassword == password); }
|
||||
|
||||
uint32 GetNumPlayers() const { return uint32(_playersStore.size()); }
|
||||
bool HasMember(ObjectGuid const& guid) const { return IsOn(guid); }
|
||||
|
||||
uint8 GetFlags() const { return _channelFlags; }
|
||||
bool HasFlag(uint8 flag) const { return (_channelFlags & flag) != 0; }
|
||||
@@ -213,6 +214,7 @@ class TC_GAME_API Channel
|
||||
void List(Player const* player) const;
|
||||
void Announce(Player const* player);
|
||||
void Say(ObjectGuid const& guid, std::string const& what, uint32 lang) const;
|
||||
void SayAs(std::string const& senderName, std::string const& what) const; // not a player: the Discord bot (DiscordChannel)
|
||||
void AddonSay(ObjectGuid const& guid, std::string const& prefix, std::string const& what, bool isLogged) const;
|
||||
void DeclineInvite(Player const* player);
|
||||
void Invite(Player const* player, std::string const& newp);
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DiscordChannel.h"
|
||||
#include "Channel.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
// the channel as it must stay: no join/leave announcements, no owner (nobody can kick, ban or set a password)
|
||||
Channel* GetOrCreate(ChannelMgr* mgr)
|
||||
{
|
||||
Channel* channel = mgr->GetCustomChannel(DiscordChannel::GetName());
|
||||
if (!channel)
|
||||
channel = mgr->CreateCustomChannel(DiscordChannel::GetName());
|
||||
if (channel)
|
||||
{
|
||||
channel->SetAnnounce(false);
|
||||
channel->SetOwnership(false);
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
|
||||
// WoW chat escapes (|c colours, |H links, |T textures) would let Discord users fake item links or textures: no '|' at all
|
||||
std::string Clean(std::string text, size_t maxLength)
|
||||
{
|
||||
std::string out;
|
||||
for (char c : text)
|
||||
{
|
||||
if (c == '|' || c == '\r' || c == '\n' || c == '\t')
|
||||
c = c == '|' ? '/' : ' ';
|
||||
out += c;
|
||||
}
|
||||
if (utf8length(out) > maxLength)
|
||||
utf8truncate(out, maxLength);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
bool DiscordChannel::IsEnabled()
|
||||
{
|
||||
static bool const enabled = sConfigMgr->GetBoolDefault("Discord.Channel.Enable", false);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
std::string const& DiscordChannel::GetName()
|
||||
{
|
||||
static std::string const name = sConfigMgr->GetStringDefault("Discord.Channel.Name", "Discord");
|
||||
return name;
|
||||
}
|
||||
|
||||
bool DiscordChannel::IsDiscordChannel(std::string const& channelName)
|
||||
{
|
||||
return IsEnabled() && StringEqualI(channelName, GetName());
|
||||
}
|
||||
|
||||
void DiscordChannel::OnLogin(Player* player)
|
||||
{
|
||||
if (!IsEnabled())
|
||||
return;
|
||||
|
||||
if (CharacterDatabase.PQuery("SELECT 1 FROM character_discord_optout WHERE guid = {}", player->GetGUID().GetCounter()))
|
||||
return;
|
||||
|
||||
if (ChannelMgr* mgr = ChannelMgr::ForTeam(player->GetTeam()))
|
||||
if (Channel* channel = GetOrCreate(mgr))
|
||||
if (!channel->HasMember(player->GetGUID()))
|
||||
channel->JoinChannel(player);
|
||||
}
|
||||
|
||||
void DiscordChannel::OnJoined(Player* player)
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM character_discord_optout WHERE guid = {}", player->GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
void DiscordChannel::OnLeft(Player* player)
|
||||
{
|
||||
CharacterDatabase.PExecute("REPLACE INTO character_discord_optout (guid) VALUES ({})", player->GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
uint32 DiscordChannel::Relay(std::string const& sender, std::string const& text)
|
||||
{
|
||||
if (!IsEnabled())
|
||||
return 0;
|
||||
|
||||
std::string const cleanSender = Clean(sender, 24);
|
||||
std::string const cleanText = Clean(text, 255);
|
||||
if (cleanText.empty())
|
||||
return 0;
|
||||
|
||||
// one channel per faction, or one shared channel with cross-faction channels (ForTeam returns the same manager)
|
||||
uint32 count = 0;
|
||||
ChannelMgr* done = nullptr;
|
||||
for (Team team : { ALLIANCE, HORDE })
|
||||
{
|
||||
ChannelMgr* mgr = ChannelMgr::ForTeam(team);
|
||||
if (!mgr || mgr == done)
|
||||
continue;
|
||||
done = mgr;
|
||||
if (Channel* channel = GetOrCreate(mgr))
|
||||
{
|
||||
channel->SayAs(cleanSender, cleanText);
|
||||
count += channel->GetNumPlayers();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_DISCORD_CHANNEL_H
|
||||
#define TRINITY_DISCORD_CHANNEL_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <string>
|
||||
|
||||
class Player;
|
||||
|
||||
// The in-game "Discord" chat channel of the Discord bot (contrib/discord_bot): every player joins it at login unless they left
|
||||
// it with /leave (remembered in characters.character_discord_optout until they /join it again). The bot posts Discord messages
|
||||
// into it with the console command ".discord say"; what players type in it reaches the bot through chat.log.channel.<name>.
|
||||
// worldserver.conf: Discord.Channel.Enable, Discord.Channel.Name.
|
||||
namespace DiscordChannel
|
||||
{
|
||||
TC_GAME_API bool IsEnabled();
|
||||
TC_GAME_API std::string const& GetName();
|
||||
TC_GAME_API bool IsDiscordChannel(std::string const& channelName);
|
||||
|
||||
TC_GAME_API void OnLogin(Player* player);
|
||||
TC_GAME_API void OnJoined(Player* player); // /join: auto-join again from now on
|
||||
TC_GAME_API void OnLeft(Player* player); // /leave: no auto-join any more
|
||||
|
||||
// Posts "[<channel>] [<sender>]: <text>" to everyone in the channel (both factions); returns how many players got it.
|
||||
TC_GAME_API uint32 Relay(std::string const& sender, std::string const& text);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "DuelPackets.h"
|
||||
#include "EquipmentSetPackets.h"
|
||||
#include "Formulas.h"
|
||||
#include "FriendsService.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameEventSender.h"
|
||||
#include "GameObjectAI.h"
|
||||
@@ -115,6 +116,7 @@
|
||||
#include "QuestObjectiveCriteriaMgr.h"
|
||||
#include "QuestPackets.h"
|
||||
#include "RealmList.h"
|
||||
#include "RecentAllies.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "RestMgr.h"
|
||||
#include "Scenario.h"
|
||||
@@ -2311,6 +2313,8 @@ void Player::GiveLevel(uint8 level)
|
||||
UpdateClassicLegacyUnlock();
|
||||
|
||||
sScriptMgr->OnPlayerLevelChanged(this, oldLevel);
|
||||
|
||||
BattlenetPresence::OnCharacterChanged(this);
|
||||
}
|
||||
|
||||
// Classic 1.60 (WoW Forever): the first character bank tab is free (BankTab.db2: BankType 0, OrderIndex 0, Cost 0) and every character
|
||||
@@ -7781,6 +7785,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
{
|
||||
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, oldZone);
|
||||
sBattlefieldMgr->HandlePlayerLeaveZone(this, oldZone);
|
||||
BattlenetPresence::OnCharacterChanged(this); // Battle.net friends see the new zone
|
||||
}
|
||||
|
||||
// group update
|
||||
@@ -22872,6 +22877,8 @@ void Player::Whisper(std::string_view text, Language language, Player* target, b
|
||||
packet.Initialize(CHAT_MSG_WHISPER_INFORM, language, target, target, _text);
|
||||
SendDirectMessage(packet.Write());
|
||||
|
||||
RecentAllies::OnWhisper(this, target);
|
||||
|
||||
if (!isAcceptWhispers() && !IsGameMaster() && !target->IsGameMaster())
|
||||
{
|
||||
SetAcceptWhispers(true);
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "Player.h"
|
||||
#include "PlayerAI.h"
|
||||
#include "QuestDef.h"
|
||||
#include "RecentAllies.h"
|
||||
#include "Spell.h"
|
||||
#include "ScheduledChangeAI.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
@@ -11447,6 +11448,10 @@ void Unit::SetMeleeAnimKitId(uint16 animKitId)
|
||||
isRewardAllowed = false;
|
||||
}
|
||||
|
||||
// Classic 1.60 Social window, Allies tab: players who fought this creature together
|
||||
if (creature)
|
||||
RecentAllies::OnCreatureKill(creature);
|
||||
|
||||
// Exploit fix
|
||||
if (creature && creature->IsPet() && creature->GetOwnerGUID().IsPlayer())
|
||||
isRewardAllowed = false;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "RecentAllies.h"
|
||||
#include "PartyPackets.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
@@ -493,6 +494,7 @@ bool Group::AddMember(Player* player)
|
||||
|
||||
SendUpdate();
|
||||
sScriptMgr->OnGroupAddMember(this, player->GetGUID());
|
||||
RecentAllies::OnGroupJoin(this, player); // Classic Social window, Allies tab
|
||||
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
|
||||
if (Pet* pet = player->GetPet())
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_GROUP_FINDER_LISTINGS_H
|
||||
#define TRINITY_GROUP_FINDER_LISTINGS_H
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
class Group;
|
||||
class Player;
|
||||
|
||||
// The Classic Group Finder listings (GuildHandler.cpp) write every change to the "groupfinder" log, one JSON line each, for the
|
||||
// Discord bot's LFG channels (contrib/discord_bot). These keep a posted group current when its members change.
|
||||
namespace GroupFinderListings
|
||||
{
|
||||
TC_GAME_API void OnGroupChanged(Group const* group);
|
||||
TC_GAME_API void OnLogout(Player const* player);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -155,7 +155,21 @@ void WorldSession::SendFeatureSystemStatusGlueScreen()
|
||||
{ "shop2HostUrlAuth"sv, "https://trinity.actual.battle.net:8443"sv },
|
||||
{ "shop2UseConnectedRealmGameServiceRegionId"sv, "0"sv }, // realm region is the fake 70 of the Classic super realm; use the account region (1)
|
||||
{ "bpayStoreEnable"sv, "1"sv },
|
||||
{ "recentAlliesEnabledClient"sv, "0"sv },
|
||||
// Classic 1.60: the Social window (O) layout, as the official server sends it (mirror vars of the 70124 sniff): side tabs with
|
||||
// Recent Allies and the raid list; without these the client shows the old window with Raid as a bottom tab.
|
||||
// socialUIEnabledClient was 0 in 70124 and is 1 from the 70235 sniff on.
|
||||
{ "recentAlliesEnabledClient"sv, "1"sv },
|
||||
{ "recentAlliesRequestDataThrottle"sv, "180"sv },
|
||||
{ "socialUIEnabledClient"sv, "1"sv },
|
||||
{ "battleNetTitleFriendsEnabledClient"sv, "1"sv },
|
||||
{ "battleNetTitleFriendTagsEnabledClient"sv, "1"sv },
|
||||
{ "battleNetTitleFriendCustomNamesEnabledClient"sv, "1"sv },
|
||||
{ "socialUIFriendsListEnabledClient"sv, "1"sv },
|
||||
{ "socialUIRaidListEnabledClient"sv, "1"sv },
|
||||
{ "socialUISocialQueueEnabledClient"sv, "1"sv },
|
||||
// official sends 0 (its players have Battle.net friends); with 0 the Add Friend button only offers BattleTag friends, which need the
|
||||
// Battle.net friends service bnetserver does not have ("Battle.net services are not available"). 1 = add characters by name.
|
||||
{ "legacyFriendSystemEnabledClient"sv, "1"sv },
|
||||
{ "browserEnabled"sv, "1"sv }, // Classic 1.60: support and shop windows use the in-game browser
|
||||
{ "housingEnableCreateGuildNeighborhood"sv, "0"sv },
|
||||
{ "housingEnableDeleteHouse"sv, "0"sv },
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h" // for normalizePlayerName
|
||||
#include "Player.h"
|
||||
#include "DiscordChannel.h"
|
||||
#include <cctype>
|
||||
|
||||
static size_t const MAX_CHANNEL_NAME_STR = 31;
|
||||
@@ -83,6 +84,15 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
|
||||
if (!DisallowHyperlinksAndMaybeKick(packet.ChannelName))
|
||||
return;
|
||||
|
||||
// the Discord channel: /join switches the auto-join at login back on; the client rejoining it by itself is not an error
|
||||
if (DiscordChannel::IsDiscordChannel(packet.ChannelName))
|
||||
{
|
||||
DiscordChannel::OnJoined(GetPlayer());
|
||||
if (Channel* channel = cMgr->GetCustomChannel(packet.ChannelName))
|
||||
if (channel->HasMember(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
}
|
||||
|
||||
if (Channel* channel = cMgr->GetCustomChannel(packet.ChannelName))
|
||||
channel->JoinChannel(GetPlayer(), packet.Password);
|
||||
else if (Channel* channel = cMgr->CreateCustomChannel(packet.ChannelName))
|
||||
@@ -115,7 +125,11 @@ void WorldSession::HandleLeaveChannel(WorldPackets::Channel::LeaveChannel& packe
|
||||
if (ChannelMgr* cMgr = ChannelMgr::ForTeam(GetPlayer()->GetTeam()))
|
||||
{
|
||||
if (Channel* channel = cMgr->GetChannel(packet.ZoneChannelID, packet.ChannelName, GetPlayer(), true, zone))
|
||||
{
|
||||
channel->LeaveChannel(GetPlayer(), true);
|
||||
if (!packet.ZoneChannelID && DiscordChannel::IsDiscordChannel(packet.ChannelName))
|
||||
DiscordChannel::OnLeft(GetPlayer()); // no auto-join at login until the player /joins it again
|
||||
}
|
||||
|
||||
if (packet.ZoneChannelID)
|
||||
cMgr->LeftChannel(packet.ZoneChannelID, zone);
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "Config.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DiscordChannel.h"
|
||||
#include "FriendsService.h"
|
||||
#include "EquipmentSetPackets.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
@@ -504,8 +506,58 @@ void WorldSession::HandleCharEnum(CharacterDatabaseQueryHolder const& holder)
|
||||
});
|
||||
}
|
||||
|
||||
// Classic 1.60: the official server sends every character as a regionwide entry (Realmless set, no realm entries; sniff 70235,
|
||||
// 2026-10-06). Only that entry has money; the character select tooltip shows it with the two primary professions.
|
||||
std::vector<WorldPackets::Character::EnumCharactersResult::CharacterInfo> realmCharacters;
|
||||
if (!charEnum.IsDeletedCharacters && !charEnum.Characters.empty())
|
||||
{
|
||||
std::string guids;
|
||||
for (WorldPackets::Character::EnumCharactersResult::CharacterInfo const& character : charEnum.Characters)
|
||||
guids += (guids.empty() ? "" : ",") + std::to_string(character.Basic.Guid.GetCounter());
|
||||
|
||||
std::unordered_map<ObjectGuid::LowType, uint64> money;
|
||||
if (QueryResult result = CharacterDatabase.PQuery("SELECT guid, money FROM characters WHERE guid IN ({})", guids))
|
||||
{
|
||||
do
|
||||
money[(*result)[0].GetUInt64()] = (*result)[1].GetUInt64();
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
std::unordered_map<ObjectGuid::LowType, std::vector<uint32>> professions;
|
||||
if (QueryResult result = CharacterDatabase.PQuery("SELECT guid, skill FROM character_skills WHERE guid IN ({})", guids))
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32 const skill = (*result)[1].GetUInt16();
|
||||
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
|
||||
if (skillLine && skillLine->CategoryID == SKILL_CATEGORY_PROFESSION && !skillLine->ParentSkillLineID)
|
||||
professions[(*result)[0].GetUInt64()].push_back(skill);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
for (WorldPackets::Character::EnumCharactersResult::CharacterInfo const& character : charEnum.Characters)
|
||||
{
|
||||
WorldPackets::Character::EnumCharactersResult::RegionwideCharacterListEntry& entry = charEnum.RegionwideCharacters.emplace_back(character.Basic);
|
||||
ObjectGuid::LowType const guid = character.Basic.Guid.GetCounter();
|
||||
entry.Basic.RealmInfoFound = true;
|
||||
if (std::vector<uint32> const* list = Trinity::Containers::MapGetValuePtr(professions, guid))
|
||||
for (std::size_t i = 0; i < list->size() && i < 2; ++i)
|
||||
entry.Basic.ProfessionIds[i] = (*list)[i];
|
||||
if (uint64 const* gold = Trinity::Containers::MapGetValuePtr(money, guid))
|
||||
entry.Money = *gold;
|
||||
entry.PvpRatingBracket = -1;
|
||||
}
|
||||
|
||||
charEnum.Realmless = true;
|
||||
realmCharacters = std::move(charEnum.Characters);
|
||||
charEnum.Characters.clear();
|
||||
}
|
||||
|
||||
SendPacket(charEnum.Write());
|
||||
|
||||
if (!realmCharacters.empty())
|
||||
charEnum.Characters = std::move(realmCharacters);
|
||||
|
||||
// Classic 1.60: per character restrictions, right after the enum result as on the official server (sniff 70205: Classic
|
||||
// opcode 0x460019; per character: 2 bits (own byte), packed guid, uint32 0, uint32 10).
|
||||
if (!charEnum.IsDeletedCharacters && !charEnum.Characters.empty())
|
||||
@@ -527,10 +579,11 @@ void WorldSession::HandleCharEnum(CharacterDatabaseQueryHolder const& holder)
|
||||
// Classic 1.60.1.70009: character select keeps the enum result pending (never shows the characters) until it receives
|
||||
// Classic opcode 0x460362 (retail numbering: SMSG_RECENT_ALLY_DATA_RESPONSE), whose handler (rva 0x24F1E50) releases it.
|
||||
// Layout: uint32, uint8 (handler only uses the list when this is 7), uint32 count, entries - send it empty.
|
||||
// Official sniffs (70235, 2026-10-06) send 0x08ECBD10, 7, 0; with 0, 0, 0 the Social window kept its old layout (no Allies tabs).
|
||||
{
|
||||
WorldPacket release(SMSG_RECENT_ALLY_DATA_RESPONSE, 9);
|
||||
release << uint32(0);
|
||||
release << uint8(0);
|
||||
release << uint32(0x08ECBD10);
|
||||
release << uint8(7);
|
||||
release << uint32(0);
|
||||
SendPacket(&release, true);
|
||||
}
|
||||
@@ -1655,6 +1708,26 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
|
||||
|
||||
sScriptMgr->OnPlayerLogin(pCurrChar, firstLogin);
|
||||
|
||||
// the Discord bot's chat channel (DiscordChannel.h): joined unless the player left it
|
||||
DiscordChannel::OnLogin(pCurrChar);
|
||||
|
||||
// Battle.net presence: the client takes the account's BattleTag from it (Social window, Battle.net friends); online friends are told
|
||||
BattlenetPresence::OnLogin(this);
|
||||
|
||||
// Battle.net account with an authenticator (support site account page): "account secured", +4 backpack slots and no
|
||||
// "attach an Authenticator" prompts. Removing it takes the slots away again (items in them are mailed).
|
||||
{
|
||||
bool secured = false;
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT COUNT(*) FROM battlenet_accounts WHERE id = {} AND authenticator_secret IS NOT NULL "
|
||||
"AND authenticator_secret <> ''", GetBattlenetAccountId()))
|
||||
secured = (*result)[0].GetUInt64() != 0;
|
||||
|
||||
if (secured)
|
||||
pCurrChar->SetAccountSecured(true);
|
||||
else if (pCurrChar->GetInventorySlotCount() == INVENTORY_DEFAULT_SIZE + INVENTORY_ACCOUNT_SECURED_BONUS_SIZE)
|
||||
pCurrChar->SetAccountSecured(false);
|
||||
}
|
||||
|
||||
TC_METRIC_EVENT("player_events", "Login", pCurrChar->GetName());
|
||||
}
|
||||
|
||||
@@ -1734,6 +1807,76 @@ void WorldSession::SendFeatureSystemStatus()
|
||||
features.GroupChatThrottle.UsedTriesPerMessage = 1;
|
||||
features.GroupChatThrottle.TriesRestoredPerSecond = 20;
|
||||
|
||||
// Classic 1.60: every flag as the official server sends it (sniffs 70205 and 70235 are identical). Field names follow the
|
||||
// retail order, which is not the Classic meaning of each bit. Classic.OfficialFeatureFlags = 0 goes back to the values above.
|
||||
if (sConfigMgr->GetBoolDefault("Classic.OfficialFeatureFlags", true))
|
||||
{
|
||||
features.VoiceEnabled = true;
|
||||
features.BpayStoreAvailable = true;
|
||||
features.ItemRestorationButtonEnabled = false;
|
||||
features.SessionAlert.reset();
|
||||
features.RAFSystem.Enabled = false;
|
||||
features.RAFSystem.RecruitingEnabled = false;
|
||||
features.CharUndeleteEnabled = true;
|
||||
features.RestrictedAccount = false;
|
||||
features.CommerceServerEnabled = false;
|
||||
features.TutorialEnabled = true;
|
||||
features.VeteranTokenRedeemWillKick = true;
|
||||
features.WorldTokenRedeemWillKick = false;
|
||||
features.KioskModeEnabled = false;
|
||||
features.CompetitiveModeEnabled = true;
|
||||
features.RedeemForBalanceAvailable = true;
|
||||
features.WarModeEnabled = true;
|
||||
features.CommunitiesEnabled = true;
|
||||
features.BnetGroupsEnabled = true;
|
||||
features.CharacterCommunitiesEnabled = false;
|
||||
features.ClubPresenceAllowSubscribeAll = false;
|
||||
features.VoiceChatParentalDisabled = true;
|
||||
features.VoiceChatParentalMuted = false;
|
||||
features.QuestSessionEnabled = false;
|
||||
features.ClubFinderEnabled = true;
|
||||
features.CommunityFinderEnabled = true;
|
||||
features.BrowserCrashReporterEnabled = false;
|
||||
features.SpeakForMeAllowed = false;
|
||||
// official sends this bit on; in Classic it is the group finder "attach an Authenticator and SMS Protect" requirement
|
||||
// (official accounts there were secured). Off until accounts can have an authenticator here.
|
||||
features.DoesAccountNeedAADCPrompt = false;
|
||||
features.IsAccountOptedInToAADC = false;
|
||||
features.LfgRequireAuthenticatorEnabled = false;
|
||||
features.ScriptsDisallowedForBeta = false;
|
||||
features.TimerunningEnabled = true;
|
||||
features.PlayerIdentityOptionsEnabled = false;
|
||||
features.IsPlayerContentTrackingEnabled = false;
|
||||
features.LfdEnabled = true;
|
||||
features.LfrEnabled = false;
|
||||
features.PetHappinessEnabled = false;
|
||||
features.GuildEventsEditsEnabled = false;
|
||||
features.GuildTradeSkillsEnabled = false;
|
||||
features.ClassicFlagBits10 = 2;
|
||||
features.IsAccountCurrencyTransferEnabled = false;
|
||||
features.NetEaseChatTelemetryEnabled = false;
|
||||
features.LobbyMatchmakerQueueFromMainlineEnabled = true;
|
||||
features.CanSendLobbyMatchmakerPartyCustomizations = false;
|
||||
features.AddonProfilingEnabled = false;
|
||||
features.GlobalUserGeneratedContentMuteEnabled = false;
|
||||
features.AccountUserGeneratedContentIsRisky = false;
|
||||
features.FriendsDisabled = false;
|
||||
|
||||
features.EuropaTicketSystemStatus->TicketsEnabled = false;
|
||||
features.EuropaTicketSystemStatus->BugsEnabled = true;
|
||||
features.EuropaTicketSystemStatus->ComplaintsEnabled = true;
|
||||
features.EuropaTicketSystemStatus->SuggestionsEnabled = true;
|
||||
features.EuropaTicketSystemStatus->ThrottleState = { .MaxTries = 10, .PerMilliseconds = 60000, .TryCount = 0, .LastResetTimeBeforeNow = 130929 };
|
||||
features.EuropaTicketSystemStatus->ExpensiveThrottleState = { .MaxTries = 1, .PerMilliseconds = 60000, .TryCount = 0, .LastResetTimeBeforeNow = 130929 };
|
||||
|
||||
features.QuickJoinConfig = { false, 7.0f, 10.0f, 1.0f, 1.0f, 5.0f, 1.0f, 0.0f, 60.0f, 20.0f, 0.0f, 50.0f, 1.0f, 10.0f, 50.0f, 100.0f,
|
||||
50.0f, 1.0f, 1.0f, 100.0f, 1.0f, 850.0f, 80.0f };
|
||||
features.RemainingTimerunningSeasonSeconds = 32767;
|
||||
features.MaxPlayerGuidLookupsPerRequest = 32;
|
||||
features.NameLookupTelemetryInterval = 32;
|
||||
features.DisabledGameModes = { { .GameMode = 3, .ContentSetID = 13, .GameModeRecordID = 0 }, { .GameMode = 2, .ContentSetID = 5, .GameModeRecordID = 0 } };
|
||||
}
|
||||
|
||||
SendPacket(features.Write());
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Group.h"
|
||||
#include "GroupFinderListings.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "LFG.h"
|
||||
#include "Log.h"
|
||||
@@ -329,6 +330,7 @@ void WorldSession::HandleSetRoleOpcode(WorldPackets::Party::SetRole& packet)
|
||||
roleChangedInform.PartyIndex = group->GetGroupCategory();
|
||||
group->BroadcastPacket(roleChangedInform.Write(), false);
|
||||
group->SetLfgRoles(packet.TargetGUID, packet.Role);
|
||||
GroupFinderListings::OnGroupChanged(group); // the group's Group Finder post in Discord shows the new role
|
||||
}
|
||||
else
|
||||
SendPacket(roleChangedInform.Write());
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "Config.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Group.h"
|
||||
#include "GroupFinderListings.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "GuildPackets.h"
|
||||
@@ -1000,6 +1002,8 @@ namespace
|
||||
std::vector<uint32> Activities;
|
||||
std::vector<uint8> Request;
|
||||
time_t Created = 0;
|
||||
std::string Name, Comment; // as the leader typed them (for the Discord bot's LFG channel)
|
||||
uint8 PlayStyle = 0; // the play style dropdown: 1 Learning, 2 Relaxed, 3 Competitive, 4 Carry Offered
|
||||
};
|
||||
|
||||
std::unordered_map<ObjectGuid, LfgListing> LfgListings;
|
||||
@@ -1031,12 +1035,14 @@ namespace
|
||||
listing.Activities.clear();
|
||||
for (uint32 i = 0; i < activityCount; ++i)
|
||||
listing.Activities.push_back(data.read<uint32>());
|
||||
data.read_skip(nameLength + commentLength + voiceChatLength);
|
||||
listing.Name = data.ReadString(nameLength, false);
|
||||
listing.Comment = data.ReadString(commentLength, false);
|
||||
data.read_skip(voiceChatLength);
|
||||
for (uint8 i = 4; i < 7; ++i)
|
||||
if (bits[i])
|
||||
data.read_skip<int32>();
|
||||
if (bits[7])
|
||||
data.read_skip<uint8>();
|
||||
listing.PlayStyle = data.read<uint8>(); // play style (retail LFGEntryGeneralPlaystyle)
|
||||
|
||||
listing.Request.assign(data.data() + start, data.data() + data.rpos());
|
||||
return data.rpos() == data.size();
|
||||
@@ -1086,7 +1092,15 @@ namespace
|
||||
data << uint32(0); // battle.net friends
|
||||
data << uint32(0); // character friends
|
||||
data << uint32(0); // guild mates
|
||||
data << uint32(1); // members: the leader
|
||||
// the leader's group as it is now (only the leader when not in a group)
|
||||
std::vector<ObjectGuid> members;
|
||||
Player const* leaderPlayer = ObjectAccessor::FindConnectedPlayer(leader);
|
||||
if (Group const* group = leaderPlayer ? leaderPlayer->GetGroup() : nullptr)
|
||||
for (Group::MemberSlot const& slot : group->GetMemberSlots())
|
||||
members.push_back(slot.guid);
|
||||
else
|
||||
members.push_back(leader);
|
||||
data << uint32(members.size());
|
||||
data << uint32(0); // completed encounters
|
||||
data << uint64(listing.Created);
|
||||
data << uint8(0); // application status
|
||||
@@ -1102,33 +1116,139 @@ namespace
|
||||
data << uint8(0);
|
||||
data << uint8(0);
|
||||
|
||||
// member (Classic reader rva 0xA4EA40): guid, int8 x3 (healer, damage, tank - tested in game), int32 area, uint8 level,
|
||||
// {guid, float, uint32 x3, int32, uint64 x2, int32, uint8}, bit leader
|
||||
Player const* player = ObjectAccessor::FindConnectedPlayer(leader);
|
||||
auto roles = LfgListRoles.find(leader);
|
||||
uint8 const roleMask = roles != LfgListRoles.end() ? roles->second : 0;
|
||||
data << leader;
|
||||
data << int8((roleMask & lfg::PLAYER_ROLE_HEALER) != 0);
|
||||
data << int8((roleMask & lfg::PLAYER_ROLE_DAMAGE) != 0);
|
||||
data << int8((roleMask & lfg::PLAYER_ROLE_TANK) != 0);
|
||||
data << int32(player ? player->GetZoneId() : 0);
|
||||
data << uint8(player ? player->GetLevel() : 0);
|
||||
data << ObjectGuid::Empty;
|
||||
data << float(0.0f);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << int32(0);
|
||||
data << uint64(0);
|
||||
data << uint64(0);
|
||||
data << int32(0);
|
||||
data << uint8(0);
|
||||
data.WriteBit(true); // leader
|
||||
data.FlushBits();
|
||||
// members (Classic reader rva 0xA4EA40): guid, int8 level, int8 class, int8 role, int32 area, uint8, {guid, float, uint32 x3,
|
||||
// int32, uint64 x2, int32, uint8}, bit leader. The role is the one of the character's talent specialization (0 tank,
|
||||
// 1 healer, 2 damage), not the roles ticked in the window: official search results of 2026-10-06 (70235) show the same
|
||||
// role for a member whatever they ticked, and tank/healer only for classes and specs that can do it.
|
||||
for (ObjectGuid const& guid : members)
|
||||
{
|
||||
Player const* member = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
CharacterCacheEntry const* info = sCharacterCache->GetCharacterCacheByGuid(guid);
|
||||
ChrSpecializationEntry const* spec = member ? member->GetPrimarySpecializationEntry() : nullptr;
|
||||
data << guid;
|
||||
data << int8(member ? member->GetLevel() : info ? info->Level : 0);
|
||||
data << int8(member ? member->GetClass() : info ? info->Class : 0);
|
||||
data << int8(spec ? spec->Role : 2);
|
||||
data << int32(member ? member->GetZoneId() : 0);
|
||||
data << uint8(member ? member->GetLevel() : 0);
|
||||
data << ObjectGuid::Empty;
|
||||
data << float(0.0f);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << int32(0);
|
||||
data << uint64(0);
|
||||
data << uint64(0);
|
||||
data << int32(0);
|
||||
data << uint8(0);
|
||||
data.WriteBit(guid == leader);
|
||||
data.FlushBits();
|
||||
}
|
||||
|
||||
data.WriteBit(false); // (entry reader ends with one bit)
|
||||
data.FlushBits();
|
||||
}
|
||||
|
||||
std::string JsonString(std::string_view text)
|
||||
{
|
||||
std::string out = "\"";
|
||||
for (char c : text)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '"': out += "\\\""; break;
|
||||
case '\\': out += "\\\\"; break;
|
||||
case '\n': out += "\\n"; break;
|
||||
case '\r': case '\t': out += ' '; break;
|
||||
default:
|
||||
if (uint8(c) < 0x20)
|
||||
out += ' ';
|
||||
else
|
||||
out += c;
|
||||
}
|
||||
}
|
||||
return out + "\"";
|
||||
}
|
||||
|
||||
// One line of the "groupfinder" log per change of a listing, read by the Discord bot (contrib/discord_bot, its LFG channel):
|
||||
// {"event": "listed" | "updated" | "delisted", "id", "faction", "activities", "title", "comment", "members": [...]}
|
||||
void LogLfgListing(char const* event, ObjectGuid const& leader, LfgListing const& listing)
|
||||
{
|
||||
if (!sLog->ShouldLog("groupfinder", LOG_LEVEL_INFO))
|
||||
return;
|
||||
|
||||
std::string json = Trinity::StringFormat(R"({{"event":"{}","id":{},"time":{})", event, listing.Id, uint64(listing.Created));
|
||||
if (strcmp(event, "delisted") != 0)
|
||||
{
|
||||
Player const* leaderPlayer = ObjectAccessor::FindConnectedPlayer(leader);
|
||||
json += Trinity::StringFormat(R"(,"faction":"{}","activities":[)", leaderPlayer && leaderPlayer->GetTeam() == ALLIANCE ? "A" : "H");
|
||||
for (size_t i = 0; i < listing.Activities.size(); ++i)
|
||||
json += (i ? "," : "") + std::to_string(listing.Activities[i]);
|
||||
json += "],\"title\":" + JsonString(listing.Name) + ",\"comment\":" + JsonString(listing.Comment)
|
||||
+ ",\"playstyle\":" + std::to_string(listing.PlayStyle) + ",\"members\":[";
|
||||
|
||||
// the leader's group as it is now (only the leader when not in a group)
|
||||
std::vector<ObjectGuid> members;
|
||||
Group const* group = leaderPlayer ? leaderPlayer->GetGroup() : nullptr;
|
||||
if (group)
|
||||
for (Group::MemberSlot const& slot : group->GetMemberSlots())
|
||||
members.push_back(slot.guid);
|
||||
else
|
||||
members.push_back(leader);
|
||||
bool first = true;
|
||||
for (ObjectGuid const& guid : members)
|
||||
{
|
||||
CharacterCacheEntry const* info = sCharacterCache->GetCharacterCacheByGuid(guid);
|
||||
if (!info)
|
||||
continue;
|
||||
// the party role (set in the group, CMSG_SET_ROLE) wins over the role ticked in the Group Finder window
|
||||
auto roles = LfgListRoles.find(guid);
|
||||
uint8 const partyRole = group ? group->GetLfgRoles(guid) : 0;
|
||||
uint8 const mask = (partyRole & (lfg::PLAYER_ROLE_TANK | lfg::PLAYER_ROLE_HEALER | lfg::PLAYER_ROLE_DAMAGE))
|
||||
? partyRole : (roles != LfgListRoles.end() ? roles->second : 0);
|
||||
json += Trinity::StringFormat(R"({}{{"name":{},"class":{},"level":{},"leader":{},"tank":{},"healer":{},"damage":{}}})",
|
||||
first ? "" : ",", JsonString(info->Name), info->Class, info->Level, guid == leader ? "true" : "false",
|
||||
(mask & lfg::PLAYER_ROLE_TANK) ? "true" : "false", (mask & lfg::PLAYER_ROLE_HEALER) ? "true" : "false",
|
||||
(mask & lfg::PLAYER_ROLE_DAMAGE) ? "true" : "false");
|
||||
first = false;
|
||||
}
|
||||
json += "]";
|
||||
}
|
||||
json += "}";
|
||||
TC_LOG_INFO("groupfinder", "{}", json);
|
||||
}
|
||||
|
||||
// the listing a player belongs to: their own, or their group leader's
|
||||
std::pair<ObjectGuid, LfgListing const*> LfgListingOf(Player const* player)
|
||||
{
|
||||
ObjectGuid leader = player->GetGroup() ? player->GetGroup()->GetLeaderGUID() : player->GetGUID();
|
||||
auto itr = LfgListings.find(leader);
|
||||
if (itr == LfgListings.end())
|
||||
{
|
||||
leader = player->GetGUID();
|
||||
itr = LfgListings.find(leader);
|
||||
}
|
||||
return { leader, itr != LfgListings.end() ? &itr->second : nullptr };
|
||||
}
|
||||
}
|
||||
|
||||
// Discord bot LFG channel (GroupFinderListings.h): keep the posted group up to date when its members change
|
||||
void GroupFinderListings::OnGroupChanged(Group const* group)
|
||||
{
|
||||
if (!group)
|
||||
return;
|
||||
auto itr = LfgListings.find(group->GetLeaderGUID());
|
||||
if (itr != LfgListings.end())
|
||||
LogLfgListing("updated", itr->first, itr->second);
|
||||
}
|
||||
|
||||
void GroupFinderListings::OnLogout(Player const* player)
|
||||
{
|
||||
auto itr = LfgListings.find(player->GetGUID());
|
||||
if (itr == LfgListings.end())
|
||||
return;
|
||||
LogLfgListing("delisted", itr->first, itr->second);
|
||||
LfgListings.erase(itr);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgListProbe(WorldPackets::Null& packet)
|
||||
@@ -1162,6 +1282,7 @@ void WorldSession::HandleLfgListProbe(WorldPackets::Null& packet)
|
||||
result << uint8(0);
|
||||
SendPacket(&result);
|
||||
SendLfgListStatus(this, stored, true);
|
||||
LogLfgListing("listed", _player->GetGUID(), stored);
|
||||
break;
|
||||
}
|
||||
case CMSG_LFG_LIST_UPDATE_REQUEST: // edit (serializer rva 0x944C00): ticket, request
|
||||
@@ -1178,6 +1299,7 @@ void WorldSession::HandleLfgListProbe(WorldPackets::Null& packet)
|
||||
listing.Created = itr->second.Created;
|
||||
itr->second = std::move(listing);
|
||||
SendLfgListStatus(this, itr->second, true);
|
||||
LogLfgListing("updated", itr->first, itr->second);
|
||||
break;
|
||||
}
|
||||
case CMSG_LFG_LIST_LEAVE: // delist (Classic 0x440038): ticket
|
||||
@@ -1188,11 +1310,17 @@ void WorldSession::HandleLfgListProbe(WorldPackets::Null& packet)
|
||||
LfgListing const listing = std::move(itr->second);
|
||||
LfgListings.erase(itr);
|
||||
SendLfgListStatus(this, listing, false);
|
||||
LogLfgListing("delisted", _player->GetGUID(), listing);
|
||||
break;
|
||||
}
|
||||
case CMSG_PERKS_PROGRAM_REQUEST_REFUND: // Classic 0x3E02B3: the roles ticked in the Group Finder (uint8 mask)
|
||||
{
|
||||
LfgListRoles[_player->GetGUID()] = data.read<uint8>();
|
||||
auto [leader, listing] = LfgListingOf(_player);
|
||||
if (listing)
|
||||
LogLfgListing("updated", leader, *listing);
|
||||
break;
|
||||
}
|
||||
case CMSG_LFG_LIST_GET_STATUS: // login
|
||||
{
|
||||
auto itr = LfgListings.find(_player->GetGUID());
|
||||
@@ -1224,13 +1352,22 @@ void WorldSession::HandleLfgListProbe(WorldPackets::Null& packet)
|
||||
|
||||
WorldPacket results(SMSG_LFG_LIST_SEARCH_RESULTS, 256);
|
||||
std::vector<std::pair<ObjectGuid, LfgListing const*>> found;
|
||||
bool const crossFaction = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP);
|
||||
for (auto itr = LfgListings.begin(); itr != LfgListings.end();)
|
||||
{
|
||||
if (!ObjectAccessor::FindConnectedPlayer(itr->first))
|
||||
Player* leaderPlayer = ObjectAccessor::FindConnectedPlayer(itr->first);
|
||||
if (!leaderPlayer)
|
||||
{
|
||||
LogLfgListing("delisted", itr->first, itr->second);
|
||||
itr = LfgListings.erase(itr); // leader logged out
|
||||
continue;
|
||||
}
|
||||
// only groups of the searcher's own faction, like groups themselves (AllowTwoSide.Interaction.Group)
|
||||
if (!crossFaction && leaderPlayer->GetTeam() != GetPlayer()->GetTeam())
|
||||
{
|
||||
++itr;
|
||||
continue;
|
||||
}
|
||||
if (itr->second.CategoryId == categoryId && (activities.empty() || std::ranges::any_of(itr->second.Activities,
|
||||
[&](uint32 activityId) { return activities.contains(activityId); })))
|
||||
found.emplace_back(itr->first, &itr->second);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "RecentAllies.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "TradeData.h"
|
||||
@@ -556,6 +557,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPackets::Trade::AcceptTrade& acc
|
||||
info.Status = TRADE_STATUS_COMPLETE;
|
||||
trader->GetSession()->SendTradeStatus(info);
|
||||
SendTradeStatus(info);
|
||||
|
||||
RecentAllies::OnTrade(_player, trader);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -224,6 +224,7 @@ namespace WorldPackets
|
||||
struct RegionwideCharacterListEntry
|
||||
{
|
||||
RegionwideCharacterListEntry(Field const* fields);
|
||||
explicit RegionwideCharacterListEntry(CharacterInfoBasic const& basic) : Basic(basic) { }
|
||||
|
||||
CharacterInfoBasic Basic;
|
||||
uint64 Money = 0;
|
||||
|
||||
@@ -53,7 +53,9 @@ void PartyInviteClient::Read()
|
||||
_worldPacket >> SizedString::BitsSize<9>(TargetName);
|
||||
_worldPacket >> SizedString::BitsSize<9>(TargetRealm);
|
||||
|
||||
_worldPacket >> ProposedRoles;
|
||||
// Classic 1.60: a realm address, not the proposed roles (sniffs: 0 when inviting by name; 0x46010046 with the target guid from the
|
||||
// Battle.net friends list). Read as roles it made the invitee see the Group Finder role choice with nothing selectable.
|
||||
_worldPacket >> TargetRealmAddress;
|
||||
_worldPacket >> TargetGUID;
|
||||
|
||||
_worldPacket >> SizedString::Data(TargetName);
|
||||
|
||||
@@ -57,7 +57,8 @@ namespace WorldPackets
|
||||
void Read() override;
|
||||
|
||||
Optional<uint8> PartyIndex;
|
||||
uint32 ProposedRoles = 0;
|
||||
uint32 ProposedRoles = 0; // not sent by the Classic 1.60 client
|
||||
uint32 TargetRealmAddress = 0; // Classic 1.60: where retail has ProposedRoles (0 for invites by name; Battle.net friend invites: 70-1-70)
|
||||
std::string TargetName;
|
||||
std::string TargetRealm;
|
||||
ObjectGuid TargetGUID;
|
||||
|
||||
@@ -143,8 +143,10 @@ WorldPacket const* FeatureSystemStatus::Write()
|
||||
|
||||
_worldPacket << Squelch;
|
||||
|
||||
// Classic 1.60: the social restriction comes first, then the content set (every official sniff, 70170-70235: 0, then 137 / 136).
|
||||
// In the other order the client 70235 took the content set for a restriction: "Verify your age" and no whispers or chat.
|
||||
_worldPacket << int32(SocialRestriction); // 2 = age verification popup
|
||||
_worldPacket << int32(ContentSetID);
|
||||
_worldPacket << int32(SocialRestriction); // Classic 1.60.1.70009: int32 after ContentSetID, not the ruleset (2 = age verification popup)
|
||||
_worldPacket << Size<uint32>(DisabledGameModes);
|
||||
_worldPacket << Size<uint32>(GameRules);
|
||||
_worldPacket << int32(ActiveTimerunningSeasonID);
|
||||
@@ -220,7 +222,7 @@ WorldPacket const* FeatureSystemStatus::Write()
|
||||
_worldPacket << Bits<1>(GuildEventsEditsEnabled);
|
||||
|
||||
_worldPacket << Bits<1>(GuildTradeSkillsEnabled);
|
||||
_worldPacket << SizedString::BitsSize<10>(Unknown1027);
|
||||
_worldPacket << Bits<10>(ClassicFlagBits10);
|
||||
_worldPacket << Bits<1>(IsAccountCurrencyTransferEnabled);
|
||||
_worldPacket << Bits<1>(NetEaseChatTelemetryEnabled);
|
||||
_worldPacket << Bits<1>(LobbyMatchmakerQueueFromMainlineEnabled);
|
||||
@@ -239,8 +241,6 @@ WorldPacket const* FeatureSystemStatus::Write()
|
||||
if (SessionAlert)
|
||||
_worldPacket << *SessionAlert;
|
||||
|
||||
_worldPacket << SizedString::Data(Unknown1027);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace WorldPackets
|
||||
uint32 ClubPresenceUnsubscribeDelay = 0; ///< Timer for updating club presence when communities ui frame is hidden
|
||||
uint32 KioskSessionDurationMinutes = 0;
|
||||
int32 ContentSetID = 0; ///< Currently active Classic season
|
||||
int32 SocialRestriction = 0; ///< Classic 1.60: int32 after ContentSetID; 2 shows "Age Verification Required" and blocks chat
|
||||
int32 SocialRestriction = 0; ///< Classic 1.60: int32 before ContentSetID; 2 shows "Age Verification Required" and blocks chat
|
||||
int16 MaxPlayerGuidLookupsPerRequest = 50;
|
||||
int16 NameLookupTelemetryInterval = 600;
|
||||
Duration<Seconds, uint32> NotFoundCacheTimeSeconds = 10s;
|
||||
@@ -195,7 +195,7 @@ namespace WorldPackets
|
||||
std::vector<GameRuleValuePair> GameRules;
|
||||
int32 ActiveTimerunningSeasonID = 0;
|
||||
int32 RemainingTimerunningSeasonSeconds = 0;
|
||||
std::string Unknown1027; // related to movement lua functions used by keybinds
|
||||
uint16 ClassicFlagBits10 = 0; ///< Classic 1.60: 10 bits where retail has the Unknown1027 string length; no string follows (official: 2)
|
||||
ChatThrottleParams AddonChatThrottle;
|
||||
ChatThrottleParams GuildChatThrottle;
|
||||
ChatThrottleParams GroupChatThrottle;
|
||||
|
||||
@@ -644,16 +644,15 @@
|
||||
{ 0x440175, 0x430175 }, // CMSG_LOBBY_MATCHMAKER_ABANDON_QUEUE (0.0)
|
||||
{ 0x440176, 0x430176 }, // CMSG_SOCIAL_CONTRACT_REQUEST (0.0)
|
||||
{ 0x440177, 0x430177 }, // CMSG_ACCEPT_SOCIAL_CONTRACT (0.0)
|
||||
{ 0x44017C, 0x43017C }, // CMSG_CLASSIC_SOCIAL_WINDOW_OPEN (1.0: official sniff 2026-10-06, Social window -> SMSG 0x460359)
|
||||
{ 0x44017D, 0x43017B }, // CMSG_SAVE_ACCOUNT_DATA_EXPORT (0.0)
|
||||
{ 0x440180, 0x43017E }, // CMSG_LOBBY_MATCHMAKER_CREATE_CHARACTER (0.0)
|
||||
{ 0x440182, 0x43018D }, // CMSG_CONVERT_TIMERUNNING_CHARACTER (0.0)
|
||||
{ 0x440190, 0x43018F }, // CMSG_SETUP_WARBAND_GROUPS (0.0)
|
||||
{ 0x440191, 0x430193 }, // CMSG_GET_REGIONWIDE_CHARACTER_RESTRICTION_AND_MAIL_DATA (0.0)
|
||||
{ 0x440197, 0x430197 }, // CMSG_SERVER_VALIDATION_SIGNATURE_REQUEST (0.0)
|
||||
{ 0x44019A, 0x430198 }, // CMSG_RECENT_ALLY_REQUEST_DATA (0.0)
|
||||
{ 0x44019B, 0x430199 }, // CMSG_RECENT_ALLY_SET_NOTE (0.0)
|
||||
{ 0x44019C, 0x43019B }, // CMSG_INVITE_PLAYER_TO_NEIGHBORHOOD (0.0)
|
||||
{ 0x44019D, 0x43019C }, // CMSG_REFRESH_ENTITLEMENTS_ON_ORDER_COMPLETE (0.0)
|
||||
{ 0x44019C, 0x430198 }, // CMSG_RECENT_ALLY_REQUEST_DATA (1.0: official sniff 2026-10-06, Allies tab -> SMSG 0x460364)
|
||||
{ 0x44019D, 0x430199 }, // CMSG_RECENT_ALLY_SET_NOTE (0.5: next to the request, as in retail)
|
||||
{ 0x44019F, 0x4301A0 }, // CMSG_BLEEP_PONG (0.0)
|
||||
{ 0x4401A0, 0x4301A1 }, // CMSG_FETCH_BLEEP_PROXIES (0.0)
|
||||
{ 0x4401A4, 0x4301A2 }, // CMSG_REFRESH_BLEEP_TOKENS (0.0)
|
||||
|
||||
@@ -941,8 +941,9 @@ void OpcodeTable::InitializeClientOpcodes()
|
||||
DEFINE_HANDLER(CMSG_RANDOM_ROLL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRandomRollOpcode);
|
||||
DEFINE_HANDLER(CMSG_READY_CHECK_RESPONSE, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleReadyCheckResponseOpcode);
|
||||
DEFINE_HANDLER(CMSG_READ_ITEM, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleReadItem);
|
||||
DEFINE_HANDLER(CMSG_RECENT_ALLY_REQUEST_DATA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_RECENT_ALLY_SET_NOTE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_RECENT_ALLY_REQUEST_DATA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRecentAllyProbe);
|
||||
DEFINE_HANDLER(CMSG_RECENT_ALLY_SET_NOTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRecentAllyProbe);
|
||||
DEFINE_HANDLER(CMSG_CLASSIC_SOCIAL_WINDOW_OPEN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRecentAllyProbe);
|
||||
DEFINE_HANDLER(CMSG_RECLAIM_CORPSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReclaimCorpse);
|
||||
DEFINE_HANDLER(CMSG_REFRESH_BLEEP_TOKENS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
DEFINE_HANDLER(CMSG_REFRESH_ENTITLEMENTS_ON_ORDER_COMPLETE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
|
||||
@@ -2313,6 +2314,8 @@ void OpcodeTable::InitializeServerOpcodes()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RECEIVE_PING_WORLD_POINT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RECENT_ALLY_DATA_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RECENT_ALLY_NOTE_UPDATED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RECENT_ALLY_LIST, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLASSIC_SOCIAL_WINDOW_OPEN_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RECRAFT_ITEM_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RECRUIT_A_FRIEND_FAILURE, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_REFETCH_TACT_KEYS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
|
||||
@@ -832,6 +832,7 @@ enum OpcodeClient : uint32
|
||||
CMSG_READ_ITEM = 0x3D0212,
|
||||
CMSG_RECENT_ALLY_REQUEST_DATA = 0x430198,
|
||||
CMSG_RECENT_ALLY_SET_NOTE = 0x430199,
|
||||
CMSG_CLASSIC_SOCIAL_WINDOW_OPEN = 0x43017C, // Classic 0x44017C: sent with the Recent Allies request when the Social window opens
|
||||
CMSG_RECLAIM_CORPSE = 0x3E0076,
|
||||
CMSG_REFRESH_BLEEP_TOKENS = 0x4301A2,
|
||||
CMSG_REFRESH_ENTITLEMENTS_ON_ORDER_COMPLETE = 0x43019C,
|
||||
@@ -2237,6 +2238,8 @@ enum OpcodeServer : uint32
|
||||
SMSG_RECEIVE_PING_WORLD_POINT = 0x45003A,
|
||||
SMSG_RECENT_ALLY_DATA_RESPONSE = 0x450362,
|
||||
SMSG_RECENT_ALLY_NOTE_UPDATED = 0x450363,
|
||||
SMSG_RECENT_ALLY_LIST = 0x450364, // Classic 0x460364: the Allies tab (sniff 2026-10-06)
|
||||
SMSG_CLASSIC_SOCIAL_WINDOW_OPEN_RESPONSE = 0x450359, // Classic 0x460359: answer to CMSG_CLASSIC_SOCIAL_WINDOW_OPEN (uint32 0)
|
||||
SMSG_RECRAFT_ITEM_RESULT = 0x45033B,
|
||||
SMSG_RECRUIT_A_FRIEND_FAILURE = 0x45016C,
|
||||
SMSG_REFETCH_TACT_KEYS = 0x450376,
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ClientConfigPackets.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "FriendsService.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
@@ -679,6 +680,9 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
//! Call script hook before deletion
|
||||
sScriptMgr->OnPlayerLogout(_player);
|
||||
|
||||
// Battle.net friends see us go offline
|
||||
BattlenetPresence::OnLogout(this);
|
||||
|
||||
TC_METRIC_EVENT("player_events", "Logout", _player->GetName());
|
||||
|
||||
//! Remove the player from the world
|
||||
@@ -1482,8 +1486,28 @@ void WorldSession::InitializeSessionCallback(LoginDatabaseQueryHolder const& hol
|
||||
|
||||
WorldPackets::Battlenet::ConnectionStatus bnetConnected;
|
||||
bnetConnected.State = 1;
|
||||
bnetConnected.SuppressNotification = false; // Classic 1.60: as the official server (0x40), the client then uses its Battle.net friends
|
||||
SendPacket(bnetConnected.Write());
|
||||
|
||||
// Classic 1.60: the official server then sends, unasked (token 0, object 0), the friends v2 and block list Subscribe results; only
|
||||
// after these does the client ask for its friends and invitations (sniff 70235: method 0x40000001, block list data 0A 00 = empty list)
|
||||
{
|
||||
WorldPackets::Battlenet::Response friendsSubscribed;
|
||||
friendsSubscribed.BnetStatus = ERROR_OK;
|
||||
friendsSubscribed.Method.Type = MAKE_PAIR64(0x40000001, 0x5869BE8C); // friends.v2.client.FriendsService.Subscribe
|
||||
friendsSubscribed.Method.ObjectId = 0;
|
||||
friendsSubscribed.Method.Token = 0;
|
||||
SendPacket(friendsSubscribed.Write());
|
||||
|
||||
WorldPackets::Battlenet::Response blockListSubscribed;
|
||||
blockListSubscribed.BnetStatus = ERROR_OK;
|
||||
blockListSubscribed.Method.Type = MAKE_PAIR64(0x40000001, 0x8E8F5FB0); // block_list.v1.client.BlockListService.Subscribe
|
||||
blockListSubscribed.Method.ObjectId = 0;
|
||||
blockListSubscribed.Method.Token = 0;
|
||||
blockListSubscribed.Data << uint8(0x0A) << uint8(0x00);
|
||||
SendPacket(blockListSubscribed.Write());
|
||||
}
|
||||
|
||||
_battlePetMgr->LoadFromDB(holder.GetPreparedResult(AccountInfoQueryHolder::BATTLE_PETS),
|
||||
holder.GetPreparedResult(AccountInfoQueryHolder::BATTLE_PET_SLOTS));
|
||||
}
|
||||
|
||||
@@ -1241,6 +1241,7 @@ class TC_GAME_API WorldSession
|
||||
void Handle_NULL(WorldPackets::Null& null); // not used
|
||||
void HandleClubFinderProbe(WorldPackets::Null& packet); // Classic 1.60 Guild Finder
|
||||
void HandleLfgListProbe(WorldPackets::Null& packet); // Classic 1.60 Group Finder: layouts still being worked out
|
||||
void HandleRecentAllyProbe(WorldPackets::Null& packet); // Classic 1.60 Social window: Recent Allies tab (RecentAllies.cpp)
|
||||
void HandleGetLastCatalogFetch(WorldPackets::Null& null); // Classic 1.60 catalog shop
|
||||
void Handle_EarlyProccess(WorldPackets::Null& null); // just mark packets processed in WorldSocket::ReadDataHandler
|
||||
void LogUnprocessedTail(WorldPacket const* packet);
|
||||
|
||||
@@ -0,0 +1,946 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "FriendsService.h"
|
||||
#include "BattlenetRpcErrorCodes.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "MapUtils.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "RealmList.h"
|
||||
#include "Util.h"
|
||||
#include "Client/api/client/v2/friends_listener.pb.h"
|
||||
#include "Client/api/client/v2/presence_listener.pb.h"
|
||||
#include "Client/api/client/v2/whisper_listener.pb.h"
|
||||
#include <mutex>
|
||||
|
||||
// Presence v2 field keys of the official server (sniff 70235, 2026-10-06). Program "BN" group 1 = the Battle.net account, group 2 = the
|
||||
// online game account (with program "WoW" group 2 fields for the character).
|
||||
namespace
|
||||
{
|
||||
constexpr uint32 ProgramBN = 0x424E;
|
||||
constexpr uint32 ProgramWoW = 0x576F57;
|
||||
constexpr uint32 GameAccountRegion = 1; // the account's region (bnetserver AccountInfo home/preferred region 1); 2 showed
|
||||
// "(Europe)" and "Different region" on the invite button
|
||||
constexpr uint32 PlatformWin = 0x576E3634; // official: 1466840628 ("Wn64")
|
||||
constexpr std::size_t MaxFriends = 200;
|
||||
constexpr std::size_t MaxPendingInvitations = 100;
|
||||
|
||||
enum : uint32
|
||||
{
|
||||
// BN group 1 (account)
|
||||
AccountFullName = 1,
|
||||
AccountBattleTag = 4,
|
||||
AccountLastOnline = 6, // int, microseconds
|
||||
AccountAppearOffline = 7, // bool, set by the client (presence Update)
|
||||
AccountBusy = 11, // bool, set by the client
|
||||
AccountAway = 12, // bool, set by the client
|
||||
AccountOnlineGameAccounts = 20, // blob PresenceOnlineGameAccountFieldValue; empty = offline
|
||||
AccountLastGameAccount = 21, // blob GameAccountHandle
|
||||
AccountState = 22, // uint (0 offline/away .. 1 online)
|
||||
AccountStateTime = 23, // int, microseconds
|
||||
|
||||
// BN group 2 (game account)
|
||||
GameOnline = 1, // bool
|
||||
GameTime = 4, // int, microseconds
|
||||
GameBattleTag = 5,
|
||||
GameAccountName = 6, // "<bnet id>#<index>"
|
||||
GameBusy = 10, // bool
|
||||
GameAway = 12, // bool
|
||||
GameRegion = 13,
|
||||
GamePlatform = 15,
|
||||
GameRegion2 = 17,
|
||||
GameBnetAccount = 20,
|
||||
GameProgramName = 21, // "WoW"
|
||||
|
||||
// WoW group 2 (character)
|
||||
WowRealm = 1, // realm address
|
||||
WowRace = 2,
|
||||
WowClass = 3,
|
||||
WowLevel = 5,
|
||||
WowZone = 6,
|
||||
WowFactionGroup = 7, // FactionGroup mask: 1 player | 2 Alliance (3) or 4 Horde (5) - every official sniff
|
||||
WowRealm2 = 8,
|
||||
WowGender = 9, // 0 / 1 (varies per character in the official character select presence)
|
||||
WowName = 10, // "Name Surname"
|
||||
WowCfgRealm = 11,
|
||||
WowGuid = 12, // character guid counter
|
||||
WowFlag13 = 13, // bool, always false
|
||||
WowFlag14 = 14, // official 18
|
||||
WowTimerunningSeason = 15, // int, 0 (1 showed the Timerunning hourglass before the name)
|
||||
};
|
||||
|
||||
uint64 NowUs()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
||||
// ---- data
|
||||
|
||||
std::mutex FriendCacheLock;
|
||||
std::unordered_map<uint32, std::vector<uint32>> FriendCache; // online (this realm) bnet account -> its friends
|
||||
|
||||
// status the client picked (online / away / busy / appear offline), kept while the account plays on this realm
|
||||
// the account fields the client set itself (presence Update), passed on to friends unchanged as the official server does
|
||||
struct PresenceStatus
|
||||
{
|
||||
bool AppearOffline = false;
|
||||
std::map<uint32, bgs::protocol::v2::Variant> Fields;
|
||||
};
|
||||
|
||||
std::mutex StatusLock;
|
||||
std::unordered_map<uint32, PresenceStatus> StatusCache;
|
||||
|
||||
PresenceStatus GetStatus(uint32 accountId)
|
||||
{
|
||||
std::scoped_lock guard(StatusLock);
|
||||
if (PresenceStatus const* status = Trinity::Containers::MapGetValuePtr(StatusCache, accountId))
|
||||
return *status;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<uint32> LoadFriendIds(uint32 accountId)
|
||||
{
|
||||
std::vector<uint32> ids;
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT friend_account_id FROM battlenet_friends WHERE account_id = {}", accountId))
|
||||
{
|
||||
do
|
||||
ids.push_back((*result)[0].GetUInt32());
|
||||
while (result->NextRow());
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
std::vector<uint32> CachedFriendIds(uint32 accountId)
|
||||
{
|
||||
std::scoped_lock guard(FriendCacheLock);
|
||||
if (std::vector<uint32> const* ids = Trinity::Containers::MapGetValuePtr(FriendCache, accountId))
|
||||
return *ids;
|
||||
return {};
|
||||
}
|
||||
|
||||
void ReloadFriendCache(uint32 accountId)
|
||||
{
|
||||
std::vector<uint32> ids = LoadFriendIds(accountId);
|
||||
std::scoped_lock guard(FriendCacheLock);
|
||||
if (FriendCache.contains(accountId))
|
||||
FriendCache[accountId] = std::move(ids);
|
||||
}
|
||||
|
||||
struct AccountInfo
|
||||
{
|
||||
uint32 Id = 0;
|
||||
std::string BattleTag;
|
||||
};
|
||||
|
||||
Optional<AccountInfo> GetAccount(uint32 accountId)
|
||||
{
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT id, battle_tag FROM battlenet_accounts WHERE id = {}", accountId))
|
||||
return AccountInfo{ (*result)[0].GetUInt32(), (*result)[1].IsNull() ? "" : (*result)[1].GetString() };
|
||||
return {};
|
||||
}
|
||||
|
||||
// "Name#1234" (any case) or an e-mail address
|
||||
Optional<AccountInfo> FindAccount(std::string const& target)
|
||||
{
|
||||
if (target.empty())
|
||||
return {};
|
||||
std::string upper = target;
|
||||
std::ranges::transform(upper, upper.begin(), [](char c) { return char(std::toupper(uint8(c))); });
|
||||
LoginDatabase.EscapeString(upper);
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT id, battle_tag FROM battlenet_accounts WHERE UPPER(battle_tag) = '{}' OR email = '{}' LIMIT 1", upper, upper))
|
||||
return AccountInfo{ (*result)[0].GetUInt32(), (*result)[1].IsNull() ? "" : (*result)[1].GetString() };
|
||||
return {};
|
||||
}
|
||||
|
||||
bool AreFriends(uint32 accountId, uint32 otherId)
|
||||
{
|
||||
return LoginDatabase.PQuery("SELECT 1 FROM battlenet_friends WHERE account_id = {} AND friend_account_id = {}", accountId, otherId) != nullptr;
|
||||
}
|
||||
|
||||
bool IsOnlineAnywhere(uint32 accountId)
|
||||
{
|
||||
return LoginDatabase.PQuery("SELECT 1 FROM account WHERE battlenet_account = {} AND online <> 0 LIMIT 1", accountId) != nullptr;
|
||||
}
|
||||
|
||||
// the player of a Battle.net account that is in world on this realm
|
||||
Player* FindOnlinePlayer(uint32 accountId)
|
||||
{
|
||||
std::shared_lock lock(*HashMapHolder<Player>::GetLock());
|
||||
for (auto const& [guid, player] : ObjectAccessor::GetPlayers())
|
||||
if (player->GetSession() && player->GetSession()->GetBattlenetAccountId() == accountId && player->IsInWorld())
|
||||
return player;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ---- presence
|
||||
|
||||
bgs::protocol::presence::v2::PresenceField* AddField(bgs::protocol::presence::v2::PresenceFieldState* state, uint32 program, uint32 group, uint32 field, uint64 now)
|
||||
{
|
||||
bgs::protocol::presence::v2::PresenceField* presenceField = state->add_fields();
|
||||
bgs::protocol::presence::v2::PresenceFieldKey* key = presenceField->mutable_key();
|
||||
key->set_title_id(program);
|
||||
key->set_group(group);
|
||||
key->set_field(field);
|
||||
key->set_unique_id(0);
|
||||
presenceField->set_updated_time_us(now);
|
||||
return presenceField;
|
||||
}
|
||||
|
||||
void SetHandle(bgs::protocol::account::v2::GameAccountHandle* handle, uint32 gameAccountId)
|
||||
{
|
||||
handle->set_id(gameAccountId);
|
||||
handle->set_title_id(ProgramWoW);
|
||||
handle->set_region(GameAccountRegion);
|
||||
}
|
||||
|
||||
// account (group 1): BattleTag, online or not, away
|
||||
void FillAccountState(bgs::protocol::presence::v2::PresenceFieldState* state, AccountInfo const& account, Player const* player, bool onlineElsewhere, uint64 now)
|
||||
{
|
||||
PresenceStatus const status = player ? GetStatus(account.Id) : PresenceStatus();
|
||||
state->set_account_id(account.Id);
|
||||
state->set_oldest_time_us(now);
|
||||
if (!account.BattleTag.empty())
|
||||
AddField(state, ProgramBN, 1, AccountBattleTag, now)->mutable_value()->set_string_value(account.BattleTag);
|
||||
AddField(state, ProgramBN, 1, AccountLastOnline, now)->mutable_value()->set_int_value(now);
|
||||
if (!status.Fields.contains(AccountAway))
|
||||
AddField(state, ProgramBN, 1, AccountAway, now)->mutable_value()->set_bool_value(player && player->isAFK());
|
||||
if (player)
|
||||
for (auto const& [field, value] : status.Fields)
|
||||
if (field != AccountAppearOffline)
|
||||
*AddField(state, ProgramBN, 1, field, now)->mutable_value() = value;
|
||||
|
||||
bool const online = player || onlineElsewhere;
|
||||
bgs::protocol::presence::v2::PresenceOnlineGameAccountFieldValue onlineAccounts;
|
||||
if (player)
|
||||
{
|
||||
bgs::protocol::presence::v2::PresenceOnlineGameAccount* onlineAccount = onlineAccounts.add_online_game_accounts();
|
||||
SetHandle(onlineAccount->mutable_game_account(), player->GetSession()->GetAccountId());
|
||||
onlineAccount->set_online_time_us(now);
|
||||
|
||||
bgs::protocol::account::v2::GameAccountHandle handle;
|
||||
SetHandle(&handle, player->GetSession()->GetAccountId());
|
||||
AddField(state, ProgramBN, 1, AccountLastGameAccount, now)->mutable_value()->set_blob_value(handle.SerializeAsString());
|
||||
}
|
||||
else
|
||||
{
|
||||
bgs::protocol::presence::v2::PresenceField* field = AddField(state, ProgramBN, 1, AccountLastGameAccount, now);
|
||||
field->set_deleted(true);
|
||||
}
|
||||
AddField(state, ProgramBN, 1, AccountOnlineGameAccounts, now)->mutable_value()->set_blob_value(onlineAccounts.SerializeAsString());
|
||||
if (!online || !status.Fields.contains(AccountState))
|
||||
AddField(state, ProgramBN, 1, AccountState, now)->mutable_value()->set_uint_value(online ? 1 : 0);
|
||||
AddField(state, ProgramBN, 1, AccountStateTime, now)->mutable_value()->set_int_value(now);
|
||||
}
|
||||
|
||||
// game account (group 2) with the character, or the fields deleted when it went offline
|
||||
void FillGameAccountState(bgs::protocol::presence::v2::PresenceFieldState* state, AccountInfo const& account, WorldSession const* session,
|
||||
Player const* player, uint64 now)
|
||||
{
|
||||
state->set_account_id(account.Id);
|
||||
state->set_oldest_time_us(now);
|
||||
SetHandle(state->mutable_game_account(), session->GetAccountId());
|
||||
|
||||
AddField(state, ProgramBN, 2, GameOnline, now)->mutable_value()->set_bool_value(player != nullptr);
|
||||
AddField(state, ProgramBN, 2, GameTime, now)->mutable_value()->set_int_value(now);
|
||||
if (!player)
|
||||
{
|
||||
for (uint32 field : { WowRealm, WowRace, WowClass, WowLevel, WowZone, WowFactionGroup, WowRealm2, WowGender, WowName, WowCfgRealm,
|
||||
WowGuid, WowFlag13, WowFlag14, WowTimerunningSeason })
|
||||
AddField(state, ProgramWoW, 2, field, now)->set_deleted(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!account.BattleTag.empty())
|
||||
AddField(state, ProgramBN, 2, GameBattleTag, now)->mutable_value()->set_string_value(account.BattleTag);
|
||||
AddField(state, ProgramBN, 2, GameAccountName, now)->mutable_value()->set_string_value(session->GetAccountName());
|
||||
AddField(state, ProgramBN, 2, GameBusy, now)->mutable_value()->set_bool_value(player->isDND());
|
||||
AddField(state, ProgramBN, 2, GameAway, now)->mutable_value()->set_bool_value(player->isAFK());
|
||||
AddField(state, ProgramBN, 2, GameRegion, now)->mutable_value()->set_uint_value(GameAccountRegion);
|
||||
AddField(state, ProgramBN, 2, GamePlatform, now)->mutable_value()->set_uint_value(PlatformWin);
|
||||
AddField(state, ProgramBN, 2, GameRegion2, now)->mutable_value()->set_uint_value(GameAccountRegion);
|
||||
AddField(state, ProgramBN, 2, GameBnetAccount, now)->mutable_value()->set_uint_value(account.Id);
|
||||
AddField(state, ProgramBN, 2, GameProgramName, now)->mutable_value()->set_string_value("WoW");
|
||||
|
||||
std::string name = player->GetName();
|
||||
std::string surname = sCharacterCache->GetCharacterSurnameByGuid(player->GetGUID());
|
||||
if (!surname.empty())
|
||||
name += " " + surname;
|
||||
|
||||
uint32 const realmAddress = sRealmList->GetCurrentRealmId().GetAddress();
|
||||
AddField(state, ProgramWoW, 2, WowRealm, now)->mutable_value()->set_uint_value(realmAddress);
|
||||
AddField(state, ProgramWoW, 2, WowRace, now)->mutable_value()->set_uint_value(player->GetRace());
|
||||
AddField(state, ProgramWoW, 2, WowClass, now)->mutable_value()->set_uint_value(player->GetClass());
|
||||
AddField(state, ProgramWoW, 2, WowLevel, now)->mutable_value()->set_uint_value(player->GetLevel());
|
||||
AddField(state, ProgramWoW, 2, WowZone, now)->mutable_value()->set_uint_value(player->GetZoneId());
|
||||
AddField(state, ProgramWoW, 2, WowFactionGroup, now)->mutable_value()->set_int_value(player->GetTeamId() == TEAM_ALLIANCE ? 3 : 5);
|
||||
AddField(state, ProgramWoW, 2, WowRealm2, now)->mutable_value()->set_uint_value(realmAddress);
|
||||
AddField(state, ProgramWoW, 2, WowGender, now)->mutable_value()->set_uint_value(player->GetNativeGender());
|
||||
AddField(state, ProgramWoW, 2, WowName, now)->mutable_value()->set_string_value(name);
|
||||
AddField(state, ProgramWoW, 2, WowCfgRealm, now)->mutable_value()->set_uint_value(sRealmList->GetCurrentRealmId().Realm);
|
||||
AddField(state, ProgramWoW, 2, WowGuid, now)->mutable_value()->set_uint_value(uint32(player->GetGUID().GetCounter()));
|
||||
AddField(state, ProgramWoW, 2, WowFlag13, now)->mutable_value()->set_bool_value(false);
|
||||
AddField(state, ProgramWoW, 2, WowFlag14, now)->mutable_value()->set_uint_value(18);
|
||||
AddField(state, ProgramWoW, 2, WowTimerunningSeason, now)->mutable_value()->set_int_value(0);
|
||||
}
|
||||
|
||||
void SendPresence(WorldSession* receiver, bgs::protocol::presence::v2::PresenceStateUpdatedNotification& notification)
|
||||
{
|
||||
notification.set_subscriber_id(receiver->GetBattlenetAccountId());
|
||||
Battlenet::WorldserverService<bgs::protocol::presence::v2::PresenceListener>(receiver).OnPresenceStateUpdated(¬ification, true, true);
|
||||
}
|
||||
|
||||
// full presence of one account (both levels when it plays on this realm) to a receiver
|
||||
void SendAccountPresence(WorldSession* receiver, AccountInfo const& account)
|
||||
{
|
||||
uint64 const now = NowUs();
|
||||
Player const* player = FindOnlinePlayer(account.Id);
|
||||
bgs::protocol::presence::v2::PresenceStateUpdatedNotification notification;
|
||||
if (player && GetStatus(account.Id).AppearOffline) // looks offline to friends
|
||||
{
|
||||
FillAccountState(notification.add_states(), account, nullptr, false, now);
|
||||
FillGameAccountState(notification.add_states(), account, player->GetSession(), nullptr, now);
|
||||
SendPresence(receiver, notification);
|
||||
return;
|
||||
}
|
||||
FillAccountState(notification.add_states(), account, player, !player && IsOnlineAnywhere(account.Id), now);
|
||||
if (player)
|
||||
FillGameAccountState(notification.add_states(), account, player->GetSession(), player, now);
|
||||
SendPresence(receiver, notification);
|
||||
}
|
||||
|
||||
// tell the online friends (this realm) of an account about a change of its presence
|
||||
void NotifyFriends(uint32 accountId, std::function<void(bgs::protocol::presence::v2::PresenceStateUpdatedNotification&)> const& fill)
|
||||
{
|
||||
for (uint32 friendId : CachedFriendIds(accountId))
|
||||
{
|
||||
if (Player* friendPlayer = FindOnlinePlayer(friendId))
|
||||
{
|
||||
bgs::protocol::presence::v2::PresenceStateUpdatedNotification notification;
|
||||
fill(notification);
|
||||
SendPresence(friendPlayer->GetSession(), notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- friends listener notifications
|
||||
|
||||
template<class Notification>
|
||||
void ToAccount(uint32 accountId, Notification& notification, void (bgs::protocol::friends::v2::client::FriendsListener::*method)(Notification const*, bool, bool))
|
||||
{
|
||||
if (Player* player = FindOnlinePlayer(accountId))
|
||||
{
|
||||
notification.set_agent_account_id(accountId);
|
||||
Battlenet::WorldserverService<bgs::protocol::friends::v2::client::FriendsListener> listener(player->GetSession());
|
||||
(listener.*method)(¬ification, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
void FillFriend(bgs::protocol::friends::v2::client::Friend* entry, uint32 friendId, std::string const& battleTag, uint32 created)
|
||||
{
|
||||
entry->set_id(friendId);
|
||||
entry->set_level(1);
|
||||
if (!battleTag.empty())
|
||||
entry->set_battle_tag(battleTag);
|
||||
entry->set_creation_time_s(created);
|
||||
}
|
||||
|
||||
void FillReceived(bgs::protocol::friends::v2::client::ReceivedInvitation* invitation, uint64 id, AccountInfo const& inviter, uint32 created)
|
||||
{
|
||||
invitation->set_id(id);
|
||||
invitation->mutable_inviter()->set_account_id(inviter.Id);
|
||||
if (!inviter.BattleTag.empty())
|
||||
invitation->mutable_inviter()->set_battle_tag(inviter.BattleTag);
|
||||
invitation->set_level(1);
|
||||
invitation->set_program(ProgramWoW);
|
||||
invitation->set_creation_time_s(created);
|
||||
invitation->set_expiration_time_s(created + 30 * DAY);
|
||||
}
|
||||
|
||||
void FillSent(bgs::protocol::friends::v2::client::SentInvitation* invitation, uint64 id, AccountInfo const& invitee, uint32 created)
|
||||
{
|
||||
invitation->set_id(id);
|
||||
invitation->set_target_name(invitee.BattleTag);
|
||||
invitation->set_level(1);
|
||||
invitation->set_program(ProgramWoW);
|
||||
invitation->set_creation_time_s(created);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Battlenet::Services
|
||||
{
|
||||
FriendsService::FriendsService(WorldSession* session) : BaseService(session) { }
|
||||
|
||||
uint32 FriendsService::HandleSubscribe(friends::v2::client::SubscribeRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleUnsubscribe(friends::v2::client::UnsubscribeRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleGetSentInvitations(friends::v2::client::GetSentInvitationsRequest const* /*request*/,
|
||||
friends::v2::client::GetSentInvitationsResponse* response, std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT i.id, i.invitee_account_id, a.battle_tag, i.created FROM battlenet_friend_invitations i "
|
||||
"JOIN battlenet_accounts a ON a.id = i.invitee_account_id WHERE i.inviter_account_id = {}", _session->GetBattlenetAccountId()))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
FillSent(response->add_invitations(), fields[0].GetUInt32(), { fields[1].GetUInt32(), fields[2].IsNull() ? "" : fields[2].GetString() },
|
||||
fields[3].GetUInt32());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
response->set_continuation(0);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleGetReceivedInvitations(friends::v2::client::GetReceivedInvitationsRequest const* /*request*/,
|
||||
friends::v2::client::GetReceivedInvitationsResponse* response, std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT i.id, i.inviter_account_id, a.battle_tag, i.created FROM battlenet_friend_invitations i "
|
||||
"JOIN battlenet_accounts a ON a.id = i.inviter_account_id WHERE i.invitee_account_id = {}", _session->GetBattlenetAccountId()))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
FillReceived(response->add_invitations(), fields[0].GetUInt32(), { fields[1].GetUInt32(), fields[2].IsNull() ? "" : fields[2].GetString() },
|
||||
fields[3].GetUInt32());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
response->set_continuation(0);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleGetFriends(friends::v2::client::GetFriendsRequest const* /*request*/,
|
||||
friends::v2::client::GetFriendsResponse* response, std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& continuation)
|
||||
{
|
||||
std::vector<AccountInfo> friends;
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT f.friend_account_id, a.battle_tag, f.created, f.note FROM battlenet_friends f "
|
||||
"JOIN battlenet_accounts a ON a.id = f.friend_account_id WHERE f.account_id = {}", _session->GetBattlenetAccountId()))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
AccountInfo& account = friends.emplace_back(AccountInfo{ fields[0].GetUInt32(), fields[1].IsNull() ? "" : fields[1].GetString() });
|
||||
bgs::protocol::friends::v2::client::Friend* entry = response->add_friends();
|
||||
FillFriend(entry, account.Id, account.BattleTag, fields[2].GetUInt32());
|
||||
if (!fields[3].GetStringView().empty())
|
||||
entry->set_note(fields[3].GetString());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
response->set_continuation(0);
|
||||
TC_LOG_INFO("network.rpc", "{} FriendsService.GetFriends: {} friend(s)", _session->GetPlayerInfo(), friends.size());
|
||||
|
||||
// reply first, then the friends' presence (official order)
|
||||
continuation(this, ERROR_OK, response);
|
||||
continuation = nullptr;
|
||||
for (AccountInfo const& account : friends)
|
||||
SendAccountPresence(_session, account);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleIsFriend(friends::v2::client::IsFriendRequest const* request, friends::v2::client::IsFriendResponse* response,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
response->set_result(AreFriends(_session->GetBattlenetAccountId(), uint32(request->target_account_id())));
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleSendInvitation(friends::v2::client::SendInvitationRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
friends::v2::client::SendInvitationTarget const& target = request->target();
|
||||
TC_LOG_INFO("network.rpc", "{} FriendsService.SendInvitation: {}", _session->GetPlayerInfo(), request->ShortDebugString());
|
||||
|
||||
Optional<AccountInfo> invitee;
|
||||
if (target.has_account_id())
|
||||
invitee = GetAccount(uint32(target.account_id()));
|
||||
else if (target.has_battle_tag())
|
||||
invitee = FindAccount(target.battle_tag());
|
||||
else if (target.has_email())
|
||||
invitee = FindAccount(target.email());
|
||||
else if (target.has_name())
|
||||
invitee = FindAccount(target.name());
|
||||
|
||||
if (!invitee)
|
||||
return ERROR_FRIENDS_RECEIVED_INVITATION_UNDELIVERABLE;
|
||||
if (invitee->Id == me)
|
||||
return ERROR_INVALID_TARGET_ID;
|
||||
if (AreFriends(me, invitee->Id))
|
||||
return ERROR_FRIENDS_FRIENDSHIP_ALREADY_EXISTS;
|
||||
if (LoginDatabase.PQuery("SELECT 1 FROM battlenet_friend_invitations WHERE inviter_account_id = {} AND invitee_account_id = {}", me, invitee->Id))
|
||||
return ERROR_FRIENDS_INVITATION_ALREADY_EXISTS;
|
||||
if (QueryResult count = LoginDatabase.PQuery("SELECT COUNT(*) FROM battlenet_friend_invitations WHERE inviter_account_id = {}", me))
|
||||
if ((*count)[0].GetUInt64() >= MaxPendingInvitations)
|
||||
return ERROR_FRIENDS_TOO_MANY_SENT_INVITATIONS;
|
||||
if (LoadFriendIds(me).size() >= MaxFriends)
|
||||
return ERROR_FRIENDS_INVITER_AT_MAX_FRIENDS;
|
||||
|
||||
// they invited us already: just accept theirs
|
||||
if (QueryResult theirs = LoginDatabase.PQuery("SELECT id FROM battlenet_friend_invitations WHERE inviter_account_id = {} AND invitee_account_id = {}", invitee->Id, me))
|
||||
{
|
||||
friends::v2::client::AcceptInvitationRequest accept;
|
||||
accept.set_invitation_id((*theirs)[0].GetUInt32());
|
||||
NoData none;
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)> noContinuation;
|
||||
return HandleAcceptInvitation(&accept, &none, noContinuation);
|
||||
}
|
||||
|
||||
uint32 const created = uint32(GameTime::GetGameTime());
|
||||
LoginDatabase.DirectPExecute("INSERT INTO battlenet_friend_invitations (inviter_account_id, invitee_account_id, created) VALUES ({}, {}, {})",
|
||||
me, invitee->Id, created);
|
||||
QueryResult inserted = LoginDatabase.PQuery("SELECT id FROM battlenet_friend_invitations WHERE inviter_account_id = {} AND invitee_account_id = {}", me, invitee->Id);
|
||||
if (!inserted)
|
||||
return ERROR_INTERNAL;
|
||||
uint64 const invitationId = (*inserted)[0].GetUInt32();
|
||||
|
||||
Optional<AccountInfo> self = GetAccount(me);
|
||||
friends::v2::client::SentInvitationAddedNotification sent;
|
||||
FillSent(sent.add_invitations(), invitationId, *invitee, created);
|
||||
ToAccount(me, sent, &friends::v2::client::FriendsListener::OnSentInvitationAdded);
|
||||
|
||||
friends::v2::client::ReceivedInvitationAddedNotification received;
|
||||
FillReceived(received.add_invitations(), invitationId, self.value_or(AccountInfo{ me, "" }), created);
|
||||
ToAccount(invitee->Id, received, &friends::v2::client::FriendsListener::OnReceivedInvitationAdded);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleAcceptInvitation(friends::v2::client::AcceptInvitationRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
QueryResult result = LoginDatabase.PQuery("SELECT inviter_account_id FROM battlenet_friend_invitations WHERE id = {} AND invitee_account_id = {}",
|
||||
request->invitation_id(), me);
|
||||
if (!result)
|
||||
return ERROR_FRIENDS_INVALID_INVITATION;
|
||||
uint32 const inviterId = (*result)[0].GetUInt32();
|
||||
|
||||
if (LoadFriendIds(me).size() >= MaxFriends)
|
||||
return ERROR_FRIENDS_INVITEE_AT_MAX_FRIENDS;
|
||||
|
||||
uint32 const created = uint32(GameTime::GetGameTime());
|
||||
LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
|
||||
trans->PAppend("DELETE FROM battlenet_friend_invitations WHERE (inviter_account_id = {0} AND invitee_account_id = {1}) OR (inviter_account_id = {1} AND invitee_account_id = {0})",
|
||||
inviterId, me);
|
||||
trans->PAppend("REPLACE INTO battlenet_friends (account_id, friend_account_id, created) VALUES ({0}, {1}, {2}), ({1}, {0}, {2})", inviterId, me, created);
|
||||
LoginDatabase.DirectCommitTransaction(trans);
|
||||
ReloadFriendCache(me);
|
||||
ReloadFriendCache(inviterId);
|
||||
|
||||
Optional<AccountInfo> self = GetAccount(me);
|
||||
Optional<AccountInfo> inviter = GetAccount(inviterId);
|
||||
if (!self || !inviter)
|
||||
return ERROR_OK;
|
||||
|
||||
friends::v2::client::ReceivedInvitationRemovedNotification receivedRemoved;
|
||||
bgs::protocol::friends::v2::client::RemovedInvitationAssignment* assignment = receivedRemoved.add_assignments();
|
||||
assignment->set_invitation_id(request->invitation_id());
|
||||
assignment->set_reason(0);
|
||||
ToAccount(me, receivedRemoved, &friends::v2::client::FriendsListener::OnReceivedInvitationRemoved);
|
||||
|
||||
friends::v2::client::SentInvitationRemovedNotification sentRemoved;
|
||||
assignment = sentRemoved.add_assignments();
|
||||
assignment->set_invitation_id(request->invitation_id());
|
||||
assignment->set_reason(0);
|
||||
ToAccount(inviterId, sentRemoved, &friends::v2::client::FriendsListener::OnSentInvitationRemoved);
|
||||
|
||||
friends::v2::client::FriendAddedNotification addedForMe;
|
||||
FillFriend(addedForMe.add_friends(), inviter->Id, inviter->BattleTag, created);
|
||||
ToAccount(me, addedForMe, &friends::v2::client::FriendsListener::OnFriendAdded);
|
||||
|
||||
friends::v2::client::FriendAddedNotification addedForInviter;
|
||||
FillFriend(addedForInviter.add_friends(), self->Id, self->BattleTag, created);
|
||||
ToAccount(inviterId, addedForInviter, &friends::v2::client::FriendsListener::OnFriendAdded);
|
||||
|
||||
// each one's presence to the other
|
||||
SendAccountPresence(_session, *inviter);
|
||||
if (Player* inviterPlayer = FindOnlinePlayer(inviterId))
|
||||
SendAccountPresence(inviterPlayer->GetSession(), *self);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::RemoveInvitation(uint64 invitationId, bool asInvitee, uint32 reason)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
QueryResult result = LoginDatabase.PQuery("SELECT inviter_account_id, invitee_account_id FROM battlenet_friend_invitations WHERE id = {} AND {} = {}",
|
||||
invitationId, asInvitee ? "invitee_account_id" : "inviter_account_id", me);
|
||||
if (!result)
|
||||
return ERROR_FRIENDS_INVALID_INVITATION;
|
||||
uint32 const inviterId = (*result)[0].GetUInt32();
|
||||
uint32 const inviteeId = (*result)[1].GetUInt32();
|
||||
LoginDatabase.DirectPExecute("DELETE FROM battlenet_friend_invitations WHERE id = {}", invitationId);
|
||||
|
||||
friends::v2::client::SentInvitationRemovedNotification sentRemoved;
|
||||
bgs::protocol::friends::v2::client::RemovedInvitationAssignment* assignment = sentRemoved.add_assignments();
|
||||
assignment->set_invitation_id(invitationId);
|
||||
assignment->set_reason(reason);
|
||||
ToAccount(inviterId, sentRemoved, &friends::v2::client::FriendsListener::OnSentInvitationRemoved);
|
||||
|
||||
friends::v2::client::ReceivedInvitationRemovedNotification receivedRemoved;
|
||||
assignment = receivedRemoved.add_assignments();
|
||||
assignment->set_invitation_id(invitationId);
|
||||
assignment->set_reason(reason);
|
||||
ToAccount(inviteeId, receivedRemoved, &friends::v2::client::FriendsListener::OnReceivedInvitationRemoved);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleRevokeInvitation(friends::v2::client::RevokeInvitationRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return RemoveInvitation(request->invitation_id(), false, 2);
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleRevokeAllInvitations(friends::v2::client::RevokeAllInvitationsRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
std::vector<uint64> ids;
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT id FROM battlenet_friend_invitations WHERE inviter_account_id = {}", _session->GetBattlenetAccountId()))
|
||||
{
|
||||
do
|
||||
ids.push_back((*result)[0].GetUInt32());
|
||||
while (result->NextRow());
|
||||
}
|
||||
for (uint64 id : ids)
|
||||
RemoveInvitation(id, false, 2);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleIgnoreInvitation(friends::v2::client::IgnoreInvitationRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return RemoveInvitation(request->invitation_id(), true, 1);
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleRemoveFriend(friends::v2::client::RemoveFriendRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
uint32 const other = uint32(request->target_account_id());
|
||||
if (!AreFriends(me, other))
|
||||
return ERROR_FRIENDS_FRIENDSHIP_DOES_NOT_EXIST;
|
||||
|
||||
LoginDatabase.DirectPExecute("DELETE FROM battlenet_friends WHERE (account_id = {0} AND friend_account_id = {1}) OR (account_id = {1} AND friend_account_id = {0})", me, other);
|
||||
ReloadFriendCache(me);
|
||||
ReloadFriendCache(other);
|
||||
|
||||
friends::v2::client::FriendRemovedNotification removedForMe;
|
||||
removedForMe.add_assignments()->set_id(other);
|
||||
ToAccount(me, removedForMe, &friends::v2::client::FriendsListener::OnFriendRemoved);
|
||||
|
||||
friends::v2::client::FriendRemovedNotification removedForOther;
|
||||
removedForOther.add_assignments()->set_id(me);
|
||||
ToAccount(other, removedForOther, &friends::v2::client::FriendsListener::OnFriendRemoved);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 FriendsService::HandleUpdateFriendState(friends::v2::client::UpdateFriendStateRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
uint32 const other = uint32(request->target_account_id());
|
||||
if (!AreFriends(me, other))
|
||||
return ERROR_FRIENDS_FRIENDSHIP_DOES_NOT_EXIST;
|
||||
|
||||
if (request->options().has_note())
|
||||
{
|
||||
std::string note = request->options().note();
|
||||
if (note.length() > 127)
|
||||
return ERROR_FRIENDS_NOTE_MAX_SIZE_EXCEEDED;
|
||||
LoginDatabase.EscapeString(note);
|
||||
LoginDatabase.DirectPExecute("UPDATE battlenet_friends SET note = '{}' WHERE account_id = {} AND friend_account_id = {}", note, me, other);
|
||||
}
|
||||
|
||||
friends::v2::client::UpdateFriendStateNotification updated;
|
||||
bgs::protocol::friends::v2::client::FriendStateAssignment* assignment = updated.add_assignments();
|
||||
assignment->set_id(other);
|
||||
if (request->options().has_note())
|
||||
assignment->set_note(request->options().note());
|
||||
ToAccount(me, updated, &friends::v2::client::FriendsListener::OnUpdateFriendState);
|
||||
return ERROR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Battlenet::Services
|
||||
{
|
||||
PresenceService::PresenceService(WorldSession* session) : BaseService(session) { }
|
||||
|
||||
uint32 PresenceService::HandleBatchSubscribe(presence::v2::client::BatchSubscribeRequest const* request, NoData* response,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& continuation)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
std::vector<uint64> ids(request->account_ids().begin(), request->account_ids().end());
|
||||
continuation(this, ERROR_OK, response);
|
||||
continuation = nullptr;
|
||||
for (uint64 id : ids)
|
||||
if (uint32(id) != me && AreFriends(me, uint32(id)))
|
||||
if (Optional<AccountInfo> account = GetAccount(uint32(id)))
|
||||
SendAccountPresence(_session, *account);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 PresenceService::HandleBatchUnsubscribe(presence::v2::client::BatchUnsubscribeRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 PresenceService::HandleQuery(presence::v2::client::QueryRequest const* request, presence::v2::client::QueryResponse* response,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
uint32 const target = uint32(request->account_id());
|
||||
if (target != me && !AreFriends(me, target))
|
||||
return ERROR_OK;
|
||||
|
||||
Optional<AccountInfo> account = GetAccount(target);
|
||||
if (!account)
|
||||
return ERROR_OK;
|
||||
|
||||
uint64 const now = NowUs();
|
||||
Player const* player = FindOnlinePlayer(target);
|
||||
if (player && target != me && GetStatus(target).AppearOffline)
|
||||
player = nullptr;
|
||||
FillAccountState(response->add_states(), *account, player, !player && target != me && IsOnlineAnywhere(target), now);
|
||||
if (player)
|
||||
FillGameAccountState(response->add_states(), *account, player->GetSession(), player, now);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 PresenceService::HandleUpdate(presence::v2::client::UpdateRequest const* request, NoData* response,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& continuation)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
bool wasHidden = false;
|
||||
bool hidden = false;
|
||||
{
|
||||
std::scoped_lock guard(StatusLock);
|
||||
PresenceStatus& status = StatusCache[me];
|
||||
wasHidden = status.AppearOffline;
|
||||
for (presence::v2::PresenceFieldUpdate const& update : request->updates())
|
||||
{
|
||||
if (update.key().title_id() != ProgramBN || update.key().group() != 1)
|
||||
continue;
|
||||
uint32 const field = update.key().field();
|
||||
if (update.delete_() || !update.has_value())
|
||||
status.Fields.erase(field);
|
||||
else
|
||||
status.Fields[field] = update.value();
|
||||
if (field == AccountAppearOffline)
|
||||
status.AppearOffline = !update.delete_() && update.value().bool_value();
|
||||
}
|
||||
hidden = status.AppearOffline;
|
||||
}
|
||||
|
||||
TC_LOG_INFO("network.rpc", "{} presence update: {}", _session->GetPlayerInfo(), request->ShortDebugString());
|
||||
|
||||
// reply, then echo the new values to ourselves and tell our friends
|
||||
continuation(this, ERROR_OK, response);
|
||||
continuation = nullptr;
|
||||
|
||||
uint64 const now = NowUs();
|
||||
presence::v2::PresenceStateUpdatedNotification own;
|
||||
presence::v2::PresenceFieldState* state = own.add_states();
|
||||
state->set_account_id(me);
|
||||
state->set_oldest_time_us(now);
|
||||
for (presence::v2::PresenceFieldUpdate const& update : request->updates())
|
||||
{
|
||||
presence::v2::PresenceField* field = state->add_fields();
|
||||
*field->mutable_key() = update.key();
|
||||
if (update.has_value())
|
||||
*field->mutable_value() = update.value();
|
||||
if (update.delete_())
|
||||
field->set_deleted(true);
|
||||
field->set_updated_time_us(now);
|
||||
}
|
||||
SendPresence(_session, own);
|
||||
|
||||
Optional<AccountInfo> account = GetAccount(me);
|
||||
if (!account || (hidden && wasHidden))
|
||||
return ERROR_OK;
|
||||
for (uint32 friendId : CachedFriendIds(me))
|
||||
if (Player* friendPlayer = FindOnlinePlayer(friendId))
|
||||
SendAccountPresence(friendPlayer->GetSession(), *account);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
WhisperService::WhisperService(WorldSession* session) : BaseService(session) { }
|
||||
|
||||
uint32 WhisperService::HandleSubscribe(whisper::v2::client::SubscribeRequest const* /*request*/, whisper::v2::client::SubscribeResponse* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 WhisperService::HandleUnsubscribe(whisper::v2::client::UnsubscribeRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 WhisperService::HandleGetWhisperHistory(whisper::v2::client::GetWhisperHistoryRequest const* /*request*/,
|
||||
whisper::v2::client::GetWhisperHistoryResponse* response, std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
response->set_continuation(0);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 WhisperService::HandleSendWhisper(whisper::v2::client::SendWhisperRequest const* request, whisper::v2::client::SendWhisperResponse* response,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
static std::atomic<uint64> position = 0;
|
||||
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
uint32 const target = uint32(request->target_account_id());
|
||||
std::string const& text = request->options().content();
|
||||
if (text.empty() || text.length() > 255 || !AreFriends(me, target))
|
||||
return ERROR_INVALID_TARGET_ID;
|
||||
|
||||
Player* receiver = FindOnlinePlayer(target);
|
||||
if (!receiver)
|
||||
return ERROR_FRIENDS_RECEIVED_INVITATION_UNDELIVERABLE; // not playing on this realm: the client says the friend is offline
|
||||
|
||||
uint64 const now = NowUs();
|
||||
whisper::v2::Whisper* whisper = response->mutable_whisper();
|
||||
whisper->mutable_whisper_id()->set_epoch(now);
|
||||
whisper->mutable_whisper_id()->set_position(++position);
|
||||
whisper->set_sender_account_id(me);
|
||||
whisper->set_receiver_account_id(target);
|
||||
whisper->set_title_id(ProgramWoW);
|
||||
whisper->set_content(text);
|
||||
|
||||
Optional<AccountInfo> self = GetAccount(me);
|
||||
whisper::v2::client::WhisperNotification notification;
|
||||
notification.set_subscriber_account_id(target);
|
||||
*notification.mutable_whisper() = *whisper;
|
||||
if (self && !self->BattleTag.empty())
|
||||
notification.set_target_battle_tag(self->BattleTag);
|
||||
SetHandle(notification.mutable_target_game_account(), _session->GetAccountId());
|
||||
Battlenet::WorldserverService<whisper::v2::client::WhisperListener>(receiver->GetSession()).OnWhisper(¬ification, true, true);
|
||||
|
||||
TC_LOG_INFO("chat.log.whisper", "{} Battle.net whisper to account {}: {}", _session->GetPlayerInfo(), target, text);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 WhisperService::HandleAdvanceViewTime(whisper::v2::client::AdvanceViewTimeRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 WhisperService::HandleAdvanceClearTime(whisper::v2::client::AdvanceClearTimeRequest const* /*request*/, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
uint32 WhisperService::HandleSetTypingIndicator(whisper::v2::client::SetTypingIndicatorRequest const* request, NoData* /*response*/,
|
||||
std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& /*continuation*/)
|
||||
{
|
||||
uint32 const me = _session->GetBattlenetAccountId();
|
||||
uint32 const target = uint32(request->target_account_id());
|
||||
if (!AreFriends(me, target))
|
||||
return ERROR_OK;
|
||||
|
||||
if (Player* receiver = FindOnlinePlayer(target))
|
||||
{
|
||||
whisper::v2::client::TypingIndicatorNotification notification;
|
||||
notification.set_subscriber_account_id(target);
|
||||
notification.set_target_account_id(me);
|
||||
notification.set_indicator(request->indicator());
|
||||
Battlenet::WorldserverService<whisper::v2::client::WhisperListener>(receiver->GetSession()).OnTypingIndicator(¬ification, true, true);
|
||||
}
|
||||
return ERROR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlenetPresence::OnLogin(WorldSession* session)
|
||||
{
|
||||
uint32 const accountId = session->GetBattlenetAccountId();
|
||||
Player const* player = session->GetPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
{
|
||||
std::vector<uint32> ids = LoadFriendIds(accountId);
|
||||
std::scoped_lock guard(FriendCacheLock);
|
||||
FriendCache[accountId] = std::move(ids);
|
||||
}
|
||||
|
||||
AccountInfo account = GetAccount(accountId).value_or(AccountInfo{ accountId, "" });
|
||||
uint64 const now = NowUs();
|
||||
|
||||
// own presence: the client takes its BattleTag from it
|
||||
bgs::protocol::presence::v2::PresenceStateUpdatedNotification own;
|
||||
FillAccountState(own.add_states(), account, player, false, now);
|
||||
FillGameAccountState(own.add_states(), account, session, player, now);
|
||||
SendPresence(session, own);
|
||||
TC_LOG_INFO("network.rpc", "{} presence: own state (BattleTag '{}')", session->GetPlayerInfo(), account.BattleTag);
|
||||
|
||||
// we are online: tell our friends
|
||||
NotifyFriends(accountId, [&](bgs::protocol::presence::v2::PresenceStateUpdatedNotification& notification)
|
||||
{
|
||||
FillAccountState(notification.add_states(), account, player, false, now);
|
||||
FillGameAccountState(notification.add_states(), account, session, player, now);
|
||||
});
|
||||
}
|
||||
|
||||
void BattlenetPresence::OnLogout(WorldSession* session)
|
||||
{
|
||||
uint32 const accountId = session->GetBattlenetAccountId();
|
||||
AccountInfo account = GetAccount(accountId).value_or(AccountInfo{ accountId, "" });
|
||||
uint64 const now = NowUs();
|
||||
NotifyFriends(accountId, [&](bgs::protocol::presence::v2::PresenceStateUpdatedNotification& notification)
|
||||
{
|
||||
FillAccountState(notification.add_states(), account, nullptr, false, now);
|
||||
FillGameAccountState(notification.add_states(), account, session, nullptr, now);
|
||||
});
|
||||
|
||||
{
|
||||
std::scoped_lock guard(FriendCacheLock);
|
||||
FriendCache.erase(accountId);
|
||||
}
|
||||
std::scoped_lock guard(StatusLock);
|
||||
StatusCache.erase(accountId);
|
||||
}
|
||||
|
||||
void BattlenetPresence::OnCharacterChanged(Player const* player)
|
||||
{
|
||||
WorldSession* session = player->GetSession();
|
||||
if (!session || !player->IsInWorld())
|
||||
return;
|
||||
|
||||
uint32 const accountId = session->GetBattlenetAccountId();
|
||||
if (CachedFriendIds(accountId).empty() || GetStatus(accountId).AppearOffline)
|
||||
return;
|
||||
|
||||
AccountInfo account = GetAccount(accountId).value_or(AccountInfo{ accountId, "" });
|
||||
uint64 const now = NowUs();
|
||||
NotifyFriends(accountId, [&](bgs::protocol::presence::v2::PresenceStateUpdatedNotification& notification)
|
||||
{
|
||||
FillGameAccountState(notification.add_states(), account, session, player, now);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITYCORE_FRIENDS_SERVICE_H
|
||||
#define TRINITYCORE_FRIENDS_SERVICE_H
|
||||
|
||||
#include "WorldserverService.h"
|
||||
#include "Client/api/client/v2/friends_service.pb.h"
|
||||
#include "Client/api/client/v2/presence_service.pb.h"
|
||||
#include "Client/api/client/v2/whisper_service.pb.h"
|
||||
|
||||
class Player;
|
||||
|
||||
// Battle.net friends (BattleTag friends) for the Classic 1.60 client. In game the client sends its Battle.net calls through the world
|
||||
// connection (CMSG_BATTLENET_REQUEST); the official server answers friends v2 Subscribe / GetSentInvitations / GetReceivedInvitations /
|
||||
// GetFriends at login and pushes presence (presence v2 PresenceListener.OnPresenceStateUpdated), which carries BattleTags, who is online
|
||||
// and their character. Friends and invitations are in auth (battlenet_friends, battlenet_friend_invitations), shared by every realm.
|
||||
namespace Battlenet::Services
|
||||
{
|
||||
class FriendsService : public WorldserverService<friends::v2::client::FriendsService>
|
||||
{
|
||||
typedef WorldserverService<friends::v2::client::FriendsService> BaseService;
|
||||
|
||||
public:
|
||||
FriendsService(WorldSession* session);
|
||||
|
||||
uint32 HandleSubscribe(friends::v2::client::SubscribeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleUnsubscribe(friends::v2::client::UnsubscribeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleGetSentInvitations(friends::v2::client::GetSentInvitationsRequest const* request, friends::v2::client::GetSentInvitationsResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleGetReceivedInvitations(friends::v2::client::GetReceivedInvitationsRequest const* request, friends::v2::client::GetReceivedInvitationsResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleGetFriends(friends::v2::client::GetFriendsRequest const* request, friends::v2::client::GetFriendsResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleIsFriend(friends::v2::client::IsFriendRequest const* request, friends::v2::client::IsFriendResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleSendInvitation(friends::v2::client::SendInvitationRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleAcceptInvitation(friends::v2::client::AcceptInvitationRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleRevokeInvitation(friends::v2::client::RevokeInvitationRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleRevokeAllInvitations(friends::v2::client::RevokeAllInvitationsRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleIgnoreInvitation(friends::v2::client::IgnoreInvitationRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleRemoveFriend(friends::v2::client::RemoveFriendRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleUpdateFriendState(friends::v2::client::UpdateFriendStateRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
|
||||
private:
|
||||
uint32 RemoveInvitation(uint64 invitationId, bool asInvitee, uint32 reason);
|
||||
};
|
||||
|
||||
// Battle.net presence (presence v2): the client's own status (away / busy / appear offline) and presence queries
|
||||
class PresenceService : public WorldserverService<presence::v2::client::PresenceService>
|
||||
{
|
||||
typedef WorldserverService<presence::v2::client::PresenceService> BaseService;
|
||||
|
||||
public:
|
||||
PresenceService(WorldSession* session);
|
||||
|
||||
uint32 HandleBatchSubscribe(presence::v2::client::BatchSubscribeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleBatchUnsubscribe(presence::v2::client::BatchUnsubscribeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleQuery(presence::v2::client::QueryRequest const* request, presence::v2::client::QueryResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleUpdate(presence::v2::client::UpdateRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
};
|
||||
|
||||
// Battle.net whispers between friends (whisper v2), delivered when the friend plays on this realm
|
||||
class WhisperService : public WorldserverService<whisper::v2::client::WhisperService>
|
||||
{
|
||||
typedef WorldserverService<whisper::v2::client::WhisperService> BaseService;
|
||||
|
||||
public:
|
||||
WhisperService(WorldSession* session);
|
||||
|
||||
uint32 HandleSubscribe(whisper::v2::client::SubscribeRequest const* request, whisper::v2::client::SubscribeResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleUnsubscribe(whisper::v2::client::UnsubscribeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleGetWhisperHistory(whisper::v2::client::GetWhisperHistoryRequest const* request, whisper::v2::client::GetWhisperHistoryResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleSendWhisper(whisper::v2::client::SendWhisperRequest const* request, whisper::v2::client::SendWhisperResponse* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleAdvanceViewTime(whisper::v2::client::AdvanceViewTimeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleAdvanceClearTime(whisper::v2::client::AdvanceClearTimeRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
uint32 HandleSetTypingIndicator(whisper::v2::client::SetTypingIndicatorRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
|
||||
};
|
||||
}
|
||||
|
||||
namespace BattlenetPresence
|
||||
{
|
||||
TC_GAME_API void OnLogin(WorldSession* session); // character in world: own presence, and tell online friends
|
||||
TC_GAME_API void OnLogout(WorldSession* session); // tell online friends we went offline
|
||||
TC_GAME_API void OnCharacterChanged(Player const* player); // zone or level: tell online friends
|
||||
}
|
||||
|
||||
#endif // TRINITYCORE_FRIENDS_SERVICE_H
|
||||
@@ -28,18 +28,18 @@ Battlenet::WorldserverServiceDispatcher::WorldserverServiceDispatcher()
|
||||
AddService<Services::ClubService>();
|
||||
AddService<WorldserverService<connection::v1::ConnectionService>>();
|
||||
AddService<WorldserverService<friends::v1::FriendsService>>();
|
||||
AddService<WorldserverService<friends::v2::client::FriendsService>>();
|
||||
AddService<Services::FriendsService>();
|
||||
AddService<WorldserverService<game_utilities::v1::GameUtilitiesService>>();
|
||||
AddService<Services::GameUtilitiesService>();
|
||||
AddService<WorldserverService<notification::v1::NotificationService>>();
|
||||
AddService<WorldserverService<notification::v2::client::NotificationService>>();
|
||||
AddService<WorldserverService<presence::v1::PresenceService>>();
|
||||
AddService<WorldserverService<presence::v2::client::PresenceService>>();
|
||||
AddService<Services::PresenceService>();
|
||||
AddService<WorldserverService<report::v1::ReportService>>();
|
||||
AddService<WorldserverService<report::v2::ReportService>>();
|
||||
AddService<WorldserverService<report::v3::client::ReportService>>();
|
||||
AddService<WorldserverService<resources::v1::ResourcesService>>(); // Classic: Services::ResourcesService (fake content handle) made the client wait on 'Retrieving character list'
|
||||
AddService<WorldserverService<whisper::v2::client::WhisperService>>();
|
||||
AddService<Services::WhisperService>();
|
||||
}
|
||||
|
||||
void Battlenet::WorldserverServiceDispatcher::Dispatch(WorldSession* session, uint32 serviceHash, uint32 token, uint32 methodId, MessageBuffer buffer)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "Client/connection_service.pb.h"
|
||||
#include "Client/friends_service.pb.h"
|
||||
#include "Client/api/client/v2/friends_service.pb.h"
|
||||
#include "FriendsService.h"
|
||||
#include "WorldserverGameUtilitiesService.h"
|
||||
#include "Client/notification_service.pb.h"
|
||||
#include "Client/api/client/v2/notification_listener.pb.h"
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Classic 1.60 Social window, Allies tab. Layouts from an official sniff (70235, 2026-10-06):
|
||||
// window opens: Classic CMSG 0x44017C (no data) -> SMSG 0x460359 uint32 0, and CMSG 0x44019C (uint32 0) -> SMSG 0x460364:
|
||||
// uint32 count, per ally { packed player guid, 16 bytes (0 in every entry seen), uint32 n,
|
||||
// n x { uint8 type, int64 unix time, int32 value, int32 0 }, uint32 0 }
|
||||
// Interaction types are the client's Enum.RolodexType (order from Blizzard_RecentAlliesUtil.lua): 0 None, 1 PartyMember, 2 RaidMember,
|
||||
// 3 Trade, 4 Whisper, 5-10 crafting orders, 11 CreatureKill ("fought together"), 12 CompleteDungeon, ... The value is the area the
|
||||
// interaction happened in (official sniff: 11 with 16600..16850, 3 / 4 with 0). At most one per type and ally.
|
||||
|
||||
#include "RecentAllies.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Creature.h"
|
||||
#include "Log.h"
|
||||
#include "StringFormat.h"
|
||||
#include "ThreatManager.h"
|
||||
#include <mutex>
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr uint8 InteractionPartyMember = 1;
|
||||
constexpr uint8 InteractionRaidMember = 2;
|
||||
constexpr uint8 InteractionTrade = 3;
|
||||
constexpr uint8 InteractionWhisper = 4;
|
||||
constexpr uint8 InteractionCreatureKill = 11;
|
||||
constexpr time_t KeepSeconds = 30 * DAY;
|
||||
constexpr size_t MaxAllies = 50;
|
||||
constexpr time_t RepeatSeconds = 5 * MINUTE; // whispers and kills: the same pair is saved again at most every 5 minutes
|
||||
constexpr size_t MaxFightersPerKill = 10;
|
||||
|
||||
void Record(ObjectGuid const& who, ObjectGuid const& ally, uint8 type, uint32 value)
|
||||
{
|
||||
CharacterDatabase.PExecute("REPLACE INTO character_recent_allies (guid, ally, type, time, value) VALUES ({}, {}, {}, {}, {})",
|
||||
who.GetCounter(), ally.GetCounter(), type, uint64(GameTime::GetGameTime()), value);
|
||||
}
|
||||
|
||||
// both directions; throttled interactions are skipped when the pair was saved less than RepeatSeconds ago
|
||||
void RecordPair(ObjectGuid const& a, ObjectGuid const& b, uint8 type, uint32 value, bool throttled)
|
||||
{
|
||||
if (a == b)
|
||||
return;
|
||||
|
||||
if (throttled)
|
||||
{
|
||||
static std::mutex lock;
|
||||
static std::unordered_map<std::string, time_t> lastSaved;
|
||||
ObjectGuid::LowType const low = std::min(a.GetCounter(), b.GetCounter());
|
||||
ObjectGuid::LowType const high = std::max(a.GetCounter(), b.GetCounter());
|
||||
std::string const key = Trinity::StringFormat("{}:{}:{}", low, high, type);
|
||||
time_t const now = GameTime::GetGameTime();
|
||||
|
||||
std::scoped_lock guard(lock);
|
||||
if (lastSaved.size() > 100000)
|
||||
lastSaved.clear();
|
||||
time_t& last = lastSaved[key];
|
||||
if (now - last < RepeatSeconds)
|
||||
return;
|
||||
last = now;
|
||||
}
|
||||
|
||||
Record(a, b, type, value);
|
||||
Record(b, a, type, value);
|
||||
}
|
||||
}
|
||||
|
||||
void RecentAllies::OnGroupJoin(Group const* group, Player const* newcomer)
|
||||
{
|
||||
if (!group || !newcomer)
|
||||
return;
|
||||
|
||||
uint32 const zone = newcomer->GetZoneId();
|
||||
uint8 const type = group->isRaidGroup() ? InteractionRaidMember : InteractionPartyMember;
|
||||
for (Group::MemberSlot const& slot : group->GetMemberSlots())
|
||||
{
|
||||
if (slot.guid == newcomer->GetGUID())
|
||||
continue;
|
||||
RecordPair(newcomer->GetGUID(), slot.guid, type, zone, false);
|
||||
}
|
||||
}
|
||||
|
||||
void RecentAllies::OnTrade(Player const* player, Player const* trader)
|
||||
{
|
||||
if (player && trader)
|
||||
RecordPair(player->GetGUID(), trader->GetGUID(), InteractionTrade, 0, false);
|
||||
}
|
||||
|
||||
void RecentAllies::OnWhisper(Player const* sender, Player const* receiver)
|
||||
{
|
||||
if (sender && receiver)
|
||||
RecordPair(sender->GetGUID(), receiver->GetGUID(), InteractionWhisper, 0, true);
|
||||
}
|
||||
|
||||
void RecentAllies::OnCreatureKill(Creature* creature)
|
||||
{
|
||||
if (!creature || creature->IsPet() || creature->IsTotem())
|
||||
return;
|
||||
|
||||
std::vector<ObjectGuid> fighters;
|
||||
for (ThreatReference const* ref : creature->GetThreatManager().GetUnsortedThreatList())
|
||||
{
|
||||
Player const* player = ref->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (player && std::ranges::find(fighters, player->GetGUID()) == fighters.end())
|
||||
fighters.push_back(player->GetGUID());
|
||||
if (fighters.size() >= MaxFightersPerKill)
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 const zone = creature->GetZoneId();
|
||||
for (std::size_t i = 0; i < fighters.size(); ++i)
|
||||
for (std::size_t j = i + 1; j < fighters.size(); ++j)
|
||||
RecordPair(fighters[i], fighters[j], InteractionCreatureKill, zone, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRecentAllyProbe(WorldPackets::Null& packet)
|
||||
{
|
||||
WorldPacket const* raw = packet.GetRawPacket();
|
||||
switch (packet.GetOpcode())
|
||||
{
|
||||
case CMSG_CLASSIC_SOCIAL_WINDOW_OPEN:
|
||||
{
|
||||
WorldPacket response(SMSG_CLASSIC_SOCIAL_WINDOW_OPEN_RESPONSE, 4);
|
||||
response << uint32(0);
|
||||
SendPacket(&response);
|
||||
break;
|
||||
}
|
||||
case CMSG_RECENT_ALLY_REQUEST_DATA:
|
||||
{
|
||||
ObjectGuid::LowType const me = _player->GetGUID().GetCounter();
|
||||
time_t const since = GameTime::GetGameTime() - KeepSeconds;
|
||||
CharacterDatabase.PExecute("DELETE FROM character_recent_allies WHERE guid = {} AND time < {}", me, uint64(since));
|
||||
|
||||
// allies by their latest interaction, newest first; each with its interactions (one per type)
|
||||
std::vector<std::pair<ObjectGuid::LowType, std::vector<std::tuple<uint8, int64, int32>>>> allies;
|
||||
if (QueryResult result = CharacterDatabase.PQuery(
|
||||
"SELECT ally, type, time, value FROM character_recent_allies WHERE guid = {} AND time >= {} ORDER BY time DESC", me, uint64(since)))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
ObjectGuid::LowType const ally = fields[0].GetUInt64();
|
||||
auto itr = std::find_if(allies.begin(), allies.end(), [&](auto const& a) { return a.first == ally; });
|
||||
if (itr == allies.end())
|
||||
{
|
||||
if (allies.size() >= MaxAllies)
|
||||
continue;
|
||||
itr = allies.emplace(allies.end(), ally, std::vector<std::tuple<uint8, int64, int32>>());
|
||||
}
|
||||
itr->second.emplace_back(fields[1].GetUInt8(), int64(fields[2].GetUInt64()), int32(fields[3].GetUInt32()));
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
WorldPacket response(SMSG_RECENT_ALLY_LIST, 4 + allies.size() * 48);
|
||||
response << uint32(allies.size());
|
||||
for (auto const& [ally, interactions] : allies)
|
||||
{
|
||||
// online allies: their zone in the 4th uint32 and uint32 0xC0000000 after the interactions (official sniff: an online
|
||||
// ally in Thunder Bluff had 0, 0, 0, 1638 and 00 00 00 C0; offline ones all zero)
|
||||
ObjectGuid const allyGuid = ObjectGuid::Create<HighGuid::Player>(ally);
|
||||
Player const* online = ObjectAccessor::FindConnectedPlayer(allyGuid);
|
||||
response << allyGuid;
|
||||
response << uint32(0) << uint32(0) << uint32(0) << uint32(online ? online->GetZoneId() : 0);
|
||||
response << uint32(interactions.size());
|
||||
for (auto const& [type, time, value] : interactions)
|
||||
{
|
||||
response << uint8(type);
|
||||
response << int64(time);
|
||||
response << int32(value);
|
||||
response << int32(0);
|
||||
}
|
||||
response << uint32(online ? 0xC0000000 : 0);
|
||||
}
|
||||
SendPacket(&response);
|
||||
break;
|
||||
}
|
||||
default: // CMSG_RECENT_ALLY_SET_NOTE: layout not seen yet; logged to learn it
|
||||
TC_LOG_INFO("network.opcode", "RecentAllies: {} size {} data {} from {}", GetOpcodeNameForLogging(packet.GetOpcode()), raw->size(),
|
||||
Trinity::Impl::ByteArrayToHexStr(raw->data(), std::min<size_t>(raw->size(), 256)), GetPlayerInfo());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_RECENT_ALLIES_H
|
||||
#define TRINITY_RECENT_ALLIES_H
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
class Creature;
|
||||
class Group;
|
||||
class Player;
|
||||
|
||||
// The Allies tab of the Classic 1.60 Social window: players you grouped, traded, whispered or fought with in the last 30 days
|
||||
// (characters.character_recent_allies).
|
||||
namespace RecentAllies
|
||||
{
|
||||
TC_GAME_API void OnGroupJoin(Group const* group, Player const* newcomer);
|
||||
TC_GAME_API void OnTrade(Player const* player, Player const* trader);
|
||||
TC_GAME_API void OnWhisper(Player const* sender, Player const* receiver);
|
||||
TC_GAME_API void OnCreatureKill(Creature* creature); // "fought together": every player fighting the creature when it died
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1331,6 +1331,31 @@ std::array<SpellEffectInfo::StaticData, TOTAL_SPELL_EFFECTS> SpellEffectInfo::_d
|
||||
{EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_ITEM}, // 360 SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY_2
|
||||
} };
|
||||
|
||||
// Classic 1.60 seal -> judgement (client SpellEffect: seal effect 2 is a dummy whose points are the judgement spell). 20154, the Forever
|
||||
// Seal of Righteousness rank 1 without that effect, unleashes Judgement of Righteousness rank 1 like 21084.
|
||||
static std::unordered_map<uint32, uint32> const ClassicSealJudgements =
|
||||
{
|
||||
{ 20154, 20187 }, { 21084, 20187 }, // Seal of Righteousness
|
||||
{ 20287, 20280 }, { 20288, 20281 }, { 20289, 20282 }, { 20290, 20283 }, { 20291, 20284 }, { 20292, 20285 }, { 20293, 20286 },
|
||||
{ 21082, 21183 }, { 20162, 20188 }, { 20305, 20300 }, { 20306, 20301 }, { 20307, 20302 }, { 20308, 20303 }, // Seal of the Crusader
|
||||
{ 20164, 20184 }, // Seal of Justice
|
||||
{ 20165, 20185 }, { 20347, 20344 }, { 20348, 20345 }, { 20349, 20346 }, // Seal of Light
|
||||
{ 20166, 20186 }, { 20356, 20354 }, { 20357, 20355 }, // Seal of Wisdom
|
||||
{ 20375, 20425 }, { 20915, 20962 }, { 20918, 20961 }, { 20919, 20967 }, { 20920, 20968 }, // Seal of Command
|
||||
{ 407798, 407803 }, // Seal of Martyrdom
|
||||
};
|
||||
|
||||
bool IsClassicPaladinSeal(uint32 spellId)
|
||||
{
|
||||
return ClassicSealJudgements.contains(spellId);
|
||||
}
|
||||
|
||||
uint32 GetClassicSealJudgement(uint32 sealSpellId)
|
||||
{
|
||||
auto itr = ClassicSealJudgements.find(sealSpellId);
|
||||
return itr != ClassicSealJudgements.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, SpellInfoLoadHelper const& data)
|
||||
: Id(spellName->ID), Difficulty(difficulty)
|
||||
{
|
||||
@@ -2728,6 +2753,10 @@ void SpellInfo::_LoadAuraState()
|
||||
{
|
||||
_auraState = [this]()->AuraStateType
|
||||
{
|
||||
// Classic 1.60: an active seal is what Judgement (20271, CasterAuraState 5) needs
|
||||
if (IsClassicPaladinSeal(Id))
|
||||
return AURA_STATE_MARKED;
|
||||
|
||||
// Faerie Fire (Feral)
|
||||
if (GetCategory() == 1133)
|
||||
return AURA_STATE_FAERIE_FIRE;
|
||||
@@ -2817,6 +2846,9 @@ void SpellInfo::_LoadSpellSpecific()
|
||||
{
|
||||
_spellSpecific = [this]()->SpellSpecificType
|
||||
{
|
||||
if (IsClassicPaladinSeal(Id))
|
||||
return SPELL_SPECIFIC_SEAL;
|
||||
|
||||
switch (SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_GENERIC:
|
||||
|
||||
@@ -321,6 +321,10 @@ struct SpellPowerCost
|
||||
int32 Amount;
|
||||
};
|
||||
|
||||
// Classic 1.60: paladin seals (vanilla family flags differ from retail) and the judgement each one unleashes (seal effect 2 points)
|
||||
TC_GAME_API bool IsClassicPaladinSeal(uint32 spellId);
|
||||
TC_GAME_API uint32 GetClassicSealJudgement(uint32 sealSpellId);
|
||||
|
||||
class TC_GAME_API SpellInfo
|
||||
{
|
||||
friend class SpellMgr;
|
||||
|
||||
@@ -1210,7 +1210,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
{ 213, 1 }, { 216, 2 }, { 174, 1 }, { 206, 1 }, { 109, 1 }, { 114, 1 }, { 211, 1 }, { 112, 1 }, { 173, 1 }, { 154, 0 },
|
||||
{ 180, 0 }, { 181, 1 }, { 182, 1 }, { 195, 1 }, { 23, 1 }, { 98, 0 }, { 93, 2 }, { 102, 1 }, { 42, 1 }, { 40, 0 },
|
||||
{ 157, 1 }, { 190, 0 }, { 162, 1 }, { 209, 1 }, { 89, 1 }, { 177, 1 }, { 197, 1 }, { 199, -5 }, { 63, 1 }, { 90, 1 },
|
||||
{ 244, 1 }, { 33, 20 }, { 129, 0 }, { 228, 1 }, { 241, 1 }, { 243, 1 }, { 101, 1 }, { 237, 0 } })
|
||||
{ 244, 1 }, { 33, 20 }, { 129, 0 }, { 228, 1 }, { 241, 1 }, { 243, 1 }, { 101, 1 }, { 237, 0 },
|
||||
// official 70205 and 70235 sniffs also send these (not in 70124); 242 / 247 are suspected to switch on the new Social window tabs
|
||||
{ 70, 1 }, { 242, 1 }, { 247, 1 } })
|
||||
_gameRules.push_back({ .Rule = ::GameRule(rule), .Value = value });
|
||||
_gameRules.push_back({ .Rule = ::GameRule(200), .Value = 0.5f });
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ void AddSC_classic_go_scripts();
|
||||
void AddSC_classic_spell_scripts();
|
||||
void AddSC_classic_armory_commands();
|
||||
void AddSC_classic_legacy_commands();
|
||||
void AddSC_classic_discord_commands();
|
||||
void AddSC_classic_wetlands();
|
||||
void AddSC_classic_westfall();
|
||||
void AddSC_classic_western_plaguelands();
|
||||
@@ -388,6 +389,7 @@ void AddClassicScripts()
|
||||
AddSC_classic_spell_scripts();
|
||||
AddSC_classic_armory_commands();
|
||||
AddSC_classic_legacy_commands();
|
||||
AddSC_classic_discord_commands();
|
||||
AddSC_classic_wetlands();
|
||||
AddSC_classic_westfall();
|
||||
AddSC_classic_western_plaguelands();
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// ".discord say <name> <text>": the Discord bot (contrib/discord_bot) posts a Discord message into the in-game Discord channel
|
||||
// (DiscordChannel.h), shown as [Discord] [<name>]: <text>. Used from the console / Remote Access.
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "ChatCommand.h"
|
||||
#include "DiscordChannel.h"
|
||||
#include "GroupFinderListings.h"
|
||||
#include "RBAC.h"
|
||||
|
||||
using namespace Trinity::ChatCommands;
|
||||
|
||||
class classic_discord_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
classic_discord_commandscript() : CommandScript("classic_discord_commandscript") { }
|
||||
|
||||
std::span<ChatCommandBuilder const> GetCommands() const override
|
||||
{
|
||||
static ChatCommandTable discordCommandTable =
|
||||
{
|
||||
{ "say", HandleSayCommand, rbac::RBAC_PERM_COMMAND_ANNOUNCE, Console::Yes },
|
||||
};
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "discord", discordCommandTable },
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleSayCommand(ChatHandler* handler, std::string sender, Tail text)
|
||||
{
|
||||
if (!DiscordChannel::IsEnabled())
|
||||
{
|
||||
handler->SendSysMessage("Discord channel is off (worldserver.conf Discord.Channel.Enable = 1)");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
if (text.empty())
|
||||
return false;
|
||||
|
||||
uint32 players = DiscordChannel::Relay(sender, std::string(text));
|
||||
handler->PSendSysMessage("Discord message sent to %u players", players);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Group Finder listings for the Discord LFG channels (GroupFinderListings.h): a member joining or leaving updates the post,
|
||||
// the leader logging out removes it
|
||||
class classic_discord_group_finder_groups : public GroupScript
|
||||
{
|
||||
public:
|
||||
classic_discord_group_finder_groups() : GroupScript("classic_discord_group_finder_groups") { }
|
||||
|
||||
void OnAddMember(Group* group, ObjectGuid /*guid*/) override { GroupFinderListings::OnGroupChanged(group); }
|
||||
void OnRemoveMember(Group* group, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, char const* /*reason*/) override
|
||||
{
|
||||
GroupFinderListings::OnGroupChanged(group);
|
||||
}
|
||||
};
|
||||
|
||||
class classic_discord_group_finder_players : public PlayerScript
|
||||
{
|
||||
public:
|
||||
classic_discord_group_finder_players() : PlayerScript("classic_discord_group_finder_players") { }
|
||||
|
||||
void OnLogout(Player* player) override { GroupFinderListings::OnLogout(player); }
|
||||
};
|
||||
|
||||
void AddSC_classic_discord_commands()
|
||||
{
|
||||
new classic_discord_commandscript();
|
||||
new classic_discord_group_finder_groups();
|
||||
new classic_discord_group_finder_players();
|
||||
}
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "AreaTrigger.h"
|
||||
#include "Creature.h"
|
||||
#include "Item.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
@@ -206,8 +208,204 @@ class classic_spell_profession_book : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 20154, 21084, 20287-20293 - Seal of Righteousness: each melee swing that lands adds the rank's Holy damage spell. Vanilla formula on the
|
||||
// seal's points (which grow per level) and the weapon: slower weapons hit harder, two-handers more (sniffs of the official beta:
|
||||
// 20154 -> 25742, 21084 -> 25741, 3-6 damage at low level)
|
||||
class classic_spell_pal_seal_of_righteousness : public AuraScript
|
||||
{
|
||||
static uint32 GetDamageSpell(uint32 sealId)
|
||||
{
|
||||
switch (sealId)
|
||||
{
|
||||
case 20154: return 25742;
|
||||
case 21084: return 25741;
|
||||
case 20287: return 25740;
|
||||
case 20288: return 25739;
|
||||
case 20289: return 25738;
|
||||
case 20290: return 25737;
|
||||
case 20291: return 25736;
|
||||
case 20292: return 25735;
|
||||
case 20293: return 25713;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellInfo({ GetDamageSpell(spellInfo->Id) });
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return GetTarget()->IsPlayer() && eventInfo.GetActionTarget() && eventInfo.GetDamageInfo()
|
||||
&& eventInfo.GetDamageInfo()->GetAttackType() == BASE_ATTACK;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Player* player = GetTarget()->ToPlayer();
|
||||
Item* weapon = player->GetWeaponForAttack(BASE_ATTACK, true);
|
||||
float const speed = (weapon ? weapon->GetTemplate()->GetDelay() : BASE_ATTACK_TIME) / 1000.0f;
|
||||
float const points = float(aurEff->GetAmount());
|
||||
|
||||
float damage;
|
||||
if (weapon && weapon->GetTemplate()->GetInventoryType() == INVTYPE_2HWEAPON)
|
||||
damage = 1.2f * points * 1.2f * 1.03f * speed / 100.0f + 1.0f;
|
||||
else
|
||||
damage = 0.85f * std::ceil(points * 1.2f * 1.03f * speed / 100.0f) - 1.0f;
|
||||
damage += 0.03f * (player->GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE) + player->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE)) / 2.0f;
|
||||
|
||||
// spell power is added by the damage spell itself (its bonus coefficient)
|
||||
player->CastSpell(eventInfo.GetActionTarget(), GetDamageSpell(GetId()), CastSpellExtraArgs(aurEff)
|
||||
.AddSpellMod(SPELLVALUE_BASE_POINT0, std::max(int32(damage) + 1, 1)));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(classic_spell_pal_seal_of_righteousness::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(classic_spell_pal_seal_of_righteousness::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 20271 - Judgement: unleashes the active seal's judgement on the target; the seal stays (sniff of the official beta 2026-10-06: Seal of
|
||||
// Righteousness -> 20187, Seal of the Crusader -> 21183, Seal of Righteousness keeps adding Holy damage to the swings after Judgement)
|
||||
enum ClassicPaladinJudgement
|
||||
{
|
||||
SPELL_JUDGEMENT_OF_THE_CRUSADER_REFRESH_PROC = 25942,
|
||||
SPELL_JUDGEMENT_OF_THE_CRUSADER_REFRESH = 25943
|
||||
};
|
||||
|
||||
static bool IsCrusaderJudgement(uint32 spellId)
|
||||
{
|
||||
switch (spellId)
|
||||
{
|
||||
case 21183: case 20188: case 20300: case 20301: case 20302: case 20303:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class classic_spell_pal_judgement : public SpellScript
|
||||
{
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
for (auto const& [auraId, aurApp] : caster->GetAppliedAuras())
|
||||
{
|
||||
uint32 judgement = GetClassicSealJudgement(auraId);
|
||||
if (!judgement || aurApp->GetBase()->GetCasterGUID() != caster->GetGUID())
|
||||
continue;
|
||||
|
||||
caster->CastSpell(target, judgement, CastSpellExtraArgs(TRIGGERED_FULL_MASK).SetTriggeringSpell(GetSpell()));
|
||||
// Judgement of the Crusader: the paladin's swings keep it on the target (25942 procs 25943, which casts it again)
|
||||
if (IsCrusaderJudgement(judgement))
|
||||
caster->CastSpell(caster, SPELL_JUDGEMENT_OF_THE_CRUSADER_REFRESH_PROC, CastSpellExtraArgs(TRIGGERED_FULL_MASK).SetTriggeringSpell(GetSpell()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(classic_spell_pal_judgement::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 25943 - Judgement of the Crusader (refresh, from the 25942 swing proc): casts the paladin's Judgement of the Crusader on the target
|
||||
// again while it is on it (sniff 2026-10-06: every swing after the judgement shows 25942, 21183, 25943)
|
||||
class classic_spell_pal_judgement_of_the_crusader_refresh : public SpellScript
|
||||
{
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
for (auto const& [auraId, aurApp] : target->GetAppliedAuras())
|
||||
{
|
||||
if (!IsCrusaderJudgement(auraId) || aurApp->GetBase()->GetCasterGUID() != caster->GetGUID())
|
||||
continue;
|
||||
|
||||
caster->CastSpell(target, auraId, CastSpellExtraArgs(TRIGGERED_FULL_MASK).SetTriggeringSpell(GetSpell()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(classic_spell_pal_judgement_of_the_crusader_refresh::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 20473, 20929, 20930 - Holy Shock (trainer, levels 40/48/56): heals a friendly target or damages an enemy with the rank's spell
|
||||
// (the retail script only knows rank 1)
|
||||
class classic_spell_pal_holy_shock : public SpellScript
|
||||
{
|
||||
static std::pair<uint32, uint32> GetRankSpells(uint32 spellId) // damage, heal
|
||||
{
|
||||
switch (spellId)
|
||||
{
|
||||
case 20473: return { 25912, 25914 };
|
||||
case 20929: return { 25911, 25913 };
|
||||
case 20930: return { 25902, 25903 };
|
||||
default: return { 0, 0 };
|
||||
}
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
auto [damage, heal] = GetRankSpells(spellInfo->Id);
|
||||
return ValidateSpellInfo({ damage, heal });
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetExplTargetUnit();
|
||||
if (!target)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!caster->IsFriendlyTo(target))
|
||||
{
|
||||
if (!caster->IsValidAttackTarget(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
if (!caster->isInFront(target))
|
||||
return SPELL_FAILED_UNIT_NOT_INFRONT;
|
||||
}
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
auto [damage, heal] = GetRankSpells(GetSpellInfo()->Id);
|
||||
caster->CastSpell(target, caster->IsFriendlyTo(target) ? heal : damage, GetSpell());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(classic_spell_pal_holy_shock::CheckCast);
|
||||
OnEffectHitTarget += SpellEffectFn(classic_spell_pal_holy_shock::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_classic_spell_scripts()
|
||||
{
|
||||
RegisterSpellScript(classic_spell_pal_holy_shock);
|
||||
RegisterSpellScript(classic_spell_pal_judgement_of_the_crusader_refresh);
|
||||
RegisterSpellScript(classic_spell_pal_seal_of_righteousness);
|
||||
RegisterSpellScript(classic_spell_pal_judgement);
|
||||
RegisterSpellScript(classic_spell_profession_book);
|
||||
RegisterSpellScript(classic_spell_ground_area_damage);
|
||||
RegisterSpellScript(classic_spell_heal_injured_druid);
|
||||
|
||||
@@ -127,16 +127,18 @@ class ChatLogScript : public PlayerScript
|
||||
channel->HasFlag(CHANNEL_FLAG_CITY) ||
|
||||
channel->HasFlag(CHANNEL_FLAG_LFG));
|
||||
|
||||
// (A) / (H) after the name: the Discord bot (contrib/discord_bot) shows which faction is talking
|
||||
char const* faction = player->GetTeam() == ALLIANCE ? "A" : "H";
|
||||
if (isSystem)
|
||||
{
|
||||
TC_LOG_CHAT("system", "Player {} tells channel {}: {}",
|
||||
player->GetName(), channel->GetName(), msg);
|
||||
TC_LOG_CHAT("system", "Player {} ({}) tells channel {}: {}",
|
||||
player->GetName(), faction, channel->GetName(), msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string channelName = channel ? channel->GetName() : "<unknown>";
|
||||
TC_LOG_CHAT("channel." + channelName, "Player {} tells channel {}: {}",
|
||||
player->GetName(), channelName, msg);
|
||||
TC_LOG_CHAT("channel." + channelName, "Player {} ({}) tells channel {}: {}",
|
||||
player->GetName(), faction, channelName, msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4466,3 +4466,28 @@ Recap.Announce = 3
|
||||
# 1 - (Enabled)
|
||||
|
||||
Classic.GuildFinder = 0
|
||||
|
||||
# Classic.OfficialFeatureFlags
|
||||
# Description: Send the client feature flags exactly as the official server does (sniffs 70205/70235).
|
||||
# 0 goes back to the older hand-picked flags.
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
|
||||
Classic.OfficialFeatureFlags = 1
|
||||
|
||||
#
|
||||
# Discord.Channel.Enable
|
||||
# Description: In-game chat channel of the Discord bot (contrib/discord_bot): players join it at login (unless they left
|
||||
# it with /leave) and see the messages of the realm's Discord chat channel there. What they type in it
|
||||
# goes to Discord. Needs Logger.chat.log.channel.<Discord.Channel.Name> for the bot (see its README).
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
Discord.Channel.Enable = 0
|
||||
|
||||
#
|
||||
# Discord.Channel.Name
|
||||
# Description: Name of that channel (/join <name>, /leave <name>).
|
||||
# Default: "Discord"
|
||||
|
||||
Discord.Channel.Name = "Discord"
|
||||
|
||||
Reference in New Issue
Block a user