diff --git a/.gitignore b/.gitignore index a4058a95d..2e065e740 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ bld/ [Bb]in/ [Oo]bj/ .vs/ +*.sdps # Roslyn cache directories *.ide/ diff --git a/MCGalaxy/Commands/Maintenance/CmdPlayerEdit.cs b/MCGalaxy/Commands/Maintenance/CmdPlayerEdit.cs index 0639f9cef..fb1374b87 100644 --- a/MCGalaxy/Commands/Maintenance/CmdPlayerEdit.cs +++ b/MCGalaxy/Commands/Maintenance/CmdPlayerEdit.cs @@ -91,7 +91,7 @@ namespace MCGalaxy.Commands.Maintenance { MessageDataChanged(p, args[0], args[1], args[2]); } else if (opt == "modified") { SetInteger(p, args, PlayerData.ColumnBlocks, int.MaxValue, who, - v => who.TotalModified = v, type_lo); + v => who.SetBaseTotalModified(v), type_lo); } else if (opt == "drawn") { SetInteger(p, args, PlayerData.ColumnDrawn, int.MaxValue, who, v => who.TotalDrawn = v, type_lo); diff --git a/MCGalaxy/Database/PlayerData.cs b/MCGalaxy/Database/PlayerData.cs index 0ce6c502a..efabdfed7 100644 --- a/MCGalaxy/Database/PlayerData.cs +++ b/MCGalaxy/Database/PlayerData.cs @@ -85,7 +85,7 @@ namespace MCGalaxy.DB { if (col.Length == 0) col = p.group.Color; p.SetColor(col); - p.TotalModified = TotalModified; + p.SetBaseTotalModified(TotalModified); p.TotalDrawn = TotalDrawn; p.TotalPlaced = TotalPlaced; p.TotalDeleted = TotalDeleted; diff --git a/MCGalaxy/Database/Stats/OnlineStat.cs b/MCGalaxy/Database/Stats/OnlineStat.cs index 8ffd86176..532406f98 100644 --- a/MCGalaxy/Database/Stats/OnlineStat.cs +++ b/MCGalaxy/Database/Stats/OnlineStat.cs @@ -136,6 +136,7 @@ namespace MCGalaxy.DB { public static void EntityLine(Player p, Player who) { bool hasSkin = !who.SkinName.CaselessEq(who.truename); + // TODO remove hardcoding bool hasModel = !(who.Model.CaselessEq("humanoid") || who.Model.CaselessEq("human")); if (hasSkin && hasModel) { diff --git a/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs b/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs index 992bc1dd1..d84dce708 100644 --- a/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs +++ b/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs @@ -189,7 +189,7 @@ namespace MCGalaxy.Drawing.Ops } lvl.BlockDB.Cache.Add(p, b.X, b.Y, b.Z, op.Flags, old, b.Block); - p.SessionModified++; p.TotalModified++; p.TotalDrawn++; // increment block stats inline + p.TotalModified++; p.TotalDrawn++; // increment block stats inline // Potentially buffer the block change if (op.TotalModified == reloadThreshold) { diff --git a/MCGalaxy/Levels/Level.Blocks.cs b/MCGalaxy/Levels/Level.Blocks.cs index dd3825097..e8229341c 100644 --- a/MCGalaxy/Levels/Level.Blocks.cs +++ b/MCGalaxy/Levels/Level.Blocks.cs @@ -325,9 +325,7 @@ namespace MCGalaxy { OtherPhysics.DoSpongeRemoved(this, PosToInt(x, y, z), true); } - p.SessionModified++; - p.TotalModified++; - + p.TotalModified++; if (drawn) p.TotalDrawn++; else if (block == Block.Air) p.TotalDeleted++; else p.TotalPlaced++; diff --git a/MCGalaxy/Player/Player.Fields.cs b/MCGalaxy/Player/Player.Fields.cs index fbb3f409b..5ae282088 100644 --- a/MCGalaxy/Player/Player.Fields.cs +++ b/MCGalaxy/Player/Player.Fields.cs @@ -118,10 +118,12 @@ namespace MCGalaxy { public int money; public long TotalModified, TotalDrawn, TotalPlaced, TotalDeleted; - public int SessionModified; public int TimesVisited, TimesBeenKicked, TimesDied; public int TotalMessagesSent; + long startModified; + public long SessionModified { get { return TotalModified - startModified; } } + DateTime startTime; public TimeSpan TotalTime { get { return DateTime.UtcNow - startTime; } diff --git a/MCGalaxy/Player/Player.cs b/MCGalaxy/Player/Player.cs index b9cddbe1c..fd3549d03 100644 --- a/MCGalaxy/Player/Player.cs +++ b/MCGalaxy/Player/Player.cs @@ -411,7 +411,14 @@ namespace MCGalaxy { public void CheckForMessageSpam() { if (spamChecker != null) spamChecker.CheckChatSpam(); - } + } + + internal void SetBaseTotalModified(long modified) { + long adjust = modified - TotalModified; + TotalModified = modified; + // adjustment so that SessionModified is unaffected + startModified += adjust; + } string selTitle; readonly object selLock = new object();