Skip to content

Commit

Permalink
make Disable EquipPlayer work, retake route on overpass
Browse files Browse the repository at this point in the history
  • Loading branch information
lengran committed Jun 22, 2024
1 parent 0edf6a6 commit 17655c1
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 27 deletions.
49 changes: 27 additions & 22 deletions OpenPrefirePrac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,19 +737,16 @@ private void SetupPrefireMode(CCSPlayerController player)
GenerateRandomPractice(player.Slot);
ResetBots(player.Slot);

AddTimer(0.3f, () => MovePlayer(player, false, _practices[practiceNo].Player.Position, _practices[practiceNo].Player.Rotation));
if (_defaultPlayerSettings!.EquipPlayer == 1)
{
AddTimer(0.4f, () => EquipPlayer(player));
}
AddTimer(0.45f, () => SetMoney(player, 60000));
AddTimer(0.2f, () => MovePlayer(player, false, _practices[practiceNo].Player.Position, _practices[practiceNo].Player.Rotation));
AddTimer(0.3f, () => EquipPlayer(player));
AddTimer(0.35f, () => SetMoney(player, 60000));
if (_playerStatuses[player.Slot].HealingMethod == 1 || _playerStatuses[player.Slot].HealingMethod == 5)
{
AddTimer(0.5f, () => SetPlayerHealth(player, 500));
AddTimer(0.4f, () => SetPlayerHealth(player, 500));
}
else
{
AddTimer(0.5f, () => SetPlayerHealth(player, 100)); // in case player got injured by bots before teleport
AddTimer(0.4f, () => SetPlayerHealth(player, 100)); // in case player got injured by bots before teleport
}
}

Expand Down Expand Up @@ -855,24 +852,32 @@ private void FreezeBot(CCSPlayerController? bot)
}
}

private static void EquipPlayer(CCSPlayerController player)
private void EquipPlayer(CCSPlayerController player)
{
if (player == null || !player.PawnIsAlive || player.PlayerPawn.Value == null)
return;

player.RemoveWeapons();

// Give weapons and items
player.GiveNamedItem("weapon_ak47");
player.GiveNamedItem("weapon_deagle");
player.GiveNamedItem("weapon_knife");
player.GiveNamedItem("weapon_flashbang");
player.GiveNamedItem("weapon_flashbang");
player.GiveNamedItem("weapon_smokegrenade");
player.GiveNamedItem("item_assaultsuit");

// Switch to main weapon
player.ExecuteClientCommand("slot1");
if (_defaultPlayerSettings!.EquipPlayer == 1)
{
player.RemoveWeapons();

// Give weapons and items
player.GiveNamedItem("weapon_ak47");
player.GiveNamedItem("weapon_deagle");
player.GiveNamedItem("weapon_knife");
player.GiveNamedItem("weapon_flashbang");
player.GiveNamedItem("weapon_flashbang");
player.GiveNamedItem("weapon_smokegrenade");
player.GiveNamedItem("item_assaultsuit");

// Switch to main weapon
player.ExecuteClientCommand("slot1");
}
else
{
player.GiveNamedItem("weapon_knife");
player.GiveNamedItem("item_assaultsuit");
}
}

private static void SetPlayerHealth(CCSPlayerController player, int hp)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ Finished practices:
- Clear underpass and go towards B short
- Attack A site from A long
- Attack A site from A short (mid)
- Retake B site from CT spawn
- de_anubis
- Attack B site from B main
- Attack B site from mid (B palace)
Expand Down
12 changes: 10 additions & 2 deletions ServerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,17 @@ public void LoadDefaultSettings()
BotWeapon = jsonConfig.BotWeapon;
}

BotAimLock = jsonConfig.BotAimLock;
if (jsonConfig.BotAimLock > -1 && jsonConfig.BotAimLock < 3)
{
BotAimLock = jsonConfig.BotAimLock;
}

if (jsonConfig.EquipPlayer > -1 && jsonConfig.EquipPlayer < 2)
{
EquipPlayer = jsonConfig.EquipPlayer;
}

Console.WriteLine($"[OpenPrefirePrac] Using default settings: Difficulty = {Difficulty}, TrainingMode = {TrainingMode}, BotWeapon = {BotWeapon}, BotAimLock = {BotAimLock}");
Console.WriteLine($"[OpenPrefirePrac] Using default settings: Difficulty = {Difficulty}, TrainingMode = {TrainingMode}, BotWeapon = {BotWeapon}, BotAimLock = {BotAimLock}, EquipPlayer = {EquipPlayer}");
}
catch (System.Exception)
{
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"map.de_overpass.under_to_b": "Clear underpass and go towards B short",
"map.de_overpass.a_long": "Attack A site from A long",
"map.de_overpass.a_short": "Attack A site from A short (mid)",
"map.de_overpass.retake_b": "Retake B site from CT spawn",
"map.de_anubis.b_main": "Attack B site from B main",
"map.de_anubis.mid_to_b": "Attack B site from mid (B palace)",
"map.de_anubis.water_to_b": "Attack B site from water (B connector/E-Box)",
Expand Down
1 change: 1 addition & 0 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"map.de_overpass.under_to_b": "Limpe a passagem subterrânea e siga em direção a B curto",
"map.de_overpass.a_long": "Ataque ao site A do A longo",
"map.de_overpass.a_short": "Atacar o local A a partir de A curto (médio)",
"map.de_overpass.retake_b": "Retomar o local B da desova do CT",
"map.de_anubis.b_main": "Atacar o local B a partir do local B principal",
"map.de_anubis.mid_to_b": "Ataque o local B a partir do meio (conector b)",
"map.de_anubis.water_to_b": "Atacar o local B a partir da água",
Expand Down
1 change: 1 addition & 0 deletions lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"map.de_overpass.under_to_b": "清下水道,进工地",
"map.de_overpass.a_long": "从 A 大进攻 A 包点",
"map.de_overpass.a_short": "从 A 小(厕所)进攻 A 包点",
"map.de_overpass.retake_b": "从警家回防 B 区",
"map.de_anubis.b_main": "从 B 门进攻 B 包点",
"map.de_anubis.mid_to_b": "从中路(B 连接)进攻 B 包点",
"map.de_anubis.water_to_b": "从水下黑屋进攻 B 包点",
Expand Down
2 changes: 1 addition & 1 deletion maps/de_overpass/b_long.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
b_short
b_short retake_b
8 0.8
-445.616333 -2271.078857 154.906830 -2.040501 103.789444 0.000000
-461.664673 -333.368896 20.262375000000006 -4.926423 -98.571404 0.000000 True
Expand Down
2 changes: 1 addition & 1 deletion maps/de_overpass/b_short.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
b_long
b_long retake_b
6 0.73
-445.616333 -2271.078857 164.906830 -2.040501 103.789444 0.000000
-461.664673 -333.368896 20.262375000000006 -4.926423 -98.571404 0.000000 True
Expand Down
54 changes: 54 additions & 0 deletions maps/de_overpass/retake_b.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
b_long b_short under_to_b
8 0.6
-1996.192261 435.561493 111.871246 1.627894 -125.325836 0.000000
-1686.933472 -136.862854 131.871246 -0.373998 132.274460 0.000000 False
-1894.388916 263.158600 169.556305 14.475981 -146.502029 0.000000 False
-1982.140503 -49.334778 131.871246 0.021999 85.758369 0.000000 False
-1007.254089 -331.879181 99.87124600000001 -2.046004 160.352295 0.000000 False
-1116.684326 -180.904297 103.37124600000001 -2.838001 167.765274 0.000000 False
-1181.108887 -70.298119 167.03125 2.574000 176.213425 0.000000 True
-1166.310547 6.738554 103.37124600000001 -2.838007 -174.312210 0.000000 False
-724.153381 223.449341 49.18021400000001 -3.928127 -164.100906 0.000000 False
-702.471497 -118.337708 35.26312299999999 -5.808003 -175.839447 0.000000 False
-1227.717529 278.767609 19.661018 -8.878093 -142.173660 0.000000 False
-2019.520508 -437.341919 131.871246 1.417929 73.947296 0.000000 False # off angle
-1288.031494 -137.969650 20.986603000000002 -16.996058 169.199127 0.000000 False
-1494.964355 574.433533 25.401711000000006 -6.502081 -100.212807 0.000000 False
-1572.905151 566.119751 126.28817699999999 -0.452091 -94.030754 0.000000 False
-1729.021240 49.003895 130.05304 0.229903 -14.699146 0.000000 False
-1160.472290 257.534149 35.214157 -0.572032 -179.050903 0.000000 False
-893.355835 -535.495300 99.87124600000001 2.847915 104.458710 0.000000 False
-993.692932 -608.953430 99.87124600000001 3.045913 98.959129 0.000000 False
-1166.613037 -95.670288 103.37124600000001 2.803916 83.902344 0.000000 True
-513.632629 -249.595261 14.280715999999998 -5.050072 132.096512 0.000000 False
-1106.873535 -638.969238 90.607101 -0.320073 67.041451 0.000000 False
-587.968750 -333.968750 15.233626999999998 -0.056072 91.511818 0.000000 False
-515.980042 391.968719 7.718924999999999 -6.656067 -128.127182 0.000000 False
-1148.827393 -638.967163 69.626282 -5.072043 49.755756 0.000000 False
-1260.708618 -695.230164 14.664985999999999 -9.252042 39.349785 0.000000 False
-856.031250 -539.228638 99.87124600000001 1.329954 153.367691 0.000000 False
-1468.029419 -477.997559 8.549103000000002 -9.538072 -6.902410 0.000000 False
-1256.487793 -760.436218 14.903732000000005 -9.450089 71.417778 0.000000 False
-1457.294189 -344.028931 24.097282000000007 2.122131 -87.707993 0.000000 False
-2088.252441 230.760559 140.871231
-1915.886353 130.633667 140.871246
-1833.555176 -142.917419 140.871246
-1551.370972 -83.173950 140.871246
-1560.132080 3.924902 140.871246
-1541.722412 109.192825 100.90803500000001
-1478.730469 177.780243 60.913177000000005
-1424.338867 231.174500 33.305496000000005
-1337.402710 311.975830 23.189635999999993
-1209.189209 327.606384 29.307404000000005
-1161.455078 318.345917 43.143585
-1026.283569 309.154510 108.70611600000001
-838.368408 300.040039 108.87124600000001
-627.017151 256.819092 19.04155
-661.800049 -65.612000 33.246216000000004
-833.310181 -75.773857 108.87124600000001
-953.321106 -128.051941 108.87124600000001
-958.776428 -571.357361 108.87124600000001
-1074.944702 -573.154053 108.87124600000001
-1244.415283 -567.679504 41.533294999999995
-1347.968506 -567.103333 22.532332999999994
-1471.842285 -566.545593 16.238663000000003
2 changes: 1 addition & 1 deletion maps/de_overpass/under_to_b.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
under_to_b b_short b_long a_long
under_to_b b_short b_long a_long retake_b
7 0.9
-952.172852 -2175.865723 314.152771 -0.096173 170.753220 0.000000
-1862.728882 -908.031250 131.03125 1.752099 -81.939896 0.000000 False
Expand Down

0 comments on commit 17655c1

Please sign in to comment.