| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032 |
- using Server.MirDatabase;
- using Server.MirEnvir;
- namespace Server
- {
- public partial class MapInfoForm : Form
- {
- public Envir Envir => SMain.EditEnvir;
- private List<MapInfo> _selectedMapInfos;
- private List<SafeZoneInfo> _selectedSafeZoneInfos;
- private List<RespawnInfo> _selectedRespawnInfos;
- private List<MovementInfo> _selectedMovementInfos;
- private List<MineZone> _selectedMineZones;
- private MapInfo _info;
- public MapInfoForm()
- {
- InitializeComponent();
- List<string> mineItems = new() { { "Disabled" } };
- Settings.MineSetList.ForEach(x => mineItems.Add(x.Name));
- MineComboBox.DataSource = mineItems;
- MineZoneComboBox.DataSource = mineItems;
- LightsComboBox.Items.AddRange(Enum.GetValues(typeof(LightSetting)).Cast<object>().ToArray());
- List<MonsterInfo> monsterInfoItems = new();
- Envir.MonsterInfoList.ForEach(x => monsterInfoItems.Add(x));
- MonsterInfoComboBox.DataSource = monsterInfoItems;
- List<String> conquestItems = new() { { "None" } };
- Envir.ConquestInfoList.ForEach(x => conquestItems.Add(x.Name));
- ConquestComboBox.DataSource = conquestItems;
- lstParticles.Items.AddRange(Enum.GetValues(typeof(WeatherSetting)).Cast<object>().ToArray());
- UpdateInterface(true);
- }
- private void MapInfoForm_FormClosed(object sender, FormClosedEventArgs e)
- {
- Envir.SaveDB();
- }
- private void UpdateInterface(bool refresh = false)
- {
- MapInfoListBox.SelectedIndexChanged -= MapInfoListBox_SelectedIndexChanged;
- if (refresh || MapInfoListBox.Items.Count != Envir.MapInfoList.Count)
- {
- MapInfo selectedMap = MapInfoListBox.SelectedItem as MapInfo;
- MapInfoListBox.Items.Clear();
- DestMapComboBox.Items.Clear();
- lstParticles.SelectedItems.Clear();
- for (int i = 0; i < Envir.MapInfoList.Count; i++)
- {
- if (!string.IsNullOrEmpty(MapSearchTextBox.Text) &&
- !Envir.MapInfoList[i].Title.Contains(MapSearchTextBox.Text, StringComparison.OrdinalIgnoreCase))
- continue;
- MapInfoListBox.Items.Add(Envir.MapInfoList[i]);
- DestMapComboBox.Items.Add(Envir.MapInfoList[i]);
- }
- // Restore the selection if possible
- if (selectedMap != null && MapInfoListBox.Items.Contains(selectedMap))
- {
- MapInfoListBox.SelectedItem = selectedMap;
- }
- }
- MapInfoListBox.SelectedIndexChanged += MapInfoListBox_SelectedIndexChanged;
- _selectedMapInfos = MapInfoListBox.SelectedItems.Cast<MapInfo>().ToList();
- if (_selectedMapInfos == null || _selectedMapInfos.Count == 0)
- {
- tabPage1.Show();
- MapTabs.Enabled = false;
- MapIndexTextBox.Text = string.Empty;
- FileNameTextBox.Text = string.Empty;
- MapNameTextBox.Text = string.Empty;
- MiniMapTextBox.Text = string.Empty;
- BigMapTextBox.Text = string.Empty;
- LightsComboBox.SelectedItem = null;
- MineComboBox.SelectedItem = null;
- MusicTextBox.Text = string.Empty;
- lstParticles.SelectedItems.Clear();
- NoTeleportCheckbox.Checked = false;
- NoReconnectCheckbox.Checked = false;
- NoRandomCheckbox.Checked = false;
- NoEscapeCheckbox.Checked = false;
- NoRecallCheckbox.Checked = false;
- NoDrugCheckbox.Checked = false;
- NoPositionCheckbox.Checked = false;
- NoThrowItemCheckbox.Checked = false;
- NoDropPlayerCheckbox.Checked = false;
- NoDropMonsterCheckbox.Checked = false;
- NoNamesCheckbox.Checked = false;
- FightCheckbox.Checked = false;
- FireCheckbox.Checked = false;
- LightningCheckbox.Checked = false;
- NoReconnectTextbox.Text = string.Empty;
- FireTextbox.Text = string.Empty;
- LightningTextbox.Text = string.Empty;
- MapDarkLighttextBox.Text = string.Empty;
- GTBox.Checked = false;
- GTIndexBox.Text = string.Empty;
- NoExperienceCheckbox.Checked = false;
- noGroupCheckbox.Checked = false;
- NoPetsCheckbox.Checked = false;
- NoHeroesCheckbox.Checked = false;
- RequiredGroupTextBox.Text = string.Empty;
- RequiredGroupCheckBox.Checked = false;
- return;
- }
- MapInfo mi = _selectedMapInfos[0];
- MapTabs.Enabled = true;
- MapIndexTextBox.Text = mi.Index.ToString();
- FileNameTextBox.Text = mi.FileName;
- MapNameTextBox.Text = mi.Title;
- MiniMapTextBox.Text = mi.MiniMap.ToString();
- BigMapTextBox.Text = mi.BigMap.ToString();
- LightsComboBox.SelectedItem = mi.Light;
- MineComboBox.SelectedIndex = mi.MineIndex;
- MusicTextBox.Text = mi.Music.ToString();
- if (mi.WeatherParticles != WeatherSetting.None)
- {
- for (int i = 0; i < lstParticles.Items.Count; i++)
- {
- var item = lstParticles.Items[i];
- if (item != null)
- {
- if (((mi.WeatherParticles & (WeatherSetting)item)) == (WeatherSetting)item)
- lstParticles.SetSelected(i, true);
- continue;
- }
- }
- }
- //map attributes
- NoTeleportCheckbox.Checked = mi.NoTeleport;
- NoReconnectCheckbox.Checked = mi.NoReconnect;
- NoReconnectTextbox.Text = mi.NoReconnectMap;
- NoRandomCheckbox.Checked = mi.NoRandom;
- NoEscapeCheckbox.Checked = mi.NoEscape;
- NoRecallCheckbox.Checked = mi.NoRecall;
- NoDrugCheckbox.Checked = mi.NoDrug;
- NoPositionCheckbox.Checked = mi.NoPosition;
- NoThrowItemCheckbox.Checked = mi.NoThrowItem;
- NoDropPlayerCheckbox.Checked = mi.NoDropPlayer;
- NoDropMonsterCheckbox.Checked = mi.NoDropMonster;
- NoNamesCheckbox.Checked = mi.NoNames;
- FightCheckbox.Checked = mi.Fight;
- NoFightCheckbox.Checked = mi.NoFight;
- FireCheckbox.Checked = mi.Fire;
- FireTextbox.Text = mi.FireDamage.ToString();
- LightningCheckbox.Checked = mi.Lightning;
- LightningTextbox.Text = mi.LightningDamage.ToString();
- MapDarkLighttextBox.Text = mi.MapDarkLight.ToString();
- NoMountCheckbox.Checked = mi.NoMount;
- NeedBridleCheckbox.Checked = mi.NeedBridle;
- NoTownTeleportCheckbox.Checked = mi.NoTownTeleport;
- NoReincarnation.Checked = mi.NoReincarnation;
- GTBox.Checked = mi.GT;
- GTIndexBox.Text = mi.GTIndex.ToString();
- NoExperienceCheckbox.Checked = mi.NoExperience;
- noGroupCheckbox.Checked = mi.NoGroup;
- NoPetsCheckbox.Checked = mi.NoPets;
- NoIntelligentCreatureCheckbox.Checked = mi.NoIntelligentCreatures;
- NoHeroesCheckbox.Checked = mi.NoHero;
- RequiredGroupTextBox.Text = mi.RequiredGroupSize.ToString();
- RequiredGroupCheckBox.Checked = mi.RequiredGroup;
- FireWallCheckBox.Checked = mi.FireWallLimit;
- FireWallCount.Text = mi.FireWallCount > 0 ? mi.FireWallCount.ToString() : string.Empty;
- FireWallCount.Enabled = FireWallCheckBox.Checked;
- for (int i = 1; i < _selectedMapInfos.Count; i++)
- {
- mi = _selectedMapInfos[i];
- if (MapIndexTextBox.Text != mi.Index.ToString()) MapIndexTextBox.Text = string.Empty;
- if (FileNameTextBox.Text != mi.FileName) FileNameTextBox.Text = string.Empty;
- if (MapNameTextBox.Text != mi.Title) MapNameTextBox.Text = string.Empty;
- if (MiniMapTextBox.Text != mi.MiniMap.ToString()) MiniMapTextBox.Text = string.Empty;
- if (BigMapTextBox.Text != mi.BigMap.ToString()) BigMapTextBox.Text = string.Empty;
- if (LightsComboBox.SelectedItem == null || (LightSetting)LightsComboBox.SelectedItem != mi.Light) LightsComboBox.SelectedItem = null;
- if (MineComboBox.SelectedItem == null || MineComboBox.SelectedIndex != mi.MineIndex) MineComboBox.SelectedIndex = 1;
- if (MusicTextBox.Text != mi.Music.ToString()) MusicTextBox.Text = string.Empty;
- if (NoTeleportCheckbox.Checked != mi.NoTeleport) NoTeleportCheckbox.Checked = false;
- if (NoReconnectCheckbox.Checked != mi.NoReconnect) NoReconnectCheckbox.Checked = false;
- if (NoReconnectTextbox.Text != mi.NoReconnectMap) NoReconnectTextbox.Text = string.Empty;
- if (NoRandomCheckbox.Checked != mi.NoRandom) NoRandomCheckbox.Checked = false;
- if (NoEscapeCheckbox.Checked != mi.NoEscape) NoEscapeCheckbox.Checked = false;
- if (NoRecallCheckbox.Checked != mi.NoRecall) NoRecallCheckbox.Checked = false;
- if (NoDrugCheckbox.Checked != mi.NoDrug) NoDrugCheckbox.Checked = false;
- if (NoPositionCheckbox.Checked != mi.NoPosition) NoPositionCheckbox.Checked = false;
- if (NoThrowItemCheckbox.Checked != mi.NoThrowItem) NoThrowItemCheckbox.Checked = false;
- if (NoDropPlayerCheckbox.Checked != mi.NoDropPlayer) NoDropPlayerCheckbox.Checked = false;
- if (NoDropMonsterCheckbox.Checked != mi.NoDropMonster) NoDropMonsterCheckbox.Checked = false;
- if (NoNamesCheckbox.Checked != mi.NoNames) NoNamesCheckbox.Checked = false;
- if (FightCheckbox.Checked != mi.Fight) FightCheckbox.Checked = false;
- if (NoFightCheckbox.Checked != mi.NoFight) NoFightCheckbox.Checked = false;
- if (FireCheckbox.Checked != mi.Fire) FireCheckbox.Checked = false;
- if (FireTextbox.Text != mi.FireDamage.ToString()) FireTextbox.Text = string.Empty;
- if (LightningCheckbox.Checked != mi.Lightning) LightningCheckbox.Checked = false;
- if (LightningTextbox.Text != mi.LightningDamage.ToString()) LightningTextbox.Text = string.Empty;
- if (MapDarkLighttextBox.Text != mi.MapDarkLight.ToString()) MapDarkLighttextBox.Text = string.Empty;
- if (NoMountCheckbox.Checked != mi.NoMount) NoMountCheckbox.Checked = false;
- if (NeedBridleCheckbox.Checked != mi.NeedBridle) NeedBridleCheckbox.Checked = false;
- if (NoTownTeleportCheckbox.Checked != mi.NoTownTeleport) NoTownTeleportCheckbox.Checked = false;
- if (NoReincarnation.Checked != mi.NoReincarnation) NoReincarnation.Checked = false;
- if (GTBox.Checked != mi.GT) GTBox.Checked = false;
- if (GTIndexBox.Text != mi.GTIndex.ToString()) GTIndexBox.Text = string.Empty;
- if (NoExperienceCheckbox.Checked != mi.NoExperience) NoExperienceCheckbox.Checked = false;
- if (noGroupCheckbox.Checked != mi.NoGroup) noGroupCheckbox.Checked = false;
- if (NoPetsCheckbox.Checked != mi.NoPets) NoPetsCheckbox.Checked = false;
- if (NoIntelligentCreatureCheckbox.Checked != mi.NoIntelligentCreatures) NoIntelligentCreatureCheckbox.Checked = false;
- if (NoHeroesCheckbox.Checked != mi.NoHero) NoHeroesCheckbox.Checked = false;
- if (RequiredGroupTextBox.Text != mi.RequiredGroupSize.ToString()) RequiredGroupTextBox.Text = string.Empty;
- if (RequiredGroupCheckBox.Checked != (mi.RequiredGroupSize > 0)) RequiredGroupCheckBox.Checked = false;
- if (FireWallCount.Text != mi.FireWallCount.ToString()) FireWallCount.Text = string.Empty;
- if (FireWallCheckBox.Checked != mi.FireWallLimit) FireWallCheckBox.Checked = false;
- // Keep the enable state in sync after possible changes
- FireWallCount.Enabled = FireWallCheckBox.Checked;
- }
- UpdateSafeZoneInterface();
- UpdateRespawnInterface();
- UpdateMovementInterface();
- UpdateMineZoneInterface();
- }
- private void UpdateSafeZoneInterface()
- {
- if (_selectedMapInfos.Count != 1)
- {
- SafeZoneInfoListBox.Items.Clear();
- if (_selectedSafeZoneInfos != null && _selectedSafeZoneInfos.Count > 0)
- _selectedSafeZoneInfos.Clear();
- _info = null;
- SafeZoneInfoPanel.Enabled = false;
- SZXTextBox.Text = string.Empty;
- SZYTextBox.Text = string.Empty;
- StartPointCheckBox.CheckState = CheckState.Unchecked;
- return;
- }
- if (_info != _selectedMapInfos[0])
- {
- SafeZoneInfoListBox.Items.Clear();
- _info = _selectedMapInfos[0];
- }
- if (SafeZoneInfoListBox.Items.Count != _info.SafeZones.Count)
- {
- SafeZoneInfoListBox.Items.Clear();
- for (int i = 0; i < _info.SafeZones.Count; i++) SafeZoneInfoListBox.Items.Add(_info.SafeZones[i]);
- }
- _selectedSafeZoneInfos = SafeZoneInfoListBox.SelectedItems.Cast<SafeZoneInfo>().ToList();
- if (_selectedSafeZoneInfos.Count == 0)
- {
- SafeZoneInfoPanel.Enabled = false;
- SZXTextBox.Text = string.Empty;
- SZYTextBox.Text = string.Empty;
- StartPointCheckBox.CheckState = CheckState.Unchecked;
- return;
- }
- SafeZoneInfo info = _selectedSafeZoneInfos[0];
- SafeZoneInfoPanel.Enabled = true;
- SZXTextBox.Text = info.Location.X.ToString();
- SZYTextBox.Text = info.Location.Y.ToString();
- StartPointCheckBox.CheckState = info.StartPoint ? CheckState.Checked : CheckState.Unchecked;
- SizeTextBox.Text = info.Size.ToString();
- for (int i = 1; i < _selectedSafeZoneInfos.Count; i++)
- {
- info = _selectedSafeZoneInfos[i];
- if (SZXTextBox.Text != info.Location.X.ToString()) SZXTextBox.Text = string.Empty;
- if (SZYTextBox.Text != info.Location.Y.ToString()) SZYTextBox.Text = string.Empty;
- if (StartPointCheckBox.Checked != info.StartPoint) StartPointCheckBox.CheckState = CheckState.Indeterminate;
- if (SizeTextBox.Text != info.Size.ToString()) SizeTextBox.Text = string.Empty;
- }
- }
- private void UpdateRespawnInterface()
- {
- if (_selectedMapInfos.Count != 1)
- {
- RespawnInfoListBox.Items.Clear();
- if (_selectedRespawnInfos != null && _selectedRespawnInfos.Count > 0)
- _selectedRespawnInfos.Clear();
- _info = null;
- RespawnInfoPanel.Enabled = false;
- MonsterInfoComboBox.SelectedItem = null;
- RXTextBox.Text = string.Empty;
- RYTextBox.Text = string.Empty;
- CountTextBox.Text = string.Empty;
- SpreadTextBox.Text = string.Empty;
- DelayTextBox.Text = string.Empty;
- chkrespawnsave.Enabled = false;
- chkRespawnEnableTick.Checked = false;
- chkrespawnsave.Checked = false;
- DirectionTextBox.Text = string.Empty;
- RoutePathTextBox.Text = string.Empty;
- Randomtextbox.Text = string.Empty;
- return;
- }
- if (_info != _selectedMapInfos[0])
- {
- RespawnInfoListBox.Items.Clear();
- _info = _selectedMapInfos[0];
- }
- if (RespawnInfoListBox.Items.Count != _info.Respawns.Count)
- {
- RespawnInfoListBox.Items.Clear();
- for (int i = 0; i < _info.Respawns.Count; i++) RespawnInfoListBox.Items.Add(_info.Respawns[i]);
- }
- _selectedRespawnInfos = RespawnInfoListBox.SelectedItems.Cast<RespawnInfo>().ToList();
- if (_selectedRespawnInfos.Count == 0)
- {
- RespawnInfoPanel.Enabled = false;
- MonsterInfoComboBox.SelectedItem = null;
- RXTextBox.Text = string.Empty;
- RYTextBox.Text = string.Empty;
- CountTextBox.Text = string.Empty;
- SpreadTextBox.Text = string.Empty;
- DelayTextBox.Text = string.Empty;
- chkrespawnsave.Enabled = false;
- chkRespawnEnableTick.Checked = false;
- chkrespawnsave.Checked = false;
- DirectionTextBox.Text = string.Empty;
- RoutePathTextBox.Text = string.Empty;
- Randomtextbox.Text = string.Empty;
- return;
- }
- RespawnInfo info = _selectedRespawnInfos[0];
- RespawnInfoPanel.Enabled = true;
- MonsterInfoComboBox.SelectedItem = Envir.MonsterInfoList.FirstOrDefault(x => x.Index == info.MonsterIndex);
- RXTextBox.Text = info.Location.X.ToString();
- RYTextBox.Text = info.Location.Y.ToString();
- CountTextBox.Text = info.Count.ToString();
- SpreadTextBox.Text = info.Spread.ToString();
- DelayTextBox.Text = info.RespawnTicks == 0 ? info.Delay.ToString() : info.RespawnTicks.ToString();
- chkrespawnsave.Enabled = info.RespawnTicks != 0;
- chkRespawnEnableTick.Checked = info.RespawnTicks != 0;
- chkrespawnsave.Checked = ((info.RespawnTicks != 0) && (info.SaveRespawnTime)) ? true : false;
- DirectionTextBox.Text = info.Direction.ToString();
- RoutePathTextBox.Text = info.RoutePath;
- Randomtextbox.Enabled = info.RespawnTicks == 0;
- Randomtextbox.Text = info.RandomDelay.ToString();
- for (int i = 1; i < _selectedRespawnInfos.Count; i++)
- {
- info = _selectedRespawnInfos[i];
- if (MonsterInfoComboBox.SelectedItem != Envir.MonsterInfoList.FirstOrDefault(x => x.Index == info.MonsterIndex)) MonsterInfoComboBox.SelectedItem = null;
- if (RXTextBox.Text != info.Location.X.ToString()) RXTextBox.Text = string.Empty;
- if (RYTextBox.Text != info.Location.Y.ToString()) RYTextBox.Text = string.Empty;
- if (CountTextBox.Text != info.Count.ToString()) CountTextBox.Text = string.Empty;
- if (SpreadTextBox.Text != info.Spread.ToString()) SpreadTextBox.Text = string.Empty;
- if (chkRespawnEnableTick.Checked != (info.RespawnTicks == 0))
- {
- DelayTextBox.Text = string.Empty;
- chkrespawnsave.Enabled = false;
- chkrespawnsave.Checked = false;
- Randomtextbox.Text = string.Empty;
- }
- else
- {
- if (chkRespawnEnableTick.Checked)
- {
- if (DelayTextBox.Text != info.RespawnTicks.ToString()) DelayTextBox.Text = string.Empty;
- if (chkrespawnsave.Checked != info.SaveRespawnTime)
- {
- chkrespawnsave.Enabled = false;
- chkrespawnsave.Checked = false;
- }
- Randomtextbox.Enabled = false;
- Randomtextbox.Text = string.Empty;
- }
- else
- {
- if (DelayTextBox.Text != info.Delay.ToString()) DelayTextBox.Text = string.Empty;
- chkrespawnsave.Enabled = false;
- chkrespawnsave.Checked = false;
- if (Randomtextbox.Text != info.RandomDelay.ToString()) Randomtextbox.Text = string.Empty;
- }
- }
- if (DirectionTextBox.Text != info.Direction.ToString()) DirectionTextBox.Text = string.Empty;
- if (RoutePathTextBox.Text != info.RoutePath) RoutePathTextBox.Text = string.Empty;
- }
- }
- private void UpdateMovementInterface()
- {
- if (_selectedMapInfos.Count != 1)
- {
- MovementInfoListBox.Items.Clear();
- if (_selectedMovementInfos != null && _selectedMovementInfos.Count > 0)
- _selectedMovementInfos.Clear();
- _info = null;
- MovementInfoPanel.Enabled = false;
- SourceXTextBox.Text = string.Empty;
- SourceYTextBox.Text = string.Empty;
- DestMapComboBox.SelectedItem = null;
- ConquestComboBox.SelectedIndex = 0;
- DestXTextBox.Text = string.Empty;
- DestYTextBox.Text = string.Empty;
- BigMapIconTextBox.Text = string.Empty;
- return;
- }
- if (_info != _selectedMapInfos[0])
- {
- MovementInfoListBox.Items.Clear();
- _info = _selectedMapInfos[0];
- }
- if (MovementInfoListBox.Items.Count != _info.Movements.Count)
- {
- MovementInfoListBox.Items.Clear();
- for (int i = 0; i < _info.Movements.Count; i++) MovementInfoListBox.Items.Add(_info.Movements[i]);
- }
- _selectedMovementInfos = MovementInfoListBox.SelectedItems.Cast<MovementInfo>().ToList();
- if (_selectedMovementInfos.Count == 0)
- {
- MovementInfoPanel.Enabled = false;
- SourceXTextBox.Text = string.Empty;
- SourceYTextBox.Text = string.Empty;
- NeedHoleMCheckBox.Checked = false;
- NeedMoveMCheckBox.Checked = false;
- DestMapComboBox.SelectedItem = null;
- ConquestComboBox.SelectedIndex = 0;
- DestXTextBox.Text = string.Empty;
- DestYTextBox.Text = string.Empty;
- BigMapIconTextBox.Text = string.Empty;
- return;
- }
- MovementInfo info = _selectedMovementInfos[0];
- MovementInfoPanel.Enabled = true;
- SourceXTextBox.Text = info.Source.X.ToString();
- SourceYTextBox.Text = info.Source.Y.ToString();
- NeedHoleMCheckBox.Checked = info.NeedHole;
- NeedMoveMCheckBox.Checked = info.NeedMove;
- ShowBigMapCheckBox.Checked = info.ShowOnBigMap;
- DestMapComboBox.SelectedItem = Envir.MapInfoList.FirstOrDefault(x => x.Index == info.MapIndex);
- DestXTextBox.Text = info.Destination.X.ToString();
- DestYTextBox.Text = info.Destination.Y.ToString();
- BigMapIconTextBox.Text = info.Icon.ToString();
- ConquestComboBox.SelectedItem = Envir.ConquestInfoList.FirstOrDefault(x => x.Index == info.ConquestIndex)?.Name;
- if (ConquestComboBox.SelectedItem == null) ConquestComboBox.SelectedIndex = 0;
- for (int i = 1; i < _selectedMovementInfos.Count; i++)
- {
- info = _selectedMovementInfos[i];
- SourceXTextBox.Text = info.Source.X.ToString();
- SourceYTextBox.Text = info.Source.Y.ToString();
- DestMapComboBox.SelectedItem = Envir.MapInfoList.FirstOrDefault(x => x.Index == info.MapIndex);
- DestXTextBox.Text = info.Destination.X.ToString();
- DestYTextBox.Text = info.Destination.Y.ToString();
- ConquestComboBox.SelectedItem = Envir.ConquestInfoList.FirstOrDefault(x => x.Index == info.ConquestIndex)?.Name;
- BigMapIconTextBox.Text = info.Icon.ToString();
- if (SourceXTextBox.Text != info.Source.X.ToString()) SourceXTextBox.Text = string.Empty;
- if (SourceYTextBox.Text != info.Source.Y.ToString()) SourceYTextBox.Text = string.Empty;
- if (DestMapComboBox.SelectedItem != Envir.MapInfoList.FirstOrDefault(x => x.Index == info.MapIndex)) DestMapComboBox.SelectedItem = null;
- if (DestXTextBox.Text != info.Destination.X.ToString()) DestXTextBox.Text = string.Empty;
- if (DestYTextBox.Text != info.Destination.Y.ToString()) DestYTextBox.Text = string.Empty;
- if (BigMapIconTextBox.Text != info.Icon.ToString()) BigMapIconTextBox.Text = string.Empty;
- if (ConquestComboBox.SelectedItem != Envir.ConquestInfoList.FirstOrDefault(x => x.Index == info.ConquestIndex)) ConquestComboBox.SelectedItem = null;
- }
- }
- private void UpdateMineZoneInterface()
- {
- if (_selectedMapInfos.Count != 1)
- {
- MZListlistBox.Items.Clear();
- if (_selectedMineZones != null && _selectedMineZones.Count > 0)
- _selectedMineZones.Clear();
- _info = null;
- MineZonepanel.Enabled = false;
- MZXtextBox.Text = string.Empty;
- MZYtextBox.Text = string.Empty;
- MineZoneComboBox.SelectedItem = null;
- MZSizetextBox.Text = string.Empty;
- return;
- }
- if (_info != _selectedMapInfos[0])
- {
- MZListlistBox.Items.Clear();
- _info = _selectedMapInfos[0];
- }
- if (MZListlistBox.Items.Count != _info.MineZones.Count)
- {
- MZListlistBox.Items.Clear();
- for (int i = 0; i < _info.MineZones.Count; i++) MZListlistBox.Items.Add(_info.MineZones[i]);
- }
- _selectedMineZones = MZListlistBox.SelectedItems.Cast<MineZone>().ToList();
- if (_selectedMineZones.Count == 0)
- {
- MineZonepanel.Enabled = false;
- MZXtextBox.Text = string.Empty;
- MZYtextBox.Text = string.Empty;
- MineZoneComboBox.SelectedItem = null;
- MZSizetextBox.Text = string.Empty;
- return;
- }
- MineZone info = _selectedMineZones[0];
- MineZonepanel.Enabled = true;
- MZXtextBox.Text = info.Location.X.ToString();
- MZYtextBox.Text = info.Location.Y.ToString();
- MineZoneComboBox.SelectedIndex = info.Mine;
- MZSizetextBox.Text = info.Size.ToString();
- for (int i = 1; i < _selectedMineZones.Count; i++)
- {
- info = _selectedMineZones[i];
- if (MZXtextBox.Text != info.Location.X.ToString()) MZXtextBox.Text = string.Empty;
- if (MZYtextBox.Text != info.Location.Y.ToString()) MZYtextBox.Text = string.Empty;
- if (MineComboBox.SelectedIndex != info.Mine) MineComboBox.SelectedIndex = 1;
- if (MZSizetextBox.Text != info.Size.ToString()) MZSizetextBox.Text = string.Empty;
- }
- }
- private void RefreshMapList()
- {
- MapInfoListBox.SelectedIndexChanged -= MapInfoListBox_SelectedIndexChanged;
- List<bool> selected = new List<bool>();
- for (int i = 0; i < MapInfoListBox.Items.Count; i++) selected.Add(MapInfoListBox.GetSelected(i));
- MapInfoListBox.Items.Clear();
- for (int i = 0; i < Envir.MapInfoList.Count; i++) MapInfoListBox.Items.Add(Envir.MapInfoList[i]);
- for (int i = 0; i < selected.Count; i++) MapInfoListBox.SetSelected(i, selected[i]);
- MapInfoListBox.SelectedIndexChanged += MapInfoListBox_SelectedIndexChanged;
- }
- private void RefreshSafeZoneList()
- {
- SafeZoneInfoListBox.SelectedIndexChanged -= SafeZoneInfoListBox_SelectedIndexChanged;
- List<bool> selected = new List<bool>();
- for (int i = 0; i < SafeZoneInfoListBox.Items.Count; i++) selected.Add(SafeZoneInfoListBox.GetSelected(i));
- SafeZoneInfoListBox.Items.Clear();
- for (int i = 0; i < _info.SafeZones.Count; i++) SafeZoneInfoListBox.Items.Add(_info.SafeZones[i]);
- for (int i = 0; i < selected.Count; i++) SafeZoneInfoListBox.SetSelected(i, selected[i]);
- SafeZoneInfoListBox.SelectedIndexChanged += SafeZoneInfoListBox_SelectedIndexChanged;
- }
- private void RefreshRespawnList()
- {
- RespawnInfoListBox.SelectedIndexChanged -= RespawnInfoListBox_SelectedIndexChanged;
- List<bool> selected = new List<bool>();
- for (int i = 0; i < RespawnInfoListBox.Items.Count; i++)
- selected.Add(RespawnInfoListBox.GetSelected(i));
- RespawnInfoListBox.Items.Clear();
- for (int i = 0; i < _info.Respawns.Count; i++)
- RespawnInfoListBox.Items.Add(_info.Respawns[i]);
- for (int i = 0; i < selected.Count; i++)
- RespawnInfoListBox.SetSelected(i, selected[i]);
- RespawnInfoListBox.SelectedIndexChanged += RespawnInfoListBox_SelectedIndexChanged;
- }
- private void RefreshMovementList()
- {
- MovementInfoListBox.SelectedIndexChanged -= MovementInfoListBox_SelectedIndexChanged;
- List<bool> selected = new List<bool>();
- for (int i = 0; i < MovementInfoListBox.Items.Count; i++) selected.Add(MovementInfoListBox.GetSelected(i));
- MovementInfoListBox.Items.Clear();
- for (int i = 0; i < _info.Movements.Count; i++) MovementInfoListBox.Items.Add(_info.Movements[i]);
- for (int i = 0; i < selected.Count; i++) MovementInfoListBox.SetSelected(i, selected[i]);
- MovementInfoListBox.SelectedIndexChanged += MovementInfoListBox_SelectedIndexChanged;
- }
- private void RefreshMineZoneList()
- {
- MZListlistBox.SelectedIndexChanged -= MZListlistBox_SelectedIndexChanged;
- List<bool> selected = new List<bool>();
- for (int i = 0; i < MZListlistBox.Items.Count; i++) selected.Add(MZListlistBox.GetSelected(i));
- MZListlistBox.Items.Clear();
- for (int i = 0; i < _info.MineZones.Count; i++) MZListlistBox.Items.Add(_info.MineZones[i]);
- for (int i = 0; i < selected.Count; i++) MZListlistBox.SetSelected(i, selected[i]);
- MZListlistBox.SelectedIndexChanged += MZListlistBox_SelectedIndexChanged;
- }
- private void AddButton_Click(object sender, EventArgs e)
- {
- Envir.CreateMapInfo();
- UpdateInterface(true);
- }
- private void RemoveButton_Click(object sender, EventArgs e)
- {
- if (_selectedMapInfos.Count == 0) return;
- if (MessageBox.Show("Are you sure you want to remove the selected maps?", "Remove Maps?", MessageBoxButtons.YesNo) != DialogResult.Yes) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++) Envir.Remove(_selectedMapInfos[i]);
- if (Envir.MapInfoList.Count == 0) Envir.MapIndex = 0;
- MapTabs.SelectTab(0);
- UpdateInterface(true);
- }
- private void MapInfoListBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- SafeZoneInfoListBox.Items.Clear();
- RespawnInfoListBox.Items.Clear();
- MovementInfoListBox.Items.Clear();
- MZListlistBox.Items.Clear();
- lstParticles.SelectedItems.Clear();
- _selectedMapInfos = MapInfoListBox.SelectedItems.Cast<MapInfo>().ToList();
- if (_selectedMapInfos == null || _selectedMapInfos.Count == 0)
- {
- UpdateInterface(false);
- return;
- }
- UpdateInterface(false);
- }
- private void FileNameTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].FileName = ActiveControl.Text;
- }
- private void MapNameTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].Title = ActiveControl.Text;
- RefreshMapList();
- }
- private void MiniMapTextBox_TextChanged(object sender, EventArgs e)
- {
- if (!ushort.TryParse(MiniMapTextBox.Text, out ushort temp))
- {
- MiniMapTextBox.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- MiniMapTextBox.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].MiniMap = temp;
- LoadImage(temp);
- }
- private void LoadImage(ushort miniMapValue)
- {
- string imagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Envir", "Previews", "Minimaps", miniMapValue + ".bmp");
- if (File.Exists(imagePath))
- {
- MinimapPreview.Image = Image.FromFile(imagePath);
- MinimapPreview.SizeMode = PictureBoxSizeMode.StretchImage;
- }
- else
- {
- MinimapPreview.Image = null;
- }
- }
- private void LightsComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].Light = (LightSetting)LightsComboBox.SelectedItem;
- }
- private void AddSZButton_Click(object sender, EventArgs e)
- {
- if (_info == null) return;
- _info.CreateSafeZone();
- UpdateSafeZoneInterface();
- }
- private void RemoveSZButton_Click(object sender, EventArgs e)
- {
- if (_selectedSafeZoneInfos.Count == 0) return;
- if (MessageBox.Show("Are you sure you want to remove the selected SafeZones?", "Remove SafeZones?", MessageBoxButtons.YesNo) != DialogResult.Yes) return;
- for (int i = 0; i < _selectedSafeZoneInfos.Count; i++) _info.SafeZones.Remove(_selectedSafeZoneInfos[i]);
- UpdateSafeZoneInterface();
- }
- private void SafeZoneInfoListBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- UpdateSafeZoneInterface();
- }
- private void SZXTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedSafeZoneInfos.Count; i++)
- _selectedSafeZoneInfos[i].Location.X = temp;
- RefreshSafeZoneList();
- }
- private void SZYTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedSafeZoneInfos.Count; i++)
- _selectedSafeZoneInfos[i].Location.Y = temp;
- RefreshSafeZoneList();
- }
- private void SizeTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedSafeZoneInfos.Count; i++)
- _selectedSafeZoneInfos[i].Size = temp;
- }
- private void StartPointCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedSafeZoneInfos.Count; i++)
- _selectedSafeZoneInfos[i].StartPoint = StartPointCheckBox.Checked;
- RefreshSafeZoneList();
- }
- private void AddRButton_Click(object sender, EventArgs e)
- {
- if (_info == null) return;
- _info.CreateRespawnInfo();
- UpdateRespawnInterface();
- }
- private void RemoveRButton_Click(object sender, EventArgs e)
- {
- if (_selectedRespawnInfos.Count == 0) return;
- if (MessageBox.Show("Are you sure you want to remove the selected Respawns?", "Remove Respawns?", MessageBoxButtons.YesNo) != DialogResult.Yes) return;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++) _info.Respawns.Remove(_selectedRespawnInfos[i]);
- UpdateRespawnInterface();
- }
- private void RespawnInfoListBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- UpdateRespawnInterface();
- }
- private void MonsterInfoComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- MonsterInfo info = MonsterInfoComboBox.SelectedItem as MonsterInfo;
- if (info == null) return;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].MonsterIndex = info.Index;
- RefreshRespawnList();
- }
- private void RXTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].Location.X = temp;
- RefreshRespawnList();
- }
- private void RYTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].Location.Y = temp;
- RefreshRespawnList();
- }
- private void CountTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].Count = temp;
- RefreshRespawnList();
- }
- private void SpreadTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].Spread = temp;
- RefreshRespawnList();
- }
- private void DelayTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- {
- if (chkRespawnEnableTick.Checked)
- {
- _selectedRespawnInfos[i].RespawnTicks = Math.Max((ushort)1, temp);
- _selectedRespawnInfos[i].Delay = 0;
- }
- else
- {
- _selectedRespawnInfos[i].Delay = temp;
- _selectedRespawnInfos[i].RespawnTicks = 0;
- }
- }
- RefreshRespawnList();
- }
- private void DirectionTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- byte temp;
- if (!byte.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].Direction = temp;
- RefreshRespawnList();
- }
- private void RoutePathTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].RoutePath = ActiveControl.Text;
- RefreshRespawnList();
- }
- private void RPasteButton_Click(object sender, EventArgs e)
- {
- if (_info == null) return;
- string data = Clipboard.GetText();
- if (!data.StartsWith("Respawn", StringComparison.OrdinalIgnoreCase))
- {
- MessageBox.Show("Cannot Paste, Copied data is not Respawn Information.");
- return;
- }
- string[] respawns = data.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 1; i < respawns.Length; i++)
- {
- RespawnInfo info = RespawnInfo.FromText(respawns[i]);
- if (info == null) continue;
- _info.Respawns.Add(info);
- }
- UpdateRespawnInterface();
- }
- //RCopy
- private void AddMButton_Click(object sender, EventArgs e)
- {
- if (_info == null) return;
- _info.CreateMovementInfo();
- UpdateMovementInterface();
- }
- private void RemoveMButton_Click(object sender, EventArgs e)
- {
- if (_selectedMovementInfos.Count == 0) return;
- if (MessageBox.Show("Are you sure you want to remove the selected Movements?", "Remove Movements?", MessageBoxButtons.YesNo) != DialogResult.Yes) return;
- for (int i = 0; i < _selectedMovementInfos.Count; i++) _info.Movements.Remove(_selectedMovementInfos[i]);
- UpdateMovementInterface();
- }
- private void SourceXTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].Source.X = temp;
- RefreshMovementList();
- }
- private void SourceYTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].Source.Y = temp;
- RefreshMovementList();
- }
- private void DestXTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].Destination.X = temp;
- RefreshMovementList();
- }
- private void DestYTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].Destination.Y = temp;
- RefreshMovementList();
- }
- private void DestMapComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- MapInfo info = DestMapComboBox.SelectedItem as MapInfo;
- if (info == null) return;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].MapIndex = info.Index;
- RefreshMovementList();
- }
- private void NeedHoleMCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].NeedHole = NeedHoleMCheckBox.Checked;
- }
- private void NeedScriptMCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].NeedMove = NeedMoveMCheckBox.Checked;
- }
- private void MovementInfoListBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- UpdateMovementInterface();
- }
- private void PasteMapButton_Click(object sender, EventArgs e)
- {
- string data = Clipboard.GetText();
- if (!data.StartsWith("Map", StringComparison.OrdinalIgnoreCase))
- {
- MessageBox.Show("Cannot Paste, Copied data is not Map Information.");
- return;
- }
- string[] maps = data.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 1; i < maps.Length; i++)
- MapInfo.FromText(maps[i]);
- UpdateInterface();
- }
- private void BigMapTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].BigMap = temp;
- }
- private void NoTeleportCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoTeleport = NoTeleportCheckbox.Checked;
- }
- private void NoReconnectCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoReconnect = NoReconnectCheckbox.Checked;
- }
- private void NoReconnectTextbox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoReconnectMap = ActiveControl.Text;
- }
- private void NoRandomCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoRandom = NoRandomCheckbox.Checked;
- }
- private void NoEscapeCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoEscape = NoEscapeCheckbox.Checked;
- }
- private void NoRecallCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoRecall = NoRecallCheckbox.Checked;
- }
- private void NoDrugCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoDrug = NoDrugCheckbox.Checked;
- }
- private void NoPositionCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoPosition = NoPositionCheckbox.Checked;
- }
- private void NoThrowItemCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoThrowItem = NoThrowItemCheckbox.Checked;
- }
- private void NoDropPlayerCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoDropPlayer = NoDropPlayerCheckbox.Checked;
- }
- private void NoDropMonsterCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoDropMonster = NoDropMonsterCheckbox.Checked;
- }
- private void NoNamesCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoNames = NoNamesCheckbox.Checked;
- }
- private void FightCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].Fight = FightCheckbox.Checked;
- }
- private void FireCheckbox_CheckStateChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].Fire = FireCheckbox.Checked;
- }
- private void FireTextbox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].FireDamage = temp;
- }
- private void LightningCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].Lightning = LightningCheckbox.Checked;
- }
- private void LightningTextbox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].LightningDamage = temp;
- }
- private void ClearHButton_Click(object sender, EventArgs e)
- {
- }
- private void MapDarkLighttextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- byte temp;
- if (!byte.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].MapDarkLight = temp;
- }
- private void MZDeletebutton_Click(object sender, EventArgs e)
- {
- if (_selectedMineZones.Count == 0) return;
- if (MessageBox.Show("Are you sure you want to remove the selected MineZones?", "Remove MineZones?", MessageBoxButtons.YesNo) != DialogResult.Yes) return;
- for (int i = 0; i < _selectedMineZones.Count; i++) _info.MineZones.Remove(_selectedMineZones[i]);
- UpdateMineZoneInterface();
- }
- private void MZAddbutton_Click(object sender, EventArgs e)
- {
- if (_info == null) return;
- _info.MineZones.Add(new MineZone());
- UpdateMineZoneInterface();
- }
- private void MZListlistBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- UpdateMineZoneInterface();
- }
- private void MZMineIndextextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- byte temp;
- if ((!byte.TryParse(ActiveControl.Text, out temp)) || (Settings.MineSetList.Count < temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMineZones.Count; i++)
- _selectedMineZones[i].Mine = temp;
- RefreshMineZoneList();
- }
- private void MZXtextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMineZones.Count; i++)
- _selectedMineZones[i].Location.X = temp;
- RefreshMineZoneList();
- }
- private void MZYtextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMineZones.Count; i++)
- _selectedMineZones[i].Location.Y = temp;
- RefreshMineZoneList();
- }
- private void MZSizetextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMineZones.Count; i++)
- _selectedMineZones[i].Size = temp;
- RefreshMineZoneList();
- }
- private void ImportMapInfoButton_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Filter = "Text File|*.txt";
- ofd.ShowDialog();
- if (ofd.FileName == string.Empty) return;
- MirForms.ConvertMapInfo.Path = ofd.FileName;
- MirForms.ConvertMapInfo.Start(Envir);
- MirForms.ConvertMapInfo.End();
- UpdateInterface(true);
- }
- private void ExportMapInfoButton_Click(object sender, EventArgs e)
- {
- if (_selectedMapInfos.Count == 0) return;
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.InitialDirectory = Path.Combine(Application.StartupPath, "Exports");
- sfd.FileName = "MapInfoExport";
- sfd.Filter = "Text File|*.txt";
- sfd.ShowDialog();
- if (sfd.FileName == string.Empty) return;
- using (StreamWriter sw = File.CreateText(sfd.FileNames[0]))
- {
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- {
- string textOut = string.Empty;
- textOut += $"[{_selectedMapInfos[i].FileName} {_selectedMapInfos[i].Title.Replace(' ', '*')}]";
- textOut += " LIGHT(" + _selectedMapInfos[i].Light + ")";
- textOut += " MINIMAP(" + _selectedMapInfos[i].MiniMap + ")";
- textOut += " BIGMAP(" + _selectedMapInfos[i].BigMap + ")";
- textOut += " MAPLIGHT(" + _selectedMapInfos[i].MapDarkLight + ")";
- textOut += " MINE(" + _selectedMapInfos[i].MineIndex + ")";
- textOut += " MUSIC(" + _selectedMapInfos[i].Music + ")";
- textOut += PrintMapAttributes(_selectedMapInfos[i]);
- sw.WriteLine(textOut);
- for (int j = 0; j < _selectedMapInfos[i].SafeZones.Count; j++)
- {
- string safeZoneOut = _selectedMapInfos[i].SafeZones[j].StartPoint ? "STARTZONE" : "SAFEZONE";
- safeZoneOut += "(" + _selectedMapInfos[i].FileName + "," +
- _selectedMapInfos[i].SafeZones[j].Size.ToString() + "," +
- _selectedMapInfos[i].SafeZones[j].Location.X.ToString() + "," +
- _selectedMapInfos[i].SafeZones[j].Location.Y.ToString() + ")";
- sw.WriteLine(safeZoneOut);
- }
- for (int j = 0; j < _selectedMapInfos[i].Movements.Count; j++)
- {
- try
- {
- string movement =
- $"{_selectedMapInfos[i].FileName} {_selectedMapInfos[i].Movements[j].Source.X + "," + _selectedMapInfos[i].Movements[j].Source.Y} {"->"} {Envir.MapInfoList.First(it=>it.Index== _selectedMapInfos[i].Movements[j].MapIndex).FileName} {_selectedMapInfos[i].Movements[j].Destination.X + "," + _selectedMapInfos[i].Movements[j].Destination.Y} {(_selectedMapInfos[i].Movements[j].NeedHole ? "NEEDHOLE " : "") + (_selectedMapInfos[i].Movements[j].NeedMove ? "NEEDMOVE " : "") + (_selectedMapInfos[i].Movements[j].ConquestIndex > 0 ? "NEEDCONQUEST(" + _selectedMapInfos[i].Movements[j].ConquestIndex + ")" : "") + (_selectedMapInfos[i].Movements[j].ShowOnBigMap ? "SHOWONBIGMAP " : "") + (_selectedMapInfos[i].Movements[j].Icon > 0 ? "BIGMAPICON(" + _selectedMapInfos[i].Movements[j].Icon + ")" : "")}";
- sw.WriteLine(movement);
- }
- catch
- {
- continue;
- }
- }
- for (int j = 0; j < _selectedMapInfos[i].MineZones.Count; j++)
- {
- try
- {
- string mineZones =
- $"MINEZONE {_selectedMapInfos[i].FileName} -> {_selectedMapInfos[i].MineZones[j].Mine.ToString()} {_selectedMapInfos[i].MineZones[j].Location.X.ToString()} {_selectedMapInfos[i].MineZones[j].Location.Y.ToString()} {_selectedMapInfos[i].MineZones[j].Size.ToString()}";
- sw.WriteLine(mineZones);
- }
- catch
- {
- continue;
- }
- }
- }
- }
- MessageBox.Show("Map Info Export Complete");
- }
- private String PrintMapAttributes(MapInfo map)
- {
- string textOut = string.Empty;
- if (map.NoTeleport) textOut += " NOTELEPORT";
- if (map.NoReconnect) textOut += " NORECONNECT(" + map.NoReconnectMap + ")";
- if (map.NoRandom) textOut += " NORANDOMMOVE";
- if (map.NoEscape) textOut += " NOESCAPE";
- if (map.NoRecall) textOut += " NORECALL";
- if (map.NoDrug) textOut += " NODRUG";
- if (map.NoPosition) textOut += " NOPOSITIONMOVE";
- if (map.NoThrowItem) textOut += " NOTHROWITEM";
- if (map.NoDropPlayer) textOut += " NOPLAYERDROP";
- if (map.NoDropMonster) textOut += " NOMONSTERDROP";
- if (map.NoNames) textOut += " NONAMES";
- if (map.NoMount) textOut += " NOMOUNT";
- if (map.NeedBridle) textOut += " NEEDBRIDLE";
- if (map.NoFight) textOut += " NOFIGHT";
- if (map.Fight) textOut += " FIGHT";
- if (map.Fire) textOut += " FIRE(" + map.FireDamage + ")";
- if (map.Lightning) textOut += " LIGHTNING(" + map.LightningDamage + ")";
- if (map.NoTownTeleport) textOut += " NOTownTeleport";
- if (map.GT) textOut += " GT(" + map.GTIndex + ")";
- if (map.NoExperience) textOut += " NOEXPERIENCE";
- if (map.NoGroup) textOut += " NOGROUP";
- if (map.NoPets) textOut += " NOPETS";
- if (map.NoIntelligentCreatures) textOut += " NOINTELLIGENTCREATURES";
- if (map.NoHero) textOut += " NOHERO";
- if (map.RequiredGroupSize > 1) textOut += " REQUIREDGROUP(" + map.RequiredGroupSize + ")";
- if (map.FireWallLimit && map.FireWallCount > 0) textOut += " FIREWALL(" + map.FireWallCount + ")";
- return textOut;
- }
- private void ImportMonGenButton_Click(object sender, EventArgs e)
- {
- bool hasImported = false;
- if (Envir.MapInfoList.Count == 0) return;
- MirForms.ConvertMonGenInfo.Start();
- for (int i = 0; i < MirForms.ConvertMonGenInfo.monGenList.Count; i++)
- {
- try
- {
- int monsterIndex = Envir.MonsterInfoList.Find(a => a.Name == MirForms.ConvertMonGenInfo.monGenList[i].Name).Index;
- if (monsterIndex == -1) continue;
- RespawnInfo respawnInfo = new RespawnInfo
- {
- MonsterIndex = monsterIndex,
- Location = new Point(MirForms.ConvertMonGenInfo.monGenList[i].X, MirForms.ConvertMonGenInfo.monGenList[i].Y),
- Count = (ushort)MirForms.ConvertMonGenInfo.monGenList[i].Count,
- Spread = (ushort)MirForms.ConvertMonGenInfo.monGenList[i].Range,
- Delay = (ushort)MirForms.ConvertMonGenInfo.monGenList[i].Delay,
- Direction = (byte)MirForms.ConvertMonGenInfo.monGenList[i].Direction,
- RoutePath = MirForms.ConvertMonGenInfo.monGenList[i].RoutePath,
- RespawnIndex = ++Envir.RespawnIndex
- };
- int index = Envir.MapInfoList.FindIndex(a => a.FileName == MirForms.ConvertMonGenInfo.monGenList[i].Map);
- if (index == -1) continue;
- Envir.MapInfoList[index].Respawns.Add(respawnInfo);
- hasImported = true;
- }
- catch (Exception)
- {
- continue;
- }
- }
- MirForms.ConvertMonGenInfo.Stop();
- if (!hasImported) return;
- UpdateInterface(true);
- MessageBox.Show("MonGen Import complete");
- }
- private void ExportMonGenButton_Click(object sender, EventArgs e)
- {
- if (_selectedMapInfos.Count == 0) return;
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.InitialDirectory = Path.Combine(Application.StartupPath, "Exports");
- sfd.Filter = "Text File|*.txt";
- sfd.ShowDialog();
- if (sfd.FileName == string.Empty) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- {
- using (StreamWriter sw = File.AppendText(sfd.FileNames[0]))
- {
- for (int j = 0; j < _selectedMapInfos[i].Respawns.Count; j++)
- {
- MonsterInfo mob = Envir.GetMonsterInfo(_selectedMapInfos[i].Respawns[j].MonsterIndex);
- if (mob == null) continue;
- string Output = $"{_selectedMapInfos[i].FileName}" +
- $",{_selectedMapInfos[i].Respawns[j].Location.X}" +
- $",{_selectedMapInfos[i].Respawns[j].Location.Y}" +
- $",{mob.Name}" +
- $",{_selectedMapInfos[i].Respawns[j].Spread}" +
- $",{_selectedMapInfos[i].Respawns[j].Count}" +
- $",{_selectedMapInfos[i].Respawns[j].Delay}" +
- $",{_selectedMapInfos[i].Respawns[j].Direction}" +
- $",{_selectedMapInfos[i].Respawns[j].RoutePath}";
- sw.WriteLine(Output);
- }
- }
- }
- MessageBox.Show("MonGen Export complete");
- }
- private void VisualizerButton_Click(object sender, EventArgs e)
- {
- if (_selectedMapInfos.Count != 1)
- return;
- MirForms.VisualMapInfo.VForm VForm = new MirForms.VisualMapInfo.VForm();
- MirForms.VisualMapInfo.Class.VisualizerGlobal.MapInfo = _selectedMapInfos[0];
- VForm.FormClosed += VForm_Disposed;
- VForm.ShowDialog();
- _selectedMapInfos[0] = MirForms.VisualMapInfo.Class.VisualizerGlobal.MapInfo;
- UpdateMineZoneInterface();
- UpdateRespawnInterface();
- }
- private void VForm_Disposed(object sender, EventArgs e)
- {
- RefreshRespawnList();
- RefreshMineZoneList();
- }
- private void MineComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].MineIndex = Convert.ToByte(MineComboBox.SelectedIndex);
- }
- private void MineZoneComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMineZones.Count; i++)
- _selectedMineZones[i].Mine = Convert.ToByte(MineZoneComboBox.SelectedIndex);
- RefreshMineZoneList();
- }
- private void NoMountCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoMount = NoMountCheckbox.Checked;
- }
- private void NeedBridleCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NeedBridle = NeedBridleCheckbox.Checked;
- }
- private void NoFightCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoFight = NoFightCheckbox.Checked;
- }
- private void MusicTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return; ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].Music = temp;
- }
- private void RandomTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ushort temp;
- if (!ushort.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- _selectedRespawnInfos[i].RandomDelay = temp;
- RefreshRespawnList();
- }
- private void chkRespawnEnableTick_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- if (chkRespawnEnableTick.Checked)
- {
- chkrespawnsave.Enabled = true;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- {
- _selectedRespawnInfos[i].RespawnTicks = _selectedRespawnInfos[i].Delay;
- _selectedRespawnInfos[i].Delay = 0;
- }
- }
- else
- {
- chkrespawnsave.Enabled = false;
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- {
- _selectedRespawnInfos[i].Delay = _selectedRespawnInfos[i].RespawnTicks;
- _selectedRespawnInfos[i].RespawnTicks = 0;
- }
- }
- RefreshRespawnList();
- }
- private void chkrespawnsave_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- if (chkRespawnEnableTick.Checked)
- {
- for (int i = 0; i < _selectedRespawnInfos.Count; i++)
- {
- _selectedRespawnInfos[i].SaveRespawnTime = chkrespawnsave.Checked;
- }
- }
- RefreshRespawnList();
- }
- private void ConquestComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- ComboBox cmb = sender as ComboBox;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- {
- var conquestIndex = 0;
- if (cmb.SelectedIndex >= 0)
- {
- ConquestInfo info = Envir.ConquestInfoList.FirstOrDefault(x => x.Name == ConquestComboBox.SelectedItem.ToString());
- if (info != null)
- {
- conquestIndex = info.Index;
- }
- MovementInfo thisMovement = _info.Movements.FirstOrDefault(x => x.MapIndex == _selectedMovementInfos[i].MapIndex &&
- x.Source == _selectedMovementInfos[i].Source &&
- x.Destination == _selectedMovementInfos[i].Destination);
- if (thisMovement != null)
- {
- thisMovement.ConquestIndex = conquestIndex;
- }
- }
- }
- RefreshMovementList();
- }
- private void NoTownTeleportCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoTownTeleport = NoTownTeleportCheckbox.Checked;
- }
- private void NoReincarnation_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoReincarnation = NoReincarnation.Checked;
- }
- private void ShowBigMapCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].ShowOnBigMap = ShowBigMapCheckBox.Checked;
- }
- private void BigMapIconTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- int temp;
- if (!int.TryParse(ActiveControl.Text, out temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMovementInfos.Count; i++)
- _selectedMovementInfos[i].Icon = temp;
- RefreshMovementList();
- }
- private void lstParticles_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- WeatherSetting newvalue = WeatherSetting.None;
- foreach (WeatherSetting item in lstParticles.SelectedItems)
- newvalue = newvalue | item;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- {
- _selectedMapInfos[i].WeatherParticles = newvalue;
- }
- //UpdateInterface(true); This isn't needed
- }
- private void MapSearchButton_Click(object sender, EventArgs e)
- {
- if (MapSearchTextBox.Text == null)
- return;
- UpdateInterface(true);
- }
- #region GT
- private void GTBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].GT = GTBox.Checked;
- }
- private void GTIndexBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- if (!byte.TryParse(ActiveControl.Text, out byte temp))
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].GTIndex = temp;
- }
- #endregion
- private void NoExperienceCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoExperience = NoExperienceCheckbox.Checked;
- }
- private void noGroupCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoGroup = noGroupCheckbox.Checked;
- }
- private void NoPetsCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoPets = NoPetsCheckbox.Checked;
- }
- private void NoIntelligentCreatureCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoIntelligentCreatures = NoIntelligentCreatureCheckbox.Checked;
- }
-
- private void NoHeroesCheckbox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].NoHero = NoHeroesCheckbox.Checked;
- }
- private void RequiredGroupTextBox_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- string txt = RequiredGroupTextBox.Text.Trim();
- int value;
- if (txt.Length == 0)
- {
- // blank = off
- value = 0;
- RequiredGroupTextBox.BackColor = SystemColors.Window;
- }
- else if (!int.TryParse(txt, out value))
- {
- RequiredGroupTextBox.BackColor = Color.Red;
- return;
- }
- else
- {
- RequiredGroupTextBox.BackColor = SystemColors.Window;
- // 0 or 1 = off
- if (value <= 1) value = 0;
- // clamp upper bound
- value = Math.Min(Globals.MaxGroup, value);
- }
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].RequiredGroupSize = value;
- }
- private void RequiredGroupCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- bool value = RequiredGroupCheckBox.Checked;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].RequiredGroup = value;
- }
- private void FireWallCheckBox_CheckedChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- FireWallCount.Enabled = FireWallCheckBox.Checked;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- {
- _selectedMapInfos[i].FireWallLimit = FireWallCheckBox.Checked;
- if (_selectedMapInfos[i].FireWallLimit)
- {
- if (!int.TryParse(FireWallCount.Text, out var parsed) || parsed <= 0)
- {
- _selectedMapInfos[i].FireWallCount = 1;
- FireWallCount.Text = "1";
- }
- }
- }
- }
- private void FireWallCount_TextChanged(object sender, EventArgs e)
- {
- if (ActiveControl != sender) return;
- if (!FireWallCheckBox.Checked)
- {
- ActiveControl.BackColor = SystemColors.Window;
- return;
- }
- if (!int.TryParse(FireWallCount.Text, out var temp) || temp <= 0)
- {
- ActiveControl.BackColor = Color.Red;
- return;
- }
- ActiveControl.BackColor = SystemColors.Window;
- for (int i = 0; i < _selectedMapInfos.Count; i++)
- _selectedMapInfos[i].FireWallCount = temp;
- }
- }
- }
|