Skip to content

Commit 1caf24d

Browse files
bhoopesh369shubham-1806MughilSrinivasanelegantShock2258Aadit-Krishnaa-R
authoredFeb 13, 2025
fixes (#13)
* update: keybindings, Tour, sidebar * fix: tiers for pvp leaderbord * fix: tutorials * fix: map save button for tutorials * update: footer * fix : phaser assets (#15) * modified: public/assets/tower3.png new file: public/assets/tower3nEW.png * feat : asset offset fix modified: public/assets/tower1.png modified: public/assets/tower2.png modified: public/assets/tower3.png * fix: tile change * fix: tile change --------- Co-authored-by: Ayush Chadha <elegantShock3307@gmail.com> * update: lsp autocomplete: * fix: pages overflow * update: player code * fix : Remove Code Tutorial from Navbar(again) * fix: leaderboard next page issue * fix: batlletv score * fix: no coins and destruction in pvp simulation * fix: Remove Code Tutorial from Navbar * fix: state in match modal * fix: average state bugs * fix: learboard by tier pvp * fix: dc latest code * fix: code type dc --------- Co-authored-by: shubham-1806 <shub.agarwal2003@gmail.com> Co-authored-by: Mughil Srinivasan R S <130070784+MughilSrinivasan@users.noreply.github.com> Co-authored-by: Ayush Chadha <elegantShock3307@gmail.com> Co-authored-by: Aadit-Krishnaa-R <aaditkrishnaa18@gmail.com>
1 parent e7be42a commit 1caf24d

File tree

33 files changed

+584
-394
lines changed

33 files changed

+584
-394
lines changed
 

‎docs/spec/CodeCharacter-API.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,11 @@ paths:
446446
in: query
447447
name: size
448448
description: Size of the page
449+
- schema:
450+
$ref: '#/components/schemas/TierType'
451+
in: query
452+
name: tier
453+
description: Leaderboard Tier
449454
description: Get PvP leaderboard
450455
parameters: []
451456

@@ -1659,23 +1664,31 @@ paths:
16591664
components:
16601665
schemas:
16611666
UserMatchStats:
1662-
title: UserMatchStats
1667+
title: UserMatchStat
1668+
type: array
1669+
description: User Match Stats array model
1670+
items:
1671+
anyOf:
1672+
- $ref: '#/components/schemas/UserMatchStat'
1673+
required:
1674+
- stat
1675+
1676+
UserMatchStat:
1677+
title: UserMatchStat
16631678
type: object
1664-
description: User Match Stats model
1679+
description: User Match Stat model
16651680
properties:
16661681
avgAtk:
16671682
type: number
1668-
default: 0
16691683
dc_wins:
16701684
type: number
1671-
default: 0
16721685
coins:
16731686
type: number
1674-
default: 0
16751687
required:
16761688
- avgAtk
16771689
- dc_wins
16781690
- coins
1691+
16791692
PasswordLoginRequest:
16801693
title: PasswordLoginRequest
16811694
type: object
@@ -2596,6 +2609,7 @@ components:
25962609
- DAILYCHALLENGE
25972610
- PVP
25982611
- SELFPVP
2612+
- AUTOPVP
25992613
description: Match Mode
26002614
Verdict:
26012615
type: string

‎packages/client/src/apis/LeaderboardApi.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface GetLeaderboardRequest {
2828
export interface GetPvPLeaderboardRequest {
2929
page?: number;
3030
size?: number;
31+
tier?: TierType;
3132
}
3233

3334
/**
@@ -68,6 +69,7 @@ export interface LeaderboardApiInterface {
6869
* @summary Get PvP leaderboard
6970
* @param {number} [page] Index of the page
7071
* @param {number} [size] Size of the page
72+
* @param {TierType} [tier] Leaderboard Tier
7173
* @param {*} [options] Override http request option.
7274
* @throws {RequiredError}
7375
* @memberof LeaderboardApiInterface
@@ -84,6 +86,7 @@ export interface LeaderboardApiInterface {
8486
getPvPLeaderboard(
8587
page?: number,
8688
size?: number,
89+
tier?: TierType,
8790
initOverrides?: RequestInit | runtime.InitOverrideFunction,
8891
): Promise<Array<PvPLeaderBoardResponse>>;
8992
}
@@ -175,6 +178,10 @@ export class LeaderboardApi
175178
queryParameters['size'] = requestParameters.size;
176179
}
177180

181+
if (requestParameters.tier !== undefined) {
182+
queryParameters['tier'] = requestParameters.tier;
183+
}
184+
178185
const headerParameters: runtime.HTTPHeaders = {};
179186

180187
if (this.configuration && this.configuration.accessToken) {
@@ -205,10 +212,11 @@ export class LeaderboardApi
205212
async getPvPLeaderboard(
206213
page?: number,
207214
size?: number,
215+
tier?: TierType,
208216
initOverrides?: RequestInit | runtime.InitOverrideFunction,
209217
): Promise<Array<PvPLeaderBoardResponse>> {
210218
const response = await this.getPvPLeaderboardRaw(
211-
{ page: page, size: size },
219+
{ page: page, size: size, tier: tier },
212220
initOverrides,
213221
);
214222
return await response.value();

‎packages/client/src/apis/StatsApi.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* CodeCharacter API
55
* Specification of the CodeCharacter API
66
*
7-
* The version of the OpenAPI document: 2023.0.1
7+
* The version of the OpenAPI document: 2024.0.1
88
* Contact: delta@nitt.edu
99
*
1010
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -13,7 +13,7 @@
1313
*/
1414

1515
import * as runtime from '../runtime';
16-
import type { UserMatchStats } from '../models';
16+
import type { UserMatchStatsInner } from '../models';
1717

1818
/**
1919
* StatsApi - interface
@@ -31,15 +31,15 @@ export interface StatsApiInterface {
3131
*/
3232
getStatsRaw(
3333
initOverrides?: RequestInit | runtime.InitOverrideFunction,
34-
): Promise<runtime.ApiResponse<Array<UserMatchStats>>>;
34+
): Promise<runtime.ApiResponse<Array<Array<UserMatchStatsInner>>>>;
3535

3636
/**
3737
* Gets all statistics for the current user
3838
* Get all General Stats for current user and top user
3939
*/
4040
getStats(
4141
initOverrides?: RequestInit | runtime.InitOverrideFunction,
42-
): Promise<Array<UserMatchStats>>;
42+
): Promise<Array<Array<UserMatchStatsInner>>>;
4343
}
4444

4545
/**
@@ -52,7 +52,7 @@ export class StatsApi extends runtime.BaseAPI implements StatsApiInterface {
5252
*/
5353
async getStatsRaw(
5454
initOverrides?: RequestInit | runtime.InitOverrideFunction,
55-
): Promise<runtime.ApiResponse<Array<UserMatchStats>>> {
55+
): Promise<runtime.ApiResponse<Array<Array<UserMatchStatsInner>>>> {
5656
const queryParameters: any = {};
5757

5858
const headerParameters: runtime.HTTPHeaders = {};
@@ -75,7 +75,7 @@ export class StatsApi extends runtime.BaseAPI implements StatsApiInterface {
7575
initOverrides,
7676
);
7777

78-
return new runtime.JSONApiResponse(response);
78+
return new runtime.JSONApiResponse<any>(response);
7979
}
8080

8181
/**
@@ -84,7 +84,7 @@ export class StatsApi extends runtime.BaseAPI implements StatsApiInterface {
8484
*/
8585
async getStats(
8686
initOverrides?: RequestInit | runtime.InitOverrideFunction,
87-
): Promise<Array<UserMatchStats>> {
87+
): Promise<Array<Array<UserMatchStatsInner>>> {
8888
const response = await this.getStatsRaw(initOverrides);
8989
return await response.value();
9090
}

‎packages/client/src/models/index.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ export const MatchMode = {
749749
Dailychallenge: 'DAILYCHALLENGE',
750750
Pvp: 'PVP',
751751
Selfpvp: 'SELFPVP',
752+
Autopvp: 'AUTOPVP',
752753
} as const;
753754
export type MatchMode = (typeof MatchMode)[keyof typeof MatchMode];
754755

@@ -1376,27 +1377,52 @@ export interface UpdatePasswordRequest {
13761377
passwordConfirmation: string;
13771378
}
13781379
/**
1379-
* User Match Stats model
1380+
* User Match Stat model
13801381
* @export
1381-
* @interface UserMatchStats
1382+
* @interface UserMatchStat
13821383
*/
1383-
export interface UserMatchStats {
1384+
export interface UserMatchStat {
13841385
/**
13851386
*
13861387
* @type {number}
1387-
* @memberof UserMatchStats
1388+
* @memberof UserMatchStat
13881389
*/
13891390
avgAtk: number;
13901391
/**
13911392
*
13921393
* @type {number}
1393-
* @memberof UserMatchStats
1394+
* @memberof UserMatchStat
13941395
*/
13951396
dcWins: number;
13961397
/**
13971398
*
13981399
* @type {number}
1399-
* @memberof UserMatchStats
1400+
* @memberof UserMatchStat
1401+
*/
1402+
coins: number;
1403+
}
1404+
/**
1405+
*
1406+
* @export
1407+
* @interface UserMatchStatsInner
1408+
*/
1409+
export interface UserMatchStatsInner {
1410+
/**
1411+
*
1412+
* @type {number}
1413+
* @memberof UserMatchStatsInner
1414+
*/
1415+
avgAtk: number;
1416+
/**
1417+
*
1418+
* @type {number}
1419+
* @memberof UserMatchStatsInner
1420+
*/
1421+
dcWins: number;
1422+
/**
1423+
*
1424+
* @type {number}
1425+
* @memberof UserMatchStatsInner
14001426
*/
14011427
coins: number;
14021428
}

‎packages/renderer/src/RendererComponent.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Renderer } from './Renderer';
1919

2020
const RendererLayer = createComponent(React, 'cc-renderer', Renderer);
2121

22-
const StatsText = () => {
22+
const StatsText = ({ shouldShowStats }: { shouldShowStats: boolean }) => {
2323
const [turns, setTurns] = React.useState(0);
2424
const [coins, setCoins] = React.useState(0);
2525
const [destruction, setDestruction] = React.useState(0);
@@ -51,7 +51,7 @@ const StatsText = () => {
5151
events.once(RendererEvents.CHANGE_DESTRUCTION, onDestructionUpdated);
5252
}, [destruction]);
5353

54-
return (
54+
return shouldShowStats ? (
5555
<p
5656
style={{
5757
textAlign: 'right',
@@ -67,10 +67,27 @@ const StatsText = () => {
6767
<br />
6868
Destruction : {String(destruction.toFixed(2)).padStart(6, '\xa0')} %
6969
</p>
70+
) : (
71+
<p
72+
style={{
73+
textAlign: 'right',
74+
color: 'white',
75+
fontFamily: 'Poppins',
76+
fontSize: '1rem',
77+
padding: '1rem',
78+
}}
79+
>
80+
Turn : {String(turns).padStart(8, '\xa0')}
81+
<br />
82+
</p>
7083
);
7184
};
7285

73-
export default function RendererComponent(): JSX.Element {
86+
export default function RendererComponent({
87+
shouldShowStats,
88+
}: {
89+
shouldShowStats?: boolean;
90+
}): JSX.Element {
7491
const [isPaused, setPaused] = React.useState(false);
7592
const [isFullscreen, setFullscreen] = React.useState(false);
7693

@@ -166,7 +183,7 @@ export default function RendererComponent(): JSX.Element {
166183
)}
167184
</Button>
168185
</ButtonGroup>
169-
<StatsText />
186+
<StatsText shouldShowStats={shouldShowStats ?? true} />
170187
</ButtonToolbar>
171188
<RendererLayer />
172189
</>

0 commit comments

Comments
 (0)