Skip to content

Commit c72aa98

Browse files
committed
Feat: Add GitHub Actions CI/CD pipline
1 parent a8b5694 commit c72aa98

24 files changed

Lines changed: 1576 additions & 228 deletions

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: GameServer Self-Hosted Deploy
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build-and-run:
9+
runs-on: self-hosted
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v3
13+
14+
- name: NuGet Restore
15+
run: nuget restore "C#_GameServer.sln"
16+
17+
- name: Build Project
18+
run: |
19+
msbuild "C#_GameServer.sln" /p:Configuration=Release /p:OutputPath=./publish
20+
21+
- name: Clean and Copy GameData
22+
run: |
23+
if (Test-Path "publish\GameData") {
24+
Remove-Item -Path "publish\GameData" -Recurse -Force
25+
}
26+
xcopy "GameData" "publish\GameData" /E /I /Y
27+
28+
- name: Restart Server
29+
run: |
30+
Get-Process -Name "C#_GameServer" -ErrorAction SilentlyContinue | Stop-Process -Force
31+
Start-Process "./publish/C#_GameServer.exe"

AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using System.Runtime.CompilerServices;
2+
3+
[assembly: InternalsVisibleTo("UnitTestProject1")]

C#_GameServer.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
3737
<ItemGroup>
38+
<Compile Include="AssemblyInfo.cs" />
3839
<Compile Include="Common\Packet.cs" />
40+
<None Include=".github\workflows\deploy.yml" />
3941
<None Include="CsharpGameServer-Doc\doc\networking.md" />
4042
<Compile Include="DataManage\ItemData.cs" />
4143
<Compile Include="DataManage\MapData.cs" />
@@ -70,6 +72,7 @@
7072
<Compile Include="DataManage\MonsterData.cs" />
7173
<Compile Include="Manager\NpcManager.cs" />
7274
<Compile Include="Manager\MapManager.cs" />
75+
<Compile Include="Network\PacketExtenstions.cs" />
7376
<Compile Include="Network\PacketHandler.cs" />
7477
<Compile Include="Network\PacketMaker.cs" />
7578
<Compile Include="Network\PacketParser.cs" />
@@ -191,7 +194,6 @@
191194
<Reference Include="System.Transactions" />
192195
</ItemGroup>
193196
<ItemGroup>
194-
<Folder Include=".github\workflows\" />
195197
<Folder Include="Game\Npc\" />
196198
</ItemGroup>
197199
<ItemGroup>

Common/Packet.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ public class PlayerInfo
152152

153153
public int Dir { get; set; }
154154

155+
public float Vx { get; set; }
156+
public float Vy { get; set; }
157+
public long Timestamp { get; set; }
158+
155159
//public EquipmentInfo Equipment { get; set; }
156160
}
157161

@@ -240,6 +244,7 @@ public class PlayerMoveRequest : IPacket
240244
public class PlayerMoveResponse : IPacket
241245
{
242246
public PacketID PacketId => PacketID.PlayerMoveResponse;
247+
public long Timestamp { get; set; }
243248
public int CharacterId { get; set; }
244249
public float PosX { get; set; }
245250
public float PosY { get; set; }
@@ -552,6 +557,7 @@ public class PlayerMoveListResponse : IPacket
552557
public List<PlayerMoveResponse> Players { get; set; } = new List<PlayerMoveResponse>();
553558
}
554559

560+
555561
/*[Serializable]
556562
public class DialogueResponse
557563
{

DB/DbManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public static Task<bool> SavePlayerData(CharacterDto characterDto, List<Inventor
197197
if (items != null && items.Count > 0)
198198
{
199199
string itemSql = @"UPDATE inventory SET
200-
count=@count, is_equipped=@is_equipped, enhancement=@enhancement
200+
owner_id=@owner_id, count=@count, is_equipped=@is_equipped, enhancement=@enhancement
201201
WHERE id=@id";
202202
db.Execute(itemSql, items, transaction);
203203
}

DataManage/MapData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class MapData
88
{
9-
private Dictionary<int, Map> _mapDatas = new Dictionary<int, Map>();
9+
internal Dictionary<int, Map> _mapDatas = new Dictionary<int, Map>();
1010

1111
public int Count() => _mapDatas.Count();
1212

GameData/Map/Map01.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
"MapId": 1,
33
"MonsterPatrolInfo": [
44
{
5-
"MonsterId": 1,
5+
"MonsterId": 2,
66
"PosX": 0.0,
77
"PosY": 0.0,
88
"MinPosX": -4.5,
9-
"MinPosY": 7.0
9+
"MaxPosX": 7.0
1010
},
1111
{
12-
"MonsterId": 2,
12+
"MonsterId": 3,
1313
"PosX": 0.0,
1414
"PosY": 4.3,
1515
"MinPosX": -4.5,
16-
"MinPosY": 7.0
16+
"MaxPosX": 7.0
1717
},
1818
{
19-
"MonsterId": 3,
19+
"MonsterId": 1,
2020
"PosX": 0.0,
2121
"PosY": -3.5,
22-
"MinPosX": -7.5,
23-
"MinPosY": 7.0
22+
"MinPosX": -4.5,
23+
"MaxPosX": 7.0
2424
}
25+
]
2526
}

GameData/Map/Map02.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"MapId": 2,
3+
"MonsterPatrolInfo": [
4+
{
5+
"MonsterId": 1,
6+
"PosX": 0.0,
7+
"PosY": -3.5,
8+
"MinPosX": -11.5,
9+
"MaxPosX": 12.0
10+
},
11+
{
12+
"MonsterId": 2,
13+
"PosX": 0.0,
14+
"PosY": 1.5,
15+
"MinPosX": -1.5,
16+
"MaxPosX": 2.5
17+
},
18+
{
19+
"MonsterId": 3,
20+
"PosX": 0.0,
21+
"PosY": 5.5,
22+
"MinPosX": -10.5,
23+
"MaxPosX": 9.5
24+
}
25+
]
26+
}

GameData/Npc/npc01.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"NpcId": 1,
3+
"Name": "촌장 바르만",
4+
"DefaultDialogueId": 1001,
5+
"Dialogues": {
6+
"1001": {
7+
"NpcId": 1,
8+
"Type": 0,
9+
"Contents": "허허, 오늘도 날씨가 좋구먼."
10+
},
11+
"2001": {
12+
"NpcId": 1,
13+
"Type": 2,
14+
"Contents": "자네, 요즘 고블린들 때문에 마을이 흉흉하다는 소식 들었나?",
15+
"NextDialogueId": 2002
16+
},
17+
"2002": {
18+
"NpcId": 1,
19+
"Type": 3,
20+
"Contents": "고블린 10마리만 좀 잡아주게나. 보상은 톡톡히 하겠네.",
21+
"QuestId": 101
22+
},
23+
"3001": {
24+
"NpcId": 1,
25+
"Type": 0,
26+
"Contents": "아직 고블린들을 다 처리하지 못한 모양이군."
27+
},
28+
"4001": {
29+
"NpcId": 1,
30+
"Type": 1,
31+
"Contents": "오! 정말 고생 많았네. 여기 약속한 보상일세."
32+
}
33+
},
34+
"QuestMap": {
35+
"101": {
36+
"QuestTitle": "고블린 소탕",
37+
"StartId": 2001,
38+
"ProgressId": 3001,
39+
"CompletableId": 4001
40+
}
41+
}
42+
}

GameData/Quest/quest01.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"QuestId": 101,
3+
"QuestName": "고블린 부락의 위협",
4+
"Description": "마을 서쪽의 고블린들을 처치하고 증거품을 가져오세요.",
5+
"RequiredLevel": 1,
6+
"RequiredQuestId": 0,
7+
"Conditions": [
8+
{
9+
"Type": 1,
10+
"TargetId": 1,
11+
"TargetCount": 1
12+
},
13+
{
14+
"Type": 2,
15+
"TargetId": 3,
16+
"TargetCount": 1
17+
}
18+
],
19+
"RewardExp": 500,
20+
"RewardGold": 200,
21+
"RewardItemId": [1, 2]
22+
}

0 commit comments

Comments
 (0)