mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 07:11:04 -04:00
Initial support for message types, use %S and p.FullName in more places.
This commit is contained in:
parent
e169d19071
commit
d8298a5010
@ -229,10 +229,9 @@ namespace MCGalaxy.Commands {
|
|||||||
pl.spyChatRooms.Remove(room);
|
pl.spyChatRooms.Remove(room);
|
||||||
}
|
}
|
||||||
Player.SendMessage(pl, "You've been forced to join the chat room '" + room + "'");
|
Player.SendMessage(pl, "You've been forced to join the chat room '" + room + "'");
|
||||||
Chat.ChatRoom(pl, pl.color + pl.name + Server.DefaultColor + " has force joined your chat room", false, room);
|
Chat.ChatRoom(pl, pl.FullName + " %Shas force joined your chat room", false, room);
|
||||||
pl.Chatroom = room;
|
pl.Chatroom = room;
|
||||||
Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor +
|
Player.SendMessage(p, pl.FullName + " %Swas forced to join the chatroom '" + room + "' by you");
|
||||||
" was forced to join the chatroom '" + room + "' by you");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleKick(Player p, string[] parts) {
|
void HandleKick(Player p, string[] parts) {
|
||||||
|
@ -39,7 +39,7 @@ namespace MCGalaxy.Commands {
|
|||||||
if (amount < 0) { Player.SendMessage(p, "You can't fakepay a negative amount."); return; }
|
if (amount < 0) { Player.SendMessage(p, "You can't fakepay a negative amount."); return; }
|
||||||
if (amount >= 16777215) { Player.SendMessage(p, "You can only fakepay up to 16777215."); return; }
|
if (amount >= 16777215) { Player.SendMessage(p, "You can only fakepay up to 16777215."); return; }
|
||||||
|
|
||||||
Player.GlobalMessage(who.color + who.prefix + who.DisplayName + " %Swas given " + amount + " " + Server.moneys);
|
Player.GlobalMessage(who.FullName + " %Swas given " + amount + " " + Server.moneys);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -84,7 +84,7 @@ namespace MCGalaxy.Commands
|
|||||||
ecos.money = who.money;
|
ecos.money = who.money;
|
||||||
ecos.salary = "%f" + amountGiven + "%3 " + Server.moneys + " by " + user1 + "%3 on %f" + DateTime.Now.ToString(CultureInfo.InvariantCulture);
|
ecos.salary = "%f" + amountGiven + "%3 " + Server.moneys + " by " + user1 + "%3 on %f" + DateTime.Now.ToString(CultureInfo.InvariantCulture);
|
||||||
Economy.UpdateEcoStats(ecos);
|
Economy.UpdateEcoStats(ecos);
|
||||||
Player.GlobalMessage(user2 + Server.DefaultColor + " gave " + who.prefix + who.name + " %f" + amountGiven + " %3" + Server.moneys);
|
Player.GlobalMessage(user2 + " %Sgave " + who.FullName + " %f" + amountGiven + " %3" + Server.moneys);
|
||||||
//Player.GlobalMessage(who.color + who.prefix + who.name + Server.DefaultColor + " was given %f" + amountGiven + " %3" + Server.moneys + Server.DefaultColor + " by " + user2);
|
//Player.GlobalMessage(who.color + who.prefix + who.name + Server.DefaultColor + " was given %f" + amountGiven + " %3" + Server.moneys + Server.DefaultColor + " by " + user2);
|
||||||
}
|
}
|
||||||
public override void Help(Player p)
|
public override void Help(Player p)
|
||||||
|
@ -62,7 +62,7 @@ namespace MCGalaxy.Commands
|
|||||||
Economy.UpdateEcoStats(payer);
|
Economy.UpdateEcoStats(payer);
|
||||||
Economy.UpdateEcoStats(receiver);
|
Economy.UpdateEcoStats(receiver);
|
||||||
|
|
||||||
Player.GlobalMessage(p.prefix + p.DisplayName + Server.DefaultColor + " paid %f" + off.color + off.name + Server.DefaultColor + "(offline) %f" + amountPaid + " %3" + Server.moneys);
|
Player.GlobalMessage(p.FullName + " %Spaid %f" + off.color + off.name + "%S(offline) %f" + amountPaid + " %3" + Server.moneys);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (who == p) { Player.SendMessage(p, "%cYou can't pay yourself %3" + Server.moneys); return; }
|
if (who == p) { Player.SendMessage(p, "%cYou can't pay yourself %3" + Server.moneys); return; }
|
||||||
@ -82,7 +82,7 @@ namespace MCGalaxy.Commands
|
|||||||
|
|
||||||
Economy.UpdateEcoStats(payer);
|
Economy.UpdateEcoStats(payer);
|
||||||
Economy.UpdateEcoStats(receiver);
|
Economy.UpdateEcoStats(receiver);
|
||||||
Player.GlobalMessage(p.prefix + p.DisplayName + Server.DefaultColor + " paid " + who.prefix + who.name + " %f" + amountPaid + " %3" + Server.moneys);
|
Player.GlobalMessage(p.FullName + " %Spaid " + who.FullName + " %f" + amountPaid + " %3" + Server.moneys);
|
||||||
}
|
}
|
||||||
public override void Help(Player p)
|
public override void Help(Player p)
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,8 @@ namespace MCGalaxy.Commands
|
|||||||
Command.all.Find("whowas").Use(p, message); return;
|
Command.all.Find("whowas").Use(p, message); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.SendMessage(p, who.color + who.name + Server.DefaultColor + " (" + who.DisplayName + ") " + Server.DefaultColor + " is on &b" + who.level.name);
|
Player.SendMessage(p, who.color + who.name + " %S(" + who.DisplayName + ") %Sis on &b" + who.level.name);
|
||||||
Player.SendMessage(p, who.color + who.prefix + who.name + Server.DefaultColor + " has :");
|
Player.SendMessage(p, who.FullName + Server.DefaultColor + " %Shas :");
|
||||||
Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name);
|
Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name);
|
||||||
|
|
||||||
Group nobody = Group.findPerm(LevelPermission.Nobody);
|
Group nobody = Group.findPerm(LevelPermission.Nobody);
|
||||||
|
@ -43,10 +43,10 @@ namespace MCGalaxy.Commands {
|
|||||||
string newName = parts.Length > 1 ? parts[1] : "";
|
string newName = parts.Length > 1 ? parts[1] : "";
|
||||||
if (newName == "") {
|
if (newName == "") {
|
||||||
who.DisplayName = who.name;
|
who.DisplayName = who.name;
|
||||||
Player.SendChatFrom(who, who.color + who.prefix + who.DisplayName + "%S has reverted their nick to their original name.", false);
|
Player.SendChatFrom(who, who.FullName + "%S has reverted their nick to their original name.", false);
|
||||||
} else {
|
} else {
|
||||||
if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; }
|
if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; }
|
||||||
Player.SendChatFrom(who, who.color + who.DisplayName + "%S has changed their nick to " + who.color + newName + "%S.", false);
|
Player.SendChatFrom(who, who.FullName + "%S has changed their nick to " + who.color + newName + "%S.", false);
|
||||||
who.DisplayName = newName;
|
who.DisplayName = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ namespace MCGalaxy.Commands
|
|||||||
File.Delete("extra/reportedbackups/" + msg + ".txt");
|
File.Delete("extra/reportedbackups/" + msg + ".txt");
|
||||||
File.Move("extra/reported/" + msg + ".txt", "extra/reportedbackups/" + msg + ".txt");
|
File.Move("extra/reported/" + msg + ".txt", "extra/reportedbackups/" + msg + ".txt");
|
||||||
Player.SendMessage(p, "%a" + msg + "'s report has been deleted.");
|
Player.SendMessage(p, "%a" + msg + "'s report has been deleted.");
|
||||||
Chat.GlobalMessageOps(p.prefix + p.color + p.name + Server.DefaultColor + " deleted " + msg + "'s report.");
|
Chat.GlobalMessageOps(p.FullName + " %Sdeleted " + msg + "'s report.");
|
||||||
Server.s.Log(msg + "'s report has been deleted by " + p.name);
|
Server.s.Log(msg + "'s report has been deleted by " + p.name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -45,11 +45,11 @@ namespace MCGalaxy.Commands {
|
|||||||
if (newTitle.Length > 17) { Player.SendMessage(p, "Title must be under 17 letters."); return; }
|
if (newTitle.Length > 17) { Player.SendMessage(p, "Title must be under 17 letters."); return; }
|
||||||
|
|
||||||
if (newTitle == "") {
|
if (newTitle == "") {
|
||||||
Player.SendChatFrom(who, who.color + who.prefix + who.name + " %Shad their title removed.", false);
|
Player.SendChatFrom(who, who.FullName + " %Shad their title removed.", false);
|
||||||
query.AddParam("@Name", who.name);
|
query.AddParam("@Name", who.name);
|
||||||
Database.executeQuery(query, "UPDATE Players SET Title = '' WHERE Name = @Name");
|
Database.executeQuery(query, "UPDATE Players SET Title = '' WHERE Name = @Name");
|
||||||
} else {
|
} else {
|
||||||
Player.SendChatFrom(who, who.color + who.name + " %Swas given the title of &b[" + newTitle + "%b]", false);
|
Player.SendChatFrom(who, who.FullName + " %Swas given the title of &b[" + newTitle + "%b]", false);
|
||||||
query.AddParam("@Title", newTitle);
|
query.AddParam("@Title", newTitle);
|
||||||
query.AddParam("@Name", who.name);
|
query.AddParam("@Name", who.name);
|
||||||
Database.executeQuery(query, "UPDATE Players SET Title = @Title WHERE Name = @Name");
|
Database.executeQuery(query, "UPDATE Players SET Title = @Title WHERE Name = @Name");
|
||||||
|
@ -51,7 +51,7 @@ namespace MCGalaxy
|
|||||||
p.hasflag = null;
|
p.hasflag = null;
|
||||||
p.prefix = p.color + "[" + Colors.Name("&" + color).ToUpper() + "] ";
|
p.prefix = p.color + "[" + Colors.Name("&" + color).ToUpper() + "] ";
|
||||||
players.Add(p);
|
players.Add(p);
|
||||||
mapOn.ChatLevel(p.color + p.prefix + p.name + Server.DefaultColor + " has joined the " + teamstring + ".");
|
mapOn.ChatLevel(p.FullName + " %Shas joined the " + teamstring + ".");
|
||||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ namespace MCGalaxy
|
|||||||
//p.carryingFlag = false;
|
//p.carryingFlag = false;
|
||||||
p.hasflag = null;
|
p.hasflag = null;
|
||||||
players.Remove(p);
|
players.Remove(p);
|
||||||
mapOn.ChatLevel(p.color + p.prefix + p.name + Server.DefaultColor + " has left the " + teamstring + ".");
|
mapOn.ChatLevel(p.FullName + " %Shas left the " + teamstring + ".");
|
||||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ namespace MCGalaxy {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
||||||
byte rotX, byte rotY) {
|
byte rotX, byte rotY) {
|
||||||
if (!p.referee && noRespawn) {
|
if (!p.referee && noRespawn) {
|
||||||
if (p.pos[0] >= x + 70 || p.pos[0] <= x - 70 ) {
|
if (p.pos[0] >= x + 70 || p.pos[0] <= x - 70 ) {
|
||||||
@ -90,16 +90,19 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayerJoinedServer(Player p) {
|
public override void PlayerJoinedServer(Player p) {
|
||||||
if (Status != ZombieGameStatus.NotStarted)
|
if (Status == ZombieGameStatus.NotStarted) return;
|
||||||
Player.SendMessage(p, "There is a Zombie Survival game currently in-progress! " +
|
Player.SendMessage(p, "There is a Zombie Survival game currently in-progress! " +
|
||||||
"Join it by typing /g " + Server.zombie.currentLevelName);
|
"Join it by typing /g " + Server.zombie.currentLevelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayerJoinedLevel(Player p, Level oldLevl) {
|
public override void PlayerJoinedLevel(Player p, Level oldLevl) {
|
||||||
if (Server.zombie.RoundInProgress && p.level.name == currentLevelName)
|
if (Server.zombie.RoundInProgress && p.level.name == currentLevelName)
|
||||||
Server.zombie.InfectedPlayerLogin(p);
|
Server.zombie.InfectedPlayerLogin(p);
|
||||||
|
if (p.level.name == currentLevelName) {
|
||||||
if (p.level.name == currentLevelName) return;
|
//p.SendMessage(CpeMessageType.BottomRight1, "%SYou have &a" + p.money + " %S" + Server.moneys);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.SendMessage(CpeMessageType.BottomRight1, "");
|
||||||
if(ZombieGame.alive.Contains(p))
|
if(ZombieGame.alive.Contains(p))
|
||||||
ZombieGame.alive.Remove(p);
|
ZombieGame.alive.Remove(p);
|
||||||
if (ZombieGame.infectd.Contains(p))
|
if (ZombieGame.infectd.Contains(p))
|
||||||
|
@ -174,19 +174,25 @@ namespace MCGalaxy {
|
|||||||
else
|
else
|
||||||
Server.IRC.Pm(Server.IRC.usedCmd, message);
|
Server.IRC.Pm(Server.IRC.usedCmd, message);
|
||||||
} else {
|
} else {
|
||||||
p.SendMessage(0, Server.DefaultColor + message, colorParse);
|
p.SendMessage(CpeMessageType.Normal, Server.DefaultColor + message, colorParse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(string message) {
|
public void SendMessage(string message) {
|
||||||
SendMessage(0, Server.DefaultColor + message, true);
|
SendMessage(CpeMessageType.Normal, Server.DefaultColor + message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(string message, bool colorParse) {
|
public void SendMessage(string message, bool colorParse) {
|
||||||
SendMessage(0, Server.DefaultColor + message, colorParse);
|
SendMessage(CpeMessageType.Normal, Server.DefaultColor + message, colorParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use the overload with the CpeMessageType parameter.")]
|
||||||
public void SendMessage(byte id, string message, bool colorParse = true) {
|
public void SendMessage(byte id, string message, bool colorParse = true) {
|
||||||
|
SendMessage((CpeMessageType)id, message, colorParse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendMessage(CpeMessageType id, string message, bool colorParse = true) {
|
||||||
|
if (id != CpeMessageType.Normal && !HasCpeExt(CpeExt.MessageTypes)) return;
|
||||||
if (colorParse)
|
if (colorParse)
|
||||||
message = Colors.EscapeColors(message);
|
message = Colors.EscapeColors(message);
|
||||||
StringBuilder sb = new StringBuilder(message);
|
StringBuilder sb = new StringBuilder(message);
|
||||||
@ -222,7 +228,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
byte[] buffer = new byte[66];
|
byte[] buffer = new byte[66];
|
||||||
buffer[0] = Opcode.Message;
|
buffer[0] = Opcode.Message;
|
||||||
buffer[1] = id;
|
buffer[1] = (byte)id;
|
||||||
if (HasCpeExt(CpeExt.FullCP437))
|
if (HasCpeExt(CpeExt.FullCP437))
|
||||||
NetUtils.WriteCP437(newLine, buffer, 2);
|
NetUtils.WriteCP437(newLine, buffer, 2);
|
||||||
else
|
else
|
||||||
|
@ -270,4 +270,10 @@ namespace MCGalaxy
|
|||||||
public const string TextColors = "TextColors";
|
public const string TextColors = "TextColors";
|
||||||
public const string BulkBlockUpdate = "BulkBlockUpdate";
|
public const string BulkBlockUpdate = "BulkBlockUpdate";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum CpeMessageType : byte {
|
||||||
|
Normal = 0, Status1 = 1, Status2 = 2, Status3 = 3,
|
||||||
|
BottomRight1 = 11, BottomRight2 = 12, BottomRight3 = 13,
|
||||||
|
Announcement = 100,
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user