123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- using Client.MirSounds;
- using System;
- using System.IO;
- using System.Windows.Forms;
- namespace Client
- {
- class Settings
- {
- public const long CleanDelay = 200000; //600000
- public static int ScreenWidth = 1024, ScreenHeight = 768;
- // public static int ScreenWidth = 640, ScreenHeight = 480;
- private static InIReader Reader = new InIReader(@".\Mir3Config.ini");
- private static bool _useTestConfig;
- public static bool UseTestConfig
- {
- get
- {
- return _useTestConfig;
- }
- set
- {
- //if (value == true)
- //{
- // Reader = new InIReader(@".\Mir2Test.ini");
- //}
- _useTestConfig = value;
- }
- }
- public const string DataPath = @".\Data\",
- MapPath = @".\Map\",
- SoundPath = @".\Sound\",
- ExtraDataPath = @".\Data\Extra\",
- ShadersPath = @".\Data\Shaders\",
- MonsterPath = @".\Data\Monster\",
- Mir3MonsterPath = @".\Data\Mir3monster\",
- GatePath = @".\Data\Gate\",
- NPCPath = @".\Data\NPC\",
- CArmourPath = @".\Data\CArmour\",
- CWeaponPath = @".\Data\CWeapon\",
- CHairPath = @".\Data\CHair\",
- AArmourPath = @".\Data\AArmour\",
- AWeaponPath = @".\Data\AWeapon\",
- AHairPath = @".\Data\AHair\",
- ARArmourPath = @".\Data\ARArmour\",
- ARWeaponPath = @".\Data\ARWeapon\",
- ARHairPath = @".\Data\ARHair\",
- CHumEffectPath = @".\Data\CHumEffect\",
- AHumEffectPath = @".\Data\AHumEffect\",
- ARHumEffectPath = @".\Data\ARHumEffect\",
- MountPath = @".\Data\Mount\",
- FishingPath = @".\Data\Fishing\",
- PetsPath = @".\Data\Pet\",
- TransformPath = @".\Data\Transform\",
- TransformMountsPath = @".\Data\TransformRide2\",
- TransformEffectPath = @".\Data\TransformEffect\",
- TransformWeaponEffectPath = @".\Data\TransformWeaponEffect\";
- //Logs
- public static bool LogErrors = true;
- public static bool LogChat = true;
- public static int RemainingErrorLogs = 100;
- //Graphics
- public static bool FullScreen = true, TopMost = true;
- public static string FontName = "Tahoma"; //"字体"
- //public static FontFamily
- public static bool FPSCap = true;
- public static int MaxFPS = 100;
- public static int Resolution = 1024;
- public static bool DebugMode = false;
- //Network
- public static bool UseConfig = true;
- public static string IPAddress = "127.0.0.1";//默认读取IP
- public static string IPAddress1;
- public static string IPAddress2;
- public static string IPAddress3;
- public static string IPAddress4;
- public static string IPAddress5;
- public static int partnum = 0; //记录登陆器选择的区服
- // public static string IPAddress = "221.226.58.2";//默认读取IP
- //五区IP列表
- public static string[] pt5iplist = new string[] { "139.196.37.152", "47.102.40.232" }; // ,"139.196.186.213","101.133.156.32"
- //三区IP列表
- public static string[] pt3iplist = new string[] { "47.116.112.48", "106.14.123.206" };
- //测试IP列表
- public static string[] pt9iplist = new string[] { "172.19.11.3" };
- public static int Port = 7000;
- public const int TimeOut = 5000;
- //Sound
- public static int SoundOverLap = 3;
- private static byte _volume = 50;
- public static byte Volume
- {
- get { return _volume; }
- set
- {
- if (_volume == value) return;
- _volume = (byte)(value > 100 ? 100 : value);
- if (_volume == 0)
- SoundManager.Vol = -10000;
- else
- SoundManager.Vol = (int)(-3000 + (3000 * (_volume / 100M)));
- }
- }
- private static byte _musicVolume = 50;
- public static byte MusicVolume
- {
- get { return _musicVolume; }
- set
- {
- if (_musicVolume == value) return;
- _musicVolume = (byte)(value > 100 ? 100 : value);
- if (_musicVolume == 0)
- SoundManager.MusicVol = -10000;
- else
- SoundManager.MusicVol = (int)(-3000 + (3000 * (_musicVolume / 100M)));
- }
- }
- //Game
- public static string AccountID = "",
- Password = "";
- public static bool
- SkillMode = false,
- SkillBar = true,
- //SkillSet = true,
- Effect = true,
- LightEffect = false,
- LevelEffect = true,
- DropView = true,
- NameView = true,
- HPView = true,
- TransparentChat = false,
- DuraView = false,
- DisplayDamage = true,
- TargetDead = true;
- public static int[,] SkillbarLocation = new int[2, 2] { { 0, 0 }, { 216, 0 } };
- //Quests
- public static int[] TrackedQuests = new int[5];
- //Chat
- public static bool
- ShowNormalChat = true,
- ShowYellChat = true,
- ShowWhisperChat = true,
- ShowLoverChat = true,
- ShowMentorChat = true,
- ShowGroupChat = true,
- ShowGuildChat = true;
- //Filters
- public static bool
- FilterNormalChat = false,
- FilterWhisperChat = false,
- FilterShoutChat = false,
- FilterSystemChat = false,
- FilterLoverChat = false,
- FilterMentorChat = false,
- FilterGroupChat = false,
- FilterGuildChat = false,
- FilterShout3Chat = false; //世界喊话
- //AutoPatcher
- public static bool P_Patcher = false;
- public static string P_Host = @""; //ftp://127.0.0.1
- public static string P_PatchFileName = @"PList.gz";
- public static bool P_NeedLogin = false;
- public static string P_Login = string.Empty;
- public static string P_Password = string.Empty;
- public static string P_ServerName = string.Empty;
- public static string P_BrowserAddress = "";
- public static string P_Client = Application.StartupPath + "\\";
- public static bool P_AutoStart = false;
- //Auxsetup
- public static int HPItemIndexed = 0;
- public static int MPItemIndexed = 0;
- public static string HPName;
- public static string MPName;
- public static int HPNum;
- public static int MPNum;
- public static bool HpSelected = false;
- public static bool MpSelected = false;
- public static bool FightMpSelected = false;
- public static bool AutoHpSelected = false;
- public static bool AutoMpSelected = false;
- public static bool ShildSelected = false;
- public static bool EShildSelected = false;
- public static bool AutoAmulet = false;
- // public static bool Shenshengzj = false; //神圣战甲术是否启用绑定
- public static int Shenshengzjfu = 0; //具体绑定那个符
- // public static bool youlindun = false; //幽灵盾是否启用绑定
- public static int youlindunfu = 0; //具体绑定那个符
- // public static bool qiangmozhenfa = false; //强魔是否启用绑定
- public static int qiangmozhenfafu = 0; //具体绑定那个符
- // public static bool menghuqiansshi = false; //猛虎是否启用绑定
- public static int menghuqiansshifu = 0; //具体绑定那个符
- // public static bool zhaohuankulou = false; //骷髅是否启用绑定
- public static int zhaohuankuloufu = 0; //具体绑定那个符
- // public static bool zhaohuashenshou = false; //神圣是否启用绑定
- public static int zhaohuashenshoufu = 0; //具体绑定那个符
- public static void Load()
- {
- if (!Directory.Exists(DataPath)) Directory.CreateDirectory(DataPath);
- if (!Directory.Exists(MapPath)) Directory.CreateDirectory(MapPath);
- if (!Directory.Exists(SoundPath)) Directory.CreateDirectory(SoundPath);
- //Graphics
- FullScreen = Reader.ReadBoolean("Graphics", "FullScreen", FullScreen);
- TopMost = Reader.ReadBoolean("Graphics", "AlwaysOnTop", TopMost);
- // FPSCap = Reader.ReadBoolean("Graphics", "FPSCap", FPSCap);
- Resolution = Reader.ReadInt32("Graphics", "Resolution", Resolution);
- DebugMode = Reader.ReadBoolean("Graphics", "DebugMode", DebugMode);
- //Network
- UseConfig = Reader.ReadBoolean("Network", "UseConfig", UseConfig);
- if (UseConfig)
- {
- IPAddress = Reader.ReadString("Network", "IPAddress", IPAddress);//读取客户配置文件中IP
- IPAddress1 = Reader.ReadString("Network", "IPAddress1", IPAddress2);
- IPAddress2 = Reader.ReadString("Network", "IPAddress2", IPAddress2);
- IPAddress3 = Reader.ReadString("Network", "IPAddress3", IPAddress3);
- IPAddress4 = Reader.ReadString("Network", "IPAddress4", IPAddress4);
- IPAddress5 = Reader.ReadString("Network", "IPAddress5", IPAddress5);
- Port = Reader.ReadInt32("Network", "Port", Port);
- }
- //Logs
- LogErrors = Reader.ReadBoolean("Logs", "LogErrors", LogErrors);
- LogChat = Reader.ReadBoolean("Logs", "LogChat", LogChat);
- //Sound
- Volume = Reader.ReadByte("Sound", "Volume", Volume);
- SoundOverLap = Reader.ReadInt32("Sound", "SoundOverLap", SoundOverLap);
- MusicVolume = Reader.ReadByte("Sound", "Music", MusicVolume);
- //Game
- AccountID = Reader.ReadString("Game", "AccountID", AccountID);
- Password = Reader.ReadString("Game", "Password", Password);
- SkillMode = Reader.ReadBoolean("Game", "SkillMode", SkillMode);
- SkillBar = Reader.ReadBoolean("Game", "SkillBar", SkillBar);
- //SkillSet = Reader.ReadBoolean("Game", "SkillSet", SkillSet);
- Effect = Reader.ReadBoolean("Game", "Effect", Effect);
- LightEffect = Reader.ReadBoolean("Game", "LightEffect", LightEffect);
- LevelEffect = Reader.ReadBoolean("Game", "LevelEffect", Effect);
- DropView = Reader.ReadBoolean("Game", "DropView", DropView);
- NameView = Reader.ReadBoolean("Game", "NameView", NameView);
- HPView = Reader.ReadBoolean("Game", "HPMPView", HPView);
- FontName = Reader.ReadString("Game", "FontName", FontName);
- TransparentChat = Reader.ReadBoolean("Game", "TransparentChat", TransparentChat);
- DisplayDamage = Reader.ReadBoolean("Game", "DisplayDamage", DisplayDamage);
- TargetDead = Reader.ReadBoolean("Game", "TargetDead", TargetDead);
- DuraView = Reader.ReadBoolean("Game", "DuraWindow", DuraView);
- for (int i = 0; i < SkillbarLocation.Length / 2; i++)
- {
- SkillbarLocation[i, 0] = Reader.ReadInt32("Game", "Skillbar" + i.ToString() + "X", SkillbarLocation[i, 0]);
- SkillbarLocation[i, 1] = Reader.ReadInt32("Game", "Skillbar" + i.ToString() + "Y", SkillbarLocation[i, 1]);
- }
- //Chat
- ShowNormalChat = Reader.ReadBoolean("Chat", "ShowNormalChat", ShowNormalChat);
- ShowYellChat = Reader.ReadBoolean("Chat", "ShowYellChat", ShowYellChat);
- ShowWhisperChat = Reader.ReadBoolean("Chat", "ShowWhisperChat", ShowWhisperChat);
- ShowLoverChat = Reader.ReadBoolean("Chat", "ShowLoverChat", ShowLoverChat);
- ShowMentorChat = Reader.ReadBoolean("Chat", "ShowMentorChat", ShowMentorChat);
- ShowGroupChat = Reader.ReadBoolean("Chat", "ShowGroupChat", ShowGroupChat);
- ShowGuildChat = Reader.ReadBoolean("Chat", "ShowGuildChat", ShowGuildChat);
- //Filters
- FilterNormalChat = Reader.ReadBoolean("Filter", "FilterNormalChat", FilterNormalChat);
- FilterWhisperChat = Reader.ReadBoolean("Filter", "FilterWhisperChat", FilterWhisperChat);
- FilterShoutChat = Reader.ReadBoolean("Filter", "FilterShoutChat", FilterShoutChat);
- FilterSystemChat = Reader.ReadBoolean("Filter", "FilterSystemChat", FilterSystemChat);
- FilterLoverChat = Reader.ReadBoolean("Filter", "FilterLoverChat", FilterLoverChat);
- FilterMentorChat = Reader.ReadBoolean("Filter", "FilterMentorChat", FilterMentorChat);
- FilterGroupChat = Reader.ReadBoolean("Filter", "FilterGroupChat", FilterGroupChat);
- FilterGuildChat = Reader.ReadBoolean("Filter", "FilterGuildChat", FilterGuildChat);
- //AutoPatcher
- P_Patcher = Reader.ReadBoolean("Launcher", "Enabled", P_Patcher);
- P_Host = Reader.ReadString("Launcher", "Host", P_Host);
- P_PatchFileName = Reader.ReadString("Launcher", "PatchFile", P_PatchFileName);
- P_NeedLogin = Reader.ReadBoolean("Launcher", "NeedLogin", P_NeedLogin);
- P_Login = Reader.ReadString("Launcher", "Login", P_Login);
- P_Password = Reader.ReadString("Launcher", "Password", P_Password);
- P_AutoStart = Reader.ReadBoolean("Launcher", "AutoStart", P_AutoStart);
- P_ServerName = Reader.ReadString("Launcher", "ServerName", P_ServerName);
- // P_BrowserAddress = Reader.ReadString("Launcher", "Browser", P_BrowserAddress);读取配置文件中网站
- if (!P_Host.EndsWith("/")) P_Host += "/";
- if (P_Host.StartsWith("www.", StringComparison.OrdinalIgnoreCase)) P_Host = P_Host.Insert(0, "http://");
- //if (P_BrowserAddress.StartsWith("www.", StringComparison.OrdinalIgnoreCase)) P_BrowserAddress = P_BrowserAddress.Insert(0, "http://");
- //Auxsetup
- // HPItemIndexed= Reader.ReadInt32("Auxsetup", "HPItemIndexed" ,HPItemIndexed);
- // MPItemIndexed = Reader.ReadInt32("Auxsetup", "MPItemIndexed", MPItemIndexed);
- }
- public static void Save()
- {
- //Graphics
- Reader.Write("Graphics", "FullScreen", FullScreen);
- Reader.Write("Graphics", "AlwaysOnTop", TopMost);
- Reader.Write("Graphics", "FPSCap", FPSCap);
- Reader.Write("Graphics", "Resolution", Resolution);
- Reader.Write("Graphics", "DebugMode", DebugMode);
- //Sound
- Reader.Write("Sound", "Volume", Volume);
- Reader.Write("Sound", "Music", MusicVolume);
- //Game
- Reader.Write("Game", "AccountID", AccountID);
- Reader.Write("Game", "Password", Password);
- Reader.Write("Game", "SkillMode", SkillMode);
- Reader.Write("Game", "SkillBar", SkillBar);
- //Reader.Write("Game", "SkillSet", SkillSet);
- Reader.Write("Game", "Effect", Effect);
- Reader.Write("Game", "LightEffect", LightEffect);
- Reader.Write("Game", "LevelEffect", LevelEffect);
- Reader.Write("Game", "DropView", DropView);
- Reader.Write("Game", "NameView", NameView);
- Reader.Write("Game", "HPMPView", HPView);
- Reader.Write("Game", "FontName", FontName);
- Reader.Write("Game", "TransparentChat", TransparentChat);
- Reader.Write("Game", "DisplayDamage", DisplayDamage);
- Reader.Write("Game", "TargetDead", TargetDead);
- Reader.Write("Game", "DuraWindow", DuraView);
- for (int i = 0; i < SkillbarLocation.Length / 2; i++)
- {
- Reader.Write("Game", "Skillbar" + i.ToString() + "X", SkillbarLocation[i, 0]);
- Reader.Write("Game", "Skillbar" + i.ToString() + "Y", SkillbarLocation[i, 1]);
- }
- //Chat
- Reader.Write("Chat", "ShowNormalChat", ShowNormalChat);
- Reader.Write("Chat", "ShowYellChat", ShowYellChat);
- Reader.Write("Chat", "ShowWhisperChat", ShowWhisperChat);
- Reader.Write("Chat", "ShowLoverChat", ShowLoverChat);
- Reader.Write("Chat", "ShowMentorChat", ShowMentorChat);
- Reader.Write("Chat", "ShowGroupChat", ShowGroupChat);
- Reader.Write("Chat", "ShowGuildChat", ShowGuildChat);
- //Filters
- Reader.Write("Filter", "FilterNormalChat", FilterNormalChat);
- Reader.Write("Filter", "FilterWhisperChat", FilterWhisperChat);
- Reader.Write("Filter", "FilterShoutChat", FilterShoutChat);
- Reader.Write("Filter", "FilterSystemChat", FilterSystemChat);
- Reader.Write("Filter", "FilterLoverChat", FilterLoverChat);
- Reader.Write("Filter", "FilterMentorChat", FilterMentorChat);
- Reader.Write("Filter", "FilterGroupChat", FilterGroupChat);
- Reader.Write("Filter", "FilterGuildChat", FilterGuildChat);
- //AutoPatcher
- Reader.Write("Launcher", "Enabled", P_Patcher);
- Reader.Write("Launcher", "Host", P_Host);
- Reader.Write("Launcher", "PatchFile", P_PatchFileName);
- Reader.Write("Launcher", "NeedLogin", P_NeedLogin);
- Reader.Write("Launcher", "Login", P_Login);
- Reader.Write("Launcher", "Password", P_Password);
- Reader.Write("Launcher", "ServerName", P_ServerName);
- Reader.Write("Launcher", "Browser", P_BrowserAddress);
- Reader.Write("Launcher", "AutoStart", P_AutoStart);
- //Auxsetup
- //Reader.Write("Auxsetup", "HPItemIndexed", HPItemIndexed);
- // Reader.Write("Auxsetup", "MPItemIndexed", MPItemIndexed);
- }
- public static void LoadTrackedQuests(string Charname)
- {
- //Quests
- for (int i = 0; i < TrackedQuests.Length; i++)
- {
- TrackedQuests[i] = Reader.ReadInt32("Q-" + Charname, "Quest-" + i.ToString(), -1);
- }
- }
- public static void SaveTrackedQuests(string Charname)
- {
- //Quests
- for (int i = 0; i < TrackedQuests.Length; i++)
- {
- Reader.Write("Q-" + Charname, "Quest-" + i.ToString(), TrackedQuests[i]);
- }
- }
- public static void LoadAuxsetup(string Charname)
- {
- HPItemIndexed = Reader.ReadInt32("A-" + Charname, "AUX-HPItemIndexed", HPItemIndexed);
- MPItemIndexed = Reader.ReadInt32("A-" + Charname, "AUX-MPItemIndexed", MPItemIndexed);
- HPName = Reader.ReadString("A-" + Charname, "AUX-HPName", HPName);
- MPName = Reader.ReadString("A-" + Charname, "AUX-MPName", MPName);
- HPNum = Reader.ReadInt32("A-" + Charname, "AUX-HPNum", HPNum);
- MPNum = Reader.ReadInt32("A-" + Charname, "AUX-MPNum", MPNum);
- HpSelected = Reader.ReadBoolean("A-" + Charname, "AUX-HpSelected", HpSelected);
- MpSelected = Reader.ReadBoolean("A-" + Charname, "AUX-MpSelected", MpSelected);
- AutoHpSelected = Reader.ReadBoolean("A-" + Charname, "AUX-AutoHpSelected", AutoHpSelected);
- AutoMpSelected = Reader.ReadBoolean("A-" + Charname, "AUX-AutoMpSelected", AutoMpSelected);
- FightMpSelected = Reader.ReadBoolean("A-" + Charname, "AUX-FightMpSelected", FightMpSelected);
- ShildSelected = Reader.ReadBoolean("A-" + Charname, "AUX-ShildSelected", ShildSelected);
- EShildSelected = Reader.ReadBoolean("A-" + Charname, "AUX-EShildSelected", EShildSelected);
- AutoAmulet = Reader.ReadBoolean("A-" + Charname, "AUX-AutoAmulet", AutoAmulet);
- Shenshengzjfu = Reader.ReadInt32("A-" + Charname, "AUX-Shenshengzjfu", Shenshengzjfu);
- youlindunfu = Reader.ReadInt32("A-" + Charname, "AUX-youlindunfu", youlindunfu);
- menghuqiansshifu = Reader.ReadInt32("A-" + Charname, "AUX-menghuqiansshifu", menghuqiansshifu);
- qiangmozhenfafu = Reader.ReadInt32("A-" + Charname, "AUX-qiangmozhenfafu", qiangmozhenfafu);
- zhaohuankuloufu = Reader.ReadInt32("A-" + Charname, "AUX-zhaohuankuloufu", zhaohuankuloufu);
- zhaohuashenshoufu = Reader.ReadInt32("A-" + Charname, "AUX-zhaohuashenshoufu", zhaohuashenshoufu);
- }
- public static void SaveAuxsetup(string Charname)
- {
- Reader.Write("A-" + Charname, "AUX-HPItemIndexed", HPItemIndexed);
- Reader.Write("A-" + Charname, "AUX-MPItemIndexed", MPItemIndexed);
- Reader.Write("A-" + Charname, "AUX-HPName", HPName);
- Reader.Write("A-" + Charname, "AUX-MPName", MPName);
- Reader.Write("A-" + Charname, "AUX-HPNum", HPNum);
- Reader.Write("A-" + Charname, "AUX-MPNum", MPNum);
- Reader.Write("A-" + Charname, "AUX-HpSelected", HpSelected);
- Reader.Write("A-" + Charname, "AUX-MpSelected", MpSelected);
- Reader.Write("A-" + Charname, "AUX-AutoHpSelected", AutoHpSelected);
- Reader.Write("A-" + Charname, "AUX-AutoMpSelected", AutoMpSelected);
- Reader.Write("A-" + Charname, "AUX-FightMpSelected", FightMpSelected);
- Reader.Write("A-" + Charname, "AUX-ShildSelected", ShildSelected);
- Reader.Write("A-" + Charname, "AUX-EShildSelected", EShildSelected);
- Reader.Write("A-" + Charname, "AUX-AutoAmulet", AutoAmulet);
- Reader.Write("A-" + Charname, "AUX-Shenshengzjfu", Shenshengzjfu);
- Reader.Write("A-" + Charname, "AUX-youlindunfu", youlindunfu);
- Reader.Write("A-" + Charname, "AUX-menghuqiansshifu", menghuqiansshifu);
- Reader.Write("A-" + Charname, "AUX-qiangmozhenfafu", qiangmozhenfafu);
- Reader.Write("A-" + Charname, "AUX-zhaohuankuloufu", zhaohuankuloufu);
- Reader.Write("A-" + Charname, "AUX-zhaohuashenshoufu", zhaohuashenshoufu);
- }
- }
- }
|