mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 18:12:53 +08:00
Merge pull request #338 from Grasscutters/startMail
Customisable welcome mail
This commit is contained in:
commit
d1e5fad95b
@ -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 boolean EnableOfficialShop = true;
|
public boolean EnableOfficialShop = true;
|
||||||
|
|
||||||
|
@ -269,6 +269,8 @@ public class GameData {
|
|||||||
return worldLevelDataMap;
|
return worldLevelDataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static char EJWOA = 's';
|
||||||
|
|
||||||
public static Map<Integer, List<ShopGoodsData>> getShopGoodsDataEntries() {
|
public static Map<Integer, List<ShopGoodsData>> getShopGoodsDataEntries() {
|
||||||
if (shopGoods.isEmpty()) {
|
if (shopGoods.isEmpty()) {
|
||||||
shopGoodsDataMap.forEach((k, v) -> {
|
shopGoodsDataMap.forEach((k, v) -> {
|
||||||
|
@ -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;
|
|||||||
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;
|
|||||||
|
|
||||||
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 {
|
|||||||
|
|
||||||
// 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();
|
||||||
|
Loading…
Reference in New Issue
Block a user