You need to go learn your shit and stop begging on elitepvpers. You're asking us to write you some basic SQL queries, and you don't even bother to correct the typo in the thread name.
First, execute these 2:
Code:
USE PS_GameData
GO
CREATE VIEW NewID
AS
SELECT NewID() AS NewID
Code:
USE [PS_GameData]
GO
/****** Object: UserDefinedFunction [dbo].[ItemUID] Script Date: 31.07.2013 00:03:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Euphoria Dev Team
-- =============================================
CREATE FUNCTION [dbo].[ItemUID]
()
RETURNS BIGINT
AS
BEGIN
DECLARE @ItemUID BIGINT
NEWUID:
SET @ItemUID = ABS(CAST(HASHBYTES('SHA1',CAST((SELECT NewID FROM PS_GameData.dbo.NewID) AS NVARCHAR(MAX))) AS BIGINT))
IF EXISTS(SELECT * FROM PS_GameData.dbo.CharItems WHERE ItemUID = @ItemUID) OR
EXISTS(SELECT * FROM PS_GameData.dbo.GuildStoredItems WHERE ItemUID = @ItemUID) OR
EXISTS(SELECT * FROM PS_GameData.dbo.MarketItems WHERE ItemUID = @ItemUID) OR
EXISTS(SELECT * FROM PS_GameData.dbo.UserStoredItems WHERE ItemUID = @ItemUID)
GOTO NEWUID
RETURN @ItemUID
END
GO
And here's the code to insert an item in a character's inventory:
Code:
USE PS_GameData
DECLARE @CharID INT = 1,
@ItemID INT = 1001,
@ItemCount TINYINT = 1,
@MinBag TINYINT = 1,
@MinSlot TINYINT = 0
IF (SELECT COUNT(*) FROM CharItems WHERE CharID = @CharID AND Bag != 0) >= 120
BEGIN
PRINT 'The character''s inventory is full.'
RETURN
END
WHILE @MinBag <= 5
BEGIN
WHILE @MinSlot <= 23
BEGIN
IF NOT EXISTS (SELECT * FROM CharItems WHERE CharID = @CharID AND Bag = @MinBag AND Slot = @MinSlot)
BEGIN
INSERT INTO CharItems (CharID, ItemID, ItemUID, Type, TypeID, Bag, Slot, Quality, Gem1, Gem2, Gem3, Gem4, Gem5, Gem6, Craftname, Count, Maketime, Maketype, Del)
VALUES (@CharID, @ItemID, dbo.ItemUID(), @ItemID / 1000, @ItemID % 1000, @MinBag, @MinSlot, (SELECT Quality FROM PS_GameDefs.dbo.Items WHERE ItemID = @ItemID), 0, 0, 0, 0, 0, 0, '00000000000000000000', @ItemCount, GETDATE(), 'S', 0)
IF @@ERROR = 0 AND @@ROWCOUNT = 1
PRINT 'Item inserted successfully in Bag ' + CAST(@MinBag AS VARCHAR(1)) + ', Slot ' + CAST(@MinSlot AS VARCHAR(2)) + '.'
ELSE PRINT 'An error occured while attempting to insert the item.'
RETURN
END
SET @MinSlot += 1
END
SET @MinSlot = 0
SET @MinBag += 1
END
For the warehouse part, try to figure it out on your own without begging.
USE PS_GameData
DECLARE @ServerID TINYINT = 1,
@UserUID INT = 1,
@ItemID INT = 17215,
@ItemCount TINYINT = 1,
@MinSlot TINYINT = 1
IF (SELECT COUNT(*) FROM UserStoredItems WHERE UserUID = @UserUID AND Slot != 0) >= 239
BEGIN
PRINT 'The character''s warehouse is full.'
RETURN
END
WHILE @MinSlot <= 239
BEGIN
IF NOT EXISTS (SELECT * FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = @MinSlot)
BEGIN
INSERT INTO UserStoredItems (ServerID, UserUID, ItemID, ItemUID, Type, TypeID, Slot, Quality, Gem1, Gem2, Gem3, Gem4, Gem5, Gem6, Craftname, Count, Maketime, Maketype, Del)
VALUES (@ServerID, @UserUID, @ItemID, dbo.ItemUID(), @ItemID / 1000, @ItemID % 1000, @MinSlot, (SELECT Quality FROM PS_GameDefs.dbo.Items WHERE ItemID = @ItemID), 0, 0, 0, 0, 0, 0, '00000000000000000000', @ItemCount, GETDATE(), 'S', 0)
IF @@ERROR = 0 AND @@ROWCOUNT = 1
PRINT 'Item inserted successfully in Slot ' + CAST(@MinSlot AS VARCHAR(3)) + '.'
ELSE PRINT 'An error occured while attempting to insert the item.'
RETURN
END
SET @MinSlot += 1
END
SET @MinSlot = 0
I don't have time to mess with this at the moment, but you should keep trying. Try a basic insert query for the UserStoredItems. Maybe you find where the problem is.
Classic[4267] Warehouse items 04/18/2014 - CO2 Private Server - 21 Replies the Warehouse items is not showing correctly here is the packet structure :-
public class WarehousePacket : TQPacket
{
int offset = 16;
public WarehousePacket(int count)
: base(PacketType.Warehouse, (ushort)(16 + (count * 20)))
{
// WriteByte(9, 10);
WriteUInt32(12, (uint)count);
}
[REQUEST] a hack to get items form guild warehouse 04/04/2013 - Shaiya - 3 Replies I'm asking if anyone have or know how to make a hack or exploit to get items from guild warehouse without beeing a rank 2 if it's possible or if it's already done sorry for opening another topic coz I dident find anything. tnx
What can cause certain players to loose items from warehouse or the ones equipped? 12/10/2012 - CO2 Private Server - 0 Replies As the title says, some players complained that some equipped items or from warehouses are disappearing.I am aware that might be some mysql issue that's why i installed MYSQL Community Server(I have set him on Server not developing machine), most of that cases disappeared but some times players complain that it might still happen.
The problem is isolated, not all players reported it and only after server restart.
Items not stored in the warehouse! Help! 03/03/2012 - Shaiya Private Server - 2 Replies Dear friends, I'm in trouble on my Private Server Ep 4.5, when I put the items in the warehouse and out the game and playing back the items back to my inventory, or if I happen to change cities and log the game when appear to play back in the old location where he had stored the items in the warehouse and the new items in my inventory.
Could anyone help me with this? Thank you in advance for your attention!:(