瀏覽代碼

fixed decay for absents bug

master
peter 5 年之前
父節點
當前提交
abed080892

+ 5
- 2
src/backend/Components/Item/ItemManager.ts 查看文件

369
     }
369
     }
370
 
370
 
371
     decayTokens = async (tier: Tiers, amount = 1) => {
371
     decayTokens = async (tier: Tiers, amount = 1) => {
372
+        getLogger('ItemManager#decayTokens').debug(tier)
373
+
372
         await this.admin
374
         await this.admin
373
         .knex(tier + 'tokens')
375
         .knex(tier + 'tokens')
374
         .decrement('level', Math.max(amount, 1))
376
         .decrement('level', Math.max(amount, 1))
379
         .del()
381
         .del()
380
     }
382
     }
381
 
383
 
382
-    decayTokensOfCharacter = async (tier: Tiers, character:Character, amount = 1) => {
384
+    decayTokensOfCharacter = async (tier: Tiers, character:Character) => {
385
+        getLogger('ItemManager#decayTokensOfCharacter').debug(character, tier)
383
         await this.admin
386
         await this.admin
384
         .knex(tier + 'tokens')
387
         .knex(tier + 'tokens')
385
         .where({
388
         .where({
386
             characterid: character.id
389
             characterid: character.id
387
         })
390
         })
388
-        .decrement('level', Math.max(amount, 1))
391
+        .decrement('level')
389
 
392
 
390
         await this.admin
393
         await this.admin
391
         .knex(tier + 'tokens as t')
394
         .knex(tier + 'tokens as t')

+ 7
- 1
src/backend/Components/Raid/RaidManager.ts 查看文件

174
 
174
 
175
     startRaid = async (raid: Raid): Promise<RaidData> => {
175
     startRaid = async (raid: Raid): Promise<RaidData> => {
176
         const data = await this.getRaidData(raid)
176
         const data = await this.getRaidData(raid)
177
-        data.participants.absent.map(p => this.itemManager.decayTokensOfCharacter(raid.tier, p, 1))
177
+        await Promise.all(data.participants.absent.map(p => this.itemManager.decayTokensOfCharacter(raid.tier, {
178
+            charactername: p.charactername,
179
+            id: p.characterid,
180
+            race: p.race,
181
+            specid: p.specid,
182
+            userid: p.userid
183
+        }, 1)))
178
         await this.itemManager.decayTokens(data.tier)      
184
         await this.itemManager.decayTokens(data.tier)      
179
         const archived = await this.archiveRaid(raid)
185
         const archived = await this.archiveRaid(raid)
180
 
186
 

+ 15
- 4
src/frontend/src/app/frontcraft/pages/rules/rules.component.html 查看文件

15
                         raid start.
15
                         raid start.
16
                     </li>
16
                     </li>
17
                     <li>
17
                     <li>
18
-                        When you sign up to a raid you can spend your reserves on an item
18
+                        When you sign up to a raid you can spend your reserves on an item. 
19
                     </li>
19
                     </li>
20
                     <li>
20
                     <li>
21
                         Every week you can re-reserve the same item to build a streak on it
21
                         Every week you can re-reserve the same item to build a streak on it
27
                 <h3>Priorities</h3>
27
                 <h3>Priorities</h3>
28
                 <ul>
28
                 <ul>
29
                     <li>
29
                     <li>
30
-                        Some classes and races may get an initial boost to specific streaks. The list is on the
31
-                        right
30
+                        Some classes and races may get an initial boost to specific streaks.
32
                     </li>
31
                     </li>
33
                     <li>
32
                     <li>
34
                         If an item was not reserved at all, players may roll according to their priority <br />(e.g.
33
                         If an item was not reserved at all, players may roll according to their priority <br />(e.g.
37
                     </li>
36
                     </li>
38
                 </ul>
37
                 </ul>
39
                 <br />
38
                 <br />
40
-                <h3>Streaks</h3>
39
+                <h3>Streaks & Decay</h3>
41
                 <ul>
40
                 <ul>
41
+                    <li>
42
+                        Spending your reserves will increase your streak by 1+#reserves. This number is affected by decay
43
+                    </li>
44
+                    <li>
45
+                        Every time a raid starts, ALL streaks in that raid tier are reduced by 1 (this evens out the streak-gain for attendees back to 1)
46
+                    </li>
47
+                    <li>
48
+                        Players that are marked absent have their streaks decay by 2 instead (which leaves the total unchanged)
49
+                    </li>
50
+                    <li>
51
+                        If a player does not sign up as either "Attending" or "Absent" they are still subject to the decay, thereby decreasing the streak by 1
52
+                    </li>
42
                     <li>
53
                     <li>
43
                         Switching the selected item destroys previous streaks. (Streaks must be continued without
54
                         Switching the selected item destroys previous streaks. (Streaks must be continued without
44
                         switchup)
55
                         switchup)

Loading…
取消
儲存