|
You last visited: Today at 01:55
Advertisement
[Release] Quest Upgrade System
Discussion on [Release] Quest Upgrade System within the SRO PServer Guides & Releases forum part of the SRO Private Server category.
02/19/2015, 08:24
|
#16
|
elite*gold: 0
Join Date: Dec 2008
Posts: 38
Received Thanks: 14
|
Thank you for this release! But let me just mention:
this statement will not work because @OldItemCode has not been initialized
PHP Code:
Select @ItemID = (Select ID From SHARD.dbo._RefObjCommon Where CodeName128=@OldItemCode)
this 2nd statement will not work because @NewItemCode has not been initialized
PHP Code:
exec SHARD.dbo._ADD_ITEM_EXTERN @Charname,@NewItemCode,1,0
|
|
|
02/19/2015, 10:25
|
#17
|
elite*gold: 28
Join Date: Aug 2014
Posts: 4,096
Received Thanks: 2,653
|
^The whole thing won't work*
Writing the whole thing in 3 lines is easier than reading and fixing it.
|
|
|
02/19/2015, 18:26
|
#18
|
elite*gold: 56
Join Date: Oct 2013
Posts: 1,165
Received Thanks: 774
|
Its a really nice idea but a bad implementation...
i was bored for like 10 mins so i started to rewrite the system but i become busy / lazy so i stopped here but maybe you can make something useful with it
-Syloxx
|
|
|
02/20/2015, 01:57
|
#19
|
elite*gold: 27
Join Date: Jan 2015
Posts: 1,339
Received Thanks: 885
|
Quote:
Originally Posted by Syloxx
Its a really nice idea but a bad implementation...
i was bored for like 10 mins so i started to rewrite the system but i become busy / lazy so i stopped here but maybe you can make something useful with it
-Syloxx
|
If you read the difference between mine and yours you will find out that mine depends on quest while yours depends on a scroll.
btw the one who depends on a scroll is old and many ppl have it now since it is in one of the shard databases.
but here is a copy of it written by me->
Quote:
If @operation = 41 and @ItemRefID = Scroll id from objcom
begin
Declare @ReqOptLvl int = '9'
Declare @OldIcode varchar(MAX)
declare @NewIcode varchar(MAX)
Select @NewIid int = (select id from shard.._Refobjcommon where codename128 like @NewIcode)
declare @OldIid int = (select id from shard.._refobjcommon where codename128 like @OldIcode)
declare @ItemsID int = (select id64 from shard.._items it join shard.._inventory inv on it.id64 = inv.itemid where inv.charid = @charid and inv.slot = 13 and it.serial64 >0 and it.optlevel >= @ReqOptLevel and it.refitemid = @oldiid)
select @OldIcode = codename128 from shard.._refobjcommon
select @NewIcode = codename128 from shard.._refobjcommon
If @OldIcode = 'ITEM_EU_TSTAFF_10_B_RARE'
begin
set @NewIcode = 'ITEM_EU_TSTAFF_10_C_RARE'
end
declare @ItemReplacer int = (select refitemid from shard.._items it join _inventory inv on it.id64 = inv.itemid where it.optlevel >= @ReqOptLevel and inv.slot = 13 and inv.charid = @charid and it.serial64 > 0 and it.refitemid = @OldIid)
if @ItemReplacer = @OldIid
begin
update sro_vt_shard.._items set RefItemID = @NewIid where id64 like @ItemsID and Refitemid like @OldIid
end
|
these lines should be added in _AddLogItem in log db
I never tested it but i think it will work
|
|
|
02/20/2015, 02:31
|
#20
|
elite*gold: 28
Join Date: Aug 2014
Posts: 4,096
Received Thanks: 2,653
|
Ques....WHAT???
|
|
|
02/20/2015, 06:05
|
#21
|
elite*gold: 56
Join Date: Oct 2013
Posts: 1,165
Received Thanks: 774
|
@Aeron* just some nice tips:
-If you do it related to quests then its abusable becuase a quest can't instant teleport you.
-Your scroll thing is related on equipment only and optlevel while your "quest" thing is for item count (equip only aswell)
-Even your scroll upgrade system is abusable...
anyway... i continue my query a bit... but for the add item part i'm 2 lazy because there are so many options like:
reqitem = equip | newitem != equip
reqitem = equip | newitem = equip
reqitem != equip | newitem != equip
reqitem != equip | newitem = equip
and yes it matters for adding the "newitemcount"
Code:
CREATE PROCEDURE _UpgradeSystem
@intScrollID int
, @intCharID int
AS
SET NOCOUNT ON
SET XACT_ABORT ON
DECLARE @intReturnValue int
, @intReqItemID int
, @intReqItemCount int
, @intNewItemID int
, @intNewItemCount int
, @bitIsEquip bit
IF XACT_STATE() = -1
BEGIN
SET @intReturnValue = 1
GOTO ErrorHandler
END
BEGIN TRY
SELECT @intReqItemID = IT.RefItemID
FROM _Inventory INV WITH (NOLOCK)
JOIN _Items IT WITH (NOLOCK)
ON INV.ItemID = IT.ID64
WHERE INV.Slot = 13
AND INV.CharID = @intCharID
IF @intReqItemID EXISTS IN (SELECT ReqItemID FROM _UpgradeItemPool WITH (NOLOCK))
BEGIN
SELECT @intReqItemCount = ReqItemCount
, @intNewItemID = NewItemID
, @intNewItemCount = NewItemCount
, @bitIsEquip = IsEquip
FROM _UpgradeItemPool
WHERE ReqItemID = @intReqItemID
END
ELSE
BEGIN
SET @intReturnValue = 100
GOTO ErrorHandler
END
BEGIN TRANSACTION
IF @bitIsEquip = 1
BEGIN
SELECT *
FROM _Inventory INV WITH (NOLOCK)
JOIN _Items IT WITH (NOLOCK)
ON INV.ItemID = IT.ID64
WHERE INV.Slot BETWEEN 13 AND 13 + @intReqItemCount
AND IT.RefItemID = @intReqItemCount
AND INV.CharID = @intCharID
IF @@ROWCOUNT = @intReqItemCount
BEGIN
UPDATE ITP
SET InUse = 0
FROM _ItemPool ITP WITH (NOLOCK)
JOIN _Inventory INV WITH (NOLOCK)
ON ITP.ItemID = INV.ItemID
WHERE INV.Slot BETWEEN 13 AND 13 + @intReqItemCount
AND INV.CharID = @intCharID
UPDATE _Inventory
SET ItemID = 0
WHERE Slot BETWEEN 13 AND 13 + @intReqItemCount
AND CharID = @intCharID
END
ELSE
BEGIN
SET @intReturnValue = 101
GOTO ErrorHandler
END
END
ELSE
BEGIN
DECLARE @intCurItemCount int
SELECT @intCurItemCount = IT.Data
FROM _Items IT WITH (NOLOCK)
JOIN _Inventory INV WITH (NOLOCK)
ON IT.ID64 = INV.ItemID
WHERE INV.Slot = 13
AND INV.CharID = @intCharID
IF @intCurItemCount = @intReqItemCount
BEGIN
UPDATE ITP
SET InUse = 0
FROM _ItemPool ITP WITH (NOLOCK)
JOIN _Inventory INV WITH (NOLOCK)
ON ITP.ItemID = INV.ItemID
WHERE INV.Slot = 13
AND INV.CharID = @intCharID
UPDATE _Inventory
SET ItemID = 0
WHERE Slot = 13
AND CharID = @intCharID
END
ELSE IF @intCurItemCount > @intReqItemCount
BEGIN
UPDATE IT
SET Data -= @intReqItemCount
FROM _Items IT WITH (NOLOCK)
JOIN _Inventory INV WITH (NOLOCK)
ON IT.ID64 = INV.ItemID
WHERE INV.Slot = 13
AND INV.CharID = @intCharID
END
ELSE
BEGIN
SET @intReturnValue = 102
GOTO ErrorHandler
END
END
END TRY
|
|
|
02/21/2015, 07:08
|
#22
|
elite*gold: 0
Join Date: Dec 2008
Posts: 38
Received Thanks: 14
|
Wow, this actually get's complicated the deeper you get into it. I've noticed all the additional logic you've added. Syloxx, are the lastthief and others right that this should be done in 2 or 3 extremely long lines of SQL code? Or does this way offer more benefits. Maybe because this concept is quest based or scroll based, and the classic _AddLogItem reacts to the teleport eventID.
|
|
|
02/21/2015, 12:47
|
#23
|
elite*gold: 85
Join Date: Feb 2014
Posts: 1,055
Received Thanks: 1,643
|
It still doesn't get complicated.
I don't know what you guys are all smoking, but those things can still be done in a single update.
Syloxx made the first post better but killed performance again, entirely.
It's rather funny how people still don't understand **** about actual database management.
You all go n learn SQL; but it really shows that essential skills are lacking when ya'll write this simple item update sp.
Quote:
Originally Posted by ersers2
Syloxx, are the lastthief and others right that this should be done in 2 or 3 extremely long lines of SQL code? Or does this way offer more benefits
|
Shorter, same function, faster, less "bugs", since its literally a line, less to write. More brainwork though.
VS
Longer, same function, more bugs, slow as ****, lot more work to write. Less brainwork.
Decide for yourself^^.
And all these people are still failling at it haha
|
|
|
02/21/2015, 17:07
|
#24
|
elite*gold: 0
Join Date: Feb 2014
Posts: 885
Received Thanks: 1,419
|
That's how i wrote it fastly... it's good enough , and it can be optimized more cuz i'm still not good with sql at all.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [_Upgrade]
@CharID int
AS
declare @ReqItemID int = (SELECT RefItemID FROM SRO_VT_SHARD.._Items JOIN SRO_VT_SHARD.._Inventory on ID64 = ItemID and CharID = @CharID and Slot = 13)
IF((SELECT COUNT(RefItemID) FROM SRO_VT_SHARD.._Items JOIN SRO_VT_SHARD.._Inventory on ID64 = ItemID and CharID = @CharID and RefItemID = @ReqItemID) >= 5)
UPDATE _Items SET
_Items.RefItemID = b.ID
--You can reset item stats/blue/plus here..
FROM SRO_VT_SHARD.._Items _Items
JOIN SRO_VT_SHARD.._Inventory _Inventory on _Items.ID64 = _Inventory.ItemID and _Inventory.Slot = 13 and CharID = @CharID
JOIN SRO_VT_SHARD.._RefObjCommon a on a.Service = 1 and a.ID = _Items.RefItemID and a.CodeName128 like '%[_]12[_]%%B[_]RARE%'
JOIN SRO_VT_SHARD.._RefObjCommon b on b.Service = 1 and a.TypeID1 = b.TypeID1 and a.TypeID2 = b.TypeID2 and a.TypeID3 = b.TypeID3 and a.TypeID4 = b.TypeID4
and b.CodeName128 like '%[_]12[_]%%C[_]RARE%'
UPDATE _Inventory SET
_Inventory.ItemID = 0
FROM SRO_VT_SHARD.._Inventory _Inventory
JOIN (SELECT TOP 4 ID64 FROM SRO_VT_SHARD.._Items a JOIN SRO_VT_SHARD.._Inventory b on a.RefItemID = @ReqItemID and a.ID64 = b.ItemID and b.CharID = @CharID) asd
on _Inventory.ItemID = asd.ID64
I prefer to assign ItemClass from _RefObjItem than using CodeName128 that's in case you haven't created any similar items.
OR
I do prefer this way.
USE [SRO_VT_HOBA]
GO
/****** Object: Table [dbo].[_Upgarde] Script Date: 02/21/2015 17:51:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[_Upgarde](
[ReqItem] [int] NOT NULL,
[NewItem] [int] NOT NULL
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [_Upgrade]
@CharID int
AS
declare @ReqItemID int,@NewItemID int
SELECT @ReqItemID = ReqItem, @NewItemID = NewItem FROM SRO_VT_HOBA.._Upgarde
declare @CharName16 varchar(16) = (SELECT CharName16 FROM SRO_VT_SHARD.._Char WHERE CharID = @CharID),
@CodeName128 varchar(129) = (SELECT CodeName128 FROM SRO_VT_SHARD.._RefObjCommon WHERE ID = @NewItemID)
IF((SELECT COUNT(RefItemID) FROM SRO_VT_SHARD.._Items JOIN SRO_VT_SHARD.._Inventory on ID64 = ItemID and CharID = @CharID and RefItemID = @ReqItemID) >= 5)
UPDATE _Inventory SET
_Inventory.ItemID = 0
FROM SRO_VT_SHARD.._Inventory _Inventory
JOIN (SELECT TOP 5 ID64 FROM SRO_VT_SHARD.._Items a JOIN SRO_VT_SHARD.._Inventory b on a.RefItemID = @ReqItemID and a.ID64 = b.ItemID and b.CharID = @CharID) asd
on _Inventory.ItemID = asd.ID64
exec SRO_VT_SHARD.._ADD_ITEM_EXTERN @CharName16,@CodeName128,1,0
P.S. I haven't tested them but they should work.
|
|
|
03/02/2015, 21:06
|
#25
|
elite*gold: 0
Join Date: Mar 2012
Posts: 679
Received Thanks: 29
|
Quote:
Originally Posted by Muhab Ashraf
That's how i wrote it fastly... it's good enough , and it can be optimized more cuz i'm still not good with sql at all.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [_Upgrade]
@CharID int
AS
declare @ReqItemID int = (SELECT RefItemID FROM SRO_VT_SHARD.._Items JOIN SRO_VT_SHARD.._Inventory on ID64 = ItemID and CharID = @CharID and Slot = 13)
IF((SELECT COUNT(RefItemID) FROM SRO_VT_SHARD.._Items JOIN SRO_VT_SHARD.._Inventory on ID64 = ItemID and CharID = @CharID and RefItemID = @ReqItemID) >= 5)
UPDATE _Items SET
_Items.RefItemID = b.ID
--You can reset item stats/blue/plus here..
FROM SRO_VT_SHARD.._Items _Items
JOIN SRO_VT_SHARD.._Inventory _Inventory on _Items.ID64 = _Inventory.ItemID and _Inventory.Slot = 13 and CharID = @CharID
JOIN SRO_VT_SHARD.._RefObjCommon a on a.Service = 1 and a.ID = _Items.RefItemID and a.CodeName128 like '%[_]12[_]%%B[_]RARE%'
JOIN SRO_VT_SHARD.._RefObjCommon b on b.Service = 1 and a.TypeID1 = b.TypeID1 and a.TypeID2 = b.TypeID2 and a.TypeID3 = b.TypeID3 and a.TypeID4 = b.TypeID4
and b.CodeName128 like '%[_]12[_]%%C[_]RARE%'
UPDATE _Inventory SET
_Inventory.ItemID = 0
FROM SRO_VT_SHARD.._Inventory _Inventory
JOIN (SELECT TOP 4 ID64 FROM SRO_VT_SHARD.._Items a JOIN SRO_VT_SHARD.._Inventory b on a.RefItemID = @ReqItemID and a.ID64 = b.ItemID and b.CharID = @CharID) asd
on _Inventory.ItemID = asd.ID64
I prefer to assign ItemClass from _RefObjItem than using CodeName128 that's in case you haven't created any similar items.
OR
I do prefer this way.
USE [SRO_VT_HOBA]
GO
/****** Object: Table [dbo].[_Upgarde] Script Date: 02/21/2015 17:51:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[_Upgarde](
[ReqItem] [int] NOT NULL,
[NewItem] [int] NOT NULL
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [_Upgrade]
@CharID int
AS
declare @ReqItemID int,@NewItemID int
SELECT @ReqItemID = ReqItem, @NewItemID = NewItem FROM SRO_VT_HOBA.._Upgarde
declare @CharName16 varchar(16) = (SELECT CharName16 FROM SRO_VT_SHARD.._Char WHERE CharID = @CharID),
@CodeName128 varchar(129) = (SELECT CodeName128 FROM SRO_VT_SHARD.._RefObjCommon WHERE ID = @NewItemID)
IF((SELECT COUNT(RefItemID) FROM SRO_VT_SHARD.._Items JOIN SRO_VT_SHARD.._Inventory on ID64 = ItemID and CharID = @CharID and RefItemID = @ReqItemID) >= 5)
UPDATE _Inventory SET
_Inventory.ItemID = 0
FROM SRO_VT_SHARD.._Inventory _Inventory
JOIN (SELECT TOP 5 ID64 FROM SRO_VT_SHARD.._Items a JOIN SRO_VT_SHARD.._Inventory b on a.RefItemID = @ReqItemID and a.ID64 = b.ItemID and b.CharID = @CharID) asd
on _Inventory.ItemID = asd.ID64
exec SRO_VT_SHARD.._ADD_ITEM_EXTERN @CharName16,@CodeName128,1,0
P.S. I haven't tested them but they should work. 
|
log ?
|
|
|
03/03/2015, 15:28
|
#26
|
elite*gold: 0
Join Date: Nov 2012
Posts: 17
Received Thanks: 0
|
usefull
|
|
|
06/14/2016, 15:23
|
#27
|
elite*gold: 0
Join Date: May 2016
Posts: 66
Received Thanks: 9
|
there's new way to upgrade weapon --_-- try to create upgrade scroll with producer can choose weapons stats from table lel..
|
|
|
 |
|
Similar Threads
|
[RELEASE] Pet System Advanced quest
04/18/2020 - Metin2 PServer Guides & Strategies - 120 Replies
hi all,
I anticipate that the quest is not quite complete as it is a job that I left a few weeks and I do not think that will complete only for lack of desire.
What is missing: to complete the quest really miss a few functions including management and summon pet horse in the application of the bonus for the fighting style I think there is nothing more to add (if I remember correctly).
the quest is very flexible, you can add different fighting styles you find already made 2 as an...
|
[RELEASE] Tages Quest System
04/22/2014 - Metin2 PServer Guides & Strategies - 9 Replies
Hallo. Ich Release mein Tages Quest System dieses brauche ich nicht mehr. Vl können viele damit etwas anfangen.
--]
quest sub_quest_kill begin
state start begin
when login or levelup with not pc.is_gm() begin
local level = {10,20,30,40,50,55,60,65,70,75,80,85,90,95}
local qstate = pc.getqf("quest_state")+1
|
[Release] Verwarn-System(Quest)
01/10/2014 - Metin2 PServer Guides & Strategies - 57 Replies
Hallo Freunde :rolleyes:,
ich habe mal wieder was für euch. Es ist ein Verwarn-System ich habe es geschrieben da ihr das wahrscheinlich auch kennt ein User wird beleidigt und die GM´s können nichts machen außer vllt. Chatblock. So hat mann die Gelegenheit als Teamler einen User zu verwarnen nach 3,5,7 und 10 Verwarnungen wird das System automatisch Aktiv und je nach Verwarnung gibt es eine Strafe z.b
Verwarnungen|Strafe
3|3h Bann
5|1 Tages Bann
7|3 Tages Bann
10|Perma. Bann
Ihr...
|
★ReVolt-Network★ Cap100- Upgrade System Weapon - Job Based - Free 10k Silk -Quest
09/30/2013 - SRO PServer Advertising - 8 Replies
http://im31.gulfup.com/mnq67.png
ReVolt-Network Gaming Network is a network which tries so hard to create new legacy of mmorpg game play system . In fact , The legacy won't be changed without someone who force it to change .. We , The team of ReVolt-Network Gaming Network CO. transforming the road of play in Silkroad Online to a new
management of trustful , hopeful predictions .
http://img716.imageshack.us/img716/7955/articlese parator.png
Hello Everyone,
We are...
|
[QUEST-RELEASE]Auction System
04/06/2013 - Metin2 PServer Guides & Strategies - 8 Replies
Hi epvp,
About quest:
It's very simple script in lua for metin2, from AzorisMt2.
The script is very short, it have only 1100 line.
The source code by: masodikbela, from hungary.
If be more than 50 records in the tables, it will very laggy
Use:
In the rar archive are two .sql files, you have to put these tables into the player database.
|
All times are GMT +1. The time now is 01:55.
|
|