Card-jitsu water working (#98)

* add card-jitsu water

* remove autogenerated file

* part 1

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 2

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 3

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 4

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 5

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 6

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 7

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 8

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 9

Co-authored-by: Levi <contact@lekuru.xyz>

* formatting part 8

Co-authored-by: Levi <contact@lekuru.xyz>

* More formatting changes

Co-authored-by: Levi <contact@lekuru.xyz>

* add watermatch

* add proper handling of the amulet client value

---------

Co-authored-by: Levi <contact@lekuru.xyz>
This commit is contained in:
nhaar 2024-09-15 11:30:29 -03:00 committed by GitHub
parent 5815b9a0f1
commit d1f31950d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1119 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ WaddleLogicMapping = {
'sensei': SenseiLogic,
'water': CardJitsuWaterLogic,
'watermatch': CardJitsuWaterLogic,
'watersensei': WaterSenseiLogic,
'fire': FireMatLogic,

View File

@ -3,6 +3,7 @@ from houdini.handlers import XTPacket
from houdini.data.penguin import Penguin
from houdini.handlers.games.ninja.card import get_threshold_for_rank, get_exp_difference_to_next_rank
from houdini.handlers.games.ninja.fire import get_fire_rank_threshold
from houdini.handlers.games.ninja.water import get_water_rank_threshold
# rank doesn't need to be known, but requiring it since it is always known and is simpler/faster to compute
def get_percentage_to_next_belt(xp: int, rank: int) -> int:
@ -14,6 +15,14 @@ def get_percentage_to_next_fire_item(xp: int, rank: int) -> int:
cur_threshold = get_fire_rank_threshold(rank)
return int((xp - cur_threshold) / (get_fire_rank_threshold(rank + 1) - cur_threshold) * 100)
def get_percentage_to_next_water_item(exp: float, rank: int) -> int:
"""Get the percentage to the next water item"""
if rank >= 4:
return 0
cur_threshold = get_water_rank_threshold(rank)
next_threshold = get_water_rank_threshold(rank + 1)
return int((exp - cur_threshold) / (next_threshold - cur_threshold) * 100)
@handlers.handler(XTPacket('ni', 'gnr'))
@handlers.cooldown(2)
async def handle_get_ninja_ranks(p, penguin_id: int):
@ -34,7 +43,7 @@ async def handle_get_fire_level(p):
@handlers.handler(XTPacket('ni', 'gwl'))
async def handle_get_water_level(p):
await p.send_xt('gwl', p.water_ninja_rank, p.water_ninja_progress, 5)
await p.send_xt('gwl', p.water_ninja_rank, get_percentage_to_next_water_item(p.water_ninja_progress, p.water_ninja_rank), 5)
@handlers.handler(XTPacket('ni', 'gsl'))