Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Private Server
You last visited: Today at 22:19

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

Advertisement



Query for more then one Item

Discussion on Query for more then one Item within the SRO Private Server forum part of the Silkroad Online category.

Reply
 
Old   #1
 
mayc0n's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 165
Received Thanks: 4
Query for more then one Item

G8 guys,

I wonder if you know how can I edit this query or if haz another to add more than one item.

I am creating an NPC with ALL Avatars and ALL Pets, and one by one, then go to the media and such.

Could someone help me with this.

I use this query to add items to npcs.

Code:
USE SRO_VT_SHARD
GO
DECLARE @ID int
DECLARE @INDEX int
DECLARE @CodeName varchar(128)
DECLARE @PackageName varchar(128)
DECLARE @DescSTRID varchar(128)
DECLARE @File varchar(128)
DECLARE @Price int
DECLARE @SilkPrice int
DECLARE @Slot tinyint
DECLARE @TAB varchar(128)
DECLARE @Data int
DECLARE @SkipScrapOfPackageItem int = 0
DECLARE @SkipPackageItem int = 0
DECLARE @SkipPricePolicyOfItem int = 0
--- Set Variables
SET @CodeName = 'ITEM' -- Item CodeName in RefObjCommon
SET @Price = 0 -- Set 0 if you don't want to set Gold Price
SET @SilkPrice = 0 -- Set 0 if you don't want to set Silk Price
SET @TAB = 'STORE_X' -- Tab name in NPC, For _RefShopGoods
SET @PackageName = 'PACKAGE_'+@CodeName -- Do not edit if you don't know what are you doing.
--- you don't need to touch here...
IF (@CodeName = '')
BEGIN
    PRINT 'You have to edit CodeName..!'
    PRINT 'FAILED.'
    RETURN
END
IF ((SELECT COUNT(ID) FROM _RefObjCommon WHERE CodeName128 = @CodeName) < 1)
BEGIN
    PRINT 'There is no item with this CodeName..!'
    PRINT 'FAILED.'
    RETURN
END
IF (@Price < 0)
BEGIN
    PRINT 'Price is not VALID..!'
    PRINT 'FAILED.'
    RETURN
END
IF (@SilkPrice < 0)
BEGIN
    PRINT 'Silk Price is not VALID..!'
    PRINT 'FAILED.'
    RETURN
END
IF ((SELECT COUNT(ID) FROM _RefShopTab WHERE CodeName128 = @TAB) < 1)
BEGIN
    PRINT 'TAB VALUE IS NOT VALID..!'
    PRINT 'FAILED.'
    RETURN
END
IF ((SELECT COUNT (RefPackageItemCodeName) FROM _RefShopGoods WHERE RefPackageItemCodeName = @PackageName AND RefTabCodeName = @TAB) > 0)
BEGIN
    PRINT 'There is already same item in same tab..!'
    PRINT 'FAILED.'
    RETURN
END
IF ((SELECT COUNT (RefPackageItemCodeName) FROM _RefScrapOfPackageItem WHERE RefPackageItemCodeName = @PackageName) > 0)
BEGIN
    PRINT 'There is already an entry for this item, skipping @_RefScrapOfPackageItem table..!'
    SET @SkipScrapOfPackageItem = 1
END
IF ((SELECT COUNT (CodeName128) FROM _RefPackageItem WHERE CodeName128 = @PackageName) > 0)
BEGIN
    PRINT 'There is already an entry for this item, skipping @_RefPackageItem table..!'
    SET @SkipPackageItem = 1
END
IF ((SELECT COUNT (PaymentDevice) FROM _RefPricePolicyOfItem WHERE RefPackageItemCodeName = @PackageName AND PaymentDevice = '1') > 0)
BEGIN
    PRINT 'There is already an entry for this item with same PaymentDevice, skipping @_RefPricePolicyOfItem table..! (Gold)'
    SET @SkipPricePolicyOfItem = 1
END
IF ((SELECT COUNT (PaymentDevice) FROM _RefPricePolicyOfItem WHERE RefPackageItemCodeName = @PackageName AND PaymentDevice = '2') > 0)
BEGIN
    PRINT 'There is already an entry for this item with same PaymentDevice, skipping @_RefPricePolicyOfItem table..! (Silk)'
    IF (@SkipPricePolicyOfItem = 1)
    BEGIN
        SET @SkipPricePolicyOfItem = 3
    END
    ELSE
    BEGIN
        SET @SkipPricePolicyOfItem = 2
    END
END
IF (@SilkPrice = 0) AND (@Price = 0)
BEGIN
    PRINT 'You need to set a price, at least one !'
    PRINT 'FAILED.'
    RETURN
END
SELECT TOP 1 @ID = ID FROM _RefPackageItem ORDER BY ID DESC
SET @ID = @ID + 1
SELECT TOP 1 @INDEX = [Index] FROM _RefScrapOfPackageItem ORDER BY [Index] DESC
SET @INDEX = @INDEX + 1
SELECT TOP 1 @Slot = SlotIndex FROM _RefShopGoods WHERE RefTabCodeName = @TAB ORDER BY SlotIndex DESC
IF (@Slot = 0)
BEGIN
    SET @Slot = @Slot + 1
END
ELSE IF (@Slot > 0)
BEGIN
    SET @Slot = @Slot + 1
END
ELSE
BEGIN
    SET @Slot = 0
END
SET @DescSTRID = 'SN_' + @CodeName + '_TT_DESC'
SELECT @File = AssocFileIcon128 FROM _RefObjCommon WHERE CodeName128 = @CodeName
IF (@CodeName LIKE '%RING%' OR @CodeName LIKE '%NECKLACE%' OR @CodeName LIKE '%ARCHEMY%')
BEGIN
    SET @Data = 1
END
ELSE
BEGIN
    SELECT @Data = Dur_U FROM _RefObjItem WHERE ID = (SELECT Link FROM _RefObjCommon WHERE CodeName128 = @CodeName)
END
BEGIN TRANSACTION
IF (@SkipPackageItem = 0)
BEGIN
    SET IDENTITY_INSERT _RefPackageItem ON
    INSERT _RefPackageItem ([Service], Country, ID, CodeName128, SaleTag, ExpandTerm, NameStrID, DescStrID, AssocFileIcon, Param1, Param1_Desc128, Param2, Param2_Desc128, Param3, Param3_Desc128, Param4, Param4_Desc128) VALUES (1, 15, @ID, @PackageName, 0, 'EXPAND_TERM_ALL', 'SN_'+@CodeName, @DescSTRID, @File, -1, 'xxx', -1, 'xxx', -1, 'xxx', -1, 'xxx')
        IF (@@ERROR <> 0)  
        BEGIN
            PRINT 'AN ERROR HAPPENED WHILE ADDING TO _RefPackageItem, Rolling back...'
            ROLLBACK TRANSACTION
            RETURN
        END
    PRINT 'Added to _RefPackageItem !'
    SET IDENTITY_INSERT _RefPackageItem OFF
END
IF (@SkipScrapOfPackageItem = 0)
BEGIN
	SET IDENTITY_INSERT _RefScrapOfPackageItem ON
    INSERT _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, @PackageName, @CodeName, 0, 0, @Data, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 'xxx', -1, 'xxx', -1, 'xxx', -1, 'xxx', @INDEX)
        IF (@@ERROR <> 0)  
        BEGIN
            PRINT 'AN ERROR HAPPENED WHILE ADDING TO _RefScrapOfPackageItem, Rolling back...'
            ROLLBACK TRANSACTION
            RETURN
        END
    PRINT 'Added to _RefScrapOfPackageItem !'
    SET IDENTITY_INSERT _RefScrapOfPackageItem OFF
END
IF (@SkipPricePolicyOfItem = 2 OR @SkipPricePolicyOfItem = 0 AND @Price > 0)
BEGIN
    INSERT _RefPricePolicyOfItem (Service, Country, RefPackageItemCodeName, PaymentDevice, PreviousCost, Cost, Param1, Param1_Desc128, Param2, Param2_Desc128, Param3, Param3_Desc128, Param4, Param4_Desc128) VALUES (1, 15, @PackageName, 1, 0, @Price, -1, 'xxx', -1, 'xxx', -1, 'xxx', -1, 'xxx')
        IF (@@ERROR <> 0)  
        BEGIN
            PRINT 'AN ERROR HAPPENED WHILE ADDING TO _RefPricePolicyOfItem, Rolling back...'
            ROLLBACK TRANSACTION
            RETURN
        END
    PRINT 'Added to _RefPricePolicyOfItem, PaymentDevice = 1 (Gold)'
END
IF (@SkipPricePolicyOfItem = 1 OR @SkipPricePolicyOfItem = 0 AND @SilkPrice > 0)
BEGIN
    INSERT _RefPricePolicyOfItem (Service, Country, RefPackageItemCodeName, PaymentDevice, PreviousCost, Cost, Param1, Param1_Desc128, Param2, Param2_Desc128, Param3, Param3_Desc128, Param4, Param4_Desc128) VALUES (1, 15, @PackageName, 2, 0, @SilkPrice, -1, 'xxx', -1, 'xxx', -1, 'xxx', -1, 'xxx')
        IF (@@ERROR <> 0)  
        BEGIN
            PRINT 'AN ERROR HAPPENED WHILE ADDING TO _RefPricePolicyOfItem, Rolling back...'
            ROLLBACK TRANSACTION
            RETURN
        END
    PRINT 'Added to _RefPricePolicyOfItem, PaymentDevice = 2 (Silk)'
END
ELSE
BEGIN
    PRINT 'There is already silk / gold price, skipping _RefPricePolicyOfItem table...'
END
INSERT _RefShopGoods (Service, Country, RefTabCodeName, RefPackageItemCodeName, SlotIndex, Param1, Param1_Desc128, Param2, Param2_Desc128, Param3, Param3_Desc128, Param4, Param4_Desc128) VALUES (1, 15, @TAB, @PackageName, @Slot, -1, 'xxx', -1, 'xxx', -1, 'xxx', -1, 'xxx')
    IF (@@ERROR <> 0)  
    BEGIN
        PRINT 'An error happened while adding to _RefShopGoods table'
        PRINT 'FAILED.'
        ROLLBACK TRANSACTION
        RETURN
    END
    PRINT 'Added to _RefShopGoods, DONE!'
COMMIT TRANSACTION
Oh, and if you can help with this question too, would be great:

Regards
mayc0n is offline  
Old 04/06/2013, 16:14   #2
 
elite*gold: 0
Join Date: Jan 2013
Posts: 308
Received Thanks: 97
Do the same thing to same monster but different item.
JuliaRocks is offline  
Old 04/06/2013, 18:23   #3
 
mayc0n's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 165
Received Thanks: 4
Quote:
Originally Posted by JuliaRocks View Post
Do the same thing to same monster but different item.
lol?

This querys is to add item on npc, but only one by one...i want add more then one item in same time.
mayc0n is offline  
Old 04/07/2013, 03:27   #4
 
gigola123's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 722
Received Thanks: 390
I did it on php , pm me with your skype ^^
gigola123 is offline  
Thanks
1 User
Old 04/07/2013, 04:10   #5
 
mayc0n's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 165
Received Thanks: 4
Quote:
Originally Posted by gigola123 View Post
I did it on php , pm me with your skype ^^
Done...
mayc0n is offline  
Old 04/07/2013, 19:56   #6
 
elite*gold: 0
Join Date: Feb 2008
Posts: 340
Received Thanks: 72
I just copy what I need from txt files (because they have same structure as database tables for price,shop,package etc) and paste in Navicat
less stress for me.

But this is nice if you have to add few items to all tables at once, thx.
pushipu is offline  
Thanks
1 User
Old 04/07/2013, 19:58   #7
 
mayc0n's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 165
Received Thanks: 4
gigola123 is still busy, can someone help me in the meantime?
mayc0n is offline  
Old 04/08/2013, 20:06   #8
 
mayc0n's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 165
Received Thanks: 4
gigola123 told me some hints, i'll try late! thx
mayc0n is offline  
Thanks
1 User
Old 04/09/2013, 21:50   #9
 
gigola123's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 722
Received Thanks: 390
Quote:
Originally Posted by mayc0n View Post
gigola123 told me some hints, i'll try late! thx
No prob
gigola123 is offline  
Reply


Similar Threads Similar Threads
Add Item to NPC Query
12/16/2016 - SRO Guides & Templates - 13 Replies
if someone needs it, use it - will faster many things up :) and you'll get punished for sloppy done work in the past. 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*/ --## <--
need query add item in char
09/16/2012 - SRO Private Server - 3 Replies
hi all im need query for add item in char by code item and char name
INSERT INTO Item Query?
01/07/2012 - Flyff Private Server - 4 Replies
Gibts ne query um items direkt per query ins inventory / als mail zu senden? Insanityflyff hat dieses ja zB,wenn man ein item auf der homepage auswählt,wirds sofort ins inventory gepackt.. kennt wer den oder einen ähnlichen query :/?
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 = .



All times are GMT +1. The time now is 22:19.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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