[RELEASE - QUERY] Clone Mob and Item

06/17/2024 20:42 yoneh1#1
Hey Guys,
I wanted to be able to clone mobs and items and keep the original stats so I can do my modifications 1 by 1.

It takes the ID of the MOB or ITEM in RefObjCommon and clones it with new Link and ID in refobj Item/Char

Usage

Exec _CloneItem ID, NEWCODENAME128

exec _CloneMob ID,NEWCODENAME128

Enjoy!

PHP Code:
USE [Y0GI]
GO
/****** Object:  StoredProcedure [dbo].[_CloneItem]    Script Date: 6/17/2024 11:42:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE 
[dbo].[_CloneItem]
    @
OriginalItemID INT,
    @
NewCodeName128 VARCHAR(129)
AS
BEGIN
    SET NOCOUNT ON
;

    DECLARE @
NewCommonID INT;
    DECLARE @
NewItemID INT;

    -- 
Step 1Get the new IDs for _RefObjCommon and _RefObjItem
    SELECT 
@NewCommonID MAX(ID) + 1 FROM [SRO_VT_SHARD].[dbo].[_RefObjCommon];
    
SELECT @NewItemID MAX(ID) + 1 FROM [SRO_VT_SHARD].[dbo].[_RefObjItem];

    -- 
Step 2Insert the new row into _RefObjCommon
    INSERT INTO 
[SRO_VT_SHARD].[dbo].[_RefObjCommon] (
        [
ID], [Service], [CodeName128], [ObjName128], [OrgObjCodeName128], [NameStrID128], [DescStrID128], 
        [
CashItem], [Bionic], [TypeID1], [TypeID2], [TypeID3], [TypeID4], [DecayTime], [Country], 
        [
Rarity], [CanTrade], [CanSell], [CanBuy], [CanBorrow], [CanDrop], [CanPick], [CanRepair], 
        [
CanRevive], [CanUse], [CanThrow], [Price], [CostRepair], [CostRevive], [CostBorrow], 
        [
KeepingFee], [SellPrice], [ReqLevelType1], [ReqLevel1], [ReqLevelType2], [ReqLevel2], 
        [
ReqLevelType3], [ReqLevel3], [ReqLevelType4], [ReqLevel4], [MaxContain], [RegionID], [Dir], 
        [
OffsetX], [OffsetY], [OffsetZ], [Speed1], [Speed2], [Scale], [BCHeight], [BCRadius], 
        [
EventID], [AssocFileObj128], [AssocFileDrop128], [AssocFileIcon128], [AssocFile1_128], 
        [
AssocFile2_128], [Link], [webNumber], [webName]
    )
    
SELECT 
        
@NewCommonID, [Service], @NewCodeName128, [ObjName128], [OrgObjCodeName128], [NameStrID128], [DescStrID128], 
        [
CashItem], [Bionic], [TypeID1], [TypeID2], [TypeID3], [TypeID4], [DecayTime], [Country], 
        [
Rarity], [CanTrade], [CanSell], [CanBuy], [CanBorrow], [CanDrop], [CanPick], [CanRepair], 
        [
CanRevive], [CanUse], [CanThrow], [Price], [CostRepair], [CostRevive], [CostBorrow], 
        [
KeepingFee], [SellPrice], [ReqLevelType1], [ReqLevel1], [ReqLevelType2], [ReqLevel2], 
        [
ReqLevelType3], [ReqLevel3], [ReqLevelType4], [ReqLevel4], [MaxContain], [RegionID], [Dir], 
        [
OffsetX], [OffsetY], [OffsetZ], [Speed1], [Speed2], [Scale], [BCHeight], [BCRadius], 
        [
EventID], [AssocFileObj128], [AssocFileDrop128], [AssocFileIcon128], [AssocFile1_128], 
        [
AssocFile2_128], @NewItemID, [webNumber], [webName]
    
FROM [SRO_VT_SHARD].[dbo].[_RefObjCommon]
    
WHERE [ID] = @OriginalItemID

    
-- Step 3Insert the new row into _RefObjItem
    INSERT INTO 
[SRO_VT_SHARD].[dbo].[_RefObjItem] (
        [
ID], [MaxStack], [ReqGender], [ReqStr], [ReqInt], [ItemClass], [SetID], [Dur_L], [Dur_U], [PD_L], 
        [
PD_U], [PDInc], [ER_L], [ER_U], [ERInc], [PAR_L], [PAR_U], [PARInc], [BR_L], [BR_U], [MD_L], 
        [
MD_U], [MDInc], [MAR_L], [MAR_U], [MARInc], [PDStr_L], [PDStr_U], [MDInt_L], [MDInt_U], 
        [
Quivered], [Ammo1_TID4], [Ammo2_TID4], [Ammo3_TID4], [Ammo4_TID4], [Ammo5_TID4], [SpeedClass], 
        [
TwoHanded], [Range], [PAttackMin_L], [PAttackMin_U], [PAttackMax_L], [PAttackMax_U], [PAttackInc], 
        [
MAttackMin_L], [MAttackMin_U], [MAttackMax_L], [MAttackMax_U], [MAttackInc], [PAStrMin_L], 
        [
PAStrMin_U], [PAStrMax_L], [PAStrMax_U], [MAInt_Min_L], [MAInt_Min_U], [MAInt_Max_L], [MAInt_Max_U], 
        [
HR_L], [HR_U], [HRInc], [CHR_L], [CHR_U], [Param1], [Desc1_128], [Param2], [Desc2_128], [Param3], 
        [
Desc3_128], [Param4], [Desc4_128], [Param5], [Desc5_128], [Param6], [Desc6_128], [Param7], 
        [
Desc7_128], [Param8], [Desc8_128], [Param9], [Desc9_128], [Param10], [Desc10_128], [Param11], 
        [
Desc11_128], [Param12], [Desc12_128], [Param13], [Desc13_128], [Param14], [Desc14_128], [Param15], 
        [
Desc15_128], [Param16], [Desc16_128], [Param17], [Desc17_128], [Param18], [Desc18_128], [Param19], 
        [
Desc19_128], [Param20], [Desc20_128], [MaxMagicOptCount], [ChildItemCount], [Link]
    )
    
SELECT 
        
@NewItemID, [MaxStack], [ReqGender], [ReqStr], [ReqInt], [ItemClass], [SetID], [Dur_L], [Dur_U], [PD_L], 
        [
PD_U], [PDInc], [ER_L], [ER_U], [ERInc], [PAR_L], [PAR_U], [PARInc], [BR_L], [BR_U], [MD_L], 
        [
MD_U], [MDInc], [MAR_L], [MAR_U], [MARInc], [PDStr_L], [PDStr_U], [MDInt_L], [MDInt_U], 
        [
Quivered], [Ammo1_TID4], [Ammo2_TID4], [Ammo3_TID4], [Ammo4_TID4], [Ammo5_TID4], [SpeedClass], 
        [
TwoHanded], [Range], [PAttackMin_L], [PAttackMin_U], [PAttackMax_L], [PAttackMax_U], [PAttackInc], 
        [
MAttackMin_L], [MAttackMin_U], [MAttackMax_L], [MAttackMax_U], [MAttackInc], [PAStrMin_L], 
        [
PAStrMin_U], [PAStrMax_L], [PAStrMax_U], [MAInt_Min_L], [MAInt_Min_U], [MAInt_Max_L], [MAInt_Max_U], 
        [
HR_L], [HR_U], [HRInc], [CHR_L], [CHR_U], [Param1], [Desc1_128], [Param2], [Desc2_128], [Param3], 
        [
Desc3_128], [Param4], [Desc4_128], [Param5], [Desc5_128], [Param6], [Desc6_128], [Param7], 
        [
Desc7_128], [Param8], [Desc8_128], [Param9], [Desc9_128], [Param10], [Desc10_128], [Param11], 
        [
Desc11_128], [Param12], [Desc12_128], [Param13], [Desc13_128], [Param14], [Desc14_128], [Param15], 
        [
Desc15_128], [Param16], [Desc16_128], [Param17], [Desc17_128], [Param18], [Desc18_128], [Param19], 
        [
Desc19_128], [Param20], [Desc20_128], [MaxMagicOptCount], [ChildItemCount], [Link]
    
FROM [SRO_VT_SHARD].[dbo].[_RefObjItem]
    
WHERE [ID] = (SELECT Link FROM [SRO_VT_SHARD].[dbo].[_RefObjCommonWHERE [ID] = @OriginalItemID)
END
PHP Code:
USE [Y0GI]
GO
/****** Object:  StoredProcedure [dbo].[_CloneMob]    Script Date: 6/17/2024 11:42:24 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE 
[dbo].[_CloneMob]
    @
OriginalMobID INT,
    @
NewCodeName128 VARCHAR(129)
AS
BEGIN
    SET NOCOUNT ON
;

    DECLARE @
NewCommonID INT;
    DECLARE @
NewMobID INT;

    -- 
Step 1Get the new IDs for _RefObjCommon and _RefObjChar
    SELECT 
@NewCommonID MAX(ID) + 1 FROM [SRO_VT_SHARD].[dbo].[_RefObjCommon];
    
SELECT @NewMobID MAX(ID) + 1 FROM [SRO_VT_SHARD].[dbo].[_RefObjChar];

    -- 
Step 2Insert the new row into _RefObjCommon
    INSERT INTO 
[SRO_VT_SHARD].[dbo].[_RefObjCommon] (
        [
ID], [Service], [CodeName128], [ObjName128], [OrgObjCodeName128], [NameStrID128], [DescStrID128], 
        [
CashItem], [Bionic], [TypeID1], [TypeID2], [TypeID3], [TypeID4], [DecayTime], [Country], 
        [
Rarity], [CanTrade], [CanSell], [CanBuy], [CanBorrow], [CanDrop], [CanPick], [CanRepair], 
        [
CanRevive], [CanUse], [CanThrow], [Price], [CostRepair], [CostRevive], [CostBorrow], 
        [
KeepingFee], [SellPrice], [ReqLevelType1], [ReqLevel1], [ReqLevelType2], [ReqLevel2], 
        [
ReqLevelType3], [ReqLevel3], [ReqLevelType4], [ReqLevel4], [MaxContain], [RegionID], [Dir], 
        [
OffsetX], [OffsetY], [OffsetZ], [Speed1], [Speed2], [Scale], [BCHeight], [BCRadius], 
        [
EventID], [AssocFileObj128], [AssocFileDrop128], [AssocFileIcon128], [AssocFile1_128], 
        [
AssocFile2_128], [Link], [webNumber], [webName]
    )
    
SELECT 
        
@NewCommonID, [Service], @NewCodeName128, [ObjName128], [OrgObjCodeName128], [NameStrID128], [DescStrID128], 
        [
CashItem], [Bionic], [TypeID1], [TypeID2], [TypeID3], [TypeID4], [DecayTime], [Country], 
        [
Rarity], [CanTrade], [CanSell], [CanBuy], [CanBorrow], [CanDrop], [CanPick], [CanRepair], 
        [
CanRevive], [CanUse], [CanThrow], [Price], [CostRepair], [CostRevive], [CostBorrow], 
        [
KeepingFee], [SellPrice], [ReqLevelType1], [ReqLevel1], [ReqLevelType2], [ReqLevel2], 
        [
ReqLevelType3], [ReqLevel3], [ReqLevelType4], [ReqLevel4], [MaxContain], [RegionID], [Dir], 
        [
OffsetX], [OffsetY], [OffsetZ], [Speed1], [Speed2], [Scale], [BCHeight], [BCRadius], 
        [
EventID], [AssocFileObj128], [AssocFileDrop128], [AssocFileIcon128], [AssocFile1_128], 
        [
AssocFile2_128], @NewMobID, [webNumber], [webName]
    
FROM [SRO_VT_SHARD].[dbo].[_RefObjCommon]
    
WHERE [ID] = @OriginalMobID

    
-- Step 3Insert the new row into _RefObjChar
    INSERT INTO 
[SRO_VT_SHARD].[dbo].[_RefObjChar] (
        [
ID], [Lvl], [CharGender], [MaxHP], [MaxMP], [ResistFrozen], [ResistFrostbite], [ResistBurn], 
        [
ResistEShock], [ResistPoison], [ResistZombie], [ResistSleep], [ResistRoot], [ResistSlow], 
        [
ResistFear], [ResistMyopia], [ResistBlood], [ResistStone], [ResistDark], [ResistStun], 
        [
ResistDisea], [ResistChaos], [ResistCsePD], [ResistCseMD], [ResistCseSTR], [ResistCseINT], 
        [
ResistCseHP], [ResistCseMP], [Resist24], [ResistBomb], [Resist26], [Resist27], [Resist28], 
        [
Resist29], [Resist30], [Resist31], [Resist32], [InventorySize], [CanStore_TID1], 
        [
CanStore_TID2], [CanStore_TID3], [CanStore_TID4], [CanBeVehicle], [CanControl], 
        [
DamagePortion], [MaxPassenger], [AssocTactics], [PD], [MD], [PAR], [MAR], [ER], [BR], [HR], 
        [
CHR], [ExpToGive], [CreepType], [Knockdown], [KO_RecoverTime], [DefaultSkill_1], [DefaultSkill_2], 
        [
DefaultSkill_3], [DefaultSkill_4], [DefaultSkill_5], [DefaultSkill_6], [DefaultSkill_7], 
        [
DefaultSkill_8], [DefaultSkill_9], [DefaultSkill_10], [TextureType], [Except_1], [Except_2], 
        [
Except_3], [Except_4], [Except_5], [Except_6], [Except_7], [Except_8], [Except_9], [Except_10], 
        [
Link]
    )
    
SELECT 
        
@NewMobID, [Lvl], [CharGender], [MaxHP], [MaxMP], [ResistFrozen], [ResistFrostbite], [ResistBurn], 
        [
ResistEShock], [ResistPoison], [ResistZombie], [ResistSleep], [ResistRoot], [ResistSlow], 
        [
ResistFear], [ResistMyopia], [ResistBlood], [ResistStone], [ResistDark], [ResistStun], 
        [
ResistDisea], [ResistChaos], [ResistCsePD], [ResistCseMD], [ResistCseSTR], [ResistCseINT], 
        [
ResistCseHP], [ResistCseMP], [Resist24], [ResistBomb], [Resist26], [Resist27], [Resist28], 
        [
Resist29], [Resist30], [Resist31], [Resist32], [InventorySize], [CanStore_TID1], 
        [
CanStore_TID2], [CanStore_TID3], [CanStore_TID4], [CanBeVehicle], [CanControl], 
        [
DamagePortion], [MaxPassenger], [AssocTactics], [PD], [MD], [PAR], [MAR], [ER], [BR], [HR], 
        [
CHR], [ExpToGive], [CreepType], [Knockdown], [KO_RecoverTime], [DefaultSkill_1], [DefaultSkill_2], 
        [
DefaultSkill_3], [DefaultSkill_4], [DefaultSkill_5], [DefaultSkill_6], [DefaultSkill_7], 
        [
DefaultSkill_8], [DefaultSkill_9], [DefaultSkill_10], [TextureType], [Except_1], [Except_2], 
        [
Except_3], [Except_4], [Except_5], [Except_6], [Except_7], [Except_8], [Except_9], [Except_10], 
        [
Link]
    
FROM [SRO_VT_SHARD].[dbo].[_RefObjChar]
    
WHERE [ID] = (SELECT Link FROM [SRO_VT_SHARD].[dbo].[_RefObjCommonWHERE [ID] = @OriginalMobID)
END
If you find this usefull, please hit thanks!:D
06/18/2024 11:36 OKeks#2
Thanks for sharing, however you forgot about other important tables:

General tables:
Tactics Table
Hive Table
Skills Table
Extra Skills Table
AI Skills table

Autospawn table:
Nest Table

You also did not make sure, that you use a reference to the old mob. If you do not add it, you cannot use ingame sounds and skilleffect with your clone mob. Your mob will use a charmodel instead, using human sounds / size / animations.

You can find a txt file attached. This will give almost every information, you only need to query for AI Skills and Extra Skills. I am sure, this will help you to enhance your query to use all needed tables.

To create a reference you need to put the original mob name into RefCommon "Basic_Original" column. Or you clone the entries for inside Skilleffect and sound files too.
06/18/2024 15:37 yoneh1#3
Quote:
Originally Posted by OKeks View Post
Thanks for sharing, however you forgot about other important tables:

General tables:
Tactics Table
Hive Table
Skills Table
Extra Skills Table
AI Skills table

Autospawn table:
Nest Table

You also did not make sure, that you use a reference to the old mob. If you do not add it, you cannot use ingame sounds and skilleffect with your clone mob. Your mob will use a charmodel instead, using human sounds / size / animations.

You can find a txt file attached. This will give almost every information, you only need to query for AI Skills and Extra Skills. I am sure, this will help you to enhance your query to use all needed tables.

To create a reference you need to put the original mob name into RefCommon "Basic_Original" column. Or you clone the entries for inside Skilleffect and sound files too.
Hey Okeks !
Thanks for the reply. I’m just getting started!!

Although you may be correct that I am in fact completely missing refskill and tactics tables because my use for this proc was to clone a mob and keep everything identical except for the code name128 so I can change some things around.

What you did bring to light is the fact that I fully missed the skilleffect. But this would need some manual input.

The intended purpose for this tool is to have a working platform for a mob and then make all modifications on skilleffect / textdata object . (Or on the db if you know how)

It’s just a quick and dirty way to edit something and not break the original.

I think what I can do is add some skill customization options and the ability to add the spawn with a char name!