From 1ab06413d497188f7c7a5715bdb69a6835251c9d Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Wed, 14 Feb 2024 22:49:10 +0800
Subject: [PATCH 1/9] =?UTF-8?q?fix=20=E8=B0=A8=E9=98=B2=E5=8D=8A=E5=9C=BA?=
=?UTF-8?q?=E5=BC=80=E9=A6=99=E6=A7=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/game/server/weapons/grenade.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/game/server/weapons/grenade.cpp b/src/game/server/weapons/grenade.cpp
index fda67d9078..84b2098836 100644
--- a/src/game/server/weapons/grenade.cpp
+++ b/src/game/server/weapons/grenade.cpp
@@ -74,7 +74,7 @@ bool CGrenade::GrenadeCollide(CProjectile *pProj, vec2 Pos, CCharacter *pHit, bo
WEAPON_SHOTGUN, //Type
pProj->GetWeaponID(), //WeaponID
pProj->GetOwner(), //Owner
- FragPos, //Pos
+ FragPos + d, //Pos
d * 0.5f, //Dir
6.0f, // Radius
0.2f * pProj->Server()->TickSpeed(), //Span
From 94ec2e17e16c545a951eb0ed922fbe0720d887c2 Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Fri, 16 Feb 2024 01:28:27 +0800
Subject: [PATCH 2/9] update README.md
---
README.md | 53 +++++++++++++++++++++--------------------------------
1 file changed, 21 insertions(+), 32 deletions(-)
diff --git a/README.md b/README.md
index 8eca9395c9..705372facb 100644
--- a/README.md
+++ b/README.md
@@ -1,37 +1,26 @@
-DDNet-PvP HunterN猎人杀
-===
-模式规则:
+# DDNet-PvP HunterN猎人杀
+**DDNet-HunterN**是一个基于**DDNet-PvP**的模组 提供**HunterN**(猎人杀)游戏模式
-1.每回合都会秘密随机选择猎人。猎人必须消灭所有平民。
+### HunterN的游戏规则:
+1. 在该模式中 每回合都会**秘密随机**选择玩家成为**猎人**或**平民** 猎人的目标是**消灭所有平民** 开局时玩家只知道自己身份
+1. 猎人使用高伤武器、瞬杀追踪锤和破片榴弹 而平民没有锤子且只能使用常规武器
+1. 死亡后 消息**仅旁观/死人可见** 如果猎人死亡还会通知其他猎人
-2.猎人造成双倍伤害,有一把瞬杀锤和破片榴弹,而平民没有锤子,只能使用常规武器。
-
-3.活着的玩家看不到死去玩家的信息。
-
-4.如果猎人死亡,将通知其他猎人。
-
-5.在游戏开始时,玩家只知道自己的身份。
-
-Rules:
-
-1.Each round will secretly randomly select Hunter(s). Hunter(s) must eliminate all the Civilians.
-
-2.The Hunter deals double damage and has an instant-kill hammer and fragmentation grenades, while Civilians have no hammer and can only use regular weapons.
-
-3.The living players cannot see messages from dead players.
-
-4.If the Hunter dies, the other Hunters will be notified.
-
-5.At the beginning of the game, players only know their own identity.
-
-在Ubuntu上使用CMake构建
----
-1.安装依赖库
+## 在Ubuntu上使用CMake构建HunterN
+1. 使用apt安装依赖库
+```
+sudo apt install build-essential cmake python3 libsqlite3-dev
```
- sudo apt install build-essential cmake python3 libsqlite3-dev
+2. 转到项目目录编译服务端
```
-2.编译服务端
+cmake .
+make -j16
```
- cmake ..
- make -j16
-```
\ No newline at end of file
+## HunterN的服务端下载&配置
+* 你可以下载**正式发布包**于[Github Releases](https://github.com/Hu1night/DDNet-HunterN/releases)
+* 或者下载**开发构建**于[Github Actions](https://github.com/Hu1night/DDNet-HunterN/actions/workflows/build.yaml)(下载需Github账号)
+
+**HunterN的一些配置文件**
+* 服务端启动时执行/autoexec.cfg
+* HunterN房间启动时执行/room_config/modes/huntern.rcfg
+* HunterN的Mega_std_collection地图启动时执行/data/maps/huntern_msc.map.cfg
\ No newline at end of file
From 3f5f6f3e0cfc9244b6388edb6e86b22412529a57 Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Mon, 19 Feb 2024 03:12:07 +0800
Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=81=E8=A7=82/?=
=?UTF-8?q?=E6=AD=BB=E4=BA=BA=E7=9C=8B=E4=B8=8D=E5=88=B0=E6=AD=BB=E4=BA=BA?=
=?UTF-8?q?=E7=9A=84Bug=20x2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/game/server/gamecontroller.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp
index 4f108f493d..62f34c9052 100644
--- a/src/game/server/gamecontroller.cpp
+++ b/src/game/server/gamecontroller.cpp
@@ -2940,7 +2940,7 @@ void IGameController::SendKillMsg(int Killer, int Victim, int Weapon, int ModeSp
for(int i = 0; i < MAX_CLIENTS; ++i)
{
if(GetPlayerIfInRoom(i))
- Server()->SendPackMsg((GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS || !(GameServer()->m_apPlayers[i]->GetCharacter() && GameServer()->m_apPlayers[i]->GetCharacter()->IsAlive())) ?
+ Server()->SendPackMsg((GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS || (GameServer()->m_apPlayers[i]->GetCharacter() && GameServer()->m_apPlayers[i]->GetCharacter()->IsAlive())) ?
&PlayerMsg : &Msg, // Is Hide Reason
MSGFLAG_VITAL, i);
}
From 2188c731f44e02a06fc1123b87d86666532293f0 Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Mon, 19 Feb 2024 04:35:26 +0800
Subject: [PATCH 4/9] update README.md
---
README.md | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 705372facb..4e80c727f9 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,38 @@
-# DDNet-PvP HunterN猎人杀
-**DDNet-HunterN**是一个基于**DDNet-PvP**的模组 提供**HunterN**(猎人杀)游戏模式
+# DDNet-HunterN猎人杀
+[**DDNet-HunterN**](https://github.com/Hu1night/DDNet-HunterN)是一个基于[**DDNet-PvP**](https://github.com/TeeworldsCN/ddnet-pvp)(传统竞技)(基于DDNet 15.3.2)的[**DDNet**](https://github.com/DDNet/DDNet)模组项目 提供名为***HunterN***(猎人杀)的PvP模式
### HunterN的游戏规则:
-1. 在该模式中 每回合都会**秘密随机**选择玩家成为**猎人**或**平民** 猎人的目标是**消灭所有平民** 开局时玩家只知道自己身份
-1. 猎人使用高伤武器、瞬杀追踪锤和破片榴弹 而平民没有锤子且只能使用常规武器
-1. 死亡后 消息**仅旁观/死人可见** 如果猎人死亡还会通知其他猎人
+1. 每局开始时会**秘密随机**选择玩家成为**猎人**或**平民** 且玩家只知道自己身份 猎人的目标是**消灭所有平民**
+2. 猎人使用高伤武器、瞬杀追踪锤(20伤,长按追踪)和破片榴弹 **而平民没有锤子且只能使用常规武器**
+3. 当玩家死时如为猎人死亡则通知其他猎人 且死亡原因和死后聊天**仅旁观/死人可见**
-## 在Ubuntu上使用CMake构建HunterN
-1. 使用apt安装依赖库
+## 在Ubuntu上使用CMake构建DDNet-HunterN
+1. 使用apt安装***依*****赖***库*
```
-sudo apt install build-essential cmake python3 libsqlite3-dev
+sudo apt install build-essential cmake python3 libsqlite3-dev libcurl4-openssl-dev zlib1g-dev
```
2. 转到项目目录编译服务端
```
cmake .
make -j16
```
-## HunterN的服务端下载&配置
+
+## DDNet-HunterN的服务端下载&配置
* 你可以下载**正式发布包**于[Github Releases](https://github.com/Hu1night/DDNet-HunterN/releases)
-* 或者下载**开发构建**于[Github Actions](https://github.com/Hu1night/DDNet-HunterN/actions/workflows/build.yaml)(下载需Github账号)
+* 或者下载**开发构建**于[Github Actions](https://github.com/Hu1night/DDNet-HunterN/actions/workflows/build.yaml?query=branch%3Amaster++)([几乎汉化分支构建](https://github.com/Hu1night/DDNet-HunterN/actions/workflows/build.yaml?query=branch%3Ahuntern-zh_cn++))(下载需Github账号)
+
+**关于DDNet-HunterN的一些配置指令**
+* ```sv_room_commands```于控制台启用时才能使玩家创建/加入房间
+* ```room_setting 0```于控制台输入可查看0号房间可用的模式指令 房间指令使用实例:```room_setting 0 timelimit 3``` (设置0号房间每局限时3分钟)
+* ```/setting```于(管理员)聊天栏输入可查看所在房间可用的模式指令 使用实例:```/setting map dm2``` (设置所在房间的子地图为dm2)
-**HunterN的一些配置文件**
+**关于DDNet-HunterN的一些配置文件**
* 服务端启动时执行/autoexec.cfg
* HunterN房间启动时执行/room_config/modes/huntern.rcfg
-* HunterN的Mega_std_collection地图启动时执行/data/maps/huntern_msc.map.cfg
\ No newline at end of file
+* DDNet-HunterN的Mega_std_collection地图启动时执行/data/maps/huntern_msc.map.cfg
+* 服务器资产定位使用/storage.cfg
+
+**关于DDNet-PvP的Mega map生成**
+使用[DDNet-PvP附加工具](https://github.com/Hu1night/DDNet-HunterN/releases/download/0.3a1/DDNet-PvP.Extra.tools.zip)中的map_merge程序进行Mega map的生成
+使用用法:```map_merge 输出地图名 输入地图1 输入地图2 输入地图3 ... 输入地图n```
+使用实例:```map_merge huntern.map hunter1.map hunter2.map hunter3.map hunter4.map hunter6.map```
\ No newline at end of file
From f41a08cc22f9500925dc032f22f946e9372f3b0d Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Mon, 19 Feb 2024 21:32:01 +0800
Subject: [PATCH 5/9] =?UTF-8?q?README=E4=B9=9F=E5=8D=8A=E5=9C=BA=E5=BC=80?=
=?UTF-8?q?=E9=A6=99=E6=A7=9F=E4=BA=86:(?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 4e80c727f9..ac31268a1d 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ make -j16
* DDNet-HunterN的Mega_std_collection地图启动时执行/data/maps/huntern_msc.map.cfg
* 服务器资产定位使用/storage.cfg
-**关于DDNet-PvP的Mega map生成**
-使用[DDNet-PvP附加工具](https://github.com/Hu1night/DDNet-HunterN/releases/download/0.3a1/DDNet-PvP.Extra.tools.zip)中的map_merge程序进行Mega map的生成
-使用用法:```map_merge 输出地图名 输入地图1 输入地图2 输入地图3 ... 输入地图n```
-使用实例:```map_merge huntern.map hunter1.map hunter2.map hunter3.map hunter4.map hunter6.map```
\ No newline at end of file
+**关于DDNet-PvP的Mega map生成**
+使用[DDNet-PvP附加工具](https://github.com/Hu1night/DDNet-HunterN/releases/download/0.3a1/DDNet-PvP.Extra.tools.zip)中的map_merge程序进行Mega map的生成
+使用用法:```map_merge 输出地图名 输入地图1 输入地图2 输入地图3 ... 输入地图n```
+使用实例:```map_merge huntern.map hunter1.map hunter2.map hunter3.map hunter4.map hunter6.map```
\ No newline at end of file
From 26655816bde4879e642bb317c3b4db05d6bef8c4 Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Mon, 19 Feb 2024 21:50:31 +0800
Subject: [PATCH 6/9] =?UTF-8?q?=E5=A4=A7=E4=BA=8E4=E4=BA=BA=E6=97=B6?=
=?UTF-8?q?=E6=89=8D=E5=90=AF=E7=94=A8=E9=9A=8F=E6=9C=BA=E5=87=BA=E7=94=9F?=
=?UTF-8?q?=E7=82=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/game/server/gamemodes/huntern.cpp | 9 +++------
src/game/server/gamemodes/huntern.h | 3 ++-
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/game/server/gamemodes/huntern.cpp b/src/game/server/gamemodes/huntern.cpp
index 8b2fcf3817..901d1a45a0 100644
--- a/src/game/server/gamemodes/huntern.cpp
+++ b/src/game/server/gamemodes/huntern.cpp
@@ -246,12 +246,9 @@ void CGameControllerHunterN::OnWorldReset() // 重置部分值和职业选择
{
SendChatTarget(pPlayer->GetCID(), HunterList); // 给膀胱者发
}
- else if(pPlayer->GetCharacter())
+ else if(pPlayer->GetCharacter() && pPlayer->GetCharacter()->IsAlive()) // 这个玩家出生了 所以OnCharacterSpawn已经过了
{
- if(pPlayer->GetCharacter()->IsAlive()) // 这个玩家出生了 所以OnCharacterSpawn已经过了
- {
- OnResetClass(pPlayer->GetCharacter()); // 在这里给他们Class提示和武器
- }
+ OnResetClass(pPlayer->GetCharacter()); // 在这里给他们Class提示和武器
}
}
}
@@ -326,7 +323,7 @@ int CGameControllerHunterN::OnCharacterTakeDamage(class CCharacter *pChr, vec2 &
return -1;
}*/
-bool CGameControllerHunterN::CanChangeTeam(CPlayer *pPlayer, int JoinTeam) const // 加入膀胱者重置职业Flag
+bool CGameControllerHunterN::CanChangeTeam(CPlayer *pPlayer, int JoinTeam) const // 加入膀胱者则重置职业Flag
{
if(JoinTeam == TEAM_SPECTATORS)
{
diff --git a/src/game/server/gamemodes/huntern.h b/src/game/server/gamemodes/huntern.h
index b27693f0cb..0696d8c4a7 100644
--- a/src/game/server/gamemodes/huntern.h
+++ b/src/game/server/gamemodes/huntern.h
@@ -22,8 +22,9 @@ class CGameControllerHunterN : public IGameController
void SendChatRoom(const char *pText, int Flags = 3);
// event
- void OnCharacterSpawn(class CCharacter *pChr) override;
void OnWorldReset() override;
+ bool IsSpawnRandom() const { return m_aTeamSize[TEAM_RED] > 4; };
+ void OnCharacterSpawn(class CCharacter *pChr) override;
void OnPlayerJoin(class CPlayer *pPlayer) override;
int OnCharacterTakeDamage(class CCharacter *pChr, vec2 &Force, int &Dmg, int From, int WeaponType, int WeaponID, bool IsExplosion) override;
//int OnPickup(CPickup *pPickup, CCharacter *pChar, SPickupSound *pSound) override;
From fd3c004a51285d87bd7f97f61dc34d7b95b46bff Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Mon, 19 Feb 2024 21:51:49 +0800
Subject: [PATCH 7/9] Disable Jug
---
CMakeLists.txt | 4 ++--
src/game/server/gamemodes/huntern.cpp | 4 ++--
src/game/server/weapons.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b939e05b12..b70473f2ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1006,8 +1006,8 @@ set_src(GAME_SERVER GLOB_RECURSE src/game/server
weapons/hammer.h
weapons/hunthammer.cpp
weapons/hunthammer.h
- weapons/jugninja.cpp
- weapons/jugninja.h
+# weapons/jugninja.cpp
+# weapons/jugninja.h
weapons/lasergun.cpp
weapons/lasergun.h
weapons/ninja.cpp
diff --git a/src/game/server/gamemodes/huntern.cpp b/src/game/server/gamemodes/huntern.cpp
index 901d1a45a0..7f1a6cd9df 100644
--- a/src/game/server/gamemodes/huntern.cpp
+++ b/src/game/server/gamemodes/huntern.cpp
@@ -286,7 +286,7 @@ void CGameControllerHunterN::OnCharacterSpawn(CCharacter *pChr) // 给予生命
pChr->GameWorld()->CreateSoundGlobal(SOUND_CTF_GRAB_EN, CmaskOne(pChr->GetPlayer()->GetCID()));
pChr->GameServer()->SendBroadcast(" 这回合你被选择为猎人Hunter!\n 猎人双倍伤害 有瞬杀锤子和破片榴弹\n 分辨出你的队友 消灭敌方队伍胜利!", pChr->GetPlayer()->GetCID(), true);
}
- else if(pChr->GetPlayer()->m_Class == CLASS_JUGGERNAUT)
+ /*else if(pChr->GetPlayer()->m_Class == CLASS_JUGGERNAUT)
{
pChr->m_MaxHealth = 114;
pChr->IncreaseHealth(114);
@@ -297,7 +297,7 @@ void CGameControllerHunterN::OnCharacterSpawn(CCharacter *pChr) // 给予生命
pChr->GameWorld()->CreateSoundGlobal(SOUND_NINJA_FIRE, CmaskOne(pChr->GetPlayer()->GetCID()));
pChr->GameServer()->SendBroadcast(" 这局你是剑圣Juggernaut!噶了所有人胜利!\n 剑圣40心20盾 有盾反锤子且能斩杀", pChr->GetPlayer()->GetCID(), true);
- }
+ }*/
}
void CGameControllerHunterN::OnPlayerJoin(class CPlayer *pPlayer) // 使新进旁观者收到猎人列表
diff --git a/src/game/server/weapons.h b/src/game/server/weapons.h
index 7a5762968e..72c564b8b8 100644
--- a/src/game/server/weapons.h
+++ b/src/game/server/weapons.h
@@ -10,7 +10,7 @@ REGISTER_WEAPON(WEAPON_ID_NINJA, CNinja)
REGISTER_WEAPON(WEAPON_ID_EXPLODINGLASER, CExplodingLaser)
REGISTER_WEAPON(WEAPON_ID_HUNTHAMMER, CHuntHammer) // Hunter
-REGISTER_WEAPON(WEAPON_ID_JUGNINJA, CJugNinja) // Hunter
+//REGISTER_WEAPON(WEAPON_ID_JUGNINJA, CJugNinja) // Hunter
#else
@@ -27,7 +27,7 @@ REGISTER_WEAPON(WEAPON_ID_JUGNINJA, CJugNinja) // Hunter
#include "weapons/explodinglaser.h"
#include "weapons/hunthammer.h" // Hunter
-#include "weapons/jugninja.h" // Hunter
+//#include "weapons/jugninja.h" // Hunter
enum
{
From 2353561fc5a94592bfc7bfab9c17874fbd339747 Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Wed, 21 Feb 2024 14:59:04 +0800
Subject: [PATCH 8/9] =?UTF-8?q?CGameControllerHunterN=E7=9A=84=E5=B0=8F?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E4=BB=A5=E5=8F=8A=20Maprotation=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E6=8D=A2=E5=9B=BE(=E6=9A=82=E6=97=B6=E6=94=BE?=
=?UTF-8?q?=E5=9C=A8CGameControllerHunterN?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/game/server/gamemodes/huntern.cpp | 107 +++++++++++++++++++++++---
src/game/server/gamemodes/huntern.h | 5 +-
src/game/server/teams.cpp | 9 +++
src/game/server/teams.h | 1 +
4 files changed, 110 insertions(+), 12 deletions(-)
diff --git a/src/game/server/gamemodes/huntern.cpp b/src/game/server/gamemodes/huntern.cpp
index 7f1a6cd9df..52d8b7c032 100644
--- a/src/game/server/gamemodes/huntern.cpp
+++ b/src/game/server/gamemodes/huntern.cpp
@@ -9,6 +9,63 @@
#include
// HunterN commands
+static void ConMapAdd(IConsole::IResult *pResult, void *pUserData)
+{
+ CGameControllerHunterN *pSelf = (CGameControllerHunterN *)pUserData;
+
+ if(pResult->NumArguments() > 0) // 如果要加入地图
+ {
+ for(int j = 0; j < pResult->NumArguments(); ++j) // 逐个加入地图到列表
+ {
+ const char *pMapName = pResult->GetString(j);
+
+ for(int i = 0; i < 64; ++i) // 循环所有子地图
+ {
+ if(!pSelf->m_Maprotation[i]) // 在列表里找到了可用空位
+ {
+ int MapIndex = pSelf->GameServer()->Teams()->GetMapIndex(pMapName);
+ if(MapIndex == 0)
+ break; // 跳出到错误提示
+
+ pSelf->m_Maprotation[i] = MapIndex; // 加入循环列表
+ goto next_map;
+ }
+ }
+
+ char aBuf[512];
+ str_format(aBuf, sizeof(aBuf), "Cannot add map '%s'", pMapName);
+ pSelf->InstanceConsole()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "instance", aBuf);
+
+ next_map:;
+ }
+ }
+ else // 显示列表
+ {
+ char aBuf[1024];
+ str_format(aBuf, sizeof(aBuf), "Value: ");
+ for(int i = 0; i < 64; ++i) // 循环所有子地图
+ {
+ if(!pSelf->m_Maprotation[i]) // 列表走到了尽头
+ break;
+
+ const char *pMapName = pSelf->GameServer()->Teams()->GetMapName(pSelf->m_Maprotation[i]);
+ if(!pMapName)
+ continue;
+
+ str_append(aBuf, pMapName, sizeof(aBuf));
+ str_append(aBuf, ", ", sizeof(aBuf));
+ }
+ pSelf->InstanceConsole()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "instance", aBuf); // 输出
+ }
+}
+
+static void ConMapClear(IConsole::IResult *pResult, void *pUserData)
+{
+ CGameControllerHunterN *pSelf = (CGameControllerHunterN *)pUserData;
+
+ for(int i = 0; i < 64; ++i) pSelf->m_Maprotation[i] = {0};
+}
+
static void ConSetClass(IConsole::IResult *pResult, void *pUserData)
{
IGameController *pSelf = (IGameController *)pUserData;
@@ -64,7 +121,7 @@ static void ConSetHeal(IConsole::IResult *pResult, void *pUserData)
static void ConRevive(IConsole::IResult *pResult, void *pUserData)
{
- IGameController *pSelf = (IGameController *)pUserData;// CGameControllerHunterN *pSelf = (CGameControllerHunterN *)pUserData; // Warning // Use CGameControllerHunterN instead of IGameController
+ IGameController *pSelf = (IGameController *)pUserData;// CGameControllerHunterN *pSelf = (CGameControllerHunterN *)pUserData; // Use CGameControllerHunterN instead of IGameController
CPlayer *pPlayer = pSelf->GetPlayerIfInRoom((pResult->NumArguments() > 0) ? pResult->GetInteger(0) : pResult->m_ClientID);
if(!pPlayer) // If the player does not exist
@@ -89,10 +146,14 @@ CGameControllerHunterN::CGameControllerHunterN() :
INSTANCE_CONFIG_INT(&m_BroadcastHunterDeath, "htn_hunt_broadcast_death", 0, 0, 1, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "是否全体广播猎人死亡(开关,默认0,限制0~1)");
INSTANCE_CONFIG_INT(&m_EffectHunterDeath, "htn_hunt_effert_death", 0, 0, 1, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "猎人死亡是否使用出生烟(开关,默认0,限制0~1)");
INSTANCE_CONFIG_INT(&m_HuntFragNum, "htn_hunt_frag_num", 18, 0, 0xFFFFFFF, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "猎人榴弹产生的破片数量(整数,默认18,限制0~268435455)");
- INSTANCE_CONFIG_INT(&m_HuntFragTrack, "htn_hunt_frag_track", 18, 0, 0xFFFFFFF, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "猎人榴弹产生的破片数量(整数,默认18,限制0~268435455)");
+ INSTANCE_CONFIG_INT(&m_HuntFragTrack, "htn_hunt_frag_track", 0, 0, 1, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "猎人榴弹破片是否追踪定向(开关,默认0,限制0~1)");
INSTANCE_CONFIG_INT(&m_Wincheckdeley, "htn_wincheck_deley", 100, 0, 0xFFFFFFF, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "终局判断延时毫秒(整数,默认100,限制0~268435455)");
INSTANCE_CONFIG_INT(&m_GameoverTime, "htn_gameover_time", 7, 0, 0xFFFFFFF, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "结算界面时长秒数(整数,默认0,限制0~268435455)");
- //INSTANCE_CONFIG_INT(&m_RoundMode, "htn_round_mode", 0, 0, 1, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "回合模式 正常0 娱乐1(整数,默认0,限制0~1)");
+ //INSTANCE_CONFIG_INT(&m_RoundMode, "htn_round_mode", 0, 0, 1, CFGFLAG_CHAT | CFGFLAG_INSTANCE, "回合模式 正常0 娱乐1(整数,默认0,限制0~1)");;
+
+ InstanceConsole()->Register("htn_map", "", CFGFLAG_CHAT | CFGFLAG_INSTANCE, ConMapAdd, this, "Maps to rotate between");
+ InstanceConsole()->Register("htn_map_add", "?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps] ?s[maps]", CFGFLAG_CHAT | CFGFLAG_INSTANCE, ConMapAdd, this, "Add a map to the maps rotation list");
+ InstanceConsole()->Register("htn_map_clear", "", CFGFLAG_CHAT | CFGFLAG_INSTANCE, ConMapClear, this, "Clear the maps rotation list");
InstanceConsole()->Register("htn_setclass", "i[class-id] ?i[CID] ?i[team-id] ?i[hunt-weapon]", CFGFLAG_CHAT | CFGFLAG_INSTANCE, ConSetClass, this, "给玩家设置职业(1平民,2猎人,4剑圣)");
InstanceConsole()->Register("htn_giveweapon", "i[weapon-id] i[slot] ?i[CID] ?i[ammo-num]", CFGFLAG_CHAT | CFGFLAG_INSTANCE, ConGiveWeapon, this, "给玩家武器");
@@ -130,6 +191,31 @@ void CGameControllerHunterN::SendChatRoom(const char *pText, int Flags)
}
}
+void CGameControllerHunterN::CycleMap()
+{
+ if(!m_Maprotation[0]) // 列表没东西
+ return;
+
+ bool CurrentMapfound = false; // 是否找到了当前地图
+
+ for(int i = 0; i < 64; ++i) // 循环所有子地图
+ {
+ if(!m_Maprotation[i]) // 列表走到了尽头 没找到可用地图
+ break;
+ else if(m_Maprotation[i] == m_MapIndex) // 是否在列表里找到了当前地图
+ CurrentMapfound = true; // 下次循环会试图寻找可用地图
+ else if(CurrentMapfound)
+ {
+ m_MapIndex = m_Maprotation[i]; // 切换地图
+ GameServer()->Teams()->ReloadGameInstance(GameWorld()->Team());
+ return;
+ }
+ }
+
+ m_MapIndex = m_Maprotation[0]; // 重置到列表第一项
+ GameServer()->Teams()->ReloadGameInstance(GameWorld()->Team());
+}
+
void CGameControllerHunterN::OnWorldReset() // 重置部分值和职业选择
{
m_GameFlags = IGF_SURVIVAL | IGF_ROUND_TIMER_ROUND | IGF_SUDDENDEATH | IGF_MARK_MATCH | IGF_MARK_AMONGUS;
@@ -140,7 +226,7 @@ void CGameControllerHunterN::OnWorldReset() // 重置部分值和职业选择
//TeamClass[0] = CLASS_CIVIC; // TEAM_RED
//TeamClass[1] = CLASS_HUNTER; // TEAM_BLUE
- int PlayerCount = 0; // 玩家计数
+ //int PlayerCount = m_aTeamSize[TEAM_RED]; // 玩家计数
int PreselectPlayerCount = 0; // 最近没当过猎人的玩家的计数
int rHunter = 0; // 猎人选择随机数
// int nHunter = 0; // 需要选择多少个猎人
@@ -156,19 +242,17 @@ void CGameControllerHunterN::OnWorldReset() // 重置部分值和职业选择
pPlayer->m_HiddenScore = 0; // 重置隐藏分
pPlayer->m_UseHunterWeapon = false; // 默认武器
pPlayer->m_Class = CLASS_CIVIC; // 重置玩家为平民
- ++PlayerCount; // 计数有PlayerCount个玩家
if(pPlayer->m_Preselect) // 猎人选择伪随机!我们要在m_Preselect的玩家里面选择猎人
++PreselectPlayerCount; // 计数有PreselectPlayerCount个玩家
}
}
- if(PlayerCount < 2)
+ if(m_aTeamSize[TEAM_RED] < 2)
{
- m_aTeamSize[TEAM_RED] = PlayerCount; // 你猜猜正常情况下没指令是怎么触发这个函数的
return;
}
- nHunter = (PlayerCount - 2) / m_HunterRatio + 1;// 我们要多少个猎人
+ nHunter = (m_aTeamSize[TEAM_RED] - 2) / m_HunterRatio + 1;// 我们要多少个猎人
str_format(HunterList, sizeof(HunterList), "本回合的 %d 个Hunter是: ", nHunter); // Generate Hunter info message 生成猎人列表消息头
SendChatRoom("——————欢迎来到HunterN猎人杀——————");
@@ -428,13 +512,14 @@ void CGameControllerHunterN::DoWincheckRound() // check for time based win
--DoWinchenkClassTick;
}
-/*void CGameControllerHunterN::DoWincheckMatch()
+void CGameControllerHunterN::DoWincheckMatch()
{
if(m_GameInfo.m_MatchNum > 0 && m_GameInfo.m_MatchCurrent >= m_GameInfo.m_MatchNum)
{
- EndMatch();
+ SetGameState(IGS_END_MATCH, m_GameoverTime); // EndMatch();
+ CycleMap();
}
-}*/
+}
int CGameControllerHunterN::OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int Weapon) // 杀手隐藏分增减 和受害人职业死亡消息 以及延时终局
{
diff --git a/src/game/server/gamemodes/huntern.h b/src/game/server/gamemodes/huntern.h
index 0696d8c4a7..9e66b2eaf5 100644
--- a/src/game/server/gamemodes/huntern.h
+++ b/src/game/server/gamemodes/huntern.h
@@ -14,12 +14,15 @@ class CGameControllerHunterN : public IGameController
int m_Wincheckdeley;
int m_GameoverTime;
//int m_RoundMode;
+public: // Maprotation
+ int m_Maprotation[64] = {0}; // 存储MapIndex的数组
public:
CGameControllerHunterN();
static void OnResetClass(CCharacter *pChr);
void SendChatRoom(const char *pText, int Flags = 3);
+ void CycleMap();
// event
void OnWorldReset() override;
@@ -32,7 +35,7 @@ class CGameControllerHunterN : public IGameController
//bool CanDeadPlayerFollow(const CPlayer *pSpectator, const CPlayer *pTarget) override { return true; }
bool CanChangeTeam(CPlayer *pPlayer, int JoinTeam) const override;
void DoWincheckRound() override;
- void DoWincheckMatch() override { ; }
+ void DoWincheckMatch() override;
int OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int Weapon) override;
private: // Intelnal function and value
diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp
index e3509d0741..9c5f42d92c 100644
--- a/src/game/server/teams.cpp
+++ b/src/game/server/teams.cpp
@@ -861,6 +861,15 @@ void CGameTeams::AddTaggedMapVote(IGameController *Controller, int Tag)
Controller->AddVote(Controller, aBuf, aBufCom);
}
}
+
+const char *CGameTeams::GetMapName(int NumMap)
+{
+ NumMap--;
+ if(NumMap >= 0 && NumMap < m_NumMaps)
+ return m_aMapNames[NumMap];
+
+ return nullptr;
+}
/* Hunter End */
int CGameTeams::GetMapIndex(const char *pMapName)
diff --git a/src/game/server/teams.h b/src/game/server/teams.h
index edbd5467a0..056a92917a 100644
--- a/src/game/server/teams.h
+++ b/src/game/server/teams.h
@@ -147,6 +147,7 @@ class CGameTeams
static void AddMap(const char *pMapName);
static void AddMapWithTag(const char *pMapName, int Tag); // Hunter
static void AddTaggedMapVote(IGameController *Controller, int Tag); // Hunter
+ const char *GetMapName(int NumMap);
static int GetMapIndex(const char *pMapName);
void UpdateGameTypeName();
From a26404d49d4aaca26be41339701e56871f90423f Mon Sep 17 00:00:00 2001
From: Hu1night <2506405864@qq.com>
Date: Wed, 21 Feb 2024 14:59:45 +0800
Subject: [PATCH 9/9] pre-release 0.3a2
---
src/game/version.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/game/version.h b/src/game/version.h
index 74d582155e..88f5629566 100644
--- a/src/game/version.h
+++ b/src/game/version.h
@@ -5,7 +5,7 @@
#ifndef GAME_RELEASE_VERSION
#define GAME_RELEASE_VERSION "15.4"
#endif
-#define GAME_VERSION "0.6.4, " GAME_RELEASE_VERSION ", 0.3a1"
+#define GAME_VERSION "0.6.4, " GAME_RELEASE_VERSION ", 0.3a2_p0"
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
#define GAME_NAME "DDNet"
#define CLIENT_VERSIONNR 15040