Discord webhook stuff and lint/type errors fixed
This commit is contained in:
parent
791b13682f
commit
e16455b8ba
@ -4,7 +4,7 @@ import random
|
||||
import struct
|
||||
from typing import Optional, Dict, Any, List, Tuple
|
||||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
|
||||
from bemani.backend.iidx.base import IIDXBase
|
||||
from bemani.backend.iidx.course import IIDXCourse
|
||||
@ -1008,7 +1008,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
root.add_child(event1_phase)
|
||||
event1_phase.set_attribute('phase', str(event1))
|
||||
|
||||
extra_boss_event = Node.void('extra_boss_event') # Always enable IIDX AIR RACE 5
|
||||
extra_boss_event = Node.void('extra_boss_event') # Always enable IIDX AIR RACE 5
|
||||
root.add_child(extra_boss_event)
|
||||
extra_boss_event.set_attribute('phase', '4')
|
||||
|
||||
@ -1395,7 +1395,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
|
||||
# now we will build up the embed
|
||||
now = datetime.now()
|
||||
@ -1432,7 +1432,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
webhook.add_embed(scoreembed)
|
||||
|
||||
# now we send the webhook!
|
||||
response = webhook.execute()
|
||||
webhook.execute()
|
||||
|
||||
end = Node.void('IIDX25pc')
|
||||
|
||||
@ -1770,7 +1770,7 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
event1.set_attribute('engine_equip_parts', str(event1_dict.get_int('engine_equip_parts')))
|
||||
event1.set_attribute('tire_equip_parts', str(event1_dict.get_int('tire_equip_parts')))
|
||||
event1.set_attribute('gift_point', str(event1_dict.get_int('play_gift')))
|
||||
|
||||
|
||||
for map_data in achievements:
|
||||
if map_data.type != 'map_data':
|
||||
continue
|
||||
@ -1801,7 +1801,6 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
|
||||
onemore_data.set_attribute(f'challenge_num_{i}_h', str(omes_dict.get_int(f'challenge_num_{i}_h')))
|
||||
onemore_data.set_attribute(f'challenge_num_{i}_a', str(omes_dict.get_int(f'challenge_num_{i}_a')))
|
||||
|
||||
|
||||
# If the user joined a particular shop, let the game know.
|
||||
if 'shop_location' in profile:
|
||||
shop_id = profile.get_int('shop_location')
|
||||
|
@ -3,6 +3,8 @@ import copy
|
||||
import random
|
||||
import struct
|
||||
from typing import Optional, Dict, Any, List, Tuple
|
||||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
|
||||
from bemani.backend.iidx.base import IIDXBase
|
||||
from bemani.backend.iidx.course import IIDXCourse
|
||||
@ -1389,6 +1391,99 @@ class IIDXCopula(IIDXCourse, IIDXBase):
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX23pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
# first, we register the iidx webhook. this is done by sending all of our money to konami
|
||||
if self.config['webhooks'][self.game] is None:
|
||||
return Node.void('IIDX23pc')
|
||||
webhook = DiscordWebhook(url=self.config['webhooks'][self.game])
|
||||
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
self.GAME_CLEAR_STATUS_FAILED: 'FAILED',
|
||||
self.GAME_CLEAR_STATUS_ASSIST_CLEAR: 'ASSIST CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EASY_CLEAR: 'EASY CLEAR',
|
||||
self.GAME_CLEAR_STATUS_CLEAR: 'CLEAR',
|
||||
self.GAME_CLEAR_STATUS_HARD_CLEAR: 'HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EX_HARD_CLEAR: 'EX HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_FULL_COMBO: 'FULL COMBO',
|
||||
}
|
||||
# first we'll grab the data from the packet
|
||||
# did = request.child_value('did')
|
||||
# rid = request.child_value('rid')
|
||||
name = request.child_value('name')
|
||||
# qpro_hair = request.child_value('qpro_hair')
|
||||
# qpro_head = request.child_value('qpro_head')
|
||||
# qpro_body = request.child_value('qpro_body')
|
||||
# qpro_hand = request.child_value('qpro_hand')
|
||||
music_id = request.child_value('music_id')
|
||||
class_id = request.child_value('class_id')
|
||||
# no_save = request.child_value('no_save')
|
||||
# is_couple = request.child_value('is_couple')
|
||||
# target_graph = request.child_value('target_graph')
|
||||
target_exscore = request.child_value('target_exscore')
|
||||
# pacemaker = request.child_value('pacemaker')
|
||||
best_clear = request.child_value('best_clear')
|
||||
# best_djlevel = request.child_value('best_djlevel')
|
||||
# best_exscore = request.child_value('best_exscore')
|
||||
# best_misscount = request.child_value('best_misscount')
|
||||
now_clear = request.child_value('now_clear')
|
||||
# now_djlevel = request.child_value('now_djlevel')
|
||||
now_exscore = request.child_value('now_exscore')
|
||||
# now_misscount = request.child_value('now_misscount')
|
||||
now_pgreat = request.child_value('now_pgreat')
|
||||
now_great = request.child_value('now_great')
|
||||
now_good = request.child_value('now_good')
|
||||
now_bad = request.child_value('now_bad')
|
||||
now_poor = request.child_value('now_poor')
|
||||
now_combo = request.child_value('now_combo')
|
||||
now_fast = request.child_value('now_fast')
|
||||
now_slow = request.child_value('now_slow')
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
|
||||
# now we will build up the embed
|
||||
now = datetime.now()
|
||||
|
||||
# now, we generate the embed
|
||||
scoreembed = DiscordEmbed(title='New IIDX Score!', description="Login to see whole score.", color='fbba08')
|
||||
scoreembed.set_footer(text=(now.strftime('Score was recorded on %m/%d/%y at %H:%M:%S')))
|
||||
|
||||
# lets give it an author
|
||||
scoreembed.set_author(name=self.config['name'], url=self.config['server']['uri'])
|
||||
# Set `inline=False` for the embed field to occupy the whole line
|
||||
scoreembed.add_embed_field(name='DJ Name', value=(name), inline=False)
|
||||
scoreembed.add_embed_field(name='Song', value=(song.name), inline=False)
|
||||
scoreembed.add_embed_field(name='Artist', value=(song.artist), inline=False)
|
||||
scoreembed.add_embed_field(name='Difficulty', value=(song.data.get('difficulty', 0)))
|
||||
scoreembed.add_embed_field(name='Target EXScore', value=(target_exscore))
|
||||
scoreembed.add_embed_field(name='Your EXScore', value=(now_exscore))
|
||||
scoreembed.add_embed_field(name='Best Clear', value=best_clear_string)
|
||||
scoreembed.add_embed_field(name='Clear Status', value=now_clear_string)
|
||||
scoreembed.add_embed_field(name='Note Counts', value='How did you do?', inline=False)
|
||||
scoreembed.add_embed_field(name=('Perfect Greats'), value=((now_pgreat)))
|
||||
scoreembed.add_embed_field(name=('Greats'), value=((now_great)))
|
||||
scoreembed.add_embed_field(name=('Goods'), value=((now_good)))
|
||||
scoreembed.add_embed_field(name=('Bads'), value=((now_bad)))
|
||||
scoreembed.add_embed_field(name=('Poors'), value=((now_poor)))
|
||||
|
||||
scoreembed.add_embed_field(name='Combo Breaks', value=(now_combo))
|
||||
|
||||
# scoreembed.add_embed_field(name='Timing Stats', value='Were you on time?', inline = False)
|
||||
scoreembed.add_embed_field(name=('Slow'), value=((now_slow)))
|
||||
scoreembed.add_embed_field(name=('Fast'), value=((now_fast)))
|
||||
|
||||
# add embed object to webhook
|
||||
webhook.add_embed(scoreembed)
|
||||
|
||||
# now we send the webhook!
|
||||
webhook.execute()
|
||||
|
||||
end = Node.void('IIDX23pc')
|
||||
|
||||
return end
|
||||
|
||||
def format_profile(self, userid: UserID, profile: ValidatedDict) -> Node:
|
||||
root = Node.void('IIDX23pc')
|
||||
|
||||
|
@ -31,7 +31,7 @@ from bemani.backend.iidx.cannonballers import IIDXCannonBallers
|
||||
from bemani.backend.iidx.rootage import IIDXRootage
|
||||
from bemani.backend.iidx.heroicverse import IIDXHeroicVerse
|
||||
from bemani.backend.iidx.bistrover import IIDXBistrover
|
||||
from bemani.common import Model, VersionConstants, GameConstants
|
||||
from bemani.common import Model, VersionConstants
|
||||
from bemani.data import Data
|
||||
|
||||
|
||||
|
@ -3,6 +3,8 @@ import copy
|
||||
import random
|
||||
import struct
|
||||
from typing import Optional, Dict, Any, List, Tuple
|
||||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
|
||||
from bemani.backend.iidx.base import IIDXBase
|
||||
from bemani.backend.iidx.course import IIDXCourse
|
||||
@ -1302,6 +1304,99 @@ class IIDXPendual(IIDXCourse, IIDXBase):
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX22pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
# first, we register the iidx webhook. this is done by sending all of our money to konami
|
||||
if self.config['webhooks'][self.game] is None:
|
||||
return Node.void('IIDX22pc')
|
||||
webhook = DiscordWebhook(url=self.config['webhooks'][self.game])
|
||||
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
self.GAME_CLEAR_STATUS_FAILED: 'FAILED',
|
||||
self.GAME_CLEAR_STATUS_ASSIST_CLEAR: 'ASSIST CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EASY_CLEAR: 'EASY CLEAR',
|
||||
self.GAME_CLEAR_STATUS_CLEAR: 'CLEAR',
|
||||
self.GAME_CLEAR_STATUS_HARD_CLEAR: 'HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EX_HARD_CLEAR: 'EX HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_FULL_COMBO: 'FULL COMBO',
|
||||
}
|
||||
# first we'll grab the data from the packet
|
||||
# did = request.child_value('did')
|
||||
# rid = request.child_value('rid')
|
||||
name = request.child_value('name')
|
||||
# qpro_hair = request.child_value('qpro_hair')
|
||||
# qpro_head = request.child_value('qpro_head')
|
||||
# qpro_body = request.child_value('qpro_body')
|
||||
# qpro_hand = request.child_value('qpro_hand')
|
||||
music_id = request.child_value('music_id')
|
||||
class_id = request.child_value('class_id')
|
||||
# no_save = request.child_value('no_save')
|
||||
# is_couple = request.child_value('is_couple')
|
||||
# target_graph = request.child_value('target_graph')
|
||||
target_exscore = request.child_value('target_exscore')
|
||||
# pacemaker = request.child_value('pacemaker')
|
||||
best_clear = request.child_value('best_clear')
|
||||
# best_djlevel = request.child_value('best_djlevel')
|
||||
# best_exscore = request.child_value('best_exscore')
|
||||
# best_misscount = request.child_value('best_misscount')
|
||||
now_clear = request.child_value('now_clear')
|
||||
# now_djlevel = request.child_value('now_djlevel')
|
||||
now_exscore = request.child_value('now_exscore')
|
||||
# now_misscount = request.child_value('now_misscount')
|
||||
now_pgreat = request.child_value('now_pgreat')
|
||||
now_great = request.child_value('now_great')
|
||||
now_good = request.child_value('now_good')
|
||||
now_bad = request.child_value('now_bad')
|
||||
now_poor = request.child_value('now_poor')
|
||||
now_combo = request.child_value('now_combo')
|
||||
now_fast = request.child_value('now_fast')
|
||||
now_slow = request.child_value('now_slow')
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
|
||||
# now we will build up the embed
|
||||
now = datetime.now()
|
||||
|
||||
# now, we generate the embed
|
||||
scoreembed = DiscordEmbed(title='New IIDX Score!', description="Login to see whole score.", color='fbba08')
|
||||
scoreembed.set_footer(text=(now.strftime('Score was recorded on %m/%d/%y at %H:%M:%S')))
|
||||
|
||||
# lets give it an author
|
||||
scoreembed.set_author(name=self.config['name'], url=self.config['server']['uri'])
|
||||
# Set `inline=False` for the embed field to occupy the whole line
|
||||
scoreembed.add_embed_field(name='DJ Name', value=(name), inline=False)
|
||||
scoreembed.add_embed_field(name='Song', value=(song.name), inline=False)
|
||||
scoreembed.add_embed_field(name='Artist', value=(song.artist), inline=False)
|
||||
scoreembed.add_embed_field(name='Difficulty', value=(song.data.get('difficulty', 0)))
|
||||
scoreembed.add_embed_field(name='Target EXScore', value=(target_exscore))
|
||||
scoreembed.add_embed_field(name='Your EXScore', value=(now_exscore))
|
||||
scoreembed.add_embed_field(name='Best Clear', value=best_clear_string)
|
||||
scoreembed.add_embed_field(name='Clear Status', value=now_clear_string)
|
||||
scoreembed.add_embed_field(name='Note Counts', value='How did you do?', inline=False)
|
||||
scoreembed.add_embed_field(name=('Perfect Greats'), value=((now_pgreat)))
|
||||
scoreembed.add_embed_field(name=('Greats'), value=((now_great)))
|
||||
scoreembed.add_embed_field(name=('Goods'), value=((now_good)))
|
||||
scoreembed.add_embed_field(name=('Bads'), value=((now_bad)))
|
||||
scoreembed.add_embed_field(name=('Poors'), value=((now_poor)))
|
||||
|
||||
scoreembed.add_embed_field(name='Combo Breaks', value=(now_combo))
|
||||
|
||||
# scoreembed.add_embed_field(name='Timing Stats', value='Were you on time?', inline = False)
|
||||
scoreembed.add_embed_field(name=('Slow'), value=((now_slow)))
|
||||
scoreembed.add_embed_field(name=('Fast'), value=((now_fast)))
|
||||
|
||||
# add embed object to webhook
|
||||
webhook.add_embed(scoreembed)
|
||||
|
||||
# now we send the webhook!
|
||||
webhook.execute()
|
||||
|
||||
end = Node.void('IIDX22pc')
|
||||
|
||||
return end
|
||||
|
||||
def format_profile(self, userid: UserID, profile: ValidatedDict) -> Node:
|
||||
root = Node.void('IIDX22pc')
|
||||
|
||||
|
@ -4,7 +4,7 @@ import random
|
||||
import struct
|
||||
from typing import Optional, Dict, Any, List, Tuple
|
||||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
|
||||
from bemani.backend.iidx.base import IIDXBase
|
||||
from bemani.backend.iidx.course import IIDXCourse
|
||||
@ -1068,7 +1068,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
root.set_attribute('pflg', '0')
|
||||
return root
|
||||
|
||||
def handle_IIDX26pc_shopregister_request(self, request: Node) -> Node: # Not used anymore????
|
||||
def handle_IIDX26pc_shopregister_request(self, request: Node) -> Node: # Not used anymore????
|
||||
root = Node.void('IIDX26pc')
|
||||
return root
|
||||
|
||||
@ -1202,7 +1202,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, self.game_to_db_chart(class_id))
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
|
||||
# now we will build up the embed
|
||||
now = datetime.now()
|
||||
@ -1239,7 +1239,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
webhook.add_embed(scoreembed)
|
||||
|
||||
# now we send the webhook!
|
||||
response = webhook.execute()
|
||||
webhook.execute()
|
||||
|
||||
end = Node.void('IIDX26pc')
|
||||
|
||||
@ -1626,7 +1626,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
map_data_node.set_attribute('bookshelf_release_num', str(map_data.data.get_int('bookshelf_release_num')))
|
||||
map_data_node.add_child(Node.bool('is_clear', map_data.data.get_bool('is_clear')))
|
||||
map_data_node.add_child(Node.binary('map_route_damage', map_data.data.get_bytes('map_route_damage')))
|
||||
|
||||
|
||||
# DELABITY LABORATORY event
|
||||
event2_dict = profile.get_dict('event2')
|
||||
event2 = Node.void('event2')
|
||||
@ -1653,7 +1653,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
area_data.set_attribute('last_select_note', str(area.data.get_int('last_select_note')))
|
||||
area_data.set_attribute('normal_play_num', str(area.data.get_int('normal_play_num')))
|
||||
area_data.set_attribute('hyper_play_num', str(area.data.get_int('hyper_play_num')))
|
||||
area_data.set_attribute('another_play_num', str(area.data.get_int('another_play_num')))
|
||||
area_data.set_attribute('another_play_num', str(area.data.get_int('another_play_num')))
|
||||
area_data.set_attribute('area_clear_flg_list', str(area.data.get_int('area_clear_flg_list')))
|
||||
area_data.set_attribute('normal_grade_point', str(area.data.get_int('normal_grade_point')))
|
||||
area_data.set_attribute('hyper_grade_point', str(area.data.get_int('hyper_grade_point')))
|
||||
@ -2056,7 +2056,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
event2_dict.replace_int('floor_clear_flg_list', int(event2.attribute('floor_clear_flg_list')))
|
||||
event2_dict.replace_int('last_select_floor', int(event2.attribute('last_select_floor')))
|
||||
event2_dict.replace_int('tips_list', int(event2.attribute('tips_list')))
|
||||
|
||||
|
||||
for area_data in event2.children:
|
||||
if area_data.name != 'area_data':
|
||||
continue
|
||||
@ -2067,7 +2067,7 @@ class IIDXRootage(IIDXCourse, IIDXBase):
|
||||
self.version,
|
||||
userid,
|
||||
area_id,
|
||||
f'area_data_floor_{floor_id}', # Save floor_id twice since the game seems to key by both
|
||||
f'area_data_floor_{floor_id}', # Save floor_id twice since the game seems to key by both
|
||||
{
|
||||
'floor_id': floor_id,
|
||||
'last_select_note': int(area_data.attribute('last_select_note')),
|
||||
|
@ -3,6 +3,8 @@ import copy
|
||||
import random
|
||||
import struct
|
||||
from typing import Optional, Dict, Any, List, Tuple
|
||||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
|
||||
from bemani.backend.iidx.base import IIDXBase
|
||||
from bemani.backend.iidx.course import IIDXCourse
|
||||
@ -1361,6 +1363,99 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
|
||||
|
||||
return Node.void('IIDX24pc')
|
||||
|
||||
def handle_IIDX24pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
# first, we register the iidx webhook. this is done by sending all of our money to konami
|
||||
if self.config['webhooks'][self.game] is None:
|
||||
return Node.void('IIDX24pc')
|
||||
webhook = DiscordWebhook(url=self.config['webhooks'][self.game])
|
||||
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
self.GAME_CLEAR_STATUS_FAILED: 'FAILED',
|
||||
self.GAME_CLEAR_STATUS_ASSIST_CLEAR: 'ASSIST CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EASY_CLEAR: 'EASY CLEAR',
|
||||
self.GAME_CLEAR_STATUS_CLEAR: 'CLEAR',
|
||||
self.GAME_CLEAR_STATUS_HARD_CLEAR: 'HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EX_HARD_CLEAR: 'EX HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_FULL_COMBO: 'FULL COMBO',
|
||||
}
|
||||
# first we'll grab the data from the packet
|
||||
# did = request.child_value('did')
|
||||
# rid = request.child_value('rid')
|
||||
name = request.child_value('name')
|
||||
# qpro_hair = request.child_value('qpro_hair')
|
||||
# qpro_head = request.child_value('qpro_head')
|
||||
# qpro_body = request.child_value('qpro_body')
|
||||
# qpro_hand = request.child_value('qpro_hand')
|
||||
music_id = request.child_value('music_id')
|
||||
class_id = request.child_value('class_id')
|
||||
# no_save = request.child_value('no_save')
|
||||
# is_couple = request.child_value('is_couple')
|
||||
# target_graph = request.child_value('target_graph')
|
||||
target_exscore = request.child_value('target_exscore')
|
||||
# pacemaker = request.child_value('pacemaker')
|
||||
best_clear = request.child_value('best_clear')
|
||||
# best_djlevel = request.child_value('best_djlevel')
|
||||
# best_exscore = request.child_value('best_exscore')
|
||||
# best_misscount = request.child_value('best_misscount')
|
||||
now_clear = request.child_value('now_clear')
|
||||
# now_djlevel = request.child_value('now_djlevel')
|
||||
now_exscore = request.child_value('now_exscore')
|
||||
# now_misscount = request.child_value('now_misscount')
|
||||
now_pgreat = request.child_value('now_pgreat')
|
||||
now_great = request.child_value('now_great')
|
||||
now_good = request.child_value('now_good')
|
||||
now_bad = request.child_value('now_bad')
|
||||
now_poor = request.child_value('now_poor')
|
||||
now_combo = request.child_value('now_combo')
|
||||
now_fast = request.child_value('now_fast')
|
||||
now_slow = request.child_value('now_slow')
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
|
||||
# now we will build up the embed
|
||||
now = datetime.now()
|
||||
|
||||
# now, we generate the embed
|
||||
scoreembed = DiscordEmbed(title='New IIDX Score!', description="Login to see whole score.", color='fbba08')
|
||||
scoreembed.set_footer(text=(now.strftime('Score was recorded on %m/%d/%y at %H:%M:%S')))
|
||||
|
||||
# lets give it an author
|
||||
scoreembed.set_author(name=self.config['name'], url=self.config['server']['uri'])
|
||||
# Set `inline=False` for the embed field to occupy the whole line
|
||||
scoreembed.add_embed_field(name='DJ Name', value=(name), inline=False)
|
||||
scoreembed.add_embed_field(name='Song', value=(song.name), inline=False)
|
||||
scoreembed.add_embed_field(name='Artist', value=(song.artist), inline=False)
|
||||
scoreembed.add_embed_field(name='Difficulty', value=(song.data.get('difficulty', 0)))
|
||||
scoreembed.add_embed_field(name='Target EXScore', value=(target_exscore))
|
||||
scoreembed.add_embed_field(name='Your EXScore', value=(now_exscore))
|
||||
scoreembed.add_embed_field(name='Best Clear', value=best_clear_string)
|
||||
scoreembed.add_embed_field(name='Clear Status', value=now_clear_string)
|
||||
scoreembed.add_embed_field(name='Note Counts', value='How did you do?', inline=False)
|
||||
scoreembed.add_embed_field(name=('Perfect Greats'), value=((now_pgreat)))
|
||||
scoreembed.add_embed_field(name=('Greats'), value=((now_great)))
|
||||
scoreembed.add_embed_field(name=('Goods'), value=((now_good)))
|
||||
scoreembed.add_embed_field(name=('Bads'), value=((now_bad)))
|
||||
scoreembed.add_embed_field(name=('Poors'), value=((now_poor)))
|
||||
|
||||
scoreembed.add_embed_field(name='Combo Breaks', value=(now_combo))
|
||||
|
||||
# scoreembed.add_embed_field(name='Timing Stats', value='Were you on time?', inline = False)
|
||||
scoreembed.add_embed_field(name=('Slow'), value=((now_slow)))
|
||||
scoreembed.add_embed_field(name=('Fast'), value=((now_fast)))
|
||||
|
||||
# add embed object to webhook
|
||||
webhook.add_embed(scoreembed)
|
||||
|
||||
# now we send the webhook!
|
||||
webhook.execute()
|
||||
|
||||
end = Node.void('IIDX24pc')
|
||||
|
||||
return end
|
||||
|
||||
def format_profile(self, userid: UserID, profile: ValidatedDict) -> Node:
|
||||
root = Node.void('IIDX24pc')
|
||||
|
||||
|
@ -3,6 +3,8 @@ import copy
|
||||
import random
|
||||
import struct
|
||||
from typing import Optional, Dict, List, Tuple, Any
|
||||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
|
||||
from bemani.backend.iidx.base import IIDXBase
|
||||
from bemani.backend.iidx.tricoro import IIDXTricoro
|
||||
@ -1001,6 +1003,99 @@ class IIDXSpada(IIDXBase):
|
||||
# Invalid method
|
||||
return None
|
||||
|
||||
def handle_IIDX21pc_eaappliresult_request(self, request: Node) -> Node:
|
||||
# first, we register the iidx webhook. this is done by sending all of our money to konami
|
||||
if self.config['webhooks'][self.game] is None:
|
||||
return Node.void('IIDX21pc')
|
||||
webhook = DiscordWebhook(url=self.config['webhooks'][self.game])
|
||||
|
||||
clear_map = {
|
||||
self.GAME_CLEAR_STATUS_NO_PLAY: 'NO PLAY',
|
||||
self.GAME_CLEAR_STATUS_FAILED: 'FAILED',
|
||||
self.GAME_CLEAR_STATUS_ASSIST_CLEAR: 'ASSIST CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EASY_CLEAR: 'EASY CLEAR',
|
||||
self.GAME_CLEAR_STATUS_CLEAR: 'CLEAR',
|
||||
self.GAME_CLEAR_STATUS_HARD_CLEAR: 'HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_EX_HARD_CLEAR: 'EX HARD CLEAR',
|
||||
self.GAME_CLEAR_STATUS_FULL_COMBO: 'FULL COMBO',
|
||||
}
|
||||
# first we'll grab the data from the packet
|
||||
# did = request.child_value('did')
|
||||
# rid = request.child_value('rid')
|
||||
name = request.child_value('name')
|
||||
# qpro_hair = request.child_value('qpro_hair')
|
||||
# qpro_head = request.child_value('qpro_head')
|
||||
# qpro_body = request.child_value('qpro_body')
|
||||
# qpro_hand = request.child_value('qpro_hand')
|
||||
music_id = request.child_value('music_id')
|
||||
class_id = request.child_value('class_id')
|
||||
# no_save = request.child_value('no_save')
|
||||
# is_couple = request.child_value('is_couple')
|
||||
# target_graph = request.child_value('target_graph')
|
||||
target_exscore = request.child_value('target_exscore')
|
||||
# pacemaker = request.child_value('pacemaker')
|
||||
best_clear = request.child_value('best_clear')
|
||||
# best_djlevel = request.child_value('best_djlevel')
|
||||
# best_exscore = request.child_value('best_exscore')
|
||||
# best_misscount = request.child_value('best_misscount')
|
||||
now_clear = request.child_value('now_clear')
|
||||
# now_djlevel = request.child_value('now_djlevel')
|
||||
now_exscore = request.child_value('now_exscore')
|
||||
# now_misscount = request.child_value('now_misscount')
|
||||
now_pgreat = request.child_value('now_pgreat')
|
||||
now_great = request.child_value('now_great')
|
||||
now_good = request.child_value('now_good')
|
||||
now_bad = request.child_value('now_bad')
|
||||
now_poor = request.child_value('now_poor')
|
||||
now_combo = request.child_value('now_combo')
|
||||
now_fast = request.child_value('now_fast')
|
||||
now_slow = request.child_value('now_slow')
|
||||
best_clear_string = clear_map.get(best_clear, 'NO PLAY')
|
||||
now_clear_string = clear_map.get(now_clear, 'NO PLAY')
|
||||
# let's get the song info first
|
||||
song = self.data.local.music.get_song(self.game, self.music_version, music_id, class_id)
|
||||
|
||||
# now we will build up the embed
|
||||
now = datetime.now()
|
||||
|
||||
# now, we generate the embed
|
||||
scoreembed = DiscordEmbed(title='New IIDX Score!', description="Login to see whole score.", color='fbba08')
|
||||
scoreembed.set_footer(text=(now.strftime('Score was recorded on %m/%d/%y at %H:%M:%S')))
|
||||
|
||||
# lets give it an author
|
||||
scoreembed.set_author(name=self.config['name'], url=self.config['server']['uri'])
|
||||
# Set `inline=False` for the embed field to occupy the whole line
|
||||
scoreembed.add_embed_field(name='DJ Name', value=(name), inline=False)
|
||||
scoreembed.add_embed_field(name='Song', value=(song.name), inline=False)
|
||||
scoreembed.add_embed_field(name='Artist', value=(song.artist), inline=False)
|
||||
scoreembed.add_embed_field(name='Difficulty', value=(song.data.get('difficulty', 0)))
|
||||
scoreembed.add_embed_field(name='Target EXScore', value=(target_exscore))
|
||||
scoreembed.add_embed_field(name='Your EXScore', value=(now_exscore))
|
||||
scoreembed.add_embed_field(name='Best Clear', value=best_clear_string)
|
||||
scoreembed.add_embed_field(name='Clear Status', value=now_clear_string)
|
||||
scoreembed.add_embed_field(name='Note Counts', value='How did you do?', inline=False)
|
||||
scoreembed.add_embed_field(name=('Perfect Greats'), value=((now_pgreat)))
|
||||
scoreembed.add_embed_field(name=('Greats'), value=((now_great)))
|
||||
scoreembed.add_embed_field(name=('Goods'), value=((now_good)))
|
||||
scoreembed.add_embed_field(name=('Bads'), value=((now_bad)))
|
||||
scoreembed.add_embed_field(name=('Poors'), value=((now_poor)))
|
||||
|
||||
scoreembed.add_embed_field(name='Combo Breaks', value=(now_combo))
|
||||
|
||||
# scoreembed.add_embed_field(name='Timing Stats', value='Were you on time?', inline = False)
|
||||
scoreembed.add_embed_field(name=('Slow'), value=((now_slow)))
|
||||
scoreembed.add_embed_field(name=('Fast'), value=((now_fast)))
|
||||
|
||||
# add embed object to webhook
|
||||
webhook.add_embed(scoreembed)
|
||||
|
||||
# now we send the webhook!
|
||||
webhook.execute()
|
||||
|
||||
end = Node.void('IIDX21pc')
|
||||
|
||||
return end
|
||||
|
||||
def format_profile(self, userid: UserID, profile: ValidatedDict) -> Node:
|
||||
root = Node.void('IIDX21pc')
|
||||
|
||||
|
@ -168,7 +168,7 @@ class IIDXFrontend(FrontendBase):
|
||||
result[version] = qpro['qpros']
|
||||
return result
|
||||
|
||||
def __format_iidx_extras(self, version) -> Dict[str, List[Dict[str, Any]]]:
|
||||
def __format_iidx_extras(self, version: int) -> Dict[str, List[Dict[str, Any]]]:
|
||||
# Gotta look up the unlock catalog
|
||||
items = self.data.local.game.get_items(self.game, version)
|
||||
|
||||
|
@ -25,6 +25,10 @@ server:
|
||||
# Whether PCBIDs must be added to the network before games will work.
|
||||
enforce_pcbid: False
|
||||
|
||||
# Discord webhook urls
|
||||
webhooks:
|
||||
iidx: "https://discord.com/api/webhooks/1232122131321321321/eauihfafaewfhjaveuijaewuivhjawueihoi"
|
||||
|
||||
paseli:
|
||||
# Whether PASELI is enabled on the network.
|
||||
enabled: True
|
||||
|
@ -23,3 +23,4 @@ pycryptodome
|
||||
jaconv
|
||||
pefile
|
||||
pillow
|
||||
discord_webhook
|
||||
|
Loading…
x
Reference in New Issue
Block a user