아이템 오탈자 수정및 기타 아이탬 추가
This commit is contained in:
parent
44f1327bd2
commit
636c070d2b
|
|
@ -46,7 +46,7 @@ namespace Server.Manager
|
|||
{
|
||||
DeckUnitInfo deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = rewardData.return_item;
|
||||
deckUnitInfo.unit_data_id = rewardData.return_item;
|
||||
box.Add(deckUnitInfo);
|
||||
}
|
||||
break;
|
||||
|
|
@ -70,8 +70,11 @@ namespace Server.Manager
|
|||
box.Add(consumableItem);
|
||||
break;
|
||||
case eRewardItemType.etc:
|
||||
//기타아이탬 만들고 넣기
|
||||
logger.Info("아직 개발중인 시스템");
|
||||
EtcItem etcItem = new EtcItem();
|
||||
etcItem.user_id = user.id;
|
||||
etcItem.etc_item_data_id = rewardData.return_item;
|
||||
etcItem.count = rewardData.return_count;
|
||||
box.Add(etcItem);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Not case", Error.nodata);
|
||||
|
|
@ -102,6 +105,10 @@ namespace Server.Manager
|
|||
public List<ConsumableItem> consumableItem { get { return _consumableItem; } }
|
||||
public List<ConsumableItem> addConsumableItem;
|
||||
|
||||
//기타
|
||||
List<EtcItem> _etcItem;
|
||||
public List<EtcItem> etcItem { get { return _etcItem; } }
|
||||
public List<EtcItem> addEtcItem;
|
||||
public ItemBox(User user)
|
||||
{
|
||||
_deckUnitInfo = Statics.deckUnitInfoSQL.SelectUid(user.id);
|
||||
|
|
@ -128,7 +135,7 @@ namespace Server.Manager
|
|||
|
||||
public bool Add(DeckUnitInfo item)
|
||||
{
|
||||
if(_deckUnitInfo.FindIndex(n => n.unit_id == item.unit_id) != -1)
|
||||
if(_deckUnitInfo.FindIndex(n => n.unit_data_id == item.unit_data_id) != -1)
|
||||
return false;
|
||||
_deckUnitInfo.Add(item);
|
||||
addDeckUnitInfo.Add(item);
|
||||
|
|
@ -139,7 +146,7 @@ namespace Server.Manager
|
|||
{
|
||||
foreach(var item in items)
|
||||
{
|
||||
if (_deckUnitInfo.FindIndex(n => n.unit_id == item.unit_id) != -1)
|
||||
if (_deckUnitInfo.FindIndex(n => n.unit_data_id == item.unit_data_id) != -1)
|
||||
return false;
|
||||
}
|
||||
_deckUnitInfo.AddRange(items);
|
||||
|
|
@ -209,6 +216,55 @@ namespace Server.Manager
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Add(EtcItem item)
|
||||
{
|
||||
int index = _etcItem.FindIndex(n => n.etc_item_data_id == item.etc_item_data_id);
|
||||
int addIndex = addEtcItem.FindIndex(n => n.etc_item_data_id == item.etc_item_data_id);
|
||||
if (index == -1)
|
||||
{
|
||||
_etcItem.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
_etcItem[index].count += item.count;
|
||||
}
|
||||
if (addIndex == -1)
|
||||
{
|
||||
addEtcItem.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
addEtcItem[index].count += item.count;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Add(List<EtcItem> items)
|
||||
{
|
||||
foreach (EtcItem item in items)
|
||||
{
|
||||
int index = _etcItem.FindIndex(n => n.etc_item_data_id == item.etc_item_data_id);
|
||||
int addIndex = addEtcItem.FindIndex(n => n.etc_item_data_id == item.etc_item_data_id);
|
||||
if (index == -1)
|
||||
{
|
||||
_etcItem.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
_etcItem[index].count += item.count;
|
||||
}
|
||||
if (addIndex == -1)
|
||||
{
|
||||
addEtcItem.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
addEtcItem[index].count += item.count;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.SQL
|
|||
public class DeckUnitInfo
|
||||
{
|
||||
public long id { get; set; }
|
||||
public long unit_id { get; set; }//네이밍 변경할것 unit_id > unit_data_id
|
||||
public long unit_data_id { get; set; }
|
||||
[JsonIgnore]
|
||||
public long user_id { get; set; }
|
||||
public long equip0_id { get; set; }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Server.SQL
|
||||
{
|
||||
[Table("etc_item", Schema = "gamedb")]
|
||||
public class EtcItem
|
||||
{
|
||||
public long id { get; set; }
|
||||
[JsonIgnore]
|
||||
public long user_id { get; set; }
|
||||
public long etc_item_data_id { get; set; }
|
||||
|
||||
public int count { get; set; }
|
||||
}
|
||||
|
||||
public class EtcItemSQL : SQL<EtcItem>
|
||||
{
|
||||
public override DbSet<EtcItem> table { get; set; }
|
||||
|
||||
public void Update(EtcItem etcItem)
|
||||
{
|
||||
table.Update(etcItem);
|
||||
}
|
||||
|
||||
public override List<EtcItem> SelectUid(long user_id)
|
||||
{
|
||||
return table.Where(data => data.user_id == user_id).ToList();
|
||||
}
|
||||
|
||||
public EtcItem SelectItem(long user_id, long etc_item_id)
|
||||
{
|
||||
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == etc_item_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -59,39 +59,39 @@ namespace Server.Service
|
|||
DeckUnitInfo deckUnitInfo;
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100001;
|
||||
deckUnitInfo.unit_data_id = 100001;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100002;
|
||||
deckUnitInfo.unit_data_id = 100002;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100003;
|
||||
deckUnitInfo.unit_data_id = 100003;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100004;
|
||||
deckUnitInfo.unit_data_id = 100004;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100005;
|
||||
deckUnitInfo.unit_data_id = 100005;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100006;
|
||||
deckUnitInfo.unit_data_id = 100006;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100007;
|
||||
deckUnitInfo.unit_data_id = 100007;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100008;
|
||||
deckUnitInfo.unit_data_id = 100008;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
deckUnitInfo = new DeckUnitInfo();
|
||||
deckUnitInfo.user_id = user.id;
|
||||
deckUnitInfo.unit_id = 100009;
|
||||
deckUnitInfo.unit_data_id = 100009;
|
||||
deckUnitInfoList.Add(deckUnitInfo);
|
||||
Statics.deckUnitInfoSQL.Insert(deckUnitInfoList);
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Reference in New Issue