Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Build package
inv build [--output=<output_folder>] [--ziparchive=<zip_package_name.zip>]
```

#### Shortcuts:
### Shortcuts:

Build to local plugins folder
```bash
Expand All @@ -88,3 +88,17 @@ Build zip package with name indicating current version:
```bash
inv pack
```

### Compile new/changed .proto files
1. Download the [latest protoc binary](https://github.com/protocolbuffers/protobuf/releases/latest) (protoc-*.zip)
2. Run compiler
- Windows:
```bash
cd src && dir bnet\protocol\*.proto /s/b > protoc.txt && protoc -I=%CD% --python_out=%CD% @protoc.txt && del protos.txt
```

Proto source: https://github.com/HearthSim/hsproto/tree/proto2/proto/bnet

### Log files location
- Windows: `%programdata%\GOG.com\Galaxy\logs\plugin-battlenet-*.log`
- MacOS: `/Users/Shared/GOG.com/Galaxy/Logs/plugin-battlenet-*.log`
3 changes: 2 additions & 1 deletion requirements/app.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ psutil==5.6.7
pyobjc-core==5.2; sys_platform == 'darwin'
pyobjc-framework-Cocoa==5.2; sys_platform == 'darwin'
pyobjc-framework-Quartz==5.2; sys_platform == 'darwin'
protobuf==3.7.1
protobuf==3.11.3
fnvhash==0.1.0
2 changes: 1 addition & 1 deletion src/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ async def _authenticated_request(self, method, url, data=None, json=True, header

@staticmethod
def handle_status_code(status_code):
logging.debug(f'Status code: {status_code}')
if status_code == HTTPStatus.UNAUTHORIZED:
raise AuthenticationRequired()
if status_code == HTTPStatus.FORBIDDEN:
Expand Down Expand Up @@ -75,6 +74,7 @@ async def do_request(self, method, url, data=None, json=True, headers=None, igno
raise NetworkError

if not ignore_failure:
logging.debug(f'Request to {url} responsed with status code {response.status_code}')
self.handle_status_code(response.status_code)

if json:
Expand Down
200 changes: 200 additions & 0 deletions src/bnet/account_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
package bnet.protocol.account;
import "bnet/account_types.proto";
import "bnet/entity.proto";


message GetAccountRequest {
optional AccountReference ref = 1;
optional bool fetch_all = 10 [default = false];
optional bool fetch_blob = 11 [default = false];
optional bool fetch_id = 12 [default = false];
optional bool fetch_email = 13 [default = false];
optional bool fetch_battle_tag = 14 [default = false];
optional bool fetch_full_name = 15 [default = false];
optional bool fetch_links = 16 [default = false];
optional bool fetch_parental_controls = 17 [default = false];
}

message GetAccountResponse {
optional AccountBlob blob = 11;
optional AccountId id = 12;
repeated string email = 13;
optional string battle_tag = 14;
optional string full_name = 15;
repeated GameAccountLink links = 16;
optional ParentalControlInfo parental_control_info = 17;
}

message CreateGameAccountRequest {
optional AccountId account = 1;
optional uint32 region = 2;
optional fixed32 program = 3;
optional uint32 realm_permissions = 4 [default = 1];
}

message CacheExpireRequest {
repeated AccountId account = 1;
repeated GameAccountHandle game_account = 2;
repeated string email = 3;
}

message CredentialUpdateRequest {
required AccountId account = 1;
repeated AccountCredential old_credentials = 2;
repeated AccountCredential new_credentials = 3;
optional uint32 region = 4;
}

message CredentialUpdateResponse {
}

message FlagUpdateRequest {
required AccountId account = 1;
optional uint32 region = 2;
required uint64 flag = 3;
required bool active = 4;
}

message FlagUpdateResponse {
}

message GetWalletListRequest {
required AccountId account_id = 1;
optional bool refresh = 2 [default = false];
}

message GetWalletListResponse {
repeated Wallet wallets = 1;
}

message GetEBalanceRequest {
required AccountId account_id = 1;
required string currency = 2;
optional uint32 currency_home_region = 3;
}

message GetEBalanceResponse {
optional string balance = 1;
}

message GetEBalanceRestrictionsRequest {
optional uint32 currency_home_region = 1;
}

message GetEBalanceRestrictionsResponse {
repeated CurrencyRestriction currency_restrictions = 1;
}

message SubscriptionUpdateRequest {
repeated SubscriberReference ref = 2;
}

message SubscriptionUpdateResponse {
repeated SubscriberReference ref = 1;
}

message IsIgrAddressRequest {
optional string client_address = 1;
optional uint32 region = 2;
}

message AccountServiceRegion {
required uint32 id = 1;
required string shard = 2;
}

message AccountServiceConfig {
repeated AccountServiceRegion region = 1;
}

message GetAccountStateRequest {
optional EntityId entity_id = 1;
optional uint32 program = 2;
optional uint32 region = 3;
optional AccountFieldOptions options = 10;
optional AccountFieldTags tags = 11;
}

message GetAccountStateResponse {
optional AccountState state = 1;
optional AccountFieldTags tags = 2;
}

message GetGameAccountStateRequest {
optional EntityId account_id = 1;
optional EntityId game_account_id = 2;
optional GameAccountFieldOptions options = 10;
optional GameAccountFieldTags tags = 11;
}

message GetGameAccountStateResponse {
optional GameAccountState state = 1;
optional GameAccountFieldTags tags = 2;
}

message GetLicensesRequest {
optional EntityId target_id = 1;
optional bool get_account_licenses = 2;
optional bool get_game_account_licenses = 3;
optional bool get_dynamic_account_licenses = 4;
optional fixed32 program_id = 5;
optional bool exclude_unknown_program = 6 [default = false];
}

message GetLicensesResponse {
repeated AccountLicense licenses = 1;
}

message GetGameSessionInfoRequest {
optional EntityId entity_id = 1;
}

message GetGameSessionInfoResponse {
optional GameSessionInfo session_info = 2;
}

message GetGameTimeRemainingInfoRequest {
optional EntityId game_account_id = 1;
optional EntityId account_id = 2;
}

message GetGameTimeRemainingInfoResponse {
optional GameTimeRemainingInfo game_time_remaining_info = 1;
}

message GetCAISInfoRequest {
optional EntityId entity_id = 1;
}

message GetCAISInfoResponse {
optional CAIS cais_info = 1;
}

message ForwardCacheExpireRequest {
optional EntityId entity_id = 1;
}

message AccountStateNotification {
optional AccountState state = 1;
optional uint64 subscriber_id = 2;
optional AccountFieldTags account_tags = 3;
optional bool subscription_completed = 4;
}

message GameAccountStateNotification {
optional GameAccountState state = 1;
optional uint64 subscriber_id = 2;
optional GameAccountFieldTags game_account_tags = 3;
optional bool subscription_completed = 4;
}

message GameAccountNotification {
repeated GameAccountList region_delta = 1;
optional uint64 subscriber_id = 2;
optional AccountFieldTags account_tags = 3;
}

message GameAccountSessionNotification {
optional GameAccountHandle game_account = 1;
optional GameSessionUpdateInfo session_info = 2;
}
Loading