NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

Junior Spellweaver
Joined
Apr 27, 2005
Messages
124
Reaction score
62
NEW VERSION!
FASTER, LESS CPU and MEMORY USAGE!!!


:ala:

All i've seen around is scripts that are made for the old Database based on 97 gs, so here you go, THIS SCRIPT IS FOR GS 99.88/99.96/1.00.08/1.00.16/1.00.18, which contains a proper length of items for a checkup, and unlike other scripts it does not ban anyone but instead, deletes the actual dupes from ppl ;)

Installation:
1. Open Query Analyser
2. Drag and Drop TXT file with the script OR copy-paste script AT THE END OF THAT POST in to the query window!

To remove:
1. Open Query Analyser
2. Enter this query:
Code:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[trg_CheckSameID]') and OBJECTPROPERTY(id, N'IsTrigger') = 1) 
drop trigger [dbo].[trg_CheckSameID] 
GO 

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AllItemsLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) 
drop table [dbo].[AllItemsLog] 
GO 

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CopyLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) 
drop table [dbo].[CopyLog] 
GO

Simple method to TEST the script:
1. Make sure the script is installed in MuOnline DB
2. Then, open mueditor.
3. Open your account.
4. Open vault, insert item (Bronze armor for example) with serial 22222222
5. Close vault (dont forget to save it)
6. Open inventory on any other character on that account.
7. Insert Bronze armor with serial 22222222
8. Save inventory.
9. Open vault... oooo, item is missing.

Questions/Answers:
Q: Does it support 97 or 99B+?
A: NO!!!

Q: This script delete the dupe items ?
A: OMFG! Yes, the ones duped through vault-inventory method!

Q: Sorry that is for Dupes?
A: -=8-D yes!

Q: What muserver does it support?
A: Any muserver based on 99.88 or higher, meaning Season 1, Season 2, Season 3

Q: Does it work on 1.00.16 ?
A: YES!

Q: Does it work on Endi or luciano server?
A: YES, for god sake, the gs version is above 99.88 !!!

Q: How to install it?
A: Simple! Open query analyser, select MuOnline db, copypaste script in QUERY and RUN it.

Q: Can I make it ban the users as well?
A: YES you can, whatever you want it to do, insert on line 176

Q: Does it delete items with 00000000 serials?
A: NO!!! All items you buy from NPC come with serial 00000000

Q: How do i know which items got deleted?
A: Simple, check CopyLog table in MuOnline DB, you will see something like that:


Code:
Code:
--************************************************************************************************************
--*NAME: DaRK Side of MU Real-Time antidupe v4.0b for 99.88 GS and UP
--*WEB: http://www.darksideofmu.com
--*
--*NEW: Faster script running time (75% faster) & less SQL CP load
--*
--*AUTHOR: DaRKav
--*CREDITS: Original credits for the variation of the script go to CT Team [CHS]
--*
--*INSTALLATION: Open the File with Query Analyser and Run it
--*
--*INFO: This trigger detects and deletes duped items in real time from users warehouse.
--*
--*Questions/Answers:
--* 			Q: Does it support 97 or 99B+?
--*			A: NO
--*
--*			Q: What muserver does it support?
--*			A: Any muserver based on 99.88 or higher, meaning Season 1, Season 2, Season 3
--*
--*			Q: Can I make it ban the users as well?
--*			A: YES you can, whatever you want it to do, insert on line 176
--*
--*			Q: Does it delete items with 00000000 serials?
--*			A: NO!!! All items you buy from NPC come with serial 00000000
--*
--*Respect and Hello to CT Team [CHS], long gone MG Group [CHS], MX team [CHS], DS team, Divider, bet0x, 
--*[MX]BigEgg [CHS], Akaruz, long gone VZKJ community [CHS], freeMG members [CHS], hacker [CHS], goe
--*and so on... if i did not named you, do not get mad ;] 
--************************************************************************************************************


USE MUONLINE 
if exists(select * from dbo.sysobjects where type='p' and name='WZ_GetItemSerial') 
drop procedure WZ_GetItemSerial 
GO 

CREATE procedure WZ_GetItemSerial 
AS
BEGIN 
	DECLARE @ItemSerial int 
	SET NOCOUNT ON
	BEGIN TRANSACTION 
	UPDATE GameServerInfo set @ItemSerial = ItemCount = (case when ItemCount < 0x7effffff then ItemCount+1 
	ELSE 1 
	END) 
	
	IF(@@error <> 0) 
	BEGIN 
		rollback transaction 
		select-1 
	END 
	ELSE 
	BEGIN 
		commit transaction 
		select @ItemSerial 
	END
END 
GO 

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[trg_CheckSameID]') and OBJECTPROPERTY(id, N'IsTrigger') = 1) 
drop trigger [dbo].[trg_CheckSameID] 
GO 

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AllItemsLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) 
drop table [dbo].[AllItemsLog] 
GO 

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CopyLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) 
drop table [dbo].[CopyLog] 
GO 

CREATE TABLE [dbo].[AllItemsLog] ( 
	[items_id] [int] IDENTITY (1, 1) NOT NULL , 
	[items_type] [binary] (1) NOT NULL , 
	[items_serial] [binary] (4) NOT NULL , 
	[items_acid] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO 

CREATE TABLE [dbo].[CopyLog] ( 
	[copy_id] [int] IDENTITY (1, 1) NOT NULL , 
	[copy_acid] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL , 
	[copy_name] [varchar] (15) COLLATE Chinese_PRC_CI_AS NOT NULL , 
	[copy_type] [binary] (1) , 
	[copy_serial] [binary] (4) ,
	[copy_item] [binary] (16) , 
	[copy_date] [datetime] NOT NULL 
) ON [PRIMARY] 
GO
 
ALTER TABLE [dbo].[AllItemsLog] ADD 
CONSTRAINT [DF_CT_ITEM_item] DEFAULT (0) FOR [items_type], 
CONSTRAINT [DF_CT_ITEM_itemid] DEFAULT (0) FOR [items_serial], 
CONSTRAINT [DF_CT_ITEM_itemrole] DEFAULT ('\') FOR [items_acid]
GO
 
CREATE INDEX [IX_CT_ITEM] ON [dbo].[AllItemsLog]([items_type], [items_serial]) ON [PRIMARY] 
GO
 
ALTER TABLE [dbo].[CopyLog] ADD 
CONSTRAINT [DF_CopyLog_copy_date] DEFAULT (getdate()) FOR [copy_date] 
GO
 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[trg_CheckSameID]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[trg_CheckSameID]
GO

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

CREATE TRIGGER [dbo].[trg_CheckSameID] ON [dbo].[character] 
	FOR UPDATE 
	AS 
	BEGIN 
		IF UPDATE(inventory) 
		BEGIN 
			SET NOCOUNT ON 
			DECLARE 
			@wh_data binary(1920),
			@wh_type binary(1), 
			@wh_serial binary(4),
			@wh_item binary(16), 
			@cr_acid varchar(10),
			@cr_char varchar(15), 
			@cr_data binary(760), 
			@cr_type binary(1), 
			@cr_serial binary(4),
			@cr_item binary(16), 
			@al_acid varchar(10), 
			@j int, 
			@k int, 
			@warehouse_length int, 
			@find bit

			-- Selecting information about inserted object
			SELECT @cr_acid=i.accountid, @cr_data=i.inventory ,@cr_char=i.name FROM inserted i 
			SELECT @wh_data=items FROM warehouse WHERE accountid=@cr_acid  

			-- Length of the warehouse in binary
			SET @warehouse_length=1920
			
			SET @j=0 
			SET @find=0 
			WHILE @j<76 AND @cr_data IS NOT NULL 
			BEGIN 
				SET @cr_type=SUBSTRING(@cr_data,@j*16+1,1) 
				SET @cr_serial=SUBSTRING(@cr_data,@j*16+4,4) 
				SET @cr_item=SUBSTRING(@cr_data,@j*16+1,16)
				IF @cr_type<>0xFF AND @cr_serial<>0x00000000 
				BEGIN 
					SELECT @al_acid=items_acid FROM allitemslog WHERE items_type=@cr_type AND items_serial=@cr_serial 
					IF @al_acid IS NULL 
						INSERT INTO allitemslog (items_type,items_serial,items_acid) VALUES (@cr_type,@cr_serial,@cr_acid) 
					ELSE 
					BEGIN 
						UPDATE allitemslog SET items_acid=@cr_acid WHERE items_type=@cr_type AND items_serial=@cr_serial 
						
						SET @k=0 
						WHILE @k<120 AND @wh_data IS NOT NULL 
						BEGIN 
							SET @wh_type=SUBSTRING(@wh_data,@k*16+1,1) 
							SET @wh_serial=SUBSTRING(@wh_data,@k*16+4,4)
							SET @wh_item=SUBSTRING(@wh_data,@k*16+1,16)
							IF @wh_type=@cr_type AND @wh_serial=@cr_serial
							BEGIN 
								SET @find=1
								-- Insert dupe record in to the log (item with serial)
								INSERT INTO copylog (copy_type,copy_serial,copy_item,copy_acid,copy_name,copy_date) VALUES (@cr_type,@cr_serial,@cr_item,@al_acid,@cr_char,getdate()) 
								SET @wh_data=SUBSTRING(@wh_data,1,@k*16)+0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF+SUBSTRING(@wh_data,((@k+1)*16+1),@warehouse_length-(((@k+1)*16)))
							END 
							SET @k=@k+1 
						END 
					END 
				END 
				SET @j=@j+1 
			END 
			
			IF @find=1 
			BEGIN 
				-- Update warehouse, delete dupe
				UPDATE warehouse SET items=@wh_data where accountid=@cr_acid

				-- This is where u can add more punishment like ban or lock characters
				-- Block character that has dupes on him [if you feel like it] 
				-- UPDATE Character SET CtlCode=1 WHERE name=@cr_char
			END 
			SET NOCOUNT OFF 
		END 
	END

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

NEW GOOD Feature of the script
As some people noticed before, that script keeps log of all serials in game as well!!!
What it could be used for you ask? SIMPLE, finding more dupes or just making sure server is clean as it is!!!
With 140,000 items on a server I found so far only 1 dupe from before!!! ;)

How to use? After installing script, let your server to sit for at least a week, and then run that query in Query Analyser, that query will show you duped items from before, that are on a different accounts:
Code:
select items_serial,items_acid from allitemslog where items_serial IN 
	(select items_serial from allitemslog group by items_serial having count(*) > 1)

NOT RELATED To RELEASE:
Looking for server owners that are willing to unite their servers....
Either we could unite servers as different entity (example: Maya/Wigle in global) or we could unite servers completely (Meaning: unite databases) !

Reason: Create a bigger, more powerful Gaming community.

P.S. If you are planning on closing server as well, we are willing to take over your server and keep hosting it in a way.

CONTACT ME BY MY EMAIL: [email protected]
 
Last edited:
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

Thanks , i'm gonna use it soon .

was it you or someone else that needed that script to shut off when server had a lot of ppl online?

p.s. i'm gonna optimize that script a little bit more later on, maybe will get it to work even faster ;-D
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

why people are trying to fix DUPE bug in "sql way", it's gs bug, so the one big solution is fix it in gs =)

who knows the dupe system? let's fix it in gs :D
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

why people are trying to fix DUPE bug in "sql way", it's gs bug, so the one big solution is fix it in gs =)

who knows the dupe system? let's fix it in gs :D

not all of them are in GS... you are talking about the actual methods of duping, and the best part is that for each GS its a different method EACH time, why not do it in a lot simplier manner than digging all those different GS files?

exactly = no point...

P.S. after certain ammount of ppl online you will get dupes through SQL as well, either you want it or no... you are talking about MSSQL and considering that there is not 'TRANSACTIONS' in dataserver at all, some queries will execute or finish executing faster then others, so yes, you will be screwed and will have dupes...

Cheers and enjoy with backlogs in your MsSQL :construct
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

NEW GOOD Feature of the script
As some people noticed before, that script keeps log of all serials in game as well!!!
What it could be used for you ask? SIMPLE, finding more dupes or just making sure server is clean as it is!!!
With 140,000 items on a server I found so far only 1 dupe from before!!! ;)

How to use? After installing script, let your server to sit for at least a week, and then run that query in Query Analyser, that query will show you duped items from before, that are on a different accounts:
Code:
select items_serial,items_acid from allitemslog where items_serial IN 
	(select items_serial from allitemslog group by items_serial having count(*) > 1)
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

hmm you've got and replyed back. sry it was a problem from me..the pop up window didn t showed uo
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

upload S3 Chapter 2 full plz plz...

hahaha
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

pls make this script for old versions 97 =/
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

veri nice :) tanks alot!
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

Thanks i will test
But my server is too slow! P4 3.0 ghz HT - 1.5GB RAM , i think will lag ALOOTT
 
Re: [Release] NEW Anti-DUPE SQL for Season 1, Season 2 and Season 3 GS/DB by DaRKav

Thanks i will test
But my server is too slow! P4 3.0 ghz HT - 1.5GB RAM , i think will lag ALOOTT

so add lines that will do checkup when less then 100 users online... not that hard
 
Back