Make hacks more consistent, can place blocks through yourself in noclip, alow cycling fog up to 1024, 2048 and 4096.

This commit is contained in:
UnknownShadow200 2015-11-08 12:22:04 +11:00
parent 30ea4c9429
commit 30a70638e1
5 changed files with 39 additions and 32 deletions

View File

@ -61,8 +61,10 @@ namespace ClassicalSharp {
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no", g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ), (g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
Make( 140, -150, "Pushback block placing", Anchor.Centre, OnWidgetClick, Make( 140, -150, "Pushback block placing", Anchor.Centre, OnWidgetClick,
g => g.PushbackBlockPlacing ? "yes" : "no", g => g.LocalPlayer.PushbackBlockPlacing
(g, v) => g.PushbackBlockPlacing = (v == "yes" ) ), && g.LocalPlayer.CanPushbackBlocks ? "yes" : "no",
(g, v) => { if( g.LocalPlayer.CanPushbackBlocks)
g.LocalPlayer.PushbackBlockPlacing = v == "yes"; }),
Make( 0, 5, "Back to menu", Anchor.BottomOrRight, Make( 0, 5, "Back to menu", Anchor.BottomOrRight,
(g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ), (g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ),

View File

@ -14,28 +14,23 @@ namespace ClassicalSharp {
public int SpeedMultiplier = 10; public int SpeedMultiplier = 10;
public byte UserType; public byte UserType;
public bool PushbackBlockPlacing;
bool canSpeed = true, canFly = true, canRespawn = true, canNoclip = true; bool canSpeed = true, canFly = true, canRespawn = true, canNoclip = true;
/// <summary> Whether the player has permission to increase its speed beyond the normal walking speed. </summary> /// <summary> Whether the player is allowed to increase its speed beyond the normal walking speed. </summary>
public bool CanSpeed { public bool CanSpeed = true;
get { return canSpeed; }
set { canSpeed = value; }
}
public bool CanFly { /// <summary> Whether the player is allowed to fly in the world. </summary>
get { return canFly; } public bool CanFly = true;
set { canFly = value; if( !value ) flying = false; }
}
public bool CanRespawn { /// <summary> Whether the player is allowed to teleport to their respawn point. </summary>
get { return canRespawn; } public bool CanRespawn = true;
set { canRespawn = value; }
}
public bool CanNoclip { /// <summary> Whether the player is allowed to pass through all blocks. </summary>
get { return canNoclip; } public bool CanNoclip = true;
set { canNoclip = value; if( !value ) noClip = false; }
} /// <summary> Whether the player is allowed to use pushback block placing. </summary>
public bool CanPushbackBlocks = true;
float jumpVel = 0.42f; float jumpVel = 0.42f;
/// <summary> Returns the height that the client can currently jump up to.<br/> /// <summary> Returns the height that the client can currently jump up to.<br/>
@ -214,12 +209,11 @@ namespace ClassicalSharp {
public void ParseHackFlags( string name, string motd ) { public void ParseHackFlags( string name, string motd ) {
string joined = name + motd; string joined = name + motd;
if( joined.Contains( "-hax" ) ) { if( joined.Contains( "-hax" ) ) {
CanFly = CanNoclip = CanSpeed = CanRespawn = false; CanFly = CanNoclip = CanRespawn = CanSpeed =
game.CanUseThirdPersonCamera = false; CanPushbackBlocks = game.CanUseThirdPersonCamera = false;
game.SetCamera( false );
} else { // By default (this is also the case with WoM), we can use hacks. } else { // By default (this is also the case with WoM), we can use hacks.
CanFly = CanNoclip = CanSpeed = CanRespawn = true; CanFly = CanNoclip = CanRespawn = CanSpeed =
game.CanUseThirdPersonCamera = true; CanPushbackBlocks = game.CanUseThirdPersonCamera = true;
} }
ParseFlag( b => CanFly = b, joined, "fly" ); ParseFlag( b => CanFly = b, joined, "fly" );
@ -228,7 +222,9 @@ namespace ClassicalSharp {
ParseFlag( b => CanRespawn = b, joined, "respawn" ); ParseFlag( b => CanRespawn = b, joined, "respawn" );
if( UserType == 0x64 ) if( UserType == 0x64 )
ParseFlag( b => CanFly = CanNoclip = CanRespawn = CanSpeed = b, joined, "ophax" ); ParseFlag( b => CanFly = CanNoclip = CanRespawn =
CanSpeed = CanPushbackBlocks = b, joined, "ophax" );
CheckHacksConsistency();
} }
static void ParseFlag( Action<bool> action, string joined, string flag ) { static void ParseFlag( Action<bool> action, string joined, string flag ) {
@ -239,6 +235,17 @@ namespace ClassicalSharp {
} }
} }
/// <summary> Disables any hacks if their respective CanHackX value is set to false. </summary>
public void CheckHacksConsistency() {
if( !CanFly ) flying = false;
if( !CanNoclip ) noClip = false;
if( !CanSpeed) canSpeed = false;
if( !CanPushbackBlocks ) PushbackBlockPlacing = false;
if( !game.CanUseThirdPersonCamera )
game.SetCamera( false );
}
/// <summary> Sets the user type of this user. This is used to control permissions for grass, /// <summary> Sets the user type of this user. This is used to control permissions for grass,
/// bedrock, water and lava blocks on servers that don't support CPE block permissions. </summary> /// bedrock, water and lava blocks on servers that don't support CPE block permissions. </summary>
public void SetUserType( byte value ) { public void SetUserType( byte value ) {

View File

@ -69,7 +69,7 @@ namespace ClassicalSharp {
public int MouseSensitivity = 30; public int MouseSensitivity = 30;
public int ChatLines = 12; public int ChatLines = 12;
public bool HideGui = false, ShowFPS = true; public bool HideGui = false, ShowFPS = true;
public bool PushbackBlockPlacing;
public Animations Animations; public Animations Animations;
internal int CloudsTextureId, RainTextureId, SnowTextureId; internal int CloudsTextureId, RainTextureId, SnowTextureId;
internal bool screenshotRequested; internal bool screenshotRequested;

View File

@ -116,9 +116,9 @@ namespace ClassicalSharp {
pos.X + 1, pos.Y + height, pos.Z + 1 ); pos.X + 1, pos.Y + height, pos.Z + 1 );
BoundingBox localBB = game.LocalPlayer.CollisionBounds; BoundingBox localBB = game.LocalPlayer.CollisionBounds;
if( !localBB.Intersects( blockBB ) ) return true; if( game.LocalPlayer.noClip || !localBB.Intersects( blockBB ) ) return true;
if( game.PushbackBlockPlacing ) { if( game.LocalPlayer.PushbackBlockPlacing ) {
return PushbackPlace( selected, blockBB ); return PushbackPlace( selected, blockBB );
} else { } else {
localBB.Min.Y += 0.25f + Entity.Adjustment; localBB.Min.Y += 0.25f + Entity.Adjustment;
@ -263,7 +263,7 @@ namespace ClassicalSharp {
} }
} }
static int[] viewDistances = { 16, 32, 64, 128, 256, 512 }; static int[] viewDistances = { 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };
void KeyDownHandler( object sender, KeyboardKeyEventArgs e ) { void KeyDownHandler( object sender, KeyboardKeyEventArgs e ) {
Key key = e.Key; Key key = e.Key;
if( SimulateMouse( key, true ) ) return; if( SimulateMouse( key, true ) ) return;

View File

@ -308,10 +308,8 @@ namespace ClassicalSharp {
game.LocalPlayer.CanSpeed = reader.ReadUInt8() != 0; game.LocalPlayer.CanSpeed = reader.ReadUInt8() != 0;
game.LocalPlayer.CanRespawn = reader.ReadUInt8() != 0; game.LocalPlayer.CanRespawn = reader.ReadUInt8() != 0;
game.CanUseThirdPersonCamera = reader.ReadUInt8() != 0; game.CanUseThirdPersonCamera = reader.ReadUInt8() != 0;
game.LocalPlayer.CheckHacksConsistency();
if( !game.CanUseThirdPersonCamera ) {
game.SetCamera( false );
}
float jumpHeight = reader.ReadInt16() / 32f; float jumpHeight = reader.ReadInt16() / 32f;
if( jumpHeight < 0 ) jumpHeight = 1.4f; if( jumpHeight < 0 ) jumpHeight = 1.4f;
game.LocalPlayer.CalculateJumpVelocity( jumpHeight ); game.LocalPlayer.CalculateJumpVelocity( jumpHeight );