장비 장착 시스템 작업 완료
This commit is contained in:
parent
933926276c
commit
3094199674
|
|
@ -32,6 +32,9 @@ namespace Server.Git
|
||||||
Push(excel);
|
Push(excel);
|
||||||
if (isRestart)
|
if (isRestart)
|
||||||
goto restart;
|
goto restart;
|
||||||
|
|
||||||
|
//최종 데이터 세팅
|
||||||
|
DataSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -44,7 +47,7 @@ namespace Server.Git
|
||||||
if (!Directory.Exists(_repositoryPath))
|
if (!Directory.Exists(_repositoryPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(_repositoryPath);
|
Directory.CreateDirectory(_repositoryPath);
|
||||||
RepositorySet($"clone {STATICS.remoteUrl} {_repositoryPath}", null);
|
RepositorySet($"clone {Statics.remoteUrl} {_repositoryPath}", null);
|
||||||
|
|
||||||
//main브렌치로 세팅
|
//main브렌치로 세팅
|
||||||
RepositorySet("branch -m main", _repositoryPath);
|
RepositorySet("branch -m main", _repositoryPath);
|
||||||
|
|
@ -162,5 +165,14 @@ namespace Server.Git
|
||||||
|
|
||||||
return xlsxFileList;
|
return xlsxFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 엑셀 데이터 저장
|
||||||
|
/// </summary>
|
||||||
|
public void DataSet()
|
||||||
|
{
|
||||||
|
EquipmentDataSQL equipmentDataSQL = new EquipmentDataSQL();
|
||||||
|
equipmentDataSQL.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Server.Git
|
||||||
|
|
||||||
public void DataUpdate()
|
public void DataUpdate()
|
||||||
{
|
{
|
||||||
using (NpgsqlConnection connection = new NpgsqlConnection(STATICS.EXCEL_SQL_URL))
|
using (NpgsqlConnection connection = new NpgsqlConnection(Statics.EXCEL_SQL_URL))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,4 @@ app.MapPost("/git", GItWebhook.Process);
|
||||||
|
|
||||||
//app.MapPost("/update", GItWebhook.Process);
|
//app.MapPost("/update", GItWebhook.Process);
|
||||||
|
|
||||||
app.Run(STATICS.URL);
|
app.Run(Statics.URL);
|
||||||
|
|
|
||||||
|
|
@ -8,25 +8,25 @@ namespace Server.SQL
|
||||||
[Table("deck_info", Schema = "gamedb")]
|
[Table("deck_info", Schema = "gamedb")]
|
||||||
public class DeckInfo
|
public class DeckInfo
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public long id { get; set; }
|
||||||
public int deck_type { get; set; }
|
public int deck_type { get; set; }
|
||||||
public int deck_unit0_id { get; set; }
|
public long deck_unit0_id { get; set; }
|
||||||
public int deck_unit1_id { get; set; }
|
public long deck_unit1_id { get; set; }
|
||||||
public int deck_unit2_id { get; set; }
|
public long deck_unit2_id { get; set; }
|
||||||
public int deck_unit3_id { get; set; }
|
public long deck_unit3_id { get; set; }
|
||||||
public int deck_unit4_id { get; set; }
|
public long deck_unit4_id { get; set; }
|
||||||
public int deck_unit5_id { get; set; }
|
public long deck_unit5_id { get; set; }
|
||||||
public int deck_unit6_id { get; set; }
|
public long deck_unit6_id { get; set; }
|
||||||
public int deck_unit7_id { get; set; }
|
public long deck_unit7_id { get; set; }
|
||||||
public int deck_unit8_id { get; set; }
|
public long deck_unit8_id { get; set; }
|
||||||
public int user_id { get; set; }
|
public long user_id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeckInfoSQL : SQL<DeckInfo>
|
public class DeckInfoSQL : SQL<DeckInfo>
|
||||||
{
|
{
|
||||||
public override DbSet<DeckInfo> table { get; set; }
|
public override DbSet<DeckInfo> table { get; set; }
|
||||||
|
|
||||||
public override List<DeckInfo> SelectUid(int user_id)
|
public override List<DeckInfo> SelectUid(long user_id)
|
||||||
{
|
{
|
||||||
return table.Where(data => data.user_id == user_id).ToList();
|
return table.Where(data => data.user_id == user_id).ToList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,26 +8,30 @@ namespace Server.SQL
|
||||||
[Table("deck_unit_info", Schema = "gamedb")]
|
[Table("deck_unit_info", Schema = "gamedb")]
|
||||||
public class DeckUnitInfo
|
public class DeckUnitInfo
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public long id { get; set; }
|
||||||
public int unit_id { get; set; }
|
public long unit_id { get; set; }
|
||||||
public int user_id { get; set; }
|
public long user_id { get; set; }
|
||||||
public int equip0 { get; set; }
|
public long equip0_id { get; set; }
|
||||||
public int equip1 { get; set; }
|
public long equip1_id { get; set; }
|
||||||
public int equip2 { get; set; }
|
public long equip2_id { get; set; }
|
||||||
public int equip3 { get; set; }
|
public long equip3_id { get; set; }
|
||||||
public int equip4 { get; set; }
|
public long equip4_id { get; set; }
|
||||||
public int equip5 { get; set; }
|
public long equip5_id { get; set; }
|
||||||
public int level { get; set; }
|
public int level { get; set; }
|
||||||
public int exp { get; set; }
|
public long exp { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeckUnitInfoSQL : SQL<DeckUnitInfo>
|
public class DeckUnitInfoSQL : SQL<DeckUnitInfo>
|
||||||
{
|
{
|
||||||
public override DbSet<DeckUnitInfo> table { get; set; }
|
public override DbSet<DeckUnitInfo> table { get; set; }
|
||||||
|
|
||||||
public override List<DeckUnitInfo> SelectUid(int user_id)
|
public override List<DeckUnitInfo> SelectUid(long user_id)
|
||||||
{
|
{
|
||||||
return table.Where(data => data.user_id == user_id).ToList();
|
return table.Where(data => data.user_id == user_id).ToList();
|
||||||
}
|
}
|
||||||
|
public DeckUnitInfo SelectItem(long user_id, long unit_id)
|
||||||
|
{
|
||||||
|
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == unit_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace Server.SQL
|
||||||
[Table("dynamic_data", Schema = "gamedb")]
|
[Table("dynamic_data", Schema = "gamedb")]
|
||||||
public class DynamicData
|
public class DynamicData
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public long id { get; set; }
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
public string value { get; set; }
|
public string value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Server.SQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<DynamicData> SelectUid(int user_id)
|
public override List<DynamicData> SelectUid(long user_id)
|
||||||
{
|
{
|
||||||
return null;//table.Where(data => data.id == user_id).ToList();
|
return null;//table.Where(data => data.id == user_id).ToList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ namespace Server.SQL
|
||||||
[Table("equipment", Schema = "gamedb")]
|
[Table("equipment", Schema = "gamedb")]
|
||||||
public class Equipment
|
public class Equipment
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public long id { get; set; }
|
||||||
public int user_id { get; set; }
|
public long user_id { get; set; }
|
||||||
public int equip_unit { get; set; }
|
public long equip_unit { get; set; }
|
||||||
public int rand_stats { get; set; }
|
public int rand_stats { get; set; }
|
||||||
public int equipment_data_id { get; set; }
|
public long equipment_data_id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EquipmentrSQL : SQL<Equipment>
|
public class EquipmentrSQL : SQL<Equipment>
|
||||||
|
|
@ -25,9 +25,14 @@ namespace Server.SQL
|
||||||
table.Update(equipment);
|
table.Update(equipment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override List<Equipment> SelectUid(int user_id)
|
public override List<Equipment> SelectUid(long user_id)
|
||||||
{
|
{
|
||||||
return table.Where(data => data.user_id == user_id).ToList();
|
return table.Where(data => data.user_id == user_id).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Equipment SelectItem(long user_id, long equipment_id)
|
||||||
|
{
|
||||||
|
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == equipment_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using NLog;
|
||||||
|
using Server.System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Server.SQL
|
||||||
|
{
|
||||||
|
[Table("equipmentdata", Schema = "excel")]
|
||||||
|
public class EquipmentData
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public long index { get; set; }
|
||||||
|
public int part { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EquipmentDataSQL : SQL<EquipmentData>
|
||||||
|
{
|
||||||
|
private static readonly NLog.ILogger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
public override DbSet<EquipmentData> table { get; set; }
|
||||||
|
|
||||||
|
public override List<EquipmentData> SelectUid(long user_id)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
logger.Info("동작1");
|
||||||
|
Statics.equipmentData = new Dictionary<long, EquipmentData>();
|
||||||
|
logger.Info("동작2");
|
||||||
|
List<EquipmentData> equipmentDatas = table.ToList();
|
||||||
|
for(int n = 0; n < equipmentDatas.Count; n++)
|
||||||
|
{
|
||||||
|
Statics.equipmentData.Add(equipmentDatas[n].index, equipmentDatas[n]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Server.SQL
|
||||||
{
|
{
|
||||||
if (!optionsBuilder.IsConfigured)
|
if (!optionsBuilder.IsConfigured)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseNpgsql(STATICS.SQL_URL);
|
optionsBuilder.UseNpgsql(Statics.SQL_URL);
|
||||||
// 다른 옵션들을 추가할 수 있습니다.
|
// 다른 옵션들을 추가할 수 있습니다.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ namespace Server.SQL
|
||||||
return table.ToList();
|
return table.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract List<T> SelectUid(int user_id);
|
public abstract List<T> SelectUid(long user_id);
|
||||||
|
|
||||||
// Select 예시
|
// Select 예시
|
||||||
// 각자 상황에 맞게 작성해서 사용할것
|
// 각자 상황에 맞게 작성해서 사용할것
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace Server.SQL
|
||||||
[Table("user", Schema = "gamedb")]
|
[Table("user", Schema = "gamedb")]
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public long id { get; set; }
|
||||||
public string uuid { get; set; }
|
public string uuid { get; set; }
|
||||||
public string mail { get; set; }
|
public string mail { get; set; }
|
||||||
public string nickname { get; set; }
|
public string nickname { get; set; }
|
||||||
|
|
@ -39,9 +39,11 @@ namespace Server.SQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user_id"></param>
|
/// <param name="user_id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override List<User> SelectUid(int user_id)
|
public override List<User> SelectUid(long user_id)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
using Server.System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Server.SQL;
|
||||||
|
|
||||||
|
namespace Server.Service
|
||||||
|
{
|
||||||
|
public class EquipChange : AbstractService
|
||||||
|
{
|
||||||
|
private EquipChangeReq req;
|
||||||
|
public override string Process()
|
||||||
|
{
|
||||||
|
//문제 1 장비 장착 저장이 안됨.
|
||||||
|
//문제 2 기존에 장비가 있다면 신규 장비로 교체가 되야함.
|
||||||
|
UserSQL userSQL = new UserSQL();
|
||||||
|
EquipmentrSQL equipmentrSQL = new EquipmentrSQL();
|
||||||
|
DeckUnitInfoSQL deckUnitInfoSQL = new DeckUnitInfoSQL();
|
||||||
|
User user = userSQL.SelectUuid(req.uuid);
|
||||||
|
Equipment equipment = equipmentrSQL.SelectItem(user.id, req.equipment_id);
|
||||||
|
DeckUnitInfo deckUnitInfo = deckUnitInfoSQL.SelectItem(user.id, req.unit_id);
|
||||||
|
|
||||||
|
if(equipment == null || deckUnitInfo == null)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Not Data", Error.nodata);
|
||||||
|
}
|
||||||
|
|
||||||
|
EquipmentData equipmentData = Statics.equipmentData[equipment.equipment_data_id];
|
||||||
|
|
||||||
|
switch (equipmentData.part)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
deckUnitInfo.equip0_id = equipment.id;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
deckUnitInfo.equip1_id = equipment.id;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
deckUnitInfo.equip2_id = equipment.id;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
deckUnitInfo.equip3_id = equipment.id;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
deckUnitInfo.equip4_id = equipment.id;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
deckUnitInfo.equip5_id = equipment.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
equipment.equip_unit = deckUnitInfo.id;
|
||||||
|
|
||||||
|
equipmentrSQL.Update(equipment);
|
||||||
|
deckUnitInfoSQL.Update(deckUnitInfo);
|
||||||
|
|
||||||
|
return makeResp(equipment, deckUnitInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Protocol ProtocolValue() => Protocol.EquipChange;
|
||||||
|
|
||||||
|
public override Req Requst(string json)
|
||||||
|
{
|
||||||
|
req = JsonConvert.DeserializeObject<EquipChangeReq>(json);
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string makeResp(Equipment equipment, DeckUnitInfo deck_unit_info)
|
||||||
|
{
|
||||||
|
EquipChangeResp resp = new EquipChangeResp();
|
||||||
|
resp.status = 200;
|
||||||
|
resp.equipment = equipment;
|
||||||
|
resp.deck_unit_info = deck_unit_info;
|
||||||
|
return resp.ToJson();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EquipChangeReq : Req
|
||||||
|
{
|
||||||
|
public string uuid;
|
||||||
|
public long unit_id;
|
||||||
|
public long equipment_id;
|
||||||
|
public override bool IsReceivedAllField()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EquipChangeResp : Resp
|
||||||
|
{
|
||||||
|
public Equipment equipment;
|
||||||
|
public DeckUnitInfo deck_unit_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -161,6 +161,7 @@ namespace Server.Service
|
||||||
{
|
{
|
||||||
public string uuid;
|
public string uuid;
|
||||||
public string nickname;
|
public string nickname;
|
||||||
|
public long id;
|
||||||
public List<DynamicData> dynamic_data;
|
public List<DynamicData> dynamic_data;
|
||||||
public List<DeckUnitInfo> deck_unit;
|
public List<DeckUnitInfo> deck_unit;
|
||||||
public List<DeckInfo> deck_info;
|
public List<DeckInfo> deck_info;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@
|
||||||
Downlode = 100,//기획 데이터 다운로드
|
Downlode = 100,//기획 데이터 다운로드
|
||||||
Login = 101,//기획 데이터 다운로드
|
Login = 101,//기획 데이터 다운로드
|
||||||
ChangeDeck = 102,//기획 데이터 다운로드
|
ChangeDeck = 102,//기획 데이터 다운로드
|
||||||
|
|
||||||
|
|
||||||
|
EquipChange = 200,//장비 변경
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Error
|
public enum Error
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
namespace Server.System
|
using Server.SQL;
|
||||||
|
|
||||||
|
namespace Server.System
|
||||||
{
|
{
|
||||||
public static class STATICS
|
public static class Statics
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
|
|
@ -16,6 +18,7 @@
|
||||||
public static readonly string URL = "https://0.0.0.0:4860";
|
public static readonly string URL = "https://0.0.0.0:4860";
|
||||||
|
|
||||||
public static readonly string PATTERN = "[^a-zA-Z0-9가-힣 ]";
|
public static readonly string PATTERN = "[^a-zA-Z0-9가-힣 ]";
|
||||||
}
|
|
||||||
|
|
||||||
|
public static Dictionary<long,EquipmentData> equipmentData = new Dictionary<long,EquipmentData>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue