Welcome to the RaGEZONE - MMORPG development forums.

Add Item to NPC

This is a discussion on Add Item to NPC within the SilkRoad Releases forums, part of the SilkRoad Online category; Works fine, but only for the first item. If i want to add a new item after i closed mssql ...

Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
  1. #16
    Newbie
    Rank
    Member
    Join Date
    Dec 2011
    Posts
    4
    Liked
    0

    Re: [Release] Add Item to NPC

    Click
    Works fine, but only for the first item.
    If i want to add a new item after i closed mssql i got this strange errors:

    Meldung 2627, Ebene 14, Status 1, Zeile 21
    Violation of PRIMARY KEY constraint 'PK__RefPackageItem'. Cannot insert duplicate key in object 'dbo._RefPackageItem'.
    The statement has been terminated.

    (1 Zeile(n) betroffen)
    Meldung 2627, Ebene 14, Status 1, Zeile 79
    Violation of PRIMARY KEY constraint 'PK__RefPricePolicyOfItem'. Cannot insert duplicate key in object 'dbo._RefPricePolicyOfItem'.
    The statement has been terminated.

    Meldung 2627, Ebene 14, Status 1, Zeile 100
    Violation of PRIMARY KEY constraint 'PK__RefShopGoods_renewal'. Cannot insert duplicate key in object 'dbo._RefShopGoods'.
    The statement has been terminated.


    Any solutions?


    edit
    omg forgot to count id up -.- :D
    Last edited by loli89; 21-12-11 at 08:37 AM.

  2. #17
    Hardcore Member
    Rank
    Member
    Join Date
    Sep 2011
    Posts
    112
    Liked
    102

    Re: [Release] Add Item to NPC

    Quote Originally Posted by loli89 View Post
    Works fine, but only for the first item.
    If i want to add a new item after i closed mssql i got this strange errors:

    Meldung 2627, Ebene 14, Status 1, Zeile 21
    Violation of PRIMARY KEY constraint 'PK__RefPackageItem'. Cannot insert duplicate key in object 'dbo._RefPackageItem'.
    The statement has been terminated.

    (1 Zeile(n) betroffen)
    Meldung 2627, Ebene 14, Status 1, Zeile 79
    Violation of PRIMARY KEY constraint 'PK__RefPricePolicyOfItem'. Cannot insert duplicate key in object 'dbo._RefPricePolicyOfItem'.
    The statement has been terminated.

    Meldung 2627, Ebene 14, Status 1, Zeile 100
    Violation of PRIMARY KEY constraint 'PK__RefShopGoods_renewal'. Cannot insert duplicate key in object 'dbo._RefShopGoods'.
    The statement has been terminated.


    Any solutions?


    edit
    omg forgot to count id up -.- :D
    Also check if that item exist bevore. Maybe if someone knows mssql more then me smthing like
    if (CodeName128 = exist) execute code

    or something like that.

    Join my Server now! ;)

  3. #18
    #Yummi.sql
    Rank
    Member +
    Join Date
    Sep 2011
    Location
    Germany
    Posts
    409
    Liked
    269

    Re: [Release] Add Item to NPC

    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 (74SET @CodeName = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @ItemID)

    /* Which Itemdata.txt is affected in the Media.pk2*/
    Declare @newItemID varchar(5)
    Declare @
    lastPrice varchar(25SET @lastPrice = (SELECT Price FROM _RefObjCommon WHERE ID = @ItemID)
    Declare @
    yourPriceCHAR varchar(25SET @yourPriceCHAR = @yourPrice
    IF (@ItemID 5000SET @newItemID 5000
    else if (@ItemID 10000SET @newItemID 10000
    else if (@ItemID 15000SET @newItemID 15000
    else if (@ItemID 20000SET @newItemID 20000
    else if (@ItemID 25000SET @newItemID 25000
    else if (@ItemID 30000SET @newItemID 30000
    else if (@ItemID 35000SET @newItemID 35000
    else if (@ItemID 40000SET @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(74SET @SN = (SELECT NameStrID128 FROM _RefObjCommon WHERE ID = @ItemID)
    Declare @
    DESC varchar(74SET @Desc = (SELECT DescStrID128 FROM _RefObjCommon WHERE ID = @ItemID)
    Declare @
    DDJ varchar(74SET @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 (10SET @TOPID = (SELECT MAX(IDFROM _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 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(15SET @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(15SET @newSLOTINDEX = (SELECT MAX(SlotIndexFROM _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!' 
    Hean likes this.
    I dun like Signatures, they're always confusing me while reading a thread!

  4. #19
    Registered
    Rank
    Member
    Join Date
    Nov 2011
    Posts
    17
    Liked
    0

    Re: [Release] Add Item to NPC

    nice jop ^^

  5. #20
    Member
    Rank
    Member
    Join Date
    Aug 2010
    Posts
    51
    Liked
    0

    Re: [Release] Add Item to NPC

    Thank you bro

  6. #21
    Registered
    Rank
    Member
    Join Date
    May 2011
    Posts
    8
    Liked
    0

    Re: [Release] Add Item to NPC

    Please RE-upload

  7. #22
    Member
    Rank
    Member
    Join Date
    Dec 2011
    Posts
    64
    Liked
    21

    Re: [Release] Add Item to NPC

    Please RE-upload²

  8. #23
    Registered
    Rank
    Member
    Join Date
    Dec 2011
    Posts
    15
    Liked
    0

    Re: [Release] Add Item to NPC

    Please , upload it at Mediafire or any thing alse
    cuz , Multiupload not working :(

  9. #24
    Member
    Rank
    Member
    Join Date
    Jan 2012
    Posts
    43
    Liked
    3

    Re: [Release] Add Item to NPC

    reupload please Multiupload doesn't work :(

  10. #25
    Member
    Rank
    Member
    Join Date
    Nov 2011
    Posts
    75
    Liked
    2

    Re: [Release] Add Item to NPC

    reupload plz

  11. #26
    Member
    Rank
    Member
    Join Date
    Jan 2012
    Posts
    43
    Liked
    3

    Re: [Release] Add Item to NPC

    Quote Originally Posted by Caipi View Post
    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 (74SET @CodeName = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @ItemID)

    /* Which Itemdata.txt is affected in the Media.pk2*/
    Declare @newItemID varchar(5)
    Declare @
    lastPrice varchar(25SET @lastPrice = (SELECT Price FROM _RefObjCommon WHERE ID = @ItemID)
    Declare @
    yourPriceCHAR varchar(25SET @yourPriceCHAR = @yourPrice
    IF (@ItemID 5000SET @newItemID 5000
    else if (@ItemID 10000SET @newItemID 10000
    else if (@ItemID 15000SET @newItemID 15000
    else if (@ItemID 20000SET @newItemID 20000
    else if (@ItemID 25000SET @newItemID 25000
    else if (@ItemID 30000SET @newItemID 30000
    else if (@ItemID 35000SET @newItemID 35000
    else if (@ItemID 40000SET @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(74SET @SN = (SELECT NameStrID128 FROM _RefObjCommon WHERE ID = @ItemID)
    Declare @
    DESC varchar(74SET @Desc = (SELECT DescStrID128 FROM _RefObjCommon WHERE ID = @ItemID)
    Declare @
    DDJ varchar(74SET @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 (10SET @TOPID = (SELECT MAX(IDFROM _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 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(15SET @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(15SET @newSLOTINDEX = (SELECT MAX(SlotIndexFROM _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!' 
    can you explain with video or something please

  12. #27
    ✗ ¤ Kira ¤ ✗
    Rank
    Member +
    Join Date
    Nov 2011
    Location
    ✗¤EGYPT¤✗
    Posts
    570
    Liked
    129

    Re: [Release] Add Item to NPC

    Just Like :P

    Here u Go
    My Baby Coming soon in this world I'm so happy

  13. #28
    Member
    Rank
    Member
    Join Date
    Oct 2011
    Location
    Egypt
    Posts
    35
    Liked
    3

    Re: [Release] Add Item to NPC

    multiupload is down :( could you reupload it.. mediafire?
    PRESS LIKE IF I HELPED, DONT BE SUCH A FOOL LEARN & RUN!!
    Ultra Online Owner

  14. #29
    ✗ ¤ Kira ¤ ✗
    Rank
    Member +
    Join Date
    Nov 2011
    Location
    ✗¤EGYPT¤✗
    Posts
    570
    Liked
    129

    Re: [Release] Add Item to NPC

    Quote Originally Posted by BD001 View Post
    multiupload is down :( could you reupload it.. mediafire?
    Here u Go
    Just Like :P
    My Baby Coming soon in this world I'm so happy

  15. #30
    Member
    Rank
    Member
    Join Date
    Jan 2012
    Posts
    43
    Liked
    3

    Re: [Release] Add Item to NPC

    is this program adding items automatically or what??
    can anyone please tell me how to add items to NPC from the DB

 

 
Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •