USE [warz]
GO
/****** Object: StoredProcedure [dbo].[WZ_Char_SRV_SetStatus] Script Date: 10/19/2013 10:46:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ----------------------------
-- Procedure structure for [WZ_Char_SRV_SetStatus]
-- ----------------------------
ALTER PROCEDURE [dbo].[WZ_Char_SRV_SetStatus]
@in_CustomerID int,
@in_CharID int,
@in_Alive int,
@in_GamePos varchar(256),
@in_GameFlags int,
@in_Health float,
@in_Hunger float,
@in_Thirst float,
@in_Toxic float,
@in_TimePlayed int,
@in_XP int,
@in_Reputation int,
@in_GameDollars int,
@in_Stat00 int,
@in_Stat01 int,
@in_Stat02 int,
@in_Stat03 int,
@in_Stat04 int,
@in_Stat05 int
AS
BEGIN
SET NOCOUNT ON;
--
-- this function should be called only by server, so we skip all validations
--
-- record last game update
update UsersData set GameDollars=@in_GameDollars, lastgamedate=GETDATE() where CustomerID=@in_CustomerID
declare @IsLegend int = 0
select @IsLegend=AccountType from UsersData where CustomerID=@in_CustomerID
-- update basic character data
update UsersChars set
GamePos=@in_GamePos,
GameFlags=@in_GameFlags,
Alive=@in_Alive,
Health=@in_Health,
Food=@in_Hunger,
Water=@in_Thirst,
Toxic=@in_Toxic,
TimePlayed=@in_TimePlayed,
LastUpdateDate=GETDATE(),
XP=@in_XP,
Reputation=@in_Reputation,
Stat00=@in_Stat00,
Stat01=@in_Stat01,
Stat02=@in_Stat02,
Stat03=@in_Stat03,
Stat04=@in_Stat04,
Stat05=@in_Stat05
where CharID=@in_CharID
if(@in_Alive = 0) begin
update UsersChars set DeathUtcTime=GETUTCDATE() where CharID=@in_CharID
if(@IsLegend = 2) begin
-- set default backpack on death
update UsersChars set BackpackID=20176, BackpackSize=12 where CharID=@in_CharID
-- delete stuff from backpack
delete from UsersInventory where CustomerID=@in_CustomerID and CharID=@in_CharID
end
end
select 0 as ResultCode
end