[Euphoria Dev Team Release] Starter Gears

03/08/2015 21:03 [DEV]Warlock#31
Quote:
Originally Posted by SnickQ View Post
I guess your problem must be in that part:
Hello Thank you SnickQ i think i make it right way i copied and paste it to before END i dont know where is the wrong but i keep trying atm also i use SQL 2005 server but i will upgrade it to SQL 2008 R2 today maybe it can work
03/19/2015 19:51 h3adsh00ter#32
Craftname? Weapon 20 ? Equipment 70 right ?
03/22/2015 18:38 h3adsh00ter#33
Does anyone know what to enter exactly? neither 20 nor 70 functioning
03/22/2015 18:51 Cansas59#34
teste es doch einfach aus^^
03/22/2015 19:26 h3adsh00ter#35
I have tried both things but neither [20] <- weapon yet [70] <- functioning of the armor are normally the default values
04/14/2015 10:43 kalib.32#36
Nice release!
02/23/2017 18:43 jumentodoido#37
Quote:
Originally Posted by Philipp_ View Post
Hello community,

I recently saw users asking for a way to let their characters start equipped, since this is not possible by using the existing BaseItemsDefs table. Today I am releasing a way of doing it, which can also replace the BaseItemsDefs table but having more possibilities to realize your ideas.
If you are interested in this you might thought about a way of doing this before. The only problem I can imagine you could have had is the ItemUID. Since we want to insert one, or even multiple rows into the CharItems table we need to insert a new ItemUID as well, but there is no function to get an ItemUID. So how do we get a new ItemUID? There are several ways to get an uniqueidentifier, you will see my way few lines below. Since there is no function to call I decided to create my own, it surely is the most efficient way. Just execute the following querys to create my function and you can easily get a new UID whenever you want.
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
Secondly, I created a table to store all the data in. You can specify the item, its links, craftname and even more. I named it BaseGearsDefs, because of the reason mentioned at the beginning. In fact, you can do even more with it than it was meant to do (Starting with equipped gears). The query can be found below.
Code:
USE [PS_GameDefs]
GO

/****** Object:  Table [dbo].[BaseGearsDefs]    Script Date: 31.07.2013 22:00:04 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[BaseGearsDefs](
	[Family] [tinyint] NOT NULL,
	[Job] [tinyint] NOT NULL,
	[Level] [int] NOT NULL,
	[Bag] [smallint] NOT NULL,
	[Slot] [smallint] NOT NULL,
	[ItemID] [int] NOT NULL,
	[Type] [tinyint] NOT NULL,
	[TypeID] [tinyint] NOT NULL,
	[Gem1] [tinyint] NOT NULL,
	[Gem2] [tinyint] NOT NULL,
	[Gem3] [tinyint] NOT NULL,
	[Gem4] [tinyint] NOT NULL,
	[Gem5] [tinyint] NOT NULL,
	[Gem6] [tinyint] NOT NULL,
	[Craftname] [varchar](20) NULL,
	[Quality] [int] NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO
If you want to add a new row to it you have to fill in content in each column except the craftname one, if you do not want to add rerolls or let your players start with enchanted items leave this clear. The Level column should be interesting for servers with an instant leveling system only - If you enter 60 in the column for example, only characters whose starter level is 60 will have it equipped or in their inventory, depending on your setup. For those without instant leveling, logically write a 1 in it. About preparations, we are done now. Next we will take use of this and implement it in our usp_Create_Char_R procedure (located in PS_GameData).
Code:
INSERT INTO CharItems
SELECT @CharID AS CharID,ItemID,dbo.ItemUID() AS ItemUID,Type,TypeID,Bag,Slot,Quality,Gem1,Gem2,Gem3,Gem4,Gem5,Gem6,Craftname,1 AS COUNT,GETDATE() AS Maketime,'S' AS Maketype,0 AS Del
FROM PS_GameDefs.dbo.BaseGearsDefs WHERE Family = @Family AND Job = @Job AND Level = @Level
Paste the upper code right after the following line at the nearly end of your proc:
Code:
SET @CharID = IDENT_CURRENT('Chars')
Best regards,
Philipp.



Well excuse my English bad but I could not use the system that you develop I execute the escript I put all sucks but the perssonages are not born equipped what should I do?
12/10/2017 16:19 Sнσт#38
I ran all the scripts successively, and still name already exist.
Using SQL Server 2012 Express.

Edit: The problem is solved.
02/02/2023 02:08 Glory777#39
Quote:
Originally Posted by Philipp_ View Post
Hello community,

I recently saw users asking for a way to let their characters start equipped, since this is not possible by using the existing BaseItemsDefs table. Today I am releasing a way of doing it, which can also replace the BaseItemsDefs table but having more possibilities to realize your ideas.
If you are interested in this you might thought about a way of doing this before. The only problem I can imagine you could have had is the ItemUID. Since we want to insert one, or even multiple rows into the CharItems table we need to insert a new ItemUID as well, but there is no function to get an ItemUID. So how do we get a new ItemUID? There are several ways to get an uniqueidentifier, you will see my way few lines below. Since there is no function to call I decided to create my own, it surely is the most efficient way. Just execute the following querys to create my function and you can easily get a new UID whenever you want.
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
Secondly, I created a table to store all the data in. You can specify the item, its links, craftname and even more. I named it BaseGearsDefs, because of the reason mentioned at the beginning. In fact, you can do even more with it than it was meant to do (Starting with equipped gears). The query can be found below.
Code:
USE [PS_GameDefs]
GO

/****** Object:  Table [dbo].[BaseGearsDefs]    Script Date: 31.07.2013 22:00:04 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[BaseGearsDefs](
	[Family] [tinyint] NOT NULL,
	[Job] [tinyint] NOT NULL,
	[Level] [int] NOT NULL,
	[Bag] [smallint] NOT NULL,
	[Slot] [smallint] NOT NULL,
	[ItemID] [int] NOT NULL,
	[Type] [tinyint] NOT NULL,
	[TypeID] [tinyint] NOT NULL,
	[Gem1] [tinyint] NOT NULL,
	[Gem2] [tinyint] NOT NULL,
	[Gem3] [tinyint] NOT NULL,
	[Gem4] [tinyint] NOT NULL,
	[Gem5] [tinyint] NOT NULL,
	[Gem6] [tinyint] NOT NULL,
	[Craftname] [varchar](20) NULL,
	[Quality] [int] NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO
If you want to add a new row to it you have to fill in content in each column except the craftname one, if you do not want to add rerolls or let your players start with enchanted items leave this clear. The Level column should be interesting for servers with an instant leveling system only - If you enter 60 in the column for example, only characters whose starter level is 60 will have it equipped or in their inventory, depending on your setup. For those without instant leveling, logically write a 1 in it. About preparations, we are done now. Next we will take use of this and implement it in our usp_Create_Char_R procedure (located in PS_GameData).
Code:
INSERT INTO CharItems
SELECT @CharID AS CharID,ItemID,dbo.ItemUID() AS ItemUID,Type,TypeID,Bag,Slot,Quality,Gem1,Gem2,Gem3,Gem4,Gem5,Gem6,Craftname,1 AS COUNT,GETDATE() AS Maketime,'S' AS Maketype,0 AS Del
FROM PS_GameDefs.dbo.BaseGearsDefs WHERE Family = @Family AND Job = @Job AND Level = @Level
Paste the upper code right after the following line at the nearly end of your proc:
Code:
SET @CharID = IDENT_CURRENT('Chars')
Best regards,
Philipp.


Hello sir Philipp, I'm just nub..can you put an example like I want basileus as starter gear.. because I cannot figure it out where to put in column..
Please make an example..please