Skip to content

Commit

Permalink
Update READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMacocian committed Aug 11, 2024
1 parent a05ab8d commit eecae24
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 75 deletions.
2 changes: 1 addition & 1 deletion GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Services\BotStatus\BotStatusService.cs~RFec2479f.TMP" />
<None Include="README.md" />
</ItemGroup>

<ItemGroup>
Expand Down
40 changes: 40 additions & 0 deletions GuildWarsPartySearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# GuildWarsPartySeach.Server

## Building

### Local
- Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- Restore project
- Build and Launch Debug configuration

### Docker
#### Build
- `docker build -t guildwarspartysearch.server .`
- `docker create --name partysearch -p 8080:80 guildwarspartysearch.server.latest`
- For a custom configuration: `docker cp [PATH_TO_CUSTOM_CONFIG].json partysearch:/app/Config.json`
- `docker start partysearch`

#### Change configuration
- `docker stop partysearch`
- `docker cp [PATH_TO_CUSTOM_CONFIG].json partysearch:/app/Config.json`
- `docker start partysearch`

#### Change static content
- `docker stop partysearch`
- `docker cp [PATH_TO_CONTENT_DIR] partysearch:/app`
- `docker start partysearch`

#### Manually modify SQLite db
- `docker stop partysearch`
- `docker cp partysearch:/app/partysearches.db [LOCAL_PATH_FOR_DB]/partysearches.db`
- Use something like [DB4S](https://sqlitebrowser.org/) to browse and modify the database file
- `docker cp [LOCAL_PATH_FOR_DB]/partysearches.db partysearch:/app/partysearches.db`
- `docker start partysearch`

## Configuration
Found in Config.[ENV].json
- `ServerOptions.Port` dictates the port on which the server will accept connections
- `PartySearchDatabaseOptions.TableName` is the name of the party searches table in the SQLite db
- `BotHistoryDatabaseOptions.TableName` is the name of the bot actions history table in the SQLite db
- `IpWhitelistOptions.Addresses` is an array of addresses that are whitelisted by IP. These are the addresses that are allowed to open bot connections and push updates
- `ContentOptions.StagingFolder` is the relative path of the static content that is served by the server
80 changes: 6 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,10 @@
# GuildWarsPartySearch
Party Search Aggregator

## GuildWarsPartySearch.Server
## Build & Launch
Check the README files in each subproject

### Usage
- Bots connect with websocket to `party-search/update` where they push the current state of their map. Sample payload:
```json
{
"map_id": 857,
"district_region": -2,
"district_number": 1,
"district_language": 0,
"parties": [
{
"party_id": 1,
"district_number": 1,
"district_language": 0,
"message": "",
"sender": "Gaile Gray",
"party_size": 4,
"hero_count": 3,
"hard_mode": 1,
"search_type": 1,
"primary": 3,
"secondary": 10,
"level": 20
}
]
}
```
- Bots need to have `User-Agent` header set and have their IP whitelisted. `User-Agent` identifies the bot.
- The client/user connects with websocket to `party-search/live-feed`
- When the client first connects, it receives a json with all the party searches currently in the database (all the snapshots). Sample payload:
```json
{
"Searches":
[
{
"map_id":857,
"district_region":-2,
"district_number":1,
"district_language":0,
"parties":
[
{
"party_id":1,
"district_number":1,
"district_language":0,
"message":"",
"sender":"Gaile Gray",
"party_size":4,
"hero_count":3,
"hard_mode":1,
"search_type":1,
"primary":3,
"secondary":10,
"level":20
}
]
}
]
}
```
- Whenever a bot posts an update, all clients receive that update in the same json format as the first message
- There's a status page `/status/bots` where you can see a list of all the currently connected bots. You need to have your IP whitelisted set to see the page
- Check https://guildwarspartysearch.azurewebsites.net/swagger for the swagger docs and examples of the server

## GuildWarsPartySearch.BotUploader
The resulting dll needs to be injected into a running Guild Wars process.

When injecting, the dll needs a file called config.txt in the same folder.

### Config.txt
Config file that contains 3 lines.
1. Uri of the party service (guildwarspartysearch.northeurope.azurecontainer.io)
2. The API Key necesarry for the bot to access the upload endpoint
3. Bot name. This is an identifier of the bot. This appears on /status/bots when the bot is connected
## Usage
- Launch GuildWarsPartySearch.Server
- Build and run a bot from GuildWarsPartySearch.Bot
- Go to http://localhost

0 comments on commit eecae24

Please sign in to comment.