Exemplo n.º 1
0
    def test_towerattack_cmd(self, request, _, attacker, def_faction,
                             def_org_name):
        playfield_name = "Perpetual Wastelands"
        x_coords = "123"
        y_coords = "456"
        if not attacker:
            attacker = request.sender
        if not def_faction:
            def_faction = "Neutral"
        if not def_org_name:
            def_org_name = "DefendOrg"

        char_info = self.pork_service.get_character_info(attacker.name)
        if not char_info:
            return f"Could not retrieve character info for <highlight>{attacker.name}</highlight>."
        elif not char_info.org_name:
            f"{attacker.name} just attacked the {def_faction} organization {def_org_name.lower()}'s tower in {playfield_name} at location ({x_coords}, {y_coords})."
        else:
            # The %s organization %s just entered a state of war! %s attacked the %s organization %s's tower in %s at location (%d,%d).
            ext_msg = self.ext_message_as_string(506, 12753364,
                                                 [("s", char_info.faction),
                                                  ("s", char_info.org_name),
                                                  ("s", char_info.name),
                                                  ("s", def_faction),
                                                  ("s", def_org_name),
                                                  ("s", playfield_name),
                                                  ("s", x_coords),
                                                  ("s", y_coords)])
            packet = server_packets.PublicChannelMessage(
                TowerMessagesController.ALL_TOWERS_ID, 0, ext_msg, "\0")
            self.bot.incoming_queue.put((request.conn, packet))
Exemplo n.º 2
0
    def test_org_leave_cmd(self, request, _1, _2, char):
        if not char.char_id:
            return "Character <highlight>%s</highlight> does not exist." % char.name

        category_id, instance_id = OrgMemberController.LEFT_ORG
        ext_msg = self.ext_message_as_string(category_id, instance_id, [("s", char.name)])
        packet = server_packets.PublicChannelMessage(PublicChannelService.ORG_MSG_CHANNEL_ID, 0, ext_msg, "\0")
        self.bot.incoming_queue.put((request.conn, packet))
Exemplo n.º 3
0
    def test_cloak_status_command(self, request, _, cloak_status):
        ext_msg = self.ext_message_as_string(1001, 1,
                                             [("s", request.sender.name),
                                              ("s", cloak_status)])

        packet = server_packets.PublicChannelMessage(
            request.conn.org_channel_id, 0, ext_msg, "\x02\x01")
        self.bot.incoming_queue.put((request.conn, packet))
Exemplo n.º 4
0
 def test_towervictory_cmd(self, request, _, attack_faction,
                           attack_org_name, def_faction, def_org_name,
                           playfield_name):
     msg = "The %s organization %s attacked the %s %s at their base in %s. The attackers won!!" % (
         attack_faction.capitalize(), attack_org_name,
         def_faction.capitalize(), def_org_name, playfield_name)
     packet = server_packets.PublicChannelMessage(
         TowerMessagesController.TOWER_BATTLE_OUTCOME_ID, 0, msg, "\0")
     self.bot.incoming_queue.put((request.conn, packet))
Exemplo n.º 5
0
    def test_citytargetted_command(self, request, _):
        ext_msg = self.ext_message_as_string(1001, 3, [("s", "Antarctica")])

        packet = server_packets.PublicChannelMessage(request.conn.org_channel_id, request.sender.char_id, ext_msg, "\0")
        self.bot.incoming_queue.put((request.conn, packet))