[Release] Perfect Reset Scripts

Leonid

New Member
Joined
Apr 24, 2010
Messages
4
Reaction score
0
Here #1 ResetScript from my collection.

Information:

Reset lvl: '400'
Reset point: '300'
Reset money: 100'000'000 zen
Vault: 'NOT NULL'
Inventoty: 'NULL'
MagicList: 'NULL'
Quest: 'NULL' (zeroing)
Class: 'NULL' (zeroing)
LevelUpPoint: '0' (zeroing)
Reset Map: 'Lorencia'
PkLevel: '3'
Reset script for: DK/BK, DW/SM, FE/ME, MG, DL. Need coded for 3class+summoner.

Install:
1) In JOB insert this: "exec ResetScript" (without " ")
2) To register procedure it is necessary into DataBases "MuOnline".
3) After the admission of this procedure through Query Analyzer, the first time in manual pass through Query Analyzer: "exec ResetScript"



Code:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

Create PROCEDURE ResetScript
As
Begin
Set nocount on
Set dateformat dmy -- Install the Date.

Declare -- Declare variables.
@ResetLevel int, -- Level Reset.
@ResetMoney int, -- Money for Reset.
@NickName varchar(10) -- NickName.


-- LevelReset
SET @ResetLevel=400
SET @ResetMoney=100000000

-- 1) We find characters who apply on Reset.
- Looking for approaching Level (in this case 400) and which are in offline.
Declare @TLS table (NickName varchar(10))
Insert into @TLS (NickName)
Select Name
FROM Character c
JOIN MEMB_STAT m ON c.AccountID = m.memb___id
COLLATE Latin1_general_CI_AI
WHERE (cLevel=@ResetLevel) and (Money>=@ResetMoney) and (ConnectStat=0)
-- If there is no character that we need, exit procedure.
if (Select count(*) from @TLS)=0 Goto EX


-- Dump stats.
UPDATE c SET
LevelUpPoint=0
FROM Character c
inner join @TLS t ON t.NickName=c.Name
COLLATE Latin1_general_CI_AI


-- Dump stats.
UPDATE c SET
cLevel = 1,
Experience = 0,
Money = Money-@ResetMoney,

Strength = Case
when ((Class = 0) OR (Class = 1)) then 18 --DW SM
when ((Class = 16) OR (Class = 17)) then 28 --DK BK
when ((Class = 32) OR (Class = 33)) then 22 --Elf MElf
when (Class = 48 ) then 26 --MG
when (Class = 64) then 26 --DL
End,

Dexterity = Case
when ((Class = 0) OR (Class = 1)) then 18 --DW SM
when ((Class = 16) OR (Class = 17)) then 20 --DK BK
when ((Class = 32) OR (Class = 33)) then 25 --Elf MElf
when (Class = 48 ) then 26 --MG
when (Class = 64) then 26 --DL
End,

Vitality = Case
when ((Class = 0) OR (Class = 1)) then 15 --DW SM
when ((Class = 16) OR (Class = 17)) then 25 --DK BK
when ((Class = 32) OR (Class = 33)) then 20 --Elf MElf
when (Class = 48 ) then 26 --MG
when (Class = 64) then 26 --DL
End,

Energy = Case
when ((Class = 0) OR (Class = 1)) then 30 --DW SM
when ((Class = 16) OR (Class = 17)) then 10 --DK BK
when ((Class = 32) OR (Class = 33)) then 15 --Elf MElf
when (Class = 48 ) then 26 --MG
when (Class = 64) then 26 --DL
End,

Leadership = Case
when (Class = 64) then 26 --DL
end,

MagicList = NULL, -- Clear list of MagicSkills.
-- Clear list of finished quests.
Quest = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF,
Inventory = NULL, -- Clear backpack.

Class = Case -- To appropriate to the player standart class.
when ((Class = 0) OR (Class = 1)) then 0 --SM->DW
when ((Class = 16) OR (Class = 17)) then 16 --BK->DK
when ((Class = 32) OR (Class = 33)) then 32 --ME->FE
when (Class = 48) then 48 --MG
when (Class = 64) then 64 --DL
End,

MapNumber = Case
when ((Class = 0) OR (Class = 1)) then 0 --DW SM
when ((Class = 16) OR (Class = 17)) then 0 --DK BK
when ((Class = 32) OR (Class = 33)) then 3 --FE ME
when (Class = 48 ) then 0 --MG
when (Class = 64) then 0 --DL
End,

MapPosX = Case
when ((Class = 0) OR (Class = 1)) then 125 --DW SM
when ((Class = 16) OR (Class = 17)) then 125 --DK BK
when ((Class = 32) OR (Class = 33)) then 176 --FE ME
when (Class = 48 ) then 125 --MG
when (Class = 64) then 125 --DL
End,

MapPosY= Case
when ((Class = 0) OR (Class = 1)) then 123 --DW SM
when ((Class = 16) OR (Class = 17)) then 123 --DK BK
when ((Class = 32) OR (Class = 33)) then 116 --FE ME
when (Class = 48 ) then 123 --MG
when (Class = 64) then 123 --DL
End,

PkLevel = 3,

LevelUpPoint = Case
when ((Class = 0) OR (Class = 1)) then 300 --DW SM
when ((Class = 16) OR (Class = 17)) then 300 --DK BK
when ((Class = 32) OR (Class = 33)) then 300 --FE ME
when (Class = 48 ) then 300 --MG
when (Class = 64) then 300 --DL
End * (Reset+1),

Reset = Reset+1

FROM Character c
inner join @TLS t ON t.NickName=c.Name
COLLATE Latin1_general_CI_AI


--select * from @TLS


EX:

End



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Job:

Code:
DECLARE @RC int
-- Set parameter values
EXEC @RC = [MuOnline].[dbo].[ScriptReset]


===========================
Auto-Reset Passes for things. Low in presented script, Reset costs 10 "Jewel Of Life". Reset looks like privious. ONLY SEARCHING FOR ITEMS IN PERSONAL SHOP!

-- Reset will be for 10 items
Set @ItemCount=10
-- Reset will be for "Jewel Of Life"
Set @GroupID=14
Set @ItemID=16
-- ResetLevel
Set @ResetLevel=400

@ItemCount - Quantity of things sufficient for Resets.
@GroupID - Group of a thing from Items (*).txt
@ItemID - Number of thing in group from Items(*).txt
@ResetLevel - ResetLevel.


Code:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO


Create PROCEDURE AUTORESET
As
Begin
Set nocount on
Set dateformat dmy

Declare 
@ItemCount int, --quantity
@GroupID int, --group of item
@GroupIDHex varbinary(10),
@ItemID int, --number of item,
@ItemIDHex varbinary(10),
@ResetLevel int, --ResetLevel
@Npp int,
@NppMax int,
@In int,
@InMax int,
@Inventory varbinary(8000),
@PerInv varchar(8000),
@PerInvTMP varchar(8000),
@CharId varchar(10),
@StartPoint int


Set @ItemCount=10
Set @GroupID=14
Set @ItemID=16
Set @ResetLevel=400

--HEX
set @GroupIDHex=dbo.HexStrToVarBin(master.dbo.fn_varbintohexstr(cast(@GroupID*16 as varbinary(1))) )
set @ItemIDHex=dbo.HexStrToVarBin(master.dbo.fn_varbintohexstr(cast(@ItemID as varbinary(1))) )
-- select @GroupIDHex GroupIDHex, @ItemIDHex ItemIDHex

--select '1' '1'
-----====================================================================
Declare @TLS table (CharID varchar(10), inventory varbinary(8000), npp int identity(1,1))
Insert into @TLS (CharID, inventory)
select name, inventory
FROM Character c
JOIN MEMB_STAT m ON c.AccountID = m.memb___id
COLLATE Latin1_general_CI_AI
WHERE (clevel>=@ResetLevel) and (ConnectStat = 0)
if (Select count(*) from @TLS)=0 Goto EX

--[B]Personal Shop Open[/B]
Declare @PS table (CharID varchar(10), ItemBin Varbinary(1000), ItemId int, Ready int, npp int identity(1,1))
set @NppMax=(select max(npp) from @TLS)
set @InMax=32
Set @Npp=0

--select '2' '2'

While @Npp<>@NppMax
begin
Set @Npp=@Npp+1
Set @In=0
Set @StartPoint=-15
Select @CharId=CharId,
@Inventory=substring(Inventory, 1217, 512) --Analising only Personal Shop
from @TLS
where npp=@Npp
While @In<>@InMax
begin
Set @In=@In+1
Set @StartPoint=@StartPoint+16
Insert into @PS (CharID, ItemBin, ItemId, Ready)
select @CharID, substring(@Inventory, @StartPoint, 16), @In, 0
end

end

--Finding JOL's
Update p set
ready=1
from @PS p
where substring(ItemBin,1,1)=@ItemIDHex
and substring(ItemBin,10,1)=@GroupIDHex

--Finding how have got this number of items
Declare @TRES table (CharId varchar(10), inventory varbinary(8000), npp int identity (1,1))
insert into @TRES (CharId)
select CharId
from @PS
where ready=1
group by CharId
having sum(1)>=@ItemCount

-- If haven't got - exit.
if (Select count(*) from @TRES)=0 Goto EX

--select '3' '3'
--[B]Clear needed number of items for reset.[/B]
set @NppMax=(select max(npp) from @TRES)
Set @Npp=0
While @Npp<>@NppMax
begin
Set @Npp=@Npp+1
Set @In=0

Select @CharId=CharId
from @TRES
where npp=@Npp

While @In<>@ItemCount
begin
Set @In=@In+1
Set @StartPoint=(select top 1 npp
from @PS
where CharId=@CharId
and ready=1
and ItemBin<>0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
order by ItemId)
Update p set
ItemBin=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
from @PS p
where npp=@StartPoint
end

end

select '4' '4'

--Need compare list of inventory for everyone who having reset.
set @NppMax=(select max(npp) from @TRES)
Set @Npp=0
select @Npp Npp, @NppMax NppMax
While @Npp<>@NppMax
begin
Set @Npp=@Npp+1
Set @In=0

Select @CharId=CharId
from @TRES
where npp=@Npp

Set @PerInv=''
--select ' 1' ' 1'
While @In<>32
begin
Set @In=@In+1
Set @PerInvTMP=master.dbo.fn_varbintohexstr(
(select ItemBin from @PS where CharId=@CharId and ItemId=@In))
Set @PerInv=@PerInv+substring(@PerInvTMP,3,32)
-- select @PerInvTMP
--select ' 2' ' 2'
end


Select @Inventory=Inventory
from @TLS
where CharId=@CharId

Set @PerInvTMP=master.dbo.fn_varbintohexstr(substring(@Inventory, 1, 1216))
Set @PerInvTMP=@PerInvTMP+@PerInv

-- select @PerInvTMP
Update t set
Inventory=dbo.HexStrToVarBin(@PerInvTMP)
from @TRES t
where npp=@Npp
end


--zeroing stats
UPDATE c SET
clevel= 1,
Experience= 0,
-- Money=Money-100000000, --Reset cost 1 000 000 00 zen
Strength = Case when ((class = 0) OR (class = 1)) then 18 --DW SM
when ((class = 16) OR (class = 17)) then 28 --DK BK
when ((class = 32) OR (class = 33)) then 22 --Elf MElf
when (class = 48 ) then 26 --MG
when (class = 64) then 26 --DL
End,

Dexterity = Case when ((class = 0) OR (class = 1)) then 18 --DW SM
when ((class = 16) OR (class = 17)) then 20 --DK BK
when ((class = 32) OR (class = 33)) then 25 --Elf MElf
when (class = 48 ) then 26 --MG
when (class = 64) then 26 --DL
End,

Vitality = Case when ((class = 0) OR (class = 1)) then 15 --DW SM
when ((class = 16) OR (class = 17)) then 25 --DK BK
when ((class = 32) OR (class = 33)) then 20 --Elf MElf
when (class = 48 ) then 26 --MG
when (class = 64) then 26 --DL
End,

Energy = Case when ((class = 0) OR (class = 1)) then 30 --DW SM
when ((class = 16) OR (class = 17)) then 10 --DK BK
when ((class = 32) OR (class = 33)) then 15 --Elf MElf
when (class = 48 ) then 26 --MG
when (class = 64) then 26 --DL
End,

-- MagicList = NULL, --[B]Magic and skills will be not dissapear.[/B]
MapNumber= Case when ((class = 0) OR (class = 1)) then 0 --DW SM
when ((class = 16) OR (class = 17)) then 0 --DK BK
when ((class = 32) OR (class = 33)) then 3 --Elf MElf
when (class = 48 ) then 0 --MG
when (class = 64) then 0 --DL
End,

MapPosX= Case when ((class = 0) OR (class = 1)) then 125 --DW SM
when ((class = 16) OR (class = 17)) then 125 --DK BK
when ((class = 32) OR (class = 33)) then 176 --Elf MElf
when (class = 48 ) then 125 --MG
when (class = 64) then 125 --DL
End,

MapPosY= Case when ((class = 0) OR (class = 1)) then 123 --DW SM
when ((class = 16) OR (class = 17)) then 123 --DK BK
when ((class = 32) OR (class = 33)) then 116 --Elf MElf
when (class = 48 ) then 123 --MG
when (class = 64) then 123 --DL
End,

PkLevel= 3,

Resets = Resets+1,

LevelUpPoint = Case when ((class = 0) OR (class = 1)) then 500 --DW SM
when ((class = 16) OR (class = 17)) then 500 --DK BK
when ((class = 32) OR (class = 33)) then 500 --Elf MElf
when (class = 48 ) then 650 --MG
when (class = 64) then 700 --DL
End * (Resets + 1),
inventory=t.inventory
FROM Character c
Inner join @TRES t on c.name=t.charid
COLLATE Latin1_general_CI_AI



--, PS varbinary(1000
--select * from @TLS
--select * from @PS
--select * from @TRES




EX:

End



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO





Credits: Google

Note:
Need coded for 3class+summoner.
If you can edit something or decoded it,you're welcome.
 
Last edited:

Aragorn

Well-Known Member
Joined
Apr 11, 2008
Messages
1,257
Reaction score
312
автоматична ресет система която иска и предмети (ако ги нямаш тия предмети няма да можеш да реснеш)
 

viper9x

New Member
Joined
Jan 16, 2010
Messages
12
Reaction score
1
I do not understand this very
You are a new member?
 

Leonid

New Member
Joined
Apr 24, 2010
Messages
4
Reaction score
0
Yeah I'm new member :p This forum helps me and I trying help you!