|
You last visited: Today at 00:13
Advertisement
[Guide] Simple SQL query to check Max Plus of items during login/logout session
Discussion on [Guide] Simple SQL query to check Max Plus of items during login/logout session within the SRO PServer Guides & Releases forum part of the SRO Private Server category.
08/03/2015, 12:45
|
#1
|
elite*gold: 40
Join Date: Jul 2013
Posts: 167
Received Thanks: 201
|
[Guide] Simple SQL query to check Max Plus of items (Real time or login/logout)
Hello,
Here I'll share simple SQL query to check and update "Max Plus" (with and without Adv. Elixir) of items in 2 different methods: (doesn't matter which, both has same effect)
Method 1: Real time after fusing
Method 2: On login/logout session
Why login/logout session? well as far as I tried, changing item plus from database trigger or [_AddLogItem] query without refreshing the client will cause misinformation between client and server. And might cause the client dc or crash (no idea which), because of wrong information send to/received from the server. (CMIIW)
For example, someone did +13 and you force real time query back to +12. The database already have "+12", but the client still reads "+13"... then the player fused again and succeeded the 2nd time (this time client reads +14 while server reads +12), and they start hunting/hitting/killing whatever without teleporting... not sure what will happen :P
(Update: as its.soul confirmed, nothing will happen, so I added a "real time" max plus check during equipment fusing, even though the client has to teleport to refresh the visual side)
Update notes: - This will work and might be useful if you run your server without additional 3rd party filter. But you won't need this if using filter such as K-Guard, SUPERMAN, Galullians or others, since those already have a feature for plus limit.

- If you use Method 1, you won't need to use Method 2 because Method 1 already update the "ItemID" itself. So it won't matter where the player put the item after fusing

Now the boring part: (Feel free to develop the query as you see fit)
Method 1. " Real time" check and update right after fusing. (Client needs to teleport to refresh visual side)
Procedure: [SRO_VT_LOG].[dbo].[_AddLogItem]
Code:
/* Item upgrading */
IF (@Operation = 90 OR @Operation = 160)
BEGIN
/* Start: Max Plus */
DECLARE @strDescStrip VARCHAR(128)
DECLARE @ItemID INT
DECLARE @MaxOptLevel TINYINT
SET @MaxOptLevel = 12
/* Get current fused plus */
SET @len_desc1 = CHARINDEX (']', @strDesc)
IF (@len_desc1 = 9)
BEGIN
SET @strDesc = SUBSTRING(@strDesc, 0, 9)
SET @strDescStrip = SUBSTRING(@strDesc, 8, 1)
END
ELSE IF (@len_desc1 = 10)
BEGIN
SET @strDesc = SUBSTRING(@strDesc, 0, 10)
SET @strDescStrip = SUBSTRING(@strDesc, 8, 2)
END
/* Check if OptLevel above @MaxOptLevel */
IF (@strDescStrip >= @MaxOptLevel)
BEGIN
/* Get ItemID */
SELECT @ItemID = ID64 from [SRO_VT_SHARD].[dbo].[_Items] WHERE Serial64 = @ItemSerial
/* Update items if has more than @MaxOptLevel without Adv elixir*/
UPDATE [SRO_VT_SHARD].[dbo].[_Items] SET OptLevel = @MaxOptLevel WHERE OptLevel > @MaxOptLevel AND Serial64 = @ItemSerial
/* Delete Adv elixir effect for item if has more than @MaxOptLevel with Adv elixir */
DELETE FROM [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] WHERE nItemDBID IN (
SELECT a.ID64 FROM [SRO_VT_SHARD].[dbo].[_Items] a WITH (NOLOCK)
INNER JOIN [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] b ON a.ID64 = b.nItemDBID
WHERE a.ID64 = @ItemID AND (a.OptLevel + b.nOptValue) > @MaxOptLevel
AND b.bOptType = 2
)
END
RETURN -1
/* End: Max Plus */
END
Method 2. Check and update during login/logout session for Inventory, Storage, and Guild Storage
Procedure: [SRO_VT_LOG].[dbo].[_AddLogChar]
Code:
/* Login/Logout sequence (4 = Login, 6 = Logout) */
IF (@EventID = 4 OR @EventID = 6)
BEGIN
/*
* Begin: Item Plus check
*/
DECLARE @UserJID INT, @GuildID INT, @MaxOptLevel TINYINT
SET @MaxOptLevel = 12 -- Set Max Plus value (change this)
/*
* Get JID and GuildID info
*/
SELECT @UserJID = a.UserJID, @GuildID = b.GuildID FROM [SRO_VT_SHARD].[dbo].[_User] a WITH (NOLOCK)
INNER JOIN [SRO_VT_SHARD].[dbo].[_Char] b ON a.CharID = b.CharID WHERE a.CharID = @CharID
/*
* 1. INVENTORY: Update items in inventory if has more than +12 without Adv elixir
*/
UPDATE [SRO_VT_SHARD].[dbo].[_Items] SET OptLevel = @MaxOptLevel WHERE OptLevel > @MaxOptLevel AND ID64 IN (
SELECT ItemID FROM [SRO_VT_SHARD].[dbo].[_Inventory] WITH (NOLOCK)
WHERE CharID = @CharID AND ItemID > 0
)
/*
* 2. INVENTORY: Remove Adv elixir effect for items in inventory if has more than +12 with Adv elixir
*/
DELETE FROM [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] WHERE nItemDBID IN (
SELECT a.ItemID FROM [SRO_VT_SHARD].[dbo].[_Inventory] a WITH (NOLOCK)
INNER JOIN [SRO_VT_SHARD].[dbo].[_Items] b ON a.ItemID = b.ID64
INNER JOIN [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] c ON a.ItemID = c.nItemDBID
WHERE a.CharID = @CharID AND a.ItemID > 0 AND (b.OptLevel + c.nOptValue) > @MaxOptLevel
AND c.bOptType = 2
)
/*
* 3. PERSONAL STORAGE: Update items in personal storage if has more than +12 without Adv elixir
*/
UPDATE [SRO_VT_SHARD].[dbo].[_Items] SET OptLevel = @MaxOptLevel WHERE OptLevel > @MaxOptLevel AND ID64 IN (
SELECT ItemID FROM [SRO_VT_SHARD].[dbo].[_Chest] WITH (NOLOCK)
WHERE UserJID = @UserJID AND ItemID > 0
)
/*
* 4. PERSONAL STORAGE: Remove Adv elixir effect for items in personal storage if has more than +12 with Adv elixir
*/
DELETE FROM [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] WHERE nItemDBID IN (
SELECT a.ItemID FROM [SRO_VT_SHARD].[dbo].[_Chest] a WITH (NOLOCK)
INNER JOIN [SRO_VT_SHARD].[dbo].[_Items] b ON a.ItemID = b.ID64
INNER JOIN [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] c ON a.ItemID = c.nItemDBID
WHERE a.UserJID = @UserJID AND a.ItemID > 0 AND (b.OptLevel + c.nOptValue) > @MaxOptLevel
AND c.bOptType = 2
)
/*
* 5. GUILD: If character is guild member, check Item Plus in Guild Inventory
*/
IF (@GuildID <> 0)
BEGIN
/*
* 5.1. Update items in guild storage if has more than +12 without Adv elixir
*/
UPDATE [SRO_VT_SHARD].[dbo].[_Items] SET OptLevel = @MaxOptLevel WHERE OptLevel > @MaxOptLevel AND ID64 IN (
SELECT ItemID FROM [SRO_VT_SHARD].[dbo].[_GuildChest] WITH (NOLOCK)
WHERE GuildID = @GuildID AND ItemID > 0
)
/*
* 5.2. Remove Adv elixir effect for items in guild storage if has more than +12 with Adv elixir
*/
DELETE FROM [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] WHERE nItemDBID IN (
SELECT a.ItemID FROM [SRO_VT_SHARD].[dbo].[_GuildChest] a WITH (NOLOCK)
INNER JOIN [SRO_VT_SHARD].[dbo].[_Items] b ON a.ItemID = b.ID64
INNER JOIN [SRO_VT_SHARD].[dbo].[_BindingOptionWithItem] c ON a.ItemID = c.nItemDBID
WHERE a.GuildID = @GuildID AND a.ItemID > 0 AND (b.OptLevel + c.nOptValue) > @MaxOptLevel
AND c.bOptType = 2
)
END
/*
* END: Item Plus check
*/
END
To test, fuse some items with or without Adv Elixir to more than your Max Plus value, then teleport (to test method 1), or put those items in Inventory, Storage, and Guild Storage, then logout/login again (to test method 2). see if it works.
good luck and have fun
|
|
|
08/03/2015, 13:52
|
#2
|
elite*gold: 85
Join Date: Aug 2010
Posts: 1,278
Received Thanks: 522
|
good release
about :
Quote:
then the player fused again and succeeded the 2nd time (this time client reads +14 while server reads +12), and they start hunting/hitting/killing whatever without teleporting... not sure what will happen :P
|
nothing will happen cuz clinet side is just a visual side..
|
|
|
08/03/2015, 16:46
|
#3
|
elite*gold: 87
Join Date: Apr 2015
Posts: 318
Received Thanks: 535
|
there is a much better way,
you could simply filter it, so when you are trying to pass the limit, nothing will happen and you will get a notice informing you that you can't fuse this item anymore.
|
|
|
08/03/2015, 17:16
|
#4
|
elite*gold: 40
Join Date: Jul 2013
Posts: 167
Received Thanks: 201
|
like reverting back to max plus when fusing?... if no problem with the client, then it'll do, coz i have no idea how to limit it on client side, so whenever succeeded the client will still show the latest value right?
|
|
|
08/03/2015, 17:58
|
#5
|
elite*gold: 87
Join Date: Apr 2015
Posts: 318
Received Thanks: 535
|
Quote:
Originally Posted by witchymoo
like reverting back to max plus when fusing?... if no problem with the client, then it'll do, coz i have no idea how to limit it on client side, so whenever succeeded the client will still show the latest value right?
|
It will not fail or success, plus will not be changed in both sides db and client.
|
|
|
08/03/2015, 18:01
|
#6
|
elite*gold: 40
Join Date: Jul 2013
Posts: 167
Received Thanks: 201
|
Post updated, added another method to check and update real time on database side after fusing.
Quote:
Originally Posted by Xutan*
It will not fail or success, plus will not be changed in both sides db and client.
|
About this, How do I filter it to follow your explanation?
thank you
|
|
|
08/03/2015, 18:06
|
#7
|
elite*gold: 87
Join Date: Apr 2015
Posts: 318
Received Thanks: 535
|
Quote:
Originally Posted by witchymoo
Post updated, added another method to check and update real time on database side after fusing.
About this, How do I filter it to follow your explanation?
thank you
|
using a packet filter.
P.S. : that kguard which was released includes this feature. you can check the source and learn how to do it.
|
|
|
08/03/2015, 18:12
|
#8
|
elite*gold: 40
Join Date: Jul 2013
Posts: 167
Received Thanks: 201
|
Quote:
Originally Posted by Xutan*
using a packet filter.
P.S. : that kguard which was released includes this feature. you can check the source and learn how to do it.
|
Ah alright, a 3rd party filter  ... I was wondering if we can do that without additional addon/filter.
|
|
|
08/03/2015, 18:19
|
#9
|
elite*gold: 87
Join Date: Apr 2015
Posts: 318
Received Thanks: 535
|
Quote:
Originally Posted by witchymoo
Ah alright, a 3rd party filter  ... I was wondering if we can do that without additional addon/filter.
|
your AddLogChar way is the only way to do it without any additional addons. however, it's kinda bad. players will use items with high plus till they get a disconnect.
there is something easier, but requires a bot.
you can do the AddLogItem's way and send "/totown" to the char which passed the limit. so the visual of the item plus will get updated.
|
|
|
08/03/2015, 18:51
|
#10
|
elite*gold: 85
Join Date: Aug 2010
Posts: 1,278
Received Thanks: 522
|
as Xutan said : there is noway except addlogchar
using a 3rd part program is more useful adding more features ..
|
|
|
08/08/2015, 01:57
|
#11
|
elite*gold: 0
Join Date: Aug 2015
Posts: 116
Received Thanks: 44
|
tested , good one
|
|
|
08/08/2015, 17:21
|
#12
|
elite*gold: 480
Join Date: Jan 2012
Posts: 655
Received Thanks: 579
|
Great release witchy, but I have to agree a packet filter would work better. Still a nice idea though!
|
|
|
 |
Similar Threads
|
[Guide] Simple Query to Count Total Monster Spawns by Their Levels
07/18/2015 - SRO PServer Guides & Releases - 5 Replies
hey ;)
Here I'll share simple query about how to count total monster spawn categorized by their level, this should match total monster spawn you get when using gm command /worldstatus
This prolly useless to you but if you find it useful, feel free to develop it to match your needs ;)
Now the boring part:
/*
* Count total monster spawn categorized by level
* Witchy Moo, 20150622
|
[Question]How to fix Bug (Delete all items on Login to game and Logout)
04/04/2015 - 4Story - 12 Replies
In game: Screenshot by Lightshot
Logout: Screenshot by Lightshot
Help me please.
Thanks.
|
[Guide]- ZsZc how to login faster/ and how to speed hack *VERY SIMPLE!*
01/22/2012 - SRO PServer Guides & Releases - 53 Replies
#New thread has been added.
http://www.elitepvpers.com/forum/private-sro-explo its-hacks-bots-guides/899655-guide-how-connect-zsz c-faster-works.html
|
[Tool] Simple Logout Hack -only- by NeX#
01/11/2012 - DarkOrbit - 95 Replies
Dark Orbit Logout Hack -by NeX#-
http://s7.directupload.net/images/110816/a88rwj4e .jpg
What can it do?
- It can Logout you while Gates, fights and so on...
How to use it?
Just open it and read the two Messages!
|
All times are GMT +1. The time now is 00:13.
|
|