[How to] activate serial check in the community release
Hello everyone! I've been strugling with the serial checking for a moment now, and I have finally found out how to make it work! Here's how to activate it:
Notice: Backup your functions just in case.
1 - Open up navicat, and connect to your server.
2 - Go to: Breezenet -> dbo -> Functions.
3 - Double click the function "BN_WarZ_CheckSerial" to open it.
3.a - Make sure it looks like this:
Code:
-- ----------------------------
-- Procedure structure for [BN_WarZ_CheckSerial]
-- ----------------------------
ALTER PROCEDURE [BN_WarZ_CheckSerial]
@in_SerialKey varchar(128)
AS
BEGIN
SET NOCOUNT ON;
-- temp function used for checking if serial exists
select * from WarZSerials where SerialKey=@in_SerialKey
return
END
3.b - Save.
##########################################################
4 - Double click the function "BN_WarZ_SerialCheck" to open it.
4.a - Make sure it looks like this:
Code:
-- ----------------------------
-- Procedure structure for [BN_WarZ_SerialCheck]
-- ----------------------------
ALTER PROCEDURE [dbo].[BN_WarZ_SerialCheck]
@in_SerialKey varchar(128),
@in_email varchar(128)
AS
BEGIN
SET NOCOUNT ON;
-- call is always success
select 0 as ResultCode
update DBG_SerialChecks set SerialCheck=(SerialCheck+1) where RecordID=1
declare @email varchar(128)
declare @CustomerID int
declare @IsUsed int
declare @IsBlocked int
declare @SerialType int
select
@email=email,
@CustomerID=CustomerID,
@IsUsed=IsUsed,
@IsBlocked=IsBlocked,
@SerialType=SerialType
from WarZSerials where SerialKey=@in_SerialKey
if(@@ROWCOUNT = 0 or @IsUsed = 0) begin
select 1 as CheckCode, 'Serial Key is not valid' as CheckMsg, -1 as SerialType
return
end
if(@IsBlocked > 0) begin
select 5 as CheckCode, 'Your Serial Key is BLOCKED' as CheckMsg, -1 as SerialType
return
end
--we do not check for email anymore
--if(@email <> @in_email) begin
-- select 2 as CheckCode, 'Serial Key and order email do not match' as CheckMsg, -1 as SerialType
-- return
--end
if(@CustomerID > 0) begin
select 3 as CheckCode, 'You already have The War Z account for this Serial Key' as CheckMsg, -1 as SerialType
return
end
select 0 as CheckCode, 'Serial Key is Valid' as CheckMsg, @SerialType as SerialType
return
END
4.b - Save.
##########################################################
5 - Double click the function "BN_WarZ_SerialCheck2" to open it.
5.a - Make sure it looks like this:
Code:
-- ----------------------------
-- Procedure structure for [BN_WarZ_SerialCheck2]
-- ----------------------------
ALTER PROCEDURE [BN_WarZ_SerialCheck2]
@in_SerialKey varchar(128),
@in_email varchar(128)
AS
BEGIN
SET NOCOUNT ON;
-- temp function used for account site getforumbadge-exec.php
select * from WarZSerials where SerialKey=@in_SerialKey and email=@in_email
return
END
5.b - Save.
##########################################################
6 - Go to: Warz -> dbo -> Functions.
7 - Double click the function "WZ_ACCOUNT_APPLYKEY" to open it.
7.a - Make sure it looks like this:
Code:
-- ----------------------------
-- Procedure structure for [WZ_ACCOUNT_APPLYKEY]
-- ----------------------------
ALTER PROCEDURE [WZ_ACCOUNT_APPLYKEY]
@in_CustomerID int,
@in_SerialKey varchar(128)
AS
BEGIN
SET NOCOUNT ON;
declare @AccountType int = -1
select @AccountType=AccountType from dbo.UsersData where CustomerID=@in_CustomerID
if(@@ROWCOUNT = 0) begin
select 6 as ResultCode, 'no user' as ResultMsg;
return
end
-- only guest accounts can be extended
if(@AccountType <> 3) begin
select 2 as ResultCode, 'bad account type' as ResultMsg;
return
end
--
-- add new return codes in CUpdater::DoApplyNewKey
--
-- check for serial key
declare @keyResultCode int = 99
declare @keyCustomerID int = 99
declare @keySerialType int = 99
exec [BreezeNet].[dbo].[BN_WarZ_SerialGetInfo]
@in_SerialKey,
'email@not.used',
@keyResultCode out,
@keyCustomerID out,
@keySerialType out
if(@keyResultCode <> 0) begin
select 3 as ResultCode, 'Serial not valid' as ResultMsg;
return
end
if(@keyCustomerID > 0) begin
select 4 as ResultCode, 'Serial already used' as ResultMsg;
return
end
-- update account type and expiration time
declare @DateActiveUntil datetime = '2030-1-1'
if(@keySerialType = 3) begin
-- guest accounts have 48hrs play time (sync with [WZ_ACCOUNT_CREATE])
set @DateActiveUntil = DATEADD(hour, 48, GETDATE())
end
update UsersData set DateActiveUntil=@DateActiveUntil, AccountType=@keySerialType where CustomerID=@in_CustomerID
-- register CustomerID in BreezeNet
exec [BreezeNet].[dbo].[BN_WarZ_SerialSetCustomerID] @in_SerialKey, @in_CustomerID
-- BONUSES from [WZ_ACCOUNT_CREATE] - do not forget to sync them
if(@keySerialType = 0) begin
-- legend package, 30$ 1GC=142
update UsersData set GamePoints=(GamePoints+4260) where CustomerID=@in_CustomerID
end
if(@keySerialType = 1) begin
-- pioneer package, 15$ 1GC=142
update UsersData set GamePoints=(GamePoints+2139) where CustomerID=@in_CustomerID
end
-- success
select 0 as ResultCode
select @in_CustomerID as CustomerID, @keySerialType as 'AccountType'
return
END
7.b - Save.
##########################################################
8 - Double click the function "WZ_ACCOUNT_CREATE" to open it.
8.a - Make sure it looks like this:
Code:
-- ----------------------------
-- Procedure structure for [WZ_ACCOUNT_CREATE]
-- ----------------------------
ALTER PROCEDURE [dbo].[WZ_ACCOUNT_CREATE]
@in_IP varchar(64),
@in_Email varchar(128),
@in_Password varchar(64),
@in_ReferralID int,
@in_SerialKey varchar(128),
@in_SerialEmail varchar(128)
AS
BEGIN
SET NOCOUNT ON;
--
-- NOTE: add new ResultCodes to updater CUpdater::CreateAccThreadEntry
--
-- check for serial key
declare @keyResultCode int = 99
declare @keyCustomerID int = 99
declare @keySerialType int = 99
exec [BreezeNet].[dbo].[BN_WarZ_SerialGetInfo]
@in_SerialKey,
@in_SerialEmail,
@keyResultCode out,
@keyCustomerID out,
@keySerialType out
if(@keyResultCode <> 0 or @keyCustomerID > 0) begin
select 3 as ResultCode, 'Serial not valid' as ResultMsg;
return
end
-- declare @keySerialType int = 0 -- Legend Package
-- check if that account was created and refunded before (status 999)
declare @RefundCustomerID int = 0
select @RefundCustomerID=CustomerID from Accounts WHERE email=@in_Email and AccountStatus=999
if(@RefundCustomerID > 0) begin
-- change email to some unique one so it can be used again.
declare @dateTime varchar(128)
set @dateTime = REPLACE(CONVERT(VARCHAR, GETDATE(),111),'/','') + REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')
declare @refundedEmail varchar(128) = '(' + @dateTime + ') ' + @in_Email
update Accounts set email=@refundedEmail where CustomerID=@RefundCustomerID
end
-- validate that email is unique
if exists (SELECT CustomerID from Accounts WHERE email=@in_Email) begin
select 2 as ResultCode, 'Email already in use' as ResultMsg;
return;
end
-- create user
declare @MD5FromPwd varchar(100)
exec FN_CreateMD5Password @in_Password, @MD5FromPwd OUTPUT
INSERT INTO Accounts (
email,
MD5Password,
dateregistered,
ReferralID,
lastlogindate,
lastloginIP
) VALUES (
@in_EMail,
@MD5FromPwd,
GETDATE(),
@in_ReferralID,
GETDATE(),
@in_IP
)
-- get new CustomerID
declare @CustomerID int
SELECT @CustomerID=CustomerID from Accounts where email=@in_Email
-- create all needed user tables
INSERT INTO UsersData (
CustomerID,
AccountType,
dateregistered
) VALUES (
@CustomerID,
@keySerialType,
GETDATE()
)
-- guest accounts have 48hrs play time (sync with WZ_ACCOUNT_APPLYKEY also)
if(@keySerialType = 3) begin
declare @DateActiveUntil datetime = DATEADD(hour, 48, GETDATE())
update UsersData set DateActiveUntil=@DateActiveUntil where CustomerID=@CustomerID
end
-- register CustomerID in BreezeNet
exec [BreezeNet].[dbo].[BN_WarZ_SerialSetCustomerID] @in_SerialKey, @CustomerID
-- default items and bonuses for account types
exec FN_AddItemToUser @CustomerID, 20174, 2000 -- hero: regular guy
-- CBT TEST HEROES
exec FN_AddItemToUser @CustomerID, 20182, 2000
exec FN_AddItemToUser @CustomerID, 20184, 2000
-- 10 of each
--declare @i int = 0
--while(@i < 10) begin
-- set @i = @i + 1
-- exec FN_AddItemToUser @CustomerID, 101306, 2000 -- Flashlight
-- exec FN_AddItemToUser @CustomerID, 101261, 2000 -- Bandages
-- exec FN_AddItemToUser @CustomerID, 101296, 2000 -- Can of Soda
-- exec FN_AddItemToUser @CustomerID, 101289, 2000 -- Granola Bar
--end
-- BONUSES for packages - do not forget to sync them with [WZ_ACCOUNT_APPLYKEY]
if(@keySerialType = 0) begin
-- legend package, 30$ 1GC=142
update UsersData set GamePoints=(GamePoints+4260) where CustomerID=@CustomerID
end
if(@keySerialType = 1) begin
-- pioneer package, 15$ 1GC=142
update UsersData set GamePoints=(GamePoints+2139) where CustomerID=@CustomerID
end
-- success
select 0 as ResultCode
select @CustomerID as CustomerID, @keySerialType as 'AccountType'
return
END
8.b - Save.
That's it!
Now go to your launcher -> register -> try any random key in the format of "xxxx-xxxx-xxxx-xxxx" or "xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", and it should say: "Serial key is invalid".
From Theoutbreak DEV's.
Re: [How to] activate serial check in the community release
hmm just tried and my launcher wont accept any codes now not even ones generated from the programme from ultrapouring
Re: [How to] activate serial check in the community release
Thank you has you very good work
Re: [How to] activate serial check in the community release
Quote:
Originally Posted by
MtHx62210
Thank you has you very good work
No problem mate!
Quote:
Originally Posted by
Lewis Caddick
hmm just tried and my launcher wont accept any codes now not even ones generated from the programme from ultrapouring
As I told you in the PM... :P
Re: [How to] activate serial check in the community release
will you be able to help i rebuilt everything and still launcher doesnt accept no serials.
Re: [How to] activate serial check in the community release
yes but it is safe ? need change a pass generator or no ?
Re: [How to] activate serial check in the community release
Quote:
Originally Posted by
doidloko
need change a pass generator or no ?
What do you mean?
And yes it is safe (at least should be!), I tried it and it worked, and a mate tried it and it worked for him too. (But make a backup, you never know!)
Re: [How to] activate serial check in the community release
why don't just use the old store procedure...easy and safe
Re: [How to] activate serial check in the community release
How would I be able to register normally? without all this?
Like without this post?
Re: [How to] activate serial check in the community release
and how to create new serial to create account ?