Quote:
Use MuOnline
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_CreateCharacter]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_CreateCharacter]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE Procedure [dbo].[WZ_CreateCharacter]
@AccountID varchar(10),
@Name varchar(10),
@Class tinyint
AS
Begin
SET NOCOUNT ON
SET XACT_ABORT ON
DECLARE @Result tinyint
SET @Result = 0x00
If EXISTS ( SELECT Name FROM Character WHERE Name = @Name )
begin
SET @Result = 0x01
GOTO ProcEnd
end
If EXISTS ( SELECT Name FROM BotPet WHERE Name = @Name )
begin
SET @Result = 0x01
GOTO ProcEnd
end
BEGIN TRAN
If NOT EXISTS ( SELECT Id FROM AccountCharacter WHERE Id = @AccountID )
begin
INSERT INTO dbo.AccountCharacter(Id, GameID1, GameID2, GameID3, GameID4, GameID5, GameIDC)
VALUES(@AccountID, @Name, NULL, NULL, NULL, NULL, NULL)
SET @Result = @@Error
end
else
begin
Declare @g1 varchar(10), @g2 varchar(10), @g3 varchar(10), @g4 varchar(10), @g5 varchar(10)
SELECT @g1=GameID1, @g2=GameID2, @g3=GameID3, @g4=GameID4, @g5=GameID5 FROM dbo.AccountCharacter Where Id = @AccountID
if( ( @g1 Is NULL) OR (Len(@g1) = 0))
begin
UPDATE AccountCharacter SET GameID1 = @Name
WHERE Id = @AccountID
SET @Result = @@Error
end
else if( @g2 Is NULL OR Len(@g2) = 0)
begin
UPDATE AccountCharacter SET GameID2 = @Name
WHERE Id = @AccountID
SET @Result = @@Error
end
else if( @g3 Is NULL OR Len(@g3) = 0)
begin
UPDATE AccountCharacter SET GameID3 = @Name
WHERE Id = @AccountID
SET @Result = @@Error
end
else if( @g4 Is NULL OR Len(@g4) = 0)
begin
UPDATE AccountCharacter SET GameID4 = @Name
WHERE Id = @AccountID
SET @Result = @@Error
end
else if( @g5 Is NULL OR Len(@g5) = 0)
begin
UPDATE AccountCharacter SET GameID5 = @Name
WHERE Id = @AccountID
SET @Result = @@Error
end
else
begin
SET @Result = 0x03
GOTO TranProcEnd
end
end
if( @Result <> 0 )
begin
GOTO TranProcEnd
end
else
begin
INSERT INTO dbo.Character(AccountID, Name, cLevel, LevelUpPoint, Class, Strength, Dexterity, Vitality, Energy, Inventory,MagicList,
Life, MaxLife, Mana, MaxMana, MapNumber, MapPosX, MapPosY, MDate, LDate, Quest, DbVersion, Leadership,money )
SELECT @AccountID As AccountID, @Name As Name, Level, 0, @Class As Class,
Strength, Dexterity, Vitality, Energy, Inventory,MagicList, Life, MaxLife, Mana, MaxMana, MapNumber, MapPosX, MapPosY,
getdate() As MDate, getdate() As LDate, Quest, DbVersion, Leadership,0
FROM DefaultClassType WHERE Class = @Class
SET @Result = @@Error
end
TranProcEnd: -- GOTO
IF ( @Result <> 0 )
ROLLBACK TRAN
ELSE
COMMIT TRAN
ProcEnd:
SET NOCOUNT OFF
SET XACT_ABORT OFF
SELECT
CASE @Result
WHEN 0x00 THEN 0x01
WHEN 0x01 THEN 0x00
WHEN 0x03 THEN 0x03
ELSE 0x02
END AS Result
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_GetItemSerial]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_GetItemSerial]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[WZ_GetItemSerial]
as
BEGIN
DECLARE @ItemSerial int
set nocount on
begin transaction
update GameServerInfo set @ItemSerial = ItemCount = ItemCount+1
if ( @@error <> 0 )
begin
rollback transaction
select -1
end
else
begin
commit transaction
select @ItemSerial
end
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
f exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_DISCONNECT_MEMB]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_DISCONNECT_MEMB]
GO
CREATE PROCEDURE WZ_DISCONNECT_MEMB
@memb___id varchar(10)
AS
Begin
set nocount on
Declare @find_id varchar(10)
Declare @ConnectStat tinyint
Declare @FechaIngreso datetime
Declare @FechaEgreso datetime
Set @ConnectStat = 0 -- Fija ConnectStat a 0
Set @find_id = 'NOT'
select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id
where I.memb___id = @memb___id
if( @find_id <> 'NOT' ) -- Realizado por TheGhost -- CP Team Development Group
begin
update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate()
where memb___id = @memb___id
select @FechaIngreso = (select ConnectTM from memb_stat where memb___id = @memb___id)
select @FechaEgreso = (select DisConnectTM from memb_stat where memb___id = @memb___id)
update MEMB_STAT set OnlineHours = OnlineHours + (DATEDIFF(Hour, @FechaIngreso, @FechaEgreso))
where memb___id = @memb___id
end
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO