Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Guides & Releases
You last visited: Today at 15:25

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Euphoria Dev Team Release] Starter Gears

Discussion on [Euphoria Dev Team Release] Starter Gears within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old   #1
 
Philipp_'s Avatar
 
elite*gold: 576
Join Date: Mar 2011
Posts: 348
Received Thanks: 994
[Euphoria Dev Team Release] Starter Gears

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.
Philipp_ is offline  
Thanks
57 Users
Old 07/31/2013, 23:18   #2
 
elite*gold: 0
Join Date: Aug 2012
Posts: 32
Received Thanks: 62
Epic Release!
Gz and *** Bless you too!
adm_anos is offline  
Thanks
6 Users
Old 08/01/2013, 07:01   #3
 
anton1312's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 195
Received Thanks: 343
why you release it? for thanks? lol
Now all servers will have this system and its bad
anton1312 is offline  
Thanks
2 Users
Old 08/01/2013, 08:00   #4
 
Philipp_'s Avatar
 
elite*gold: 576
Join Date: Mar 2011
Posts: 348
Received Thanks: 994
Quote:
Originally Posted by anton1312 View Post
why you release it? for thanks? lol
Now all servers will have this system and its bad
I released it, because of the communitys' interest in it, plus I somehow felt like releasing something.

What do you mean by its bad? Do you mean this system is bad, or that it is bad all servers will have this system now? Both is not bad in my point of view.
Philipp_ is offline  
Thanks
7 Users
Old 08/01/2013, 08:19   #5
 
Shànks♠'s Avatar
 
elite*gold: 0
Join Date: Jan 2012
Posts: 1,777
Received Thanks: 686
Thanks for the release
Shànks♠ is offline  
Old 08/01/2013, 10:26   #6
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
Nice release Philipp, thanks for sharing such a brilliant method.

Just 2 comments regarding the generation of the UID:
- the sha2_256 mechanism is not available in all SQL Server release (not sure if it was introduced in the 2010 or 2012 release), also it seems to be not supported by the Express versions (all releases).
meantime, the function must generate a 64-bits number, so the 'SHA1' mechanism (with a 128 bits output) can be used instead of the 'sha2_256' (which generates a 256-bits digest).

- the NewID view is not mandatory, the intrinsic NewID() function can be used directly

the beginning of the ItemUID function can so - if you experience error with the SHA2 mechanism - be rewritten to:

Code:
DECLARE @ItemUID BIGINT

NEWUID:
SET @ItemUID = ABS(CAST(HASHBYTES('SHA1',CAST(NewID() AS NVARCHAR(MAX))) AS BIGINT))
note that if the 'sha2_256' mechanism is not supported, the hashbytes function will NOT throw an error, il will only returns null.
castor4878 is offline  
Thanks
15 Users
Old 08/01/2013, 12:30   #7
 
Philipp_'s Avatar
 
elite*gold: 576
Join Date: Mar 2011
Posts: 348
Received Thanks: 994
Thank you for the information, castor. I did not know the SHA2 mechanism was introduced lately.

About your second comment, I have to say you are wrong. The view is needed - at least it is a good workaround.
Most nondeterministic functions, those who return different results each time they are called, cannot be used inside user-defined functions.

Cheers
Philipp_ is offline  
Thanks
4 Users
Old 08/01/2013, 12:31   #8
 
anton1312's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 195
Received Thanks: 343
Quote:
Originally Posted by Philipp_ View Post
I released it, because of the communitys' interest in it, plus I somehow felt like releasing something.

What do you mean by its bad? Do you mean this system is bad, or that it is bad all servers will have this system now? Both is not bad in my point of view.
i mean all servers will have this system because all servers will use it

a little earlier, I created my own script starter gear, and i was sad when i saw your release here.
anton1312 is offline  
Old 08/01/2013, 15:31   #9
 
Battle-of-Shaiya's Avatar
 
elite*gold: 260
Join Date: Feb 2011
Posts: 49
Received Thanks: 73
is that all you can say if so say nothing that wil be the best

nice release bro
Battle-of-Shaiya is offline  
Old 08/01/2013, 15:58   #10
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
Quote:
Originally Posted by Philipp_ View Post
I did not know the SHA2 mechanism was introduced lately.
I've just rechecked, it appears that SQL Svr 2008 R2 does not support it but the configs I've tried (a Developer Edition and an Express edition) were both on Win XP (NT 5.1) SP3; I can not exclude that the SQL engine uses some cryptographic of the system, and may be the XP's CSPs are still not aware of SHA2 (and AES, ECC, stuff ...)

Quote:
Originally Posted by Philipp_ View Post
About your second comment, I have to say you are wrong. The view is needed - at least it is a good workaround.
Most nondeterministic functions, those who return different results each time they are called, cannot be used inside user-defined functions.
You are right, the deterministic state of functions is very important in the coding of a stored procedure and your coding is *in all cases* correct; still the intrinsic NewID function is nondeterministic (is defined and known as nondeterministic by the server) ) and I assumed that direct call can be made, but again your code is defensive and valid.

edit 1:
missread your point actually (I read: fct will be use internally of the SP as deterministic and thus always return same value) ... I recheck that point

edit 2:
nice days, I was just double-wrong
due to not-constant result, the NewID function can indeed not be used in a (stored) procedure that manage access to table(s) (the engine can not track what not limited to the SP context is changed), and your coding is a) mandatory b) the cleanest way to do it.

(sorry for not relevant posts)
castor4878 is offline  
Thanks
7 Users
Old 08/01/2013, 21:17   #11
 
elite*gold: 0
Join Date: Jul 2013
Posts: 4
Received Thanks: 0
Hey Castor with SQL Server 2005 Express does not work.

Error:
Fix
[Dev]Optimum is offline  
Old 08/01/2013, 21:38   #12
 
[Dev]Matheus's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 60
Received Thanks: 44
Here when I run these script when creating the character of "name already exists" Help me please.
[Dev]Matheus is offline  
Old 08/01/2013, 21:42   #13
 
elite*gold: 0
Join Date: Jul 2013
Posts: 4
Received Thanks: 0
In the game or when the script run?
[Dev]Optimum is offline  
Old 08/01/2013, 21:52   #14
 
[Dev]Matheus's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 60
Received Thanks: 44
Yes this error happens when I run the script

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
in usp_Create_Char_R.
[Dev]Matheus is offline  
Old 08/01/2013, 22:02   #15
 
Philipp_'s Avatar
 
elite*gold: 576
Join Date: Mar 2011
Posts: 348
Received Thanks: 994
Without providing me error messages or your logs located in PSM_Client/Bin/Logs I will not be able to help you. Be sure you edited the procedure correctly, otherwise an error like the one you get can easily occur.
Philipp_ is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Euphoria Dev Team Release] Perfect Orange Stats Game Service
05/25/2021 - Shaiya PServer Guides & Releases - 119 Replies
Hello elitepvpers, After multiple requests, I decided to release the Perfect Orange Stats Service that we used on Shaiya Euphoria. Before releasing it, we decided to improve it a little bit, to make it even more powerful and flexible. Some of you might prefer the web based recreation service, we chose to create something different, it's purely game based, you don't have to go on any website to do apply Perfect Orange Stats to your items. The former players of Shaiya Euphoria loved it, it is...
5.1 Todesritter auf Starter Edition erstellen / Create Death Knight on Starter Acc's
01/03/2013 - WoW Exploits, Hacks, Tools & Macros - 17 Replies
Sehr geeehrte Damen und Herren. Auf einem Starter Account ist es eigentlich nicht möglich ein Todesritter zu erstellen. Doch mit dem 5.1 Patch ist es durch eine kleine Sicherheitslücke möglich, soviele Todesritter wie möglich zu erstellen. Allerdings bekommt man keine Erfahrung und man bleibt auf lvl55. Ihr könnt auf jedem beliebigen Realm ein Todesritter erstellen doch davor müsst ihr ein Todesritter auf dem Italienischen Realm: "Nemesis" erstellen, erst dann ist es auf jedem Realm...
[Release] PacketLogger Starter
08/10/2012 - Nostale Hacks, Bots, Cheats & Exploits - 41 Replies
Hier mein erster Release :) Es ist zwar nur ein kleines tool, wird jedoch vielen helfen denke ich :) Infos Es startet den Multiclient und ändert anschließend die VersionsNr. Zudem Injizieret er die dll automatisch. Somit muss man dies nicht mehr mit CE machen. http://www.abload.de/img/unbenanntogxfy.png
[Release] 190 gears
03/09/2011 - Zero - 12 Replies
190 gears + weps have fun:D /awarditem 90100209 Engine /awarditem 600269 armor /awarditem 700209 booster /awarditem 100259 thrusters /awarditem 90800209 hp mod /awarditem 90300199 cabin /awarditem 90600259 df mod
Selling Account + Gears + Gears & More Gears @ Snowwhite!
06/29/2010 - Conquer Online 2 Trading - 1 Replies
Server: Cinderella/Snowwhite (Tro) Gears: Sup +6 SDG/SDG -5 Ears lvl 112 (102HP) Sup +6 SDG -5 130 Necky lvl 130 (130HP) Sup +6 SDG/SDG Blade lvl 130 (142HP) Sup +6 SDG/SDG -3 Trojan Armor lvl 120 (130HP) GoodLuck -1 Sup +6 SDG/SDG -5 Sword lvl 130 (225HP) Sup +6 SGG/SGG -1 Fan



All times are GMT +1. The time now is 15:25.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.