- Timestamp:
- Jul 24, 2014, 3:25:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/TelnetCommands/SetTimeReal.cs
r84 r103 19 19 public override void Run (string[] _params) 20 20 { 21 if (_params.Length != 3) { 22 m_Console.md000a ("Usage: settimereal <day> <hour> <min>"); 23 return; 21 try { 22 if (_params.Length != 3) { 23 m_Console.md000a ("Usage: settimereal <day> <hour> <min>"); 24 return; 25 } 26 27 int day, hour, min; 28 if (!int.TryParse (_params [0], out day)) { 29 m_Console.md000a ("Could not parse day number \"" + _params [0] + "\""); 30 return; 31 } 32 if (day < 1) { 33 m_Console.md000a ("Day must be >= 1"); 34 return; 35 } 36 if (!int.TryParse (_params [1], out hour)) { 37 m_Console.md000a ("Could not parse hour \"" + _params [1] + "\""); 38 return; 39 } 40 if (hour > 23) { 41 m_Console.md000a ("Hour must be <= 23"); 42 return; 43 } 44 if (!int.TryParse (_params [2], out min)) { 45 m_Console.md000a ("Could not parse minute \"" + _params [2] + "\""); 46 return; 47 } 48 if (min > 59) { 49 m_Console.md000a ("Minute must be <= 59"); 50 return; 51 } 52 if ((day < 1) || (hour < 8 && day < 1)) { 53 m_Console.md000a ("Time may not be prior to day 1, 8:00"); 54 return; 55 } 56 57 ulong time = ((ulong)(day - 1) * 24000) + ((ulong)hour * 1000) + ((ulong)min * 1000 / 60) - 8000; 58 m_Console.gameManager.World.gameTime = time; 59 m_Console.md000a (String.Format ("Set time to Day {0}, {1:00}:{2:00} = {3}", day, hour, min, time)); 60 } catch (Exception e) { 61 Log.Out ("Error in SetTimeReal.Run: " + e); 24 62 } 25 26 int day, hour, min;27 if (!int.TryParse (_params [0], out day)) {28 m_Console.md000a ("Could not parse day number \"" + _params [0] + "\"");29 return;30 }31 if (day < 1) {32 m_Console.md000a ("Day must be >= 1");33 return;34 }35 if (!int.TryParse (_params [1], out hour)) {36 m_Console.md000a ("Could not parse hour \"" + _params [1] + "\"");37 return;38 }39 if (hour > 23) {40 m_Console.md000a ("Hour must be <= 23");41 return;42 }43 if (!int.TryParse (_params [2], out min)) {44 m_Console.md000a ("Could not parse minute \"" + _params [2] + "\"");45 return;46 }47 if (min > 59) {48 m_Console.md000a ("Minute must be <= 59");49 return;50 }51 if ((day < 1) || (hour < 8 && day < 1)) {52 m_Console.md000a ("Time may not be prior to day 1, 8:00");53 return;54 }55 56 ulong time = ((ulong)(day-1) * 24000) + ((ulong)hour * 1000) + ((ulong)min * 1000 / 60) - 8000;57 this.m_Console.gameManager.World.gameTime = time;58 m_Console.md000a (String.Format ("Set time to Day {0}, {1:00}:{2:00} = {3}", day, hour, min, time));59 63 } 60 64 }
Note:
See TracChangeset
for help on using the changeset viewer.