Module: ClasslessMud
- Defined in:
- lib/classless_mud.rb,
lib/classless_mud/npc.rb,
lib/classless_mud/exit.rb,
lib/classless_mud/game.rb,
lib/classless_mud/item.rb,
lib/classless_mud/room.rb,
lib/classless_mud/world.rb,
lib/classless_mud/client.rb,
lib/classless_mud/effect.rb,
lib/classless_mud/player.rb,
lib/classless_mud/server.rb,
lib/classless_mud/version.rb,
lib/classless_mud/commands.rb,
lib/classless_mud/character.rb,
lib/classless_mud/colorizer.rb,
lib/classless_mud/game_master.rb,
lib/classless_mud/commands/eat.rb,
lib/classless_mud/commands/get.rb,
lib/classless_mud/commands/say.rb,
lib/classless_mud/commands/who.rb,
lib/classless_mud/input_parser.rb,
lib/classless_mud/commands/chat.rb,
lib/classless_mud/commands/look.rb,
lib/classless_mud/commands/move.rb,
lib/classless_mud/commands/quit.rb,
lib/classless_mud/commands/dance.rb,
lib/classless_mud/commands/score.rb,
lib/classless_mud/account_builder.rb,
lib/classless_mud/character_sheet.rb,
lib/classless_mud/commands/whisper.rb,
lib/classless_mud/commands/commands.rb,
lib/classless_mud/commands/character.rb,
lib/classless_mud/commands/inventory.rb,
lib/classless_mud/commands/bad_command.rb,
lib/classless_mud/character_sheet_builder.rb
Defined Under Namespace
Modules: Character, Colorizer, Commands
Classes: AccountBuilder, CharacterSheet, CharacterSheetBuilder, Client, Effect, Exit, Game, GameMaster, InputParser, Item, Npc, Player, Room, Server, World
Constant Summary
collapse
- MOTD =
<<EOS
.-~~~~~~~~~-._ _.-~~~~~~~~~-.
__.' ~. .~ `.__
.'// We are \./ awesome. \\`.
.'// | \\`.
.'// .-~"""""""~~~~-._ | _,-~~~~"""""""~-. \\`.
.'//.-" `-. | .-' "-.\\`.
.'//______.============-.. \ | / ..-============.______\\`.
.'______________________________\|/______________________________`.
EOS
- VERSION =
"0.0.1"
- RACES =
['human', 'elven']
Class Method Summary
collapse
Class Method Details
.settings ⇒ Object
29
30
31
|
# File 'lib/classless_mud.rb', line 29
def self.settings
@settings ||= YAML.load_file('conf/settings.yml')
end
|
.setup_db! ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/classless_mud.rb', line 33
def self.setup_db!
DataMapper::Logger.new($stdout, :debug)
db_name = settings['db']['name']
if ENV.has_key? 'SNAP_DB_PG_URL_ALT' DataMapper.setup :default, ENV['SNAP_DB_PG_URL_ALT']
elsif ENV.has_key? 'DATABASE_URL'
DataMapper.setup :default, ENV['DATABASE_URL']
else
puts "Using DB:#{db_name}"
DataMapper.setup :default, "sqlite3://#{Dir.pwd}/#{db_name}"
end
DataMapper.finalize
end
|
.start! ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/classless_mud.rb', line 47
def self.start!
setup_db!
plus_20 = Effect.new description: 'You munch on the bar of chocolate and feel refreshed.', health_modification: 20
minus_20 = Effect.new description: 'Despite better judgment, you bite into the open bar of chocolate. It is filled with razor blades.', health_modification: -20
chocolate = Item.new name: "Good Chocolate", short_description: "a pristine bar of chocolate", keywords: "pristine bar chocolate", edible: true
chocolate.effects << plus_20
bad_chocolate = Item.new name: "Bad Chocolate", short_description: "a sketchy bar of chocolate", keywords: "sketchy bar chocolate", edible: true
bad_chocolate.effects << minus_20
room1 = Room.create! description: "There's a set of glass double doors to the west and an intersection of hallways to the east."
room2 = Room.create! description: "You are at an intersection of hallways. Glass double doors lay to the north and south. An extension of the hallway lays to the west."
room1.items << bad_chocolate
room2.items << chocolate
room1.exits.create! direction: 'east', target: room2
room2.exits.create! direction: 'west', target: room1
goblin = Npc.new name: 'Goblin', health: 90, level: 2
room1.npcs << goblin
world = World.new [room1, room2]
game = Game.new world, settings
EventMachine::run {
puts "Starting server on port 2000"
::ClasslessMud::Server.new(2000, game).start
}
end
|