MuManager的一些存储过程 角色修改
CREATE PROCEDURE WZ_CharInfoChange
@AdminId varchar(10),
@mess varchar(10),
@action varchar(50),
@AccId varchar(10),
@GameID varchar(16),
@gamenum int,
@unknow2 varchar(10),
@cLevel1 int,
@Up1 int,
@exp1 int,
@st1 int,
@dex1 int,
@vi1 int,
@en1 int,
@mlift1 int,
@dlift1 int,
@mmagic1 int,
@dmagic1 int,
@cLevel2 int,
@Up2 int,
@exp2 int,
@st2 int,
@dex2 int,
@vi2 int,
@en2 int,
@mlift2 int,
@dlift2 int,
@mmagic2 int,
@dmagic2 int AS
begin
insert into MngModifyLog (ManagerID,AccountId,GameID,servernumber,LogText) values (@AdminId,@AccId,@GameID,@gamenum,@action)
insert into CharInfoModifyOrigin (cLevel,LevelUpPoint,Experience,Strength,Dexterity,Vitality,Energy,Life,MaxLife,Mana,MaxMana) valueS (@cLevel1,@Up1,@exp1,@st1,@dex1,@vi1,@en1,@mlift1,@dlift1,@mmagic1,@dmagic1)
insert into CharInfoModify (cLevel,LevelUpPoint,Experience,Strength,Dexterity,Vitality,Energy,Life,MaxLife,Mana,MaxMana) valueS (@cLevel2,@Up2,@exp2,@st2,@dex2,@vi2,@en2,@mlift2,@dlift2,@mmagic2,@dmagic2)
insert into CharInfoModify (cLevel,LevelUpPoint,Experience,Strength,Dexterity,Vitality,Energy,Life,MaxLife,Mana,MaxMana) valueS (@cLevel2,@Up2,@exp2,@st2,@dex2,@vi2,@en2,@mlift2,@dlift2,@mmagic2,@dmagic2)
update Character set cLevel=@cLevel2,LevelUpPoint=@Up2,Experience=@exp2,Strength=@st2,Dexterity=@dex2,Vitality=@vi2,Energy=@en2,Life=@mlift2,MaxLife=@dlift2,Mana=@mmagic2,MaxMana=@dmagic2 where AccountID=@AccId and Name=@GameId
end
GO
如果提示语法错误,那到你的MngModifyLog,CharInfoModifyOrigin,CharInfoModify这三个表的结构可能跟我有出入,自己看一下吧
下面是我这三个表的sql语句,结构上有几处我改过了大家自己看办
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CharInfoModify]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CharInfoModify]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CharInfoModifyOrigin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CharInfoModifyOrigin]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MngModifyLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MngModifyLog]
GO
CREATE TABLE [dbo].[CharInfoModify] (
[Number] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[cLevel] [int] NULL ,
[LevelUpPoint] [int] NULL ,
[Experience] [int] NULL ,
[Strength] [smallint] NULL ,
[Dexterity] [smallint] NULL ,
[Vitality] [smallint] NULL ,
[Energy] [smallint] NULL ,
[Life] [real] NULL ,
[MaxLife] [real] NULL ,
[Mana] [real] NULL ,
[MaxMana] [real] NULL ,
[cDate] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[CharInfoModifyOrigin] (
[Number] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[cLevel] [int] NULL ,
[LevelUpPoint] [int] NULL ,
[Experience] [int] NULL ,
[Strength] [smallint] NULL ,
[Dexterity] [smallint] NULL ,
[Vitality] [smallint] NULL ,
[Energy] [smallint] NULL ,
[Life] [real] NULL ,
[MaxLife] [real] NULL ,
[Mana] [real] NULL ,
[MaxMana] [real] NULL ,
[cDate] [smalldatetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[MngModifyLog] (
[Number] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[ManagerID] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[AccountId] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[GameID] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[servernumber] [tinyint] NULL ,
[IP] [nvarchar] (16) COLLATE Chinese_PRC_CI_AS NULL ,
[ModifyDate] [smalldatetime] NULL ,
[LogType] [smallint] NULL ,
[LogText] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CharInfoModify] WITH NOCHECK ADD
CONSTRAINT [DF_CharInfoModify_cDate] DEFAULT (getdate()) FOR [cDate]
GO
ALTER TABLE [dbo].[CharInfoModifyOrigin] WITH NOCHECK ADD
CONSTRAINT [DF_CharInfoModifyOrigin_cDate] DEFAULT (getdate()) FOR [cDate]
GO
ALTER TABLE [dbo].[MngModifyLog] WITH NOCHECK ADD
CONSTRAINT [DF_MngModifyLog_ModifyDate] DEFAULT (getdate()) FOR [ModifyDate]
GO
正确的joinServer控制帐号连接用的存储过程
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_CONNECT_MEMB]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_CONNECT_MEMB]
GO
if 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
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE WZ_CONNECT_MEMB
@uid varchar(20),
@server varchar(20),
@uip varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET ip = @uip , connectstat = 1 , servername = @server , ConnectTM = (getdate())
WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,ip,connectstat,servername) valueS (
@uid,
@uip,
1,
@server
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE WZ_DISCONNECT_MEMB
@uid varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET DisConnectTM = (getdate()), connectstat = 0 WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,DisConnectTM,connectstat) valueS (
@uid,
(getdate()),
0
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
memb_stat表的结构
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MEMB_STAT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MEMB_STAT]
GO
CREATE TABLE [dbo].[MEMB_STAT] (
[memb___id] [nvarchar] (10) COLLATE Chinese_PRC_CS_AS NOT NULL ,
[ConnectStat] [tinyint] NULL ,
[ServerName] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[IP] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[ConnectTM] [smalldatetime] NULL ,
[DisConnectTM] [smalldatetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MEMB_STAT] WITH NOCHECK ADD
CONSTRAINT [DF_MEMB_STAT_ConnectTM] DEFAULT (getdate()) FOR [ConnectTM],
CONSTRAINT [DF_MEMB_STAT_DisConnectTM] DEFAULT (getdate()) FOR [DisConnectTM],
CONSTRAINT [PK_MEMB_STAT] PRIMARY KEY CLUSTERED
(
[memb___id]
) ON [PRIMARY]
GO