Fix parsing floats (#7)
This commit is contained in:
@@ -25,6 +25,7 @@ using Game.SupportSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Game.Chat.Commands
|
||||
{
|
||||
@@ -156,10 +157,10 @@ namespace Game.Chat.Commands
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float gridX))
|
||||
if (!float.TryParse(args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float gridX))
|
||||
return false;
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float gridY))
|
||||
if (!float.TryParse(args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float gridY))
|
||||
return false;
|
||||
|
||||
if (!uint.TryParse(args.NextString(), out uint mapId))
|
||||
@@ -402,10 +403,10 @@ namespace Game.Chat.Commands
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float x))
|
||||
if (!float.TryParse(args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float x))
|
||||
return false;
|
||||
|
||||
if (!float.TryParse(args.NextString(),out float y))
|
||||
if (!float.TryParse(args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float y))
|
||||
return false;
|
||||
|
||||
// prevent accept wrong numeric args
|
||||
@@ -468,10 +469,10 @@ namespace Game.Chat.Commands
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float x))
|
||||
if (!float.TryParse( args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float x))
|
||||
return false;
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float y))
|
||||
if (!float.TryParse(args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float y))
|
||||
return false;
|
||||
|
||||
string goZ = args.NextString();
|
||||
@@ -479,13 +480,13 @@ namespace Game.Chat.Commands
|
||||
if (!uint.TryParse(args.NextString(), out uint mapId))
|
||||
mapId = player.GetMapId();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float ort))
|
||||
if (!float.TryParse(args.NextString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float ort))
|
||||
ort = player.GetOrientation();
|
||||
|
||||
float z;
|
||||
if (!goZ.IsEmpty())
|
||||
{
|
||||
if (!float.TryParse(goZ, out z))
|
||||
if (!float.TryParse(goZ, NumberStyles.Float, CultureInfo.InvariantCulture, out z))
|
||||
return false;
|
||||
|
||||
if (!GridDefines.IsValidMapCoord(mapId, x, y, z))
|
||||
|
||||
Reference in New Issue
Block a user