-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a pretty straight forward port of https://github.com/cemathey/hll_seed_vip to run as a service inside of CRCON itself. Made some minor tweaks since it can access info internally instead of using the API. This runs as a separate service (like all the other plugins) Has a user config and updated menu For future reference, this possible languages that can be used when using `humanize` to nicely format date/time quantities: https://github.com/MarechJ/hll_rcon_tool/wiki/Seed-VIP-Localization
- Loading branch information
Showing
29 changed files
with
1,762 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from datetime import datetime, timedelta | ||
from logging import getLogger | ||
|
||
import pydantic | ||
|
||
from rcon.maps import Layer | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
class BaseCondition(pydantic.BaseModel): | ||
def is_met(self): | ||
raise NotImplementedError | ||
|
||
|
||
class PlayerCountCondition(BaseCondition): | ||
faction: str | ||
min_players: int = pydantic.Field(ge=0, le=50) | ||
max_players: int = pydantic.Field(ge=0, le=50) | ||
|
||
current_players: int = pydantic.Field(ge=0, le=50) | ||
|
||
def is_met(self): | ||
return self.min_players <= self.current_players <= self.max_players | ||
|
||
|
||
class PlayTimeCondition(BaseCondition): | ||
# This is constrained on the user config side | ||
min_time_secs: int = pydantic.Field() | ||
# This should be constrained to ge=0 but CRCON will sometimes | ||
# report players with negative play time | ||
current_time_secs: int = pydantic.Field() | ||
|
||
def is_met(self): | ||
return self.current_time_secs >= self.min_time_secs | ||
|
||
|
||
class GameState(pydantic.BaseModel): | ||
num_allied_players: int | ||
num_axis_players: int | ||
allied_score: int | ||
axis_score: int | ||
raw_time_remaining: str | ||
time_remaining: timedelta | ||
current_map: Layer | ||
next_map: Layer | ||
|
||
|
||
class Player(pydantic.BaseModel): | ||
name: str | ||
player_id: str | ||
current_playtime_seconds: int | ||
|
||
|
||
class VipPlayer(pydantic.BaseModel): | ||
player: Player | ||
expiration_date: datetime | None | ||
|
||
|
||
class ServerPopulation(pydantic.BaseModel): | ||
players: dict[str, Player] |
Oops, something went wrong.