-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
596 additions
and
174 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
create table stats | ||
( | ||
id int auto_increment | ||
primary key, | ||
tscore_vn_std int not null, | ||
tscore_vn_taiko int not null, | ||
tscore_vn_catch int not null, | ||
tscore_vn_mania int not null, | ||
tscore_rx_std int not null, | ||
tscore_rx_taiko int not null, | ||
tscore_rx_catch int not null, | ||
tscore_rx_mania int null, | ||
rscore_vn_std int not null, | ||
rscore_vn_taiko int not null, | ||
rscore_vn_catch int not null, | ||
rscore_vn_mania int not null, | ||
rscore_rx_std int not null, | ||
rscore_rx_taiko int not null, | ||
rscore_rx_catch int not null, | ||
rscore_rx_mania int null, | ||
pp_vn_std smallint(6) not null, | ||
pp_vn_taiko smallint(6) not null, | ||
pp_vn_catch smallint(6) not null, | ||
pp_vn_mania smallint(6) not null, | ||
pp_rx_std smallint(6) not null, | ||
pp_rx_taiko smallint(6) not null, | ||
pp_rx_catch smallint(6) not null, | ||
pp_rx_mania smallint(6) null, | ||
playcount_vn_std int not null, | ||
playcount_vn_taiko int not null, | ||
playcount_vn_catch int not null, | ||
playcount_vn_mania int not null, | ||
playcount_rx_std int not null, | ||
playcount_rx_taiko int not null, | ||
playcount_rx_catch int not null, | ||
playcount_rx_mania int null, | ||
playtime_vn_std int not null, | ||
playtime_vn_taiko int not null, | ||
playtime_vn_catch int not null, | ||
playtime_vn_mania int not null, | ||
playtime_rx_std int not null, | ||
playtime_rx_taiko int not null, | ||
playtime_rx_catch int not null, | ||
playtime_rx_mania int null, | ||
acc_vn_std float(5,3) not null, | ||
acc_vn_taiko float(5,3) not null, | ||
acc_vn_catch float(5,3) not null, | ||
acc_vn_mania float(5,3) not null, | ||
acc_rx_std float(5,3) not null, | ||
acc_rx_taiko float(5,3) not null, | ||
acc_rx_catch float(5,3) not null, | ||
acc_rx_mania float(5,3) null, | ||
maxcombo_vn_std int not null, | ||
maxcombo_vn_taiko int not null, | ||
maxcombo_vn_catch int not null, | ||
maxcombo_vn_mania int not null, | ||
maxcombo_rx_std int not null, | ||
maxcombo_rx_taiko int not null, | ||
maxcombo_rx_catch int not null, | ||
maxcombo_rx_mania int null, | ||
constraint stats_users_id_fk | ||
foreign key (id) references users (id) | ||
); |
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,57 @@ | ||
from typing import Tuple | ||
from objects.player import Player | ||
from objects.channel import Channel | ||
from constants import Privileges | ||
|
||
class ChannelList: | ||
def __init__(self): | ||
self.channels = [] | ||
|
||
def get(self, name: str) -> Channel: | ||
for c in self.channels: | ||
if c.name == name: | ||
return c | ||
|
||
def add(self, p: Channel) -> None: # bool ret success? | ||
if p in self.channels: | ||
print(f'{p.name} already in channels list!') | ||
return | ||
print(f'Adding {p.name} to channels list.') | ||
self.channels.append(p) | ||
|
||
def remove(self, p: Channel) -> None: | ||
print(f'Removing {p.name} from channels list.') | ||
self.channels.remove(p) | ||
|
||
class PlayerList: | ||
def __init__(self): | ||
self.players = [] | ||
|
||
@property | ||
def ids(self) -> Tuple[int]: | ||
return (p.id for p in self.players) | ||
|
||
def broadcast(self, data: bytes) -> None: | ||
for p in self.players: # no idea if it takes ref | ||
p.enqueue(data) | ||
|
||
def get(self, token: str) -> Player: | ||
for p in self.players: # might copy | ||
if p.token == token: | ||
return p | ||
|
||
def get_by_id(self, id: int) -> Player: | ||
for p in self.players: # might copy | ||
if p.id == id: | ||
return p | ||
|
||
def add(self, p: Player) -> None: # bool ret success? | ||
if p in self.players: | ||
print(f'{p.name} ({p.id}) already in players list!') | ||
return | ||
print(f'Adding {p.name} ({p.id}) to players list.') | ||
self.players.append(p) | ||
|
||
def remove(self, p: Player) -> None: | ||
print(f'Removing {p.name} ({p.id}) from players list.') | ||
self.players.remove(p) |
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,5 @@ | ||
from objects.collections import PlayerList, ChannelList | ||
|
||
players = PlayerList() | ||
channels = ChannelList() | ||
db = None # too lazy |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.