- Joined
- Jan 24, 2013
- Messages
- 183
- Reaction score
- 80
Stored procedure to get list of items from character inventory. Like this
In order to get it working you will need this item list table
It should look something like this
STORED PROCEDURE:
In order to get it working you will need this item list table
Code:
USE [Server01]
GO
CREATE TABLE Cabal_ItemList (ID int, Name varchar(100))
It should look something like this
STORED PROCEDURE:
Code:
USE [Server01]
GO
/****** Object: StoredProcedure [dbo].[cabal_sp_Get_CabalItemList] Script Date: 2/25/2017 11:27:19 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[cabal_sp_Get_CabalItemList]
(
[USER=551894]Char[/USER]IDX int
)
AS
BEGIN
/****** Script for SelectTopNRows command from SSMS ******/
DECLARE @InvData varbinary(512), [USER=836714]counter[/USER] int, @ItemData varbinary(18), @ItemID int, @ItemName Varchar(100)
DECLARE [USER=1333447295]Out[/USER]put TABLE (ID INT, Name Varchar(50))
SELECT @InvData = [Data]
FROM [Server01].[dbo].[cabal_Inventory_table] WHERE CharacterIdx = [USER=551894]Char[/USER]IDX
SELECT [USER=836714]counter[/USER] = 1
WHILE [USER=836714]counter[/USER] < LEN(@InvData)
BEGIN
SELECT @ItemData = SUBSTRING(@InvData, [USER=836714]counter[/USER], 18)
SELECT @ItemID = dbo.BinToInt(SUBSTRING(@ItemData, 1, 2)) & 0xFFF
SELECT @ItemName = Name FROM Cabal_ItemList WHERE ID = @ItemID
INSERT INTO [USER=1333447295]Out[/USER]put (Id, Name)
VALUES (@ItemID, @ItemName );
SELECT [USER=836714]counter[/USER] = [USER=836714]counter[/USER] + 18
END
SELECT Id, Name
FROM [USER=1333447295]Out[/USER]put ORDER BY ID ASC;
END
Attachments
You must be registered for see attachments list
Last edited: