USE [PS_GameData]
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_Info_E]
@CharID int,
@Level int, @

Point smallint, @

smallint, @

smallint,
@Dex smallint,
@Rec smallint,
@Int smallint, @

smallint,
@Luc smallint,
@Hp smallint,
@Mp smallint,
@Sp smallint,
@Map smallint,
@Dir smallint,
@Exp int,
@Money int,
@Posx varchar(50),
@Posy varchar(50),
@Posz varchar(50),
@Hg int,
@Vg int,
@Cg int,
@Og int,
@Ig int,
@K1 int = null,
@K2 int = null,
@K3 int = null,
@K4 int = null,
@KillLevel tinyint,
@DeadLevel tinyint
AS
SET NOCOUNT ON
DECLARE @ServerID int,
@Grow int,
@

p bigint,
@PosxR real,
@PosyR real,
@PoszR real
SET @ServerID = 1
IF (ISNumeric(@Posx) = 1 and ISNumeric(@Posy) = 1 and ISNumeric(@Posz) = 1)
BEGIN
SET @PosxR = CAST(@Posx as real)
SET @PosyR = CAST(@Posy as real)
SET @PoszR = CAST(@Posz as real)
END
ELSE
BEGIN
--Only gets here if there is a error in the positions, Most likely a bot or exploit.
--Log in a error table for manual invest.
--Set all the pos. to bootleg so it doesn't throw an error
SET @Map = 41
SET @PosxR = 42.970
SET @PosYR = 2.090
SET @PosZR = 48.270
END
UPDATE Chars
SET [Level] = @Level, StatPoint = @

Point, SkillPoint = @

,
[Str] = @

, dex = @Dex, Rec = @Rec, [int] = @Int, Wis = @

, Luc = @Luc,
HP = @Hp, Mp = @Mp, Sp = @Sp,
Map = @Map, dir = @Dir, [exp] = @Exp, [money] = @Money,
PosX = @PosxR, PosY = @PosYR, PosZ = @PosZR, hg = @Hg, vg = @Vg, cg = @Cg, og = @Og, ig = @Ig,
KillLevel=@KillLevel, DeadLevel=@DeadLevel,LeaveDate=GETDATE()
WHERE CharID = @CharID
IF( (@K1 IS NOT NULL) AND (@K2 IS NOT NULL) AND (@K3 IS NOT NULL) AND (@K4 IS NOT NULL))
BEGIN
UPDATE Chars SET K1=@K1, K2=@K2, K3=@K3, K4=@K4 WHERE CharID=@CharID
END
IF(@@ERROR = 0 AND @@ROWCOUNT = 1)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF