219 lines
4.3 KiB
Transact-SQL
219 lines
4.3 KiB
Transact-SQL
CREATE PROCEDURE [dbo].[up_ItemMoveToMailItem]
|
|
@character_id [uniqueidentifier],
|
|
@auth_id [uniqueidentifier],
|
|
@item_id [uniqueidentifier],
|
|
@use_cnt int,
|
|
@NewMailID [uniqueidentifier],
|
|
@slot_index tinyint
|
|
|
|
as
|
|
set nocount on
|
|
|
|
declare @src_item_count int
|
|
declare @new_item_id [uniqueidentifier]
|
|
select @src_item_count = [use_cnt] from N_InventoryItem with (READUNCOMMITTED) where [item_uid] = @item_id
|
|
|
|
begin tran
|
|
|
|
if @src_item_count <= @use_cnt
|
|
begin
|
|
insert dbo.N_MailItem
|
|
([item_uid],
|
|
[character_id],
|
|
[auth_id],
|
|
[page_index],
|
|
[slot_index],
|
|
[code],
|
|
[use_cnt],
|
|
[remain_time],
|
|
[create_time],
|
|
[update_time],
|
|
[gcode],
|
|
[durability],
|
|
[enhance_level],
|
|
[option_1_code],
|
|
[option_1_value],
|
|
[option_2_code],
|
|
[option_2_value],
|
|
[option_3_code],
|
|
[option_3_value],
|
|
[option_group],
|
|
[ReconNum],
|
|
[ReconState],
|
|
[socket_count],
|
|
[socket_1_code],
|
|
[socket_1_value],
|
|
[socket_2_code],
|
|
[socket_2_value],
|
|
[socket_3_code],
|
|
[socket_3_value],
|
|
[expire_time],
|
|
[activity_value], --활성석 20100928 jojo
|
|
[link_id],
|
|
[socket_1_color],
|
|
[socket_2_color],
|
|
[socket_3_color],
|
|
[rank],
|
|
[acquireroute],
|
|
[physical],
|
|
[magical],
|
|
[durabilitymax],
|
|
[weight]
|
|
)
|
|
select
|
|
[item_uid],
|
|
@character_id,
|
|
@auth_id,
|
|
61,--[page_index],
|
|
@slot_index, --[slot_index],
|
|
[code],
|
|
[use_cnt],
|
|
[remain_time],
|
|
[create_time],
|
|
[update_time],
|
|
[gcode],
|
|
[durability],
|
|
[enhance_level],
|
|
[option_1_code],
|
|
[option_1_value],
|
|
[option_2_code],
|
|
[option_2_value],
|
|
[option_3_code],
|
|
[option_3_value],
|
|
[option_group],
|
|
[ReconNum],
|
|
[ReconState],
|
|
[socket_count],
|
|
[socket_1_code],
|
|
[socket_1_value],
|
|
[socket_2_code],
|
|
[socket_2_value],
|
|
[socket_3_code],
|
|
[socket_3_value],
|
|
[expire_time],
|
|
[activity_value], --활성석 20100928 jojo
|
|
[link_id],
|
|
[socket_1_color],
|
|
[socket_2_color],
|
|
[socket_3_color],
|
|
[rank],
|
|
[acquireroute],
|
|
[physical],
|
|
[magical],
|
|
[durabilitymax],
|
|
[weight]
|
|
|
|
from N_InventoryItem where [item_uid] = @item_id
|
|
|
|
--메일아이템을 메일과 연결
|
|
UPDATE [dbo].[N_MailItem] SET [mail_uid] = @NewMailID WHERE [item_uid] = @item_id
|
|
delete from N_InventoryItem where [item_uid] = @item_id --모두 옮겼으므로 삭제
|
|
end
|
|
else
|
|
begin
|
|
|
|
set @new_item_id = NEWID()
|
|
|
|
--일부만 옮기는 것은 새로 만들어 준다
|
|
insert dbo.N_MailItem
|
|
([item_uid],
|
|
[character_id],
|
|
[auth_id],
|
|
[page_index],
|
|
[slot_index],
|
|
[code],
|
|
[use_cnt],
|
|
[remain_time],
|
|
[create_time],
|
|
[update_time],
|
|
[gcode],
|
|
[durability],
|
|
[enhance_level],
|
|
[option_1_code],
|
|
[option_1_value],
|
|
[option_2_code],
|
|
[option_2_value],
|
|
[option_3_code],
|
|
[option_3_value],
|
|
[option_group],
|
|
[ReconNum],
|
|
[ReconState],
|
|
[socket_count],
|
|
[socket_1_code],
|
|
[socket_1_value],
|
|
[socket_2_code],
|
|
[socket_2_value],
|
|
[socket_3_code],
|
|
[socket_3_value],
|
|
[expire_time],
|
|
[socket_1_color],
|
|
[socket_2_color],
|
|
[socket_3_color],
|
|
[rank],
|
|
[acquireroute],
|
|
[physical],
|
|
[magical],
|
|
[durabilitymax],
|
|
[weight],
|
|
[link_id]
|
|
)
|
|
select
|
|
@new_item_id,
|
|
@character_id,
|
|
@auth_id,
|
|
61,--[page_index],
|
|
@slot_index, --[slot_index],
|
|
[code],
|
|
@use_cnt,
|
|
[remain_time],
|
|
GetDate(),
|
|
[update_time],
|
|
4, --[gcode], c_nGen_SendMail = 4;
|
|
[durability],
|
|
[enhance_level],
|
|
[option_1_code],
|
|
[option_1_value],
|
|
[option_2_code],
|
|
[option_2_value],
|
|
[option_3_code],
|
|
[option_3_value],
|
|
[option_group],
|
|
[ReconNum],
|
|
[ReconState],
|
|
[socket_count],
|
|
[socket_1_code],
|
|
[socket_1_value],
|
|
[socket_2_code],
|
|
[socket_2_value],
|
|
[socket_3_code],
|
|
[socket_3_value],
|
|
[expire_time],
|
|
[socket_1_color],
|
|
[socket_2_color],
|
|
[socket_3_color],
|
|
[rank],
|
|
[acquireroute],
|
|
[physical],
|
|
[magical],
|
|
[durabilitymax],
|
|
[weight],
|
|
'00000000-0000-0000-0000-000000000000'
|
|
from N_InventoryItem where [item_uid] = @item_id
|
|
|
|
--메일아이템을 메일과 연결
|
|
UPDATE [dbo].[N_MailItem] SET [mail_uid] = @NewMailID WHERE [item_uid] = @new_item_id
|
|
|
|
--기존 아이템에서 갯수를 줄인다
|
|
update [dbo].[N_InventoryItem] Set [use_cnt] = @src_item_count-@use_cnt where [item_uid] = @item_id
|
|
end
|
|
|
|
|
|
declare @ERR int
|
|
|
|
SET @ERR = @@ERROR
|
|
IF @ERR <> 0 BEGIN
|
|
RAISERROR('처리오류', 16, 10)
|
|
IF @@TRANCOUNT <> 0 ROLLBACK
|
|
RETURN (@ERR)
|
|
END
|
|
COMMIT TRAN
|