Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Private Server > SRO PServer Guides & Releases
You last visited: Today at 01:32

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

Advertisement



[SQL, PERFORMANCE, Proc]_Roya_AddItems_Fast

Discussion on [SQL, PERFORMANCE, Proc]_Roya_AddItems_Fast within the SRO PServer Guides & Releases forum part of the SRO Private Server category.

Reply
 
Old   #1
 
Royalblade*'s Avatar
 
elite*gold: 85
Join Date: Feb 2014
Posts: 1,055
Received Thanks: 1,643
[SQL, PERFORMANCE, Proc]_Roya_AddItems_Fast

huhuz, I feel like releasing smtn again and since simulation asked me to be nicer i won't write all the crap i usually write.

What is this?

It's a re-write of the procedure _ADD_ITEM_EXTERN.

Why is this better?
Because it's 80x+ faster than the original one.

So why would i use this? I barely ever add items!
Then don't use it. It's meant for people who have custom features that'd like to add items to characters without losing precious cpu time.

How to use it?
EXEC _ProcNameHere CharID*Here, _RefObjCommon.ID*Here, Amount*Here, Plus*here

No work menz?!?
Suicide is an option.


Procedure:
Code:

CREATE PROCEDURE [dbo].[_RoyalAddItems]
@CharID INT,
@ItemID INT,
@Amount INT,
@OptLvl INT
AS
SET XACT_ABORT ON
DECLARE	@FreeSlot TINYINT,
		@Link INT,
		@LatestItemSN BIGINT,
		@NewItemID BIGINT = 0;
 
SELECT	@Link = R.Link,
		@Amount =	CASE	
						WHEN TypeID1 = 3 AND TypeID2 = 1
							THEN Dur_L
						WHEN TypeID1 = 3 AND TypeID2 = 2 AND TypeID3 = 1 AND TypeID4 IN(1,2)
							THEN 0
						WHEN @Amount > RI.MaxStack OR @Amount < 0
							THEN MaxStack
						ELSE @Amount
					END
FROM	_RefObjCommon R
JOIN	_RefObjItem RI	ON R.Link = RI.ID
WHERE	R.ID = @ItemID

IF @Link IS NULL OR @Amount IS NULL
		RETURN -4 -- Self-explanatory

	
IF NOT EXISTS(SELECT * FROM _Char WITH (NOLOCK) WHERE CharID = @CharID)
		RETURN -3 -- Character doesnt exist.

SELECT TOP 1 @FreeSlot = Slot
FROM	_Inventory
WHERE	CharID = @CharID
AND		Slot > 12
AND		ItemID = 0

IF	@FreeSlot IS NULL
		RETURN -2 -- Inventory is full.


BEGIN TRAN
BEGIN TRY

UPDATE _LatestItemSerial SET LatestItemSerial += 1;

SELECT @LatestItemSN = LatestItemSerial 
FROM _LatestItemSerial 
WITH (UPDLOCK)

INSERT INTO _Items (RefItemID, OptLevel, Data, MagParamNum, Serial64) 
VALUES (@ItemID, @OptLvl, @Amount, 0, @LatestItemSN)
SELECT	@NewItemID = @@IDENTITY

UPDATE _Inventory SET ItemID = @NewItemID WHERE CharID = @CharID AND Slot = @FreeSlot

INSERT INTO _ItemPool (InUse, ItemID)
VALUES		(1,@NewItemID)
		
IF	@NewItemID = 0
	BEGIN
		ROLLBACK TRAN
		RETURN
	END
END TRY
BEGIN CATCH -- You can remove the try n catch block. This should always work.. I just wanted to be sure.
	ROLLBACK TRAN
	RETURN 
END CATCH
	
COMMIT TRAN
Royalblade* is offline  
Thanks
8 Users
Old 06/05/2014, 16:15   #2

 
Callum's Avatar
 
elite*gold: 5
Join Date: Mar 2008
Posts: 6,297
Received Thanks: 3,819
#approved
Callum is offline  
Old 06/05/2014, 17:51   #3
 
Lisias's Avatar
 
elite*gold: 20
Join Date: Mar 2014
Posts: 68
Received Thanks: 14
Thanks

wieder mal alles rasiert hahaha
Lisias is offline  
Old 06/06/2014, 00:01   #4
 
bares1993's Avatar
 
elite*gold: 0
Join Date: Feb 2013
Posts: 170
Received Thanks: 253
Akasch wieder mal am rasieren
bares1993 is offline  
Old 06/12/2014, 07:02   #5
 
elite*gold: 0
Join Date: Mar 2014
Posts: 362
Received Thanks: 192
THANKS
CallM3B1tch is offline  
Reply


Similar Threads Similar Threads
about [STORED PROC]
05/11/2014 - SRO Private Server - 0 Replies
hello epvp i want to know what is the STORED PROC and what his job need some tips
Trinket Proc
12/05/2013 - WoW Private Server - 2 Replies
Hallo, ich habe das Problem, dass auf der 4.0.6er ArkCore sämtliche Trinkets ab dem Cata Bereich einfach nur dauerhaft proccen.. In der DB sollte an sich eigentlich von den Cooldowns her alles richtig sein. Wäre nett, wenn mir jemand weiterhelfen könnte...so kann ich den Server nicht Public stellen ^^ Skype: ortnaa
Arena Little Proc bug
02/18/2011 - WoW Exploits, Hacks, Tools & Macros - 8 Replies
Hi. Ein kleiner bug den ich mit meinem Magier getestet habe. getestet am 15.2.2011 1. Ihr seit mit eurem Arena team in Grp 2. Geht zur Hero puppe in Og (od wo immer ihr wollt) 3. Meldet für arena an! 4. Schießt solange auf die Puppe bis ihr den Procc Hirnfrost und Eisige Fingern habt und versucht sie solange aufrecht zu halten bis die Arena Aufgeht! 5. Joint Arena....
[Performance-Camtasia Studio]Wie verbessere ich die Performance?
11/13/2009 - Video Art - 4 Replies
Hallo liebe Community und Mitglieder. Wenn ich mit dem Aufnahmeprogramm „Camtasia Studio" ein Fenster aufnehme, z.B. das Client Fenster von Metin2, verschlechtert sich die Performance beim späteren angucken des Resultates. D.h. es bleibt bei mehreren Hängern und es ist kein flüssiger Film. Was habe ich versucht? #Die Frames pro Sekunde zu erhöhen(bis 200 Frames pro Sekunde, aber dann gibt es auch schon bei der Aufnahme Hänger, bzw. beim produzieren) #Das Video in der Bearbeitung zu...
Weapon Proc
12/08/2007 - WoW Exploits, Hacks, Tools & Macros - 11 Replies
Ok heres how to do it. Use chance on hit procced weapons Add 2 weapons ... get them to proc.. Take them off. Add 2 more get them to proc Take them off Repeat about 4 times



All times are GMT +1. The time now is 01:33.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.