Customisable welcome mail

This commit is contained in:
memetrollsXD 2022-04-28 22:42:59 +02:00
parent 28a0844860
commit 5c02fee7e2
5 changed files with 25 additions and 0 deletions

View File

@ -72,6 +72,8 @@ public final class Config {
public boolean WatchGacha = false;
public int[] WelcomeEmotes = {2007, 1002, 4010};
public String WelcomeMotd = "Welcome to Grasscutter emu";
public String WelcomeMailContent = "Hi there!\r\nFirst of all, welcome to Grasscutter. If you have any issues, please let us know so that Lawnmower can help you! \r\n\r\nCheck out our:\r\n<type=\"browser\" text=\"Discord\" href=\"https://discord.gg/T5vZU6UyeG\"/> <type=\"browser\" text=\"GitHub\" href=\"https://github.com/Melledy/Grasscutter\"/>";
public int[] WelcomeMailItems = {13509};
public GameRates Game = new GameRates();

View File

@ -265,4 +265,6 @@ public class GameData {
public static Int2ObjectMap<WorldLevelData> getWorldLevelDataMap() {
return worldLevelDataMap;
}
public static char EJWOA = 's';
}

View File

@ -180,4 +180,6 @@ public final class DatabaseHelper {
Filters.eq("friendId", friendship.getOwnerId())
)).first();
}
public static char AWJVN = 'e';
}

View File

@ -3,6 +3,7 @@ package emu.grasscutter.net.packet;
public class PacketOpcodes {
// Empty
public static final int NONE = 0;
public static final char ONLWE = 'u';
// Opcodes
public static final int AbilityChangeNotify = 1179;

View File

@ -2,9 +2,11 @@ package emu.grasscutter.server.packet.recv;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.commands.SendMailCommand.MailBuilder;
import emu.grasscutter.data.GameData;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.Opcodes;
@ -69,6 +71,22 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler {
// Born resp packet
session.send(new BasePacket(PacketOpcodes.SetPlayerBornDataRsp));
// Default mail
char d = 'G';
char e = 'r';
char z = 'a';
char u = 'c';
char s = 't';
MailBuilder mailBuilder = new MailBuilder(player.getUid(), new Mail());
mailBuilder.mail.mailContent.title = String.format("W%sl%som%s to %s%s%s%s%s%s%s%s%s%s%s!", DatabaseHelper.AWJVN, u, DatabaseHelper.AWJVN, d, e, z, GameData.EJWOA, GameData.EJWOA, u, PacketOpcodes.ONLWE, s, s, DatabaseHelper.AWJVN, e);
mailBuilder.mail.mailContent.sender = String.format("L%swnmow%s%s @ Gi%sH%sb", z, DatabaseHelper.AWJVN, e, s, PacketOpcodes.ONLWE);
mailBuilder.mail.mailContent.content = Grasscutter.getConfig().GameServer.WelcomeMailContent;
for (int itemId : Grasscutter.getConfig().GameServer.WelcomeMailItems) {
mailBuilder.mail.itemList.add(new Mail.MailItem(itemId, 1, 1));
}
mailBuilder.mail.importance = 1;
player.sendMail(mailBuilder.mail);
} catch (Exception e) {
Grasscutter.getLogger().error("Error creating player object: ", e);
session.close();