USE [SRO_VT_SHARD]
GO
/****** Object: StoredProcedure [dbo].[_UPDATE_COST] Script Date: 02/02/2012 16:10:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- »óÁ¡°³Æí (ÃÖ¼±È£)
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ALTER PROCEDURE [dbo].[_UPDATE_COST]
@Operation tinyint, [MENTION=18691]char[/MENTION]ID int, [MENTION=37128]pay[/MENTION]mentDevice int,
@PackageItemCodeName varchar(129),
@RemainGold bigint,
@OwnSilkToPay int,
@GiftSilkToPay int, [MENTION=19658]off[/MENTION]setOptionalPoint int,
@MileageToPay int
AS
SET NOCOUNT ON
declare [MENTION=37128]pay[/MENTION]mentDeviceTemp int
declare @RemainOwnSilk int
declare @RemainGiftSilk int
declare @RemainMileage int
declare [MENTION=34283]resul[/MENTION]t int
set @RemainOwnSilk = 0
set @RemainGiftSilk = 0
set @RemainMileage = 0
IF (@RemainGold < 0 or @MileageToPay < 0 or @OwnSilkToPay < 0 or @GiftSilkToPay < 0 or [MENTION=19658]off[/MENTION]setOptionalPoint < 0)
BEGIN
RETURN -2001
END
DECLARE @PC_ID INT
set @PC_ID = [MENTION=18691]char[/MENTION]ID
----------------------------------------------------------
-- Operation¿¡ µû¶ó¼* À¯Àú ij¸¯şÍ ¾ÆÀ̵𰡠³Ñ¾î ¿üöµµ ÀÖ°í, cos ¾ÆÀ̵𰡠³Ñ¾î ¿Ã ¼öµµ ÀÖ´Ù.
-- ij¸¯şÍ ¾ÆÀ̵𸦠¾î¶´ø ¾Ë¾Æ³»¾ß ÇÏ°Ú´Ù.
----------------------------------------------------------
if (@Operation = 19)
begin
-- COS ¿ë ¹°Ç°À» ±¸ÀÔÇÑ°ş´Ï±ñ... ij¸¯ ã¾Æ¼* µ· »©Áà¾ßÁö...
SELECT @PC_ID = OwnerCharID FROM _CharCOS WHERE ID = @PC_ID
IF (@@ERROR <> 0 OR @@ROWCOUNT = 0)
BEGIN
RETURN -2002
END
end
/*
#define EXPAND_DEVICE_GOLDPRICE 1
#define EXPAND_DEVICE_SILKPRICE 2
#define EXPAND_DEVICE_GIFTSILKPRICE 4
#define EXPAND_DEVICE_GUILDPOINT 8
#define EXPAND_DEVICE_MILEAGE 16
*/
if ( [MENTION=37128]pay[/MENTION]mentDevice & (2 | 4 | 16 )) > 0)
begin
-- ½Çş©, ¼±¹°½Çş©, ¸¶Àϸ®Áö¸¦ ±î¾ß Çϴ±¸¸¸.
-- ´Ü, ¸¶Àϸ®Áö´Â ¿É¼ÇÀÌ´Ù.
-- ij¸¯şÍÀÇ JID¸¦ ¾ò¾î¿À³Ê¶ó.
declare @JID int
select top 1 @JID = UserJID from _User
where CharID = @PC_ID
IF (@@ROWCOUNT = 0 OR @@ERROR <> 0)
BEGIN
RETURN -2006
END
DECLARE @PackageItemID int
select @PackageItemID = ID from dbo._RefPackageItem where codename128 = @PackageItemCodeName
DECLARE @rvalue int
-- EXEC @rvalue = SRO_VT_ACCOUNT.DBO._ConsumeSilkByGameServer @JID, @OwnSilkToPay OUTPUT, @GiftSilkToPay OUTPUT, @MileageToPay output, 1, [MENTION=18691]char[/MENTION]ID
EXEC @rvalue = SRO_VT_ACCOUNT.DBO._ConsumeSilkByGameServer @JID, @OwnSilkToPay OUTPUT, @GiftSilkToPay OUTPUT, @MileageToPay output, 0, [MENTION=18691]char[/MENTION]ID, @PackageItemID , 0
IF (@rvalue < 0 OR @@ERROR <> 0)
BEGIN
RETURN -2012
END
--------------------------
--<< 1. ¼öÁ¤ Àü ÄÚµå >> -- ÁÖÈ*
--------------------------
-- -- °ÔÀÓ ¼*¹öÂÊ¿¡¼* °»½ş ¹Ş±â À§ÇØ cost °ªÀ» °á°ú ş×ÀÌºí¿¡ ³Ö¾îµĞ´Ù.
-- insert into _ResultOfPackageItemToMappingWithServerSide
-- values (@Operation, [MENTION=18691]char[/MENTION]ID, 255, @OwnSilkToPay, 2, 0, 1)
--
-- if (@@ERROR <> 0 or @@ROWCOUNT = 0)
-- begin
-- return -2007
-- end
--
-- insert into _ResultOfPackageItemToMappingWithServerSide
-- values (@Operation, [MENTION=18691]char[/MENTION]ID, 254,@GiftSilkToPay, 4, 0, 1)
--
-- if (@@ERROR <> 0 or @@ROWCOUNT = 0)
-- begin
-- return -2007
-- end
--
-- insert into _ResultOfPackageItemToMappingWithServerSide
-- values (@Operation, [MENTION=18691]char[/MENTION]ID, 253,@MileageToPay, 16, 0, 1)
--------------------------
--<< 1. ¼öÁ¤ ÈÄ ÄÚµå >> --
--------------------------
-- °ÔÀÓ ¼*¹öÂÊ¿¡¼* °»½ş ¹Ş±â À§ÇØ cost °ªÀ» °á°ú ş×ÀÌºí¿¡ ³Ö¾îµĞ´Ù.
insert into _ResultOfPackageItemToMappingWithServerSide
values (@Operation, [MENTION=18691]char[/MENTION]ID, 255, @OwnSilkToPay, 2, 0, 1, 0)
if (@@ERROR <> 0 or @@ROWCOUNT = 0)
begin
return -2007
end
insert into _ResultOfPackageItemToMappingWithServerSide
values (@Operation, [MENTION=18691]char[/MENTION]ID, 254,@GiftSilkToPay, 4, 0, 1, 0)
if (@@ERROR <> 0 or @@ROWCOUNT = 0)
begin
return -2007
end
insert into _ResultOfPackageItemToMappingWithServerSide
values (@Operation, [MENTION=18691]char[/MENTION]ID, 253,@MileageToPay, 16, 0, 1, 0)
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
if (@@ERROR <> 0 or @@ROWCOUNT = 0)
begin
return -2007
end
end
-- gold
if ( [MENTION=37128]pay[/MENTION]mentDevice & 1) > 0)
begin
UPDATE _Char SET RemainGold = @RemainGold WHERE CharID = @PC_ID
IF (@@ERROR <> 0 OR @@ROWCOUNT = 0)
BEGIN
RETURN -2003
END
end
-- guildpoint
if ( [MENTION=37128]pay[/MENTION]mentDevice & 8) > 0)
BEGIN
-- ±æµå¸¦ ¾Ë¾Æ¿Í¶ó.
declare @GuildID int
select @GuildID = GuildID from _GuildMember
where CharID = @PC_ID
IF (@@ERROR <> 0 OR @@ROWCOUNT = 0)
BEGIN
RETURN -2004
END
-- ±æµå Æ÷ÀÎÆ® ±î¶ó.
update _Guild set GatheredSP = GatheredSP - [MENTION=19658]off[/MENTION]setOptionalPoint
where GatheredSP >= [MENTION=19658]off[/MENTION]setOptionalPoint and ID = @GuildID
IF (@@ERROR <> 0 OR @@ROWCOUNT = 0)
BEGIN
/*
-- ¾øÀ»¼öµµ Àִ°ş´Ù.
-- by novice. 2010-01-15 ¿¡·¯ÄÚµå µ¥ÀÌşÍÇü È®Àå
-- ¿ø·¡ ÁÖ¼®µÇ¾î ÀÖ´ø ÄÚµåÀÌÁö¸¸, ÃßÈÄ °³¹ßÇÏ´Â »ç¶÷µéÀÌ
-- ¼öÁ¤µÇÁö ¾ÊÀº ³»¿ëÀ» º¸°í È¥¶õ½º·¯¿ö ÇÒ ¼ö ÀÖ¾î¼*
-- ÀÌ ºÎºĞ±îÁö ¼öÁ¤Çعö¸²!
-- declare [MENTION=55912]slo[/MENTION]t tinyint
declare [MENTION=55912]slo[/MENTION]t int
declare [MENTION=34153]ref[/MENTION]ItemSerial64 bigint
declare [MENTION=34153]ref[/MENTION]ItemDBID bigint
declare [MENTION=34153]ref[/MENTION]ItemID int
declare @Type tinyint
-- by novice. 2010-01-15 ¿¡·¯ÄÚµå µ¥ÀÌşÍÇü È®Àå
-- set [MENTION=55912]slo[/MENTION]t = 0xd0 -- error_num ¼*¹ö¿¡¼* »ç¿ëÇÏ´Â ¿¡·¯
-- MAKE_SRO_SP_ERR_TYPE( _UPDATE_COST, 0x0004);
-- DEFINE_SRO_SP_ERR( SRO_SP_ERR_NOT_ENOUGH_GUILD_POINT, _UPDATE_COST, 0x8001 ); // ==> 0x80010004
-- BIND_SRO_SP_ERR_TO_SRO_ERR( SRO_SP_ERR_NOT_ENOUGH_GUILD_POINT, STRGERR_NOT_ENOUGH_GUILDPOINT );
set [MENTION=55912]slo[/MENTION]t = 0x80010004 -- error_num ¼*¹ö¿¡¼* »ç¿ëÇÏ´Â ¿¡·¯
set [MENTION=34153]ref[/MENTION]ItemSerial64 = 0
set [MENTION=34153]ref[/MENTION]ItemDBID = 0
set [MENTION=34153]ref[/MENTION]ItemID = 0
set @Type = 2
select @Operation, [MENTION=55912]slo[/MENTION]t, [MENTION=34153]ref[/MENTION]ItemSerial64, [MENTION=34153]ref[/MENTION]ItemDBID, [MENTION=34153]ref[/MENTION]ItemID, @Type
*/
RETURN -2005
END
--------------------------
--<< 2. ¼öÁ¤ Àü ÄÚµå >> --
--------------------------
-- °ÔÀÓ ¼*¹öÂÊ¿¡¼* °»½ş ¹Ş±â À§ÇØ cost °ªÀ» °á°ú ş×ÀÌºí¿¡ ³Ö¾îµĞ´Ù.
-- insert into _ResultOfPackageItemToMappingWithServerSide
-- values (@Operation, [MENTION=18691]char[/MENTION]ID, 252, [MENTION=19658]off[/MENTION]setOptionalPoint, 8, 0, 1)
--------------------------
--<< 2. ¼öÁ¤ ÈÄ ÄÚµå >> --
--------------------------
-- °ÔÀÓ ¼*¹öÂÊ¿¡¼* °»½ş ¹Ş±â À§ÇØ cost °ªÀ» °á°ú ş×ÀÌºí¿¡ ³Ö¾îµĞ´Ù.
insert into _ResultOfPackageItemToMappingWithServerSide
values (@Operation, [MENTION=18691]char[/MENTION]ID, 252, [MENTION=19658]off[/MENTION]setOptionalPoint, 8, 0, 1, 0)
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
if (@@ERROR <> 0 or @@ROWCOUNT = 0)
begin
return -2007
end
end
-- honorpoint
else if ( [MENTION=37128]pay[/MENTION]mentDevice & 32) > 0)
begin
-- honorpoint ±î¶ó.
update _TrainingCampMember set HonorPoint = HonorPoint - [MENTION=19658]off[/MENTION]setOptionalPoint
where HonorPoint >= [MENTION=19658]off[/MENTION]setOptionalPoint and CharID = @PC_ID
if (@@ERROR <> 0 or @@ROWCOUNT = 0)
begin
return -2006
end
--------------------------
--<< 3. ¼öÁ¤ Àü ÄÚµå >> --
--------------------------
-- °ÔÀÓ ¼*¹öÂÊ¿¡¼* °»½ş ¹Ş±â À§ÇØ cost °ªÀ» °á°ú ş×ÀÌºí¿¡ ³Ö¾îµĞ´Ù.
-- insert into _ResultOfPackageItemToMappingWithServerSide
-- values (@Operation, [MENTION=18691]char[/MENTION]ID, 252, [MENTION=19658]off[/MENTION]setOptionalPoint, 32, 0, 1)
--------------------------
--<< 3. ¼öÁ¤ ÈÄ ÄÚµå >> --
--------------------------
-- °ÔÀÓ ¼*¹öÂÊ¿¡¼* °»½ş ¹Ş±â À§ÇØ cost °ªÀ» °á°ú ş×ÀÌºí¿¡ ³Ö¾îµĞ´Ù.
insert into _ResultOfPackageItemToMappingWithServerSide
values (@Operation, [MENTION=18691]char[/MENTION]ID, 252, [MENTION=19658]off[/MENTION]setOptionalPoint, 32, 0, 1, 0)
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
if (@@ERROR <> 0 or @@ROWCOUNT = 0)
begin
return -2007
end
end
SET NOCOUNT OFF
return 1
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Close GameServer and use this query and open service SR_GameServer