本文整理汇总了C#中Player.SendBlockchange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendBlockchange方法的具体用法?C# Player.SendBlockchange怎么用?C# Player.SendBlockchange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.SendBlockchange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EntryChange
public void EntryChange(Player p, ushort x, ushort y, ushort z, ushort type)
{
p.ClearBlockchange();
portalPos bp = (portalPos)p.blockchangeObject;
if (bp.Multi && type == Block.red && bp.port.Count > 0) { ExitChange(p, x, y, z, type); return; }
// ushort b = p.level.GetTile(x, y, z);
p.level.Blockchange(p, x, y, z, bp.type);
p.SendBlockchange(x, y, z, Block.green);
portPos Port;
Port.portMapName = p.level.name;
Port.x = x; Port.y = y; Port.z = z;
bp.port.Add(Port);
p.blockchangeObject = bp;
if (!bp.Multi)
{
p.Blockchange += ExitChange;
Player.SendMessage(p, "&aEntry block placed");
}
else
{
p.Blockchange += EntryChange;
Player.SendMessage(p, "&aEntry block placed. &cRed block for exit");
}
}
示例2: EntryChange
public void EntryChange(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
portalPos bp = (portalPos)p.blockchangeObject;
if (bp.Multi && type == Block.red && bp.port.Count > 0) { ExitChange(p, x, y, z, type); return; }
// byte b = p.level.GetTile(x, y, z) // Unused method, wasting mah .exe spaces;
p.level.Blockchange(p, x, y, z, bp.type);
p.SendBlockchange(x, y, z, Block.green);
portPos Port;
Port.portMapName = p.level.name;
Port.x = x; Port.y = y; Port.z = z;
bp.port.Add(Port);
p.blockchangeObject = bp;
if (!bp.Multi)
{
p.Blockchange += new Player.BlockchangeEventHandler(ExitChange);
Player.SendMessage(p, "&aEntry block placed");
}
else
{
p.Blockchange += new Player.BlockchangeEventHandler(EntryChange);
Player.SendMessage(p, "&aEntry block placed. &cRed block for exit");
}
}
示例3: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, ushort type)
{
p.ClearBlockchange();
ushort b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
Level.Zone Zn;
Zn.smallX = Math.Min(cpos.x, x);
Zn.smallY = Math.Min(cpos.y, y);
Zn.smallZ = Math.Min(cpos.z, z);
Zn.bigX = Math.Max(cpos.x, x);
Zn.bigY = Math.Max(cpos.y, y);
Zn.bigZ = Math.Max(cpos.z, z);
Zn.Owner = cpos.Owner;
p.level.ZoneList.Add(Zn);
//DB
Database.AddParams("@Owner", Zn.Owner);
Database.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", @Owner)");
//DB
Player.SendMessage(p, "Added zone for &b" + cpos.Owner);
}
示例4: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
if (!p.staticCommands) p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
byte oldType = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, oldType);
int diffX = 0, diffZ = 0;
if (p.rot[0] <= 32 || p.rot[0] >= 224) { diffZ = -1; }
else if (p.rot[0] <= 96) { diffX = 1; }
else if (p.rot[0] <= 160) { diffZ = 1; }
else diffX = -1;
List<Pos> buffer = new List<Pos>();
Pos pos;
int total = 0;
if (diffX != 0)
{
for (ushort xx = x; total < cpos.distance; xx += (ushort)diffX)
{
for (ushort yy = (ushort)(y - 1); yy <= (ushort)(y + 1); yy++)
for (ushort zz = (ushort)(z - 1); zz <= (ushort)(z + 1); zz++)
{
pos.x = xx; pos.y = yy; pos.z = zz;
buffer.Add(pos);
}
total++;
}
}
else
{
for (ushort zz = z; total < cpos.distance; zz += (ushort)diffZ)
{
for (ushort yy = (ushort)(y - 1); yy <= (ushort)(y + 1); yy++)
for (ushort xx = (ushort)(x - 1); xx <= (ushort)(x + 1); xx++)
{
pos.x = xx; pos.y = yy; pos.z = zz;
buffer.Add(pos);
}
total++;
}
}
if (buffer.Count > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to drill " + buffer.Count + " blocks.");
Player.SendMessage(p, "You cannot drill more than " + p.group.maxBlocks + ".");
return;
}
foreach (Pos pos1 in buffer)
{
if (p.level.GetTile(pos1.x, pos1.y, pos1.z) == oldType)
p.level.Blockchange(p, pos1.x, pos1.y, pos1.z, Block.air);
}
Player.SendMessage(p, buffer.Count + " blocks.");
}
示例5: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
List<CatchPos> buffer = new List<CatchPos>();
CatchPos pos = new CatchPos();
//int totalChecks = 0;
//if (Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z) > 8000) { Player.SendMessage(p, "Tried to restart too many blocks. You may only restart 8000"); return; }
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
{
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
{
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
if (p.level.GetTile(xx, yy, zz) != Block.air)
{
pos.x = xx; pos.y = yy; pos.z = zz;
pos.extraInfo = cpos.extraInfo;
buffer.Add(pos);
}
}
}
}
try
{
if (cpos.extraInfo == "")
{
if (buffer.Count > Server.rpNormLimit)
{
Player.SendMessage(p, "Cannot restart more than " + Server.rpNormLimit + " blocks.");
Player.SendMessage(p, "Tried to restart " + buffer.Count + " blocks.");
return;
}
}
else
{
if (buffer.Count > Server.rpLimit)
{
Player.SendMessage(p, "Tried to add physics to " + buffer.Count + " blocks.");
Player.SendMessage(p, "Cannot add physics to more than " + Server.rpLimit + " blocks.");
return;
}
}
}
catch { return; }
foreach (CatchPos pos1 in buffer)
{
p.level.AddCheck(p.level.PosToInt(pos1.x, pos1.y, pos1.z), pos1.extraInfo, true);
}
Player.SendMessage(p, "Activated " + buffer.Count + " blocks.");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例6: AboutBlockchange
public void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type)
{
if (!p.staticCommands) p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
if (b == Block.Zero) { Player.SendMessage(p, "Invalid Block(" + x + "," + y + "," + z + ")!"); return; }
p.SendBlockchange(x, y, z, b);
string message = "Block (" + x + "," + y + "," + z + "): ";
message += "&f" + b + " = " + Block.Name(b);
Player.SendMessage(p, message + Server.DefaultColor + ".");
message = p.level.foundInfo(x, y, z);
if (message != "") Player.SendMessage(p, "Physics information: &a" + message);
//safe against SQL injections because no user input is given here
DataTable Blocks = Database.fillData("SELECT * FROM Block" + p.level.name + " WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
string Username, TimePerformed, BlockUsed;
bool Deleted, foundOne = false;
for (int i = 0; i < Blocks.Rows.Count; i++)
{
foundOne = true;
Username = Blocks.Rows[i]["Username"].ToString();
TimePerformed = DateTime.Parse(Blocks.Rows[i]["TimePerformed"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
//Server.s.Log(Blocks.Rows[i]["Type"].ToString());
BlockUsed = Block.Name(Convert.ToByte(Blocks.Rows[i]["Type"])).ToString();
Deleted = Convert.ToBoolean(Blocks.Rows[i]["Deleted"]);
if (!Deleted)
Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
else
Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
}
List<Level.BlockPos> inCache = p.level.blockCache.FindAll(bP => bP.x == x && bP.y == y && bP.z == z);
for (int i = 0; i < inCache.Count; i++)
{
foundOne = true;
Deleted = inCache[i].deleted;
Username = inCache[i].name;
TimePerformed = inCache[i].TimePerformed.ToString("yyyy-MM-dd HH:mm:ss");
BlockUsed = Block.Name(inCache[i].type);
if (!Deleted)
Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
else
Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
}
if (!foundOne)
Player.SendMessage(p, "This block has not been modified since the map was cleared.");
Blocks.Dispose();
GC.Collect();
GC.WaitForPendingFinalizers();
}
示例7: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
p.SendBlockchange(x, y, z, p.level.GetTile(x, y, z));
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += Blockchange2;
}
示例8: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
p.blockchangeObject = new CatchPos(x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例9: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte block = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, block);
Position bp;
bp.x = x; bp.y = y; bp.z = z; bp.type = type; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例10: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, ushort type)
{
p.ClearBlockchange();
ushort b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例11: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
p.SendBlockchange(x, y, z, p.level.GetTile(x, y, z));
CatchPos cpos = (CatchPos)p.blockchangeObject;
FileStream fs = File.OpenRead(@Server.backupLocation + "/" + p.level.name + "/" + cpos.backup + "/" + p.level.name + ".lvl");
GZipStream gs = new GZipStream(fs, CompressionMode.Decompress);
byte[] ver = new byte[2];
gs.Read(ver, 0, ver.Length);
ushort version = BitConverter.ToUInt16(ver, 0);
ushort[] vars = new ushort[6];
try
{
if (version == 1874)
{
byte[] header = new byte[16]; gs.Read(header, 0, header.Length);
vars[0] = BitConverter.ToUInt16(header, 0);
vars[1] = BitConverter.ToUInt16(header, 2);
vars[2] = BitConverter.ToUInt16(header, 4);
}
else
{
byte[] header = new byte[12]; gs.Read(header, 0, header.Length);
vars[0] = version;
vars[1] = BitConverter.ToUInt16(header, 0);
vars[2] = BitConverter.ToUInt16(header, 2);
}
byte[] blocks = new byte[vars[0] * vars[2] * vars[1]];
gs.Read(blocks, 0, blocks.Length);
gs.Dispose();
fs.Dispose();
if (blocks.Length != p.level.blocks.Length) { p.SendMessage("Cant restore selection of different size maps."); blocks = null; return; }
if (p.level.bufferblocks && !p.level.Instant)
{
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
BlockQueue.Addblock(p, xx, yy, zz, blocks[xx + (zz * vars[0]) + (yy * vars[0] * vars[1])]);
}
else
{
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
p.level.Blockchange(p, xx, yy, zz, blocks[xx + (zz * vars[0]) + (yy * vars[0] * vars[1])]);
}
blocks = null;
if (p.staticCommands) p.Blockchange += Blockchange1;
}
catch { Server.s.Log("Restore selection failed"); }
}
示例12: Blockchange
public void Blockchange(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
Block b = Program.mainLevel.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b.type);
if (b == null) { p.SendMessage("No edits found for (" + x + "," + y + "," + z + ")."); return; }
//if (b.lastaction.Count == 0) { p.SendMessage("No edits found for (" + x + "," + y + "," + z + ")."); return; }
p.SendMessage("Last edits of (" + x + "," + y + "," + z + "):");
//b.lastaction.ForEach(delegate(Edit e) { p.SendMessage("> " + Player.GetColor(e.from) + e.from + ":&e " + e.before + " => " + e.after); });
}
示例13: BlockchangeHCone
public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
p.ClearBlockchange();
Util.SCOGenerator.HCone(p, x, y, z, height, radius, type);
}
示例14: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
type = p.bindings[type];
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort cur;
if (x == cpos.x && z == cpos.z) { Player.SendMessage(p, "No direction was selected"); return; }
if (Math.Abs(cpos.x - x) > Math.Abs(cpos.z - z))
{
cur = cpos.x;
if (x > cpos.x)
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cur, cpos.y, cpos.z, type, 0);
}
}
else
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cur, cpos.y, cpos.z, type, 1);
}
}
}
else
{
cur = cpos.z;
if (z > cpos.z)
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cpos.x, cpos.y, cur, type, 2);
}
}
else
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cpos.x, cpos.y, cur, type, 3);
}
}
}
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例15: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte Type)
{
//get the pos of first block
p.ClearBlockchange();
byte t = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, t);
//undone change
blox[0].x = x;
blox[0].y = y;
blox[0].z = z;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}