private void _tbImport_Click(object sender, RoutedEventArgs e) { Table <int, ReadableTuple <int> > btable = _tab.ProjectDatabase.GetMetaTable <int>(ServerDbs.Mobs); SelectFromDialog select = new SelectFromDialog(btable, ServerDbs.Mobs, ""); select.Owner = WpfUtilities.TopWindow; if (select.ShowDialog() == true) { _eventsDisabled = true; ReadableTuple <int> tuple = btable.GetTuple(select.Id.ToInt()); _level = tuple.GetValue <int>(ServerMobAttributes.Lv); for (int i = 0; i < 6; i++) { _rates[i] = tuple.GetValue <int>(ServerMobAttributes.Str.Index + i); } _gpRate.SetPosition(_level / Limit, false); _setValues(); _eventsDisabled = false; } }
private static void _trySetIfDefault(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { if (tuple.GetValue <string>(attribute) != defaultValue) { builder.AppendLineUnix("\t" + attribute.AttributeName + ": " + tuple.GetValue <string>(attribute)); } }
public static bool IsArmorType(ReadableTuple <int> tuple) { if (SdeAppConfiguration.RevertItemTypes) { return(tuple.GetValue <TypeType>(ServerItemAttributes.Type) == TypeType.Weapon); } return(tuple.GetValue <TypeType>(ServerItemAttributes.Type) == TypeType.Armor); }
public static void TrySetAttack(ReadableTuple <int> tuple, StringBuilder builder) { var atk1 = FormatConverters.IntOrHexConverter(tuple.GetValue <string>(ServerMobAttributes.Atk1)); var atk2 = FormatConverters.IntOrHexConverter(tuple.GetValue <string>(ServerMobAttributes.Atk2)); if (atk1 == atk2 && atk1 == 0) { return; } builder.AppendLine("\tAttack: [" + atk1 + ", " + (atk2 - atk1) + "]"); }
public static void WriteEntryYaml(StringBuilder builder, ReadableTuple <int> tuple) { if (tuple != null) { string valueS; builder.AppendLine(" - Id: " + tuple.Key); builder.AppendLine(" Map: " + (String.IsNullOrEmpty((valueS = tuple.GetValue <string>(ServerCastleAttributes.MapName))) ? "SDE_NULL" : valueS)); builder.AppendLine(" Name: " + (String.IsNullOrEmpty((valueS = tuple.GetValue <string>(ServerCastleAttributes.CastleName))) ? "SDE_NULL" : valueS)); builder.AppendLine(" Npc: " + (String.IsNullOrEmpty((valueS = tuple.GetValue <string>(ServerCastleAttributes.NpcName))) ? "SDE_NULL" : valueS)); } }
private void _reload() { ID = _tuple.GetValue <int>(_index); Name = ""; if (_itemsTable.ContainsKey(ID)) { Name = (string)_itemsTable.GetTuple(ID).GetRawValue(ServerItemAttributes.Name.Index); } DropOriginal = Int32.Parse(((string)_tuple.GetRawValue(_index + 1))); Drop = String.Format("{0:0.00} %", DropOriginal / 100f); MVP = _index < ServerMobAttributes.Drop1ID.Index ? "MVP" : ""; if (DbPathLocator.IsYamlMob()) { int b = (AttributeIndex - ServerMobAttributes.Drop1ID.Index) / 2; int distRandGroup = ServerMobAttributes.Drop1RandomOptionGroup.Index + b; int distSteal = ServerMobAttributes.Drop1Flags.Index + b; StealProtected = Boolean.Parse(_tuple.GetRawValue <string>(distSteal)); RandomOptionGroup = (_tuple.GetRawValue(distRandGroup) ?? "").ToString(); } }
private void _updateFields(ReadableTuple <int> tuple) { // We update the fields int value = tuple.GetValue <int>(_attribute); _boxes.ForEach(p => p.IsChecked = false); if (value == 0) { _boxes[0].IsChecked = true; } else { for (int i = 1; i < 4; i++) { CheckBox box = _boxes[i]; int val = 1 << (i - 1); if ((value & val) == val) { box.IsChecked = true; } } } }
private void _autoAddElement(ReadableTuple <int> tupleSource, ParameterHolder holder) { var script = tupleSource.GetValue <string>(ServerItemAttributes.Script); const string Bonus = "bonus bAtkEle"; if (script.Contains(Bonus)) { int start = script.IndexOf(Bonus, StringComparison.Ordinal) + Bonus.Length; int end = script.IndexOf(";", start, StringComparison.Ordinal); if (end < 0) { end = script.Length; } var bonus = script.Substring(start, end - start).Trim(',', ' ', ';'); if (bonus.Length > 4) { holder.Values[ParameterHolderKeys.Property] = bonus.Substring(4); } } else { if (ProjectConfiguration.AutocompleteNeutralProperty) { holder.Values[ParameterHolderKeys.Property] = "Neutral"; } } }
public static void SetQuestValue(Table <int, ReadableTuple <int> > table, ReadableTuple <int> tuple, string[] elements, int id) { string value = tuple.GetValue <string>(ClientQuestsAttributes.AttributeList[id]); if (value == "") { if (elements[id] == "") { return; } table.Commands.Set(tuple, ClientQuestsAttributes.AttributeList[id], elements[id]); } else if (elements[id] == "") { //table.Set(tuple.Key, ClientQuestsAttributes.AttributeList[id], value); } else if (_isKorean(value)) { if (elements[id] == value) { return; } table.Commands.Set(tuple, ClientQuestsAttributes.AttributeList[id], elements[id]); } else if (_isKorean(elements[id])) { //table.Set(tuple.Key, ClientQuestsAttributes.AttributeList[id], value); } }
private static void _trySet(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(tuple.GetValue <string>(attribute)); }
public static void TrySetGender(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { int key = tuple.GetKey <int>(); string val = tuple.GetValue <string>(attribute); if (key >= 1950 && key < 2000) { if (val == "0") { return; } } if (key == 2635) { if (val == "0") { return; } } if (val != "" && val != defaultValue && val != "-1") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLine(val); } }
private void _update() { try { GDbTab tab = _editor.FindTopmostTab(); _tab = tab; _item = null; if (tab != null && (tab.DbComponent.DbSource == ServerDbs.Mobs || tab.DbComponent.DbSource == ServerDbs.Mobs2)) { ReadableTuple <int> tuple = tab._listView.SelectedItem as ReadableTuple <int>; _mobDb = (AbstractDb <int>)tab.DbComponent; if (tab.DbComponent.DbSource == ServerDbs.Mobs && !_bind1) { tab._listView.SelectionChanged += (e, s) => _update(); _bind1 = true; } if (tab.DbComponent.DbSource == ServerDbs.Mobs2 && !_bind2) { tab._listView.SelectionChanged += (e, s) => _update(); _bind2 = true; } if (tuple != null) { _item = _mobDb.Table.GetTuple(tuple.Key); _eventsDisabled = true; _level = _item.GetValue <int>(ServerMobAttributes.Lv); for (int i = 0; i < 6; i++) { _rates[i] = _item.GetValue <int>(ServerMobAttributes.Str.Index + i); } _gpRate.SetPosition(_level / Limit, false); _setValues(); _eventsDisabled = false; } } } catch (Exception err) { ErrorHandler.HandleException(err); } }
public static void ExpandFlagYaml <T>(StringBuilder builder, ReadableTuple <int> tuple, string name, DbAttribute attribute, string indent1, string indent2, Func <bool> isExtra = null, Action extra = null) { long value = FormatConverters.LongOrHexConverter(tuple.GetValue <string>(attribute)); if (value != 0 || (isExtra != null && isExtra())) { if (name != "") { builder.Append(indent1); builder.Append(name); builder.AppendLine(": {"); } var flagsData = FlagsManager.GetFlag <T>(); if (flagsData != null) { foreach (var v in flagsData.Values) { long vF = v.Value; if ((v.DataFlag & FlagDataProperty.Hide) == FlagDataProperty.Hide) { continue; } if ((vF & value) == vF) { builder.Append(indent2); builder.Append(v.Name); builder.AppendLine(": true"); } } } else { foreach (var v in Enum.GetValues(typeof(T)).Cast <T>()) { int vF = (int)(object)v; if ((vF & value) == vF) { builder.Append(indent2); builder.Append(Constants.ToString(v)); builder.AppendLine(": true"); } } } if (extra != null) { extra(); } builder.Append(indent1); builder.AppendLine("}"); } }
public static void TrySetIfNotDefault(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = tuple.GetValue <string>(attribute); if (val != defaultValue) { builder.AppendLine("\t" + attribute.AttributeName + ": " + val); } }
private void _autoAddJob(ReadableTuple <int> tupleSource, ParameterHolder holder, int equipLevel) { var val = tupleSource.GetValue <string>(ServerItemAttributes.ApplicableJob); string applicationJob = JobList.GetStringJobFromHex(val, _getUpper(tupleSource), _getGender(tupleSource), equipLevel); //if (!String.IsNullOrEmpty(applicationJob)) { holder.Values[ParameterHolderKeys.ApplicableJob] = applicationJob; //} }
public void Read(ReadableTuple <int> tuple, GDbTab tab) { PreviewSprite = null; KeepPreviousPreviewPosition = true; RemoveJobs(); RemoveError(); List <Job> jobs; _lastTuple = tuple; _metaGrf = tab.ProjectDatabase.MetaGrf; _currentTab = tab; foreach (var preview in _previews) { if (preview.CanRead(tuple)) { if (_lastMatch != preview) { KeepPreviousPreviewPosition = false; } _lastMatch = preview; string job = tuple.GetValue <string>(ServerItemAttributes.ApplicableJob); jobs = JobList.GetJobsFromHex("0x" + ((job == "") ? "FFFFFFFF" : job), tuple.GetIntNoThrow(ServerItemAttributes.Upper)); preview.Read(tuple, this, jobs); break; } } if (_listView.Items.Count > 0) { _listView.SelectedItem = PreferredJob; if (_listView.SelectedItem == null) { if (_oldJob != null) { _listView.SelectedItem = _oldJob; } if (_listView.SelectedItem == null) { _listView.SelectedIndex = 0; } } } else { _updatePreview(SpriteDefault); } if (!KeepPreviousPreviewPosition) { _selector.SetAction(_lastMatch.SuggestedAction); } }
private void _autoAddJobIfRestricted(ReadableTuple <int> tupleSource, ParameterHolder holder) { var val = tupleSource.GetValue <string>(ServerItemAttributes.ApplicableJob); string applicationJob = JobList.GetStringJobFromHex(val, _getUpper(tupleSource), _getGender(tupleSource)); if (String.CompareOrdinal(applicationJob, JobList.EveryJob.Name) != 0) { holder.Values[ParameterHolderKeys.ApplicableJob] = applicationJob; } }
private int _getGender(ReadableTuple <int> tuple) { var gender = tuple.GetValue <int>(ServerItemAttributes.Gender); if (gender < 0) { return(2); } return(gender); }
public static void TrySetIfDefaultLocation(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute) { string val = tuple.GetValue <string>(attribute); if (val != "" && val != "0") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLine(val); } }
private static void _trySetIfDefaultEmptyUpper(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute) { string val = tuple.GetValue <string>(attribute); if (val != "" && val != "7" && val != "63") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(val); } }
public static void TrySetIfDefaultEmptyAddHex(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = "0x" + tuple.GetValue <string>(attribute); if (val != "" && val != defaultValue && val.Length > 2 && val.ToLower() != "0xffffffff") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLine(val); } }
public static void TrySetIfDefaultEmptyScript(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = tuple.GetValue <string>(attribute); if (val != "" && val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": <\""); builder.Append(ScriptFormat(val, 2, true)); builder.AppendLine("\">"); } }
public static void TrySetIfDefaultEmptyBracket(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = tuple.GetValue <string>(attribute); if (val != "" && val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": ["); builder.Append(val); builder.AppendLine("]"); } }
private int _getUpper(ReadableTuple <int> tuple) { var upper = tuple.GetValue <string>(ServerItemAttributes.Upper); if (String.IsNullOrEmpty(upper)) { return(JobGroup.All.Id); } int ival; Int32.TryParse(upper, out ival); return(ival); }
public static void TrySetIfDefaultEmptyAddHexJobEx(ReadableTuple <int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = "0x" + tuple.GetValue <string>(attribute); if (val != "" && val != defaultValue && val.Length > 2 && val.ToLower() != "0xffffffff") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.AppendLine(": {"); int value = FormatConverters.IntOrHexConverter(val); if (value == 0) { builder.AppendLine("\t\tAll: false"); builder.AppendLine("\t}"); return; } if (value > 0) { foreach (var job in DbIOItems.ItemDbJobs) { if ((value & job.Value) == job.Value) { builder.Append("\t\t"); builder.Append(job.Key); builder.AppendLine(": true"); } } } else { builder.AppendLine("\t\tAll: true"); foreach (var job in DbIOItems.ItemDbJobs.Skip(1)) { if ((value & ~job.Value) == ~job.Value) { builder.Append("\t\t"); builder.Append(job.Key); builder.AppendLine(": false"); } } } builder.AppendLine("\t}"); } }
private static void _trySetIfDefaultBoolean(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, bool defaultValue) { if (tuple.GetRawValue(attribute.Index) as string == "") return; bool val = tuple.GetValue<bool>(attribute); if (val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(val.ToString().ToLower()); } }
private static void _trySet(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(tuple.GetValue<string>(attribute)); }
private static void _trySetIfDefault(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { if (tuple.GetValue<string>(attribute) != defaultValue) { builder.AppendLineUnix("\t" + attribute.AttributeName + ": " + tuple.GetValue<string>(attribute)); } }
private static void _trySetIfDefaultLocation(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute) { string val = tuple.GetValue<string>(attribute); if (val != "" && val != "0") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(val); } }
private static void _trySetIfDefaultEmptyScript(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = tuple.GetValue<string>(attribute); if (val != "" && val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": <\""); builder.Append(Format(val, 2, true)); builder.AppendLineUnix("\">"); } }
private static void _trySetGender(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { int key = tuple.GetKey<int>(); string val = tuple.GetValue<string>(attribute); if (key >= 1950 && key < 2000) { if (val == "0") return; } if (key == 2635) { if (val == "0") return; } if (val != "" && val != defaultValue && val != "-1") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(val); } }
private static void _trySetIfDefaultEmptyBracket(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = tuple.GetValue<string>(attribute); if (val != "" && val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": ["); builder.Append(val); builder.AppendLineUnix("]"); } }
private static void _trySetIfRefineable(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, bool defaultValue) { int type = tuple.GetValue<int>(ServerItemAttributes.Type); bool val = tuple.GetValue<bool>(attribute); if (type != 4 && type != 5) { if (val) { // This is not supposed to be allowed, but... we'll let it slide DbLoaderErrorHandler.Handle("The refineable status on the item ID [" + tuple.GetKey<int>() + "] has been set to true but the item type is not an equipment. This is suspicious.", ErrorLevel.Warning); builder.AppendLineUnix("\t" + attribute.AttributeName + ": true"); } return; } if (val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(val.ToString().ToLower()); } }
private static void _trySetIfDefaultEmptyAddHex(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = "0x" + tuple.GetValue<string>(attribute); if (val != "" && val != defaultValue && val.Length > 2 && val.ToLower() != "0xffffffff") { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(val); } }
private static void _trySetIfDefaultEmptyToHex(ReadableTuple<int> tuple, StringBuilder builder, DbAttribute attribute, string defaultValue) { string val = tuple.GetValue<string>(attribute); int ival; if (Int32.TryParse(val, out ival)) { string sval = "0x" + ival.ToString("X").ToLower(); if (val != defaultValue) { builder.Append("\t"); builder.Append(attribute.AttributeName); builder.Append(": "); builder.AppendLineUnix(sval); } } else { Z.F(); } }