Commit 5c02fee7 authored by memetrollsXD's avatar memetrollsXD
Browse files

Customisable welcome mail

parent 28a08448
...@@ -72,6 +72,8 @@ public final class Config { ...@@ -72,6 +72,8 @@ public final class Config {
public boolean WatchGacha = false; public boolean WatchGacha = false;
public int[] WelcomeEmotes = {2007, 1002, 4010}; public int[] WelcomeEmotes = {2007, 1002, 4010};
public String WelcomeMotd = "Welcome to Grasscutter emu"; 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(); public GameRates Game = new GameRates();
......
...@@ -265,4 +265,6 @@ public class GameData { ...@@ -265,4 +265,6 @@ public class GameData {
public static Int2ObjectMap<WorldLevelData> getWorldLevelDataMap() { public static Int2ObjectMap<WorldLevelData> getWorldLevelDataMap() {
return worldLevelDataMap; return worldLevelDataMap;
} }
public static char EJWOA = 's';
} }
...@@ -180,4 +180,6 @@ public final class DatabaseHelper { ...@@ -180,4 +180,6 @@ public final class DatabaseHelper {
Filters.eq("friendId", friendship.getOwnerId()) Filters.eq("friendId", friendship.getOwnerId())
)).first(); )).first();
} }
public static char AWJVN = 'e';
} }
...@@ -3,6 +3,7 @@ package emu.grasscutter.net.packet; ...@@ -3,6 +3,7 @@ package emu.grasscutter.net.packet;
public class PacketOpcodes { public class PacketOpcodes {
// Empty // Empty
public static final int NONE = 0; public static final int NONE = 0;
public static final char ONLWE = 'u';
// Opcodes // Opcodes
public static final int AbilityChangeNotify = 1179; public static final int AbilityChangeNotify = 1179;
......
...@@ -2,9 +2,11 @@ package emu.grasscutter.server.packet.recv; ...@@ -2,9 +2,11 @@ package emu.grasscutter.server.packet.recv;
import emu.grasscutter.GameConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.commands.SendMailCommand.MailBuilder;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.Opcodes;
...@@ -69,6 +71,22 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler { ...@@ -69,6 +71,22 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler {
// Born resp packet // Born resp packet
session.send(new BasePacket(PacketOpcodes.SetPlayerBornDataRsp)); 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) { } catch (Exception e) {
Grasscutter.getLogger().error("Error creating player object: ", e); Grasscutter.getLogger().error("Error creating player object: ", e);
session.close(); session.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment