fix: room descriptions, exit connections, character placement
This commit is contained in:
141
world/fix_world.py
Normal file
141
world/fix_world.py
Normal file
@@ -0,0 +1,141 @@
|
||||
import os, sys
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "server.conf.settings"
|
||||
sys.path.insert(0, "/root/workspace/timmy-academy")
|
||||
import django
|
||||
django.setup()
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.utils.create import create_object
|
||||
|
||||
def get_room(rid):
|
||||
return ObjectDB.objects.get(id=rid)
|
||||
|
||||
def make_exit(name, aliases, source, dest):
|
||||
"""Create a two-way exit if it doesnt exist."""
|
||||
existing = ObjectDB.objects.filter(
|
||||
db_key=name, db_location=source, db_typeclass_path__icontains="exit"
|
||||
)
|
||||
if existing.exists():
|
||||
print(" [skip] {} already exists in {}".format(name, source.db_key))
|
||||
return
|
||||
exit_obj = create_object(
|
||||
typeclass="typeclasses.exits.Exit",
|
||||
key=name,
|
||||
location=source,
|
||||
destination=dest,
|
||||
aliases=aliases,
|
||||
)
|
||||
print(" [+] {} ({}) -> {}".format(name, source.db_key, dest.db_key))
|
||||
|
||||
# Room IDs from DB check
|
||||
LIMBO = get_room(2)
|
||||
DORM_ENTRANCE = get_room(3)
|
||||
LODGING_OFFICE = get_room(4)
|
||||
REST_CORRIDOR = get_room(5)
|
||||
NOVICE_DORMS = get_room(6)
|
||||
MASTER_SUITES = get_room(7)
|
||||
GRAND_COMMONS = get_room(8)
|
||||
DINING_HALL = get_room(9)
|
||||
SCHOLARS_CORNER = get_room(10)
|
||||
GAMES_ROOM = get_room(11)
|
||||
COMMONS_BALCONY = get_room(12)
|
||||
WORKSHOP_ENTRANCE = get_room(13)
|
||||
GREAT_SMITHY = get_room(14)
|
||||
ALCHEMY_LABS = get_room(15)
|
||||
WOODWORKING = get_room(16)
|
||||
ARTIFICING = get_room(17)
|
||||
GARDENS_ENTRANCE = get_room(18)
|
||||
HERB_GARDENS = get_room(19)
|
||||
ENCHANTED_GROVE = get_room(20)
|
||||
GREENHOUSE = get_room(21)
|
||||
SACRED_GROVE = get_room(22)
|
||||
|
||||
print("=== Building Dormitory Wing exits ===")
|
||||
make_exit("north", ["n"], DORM_ENTRANCE, LODGING_OFFICE)
|
||||
make_exit("south", ["s"], LODGING_OFFICE, DORM_ENTRANCE)
|
||||
make_exit("east", ["e"], DORM_ENTRANCE, REST_CORRIDOR)
|
||||
make_exit("west", ["w"], REST_CORRIDOR, DORM_ENTRANCE)
|
||||
make_exit("north", ["n"], REST_CORRIDOR, NOVICE_DORMS)
|
||||
make_exit("south", ["s"], NOVICE_DORMS, REST_CORRIDOR)
|
||||
make_exit("east", ["e"], REST_CORRIDOR, MASTER_SUITES)
|
||||
make_exit("west", ["w"], MASTER_SUITES, REST_CORRIDOR)
|
||||
|
||||
print("\n=== Building Commons Wing exits ===")
|
||||
make_exit("north", ["n"], GRAND_COMMONS, DINING_HALL)
|
||||
make_exit("south", ["s"], DINING_HALL, GRAND_COMMONS)
|
||||
make_exit("east", ["e"], GRAND_COMMONS, SCHOLARS_CORNER)
|
||||
make_exit("west", ["w"], SCHOLARS_CORNER, GRAND_COMMONS)
|
||||
make_exit("south", ["s"], GRAND_COMMONS, GAMES_ROOM)
|
||||
make_exit("north", ["n"], GAMES_ROOM, GRAND_COMMONS)
|
||||
make_exit("up", ["u"], GRAND_COMMONS, COMMONS_BALCONY)
|
||||
make_exit("down", ["d"], COMMONS_BALCONY, GRAND_COMMONS)
|
||||
|
||||
print("\n=== Building Workshop Wing exits ===")
|
||||
make_exit("east", ["e"], WORKSHOP_ENTRANCE, GREAT_SMITHY)
|
||||
make_exit("west", ["w"], GREAT_SMITHY, WORKSHOP_ENTRANCE)
|
||||
make_exit("south", ["s"], WORKSHOP_ENTRANCE, ALCHEMY_LABS)
|
||||
make_exit("north", ["n"], ALCHEMY_LABS, WORKSHOP_ENTRANCE)
|
||||
make_exit("west", ["w"], WORKSHOP_ENTRANCE, WOODWORKING)
|
||||
make_exit("east", ["e"], WOODWORKING, WORKSHOP_ENTRANCE)
|
||||
make_exit("down", ["d"], WORKSHOP_ENTRANCE, ARTIFICING)
|
||||
make_exit("up", ["u"], ARTIFICING, WORKSHOP_ENTRANCE)
|
||||
|
||||
print("\n=== Building Gardens Wing exits ===")
|
||||
make_exit("north", ["n"], GARDENS_ENTRANCE, HERB_GARDENS)
|
||||
make_exit("south", ["s"], HERB_GARDENS, GARDENS_ENTRANCE)
|
||||
make_exit("west", ["w"], GARDENS_ENTRANCE, ENCHANTED_GROVE)
|
||||
make_exit("east", ["e"], ENCHANTED_GROVE, GARDENS_ENTRANCE)
|
||||
make_exit("south", ["s"], GARDENS_ENTRANCE, GREENHOUSE)
|
||||
make_exit("north", ["n"], GREENHOUSE, GARDENS_ENTRANCE)
|
||||
make_exit("down", ["d"], ENCHANTED_GROVE, SACRED_GROVE)
|
||||
make_exit("up", ["u"], SACRED_GROVE, ENCHANTED_GROVE)
|
||||
|
||||
print("\n=== Fixing character locations ===")
|
||||
for char_id in [31, 33]: # Allegro, Timmy
|
||||
char = ObjectDB.objects.get(id=char_id)
|
||||
if char.db_location is None:
|
||||
char.db_location = LIMBO
|
||||
char.save()
|
||||
print(" [+] {} placed in Limbo".format(char.db_key))
|
||||
else:
|
||||
print(" [skip] {} already in {}".format(char.db_key, char.db_location.db_key))
|
||||
|
||||
print("\n=== Setting room descriptions for bare rooms ===")
|
||||
descs = {
|
||||
4: "The administrative heart of the dormitories. Ledgers and room assignments cover a broad oak desk. A enchanted quill hovers, ready to record new arrivals. Brass keys hang on numbered hooks along the wall.",
|
||||
5: "A long, hushed corridor lit by softly glowing sconces. Doors line both sides, each bearing a different sigil. The carpet underfoot absorbs all sound. Passages lead north to the novice halls and east to the master suites.",
|
||||
6: "A spacious communal hall with rows of simple but comfortable bunks. Each sleeping nook has a privacy curtain, a small desk, and a locked chest. Young wizards' personal effects dot the shelves — crystals, worn spellbooks, lucky charms.",
|
||||
7: "Private chambers for senior wizards. Each door is inscribed with its occupant's chosen sigil. The hallway is wider here, the carpet thicker, the sconces brighter. A faint scent of expensive incense lingers.",
|
||||
9: "A cavernous dining hall dominated by a great stone hearth perpetually ablaze with magical fire. Long oak tables seat dozens. The smell of fresh bread and roasting herbs fills the air. Enchanted serving platters float between kitchen and table.",
|
||||
10: "Tall bookshelves form a labyrinth of quiet study alcoves. Each nook has a reading lamp, a writing desk, and a silencing charm. Scrolls and tomes on every subject line the walls. A perpetual quiet hangs in the air.",
|
||||
11: "A bright, airy room filled with games and diversions. Chess sets with animated pieces, a billiards table, card tables, and a stage for performances. Laughter and the click of game pieces echo off vaulted ceilings.",
|
||||
12: "A sweeping balcony overlooking the Grand Commons below. Iron railings forged into vine patterns. The view encompasses the entire commons floor. A few small tables and comfortable chairs make this a favored spot for private conversations.",
|
||||
14: "Heat and hammer-song fill the Great Smithy. Multiple forges blaze along the walls, each attended by enchanted bellows. Anvils of various sizes stand ready. Racks of tongs, hammers, and files line every surface. Sparks dance like fireflies.",
|
||||
15: "Glass vessels of every shape bubble and steam on long stone counters. Color-coded reagent cabinets line the walls. A ventilation enchantment keeps the air clear despite the acrid fumes. Careful labels mark each substance.",
|
||||
16: "Sawdust and the sweet smell of fresh-cut wood permeate this warm workshop. Lathes, saws, planes, and chisels of every size hang in orderly rows. Half-finished projects — staffs, wands, furniture — rest on workbenches.",
|
||||
17: "A dimly lit chamber thrumming with arcane energy. Enchanting circles are etched into the stone floor, each ringed with silver. Crystal focusing lenses hang from adjustable arms. The walls are lined with completed artifacts, each pulsing faintly.",
|
||||
19: "Orderly rows of medicinal and magical herbs grow in raised stone beds. Each bed is labeled with the plant's name, properties, and harvest schedule. A gentle misting enchantment keeps everything perfectly watered. Bees hum between blossoms.",
|
||||
20: "Ancient trees form a canopy of silver-leafed branches that shimmer with their own inner light. The ground is carpeted with soft moss. Fireflies drift between the trunks. The air feels thick with old magic. Whispers seem to come from the trees themselves.",
|
||||
21: "A magnificent glass structure housing exotic plants from across the realms. Temperature zones shift as you walk — tropical humidity gives way to arid heat, then cool mountain mist. Vines crawl along the iron framework.",
|
||||
22: "A clearing of profound stillness. Ancient standing stones form a circle around a crystal-clear spring. The water glows faintly blue. This is a place of deep contemplation, where wizards come to meditate, pray, or simply sit with silence. The air itself feels holy.",
|
||||
}
|
||||
for rid, desc in descs.items():
|
||||
room = get_room(rid)
|
||||
room.db.desc = desc
|
||||
room.save()
|
||||
print(" [+] Set desc for {} (#{}) ".format(room.db_key, rid))
|
||||
|
||||
print("\n=== Setting up public channel ===")
|
||||
from evennia.comms.models import ChannelDB
|
||||
if not ChannelDB.objects.filter(db_key="Public").exists():
|
||||
from evennia.utils.create import create_channel
|
||||
chan = create_channel("Public", desc="Academy-wide communication channel", locks="control:perm(Admin);listen:all();send:all()")
|
||||
print(" [+] Created Public channel")
|
||||
else:
|
||||
print(" [skip] Public channel exists")
|
||||
|
||||
print("\n=== DONE ===")
|
||||
|
||||
# Verify
|
||||
rooms = ObjectDB.objects.filter(db_typeclass_path__icontains="room")
|
||||
total_exits = ObjectDB.objects.filter(db_typeclass_path__icontains="exit").count()
|
||||
print("Rooms: {}, Exits: {}".format(rooms.count(), total_exits))
|
||||
Reference in New Issue
Block a user