feat: mastery rank up inbox message #1206
@ -5,6 +5,7 @@ import { IMongoDate } from "@/src/types/commonTypes";
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { unixTimesInMs } from "@/src/constants/timeConstants";
 | 
					import { unixTimesInMs } from "@/src/constants/timeConstants";
 | 
				
			||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
					import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
				
			||||||
 | 
					import { createMessage } from "@/src/services/inboxService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface ITrainingResultsRequest {
 | 
					interface ITrainingResultsRequest {
 | 
				
			||||||
    numLevelsGained: number;
 | 
					    numLevelsGained: number;
 | 
				
			||||||
@ -26,6 +27,25 @@ const trainingResultController: RequestHandler = async (req, res): Promise<void>
 | 
				
			|||||||
    if (trainingResults.numLevelsGained == 1) {
 | 
					    if (trainingResults.numLevelsGained == 1) {
 | 
				
			||||||
        inventory.TrainingDate = new Date(Date.now() + unixTimesInMs.hour * 23);
 | 
					        inventory.TrainingDate = new Date(Date.now() + unixTimesInMs.hour * 23);
 | 
				
			||||||
        inventory.PlayerLevel += 1;
 | 
					        inventory.PlayerLevel += 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await createMessage(accountId, [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender",
 | 
				
			||||||
 | 
					                msg: "/Lotus/Language/Inbox/MasteryRewardMsg",
 | 
				
			||||||
 | 
					                arg: [
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        Key: "NEW_RANK",
 | 
				
			||||||
 | 
					                        Tag: inventory.PlayerLevel
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					                att: [
 | 
				
			||||||
 | 
					                    `/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank${inventory.PlayerLevel.toString().padStart(2, "0")}Trophy`
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					                sub: "/Lotus/Language/Inbox/MasteryRewardTitle",
 | 
				
			||||||
 | 
					                icon: "/Lotus/Interface/Icons/Npcs/Lotus_d.png",
 | 
				
			||||||
 | 
					                highPriority: true
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const changedinventory = await inventory.save();
 | 
					    const changedinventory = await inventory.save();
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@ export interface IMessage {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface Arg {
 | 
					export interface Arg {
 | 
				
			||||||
    Key: string;
 | 
					    Key: string;
 | 
				
			||||||
    Tag: string;
 | 
					    Tag: string | number;
 | 
				
			||||||
| 
							
							
								
									
	
	
	
	
	
	
	
	 | 
					|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//types are wrong
 | 
					//types are wrong
 | 
				
			||||||
@ -99,7 +99,7 @@ const messageSchema = new Schema<IMessageDatabase>(
 | 
				
			|||||||
            type: [
 | 
					            type: [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Key: String,
 | 
					                    Key: String,
 | 
				
			||||||
                    Tag: String,
 | 
					                    Tag: Schema.Types.Mixed,
 | 
				
			||||||
| 
							
							
								
									
	
	
	
	
	
	
	
	 
					
					OrdisPrime marked this conversation as resolved
					
				 
				
				
					
						OrdisPrime
						commented  
			
		why use mixed here? its the same as allowing everything. We should certainly not use mixed for anything that was validated. why use mixed here? its the same as allowing everything. We should certainly not use mixed for anything that was validated.
Mixed was only set for things that are not implemented 
			
			
		
				
					
						Sainan
						commented  
			
		Because it can also be a number. Because it can also be a number. 
			
			
		 | 
					|||||||
                    _id: false
 | 
					                    _id: false
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	
tag can be a number? I don't see why this pr needs that change, so I don't know where it's coming from
The
NEW_RANKis a number.I think this might be a DE moment, and the client can just work with both.
It just work when a number is supplied, right?
I sadly can't try now.
Yeah, it's a number in my inbox messages.
Weird situation, well in that case we gotta use mixed, you are right.
PR is good to go