[Release]Query fast adding item to npc.

10/06/2012 22:51 Nefetis#1
Today I'd like to share a query with you. This query will quickly add an item to an NPC - test it and rate it.

PHP Code:
USE [SRO_VT_SHARD]
----------
By Nefetis--------------
DECLARE @
PRICETYPE VARCHAR (70)
DECLARE @
PRICE VARCHAR (70)
DECLARE @
TAB VARCHAR (70)
DECLARE @
CODENAME128 VARCHAR (70)
DECLARE @
OPTLEVEL VARCHAR (70)
SET @PRICETYPE 'GOLD'
SET @OPTLEVEL '5'
SET @CODENAME128 'ITEM_EU_STAFF_10_A_RARE'
SET @PRICE '1' 
SET @TAB 'STORE_LEVELING_TAB2'








DECLARE @DATA VARCHAR (30) = (Select DUR_L FROM _RefObjItem WHERE ID IN(SELECT Link from _RefObjCommon where CodeName128 = @CODENAME128))
DECLARE @
MAXLINK VARCHAR (30) = (SELECT MAX ([Index]) FROM _RefScrapOfPackageItem)+

SET IDENTITY_INSERT _RefScrapOfPackageItem ON 
INSERT INTO _RefScrapOfPackageItem 
(Service,Country,RefPackageItemCodeName,RefItemCodeName,OptLevel,Variance,Data,MagParamNum,MagParam1,MagParam2,MagParam3,MagParam4,MagParam5,MagParam6,MagParam7 
,MagParam8,MagParam9,MagParam10,MagParam11,MagParam12,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128,[Index]) VALUES 
(1,15,'PACKAGE_'+@CODENAME128,@CODENAME128,@OPTLEVEL,0,@DATA,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx',@MAXLINK
SET IDENTITY_INSERT _RefScrapOfPackageItem OFF


SET IDENTITY_INSERT _RefPackageItem ON 
DECLARE @ICON VARCHAR (70) = (SELECT AssocFileIcon128 FROM _RefObjCommon Where CodeName128 = @CODENAME128)
DECLARE @
MAXID VARCHAR (30) = (SELECT MAX (IDFROM _RefPackageItem)+
INSERT INTO _RefPackageItem 
(Service,Country,ID,Codename128,SaleTag,ExpandTerm,NameStrID,DescStrID,AssocFileIcon,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128VALUES
(1,15,@MAXID,'PACKAGE_'+@CODENAME128,0,'EXPAND_TERM_ALL','SN_'+@CODENAME128,'SN_'+@CODENAME128+'_TT_DESC',@ICON,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
SET IDENTITY_INSERT _RefPackageItem OFF


IF @PRICETYPE 'GOLD' BEGIN
INSERT INTO _RefPricepolicyofitem 
(Service,Country,RefPackageItemCodeName,PaymentDevice,PreviousCost,Cost,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128VALUES
(1,15,'PACKAGE_'+@CODENAME128,1,0,@PRICE,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
END


IF @PRICETYPE 'SILK' BEGIN
INSERT INTO _RefPricepolicyofitem 
(Service,Country,RefPackageItemCodeName,PaymentDevice,PreviousCost,Cost,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128VALUES
(1,15,'PACKAGE_'+@CODENAME128,2,0,@PRICE,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
INSERT INTO _RefPricepolicyofitem (Service,Country,RefPackageItemCodeName,PaymentDevice,PreviousCost,Cost,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128VALUES
(1,15,'PACKAGE_'+@CODENAME128,4,0,0,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
INSERT INTO _RefPricepolicyofitem (Service,Country,RefPackageItemCodeName,PaymentDevice,PreviousCost,Cost,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128VALUES
(1,15,'PACKAGE_'+@CODENAME128,16,0,0,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
END


DECLARE @MAXSLOT VARCHAR (30) = (SELECT MAX (SlotIndexfrom _RefShopGoods  Where Reftabcodename = @TAB  and Service 1)+

INSERT INTO _RefShopGoods 
(Service,Country,RefTabCodeName,RefPackageItemCodeName,SlotIndex,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128VALUES
(1,15,@TAB,'PACKAGE_'+@CODENAME128,@MAXSLOT,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx'
SET @PRICETYPE = 'GOLD'(GOLD OR SILK)
SET @OPTLEVEL = '5'(how much Plus)
SET @CODENAME128 = 'ITEM_EU_STAFF_10_A_RARE'(CodeName of item)
SET @PRICE = '1' (Price Of item)
SET @TAB = 'STORE_LEVELING_TAB2'( Tab where u want to add it)

I think it will work only on SQLSERVER 2008
If u have some problem with query pm me:)
10/06/2012 23:47 LegendM*#2
[Only registered and activated users can see links. Click Here To Register...]
10/06/2012 23:59 Nefetis#3
Sorry, didn't see that before. However, you've got the the option here to set up what kind of a plus the item will have, you can also setup the silk price for it. I might soon add an "add blue" option for the items.
10/07/2012 15:54 dimkacool#4
Can you add quantity? For example if I want to add 20 unit of items straight to NPC?
10/07/2012 16:09 Nefetis#5
U mean MultiAdding?
U write 40 codenames and it add it with one click?
01/17/2013 07:52 casteryee#6
if you could make this query after insert to database and show txt file will be great :)
01/17/2013 09:58 eminem5#7
to make a server only way to do is buying a root
01/19/2013 15:36 intercsaki#8
Quote:
Originally Posted by eminem5 View Post
to make a server only way to do is buying a root
Ummm yea, and this is related to..... to what, exactly? :D
01/21/2013 13:44 Crue*#9
thanks !
06/25/2014 03:39 Little Messi#10
doesn't work on SQL 2008 R2 right ?
06/27/2014 00:39 xivak#11
Work on SQL Server 2012 :)
06/27/2014 13:23 Nefetis#12
Quote:
Originally Posted by Little Messi View Post
doesn't work on SQL 2008 R2 right ?
It works. If you have some errors PM Me and i will try to help ya
05/21/2016 12:48 Anonyxx#13
dont work sql 2014 , plz help me