Newbie Spellweaver
- Joined
- Mar 24, 2011
- Messages
- 30
- Reaction score
- 1
Re: [SHARE]Amend Stat Adder/Reset [UPDATED CODE]
this will HELP me more...
this will HELP me more...
Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!
Join Today!this guide is so old ..SeiferXIII said:yes. and you really must. because if you have 2 triggers in one database, you might experience some rollback issues..
http://forum.ragezone.com/f528/share-amend-stat-adder-reset-576958/index2.html#post6253936
/****** Object: Trigger [dbo].[Amend_AdStat] Script Date: 07/09/2019 05:07:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER [dbo].[Amend_AdStat] ON [dbo].[ChaInfo]
after update
as
BEGIN
UPDATE ChaInfo SET [ChaInfo].ChaGuName='ADDFINISH',
[ChaInfo].ChaStRemain=[ChaInfo].ChaStRemain-REPLACE([ChaInfo].ChaGuName,'ADPOW',''),
[ChaInfo].ChaPower=[ChaInfo].ChaPower+REPLACE([ChaInfo].ChaGuName,'ADPOW',''),
[ChaInfo].ChaMoney=[ChaInfo].ChaMoney-(REPLACE([ChaInfo].ChaGuName,'ADPOW','')*1000)
From Inserted
WHERE LEFT(Inserted.ChaGuName,5)='ADPOW'
and [ChaInfo].ChaStRemain>=REPLACE([ChaInfo].ChaGuName,'ADPOW','')
and [ChaInfo].ChaMoney>=REPLACE([ChaInfo].ChaGuName,'ADPOW','')*1000
and Inserted.ChaName=[ChaInfo].ChaName
and Inserted.UserNum=[ChaInfo].UserNum
UPDATE ChaInfo SET [ChaInfo].ChaGuName='ADDFINISH',
[ChaInfo].ChaStRemain=[ChaInfo].ChaStRemain-REPLACE([ChaInfo].ChaGuName,'ADDEX',''),
[ChaInfo].ChaDex=[ChaInfo].ChaDex+REPLACE([ChaInfo].ChaGuName,'ADDEX',''),
[ChaInfo].ChaMoney=[ChaInfo].ChaMoney-(REPLACE([ChaInfo].ChaGuName,'ADDEX','')*1000)
From Inserted
WHERE LEFT(Inserted.ChaGuName,5)='ADDEX'
and [ChaInfo].ChaStRemain>=REPLACE([ChaInfo].ChaGuName,'ADDEX','')
and [ChaInfo].ChaMoney>=REPLACE([ChaInfo].ChaGuName,'ADDEX','')*1000
and Inserted.ChaName=[ChaInfo].ChaName
and Inserted.UserNum=[ChaInfo].UserNum
UPDATE ChaInfo SET [ChaInfo].ChaGuName='ADDFINISH',
[ChaInfo].ChaStRemain=[ChaInfo].ChaStRemain-REPLACE([ChaInfo].ChaGuName,'ADINT',''),
[ChaInfo].ChaSpirit=[ChaInfo].ChaSpirit+REPLACE([ChaInfo].ChaGuName,'ADINT',''),
[ChaInfo].ChaMoney=[ChaInfo].ChaMoney-(REPLACE([ChaInfo].ChaGuName,'ADINT','')*1000)
From Inserted
WHERE LEFT(Inserted.ChaGuName,5)='ADINT'
and [ChaInfo].ChaStRemain>=REPLACE([ChaInfo].ChaGuName,'ADINT','')
and [ChaInfo].ChaMoney>=REPLACE([ChaInfo].ChaGuName,'ADINT','')*1000
and Inserted.ChaName=[ChaInfo].ChaName
and Inserted.UserNum=[ChaInfo].UserNum
UPDATE ChaInfo SET [ChaInfo].ChaGuName='ADDFINISH',
[ChaInfo].ChaStRemain=[ChaInfo].ChaStRemain-REPLACE([ChaInfo].ChaGuName,'ADVIT',''),
[ChaInfo].ChaStrong=[ChaInfo].ChaStrong+REPLACE([ChaInfo].ChaGuName,'ADVIT',''),
[ChaInfo].ChaMoney=[ChaInfo].ChaMoney-(REPLACE([ChaInfo].ChaGuName,'ADVIT','')*1000)
From Inserted
WHERE LEFT(Inserted.ChaGuName,5)='ADVIT'
and [ChaInfo].ChaStRemain>=REPLACE([ChaInfo].ChaGuName,'ADVIT','')
and [ChaInfo].ChaMoney>=REPLACE([ChaInfo].ChaGuName,'ADVIT','')*1000
and Inserted.ChaName=[ChaInfo].ChaName
and Inserted.UserNum=[ChaInfo].UserNum
UPDATE ChaInfo SET [ChaInfo].ChaGuName='ADDFINISH',
[ChaInfo].ChaStRemain=[ChaInfo].ChaStRemain-REPLACE([ChaInfo].ChaGuName,'ADSTM',''),
[ChaInfo].ChaStrength=[ChaInfo].ChaStrength+REPLACE([ChaInfo].ChaGuName,'ADSTM',''),
[ChaInfo].ChaMoney=[ChaInfo].ChaMoney-(REPLACE([ChaInfo].ChaGuName,'ADSTM','')*1000)
From Inserted
WHERE LEFT(Inserted.ChaGuName,5)='ADSTM'
and [ChaInfo].ChaStRemain>=REPLACE([ChaInfo].ChaGuName,'ADSTM','')
and [ChaInfo].ChaMoney>=REPLACE([ChaInfo].ChaGuName,'ADSTM','')*1000
and Inserted.ChaName=[ChaInfo].ChaName
and Inserted.UserNum=[ChaInfo].UserNum
[COLOR="#FF0000"]
UPDATE ChaInfo SET [ChaInfo].ChaGuName='RESETFINISH',
[ChaInfo].ChaStRemain=[ChaInfo].ChaStRemain+([ChaInfo].ChaPower+[ChaInfo].ChaDex+[ChaInfo].ChaSpirit+[ChaInfo].ChaStrong+[ChaInfo].ChaStrength),
[ChaInfo].ChaPower=0,
[ChaInfo].ChaDex=0,
[ChaInfo].ChaIntel=0,
[ChaInfo].ChaStrong=0,
[ChaInfo].ChaStrength=0,
[ChaInfo].ChaMoney=[ChaInfo].ChaMoney-(([ChaInfo].ChaPower+[ChaInfo].ChaDex+[ChaInfo].ChaSpirit+[ChaInfo].ChaStrong+[ChaInfo].ChaStrength)*1000)
From Inserted
WHERE Inserted.ChaGuName='RESETSTAT'
and [ChaInfo].ChaMoney>=(([ChaInfo].ChaPower+[ChaInfo].ChaDex+[ChaInfo].ChaSpirit+[ChaInfo].ChaStrong+[ChaInfo].ChaStrength)*1000)
and Inserted.ChaName=[ChaInfo].ChaName
and Inserted.UserNum=[ChaInfo].UserNum
[/COLOR]
END
The red color that i highlighted is the rollbacks set it to 500