Originally Posted by Azumi
Awhh ok , I think I give up , this forums has been helpful with quite a few things to everyone so I will post the little guide I wrote.
Bear in mind , you will need to know a little of what you are doing to perform all this oh and this was all written with a bad headache so ... dont expect it all to be absolutely perfect.
Use two copys of the redmoon 4.4 server ( example c:\redmoon44 and c:\redmoonBD )
MAKE SURE your ServerMgr ini file points to the new location in the 2nd copy.
Add in a replica database called RMBattleArena. Change the values in the rmserver.ni
that say RMBrain0 and RMBrain1 , to RMBrain2 and RMBrain3. And make sure your
datasources [ODBC] are named this and linked to your second database.
Open the config file for your MAIN server ( not BD ) and add in 1_ infront of
maps 132-136 so it should look like:
1_132=111.111.111.111, 10252
1_133=111.111.111.111, 10253
1_134=111.111.111.111, 10254
1_135=111.111.111.111, 10255
1_136=111.111.111.111, 10256
Open the Config file for your BD SERVER and put a 1_ infront of map 21
1_21=111.111.111.111
Now that you have a second database linked to rmbrain2 and 3 , you need to
change some proceedures and add in some proceedures.
First one : USERDB_INSERTBATTLEID
create a new proceedure in BOTH the main server and battle server proceedures.
Copy Paste the following into it: ( remove anything that is in there to start with )
-------------------[START OF CODE]dont copy paste this line-----------------------
CREATE PROCEDURE dbo.RMS_USERDB_INSERTBATTLEID
@GameID varchar(14),
@BillID varchar(14),
@Face int,
@Color1 int,
@Color2 int
AS
set nocount on
begin transaction RMS_USERDB_INSERTBATTLEID
DELETE RMBattleArena.dbo.tblGameID1 WHERE GameID=@GameID and BillID=@BillID
INSERT INTO RMBattleArena.dbo.tblGameID1 (Version, lvl , Map, X, Y, TileKind, Item, Equipment, Skill, SpecialSkill, Strength, Spirit, Dexterity, Power, Fame, Experiment, HP, MP, SP, DP, Bonus, Money, QuickItem, QuickSkill, QuickSpecialSkill, BankMoney, BankItem, SETimer, PKTimer, PoisonUsedDate, LovePoint, ToMap, SurvivalEvent, SurvivalTime, Bonus2, Sbonus, STotalBonus, BonusInitCount, TLETimer, OpArmy, BankSigMoney,SigMoney,PKPenaltyDecreaseTimer, ArmyHired, ArmyMarkIndex, Permission, OPPKTimer, PKPenaltyCount, BankItem2, BankPassword, MailPassword, SpouseGameID, GameID, BillID, Face, Color1, Color2) VALUES (100, 1, 132, 57, 16, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 2000, 2000, 2000, 0, 2, 200000000, 0, 0, 0, 20000000, 0, 0, 0, 2005/02/02, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @GameID, @BillID, @Face, @Color1, @Color2)
DELETE tblSpecialItem1 WHERE GameID=@GameID
begin
commit transaction RMS_USERDB_INSERTBATTLEID
end
GO
==================END OF CODE DONT COPY PASTE THIS LINE============================
Next up is when the BD starts. Edit your INIZIALIZEBATTLEZONE proceedure
in your BattleServer Database NOT THE MAIN SERVER. Take out all the text contained within it
and copy paste the following:
------------------START OF CODE-----------------------------------
CREATE PROCEDURE RMS_INITIALIZEBILLBATTLEZONE
@ZoneIndex int
AS
set nocount on
declare @Error int
set @Error = 1
begin transaction
delete tblCurrentBattleZoneScore where ZoneIndex = @ZoneIndex
delete redmoon.dbo.tblCurrentBattleArenaScore where ZoneIndex = @ZoneIndex
select @Error = @@ERROR
if 0 = @Error
begin
commit transaction
end
else
begin
rollback transaction
end
GO
==========================END OF CODE================================
Next is the registration of scores whilst in battle game. Same as above
delete everything in proceedure INCREASEBATTLEZONESCORE. And copy paste
the following into it:
---------------------START OF CODE-----------------------------------
CREATE PROCEDURE RMS_INCREASEBATTLEZONESCORE
@ZoneIndex int,
@WinnerGameID varchar(14),
@WinnerBillID varchar(14),
@WinnerServerIndex int,
@LoserGameID varchar(14),
@LoserBillID varchar(14),
@LoserServerIndex int,
@Score int
AS
set nocount on
declare @WinnerCount int, @LoserCount int, @WinnerUpdateError int, @LoserUpdateError int
set @WinnerCount = 0
set @LoserCount = 0
set @WinnerUpdateError = 1
set @LoserUpdateError = 1
begin transaction
select @WinnerCount = count(*) from tblCurrentBattleZoneScore where GameID = @WinnerGameID and BillID = @WinnerBillID and ServerIndex = @WinnerServerIndex
if @WinnerCount = 0
begin
insert tblCurrentBattleZoneScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @WinnerGameID, @WinnerBillID, @WinnerServerIndex)
insert redmoon.dbo.tblCurrentBattleArenaScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @WinnerGameID, @WinnerBillID, @WinnerServerIndex)
insert redmoon.dbo.tblBattleArenaScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @WinnerGameID, @WinnerBillID, @WinnerServerIndex)
insert tblBattleZoneScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @WinnerGameID, @WinnerBillID, @WinnerServerIndex)
insert tblBattleArenaScore (ZoneIndex, GameID, BillID, ServerIndex) values (1, @WinnerGameID, @WinnerBillID, @WinnerServerIndex)
end
select @LoserCount = count(*) from tblCurrentBattleZoneScore where GameID = @LoserGameID and BillID = @LoserBillID and ServerIndex = @LoserServerIndex
if @LoserCount = 0
begin
insert tblCurrentBattleZoneScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @LoserGameID, @LoserBillID, @LoserServerIndex)
insert redmoon.dbo.tblCurrentBattleArenaScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @LoserGameID, @LoserBillID, @LoserServerIndex)
insert tblBattleZoneScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @LoserGameID, @LoserBillID, @LoserServerIndex)
insert redmoon.dbo.tblBattleArenaScore (ZoneIndex, GameID, BillID, ServerIndex) values (@ZoneIndex, @LoserGameID, @LoserBillID, @LoserServerIndex)
insert tblBattleArenaScore (ZoneIndex, GameID, BillID, ServerIndex) values (1, @LoserGameID, @LoserBillID, @LoserServerIndex)
end
update tblCurrentBattleZoneScore set Win = Win + 1, Score = Score + @Score where GameID = @WinnerGameID and BillID = @WinnerBillID and ServerIndex = @WinnerServerIndex
update redmoon.dbo.tblCurrentBattleArenaScore set Win = Win + 1, Score = Score + @Score where GameID = @WinnerGameID and BillID = @WinnerBillID and ServerIndex = @WinnerServerIndex
update tblBattleZoneScore set Win = Win + 1, Score = Score + @Score where GameID = @WinnerGameID and BillID = @WinnerBillID and ServerIndex = @WinnerServerIndex
update tblBattleArenaScore set Win = Win + 1, Score = Score + @Score where GameID = @WinnerGameID and BillID = @WinnerBillID and ServerIndex = @WinnerServerIndex
update redmoon.dbo.tblBattleArenaScore set Win = Win + 1, Score = Score + @Score where GameID = @WinnerGameID and BillID = @WinnerBillID and ServerIndex = @WinnerServerIndex
select @WinnerUpdateError = @@ERROR
update tblCurrentBattleZoneScore set Lose = Lose + 1 where GameID = @LoserGameID and BillID = @LoserBillID and ServerIndex = @LoserServerIndex
update redmoon.dbo.tblCurrentBattleArenaScore set Lose = Lose + 1 where GameID = @LoserGameID and BillID = @LoserBillID and ServerIndex = @LoserServerIndex
update tblBattleZoneScore set Lose = Lose + 1 where GameID = @LoserGameID and BillID = @LoserBillID and ServerIndex = @LoserServerIndex
update redmoon.dbo.tblBattleArenaScore set Lose = Lose + 1 where GameID = @LoserGameID and BillID = @LoserBillID and ServerIndex = @LoserServerIndex
update tblBattleArenaScore set Lose = Lose + 1 where GameID = @LoserGameID and BillID = @LoserBillID and ServerIndex = @LoserServerIndex
select @LoserUpdateError = @@ERROR
if @WinnerUpdateError = 0 and @LoserUpdateError = 0
begin
commit transaction
end
else
begin
rollback transaction
end
GO
=====================END OF CODE==========================================
Next one is ELECTCHAMPIONANDCLEANUPBATTLEZONE. Same as above but use the
following:
----------------------START OF CODE---------------------------
CREATE PROCEDURE RMS_ELECTCHAMPIONANDCLEANUPBATTLEZONE
@ZoneIndex int,
@Time datetime,
@Today datetime
AS
set nocount on
declare @GameID varchar(14), @BillID varchar(14), @ServerIndex int, @TodaySendItemCount int
declare @Error int, @ScoreCount int, @Win int, @Lose int, @Score int
set @TodaySendItemCount = 1
set @Error = 0
begin transaction
select top 1 @GameID = GameID, @BillID = BillID, @ServerIndex = ServerIndex from tblBattleArenaScore with (TABLOCKX) where Win > 0 And ZoneIndex = @ZoneIndex order by Win desc, EndLevel desc, sign(EndExperience), EndExperience desc
if @@ROWCOUNT > 0
begin
select @TodaySendItemCount = count(*) from tblBattleArenaChampionLog where GameID = @GameID and BillID = @BillID and Time >= @Today and Time < dateadd(day, 1, @Today) and SendItem = 1
select @Error = @@ERROR
if @Error = 0
begin
if @TodaySendItemCount > 0
begin
insert tblBattleArenaChampionLog (ZoneIndex, GameID, BillID, ServerIndex, Time) values (@ZoneIndex, @GameID, @BillID, @ServerIndex, @Time)
select @Error = @@ERROR
end
else
begin
insert tblBattleArenaChampionLog (ZoneIndex, GameID, BillID, ServerIndex, Time, SendItem, MailSent) values (@ZoneIndex, @GameID, @BillID, @ServerIndex, @Time, 1, 1)
select @Error = @@ERROR
end
end
end
declare user_cursor cursor for
select GameID, BillID, ServerIndex, Win, Lose, Score from tblCurrentBattleArenaScore where ZoneIndex = @ZoneIndex
open user_cursor
fetch next from user_cursor into @GameID, @BillID, @ServerIndex, @Win, @Lose, @Score
while @@FETCH_STATUS = 0 and @Error = 0
begin
select @ScoreCount = count(*) from tblBattleArenaScore where GameID = @GameID and BillID = @BillID and ServerIndex = @ServerIndex
select @Error = @@ERROR
if @Error = 0
begin
if @ScoreCount = 0
begin
insert tblBattleArenaScore (GameID, BillID, ServerIndex, Win, Lose, Score) values (@GameID, @BillID, @ServerIndex, @Win, @Lose, @Score)
insert redmoon.dbo.tblBattleArenaScore (GameID, BillID, ServerIndex, Win, Lose, Score) values (@GameID, @BillID, @ServerIndex, @Win, @Lose, @Score)
select @Error = @@ERROR
end
else
begin
update tblBattleArenaScore set Win = Win + @Win, Lose = Lose + @Lose, Score = Score + @Score where BillID = @BillID and GameID = @GameID and ServerIndex = @ServerIndex
update redmoon.dbo.tblBattleArenaScore set Win = Win + @Win, Lose = Lose + @Lose, Score = Score + @Score where BillID = @BillID and GameID = @GameID and ServerIndex = @ServerIndex
select @Error = @@ERROR
end
end
fetch next from user_cursor into @GameID, @BillID, @ServerIndex, @Win, @Lose, @Score
end
close user_cursor
deallocate user_cursor
if @Error = 0
begin
insert into tblBattleZoneScoreLog (ZoneIndex, GameID, BillID, ServerIndex, Win, Lose, Score, NormalEnd, EndLevel, EndExperience) select ZoneIndex, GameID, BillID, ServerIndex, Win, Lose, Score, NormalEnd, EndLevel, EndExperience from tblCurrentBattleZoneScore
delete tblCurrentBattleZoneScore where ZoneIndex = @ZoneIndex
insert into redmoon.dbo.tblBattleArenaScoreLog (ZoneIndex, GameID, BillID, ServerIndex, Win, Lose, Score, NormalEnd, EndLevel, EndExperience) select ZoneIndex, GameID, BillID, ServerIndex, Win, Lose, Score, NormalEnd, EndLevel, EndExperience from redmoon.dbo.tblCurrentBattleArenaScore
delete redmoon.dbo.tblCurrentBattleZoneScore where ZoneIndex = @ZoneIndex
select @Error = @@ERROR
end
if @Error = 0
begin
EXEC RMBattleArena.dbo.RMS_SENDBATTLEPRIZETMAIL 'Kasham', @GameID, 'Congradulations', 'You are the lastest winner in
the Battle Dimension! , congradulations! , here is your prize', 6, 66, 1
commit transaction
end
else
begin
rollback transaction
end
GO
====================END OF CODE===============================================
Next is the clean up of your battle dimension server proceedure called
CLEANUPGAMEBATTLE
Delete everything from in that and insert this:
------------------START OF CODE---------------
CREATE PROCEDURE RMS_CLEANUPGAMEBATTLE AS
set nocount on
Begin
DELETE RMBattleArena.dbo.tblBattleArenaScore
DELETE RMBattleArena.dbo.tblCurrentBattleZoneScore
DELETE RMBattleArena.dbo.tblGameID1
DELETE RMBattleArena.dbo.tblSpecialItem1
End
GO
==============END OF CODE=======================
Last But Not leased : Sending the prize mail. Open stored proceedure SENDBATTLEPRIZEMAIL and delete it's entire content. then copy paste the following into it.:
------------------Start of code---------------------------------------------
CREATE PROCEDURE RMS_SENDBATTLEPRIZETMAIL
@Sender varchar(14),
@Recipient varchar(14),
@Title varchar(80),
@Content varchar(1000),
@ItemKind int,
@ItemIndex int,
@ItemCount int
AS
set nocount on
declare @MailCount int
declare @Time datetime
set @MailCount = 0
set @Time=cast(convert(varchar, GetDate(), 120) as datetime)
If @ItemCount>100
begin
set @ItemCount=100
end
if @ItemKind!=6
begin
set @ItemCount=0
end
begin transaction
select @MailCount = count(*) from RedMoon.dbo.tblMail1 where Recipient =@Recipient and Time = @Time
while @MailCount > 0
begin
set @MailCount = 0
set @Time = dateadd(second, 1, @Time)
select @MailCount = count(*) from RedMoon.dbo.tblMail1 where Recipient = @Recipient and Time = @Time
end
while @ItemCount>0
begin
insert RedMoon.dbo.tblSpecialItem1 (ItemKind, ItemIndex, ItemDurability, Position, Map, X, Y, TileKind, GameID, WindowKind, WindowIndex, MiscTime, AttackGrade, StrengthGrade, SpiritGrade, DexterityGrade, PowerGrade) values (@ItemKind, @ItemIndex, 4, 2, 1, 100, 100, 1, @Recipient, 100, 0, @Time, 0, 0, 0, 0, 0)
set @ItemCount=@ItemCount -1
end
insert RedMoon.dbo.tblMail1 (Time, Recipient, Sender, ReadOrNot, Title, Line, Content, Item) values(@Time, @Recipient,@Sender, 0, @Title, 20, @Content, '')
commit transaction
GO
=========END OF CODE========================
Next up is the editing fo some tables.
First one is going to be tblBattleArenaScore.
Right click and select DESIGN TABLE.
If the following are missing, add them in as int.
EndLevel
EndExperience
NormalEnd
ZoneIndex
Do not allow nulls atall in this table.
Now set some default values as the following:
ServerIndex default value 1
Win default value 0
Lose default value 0
Score default value 0
ZoneIndex default value 1
Once that's done, close it and save.
Next two are tblBattleZoneScore and tblCurrentBattleZoneScore
Add default values the same as above.
Then tblBattleArenaChampionLog
zone and server index 1
Mail sent 0
Sent Item 0
Add default Values to tblbattlezonescorelog the same as what you
did for BattleArenaScore.
Ok thats the battle server done. You may run into some special item problems
but they are easy enough to sort out.
You must start the map center from your BD server folder. You must also
start it with the switch -BattleArena. All the BA maps must also be
started with -BattleArena otherwise respawn wont work. You also run SVALIVEIP
with the switch -BattleArena. Do not run IpServ , remove it from your rmServermgr
ini file along with all maps other than 132 - 136.
You do not need to open the Map Center from your main server folder. 2 map
centers open will stop all communication between outside and inside the BD.
So what you should have open is the following:
IPserv.exe from the main server folder
RMServMgr.exe from the main server folder.
Map Center for RMBattleLeague.exe from the BD folder
SVAliveIp from the BD folder
RMServMgr.exe from the BD folder
Remeber to set the BD times in the config file for BOTH servers.
They must be exactly the same times.
Just to double check and make sure you know. You still need RMBrain0 and 1 , so you make 2 new brains called 2 and 3 like the following