Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALTER PROCEDURE [dbo].[WZ_CharChangeSkin]
- @in_CustomerID int,
- @in_CharID int,
- @in_HeadIdx int,
- @in_BodyIdx int,
- @in_LegsIdx int,
- @in_HeroItemID 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
- -- validate that this is actual body
- declare @GearCategory int = 0
- declare @GearWeight float = 0
- select @GearCategory=Category, @GearWeight=Weight from Items_Gear where ItemID=@in_HeroItemID
- if(@GearCategory <> 16) begin
- select 6 as ResultCode, 'bad hero' as ResultMsg
- return
- end
- -- TODO check for indices
- -- MaxHeads = $member['Bulkiness'];
- -- MaxBodys = $member['Inaccuracy'];
- -- MaxLegs = $member['Stealth'];
- update UsersChars
- set BodyIdx=@in_BodyIdx,
- HeadIdx=@in_HeadIdx,
- LegsIdx=@in_LegsIdx,
- HeroItemID=@in_HeroItemID
- where CharID=@in_CharID
- IF NOT EXISTS(SELECT InventoryID FROM UsersInventory WHERE CustomerID=@in_CustomerID AND ItemID=@in_HeroItemID)
- BEGIN
- SELECT 6 AS ResultCode, 'no hero' AS ResultMsg
- UPDATE UsersData SET Accountstatus = '200' WHERE CustomerID=@in_CustomerID
- RETURN
- END
- -- success
- select 0 as ResultCode
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement