ArkTools 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5104482923e8cc53344ec4ab6d3a1e4854eca59f
4
+ data.tar.gz: c6ed8adc36d34d37db0fb92e29186cf800bb83b8
5
+ SHA512:
6
+ metadata.gz: 385246b0b4e36043c66c37c05226cfd9fb2ff0b5df56516d5824779704dc67b85a79575efa9d437aa68064bd622dd52a734c7f7ae0b8806c93bd18975fd89e24
7
+ data.tar.gz: 7ddaab8f2309b168579992c778b4e1680f3d26bedef4c4a6654ee621e3618651763bc7caabfbfdd27c488df774d65f2f899b91a711893004a3aa4e8e98052f02
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.14.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ark_config.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # ArkTools
2
+
3
+ Welcome to ArkTools!
4
+
5
+ Currently this provides a command line tool named `arktool` which will create customized Game.ini and GameUserSettings.ini lines for you.
6
+
7
+ ## Installation
8
+
9
+ Install the gem from rubygems as you normally would. Once installed, you'll have access to the command line tool named `arktool`.
10
+
11
+ $ gem install ArkConfig
12
+
13
+ ## Usage
14
+
15
+ `arktool help` should get you started. Subcommands also have their own help, so `arktool mods help` will give you information about the `mods` subcommand.
16
+
17
+ ## Commands
18
+
19
+ ### Mods
20
+
21
+ These commands take an input file (via --file) in the following format:
22
+
23
+ MODID Description
24
+
25
+ Each mod should be separated on it's own line and the order of the lines determine the load order (top to bottom)
26
+
27
+ e.g.
28
+
29
+ 776464863 Ragnarok
30
+ 813220452 Ragnarok Lore
31
+
32
+ ### Levels
33
+
34
+ These commands will create customized level lists for your Game.ini. Please see `arktools levels help` for additional information.
35
+
36
+ --level : the Maximum level for your server (required)
37
+ --exp : The total experience to obtain max level (optional)
38
+ --growth : a customized logarithmic "growth rate" (very optional -- if you don't know what this means, you probably don't need it)
39
+
40
+ ## Future Plans
41
+
42
+ - Web based interface (for the non-ruby world)
43
+ - Other configuration options / commands as requested by the community
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/dyoung522/arktools).
54
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/ark_tools.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ark_tool/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ArkTools"
8
+ spec.version = ArkTools::VERSION
9
+ spec.authors = ["Donovan Young"]
10
+ spec.email = ["dyoung522@gmail.com"]
11
+
12
+ spec.summary = %q{Creates ARK configuration files}
13
+ spec.description = %Q{Uses various template files to create ARK configuration files\n} +
14
+ %Q{ - Game.ini\n} +
15
+ %Q{ - GameUserSettings.ini\n}
16
+ spec.homepage = "https://github.com/dyoung522/arkconfig"
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "config", "~> 1.3"
25
+ spec.add_dependency "thor"
26
+ spec.add_dependency "io-console"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.14"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
31
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ark_tool"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/arktool ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "ark_tool"
3
+
4
+ ArkTools::Commands.start(ARGV)
data/lib/ark_tool.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "ark_tool/version"
2
+ require "ark_tool/commands"
3
+
@@ -0,0 +1,100 @@
1
+ require "mods/ark_mod_list"
2
+ require "generators/player_level"
3
+ require "thor"
4
+
5
+ module ArkTools
6
+ class Levels < Thor
7
+ desc "player", "Generates custom player levels Game.ini line"
8
+ long_desc <<-LONGDESC
9
+ Generates "OverrideMaxExperiencePointsPlayer=" and "LevelExperienceRampOverrides=" lines
10
+ suitable to copy/paste into Game.ini
11
+
12
+ --level ; Maximum level you wish to obtain (required)
13
+ \x5--exp ; Maximum experience points to award per player (optional)
14
+ \x5--growth ; Provide a custom growth_rate for level progression (optional)
15
+
16
+ LONGDESC
17
+
18
+ option :level, required: true, :type => :numeric, :banner => "MAX_LEVEL"
19
+ option :exp, :type => :numeric, :banner => "MAX_EXPERIENCE"
20
+ option :growth, :type => :numeric, :banner => "GROWTH_RATE"
21
+
22
+ def player
23
+ puts Generate::ArkGameLevels.new(options[:level].to_i,
24
+ {
25
+ max_exp: options[:exp].to_i,
26
+ growth_rate: options[:growth].to_f
27
+ }).player_levels
28
+ end
29
+
30
+ desc "dino", "Generates custom dino levels Game.ini line"
31
+ long_desc <<-LONGDESC
32
+ Generates "OverrideMaxExperiencePointsDino=" and "LevelExperienceRampOverrides=" lines
33
+ suitable to copy/paste into Game.ini
34
+
35
+ --level ; Maximum level you wish to obtain (required)
36
+ \x5--exp ; Maximum experience points to award per player (optional)
37
+ \x5--growth ; Provide a custom growth_rate for level progression (optional)
38
+
39
+ *NOTE* In order to include custom Dino levels, you *MUST* also include custom player levels first
40
+ LONGDESC
41
+
42
+ option :level, required: true, :type => :numeric, :banner => "MAX_LEVEL"
43
+ option :exp, :type => :numeric, :banner => "MAX_EXPERIENCE"
44
+ option :growth, :type => :numeric, :banner => "GROWTH_RATE"
45
+
46
+ def dino
47
+ puts Generate::ArkGameLevels.new(options[:level].to_i,
48
+ {
49
+ max_exp: options[:exp].to_i,
50
+ growth_rate: options[:growth].to_f
51
+ }).dino_levels
52
+ end
53
+ end # class Generate
54
+
55
+ class Mods < Thor
56
+ desc "Active", "Creates an ActiveMods= line suitable for GameUserSettings.ini"
57
+
58
+ option :file, required: true
59
+
60
+ def activemods(file = options[:file])
61
+ puts "ActiveMods=#{ArkModList.new(file).csv}"
62
+ end
63
+
64
+ desc "Configs", "Generates both ActiveMods and ModInstaller"
65
+
66
+ option :file, required: true
67
+
68
+ def configs
69
+ invoke :activemods
70
+ puts
71
+ invoke :modinstaller
72
+ end
73
+
74
+ desc "List", "Displays a list of active mods from the provided input file"
75
+
76
+ option :file, required: true
77
+
78
+ def list
79
+ ArkModList.new(options[:file]).each { |mod| printf "%-25s %s\n", mod.description, mod.id }
80
+ end
81
+
82
+ desc "ModInstaller", "Creates a [ModInstaller] block suitable for Game.ini"
83
+
84
+ option :file, required: true
85
+
86
+ def modinstaller(file = options[:file])
87
+ puts "[ModInstaller]"
88
+ ArkModList.new(file).each { |mod| printf "ModIds=%s ; %s\n", mod.id, mod.description }
89
+ end
90
+ end # class Mods
91
+
92
+ class Commands < Thor
93
+ desc "mods", "Commands related to Mod Settings"
94
+ subcommand "mods", Mods
95
+
96
+ desc "levels", "Commands related to custom player/dino levels for Game.ini"
97
+ subcommand "levels", Levels
98
+ end # class Commands
99
+ end # module ArkTools
100
+
@@ -0,0 +1,4 @@
1
+ module ArkTools
2
+ PROGRAM = File.basename($0, ".rb")
3
+ VERSION = "0.1.0"
4
+ end
@@ -0,0 +1,43 @@
1
+ module ArkTools
2
+ module Generate
3
+ class ArkGameLevels
4
+ def initialize(max_level, options = {})
5
+ @max_level = max_level
6
+ @max_exp = options[:max_exp] == 0 ? max_level * 10000 : options[:max_exp]
7
+ @growth_rate = options[:growth_rate] == 0 ? Math.log(@max_exp, @max_level) : options[:growth_rate]
8
+ end
9
+
10
+ def _calc_exp(level)
11
+ (level ** @growth_rate).round
12
+ end
13
+
14
+ def _make_level_overrides
15
+ exp_config = []
16
+
17
+ (0..@max_level).each { |lvl|
18
+ exp_config << "ExperiencePointsForLevel[#{lvl}]=#{_calc_exp lvl}"
19
+ }
20
+
21
+ "LevelExperienceRampOverrides=(#{exp_config.join(",")})"
22
+ end
23
+
24
+ def _make_levels(type)
25
+ type = type.to_s.capitalize
26
+ max_experience = _calc_exp@max_level
27
+
28
+ raise RuntimeError, "type must be either 'Player' or 'Dino'" unless ["Player", "Dino"].include?(type)
29
+
30
+ "OverrideMaxExperiencePoints#{type}=#{max_experience}\n" +
31
+ _make_level_overrides
32
+ end
33
+
34
+ def player_levels
35
+ _make_levels"Player"
36
+ end
37
+
38
+ def dino_levels
39
+ _make_levels"Dino"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,14 @@
1
+ module ArkTools
2
+ class ArkMod
3
+ attr_reader :id, :description
4
+
5
+ def initialize(mod)
6
+ @id = mod[0]
7
+ @description = mod[1]
8
+ end
9
+
10
+ def to_s
11
+ "#{id}:#{description}"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ require "mods/ark_mod"
2
+
3
+ module ArkTools
4
+ class ArkModList
5
+ attr_reader :mods
6
+
7
+ def initialize(file)
8
+ @mods = []
9
+
10
+ File.open(file, "r") do |f|
11
+ f.each_line do |line|
12
+ next if line =~ /^\s*[^\d]+/
13
+ if match = line.match(/(\d+)[\s\/#;]+(.*)$/)
14
+ @mods.push ArkMod.new(match.captures)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ def each
21
+ @mods.each { |mod| yield mod }
22
+ end
23
+
24
+ def csv
25
+ @mods.map(&:id).join(",")
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ArkTools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Donovan Young
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: config
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: io-console
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: |
98
+ Uses various template files to create ARK configuration files
99
+ - Game.ini
100
+ - GameUserSettings.ini
101
+ email:
102
+ - dyoung522@gmail.com
103
+ executables:
104
+ - arktool
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - ".gitignore"
109
+ - ".rspec"
110
+ - ".travis.yml"
111
+ - Gemfile
112
+ - README.md
113
+ - Rakefile
114
+ - ark_tools.gemspec
115
+ - bin/console
116
+ - bin/setup
117
+ - exe/arktool
118
+ - lib/ark_tool.rb
119
+ - lib/ark_tool/commands.rb
120
+ - lib/ark_tool/version.rb
121
+ - lib/generators/player_level.rb
122
+ - lib/mods/ark_mod.rb
123
+ - lib/mods/ark_mod_list.rb
124
+ homepage: https://github.com/dyoung522/arkconfig
125
+ licenses: []
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.6.8
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Creates ARK configuration files
147
+ test_files: []