Register for your free account! | Forgot your password?

Go Back   elitepvpers › Popular Games › Silkroad Online › SRO Guides & Templates
You last visited: Today at 10:20

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

Advertisement



Add Item to NPC Query

Discussion on Add Item to NPC Query within the SRO Guides & Templates forum part of the Silkroad Online category.

Reply
 
Old   #1
 
IceAmStiel's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 1,058
Received Thanks: 1,118
Lightbulb Add Item to NPC Query

if someone needs it, use it - will faster many things up and you'll get punished for sloppy done work in the past.

PHP Code:
USE SRO_VT_SHARD /* ITEMS TO NPC FOR GOLD by Caipi */
Declare @ItemID int
Declare @yourPrice int
Declare @WhichTAB varchar(74)



SET @ItemID = 23                            /* The Item ID of the Item you want to add to the NPC*/ --## <--
SET @yourPrice = 5000                        /* The price per Unit */ --## <--
SET @WhichTAB = 'STORE_CH_POTION_TAB1'        /* To which Tab at which NPC you want to add the Item*/



/* Codename instead of the ID */ 
Declare @CodeName varchar (74) SET @CodeName = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @ItemID)

/* Which Itemdata.txt is affected in the Media.pk2*/
Declare @newItemID varchar(5)
Declare @
lastPrice varchar(25) SET @lastPrice = (SELECT Price FROM _RefObjCommon WHERE ID = @ItemID)
Declare @
yourPriceCHAR varchar(25) SET @yourPriceCHAR = @yourPrice
IF (@ItemID < 5000) SET @newItemID = 5000
else if (@ItemID < 10000) SET @newItemID = 10000
else if (@ItemID < 15000) SET @newItemID = 15000
else if (@ItemID < 20000) SET @newItemID = 20000
else if (@ItemID < 25000) SET @newItemID = 25000
else if (@ItemID < 30000) SET @newItemID = 30000
else if (@ItemID < 35000) SET @newItemID = 35000
else if (@ItemID < 40000) SET @newItemID = 40000
else SET @newItemID = 45000
print ''
print @CodeName + ' from Media\server_dep\silkroad\textdata\itemdata_'+@newItemID+'.txt'
print 'Change the current Price of '+@lastPrice+' to '+@yourPriceCHAR+' at the itemdata_'+@newItemID+'. (For the visual Price ingame)'
/*END which Itemdata.txr*/

/*for _RefObjCommon Price*/
UPDATE _RefObjCommon SET Price = @yourPrice WHERE ID = @ItemID

/* for _RefPackageItem */
IF EXISTS (SELECT CodeName128 FROM _RefPackageItem WHERE CodeName128 = 'Package_'+@CodeName)
    
BEGIN
        
print 'Already added @ RefPackageItem/.txt!'
    
END
ELSE BEGIN
Declare @SN varchar(74) SET @SN = (SELECT NameStrID128 FROM _RefObjCommon WHERE ID = @ItemID)
Declare @
DESC varchar(74) SET @Desc = (SELECT DescStrID128 FROM _RefObjCommon WHERE ID = @ItemID)
Declare @
DDJ varchar(74) SET @DDJ = (SELECT AssocFileIcon128 FROM _RefObjCommon WHERE ID = @ItemID)
INSERT INTO _RefPackageItem (Service,Country,CodeName128,SaleTag,ExpandTerm,NameStrID,DescStrID,AssocFileIcon,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128) 
VALUES (1,15,'PACKAGE_'+@CodeName,0,'EXPAND_TERM_ALL',@SN,@Desc,@DDJ,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
Declare @
TOPID varchar (10) SET @TOPID = (SELECT MAX(ID) FROM _RefPackageItem)
print 
''
print 'Add the following line @ refpackageitem.txt'
print '1    15    '+@TOPID+'    PACKAGE_'+@CodeName+'    0    EXPAND_TERM_ALL    '+@SN+'    '+@DESC+'    '+@DDJ+'    -1    xxx    -1    xxx    -1    xxx    -1    xxx'
print ''
END

/* for _RefPricePolicyOfItem */
IF EXISTS (SELECT RefPackageItemCodeName FROM _RefPricePolicyOfItem WHERE RefPackageItemCodeName = 'Package_'+@CodeName AND PaymentDevice = 1 AND Cost = @yourPrice)
    
BEGIN
        
print 'Already added @ RefPricePolicyOfItem/.txt!'
    
END
ELSE BEGIN
INSERT INTO _RefPricePolicyOfItem 
(Service,Country,RefPackageItemCodeName,PaymentDevice,PreviousCost,Cost,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128)
VALUES (1,15,'PACKAGE_'+@CodeName,1,0,@yourPrice,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
Declare @
NEWPRICE varchar(15) SET @NEWPRICE = @yourPrice
print ''
print 'Add the following line @ refpricepolicyofitem.txt'
print '1    15    PACKAGE_'+@CodeName+'    1    0    '+@NEWPRICE+'    -1    xxx    -1    xxx    -1    xxx    -1    xxx'
print ''
END

/* for _RefShopGoods */
IF EXISTS (SELECT RefPackageItemCodeName FROM _RefShopGoods WHERE RefPackageItemCodeName = 'Package_'+@CodeName AND RefTabCodeName = @WhichTAB)
    
BEGIN
        
print 'Already added @ RefShopGoods/.txt!'
    
END
ELSE BEGIN
Declare @newSLOTINDEX varchar(15) SET @newSLOTINDEX = (SELECT MAX(SlotIndex) FROM _RefShopGoods WHERE RefTabCodeName = @WhichTAB)+1
INSERT INTO _RefShopGoods 
(Service,Country,RefTabCodeName,RefPackageItemCodeName,SlotIndex,Param1,Param1_Desc128,Param2,Param2_Desc128,Param3,Param3_Desc128,Param4,Param4_Desc128)
VALUES (1,15,@WhichTAB,'PACKAGE_'+@CodeName,@newSLOTINDEX,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
print 
''
print 'Add the following line @ refshopgoods.txt'
print '1    15    '+@WhichTAB+'    '+'PACKAGE_'+@CodeName+'    '+@newSLOTINDEX+'    -1    xxx    -1    xxx    -1    xxx    -1    xxx'
print ''
END

/* for _RefScrapOfPackageItem */
IF EXISTS (SELECT RefPackageItemCodeName FROM _RefScrapOfPackageItem WHERE RefPackageItemCodeName = 'Package_'+@CodeName AND RefItemCodeName = @CodeName)
    
BEGIN
        
print 'Already added @ RefScrapOfPackageItem/.txt!'
    
END
ELSE BEGIN
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)
VALUES (1,15,'PACKAGE_'+@CodeName,@CodeName,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,'xxx',-1,'xxx',-1,'xxx',-1,'xxx')
Declare @
ScrapIndex varchar(15)
SET @ScrapIndex = (SELECT MAX([Index]) FROM _RefScrapOfPackageItem WHERE RefItemCodeName = @CodeName)
print 
''
print 'Add the following line @ refscrapofpackageitem.txt'
print '1    15    '+'PACKAGE_'+@CodeName+'    '+@CodeName+'    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    -1    xxx    -1    xxx    -1    xxx    -1    xxx    '+@ScrapIndex
print ''
END
print ''
print ''
print 'Done!' 
IceAmStiel is offline  
Thanks
18 Users
Old   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 590
Received Thanks: 775
thanks ^^
BestOnWorld is offline  
Old   #3
 
elite*gold: 0
Join Date: Sep 2007
Posts: 21
Received Thanks: 0
THANK YOU VERY MUCH
vantuto is offline  
Old   #4

 
ZiCo*'s Avatar
 
elite*gold: 220
Join Date: Jul 2008
Posts: 1,085
Received Thanks: 576
Works perfectly in microsoft sql 2005 but not mssql 2008 r2
it give an error that it can't add null some where in refpackageitem & refscrapofpackageitem

Regards
ZiCo* is offline  
Old   #5
 
elite*gold: 0
Join Date: Nov 2009
Posts: 190
Received Thanks: 2
which lines i need to change ? i changed in first line to SRO_VT_SHARD_INIT ...
line 8-10 i changed for my item,price,npc... what i need change else ?
Pati1992 is offline  
Old   #6
 
elite*gold: 0
Join Date: Jun 2012
Posts: 67
Received Thanks: 4
thx bro
mmmhhh is offline  
Old   #7
 
elite*gold: 0
Join Date: Jan 2012
Posts: 72
Received Thanks: 0
Weird Glitch

yesterday i was trying to add a vehicle to the stable tab one

so i tried it i put

item ID 22720 (Unicorn)
price 5000
shop tab Shop_CH_STABLE_TAB1 or what ever it was

i execute the query runs fine no errors
i change the media files like i am told to by the query

but when i go to start my server up
all modules work except Game_server
it shows
"
Connected to Shard_manager
Connected to DB
Connected to farm
"
then i just closes
no message or anything

this really ****** me off because after working for like an hour figuring stuff out i just ended up having to restore to a clean database

so i thought maybe it was because of sloppy work, so i redid all initial work on DB added user ids privileged Ip .. ETC

and backed up the data base

checked if it worked, it did Game server ran fine

then i redid the add item to just one store and i got the same problem. If anyone has any idea whats going on please help me
gman2233 is offline  
Old   #8
 
elite*gold: 0
Join Date: May 2014
Posts: 5
Received Thanks: 3
the price 5000 is what gold silk or coins
and if I want change the type of it I edit refpricepolicy or what
marwanayman19 is offline  
Old   #9
 
elite*gold: 50
Join Date: Mar 2013
Posts: 1,153
Received Thanks: 412
n11
asanoftw is offline  
Old   #10
 
elite*gold: 0
Join Date: Jul 2014
Posts: 5
Received Thanks: 0
how i can find media file witch Query edit them ?
GM Offander is offline  
Old   #11
 
JoyGaming's Avatar
 
elite*gold: 0
Join Date: Jul 2014
Posts: 31
Received Thanks: 3
thanks
JoyGaming is offline  
Old   #12
 
elite*gold: 0
Join Date: May 2009
Posts: 31
Received Thanks: 8
thanks
pompapage is offline  
Old   #13
 
elite*gold: 0
Join Date: Oct 2014
Posts: 20
Received Thanks: 8
Useful release
CharIes is offline  
Old   #14
 
elite*gold: 0
Join Date: Jun 2011
Posts: 802
Received Thanks: 396
Please delete this ****
Where is data @_RefScrapOfPackageItem ?
H34D_B4NG3R is offline  
Reply


Similar Threads Similar Threads
Query für bestimmtes Item löschen
10/10/2011 - Metin2 Private Server - 2 Replies
Wie kann ich alle Items in der Itemtable mit z.b Value 70007 löschen danke im Voraus.
Insert item query
07/31/2011 - Rappelz - 7 Replies
HI all, My commands game001 didnt working, what is the way to inser this : USE GO DECLARE @return_value int EXEC @return_value = .
VIP update in a form of item instead of making query manually
06/06/2011 - EO PServer Hosting - 4 Replies
Hi, I've been searching guides on how to update the VIP level and found out on how to update it manually. But, can the VIP level be customized into some form of item (should be in PP type) that when you were right click on to it, it will automatically updating your character's VIP level..say that the player can update it according to him at anytime. Purpose : As an event' gift or when the particular player is donating to the server.
[Suche]Query für "Alteklinge, Reichsklinge" &' Stichdolche NUR QUERY!
08/18/2010 - Metin2 Private Server - 1 Replies
Ich weiß ich werd nervig aber ich suche die Query's für Alteklinge, Reichsklinge &' Strichdolche Why? Naya, weil ich in der DB i-wie nur Drachenmaulglocke hab ... not more -.- Auf jeden Fall Icon's etc. etc. etc. hab ich ich brauche nur die Query's



All times are GMT +1. The time now is 10:23.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.