@@ -143,7 +143,16 @@ type PredefinedLootDropStrategy = {
143143 template : LootTemplate ;
144144 rarity : LootAttributeTemplate | undefined ;
145145} ;
146- export type LootDropStrategy = RandomizedLootDropStrategy | PredefinedLootDropStrategy ;
146+ type TransferLootDropStrategy = {
147+ kind : "transfer" ;
148+ template : LootTemplate ;
149+ rarity : LootAttributeTemplate | undefined ;
150+ sourceLootId : LootId ;
151+ } ;
152+ export type LootDropStrategy =
153+ | RandomizedLootDropStrategy
154+ | PredefinedLootDropStrategy
155+ | TransferLootDropStrategy ;
147156
148157export async function postLootDrop (
149158 context : BotContext ,
@@ -216,19 +225,23 @@ export async function postLootDrop(
216225 return ;
217226 }
218227
219- const lootDrop = await ( strategy . kind === "predefined"
220- ? fixedLootDrop ( strategy . template , strategy . rarity , donor , predecessorLootId )
221- : randomizedLootDrop ( interaction . user , donor , predecessorLootId ) ) ;
228+ const lootDrop =
229+ strategy . kind === "randomized"
230+ ? await randomizedLootDrop ( interaction . user , donor , predecessorLootId )
231+ : fixedLootDrop ( strategy . template , strategy . rarity , donor , predecessorLootId ) ;
222232 const { template, rarity : rarityAttribute , messages } = lootDrop ;
223233
224- const claimedLoot = await lootService . createLoot (
225- template ,
226- interaction . user ,
227- message ,
228- "drop" ,
229- predecessorLootId ?? null ,
230- rarityAttribute ?? null ,
231- ) ;
234+ const claimedLoot =
235+ strategy . kind === "transfer"
236+ ? await lootService . transferLootToUser ( strategy . sourceLootId , interaction . user , true )
237+ : await lootService . createLoot (
238+ template ,
239+ interaction . user ,
240+ message ,
241+ "drop" ,
242+ predecessorLootId ?? null ,
243+ rarityAttribute ?? null ,
244+ ) ;
232245
233246 const reply = await interaction . deferReply ( { flags : MessageFlags . Ephemeral } ) ;
234247
0 commit comments