Various Fixes.

generified the Worldboss module; removed the spammy-section as of currently, will be readded at a later stage.
This commit is contained in:
2022-06-24 18:10:45 +02:00
parent e942ac43fa
commit 84a5933490
20 changed files with 274 additions and 176 deletions
+46 -1
View File
@@ -1,4 +1,5 @@
import time
from collections import OrderedDict
from typing import Union
from core.aochat import server_packets
@@ -9,6 +10,7 @@ from core.command_param_types import Const, Int, Any, Options, Character
from core.command_request import CommandRequest
from core.db import DB
from core.decorators import instance, command, timerevent, event
from core.dict_object import DictObject
from core.event_service import EventService
from core.lookup.character_service import CharacterService
from core.lookup.pork_service import PorkService
@@ -20,6 +22,7 @@ from core.igncore import IgnCore
from core.util import Util
from modules.core.accounting.services.account_service import AccountService
from modules.raidbot.raid.preset_controller import PresetController
from modules.standard.online.online_controller import OnlineController
from modules.standard.raid.leader_controller import LeaderController
@@ -75,6 +78,7 @@ class RaidbotController(BaseModule):
self.private_channel_service: PrivateChannelService = registry.get_instance("private_channel_service")
self.account_service: AccountService = registry.get_instance("account_service")
self.buddy_service: BuddyService = registry.get_instance("buddy_service")
self.online: OnlineController = registry.get_instance("online_controller")
@event("connect", "Adds all raiders to buddylist")
def connect(self, _, _1):
@@ -192,7 +196,7 @@ class RaidbotController(BaseModule):
if not char.char_id:
return self.getresp("global", "char_not_found", {"char": char.name})
if not self.private_channel_service.in_private_channel(char.char_id):
return f"The player <highlight>{char.name}</highlight> is not in my private channel. Could not add him."
return f"The player <highlight>{char.name}</highlight> is not in my private channel. You cannot add him/her to the raid."
main_id = self.account_service.get_main(char.char_id).char_id
in_raid = self.is_in_raid(main_id)
if in_raid is not None:
@@ -365,6 +369,47 @@ class RaidbotController(BaseModule):
raider_names.clear()
return ChatBlob("Active check", blob)
@command(command="raid", params=[Const("list")], description="Get a list if (in)active raiders.",
access_level="leader", sub_command="manage")
def raid_check_cmd(self, _1, _):
if not self.raid:
return self.NO_RAID_RUNNING_RESPONSE
raiders = {}
o = self.online.online_display.get_online_players("ORDER BY p.profession, p.name", "", [self.bot.get_char_name(), self.bot.get_char_id()])
users = []
for x in self.raid.raiders:
if x.is_active:
users.append(self.character_service.resolve_char_to_name(x.active_id))
for x in o:
if x.channel_id not in [1, 2, 4] and x.name not in users:
continue
if x.name in raiders.keys():
if raiders[x.name].channel_id < x.channel_id:
continue
raiders[x.name] = x
if x.name in users:
raiders[x.name].update({'in_raid': True})
else:
raiders[x.name].update({'in_raid': False})
raiders = DictObject(raiders)
blob = ""
for name, raider in raiders.items():
if not raider.in_raid and raider.channel_id > 2:
continue
entry = f"{self.util.get_prof_icon(raider.profession)} " \
f"{self.text.zfill(raider.level, 220)}/<green>{self.text.zfill(raider.ai_level, 30)}</green> " \
f"{raider.name} [<highlight>{raider.main_name or raider.name}</highlight>] - " \
f"{'<green>In Raid</green>' if raider.in_raid else '<red>Not in Raid</red>'}"
if raider.in_raid:
entry += f" - [{self.text.make_tellcmd('Kick', f'raid kick {raider.name} <no reason given>')}]"
else:
entry += f" - [{self.text.make_tellcmd('Add', f'raid add {raider.name}')}]"
blob += f"{entry}\n"
return ChatBlob("Raid list", blob)
@command(command="raid", params=[Const("kick"), Character("char"), Any("reason")],
description="Set raider as kicked with a reason", access_level="leader", sub_command="manage")
def raid_kick_cmd(self, request, _2, char: SenderObj, reason: str):