#class map kill #class map open #showme {Loading Rites of Passage map class} /* * This mapper will use the GMCP data that RoP provides to create a map and track your whereabouts. * Create a "map" directory where the script will keep the map file and optionally create a map/locations.tt file * where you can define specific locations or fast travel points. * * Enjoy! * * Nova - 2026 */ #read {map/locations.tt} #nop Rites of Passage 2: highest vnum currently in use is 93603; #var {map_size} {100000}; #var {map_file} {map/gmcp.map}; #var {map_out} {map-out.txt}; #var {revexits} { {n} {s} {e} {w} {s} {n} {w} {e} {u} {d} {d} {u} } #var {sector_colors} { {} {<178>} {none} {<178>} {inside} {<178>} {city} {<178>} {water} {<068>} {forest} {<020>} {hills} {<030>} {field} {<120>} {desert} {<130>} {mountain} {<030>} {underwater} {<168>} {air} {<160>} {snow} {<170>} {tropical} {<128>} {water swim} {<068>} {water no-swim} {<148>} {water_deep} {<148>} {ice} {<170>} {marsh} {<108>} } #nop Door handling helpers; #var {autoclose} {0} #alias {autoclose} { #if {$autoclose} {close %0} } #var {door_n} {false}; #var {door_e} {false}; #var {door_s} {false}; #var {door_w} {false}; #var {door_u} {false}; #var {door_d} {false}; #alias {n} { #if {"$door_n" == "true"} {open north}; north; autoclose south } #alias {e} { #if {"$door_e" == "true"} {open east}; east; autoclose west } #alias {s} { #if {"$door_s" == "true"} {open south}; south; autoclose north } #alias {w} { #if {"$door_w" == "true"} {open west}; west; autoclose east } #alias {u} { #if {"$door_u" == "true"} {open up}; up; autoclose down } #alias {d} { #if {"$door_d" == "true"} {open down}; down; autoclose up } #nop Aliases that make mapping life easier; #alias {door} { #if {"%1" == "n"} { #map exit n command {open n;n;autoclose s} }; #if {"%1" == "e"} { #map exit e command {open e;e;autoclose w} }; #if {"%1" == "s"} { #map exit s command {open s;s;autoclose n} }; #if {"%1" == "w"} { #map exit w command {open w;w;autoclose e} }; #if {"%1" == "d"} { #map exit d command {open d;d;autoclose u} }; #if {"%1" == "u"} { #map exit u command {open u;u;autoclose d} }; } #alias {secret} { #if {"%1" == "n"} { #map exit n command {open '%2';n;autoclose '%2'} }; #if {"%1" == "e"} { #map exit e command {open '%2';e;autoclose '%2'} }; #if {"%1" == "s"} { #map exit s command {open '%2';s;autoclose '%2'} }; #if {"%1" == "w"} { #map exit w command {open '%2';w;autoclose '%2'} }; #if {"%1" == "d"} { #map exit d command {open '%2';d;autoclose '%2'} }; #if {"%1" == "u"} { #map exit u command {open '%2';u;autoclose '%2'} }; } #nop Handle the GMCP events; #EVENT {SESSION CONNECTED} { #var TELNET[IAC] \xFF; #var TELNET[DONT] \xFE; #var TELNET[DO] \xFD; #var TELNET[WONT] \xFC; #var TELNET[WILL] \xFB; #var TELNET[SB] \xFA; #var TELNET[SE] \xF0; #var TELNET[GMCP] \xC9; #nop Turn telnet debug on to see telnet debugging information; #nop #config {debug telnet} {on}; #nop split 16 1; #map create $map_size; #map goto 1; #map flag static; #map flag nofollow; #map flag vtmap; #map read $map_file; } #EVENT {SESSION DISCONNECTED} { #map write $map_file; } #nop To avoid writing a map to disk on every MAP ENTER ROOM event, check if we've moved before writing a map; #var {current_room} {0} #nop I prefer to write the map to a file so I don't have to deal with #split shenanigans; #EVENT {MAP ENTER ROOM} { #if {$current_room != $gmcp[room][info][num]} { #var {current_room} {$gmcp[room][info][num]}; #map map 50 170 overwrite $map_out; }; } #alias {gmcp} { #if {"%1" == "on"} { #send {$TELNET[IAC]$TELNET[DO]$TELNET[GMCP]\}; }; #if {"%1" == "off"} { #send {$TELNET[IAC]$TELNET[DONT]$TELNET[GMCP]\}; }; } #EVENT {IAC WILL GMCP} { #info SYSTEM save; #nop core.supports.set "char.items 1", maybe others too?; gmcp on; #send {$TELNET[IAC]$TELNET[SB]$TELNET[GMCP] core.hello { "client": "$info[SYSTEM][CLIENT_NAME]", "version": "$info[SYSTEM][CLIENT_VERSION]" } $TELNET[IAC]$TELNET[SE]\}; #send {$TELNET[IAC]$TELNET[SB]$TELNET[GMCP] core.supports.set [ "room 1", "room.info 1", "char 1", "char.vitals 1", "char.status 1" ] $TELNET[IAC]$TELNET[SE]\} } #EVENT {IAC SB GMCP Room.Info IAC SE} { #var gmcp[room][info] {%0}; #if {$gmcp[room][info][num] == -1} { #return }; #map goto {$gmcp[room][info][num]} {dig}; #map get roomarea {result}; #nop We are in a new room, set it up; #if {"$result" == ""} { #map set roomarea $gmcp[room][info][zone]; #map set roomcolor $sector_colors[$gmcp[room][info][terrain]]; #map set roomname $gmcp[room][info][name]; #map set roomnote $gmcp[room][info][environment]; #map set roomterrain $gmcp[room][info][terrain]; #map set roominfo $gmcp[room][info][details]; #nop Flag deep water with the avoid flag so we won't try to path through them; #if {"$gmcp[room][info][terrain]" == "water_deep"} { #map roomflag avoid; } }; #foreach {*gmcp[room][info][exits][]} {exit} { #map get {roomexit} {result}; #if {&result[$exit] == 0} { #map get {roomvnum} {result} {$gmcp[room][info][exits][$exit]}; #nop Exits can contain door information: {exits} { {s} { {door} {1} {v} {9001} } }; #if {&gmcp[room][info][exits][$exit][door] == 0} { #map dig {$exit} {$gmcp[room][info][exits][$exit]}; }; #else { #map dig {$exit} {$gmcp[room][info][exits][$exit][v]}; #map exit $exit command {open $exit;$exit;autoclose $revexits[$exit]}; }; #if {$result == 0} { #map set {roomcolor} {<118>} {$gmcp[room][info][exits][$exit]} } }; #nop automatically open doors; #if {&gmcp[room][info][exits][$exit][door] == 0} { #var {door_$exit} {false}; }; #else { #if {$gmcp[room][info][exits][$exit][door] == 2} { #var {door_$exit} {true}; } } } } #nop TODO: We can handle map data using the Room.Map event; #nop #EVENT {IAC SB GMCP Room.Map IAC SE} { #VAR room[map] {%0} }; #nop Show a notification that your spider senses tingled; #action {You sense a hidden exit somewhere in this room. Perhaps you should} { notify Hidden exit in room $gmcp[room][info][num]; } #class map close