{"id":20722504,"url":"https://github.com/toomanybees/av-verify","last_synced_at":"2025-07-25T20:36:35.862Z","repository":{"id":11463069,"uuid":"13927423","full_name":"TooManyBees/Av-Verify","owner":"TooManyBees","description":"Area and Mobprog verifier for AVATAR Mud","archived":false,"fork":false,"pushed_at":"2022-08-21T04:34:10.000Z","size":261,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T23:15:32.709Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TooManyBees.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-28T14:02:51.000Z","updated_at":"2022-01-24T04:45:39.000Z","dependencies_parsed_at":"2022-09-14T03:00:20.119Z","dependency_job_id":null,"html_url":"https://github.com/TooManyBees/Av-Verify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2FAv-Verify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2FAv-Verify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2FAv-Verify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2FAv-Verify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TooManyBees","download_url":"https://codeload.github.com/TooManyBees/Av-Verify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242996886,"owners_count":20219036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T03:36:07.602Z","updated_at":"2025-03-11T08:20:53.028Z","avatar_url":"https://github.com/TooManyBees.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Av Verify\n\nArea and Prog verifiers for AVATAR Mud, implemented in Ruby.\n\nThe file `test-air.are` is a lightly modified version of `air.are` distributed with [Merc 2.2](http://www.mudbytes.net/index.php?a=files\u0026cid=9).\n\n## vArea : the area verifier\n\nUsage: `ruby varea.rb filename.are [nowarning|cosmetic|nocolor]`\n\n* `nowarning`: Suppresses warnings that won't prevent the area from functioning (typically these consist of loading vnums from outside the area file)\n* `cosmetic`: Shows cosmetic warnings that are normally suppressed (mostly just tildes on the wrong line)\n* `nocolor`: Disables ANSI color codes, so output can be cleanly piped into another program\n* `notices`: Shows notices that are suppressed by default (notices consist of room exits leaving the area, and resets referencing a section that isn't in the file)\n\nvArea relies on proper formatting to do its thing, or you will get unexpected errors. That means output from an area builder, etc. Also, while it is technically possible to have more than one of the same section in the same area file (multiple #OBJECTS in houses.are for example), vArea won't parse it.\n\n### Main classes\n\n#### Area\n\nIncludes `Parsable` and `AreaAttributes` modules. This is what can be thought of as the area file in object form. Its initializer accepts a file path string (relative) which it loads and promptly dissects into sections, detects their type, and instantiates them into the appropriate objects.\n\nSections are accessible in Area#main_sections.\n\n`verify_all` simply runs an each loop on self.main_sections that calls the section's `parse` method, then add the section's resulting errors (if any) to the area's errors.\n\n`correlate_all` runs a different set of checks that compares vnum references between sections, the obvious example being #RESETS. It is a shorthand method for separately running `correlate_rooms`, `_resets`, `_specials`, and `_shops`. See the section on the `Correlation` class below for more info.\n\n#### Section\nIncludes `Parsable` module. Most sections that are a collection of smaller things (so anything except `AreaHeader` and `AreaData`) present a hash-like interface, in which they have `[]`, `each`, `length`, and `key?` methods. Keyed by VNUM where appropriate. These are not inherited, though they should be (a task for later improvement)\n\nSubclasses of Section:\n* `AreaHeader`\n* `AreaData`\n* `Helps`\n* `VnumSection`\n  * `Mobiles`\n  * `Objects`\n  * `Rooms`\n* `Resets`\n* `Shops`\n* `Specials`\n\n#### VnumSection\n\nSince #Mobiles, #Objects, and #Rooms are all structured similarly, they share the parent class VnumSection. Each of the child sections supply the class name of the items they contain (Mobs, Objects, Rooms respectively) so that VnumSection can break apart the text and instantiate new `self.child_class` objects.\n\n#### LineByLineItem\nIncludes `Parsable` and `TheTroubleWithTildes`. Its subclasses are all parsed the same way (line by line, if you couldn't guess)\n\nIts subclasses are:\n* `Mobile` includes `HasApplyFlag` and `HasQuotedKeywords`\n* `Object` includes `HasApplyFlag` and `HasQuotedKeywords`\n* `Room` includes `HasQuotedKeywords`\n* `Shop` (is the bane of my existance)\n\n#### HelpFile\nIncludes `Parsable`, `HasQuotedKeywords`, and `TheTroubleWithTildes` modules.\n\n#### Reset\n\nIncludes `Parsable` module. A reset can be of type mob, inventory, equipment, object, container, door, or random. Its visible attributes are `Reset#vnum`, `Reset#target`, `Reset#slot`, and `Reset#limit`. Vnum is typically the identifier (references the room, object, or mob that it's placing), and target is typically another vnum (the one it's loading into or onto, etc). Limit and slot are not always used.\n\nResets have no knowledge of the rest of the area, so they can't tell whether or not the items they're referencing exist.\n\n#### Special\n\nIncludes `Parsable` module.\n\n### Helper classes\n\n#### Bits\nInherits from `Array`, and has the following methods for dealing with bit fields:\n\n* `Bits::pattern` \u0026 `Bits::insert` return regex patterns that match a pipe-separated bitfield in string format, and the same bitfield as a substring in a larger string.\n* `Bits#initialize(bits)` accepts both a pipe-separated string or an array of numbers\n* `Bits#bit?(i)` true if `i` is part of the bit field\n* `Bits#error?` true if any of its bits was not a power of 2 to start with\n* `Bits#sum`\n* `Bits#to_a`\n\n#### Error\nAn error contains the line number on which it occurred, a copy of that line of text, its type (`:error`, `:warning`, `:nb`, or `:ugly`), and a copy of its error message.\n\nHas a `to_s` method which, if passed true, disables color output.\n\n#### Correlation\nAccepts a hash of options (`area`, `mobiles`, `objects`, `rooms`, `resets`, `shops`, `specials`. The individual sections, if present, override the sections from the area).\n\n`correlate_doors` detects doors whose destinations rooms aren't in the area.\n\n`correlate_shops` and `correlate_specials` detects shops and specials whose vnums don't correspond to mobiles in the area.\n\n`correlate_resets` is a macro for a bunch of checks specific to the type of reset, but basically consist of ensuring that mobs, objects, and rooms referenced as vnums actually exist in the area.\n\nAll errors raised here are warnings, and errors raised from doors not matching up with rooms are notices which means they're suppresed by default (since obviously an area will have detinations out of the area). Also, if a required section isn't passed to the correlation instance, it will only raise a single notice like\n\n```\nLine 2694: No MOBILES section in area, 46 mob references in RESETS skipped\n```\nwhere the line number is where `RESETS` section started.\n\n### Modules\n\n#### AreaAttributes\nGives Area its getter methods, namely:\n\n* `name`, `author`, `level`, all strings, from AreaHeader\n* `plane` and `zone`, both numbers, from AreaData\n* `flags`, a Bits object, from AreaData\n* `outlaw`, `seeker` (a.k.a kspawn), `modifiers`, `group_exp`, all hashes of their respective fields, from AreaData\n* `helps`, an array of help files, from Helps\n* `mobiles`, the actual Mobiles object, if any\n* `objects`, the actual Objects object, if any\n* `rooms`, the actual Rooms object, if any\n* `resets`, the actual Resets object, if any\n* `shops`, the actual Shops object, if any\n* `specials`, the actual Specials object, if any\n\nEach getter will return nil if the section that contains the data it's looking for isn't in the area. If the section is found, it will also cache its return value so it's only looked up once.\n\n#### Parsable\nSupplies the `Error` class and bestows the `err` method (and its ilk), and the `error_report` method that prints all of the object's errors.\n\nAlso supplies the `err_msg` method as a class method, which accepts a symbol and any number of optional arguments, and returns an error string corresponding to the symbol with the arguments interpolated into it.\n\n#### HasApplyFlag\nBestows the `parse_apply_flag` method. Both objects and mobiles use this.\n\n#### HasQuotedKeywords\nBestows the `parse_quoted_keywords` method which turns a string of keywords into an array of keywords, taking single quotes into account.\n\nAlso generates errors for mismatched quotes, and if supplied a boolean will generate a warning if there are any quotes in the keywords. (Since you probably don't want to be quoting an object keyword.)\n\n#### TheTroubleWithTildes\nIt is what it sounds like.\n\n\n## vProg : the prog verifier\n\nUsage: `ruby vprog.rb filename.prg [nowarning|showdeprecated|showunknown|nocolor]`\n\n* `nowarning`: As above, suppresses warnings that won't prevent the prog from running\n* `showdeprecated`: Will whine about using the old style of insignia tracking\n* `showunknown`: Will whine about unknown trigger types. (Since most prog files will intentionally have lots of these, it's more of an occasional guard against typos in case you notice something awry)\n* `nocolor`: Drains color from your face and makes you look like a vampire. N.B. This option does _not_ give you fangs. You must manually use candy corns for that. (Just kidding, it disables ANSI color codes.)\n\nDanger: here (in the code) be dragons. This will likely never receive the same refactoring treatment that vArea did, on account of there being less of a reason to give it a proper API. Also it just isn't worth the sorrow.\n\n# To do\n\n### Immediate\n\n* Unify error messages so we don't have to chain a bunch of references like `self.class.err_msg(whatever)`, or traverse class hierarchies just to get to the right error message\n\n### Long term\n\n* Ability to pass a vnum range and have the program ignore external references to those vnums. I.e. \"I know vnums i-j aren't in the file, don't throw me warnings about them.\"\n* Add object/mob analysis. Give breakdown of mob levels and specs, object levels and their apply flags, etc.\n* Mob flow analysis. Could be crazy difficult. Given room connections and terrain types, predict \"bottleneck\" rooms that could be hard to spot just from reading the area file text. It may be impractical to take random exits and non-Euclidean layouts into account. (Nah it won't, I just wanted an excuse to type \"non-Euclidean\".)\n* Separate classes for actual areafile elements, and for the objects that parse text into them (so a valid Mobile doesn't have a @current_line, @contents, etc.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoomanybees%2Fav-verify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoomanybees%2Fav-verify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoomanybees%2Fav-verify/lists"}