forked from ReviveNetwork/ASP
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from startersclan/enhancement/add-src-python-f…
…iles-from-https-github.com-startersclan-statspython Enhancement: Add `src/python` files from https://github.com/startersclan/StatsPython 3.2.0 commit 5497f4b8bd99879f7f13248abccfd7aaee10c670
- Loading branch information
Showing
24 changed files
with
7,220 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/src/python/bf2/logs/*.log | ||
/src/python/bf2/logs/snapshots/sent/*.json | ||
/src/python/bf2/logs/snapshots/unsent/*.json |
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 @@ | ||
logs/*.log |
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,69 @@ | ||
# ------------------------------------------------------------------------------ | ||
# BF2Statistics 3.0.0 - Config File | ||
# ------------------------------------------------------------------------------ | ||
# Conventions: | ||
# 0 -> Disable | ||
# 1 -> Enable | ||
# ------------------------------------------------------------------------------ | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Debug Logging | ||
# ------------------------------------------------------------------------------ | ||
debug_enable = 1 | ||
debug_log_path = 'python/bf2/logs' # Relative from BF2 base folder | ||
debug_fraglog_enable = 0 # Detailed 'Fragalyzer' Logs (requires existing folder "mods/<ModName>/logs/") | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Statistics Enabling | ||
# ------------------------------------------------------------------------------ | ||
# 0 = disable statistics, 1 = enable statistics (requires an ASP stats server) | ||
# By disabling the stats, this server will be "non-ranked" | ||
# | ||
# An AuthID and AuthToken are required to post stats data to the ASP backend. | ||
# Contact your local Stats Admin to recieve an AuthID and AuthToken. Both of | ||
# which are NOT to be shared with anyone! | ||
# ------------------------------------------------------------------------------ | ||
stats_enable = 1 | ||
stats_auth_id = 112960 # Required to post stats data at the end of round. | ||
stats_auth_token = '2GS61JLR2WQq2n6N' # Required to post stats data at the end of round. | ||
|
||
# ------------------------------------------------------------------------------ | ||
# ASP Stats Backend Web Server | ||
# ------------------------------------------------------------------------------ | ||
http_backend_addr = '127.0.0.1' | ||
http_backend_port = 80 | ||
http_backend_asp = '/ASP/bf2statistics.php' | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Snapshot Logging | ||
# ------------------------------------------------------------------------------ | ||
# Enables server to make snapshot backups. | ||
# 0 = log only on error sending to backend | ||
# 1 = all snapshots | ||
# ------------------------------------------------------------------------------ | ||
snapshot_logging = 0 | ||
snapshot_log_path_sent = 'python/bf2/logs/snapshots/sent' # Relative from the BF2 base folder | ||
snapshot_log_path_unsent = 'python/bf2/logs/snapshots/unsent' # Relative from the BF2 base folder | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Medals Processing | ||
# ------------------------------------------------------------------------------ | ||
# Suffix for your custom medals file(s). | ||
# Example: A profile named "custom" = medal_data_custom.py | ||
# ------------------------------------------------------------------------------ | ||
medals_custom_data = 'custom' | ||
# A list of mods that xpack (special forces) medals can be earned while playing | ||
# Example: ['mods/xpack', 'mods/bf2', 'mods/ModName'] (all entries must be lower case!!) | ||
medals_xpack_mods = ['mods/bf2sfsp','mods/xpack'] | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Player Manager | ||
# ------------------------------------------------------------------------------ | ||
# Local IP address for AI Bots | ||
# ------------------------------------------------------------------------------ | ||
pm_ai_player_addr = '127.0.0.1' # Not recommended to change | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# END CONFIGURATION | ||
# ------------------------------------------------------------------------------ |
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,72 @@ | ||
# game logic | ||
|
||
|
||
import host | ||
|
||
class GameLogic: | ||
def __init__(self): | ||
print "GameLogic created" | ||
|
||
def getModDir(self): return host.sgl_getModDirectory() | ||
def getMapName(self): return host.sgl_getMapName() | ||
def getWorldSize(self): return host.sgl_getWorldSize() | ||
def getTeamName(self, team): return host.sgl_getParam('teamName', team, 0) | ||
def isAIGame(self): return host.sgl_getIsAIGame() | ||
|
||
def sendClientCommand(self, playerId, command, args): return host.sgl_sendPythonEvent(playerId, command, args) | ||
def sendGameEvent(self, player, event, data): return host.sgl_sendGameLogicEvent(player.index, event, data) | ||
def sendMedalEvent(self, player, type, value): return host.sgl_sendMedalEvent(player.index, type, value) | ||
def sendRankEvent(self, player, rank, score): return host.sgl_sendRankEvent(player.index, rank, score) | ||
def sendHudEvent(self, player, event, data): return host.sgl_sendHudEvent(player.index, event, data) | ||
|
||
def sendServerMessage(self, playerId, message): return host.sgl_sendTextMessage(playerId, 10, 1, message) | ||
|
||
def getTicketState(self, team): return host.sgl_getParam('ticketState', team, 0) | ||
def setTicketState(self, team, value): return host.sgl_setParam('ticketState', team, value, 0) | ||
|
||
def getTickets(self, team): return host.sgl_getParam('tickets', team, 0) | ||
def setTickets(self, team, value): return host.sgl_setParam('tickets', team, value, 0) | ||
|
||
def getDefaultTickets(self, team): return host.sgl_getParam('startTickets', team, 0) | ||
|
||
def getTicketChangePerSecond(self, team): return host.sgl_getParam('ticketChangePerSecond', team, 0, 0) | ||
def setTicketChangePerSecond(self, team, value): return host.sgl_setParam('ticketChangePerSecond', team, value, 0) | ||
|
||
def getTicketLimit(self, team, id): return host.sgl_getParam('ticketLimit', team, id) | ||
def setTicketLimit(self, team, id, value): return host.sgl_setParam('ticketLimit', team, id, value) | ||
|
||
def getDefaultTicketLossPerMin(self, team): return host.sgl_getParam('defaultTicketLossPerMin', team, 0) | ||
def getDefaultTicketLossAtEndPerMin(self): return host.sgl_getParam('defaultTicketLossAtEndPerMin', 0, 0) | ||
|
||
def getWinner(self): return host.sgl_getParam('winner', 0, 0) | ||
def getVictoryType(self): return host.sgl_getParam('victoryType', 0, 0) | ||
|
||
def setHealPointLimit(self, value): return host.sgl_setParam('healScoreLimit', 0, value, 0) | ||
def setRepairPointLimit(self, value): return host.sgl_setParam('repairScoreLimit', 0, value, 0) | ||
def setGiveAmmoPointLimit(self, value): return host.sgl_setParam('giveAmmoScoreLimit', 0, value, 0) | ||
def setTeamDamagePointLimit(self, value): return host.sgl_setParam('teamDamageScoreLimit', 0, value, 0) | ||
def setTeamVehicleDamagePointLimit(self, value): return host.sgl_setParam('teamVehicleDamageScoreLimit', 0, value, 0) | ||
|
||
|
||
class ServerSettings: | ||
def __init__(self): | ||
print "Serversettings created" | ||
|
||
def getTicketRatio(self): return host.ss_getParam('ticketRatio') | ||
def getTeamRatioPercent(self): return host.ss_getParam('teamRatioPct') | ||
def getMaxPlayers(self): return host.ss_getParam('maxPlayers') | ||
def getGameMode(self): return host.ss_getParam('gameMode') | ||
def getMapName(self): return host.ss_getParam('mapName') | ||
def getTimeLimit(self): return host.ss_getParam('timeLimit') | ||
def getScoreLimit(self): return host.ss_getParam('scoreLimit') | ||
def getAutoBalanceTeam(self): return host.ss_getParam('autoBalance') | ||
def getTKPunishEnabled(self): return host.ss_getParam('tkpEnabled') | ||
def getTKNumPunishToKick(self): return host.ss_getParam('tkpNeeded') | ||
def getTKPunishByDefault(self): return host.ss_getParam('tkpDefault') | ||
|
||
def getUseGlobalRank(self): return host.ss_getParam('globRank') | ||
def getUseGlobalUnlocks(self): return host.ss_getParam('globUnlocks') | ||
|
||
def getServerConfig(self, variableName): | ||
return host.rcon_invoke(variableName).strip() | ||
|
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,20 @@ | ||
import host | ||
|
||
|
||
class ObjectManager: | ||
def __init__(self): | ||
print "ObjectManager created" | ||
|
||
def getObjectsOfType(self, type): | ||
return host.omgr_getObjectsOfType(type) | ||
|
||
def getObjectsOfTemplate(self, templ): | ||
return host.omgr_getObjectsOfTemplate(templ) | ||
|
||
def getRootParent(self, obj): | ||
parent = obj.getParent() | ||
|
||
if parent == None: | ||
return obj | ||
|
||
return self.getRootParent(parent) |
Oops, something went wrong.