good job, but here is a clearer version of this query
Type 1 = Stones
Type 2 = Tablets
Type 3 = Elements
Type 4 = Elixirs
PHP Code:
USE SRO_VT_SHARD
/******By Certus ******/
DECLARE @Type INT = 1
DECLARE @MaxStack INT = 250
-- *******************************************************************************
-- CHANGE STACK OF STONES
-- *******************************************************************************
IF @Type = 1
BEGIN
UPDATE _RefObjItem SET MaxStack = @MaxStack WHERE ID IN (SELECT Link FROM _RefObjCommon WHERE CodeName128 LIKE 'ITEM_ETC_ARCHEMY_%STONE%' AND Service=1)
DECLARE @PrintMessageStones VARCHAR (50) = 'Stack of stones is successfully changed to '
+ RTRIM(CAST(@MaxStack AS nvarchar(30)))
PRINT @PrintMessageStones
END
-- *******************************************************************************
-- CHANGE STACK OF TABLETS
-- *******************************************************************************
IF @Type = 2
BEGIN
UPDATE _RefObjItem SET MaxStack = @MaxStack WHERE ID IN (SELECT Link FROM _RefObjCommon WHERE CodeName128 LIKE 'ITEM_ETC_ARCHEMY_%TABLET%' AND Service=1)
DECLARE @PrintMessageTablets VARCHAR (50) = 'Stack of tablets is successfully changed to '
+ RTRIM(CAST(@MaxStack AS nvarchar(30)))
PRINT @PrintMessageTablets
END
-- *******************************************************************************
-- CHANGE STACK OF ELEMENTS
-- *******************************************************************************
IF @Type = 3
BEGIN
UPDATE _RefObjItem SET MaxStack = @MaxStack WHERE ID IN (SELECT Link FROM _RefObjCommon WHERE CodeName128 LIKE 'ITEM_ETC_ARCHEMY_%ELEMENT%' AND Service=1)
DECLARE @PrintMessageElements VARCHAR (50) = 'Stack of elements is successfully changed to '
+ RTRIM(CAST(@MaxStack AS nvarchar(30)))
PRINT @PrintMessageElements
END
-- *******************************************************************************
-- CHANGE STACK OF ELIXIRS
-- *******************************************************************************
IF @Type = 4
BEGIN
UPDATE _RefObjItem SET MaxStack = @MaxStack WHERE ID IN (SELECT Link FROM _RefObjCommon WHERE CodeName128 LIKE '%ITEM_ETC_ARCHEMY_REINFORCE_RECIPE_%_B%' AND Service=1)
DECLARE @PrintMessageElexirs VARCHAR (50) = 'Stack of elixirs is successfully changed to '
+ RTRIM(CAST(@MaxStack AS nvarchar(30)))
PRINT @PrintMessageElexirs
END
IF @Type NOT BETWEEN 1 AND 4
BEGIN
PRINT 'Please set Type to 1 for stones'
PRINT 'Please set Type to 2 for tablets'
PRINT 'Please set Type to 3 for elements'
PRINT 'Please set Type to 4 for elixirs'
END