修改战盟人数限制的存储过程
CREATE PROCEDURE WZ_CS_ReqRegAttackGuild
@iMapSvrGroup SMALLINT, -- 甘辑滚 弊缝
@szGuildName VARCHAR(8) -- 傍己殿废阑 茄 辨靛捞抚
As
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
DECLARE @iMaxRegGuildCount INT -- 傍己俊 弥措 殿废且 荐 乐绰 辨靛 荐
DECLARE @iCurRegGuildCount INT -- 泅犁 傍己俊 殿废茄 辨靛 荐
SET @iMaxRegGuildCount = 100
SELECT @iCurRegGuildCount = COUNT(*) FROM MuCastle_REG_SIEGE WITH (READUNCOMMITTED) WHERE MAP_SVR_GROUP = @iMapSvrGroup
IF (@iCurRegGuildCount >= @iMaxRegGuildCount)
BEGIN
SELECT 6 As QueryResult -- 殿废茄 辨靛啊 捞固 N俺甫 逞菌澜
END
ELSE
BEGIN
IF EXISTS ( SELECT MAP_SVR_GROUP FROM MuCastle_REG_SIEGE WITH (READUNCOMMITTED)
WHERE MAP_SVR_GROUP = @iMapSvrGroup and REG_SIEGE_GUILD = @szGuildName)
BEGIN
SELECT 2 As QueryResult -- 捞固 殿废登绢 乐澜
END
ELSE
BEGIN
DECLARE @szOwnGuildName VARCHAR(8)
SELECT @szOwnGuildName = OWNER_GUILD FROM MuCastle_DATA WHERE MAP_SVR_GROUP = @iMapSvrGroup
-- 趣矫 荐己螟 辨靛啊 酒囱瘤 痢八
IF (@szOwnGuildName = @szGuildName)
BEGIN
SELECT 3 As QueryResult -- 荐己螟 辨靛烙
END
ELSE
BEGIN
IF NOT EXISTS ( SELECT G_Name FROM Guild WITH (READUNCOMMITTED) WHERE G_Name = @szGuildName)
BEGIN
SELECT 4 As QueryResult -- 辨靛沥焊啊 粮犁窍瘤 臼澜
END
ELSE
BEGIN
DECLARE @szGuildMaster VARCHAR(10)
DECLARE @iGuildMasterLevel INT
DECLARE @iGuildMemberCount INT
SELECT @szGuildMaster = G_Master FROM Guild WHERE G_Name = @szGuildName
SELECT @iGuildMasterLevel = cLevel FROM Character WHERE Name = @szGuildMaster
SELECT @iGuildMemberCount = COUNT(*) FROM GuildMember WHERE G_Name = @szGuildName
IF (@iGuildMasterLevel < 200) ----这里修改盟主的要求等级(默认就是要200或以上才能)
BEGIN
SELECT 5 As QueryResult -- 辨靛付胶磐狼 饭骇捞 撤澜
END
ELSE
BEGIN
IF (@iGuildMemberCount < 0) -----这里修改战盟人数限制,修改为0,一个人就能申请了
BEGIN
SELECT 8 As QueryResult -- 辨靛盔 荐啊 何练
END
ELSE
BEGIN
DECLARE @iMAX_SEQNUM INT -- 泅犁 弥措 殿废锅龋
DECLARE @iNXT_SEQNUM INT -- 促澜 殿废锅龋
SELECT @iMAX_SEQNUM = MAX(SEQ_NUM) FROM MuCastle_REG_SIEGE WITH (READUNCOMMITTED) WHERE MAP_SVR_GROUP = @iMapSvrGroup
IF (@iMAX_SEQNUM IS NULL)
SET @iNXT_SEQNUM = 1
ELSE
SET @iNXT_SEQNUM = @iMAX_SEQNUM + 1
INSERT INTO MuCastle_REG_SIEGE
VALUES (@iMapSvrGroup, @szGuildName, 0, 0, @iNXT_SEQNUM)
SELECT 1 As QueryResult -- 殿废 己傍
END
END
END
END
END
END
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
本文出自 7j45 > 奇迹一条龙