عرض مشاركة واحدة
قديم 12-09-2014, 12:31 PM   #2

Hero
عضو مشارك



الصورة الرمزية Hero


• الانـتـسـاب » Jan 2014
• رقـم العـضـويـة » 116050
• المشـــاركـات » 7,017
• الـدولـة » Egypt
• الـهـوايـة » ;"#string n = "C
• اسـم الـسـيـرفـر » No Server
• الـجـنـس » Male
• نقـاط التقييم » 85
Hero جـيـد

Hero غير متواجد حالياً



افتراضي



ايوة يا باشا اتفضل اعمل الكورى دة هتعمل +250
كود PHP:
USE [SRO_VT_SHARD]
GO
/****** Object:  StoredProcedure [dbo].[_SMC_ADD_ITEM]    Script Date: 05/19/2012 06:27:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO


----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
-- 
20_SMC__ShardDB.sql  _SMC_ADD_ITEM ¼أ¶أپ¤ 
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------

 -----------------------------------------------------------------------  
ALTER       procedure [dbo].[_SMC_ADD_ITEM]  
----------------------------------------------------- 
params to find target item  
 
@TargetStorage int,  /* 0 = inventory, 1 = chest , 2 = guild chest, 3 = Avatar Inventory */  
 
@OwnerName varchar(128),  
 ----------------------------------------------------- 
params to modify the item  
 
@RefItemID  int,  
 @
OptLvl   tinyint,  
 @
Variance  bigint,  
 @
Data   int,  
 @
szCreater  varchar(32),  
 @
MagParamNum int,  
 @
MagParam1 bigint,  
 @
MagParam2 bigint,  
 @
MagParam3 bigint,  
 @
MagParam4 bigint,  
 @
MagParam5 bigint,  
 @
MagParam6 bigint,  
 @
MagParam7 bigint,  
 @
MagParam8 bigint,  
 @
MagParam9 bigint,  
 @
MagParam10 bigint,  
 @
MagParam11 bigint,  
 @
MagParam12 bigint  
as  
 ----------------------------------------------------  
 -- 
step 1. check validity of parameters  
 
----------------------------------------------------  
 if (@
TargetStorage <> and @TargetStorage <> and @TargetStorage <> and @TargetStorage <> 3)  
 
begin  
  select 
-1cast(as bigint), cast(as bigint) -- invalid target storage  
  
return  
 
end  
 
declare @ownerid int  
 
declare @ItemID bigint  
 set 
@ownerid 0  
 set 
@ItemID 0  
 
declare @empty_slot int  
 set 
@empty_slot = -1  
 
if (@TargetStorage 0)  
 
begin  
  select 
@ownerid charid from _char where charname16 = @OwnerName  
  
if (@@rowcount or @ownerid or @ownerid is null)  
  
begin  
   select 
-2cast(as bigint), cast(as bigint)-- can't find owner  
   return  
  end  
  
  select top 1 @empty_slot = slot from _inventory   
  where charid = @ownerid and slot >= 13   
   and itemid = 0   
   and slot < (select top 1 InventorySize from _Char where CharID = @ownerid)  
  order by slot asc  
  
  if (@@rowcount = 0)  
  begin  
   select -3, cast(0 as bigint), cast(0 as bigint) -- inventory full  
   return  
  end  
 end  
 else if (@TargetStorage = 1)  
 begin  
  select @ownerid = JID from _AccountJID where AccountID = @ownername  
  if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null)  
  begin  
   select -2, cast(0 as bigint), cast(0 as bigint) -- can'
t find owner  
   
return  
  
end  
  select top 1 
@empty_slot slot from _chest where userjid = @ownerid and (itemid or ItemID is nullorder by slot asc  
  
if (@@rowcount 0)  
  
begin  
   select 
-3cast(as bigint), cast(as bigint) -- chest full  
   
return  
  
end  
 end  
 
else if (@TargetStorage 2)  
 
begin  
  select 
@ownerid = [IDfrom _guild where [name] = @ownername  
  
if (@@rowcount or @ownerid or @ownerid is null)  
  
begin  
   select 
-2cast(as bigint), cast(as bigint) -- can't find owner  
   return  
  end   
  select top 1 @empty_slot = slot from _guildchest where guildid = @ownerid and (itemid = 0 or ItemID is null) order by slot asc  
  if (@@rowcount = 0)  
  begin  
   select -3, cast(0 as bigint), cast(0 as bigint) -- chest full  
   return  
  end   
    
  -- ±أ¦µأ¥ ·¹آ؛§آ؟آ، µû¸¥ ±أ¦µأ¥ ½½·أ”¼أ¶ أپ¦أ‡أ‘أ€» أˆ®أ€أژأ‡أڈأ€أڑ.  
  declare @lvl tinyint  
  declare @max_slot tinyint  
  select @lvl = Lvl from _guild where [id] = @ownerid  
  set @max_slot = 30 * (@lvl - 1) - 1  
  
  if @empty_slot > @max_slot   
  begin  
   select -3, cast(0 as bigint), cast(0 as bigint) -- chest full  
   return  
  end      
 end  
 else  
 begin  
  select @ownerid = charid from _char where charname16 = @OwnerName  
  if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null)  
  begin  
   select -2, cast(0 as bigint), cast(0 as bigint)-- can'
t find owner  
   
return  
  
end  
  
  select top 1 
@empty_slot slot from _InventoryForAvatar  
  where charid 
= @ownerid  
   
and itemid 0   
   
and slot 4     -- أ‡أپ·أژ½أƒأپ® أ‡أڈµأ¥أ„أڑµù(¾أ†¹أ™أ…¸ ½½·أ”أ€آ؛ 0123أ€أŒ´أ™.)  
  
order by slot asc  
  
  
if (@@rowcount 0)  
  
begin  
   select 
-3cast(as bigint), cast(as bigint) -- inventory full  
   
return  
  
end  
 end  
   
  
 
if (@empty_slot or @empty_slot is null)  
 
begin   
  select 
-4cast(as bigint), cast(as bigint)  -- unknown error ???  
  return  
 
end  
   
 
declare @tid1 int  
 
declare @tid2 int  
 
declare @tid3 int  
  
declare @tid4 int  
   
 select 
@tid1 TypeID1, @tid2 TypeID2, @tid3 TypeID3, @tid4 TypeID4 from _RefObjCommon where ID = @RefItemID  
 
if (@tid1 <> 3)  
 
begin  
  select 
-5cast(as bigint), cast(as bigint) -- about to assign non-item object  
  
return  
 
end  
 
if (@tid2 <> 1)  -- is not equipment  
 begin  
  
-- can't assign magic param or optlevel to non-equip item  
  if (@MagParamNum > 0 or @OptLvl > 0)  
  begin  
   select -6, cast(0 as bigint), cast(0 as bigint)  
   return  
  end  
 end  
   
 ----------------------------------------------------  
 -- step 2. correct some non-critical parameters  
 ----------------------------------------------------  
 if (@tid2 = 3 and @Data = 0) -- can'
t assign overlap count 0 to expendable item  
 begin  
  set 
@Data 1  
 end  
  
 
if (LEN(@szCreater) = 0)  
  
set @szCreater NULL  
  
 
----------------------------------------------------  
 -- 
step addequip and pet @data setting  
 
----------------------------------------------------  
 declare @
IS_EQUIP int  
 
declare @IS_PET int  
  
 set 
@IS_EQUIP 0  
 set 
@IS_PET 0  
  
 
if (@tid1 and @tid2 1)  
  
set @IS_EQUIP 1  
 
else if (@tid1 and @tid2 and @tid3 and (@tid4 or @tid4 2))  
  
set @IS_PET 1  
  
 
if (@IS_EQUIP 1)  
 
begin  
  
    
-- أ€أں ¸أ¸µأˆ ID·أژ select أ‡أڈ°أأ€أ–أ€½¼أ¶أپ¤ (by binu 2008-10-17)
    --    
select @Data Dur_L from _RefObjItem where ID =  @RefItemID
    select 
@Data Dur_L from _RefObjItem where ID = (select Link from _RefObjCommon where ID = @RefItemID )
    
   if (@
OptLvl 0)  
    
set @OptLvl 0  
   
else if (@OptLvl 249)  
    
set @OptLvl 249  
  
 end  
 
else  
 
begin  
  
  
if( @IS_PET )  
   
set @Data 0  
  
else  
  
begin  
   
declare @MaxCount int  
   select 
@MaxCount MaxStack from _RefObjItem where ID = @RefItemID  
   
   
if (@Data <= or @Data > @MaxCount)    
    
set @Data = @MaxCount    
  end  
  
  set 
@OptLvl 0  
 end  
  
  
 
----------------------------------------------------------  
 -- 
Step3create item and set to associated storage  
 
----------------------------------------------------------  
 
set xact_abort on  
begin transaction  
   
 
declare @NewItemID  bigint  
 
declare @Serial64 bigint  
 set 
@NewItemID  0  
 set 
@Serial64 0  
 exec 
@NewItemID _STRG_ALLOC_ITEM_NoTX @Serial64 OUTPUT  
 
if (@NewItemID 0)  
 
begin  
  rollback transaction  
  select 
-7cast(as bigint), cast(as bigint)  
  return  
 
end  
 
if (@MagParamNum 0)  
 
begin  
  update _Items set RefItemID 
= @RefItemIDOptLevel = @OptLvlVariance = @VarianceData = @DataMagParamNum 0Serial64 = @Serial64   
  where ID64 
= @NewItemID  
 end  
 
else  
 
begin  
  update _Items set RefItemID 
= @RefItemIDOptLevel = @OptLvlVariance = @VarianceData = @DataMagParamNum = @MagParamNum,   
    
MagParam1 = @MagParam1MagParam2 = @MagParam2MagParam3 = @MagParam3MagParam4 = @MagParam4,  
    
MagParam5 = @MagParam5MagParam6 = @MagParam6MagParam7 = @MagParam7MagParam8 = @MagParam8,  
    
MagParam9 = @MagParam9MagParam10= @MagParam10MagParam11 = @MagParam11MagParam12 = @MagParam12Serial64 = @Serial64  
  where ID64 
= @NewItemID  
 end  
 
if (@@error <> 0)  
 
begin  
  rollback transaction  
  select 
-8cast(as bigint), cast(as bigint)  
  return  
 
end  
 
if (@TargetStorage 0)  
  
update _Inventory set ItemID = @NewItemID where CharID = @OwnerID and Slot = @empty_slot  
 
else if (@TargetStorage 1)  
  
update _chest set ItemID = @NewItemID where UserJID = @OwnerID and slot = @empty_slot  
 
else if (@TargetStorage 2)  
  
update _guildchest set ItemID = @NewItemID where guildid = @OwnerID and slot = @empty_slot  
 
else  
  
update _InventoryForAvatar set ItemID = @NewItemID where CharID = @OwnerID and Slot = @empty_slot  
   
 
if (@@rowcount or @@error <> 0)  
 
begin  
  rollback transaction  
  select 
-9cast(as bigint), cast(as bigint)  
  return  
 
end  
   
 commit transaction  
 select 
@empty_slot, @NewItemID, @Serial64  
 
return 


توقيع Hero :
...!!