Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bugs for function of developing equipments including concentrated development #252

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -56,7 +56,8 @@ public CreatedSlotItemViewModel()
public void Update(CreatedSlotItem item)
{
this.Succeed = item.Succeed;
this.Name = item.SlotItemInfo.Name;
this.Name = !item.Succeed ? "-----"
: string.Join(Environment.NewLine, item.SlotItemInfos.Select(x => x.Name).ToArray());
}
}
}
9 changes: 6 additions & 3 deletions source/Grabacr07.KanColleWrapper/Itemyard.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
Expand Down Expand Up @@ -132,9 +132,12 @@ internal void RemoveFromRemodel(kcsapi_remodel_slot source)

private void CreateItem(kcsapi_createitem source)
{
if (source.api_create_flag == 1 && source.api_slot_item != null)
if (source.api_create_flag == 1 && source.api_get_items != null)
{
this.SlotItems.Add(new SlotItem(source.api_slot_item));
foreach (var x in source.api_get_items)
{
if (x.api_slotitem_id != -1) this.SlotItems.Add(new SlotItem(x));
}
}
this.RaiseSlotItemsChanged();
}
Expand Down
15 changes: 9 additions & 6 deletions source/Grabacr07.KanColleWrapper/Models/CreatedSlotItem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -13,18 +13,21 @@ public class CreatedSlotItem : RawDataWrapper<kcsapi_createitem>
{
public bool Succeed => this.RawData.api_create_flag == 1;

public SlotItemInfo SlotItemInfo { get; }
public List<SlotItemInfo> SlotItemInfos { get; }

public CreatedSlotItem(kcsapi_createitem rawData)
: base(rawData)
{
try
{
this.SlotItemInfo = this.Succeed
? KanColleClient.Current.Master.SlotItems[rawData.api_slot_item.api_slotitem_id]
: KanColleClient.Current.Master.SlotItems[int.Parse(rawData.api_fdata.Split(',')[1])];
this.SlotItemInfos = this.Succeed
? new List<SlotItemInfo>(
rawData.api_get_items
.Where(x => x.api_slotitem_id != -1)
.Select(x => KanColleClient.Current.Master.SlotItems[x.api_slotitem_id]))
: null;

System.Diagnostics.Debug.WriteLine("createitem: {0} - {1}", this.Succeed, this.SlotItemInfo.Name);
//System.Diagnostics.Debug.WriteLine("createitem: {0} - {1}", this.Succeed, this.SlotItemInfos.Name);
}
catch (Exception ex)
{
Expand Down
20 changes: 12 additions & 8 deletions source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_createitem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -9,15 +9,19 @@ namespace Grabacr07.KanColleWrapper.Models.Raw
// ReSharper disable InconsistentNaming
public class kcsapi_createitem
{
public int api_id { get; set; }
public int api_slotitem_id { get; set; }
public int api_create_flag { get; set; }
public int api_shizai_flag { get; set; }
public kcsapi_slotitem api_slot_item { get; set; }
public kcsapi_slotitem[] api_get_items { get; set; }
public int[] api_material { get; set; }
public kcsapi_createitem_unset_items[] kcsapi_unset_items { get; set; }
//public int api_id { get; set; }
//public int api_slotitem_id { get; set; }
//public int api_shizai_flag { get; set; }
//public string api_fdata { get; set; }
}
public class kcsapi_createitem_unset_items
{
public int api_type3 { get; set; }
public int[] api_unsetslot { get; set; }
public string api_fdata { get; set; }
public int api_slot_list { get; set; }
}
// ReSharper restore InconsistentNaming
}
}