omniarena-nurvus-shared 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ import type { ChoosableType, Energy, NatureType, PersistenceType, Resource, Tag, ValenceType } from './engine.js';
2
+ import type { CharacterAvatar } from './skins.js';
3
+ export type GameDto = {
4
+ id: string;
5
+ globalEffects: string[];
6
+ player1: PlayerDto;
7
+ player2: PlayerDto;
8
+ characters: Record<string, CharacterDto>;
9
+ skills: Record<string, SkillDto>;
10
+ effects: Record<string, EffectDto>;
11
+ currentTurn: number;
12
+ winner: number | null;
13
+ error: string | null;
14
+ };
15
+ export type PlayerDto = {
16
+ id: string;
17
+ number: number;
18
+ inventory: InventoryDto;
19
+ characters: string[];
20
+ movableSkillUses: SkillUseDto[];
21
+ playing: boolean;
22
+ turnDuration: number;
23
+ username: string;
24
+ title: string;
25
+ avatar: string | null;
26
+ elo: number;
27
+ wins: number;
28
+ losses: number;
29
+ streak: number;
30
+ };
31
+ export type InventoryDto = {
32
+ id: string;
33
+ resources: Record<Energy, number>;
34
+ pool: Energy[];
35
+ baseExchangeRate: number;
36
+ exchangeRate: number;
37
+ };
38
+ export type CharacterDto = {
39
+ id: string;
40
+ characterId: number;
41
+ player: number;
42
+ name: string;
43
+ avatar: CharacterAvatar;
44
+ description: string;
45
+ maxHealth: number;
46
+ currentHealth: number;
47
+ skillset: string[];
48
+ skills: string[];
49
+ effects: string[];
50
+ sounds: string[];
51
+ };
52
+ export type SkillDto = {
53
+ id: string;
54
+ skillId: number;
55
+ description: string;
56
+ userId: string;
57
+ playerId: string;
58
+ baseCooldown: number;
59
+ cooldown: number;
60
+ windDown: number;
61
+ baseCost: Resource[];
62
+ cost: Resource[];
63
+ classes: string[];
64
+ targetingOptions: TargetingOptionsDto;
65
+ validTargets: string[];
66
+ choosables: ChoosableDto[];
67
+ };
68
+ export type EffectDto = {
69
+ id: string;
70
+ skillId: string;
71
+ userId: number;
72
+ description: string;
73
+ duration: number;
74
+ turnsLeft: number;
75
+ isPermanent: boolean;
76
+ endsThisTurn: boolean;
77
+ valence: ValenceType;
78
+ nature: NatureType;
79
+ persistence: PersistenceType;
80
+ ignored: boolean;
81
+ paused: boolean;
82
+ };
83
+ export type TargetingOptionsDto = {
84
+ self: boolean;
85
+ teamMembers: number;
86
+ allTeamMembers: boolean;
87
+ allies: number;
88
+ allAllies: boolean;
89
+ enemies: number;
90
+ allEnemies: boolean;
91
+ characters: number;
92
+ allCharacters: boolean;
93
+ partial: boolean;
94
+ random: number;
95
+ distinct: boolean;
96
+ };
97
+ export type ChoosableDto = {
98
+ id: string;
99
+ type: ChoosableType;
100
+ options: any[];
101
+ perTarget: boolean;
102
+ fromTarget: boolean;
103
+ picks: number;
104
+ };
105
+ export type SkillUseDto = {
106
+ id: string;
107
+ skillId: string;
108
+ order: number;
109
+ };
110
+ export type GameSkill = {
111
+ id: number;
112
+ valence: ValenceType;
113
+ nature: NatureType;
114
+ persistence: PersistenceType;
115
+ cooldown: number;
116
+ cost: Resource[];
117
+ targeting: string;
118
+ baseDescription: string;
119
+ baseDuration: number;
120
+ baseTags: Tag[];
121
+ };
122
+ export type GameCharacter = {
123
+ id: number;
124
+ unplayable: boolean;
125
+ skills: GameSkill[];
126
+ };
127
+ export type LiveStats = {
128
+ playersOnline: number;
129
+ playersInBattle: number;
130
+ characterCount: number;
131
+ playerCount: number;
132
+ };
@@ -0,0 +1,9 @@
1
+ export type UserRole = 'user' | 'admin' | 'mod' | 'bot' | 'skin_maker';
2
+ export type BattleMode = 'ranked' | 'casual' | 'private';
3
+ export type BattleEndReason = 'opponent_defeated' | 'opponent_surrendered' | 'opponent_left' | 'error';
4
+ export type UserHeaderDto = {
5
+ id: string;
6
+ username: string;
7
+ displayName: string;
8
+ avatarImageId: string | null;
9
+ };
@@ -0,0 +1,58 @@
1
+ export type GamePhase = 'mount' | 'apply' | 'turnstart' | 'clock' | 'turnend' | 'post';
2
+ export type SlotNumber = 1 | 2 | 3 | 4;
3
+ export type ActionType = 'skill' | 'energy_exchange';
4
+ export type ValenceType = 'helpful' | 'harmful';
5
+ export type NatureType = 'physical' | 'energy' | 'mental' | 'tactical';
6
+ export type PersistenceType = 'instant' | 'action' | 'control';
7
+ export type DamageType = 'regular' | 'piercing' | 'true';
8
+ export type Energy = 'energy1' | 'energy2' | 'energy3' | 'energy4';
9
+ export type Resource = Energy | 'random';
10
+ export type EffectType = 'damage' | 'stealHealth' | 'healthSetting' | 'execution' | 'heal' | 'destructibleDefense' | 'damageReduction' | 'gainResource' | 'drainResource' | 'stealResource' | 'energyPoolRestricting' | 'energyExchangeRateModifying' | 'skillSwap' | 'delayed' | 'transform' | 'immortality' | 'deathCheating' | 'interval' | 'ignore' | 'invulnerability' | 'stun' | 'removal' | 'dealtDamageModifying' | 'receivedDamageModifying' | 'costModifying' | 'costReplacing' | 'costOverwriting' | 'durationModifying' | 'currentDurationModifying' | 'cooldownModifying' | 'currentCooldownModifying' | 'destructibleDefenseModifying' | 'damageReductionModifying' | 'counter' | 'parry' | 'reflection' | 'nullification' | 'reveal' | 'conceal' | 'targetingModifying' | 'adder' | 'conditionalEnder' | 'ender' | 'modifying' | 'effectModifying' | 'skillModifying' | 'characterModifying' | 'storage' | 'jumble' | 'shell' | 'label' | 'tracing';
11
+ export type Miscellaneous = 'ignoreInvulnerability' | 'mainTarget' | 'improving' | 'impairing' | 'passive';
12
+ export type Tag = ValenceType | NatureType | PersistenceType | DamageType | Resource | EffectType | Miscellaneous;
13
+ export type SkillUnmountReason = 'death' | 'replace' | 'temporary';
14
+ export type SkillPassthroughType = 'apply' | 'check';
15
+ export type EffectMountReason = 'started' | 'reapplied' | 'triggered';
16
+ export type EffectUnmountReason = 'ended' | 'forcefullyEnded' | 'removed' | 'interrupted' | 'triggered' | 'depleted' | 'countered' | 'transformed' | 'death' | 'cancelled' | 'codependence' | 'reused' | 'decayed';
17
+ export type EffectPassthroughType = 'apply' | 'global' | 'user' | 'before' | 'after';
18
+ export type ChoosableType = 'skill' | 'energy' | 'number' | 'string';
19
+ export type ActionData = {
20
+ type: ActionType;
21
+ skillId: string;
22
+ skillUseId?: string;
23
+ order: number;
24
+ targetIds: string[];
25
+ randomsUsed: Energy[];
26
+ choices: Choice[];
27
+ inventoryId: string;
28
+ fromEnergies: Energy[];
29
+ toEnergy: Energy;
30
+ };
31
+ export type PlayerData = {
32
+ username: string;
33
+ title: string;
34
+ avatarId: string | null;
35
+ elo: number;
36
+ wins: number;
37
+ losses: number;
38
+ streak: number;
39
+ team: number[];
40
+ };
41
+ export type CharacterData = {
42
+ id: number;
43
+ name: string;
44
+ facepic: string;
45
+ maxHealth: number;
46
+ skills: SkillData[];
47
+ };
48
+ export type SkillData = {
49
+ id: number;
50
+ };
51
+ export type SkillInitData = SkillData & {
52
+ userId: string;
53
+ };
54
+ export type Choice = {
55
+ id: string;
56
+ values: any[];
57
+ [key: string]: string | any[];
58
+ };
@@ -0,0 +1,7 @@
1
+ export * from './engine.js';
2
+ export * from './common.js';
3
+ export * from './battle.js';
4
+ export * from './users.js';
5
+ export * from './social.js';
6
+ export * from './skins.js';
7
+ export * from './socket.js';
@@ -0,0 +1,83 @@
1
+ export type PronounType = 'feminine' | 'masculine' | 'neutral';
2
+ export type PronounsSkin = {
3
+ subject: string;
4
+ object: string;
5
+ possessive: string;
6
+ reflexive: string;
7
+ conjugation: 'singular' | 'plural';
8
+ };
9
+ export type EnergySkin = {
10
+ name: string;
11
+ color: string;
12
+ };
13
+ export type CharacterAvatar = 'main' | 'old' | 'masked';
14
+ export type CharacterSkin = {
15
+ id: number;
16
+ name: string;
17
+ short: string;
18
+ avatars: Partial<Record<CharacterAvatar, string>>;
19
+ pronouns: PronounsSkin;
20
+ bio: string;
21
+ };
22
+ export type SkillSkin = {
23
+ id: number;
24
+ name: string;
25
+ image: string;
26
+ };
27
+ export type SkinContent = {
28
+ classes: {
29
+ physical: string;
30
+ energy: string;
31
+ mental: string;
32
+ tactical: string;
33
+ };
34
+ energies: {
35
+ name: {
36
+ singular: string;
37
+ plural: string;
38
+ };
39
+ energy1: EnergySkin;
40
+ energy2: EnergySkin;
41
+ energy3: EnergySkin;
42
+ energy4: EnergySkin;
43
+ };
44
+ characters: Record<string, CharacterSkin>;
45
+ skills: Record<string, SkillSkin>;
46
+ };
47
+ export type SkinDto = {
48
+ id: string;
49
+ default: boolean;
50
+ name: string;
51
+ createdAt: Date;
52
+ content: SkinContent;
53
+ verified: boolean;
54
+ public: boolean;
55
+ creatorId: string;
56
+ updatedAt: Date;
57
+ uses: number;
58
+ };
59
+ export type YourSkinDto = {
60
+ id: string;
61
+ name: string;
62
+ verified: boolean;
63
+ public: boolean;
64
+ createdAt: Date;
65
+ updatedAt: Date;
66
+ default: boolean;
67
+ uses: number;
68
+ };
69
+ export type PublicSkinDto = {
70
+ id: string;
71
+ name: string;
72
+ verified: boolean;
73
+ public: boolean;
74
+ createdAt: Date;
75
+ updatedAt: Date;
76
+ uses: number;
77
+ creator: {
78
+ id: string;
79
+ username: string;
80
+ displayName: string;
81
+ avatarImageId: string;
82
+ };
83
+ };
@@ -0,0 +1,86 @@
1
+ import type { BattleEndReason, BattleMode, UserHeaderDto } from './common.js';
2
+ export type SentMessageDto = {
3
+ id: string;
4
+ recipient: UserHeaderDto;
5
+ title: string;
6
+ createdAt: Date;
7
+ read: boolean;
8
+ };
9
+ export type ReceivedMessageDto = {
10
+ id: string;
11
+ sender: UserHeaderDto | null;
12
+ title: string;
13
+ createdAt: Date;
14
+ read: boolean;
15
+ };
16
+ export type MessageDto = {
17
+ id: string;
18
+ sender: UserHeaderDto | null;
19
+ recipient: UserHeaderDto;
20
+ title: string;
21
+ content: string;
22
+ createdAt: Date;
23
+ read: boolean;
24
+ };
25
+ export type PostDto = {
26
+ id: string;
27
+ type: string;
28
+ title: string;
29
+ content: string;
30
+ createdAt: Date;
31
+ creator: {
32
+ id: string;
33
+ username: string;
34
+ displayName: string;
35
+ avatarImageId: string | null;
36
+ };
37
+ likes: number;
38
+ dislikes: number;
39
+ reaction: -1 | 1 | null;
40
+ };
41
+ export type BattleHistoryPlayerDto = {
42
+ id: string;
43
+ username: string;
44
+ displayName: string;
45
+ avatarImageId: string | null;
46
+ eloBefore: number;
47
+ eloAfter: number;
48
+ };
49
+ export type BattleHistoryDto = {
50
+ id: string;
51
+ mode: BattleMode;
52
+ endReason: BattleEndReason;
53
+ winnerId: string;
54
+ loserId: string;
55
+ createdAt: Date;
56
+ player1: BattleHistoryPlayerDto;
57
+ player2: BattleHistoryPlayerDto;
58
+ };
59
+ export type BattleSummaryDto = {
60
+ id: string;
61
+ mode: BattleMode;
62
+ endReason: BattleEndReason;
63
+ winnerId: string;
64
+ loserId: string;
65
+ createdAt: Date;
66
+ player1Team: number[];
67
+ player2Team: number[];
68
+ player1: UserHeaderDto;
69
+ player2: UserHeaderDto;
70
+ };
71
+ export type LeaderboardEntryDto = {
72
+ id: string;
73
+ username: string;
74
+ displayName: string;
75
+ avatarImageId: string | null;
76
+ elo: number;
77
+ wins: number;
78
+ losses: number;
79
+ streak: number;
80
+ highestStreak: number;
81
+ };
82
+ export type ImageDto = {
83
+ id: string;
84
+ url: string;
85
+ createdAt: Date;
86
+ };
@@ -0,0 +1,28 @@
1
+ import type { BattleEndReason, BattleMode } from './common.js';
2
+ import type { ActionData } from './engine.js';
3
+ export type ClientToServerEvents = {
4
+ team_changed: (members: number[]) => void;
5
+ search: (mode: BattleMode) => void;
6
+ cancel_search: () => void;
7
+ battle_loaded: () => void;
8
+ turn_started: () => void;
9
+ finish_turn: (queuedActions: ActionData[]) => void;
10
+ surrender: () => void;
11
+ send_message: (senderId: string, content: string) => void;
12
+ };
13
+ export type ServerToClientEvents = {
14
+ connexion_established: (inBattle: boolean) => void;
15
+ timer_started: () => void;
16
+ timer_resumed: (durationLeft: number) => void;
17
+ turn_received: () => void;
18
+ search_started: () => void;
19
+ search_canceled: () => void;
20
+ resume_battle: (data: string) => void;
21
+ battle_started: (data: string) => void;
22
+ battle_paused: (reason: BattlePausedReason) => void;
23
+ battle_ended: (winner: string, reason: BattleEndReason, error?: string) => void;
24
+ battle_resolved: () => void;
25
+ new_turn: (data: string) => void;
26
+ receive_message: (senderId: string, content: string) => void;
27
+ };
28
+ export type BattlePausedReason = 'opponent_disconnected';
@@ -0,0 +1,75 @@
1
+ import type { UserRole } from './common.js';
2
+ export type UserDto = {
3
+ id: string;
4
+ username: string;
5
+ displayName: string;
6
+ title: string;
7
+ avatarImageId: string | null;
8
+ elo: number;
9
+ wins: number;
10
+ losses: number;
11
+ streak: number;
12
+ highestStreak: number;
13
+ shards: number;
14
+ skinId: string;
15
+ colorPrimary: string | null;
16
+ colorSecondary: string | null;
17
+ emojiIds: string[];
18
+ nameFontId: string | null;
19
+ nameEffectId: string | null;
20
+ characterBorderId: string | null;
21
+ roles: UserRole[];
22
+ joinedOn: Date;
23
+ };
24
+ export type UserSummaryDto = {
25
+ id: string;
26
+ username: string;
27
+ displayName: string;
28
+ title: string;
29
+ avatarImageId: string | null;
30
+ elo: number;
31
+ wins: number;
32
+ losses: number;
33
+ streak: number;
34
+ highestStreak: number;
35
+ skinId: string;
36
+ colorPrimary: string | null;
37
+ colorSecondary: string | null;
38
+ nameFontId: string | null;
39
+ nameEffectId: string | null;
40
+ characterBorderId: string | null;
41
+ joinedOn: Date;
42
+ };
43
+ export type ConnectionDto = {
44
+ id: string;
45
+ username: string;
46
+ displayName: string;
47
+ avatarImageId: string | null;
48
+ createdAt: Date;
49
+ };
50
+ export type RegisterData = {
51
+ username: string;
52
+ password: string;
53
+ };
54
+ export type LoginData = {
55
+ username: string;
56
+ password: string;
57
+ };
58
+ export type ForgotPasswordData = {
59
+ username: string;
60
+ recoveryKey: string;
61
+ };
62
+ export type ResetPasswordData = {
63
+ resetToken: string;
64
+ newPassword: string;
65
+ };
66
+ export type UpdateProfileData = {
67
+ displayName: string;
68
+ avatar: string | null;
69
+ colorPrimary: string | null;
70
+ colorSecondary: string | null;
71
+ emojiIds: string[];
72
+ nameFontId: string | null;
73
+ nameEffectId: string | null;
74
+ characterBorderId: string | null;
75
+ };
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "omniarena-nurvus-shared",
3
+ "version": "0.4.0",
4
+ "type": "module",
5
+ "description": "Shared contract types for OmniArena (nurvus slice). Type-only, zero dependencies.",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "sideEffects": false
11
+ }