.BANCHO. pep.py modules
This commit is contained in:
parent
993079d2dd
commit
9325578377
|
@ -1,7 +1,7 @@
|
|||
""" Contains functions used to read specific client packets from byte stream """
|
||||
import dataTypes
|
||||
import packetHelper
|
||||
import slotStatuses
|
||||
from constants import dataTypes
|
||||
from helpers import packetHelper
|
||||
from constants import slotStatuses
|
||||
|
||||
|
||||
""" General packets """
|
|
@ -1,11 +1,11 @@
|
|||
import fokabot
|
||||
from objects import fokabot
|
||||
import random
|
||||
import glob
|
||||
import serverPackets
|
||||
import exceptions
|
||||
import userHelper
|
||||
from objects import glob
|
||||
from constants import serverPackets
|
||||
from constants import exceptions
|
||||
from helpers import userHelper
|
||||
import time
|
||||
import systemHelper
|
||||
from helpers import systemHelper
|
||||
|
||||
"""
|
||||
Commands callbacks
|
|
@ -1,12 +1,12 @@
|
|||
""" Contains functions used to write specific server packets to byte streams """
|
||||
import packetHelper
|
||||
import dataTypes
|
||||
import userHelper
|
||||
import glob
|
||||
import userRanks
|
||||
import packetIDs
|
||||
import slotStatuses
|
||||
import matchModModes
|
||||
from helpers import packetHelper
|
||||
from constants import dataTypes
|
||||
from helpers import userHelper
|
||||
from objects import glob
|
||||
from constants import userRanks
|
||||
from constants import packetIDs
|
||||
from constants import slotStatuses
|
||||
from constants import matchModModes
|
||||
import random
|
||||
|
||||
""" Login errors packets
|
|
@ -1,8 +1,8 @@
|
|||
import glob
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import serverPackets
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import exceptions
|
||||
from constants import exceptions
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# get usertoken data
|
|
@ -1,8 +1,8 @@
|
|||
import glob
|
||||
import clientPackets
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
from constants import actions
|
||||
import userHelper
|
||||
from helpers import userHelper
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get usertoken data
|
|
@ -1,6 +1,6 @@
|
|||
import glob
|
||||
import clientPackets
|
||||
import matchModModes
|
||||
from objects import glob
|
||||
from constants import clientPackets
|
||||
from constants import matchModModes
|
||||
from constants import mods
|
||||
|
||||
def handle(userToken, packetData):
|
|
@ -1,5 +1,5 @@
|
|||
import clientPackets
|
||||
import glob
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Read packet data. Same structure as changeMatchSettings
|
|
@ -1,12 +1,12 @@
|
|||
import glob
|
||||
import clientPackets
|
||||
import matchModModes
|
||||
from objects import glob
|
||||
from constants import clientPackets
|
||||
from constants import matchModModes
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import random
|
||||
import matchTeamTypes
|
||||
import matchTeams
|
||||
import slotStatuses
|
||||
from constants import matchTeamTypes
|
||||
from constants import matchTeams
|
||||
from constants import slotStatuses
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Read new settings
|
|
@ -1,5 +1,5 @@
|
|||
import clientPackets
|
||||
import glob
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
Event called when someone joins a channel
|
||||
"""
|
||||
|
||||
import clientPackets
|
||||
from constants import clientPackets
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import serverPackets
|
||||
import glob
|
||||
import exceptions
|
||||
from constants import serverPackets
|
||||
from objects import glob
|
||||
from constants import exceptions
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Channel join packet
|
|
@ -4,9 +4,9 @@ Event called when someone parts a channel
|
|||
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import glob
|
||||
import clientPackets
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Channel part packet
|
|
@ -1,10 +1,10 @@
|
|||
import serverPackets
|
||||
import clientPackets
|
||||
import glob
|
||||
from constants import serverPackets
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import joinMatchEvent
|
||||
import exceptions
|
||||
from events import joinMatchEvent
|
||||
from constants import exceptions
|
||||
|
||||
def handle(userToken, packetData):
|
||||
try:
|
|
@ -1,5 +1,5 @@
|
|||
import userHelper
|
||||
import clientPackets
|
||||
from helpers import userHelper
|
||||
from constants import clientPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Friend add packet
|
|
@ -1,5 +1,5 @@
|
|||
import userHelper
|
||||
import clientPackets
|
||||
from helpers import userHelper
|
||||
from constants import clientPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Friend remove packet
|
|
@ -1,5 +1,5 @@
|
|||
import serverPackets
|
||||
import glob
|
||||
from constants import serverPackets
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import clientPackets
|
||||
import serverPackets
|
||||
import glob
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import exceptions
|
||||
from constants import exceptions
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# read packet data
|
|
@ -1,14 +1,14 @@
|
|||
import userHelper
|
||||
import serverPackets
|
||||
import exceptions
|
||||
import glob
|
||||
from helpers import userHelper
|
||||
from constants import serverPackets
|
||||
from constants import exceptions
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import locationHelper
|
||||
import countryHelper
|
||||
from helpers import locationHelper
|
||||
from helpers import countryHelper
|
||||
import time
|
||||
import generalFunctions
|
||||
import channelJoinEvent
|
||||
from helpers import generalFunctions
|
||||
from events import channelJoinEvent
|
||||
import sys
|
||||
import traceback
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import serverPackets
|
||||
from constants import serverPackets
|
||||
import time
|
||||
|
||||
def handle(userToken, _):
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData, has):
|
||||
# Get usertoken data
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, _):
|
||||
# Read token data
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get usertoken data
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, _):
|
||||
# Get usertoken data
|
|
@ -1,6 +1,6 @@
|
|||
import glob
|
||||
import slotStatuses
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import slotStatuses
|
||||
from constants import serverPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get usertoken data
|
|
@ -1,3 +1,3 @@
|
|||
import matchBeatmapEvent
|
||||
from events import matchBeatmapEvent
|
||||
def handle(userToken, packetData):
|
||||
matchBeatmapEvent.handle(userToken, packetData, True)
|
|
@ -1,5 +1,5 @@
|
|||
import clientPackets
|
||||
import glob
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Read token and packet data
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import clientPackets
|
||||
from objects import glob
|
||||
from constants import clientPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get token data
|
|
@ -1,3 +1,3 @@
|
|||
import matchBeatmapEvent
|
||||
from events import matchBeatmapEvent
|
||||
def handle(userToken, packetData):
|
||||
matchBeatmapEvent.handle(userToken, packetData, False)
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get userToken data
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, _):
|
||||
# Get usertoken data
|
|
@ -1,4 +1,4 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get userToken data
|
|
@ -1,6 +1,6 @@
|
|||
import glob
|
||||
import slotStatuses
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import slotStatuses
|
||||
from constants import serverPackets
|
||||
|
||||
def handle(userToken, _):
|
||||
# TODO: Host check
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import clientPackets
|
||||
from objects import glob
|
||||
from constants import clientPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# Get packet data
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import channelPartEvent
|
||||
from objects import glob
|
||||
from events import channelPartEvent
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import serverPackets
|
||||
|
||||
def handle(userToken, _):
|
||||
# get data from usertoken
|
|
@ -1,11 +1,11 @@
|
|||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import clientPackets
|
||||
import serverPackets
|
||||
import glob
|
||||
import fokabot
|
||||
import exceptions
|
||||
import messageTemplates
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
from objects import glob
|
||||
from objects import fokabot
|
||||
from constants import exceptions
|
||||
from constants import messageTemplates
|
||||
|
||||
def handle(userToken, packetData):
|
||||
"""
|
|
@ -1,10 +1,10 @@
|
|||
import exceptions
|
||||
import clientPackets
|
||||
import glob
|
||||
import fokabot
|
||||
from constants import exceptions
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
from objects import fokabot
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import serverPackets
|
||||
from constants import serverPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
"""
|
|
@ -1,5 +1,5 @@
|
|||
import clientPackets
|
||||
import serverPackets
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# get token data
|
|
@ -1,8 +1,8 @@
|
|||
import glob
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import serverPackets
|
||||
import exceptions
|
||||
from constants import serverPackets
|
||||
from constants import exceptions
|
||||
|
||||
def handle(userToken, packetData):
|
||||
# get token data
|
|
@ -1,10 +1,10 @@
|
|||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import clientPackets
|
||||
import serverPackets
|
||||
import exceptions
|
||||
import glob
|
||||
import userHelper
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
from constants import exceptions
|
||||
from objects import glob
|
||||
from helpers import userHelper
|
||||
|
||||
def handle(userToken, packetData):
|
||||
try:
|
|
@ -1,8 +1,8 @@
|
|||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import glob
|
||||
import serverPackets
|
||||
import exceptions
|
||||
from objects import glob
|
||||
from constants import serverPackets
|
||||
from constants import exceptions
|
||||
|
||||
def handle(userToken, _):
|
||||
try:
|
|
@ -3,8 +3,8 @@ WIP feature that will come in the future.
|
|||
Don't import
|
||||
"""
|
||||
import flask
|
||||
import glob
|
||||
import exceptions
|
||||
from objects import glob
|
||||
from constants import exceptions
|
||||
|
||||
@app.route("/api/online-users-count")
|
||||
def APIonlineUsersCount():
|
|
@ -1,7 +1,7 @@
|
|||
"""Some console related functions"""
|
||||
|
||||
from constants import bcolors
|
||||
import glob
|
||||
from objects import glob
|
||||
|
||||
def printServerStartHeader(asciiArt):
|
||||
"""Print server start header with optional ascii art
|
||||
|
|
|
@ -2,7 +2,7 @@ import pymysql
|
|||
from constants import bcolors
|
||||
from helpers import consoleHelper
|
||||
import threading
|
||||
import glob
|
||||
from objects import glob
|
||||
|
||||
class db:
|
||||
"""A MySQL database connection"""
|
|
@ -1,5 +1,5 @@
|
|||
import struct
|
||||
import dataTypes
|
||||
from constants import dataTypes
|
||||
|
||||
def uleb128Encode(num):
|
||||
"""
|
|
@ -1,4 +1,4 @@
|
|||
import crypt
|
||||
from helpers import cryptHelper
|
||||
import base64
|
||||
import bcrypt
|
||||
|
||||
|
@ -12,24 +12,24 @@ def checkOldPassword(password, salt, rightPassword):
|
|||
return -- bool
|
||||
"""
|
||||
|
||||
return (rightPassword == crypt.crypt(password, "$2y$"+str(base64.b64decode(salt))))
|
||||
return (rightPassword == cryptHelper.crypt(password, "$2y$"+str(base64.b64decode(salt))))
|
||||
|
||||
def checkNewPassword(password, dbPassword):
|
||||
"""
|
||||
Check if a password (version 2) is right.
|
||||
|
||||
|
||||
password -- input password
|
||||
dbPassword -- the password in the database
|
||||
return -- bool
|
||||
"""
|
||||
password = password.encode("utf8")
|
||||
dbPassword = dbPassword.encode("utf8")
|
||||
dbPassword = dbPassword.encode("utf8")
|
||||
return bcrypt.hashpw(password, dbPassword) == dbPassword
|
||||
|
||||
def genBcrypt(password):
|
||||
"""
|
||||
Bcrypts a password.
|
||||
|
||||
|
||||
password -- the password to hash.
|
||||
return -- bytestring
|
||||
"""
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import serverPackets
|
||||
from objects import glob
|
||||
from constants import serverPackets
|
||||
import psutil
|
||||
import os
|
||||
import sys
|
|
@ -1,7 +1,7 @@
|
|||
import passwordHelper
|
||||
import gameModes
|
||||
import generalFunctions
|
||||
import glob
|
||||
from helpers import passwordHelper
|
||||
from constants import gameModes
|
||||
from helpers import generalFunctions
|
||||
from objects import glob
|
||||
|
||||
def getID(username):
|
||||
"""
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import generalFunctions
|
||||
from objects import glob
|
||||
from helpers import generalFunctions
|
||||
|
||||
class banchoConfig:
|
||||
"""
|
|
@ -1,5 +1,5 @@
|
|||
import glob
|
||||
import channel
|
||||
from objects import glob
|
||||
from objects import channel
|
||||
|
||||
class channelList:
|
||||
"""
|
|
@ -1,9 +1,9 @@
|
|||
"""FokaBot related functions"""
|
||||
import userHelper
|
||||
import glob
|
||||
from helpers import userHelper
|
||||
from objects import glob
|
||||
from constants import actions
|
||||
import serverPackets
|
||||
import fokabotCommands
|
||||
from constants import serverPackets
|
||||
from constants import fokabotCommands
|
||||
|
||||
def connect():
|
||||
"""Add FokaBot to connected users and send userpanel/stats packet to everyone"""
|
|
@ -1,8 +1,8 @@
|
|||
"""Global objects and variables"""
|
||||
|
||||
import tokenList
|
||||
import channelList
|
||||
import matchList
|
||||
from objects import tokenList
|
||||
from objects import channelList
|
||||
from objects import matchList
|
||||
|
||||
VERSION = "0.9"
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
# TODO: Enqueue all
|
||||
import gameModes
|
||||
import matchScoringTypes
|
||||
import matchTeamTypes
|
||||
import matchModModes
|
||||
import slotStatuses
|
||||
import glob
|
||||
from constants import gameModes
|
||||
from constants import matchScoringTypes
|
||||
from constants import matchTeamTypes
|
||||
from constants import matchModModes
|
||||
from constants import slotStatuses
|
||||
from objects import glob
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import serverPackets
|
||||
import dataTypes
|
||||
import matchTeams
|
||||
from constants import serverPackets
|
||||
from constants import dataTypes
|
||||
from constants import matchTeams
|
||||
|
||||
class match:
|
||||
"""Multiplayer match object"""
|
|
@ -1,6 +1,6 @@
|
|||
import match
|
||||
import glob
|
||||
import serverPackets
|
||||
from objects import match
|
||||
from objects import glob
|
||||
from constants import serverPackets
|
||||
|
||||
class matchList:
|
||||
matches = {}
|
|
@ -1,12 +1,12 @@
|
|||
import uuid
|
||||
from constants import actions
|
||||
import gameModes
|
||||
import userHelper
|
||||
from constants import gameModes
|
||||
from helpers import userHelper
|
||||
import time
|
||||
from helpers import consoleHelper
|
||||
from constants import bcolors
|
||||
import serverPackets
|
||||
import logoutEvent
|
||||
from constants import serverPackets
|
||||
from events import logoutEvent
|
||||
|
||||
class token:
|
||||
"""Osu Token object
|
|
@ -1,7 +1,7 @@
|
|||
import osuToken
|
||||
from objects import osuToken
|
||||
import time
|
||||
import threading
|
||||
import logoutEvent
|
||||
from events import logoutEvent
|
||||
|
||||
class tokenList:
|
||||
"""
|
98
pep.py
98
pep.py
|
@ -11,58 +11,58 @@ from tornado.ioloop import IOLoop
|
|||
|
||||
# pep.py files
|
||||
from constants import bcolors
|
||||
import packetIDs
|
||||
import serverPackets
|
||||
import config
|
||||
import exceptions
|
||||
import glob
|
||||
import fokabot
|
||||
import banchoConfig
|
||||
from constants import packetIDs
|
||||
from constants import serverPackets
|
||||
from helpers import configHelper
|
||||
from constants import exceptions
|
||||
from objects import glob
|
||||
from objects import fokabot
|
||||
from objects import banchoConfig
|
||||
|
||||
import sendPublicMessageEvent
|
||||
import sendPrivateMessageEvent
|
||||
import channelJoinEvent
|
||||
import channelPartEvent
|
||||
import changeActionEvent
|
||||
import cantSpectateEvent
|
||||
import startSpectatingEvent
|
||||
import stopSpectatingEvent
|
||||
import spectateFramesEvent
|
||||
import friendAddEvent
|
||||
import friendRemoveEvent
|
||||
import logoutEvent
|
||||
import loginEvent
|
||||
import setAwayMessageEvent
|
||||
import joinLobbyEvent
|
||||
import createMatchEvent
|
||||
import partLobbyEvent
|
||||
import changeSlotEvent
|
||||
import joinMatchEvent
|
||||
import partMatchEvent
|
||||
import changeMatchSettingsEvent
|
||||
import changeMatchPasswordEvent
|
||||
import changeMatchModsEvent
|
||||
import matchReadyEvent
|
||||
import matchLockEvent
|
||||
import matchStartEvent
|
||||
import matchPlayerLoadEvent
|
||||
import matchSkipEvent
|
||||
import matchFramesEvent
|
||||
import matchCompleteEvent
|
||||
import matchNoBeatmapEvent
|
||||
import matchHasBeatmapEvent
|
||||
import matchTransferHostEvent
|
||||
import matchFailedEvent
|
||||
import matchInviteEvent
|
||||
import matchChangeTeamEvent
|
||||
from events import sendPublicMessageEvent
|
||||
from events import sendPrivateMessageEvent
|
||||
from events import channelJoinEvent
|
||||
from events import channelPartEvent
|
||||
from events import changeActionEvent
|
||||
from events import cantSpectateEvent
|
||||
from events import startSpectatingEvent
|
||||
from events import stopSpectatingEvent
|
||||
from events import spectateFramesEvent
|
||||
from events import friendAddEvent
|
||||
from events import friendRemoveEvent
|
||||
from events import logoutEvent
|
||||
from events import loginEvent
|
||||
from events import setAwayMessageEvent
|
||||
from events import joinLobbyEvent
|
||||
from events import createMatchEvent
|
||||
from events import partLobbyEvent
|
||||
from events import changeSlotEvent
|
||||
from events import joinMatchEvent
|
||||
from events import partMatchEvent
|
||||
from events import changeMatchSettingsEvent
|
||||
from events import changeMatchPasswordEvent
|
||||
from events import changeMatchModsEvent
|
||||
from events import matchReadyEvent
|
||||
from events import matchLockEvent
|
||||
from events import matchStartEvent
|
||||
from events import matchPlayerLoadEvent
|
||||
from events import matchSkipEvent
|
||||
from events import matchFramesEvent
|
||||
from events import matchCompleteEvent
|
||||
from events import matchNoBeatmapEvent
|
||||
from events import matchHasBeatmapEvent
|
||||
from events import matchTransferHostEvent
|
||||
from events import matchFailedEvent
|
||||
from events import matchInviteEvent
|
||||
from events import matchChangeTeamEvent
|
||||
|
||||
# pep.py helpers
|
||||
import packetHelper
|
||||
from helpers import packetHelper
|
||||
from helpers import consoleHelper
|
||||
import databaseHelper
|
||||
import responseHelper
|
||||
import generalFunctions
|
||||
import systemHelper
|
||||
from helpers import databaseHelper
|
||||
from helpers import responseHelper
|
||||
from helpers import generalFunctions
|
||||
from helpers import systemHelper
|
||||
|
||||
# Create flask instance
|
||||
app = flask.Flask(__name__)
|
||||
|
@ -249,7 +249,7 @@ if __name__ == "__main__":
|
|||
|
||||
# Read config.ini
|
||||
consoleHelper.printNoNl("> Loading config file... ")
|
||||
glob.conf = config.config("config.ini")
|
||||
glob.conf = configHelper.config("config.ini")
|
||||
|
||||
if glob.conf.default == True:
|
||||
# We have generated a default config.ini, quit server
|
||||
|
|
Loading…
Reference in New Issue
Block a user