Skip to content

Commit

Permalink
Merge pull request #78 from xadamxk/chore/project-cleanup
Browse files Browse the repository at this point in the history
Chore/project cleanup
  • Loading branch information
xadamxk authored Mar 24, 2024
2 parents fec2970 + 619c5bc commit a42d215
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 65 deletions.
File renamed without changes.
File renamed without changes.
Empty file removed CHANGELOG.md
Empty file.
34 changes: 34 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Development
### Install Dependencies
```
npm i
```
### Running the Application
#### Serving Angular Live
This builds the Angular and Electron portions of the code and runs the Electron application. The Angular portion of the code is served live (i.e. from a server). Changes to both the Angular portion and the Electron portion of the code are watched and will trigger the code to be recompiled. When the Angular portion of the code is recompiled, any open Electron windows will be reloaded. When the Electron portion of the code is recompiled, a new Electron process will be spawned.
```
npm run start
```
#### Serving Angular Locally
This builds the Angular and Electron portions of the code and runs the Electron application. The Angular portion of the code is served locally (i.e. from a file). This is how the application would be ran once built into an executable.
```
npm run build[:<dev|prod>]
npm run electron -- ./
```
#### Skipping Angular Build
If the Angular portion of the code has not changed, or if the Angular window is not being displayed, then (re)compiling the Angular portion may be skipped.
```
npm run electron:build
npm run electron -- ./
```
Alternatively, changes to the Electron portion of the code can be watched. When the Electron portion of the code is recompiled, a new Electron process will be spawned.
```
npm run electron:watch
```
### Building Executable
```
npm run package
```

### CI/CD Pipeline
Commits trigger CodeQL analysis that build the application and add a status check to pull requests. Commits to master with a version tag (format v#.#.#) trigger the release job to build and create a release draft. The release draft requires manual review. Disabled atm
Binary file added images/OpenBuildIn-1.2.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/RecentlyPlayed-1.2.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SpoofProfileIcon-1.2.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SpoofProfileRank-1.2.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lcu-enhancement-suite",
"version": "1.2.0",
"version": "1.2.1",
"description": "Enhancements for the League of Legends client.",
"author": "xadamxk",
"contributors": [
Expand Down
46 changes: 8 additions & 38 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ Running as a background application, found in your system tray, LCU Enhancement

![Feature Highlight GIF](https://github.com/xadamxk/LCU-Enhancement-Suite/blob/master/images/LCU-Enhancement-Suite-1.0.3.gif?raw=true)

## Download
[Download Link](https://github.com/xadamxk/LCU-Enhancement-Suite/releases/latest)

## Features
- Open recommended build in browser during champion select (ARAM ONLY - SR coming soon) for the following providers:
- Open recommended build in browser during champion select (SR & ARAM ONLY) for the following providers:
- Blitz.gg
- Lolalytics
- Mobalytics
- Op.gg
- Quick invite recently played players
- U.gg
<details><summary>Screenshot</summary><img src="./images/OpenBuildIn-1.2.1.png" title="Open Build In" /></details>
- Quick invite recently played players<details><summary>Screenshot</summary><img src="./images/RecentlyPlayed-1.2.1.png" title="Recently Played" /></details>
- Quick invite players by friend group
- Advanced loot disenchantment for owned & unowned resources including:
- Champion Capsules
Expand All @@ -27,46 +32,11 @@ Running as a background application, found in your system tray, LCU Enhancement
- Availability (Friends List)
- Icon (Friends List)
- Rank (Friends List)
<details><summary>Screenshot</summary><img src="./images/SpoofProfileIcon-1.2.1.png" title="Spoof Profile Icon" /><img src="./images/SpoofProfileRank-1.2.1.png" title="Spoof Profile Rank" /></details>
- Auto accept queue prompt

## Download
[Download Link](https://github.com/xadamxk/LCU-Enhancement-Suite/releases/latest)


# Development
### Install Dependencies
```
npm i
```
### Running the Application
#### Serving Angular Live
This builds the Angular and Electron portions of the code and runs the Electron application. The Angular portion of the code is served live (i.e. from a server). Changes to both the Angular portion and the Electron portion of the code are watched and will trigger the code to be recompiled. When the Angular portion of the code is recompiled, any open Electron windows will be reloaded. When the Electron portion of the code is recompiled, a new Electron process will be spawned.
```
npm run start
```
#### Serving Angular Locally
This builds the Angular and Electron portions of the code and runs the Electron application. The Angular portion of the code is served locally (i.e. from a file). This is how the application would be ran once built into an executable.
```
npm run build[:<dev|prod>]
npm run electron -- ./
```
#### Skipping Angular Build
If the Angular portion of the code has not changed, or if the Angular window is not being displayed, then (re)compiling the Angular portion may be skipped.
```
npm run electron:build
npm run electron -- ./
```
Alternatively, changes to the Electron portion of the code can be watched. When the Electron portion of the code is recompiled, a new Electron process will be spawned.
```
npm run electron:watch
```
### Building Executable
```
npm run package
```

### CI/CD Pipeline
Commits trigger CodeQL analysis that build the application and add a status check to pull requests. Commits to master with a version tag (format v#.#.#) trigger the release job to build and create a release draft. The release draft requires manual review.

## Riot Games

Expand Down
9 changes: 7 additions & 2 deletions src/electron/core/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ declare module '../../connector' {
getCurrentVersion(): Promise<Response>;
getChampionIcon(championId: number): Promise<Response>;
getChampionSelectChampions(): Promise<Response>;
getLobbyV2Lobby(): Promise<Response>;
}
}

Expand Down Expand Up @@ -63,11 +64,11 @@ LeagueConnection.prototype.forgeLoot = async function(this, recipeName, componen
return await this.post(`${Endpoints.LOOT_RECIPES}/${recipeName}/craft?repeat=${repeatCount}`, componentLootIds);
};

LeagueConnection.prototype.getBalance = async function(this) : Promise<Response> {
LeagueConnection.prototype.getBalance = async function(this): Promise<Response> {
return await this.get(Endpoints.WALLET);
};

LeagueConnection.prototype.getFriends = async function(this) : Promise<Response> {
LeagueConnection.prototype.getFriends = async function(this): Promise<Response> {
return await this.get(Endpoints.FRIENDS);
};

Expand Down Expand Up @@ -98,3 +99,7 @@ LeagueConnection.prototype.getChampionIcon = async function(championId): Promise
LeagueConnection.prototype.getChampionSelectChampions = async function(): Promise<Response> {
return await this.get(Endpoints.CHAMPION_SELECT_ALL_CHAMPS);
};

LeagueConnection.prototype.getLobbyV2Lobby = async function(): Promise<Response> {
return await this.get(Endpoints.LOBBY);
};
1 change: 1 addition & 0 deletions src/electron/enums/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum Endpoints {
TEAM_BUILDER_CURRENT_CHAMPION = '/lol-lobby-team-builder/champ-select/v1/current-champion',
END_OF_GAME_STATS = '/lol-end-of-game/v1/eog-stats-block',
INVITATIONS = '/lol-lobby/v2/lobby/invitations',
LOBBY = '/lol-lobby/v2/lobby',
FRIEND_GROUPS = '/lol-chat/v1/friend-groups',
FRIENDS = '/lol-chat/v1/friends',
FRIEND_REQUESTS = '/lol-chat/v1/friend-requests',
Expand Down
5 changes: 5 additions & 0 deletions src/electron/enums/game-modes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Source: https://static.developer.riotgames.com/docs/lol/gameModes.json
export enum GameModes {
ARAM = 'ARAM',
CLASSIC = 'CLASSIC'
}
1 change: 1 addition & 0 deletions src/electron/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './loot-item-status';
export * from './loot-redeemable-status';
export * from './loot-types';
export * from './player-response';
export * from './game-modes';
1 change: 1 addition & 0 deletions src/electron/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export * from './eog-player';
export * from './eog-stats';
export * from './eog-team';
export * from './cs-champion';
export * from './lollobby-lobby';
151 changes: 151 additions & 0 deletions src/electron/models/lollobby-lobby.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { Model } from '../api';

export class LOLLobbyV2Lobby extends Model {
canStartActivity: boolean;
gameConfig: GameConfig;
invitations: any[];
localMember: LocalMember;
members: Member[];
mucJwtDto: MucJwtDto;
multiUserChatId: string;
multiUserChatPassword: string;
partyId: string;
partyType: string;
restrictions: any;
scarcePositions: any[];
warnings: any;
}

export interface GameConfig {
allowablePremadeSizes: any[]
customLobbyName: string
customMutatorName: string
customRewardsDisabledReasons: any[]
customSpectatorPolicy: string
customSpectators: any[]
customTeam100: CustomTeam[]
customTeam200: CustomTeam[]
gameMode: string
isCustom: boolean
isLobbyFull: boolean
isTeamBuilderManaged: boolean
mapId: number
maxHumanPlayers: number
maxLobbySize: number
maxTeamSize: number
pickType: string
premadeSizeAllowed: boolean
queueId: number
shouldForceScarcePositionSelection: boolean
showPositionSelector: boolean
showQuickPlaySlotSelection: boolean
}

export interface CustomTeam {
allowedChangeActivity: boolean
allowedInviteOthers: boolean
allowedKickOthers: boolean
allowedStartActivity: boolean
allowedToggleInvite: boolean
autoFillEligible: boolean
autoFillProtectedForPromos: boolean
autoFillProtectedForSoloing: boolean
autoFillProtectedForStreaking: boolean
botChampionId: number
botDifficulty: string
botId: string
firstPositionPreference: string
intraSubteamPosition: any
isBot: boolean
isLeader: boolean
isSpectator: boolean
playerSlots: any[]
puuid: string
quickplayPlayerState: any
ready: boolean
secondPositionPreference: string
showGhostedBanner: boolean
subteamIndex: any
summonerIconId: number
summonerId: number
summonerInternalName: string
summonerLevel: number
summonerName: string
teamId: number
tftNPEQueueBypass: any
}

export interface LocalMember {
allowedChangeActivity: boolean
allowedInviteOthers: boolean
allowedKickOthers: boolean
allowedStartActivity: boolean
allowedToggleInvite: boolean
autoFillEligible: boolean
autoFillProtectedForPromos: boolean
autoFillProtectedForSoloing: boolean
autoFillProtectedForStreaking: boolean
botChampionId: number
botDifficulty: string
botId: string
firstPositionPreference: string
intraSubteamPosition: any
isBot: boolean
isLeader: boolean
isSpectator: boolean
playerSlots: any[]
puuid: string
quickplayPlayerState: any
ready: boolean
secondPositionPreference: string
showGhostedBanner: boolean
subteamIndex: any
summonerIconId: number
summonerId: number
summonerInternalName: string
summonerLevel: number
summonerName: string
teamId: number
tftNPEQueueBypass: any
}

export interface Member {
allowedChangeActivity: boolean
allowedInviteOthers: boolean
allowedKickOthers: boolean
allowedStartActivity: boolean
allowedToggleInvite: boolean
autoFillEligible: boolean
autoFillProtectedForPromos: boolean
autoFillProtectedForSoloing: boolean
autoFillProtectedForStreaking: boolean
botChampionId: number
botDifficulty: string
botId: string
firstPositionPreference: string
intraSubteamPosition: any
isBot: boolean
isLeader: boolean
isSpectator: boolean
playerSlots: any[]
puuid: string
quickplayPlayerState: any
ready: boolean
secondPositionPreference: string
showGhostedBanner: boolean
subteamIndex: any
summonerIconId: number
summonerId: number
summonerInternalName: string
summonerLevel: number
summonerName: string
teamId: number
tftNPEQueueBypass: any
}

export interface MucJwtDto {
channelClaim: string
domain: string
jwt: string
targetRegion: string
}
19 changes: 10 additions & 9 deletions src/electron/modules/auto-accept-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@ import { Endpoints, PlayerResponse } from '../enums';
import { ReadyCheck } from '../models';
import { ReadyCheckSubscription } from '../subscriptions';

const SETTINGS_KEY = 'isAutoAcceptQueueEnabled';

export class AutoAcceptQueueModule extends WebSocketModule {
id = 'AutoAcceptQueue';
checked = this.storage.get('checked', true);
enabled = this.storage.get(SETTINGS_KEY, false);

async register(): Promise<void> {
connection.addSubscription(
new ReadyCheckSubscription((event) => {
this.refresh(event);
if (this.storage.get(SETTINGS_KEY)) {
this.refresh(event);
}
})
);

const menuItem = new MenuItem({
label: 'Auto-Accept Queue',
type: 'checkbox',
checked: this.checked,
checked: this.enabled,
click: (menuItem) => {
this.checked = menuItem.checked = !this.checked;
this.storage.set('checked', this.checked);
this.enabled = menuItem.checked = !this.enabled;
this.storage.set(SETTINGS_KEY, this.enabled);
}
});

Expand All @@ -34,10 +38,7 @@ export class AutoAcceptQueueModule extends WebSocketModule {
const readyCheck = new ReadyCheck(event.data);

if (readyCheck.playerResponse === PlayerResponse.NONE) {
const response = await connection.post(Endpoints.READY_CHECK_ACCEPT);
console.log(response.status);
const json = await response.json();
console.log(json);
await connection.post(Endpoints.READY_CHECK_ACCEPT);
}
}
}
4 changes: 2 additions & 2 deletions src/electron/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const modules: Module[] = [
new DisenchantLootModule(),
new FriendsListModule(),
new SpoofProfileModule(),
new AutoAcceptQueueModule(),
new OpenBuildInBrowserModule()
new OpenBuildInBrowserModule(),
new AutoAcceptQueueModule()
];

export { modules };
Loading

0 comments on commit a42d215

Please sign in to comment.