Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ----------------------------
- -- Procedure structure for [WZ_CharCreate]
- -- ----------------------------
- ALTER PROCEDURE [dbo].[WZ_CharCreate]
- @in_CustomerID int,
- @in_Hardcore int,
- @in_Gamertag nvarchar(64),
- @in_HeroItemID int,
- @in_HeadIdx int,
- @in_BodyIdx int,
- @in_LegsIdx int
- AS
- BEGIN
- SET NOCOUNT ON;
- if(@in_Gamertag like '%sergey%titov%') begin
- select 9 as ResultCode, 'no impersonation' as ResultMsg
- return
- end
- if(@in_Gamertag like '%titov%sergey%') begin
- select 9 as ResultCode, 'no impersonation' as ResultMsg
- return
- end
- if(@in_Gamertag like '%system%') begin
- select 9 as ResultCode, 'no System' as ResultMsg
- return
- end
- if(@in_Gamertag like '%\[dev\]%' escape '\') begin
- select 9 as ResultCode, 'no dev' as ResultMsg
- return
- end
- -- check if gamertag is unique
- if exists (select CharID from UsersChars where Gamertag=@in_Gamertag)
- begin
- select 9 as ResultCode, 'Gamertag already exists' as ResultMsg
- return
- end
- -- for anticheats we will used this to check heroitemid is vaild.
- declare @cat int = 0
- select @cat=Category from Items_Gear where ItemID=@in_HeroItemID
- if (@cat != 16) BEGIN
- select 6 as ResultCode, 'Invaid HeroItemID' as ResultMsg
- return
- end
- declare @InventoryIDHero int = 0
- select @InventoryIDHero=InventoryID from UsersInventory where ItemID=@in_HeroItemID and CustomerID=@in_CustomerID
- if (@InventoryIDHero = 0) BEGIN
- select 6 as ResultCode, 'you not have HeroItemID' as ResultMsg
- return
- end
- -- anticheats : check this user have Hero.
- -- we can't have more that 5 survivors
- declare @NumChars int = 0
- select @NumChars=COUNT(*) from UsersChars where CustomerID=@in_CustomerID
- if(@NumChars >= 5) begin
- select 6 as ResultCode, 'too many created chars' as ResultMsg
- return
- end
- insert into UsersChars (
- CustomerID,
- Gamertag,
- Alive,
- Hardcore,
- HeroItemID,
- HeadIdx,
- BodyIdx,
- LegsIdx,
- CreateDate
- ) values (
- @in_CustomerID,
- @in_Gamertag,
- 3,
- @in_Hardcore,
- @in_HeroItemID,
- @in_HeadIdx,
- @in_BodyIdx,
- @in_LegsIdx,
- GETDATE()
- )
- declare @CharID int = SCOPE_IDENTITY()
- -- give basic items for first few survivors
- declare @CharsCreated int = 0
- update UsersData set CharsCreated=(CharsCreated+1) where CustomerID=@in_CustomerID
- select @CharsCreated=CharsCreated from UsersData where CustomerID=@in_CustomerID
- --if(@CharsCreated <= 5) begin
- -- add some default items - BE ULTRA CAREFUL with BackpackSlot number
- insert into UsersInventory (CustomerID, CharID, BackpackSlot, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, @CharID, 1, 101306, '2020-1-1', 1) -- Flashlight
- insert into UsersInventory (CustomerID, CharID, BackpackSlot, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, @CharID, 2, 101261, '2020-1-1', 1) -- Bandages
- insert into UsersInventory (CustomerID, CharID, BackpackSlot, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, @CharID, 3, 101296, '2020-1-1', 1) -- Can of Soda
- insert into UsersInventory (CustomerID, CharID, BackpackSlot, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, @CharID, 4, 101289, '2020-1-1', 1) -- Granola Bar
- -- new inventory give out only for char id 1
- if(@CharsCreated = 1) begin
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101088, '2020-1-1', 5) -- M107
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101247, '2020-1-1', 5) -- Blazer
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101084, '2020-1-1', 20) -- vss
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101087, '2020-1-1', 5) -- awm
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101262, '2020-1-1', 150) -- bandges dx
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 400016, '2020-1-1', 100) -- stanag 30
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 20016, '2020-1-1', 20) -- custom g
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 20067, '2020-1-1', 20) -- K style NVG
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 20180, '2020-1-1', 20) -- Military ruck
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101173, '2020-1-1', 50) -- IMI TAR 21
- insert into UsersInventory (CustomerID, ItemID, LeasedUntil, Quantity)
- values (@in_CustomerID, 101172, '2020-1-1', 50) -- sig 556
- end
- -- end
- -- Krit give 500XP if first char
- if(@CharsCreated = 1) begin
- UPDATE UsersChars SET XP = 500 WHERE CharID = @CharID
- end
- -- allow to use postbox on newly created survivors
- update UsersChars set GameFlags=1 where CharID=@CharID
- -- Save to CharsCreateLog
- --INSERT INTO CharsCreateLog (CustomerID, CharID, GamerTag) VALUES (@in_CustomerID, @CharID, @in_Gamertag)
- INSERT INTO CharsLog (CharMessage, CustomerID, CharID, GamerTag, time) VALUES ('Char Create', @in_CustomerID, @CharID, @in_Gamertag, GETDATE())
- select 0 as ResultCode
- select @CharID as 'CharID'
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement