def _game_board(self, title=""): """ Returns the game board. """ text = { "FORM": """ ◓═══════════◓ xAxxxxxxxxx ◓═══════════◓ A B C 1 -┃-┃- ━╋━╋━ 2 -┃-┃- ━╋━╋━ 3 -┃-┃- ◓═══════════◓\ """ } form = str(evform.EvForm(form=text, cells={"A": title})) for position in self.db.game_field: form = form.replace("-", position, 1) return form
def func(self): form = evform.EvForm("world/charactersheetform.py") form.map( cells={ 1: self.caller.name, 2: self.caller.db.tradition, 3: self.caller.db.essence, 4: self.caller.db.concept, 5: self.caller.db.desc, 6: self.caller.db.strength, 7: self.caller.db.dexterity, 8: self.caller.db.stamina, 9: self.caller.db.charisma, 10: self.caller.db.manipulation, 11: self.caller.db.appearance, 12: self.caller.db.perception, 13: self.caller.db.intelligence, 14: self.caller.db.wits, 15: self.caller.db.alertness, 16: self.caller.db.athletics, 17: self.caller.db.awareness, 18: self.caller.db.brawl, 19: self.caller.db.intimidation, 20: self.caller.db.streetwise, 21: self.caller.db.drive, 22: self.caller.db.firearms, 23: self.caller.db.martialarts, 24: self.caller.db.melee, 25: self.caller.db.meditation, 26: self.caller.db.stealth, 27: self.caller.db.astrology, 28: self.caller.db.computer, 29: self.caller.db.language, 30: self.caller.db.medicine, 31: self.caller.db.occult, 32: self.caller.db.rituals, 33: self.caller.db.correspondence, 34: self.caller.db.entropy, 35: self.caller.db.forces, 36: self.caller.db.life, 37: self.caller.db.matter, 38: self.caller.db.mind, 39: self.caller.db.prime, 40: self.caller.db.spirit, 41: self.caller.db.time, 42: self.caller.db.arete, 43: self.caller.db.arcane, 44: self.caller.db.avatar, 45: self.caller.db.willpower, 46: self.caller.db.belief, 47: self.caller.db.familiar, 48: self.caller.db.quitnessence, 49: self.caller.db.luck, 50: self.caller.db.resources }) self.caller.msg(unicode(form))
def _simple_form(self, form): cellsdict = {1: "Apple", 2: "Banana", 3: "Citrus", 4: "Durian"} formdict = {"FORMCHAR": 'x', "TABLECHAR": 'c', "FORM": form} form = evform.EvForm(form=formdict) form.map(cellsdict) form = ansi.strip_ansi(str(form)) # this is necessary since editors/black tend to strip lines spaces # from the end of lines for the comparison strings. form = "\n".join(line.rstrip() for line in form.split("\n")) return form
def _parse_form(self): "test evform. This is used by the unittest system." form = evform.EvForm("evennia.utils.tests.data.evform_example") # add data to each tagged form cell form.map( cells={ "AA": "|gTom the Bouncer", 2: "|yGriatch", 3: "A sturdy fellow", 4: 12, 5: 10, 6: 5, 7: 18, 8: 10, 9: 3, "F": "rev 1", }) # create the EvTables tableA = evtable.EvTable("HP", "MV", "MP", table=[["**"], ["*****"], ["***"]], border="incols") tableB = evtable.EvTable( "Skill", "Value", "Exp", table=[ ["Shooting", "Herbalism", "Smithing"], [12, 14, 9], ["550/1200", "990/1400", "205/900"], ], border="incols", ) # add the tables to the proper ids in the form form.map(tables={"A": tableA, "B": tableB}) return str(form)
def test_ansi_escape(self): # note that in a msg() call, the result would be the correct |-----, # in a print, ansi only gets called once, so ||----- is the result self.assertEqual(unicode(evform.EvForm(form={"FORM": "\n||-----"})), "||-----")