@@ -21,6 +21,7 @@ import { randomEntry, randomEntryWeighted } from "@/utils/arrayUtils.js";
2121
2222import * as lootService from "@/service/loot.js" ;
2323import {
24+ LootAttributeClassId ,
2425 LootAttributeKindId ,
2526 lootAttributeTemplates ,
2627 LootKindId ,
@@ -157,12 +158,11 @@ export async function postLootDrop(
157158
158159 const template = randomEntryWeighted ( lootTemplates , weights ) ;
159160
160- const rarityWeights = lootAttributeTemplates . map ( a => a . initialDropWeight ?? 0 ) ;
161+ const rarities = lootAttributeTemplates . filter ( a => a . classId === LootAttributeClassId . RARITY ) ;
162+ const rarityWeights = rarities . map ( a => a . initialDropWeight ?? 0 ) ;
161163
162164 const initialAttribute =
163- template . id === LootKindId . NICHTS
164- ? null
165- : randomEntryWeighted ( lootAttributeTemplates , rarityWeights ) ;
165+ template . id === LootKindId . NICHTS ? null : randomEntryWeighted ( rarities , rarityWeights ) ;
166166
167167 const claimedLoot = await lootService . createLoot (
168168 template ,
@@ -197,15 +197,31 @@ export async function postLootDrop(
197197 await message . edit ( {
198198 embeds : [
199199 {
200- title : `Das Geschenk enthielt: ${ template . titleText } ${ initialAttribute ?. shortDisplay ?? "" } ` . trim ( ) ,
200+ title : `Das Geschenk enthielt: ${ template . titleText } ` ,
201201 description : template . dropDescription ,
202202 image : attachment
203203 ? {
204204 url : "attachment://opened.gif" ,
205205 }
206206 : undefined ,
207+ fields : [
208+ {
209+ name : "🎉 Ehrenwerter Empfänger" ,
210+ value : winner . toString ( ) ,
211+ inline : true ,
212+ } ,
213+ ...( initialAttribute
214+ ? [
215+ {
216+ name : "✨ Rarität" ,
217+ value : `${ initialAttribute . shortDisplay } ${ initialAttribute . displayName } ` . trim ( ) ,
218+ inline : true ,
219+ } ,
220+ ]
221+ : [ ] ) ,
222+ ] ,
207223 footer : {
208- text : `🎉 ${ winner . displayName } hat das Geschenk geöffnet\n ${ messages . join ( "\n" ) } ` . trim ( ) ,
224+ text : messages . join ( "\n" ) . trim ( ) ,
209225 } ,
210226 } ,
211227 ] ,
0 commit comments