public NouseEditDialog(ReadableTuple <int> tuple) : base("NoUse edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize) { InitializeComponent(); ToolTipsBuilder.Initialize(new string[] { "Cannot use the item while sitting." }, this); _override = tuple.GetIntNoThrow(ServerItemAttributes.NoUseOverride); _flag = tuple.GetIntNoThrow(ServerItemAttributes.NoUseFlag); _cbUpper1.Tag = 1 << 0; _boxes.Add(_cbUpper1); _tbOverride.Text = tuple.GetIntNoThrow(ServerItemAttributes.NoUseOverride).ToString(CultureInfo.InvariantCulture); _eventId = 0; _boxes.ForEach(_addEvents); _tbOverride.TextChanged += delegate { _update(); }; WindowStartupLocation = WindowStartupLocation.CenterOwner; }
public TradeEditDialog(ReadableTuple <int> tuple) : base("Trade edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize) { InitializeComponent(); ToolTipsBuilder.Initialize(new string[] { "Item can't be droped", "Item can't be traded (nor vended)", "Wedded partner can override restriction 2.", "Item can't be sold to npcs", "Item can't be placed in the cart", "Item can't be placed in the storage", "Item can't be placed in the guild storage", "Item can't be attached to mail", "Item can't be auctioned" }, this); _override = tuple.GetIntNoThrow(ServerItemAttributes.TradeOverride); _flag = tuple.GetIntNoThrow(ServerItemAttributes.TradeFlag); _cbUpper1.Tag = 1 << 0; _cbUpper2.Tag = 1 << 1; _cbUpper3.Tag = 1 << 2; _cbUpper4.Tag = 1 << 3; _cbUpper5.Tag = 1 << 4; _cbUpper6.Tag = 1 << 5; _cbUpper7.Tag = 1 << 6; _cbUpper8.Tag = 1 << 7; _cbUpper9.Tag = 1 << 8; _boxes.Add(_cbUpper1); _boxes.Add(_cbUpper2); _boxes.Add(_cbUpper3); _boxes.Add(_cbUpper4); _boxes.Add(_cbUpper5); _boxes.Add(_cbUpper6); _boxes.Add(_cbUpper7); _boxes.Add(_cbUpper8); _boxes.Add(_cbUpper9); _tbOverride.Text = tuple.GetIntNoThrow(ServerItemAttributes.TradeOverride).ToString(CultureInfo.InvariantCulture); _eventId = 0; _boxes.ForEach(_addEvents); _tbOverride.TextChanged += delegate { _update(); }; WindowStartupLocation = WindowStartupLocation.CenterOwner; }
private void _reload() { if (_skillDbTuple != null) { Name = _skillDbTuple.GetStringValue(ServerSkillAttributes.Desc.Index); if (String.IsNullOrEmpty(Name)) { Name = _skillDbTuple.Key.ToString(CultureInfo.InvariantCulture); } } if (_mobSkillDbTuple != null) { int icondition = _mobSkillDbTuple.GetValue <int>(ServerMobSkillAttributes.ConditionType); string condition = Enum.GetValues(typeof(ConditionType)).Cast <Enum>().Select(Description.GetDescription).ToList()[icondition]; Condition = condition. Replace("[CValue]", _mobSkillDbTuple.GetStringValue(ServerMobSkillAttributes.ConditionValue.Index)). Replace("[Val1]", _mobSkillDbTuple.GetStringValue(ServerMobSkillAttributes.Val1.Index)); if (String.IsNullOrEmpty(Name)) { Name = "#Not found - " + _mobSkillDbTuple.GetIntNoThrow(ServerMobSkillAttributes.SkillId); } } if (String.IsNullOrEmpty(Name)) { Name = "#Invalid ID"; } }
public TradeEditDialog(ReadableTuple <int> tuple) : base("Trade edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize) { InitializeComponent(); ToolTipsBuilder.Initialize(new string[] { "Item can't be droped", "Item can't be traded (nor vended)", "Wedded partner can override restriction 2.", "Item can't be sold to npcs", "Item can't be placed in the cart", "Item can't be placed in the storage", "Item can't be placed in the guild storage", "Item can't be attached to mail", "Item can't be auctioned" }, this); _flag = tuple.GetIntNoThrow(ServerItemAttributes.TradeFlag); _cbUpper1.Tag = 1 << 0; _cbUpper2.Tag = 1 << 1; _cbUpper3.Tag = 1 << 2; _cbUpper4.Tag = 1 << 3; _cbUpper5.Tag = 1 << 4; _cbUpper6.Tag = 1 << 5; _cbUpper7.Tag = 1 << 6; _cbUpper8.Tag = 1 << 7; _cbUpper9.Tag = 1 << 8; _rbMet1.Tag = 467; _rbMet2.Tag = 475; _rbMet3.Tag = 483; _rbMet4.Tag = 491; _rbMet5.Tag = 507; _boxes.Add(_cbUpper1); _boxes.Add(_cbUpper2); _boxes.Add(_cbUpper3); _boxes.Add(_cbUpper4); _boxes.Add(_cbUpper5); _boxes.Add(_cbUpper6); _boxes.Add(_cbUpper7); _boxes.Add(_cbUpper8); _boxes.Add(_cbUpper9); _radios.Add(_rbMet1); _radios.Add(_rbMet2); _radios.Add(_rbMet3); _radios.Add(_rbMet4); _radios.Add(_rbMet5); _eventId = 0; _boxes.ForEach(_addEvents); _radios.ForEach(_addEvents); _rbEvents = true; WindowStartupLocation = WindowStartupLocation.CenterOwner; }
public void Read(ReadableTuple <int> tuple, PreviewHelper helper, List <Job> jobs) { helper.PreviewSprite = LuaHelper.GetSpriteFromViewId(tuple.GetIntNoThrow(ServerItemAttributes.ClassNumber), LuaHelper.ViewIdTypes.Weapon, helper.Db, tuple); if (helper.PreviewSprite == null) { helper.SetError(PreviewHelper.ViewIdNotSet); return; } helper.SetJobs(jobs); }
public NouseEditDialog(ReadableTuple <int> tuple) : base("NoUse edit", "cde.ico", SizeToContent.Height, ResizeMode.CanResize) { InitializeComponent(); ToolTipsBuilder.Initialize(new string[] { "Cannot use the item while sitting." }, this); _flag = tuple.GetIntNoThrow(ServerItemAttributes.NoUseFlag); _cbUpper1.Tag = 1 << 0; _boxes.Add(_cbUpper1); _eventId = 0; _boxes.ForEach(_addEvents); WindowStartupLocation = WindowStartupLocation.CenterOwner; }
public static void WriteEntryYaml(StringBuilder builder, ReadableTuple <int> tuple, MetaTable <int> itemDb) { if (tuple != null) { builder.AppendLine(" - Id: " + tuple.GetKey <int>().ToString(CultureInfo.InvariantCulture)); builder.AppendLine(" AegisName: " + tuple.GetValue <string>(ServerMobAttributes.AegisName)); builder.AppendLine(" Name: " + DbIOUtils.QuoteCheck(tuple.GetValue <string>(ServerMobAttributes.IRoName))); if (tuple.GetValue <string>(ServerMobAttributes.IRoName) != tuple.GetValue <string>(ServerMobAttributes.KRoName)) { builder.AppendLine(" JapaneseName: " + DbIOUtils.QuoteCheck(tuple.GetValue <string>(ServerMobAttributes.KRoName))); } int value; //bool valueB; string valueS; //int type = 0; builder.AppendLine(" Level: " + tuple.GetValue <int>(ServerMobAttributes.Lv)); if ((value = tuple.GetValue <int>(ServerMobAttributes.Hp)) != 1) { builder.AppendLine(" Hp: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Sp)) != 1) { builder.AppendLine(" Sp: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Exp)) != 0) { builder.AppendLine(" BaseExp: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.JExp)) != 0) { builder.AppendLine(" JobExp: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.MvpExp)) != 0) { builder.AppendLine(" MvpExp: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Atk1)) != 0) { builder.AppendLine(" Attack: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Atk2)) != 0) { builder.AppendLine(" Attack2: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Def)) != 0) { builder.AppendLine(" Defense: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Mdef)) != 0) { builder.AppendLine(" MagicDefense: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Str)) != 1) { builder.AppendLine(" Str: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Agi)) != 1) { builder.AppendLine(" Agi: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Vit)) != 1) { builder.AppendLine(" Vit: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Int)) != 1) { builder.AppendLine(" Int: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Dex)) != 1) { builder.AppendLine(" Dex: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.Luk)) != 1) { builder.AppendLine(" Luk: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.AttackRange)) != 0) { builder.AppendLine(" AttackRange: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.ViewRange)) != 0) { builder.AppendLine(" SkillRange: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.ChaseRange)) != 0) { builder.AppendLine(" ChaseRange: " + value); } //if ((value = tuple.GetValue<int>(ServerMobAttributes.Size)) != 0) { builder.AppendLine(" Size: " + Constants.ToString <SizeType>(tuple.GetValue <int>(ServerMobAttributes.Size))); //} builder.AppendLine(" Race: " + Constants.ToString <MobRaceType>(tuple.GetValue <int>(ServerMobAttributes.Race))); DbIOUtils.ExpandFlag <MobGroup2Type>(builder, tuple, "RaceGroups", ServerMobAttributes.RaceGroups, YamlParser.Indent4, YamlParser.Indent6); int elementLevel = tuple.GetValue <int>(ServerMobAttributes.Element) / 20; int element = tuple.GetValue <int>(ServerMobAttributes.Element) % 20; switch (element) { case 0: builder.AppendLine(" Element: Neutral"); break; case 1: builder.AppendLine(" Element: Water"); break; case 2: builder.AppendLine(" Element: Earth"); break; case 3: builder.AppendLine(" Element: Fire"); break; case 4: builder.AppendLine(" Element: Wind"); break; case 5: builder.AppendLine(" Element: Poison"); break; case 6: builder.AppendLine(" Element: Holy"); break; case 7: builder.AppendLine(" Element: Dark"); break; case 8: builder.AppendLine(" Element: Ghost"); break; case 9: builder.AppendLine(" Element: Undead"); break; } builder.AppendLine(" ElementLevel: " + elementLevel); if ((value = tuple.GetValue <int>(ServerMobAttributes.MoveSpeed)) != 0) { builder.AppendLine(" WalkSpeed: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.AttackDelay)) != 0) { builder.AppendLine(" AttackDelay: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.AttackMotion)) != 0) { builder.AppendLine(" AttackMotion: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.DamageMotion)) != 0) { builder.AppendLine(" DamageMotion: " + value); } if ((value = tuple.GetValue <int>(ServerMobAttributes.DamageTaken)) != 100) { builder.AppendLine(" DamageTaken: " + value); } long mode = FormatConverters.LongOrHexConverter(tuple.GetValue <string>(ServerMobAttributes.NewMode)); if ((mode & 0xB695) == 0xB695) { builder.AppendLine(" Ai: 26"); mode &= ~0xB695; } else if ((mode & 0x8084) == 0x8084) { builder.AppendLine(" Ai: 27"); mode &= ~0x8084; } else if ((mode & 0x7085) == 0x7085) { builder.AppendLine(" Ai: 08"); mode &= ~0x7085; } else if ((mode & 0x3885) == 0x3885) { builder.AppendLine(" Ai: 04"); mode &= ~0x3885; } else if ((mode & 0x3695) == 0x3695) { builder.AppendLine(" Ai: 21"); mode &= ~0x3695; } else if ((mode & 0x3295) == 0x3295) { builder.AppendLine(" Ai: 20"); mode &= ~0x3295; } else if ((mode & 0x3095) == 0x3095) { builder.AppendLine(" Ai: 09"); mode &= ~0x3095; } else if ((mode & 0x308D) == 0x308D) { builder.AppendLine(" Ai: 13"); mode &= ~0x308D; } else if ((mode & 0x2085) == 0x2085) { builder.AppendLine(" Ai: 05"); mode &= ~0x2085; } else if ((mode & 0x108B) == 0x108B) { builder.AppendLine(" Ai: 07"); mode &= ~0x108B; } else if ((mode & 0x1089) == 0x1089) { builder.AppendLine(" Ai: 03"); mode &= ~0x1089; } else if ((mode & 0xA1) == 0xA1) { builder.AppendLine(" Ai: 24"); mode &= ~0xA1; } else if ((mode & 0x91) == 0x91) { builder.AppendLine(" Ai: 17"); mode &= ~0x91; } else if ((mode & 0x84) == 0x84) { builder.AppendLine(" Ai: 10"); mode &= ~0x84; } else if ((mode & 0x83) == 0x83) { builder.AppendLine(" Ai: 02"); mode &= ~0x83; } else if ((mode & 0x81) == 0x81) { builder.AppendLine(" Ai: 01"); mode &= ~0x81; } else if ((mode & 0x1) == 0x1) { builder.AppendLine(" Ai: 25"); mode &= ~0x1; } if ((value = tuple.GetValue <int>(ServerMobAttributes.Class)) != 0) { builder.AppendLine(" Class: " + Constants.ToString <ClassType>(value)); } if (mode > 0) { builder.AppendLine(" Modes:"); if ((mode & 0x1) == 0x1) { builder.AppendLine(" CanMove: true"); } if ((mode & 0x80) == 0x80) { builder.AppendLine(" CanAttack: true"); } if ((mode & 0x40) == 0x40) { builder.AppendLine(" NoCast: true"); } if ((mode & 0x2) == 0x2) { builder.AppendLine(" Looter: true"); } if ((mode & 0x4) == 0x4) { builder.AppendLine(" Aggressive: true"); } if ((mode & 0x8) == 0x8) { builder.AppendLine(" Assist: true"); } if ((mode & 0x20) == 0x20) { builder.AppendLine(" NoRandomWalk: true"); } if ((mode & 0x200) == 0x200) { builder.AppendLine(" CastSensorChase: true"); } if ((mode & 0x10) == 0x10) { builder.AppendLine(" CastSensorIdle: true"); } if ((mode & 0x800) == 0x800) { builder.AppendLine(" Angry: true"); } if ((mode & 0x400) == 0x400) { builder.AppendLine(" ChangeChase: true"); } if ((mode & 0x1000) == 0x1000) { builder.AppendLine(" ChangeTargetMelee: true"); } if ((mode & 0x2000) == 0x2000) { builder.AppendLine(" ChangeTargetChase: true"); } if ((mode & 0x4000) == 0x4000) { builder.AppendLine(" TargetWeak: true"); } if ((mode & 0x8000) == 0x8000) { builder.AppendLine(" RandomTarget: true"); } if ((mode & 0x20000) == 0x20000) { builder.AppendLine(" IgnoreMagic: true"); } if ((mode & 0x10000) == 0x10000) { builder.AppendLine(" IgnoreMelee: true"); } if ((mode & 0x100000) == 0x100000) { builder.AppendLine(" IgnoreMisc: true"); } if ((mode & 0x40000) == 0x40000) { builder.AppendLine(" IgnoreRanged: true"); } if ((mode & 0x400000) == 0x400000) { builder.AppendLine(" TeleportBlock: true"); } if ((mode & 0x1000000) == 0x1000000) { builder.AppendLine(" FixedItemDrop: true"); } if ((mode & 0x2000000) == 0x2000000) { builder.AppendLine(" Detector: true"); } if ((mode & 0x200000) == 0x200000) { builder.AppendLine(" KnockBackImmune: true"); } if ((mode & 0x4000000) == 0x4000000) { builder.AppendLine(" StatusImmune: true"); } if ((mode & 0x8000000) == 0x8000000) { builder.AppendLine(" SkillImmune: true"); } if ((mode & 0x80000) == 0x80000) { builder.AppendLine(" Mvp: true"); } } int stat = 0; for (int i = 0; i < 6; i += 2) { stat += tuple.GetIntNoThrow(ServerMobAttributes.Mvp1ID.Index + i); } if (stat != 0) { builder.AppendLine(" MvpDrops:"); for (int i = 0; i < 6; i += 2) { valueS = tuple.GetValue <string>(ServerMobAttributes.Mvp1ID.Index + i); if (stat != 0 && valueS != "0" && valueS != "") { builder.AppendLine(" - Item: " + DbIOUtils.Id2Name(itemDb, ServerItemAttributes.AegisName, valueS)); builder.AppendLine(" Rate: " + tuple.GetValue <int>(ServerMobAttributes.Mvp1ID.Index + i + 1)); if ((valueS = tuple.GetValue <string>(ServerMobAttributes.Mvp1RandomOptionGroup.Index + (i / 2))) != "") { builder.AppendLine(" RandomOptionGroup: " + valueS); } } } } stat = 0; for (int i = 0; i < 20; i += 2) { stat += tuple.GetIntNoThrow(ServerMobAttributes.Drop1ID.Index + i); } if (stat != 0) { builder.AppendLine(" Drops:"); for (int i = 0; i < 20; i += 2) { valueS = tuple.GetValue <string>(ServerMobAttributes.Drop1ID.Index + i); if (stat != 0 && valueS != "0" && valueS != "") { builder.AppendLine(" - Item: " + DbIOUtils.Id2Name(itemDb, ServerItemAttributes.AegisName, valueS)); builder.AppendLine(" Rate: " + tuple.GetValue <int>(ServerMobAttributes.Drop1ID.Index + i + 1)); if ((valueS = tuple.GetValue <string>(ServerMobAttributes.Drop1Flags.Index + (i / 2))) != "" && valueS != null) { if (FormatConverters.BooleanConverter(valueS)) { builder.AppendLine(" StealProtected: true"); } } if ((valueS = tuple.GetValue <string>(ServerMobAttributes.Drop1RandomOptionGroup.Index + (i / 2))) != "") { builder.AppendLine(" RandomOptionGroup: " + valueS); } } } } } }
public static void WriteEntry(BaseDb db, StringBuilder builder, ReadableTuple <int> tuple) { bool useConstants = db.Attached["MobDb.UseConstants"] != null && (bool)db.Attached["MobDb.UseConstants"]; builder.AppendLine("{"); builder.AppendLine("\tId: " + tuple.GetKey <int>().ToString(CultureInfo.InvariantCulture)); builder.AppendLine("\tSpriteName: \"" + tuple.GetValue <string>(ServerMobAttributes.AegisName) + "\""); builder.AppendLine("\tName: \"" + tuple.GetValue <string>(ServerMobAttributes.KRoName) + "\""); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Lv, "1"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Hp, "1"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Sp, "0"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Exp, "0"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.JExp, "0"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.AttackRange, "1"); DbIOFormatting.TrySetAttack(tuple, builder); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Def, "0"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Mdef, "0"); int stat = 0; for (int i = 0; i < 6; i++) { stat += tuple.GetIntNoThrow(ServerMobAttributes.Str.Index + i); } if (stat != 0) { builder.AppendLine(" Stats: {"); for (int i = 0; i < 6; i++) { stat = tuple.GetIntNoThrow(ServerMobAttributes.Str.Index + i); if (stat != 0) { builder.AppendLine(String.Format(" {0}: {1}", ServerMobAttributes.AttributeList[ServerMobAttributes.Str.Index + i].AttributeName, stat)); } } builder.AppendLine(" }"); } DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.ViewRange, "1"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.ChaseRange, "1"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Size, "1", useConstants, "Size_"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.Race, "0", useConstants, "RC_"); int element = tuple.GetIntNoThrow(ServerMobAttributes.Element); int level = element / 10; int property = element - level * 10; level = level / 2; if (useConstants) { builder.AppendLine("\tElement: (\"" + SdeEditor.Instance.ProjectDatabase.IntToConstant(property, "Ele_") + "\", " + level + ")"); } else { builder.AppendLine("\tElement: (" + property + ", " + level + ")"); } int mode = tuple.GetIntNoThrow(ServerMobAttributes.Mode); if ((mode & 32767) != 0) { builder.AppendLine(" Mode: {"); if ((mode & (1 << 0)) == (1 << 0)) { builder.AppendLine(" CanMove: true"); } if ((mode & (1 << 1)) == (1 << 1)) { builder.AppendLine(" Looter: true"); } if ((mode & (1 << 2)) == (1 << 2)) { builder.AppendLine(" Aggressive: true"); } if ((mode & (1 << 3)) == (1 << 3)) { builder.AppendLine(" Assist: true"); } if ((mode & (1 << 4)) == (1 << 4)) { builder.AppendLine(" CastSensorIdle: true"); } if ((mode & (1 << 5)) == (1 << 5)) { builder.AppendLine(" Boss: true"); } if ((mode & (1 << 6)) == (1 << 6)) { builder.AppendLine(" Plant: true"); } if ((mode & (1 << 7)) == (1 << 7)) { builder.AppendLine(" CanAttack: true"); } if ((mode & (1 << 8)) == (1 << 8)) { builder.AppendLine(" Detector: true"); } if ((mode & (1 << 9)) == (1 << 9)) { builder.AppendLine(" CastSensorChase: true"); } if ((mode & (1 << 10)) == (1 << 10)) { builder.AppendLine(" ChangeChase: true"); } if ((mode & (1 << 11)) == (1 << 11)) { builder.AppendLine(" Angry: true"); } if ((mode & (1 << 12)) == (1 << 12)) { builder.AppendLine(" ChangeTargetMelee: true"); } if ((mode & (1 << 13)) == (1 << 13)) { builder.AppendLine(" ChangeTargetChase: true"); } if ((mode & (1 << 14)) == (1 << 14)) { builder.AppendLine(" TargetWeak: true"); } builder.AppendLine(" }"); } DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.MoveSpeed, "0"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.AttackDelay, "4000"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.AttackMotion, "2000"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.DamageMotion, "0"); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerMobAttributes.MvpExp, "0"); stat = 0; for (int i = 0; i < 6; i += 2) { stat += tuple.GetIntNoThrow(ServerMobAttributes.Mvp1ID.Index + i); } if (stat != 0) { builder.AppendLine(" MvpDrops: {"); for (int i = 0; i < 6; i += 2) { stat = tuple.GetIntNoThrow(ServerMobAttributes.Mvp1ID.Index + i); if (stat != 0) { var ttuple = SdeDatabase.GetTuple(null, stat); if (ttuple != null) { builder.AppendLine(String.Format(" {0}: {1}", ttuple.GetStringValue(ServerItemAttributes.AegisName.Index), tuple.GetIntNoThrow(ServerMobAttributes.Mvp1ID.Index + i + 1))); } } } builder.AppendLine(" }"); } stat = 0; for (int i = 0; i < 18; i += 2) { stat += tuple.GetIntNoThrow(ServerMobAttributes.Drop1ID.Index + i); } if (stat != 0) { builder.AppendLine(" Drops: {"); for (int i = 0; i < 18; i += 2) { stat = tuple.GetIntNoThrow(ServerMobAttributes.Drop1ID.Index + i); if (stat != 0) { var ttuple = SdeDatabase.GetTuple(null, stat); if (ttuple != null) { builder.AppendLine(String.Format(" {0}: {1}", ttuple.GetStringValue(ServerItemAttributes.AegisName.Index), tuple.GetIntNoThrow(ServerMobAttributes.Drop1ID.Index + i + 1))); } } } stat = tuple.GetIntNoThrow(ServerMobAttributes.DropCardid); if (stat != 0) { var ttuple = SdeDatabase.GetTuple(null, stat); if (ttuple != null) { builder.AppendLine(String.Format(" {0}: {1}", ttuple.GetStringValue(ServerItemAttributes.AegisName.Index), tuple.GetIntNoThrow(ServerMobAttributes.DropCardper.Index))); } } builder.AppendLine(" }"); } builder.Append("},"); }
public GroupCommand <TKey, ReadableTuple <TKey> > Generate <TKey>(ReadableTuple <TKey> item, ReadableTuple <int> tupleSource, AbstractDb <int> mobDb1, AbstractDb <int> mobDb2, AbstractDb <int> pet1, AbstractDb <int> pet2) { var description = item.GetValue <ParameterHolder>(ClientItemAttributes.Parameters).Values[ParameterHolderKeys.Description] ?? ""; description = ParameterHolder.ClearDescription(description); ParameterHolder holder = new ParameterHolder(); GroupCommand <TKey, ReadableTuple <TKey> > commands = GroupCommand <TKey, ReadableTuple <TKey> > .Make(); int numSlotC = _getInt(ClientItemAttributes.NumberOfSlots, item); int numSlotS = _getInt(ServerItemAttributes.NumberOfSlots, tupleSource); if (ProjectConfiguration.AutocompleteViewId) { int viewIdC = _getInt(ClientItemAttributes.ClassNumber, item); int viewIdS = _getInt(ServerItemAttributes.ClassNumber, tupleSource); if (viewIdC != viewIdS) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.ClassNumber, viewIdS)); } } if (ProjectConfiguration.AutocompleteNumberOfSlot) { if (numSlotC != numSlotS) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.NumberOfSlots, numSlotS)); } } if ((TypeType)tupleSource.GetValue <int>(ServerItemAttributes.Type) != TypeType.Card) { if (item.GetValue <bool>(ClientItemAttributes.IsCard)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.IsCard, false)); } } string idDisplayName = tupleSource.GetValue <string>(ServerItemAttributes.Name); if (_emptyFill(ClientItemAttributes.IdentifiedDisplayName, item) && ProjectConfiguration.AutocompleteIdDisplayName && _isNotNullDifferent(idDisplayName, ClientItemAttributes.IdentifiedDisplayName, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.IdentifiedDisplayName, idDisplayName)); } DbAttribute attribute; TypeType itemType = (TypeType)tupleSource.GetValue <int>(ServerItemAttributes.Type); if (itemType == TypeType.Weapon || itemType == TypeType.Armor) { if (itemType == TypeType.Armor && !ItemParser.IsArmorType(tupleSource)) { if (itemType == TypeType.Armor) { itemType = TypeType.Weapon; } else { itemType = TypeType.Armor; } } } // Weight: //holder = item.GetValue<ParameterHolder>(ClientItemAttributes.Parameters); // //switch (itemType) { // case TypeType.Weapon: // case TypeType.Ammo: // case TypeType.Armor: // case TypeType.Card: // case TypeType.PetEgg: // case TypeType.PetEquip: // case TypeType.UsableItem: // case TypeType.EtcItem: // case TypeType.HealingItem: // case TypeType.ShadowEquip: // case TypeType.UsableWithDelayed: // case TypeType.UsableWithDelayed2: // _autoAddWeight(tupleSource, holder); // break; //} DbAttribute equipLevelAttribute = ServerItemAttributes.EquipLevel; if (tupleSource.GetIntNoThrow(ServerItemAttributes.EquipLevelMin) > tupleSource.GetIntNoThrow(ServerItemAttributes.EquipLevel)) { equipLevelAttribute = ServerItemAttributes.EquipLevelMin; } switch (itemType) { case TypeType.Weapon: string type = _findWeaponType(tupleSource) ?? "Weapon"; holder.Values[ParameterHolderKeys.Class] = type; string unidentifiedResourceName = EncodingService.FromAnyToDisplayEncoding(_findWeaponUnidentifiedResource(tupleSource) ?? ""); attribute = ClientItemAttributes.UnidentifiedResourceName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } string identifiedResourceName = item.GetStringValue(ClientItemAttributes.IdentifiedResourceName.Index); attribute = ClientItemAttributes.IdentifiedResourceName; if (String.IsNullOrEmpty(identifiedResourceName) && ProjectConfiguration.AutocompleteIdResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } attribute = ClientItemAttributes.UnidentifiedDisplayName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnDisplayName && _isNotNullDifferent(type, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, type)); } if (!tupleSource.GetValue <bool>(ServerItemAttributes.Refineable)) { if (!description.Contains("Impossible to refine") && !description.Contains("Cannot be upgraded") && !description.ToLower().Contains("rental item")) { description += "\r\nImpossible to refine this item."; } } if (tupleSource.GetValue <bool>(ServerItemAttributes.Refineable)) { if (description.Contains("Impossible to refine")) { description = description.Replace("Impossible to refine this item.", "").Trim('\r', '\n'); } } _autoAdd(ServerItemAttributes.Attack, ParameterHolderKeys.Attack, tupleSource, holder); _autoAddWeight(tupleSource, holder); _autoAdd(ServerItemAttributes.WeaponLevel, ParameterHolderKeys.WeaponLevel, tupleSource, holder); _autoAddJob(tupleSource, holder, _getInt(equipLevelAttribute, tupleSource)); _autoAddElement(tupleSource, holder); break; case TypeType.Ammo: type = _findAmmoType(tupleSource.GetStringValue(ServerItemAttributes.ApplicableJob.Index)) ?? "Ammunition"; holder.Values[ParameterHolderKeys.Class] = type; _autoAdd(ServerItemAttributes.Attack, ParameterHolderKeys.Attack, tupleSource, holder, -1); _autoAddWeight(tupleSource, holder); _autoAddElement(tupleSource, holder); break; case TypeType.Armor: int location = _getInt(ServerItemAttributes.Location, tupleSource); type = _findArmorType(location) ?? "Armor"; holder.Values[ParameterHolderKeys.Class] = type; unidentifiedResourceName = EncodingService.FromAnyToDisplayEncoding(_findArmorUnidentifiedResource(tupleSource, item) ?? ""); attribute = ClientItemAttributes.UnidentifiedResourceName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } else { unidentifiedResourceName = item.GetValue <string>(ClientItemAttributes.UnidentifiedResourceName); } identifiedResourceName = item.GetStringValue(ClientItemAttributes.IdentifiedResourceName.Index); attribute = ClientItemAttributes.IdentifiedResourceName; if (String.IsNullOrEmpty(identifiedResourceName) && ProjectConfiguration.AutocompleteIdResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } string unDisplayName = _findArmorUnidentifiedDisplayName(unidentifiedResourceName); attribute = ClientItemAttributes.UnidentifiedDisplayName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnDisplayName && _isNotNullDifferent(unDisplayName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unDisplayName)); } if ((_getInt(ServerItemAttributes.Location, tupleSource) & 374) != 0) { if (!tupleSource.GetValue <bool>(ServerItemAttributes.Refineable)) { if (!description.Contains("Impossible to refine")) { description += "\r\nImpossible to refine this item."; } } if (tupleSource.GetValue <bool>(ServerItemAttributes.Refineable)) { if (description.Contains("Impossible to refine")) { description = description.Replace("Impossible to refine this item.", "").Trim('\r', '\n'); } } } _autoAdd(ServerItemAttributes.Defense, ParameterHolderKeys.Defense, tupleSource, holder); _autoAddEquippedOn(ServerItemAttributes.Location, ParameterHolderKeys.Location, tupleSource, holder); _autoAddWeight(tupleSource, holder); _autoAddJob(tupleSource, holder, _getInt(equipLevelAttribute, tupleSource)); break; case TypeType.Card: holder.Values[ParameterHolderKeys.Class] = "Card"; _autoAddCompound(ServerItemAttributes.Location, ParameterHolderKeys.CompoundOn, tupleSource, holder); _autoAdd(equipLevelAttribute, ParameterHolderKeys.RequiredLevel, tupleSource, holder, 1); _autoAddWeight(tupleSource, holder); if (!item.GetValue <bool>(ClientItemAttributes.IsCard)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.IsCard, true)); } if (String.IsNullOrEmpty(item.GetValue <string>(ClientItemAttributes.Illustration))) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.Illustration, "sorry")); } if (String.IsNullOrEmpty(item.GetValue <string>(ClientItemAttributes.Affix))) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.Affix, tupleSource.GetValue <string>(ServerItemAttributes.Name))); } const string CardResource = "À̸§¾ø´ÂÄ«µå"; unDisplayName = tupleSource.GetValue <string>(ServerItemAttributes.Name); attribute = ClientItemAttributes.UnidentifiedDisplayName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnDisplayName && _isNotNullDifferent(unDisplayName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unDisplayName)); } unidentifiedResourceName = EncodingService.FromAnyToDisplayEncoding(CardResource); attribute = ClientItemAttributes.UnidentifiedResourceName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } attribute = ClientItemAttributes.IdentifiedResourceName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteIdResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } break; case TypeType.PetEgg: holder.Values[ParameterHolderKeys.Class] = "Monster Egg"; _autoAddWeight(tupleSource, holder); break; case TypeType.PetEquip: holder.Values[ParameterHolderKeys.Class] = "Cute Pet Armor"; _autoAddWeight(tupleSource, holder); int id = item.GetKey <int>(); List <ReadableTuple <int> > tuples = pet1.Table.Tuples.Where(p => p.Value.GetValue <int>(ServerPetAttributes.EquipId) == id).Select(p => p.Value).Concat( pet2.Table.Tuples.Where(p => p.Value.GetValue <int>(ServerPetAttributes.EquipId) == id).Select(p => p.Value) ).ToList(); if (tuples.Count > 0) { // Try to retrieve the names List <string> values = new List <string>(); foreach (ReadableTuple <int> tuple in tuples) { var pid = tuple.GetKey <int>(); var pTuple = mobDb2.Table.TryGetTuple(pid) ?? mobDb1.Table.TryGetTuple(pid); if (pTuple != null) { values.Add(pTuple.GetValue <string>(ServerMobAttributes.KRoName)); } } if (values.Count > 0) { holder.Values[ParameterHolderKeys.ApplicablePet] = String.Join(", ", values.ToArray()); } } break; case TypeType.UsableItem: _autoAddPet(tupleSource, holder); _autoAddWeight(tupleSource, holder); _autoAddJobIfRestricted(tupleSource, holder); break; case TypeType.EtcItem: case TypeType.HealingItem: case TypeType.ShadowEquip: case TypeType.UsableWithDelayed: case TypeType.UsableWithDelayed2: _autoAddWeight(tupleSource, holder); _autoAddJobIfRestricted(tupleSource, holder); break; } _autoAdd(equipLevelAttribute, ParameterHolderKeys.RequiredLevel, tupleSource, holder, 1); holder.Values[ParameterHolderKeys.Description] = description == "" ? ProjectConfiguration.AutocompleteDescNotSet : description; var idDescription = holder.GenerateDescription(); if (ProjectConfiguration.AutocompleteIdDescription) { if (idDescription != item.GetValue <string>(ClientItemAttributes.IdentifiedDescription)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.IdentifiedDescription, idDescription)); } } var unDescription = item.GetValue <string>(ClientItemAttributes.UnidentifiedDescription); // unidentified switch (tupleSource.GetValue <TypeType>(ServerItemAttributes.Type)) { case TypeType.Ammo: case TypeType.EtcItem: case TypeType.HealingItem: case TypeType.PetEgg: case TypeType.UsableItem: case TypeType.UsableWithDelayed: case TypeType.UsableWithDelayed2: if (ProjectConfiguration.AutocompleteUnDescription && unDescription != idDescription) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.UnidentifiedDescription, idDescription)); } string unDisplayName = tupleSource.GetValue <string>(ServerItemAttributes.Name); attribute = ClientItemAttributes.UnidentifiedDisplayName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnDisplayName && _isNotNullDifferent(unDisplayName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unDisplayName)); } string unidentifiedResourceName = item.GetValue <string>(ClientItemAttributes.IdentifiedResourceName); if (String.IsNullOrEmpty(unidentifiedResourceName)) { unidentifiedResourceName = EncodingService.FromAnyToDisplayEncoding("Á¶°¢ÄÉÀÌÅ©"); // Cake } attribute = ClientItemAttributes.UnidentifiedResourceName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteUnResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } attribute = ClientItemAttributes.IdentifiedResourceName; if (_emptyFill(attribute, item) && ProjectConfiguration.AutocompleteIdResourceName && _isNotNullDifferent(unidentifiedResourceName, attribute, item)) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, attribute, unidentifiedResourceName)); } break; case TypeType.Card: if (ProjectConfiguration.AutocompleteUnDescription && unDescription != idDescription) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.UnidentifiedDescription, idDescription)); } break; default: if (ProjectConfiguration.AutocompleteUnDescription && unDescription != ProjectConfiguration.AutocompleteUnDescriptionFormat) { commands.Add(new ChangeTupleProperty <TKey, ReadableTuple <TKey> >(item, ClientItemAttributes.UnidentifiedDescription, ProjectConfiguration.AutocompleteUnDescriptionFormat)); } break; } if (commands.Commands.Count == 0) { return(null); } return(commands); }
public static void WriteEntry(BaseDb db, StringBuilder builder, ReadableTuple <int> tuple) { bool useExtendedJobs = db.Attached["ItemDb.UseExtendedJobs"] != null && (bool)db.Attached["ItemDb.UseExtendedJobs"]; builder.AppendLine("{"); builder.AppendLine("\tId: " + tuple.GetKey <int>().ToString(CultureInfo.InvariantCulture)); builder.AppendLine("\tAegisName: \"" + tuple.GetValue <string>(ServerItemAttributes.AegisName) + "\""); builder.AppendLine("\tName: \"" + tuple.GetValue <string>(ServerItemAttributes.Name) + "\""); DbIOFormatting.SetType(tuple, builder, ServerItemAttributes.Type); DbIOFormatting.TrySetIfNotDefault(tuple, builder, ServerItemAttributes.Buy, ""); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Sell, (tuple.GetIntNoThrow(ServerItemAttributes.Buy) / 2).ToString(CultureInfo.InvariantCulture)); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Weight, "0"); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Attack, "0"); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Matk, "0"); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Defense, "0"); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Range, "0"); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.NumberOfSlots, "0"); if (useExtendedJobs) { DbIOFormatting.TrySetIfDefaultEmptyAddHexJobEx(tuple, builder, ServerItemAttributes.ApplicableJob, ""); } else { DbIOFormatting.TrySetIfDefaultEmptyAddHex(tuple, builder, ServerItemAttributes.ApplicableJob, ""); } DbIOFormatting.TrySetIfDefaultEmptyUpper(tuple, builder, ServerItemAttributes.Upper); DbIOFormatting.TrySetGender(tuple, builder, ServerItemAttributes.Gender, "2"); DbIOFormatting.TrySetIfDefaultLocation(tuple, builder, ServerItemAttributes.Location); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.WeaponLevel, "0"); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.EquipLevel, "0"); DbIOFormatting.TrySetIfRefineable(tuple, builder, ServerItemAttributes.Refineable, true); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.ClassNumber, "0"); DbIOFormatting.TrySetIfDefaultBoolean(tuple, builder, ServerItemAttributes.BindOnEquip, false); DbIOFormatting.TrySetIfDefaultBoolean(tuple, builder, ServerItemAttributes.ForceSerial, false); DbIOFormatting.TrySetIfDefaultBoolean(tuple, builder, ServerItemAttributes.BuyingStore, false); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Delay, "0"); DbIOFormatting.TrySetIfDefaultBoolean(tuple, builder, ServerItemAttributes.KeepAfterUse, false); var tradeOverride = tuple.GetIntNoThrow(ServerItemAttributes.TradeOverride); var tradeFlag = tuple.GetIntNoThrow(ServerItemAttributes.TradeFlag); if (tradeOverride != 100 || tradeFlag != 0) { builder.AppendLine(" Trade: {"); if (tradeOverride != 100) { builder.AppendLine(" override: "+ tradeOverride); } if ((tradeFlag & (1 << 0)) == (1 << 0)) { builder.AppendLine(" nodrop: true"); } if ((tradeFlag & (1 << 1)) == (1 << 1)) { builder.AppendLine(" notrade: true"); } if ((tradeFlag & (1 << 2)) == (1 << 2)) { builder.AppendLine(" partneroverride: true"); } if ((tradeFlag & (1 << 3)) == (1 << 3)) { builder.AppendLine(" noselltonpc: true"); } if ((tradeFlag & (1 << 4)) == (1 << 4)) { builder.AppendLine(" nocart: true"); } if ((tradeFlag & (1 << 5)) == (1 << 5)) { builder.AppendLine(" nostorage: true"); } if ((tradeFlag & (1 << 6)) == (1 << 6)) { builder.AppendLine(" nogstorage: true"); } if ((tradeFlag & (1 << 7)) == (1 << 7)) { builder.AppendLine(" nomail: true"); } if ((tradeFlag & (1 << 8)) == (1 << 8)) { builder.AppendLine(" noauction: true"); } builder.AppendLine(" }"); } var nouseOverride = tuple.GetIntNoThrow(ServerItemAttributes.NoUseOverride); var nouseFlag = tuple.GetIntNoThrow(ServerItemAttributes.NoUseFlag); if (nouseOverride != 100 || nouseFlag != 0) { builder.AppendLine(" Nouse: {"); if (nouseOverride != 100) { builder.AppendLine(" override: "+ nouseOverride); } if ((nouseFlag & (1 << 0)) == (1 << 0)) { builder.AppendLine(" sitting: true"); } builder.AppendLine(" }"); } DbIOFormatting.TrySetIfDefaultEmptyBracket(tuple, builder, ServerItemAttributes.Stack, ""); DbIOFormatting.TrySetIfDefaultEmpty(tuple, builder, ServerItemAttributes.Sprite, "0"); DbIOFormatting.TrySetIfDefaultEmptyScript(tuple, builder, ServerItemAttributes.Script, ""); DbIOFormatting.TrySetIfDefaultEmptyScript(tuple, builder, ServerItemAttributes.OnEquipScript, ""); DbIOFormatting.TrySetIfDefaultEmptyScript(tuple, builder, ServerItemAttributes.OnUnequipScript, ""); builder.Append("},"); }
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); } }
public List <string> TestItem(ReadableTuple <int> tuple, MultiGrfReader grf, Type compare = null) { var result = new List <string>(); _metaGrf = grf; _lastTuple = tuple; foreach (var preview in _previews) { if (preview.CanRead(tuple) && !(preview is NullPreview) && (compare == null || preview.GetType() == compare)) { string jobt = tuple.GetValue <string>(ServerItemAttributes.ApplicableJob); var jobs = JobList.GetJobsFromHex("0x" + ((jobt == "") ? "FFFFFFFF" : jobt), tuple.GetIntNoThrow(ServerItemAttributes.Upper)); preview.Read(tuple, this, jobs); _jobs.Clear(); _jobs.AddRange(jobs); if (PreviewSprite == SpriteNone) { return(result); } var gender = _lastTuple.GetValue <GenderType>(ServerItemAttributes.Gender); foreach (var job in jobs) { _listView.SelectedItem = job; if (_listView.SelectedItem == null) { continue; } if (gender == GenderType.Undefined) { gender = GenderType.Both; } if (gender == GenderType.Both || gender == GenderType.Female) { _overrideGender = GenderType.Female; var act = preview.GetSpriteFromJob(tuple, this); var spr = act.ReplaceExtension(".spr"); result.Add(act); result.Add(spr); } if (gender == GenderType.Both || gender == GenderType.Male) { _overrideGender = GenderType.Male; var act = preview.GetSpriteFromJob(tuple, this); var spr = act.ReplaceExtension(".spr"); result.Add(act); result.Add(spr); } _overrideGender = null; } break; } } return(result); }
public bool CanRead(ReadableTuple <int> tuple) { return(ItemParser.IsArmorType(tuple) && tuple.GetIntNoThrow(ServerItemAttributes.Location) == 32); }