아이템 저리 형식 변경 및 유닛 데이터 처리 방식 변경
This commit is contained in:
parent
a8913ff036
commit
565429f47a
|
|
@ -37,7 +37,8 @@ namespace Server.Manager
|
||||||
deckUnitInfo.user_id = user.id;
|
deckUnitInfo.user_id = user.id;
|
||||||
deckUnitInfo.unit_data_id = rewardData.return_item;
|
deckUnitInfo.unit_data_id = rewardData.return_item;
|
||||||
deckUnitInfo.count = rewardData.return_count;
|
deckUnitInfo.count = rewardData.return_count;
|
||||||
box.Add(deckUnitInfo);
|
if (!box.Add(deckUnitInfo))
|
||||||
|
throw new RuntimeException("add new unit [box.Add(deckUnitInfo)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.equipment:
|
case eRewardItemType.equipment:
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
@ -48,7 +49,8 @@ namespace Server.Manager
|
||||||
equipment.equip_unit = 0;
|
equipment.equip_unit = 0;
|
||||||
equipment.rand_stats = rand.Next(5);
|
equipment.rand_stats = rand.Next(5);
|
||||||
equipment.equipment_data_id = rewardData.return_item;
|
equipment.equipment_data_id = rewardData.return_item;
|
||||||
box.Add(equipment);
|
if(!box.Add(equipment))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(equipment)]", Error.RuntimeException);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.consumable:
|
case eRewardItemType.consumable:
|
||||||
|
|
@ -61,7 +63,8 @@ namespace Server.Manager
|
||||||
consumableItem.user_id = user.id;
|
consumableItem.user_id = user.id;
|
||||||
consumableItem.consumable_item_data_id = rewardData.return_item;
|
consumableItem.consumable_item_data_id = rewardData.return_item;
|
||||||
consumableItem.count = rewardData.return_count;
|
consumableItem.count = rewardData.return_count;
|
||||||
box.Add(consumableItem);
|
if(!box.Add(consumableItem))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(consumableItem)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
case eItemType.random:
|
case eItemType.random:
|
||||||
randomItem(consumableItemData.reward, rewardData.return_count);
|
randomItem(consumableItemData.reward, rewardData.return_count);
|
||||||
|
|
@ -74,7 +77,8 @@ namespace Server.Manager
|
||||||
etcItem.user_id = user.id;
|
etcItem.user_id = user.id;
|
||||||
etcItem.etc_item_data_id = rewardData.return_item;
|
etcItem.etc_item_data_id = rewardData.return_item;
|
||||||
etcItem.count = rewardData.return_count;
|
etcItem.count = rewardData.return_count;
|
||||||
box.Add(etcItem);
|
if (!box.Add(etcItem))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(etcItem)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Not case", Error.nodata);
|
throw new RuntimeException("Not case", Error.nodata);
|
||||||
|
|
@ -87,7 +91,8 @@ namespace Server.Manager
|
||||||
deckUnitInfo.user_id = user.id;
|
deckUnitInfo.user_id = user.id;
|
||||||
deckUnitInfo.count = 1;
|
deckUnitInfo.count = 1;
|
||||||
deckUnitInfo.unit_data_id = unitDataId;
|
deckUnitInfo.unit_data_id = unitDataId;
|
||||||
box.Add(deckUnitInfo);
|
if (!box.Add(deckUnitInfo))
|
||||||
|
throw new RuntimeException("add new unit", Error.RuntimeException);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void randomItem(int group, int count)
|
public void randomItem(int group, int count)
|
||||||
|
|
@ -120,7 +125,8 @@ namespace Server.Manager
|
||||||
deckUnitInfo.user_id = user.id;
|
deckUnitInfo.user_id = user.id;
|
||||||
deckUnitInfo.unit_data_id = randomRewardDatas[n].reward;
|
deckUnitInfo.unit_data_id = randomRewardDatas[n].reward;
|
||||||
deckUnitInfo.count = (randomRewardDatas[n].return_count * count);
|
deckUnitInfo.count = (randomRewardDatas[n].return_count * count);
|
||||||
box.Add(deckUnitInfo);
|
if (!box.Add(deckUnitInfo))
|
||||||
|
throw new RuntimeException("add new unit", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.equipment:
|
case eRewardItemType.equipment:
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
@ -132,7 +138,8 @@ namespace Server.Manager
|
||||||
equipment.equip_unit = 0;
|
equipment.equip_unit = 0;
|
||||||
equipment.rand_stats = rand.Next(5);
|
equipment.rand_stats = rand.Next(5);
|
||||||
equipment.equipment_data_id = randomRewardDatas[n].reward;
|
equipment.equipment_data_id = randomRewardDatas[n].reward;
|
||||||
box.Add(equipment);
|
if (!box.Add(equipment))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(equipment)]", Error.RuntimeException);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.consumable:
|
case eRewardItemType.consumable:
|
||||||
|
|
@ -141,14 +148,16 @@ namespace Server.Manager
|
||||||
consumableItem.user_id = user.id;
|
consumableItem.user_id = user.id;
|
||||||
consumableItem.consumable_item_data_id = randomRewardDatas[n].reward;
|
consumableItem.consumable_item_data_id = randomRewardDatas[n].reward;
|
||||||
consumableItem.count = (randomRewardDatas[n].return_count * count);
|
consumableItem.count = (randomRewardDatas[n].return_count * count);
|
||||||
box.Add(consumableItem);
|
if (!box.Add(consumableItem))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(consumableItem)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.etc:
|
case eRewardItemType.etc:
|
||||||
EtcItem etcItem = new EtcItem();
|
EtcItem etcItem = new EtcItem();
|
||||||
etcItem.user_id = user.id;
|
etcItem.user_id = user.id;
|
||||||
etcItem.etc_item_data_id = randomRewardDatas[n].reward;
|
etcItem.etc_item_data_id = randomRewardDatas[n].reward;
|
||||||
etcItem.count = (randomRewardDatas[n].return_count * count);
|
etcItem.count = (randomRewardDatas[n].return_count * count);
|
||||||
box.Add(etcItem);
|
if (!box.Add(etcItem))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(etcItem)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Not case", Error.nodata);
|
throw new RuntimeException("Not case", Error.nodata);
|
||||||
|
|
@ -216,7 +225,8 @@ namespace Server.Manager
|
||||||
deckUnitInfo.user_id = user.id;
|
deckUnitInfo.user_id = user.id;
|
||||||
deckUnitInfo.unit_data_id = randomRewardDatas[selectItem].reward;
|
deckUnitInfo.unit_data_id = randomRewardDatas[selectItem].reward;
|
||||||
deckUnitInfo.count = (randomRewardDatas[selectItem].return_count);
|
deckUnitInfo.count = (randomRewardDatas[selectItem].return_count);
|
||||||
box.Add(deckUnitInfo);
|
if (!box.Add(deckUnitInfo))
|
||||||
|
throw new RuntimeException("add new unit", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.equipment:
|
case eRewardItemType.equipment:
|
||||||
int reward_count = randomRewardDatas[selectItem].return_count;
|
int reward_count = randomRewardDatas[selectItem].return_count;
|
||||||
|
|
@ -227,7 +237,8 @@ namespace Server.Manager
|
||||||
equipment.equip_unit = 0;
|
equipment.equip_unit = 0;
|
||||||
equipment.rand_stats = rand.Next(5);
|
equipment.rand_stats = rand.Next(5);
|
||||||
equipment.equipment_data_id = randomRewardDatas[selectItem].reward;
|
equipment.equipment_data_id = randomRewardDatas[selectItem].reward;
|
||||||
box.Add(equipment);
|
if (!box.Add(equipment))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(equipment)]", Error.RuntimeException);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.consumable:
|
case eRewardItemType.consumable:
|
||||||
|
|
@ -236,14 +247,16 @@ namespace Server.Manager
|
||||||
consumableItem.user_id = user.id;
|
consumableItem.user_id = user.id;
|
||||||
consumableItem.consumable_item_data_id = randomRewardDatas[selectItem].reward;
|
consumableItem.consumable_item_data_id = randomRewardDatas[selectItem].reward;
|
||||||
consumableItem.count = randomRewardDatas[selectItem].return_count;
|
consumableItem.count = randomRewardDatas[selectItem].return_count;
|
||||||
box.Add(consumableItem);
|
if (!box.Add(consumableItem))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(consumableItem)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
case eRewardItemType.etc:
|
case eRewardItemType.etc:
|
||||||
EtcItem etcItem = new EtcItem();
|
EtcItem etcItem = new EtcItem();
|
||||||
etcItem.user_id = user.id;
|
etcItem.user_id = user.id;
|
||||||
etcItem.etc_item_data_id = randomRewardDatas[selectItem].reward;
|
etcItem.etc_item_data_id = randomRewardDatas[selectItem].reward;
|
||||||
etcItem.count = randomRewardDatas[selectItem].return_count;
|
etcItem.count = randomRewardDatas[selectItem].return_count;
|
||||||
box.Add(etcItem);
|
if (!box.Add(etcItem))
|
||||||
|
throw new RuntimeException("Unknown Error [box.Add(etcItem)]", Error.RuntimeException);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Not case", Error.nodata);
|
throw new RuntimeException("Not case", Error.nodata);
|
||||||
|
|
@ -297,33 +310,9 @@ namespace Server.Manager
|
||||||
Statics.userSQL.Update(user);
|
Statics.userSQL.Update(user);
|
||||||
Statics.userSQL.SaveChanges();
|
Statics.userSQL.SaveChanges();
|
||||||
if (addDeckUnitInfo.Count != 0)
|
if (addDeckUnitInfo.Count != 0)
|
||||||
{
|
Statics.deckUnitInfoSQL.Insert(addDeckUnitInfo);
|
||||||
List<DeckUnitInfo> newItem = new List<DeckUnitInfo>();
|
|
||||||
foreach (var item in _deckUnitInfo)
|
|
||||||
{
|
|
||||||
if(item.id == 0)
|
|
||||||
{
|
|
||||||
newItem.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newItem.Count != 0)
|
|
||||||
Statics.deckUnitInfoSQL.Insert(newItem);
|
|
||||||
Statics.deckUnitInfoSQL.SaveChanges();
|
|
||||||
}
|
|
||||||
if (addEquipment.Count != 0)
|
if (addEquipment.Count != 0)
|
||||||
{
|
Statics.equipmentrSQL.Insert(addEquipment);
|
||||||
List<Equipment> newItem = new List<Equipment>();
|
|
||||||
foreach (var item in _equipment)
|
|
||||||
{
|
|
||||||
if (item.id == 0)
|
|
||||||
{
|
|
||||||
newItem.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newItem.Count != 0)
|
|
||||||
Statics.equipmentrSQL.Insert(newItem);
|
|
||||||
Statics.equipmentrSQL.SaveChanges();
|
|
||||||
}
|
|
||||||
if (addConsumableItem.Count != 0)
|
if (addConsumableItem.Count != 0)
|
||||||
{
|
{
|
||||||
List<ConsumableItem> newItem = new List<ConsumableItem>();
|
List<ConsumableItem> newItem = new List<ConsumableItem>();
|
||||||
|
|
@ -336,7 +325,6 @@ namespace Server.Manager
|
||||||
}
|
}
|
||||||
if (newItem.Count != 0)
|
if (newItem.Count != 0)
|
||||||
Statics.consumableItemSQL.Insert(newItem);
|
Statics.consumableItemSQL.Insert(newItem);
|
||||||
Statics.consumableItemSQL.SaveChanges();
|
|
||||||
}
|
}
|
||||||
if (addEtcItem.Count != 0)
|
if (addEtcItem.Count != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -350,8 +338,11 @@ namespace Server.Manager
|
||||||
}
|
}
|
||||||
if (newItem.Count != 0)
|
if (newItem.Count != 0)
|
||||||
Statics.etcItemSQL.Insert(newItem);
|
Statics.etcItemSQL.Insert(newItem);
|
||||||
Statics.etcItemSQL.SaveChanges();
|
|
||||||
}
|
}
|
||||||
|
Statics.deckUnitInfoSQL.SaveChanges();
|
||||||
|
Statics.equipmentrSQL.SaveChanges();
|
||||||
|
Statics.consumableItemSQL.SaveChanges();
|
||||||
|
Statics.etcItemSQL.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Add(DeckUnitInfo item)
|
public bool Add(DeckUnitInfo item)
|
||||||
|
|
@ -361,22 +352,12 @@ namespace Server.Manager
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
{
|
{
|
||||||
_deckUnitInfo.Add(item);
|
_deckUnitInfo.Add(item);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_deckUnitInfo[index].count += item.count;
|
|
||||||
item.id = _deckUnitInfo[index].id;
|
|
||||||
}
|
|
||||||
if (addIndex == -1)
|
|
||||||
{
|
|
||||||
addDeckUnitInfo.Add(item);
|
addDeckUnitInfo.Add(item);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
return false;
|
||||||
addDeckUnitInfo[addIndex].count += item.count;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Add(List<DeckUnitInfo> items)
|
public bool Add(List<DeckUnitInfo> items)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue