mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 07:11:04 -04:00
Fix bug when round was still considered to be as 'in progress', even though the 'error: need two or more players' message was shown. Modularise some games code more.
This commit is contained in:
parent
21c5a9c25b
commit
e169d19071
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands
|
|||||||
{
|
{
|
||||||
public override string name { get { return "zone"; } }
|
public override string name { get { return "zone"; } }
|
||||||
public override string shortcut { get { return ""; } }
|
public override string shortcut { get { return ""; } }
|
||||||
public override string type { get { return CommandTypes.Moderation; } }
|
public override string type { get { return CommandTypes.Moderation; } }
|
||||||
public override bool museumUsable { get { return false; } }
|
public override bool museumUsable { get { return false; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override CommandPerm[] AdditionalPerms {
|
public override CommandPerm[] AdditionalPerms {
|
||||||
@ -138,16 +138,14 @@ namespace MCGalaxy.Commands
|
|||||||
Player.SendMessage(p, "/zone del - Deletes the zone clicked");
|
Player.SendMessage(p, "/zone del - Deletes the zone clicked");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
|
void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
|
||||||
{
|
|
||||||
RevertAndClearState(p, x, y, z);
|
RevertAndClearState(p, x, y, z);
|
||||||
CatchPos bp = (CatchPos)p.blockchangeObject;
|
CatchPos bp = (CatchPos)p.blockchangeObject;
|
||||||
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
|
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
|
||||||
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
|
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
|
void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
|
||||||
{
|
|
||||||
RevertAndClearState(p, x, y, z);
|
RevertAndClearState(p, x, y, z);
|
||||||
CatchPos cpos = (CatchPos)p.blockchangeObject;
|
CatchPos cpos = (CatchPos)p.blockchangeObject;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ namespace MCGalaxy.Commands {
|
|||||||
p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
|
p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
|
||||||
|
|
||||||
p.Loading = false;
|
p.Loading = false;
|
||||||
CheckGamesJoin(p, lvl);
|
CheckGamesJoin(p, oldLevel);
|
||||||
|
|
||||||
if (!p.hidden) {
|
if (!p.hidden) {
|
||||||
Player.SendChatFrom(p, p.color + "*" + p.DisplayName + Server.DefaultColor + " went to &b" + lvl.name, false);
|
Player.SendChatFrom(p, p.color + "*" + p.DisplayName + Server.DefaultColor + " went to &b" + lvl.name, false);
|
||||||
@ -148,40 +148,20 @@ namespace MCGalaxy.Commands {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckGamesJoin(Player p, Level lvl) {
|
void CheckGamesJoin(Player p, Level oldLvl) {
|
||||||
if (Server.lava.active && !Server.lava.sendingPlayers && Server.lava.map == p.level) {
|
Server.lava.PlayerJoinedLevel(p, oldLvl);
|
||||||
if (Server.lava.roundActive) {
|
Server.zombie.PlayerJoinedLevel(p, oldLvl);
|
||||||
Server.lava.AnnounceRoundInfo(p);
|
|
||||||
Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p);
|
|
||||||
} else {
|
|
||||||
Player.SendMessage(p, "Vote for the next map!");
|
|
||||||
Player.SendMessage(p, "Choices: " + Server.lava.VoteString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Server.zombie.RoundInProgress) {
|
if (p.inTNTwarsMap) p.canBuild = true;
|
||||||
if (p.level.name == Server.zombie.currentLevelName)
|
|
||||||
Server.zombie.InfectedPlayerLogin(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.level.name != Server.zombie.currentLevelName) {
|
|
||||||
if(ZombieGame.alive.Contains(p))
|
|
||||||
ZombieGame.alive.Remove(p);
|
|
||||||
if (ZombieGame.infectd.Contains(p))
|
|
||||||
ZombieGame.infectd.Remove(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.inTNTwarsMap)
|
|
||||||
p.canBuild = true;
|
|
||||||
TntWarsGame game = TntWarsGame.Find(p.level);
|
TntWarsGame game = TntWarsGame.Find(p.level);
|
||||||
if (game != null) {
|
if (game == null) return;
|
||||||
if (game.GameStatus != TntWarsGame.TntWarsGameStatus.Finished &&
|
|
||||||
game.GameStatus != TntWarsGame.TntWarsGameStatus.WaitingForPlayers) {
|
if (game.GameStatus != TntWarsGame.TntWarsGameStatus.Finished &&
|
||||||
p.canBuild = false;
|
game.GameStatus != TntWarsGame.TntWarsGameStatus.WaitingForPlayers) {
|
||||||
Player.SendMessage(p, "TNT Wars: Disabled your building because you are in a TNT Wars map!");
|
p.canBuild = false;
|
||||||
}
|
Player.SendMessage(p, "TNT Wars: Disabled your building because you are in a TNT Wars map!");
|
||||||
p.inTNTwarsMap = true;
|
|
||||||
}
|
}
|
||||||
|
p.inTNTwarsMap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -42,5 +42,7 @@ namespace MCGalaxy {
|
|||||||
public virtual void PlayerJoinedGame(Player p) { }
|
public virtual void PlayerJoinedGame(Player p) { }
|
||||||
|
|
||||||
public virtual void PlayerLeftGame(Player p) { }
|
public virtual void PlayerLeftGame(Player p) { }
|
||||||
|
|
||||||
|
public virtual void PlayerJoinedLevel(Player p, Level oldLvl) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
50
Games/LavaSurvival/LavaSurvival.Game.cs
Normal file
50
Games/LavaSurvival/LavaSurvival.Game.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MCGalaxy {
|
||||||
|
|
||||||
|
public sealed partial class LavaSurvival : IGame {
|
||||||
|
|
||||||
|
public override bool HandlesChatMessage(Player p, string message) {
|
||||||
|
message = message.ToLower();
|
||||||
|
if (HasPlayer(p) && HasVote(message)) {
|
||||||
|
if (AddVote(p, message)) {
|
||||||
|
p.SendMessage("Your vote for &5" + message.Capitalize() + " %Shas been placed. Thanks!");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
p.SendMessage("&cYou already voted!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PlayerJoinedLevel(Player p, Level oldLevl) {
|
||||||
|
if (Server.lava.active && !Server.lava.sendingPlayers && Server.lava.map == p.level) {
|
||||||
|
if (Server.lava.roundActive) {
|
||||||
|
Server.lava.AnnounceRoundInfo(p);
|
||||||
|
Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p);
|
||||||
|
} else {
|
||||||
|
Player.SendMessage(p, "Vote for the next map!");
|
||||||
|
Player.SendMessage(p, "Choices: " + Server.lava.VoteString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
261
Games/LavaSurvival/LavaSurvival.Settings.cs
Normal file
261
Games/LavaSurvival/LavaSurvival.Settings.cs
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Timers;
|
||||||
|
|
||||||
|
namespace MCGalaxy
|
||||||
|
{
|
||||||
|
public sealed partial class LavaSurvival
|
||||||
|
{
|
||||||
|
|
||||||
|
public MapData GenerateMapData(MapSettings settings)
|
||||||
|
{
|
||||||
|
MapData data = new MapData(settings);
|
||||||
|
data.killer = rand.Next(1, 101) <= settings.killer;
|
||||||
|
data.destroy = rand.Next(1, 101) <= settings.destroy;
|
||||||
|
data.water = rand.Next(1, 101) <= settings.water;
|
||||||
|
data.layer = rand.Next(1, 101) <= settings.layer;
|
||||||
|
data.fast = rand.Next(1, 101) <= settings.fast && !data.water;
|
||||||
|
data.block = data.water ? (data.killer ? Block.activedeathwater : Block.water) : (data.fast ? (data.killer ? Block.fastdeathlava : Block.lava_fast) : (data.killer ? Block.activedeathlava : Block.lava));
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadSettings()
|
||||||
|
{
|
||||||
|
if (!File.Exists("properties/lavasurvival.properties"))
|
||||||
|
{
|
||||||
|
SaveSettings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string line in File.ReadAllLines("properties/lavasurvival.properties"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (line[0] != '#')
|
||||||
|
{
|
||||||
|
string value = line.Substring(line.IndexOf(" = ") + 3);
|
||||||
|
switch (line.Substring(0, line.IndexOf(" = ")).ToLower())
|
||||||
|
{
|
||||||
|
case "start-on-startup":
|
||||||
|
startOnStartup = bool.Parse(value);
|
||||||
|
break;
|
||||||
|
case "send-afk-to-main":
|
||||||
|
sendAfkMain = bool.Parse(value);
|
||||||
|
break;
|
||||||
|
case "vote-count":
|
||||||
|
voteCount = (byte)MathHelper.Clamp(decimal.Parse(value), 2, 10);
|
||||||
|
break;
|
||||||
|
case "vote-time":
|
||||||
|
voteTime = double.Parse(value);
|
||||||
|
break;
|
||||||
|
case "lives":
|
||||||
|
lifeNum = int.Parse(value);
|
||||||
|
break;
|
||||||
|
case "setup-rank":
|
||||||
|
if (Group.Find(value.ToLower()) != null)
|
||||||
|
setupRank = Group.Find(value.ToLower()).Permission;
|
||||||
|
break;
|
||||||
|
case "control-rank":
|
||||||
|
if (Group.Find(value.ToLower()) != null)
|
||||||
|
controlRank = Group.Find(value.ToLower()).Permission;
|
||||||
|
break;
|
||||||
|
case "maps":
|
||||||
|
foreach (string mapname in value.Split(','))
|
||||||
|
if(!String.IsNullOrEmpty(mapname) && !maps.Contains(mapname)) maps.Add(mapname);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) { Server.ErrorLog(e); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SaveSettings()
|
||||||
|
{
|
||||||
|
File.Create("properties/lavasurvival.properties").Dispose();
|
||||||
|
using (StreamWriter SW = File.CreateText("properties/lavasurvival.properties"))
|
||||||
|
{
|
||||||
|
SW.WriteLine("#Lava Survival main properties");
|
||||||
|
SW.WriteLine("start-on-startup = " + startOnStartup.ToString().ToLower());
|
||||||
|
SW.WriteLine("send-afk-to-main = " + sendAfkMain.ToString().ToLower());
|
||||||
|
SW.WriteLine("vote-count = " + voteCount.ToString());
|
||||||
|
SW.WriteLine("vote-time = " + voteTime.ToString());
|
||||||
|
SW.WriteLine("lives = " + lifeNum.ToString());
|
||||||
|
SW.WriteLine("setup-rank = " + Level.PermissionToName(setupRank).ToLower());
|
||||||
|
SW.WriteLine("control-rank = " + Level.PermissionToName(controlRank).ToLower());
|
||||||
|
SW.WriteLine("maps = " + maps.Concatenate(","));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapSettings LoadMapSettings(string name)
|
||||||
|
{
|
||||||
|
MapSettings settings = new MapSettings(name);
|
||||||
|
if (!Directory.Exists(propsPath)) Directory.CreateDirectory(propsPath);
|
||||||
|
if (!File.Exists(propsPath + name + ".properties"))
|
||||||
|
{
|
||||||
|
SaveMapSettings(settings);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string line in File.ReadAllLines(propsPath + name + ".properties"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (line[0] != '#')
|
||||||
|
{
|
||||||
|
string[] sp;
|
||||||
|
string value = line.Substring(line.IndexOf(" = ") + 3);
|
||||||
|
switch (line.Substring(0, line.IndexOf(" = ")).ToLower())
|
||||||
|
{
|
||||||
|
case "fast-chance":
|
||||||
|
settings.fast = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
||||||
|
break;
|
||||||
|
case "killer-chance":
|
||||||
|
settings.killer = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
||||||
|
break;
|
||||||
|
case "destroy-chance":
|
||||||
|
settings.destroy = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
||||||
|
break;
|
||||||
|
case "water-chance":
|
||||||
|
settings.water = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
||||||
|
break;
|
||||||
|
case "layer-chance":
|
||||||
|
settings.layer = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
||||||
|
break;
|
||||||
|
case "layer-height":
|
||||||
|
settings.layerHeight = int.Parse(value);
|
||||||
|
break;
|
||||||
|
case "layer-count":
|
||||||
|
settings.layerCount = int.Parse(value);
|
||||||
|
break;
|
||||||
|
case "layer-interval":
|
||||||
|
settings.layerInterval = double.Parse(value);
|
||||||
|
break;
|
||||||
|
case "round-time":
|
||||||
|
settings.roundTime = double.Parse(value);
|
||||||
|
break;
|
||||||
|
case "flood-time":
|
||||||
|
settings.floodTime = double.Parse(value);
|
||||||
|
break;
|
||||||
|
case "block-flood":
|
||||||
|
sp = value.Split(',');
|
||||||
|
settings.blockFlood = new Pos(ushort.Parse(sp[0]), ushort.Parse(sp[1]), ushort.Parse(sp[2]));
|
||||||
|
break;
|
||||||
|
case "block-layer":
|
||||||
|
sp = value.Split(',');
|
||||||
|
settings.blockLayer = new Pos(ushort.Parse(sp[0]), ushort.Parse(sp[1]), ushort.Parse(sp[2]));
|
||||||
|
break;
|
||||||
|
case "safe-zone":
|
||||||
|
sp = value.Split('-');
|
||||||
|
string[] p1 = sp[0].Split(','), p2 = sp[1].Split(',');
|
||||||
|
settings.safeZone = new Pos[] { new Pos(ushort.Parse(p1[0]), ushort.Parse(p1[1]), ushort.Parse(p1[2])), new Pos(ushort.Parse(p2[0]), ushort.Parse(p2[1]), ushort.Parse(p2[2])) };
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) { Server.ErrorLog(e); }
|
||||||
|
}
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
public void SaveMapSettings(MapSettings settings)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(propsPath)) Directory.CreateDirectory(propsPath);
|
||||||
|
|
||||||
|
File.Create(propsPath + settings.name + ".properties").Dispose();
|
||||||
|
using (StreamWriter SW = File.CreateText(propsPath + settings.name + ".properties"))
|
||||||
|
{
|
||||||
|
SW.WriteLine("#Lava Survival properties for " + settings.name);
|
||||||
|
SW.WriteLine("fast-chance = " + settings.fast);
|
||||||
|
SW.WriteLine("killer-chance = " + settings.killer);
|
||||||
|
SW.WriteLine("destroy-chance = " + settings.destroy);
|
||||||
|
SW.WriteLine("water-chance = " + settings.water);
|
||||||
|
SW.WriteLine("layer-chance = " + settings.layer);
|
||||||
|
SW.WriteLine("layer-height = " + settings.layerHeight);
|
||||||
|
SW.WriteLine("layer-count = " + settings.layerCount);
|
||||||
|
SW.WriteLine("layer-interval = " + settings.layerInterval);
|
||||||
|
SW.WriteLine("round-time = " + settings.roundTime);
|
||||||
|
SW.WriteLine("flood-time = " + settings.floodTime);
|
||||||
|
SW.WriteLine("block-flood = " + settings.blockFlood.ToString());
|
||||||
|
SW.WriteLine("block-layer = " + settings.blockLayer.ToString());
|
||||||
|
SW.WriteLine(String.Format("safe-zone = {0}-{1}", settings.safeZone[0].ToString(), settings.safeZone[1].ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal classes
|
||||||
|
public class MapSettings
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public byte fast, killer, destroy, water, layer;
|
||||||
|
public int layerHeight, layerCount;
|
||||||
|
public double layerInterval, roundTime, floodTime;
|
||||||
|
public Pos blockFlood, blockLayer;
|
||||||
|
public Pos[] safeZone;
|
||||||
|
|
||||||
|
public MapSettings(string name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
fast = 0;
|
||||||
|
killer = 100;
|
||||||
|
destroy = 0;
|
||||||
|
water = 0;
|
||||||
|
layer = 0;
|
||||||
|
layerHeight = 3;
|
||||||
|
layerCount = 10;
|
||||||
|
layerInterval = 2;
|
||||||
|
roundTime = 15;
|
||||||
|
floodTime = 5;
|
||||||
|
blockFlood = new Pos();
|
||||||
|
blockLayer = new Pos();
|
||||||
|
safeZone = new Pos[] { new Pos(), new Pos() };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MapData : IDisposable
|
||||||
|
{
|
||||||
|
public bool fast, killer, destroy, water, layer;
|
||||||
|
public byte block;
|
||||||
|
public int currentLayer;
|
||||||
|
public Timer roundTimer, floodTimer, layerTimer;
|
||||||
|
|
||||||
|
public MapData(MapSettings settings)
|
||||||
|
{
|
||||||
|
fast = false;
|
||||||
|
killer = false;
|
||||||
|
destroy = false;
|
||||||
|
water = false;
|
||||||
|
layer = false;
|
||||||
|
block = Block.lava;
|
||||||
|
currentLayer = 1;
|
||||||
|
roundTimer = new Timer(TimeSpan.FromMinutes(settings.roundTime).TotalMilliseconds); roundTimer.AutoReset = false;
|
||||||
|
floodTimer = new Timer(TimeSpan.FromMinutes(settings.floodTime).TotalMilliseconds); floodTimer.AutoReset = false;
|
||||||
|
layerTimer = new Timer(TimeSpan.FromMinutes(settings.layerInterval).TotalMilliseconds); layerTimer.AutoReset = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
roundTimer.Dispose();
|
||||||
|
floodTimer.Dispose();
|
||||||
|
layerTimer.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,7 +24,7 @@ using System.Timers;
|
|||||||
|
|
||||||
namespace MCGalaxy
|
namespace MCGalaxy
|
||||||
{
|
{
|
||||||
public sealed class LavaSurvival
|
public sealed partial class LavaSurvival
|
||||||
{
|
{
|
||||||
// Private variables
|
// Private variables
|
||||||
private string propsPath = "properties/lavasurvival/";
|
private string propsPath = "properties/lavasurvival/";
|
||||||
@ -440,179 +440,6 @@ namespace MCGalaxy
|
|||||||
return (deaths[name] >= lifeNum);
|
return (deaths[name] >= lifeNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapData GenerateMapData(MapSettings settings)
|
|
||||||
{
|
|
||||||
MapData data = new MapData(settings);
|
|
||||||
data.killer = rand.Next(1, 101) <= settings.killer;
|
|
||||||
data.destroy = rand.Next(1, 101) <= settings.destroy;
|
|
||||||
data.water = rand.Next(1, 101) <= settings.water;
|
|
||||||
data.layer = rand.Next(1, 101) <= settings.layer;
|
|
||||||
data.fast = rand.Next(1, 101) <= settings.fast && !data.water;
|
|
||||||
data.block = data.water ? (data.killer ? Block.activedeathwater : Block.water) : (data.fast ? (data.killer ? Block.fastdeathlava : Block.lava_fast) : (data.killer ? Block.activedeathlava : Block.lava));
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadSettings()
|
|
||||||
{
|
|
||||||
if (!File.Exists("properties/lavasurvival.properties"))
|
|
||||||
{
|
|
||||||
SaveSettings();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string line in File.ReadAllLines("properties/lavasurvival.properties"))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (line[0] != '#')
|
|
||||||
{
|
|
||||||
string value = line.Substring(line.IndexOf(" = ") + 3);
|
|
||||||
switch (line.Substring(0, line.IndexOf(" = ")).ToLower())
|
|
||||||
{
|
|
||||||
case "start-on-startup":
|
|
||||||
startOnStartup = bool.Parse(value);
|
|
||||||
break;
|
|
||||||
case "send-afk-to-main":
|
|
||||||
sendAfkMain = bool.Parse(value);
|
|
||||||
break;
|
|
||||||
case "vote-count":
|
|
||||||
voteCount = (byte)MathHelper.Clamp(decimal.Parse(value), 2, 10);
|
|
||||||
break;
|
|
||||||
case "vote-time":
|
|
||||||
voteTime = double.Parse(value);
|
|
||||||
break;
|
|
||||||
case "lives":
|
|
||||||
lifeNum = int.Parse(value);
|
|
||||||
break;
|
|
||||||
case "setup-rank":
|
|
||||||
if (Group.Find(value.ToLower()) != null)
|
|
||||||
setupRank = Group.Find(value.ToLower()).Permission;
|
|
||||||
break;
|
|
||||||
case "control-rank":
|
|
||||||
if (Group.Find(value.ToLower()) != null)
|
|
||||||
controlRank = Group.Find(value.ToLower()).Permission;
|
|
||||||
break;
|
|
||||||
case "maps":
|
|
||||||
foreach (string mapname in value.Split(','))
|
|
||||||
if(!String.IsNullOrEmpty(mapname) && !maps.Contains(mapname)) maps.Add(mapname);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) { Server.ErrorLog(e); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void SaveSettings()
|
|
||||||
{
|
|
||||||
File.Create("properties/lavasurvival.properties").Dispose();
|
|
||||||
using (StreamWriter SW = File.CreateText("properties/lavasurvival.properties"))
|
|
||||||
{
|
|
||||||
SW.WriteLine("#Lava Survival main properties");
|
|
||||||
SW.WriteLine("start-on-startup = " + startOnStartup.ToString().ToLower());
|
|
||||||
SW.WriteLine("send-afk-to-main = " + sendAfkMain.ToString().ToLower());
|
|
||||||
SW.WriteLine("vote-count = " + voteCount.ToString());
|
|
||||||
SW.WriteLine("vote-time = " + voteTime.ToString());
|
|
||||||
SW.WriteLine("lives = " + lifeNum.ToString());
|
|
||||||
SW.WriteLine("setup-rank = " + Level.PermissionToName(setupRank).ToLower());
|
|
||||||
SW.WriteLine("control-rank = " + Level.PermissionToName(controlRank).ToLower());
|
|
||||||
SW.WriteLine("maps = " + maps.Concatenate(","));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapSettings LoadMapSettings(string name)
|
|
||||||
{
|
|
||||||
MapSettings settings = new MapSettings(name);
|
|
||||||
if (!Directory.Exists(propsPath)) Directory.CreateDirectory(propsPath);
|
|
||||||
if (!File.Exists(propsPath + name + ".properties"))
|
|
||||||
{
|
|
||||||
SaveMapSettings(settings);
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string line in File.ReadAllLines(propsPath + name + ".properties"))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (line[0] != '#')
|
|
||||||
{
|
|
||||||
string[] sp;
|
|
||||||
string value = line.Substring(line.IndexOf(" = ") + 3);
|
|
||||||
switch (line.Substring(0, line.IndexOf(" = ")).ToLower())
|
|
||||||
{
|
|
||||||
case "fast-chance":
|
|
||||||
settings.fast = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
|
||||||
break;
|
|
||||||
case "killer-chance":
|
|
||||||
settings.killer = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
|
||||||
break;
|
|
||||||
case "destroy-chance":
|
|
||||||
settings.destroy = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
|
||||||
break;
|
|
||||||
case "water-chance":
|
|
||||||
settings.water = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
|
||||||
break;
|
|
||||||
case "layer-chance":
|
|
||||||
settings.layer = (byte)MathHelper.Clamp(decimal.Parse(value), 0, 100);
|
|
||||||
break;
|
|
||||||
case "layer-height":
|
|
||||||
settings.layerHeight = int.Parse(value);
|
|
||||||
break;
|
|
||||||
case "layer-count":
|
|
||||||
settings.layerCount = int.Parse(value);
|
|
||||||
break;
|
|
||||||
case "layer-interval":
|
|
||||||
settings.layerInterval = double.Parse(value);
|
|
||||||
break;
|
|
||||||
case "round-time":
|
|
||||||
settings.roundTime = double.Parse(value);
|
|
||||||
break;
|
|
||||||
case "flood-time":
|
|
||||||
settings.floodTime = double.Parse(value);
|
|
||||||
break;
|
|
||||||
case "block-flood":
|
|
||||||
sp = value.Split(',');
|
|
||||||
settings.blockFlood = new Pos(ushort.Parse(sp[0]), ushort.Parse(sp[1]), ushort.Parse(sp[2]));
|
|
||||||
break;
|
|
||||||
case "block-layer":
|
|
||||||
sp = value.Split(',');
|
|
||||||
settings.blockLayer = new Pos(ushort.Parse(sp[0]), ushort.Parse(sp[1]), ushort.Parse(sp[2]));
|
|
||||||
break;
|
|
||||||
case "safe-zone":
|
|
||||||
sp = value.Split('-');
|
|
||||||
string[] p1 = sp[0].Split(','), p2 = sp[1].Split(',');
|
|
||||||
settings.safeZone = new Pos[] { new Pos(ushort.Parse(p1[0]), ushort.Parse(p1[1]), ushort.Parse(p1[2])), new Pos(ushort.Parse(p2[0]), ushort.Parse(p2[1]), ushort.Parse(p2[2])) };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) { Server.ErrorLog(e); }
|
|
||||||
}
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
public void SaveMapSettings(MapSettings settings)
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(propsPath)) Directory.CreateDirectory(propsPath);
|
|
||||||
|
|
||||||
File.Create(propsPath + settings.name + ".properties").Dispose();
|
|
||||||
using (StreamWriter SW = File.CreateText(propsPath + settings.name + ".properties"))
|
|
||||||
{
|
|
||||||
SW.WriteLine("#Lava Survival properties for " + settings.name);
|
|
||||||
SW.WriteLine("fast-chance = " + settings.fast);
|
|
||||||
SW.WriteLine("killer-chance = " + settings.killer);
|
|
||||||
SW.WriteLine("destroy-chance = " + settings.destroy);
|
|
||||||
SW.WriteLine("water-chance = " + settings.water);
|
|
||||||
SW.WriteLine("layer-chance = " + settings.layer);
|
|
||||||
SW.WriteLine("layer-height = " + settings.layerHeight);
|
|
||||||
SW.WriteLine("layer-count = " + settings.layerCount);
|
|
||||||
SW.WriteLine("layer-interval = " + settings.layerInterval);
|
|
||||||
SW.WriteLine("round-time = " + settings.roundTime);
|
|
||||||
SW.WriteLine("flood-time = " + settings.floodTime);
|
|
||||||
SW.WriteLine("block-flood = " + settings.blockFlood.ToString());
|
|
||||||
SW.WriteLine("block-layer = " + settings.blockLayer.ToString());
|
|
||||||
SW.WriteLine(String.Format("safe-zone = {0}-{1}", settings.safeZone[0].ToString(), settings.safeZone[1].ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddMap(string name)
|
public void AddMap(string name)
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(name) && !maps.Contains(name.ToLower()))
|
if (!String.IsNullOrEmpty(name) && !maps.Contains(name.ToLower()))
|
||||||
@ -642,9 +469,8 @@ namespace MCGalaxy
|
|||||||
public bool InSafeZone(ushort x, ushort y, ushort z)
|
public bool InSafeZone(ushort x, ushort y, ushort z)
|
||||||
{
|
{
|
||||||
if (mapSettings == null) return false;
|
if (mapSettings == null) return false;
|
||||||
if (x >= mapSettings.safeZone[0].x && x <= mapSettings.safeZone[1].x && y >= mapSettings.safeZone[0].y && y <= mapSettings.safeZone[1].y && z >= mapSettings.safeZone[0].z && z <= mapSettings.safeZone[1].z)
|
return x >= mapSettings.safeZone[0].x && x <= mapSettings.safeZone[1].x && y >= mapSettings.safeZone[0].y
|
||||||
return true;
|
&& y <= mapSettings.safeZone[1].y && z >= mapSettings.safeZone[0].z && z <= mapSettings.safeZone[1].z;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
@ -672,64 +498,6 @@ namespace MCGalaxy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal classes
|
|
||||||
public class MapSettings
|
|
||||||
{
|
|
||||||
public string name;
|
|
||||||
public byte fast, killer, destroy, water, layer;
|
|
||||||
public int layerHeight, layerCount;
|
|
||||||
public double layerInterval, roundTime, floodTime;
|
|
||||||
public Pos blockFlood, blockLayer;
|
|
||||||
public Pos[] safeZone;
|
|
||||||
|
|
||||||
public MapSettings(string name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
fast = 0;
|
|
||||||
killer = 100;
|
|
||||||
destroy = 0;
|
|
||||||
water = 0;
|
|
||||||
layer = 0;
|
|
||||||
layerHeight = 3;
|
|
||||||
layerCount = 10;
|
|
||||||
layerInterval = 2;
|
|
||||||
roundTime = 15;
|
|
||||||
floodTime = 5;
|
|
||||||
blockFlood = new Pos();
|
|
||||||
blockLayer = new Pos();
|
|
||||||
safeZone = new Pos[] { new Pos(), new Pos() };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MapData : IDisposable
|
|
||||||
{
|
|
||||||
public bool fast, killer, destroy, water, layer;
|
|
||||||
public byte block;
|
|
||||||
public int currentLayer;
|
|
||||||
public Timer roundTimer, floodTimer, layerTimer;
|
|
||||||
|
|
||||||
public MapData(MapSettings settings)
|
|
||||||
{
|
|
||||||
fast = false;
|
|
||||||
killer = false;
|
|
||||||
destroy = false;
|
|
||||||
water = false;
|
|
||||||
layer = false;
|
|
||||||
block = Block.lava;
|
|
||||||
currentLayer = 1;
|
|
||||||
roundTimer = new Timer(TimeSpan.FromMinutes(settings.roundTime).TotalMilliseconds); roundTimer.AutoReset = false;
|
|
||||||
floodTimer = new Timer(TimeSpan.FromMinutes(settings.floodTime).TotalMilliseconds); floodTimer.AutoReset = false;
|
|
||||||
layerTimer = new Timer(TimeSpan.FromMinutes(settings.layerInterval).TotalMilliseconds); layerTimer.AutoReset = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
roundTimer.Dispose();
|
|
||||||
floodTimer.Dispose();
|
|
||||||
layerTimer.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct Pos
|
public struct Pos
|
||||||
{
|
{
|
||||||
public ushort x, y, z;
|
public ushort x, y, z;
|
@ -63,6 +63,7 @@ namespace MCGalaxy {
|
|||||||
void DoRound() {
|
void DoRound() {
|
||||||
if (Status == ZombieGameStatus.NotStarted) return;
|
if (Status == ZombieGameStatus.NotStarted) return;
|
||||||
List<Player> players = DoRoundCountdown();
|
List<Player> players = DoRoundCountdown();
|
||||||
|
RoundInProgress = true;
|
||||||
|
|
||||||
theEnd:
|
theEnd:
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
@ -123,7 +124,6 @@ namespace MCGalaxy {
|
|||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
||||||
Player.GlobalMessage("%4Round Start:%f 1...");
|
Player.GlobalMessage("%4Round Start:%f 1...");
|
||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
||||||
RoundInProgress = true;
|
|
||||||
int nonRefPlayers = 0;
|
int nonRefPlayers = 0;
|
||||||
List<Player> players = new List<Player>();
|
List<Player> players = new List<Player>();
|
||||||
|
|
||||||
|
@ -94,5 +94,16 @@ namespace MCGalaxy {
|
|||||||
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) {
|
||||||
|
if (Server.zombie.RoundInProgress && p.level.name == currentLevelName)
|
||||||
|
Server.zombie.InfectedPlayerLogin(p);
|
||||||
|
|
||||||
|
if (p.level.name == currentLevelName) return;
|
||||||
|
if(ZombieGame.alive.Contains(p))
|
||||||
|
ZombieGame.alive.Remove(p);
|
||||||
|
if (ZombieGame.infectd.Contains(p))
|
||||||
|
ZombieGame.infectd.Remove(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,11 @@
|
|||||||
<Compile Include="Games\Countdown\CountdownMapGen.cs" />
|
<Compile Include="Games\Countdown\CountdownMapGen.cs" />
|
||||||
<Compile Include="Games\CTF\CtfTeam.cs" />
|
<Compile Include="Games\CTF\CtfTeam.cs" />
|
||||||
<Compile Include="Games\IGame.cs" />
|
<Compile Include="Games\IGame.cs" />
|
||||||
|
<Compile Include="Games\LavaSurvival\LavaSurvival.Game.cs" />
|
||||||
|
<Compile Include="Games\LavaSurvival\LavaSurvival.cs" />
|
||||||
|
<Compile Include="Games\LavaSurvival\LavaSurvival.Settings.cs" />
|
||||||
<Compile Include="Games\Team.cs" />
|
<Compile Include="Games\Team.cs" />
|
||||||
|
<Compile Include="Games\TntWars\TntWars.cs" />
|
||||||
<Compile Include="Games\ZombieSurvival\ZombieGame.Core.cs" />
|
<Compile Include="Games\ZombieSurvival\ZombieGame.Core.cs" />
|
||||||
<Compile Include="Games\ZombieSurvival\ZombieGame.cs" />
|
<Compile Include="Games\ZombieSurvival\ZombieGame.cs" />
|
||||||
<Compile Include="Games\ZombieSurvival\ZombieGame.Game.cs" />
|
<Compile Include="Games\ZombieSurvival\ZombieGame.Game.cs" />
|
||||||
@ -506,7 +510,6 @@
|
|||||||
<DependentUpon>EconomyWindow.cs</DependentUpon>
|
<DependentUpon>EconomyWindow.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Games\CTF\Setup.cs" />
|
<Compile Include="Games\CTF\Setup.cs" />
|
||||||
<Compile Include="Games\TntWarsGame.cs" />
|
|
||||||
<Compile Include="GUI\PortTools.cs">
|
<Compile Include="GUI\PortTools.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -529,7 +532,6 @@
|
|||||||
<Compile Include="GUI\EditText.Designer.cs">
|
<Compile Include="GUI\EditText.Designer.cs">
|
||||||
<DependentUpon>EditText.cs</DependentUpon>
|
<DependentUpon>EditText.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Games\LavaSurvival.cs" />
|
|
||||||
<Compile Include="Levels\BlockQueue.cs" />
|
<Compile Include="Levels\BlockQueue.cs" />
|
||||||
<Compile Include="Database\MySQLTransactionHelper.cs" />
|
<Compile Include="Database\MySQLTransactionHelper.cs" />
|
||||||
<Compile Include="Player\Player.Events.cs" />
|
<Compile Include="Player\Player.Events.cs" />
|
||||||
@ -719,6 +721,8 @@
|
|||||||
<Folder Include="Drawing\DrawOps" />
|
<Folder Include="Drawing\DrawOps" />
|
||||||
<Folder Include="Drawing\Brushes" />
|
<Folder Include="Drawing\Brushes" />
|
||||||
<Folder Include="Games\Countdown" />
|
<Folder Include="Games\Countdown" />
|
||||||
|
<Folder Include="Games\LavaSurvival" />
|
||||||
|
<Folder Include="Games\TntWars" />
|
||||||
<Folder Include="Games\ZombieSurvival" />
|
<Folder Include="Games\ZombieSurvival" />
|
||||||
<Folder Include="Levels\IO" />
|
<Folder Include="Levels\IO" />
|
||||||
<Folder Include="Levels\Generator" />
|
<Folder Include="Levels\Generator" />
|
||||||
|
@ -190,24 +190,8 @@ namespace MCGalaxy {
|
|||||||
if (colorParse)
|
if (colorParse)
|
||||||
message = Colors.EscapeColors(message);
|
message = Colors.EscapeColors(message);
|
||||||
StringBuilder sb = new StringBuilder(message);
|
StringBuilder sb = new StringBuilder(message);
|
||||||
|
if (colorParse)
|
||||||
if (colorParse) {
|
ParseColors(sb);
|
||||||
for (int i = 0; i < 128; i++) {
|
|
||||||
if (Colors.IsStandardColor((char)i)) {
|
|
||||||
if (i >= 'A' && i <= 'F') // WoM does not work with uppercase color codes.
|
|
||||||
sb.Replace("&" + (char)i, "&" + (char)(i + ' '));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomColor col = Colors.ExtColors[i];
|
|
||||||
if (col.Undefined) {
|
|
||||||
sb.Replace("&" + (char)i, ""); continue;
|
|
||||||
}
|
|
||||||
if (!hasTextColors) {
|
|
||||||
sb.Replace("&" + (char)i, "&" + col.Fallback); continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Chat.ApplyTokens(sb, this, colorParse);
|
Chat.ApplyTokens(sb, this, colorParse);
|
||||||
if ( Server.parseSmiley && parseSmiley ) {
|
if ( Server.parseSmiley && parseSmiley ) {
|
||||||
@ -253,6 +237,24 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ParseColors(StringBuilder sb) {
|
||||||
|
for (int i = 0; i < 128; i++) {
|
||||||
|
if (Colors.IsStandardColor((char)i)) {
|
||||||
|
if (i >= 'A' && i <= 'F') // WoM does not work with uppercase color codes.
|
||||||
|
sb.Replace("&" + (char)i, "&" + (char)(i + ' '));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomColor col = Colors.ExtColors[i];
|
||||||
|
if (col.Undefined) {
|
||||||
|
sb.Replace("&" + (char)i, ""); continue;
|
||||||
|
}
|
||||||
|
if (!hasTextColors) {
|
||||||
|
sb.Replace("&" + (char)i, "&" + col.Fallback); continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SendMotd() {
|
public void SendMotd() {
|
||||||
byte[] buffer = new byte[131];
|
byte[] buffer = new byte[131];
|
||||||
buffer[0] = Opcode.Handshake;
|
buffer[0] = Opcode.Handshake;
|
||||||
|
@ -350,31 +350,7 @@ namespace MCGalaxy {
|
|||||||
LoadIgnores();
|
LoadIgnores();
|
||||||
if (type == 0x42) {
|
if (type == 0x42) {
|
||||||
hasCpe = true;
|
hasCpe = true;
|
||||||
|
SendCpeExtensions();
|
||||||
SendExtInfo(18);
|
|
||||||
SendExtEntry(CpeExt.ClickDistance, 1);
|
|
||||||
SendExtEntry(CpeExt.CustomBlocks, 1);
|
|
||||||
SendExtEntry(CpeExt.HeldBlock, 1);
|
|
||||||
|
|
||||||
SendExtEntry(CpeExt.TextHotkey, 1);
|
|
||||||
SendExtEntry(CpeExt.EnvColors, 1);
|
|
||||||
SendExtEntry(CpeExt.SelectionCuboid, 1);
|
|
||||||
|
|
||||||
SendExtEntry(CpeExt.BlockPermissions, 1);
|
|
||||||
SendExtEntry(CpeExt.ChangeModel, 1);
|
|
||||||
SendExtEntry(CpeExt.EnvMapAppearance, 2);
|
|
||||||
|
|
||||||
SendExtEntry(CpeExt.EnvWeatherType, 1);
|
|
||||||
SendExtEntry(CpeExt.HackControl, 1);
|
|
||||||
SendExtEntry(CpeExt.EmoteFix, 1);
|
|
||||||
|
|
||||||
SendExtEntry(CpeExt.FullCP437, 1);
|
|
||||||
SendExtEntry(CpeExt.LongerMessages, 1);
|
|
||||||
SendExtEntry(CpeExt.BlockDefinitions, 1);
|
|
||||||
|
|
||||||
SendExtEntry(CpeExt.BlockDefinitionsExt, 2);
|
|
||||||
SendExtEntry(CpeExt.TextColors, 1);
|
|
||||||
SendExtEntry(CpeExt.BulkBlockUpdate, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try { left.Remove(name.ToLower()); }
|
try { left.Remove(name.ToLower()); }
|
||||||
@ -393,6 +369,35 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendCpeExtensions() {
|
||||||
|
SendExtInfo(19);
|
||||||
|
SendExtEntry(CpeExt.ClickDistance, 1);
|
||||||
|
SendExtEntry(CpeExt.CustomBlocks, 1);
|
||||||
|
SendExtEntry(CpeExt.HeldBlock, 1);
|
||||||
|
|
||||||
|
SendExtEntry(CpeExt.TextHotkey, 1);
|
||||||
|
SendExtEntry(CpeExt.EnvColors, 1);
|
||||||
|
SendExtEntry(CpeExt.SelectionCuboid, 1);
|
||||||
|
|
||||||
|
SendExtEntry(CpeExt.BlockPermissions, 1);
|
||||||
|
SendExtEntry(CpeExt.ChangeModel, 1);
|
||||||
|
SendExtEntry(CpeExt.EnvMapAppearance, 2);
|
||||||
|
|
||||||
|
SendExtEntry(CpeExt.EnvWeatherType, 1);
|
||||||
|
SendExtEntry(CpeExt.HackControl, 1);
|
||||||
|
SendExtEntry(CpeExt.EmoteFix, 1);
|
||||||
|
|
||||||
|
SendExtEntry(CpeExt.FullCP437, 1);
|
||||||
|
SendExtEntry(CpeExt.LongerMessages, 1);
|
||||||
|
SendExtEntry(CpeExt.BlockDefinitions, 1);
|
||||||
|
|
||||||
|
SendExtEntry(CpeExt.BlockDefinitionsExt, 2);
|
||||||
|
SendExtEntry(CpeExt.TextColors, 1);
|
||||||
|
SendExtEntry(CpeExt.BulkBlockUpdate, 1);
|
||||||
|
|
||||||
|
SendExtEntry(CpeExt.MessageTypes, 1);
|
||||||
|
}
|
||||||
|
|
||||||
bool CheckWhitelist() {
|
bool CheckWhitelist() {
|
||||||
if (!Server.useWhitelist)
|
if (!Server.useWhitelist)
|
||||||
return true;
|
return true;
|
||||||
@ -1405,17 +1410,6 @@ return;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Server.lava.HasPlayer(this) && Server.lava.HasVote(text.ToLower()) ) {
|
|
||||||
if (Server.lava.AddVote(this, text.ToLower())) {
|
|
||||||
SendMessage("Your vote for &5" + text.ToLower().Capitalize() + Server.DefaultColor + " has been placed. Thanks!");
|
|
||||||
Server.lava.map.ChatLevelOps(name + " voted for &5" + text.ToLower().Capitalize() + Server.DefaultColor + ".");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
SendMessage("&cYou already voted!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Server.voting) {
|
if (Server.voting) {
|
||||||
string test = text.ToLower();
|
string test = text.ToLower();
|
||||||
if (CheckVote(test, this, "y", "yes", ref Server.YesVotes) ||
|
if (CheckVote(test, this, "y", "yes", ref Server.YesVotes) ||
|
||||||
@ -1426,6 +1420,8 @@ return;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Server.lava.HandlesChatMessage(this, text))
|
||||||
|
return false;
|
||||||
if (Server.votingforlevel && Server.zombie.HandlesChatMessage(this, text))
|
if (Server.votingforlevel && Server.zombie.HandlesChatMessage(this, text))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -234,7 +234,6 @@ namespace MCGalaxy {
|
|||||||
public UndoCache UndoBuffer = new UndoCache();
|
public UndoCache UndoBuffer = new UndoCache();
|
||||||
public UndoCache RedoBuffer = new UndoCache();
|
public UndoCache RedoBuffer = new UndoCache();
|
||||||
|
|
||||||
|
|
||||||
public bool showPortals = false;
|
public bool showPortals = false;
|
||||||
public bool showMBs = false;
|
public bool showMBs = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user