File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed
Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ export const lootTemplates: LootTemplate[] = [
8585 dropDescription : "Awww" ,
8686 emote : ":catsmile:" ,
8787 asset : "assets/loot/01-kadse.jpg" ,
88+ initialAttributes : [ LootAttributeKindId . SWEET ] ,
8889 attributeAsset : {
8990 [ LootAttributeKindId . RADIOACTIVE ] : "assets/loot/attributes/01-kadse-verstrahlt.jpg" ,
9091 } ,
@@ -484,6 +485,7 @@ export const lootTemplates: LootTemplate[] = [
484485 dropDescription : "Bóbr kurwa! Ja pierdolę! Jakie bydlę!" ,
485486 emote : ":beaver:" ,
486487 asset : "assets/loot/36-biber.jpg" ,
488+ initialAttributes : [ LootAttributeKindId . SWEET ] ,
487489 } ,
488490] as const ;
489491
Original file line number Diff line number Diff line change @@ -182,8 +182,6 @@ export async function postLootDrop(
182182 return ;
183183 }
184184
185- await awardPostDropLootAttributes ( claimedLoot ) ;
186-
187185 await reply . delete ( ) ;
188186
189187 log . info (
@@ -284,13 +282,3 @@ async function getDropWeightAdjustments(
284282 weights : newWeights ,
285283 } ;
286284}
287-
288- async function awardPostDropLootAttributes ( loot : Loot ) {
289- switch ( loot . lootKindId ) {
290- case LootKindId . KADSE :
291- await lootService . addLootAttributeIfNotPresent ( loot . id , LootAttributeKindId . SWEET ) ;
292- break ;
293- default :
294- break ;
295- }
296- }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import type {
2020} from "./db/model.js" ;
2121
2222import db from "@db" ;
23- import type { LootAttributeKindId } from "@/service/lootData.js" ;
23+ import { resolveLootAttributeTemplate , type LootAttributeKindId } from "@/service/lootData.js" ;
2424
2525export type LootUseCommandInteraction = ChatInputCommandInteraction & {
2626 channel : GuildTextBasedChannel ;
@@ -36,6 +36,7 @@ export interface LootTemplate {
3636 emote : string ;
3737 excludeFromInventory ?: boolean ;
3838 effects ?: string [ ] ;
39+ initialAttributes ?: LootAttributeKindId [ ] ;
3940
4041 onDrop ?: (
4142 context : BotContext ,
@@ -110,6 +111,13 @@ export async function createLoot(
110111 . returningAll ( )
111112 . executeTakeFirstOrThrow ( ) ;
112113
114+ for ( const attributeId of template . initialAttributes ?? [ ] ) {
115+ const attribute = resolveLootAttributeTemplate ( attributeId ) ;
116+ if ( ! attribute ) continue ;
117+
118+ await addLootAttributeIfNotPresent ( res . id , attribute , ctx ) ;
119+ }
120+
113121 if ( rarityAttribute ) {
114122 await addLootAttributeIfNotPresent ( res . id , rarityAttribute , ctx ) ;
115123 }
You can’t perform that action at this time.
0 commit comments