antuyon
New member
- Joined
- Mar 22, 2020
- Messages
- 2
- Programming Experience
- Beginner
hi guys, thanks for any future help with my problem, I've been trying to work on some game server files and still don't know exactly how the files connect and comunicate to each other. if any one can help me with the following questions, not necessarily have to be answers to all of them, just if you know something about those subjects. im trying to learn C# coding since those files are C# base so the more info I can get the better.
these are the question I have, which are kind of basic haha, but im learning all this stuff and im eager to become a programmer just for hobby and I need some help, im reading some basic C# guides and stuff, but mean while i what to solve those question that are flying over my head.
if you want to go further on helping me and what to take a quick look to the game files I will attach them to the thread, and I will upload the .bin file by itself even though its already on the game files.
drive.google.com
drive.google.com
thank you so much guys, have a nice weekend.
1.- I've been reading this script and it seems that It takes info from a file (I don't know exactly how it does since I don't see the file directory in the script, just know that it request for a public one) so the CS file is named DigimonDB, and has the following script:
so I know it takes the info and then it use it, but I don't know exactly how it work exactly, does it read it, save it and transfer it to another file? or it keep it and then another code call that information?
Also I know this code should be reading this file to get much information : DigimonList.BIN
and thats my next question about.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Digital_World.Helpers;
using System.IO;
using Digital_World.Entities;
namespace Digital_World.Database
{
public class DigimonDB
{
public static Dictionary<int, DigimonData> Digimon = new Dictionary<int, DigimonData>();
public static void Load(string fileName)
{
if (Digimon.Count > 0) return;
using (Stream s = File.OpenRead(fileName))
{
using (BitReader read = new BitReader(s))
{
int count = read.ReadInt();
for (int i = 0; i < count; i++)
{
read.Seek(4 + i * 408);
DigimonData digiData = new DigimonData();
digiData.Species = read.ReadInt();
read.Skip(4);
digiData.DisplayName = read.ReadZString(Encoding.Unicode);
read.Seek(4 + 136 + i * 408);
digiData.Name = read.ReadZString(Encoding.ASCII);
read.Seek(4 + 228 + i * 408);
digiData.HP = read.ReadShort();
digiData.DS = read.ReadShort();
digiData.DE = read.ReadShort();
digiData.EV = read.ReadShort();
digiData.MS = read.ReadShort();
digiData.CR = read.ReadShort();
digiData.AT = read.ReadShort();
digiData.AS = read.ReadShort();
digiData.uStat = read.ReadShort();
digiData.HT = read.ReadShort();
digiData.uShort1 = read.ReadShort();
digiData.Skill1 = read.ReadShort();
digiData.Skill2 = read.ReadShort();
digiData.Skill3 = read.ReadShort();
Digimon.Add(digiData.Species, digiData);
}
}
}
Console.WriteLine("[DigimonDB] Loaded {0} digimon.", Digimon.Count);
}
public static DigimonData GetDigimon(int Species)
{
if (Digimon.ContainsKey(Species))
return Digimon[Species];
else
return null;
}
public static List<int> GetSpecies(string Name)
{
List<int> species = new List<int>();
foreach (KeyValuePair<int, DigimonData> kvp in Digimon)
{
DigimonData dData = kvp.Value;
if (dData.DisplayName.Contains(Name) || dData.Name.Contains(Name))
species.Add(dData.Species);
}
return species;
}
}
public class DigimonData
{
public int Species;
public string Name;
public string DisplayName;
public short HP, DS, DE, AS, MS, CR, AT, EV, uStat, HT, uShort1;
public short Skill1, Skill2, Skill3;
public DigimonData() { }
public DigimonStats Stats(short Size)
{
//TODO: Get Stats
return null;
}
public DigimonStats Default(Character Tamer, int Sync, int Size)
{
DigimonStats Stats = new DigimonStats();
Stats.MaxHP = (short)(Math.Min(Math.Floor((decimal)HP * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.HP * (Sync / 100)), short.MaxValue));
Stats.HP = (short)(Math.Min(Math.Floor((decimal)HP * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.HP * (Sync / 100)), short.MaxValue));
Stats.MaxDS = (short)(Math.Min(Math.Floor((decimal)DS * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.DS * (Sync / 100)), short.MaxValue));
Stats.DS = (short)(Math.Max(Math.Floor((decimal)DS * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.DS * (Sync / 100)), short.MaxValue));
Stats.DE = (short)(Math.Min(Math.Floor((decimal)DE * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.DE * (Sync / 100)), short.MaxValue));
Stats.MS = (short)(Math.Min(Math.Floor((decimal)MS * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.MS * (Sync / 100)), short.MaxValue));
Stats.CR = (short)(Math.Min(Math.Floor((decimal)CR * ((ushort)Size / 10000)), short.MaxValue));
Stats.AT = (short)(Math.Min(Math.Floor((decimal)AT * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.AT * (Sync / 100)), short.MaxValue));
Stats.EV = EV;
Stats.uStat = uStat;
Stats.HT = HT;
Stats.Intimacy = (short)Sync;
return Stats;
}
public override string ToString()
{
return string.Format("{0} [{1}]", DisplayName, Species);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Digital_World.Helpers;
using System.IO;
using Digital_World.Entities;
namespace Digital_World.Database
{
public class DigimonDB
{
public static Dictionary<int, DigimonData> Digimon = new Dictionary<int, DigimonData>();
public static void Load(string fileName)
{
if (Digimon.Count > 0) return;
using (Stream s = File.OpenRead(fileName))
{
using (BitReader read = new BitReader(s))
{
int count = read.ReadInt();
for (int i = 0; i < count; i++)
{
read.Seek(4 + i * 408);
DigimonData digiData = new DigimonData();
digiData.Species = read.ReadInt();
read.Skip(4);
digiData.DisplayName = read.ReadZString(Encoding.Unicode);
read.Seek(4 + 136 + i * 408);
digiData.Name = read.ReadZString(Encoding.ASCII);
read.Seek(4 + 228 + i * 408);
digiData.HP = read.ReadShort();
digiData.DS = read.ReadShort();
digiData.DE = read.ReadShort();
digiData.EV = read.ReadShort();
digiData.MS = read.ReadShort();
digiData.CR = read.ReadShort();
digiData.AT = read.ReadShort();
digiData.AS = read.ReadShort();
digiData.uStat = read.ReadShort();
digiData.HT = read.ReadShort();
digiData.uShort1 = read.ReadShort();
digiData.Skill1 = read.ReadShort();
digiData.Skill2 = read.ReadShort();
digiData.Skill3 = read.ReadShort();
Digimon.Add(digiData.Species, digiData);
}
}
}
Console.WriteLine("[DigimonDB] Loaded {0} digimon.", Digimon.Count);
}
public static DigimonData GetDigimon(int Species)
{
if (Digimon.ContainsKey(Species))
return Digimon[Species];
else
return null;
}
public static List<int> GetSpecies(string Name)
{
List<int> species = new List<int>();
foreach (KeyValuePair<int, DigimonData> kvp in Digimon)
{
DigimonData dData = kvp.Value;
if (dData.DisplayName.Contains(Name) || dData.Name.Contains(Name))
species.Add(dData.Species);
}
return species;
}
}
public class DigimonData
{
public int Species;
public string Name;
public string DisplayName;
public short HP, DS, DE, AS, MS, CR, AT, EV, uStat, HT, uShort1;
public short Skill1, Skill2, Skill3;
public DigimonData() { }
public DigimonStats Stats(short Size)
{
//TODO: Get Stats
return null;
}
public DigimonStats Default(Character Tamer, int Sync, int Size)
{
DigimonStats Stats = new DigimonStats();
Stats.MaxHP = (short)(Math.Min(Math.Floor((decimal)HP * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.HP * (Sync / 100)), short.MaxValue));
Stats.HP = (short)(Math.Min(Math.Floor((decimal)HP * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.HP * (Sync / 100)), short.MaxValue));
Stats.MaxDS = (short)(Math.Min(Math.Floor((decimal)DS * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.DS * (Sync / 100)), short.MaxValue));
Stats.DS = (short)(Math.Max(Math.Floor((decimal)DS * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.DS * (Sync / 100)), short.MaxValue));
Stats.DE = (short)(Math.Min(Math.Floor((decimal)DE * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.DE * (Sync / 100)), short.MaxValue));
Stats.MS = (short)(Math.Min(Math.Floor((decimal)MS * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.MS * (Sync / 100)), short.MaxValue));
Stats.CR = (short)(Math.Min(Math.Floor((decimal)CR * ((ushort)Size / 10000)), short.MaxValue));
Stats.AT = (short)(Math.Min(Math.Floor((decimal)AT * ((ushort)Size / 10000)) + Math.Floor((decimal)Tamer.AT * (Sync / 100)), short.MaxValue));
Stats.EV = EV;
Stats.uStat = uStat;
Stats.HT = HT;
Stats.Intimacy = (short)Sync;
return Stats;
}
public override string ToString()
{
return string.Format("{0} [{1}]", DisplayName, Species);
}
}
}
Also I know this code should be reading this file to get much information : DigimonList.BIN
and thats my next question about.
2.- how can I read the information stored in such binary files (.bin) I've been trying to look for programs that can help me but all I get is periods, periods and more periods, I know the code read it using Bitreader but if visual basic is capable of reading it there is some way for me to get that info in a text file right? apparently that .bin file only stores text information? how can I get that information for me to read it and modify it? its possible to create a script capable of read the whole archive information and then transfer that to a text file?
3.- if you were going to work on this server files, would you get rid of the .bin files and work in some sort of XML files to store such info or just keep the .bin files? I would really be more satisfied working on XML but i really don't know what information is stored on the bin files thats why im struggling on advancing on it, cause can't fin a way of extracting the information of such files.
these are the question I have, which are kind of basic haha, but im learning all this stuff and im eager to become a programmer just for hobby and I need some help, im reading some basic C# guides and stuff, but mean while i what to solve those question that are flying over my head.
if you want to go further on helping me and what to take a quick look to the game files I will attach them to the thread, and I will upload the .bin file by itself even though its already on the game files.
Comfy-Mittens-Digital-World-dae79b3.zip

DigimonList.bin

thank you so much guys, have a nice weekend.