如何设置每日、每周和每月排名 + 奖池


Published:   Comment: No Comments

游戏设置

设置具有自动重置和奖励
功能的每日、每周和每月排名。
要在 Character 表中创建的列:

Use [MuOnline]
GO
ALTER TABLE [MuOnline].[dbo].[Character] ADD ResetDay INT NOT NULL DEFAULT ((0))
ALTER TABLE [MuOnline].[dbo].[Character] ADD ResetWek INT NOT NULL DEFAULT ((0))
ALTER TABLE [MuOnline].[dbo].[Character] ADD ResetMon INT NOT NULL DEFAULT ((0))
ALTER TABLE [MuOnline].[dbo].[Character] ADD MResetDay INT NOT NULL DEFAULT ((0))
ALTER TABLE [MuOnline].[dbo].[Character] ADD MResetWek INT NOT NULL DEFAULT ((0))
ALTER TABLE [MuOnline].[dbo].[Character] ADD MResetMon INT NOT NULL DEFAULT ((0))
用于解释排名的触发器:

法典:
SET ANSI_NULLS ONGO

SET QUOTED_IDENTIFIER ON
GO

CREATE TRIGGER [dbo].[resetrank]

ON [dbo].[Character]

AFTER UPDATE
AS

IF UPDATE(ResetCount)

BEGIN SET NOCOUNT ON;
UPDATE [Character] set [Character].ResetDay=ResetDay+1, ResetWek=ResetWek+1, ResetMon=ResetMon+1
WHERE [Character].accountid=(SELECT accountid FROM Inserted)
AND [Character].name=(SELECT name FROM Inserted)

END

重置相应排名并添加现金奖励的工作

declare @accountID varchar (10)declare @Name varchar(10)
declare @MResetDay int
Select top 1 @accountID=AccountID,@Name=Name,@MResetDay=MResetDay from character order by MResetDay desc, name desc
Update CashShopData set WCoinC= WCoinC+10 where AccountID @accountID
Update character set MResetDay=0

none
Last Modified:2024-09-29 21:56:23

我有话说