map-rotation 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
+
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
9
+
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
+
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
@@ -0,0 +1,20 @@
1
+ MapRotation
2
+ ===========
3
+
4
+ Builds a new map rotation file for hl2-based games
5
+
6
+ Usage
7
+ -----
8
+
9
+ Usage: `map-rotation` [options]
10
+
11
+ The possible options are:
12
+
13
+ -v, --verbose print the maplist to STDOUT as well as to file
14
+ --dump-config print out current configuration and exit
15
+
16
+ To start building a configuration fie, run `map-rotation --dump-config >
17
+ map-rotation.yaml` and edit it. The config file is a YAML file that specifies
18
+ the tiers of maps and how many maps to select from each tier. It also has a
19
+ few configuration options for map-rotation itself, but those are all specified
20
+ when you dump the config.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'map_rotation'
4
+
5
+ MapRotation.new.run
@@ -0,0 +1,3 @@
1
+ require 'map_rotation/map_rotation'
2
+
3
+ MapRotation.new.run
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "yaml"
4
+
5
+ CONFIG_FN = "map-rotation.yaml"
6
+ DEFAULT_TARGET = "maplist.txt"
7
+
8
+ USAGE = <<EOS
9
+ Usage: map-rotation [options]
10
+
11
+ The possible options are:
12
+
13
+ -v, --verbose print the maplist to STDOUT as well as to file
14
+ --dump-config print out current configuration and exit
15
+
16
+ To start building a configuration fie, run `map-rotation --dump-config >
17
+ map-rotation.yaml` and edit it. The config file is a YAML file that specifies
18
+ the tiers of maps and how many maps to select from each tier. It also has a
19
+ few configuration options for map-rotation itself, but those are all specified
20
+ when you dump the config.
21
+ EOS
22
+
23
+ if ARGV.delete("--help") || ARGV.delete("-h")
24
+ puts USAGE
25
+ exit
26
+ end
27
+
28
+ class MapRotation
29
+ class << self
30
+ attr_accessor :default_cfg
31
+ end
32
+
33
+ @default_cfg = {"tiers"=>[{"tier"=>1, "name"=>"Premier", "choose"=>3, "maps"=>["pl_goldrush", "cp_dustbowl", "pl_badwater"]}, {"tier"=>2, "name"=>"Lengthy Maps", "choose"=>1, "maps"=>["tc_hydro", "plr_hightower", "cp_freight_final1", "cp_fastlane", "cp_well", "cp_granary", "cp_coldfront"]}, {"tier"=>3, "name"=>"Payload", "choose"=>1, "maps"=>["pl_hoodoo_final", "plr_pipeline", "pl_upward", "pl_frontier_final", "pl_barnblitz", "plr_nightfall_final"]}, {"tier"=>4, "name"=>"KOTH", "choose"=>1, "maps"=>["koth_badlands", "koth_harvest_final", "koth_harvest_event", "koth_nucleus", "koth_sawmill", "koth_viaduct", "koth_lakeside_final"]}, {"tier"=>5, "name"=>"CP", "choose"=>1, "maps"=>["cp_gullywash_final1", "cp_gravelpit", "cp_badlands", "cp_gorge", "cp_steel", "cp_5gorge", "cp_degrootkeep", "cp_manor_event", "cp_mountainlab", "cp_yukon_final", "cp_egypt_final", "cp_junction_final"]}, {"tier"=>6, "name"=>"CTF", "choose"=>1, "maps"=>["ctf_doublecross", "ctf_turbine", "ctf_2fort", "ctf_well", "ctf_sawmill"]}, {"tier"=>7, "name"=>"Custom", "choose"=>1, "maps"=>["cp_crossroads_b5", "ctf_turbine_pro_b1", "cp_warmfront", "ctf_2fort_mario_b4", "cp_lwobtsud", "cp_tiplevarg", "pl_retawdab", "cp_warpath2", "cp_lazytown_e", "cp_lazytown_lazynite", "pl_halfacre", "ctf_hallofdeath", "pl_donkeykong_final", "ctf_mach4", "cp_busytown", "ctf_impact2", "cp_castle4", "cp_bighalls_b1", "cp_toy_fort_alt2", "cp_wolf"]}, {"tier"=>8, "name"=>"Arena", "choose"=>1, "maps"=>["arena_badlands", "arena_granary", "arena_lumberyard", "arena_ravine", "arena_well", "arena_offblast_final", "arena_sawmill", "arena_nucleus", "arena_watchtower"]}], "targetFile"=>"maplist.txt", "verbose"=>true}
34
+
35
+ def run
36
+ # Load config
37
+ cfg = MapRotation.default_cfg.merge begin
38
+ fn = CONFIG_FN
39
+ if File.exists?(fn) && (h = YAML::load_file(fn))
40
+ h
41
+ else
42
+ {}
43
+ end
44
+ end
45
+ cfg["verbose"] = true if ARGV.delete("--verbose") || ARGV.delete("-v")
46
+ cfg["targetFile"] ||= DEFAULT_TARGET
47
+
48
+ if ARGV.delete("--dump-config")
49
+ puts cfg.to_yaml
50
+ exit 0
51
+ end
52
+
53
+ results = cfg["tiers"].map do |t|
54
+ t["maps"].shuffle.take(t["choose"].to_i)
55
+ end
56
+ results.shuffle!
57
+ File.open(cfg["targetFile"], 'w') do |f|
58
+ results.each do |r|
59
+ f.puts r
60
+ puts r if cfg["verbose"]
61
+ end
62
+ end
63
+ exit 0
64
+ end
65
+ end
66
+
67
+ AUTHOR = "Mike Kenyon"
68
+
69
+ LICENSE = <<EOS
70
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
71
+ Version 2, December 2004
72
+
73
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
74
+
75
+ Everyone is permitted to copy and distribute verbatim or modified
76
+ copies of this license document, and changing it is allowed as long
77
+ as the name is changed.
78
+
79
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
80
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
81
+
82
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
83
+ EOS
84
+
85
+ WARRANTY = <<EOS
86
+ This program is free software. It comes without any warranty, to
87
+ the extent permitted by applicable law. You can redistribute it
88
+ and/or modify it under the terms of the Do What The Fuck You Want
89
+ To Public License, Version 2, as published by Sam Hocevar. See
90
+ http://sam.zoy.org/wtfpl/COPYING for more details.
91
+ EOS
92
+
93
+
@@ -0,0 +1,10 @@
1
+ cp_dustbowl
2
+ pl_badwater
3
+ pl_goldrush
4
+ cp_5gorge
5
+ ctf_turbine
6
+ cp_tiplevarg
7
+ plr_pipeline
8
+ arena_lumberyard
9
+ tc_hydro
10
+ koth_sawmill
@@ -0,0 +1,103 @@
1
+ ---
2
+ tiers:
3
+ - tier: 1
4
+ name: Premier
5
+ choose: 3
6
+ maps:
7
+ - pl_goldrush
8
+ - cp_dustbowl
9
+ - pl_badwater
10
+ - tier: 2
11
+ name: Lengthy Maps
12
+ choose: 1
13
+ maps:
14
+ - tc_hydro
15
+ - plr_hightower
16
+ - cp_freight_final1
17
+ - cp_fastlane
18
+ - cp_well
19
+ - cp_granary
20
+ - cp_coldfront
21
+ - tier: 3
22
+ name: Payload
23
+ choose: 1
24
+ maps:
25
+ - pl_hoodoo_final
26
+ - plr_pipeline
27
+ - pl_upward
28
+ - pl_frontier_final
29
+ - pl_barnblitz
30
+ - plr_nightfall_final
31
+ - tier: 4
32
+ name: KOTH
33
+ choose: 1
34
+ maps:
35
+ - koth_badlands
36
+ - koth_harvest_final
37
+ - koth_harvest_event
38
+ - koth_nucleus
39
+ - koth_sawmill
40
+ - koth_viaduct
41
+ - koth_lakeside_final
42
+ - tier: 5
43
+ name: CP
44
+ choose: 1
45
+ maps:
46
+ - cp_gullywash_final1
47
+ - cp_gravelpit
48
+ - cp_badlands
49
+ - cp_gorge
50
+ - cp_steel
51
+ - cp_5gorge
52
+ - cp_degrootkeep
53
+ - cp_manor_event
54
+ - cp_mountainlab
55
+ - cp_yukon_final
56
+ - cp_egypt_final
57
+ - cp_junction_final
58
+ - tier: 6
59
+ name: CTF
60
+ choose: 1
61
+ maps:
62
+ - ctf_doublecross
63
+ - ctf_turbine
64
+ - ctf_2fort
65
+ - ctf_well
66
+ - ctf_sawmill
67
+ - tier: 7
68
+ name: Custom
69
+ choose: 1
70
+ maps:
71
+ - cp_crossroads_b5
72
+ - ctf_turbine_pro_b1
73
+ - cp_warmfront
74
+ - ctf_2fort_mario_b4
75
+ - cp_lwobtsud
76
+ - cp_tiplevarg
77
+ - pl_retawdab
78
+ - cp_warpath2
79
+ - cp_lazytown_e
80
+ - cp_lazytown_lazynite
81
+ - pl_halfacre
82
+ - ctf_hallofdeath
83
+ - pl_donkeykong_final
84
+ - ctf_mach4
85
+ - cp_busytown
86
+ - ctf_impact2
87
+ - cp_castle4
88
+ - cp_bighalls_b1
89
+ - cp_toy_fort_alt2
90
+ - cp_wolf
91
+ - tier: 8
92
+ name: Arena
93
+ choose: 1
94
+ maps:
95
+ - arena_badlands
96
+ - arena_granary
97
+ - arena_lumberyard
98
+ - arena_ravine
99
+ - arena_well
100
+ - arena_offblast_final
101
+ - arena_sawmill
102
+ - arena_nucleus
103
+ - arena_watchtower
@@ -0,0 +1,3 @@
1
+ class Version
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: map-rotation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mike Kenyon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-16 00:00:00.000000000Z
13
+ dependencies: []
14
+ description:
15
+ email:
16
+ - mike.kenyon@gmail.com
17
+ executables:
18
+ - map-rotation
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - bin/map-rotation
23
+ - lib/map_rotation/map_rotation.rb
24
+ - lib/map_rotation/maplist.txt
25
+ - lib/map_rotation/maps.yaml
26
+ - lib/map_rotation/version.rb
27
+ - lib/map_rotation.rb
28
+ - LICENSE
29
+ - README.md
30
+ homepage: http://github.com/mkenyon/map-rotation
31
+ licenses: []
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.10
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Builds a new map rotation file for hl2-based games
54
+ test_files: []