CREATE PROCEDURE [dbo].[up_update_duel_info] @character_id [uniqueidentifier], @game_type int, @add_point int, @add_exp bigint, @add_disconnect int, @add_win int, @add_lose int as begin set nocount on declare @temp_add_point int declare @temp_add_exp bigint set @temp_add_point = 0 set @temp_add_exp = 0 select @temp_add_point = duel_point, @temp_add_exp = duel_exp from BattleInfo with (READUNCOMMITTED) where character_id = @character_id set @temp_add_point = @temp_add_point + @add_point set @temp_add_exp = @temp_add_exp + @add_exp if @temp_add_point < 0 set @temp_add_point = 0 if @temp_add_exp < 0 set @temp_add_exp = 0 if @add_disconnect > 0 begin declare @pannelty_time datetime set @pannelty_time = dateadd(minute, 10, getdate()) update BattleInfo set duel_disconnect = duel_disconnect + @add_disconnect, duel_pannelty_time = @pannelty_time where character_id = @character_id end update BattleInfo set duel_point = @temp_add_point, duel_exp = @temp_add_exp where character_id = @character_id if 0 = @game_type -- pvp begin update BattleInfo set pvp_win = pvp_win + @add_win, pvp_lose = pvp_lose + @add_lose, total_win = total_win + @add_win, total_lose = total_lose + @add_lose where character_id = @character_id end else if 1 = @game_type -- team begin update BattleInfo set team_win = team_win + @add_win, team_lose = team_lose + @add_lose, total_win = total_win + @add_win, total_lose = total_lose + @add_lose where character_id = @character_id end else if 2 = @game_type -- leader begin update BattleInfo set leader_win = leader_win + @add_win, leader_lose = leader_lose + @add_lose, total_win = total_win + @add_win, total_lose = total_lose + @add_lose where character_id = @character_id end else if 3 = @game_type -- tag begin update BattleInfo set tag_win = tag_win + @add_win, tag_lose = tag_lose + @add_lose, total_win = total_win + @add_win, total_lose = total_lose + @add_lose where character_id = @character_id end else if 4 = @game_type -- death begin update BattleInfo set death_win = death_win + @add_win, death_lose = death_lose + @add_lose, total_win = total_win + @add_win, total_lose = total_lose + @add_lose where character_id = @character_id end else if 5 = @game_type -- ladder begin update BattleInfo set ladder_win = ladder_win + @add_win, ladder_lose = ladder_lose + @add_lose where character_id = @character_id end return 0 end