diff --git a/Commands/CPE/CmdModel.cs b/Commands/CPE/CmdModel.cs
index 1904fa585..6ef3991e5 100644
--- a/Commands/CPE/CmdModel.cs
+++ b/Commands/CPE/CmdModel.cs
@@ -43,7 +43,7 @@ namespace MCGalaxy.Commands {
isBot = false;
who = PlayerInfo.FindOrShowMatches(p, args[0]);
if (who == null) return;
- }
+ }
} else if (p == null) {
Player.SendMessage(p, "Console can't use this command on itself."); return;
}
diff --git a/Commands/CPE/CmdSkin.cs b/Commands/CPE/CmdSkin.cs
new file mode 100644
index 000000000..fecf49e90
--- /dev/null
+++ b/Commands/CPE/CmdSkin.cs
@@ -0,0 +1,75 @@
+/*
+ Copyright 2015 MCGalaxy
+
+ Dual-licensed under the Educational Community License, Version 2.0 and
+ the GNU General Public License, Version 3 (the "Licenses"); you may
+ not use this file except in compliance with the Licenses. You may
+ obtain a copy of the Licenses at
+
+ http://www.opensource.org/licenses/ecl2.php
+ http://www.gnu.org/licenses/gpl-3.0.html
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the Licenses are distributed on an "AS IS"
+ BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ or implied. See the Licenses for the specific language governing
+ permissions and limitations under the Licenses.
+ */
+using System;
+
+namespace MCGalaxy.Commands {
+
+ public class CmdSkin : Command {
+
+ public override string name { get { return "skin"; } }
+ public override string shortcut { get { return ""; } }
+ public override string type { get { return CommandTypes.Other; } }
+ public override bool museumUsable { get { return true; } }
+ public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
+ static char[] trimChars = { ' ' };
+
+ public override void Use(Player p, string message) {
+ if (message == "") message = "normal";
+ Player who = p;
+ PlayerBot pBot = null;
+ bool isBot = message.CaselessStarts("bot ");
+ string[] args = message.Split(trimChars, isBot ? 3 : 2);
+
+ if (args.Length > 1) {
+ if (isBot && args.Length > 2) {
+ pBot = PlayerBot.Find(args[1]);
+ if (pBot == null) { Player.SendMessage(p, "There is no bot with that name."); return; }
+ } else {
+ isBot = false;
+ who = PlayerInfo.FindOrShowMatches(p, args[0]);
+ if (who == null) return;
+ }
+ } else if (p == null) {
+ Player.SendMessage(p, "Console can't use this command on itself."); return;
+ }
+
+ string skin = args[args.Length - 1];
+ if (!Player.ValidName(skin)) {
+ Player.SendMessage(p, "\"" + skin + "\" is not a valid skin name."); return;
+ }
+
+ if (isBot) {
+ pBot.skinName = skin;
+ pBot.GlobalDespawn();
+ pBot.GlobalSpawn();
+ Player.GlobalMessage("Bot " + pBot.name + "'s %Sskin was changed to &c" + skin);
+ } else {
+ who.skinName = skin;
+ Player.GlobalDespawn(who, true);
+ Player.GlobalSpawn(who, true);
+ Player.GlobalMessage(who.color + who.DisplayName + "'s %Sskin was changed to &c" + skin);
+ }
+ }
+
+ public override void Help(Player p) {
+ Player.SendMessage(p, "/skin [name] [skin] - Sets the skin of that player.");
+ Player.SendMessage(p, "/skin bot [name] [model] - Sets the model of that bot.");
+ Player.SendMessage(p, "For example, the player \"Test\" by default has the skin \"Test\".");
+ }
+ }
+}
diff --git a/Commands/Fun/ZombieSurvival/CmdReferee.cs b/Commands/Fun/ZombieSurvival/CmdReferee.cs
index 8333347df..0bfe10576 100644
--- a/Commands/Fun/ZombieSurvival/CmdReferee.cs
+++ b/Commands/Fun/ZombieSurvival/CmdReferee.cs
@@ -34,7 +34,7 @@ namespace MCGalaxy.Commands {
Player.SendChatFrom(p, p.FullName + " %Sis no longer a referee", false);
if (p.level == Server.zombie.CurLevel)
Server.zombie.PlayerJoinedLevel(p, Server.zombie.CurLevel, Server.zombie.CurLevel);
- Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], true, "");
+ Player.GlobalSpawn(p, true, "");
} else {
Player.SendChatFrom(p, p.FullName + " %Sis now a referee", false);
Server.zombie.PlayerLeftServer(p);
diff --git a/Commands/Moderation/CmdBan.cs b/Commands/Moderation/CmdBan.cs
index ec2bc8a34..accb91aa2 100644
--- a/Commands/Moderation/CmdBan.cs
+++ b/Commands/Moderation/CmdBan.cs
@@ -77,7 +77,7 @@ namespace MCGalaxy.Commands {
who.group = Group.findPerm(LevelPermission.Banned);
who.color = who.group.color;
Player.GlobalDespawn(who, false);
- Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
+ Player.GlobalSpawn(who, false);
}
string oldgroup = group.name.ToString();
diff --git a/Commands/Moderation/CmdHide.cs b/Commands/Moderation/CmdHide.cs
index e111eb922..f58092148 100644
--- a/Commands/Moderation/CmdHide.cs
+++ b/Commands/Moderation/CmdHide.cs
@@ -54,7 +54,7 @@ namespace MCGalaxy.Commands
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
if (messageOps && !p.opchat) opchat.Use(p, message);
} else {
- Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
+ Player.GlobalSpawn(p, false);
if (messageOps)
Chat.GlobalMessageOps("To Ops -" + p.color + p.DisplayName + "%S- is now &8visible%S.");
diff --git a/Commands/Moderation/CmdSetRank.cs b/Commands/Moderation/CmdSetRank.cs
index c85528e58..33f285d5e 100644
--- a/Commands/Moderation/CmdSetRank.cs
+++ b/Commands/Moderation/CmdSetRank.cs
@@ -63,9 +63,8 @@ namespace MCGalaxy.Commands
Player.GlobalDespawn(who, false);
who.SendMessage("You are now ranked " + newRank.color + newRank.name + Server.DefaultColor + ", type /help for your new set of commands.");
- who.SendUserType(Block.canPlace(who.group.Permission, Block.blackrock));
-
- Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
+ who.SendUserType(Block.canPlace(who.group.Permission, Block.blackrock));
+ Player.GlobalSpawn(who, false);
}
Server.IRC.Say(rankMsg);
}
diff --git a/Commands/Moderation/CmdUnban.cs b/Commands/Moderation/CmdUnban.cs
index 7e4c0ebf1..a4b68e9f2 100644
--- a/Commands/Moderation/CmdUnban.cs
+++ b/Commands/Moderation/CmdUnban.cs
@@ -135,8 +135,9 @@ namespace MCGalaxy.Commands
Server.s.Log("UNBANNED: by console");
Server.IRC.Say(message + " was unbanned by console.");
}
- who.group = Group.standard; who.color = who.group.color; Player.GlobalDespawn(who, false);
- Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
+ who.group = Group.standard; who.color = who.group.color;
+ Player.GlobalDespawn(who, false);
+ Player.GlobalSpawn(who, false);
Group.findPerm(LevelPermission.Banned).playerList.Remove(message);
}
}
diff --git a/Commands/other/CmdColor.cs b/Commands/other/CmdColor.cs
index 69c39c58e..08bae8427 100644
--- a/Commands/other/CmdColor.cs
+++ b/Commands/other/CmdColor.cs
@@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
Database.executeQuery(query, "UPDATE Players SET color = @Color WHERE name = @Name");
}
Player.GlobalDespawn(who, false);
- Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
+ Player.GlobalSpawn(who, false);
who.SetPrefix();
}
diff --git a/Commands/other/CmdNick.cs b/Commands/other/CmdNick.cs
index 8183f5a4b..6f3f9d4b7 100644
--- a/Commands/other/CmdNick.cs
+++ b/Commands/other/CmdNick.cs
@@ -51,7 +51,7 @@ namespace MCGalaxy.Commands {
}
Player.GlobalDespawn(who, false);
- Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
+ Player.GlobalSpawn(who, false);
PlayerDB.Save(who);
}
diff --git a/Games/CTF/CtfTeam.cs b/Games/CTF/CtfTeam.cs
index ca3534312..182df49b3 100644
--- a/Games/CTF/CtfTeam.cs
+++ b/Games/CTF/CtfTeam.cs
@@ -52,7 +52,7 @@ namespace MCGalaxy.Games
p.prefix = p.color + "[" + Colors.Name("&" + color).ToUpper() + "] ";
players.Add(p);
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, false);
}
}
@@ -68,7 +68,7 @@ namespace MCGalaxy.Games
p.Game.hasflag = null;
players.Remove(p);
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, false);
}
}
diff --git a/Games/ZombieSurvival/ZombieGame.Core.cs b/Games/ZombieSurvival/ZombieGame.Core.cs
index c8ac68bc3..64c17844f 100644
--- a/Games/ZombieSurvival/ZombieGame.Core.cs
+++ b/Games/ZombieSurvival/ZombieGame.Core.cs
@@ -254,7 +254,7 @@ namespace MCGalaxy.Games {
if (p.Game.lastSpawnColor == color) return;
p.Game.lastSpawnColor = color;
Player.GlobalDespawn(p, true);
- Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], true);
+ Player.GlobalSpawn(p, true);
}
void EndRound(object sender, ElapsedEventArgs e) {
@@ -309,7 +309,7 @@ namespace MCGalaxy.Games {
int money = GetMoney(pl, alive, rand);
Player.GlobalDespawn(pl, true);
- Player.GlobalSpawn(pl, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], true);
+ Player.GlobalSpawn(pl, true);
if (money == -1) {
pl.SendMessage("You may not hide inside a block! No " + Server.moneys + " for you."); money = 0;
} else if (money > 0) {
diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj
index aa4c6722e..76c3338d3 100644
--- a/MCGalaxy_.csproj
+++ b/MCGalaxy_.csproj
@@ -174,6 +174,7 @@
+
diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs
index 69eab4af9..39dd743f3 100644
--- a/Player/Player.Handlers.cs
+++ b/Player/Player.Handlers.cs
@@ -275,6 +275,7 @@ namespace MCGalaxy {
byte version = message[0];
name = enc.GetString(message, 1, 64).Trim();
truename = name;
+ skinName = name;
lock (pendingLock) {
pendingNames.Add(name);
diff --git a/Player/Player.cs b/Player/Player.cs
index 35e04a534..9e08a0bbd 100644
--- a/Player/Player.cs
+++ b/Player/Player.cs
@@ -58,7 +58,7 @@ namespace MCGalaxy {
public static bool storeHelp = false;
public static string storedHelp = "";
- internal string truename;
+ internal string truename, skinName;
internal bool dontmindme = false;
public Socket socket;
System.Timers.Timer timespent = new System.Timers.Timer(1000);
@@ -477,13 +477,17 @@ namespace MCGalaxy {
}
}
+ public static void GlobalSpawn(Player p, bool self, string possession = "") {
+ GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], self, possession);
+ }
+
public static void GlobalSpawn(Player p, ushort x, ushort y, ushort z,
byte rotx, byte roty, bool self, string possession = "") {
Player[] players = PlayerInfo.Online.Items;
p.Game.lastSpawnColor = p.Game.Infected ? ZombieGame.InfectCol : p.color;
foreach (Player other in players) {
- if ((other.Loading && p != other) || p.level != other.level) continue;
- if ((p.hidden || p.Game.Referee) && !self) continue;
+ if ((other.Loading && p != other) || p.level != other.level) continue;
+ if ((p.hidden || p.Game.Referee) && !self) continue;
if (p != other) {
other.SpawnEntity(p, p.id, x, y, z, rotx, roty, possession);
@@ -503,24 +507,25 @@ namespace MCGalaxy {
col = "&" + Colors.GetFallback(col[1]);
if (hasExtList) {
- SendExtAddEntity2(id, p.truename, col + p.truename + possession, x, y, z, rotx, roty);
- SendExtAddPlayerName(id, p.truename, col + p.truename, "&fPlayers", 0);
+ SendExtAddEntity2(id, p.skinName, col + p.truename + possession, x, y, z, rotx, roty);
+ SendExtAddPlayerName(id, p.skinName, col + p.truename, "&fPlayers", 0);
} else {
- SendSpawn(id, col + p.truename + possession, x, y, z, rotx, roty);
+ SendSpawn(id, col + p.truename + possession, x, y, z, rotx, roty);
}
return;
}
- string spawnName = p.truename;
- if (Server.zombie.ZombieName != "" && !Game.Aka)
- spawnName = Server.zombie.ZombieName;
-
- if (hasExtList) {
- SendExtAddEntity2(id, spawnName, Colors.red + spawnName + possession, x, y, z, rotx, roty);
- SendExtAddPlayerName(id, spawnName, Colors.red + spawnName, "&cZombies", 0);
- } else {
- SendSpawn(id, Colors.red + spawnName + possession, x, y, z, rotx, roty);
- }
+ string name = p.truename, skinName = p.skinName;
+ if (Server.zombie.ZombieName != "" && !Game.Aka) {
+ name = Server.zombie.ZombieName; skinName = name;
+ }
+
+ if (hasExtList) {
+ SendExtAddEntity2(id, skinName, Colors.red + name + possession, x, y, z, rotx, roty);
+ SendExtAddPlayerName(id, skinName, Colors.red + name, "&cZombies", 0);
+ } else {
+ SendSpawn(id, Colors.red + name + possession, x, y, z, rotx, roty);
+ }
if (hasChangeModel && id != 0xFF)
SendChangeModel(id, "zombie");
@@ -528,10 +533,10 @@ namespace MCGalaxy {
internal void SpawnEntity(PlayerBot b) {
if (hasExtList) {
- SendExtAddEntity2(b.id, b.name, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
- SendExtAddPlayerName(b.id, b.name, b.color + b.name, "Bots", 0);
+ SendExtAddEntity2(b.id, b.skinName, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
+ SendExtAddPlayerName(b.id, b.skinName, b.color + b.name, "Bots", 0);
} else {
- SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
+ SendSpawn(b.id, b.color + b.skinName, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
}
}
@@ -558,7 +563,7 @@ namespace MCGalaxy {
}
GlobalDespawn(this, true);
- GlobalSpawn(this, pos[0], pos[1], pos[2], rot[0], rot[1], true, marker);
+ GlobalSpawn(this, true, marker);
return true;
}
diff --git a/Player/PlayerBot.cs b/Player/PlayerBot.cs
index 49e4b37b0..89874fa19 100644
--- a/Player/PlayerBot.cs
+++ b/Player/PlayerBot.cs
@@ -32,7 +32,7 @@ namespace MCGalaxy {
public bool hunt = false, kill = false;
public string AIName = "";
- public string name;
+ public string name, skinName;
public string model = "humanoid";
public byte id;
public string color;
@@ -57,6 +57,7 @@ namespace MCGalaxy {
#region == constructors ==
public PlayerBot(string n, Level lvl, ushort x, ushort y, ushort z, byte rotx, byte roty) {
name = n;
+ skinName = n;
color = "&1";
id = FreeId();