Skip to content

Commit

Permalink
[Update/Fix] Canary 'imbue' update and wiki fix
Browse files Browse the repository at this point in the history
- Removed some parts of the 'wiki' sync feature.

- Add new Canary 'prey system' tags and tab on layout.
  • Loading branch information
marcosvf132 committed Dec 17, 2021
1 parent 7fa8a76 commit 0b2474d
Show file tree
Hide file tree
Showing 4 changed files with 504 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Devm items editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</PackageReference>
<PackageReference Include="Google.Protobuf" Version="3.15.3" />
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.1.9" />
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

Expand Down
95 changes: 73 additions & 22 deletions Loader.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,29 @@ public WikiObject()
#endregion
}

private void ParseLootTypeToTransformations(Item source, int transformTo)
{
Item item = _parent.GetItemByID(transformTo);
if (source == null || item == null) {
return;
}

for (int itemId = item.FromID; itemId <= item.ToID; itemId++) {
Item itemIt = _parent.GetItemByID(itemId);
if (itemIt != null && (string.IsNullOrEmpty(itemIt.LootType) || itemIt.FromID == source.FromID)) {
itemIt.LootType = source.LootType;

if (itemIt.EquipTo != int.MinValue) {
ParseLootTypeToTransformations(source, itemIt.EquipTo);
}

if (itemIt.DequipTo != int.MinValue) {
ParseLootTypeToTransformations(source, itemIt.DequipTo);
}
}
}
}

#endregion

#region Async wiki worker
Expand Down Expand Up @@ -419,22 +442,22 @@ private void WikiLoaderWorkerAction(object sender, DoWorkEventArgs e)
continue;
}

if (wikiObject.Article != null && wikiObject.Article.Length > 0) {
item.Article = wikiObject.Article;
}
//if (wikiObject.Article != null && wikiObject.Article.Length > 0) {
// item.Article = wikiObject.Article;
//}

// Empty plural are '?' char.
if (wikiObject.Plural != null && wikiObject.Plural.Length > 1) {
item.Plural = wikiObject.Plural;
}
//if (wikiObject.Plural != null && wikiObject.Plural.Length > 1) {
// item.Plural = wikiObject.Plural;
//}

if (wikiObject.FlavorText != null && wikiObject.FlavorText.Length > 0) {
item.Description = wikiObject.FlavorText;
}
//if (wikiObject.FlavorText != null && wikiObject.FlavorText.Length > 0) {
// item.Description = wikiObject.FlavorText;
//}

if (wikiObject.Words != null && wikiObject.Words.Length > 0) {
item.RuneSpellName = wikiObject.Words;
}
//if (wikiObject.Words != null && wikiObject.Words.Length > 0) {
// item.RuneSpellName = wikiObject.Words;
//}

item.ContainerSize = _parent.ParseStringToFinalInt(wikiObject.Volume, item.ContainerSize);
item.Attack = _parent.ParseStringToFinalInt(wikiObject.Attack, item.Attack);
Expand All @@ -459,7 +482,7 @@ private void WikiLoaderWorkerAction(object sender, DoWorkEventArgs e)
if (wikiObject.Weight != null) {
item.Weight = (int)(double.Parse(wikiObject.Weight, InvariantCulture) * 100);
}
item.Duration = _parent.ParseStringToFinalInt(wikiObject.Duration, item.Duration);
//item.Duration = _parent.ParseStringToFinalInt(wikiObject.Duration, item.Duration);
success++;

if (item.Tag.Length == 0) {
Expand Down Expand Up @@ -576,20 +599,21 @@ private void AssetsLoaderWorkerAction(object sender, DoWorkEventArgs e)
}

if (itemObject.Flags != null) {
if (itemObject.Flags.Market != null) {
string lootType = _parent.ParseProtobufItemCategoryToLootType(itemObject.Flags.Market.Category);
if (lootType.ToLower() != item.LootType.ToLower()) {
item.LootType = lootType;
isChanged = true;
}
}
//if (itemObject.Flags.Market != null) {
// string lootType = _parent.ParseProtobufItemCategoryToLootType(itemObject.Flags.Market.Category);
// if (lootType.ToLower() != item.LootType.ToLower()) {
// item.LootType = lootType;
// ParseLootTypeToTransformations(item, item.FromID);
// isChanged = true;
// }
//}

if (itemObject.Flags.ShowOffSocket) {
item.IsPodium = true;
}

if (itemObject.Flags.Upgradeclassification != null) {
item.UpgradeClassification = (int)(itemObject.Flags.Upgradeclassification.UpgradeClassification);
item.UpgradeClassification = (int)itemObject.Flags.Upgradeclassification.UpgradeClassification;
}

}
Expand All @@ -606,7 +630,6 @@ private void AssetsLoaderWorkerAction(object sender, DoWorkEventArgs e)
}
}

_asyncItems = _asyncItems.Distinct().ToList();
} catch (Exception ex) {
_parent.AppendLog("[PROTOBUFF ERROR]:");
_parent.AppendLog(ex.Message);
Expand All @@ -628,6 +651,34 @@ private void AssetsLoaderWorkerCompleted(object sender, RunWorkerCompletedEventA
{
if (_asyncItems.Count > 0) {
foreach (Item item in _asyncItems) {
Item threadItem = _parent.GetItemByID(item.FromID);
if (threadItem != null) {
if (!string.IsNullOrEmpty(item.Name)) {
threadItem.Name = item.Name;
}

if (!string.IsNullOrEmpty(item.Description)) {
threadItem.Description = item.Description;
}

threadItem.ToID = item.ToID;
continue;
}

threadItem = _parent.GetItemByID(item.ToID);
if (threadItem != null) {
if (!string.IsNullOrEmpty(item.Name)) {
threadItem.Name = item.Name;
}

if (!string.IsNullOrEmpty(item.Description)) {
threadItem.Description = item.Description;
}

threadItem.FromID = item.FromID;
continue;
}

_parent.ItemsList.Items.Add(item);
}
}
Expand Down
Loading

0 comments on commit 0b2474d

Please sign in to comment.