Skip to content

Commit

Permalink
Merge pull request #176 from shobhit-pathak/dev
Browse files Browse the repository at this point in the history
v0.7.12
  • Loading branch information
shobhit-pathak authored Jun 27, 2024
2 parents adb0c82 + 91e3c8a commit 89fcbd1
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 64 deletions.
10 changes: 10 additions & 0 deletions DemoManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ public async Task UploadDemoAsync(string? demoPath, long matchId, int mapNumber)
{
Log($"[UploadDemoAsync ERROR] Failed to upload file. Status code: {response.StatusCode} Response: {await response.Content.ReadAsStringAsync()}");
}

var demoUploadedEvent = new MatchZyDemoUploadedEvent
{
MatchId = matchId,
MapNumber = mapNumber,
FileName = Path.GetFileName(demoPath),
Success = response.IsSuccessStatusCode
};
await SendEventAsync(demoUploadedEvent);

}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public HookResult EventDecoyDetonateHandler(EventDecoyDetonate @event, GameEvent
if (!IsPlayerValid(player)) return HookResult.Continue;
if(lastGrenadeThrownTime.TryGetValue(@event.Entityid, out var thrownTime))
{
PrintToPlayerChat(player!, Localizer["matchzy.pracc.decop", player!.PlayerName, $"{(DateTime.Now - thrownTime).TotalSeconds:0.00}"]);
PrintToPlayerChat(player!, Localizer["matchzy.pracc.decoy", player!.PlayerName, $"{(DateTime.Now - thrownTime).TotalSeconds:0.00}"]);
lastGrenadeThrownTime.Remove(@event.Entityid);
}
return HookResult.Continue;
Expand Down
18 changes: 17 additions & 1 deletion Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public MatchZyEvent(string eventName)
public class MatchZyMatchEvent : MatchZyEvent
{
[JsonPropertyName("matchid")]
public required string MatchId { get; init; }
public required long MatchId { get; init; }

protected MatchZyMatchEvent(string eventName) : base(eventName)
{
Expand Down Expand Up @@ -220,3 +220,19 @@ public MatchZySidePickedEvent() : base("side_picked")
{
}
}

public class MatchZyDemoUploadedEvent : MatchZyMatchEvent
{
[JsonPropertyName("map_number")]
public required int MapNumber { get; init; }

[JsonPropertyName("filename")]
public required string FileName { get; init; }

[JsonPropertyName("success")]
public bool Success { get; set; }

public MatchZyDemoUploadedEvent() : base("demo_upload_ended")
{
}
}
6 changes: 3 additions & 3 deletions MapVeto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public bool PickMap(string mapName, int team) {

var mapPickedEvent = new MatchZyMapPickedEvent
{
MatchId = liveMatchId.ToString(),
MatchId = liveMatchId,
MapName = mapRemovedName,
MapNumber = matchConfig.Maplist.Count,
Team = (matchzyTeam == matchzyTeam1) ? "team1" : "team2",
Expand Down Expand Up @@ -282,7 +282,7 @@ public bool BanMap(string mapName, int team)

var mapMapVetoedEvent = new MatchZyMapVetoedEvent
{
MatchId = liveMatchId.ToString(),
MatchId = liveMatchId,
MapName = mapRemovedName,
Team = (matchzyTeam == matchzyTeam1) ? "team1" : "team2",
};
Expand Down Expand Up @@ -533,7 +533,7 @@ public void PickSide(CsTeam side, string team) {

var sidePickedEvent = new MatchZySidePickedEvent
{
MatchId = liveMatchId.ToString(),
MatchId = liveMatchId,
MapName = mapName,
MapNumber = matchConfig.Maplist.Count,
Team = (matchzyTeam == matchzyTeam1) ? "team1" : "team2",
Expand Down
4 changes: 2 additions & 2 deletions MatchManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public bool LoadMatchFromJSON(string jsonData)

var seriesStartedEvent = new MatchZySeriesStartedEvent
{
MatchId = liveMatchId.ToString(),
MatchId = liveMatchId,
NumberOfMaps = matchConfig.NumMaps,
Team1 = new(matchzyTeam1.id, matchzyTeam1.teamName),
Team2 = new(matchzyTeam2.id, matchzyTeam2.teamName),
Expand Down Expand Up @@ -586,7 +586,7 @@ public void EndSeries(string? winnerName, int restartDelay, int t1score, int t2s

var seriesResultEvent = new MatchZySeriesResultEvent()
{
MatchId = matchId.ToString(),
MatchId = matchId,
Winner = new Winner(t1score > t2score && reverseTeamSides["CT"] == matchzyTeam1 ? "3" : "2", winnerTeam),
Team1SeriesScore = team1Score,
Team2SeriesScore = team2Score,
Expand Down
2 changes: 1 addition & 1 deletion MatchZy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class MatchZy : BasePlugin
{

public override string ModuleName => "MatchZy";
public override string ModuleVersion => "0.7.11";
public override string ModuleVersion => "0.7.12";

public override string ModuleAuthor => "WD- (https://github.com/shobhit-pathak/)";

Expand Down
2 changes: 1 addition & 1 deletion MatchZy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.233">
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.245">
<PrivateAssets>none</PrivateAssets>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion PracticeMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ public void ExecDryRunCFG()
} else {
Log($"[ExecDryRunCFG] Starting Dryrun! Dryrun CFG not found in {absolutePath}, using default CFG!");
Server.ExecuteCommand("ammo_grenade_limit_default 1;ammo_grenade_limit_flashbang 2;ammo_grenade_limit_total 4;bot_quota 0;cash_player_bomb_defused 300;cash_player_bomb_planted 300;cash_player_damage_hostage -30;cash_player_interact_with_hostage 300;cash_player_killed_enemy_default 300;cash_player_killed_enemy_factor 1;cash_player_killed_hostage -1000;cash_player_killed_teammate -300;cash_player_rescued_hostage 1000;cash_team_elimination_bomb_map 3250;cash_team_elimination_hostage_map_ct 3000;cash_team_elimination_hostage_map_t 3000;cash_team_hostage_alive 0;cash_team_hostage_interaction 600;cash_team_loser_bonus 1400;cash_team_loser_bonus_consecutive_rounds 500;cash_team_planted_bomb_but_defused 800;cash_team_rescued_hostage 600;cash_team_terrorist_win_bomb 3500;cash_team_win_by_defusing_bomb 3500;");
Server.ExecuteCommand("cash_team_win_by_hostage_rescue 2900;cash_team_win_by_time_running_out_bomb 3250;cash_team_win_by_time_running_out_hostage 3250;ff_damage_reduction_bullets 0.33;ff_damage_reduction_grenade 0.85;ff_damage_reduction_grenade_self 1;ff_damage_reduction_other 0.4;mp_afterroundmoney 0;mp_autokick 0;mp_autoteambalance 0;mp_backup_restore_load_autopause 1;mp_backup_round_auto 1;mp_buy_anywhere 0;mp_buy_during_immunity 0;mp_buytime 20;mp_c4timer 40;mp_ct_default_melee weapon_knife;mp_ct_default_primary \"\";mp_ct_default_secondary weapon_hkp2000;mp_death_drop_defuser 1;mp_death_drop_grenade 2;mp_death_drop_gun 1;mp_defuser_allocation 0;mp_display_kill_assists 1;mp_endmatch_votenextmap 0;mp_forcecamera 1;mp_free_armor 0;mp_freezetime 6;mp_friendlyfire 1;mp_give_player_c4 1;mp_halftime 1;mp_halftime_duration 15;mp_halftime_pausetimer 0;mp_ignore_round_win_conditions 0;mp_limitteams 0;mp_match_can_clinch 1;mp_match_end_restart 0;mp_maxmoney 16000;mp_maxrounds 24;mp_molotovusedelay 0;mp_overtime_enable 1;mp_overtime_halftime_pausetimer 0;mp_overtime_maxrounds 6;mp_overtime_startmoney 10000;mp_playercashawards 1;mp_randomspawn 0;mp_respawn_immunitytime 0;mp_respawn_on_death_ct 0;mp_respawn_on_death_t 0;mp_round_restart_delay 5;mp_roundtime 1.92;mp_roundtime_defuse 1.92;mp_roundtime_hostage 1.92;mp_solid_teammates 1;mp_starting_losses 1;mp_startmoney 16000;mp_t_default_melee weapon_knife;mp_t_default_primary \"\";mp_t_default_secondary weapon_glock;mp_teamcashawards 1;mp_timelimit 0;mp_weapons_allow_map_placed 1;mp_weapons_allow_zeus 1;mp_weapons_glow_on_ground 0;mp_win_panel_display_time 3;occlusion_test_async 0;spec_freeze_deathanim_time 0;spec_freeze_panel_extended_time 0;spec_freeze_time 2;spec_freeze_time_lock 2;spec_replay_enable 0;sv_allow_votes 1;sv_auto_full_alltalk_during_warmup_half_end 0;sv_coaching_enabled 1;sv_competitive_official_5v5 1;sv_damage_print_enable 0;sv_deadtalk 1;sv_hibernate_postgame_delay 300;sv_holiday_mode 0;sv_ignoregrenaderadio 0;sv_infinite_ammo 0;sv_occlude_players 1;sv_talk_enemy_dead 0;sv_talk_enemy_living 0;sv_voiceenable 1;tv_relayvoice 1;mp_team_timeout_max 4;mp_team_timeout_time 30;sv_vote_command_delay 0;cash_team_bonus_shorthanded 0;cash_team_loser_bonus_shorthanded 0;mp_spectators_max 20;mp_team_intro_time 0;mp_restartgame 3;mp_warmup_end;");
Server.ExecuteCommand("cash_team_win_by_hostage_rescue 2900;cash_team_win_by_time_running_out_bomb 3250;cash_team_win_by_time_running_out_hostage 3250;ff_damage_reduction_bullets 0.33;ff_damage_reduction_grenade 0.85;ff_damage_reduction_grenade_self 1;ff_damage_reduction_other 0.4;mp_afterroundmoney 0;mp_autokick 0;mp_autoteambalance 0;mp_backup_restore_load_autopause 1;mp_backup_round_auto 1;mp_buy_anywhere 0;mp_buy_during_immunity 0;mp_buytime 20;mp_c4timer 40;mp_ct_default_melee weapon_knife;mp_ct_default_primary \"\";mp_ct_default_secondary weapon_hkp2000;mp_death_drop_defuser 1;mp_death_drop_grenade 2;mp_death_drop_gun 1;mp_defuser_allocation 0;mp_display_kill_assists 1;mp_endmatch_votenextmap 0;mp_forcecamera 1;mp_free_armor 0;mp_freezetime 6;mp_friendlyfire 1;mp_give_player_c4 1;mp_halftime 1;mp_halftime_duration 15;mp_halftime_pausetimer 0;mp_ignore_round_win_conditions 0;mp_limitteams 0;mp_match_can_clinch 1;mp_match_end_restart 0;mp_maxmoney 16000;mp_maxrounds 24;mp_overtime_enable 1;mp_overtime_halftime_pausetimer 0;mp_overtime_maxrounds 6;mp_overtime_startmoney 10000;mp_playercashawards 1;mp_randomspawn 0;mp_respawn_immunitytime 0;mp_respawn_on_death_ct 0;mp_respawn_on_death_t 0;mp_round_restart_delay 5;mp_roundtime 1.92;mp_roundtime_defuse 1.92;mp_roundtime_hostage 1.92;mp_solid_teammates 1;mp_starting_losses 1;mp_startmoney 16000;mp_t_default_melee weapon_knife;mp_t_default_primary \"\";mp_t_default_secondary weapon_glock;mp_teamcashawards 1;mp_timelimit 0;mp_weapons_allow_map_placed 1;mp_weapons_allow_zeus 1;mp_win_panel_display_time 3;spec_freeze_deathanim_time 0;spec_freeze_time 2;spec_freeze_time_lock 2;spec_replay_enable 0;sv_allow_votes 1;sv_auto_full_alltalk_during_warmup_half_end 0;sv_damage_print_enable 0;sv_deadtalk 1;sv_hibernate_postgame_delay 300;sv_ignoregrenaderadio 0;sv_infinite_ammo 0;sv_talk_enemy_dead 0;sv_talk_enemy_living 0;sv_voiceenable 1;tv_relayvoice 1;mp_team_timeout_max 4;mp_team_timeout_time 30;sv_vote_command_delay 0;cash_team_bonus_shorthanded 0;mp_spectators_max 20;mp_team_intro_time 0;mp_restartgame 3;mp_warmup_end;");
}
}

Expand Down
2 changes: 1 addition & 1 deletion PublishEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task SendEventAsync(MatchZyEvent @event)

Log($"[SendEventAsync] SENDING DATA: {jsonString}");

if (!string.IsNullOrEmpty(matchConfig.RemoteLogHeaderKey))
if (!string.IsNullOrEmpty(matchConfig.RemoteLogHeaderKey) && !string.IsNullOrEmpty(matchConfig.RemoteLogHeaderValue))
{
httpClient.DefaultRequestHeaders.Add(matchConfig.RemoteLogHeaderKey, matchConfig.RemoteLogHeaderValue);
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MatchZy is a plugin for CS2 (Counter Strike 2) for running and managing practice

[![Discord](https://discordapp.com/api/guilds/1169549878490304574/widget.png?style=banner2)](https://discord.gg/2zvhy9m7qg)

## Feature Highligts:
## Feature Highlights:

* Pug mode with simple commands to manage!
* Support of [Get5 Panel!](https://shobhit-pathak.github.io/MatchZy/get5/)
Expand Down
Loading

0 comments on commit 89fcbd1

Please sign in to comment.