ALTER PROCEDURE [dbo].[WZ_CharReviveCheck]
@in_CustomerID int,
@in_CharID int
AS
BEGIN
SET NOCOUNT ON;
-- validate CharID/CustomerID pair
declare @CustomerID int = 0
select @CustomerID=CustomerID from UsersChars where CharID=@in_CharID
if(@@ROWCOUNT = 0 or @CustomerID <> @in_CustomerID) begin
select 6 as ResultCode, 'bad charid' as ResultMsg
return
end
-- change server revive time in WZ_GetAccountInfo2/WZ_Revive/WZ_ReviveCheck as well
declare @SecToRevive int
declare @Alive int = 1
select
@SecToRevive=DATEDIFF(second, GETUTCDATE(), DATEADD(minute, 20, DeathUtcTime)),
@Alive=Alive
from UsersChars where CharID=@in_CharID
-- premium accs have 10min revive time
declare @PremiumExpireTime datetime
select @PremiumExpireTime=PremiumExpireTime from UsersData where CustomerID=@in_CustomerID
if(GETDATE() < @PremiumExpireTime) begin
set @SecToRevive = @SecToRevive - 600
end
select 0 as ResultCode
-- check if we need money for revive
declare @NeedMoney int = 0
if(@SecToRevive > 61 and @Alive = 0) set @NeedMoney = 1
select @SecToRevive as 'SecToRevive', @NeedMoney as 'NeedMoney'
END
ไม่มีความคิดเห็น:
แสดงความคิดเห็น