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:21

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

 

[RELEASE] Safe Toon Resurrection (SQL)

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 84
Received Thanks: 59
[RELEASE] Safe Toon Resurrection (SQL)

Following in Prof recent footsteps of releasing useful scripts, here is one for safely resurrecting a single toon to a location in which a second death wont occur upon logging the toon.

Code:
USE [PS_GameData]
DECLARE
@User varchar(12),
@Char varchar(30),
@Slot tinyint,
@Country tinyint,
@Family tinyint,
@Del tinyint

SET @Char = 'Char Name Here'

SELECT @User=um.UserID, @Country=umg.Country, @Family=c.family, @Del=c.del
FROM PS_UserData.dbo.Users_Master AS um
INNER JOIN PS_GameData.dbo.UserMaxGrow AS umg ON umg.UserUID = um.UserUID
INNER JOIN PS_GameData.dbo.Chars AS c ON c.UserUID = um.UserUID
WHERE c.CharName = @Char

IF(@@ROWCOUNT = 0)
BEGIN
	PRINT 'Character "' [email protected]+ '" does not exist, or does not have a related account.'
	RETURN
END
ELSE IF(@@ROWCOUNT > 1)
BEGIN
	PRINT 'There are multiple characters named "' [email protected]+ '".'
	RETURN
END
ELSE IF(@Del != 1)
BEGIN
	PRINT 'Character "' [email protected]+ '" is not dead.'
	RETURN
END

-- Slot Selection
SELECT @Slot=ISNULL(MIN(Slots.Slot),-1) FROM
	(SELECT 0 AS Slot UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4) AS Slots
LEFT JOIN
	(SELECT c.Slot
	FROM PS_UserData.dbo.Users_Master AS um
	INNER JOIN PS_GameData.dbo.Chars AS c ON c.UserUID = um.UserUID
	WHERE um.UserID = @User
	AND c.Del = 0) AS Chars ON Chars.Slot = Slots.Slot
WHERE Chars.Slot IS NULL

IF(@Slot = -1)
BEGIN
	PRINT 'Account "' + @User + '" does not have any open slots.'
	RETURN
END

IF(@Slot IN(0,1,2,3,4))
BEGIN
	IF(@Country=0 AND @Family IN (0,1))
	BEGIN
		IF(@Family IN (0,1))
		BEGIN
			UPDATE PS_GameData.dbo.Chars
			SET DEL = 0
				,Map = 42
				,PosX = 47
				,PosY = 2
				,PosZ = 52
				,RemainTime = 0
				,Slot = @Slot
			WHERE UserID = @User
			AND CharName = @Char
			AND Del = 1
			IF(@@ROWCOUNT = 1)
			BEGIN
				PRINT 'Character "' [email protected]+ '" resurrected!'
				RETURN
			END
		END
	END
	ELSE IF(@Country=1)
	BEGIN
		IF(@Family IN (2,3))
		BEGIN
			UPDATE PS_GameData.dbo.Chars
			SET DEL = 0
				,Map = 42
				,PosX = 47
				,PosY = 2
				,PosZ = 52
				,RemainTime = 0
				,Slot = @Slot
			WHERE UserID = @User
			AND CharName = @Char
			AND Del = 1
			IF(@@ROWCOUNT = 1)
			BEGIN
				PRINT 'Character "' [email protected]+ '" resurrected!'
				RETURN
			END
		END
	END
	ELSE
	BEGIN
		PRINT 'Invalid country.'
	END
END
Basically what we have is a script to resurrect a toon, by name, in the Auction Hall. Thus avoiding a toon being resurrected in a dangerous location. The script will auto-check for open slots, and resurrect the named toon in the first slot available.

Simply edit 'Char Name Here' with the exact name of the toon to be resurrected. Execute. Done.

The original had but one flaw, when toons were res'd it would place the within or outside of the walls of the Auction Hall. I have changed the coordinates, so now toons are resurrected in the center of the room.

I have also included an attachment for downloading of a .SQL, rather than copy and paste if you prefer.

-Syn

CREDIT: Lilpro, Danco, Prof, Zargon, and Abrasive
Attached Files
File Type: rar CharRes.rar (750 Bytes, 230 views)



taurian83 is offline  
Thanks
11 Users
Old   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 770
This was a group effort on the dev forums. I think credit goes to Lilpro, Danco, Prof, Zargon, and myself.


abrasive is offline  
Thanks
3 Users
Old   #3
 
elite*gold: 0
Join Date: Mar 2010
Posts: 2,334
Received Thanks: 1,745
dunno who the credit goes too...but added to my guide
Bаne is offline  
Old   #4
 
elite*gold: 0
Join Date: Oct 2009
Posts: 445
Received Thanks: 579
You can skip the check for @Del!=0. Instead, you can check whether the character is dead or whether it was user who requested it to be deleted in SELECT statement.

Code:
SELECT @User = UM.UserID, @Country = UMG.Country, @Family = C.family, @Del = C.del
FROM PS_UserData.dbo.Users_Master AS UM INNER JOIN PS_GameData.dbo.UserMaxGrow AS UMG 
ON UMG.UserUID = UM.UserUID INNER JOIN PS_GameData.dbo.Chars AS C 
ON C.UserUID = UM.UserUID
WHERE C.CharName = @Char AND C.Del=1 AND C.RemainTime=0;
If it doesn't return any rows you know it's either not dead or the CharName is invalid or it doesn't exist.

I'm also not sure why you added ISNULL check in free Slot searching statement. You won't get any results if there is no free slots so @Slot = NULL.

I'd give you more hints, but it's late. I'll check tomorrow or wait for others


@ Abrasive
I remember something about such script, but I honestly can't recall who and where. I believe LilPro started it ... I guess.


ProfNerwosol is offline  
Thanks
2 Users
Old   #5
 
elite*gold: 0
Join Date: Jun 2010
Posts: 84
Received Thanks: 59
Quote:
Originally Posted by abrasive View Post
This was a group effort on the dev forums. I think credit goes to Lilpro, Danco, Prof, Zargon, and myself.
Credit added. Thank you for the names.
taurian83 is offline  
Thanks
1 User
Old   #6
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 770
Quote:
Originally Posted by ProfNerwosol View Post
You can skip the check for @Del!=0. Instead, you can check whether the character is dead or whether it was user who requested it to be deleted in SELECT statement.

Code:
SELECT @User = UM.UserID, @Country = UMG.Country, @Family = C.family, @Del = C.del
FROM PS_UserData.dbo.Users_Master AS UM INNER JOIN PS_GameData.dbo.UserMaxGrow AS UMG 
ON UMG.UserUID = UM.UserUID INNER JOIN PS_GameData.dbo.Chars AS C 
ON C.UserUID = UM.UserUID
WHERE C.CharName = @Char AND C.Del=1 AND C.RemainTime=0;
If it doesn't return any rows you know it's either not dead or the CharName is invalid or it doesn't exist.

I'm also not sure why you added ISNULL check in free Slot searching statement. You won't get any results if there is no free slots so @Slot = NULL.

I'd give you more hints, but it's late. I'll check tomorrow or wait for others


@ Abrasive
I remember something about such script, but I honestly can't recall who and where. I believe LilPro started it ... I guess.
I didn't check if the character was dead in the initial query so that it could later return the error message that the character is not dead. When I wrote that part I was trying to make it display very specific error messages in case the user running this script didn't understand SQL.

I remember I added the ISNULL check in free Slot searching statement because I found a bug in the old query I posted. I don't recall what that bug was, but there was a case where you could get an ambiguous return I believe.
abrasive is offline  
Old   #7
 
elite*gold: 0
Join Date: Oct 2017
Posts: 4
Received Thanks: 1
thank you sooo much turlan
Lns101 is offline  
Old   #8
 
elite*gold: 0
Join Date: Jul 2016
Posts: 105
Received Thanks: 32
Quote:
Originally Posted by Lns101 View Post
thank you sooo much turlan

dude, stop bumping old threads.
you want to thank him? use the thanks button.
Velocity. is offline  
Thanks
2 Users
Old   #9
 
elite*gold: 0
Join Date: Jun 2010
Posts: 339
Received Thanks: 139
Forum rules
Quote:
5. Minor Violations
Making up your own rank icons and using them as your avatar is forbidden.

Making posts that are unnecessary or meaningless one-word posts like "#reported" or "#closerequest" is forbidden.

Posting twice in a row is to be avoided. Exceptions due to compelling reasons should be discussed with a moderator first.

Pushing/bumping outdated threads is only allowed if there is a good reason, e.g. if you have the same the question, but so far no satisfying answer has been given in the thread. If in doubt, ask a moderator whether you should pick up the old thread or rather create a new one instead.

We do not take kindly of unfriendly or provocative behavior towards other members; the same goes for excessive trolling.

Usernames which partially or fully contain an URL are forbidden
killer2p is offline  
Thanks
2 Users
Old   #10
 
elite*gold: 0
Join Date: Jul 2016
Posts: 105
Received Thanks: 32
Quote:
Originally Posted by Lns101 View Post
?? how about you **** off ? and stop trying to internet bully on the sly who cares if its old who notify you? i was giving thank to the creator so mind you own Business
no need to flame, i was just letting you know the rules. who cares? Everyone. you're bumping old threads without reason, and as i said if you would like to thank him then use the thanks button as it is there for a reason, and this is my business. read the forum rules next time.
oh yeah im totally bullying you lmao grow up.


Velocity. is offline  
Thanks
2 Users
Reply



« Previous Thread | Next Thread »

Similar Threads
Tantra ResurrecTioN On
Rates : ResuExp : 300x ResuGold : 40x ResuPoints : 30x Pag Y Reg : tresu.sytes.net tresu.sytes.net/sec/registro
0 Replies - Foreign Games
*- Safe Trading , Safe Gaming -*- Warrock Spieler Suchfunktion ! -*
So ... ich habe heute ein wenig im Blackmarket , und hier rumgeschaut ... und musste feststellen dass es sehr viel Scammer & Betrüger gibt ... ...
11 Replies - WarRock
Scroll of Resurrection
Suche jemanden fuer Scroll of Resurrection. PM me Looking for someone for Scroll of Resurrection. PM me
8 Replies - WoW Main - Discussions / Questions
(REDISTRIBUTE)SELF RESURRECTION
FIRST POSTED ON DEATHSOFT BY elcius Just use WPE to replace Stuck(BB 1C) with one of the following spells.. Resurrection(Rank 6) - 5B 63...
2 Replies - WoW PServer Exploits, Hacks & Tools



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


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.