Advertisement
EnemyGPP

Untitled

Jan 28th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1.  
  2. ALTER PROCEDURE [dbo].[WZ_CharChangeSkin]
  3. @in_CustomerID int,
  4. @in_CharID int,
  5. @in_HeadIdx int,
  6. @in_BodyIdx int,
  7. @in_LegsIdx int,
  8. @in_HeroItemID int
  9.  
  10. AS
  11. BEGIN
  12. SET NOCOUNT ON;
  13.  
  14. -- validate CharID/CustomerID pair
  15. declare @CustomerID int = 0
  16. select @CustomerID=CustomerID from UsersChars where CharID=@in_CharID
  17. if(@@ROWCOUNT = 0 or @CustomerID <> @in_CustomerID) begin
  18. select 6 as ResultCode, 'bad charid' as ResultMsg
  19. return
  20. end
  21.  
  22. -- validate that this is actual body
  23. declare @GearCategory int = 0
  24. declare @GearWeight float = 0
  25. select @GearCategory=Category, @GearWeight=Weight from Items_Gear where ItemID=@in_HeroItemID
  26. if(@GearCategory <> 16) begin
  27. select 6 as ResultCode, 'bad hero' as ResultMsg
  28. return
  29. end
  30.  
  31. -- TODO check for indices
  32. -- MaxHeads = $member['Bulkiness'];
  33. -- MaxBodys = $member['Inaccuracy'];
  34. -- MaxLegs = $member['Stealth'];
  35.  
  36. update UsersChars
  37. set BodyIdx=@in_BodyIdx,
  38. HeadIdx=@in_HeadIdx,
  39. LegsIdx=@in_LegsIdx,
  40. HeroItemID=@in_HeroItemID
  41. where CharID=@in_CharID
  42. IF NOT EXISTS(SELECT InventoryID FROM UsersInventory WHERE CustomerID=@in_CustomerID AND ItemID=@in_HeroItemID)
  43. BEGIN
  44. SELECT 6 AS ResultCode, 'no hero' AS ResultMsg
  45. UPDATE UsersData SET Accountstatus = '200' WHERE CustomerID=@in_CustomerID
  46. RETURN
  47. END
  48.  
  49. -- success
  50. select 0 as ResultCode
  51.  
  52. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement