عرض مشاركة واحدة
قديم 01-03-2012, 10:23 AM   #105

Fire_Snake
عضو فضى



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


• الانـتـسـاب » Sep 2010
• رقـم العـضـويـة » 74982
• المشـــاركـات » 3,009
• الـدولـة » شمال سيناء
• الـهـوايـة »
• اسـم الـسـيـرفـر » No Server
• الـجـنـس » Male
• نقـاط التقييم » 10
Fire_Snake صـاعـد

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


إرسال رسالة عبر Yahoo إلى Fire_Snake

افتراضي



اقتباس:
المشاركة الأصلية كتبت بواسطة branz عفوا ,,, لايمكنك مشاهده الروابط لانك غير مسجل لدينا [ للتسجيل اضغط هنا ]




كود PHP:
set ansi_nulls on
set quoted_identifier on
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     -- &#199;Á·Î½ÃÁ® ÇϵåÄÚµù(¾Æ¹ÙŸ ½½·ÔÀº 0, 1, 2, 3ÀÌ´Ù.)  
  
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  
  
    
-- &#192;ß ¸øµÈ 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 12)  
    
set @optlvl 12  
  
 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 
كود PHP:
if (@optlvl 0)  
    
set @optlvl 0  
   
else if (@optlvl 12)  
    
set @optlvl 12 
تابع الصوره دى ؟
كود PHP:
if (@optlvl 0)  
    
set @optlvl 0  
   
else if (@optlvl 255)  
    
set @optlvl 255 
وللعلم اخر اللعبه +255 عشان مش الاقى واحد بيقولى ازاى اعمل 500 ؟

وبعدين فى دى

if (@optlvl < 0)
set @optlvl = 0
else if (@optlvl > 255)
set @optlvl = 255

ممكن تخلى ال 255 اى رقم انت عاوزه تحتها بس مش ينفع اكتر

يارب يكون الحل مناسب
اوك هجرب وارد عليك
تسلم يا صحبي


توقيع Fire_Snake :
الملائكه معرفتش تخلص كتابه الحسانات للجمله دى بس

فما بالك بالأتنين ولو قولتها مش ممكن تدخلك الجنه ؟