Fix !AUTOREPLY

This commit is contained in:
SilicaAndPina 2021-07-03 20:01:00 +12:00
parent 699353f2d1
commit 801ae29a62
3 changed files with 36 additions and 29 deletions

View file

@ -64,8 +64,8 @@
"playtime_timeout":"You have run out of playtime for now. In one minute you will be disconnected. You gain one minute of playtime every 8 minutes. Please come back later!",
"random_movement":"You are sooo <B>%STAT%</B>. You wander %MSG% in a different direction.",
"movement_key":{
"thirsty":"dizzily"},
"hungery":"stumble"},
"thirsty":"dizzily",
"hungery":"stumble"
},
"incorrect_password":"Incorrect. You will have to find the correct answer somewhere...",
"player_here":"%USERNAME% here",

View file

@ -33,7 +33,6 @@ namespace HISP.Server
string ShopInventory = "CREATE TABLE IF NOT EXISTS ShopInventory(ShopID INT, RandomID INT, ItemID INT)";
string DroppedItems = "CREATE TABLE IF NOT EXISTS DroppedItems(X INT, Y INT, RandomID INT, ItemID INT, DespawnTimer INT, Data INT)";
string TrackedQuest = "CREATE TABLE IF NOT EXISTS TrackedQuest(playerId INT, questId INT, timesCompleted INT)";
string OnlineUsers = "CREATE TABLE IF NOT EXISTS OnlineUsers(playerId INT, Admin TEXT(3), Moderator TEXT(3), Subscribed TEXT(3), New TEXT(3))";
string CompetitionGear = "CREATE TABLE IF NOT EXISTS CompetitionGear(playerId INT, headItem INT, bodyItem INT, legItem INT, feetItem INT)";
string Awards = "CREATE TABLE IF NOT EXISTS Awards(playerId INT, awardId INT)";
string Jewelry = "CREATE TABLE IF NOT EXISTS Jewelry(playerId INT, slot1 INT, slot2 INT, slot3 INT, slot4 INT)";
@ -58,7 +57,8 @@ namespace HISP.Server
string SolvedRealTimeRiddle = "CREATE TABLE IF NOT EXISTS SolvedRealTimeRiddles(playerId INT, riddleId INT)";
string MutedPlayers = "CREATE TABLE IF NOT EXISTS MutedPlayers(playerId INT, mutePlayerId INT)";
string ItemQueue = "CREATE TABLE IF NOT EXISTS ItemPurchaseQueue(playerId INT, itemId INT, count INT)";
string DeleteOnlineUsers = "DELETE FROM OnlineUsers";
string DeleteOnlineUsers = "DROP TABLE OnlineUsers";
string OnlineUsers = "CREATE TABLE IF NOT EXISTS OnlineUsers(playerId INT, Admin TEXT(3), Moderator TEXT(3), Subscribed TEXT(3), New TEXT(3))";
try
{
@ -508,17 +508,6 @@ namespace HISP.Server
{
Logger.WarnPrint(e.Message);
};
try
{
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = OnlineUsers;
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
catch (Exception e)
{
Logger.WarnPrint(e.Message);
};
try
{
@ -545,6 +534,18 @@ namespace HISP.Server
{
Logger.WarnPrint(e.Message);
};
try
{
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = OnlineUsers;
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
catch (Exception e)
{
Logger.WarnPrint(e.Message);
};
}
}

View file

@ -5854,14 +5854,6 @@ namespace HISP.Server
string formattedMessage = Chat.FormatChatForOthers(sender.LoggedinUser, channel, message);
string formattedMessageSender = Chat.FormatChatForSender(sender.LoggedinUser, channel, message, nameTo);
string formattedMessageAutoReply = "";
string formattedMessageSenderAutoReply = "";
if (sender.LoggedinUser.AutoReplyText != "")
{
formattedMessageAutoReply = Chat.FormatChatForOthers(sender.LoggedinUser, channel, sender.LoggedinUser.AutoReplyText, true);
formattedMessageSenderAutoReply = Chat.FormatChatForSender(sender.LoggedinUser, channel, sender.LoggedinUser.AutoReplyText, nameTo, true);
}
byte[] chatPacketOthers = PacketBuilder.CreateChat(formattedMessage, chatSide);
byte[] chatPacketSender = PacketBuilder.CreateChat(formattedMessageSender, chatSide);
@ -5871,10 +5863,7 @@ namespace HISP.Server
foreach (GameClient recipiant in recipiants)
{
recipiant.SendPacket(chatPacketOthers);
if(formattedMessageAutoReply != "")
recipiant.SendPacket(PacketBuilder.CreateChat(formattedMessageAutoReply, chatSide));
if (channel == Chat.ChatChannel.Dm)
recipiant.SendPacket(playDmSound);
}
@ -5882,8 +5871,25 @@ namespace HISP.Server
// Send to sender
sender.SendPacket(chatPacketSender);
if (formattedMessageSenderAutoReply != "")
sender.SendPacket(PacketBuilder.CreateChat(formattedMessageSenderAutoReply, chatSide));
// AutoReply
if (channel == Chat.ChatChannel.Dm)
{
foreach (GameClient recipiant in recipiants)
{
if (recipiant.LoggedinUser.AutoReplyText != "")
{
string formattedMessageAuto = Chat.FormatChatForOthers(recipiant.LoggedinUser, channel, recipiant.LoggedinUser.AutoReplyText, true);
string formattedMessageSenderAuto = Chat.FormatChatForSender(recipiant.LoggedinUser, channel, recipiant.LoggedinUser.AutoReplyText, nameTo, true);
byte[] chatPacketAutoOthers = PacketBuilder.CreateChat(formattedMessageAuto, chatSide);
sender.SendPacket(chatPacketAutoOthers);
byte[] chatPacketAutoSender = PacketBuilder.CreateChat(formattedMessageSenderAuto, chatSide);
recipiant.SendPacket(chatPacketAutoSender);
}
}
}
}
public static void OnClickPacket(GameClient sender, byte[] packet)