mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Merge branch 'master' of github.com:Hetal728/MCGalaxy
This commit is contained in:
commit
994f317f67
@ -104,13 +104,13 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
static void SetupDefaultNames() {
|
||||
string[] names = { "air", "stone", "grass", "dirt", "cobblestone", "wood", "plant",
|
||||
"adminium", "active_water", "water", "active_lava", "lava", "sand", "gravel",
|
||||
"gold_ore", "iron_ore", "coal", "tree", "leaves", "sponge", "glass", "red",
|
||||
"orange", "yellow", "lime", "green", "springgreen", "cyan", "blue",
|
||||
"blueviolet", "indigo", "purple", "magenta", "pink", "black", "gray", "white",
|
||||
"yellow_flower", "red_flower", "brown_shroom", "red_shroom", "gold", "iron",
|
||||
"double_stair", "stair", "brick", "tnt", "bookcase", "mossy_cobblestone",
|
||||
string[] names = { "air", "stone", "grass", "dirt", "cobblestone", "wood", "sapling",
|
||||
"bedrock", "active_water", "water", "active_lava", "lava", "sand", "gravel",
|
||||
"gold_ore", "iron_ore", "coal", "log", "leaves", "sponge", "glass", "red",
|
||||
"orange", "yellow", "lime", "green", "teal", "aqua", "cyan",
|
||||
"blue", "indigo", "violet", "magenta", "pink", "black", "gray", "white",
|
||||
"dandelion", "rose", "brown_shroom", "red_shroom", "gold", "iron",
|
||||
"doubleslab", "slab", "brick", "tnt", "bookshelf", "mossyrocks",
|
||||
"obsidian", "cobblestoneslab", "rope", "sandstone", "snow", "fire", "lightpink",
|
||||
"forestgreen", "brown", "deepblue", "turquoise", "ice", "ceramictile", "magmablock",
|
||||
"pillar", "crate", "stonebrick", "door_darkpink_air", "door_darkgrey_air",
|
||||
@ -146,7 +146,7 @@ namespace MCGalaxy {
|
||||
"train", "creeper", "zombie", "zombie_head", "unknown", "dove", "pidgeon", "duck",
|
||||
"phoenix", "red_robin", "blue_bird", "unknown", "killer_phoenix", "unknown", "unknown",
|
||||
"goldfish", "sea_sponge", "shark", "salmon", "betta_fish", "lava_shark", "snake",
|
||||
"snake_tail", "door_gold", "door_gold_air", "unknown" };
|
||||
"snake_tail", "door_gold", "door_gold_air", "unknown" };
|
||||
for (int i = 0; i < names.Length; i++) {
|
||||
Properties[i].Name = names[i];
|
||||
if (names[i] != "unknown")
|
||||
@ -155,10 +155,15 @@ namespace MCGalaxy {
|
||||
Aliases[names[i].Replace("_", "")] = (byte)i;
|
||||
}
|
||||
|
||||
// Add old MCGalaxy aliases
|
||||
Aliases["greenyellow"] = lightgreen;
|
||||
// Add old MCGalaxy names
|
||||
Aliases["purple"] = purple; Aliases["blueviolet"] = blue;
|
||||
Aliases["adminium"] = blackrock; Aliases["bookcase"] = bookcase;
|
||||
Aliases["plant"] = shrub; Aliases["mossy_cobblestone"] = stonevine;
|
||||
Aliases["springgreen"] = aquagreen; Aliases["greenyellow"] = lightgreen;
|
||||
Aliases["red_flower"] = redflower; Aliases["yellow_flower"] = yellowflower;
|
||||
Aliases["stair"] = staircasestep; Aliases["double_stair"] = staircasefull;
|
||||
// Add other aliases
|
||||
Aliases["planks"] = wood; Aliases["log"] = trunk;
|
||||
Aliases["planks"] = wood; Aliases["tree"] = trunk;
|
||||
Aliases["stairs"] = staircasestep; Aliases["slab"] = staircasestep;
|
||||
Aliases["doubleslab"] = staircasefull; Aliases["slabfull"] = staircasefull;
|
||||
Aliases["solid"] = blackrock; Aliases["admintite"] = blackrock;
|
||||
|
@ -28,18 +28,17 @@ namespace MCGalaxy.Bots {
|
||||
};
|
||||
|
||||
static bool DoWalk(PlayerBot bot) {
|
||||
bot.foundPos[0] = bot.Waypoints[bot.currentPoint].x;
|
||||
bot.foundPos[1] = bot.Waypoints[bot.currentPoint].y;
|
||||
bot.foundPos[2] = bot.Waypoints[bot.currentPoint].z;
|
||||
bot.foundPos[0] = bot.Waypoints[bot.cur].x;
|
||||
bot.foundPos[1] = bot.Waypoints[bot.cur].y;
|
||||
bot.foundPos[2] = bot.Waypoints[bot.cur].z;
|
||||
bot.movement = true;
|
||||
|
||||
if ((ushort)(bot.pos[0] / 32) == (ushort)(bot.Waypoints[bot.currentPoint].x / 32)) {
|
||||
if ((ushort)(bot.pos[2] / 32) == (ushort)(bot.Waypoints[bot.currentPoint].z / 32)) {
|
||||
bot.rot[0] = bot.Waypoints[bot.currentPoint].rotx;
|
||||
bot.rot[1] = bot.Waypoints[bot.currentPoint].roty;
|
||||
if ((ushort)(bot.pos[0] / 32) == (ushort)(bot.Waypoints[bot.cur].x / 32)) {
|
||||
if ((ushort)(bot.pos[2] / 32) == (ushort)(bot.Waypoints[bot.cur].z / 32)) {
|
||||
bot.rot[0] = bot.Waypoints[bot.cur].rotx;
|
||||
bot.rot[1] = bot.Waypoints[bot.cur].roty;
|
||||
bot.movement = false;
|
||||
bot.NextInstruction();
|
||||
return false;
|
||||
bot.NextInstruction(); return false;
|
||||
}
|
||||
}
|
||||
bot.AdvanceRotation();
|
||||
@ -47,26 +46,89 @@ namespace MCGalaxy.Bots {
|
||||
}
|
||||
|
||||
static bool DoTeleport(PlayerBot bot) {
|
||||
bot.pos[0] = bot.Waypoints[bot.currentPoint].x;
|
||||
bot.pos[1] = bot.Waypoints[bot.currentPoint].y;
|
||||
bot.pos[2] = bot.Waypoints[bot.currentPoint].z;
|
||||
bot.rot[0] = bot.Waypoints[bot.currentPoint].rotx;
|
||||
bot.rot[1] = bot.Waypoints[bot.currentPoint].roty;
|
||||
bot.pos[0] = bot.Waypoints[bot.cur].x;
|
||||
bot.pos[1] = bot.Waypoints[bot.cur].y;
|
||||
bot.pos[2] = bot.Waypoints[bot.cur].z;
|
||||
bot.rot[0] = bot.Waypoints[bot.cur].rotx;
|
||||
bot.rot[1] = bot.Waypoints[bot.cur].roty;
|
||||
bot.NextInstruction();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool DoWait(PlayerBot bot) {
|
||||
if (bot.countdown != 0) {
|
||||
bot.countdown--;
|
||||
if (bot.countdown == 0) {
|
||||
bot.NextInstruction();
|
||||
return false;
|
||||
if (bot.countdown == 0) {
|
||||
bot.countdown = bot.Waypoints[bot.cur].seconds;
|
||||
return true;
|
||||
}
|
||||
|
||||
bot.countdown--;
|
||||
if (bot.countdown == 0) { bot.NextInstruction(); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool DoNod(PlayerBot bot) {
|
||||
if (bot.countdown == 0) {
|
||||
bot.countdown = bot.Waypoints[bot.cur].seconds;
|
||||
return true;
|
||||
}
|
||||
bot.countdown--;
|
||||
|
||||
byte speed = (byte)bot.Waypoints[bot.cur].rotspeed;
|
||||
if (bot.nodUp) {
|
||||
if (bot.rot[1] > 32 && bot.rot[1] < 128) {
|
||||
bot.nodUp = !bot.nodUp;
|
||||
} else {
|
||||
if (bot.rot[1] + speed > 255) bot.rot[1] = 0;
|
||||
else bot.rot[1] += speed;
|
||||
}
|
||||
} else {
|
||||
bot.countdown = bot.Waypoints[bot.currentPoint].seconds;
|
||||
if (bot.rot[1] > 128 && bot.rot[1] < 224) {
|
||||
bot.nodUp = !bot.nodUp;
|
||||
} else {
|
||||
if (bot.rot[1] - speed < 0) bot.rot[1] = 255;
|
||||
else bot.rot[1] -= speed;
|
||||
}
|
||||
}
|
||||
|
||||
if (bot.countdown == 0) { bot.NextInstruction(); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool DoSpin(PlayerBot bot) {
|
||||
if (bot.countdown == 0) {
|
||||
bot.countdown = bot.Waypoints[bot.cur].seconds;
|
||||
return true;
|
||||
}
|
||||
bot.countdown--;
|
||||
|
||||
byte speed = (byte)bot.Waypoints[bot.cur].rotspeed;
|
||||
if (bot.rot[0] + speed > 255) bot.rot[0] = 0;
|
||||
else if (bot.rot[0] + speed < 0) bot.rot[0] = 255;
|
||||
else bot.rot[0] += speed;
|
||||
|
||||
if (bot.countdown == 0) { bot.NextInstruction(); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool DoSpeed(PlayerBot bot) {
|
||||
bot.movementSpeed = (int)Math.Round(24m / 100m * bot.Waypoints[bot.cur].seconds);
|
||||
if (bot.movementSpeed == 0) bot.movementSpeed = 1;
|
||||
bot.NextInstruction(); return true;
|
||||
}
|
||||
|
||||
static bool DoJump(PlayerBot bot) {
|
||||
bot.jumpTimer.Elapsed += delegate {
|
||||
bot.currentjump++;
|
||||
switch (bot.currentjump) {
|
||||
case 1:
|
||||
case 2: bot.pos[1] += 24; break;
|
||||
case 3: break;
|
||||
case 4: bot.pos[1] -= 24; break;
|
||||
case 5: bot.pos[1] -= 24; bot.jumping = false; bot.currentjump = 0; bot.jumpTimer.Stop(); break;
|
||||
}
|
||||
};
|
||||
bot.jumpTimer.Start();
|
||||
bot.NextInstruction(); return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace MCGalaxy {
|
||||
public byte id;
|
||||
public string color;
|
||||
public Level level;
|
||||
public int currentPoint = 0;
|
||||
public int cur = 0;
|
||||
public int countdown = 0;
|
||||
public bool nodUp = false;
|
||||
public List<Pos> Waypoints = new List<Pos>();
|
||||
@ -48,12 +48,12 @@ namespace MCGalaxy {
|
||||
public byte[] rot = new byte[2], oldrot = new byte[2], foundRot = new byte[2];
|
||||
public bool movement = false;
|
||||
public int movementSpeed = 24;
|
||||
bool jumping = false;
|
||||
int currentjump = 0;
|
||||
internal bool jumping = false;
|
||||
internal int currentjump = 0;
|
||||
|
||||
System.Timers.Timer botTimer = new System.Timers.Timer(100);
|
||||
System.Timers.Timer moveTimer = new System.Timers.Timer(100 / 24);
|
||||
System.Timers.Timer jumpTimer = new System.Timers.Timer(95);
|
||||
internal System.Timers.Timer jumpTimer = new System.Timers.Timer(95);
|
||||
|
||||
public PlayerBot(string n, Level lvl, ushort x, ushort y, ushort z, byte rotx, byte roty) {
|
||||
name = n;
|
||||
@ -86,8 +86,7 @@ namespace MCGalaxy {
|
||||
bool skip = false;
|
||||
|
||||
retry:
|
||||
switch (Waypoints[currentPoint].type)
|
||||
{
|
||||
switch (Waypoints[cur].type) {
|
||||
case "walk":
|
||||
if (!DoWalk(ref skip)) goto retry;
|
||||
break;
|
||||
@ -107,33 +106,32 @@ namespace MCGalaxy {
|
||||
if (!DoSpeed(ref skip)) goto retry;
|
||||
return;
|
||||
case "reset":
|
||||
currentPoint = 0;
|
||||
cur = 0;
|
||||
return;
|
||||
case "remove":
|
||||
PlayerBot.Remove(this);
|
||||
return;
|
||||
case "linkscript":
|
||||
if (File.Exists("bots/" + Waypoints[currentPoint].newscript)) {
|
||||
Command.all.Find("botset").Use(null, this.name + " " + Waypoints[currentPoint].newscript);
|
||||
if (File.Exists("bots/" + Waypoints[cur].newscript)) {
|
||||
Command.all.Find("botset").Use(null, name + " " + Waypoints[cur].newscript);
|
||||
return;
|
||||
}
|
||||
|
||||
currentPoint++;
|
||||
if (currentPoint == Waypoints.Count) currentPoint = 0;
|
||||
cur++;
|
||||
if (cur == Waypoints.Count) cur = 0;
|
||||
if (!skip) { skip = true; goto retry; }
|
||||
return;
|
||||
case "jump":
|
||||
if (!DoJump(ref skip)) goto retry;
|
||||
break;
|
||||
}
|
||||
|
||||
if (currentPoint == Waypoints.Count) currentPoint = 0;
|
||||
if (cur == Waypoints.Count) cur = 0;
|
||||
}
|
||||
AdvanceRotation();
|
||||
}
|
||||
|
||||
public void AdvanceRotation() {
|
||||
if (!movement && Waypoints.Count > 0) {
|
||||
if (!movement && Waypoints.Count > 0) {
|
||||
if (rot[0] < 245) rot[0] += 8;
|
||||
else rot[0] = 0;
|
||||
|
||||
@ -144,21 +142,21 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
public void NextInstruction() {
|
||||
currentPoint++;
|
||||
if (currentPoint == Waypoints.Count)
|
||||
currentPoint = 0;
|
||||
cur++;
|
||||
if (cur == Waypoints.Count)
|
||||
cur = 0;
|
||||
}
|
||||
|
||||
bool DoWalk(ref bool skip) {
|
||||
foundPos[0] = Waypoints[currentPoint].x;
|
||||
foundPos[1] = Waypoints[currentPoint].y;
|
||||
foundPos[2] = Waypoints[currentPoint].z;
|
||||
foundPos[0] = Waypoints[cur].x;
|
||||
foundPos[1] = Waypoints[cur].y;
|
||||
foundPos[2] = Waypoints[cur].z;
|
||||
movement = true;
|
||||
|
||||
if ((ushort)(pos[0] / 32) == (ushort)(Waypoints[currentPoint].x / 32)) {
|
||||
if ((ushort)(pos[2] / 32) == (ushort)(Waypoints[currentPoint].z / 32)) {
|
||||
rot[0] = Waypoints[currentPoint].rotx;
|
||||
rot[1] = Waypoints[currentPoint].roty;
|
||||
if ((ushort)(pos[0] / 32) == (ushort)(Waypoints[cur].x / 32)) {
|
||||
if ((ushort)(pos[2] / 32) == (ushort)(Waypoints[cur].z / 32)) {
|
||||
rot[0] = Waypoints[cur].rotx;
|
||||
rot[1] = Waypoints[cur].roty;
|
||||
movement = false;
|
||||
NextInstruction();
|
||||
if (!skip) { skip = true; return false; }
|
||||
@ -168,11 +166,11 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
void DoTeleport() {
|
||||
pos[0] = Waypoints[currentPoint].x;
|
||||
pos[1] = Waypoints[currentPoint].y;
|
||||
pos[2] = Waypoints[currentPoint].z;
|
||||
rot[0] = Waypoints[currentPoint].rotx;
|
||||
rot[1] = Waypoints[currentPoint].roty;
|
||||
pos[0] = Waypoints[cur].x;
|
||||
pos[1] = Waypoints[cur].y;
|
||||
pos[2] = Waypoints[cur].z;
|
||||
rot[0] = Waypoints[cur].rotx;
|
||||
rot[1] = Waypoints[cur].roty;
|
||||
NextInstruction();
|
||||
}
|
||||
|
||||
@ -180,11 +178,11 @@ namespace MCGalaxy {
|
||||
if (countdown != 0) {
|
||||
countdown--;
|
||||
if (countdown == 0) {
|
||||
NextInstruction();
|
||||
NextInstruction();
|
||||
if (!skip) { skip = true; return false; }
|
||||
}
|
||||
} else {
|
||||
countdown = Waypoints[currentPoint].seconds;
|
||||
countdown = Waypoints[cur].seconds;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -197,24 +195,24 @@ namespace MCGalaxy {
|
||||
if (rot[1] > 32 && rot[1] < 128) nodUp = !nodUp;
|
||||
else
|
||||
{
|
||||
if (rot[1] + (byte)Waypoints[currentPoint].rotspeed > 255) rot[1] = 0;
|
||||
else rot[1] += (byte)Waypoints[currentPoint].rotspeed;
|
||||
if (rot[1] + (byte)Waypoints[cur].rotspeed > 255) rot[1] = 0;
|
||||
else rot[1] += (byte)Waypoints[cur].rotspeed;
|
||||
}
|
||||
} else {
|
||||
if (rot[1] > 128 && rot[1] < 224) nodUp = !nodUp;
|
||||
else
|
||||
{
|
||||
if (rot[1] - (byte)Waypoints[currentPoint].rotspeed < 0) rot[1] = 255;
|
||||
else rot[1] -= (byte)Waypoints[currentPoint].rotspeed;
|
||||
if (rot[1] - (byte)Waypoints[cur].rotspeed < 0) rot[1] = 255;
|
||||
else rot[1] -= (byte)Waypoints[cur].rotspeed;
|
||||
}
|
||||
}
|
||||
|
||||
if (countdown == 0) {
|
||||
NextInstruction();
|
||||
NextInstruction();
|
||||
if (!skip) { skip = true; return false; }
|
||||
}
|
||||
} else {
|
||||
countdown = Waypoints[currentPoint].seconds;
|
||||
countdown = Waypoints[cur].seconds;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -223,22 +221,22 @@ namespace MCGalaxy {
|
||||
if (countdown != 0) {
|
||||
countdown--;
|
||||
|
||||
if (rot[0] + (byte)Waypoints[currentPoint].rotspeed > 255) rot[0] = 0;
|
||||
else if (rot[0] + (byte)Waypoints[currentPoint].rotspeed < 0) rot[0] = 255;
|
||||
else rot[0] += (byte)Waypoints[currentPoint].rotspeed;
|
||||
if (rot[0] + (byte)Waypoints[cur].rotspeed > 255) rot[0] = 0;
|
||||
else if (rot[0] + (byte)Waypoints[cur].rotspeed < 0) rot[0] = 255;
|
||||
else rot[0] += (byte)Waypoints[cur].rotspeed;
|
||||
|
||||
if (countdown == 0) {
|
||||
NextInstruction();
|
||||
NextInstruction();
|
||||
if (!skip) { skip = true; return false; }
|
||||
}
|
||||
} else {
|
||||
countdown = Waypoints[currentPoint].seconds;
|
||||
countdown = Waypoints[cur].seconds;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DoSpeed(ref bool skip) {
|
||||
movementSpeed = (int)Math.Round(24m / 100m * Waypoints[currentPoint].seconds);
|
||||
movementSpeed = (int)Math.Round(24m / 100m * Waypoints[cur].seconds);
|
||||
if (movementSpeed == 0) movementSpeed = 1;
|
||||
|
||||
NextInstruction();
|
||||
@ -258,7 +256,7 @@ namespace MCGalaxy {
|
||||
case 5: pos[1] -= 24; jumping = false; currentjump = 0; jumpTimer.Stop(); break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
jumpTimer.Start();
|
||||
NextInstruction();
|
||||
if (!skip) { skip = true; return false; }
|
||||
@ -399,7 +397,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
public static void UnloadFromLevel(Level lvl) {
|
||||
BotsFile.UnloadBots(lvl);
|
||||
BotsFile.UnloadBots(lvl);
|
||||
RemoveAll(lvl, false);
|
||||
}
|
||||
|
||||
@ -464,14 +462,14 @@ namespace MCGalaxy {
|
||||
foreach (PlayerBot bot in bots) {
|
||||
if (bot.name.ToLower() == name) return bot;
|
||||
if (bot.name.ToLower().Contains(name)) {
|
||||
match = bot; matches++;
|
||||
match = bot; matches++;
|
||||
}
|
||||
}
|
||||
return matches == 1 ? match : null;
|
||||
}
|
||||
|
||||
public static PlayerBot FindOrShowMatches(Player pl, string name) {
|
||||
int matches = 0;
|
||||
int matches = 0;
|
||||
return Extensions.FindOrShowMatches(pl, name, out matches, Bots.Items, b => true,
|
||||
b => b.name, "bots");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace MCGalaxy.Bots {
|
||||
|
||||
PlayerBot.Pos newPos = new PlayerBot.Pos();
|
||||
try { bot.Waypoints.Clear(); } catch { }
|
||||
bot.currentPoint = 0; bot.countdown = 0; bot.movementSpeed = 12;
|
||||
bot.cur = 0; bot.countdown = 0; bot.movementSpeed = 12;
|
||||
|
||||
foreach (string line in codes) {
|
||||
if (line == "" || line[0] == '#') continue;
|
||||
|
@ -27,6 +27,9 @@ namespace MCGalaxy.Commands {
|
||||
public override string type { get { return CommandTypes.Chat; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new [] { new CommandAlias("deafen", "ignore all") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (p == null) { MessageInGameOnly(p); return; }
|
||||
@ -35,37 +38,53 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
if (action == "all") {
|
||||
p.ignoreAll = !p.ignoreAll;
|
||||
Player.Message(p, p.ignoreAll ? "&cAll chat is now ignored!" : "&aAll chat is no longer ignored!");
|
||||
Player.Message(p, p.ignoreAll ? "&cNow ignoring all chat" : "&aNo longer ignoring all chat");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "irc") {
|
||||
p.ignoreIRC = !p.ignoreIRC;
|
||||
Player.Message(p, p.ignoreIRC ? "&cIRC chat is now ignored!" : "&aIRC chat is no longer ignored!");
|
||||
Player.Message(p, p.ignoreIRC ? "&cNow ignoring IRC chat" : "&aNo longer ignoring IRC chat");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "global") {
|
||||
p.ignoreGlobal = !p.ignoreGlobal;
|
||||
Player.Message(p, p.ignoreGlobal ? "&cGlobal Chat is now ignored!" : "&aGlobal Chat is no longer ignored!");
|
||||
Player.Message(p, p.ignoreGlobal ? "&cNow ignoring Global Chat" : "&aNo longer ignoring Global Chat");
|
||||
CreateIgnoreFile(p); return;
|
||||
} else if (action == "list") {
|
||||
Player.Message(p, "&cCurrently ignoring the following players:");
|
||||
string names = string.Join(", ", p.listignored);
|
||||
if (names != "") Player.Message(p, names);
|
||||
if (p.ignoreAll) Player.Message(p, "&cIgnoring all chat.");
|
||||
if (p.ignoreIRC) Player.Message(p, "&cIgnoring IRC chat.");
|
||||
if (p.ignoreGlobal) Player.Message(p, "&cIgnoring global chat.");
|
||||
if (p.ignoreAll) Player.Message(p, "&cIgnoring all chat");
|
||||
if (p.ignoreIRC) Player.Message(p, "&cIgnoring IRC chat");
|
||||
if (p.ignoreGlobal) Player.Message(p, "&cIgnoring global chat");
|
||||
return;
|
||||
}
|
||||
|
||||
Player who = PlayerInfo.Find(action);
|
||||
if (who == null) { Player.Message(p, "Could not find player specified."); return; }
|
||||
if (who.name == p.name) { Player.Message(p, "You cannot ignore yourself."); return; }
|
||||
CreateIgnoreFile(p);
|
||||
string unignore = null;
|
||||
for (int i = 0; i < p.listignored.Count; i++) {
|
||||
if (!action.CaselessEq(p.listignored[i])) continue;
|
||||
unignore = p.listignored[i]; break;
|
||||
}
|
||||
|
||||
if (!p.listignored.Contains(who.name)) {
|
||||
p.listignored.Add(who.name);
|
||||
Player.Message(p, "Player now ignored: &c" + who.DisplayName + "!");
|
||||
if (unignore != null) {
|
||||
p.listignored.Remove(unignore);
|
||||
Player.Message(p, "&aNo longer ignoring {0}", unignore);
|
||||
} else {
|
||||
p.listignored.Remove(who.name);
|
||||
Player.Message(p, "Player is no longer ignored: &a" + who.DisplayName + "!");
|
||||
int matches = 0;
|
||||
Player who = PlayerInfo.FindOrShowMatches(p, action);
|
||||
if (who == null) {
|
||||
if (matches == 0)
|
||||
Player.SendMessage(p, "You must use the full name when unignoring offline players.");
|
||||
return;
|
||||
}
|
||||
if (p.name == who.name) { Player.Message(p, "You cannot ignore yourself."); return; }
|
||||
|
||||
if (p.listignored.Contains(who.name)) {
|
||||
p.listignored.Remove(who.name);
|
||||
Player.Message(p, "&aNo longer ignoring {0}", who.ColoredName);
|
||||
} else {
|
||||
p.listignored.Add(who.name);
|
||||
Player.Message(p, "&cNow ignoring {0}", who.ColoredName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +100,7 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "%H If name is \"all\", all chat is ignored.");
|
||||
Player.Message(p, "%H If name is \"global\", MCGalaxy global chat is ignored.");
|
||||
Player.Message(p, "%H If name is \"irc\", IRC chat is ignored.");
|
||||
Player.Message(p, "%H Otherwise, the online player matching the name is ignored.");
|
||||
Player.Message(p, "%H Otherwise, the online player matching the name is ignored.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace MCGalaxy {
|
||||
public abstract LevelPermission defaultRank { get; }
|
||||
public abstract void Use(Player p, string message);
|
||||
public abstract void Help(Player p);
|
||||
public virtual void Help(Player p, string message) { Help(p); }
|
||||
public virtual CommandPerm[] AdditionalPerms { get { return null; } }
|
||||
public virtual CommandEnable Enabled { get { return CommandEnable.Always; } }
|
||||
public virtual CommandAlias[] Aliases { get { return null; } }
|
||||
|
@ -237,7 +237,6 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdTpZone()), "tp zone teleport");
|
||||
new CommandKeywords((new CmdTree()), "log");
|
||||
new CommandKeywords((new CmdTrust()), "allow agree");
|
||||
new CommandKeywords((new CmdUBan()), "ban undo kick mod");
|
||||
new CommandKeywords((new CmdUnban()), "undo ban kick mod");
|
||||
new CommandKeywords((new CmdUnbanip()), "undo ban ip kick mod");
|
||||
new CommandKeywords((new CmdUndo()), "redo action block change");
|
||||
@ -259,7 +258,7 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdWhois()), "who player info");
|
||||
new CommandKeywords((new CmdWrite()), "block text");
|
||||
new CommandKeywords((new CmdWriteText()), "block text");
|
||||
new CommandKeywords((new CmdXban()), "ban undo admin");
|
||||
new CommandKeywords((new CmdXban()), "ban undo admin mod");
|
||||
new CommandKeywords((new CmdXJail()), "extra jail undo");
|
||||
new CommandKeywords((new CmdXmute()), "mute extra");
|
||||
new CommandKeywords((new CmdZombieGame()), "zombie game");
|
||||
|
@ -29,11 +29,10 @@ namespace MCGalaxy.Commands
|
||||
get { return new[] { new CommandAlias("cmdhelp"), new CommandAlias("ranks", "ranks") }; }
|
||||
}
|
||||
public CmdHelp() { }
|
||||
static char[] trimChars = { ' ' };
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
switch (message.ToLower())
|
||||
{
|
||||
public override void Use(Player p, string message) {
|
||||
switch (message.ToLower()) {
|
||||
case "":
|
||||
Player.Message(p, "Command Categories:");
|
||||
Player.Message(p, " %aBuilding Chat Economy Games Info Moderation Other World");
|
||||
@ -74,13 +73,17 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
|
||||
bool ParseCommand(Player p, string message) {
|
||||
Command cmd = Command.all.Find(message);
|
||||
string[] args = message.Split(trimChars, 2);
|
||||
Command cmd = Command.all.Find(args[0]);
|
||||
if (cmd == null) return false;
|
||||
cmd.Help(p);
|
||||
if (args.Length == 1)
|
||||
cmd.Help(p);
|
||||
else
|
||||
cmd.Help(p, args[1]);
|
||||
|
||||
LevelPermission minPerm = GrpCommands.MinPerm(cmd);
|
||||
Player.Message(p, "Rank needed: " + GetColoredRank(minPerm));
|
||||
PrintAliases(p, cmd);
|
||||
|
||||
PrintAliases(p, cmd);
|
||||
CommandPerm[] perms = cmd.AdditionalPerms;
|
||||
if (perms == null) return true;
|
||||
|
||||
|
@ -101,9 +101,9 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
|
||||
static void AddStates(Player pl, ref string name) {
|
||||
if (pl.hidden) name += "(hidden)";
|
||||
if (pl.muted) name += "(muted)";
|
||||
if (pl.frozen) name += "(frozen)";
|
||||
if (pl.hidden) name += "-hidden";
|
||||
if (pl.muted) name += "-muted";
|
||||
if (pl.frozen) name += "-freeze";
|
||||
if (pl.Game.Referee) name += "-ref";
|
||||
if (pl.IsAfk) name += "-afk";
|
||||
}
|
||||
|
@ -32,15 +32,11 @@ namespace MCGalaxy.Commands {
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
|
||||
bool stealth = false, totalBan = false;
|
||||
bool stealth = false;
|
||||
if (message[0] == '#') {
|
||||
message = message.Remove(0, 1).Trim();
|
||||
stealth = true;
|
||||
Server.s.Log("Stealth ban Attempted by " + (p == null ? "Console" : p.ColoredName));
|
||||
} else if (message[0] == '@') {
|
||||
message = message.Remove(0, 1).Trim();
|
||||
totalBan = true;
|
||||
Server.s.Log("Total ban Attempted by " + (p == null ? "Console" : p.ColoredName));
|
||||
}
|
||||
|
||||
string[] args = message.Split(trimChars, 2);
|
||||
@ -87,10 +83,6 @@ namespace MCGalaxy.Commands {
|
||||
Server.IRC.Say(banMsg);
|
||||
|
||||
Server.s.Log("BANNED: " + target.ToLower() + " by " + banner);
|
||||
if (totalBan) {
|
||||
Command.all.Find("undo").Use(p, target + " 0");
|
||||
Command.all.Find("banip").Use(p, "@ " + target);
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckPerms(string name, Group group, Player p) {
|
||||
@ -109,7 +101,6 @@ namespace MCGalaxy.Commands {
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/ban <player> [reason] - Bans a player without kicking them.");
|
||||
Player.Message(p, "Add # before name to stealth ban.");
|
||||
Player.Message(p, "Add @ before name to total ban.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
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.
|
||||
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdGcbanlistupdate : Command
|
||||
{
|
||||
public override string name { get { return "gcbanlistupdate"; } }
|
||||
public override string shortcut { get { return "gcbu"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
Server.UpdateGlobalSettings();
|
||||
Player.GlobalMessage("The Global Banlist has been updated.");
|
||||
}
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.Message(p, "/gcbanlistupdate - Updates the global chat ban list for this server.");
|
||||
}
|
||||
}
|
||||
}*/
|
@ -67,10 +67,12 @@ namespace MCGalaxy.Commands
|
||||
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
||||
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
|
||||
if (messageOps && !p.opchat) opchat.Use(p, message);
|
||||
Server.Hidden.Append(p.name);
|
||||
} else {
|
||||
Entities.GlobalSpawn(p, false);
|
||||
p.hidden = false;
|
||||
p.otherRankHidden = false;
|
||||
p.oHideRank = LevelPermission.Null;
|
||||
if (messageOps)
|
||||
Chat.GlobalMessageAdmins("To Admins -" + p.ColoredName + "%S- is now &fvisible%S.");
|
||||
|
||||
@ -78,6 +80,7 @@ namespace MCGalaxy.Commands
|
||||
Server.IRC.Say(p.DisplayName + " joined the game");
|
||||
if (messageOps && p.opchat) opchat.Use(p, message);
|
||||
if (p.adminchat) adminchat.Use(p, message);
|
||||
Server.Hidden.DeleteStartsWith(p.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,25 +15,22 @@
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdKickban : Command
|
||||
{
|
||||
namespace MCGalaxy.Commands {
|
||||
public sealed class CmdKickban : Command {
|
||||
public override string name { get { return "kickban"; } }
|
||||
public override string shortcut { get { return "kb"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public CmdKickban() { }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
Command.all.Find("ban").Use(p, message);
|
||||
Command.all.Find("kick").Use(p, message);
|
||||
}
|
||||
public override void Help(Player p)
|
||||
{
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/kickban <player> [message] - Kicks and bans a player with an optional message.");
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
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.
|
||||
*/
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdUBan : Command
|
||||
{
|
||||
public override string name { get { return "uban"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
|
||||
public CmdUBan() { }
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
|
||||
if (message == "") { Help(p); return; }
|
||||
|
||||
Player who = PlayerInfo.Find(message.Split(' ')[0]);
|
||||
string msg = message.Split(' ')[0];
|
||||
if (who != null)
|
||||
{
|
||||
string name = who.name;
|
||||
Command.all.Find("ban").Use(p, msg);
|
||||
Command.all.Find("kick").Use(p, message);
|
||||
Command.all.Find("xundo").Use(p, name);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Command.all.Find("ban").Use(p, msg);
|
||||
Command.all.Find("xundo").Use(p, msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.Message(p, "/uban [name] [message]- Bans, undoes, and kicks [name] with [message], if specified.");
|
||||
}
|
||||
}
|
||||
}
|
@ -32,14 +32,13 @@ namespace MCGalaxy.Commands {
|
||||
string name = message.Split(' ')[0];
|
||||
Player who = PlayerInfo.Find(name);
|
||||
Command.all.Find("ban").Use(p, message);
|
||||
Command.all.Find("banip").Use(p, "@" + name);
|
||||
if (who != null)
|
||||
Command.all.Find("kick").Use(p, message);
|
||||
Command.all.Find("undo").Use(p, name + " all");
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/xban [name] [message]- Bans, banips, undoes, and kicks [name] with [message], if specified.");
|
||||
Player.Message(p, "/xban [name] [message]- Bans, undoes, and kicks [name] with [message], if specified.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ namespace MCGalaxy.Commands
|
||||
bool useSeed = args.Length == 6;
|
||||
if (useSeed && !Int32.TryParse(args[5], out seed))
|
||||
seed = args[5].GetHashCode();
|
||||
if (!MapGen.OkayAxis(x)) { Player.Message(p, "width must be a power of two >= to 16."); return; }
|
||||
if (!MapGen.OkayAxis(y)) { Player.Message(p, "height must be a power of two >= to 16."); return; }
|
||||
if (!MapGen.OkayAxis(z)) { Player.Message(p, "length must be a power of two >= to 16."); return; }
|
||||
if (!MapGen.OkayAxis(x)) { Player.Message(p, "width must divisible by 16, and >= 16"); return; }
|
||||
if (!MapGen.OkayAxis(y)) { Player.Message(p, "height must be divisible by 16, and >= 16"); return; }
|
||||
if (!MapGen.OkayAxis(z)) { Player.Message(p, "length must be divisible by 16, and >= to 16."); return; }
|
||||
|
||||
if (!Player.ValidName(name)) {
|
||||
Player.Message(p, "Invalid name!"); return;
|
||||
@ -92,7 +92,7 @@ namespace MCGalaxy.Commands
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/newlvl - creates a new level.");
|
||||
Player.Message(p, "/newlvl mapname 128 64 128 type seed");
|
||||
Player.Message(p, "Valid sizes: 16, 32, 64, 128, 256, 512, 1024"); //Update this to add more?
|
||||
Player.Message(p, "Valid sizes: Must be >= 16 and <= 1024, and divisible by 16.");
|
||||
MapGen.PrintValidFormats(p);
|
||||
Player.Message(p, "The seed is optional, and controls how the level is generated.");
|
||||
Player.Message(p, "If the seed is the same, the generated level will be the same.");
|
||||
|
@ -34,16 +34,12 @@ namespace MCGalaxy.Commands {
|
||||
if (message == "") {
|
||||
Player.Message(p, "Your current brush is: " + p.BrushName); return;
|
||||
}
|
||||
string[] args = message.Split(trimChars, 2);
|
||||
string[] args = message.Split(trimChars, 2);
|
||||
string brush = FindBrush(args[0]);
|
||||
|
||||
if (brush == null) {
|
||||
if (message.CaselessStarts("help")) {
|
||||
HandleHelp(p, args);
|
||||
} else {
|
||||
Player.Message(p, "No brush found with name \"" + args[0] + "\".");
|
||||
Player.Message(p, "Available brushes: " + AvailableBrushes);
|
||||
}
|
||||
Player.Message(p, "No brush found with name \"" + args[0] + "\".");
|
||||
Player.Message(p, "Available brushes: " + AvailableBrushes);
|
||||
} else {
|
||||
Player.Message(p, "Set your brush to: " + brush);
|
||||
p.BrushName = brush;
|
||||
@ -51,20 +47,6 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
void HandleHelp(Player p, string[] args) {
|
||||
if (args.Length != 2) { Help(p); return; }
|
||||
|
||||
string brush = FindBrush(args[1]);
|
||||
if (brush == null) {
|
||||
Player.Message(p, "No brush found with name \"" + args[1] + "\".");
|
||||
Player.Message(p, "Available brushes: " + AvailableBrushes);
|
||||
} else {
|
||||
string[] help = Brush.BrushesHelp[brush];
|
||||
foreach (string line in help)
|
||||
Player.Message(p, line);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string FindBrush(string message) {
|
||||
foreach (var brush in Brush.Brushes) {
|
||||
if (brush.Key.CaselessEq(message))
|
||||
@ -80,11 +62,23 @@ namespace MCGalaxy.Commands {
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/brush [name] <default brush args>");
|
||||
Player.Message(p, "%HSets your current brush to the brush with the given name.");
|
||||
Player.Message(p, "%T/brush help [name]");
|
||||
Player.Message(p, "%T/help brush [name]");
|
||||
Player.Message(p, "%HOutputs the help for the brush with the given name.");
|
||||
Player.Message(p, "Available brushes: " + AvailableBrushes);
|
||||
Player.Message(p, "%HThe default brush simply takes one argument specifying the block to draw with. " +
|
||||
"If no arguments are given, your currently held block is used instead.");
|
||||
"If no arguments are given, your currently held block is used instead.");
|
||||
}
|
||||
|
||||
public override void Help(Player p, string message) {
|
||||
string brush = FindBrush(message);
|
||||
if (brush == null) {
|
||||
Player.Message(p, "No brush found with name \"{0}\".", message);
|
||||
Player.Message(p, "Available brushes: " + AvailableBrushes);
|
||||
} else {
|
||||
string[] help = Brush.BrushesHelp[brush];
|
||||
foreach (string line in help)
|
||||
Player.Message(p, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ namespace MCGalaxy.Commands
|
||||
public override string type { get { return CommandTypes.Building; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("cut", "cut") }; }
|
||||
}
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("cut", "cut") }; }
|
||||
}
|
||||
public CmdCopy() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
@ -43,7 +43,7 @@ namespace MCGalaxy.Commands
|
||||
message = message.Replace("@ ", "").Replace("@", "");
|
||||
|
||||
string[] parts = message.Split(' ');
|
||||
string opt = parts.Length == 0 ? null : parts[0].ToLower();
|
||||
string opt = parts[0].ToLower();
|
||||
|
||||
if (opt == "save") {
|
||||
if (parts.Length != 2) { Help(p); return; }
|
||||
@ -113,14 +113,8 @@ namespace MCGalaxy.Commands
|
||||
|
||||
CopyState state = new CopyState(minX, minY, minZ, maxX - minX + 1,
|
||||
maxY - minY + 1, maxZ - minZ + 1);
|
||||
if (state.Volume > p.group.maxBlocks) {
|
||||
Player.Message(p, "You tried to copy up to " + state.Volume + " blocks.");
|
||||
Player.Message(p, "You cannot copy more than " + p.group.maxBlocks + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
state.SetOrigin(cpos.x, cpos.y, cpos.z);
|
||||
int totalAir = 0, index = 0;
|
||||
int index = 0; state.UsedBlocks = 0;
|
||||
state.PasteAir = cpos.type == 2;
|
||||
|
||||
for (ushort yy = minY; yy <= maxY; ++yy)
|
||||
@ -132,20 +126,30 @@ namespace MCGalaxy.Commands
|
||||
if (b == Block.custom_block)
|
||||
extB = p.level.GetExtTile(xx, yy, zz);
|
||||
|
||||
if (b == Block.air && cpos.type != 2) totalAir++;
|
||||
state.Blocks[index] = b;
|
||||
if (b != Block.air || state.PasteAir) {
|
||||
state.UsedBlocks++;
|
||||
if (state.UsedBlocks > p.group.maxBlocks) {
|
||||
Player.Message(p, "You tried to copy " + state.UsedBlocks + " or more blocks.");
|
||||
Player.Message(p, "You cannot copy more than " + p.group.maxBlocks + ".");
|
||||
state = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
state.Blocks[index] = b;
|
||||
state.ExtBlocks[index] = extB;
|
||||
index++;
|
||||
}
|
||||
p.CopyBuffer = state;
|
||||
|
||||
p.CopyBuffer = state;
|
||||
if (cpos.type == 1) {
|
||||
DrawOp op = new CuboidDrawOp();
|
||||
Brush brush = new SolidBrush(Block.air, 0);
|
||||
DrawOp.DoDrawOp(op, brush, p, minX, minY, minZ, maxX, maxY, maxZ);
|
||||
Brush brush = new SolidBrush(Block.air, 0);
|
||||
DrawOp.DoDrawOp(op, brush, p, minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
Player.Message(p, (state.Volume - totalAir) + " blocks copied.");
|
||||
string format = "Copied &a{0} %Sblocks." +
|
||||
(state.PasteAir ? "" : " To also copy air blocks, use %T/copy air");
|
||||
Player.Message(p, format, state.UsedBlocks);
|
||||
if (cpos.allowoffset != -1) {
|
||||
Player.Message(p, "Place a block to determine where to paste from");
|
||||
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange3);
|
||||
|
@ -27,6 +27,7 @@ namespace MCGalaxy.Drawing {
|
||||
public int OriginX, OriginY, OriginZ;
|
||||
public int Width, Height, Length;
|
||||
public bool PasteAir;
|
||||
public int UsedBlocks;
|
||||
|
||||
const int identifier = 0x434F5059; // 'COPY'
|
||||
const int identifierC = 0x434F5043; // 'COPC' (Copy compressed)
|
||||
@ -35,17 +36,20 @@ namespace MCGalaxy.Drawing {
|
||||
get { return Width * Height * Length; }
|
||||
}
|
||||
|
||||
public CopyState(int x, int y, int z, int width, int height, int length, byte[] blocks, byte[] extBlocks) {
|
||||
public CopyState(int x, int y, int z, int width, int height, int length,
|
||||
byte[] blocks, byte[] extBlocks) {
|
||||
X = x; Y = y; Z = z;
|
||||
Width = width; Height = height; Length = length;
|
||||
Blocks = blocks;
|
||||
ExtBlocks = extBlocks;
|
||||
UsedBlocks = Volume;
|
||||
}
|
||||
|
||||
public CopyState(int x, int y, int z, int width, int height, int length)
|
||||
: this(x, y, z, width, height, length, null, null) {
|
||||
Blocks = new byte[width * height * length];
|
||||
ExtBlocks = new byte[width * height * length];
|
||||
UsedBlocks = Volume;
|
||||
}
|
||||
|
||||
public void Clear() {
|
||||
@ -108,6 +112,7 @@ namespace MCGalaxy.Drawing {
|
||||
blocksLen = r.ReadInt32();
|
||||
ExtBlocks = r.ReadBytes(blocksLen).Decompress(uncompressedLen);
|
||||
}
|
||||
UsedBlocks = Volume;
|
||||
OriginX = r.ReadInt32(); OriginY = r.ReadInt32(); OriginZ = r.ReadInt32();
|
||||
}
|
||||
|
||||
@ -124,6 +129,7 @@ namespace MCGalaxy.Drawing {
|
||||
ushort z = BitConverter.ToUInt16(raw, i + 4);
|
||||
Set(x - X, y - Y, z - Z, raw[i + 6], 0);
|
||||
}
|
||||
UsedBlocks = Volume;
|
||||
OriginX = X; OriginY = Y; OriginZ = Z;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
public override bool MinMaxCoords { get { return false; } }
|
||||
|
||||
public override long GetBlocksAffected(Level lvl, Vec3U16[] marks) {
|
||||
return CopyState.Volume;
|
||||
return CopyState.UsedBlocks;
|
||||
}
|
||||
|
||||
public override void Perform(Vec3U16[] marks, Player p, Level lvl, Brush brush) {
|
||||
@ -66,7 +66,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
public override bool MinMaxCoords { get { return false; } }
|
||||
|
||||
public override long GetBlocksAffected(Level lvl, Vec3U16[] marks) {
|
||||
return CopyState.Volume;
|
||||
return CopyState.UsedBlocks;
|
||||
}
|
||||
|
||||
public override void Perform(Vec3U16[] marks, Player p, Level lvl, Brush brush) {
|
||||
|
@ -38,8 +38,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
public static bool OkayAxis(int len) {
|
||||
return len == 16 || len == 32 || len == 64 || len == 128 || len == 256 ||
|
||||
len == 512 || len == 1024 || len == 2048 || len == 4096 || len == 8192;
|
||||
return len >= 16 && len <= 1024 && (len % 16) == 0;
|
||||
}
|
||||
|
||||
unsafe static void MapSet(int width, int length, byte* ptr, int yStart, int yEnd, byte block) {
|
||||
|
@ -277,7 +277,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdExplode.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdFollow.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdFreeze.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdGcbanlistupdate.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdHacks.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdHide.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdHighlight.cs" />
|
||||
@ -316,7 +315,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdTempRankInfo.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTempRankList.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTrust.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdUBan.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdUnban.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdUnbanip.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdUndoArea.cs" />
|
||||
|
@ -229,17 +229,11 @@ namespace MCGalaxy {
|
||||
if (who == null) return;
|
||||
if (who == p) { Player.Message(p, "Trying to talk to yourself, huh?"); return; }
|
||||
|
||||
LevelPermission perm = p == null ? LevelPermission.Nobody : p.group.Permission;
|
||||
LevelPermission whoPerm = who.group.Permission;
|
||||
|
||||
if (who.ignoreAll) {
|
||||
DoFakePM(p, who, message); return;
|
||||
}
|
||||
|
||||
foreach (string ignored in who.listignored) {
|
||||
if (p != null && ignored == p.name) {
|
||||
DoFakePM(p, who, message); return;
|
||||
}
|
||||
}
|
||||
if (p != null && who.listignored.Contains(p.name)) {
|
||||
DoFakePM(p, who, message); return;
|
||||
}
|
||||
DoPM(p, who, message);
|
||||
}
|
||||
|
@ -161,23 +161,23 @@ namespace MCGalaxy {
|
||||
|
||||
|
||||
/// <summary> Returns whether the given player is able to see the other player (e.g. in /who). </summary>
|
||||
public static bool CanSee(Player p, Player who) {
|
||||
if (p == null || !who.hidden || p == who) return true;
|
||||
if (who.otherRankHidden) return p.group.Permission >= who.oHideRank;
|
||||
return p.group.Permission > who.group.Permission;
|
||||
public static bool CanSee(Player p, Player target) {
|
||||
if (p == null || !target.hidden || p == target) return true;
|
||||
if (target.otherRankHidden) return p.group.Permission >= target.oHideRank;
|
||||
return p.group.Permission > target.group.Permission;
|
||||
}
|
||||
|
||||
/// <summary> Returns whether the given player is able to see the other player as an in-game entity. </summary>
|
||||
public static bool CanSeeEntity(Player p, Player who) {
|
||||
bool mayBeHidden = who.hidden;
|
||||
mayBeHidden |= (who.Game.Referee || who.Game.Invisible) && Server.zombie.Running;
|
||||
if (p == null || !mayBeHidden || p == who) return true;
|
||||
if (who.Game.Referee && !p.Game.Referee
|
||||
public static bool CanSeeEntity(Player p, Player target) {
|
||||
bool mayBeHidden = target.hidden;
|
||||
mayBeHidden |= (target.Game.Referee || target.Game.Invisible) && Server.zombie.Running;
|
||||
if (p == null || !mayBeHidden || p == target) return true;
|
||||
if (target.Game.Referee && !p.Game.Referee
|
||||
&& Server.zombie.Running) return false;
|
||||
if (who.Game.Invisible && !p.Game.Referee
|
||||
if (target.Game.Invisible && !p.Game.Referee
|
||||
&& Server.zombie.Running) return false;
|
||||
if (who.otherRankHidden) return p.group.Permission >= who.oHideRank;
|
||||
return p.group.Permission >= who.group.Permission;
|
||||
if (target.otherRankHidden) return p.group.Permission >= target.oHideRank;
|
||||
return p.group.Permission >= target.group.Permission;
|
||||
}
|
||||
|
||||
/// <summary> Updates the model of the entity with the specified id to all other players. </summary>
|
||||
|
@ -531,16 +531,20 @@ namespace MCGalaxy {
|
||||
adminpen = true;
|
||||
if (emoteList.Contains(name)) parseSmiley = false;
|
||||
|
||||
string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this);
|
||||
if (group.Permission < Server.adminchatperm || !Server.adminsjoinsilent) {
|
||||
if ((Server.guestJoinNotify && group.Permission <= LevelPermission.Guest) || group.Permission > LevelPermission.Guest) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) { Player.Message(pl, joinm); }
|
||||
}
|
||||
}
|
||||
hidden = group.CanExecute("hide") && Server.Hidden.Find(name).FirstOrDefault() != null;
|
||||
if (hidden) SendMessage("&8Reminder: You are still hidden.");
|
||||
if (group.Permission >= Server.adminchatperm && Server.adminsjoinsilent) {
|
||||
hidden = true;
|
||||
adminchat = true;
|
||||
hidden = true; adminchat = true;
|
||||
}
|
||||
|
||||
string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this);
|
||||
if (hidden) joinm = "&8(hidden)" + joinm;
|
||||
const LevelPermission perm = LevelPermission.Guest;
|
||||
if (group.Permission > perm || (Server.guestJoinNotify && group.Permission <= perm)) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) {
|
||||
if (Entities.CanSee(pl, this)) Player.Message(pl, joinm);
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerConnect != null)
|
||||
@ -1007,6 +1011,7 @@ try { SendBlockchange(pos1.x, pos1.y, pos1.z, Block.waterstill); } catch { }
|
||||
|
||||
if ( text != "/afk" && IsAfk ) {
|
||||
IsAfk = false;
|
||||
afkMessage = null;
|
||||
Player.GlobalMessage("-" + ColoredName + "%S- is no longer AFK");
|
||||
Server.IRC.Say(DisplayName + " is no longer AFK");
|
||||
TabList.Update(this, true);
|
||||
|
@ -97,7 +97,7 @@ namespace MCGalaxy {
|
||||
public string ip;
|
||||
public string color;
|
||||
public Group group;
|
||||
public LevelPermission oHideRank;
|
||||
public LevelPermission oHideRank = LevelPermission.Null;
|
||||
public bool otherRankHidden = false;
|
||||
public bool hidden = false;
|
||||
public bool painting = false;
|
||||
@ -591,14 +591,15 @@ namespace MCGalaxy {
|
||||
|
||||
Entities.DespawnEntities(this, false);
|
||||
if (discMsg != null) {
|
||||
if (!hidden) {
|
||||
string leavem = "&c- " + FullName + " %S" + discMsg;
|
||||
if ((Server.guestLeaveNotify && group.Permission <= LevelPermission.Guest) || group.Permission > LevelPermission.Guest) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) { Player.Message(pl, leavem); }
|
||||
}
|
||||
}
|
||||
Server.s.Log(name + " disconnected (" + discMsg + ").");
|
||||
string leavem = "&c- " + FullName + " %S" + discMsg;
|
||||
const LevelPermission perm = LevelPermission.Guest;
|
||||
if (group.Permission > perm || (Server.guestLeaveNotify && group.Permission <= perm)) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) {
|
||||
if (Entities.CanSee(pl, this)) Player.Message(pl, leavem);
|
||||
}
|
||||
}
|
||||
Server.s.Log(name + " disconnected (" + discMsg + ").");
|
||||
} else {
|
||||
totalKicked++;
|
||||
SendChatFrom(this, "&c- " + color + prefix + DisplayName + " %Skicked (" + kickMsg + "%S).", false);
|
||||
@ -840,8 +841,7 @@ Next: continue;
|
||||
Server.s.Log("Failed to load ignore list for: " + name);
|
||||
}
|
||||
if (ignoreAll || ignoreGlobal || ignoreIRC || listignored.Count > 0) {
|
||||
SendMessage("&cYou are still ignoring some people from your last login.");
|
||||
SendMessage("&cType &a/ignore list &cto see the list.");
|
||||
SendMessage("&cType &a/ignore list &cto see who you are still ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,11 @@ namespace MCGalaxy {
|
||||
}
|
||||
}
|
||||
WriteLines(lines);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Deletes all lines which contain the given value. </summary>
|
||||
public void DeleteContains(string value) {
|
||||
if (!File.Exists(file)) return;
|
||||
if (!File.Exists(file)) return;
|
||||
List<string> lines = new List<string>();
|
||||
using (StreamReader r = new StreamReader(file)) {
|
||||
string line;
|
||||
|
@ -149,7 +149,8 @@ namespace MCGalaxy.Util {
|
||||
Level lvl;
|
||||
if (!CheckChunk(chunk, start, p, out lvl)) return false;
|
||||
if (lvl == null) continue;
|
||||
if (p != null && (p.level != null && !p.level.name.CaselessEq(lvl.name)))
|
||||
bool isSuper = p == null || p.group.Permission == LevelPermission.Nobody;
|
||||
if (!isSuper && (p.level == null || !p.level.name.CaselessEq(lvl.name)))
|
||||
continue;
|
||||
|
||||
BufferedBlockSender buffer = new BufferedBlockSender(lvl);
|
||||
|
@ -83,6 +83,7 @@ namespace MCGalaxy
|
||||
public static PlayersFile Jailed = new PlayersFile("ranks/jailed.txt");
|
||||
public static PlayersFile TempRanks = new PlayersFile("text/tempranks.txt");
|
||||
public static PlayersFile Notes = new PlayersFile("text/notes.txt");
|
||||
public static PlayersFile Hidden = new PlayersFile("ranks/hidden.txt");
|
||||
public static PlayersFile Skins = new PlayersFile("extra/skins.txt");
|
||||
public static PlayersFile Models = new PlayersFile("extra/models.txt");
|
||||
public static Version Version { get { return System.Reflection.Assembly.GetAssembly(typeof(Server)).GetName().Version; } }
|
||||
@ -122,9 +123,6 @@ namespace MCGalaxy
|
||||
|
||||
public static readonly List<string> Devs = new List<string>();
|
||||
public static readonly List<string> Mods = new List<string>();
|
||||
|
||||
internal static readonly List<string> protectover = new List<string>(new string[] { "moderate", "mute", "freeze", "lockdown", "ban", "banip", "kickban", "kick", "global", "xban", "xundo", "undo", "uban", "unban", "unbanip", "demote", "promote", "restart", "shutdown", "setrank", "warn", "tempban", "impersonate", "sendcmd", "possess", "joker", "jail", "ignore", "voice" });
|
||||
public static List<string> ProtectOver { get { return new List<string>(protectover); } }
|
||||
|
||||
internal static readonly List<string> opstats = new List<string>(new string[] { "ban", "tempban", "kick", "warn", "mute", "freeze", "undo", "kickban", "demote", "promote" });
|
||||
public static List<string> Opstats { get { return new List<string>(opstats); } }
|
||||
|
@ -195,7 +195,7 @@ namespace MCGalaxy {
|
||||
|
||||
foreach (T item in items) {
|
||||
if (!filter(item)) continue;
|
||||
string itemName = nameGetter(item);
|
||||
string itemName = nameGetter(item);
|
||||
if (itemName.Equals(name, comp)) { matches = 1; return item; }
|
||||
if (itemName.IndexOf(name, comp) < 0) continue;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user