Query add drops to mobs by city name

NESTA3

V.I.P
SQL Developer
عضو
2 فبراير 2017
318
2
142
244
Egypt

المستوي:

الرابط مخفي تسجيل الدخول او تسجيل !!
الرابط مخفي تسجيل الدخول او تسجيل !!

بما انى لقيت كذا حد عايز يضيف Drops للوحوش بإسم المدينة
قررت أعملها وأفيدهم بيها
إتفضلوا
PHP:
USE SRO_VT_SHARD 
DECLARE @Place VARCHAR(MAX),@Drop VARCHAR(MAX),@Rate real,@rows int = 0,@MinAmount int,@MaxAmount int,@RowsCount int 
,@MobCode varchar(max),@ID int,@ItemID int 
------------------------------------------------------------------------------- 
SET @Place     = 'JG'    -- your desired area Jangan = JG, Donwhang = DW, Hotan = HT, Alex = AX, JobTemple = TP 
SET @Drop      = 'ITEM_' --Item CodeName 
SET @Rate      = '1'     -- Drop Rate 
SET @MinAmount = '1'      --Minimum amount of item 
SET @MaxAmount = '1'      --Max amount of item 
------------------------------------------------------------------------------- 
IF @Place = 'JG' 
BEGIN 
SET @RowsCount = (SELECT COUNT(CodeName128) From _RefObjCommon where id in  
(select dwobjid from Tab_RefTactics where dwTacticsID in 
(select dwTacticsID from Tab_RefNest where nRegionDBID in 
(select wregionid from _refregion where ContinentName like 'CHINA'))) and CodeName128 like '%MOB_%') 
while (@rows < @RowsCount) BEGIN 
set @MobCode = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @rows) 
set @ID = (select ID from _refobjcommon where CodeName128 = @MobCode)  
set @ItemID = (Select id from _RefObjCommon where CodeName128 = @Drop) 
INSERT _RefMonster_AssignedItemDrop VALUES (@ID,@ItemID,0,0,@MinAmount,@MaxAmount,@Rate,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'xxx') 
END 
Print ''+@Drop+' has been added to Jangan Mobs Successfully!' 
END 
ELSE IF @Place = 'DW' 
BEGIN 
SET @RowsCount = (SELECT COUNT(CodeName128) From _RefObjCommon where id in  
(select dwobjid from Tab_RefTactics where dwTacticsID in 
(select dwTacticsID from Tab_RefNest where nRegionDBID in 
(select wregionid from _refregion where ContinentName like 'West_China'))) and CodeName128 like '%MOB_%') 
while (@rows < @RowsCount) BEGIN 
set @MobCode = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @rows) 
set @ID = (select ID from _refobjcommon where CodeName128 = @MobCode)  
set @ItemID = (Select id from _RefObjCommon where CodeName128 = @Drop) 
INSERT _RefMonster_AssignedItemDrop VALUES (@ID,@ItemID,0,0,@MinAmount,@MaxAmount,@Rate,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'xxx') 
END 
Print ''+@Drop+' has been added to Donwhang Mobs Successfully!' 
END 
ELSE IF @Place = 'HT' 
BEGIN 
SET @RowsCount = (SELECT COUNT(CodeName128) From _RefObjCommon where id in  
(select dwobjid from Tab_RefTactics where dwTacticsID in 
(select dwTacticsID from Tab_RefNest where nRegionDBID in 
(select wregionid from _refregion where ContinentName like 'Oasis_Kingdom'))) and CodeName128 like '%MOB_%') 
while (@rows < @RowsCount) BEGIN 
set @MobCode = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @rows) 
set @ID = (select ID from _refobjcommon where CodeName128 = @MobCode)  
set @ItemID = (Select id from _RefObjCommon where CodeName128 = @Drop) 
INSERT _RefMonster_AssignedItemDrop VALUES (@ID,@ItemID,0,0,@MinAmount,@MaxAmount,@Rate,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'xxx') 
END 
END 
ELSE IF @Place = 'AX' 
BEGIN 
SET @RowsCount = (SELECT COUNT(CodeName128) From _RefObjCommon where id in  
(select dwobjid from Tab_RefTactics where dwTacticsID in 
(select dwTacticsID from Tab_RefNest where nRegionDBID in 
(select wregionid from _refregion where ContinentName like '%DELTA%' or ContinentName like '%SD%' or ContinentName like '%Pharaoh%' or ContinentName like '%KingsValley%'))) and CodeName128 like '%MOB_%') 
while (@rows < @RowsCount) BEGIN 
set @MobCode = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @rows) 
set @ID = (select ID from _refobjcommon where CodeName128 = @MobCode)  
set @ItemID = (Select id from _RefObjCommon where CodeName128 = @Drop) 
INSERT _RefMonster_AssignedItemDrop VALUES (@ID,@ItemID,0,0,@MinAmount,@MaxAmount,@Rate,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'xxx') 
END 
Print ''+@Drop+' has been added to Alexandria Mobs Successfully!' 
END 
ELSE IF @Place = 'TP' 
BEGIN 
SET @RowsCount = (SELECT COUNT(CodeName128) From _RefObjCommon where id in  
(select dwobjid from Tab_RefTactics where dwTacticsID in 
(select dwTacticsID from Tab_RefNest where nRegionDBID in 
(select wregionid from _refregion where ContinentName like '%TEMPLE%'))) and CodeName128 like '%MOB_%') 
while (@rows < @RowsCount) BEGIN 
set @MobCode = (SELECT CodeName128 FROM _RefObjCommon WHERE ID = @rows) 
set @ID = (select ID from _refobjcommon where CodeName128 = @MobCode)  
set @ItemID = (Select id from _RefObjCommon where CodeName128 = @Drop) 
INSERT _RefMonster_AssignedItemDrop VALUES (@ID,@ItemID,0,0,@MinAmount,@MaxAmount,@Rate,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'xxx') 
END 
Print ''+@Drop+' has been added to Temple Mobs Successfully!' 
END 
ELSE  
PRINT 'You wrote a wrong place name'