From 0270524468042485eaf7b2fecd01867f51b21c48 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Fri, 4 Dec 2020 22:27:54 -0600 Subject: [PATCH 1/3] ignoring objs,rooms,zones .json --- .gitignore | 3 +++ resources/json/books.json | 2 +- resources/json/objs.json | 1 - resources/json/rooms.json | 23 ----------------------- resources/json/zones.json | 14 -------------- 5 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 resources/json/objs.json delete mode 100644 resources/json/rooms.json delete mode 100644 resources/json/zones.json diff --git a/.gitignore b/.gitignore index 9fe3219..854f5ed 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ server/logs/lockwarnings.log.1 server/logs/portal.log.2020_11_30 server/logs/server.log.2020_11_24 server/logs/server.log.2020_11_25 +resources/json/rooms.json +resources/json/zones.json +resources/json/objs.json diff --git a/resources/json/books.json b/resources/json/books.json index a68bf92..48e3edb 100644 --- a/resources/json/books.json +++ b/resources/json/books.json @@ -152,7 +152,7 @@ "date": "2E418-431", "author": "Doctor Alfidia Lupus ", "title": "Crafting: Orc Style", - "contents": "Being notes by Doctor Alfidia Lupus for a series of pamphlets on the major cultural styles of Tamriel\n\n(Dr. Lupus was Imperial Ethnographer for Potentate Savirien-Chorak from 2E 418 to 431)\n\nI saw Divayth last night, briefly, at the Torchbug. I told him I truly cared for him, but that Morian had won my heart. He clouded over like a storm in the Jeralls, but then took a deep breath and managed a dignified exit. Oh, I do hope he'll be all right.\n\nThough I confess, I'm more worried about Morian. His experiments with Divayth are reaching their climax, when Morian will open a gate and personally make a visit to Oblivion. He says he's going to try for Azura's realm of Moonshadow, as he says that ought to be relatively safe. Safe! I'm as anxious as a scrib on a griddle. I dearly want to see Morian before he goes, but he says he must concentrate on mastering the ritual and can't be interrupted.\n\nHe did send a note by Seif-ij saying I should take his place representing the University at the Potentate's state dinner for the new envoy from Orsinium. He must really be busy to skip that event, as I know he was keen to go. Well, all the better for my Racial Motifs project, I suppose—work, work, work will take my mind off my worries!\n\nThe new province of Orsinium doesn't have an embassy yet, so for the dinner the Potentate's snake-staff set up a row of pavilions on the grounds of the White-Gold Tower. To honor Envoy Thuggikh they were all decorated with authentic Orcish paraphernalia imported from Wrothgar, so I got out my journal and took notes during the interminable speeches.\n\nStrange to think that a folk as brutish as the Orcs seem to be could design and create objects of such sophistication! Of course they're known across Tamriel as fine armorers, but I'd always assumed that was due to their great strength rather than skill. A glance at their arms and armor was enough to show me how wrong my assumption had been. Though never ornate or over-embellished, their metalwork, though even simpler and more utilitarian than the Nords', displays a deep understanding of the laws of proportion, symmetry, and harmonic congruity. An Orcish sword may be a weapon of violence, but to contemplate the dynamic sweep of its blade, visually balanced by its heavy but shapely hilt, obviously molded to flow into the hand of its wielder—why, it's almost restful and reassuring.\n\nAfterwards at the reception I was happy to see somebody I recognized in Lady Opel the Arch-Magister. She greeted me warmly and, over some West Weald wine and Eidar cheese, asked me how things were going with me and my pair of wizards. I told her I thought I'd made a terrible muddle of things, but she assured me everything would work out in the end. She said she's known Morian for ever so long, and he's really quite sensible beneath his fussy old-man ways. She was glad he'd found someone as clever as I to keep him from completely vanishing into his laboratory.\n\nBut as far as I'm concerned, that's exactly what he's done. I think I'll go talk to Seif-ij again—maybe he can help me get through to Morian before he leaves." + "contents": "Being notes by Doctor Alfidia Lupus for a series of pamphlets on the major cultural styles of Tamriel\n\n(Dr. Lupus was Imperial Ethnographer for Potentate Savirien-Chorak from 2E 418 to 431)\n\nI saw Divayth last night, briefly, at the Torchbug. I told him I truly cared for him, but that Morian had won my heart. He clouded over like a storm in the Jeralls, but then took a deep breath and managed a dignified exit. Oh, I do hope he'll be all right.\n\nThough I confess, I'm more worried about Morian. His experiments with Divayth are reaching their climax, when Morian will open a gate and personally make a visit to Oblivion. He says he's going to try for Azura's realm of Moonshadow, as he says that ought to be relatively safe. Safe! I'm as anxious as a scrib on a griddle. I dearly want to see Morian before he goes, but he says he must concentrate on mastering the ritual and can't be interrupted.\n\nHe did send a note by Seif-ij saying I should take his place representing the University at the Potentate's state dinner for the new envoy from Orsinium. He must really be busy to skip that event, as I know he was keen to go. Well, all the better for my Racial Motifs project, I suppose\u2014work, work, work will take my mind off my worries!\n\nThe new province of Orsinium doesn't have an embassy yet, so for the dinner the Potentate's snake-staff set up a row of pavilions on the grounds of the White-Gold Tower. To honor Envoy Thuggikh they were all decorated with authentic Orcish paraphernalia imported from Wrothgar, so I got out my journal and took notes during the interminable speeches.\n\nStrange to think that a folk as brutish as the Orcs seem to be could design and create objects of such sophistication! Of course they're known across Tamriel as fine armorers, but I'd always assumed that was due to their great strength rather than skill. A glance at their arms and armor was enough to show me how wrong my assumption had been. Though never ornate or over-embellished, their metalwork, though even simpler and more utilitarian than the Nords', displays a deep understanding of the laws of proportion, symmetry, and harmonic congruity. An Orcish sword may be a weapon of violence, but to contemplate the dynamic sweep of its blade, visually balanced by its heavy but shapely hilt, obviously molded to flow into the hand of its wielder\u2014why, it's almost restful and reassuring.\n\nAfterwards at the reception I was happy to see somebody I recognized in Lady Opel the Arch-Magister. She greeted me warmly and, over some West Weald wine and Eidar cheese, asked me how things were going with me and my pair of wizards. I told her I thought I'd made a terrible muddle of things, but she assured me everything would work out in the end. She said she's known Morian for ever so long, and he's really quite sensible beneath his fussy old-man ways. She was glad he'd found someone as clever as I to keep him from completely vanishing into his laboratory.\n\nBut as far as I'm concerned, that's exactly what he's done. I think I'll go talk to Seif-ij again\u2014maybe he can help me get through to Morian before he leaves." } } ] \ No newline at end of file diff --git a/resources/json/objs.json b/resources/json/objs.json deleted file mode 100644 index 9e26dfe..0000000 --- a/resources/json/objs.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/resources/json/rooms.json b/resources/json/rooms.json deleted file mode 100644 index bfb70bd..0000000 --- a/resources/json/rooms.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "1": { - "name": "The Void of Magnus", - "zone": "void", - "desc": "You float aimlessly in Magnus's void", - "flags": [ - "safe", - "no_trans", - "indoors" - ], - "type": "void", - "exits": { - "north": -1, - "south": -1, - "east": -1, - "west": -1, - "up": -1, - "down": -1 - }, - "edesc": {}, - "extra": {} - } -} \ No newline at end of file diff --git a/resources/json/zones.json b/resources/json/zones.json deleted file mode 100644 index 92306e7..0000000 --- a/resources/json/zones.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "1": { - "name": "void", - "builders": [ - "tavis" - ], - "lifespan": -1, - "level_range": [ - -1, - -1 - ], - "reset_msg": "another meaningless hour passes in the void" - } -} \ No newline at end of file From 527263198d35728729cd5b087bc7087eb7321b8d Mon Sep 17 00:00:00 2001 From: duysqubix Date: Fri, 4 Dec 2020 22:40:52 -0600 Subject: [PATCH 2/3] added aldmerish as a native language to the Altmer. wrote function that reset languages on character to untrained --- typeclasses/characters.py | 8 ++++++++ world/races.py | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/typeclasses/characters.py b/typeclasses/characters.py index 812e654..c9bc80d 100644 --- a/typeclasses/characters.py +++ b/typeclasses/characters.py @@ -40,6 +40,14 @@ def get(self, name, default=None): name = 'tamrielic' return getattr(self, name, default) + def clear(self): + """ resets languages on self to 0.0""" + for lang in VALID_LANGUAGES.keys(): + langattr = getattr(self, lang, None) + if not langattr: + continue + setattr(self, lang, LanguageSkill.untrained) + class EquipmentHandler: """ diff --git a/world/races.py b/world/races.py index 678f647..1f51341 100644 --- a/world/races.py +++ b/world/races.py @@ -2,7 +2,7 @@ Holds information regarding races of the scrolls """ -from world.languages import LanguageSkill, Tamrielic, Orcish +from world.languages import LanguageSkill, Tamrielic, Orcish, Aldmeris from world.attributes import Attribute from world.traits import * from world.characteristics import StrChar, EndChar, AgiChar, IntChar, WpChar, PrcChar, PrsChar @@ -106,6 +106,8 @@ def init(self): 'enchanting', 'illusion', 'mysticism', 'restoration' ]) + self.known_languages.extend([Aldmeris.__lang_name__]) + class Argonian(Race): """ @@ -450,5 +452,6 @@ def change_race(caller, race): caller.attrs.race = Attribute(race.name, value=race) # add known languages of race + caller.languages.clear() # reset languages to 0.0 for language in race.known_languages: setattr(caller.languages, language, LanguageSkill.master) \ No newline at end of file From 249088aac2ca3481ab8768aedd7bbb400eb45a63 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Fri, 4 Dec 2020 23:28:15 -0600 Subject: [PATCH 3/3] updated veriage on orcish to fine-tune language. Created function that capitalizes first word of each sentence. --- commands/informative.py | 3 ++- world/languages.py | 6 +++--- world/utils/utils.py | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/commands/informative.py b/commands/informative.py index 30ee39e..f03ee90 100644 --- a/commands/informative.py +++ b/commands/informative.py @@ -9,7 +9,7 @@ from evennia.utils import evmore from evennia.utils.utils import inherits_from from commands.command import Command -from world.utils.utils import can_see_obj, is_book, is_container, is_equipped, is_invis, is_obj, is_pc_npc, is_wielded, is_worn, match_name, parse_dot_notation, rplanguage_parse_string +from world.utils.utils import can_see_obj, capitalize_sentence, is_book, is_container, is_equipped, is_invis, is_obj, is_pc_npc, is_wielded, is_worn, match_name, parse_dot_notation, rplanguage_parse_string from evennia.utils.ansi import raw as raw_ansi @@ -154,6 +154,7 @@ def show_book(book): level=1.0 - lang_skill.level, language=book_lang) + contents_translated = capitalize_sentence(contents_translated) BookEvMore(ch, book_contents + contents_translated) if not self.args: diff --git a/world/languages.py b/world/languages.py index 89cc661..beb7827 100644 --- a/world/languages.py +++ b/world/languages.py @@ -125,10 +125,10 @@ class Orcish(_Language): __lang_name__ = "orcish" def define_language(self): - self.phonemes = "a u o g kh rz k r z th t m y ush am oo d ug zz gg eg ag oz uu us uth zu rul ol ru hz ri au ai kr" + self.phonemes = "a g kh rz k r z th t m ush am oo d ug zz gg eg ag oz uu us uth zu rul ol ru hz ri au ai kr gog rzn lag" self.vowels = "auo" - self.grammar = "ccvcc vccv cvccv cvccvcc" - self.word_length_variance = 1 + self.grammar = "ccvvcc ccvcc vccv vccvccvcc ccvvcvcc cvcccvcc cvcc vccccvc vcvcc cvccccv ccvcvccc cvccvcc cvcvcvcc cvcccvc ccccvc vcvvc vccvcvc ccvcv cvccvc cvccccvc cvccc cvccvcvc cvvcvc ccvccvccvc vcccvc vcvcvc ccvccvc cvccv cvcvccvcc cvcvcvc cvcvcv cvcccv cvcvcc cvcvcccc vcvccvc vccvc ccvcvc cvccccc cvcccccc" + self.word_length_variance = 2 VALID_LANGUAGES = { diff --git a/world/utils/utils.py b/world/utils/utils.py index 35a13a0..f42423a 100644 --- a/world/utils/utils.py +++ b/world/utils/utils.py @@ -10,6 +10,9 @@ from evennia.utils.utils import inherits_from, string_partial_matching from world.conditions import DetectHidden, DetectInvis, Hidden, HolyLight, Invisible, Sleeping, get_condition +_CAP_PATTERN = re.compile(r'((?<=[\.\?!\n]\s)(\w+)|(^\w+))') +_LANG_TAGS = re.compile('\>(.*?)\<', re.I) + def highlight_words(block, key_targets, color_codes): key_targets = make_iter(key_targets) @@ -23,6 +26,11 @@ def highlight_words(block, key_targets, color_codes): return block +def capitalize_sentence(string): + global _CAP_PATTERN + return _CAP_PATTERN.sub(lambda x: x.group().capitalize(), string) + + def rplanguage_parse_string(ch, string): """ Obfuscates string based on keys that set the type of language @@ -41,8 +49,9 @@ def rplanguage_parse_string(ch, string): If you plan on using this function, it is import that string supplied must have >[language]< first then contents in order for this function to parse correctly. """ - pattern = re.compile('\>(.*?)\<', re.I) - chunks = re.split(pattern, string)[1:] + global _LANG_TAGS + + chunks = re.split(_LANG_TAGS, string)[1:] if not chunks: # no tags found for a language return string @@ -70,7 +79,8 @@ def rplanguage_parse_string(ch, string): language=lang) new_string.append(obfuscated_string) - return "".join(new_string) + translated_string = "".join(new_string) + return capitalize_sentence(translated_string) def apply_obj_effects(ch, obj):