الموضوع: Npc
عرض مشاركة واحدة
قديم 04-11-2016, 12:58 AM   #10

احمد الفقى
عضو فعال



الصورة الرمزية احمد الفقى


• الانـتـسـاب » Sep 2011
• رقـم العـضـويـة » 91377
• المشـــاركـات » 249
• الـدولـة »
• الـهـوايـة »
• اسـم الـسـيـرفـر » Private Server
• الـجـنـس » Male
• نقـاط التقييم » 10
احمد الفقى صـاعـد

احمد الفقى غير متواجد حالياً

766  



افتراضي رد: Npc



كل الملف
اقتباس:
USE [SRO_VT_SHARD]
GO
/****** Object: StoredProcedure [dbo].[_ADD_ITEM_EXTERN] Script Date: 03/11/2016 11:56:19 م ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO







ALTER procedure [dbo].[_ADD_ITEM_EXTERN]
@charname varchar(64),
@codename varchar(128),
@data int,
@opt_level int
as
declare @charid int
declare @ref_item_id int
declare @link_to_item int
declare @inv_capacity int

set @inv_capacity = 45

if (not exists (select * from _RefObjCommon where Codename128 = @codename))
begin
raiserror('unknown item: %s', 1, 16, @codename)
return -1
end
if (not exists (select * from _char with (nolock) where charname16 = @charname))
begin
raiserror('not existing character: %s', 1, 16, @charname)
return -2
end
select @charid = charid, @inv_capacity = InventorySize from _char with (nolock) where charname16 = @charname
if (not exists (select * from _inventory with (nolock) where charid = @charid and slot >= 13 and slot < @inV_capacity and itemid = 0))
begin
raiserror('Inventory Full: %s', 1, 16, @charname)
return -3 -- inventory full
end
declare @empty_slot int
select top 1 @empty_slot = slot from _inventory with (nolock) where charid = @charid and slot >= 13 and slot < @inV_capacity and itemid = 0 order by slot
set @ref_item_id = 0
set @link_to_item = 0
select @ref_item_id = id, @link_to_item = link from _RefObjCommon where codename128 = @codename
if (@ref_item_id = 0 or @ref_item_id is null)
begin
raiserror('@RefItemID == NULL: %s', 1, 16, @charname)
return -4
end
if (@link_to_item = 0 or @link_to_item is null)
begin
raiserror('RefItem Link == NULL: %s', 1, 16, @charname)
return -5
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 = @ref_item_id
declare @IS_EQUIP int
declare @IS_PET int
set @IS_EQUIP = 0
set @IS_PET = 0
if (@tid1 <> 3)
begin
raiserror('not item: %s, %s', 1, 16, @charname, @codename)
return -6 -- ¿ÀÀ×! ¾ÆÀÌÅÛÀÌ ¾Æ´Ï¾ß?
end
if (@tid1 = 3 and @tid2 = 1)
set @IS_EQUIP = 1
else if (@tid1 = 3 and @tid2 = 2 and @tid3 = 1 and (@tid4 = 1 or @tid4 = 2 ) )
set @IS_PET = 1
declare @item_id bigint
set @item_id = 0

declare @dummy_serial_number bigint
set @dummy_serial_number = 0
if (@IS_EQUIP = 1)
begin
declare @dur int
select @dur = Dur_L from _RefObjItem where ID = @link_to_item
set @data = @dur
if (@opt_level < 0)
set @opt_level = 0
else if (@opt_level > 14)
set @opt_level = 14

declare @remain_gold bigint
select @remain_gold = remaingold from _char where charid = @charid
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- »óÁ¡°³Æí (ÃÖ¼±È£)
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
exec _STRG_ADD_EQUIP_NORMAL @item_id output, @dummy_serial_number output, 6, @charid, @empty_slot, @ref_item_id, @opt_level, 0, @data
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
end
else
begin
if( @IS_PET = 1 )
set @data = 0
else
begin
declare @max_count int
select @max_count = MaxStack from _RefObjItem where ID = @link_to_item

if (@data <= 0 or @data > @max_count)
begin
set @data = @max_count
end
end

--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- »óÁ¡°³Æí (ÃÖ¼±È£)
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
exec _STRG_ADD_EXPENDABLE @item_id output, @dummy_serial_number output, 6, @charid, @empty_slot, @ref_item_id, @data

--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
end

if (@item_id > 0)
return 1
else
begin
raiserror('failed for unknown reason: %s, %s', 1, 16, @charname, @codename)
return -7
end










التعديل الأخير تم بواسطة احمد الفقى ; 04-11-2016 الساعة 01:01 AM