Skip to content

Commit

Permalink
Added a getting started section, and clean things up a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikechambers committed Dec 15, 2020
1 parent 70b6691 commit f9f52c3
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 16 deletions.
142 changes: 142 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,148 @@ Just download, place them in your path and run from the command line (use --help
Each tool page contains additional tool specific information and usage examples.

You can also find some additional examples in the [examples](examples/) folder.
## Getting Started

The core idea behind the project is to provide small, focused utilities that provide useful info by themselves, but that can also be combined together, or with other shell scripts to create greater functionality.

To get started, download the release (or compile from source), and place the executables somewhere within your path so you can call them from anywhere. Doing this will make it easy to call from anywhere on your system and from other sciprts.

If you are running on Mac, make sure to [read this article](https://github.com/mikechambers/dcli/wiki/Running-dcli-tools-on-Mac-OS-X) to ensure everything will run correctly.

### Download the manifest

The first thing you should do is to download the manifest using dclim. This is required to use some of the other apis.

```
$ dclim --manifest-dir /home/mesh/destiny
```
Make sure to place it in a directory where it wont get deleted.

This will download and save the manifest to `/home/mesh/destiny/manifest.sqlite3`. Remember this path as we will use it in other API calls.

### (Optional) Save data in environment variables

One useful trick, is to store some of the data you need to reuse, such as the manifest path, in environment variables.

For example, on Linux / Mac OS X, I have this placed in my `.profile` file:

```
export MANIFEST_PATH="/home/mesh/destiny/manifest.sqlite3"
```

Then, I can just use `$MANIFEST_PATH` whenever I need to use it.

Here are some resources showing how to set environment variables on [Mac OS X](https://apple.stackexchange.com/questions/106778/how-do-i-set-environment-variables-on-os-x), [Linux](https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-environment-variables-in-linux/) and [Window](https://support.shotgunsoftware.com/hc/en-us/articles/114094235653-Setting-global-environment-variables-on-Windows),

### Retrieve your member id, platform and character ids

Next, lets find the member id, platform, and character ids for your account.

```
$ dclis --name mesh --platform xbox
```

This will output something like:

```
Display Name mesh
id 4611686018429783292
Platform Xbox
Platform Id 1
```

Note that the platform may be different that what you entered depending on whether you have set up cross save.

We need to save the platform, and id. Lets store those in environment variables also:

```
export MEMBER_ID=4611686018429783292
export PLATFORM=xbox
```

Finally, lets use this information, to get our character ids.

```
$ dclic --member-id 4611686018429783292 --platform xbox
```

or, if we saved our previous data in environment variables:

```
$ dclic --member-id $MEMBER_ID --platform $PLATFORM
```

This will print out something like this:

```
Warlock 2305843009264966986
Titan 2305843009264966984
Hunter 2305843009264966985 LAST ACTIVE
```

Lets store the id for the last active character in an environment variable (if you like, you could store all of them by class name).

```
export CHARACTER_ID=2305843009264966985
```

At this point, we have all of our data setup, and can access it via environment variables like so:

```
$ echo $MEMBER_ID
```

or on Windows

```
$ echo $env:MEMBER_ID
```

Storing this data in enviroment variables is not required but makes it much easier to use the apps. The examples below will assume you are using environment variables (if not you can just enter the actual data values in place of the variables).


### Grabbing data

So, lets start getting some data. Lets see whether we are playing Destiny 2, and if so, which activity:

```
$ dclia --member-id $MEMBER_ID --platform $PLATFORM --manifest-path $MANIFEST_PATH
```

Lets see all of our Crucible stats since the weekly reset on Tuesday:

```
$ dcliah --member-id $MEMBER_ID --character-id $CHARACTER_ID --platform $PLATFORM --manifest-path $MANIFEST_PATH --mode all_pvp --moment weekly
```

Lets view our historical Crucible stats across all of our characters for all time:

```
$ dclics --member-id $MEMBER_ID --platform xbox --mode all_pvp --moment all_time
```

### Putting it all together

These can be useful on their own, but where they can be really powerful is when you start to customize them for how you want to use them.

There are a couple of examples in the [examples directory](https://github.com/mikechambers/dcli/tree/main/examples):

* Send a notification when you load into a new activity (particularly useful when playing crucible so you can see which map you are loading into)
* Automatically generate weekly reports on your Crucible stats and email them to yourself
* Track your Crucible stats per game play session
* Generate an overview of your recent pvp stats, and have the system read them to you

As you can see, right now, a lot of the functionality is Crucible based. If you would like to see other functionality, make sure you requests it in the [issues](https://github.com/mikechambers/dcli/issues), or [Discord](https://discord.gg/2Y8bV2Mq3p).

### Learning More

At anytime, you can see which arguments and options are avaliable by passing the *--help* argument:

```
$ dcliah --help
```

You can also find additional documentation and examples on the [individual app pages for each app](https://github.com/mikechambers/dcli).

## Questions, Feature Requests, Feedback

Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ Requires that a sendmail client is [configured](https://blog.travismclarke.com/p

Prints out K/D for all modes for the past month:
```
$ dclics --member-id 4611686018429783292 --platform xbox --mode all --character-id 2305843009264966985 --moment month --output-format tsv | grep kills_deaths_ratio | awk '{print $2}'
$ dclics --member-id 4611686018429783292 --platform xbox --mode all_pvp --character-id 2305843009264966985 --moment month --output-format tsv | grep kills_deaths_ratio | awk '{print $2}'
1.5986928
```
28 changes: 14 additions & 14 deletions examples/session.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,28 @@ Write-Output "Retrieving activity data..."
$last_call_was_error=$false
while ($true) {

# you could use the Destiny2.exe process detection in ths status_notifications.ps1
# script, and then reset the session_start everytime destiny launches.
# that way, you could keep this script running, and it would always and automatically
# reset your session to when you launch destiny.
# you could use the Destiny2.exe process detection in ths status_notifications.ps1
# script, and then reset the session_start everytime destiny launches.
# that way, you could keep this script running, and it would always and automatically
# reset your session to when you launch destiny.


# assumes dcliah.exe is in your path
$activity = (dcliah.exe --manifest-path $manifest_path `
--member-id $member_id --platform $platform --character-id $character_id `
--mode $mode --moment custom --custom-time $session_start 2>$null) -join "`n"
$activity = (dcliah.exe --manifest-path $manifest_path `
--member-id $member_id --platform $platform --character-id $character_id `
--mode $mode --moment custom --custom-time $session_start 2>$null) -join "`n"
#note, to view any errors that might occur, remove 2>$null (this will print
#extra output though, or change to 2>err.txt and it will write to a text file)

if($LASTEXITCODE) {
if(!$last_call_was_error) {
Write-Host ("Error retrieving activities. Trying again in {0} seconds" -f $check_interval_seconds) -ForegroundColor White -BackgroundColor Red
$last_call_was_error=$true
}
if(!$last_call_was_error) {
Write-Host ("Error retrieving activities. Trying again in {0} seconds" -f $check_interval_seconds) -ForegroundColor White -BackgroundColor Red
$last_call_was_error=$true
}
} else {
$last_call_was_error=$false
Clear-Host
Write-Output $activity
$last_call_was_error=$false
Clear-Host
Write-Output $activity
}
Start-Sleep -Seconds $check_interval_seconds
}
1 change: 0 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

This folder contains scripts for simple testing of the compiled apps.


* **runapps** Runs all dcli apps on via a bash shell
* **runapps.bat** Windows bat file to run all apps

Expand Down

0 comments on commit f9f52c3

Please sign in to comment.