From 99715f90cd080c228e0f885708b9214ad1ea6efe Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 9 Aug 2023 14:22:16 +0100 Subject: [PATCH] Update JSONs and include end of wipe gift Add additional method to send localised messages from SYSTEM to player --- project/assets/configs/gifts.json | 22 ++++++++++++++- .../assets/database/locales/global/en.json | 1 + project/src/services/GiftService.ts | 28 +++++++++++++------ project/src/services/MailSendService.ts | 25 +++++++++++++++++ 4 files changed, 67 insertions(+), 9 deletions(-) diff --git a/project/assets/configs/gifts.json b/project/assets/configs/gifts.json index 41e1eba2..a16dc74b 100644 --- a/project/assets/configs/gifts.json +++ b/project/assets/configs/gifts.json @@ -216,7 +216,7 @@ "messageText": "Merry christmas!", "timestampToSend": 42069, "associatedEvent": "Christmas", - "collectionTimeHours": 48 + "collectionTimeHours": 48 }, "1CLICKDRESSUP": { "items": [{ @@ -715,6 +715,26 @@ "messageText": "Easy Kappa", "collectionTimeHours": 48, "associatedEvent": "Promo" + }, + "ENDOFWIPE": { + "items": [{ + "_id": "a89275c1b18274ef7432a6d7", + "_tpl": "5449016a4bdc2d6f028b456f", + "upd": { + "StackObjectsCount": 500000 + } + },{ + "_id": "a89275c1b18274e27432a6d7", + "_tpl": "5449016a4bdc2d6f028b456f", + "upd": { + "StackObjectsCount": 500000 + } + } + ], + "sender": "System", + "localeTextId": "626e5d63bc92c87fd22a943f 0", + "collectionTimeHours": 48, + "associatedEvent": "Promo" } } } diff --git a/project/assets/database/locales/global/en.json b/project/assets/database/locales/global/en.json index c7501fb6..097a65ce 100644 --- a/project/assets/database/locales/global/en.json +++ b/project/assets/database/locales/global/en.json @@ -15295,6 +15295,7 @@ "64c0e0ac03044d5322024995": "Obtain the second part of the encoded intel on Woods", "64c7de532c6492d0560d544e": "Obtain the V4 Flash Drive on Customs", "64c7de8bc4777b028806f20c": "Hand over the V4 Flash Drive", + "64d2c807d13cc217c605a77c 0": "Congratulations! You've won the prize!", "7099Kills": "Level 71-99 players killed", "8 Description": "", "8 FirstName": "", diff --git a/project/src/services/GiftService.ts b/project/src/services/GiftService.ts index 4d07d87e..5c64bff7 100644 --- a/project/src/services/GiftService.ts +++ b/project/src/services/GiftService.ts @@ -69,11 +69,25 @@ export class GiftService // Handle system messsages if (giftData.sender === GiftSenderType.SYSTEM) { - this.mailSendService.sendSystemMessageToPlayer( - playerId, - giftData.messageText, - giftData.items, - this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours)); + // Has a localisable text id to send to player + if (giftData.localeTextId) + { + this.mailSendService.sendLocalisedSystemMessageToPlayer( + playerId, + giftData.localeTextId, + giftData.items, + this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours)); + } + else + { + this.mailSendService.sendSystemMessageToPlayer( + playerId, + giftData.messageText, + giftData.items, + this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours)); + } + + } // Handle user messages else if (giftData.sender === GiftSenderType.USER) @@ -106,9 +120,7 @@ export class GiftService giftData.messageText, giftData.items, this.timeUtil.getHoursAsSeconds(giftData.collectionTimeHours)); - } - - + } } else { diff --git a/project/src/services/MailSendService.ts b/project/src/services/MailSendService.ts index b71ecf13..1bc2ddfa 100644 --- a/project/src/services/MailSendService.ts +++ b/project/src/services/MailSendService.ts @@ -136,6 +136,31 @@ export class MailSendService this.sendMessageToPlayer(details); } + /** + * Send a message from SYSTEM to the player with or without items with loalised text + * @param playerId Players id to send message to + * @param messageLocaleId Id of key from locale file to send to player + * @param items Optional items to send to player + * @param maxStorageTimeSeconds Optional time to collect items before they expire + */ + public sendLocalisedSystemMessageToPlayer(playerId: string, messageLocaleId: string, items: Item[] = [], maxStorageTimeSeconds = null): void + { + const details: ISendMessageDetails = { + recipientId: playerId, + sender: MessageType.SYSTEM_MESSAGE, + templateId: messageLocaleId + }; + + // Add items to message + if (items.length > 0) + { + details.items = items; + details.itemsMaxStorageLifetimeSeconds = maxStorageTimeSeconds; + } + + this.sendMessageToPlayer(details); + } + /** * Send a USER message to a player with or without items * @param playerId Players id to send message to