Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Send character list with escape characters (#142)
Browse files Browse the repository at this point in the history
Fixes #124.
  • Loading branch information
caleb-mabry authored Feb 20, 2021
1 parent c766755 commit 90150cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
9 changes: 9 additions & 0 deletions server/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ class TargetType(Enum):
ALL = 6
AFK = 7


class MusicEffect(IntFlag):
FADE_IN = 1
FADE_OUT = 2
SYNC_POS = 4


ESCAPE_CHARACTERS = {
'%': '<percent>',
'#': '<num>',
'$': '<dollar>',
'&': '<and>'
}
26 changes: 17 additions & 9 deletions server/network/aoprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from .. import commands
from server.fantacrypt import fanta_decrypt
from server.exceptions import ClientError, AreaError, ArgumentError, ServerError
from server.client_manager import ClientManager
from server import database
from time import localtime, strftime
import re
import arrow
from enum import Enum
import asyncio
import re
import logging
import unicodedata

import logging
from enum import Enum
from typing import List
from time import localtime, strftime

from .. import commands
from server import database
from server.fantacrypt import fanta_decrypt
from server.constants import ESCAPE_CHARACTERS
from server.exceptions import ClientError, AreaError, ArgumentError, ServerError


logger_debug = logging.getLogger('debug')
logger = logging.getLogger('events')
Expand Down Expand Up @@ -328,6 +331,11 @@ def net_cmd_rc(self, _):
AC#%
"""
for i, char in enumerate(self.server.char_list):
for esc in ESCAPE_CHARACTERS.keys():
if esc in char:
char = char.replace(esc, ESCAPE_CHARACTERS[esc])
self.server.char_list[i] = char

self.client.send_command('SC', *self.server.char_list)

Expand Down

0 comments on commit 90150cd

Please sign in to comment.