wxrcg 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/LICENSE +24 -0
- data/README.md +51 -0
- data/Rakefile +30 -0
- data/VERSION +1 -0
- data/bin/dm_screen +17 -0
- data/bin/stats +21 -0
- data/bin/weapon_add +24 -0
- data/config/database.yml +22 -0
- data/db/development.sqlite +0 -0
- data/db/development.sqlite3 +0 -0
- data/db/sqlite scripts/create_armours.sql +16 -0
- data/db/sqlite scripts/create_categories.sql +10 -0
- data/db/sqlite scripts/create_characters.sql +21 -0
- data/db/sqlite scripts/create_races.sql +9 -0
- data/db/sqlite scripts/create_weapons.sql +16 -0
- data/db/sqlite scripts/critical.sql +12 -0
- data/db/sqlite scripts/damage.sql +21 -0
- data/db/sqlite scripts/damage_type.sql +15 -0
- data/db/sqlite scripts/encumbrance_type.sql +10 -0
- data/db/sqlite scripts/training_type.sql +8 -0
- data/db/sqlite scripts/weapon_special_qualities_weapons.sql +17 -0
- data/db/test.sqlite +0 -0
- data/lib/character.old.rb +72 -0
- data/lib/controllers/character_controller.rb +35 -0
- data/lib/controllers/dm_screen_controller.rb +23 -0
- data/lib/controllers/weapon_controller.rb +37 -0
- data/lib/initdb.rb +27 -0
- data/lib/models/armour.rb +3 -0
- data/lib/models/character.rb +120 -0
- data/lib/models/critical.rb +11 -0
- data/lib/models/damage.rb +8 -0
- data/lib/models/damage_type.rb +3 -0
- data/lib/models/encumbrance_type.rb +3 -0
- data/lib/models/race.rb +3 -0
- data/lib/models/size.rb +4 -0
- data/lib/models/training_type.rb +3 -0
- data/lib/models/weapon.rb +59 -0
- data/lib/models/weapon_special_quality.rb +3 -0
- data/lib/views/abilities_frame.rb +285 -0
- data/lib/views/char_select_dialog.rb +60 -0
- data/lib/views/dm_screen_frame.rb +64 -0
- data/lib/views/weapon_screen_frame.rb +232 -0
- data/log/.keep_me +0 -0
- data/tests/armour_model_test.rb +10 -0
- data/tests/character_model_test.rb +10 -0
- data/tests/critical_model_test.rb +10 -0
- data/tests/damage_model_test.rb +10 -0
- data/tests/damage_type_model_test.rb +10 -0
- data/tests/encumbrance_type_model_test.rb +10 -0
- data/tests/race_model_test.rb +10 -0
- data/tests/size_model_test.rb +10 -0
- data/tests/training_type_model_test.rb +10 -0
- data/tests/weapon_model_test.rb +19 -0
- data/tests/weapon_special_quality_model_test.rb +10 -0
- metadata +141 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2009 Nevynxxx <nevyn@anferny.me.uk>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
21
|
+
~~~
|
22
|
+
Paizo Community Use License
|
23
|
+
|
24
|
+
This project uses trademarks and/or copyrights owned by Paizo Publishing, LLC, which are used under Paizo's Community Use Policy. We are expressly prohibited from charging you to use or access this content. This project is not published, endorsed, or specifically approved by Paizo Publishing. For more information about Paizo's Community Use Policy, please visit paizo.com/communityuse. For more information about Paizo Publishing and Paizo products, please visit paizo.com.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
CONTENTS OF THIS FILE
|
2
|
+
=====================
|
3
|
+
|
4
|
+
* Introduction
|
5
|
+
* License
|
6
|
+
* Requirements
|
7
|
+
* Installation
|
8
|
+
* Components
|
9
|
+
* Contact
|
10
|
+
|
11
|
+
|
12
|
+
INTRODUCTION
|
13
|
+
============
|
14
|
+
|
15
|
+
Current Maintainer: Nevynxxx <nevyn@anferny.me.uk>
|
16
|
+
|
17
|
+
Some basic tools for helping DMs/players run PathfinderRPG games.
|
18
|
+
|
19
|
+
Currently these include a point buy calculator, and the beginnings of a dmscreen, I hope to build up to a full character generator in time.
|
20
|
+
|
21
|
+
All built in ruby and wxRuby....
|
22
|
+
|
23
|
+
Oh, and any suggestions for a new name are very welcomed!
|
24
|
+
|
25
|
+
LICENSE
|
26
|
+
=======
|
27
|
+
|
28
|
+
See the LICENSE file. This software is Copyright Nevynxxx <nevyn@anferny.me.uk> and is distributed under the MIT license, along with the Paizo Community Use Licence also included in the LICENSE file.
|
29
|
+
|
30
|
+
Please note **we cannot charge you to use this software**.
|
31
|
+
|
32
|
+
REQUIREMENTS
|
33
|
+
============
|
34
|
+
|
35
|
+
* ruby 1.9
|
36
|
+
* rubygems
|
37
|
+
* wxruby 2.0
|
38
|
+
* activerecord
|
39
|
+
* activesupport
|
40
|
+
|
41
|
+
INSTALLATION
|
42
|
+
============
|
43
|
+
|
44
|
+
Once the above are installed, installation is as simple as git clone 'git://codaset.com/nevynxxx/wxrcg.git'
|
45
|
+
|
46
|
+
cd to the bin/ directory and run the component you want with 'ruby <component>.rb'
|
47
|
+
|
48
|
+
COMPONENTS
|
49
|
+
==========
|
50
|
+
|
51
|
+
Current components include "stats" a point buy calculator that takes into account a characters race, and optionally saves that characters basic outline to the database for use in the DM screen, "dm_screen", this is partially complete and used by a DM to track initiative/AC/HP/ and conditions currently affecting the PCs, and finally "weapons" a small app for adding new weapons into the database.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
task :default => [:test_models]
|
5
|
+
|
6
|
+
desc "Run basic tests"
|
7
|
+
Rake::TestTask.new("test_models") { |t|
|
8
|
+
t.pattern = 'tests/*_model_test.rb'
|
9
|
+
t.verbose = true
|
10
|
+
t.warning = false
|
11
|
+
}
|
12
|
+
begin
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gemspec|
|
15
|
+
gemspec.name = "wxrcg"
|
16
|
+
gemspec.summary = "Some basic tools for helping DMs/players run PathfinderRPG games."
|
17
|
+
gemspec.description = "Describe your gem"
|
18
|
+
gemspec.email = "nevyn@anferny.me.uk"
|
19
|
+
gemspec.homepage = "http://codaset.com/nevynxxx/wxrcg#"
|
20
|
+
gemspec.authors = ["Nevynxxx"]
|
21
|
+
gemspec.add_dependency('sqlite3-ruby')
|
22
|
+
gemspec.add_dependency('activerecord')
|
23
|
+
gemspec.add_dependency('wxruby-ruby19', '>= 2.0.0')
|
24
|
+
|
25
|
+
end
|
26
|
+
Jeweler::GemcutterTasks.new
|
27
|
+
rescue LoadError
|
28
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gems.github.com"
|
29
|
+
end
|
30
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/dm_screen
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
root = File.dirname(__FILE__)
|
3
|
+
require "wx"
|
4
|
+
require File.join(root, "..", "lib", "initdb.rb")
|
5
|
+
require File.join(root, "..", "lib", "models","character.rb")
|
6
|
+
require File.join(root, "..", "lib", "views","dm_screen_frame.rb")
|
7
|
+
require File.join(root, "..", "lib", "controllers","dm_screen_controller.rb")
|
8
|
+
|
9
|
+
class WxRCG < Wx::App
|
10
|
+
def on_init
|
11
|
+
@characters = Character.find(:all)
|
12
|
+
DM_screen_frame.new(@characters)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
WxRCG.new.main_loop
|
data/bin/stats
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
root = File.dirname(__FILE__)
|
3
|
+
require "wx"
|
4
|
+
require File.join(root,"..","lib","initdb.rb")
|
5
|
+
require File.join(root,"..","lib","models","character")
|
6
|
+
require File.join(root,"..","lib","models","race")
|
7
|
+
require File.join(root,"..","lib","views","abilities_frame")
|
8
|
+
require File.join(root,"..","lib","views","char_select_dialog")
|
9
|
+
|
10
|
+
class WxRCG < Wx::App
|
11
|
+
def on_init
|
12
|
+
@character = Character.new
|
13
|
+
WxRCG_frame.new(race_list,@character)
|
14
|
+
end
|
15
|
+
|
16
|
+
def race_list
|
17
|
+
Race.find :all, :order => "name ASC"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
WxRCG.new.main_loop
|
data/bin/weapon_add
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
root = File.dirname(__FILE__)
|
3
|
+
require "wx"
|
4
|
+
require File.join(root,"..","lib","initdb.rb")
|
5
|
+
require File.join(root,"..","lib","views","weapon_screen_frame")
|
6
|
+
require File.join(root,"..","lib","controllers","weapon_controller")
|
7
|
+
|
8
|
+
class WxRCG < Wx::App
|
9
|
+
def on_init
|
10
|
+
cont = WeaponController.new
|
11
|
+
version = cont.current_version_git
|
12
|
+
lists = {:training_types => cont.training_types,
|
13
|
+
:encumbrance_types => cont.encumbrance_types,
|
14
|
+
:damages => cont.damages,
|
15
|
+
:damage_types => cont.damage_types,
|
16
|
+
:criticals => cont.criticals,
|
17
|
+
:sizes => cont.sizes
|
18
|
+
}
|
19
|
+
Weapon_screen_frame.new(version,lists)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
WxRCG.new.main_loop
|
data/config/database.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: development.sqlite
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
Binary file
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
drop table armours;
|
2
|
+
create table armours (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255),
|
5
|
+
category_id integer,
|
6
|
+
cost integer,
|
7
|
+
bonus integer,
|
8
|
+
max_dex integer,
|
9
|
+
check_pen integer,
|
10
|
+
spell_fail integer,
|
11
|
+
speed_30 integer,
|
12
|
+
speed_20 integer,
|
13
|
+
weight integer
|
14
|
+
);
|
15
|
+
insert into armours values (NULL,'Hide',2,15,4,4,-3,20,20,15,25);
|
16
|
+
insert into armours values (NULL,'None',0,0,0,0,0,0,0,0,0);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
drop table categories;
|
2
|
+
create table categories (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255)
|
5
|
+
);
|
6
|
+
insert into categories values (NULL,'Light');
|
7
|
+
insert into categories values (NULL,'Medium');
|
8
|
+
insert into categories values (NULL,'Heavy');
|
9
|
+
insert into categories values (NULL,'Shields');
|
10
|
+
insert into categories values (NULL,'Extras');
|
@@ -0,0 +1,21 @@
|
|
1
|
+
drop table characters;
|
2
|
+
create table characters (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255),
|
5
|
+
race_id integer,
|
6
|
+
armour_id integer,
|
7
|
+
weapon_id integer,
|
8
|
+
size_id integer,
|
9
|
+
str integer,
|
10
|
+
dex integer,
|
11
|
+
con integer,
|
12
|
+
int integer,
|
13
|
+
wis integer,
|
14
|
+
cha integer,
|
15
|
+
floating_race_mod varchar(3),
|
16
|
+
hp integer,
|
17
|
+
bab integer
|
18
|
+
);
|
19
|
+
insert into characters values (NULL,'Drogheda',5,1,1,5,14,14,13,13,13,7,'str',12,1);
|
20
|
+
insert into characters values (NULL,'Moopara',6,2,1,5,12,12,11,12,11,15,NULL,9,0);
|
21
|
+
insert into characters values (NULL,'Snarf',4,2,1,5,16,10,9,8,8,16,'cha',9,0);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
drop table races;
|
2
|
+
create table races(id integer not null primary key,name varchar(255),str_mod integer,dex_mod integer,con_mod integer,int_mod integer,wis_mod integer,cha_mod integer,any boolean);
|
3
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Dwarf",0,0,2,0,2,-2,0);
|
4
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Elf",0,2,-2,2,0,0,0);
|
5
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Gnome",-2,0,2,0,0,2,0);
|
6
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Half-Elf",0,0,0,0,0,0,1);
|
7
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Half-Orc",0,0,0,0,0,0,1);
|
8
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Halfling",-2,2,0,0,0,2,0);
|
9
|
+
insert into races ('name','str_mod','dex_mod','con_mod','int_mod','wis_mod','cha_mod','any') values ("Human",0,0,0,0,0,0,1);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
drop table weapons;
|
2
|
+
create table weapons (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255),
|
5
|
+
training_type_id integer,
|
6
|
+
encumbrance_type_id integer,
|
7
|
+
damage_id integer,
|
8
|
+
damage_type_id integer,
|
9
|
+
damage2_id integer,
|
10
|
+
critical_id integer,
|
11
|
+
size_id integer,
|
12
|
+
cost integer,
|
13
|
+
range integer,
|
14
|
+
weight integer
|
15
|
+
);
|
16
|
+
insert into weapons values (NULL,'Unarmed strike',1,1,4,1,NULL,1,5,NULL,NULL,NULL);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
drop table criticals;
|
2
|
+
create table criticals (
|
3
|
+
id integer not null primary key,
|
4
|
+
range varchar(10),
|
5
|
+
multiplier integer
|
6
|
+
);
|
7
|
+
insert into criticals values (NULL, NULL, 2);
|
8
|
+
insert into criticals values (NULL, NULL, 3);
|
9
|
+
insert into criticals values (NULL, '19-20', 2);
|
10
|
+
insert into criticals values (NULL, '19-20', 3);
|
11
|
+
insert into criticals values (NULL, '18-20', 2);
|
12
|
+
insert into criticals values (NULL, '18-20', 3);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
drop table damages;
|
2
|
+
create table damages (
|
3
|
+
id integer not null primary key,
|
4
|
+
no integer,
|
5
|
+
sides integer
|
6
|
+
);
|
7
|
+
insert into damages values (NULL,'0', '0');
|
8
|
+
insert into damages values (NULL,'1', '1');
|
9
|
+
insert into damages values (NULL,'1', '2');
|
10
|
+
insert into damages values (NULL,'1', '3');
|
11
|
+
insert into damages values (NULL,'1', '4');
|
12
|
+
insert into damages values (NULL,'1', '6');
|
13
|
+
insert into damages values (NULL,'1', '8');
|
14
|
+
insert into damages values (NULL,'1', '10');
|
15
|
+
insert into damages values (NULL,'1', '12');
|
16
|
+
insert into damages values (NULL,'2', '4');
|
17
|
+
insert into damages values (NULL,'2', '6');
|
18
|
+
insert into damages values (NULL,'2', '8');
|
19
|
+
insert into damages values (NULL,'3', '6');
|
20
|
+
insert into damages values (NULL,'3', '8');
|
21
|
+
insert into damages values (NULL,'4', '8');
|
@@ -0,0 +1,15 @@
|
|
1
|
+
drop table damage_types;
|
2
|
+
create table damage_types (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255),
|
5
|
+
code varchar(10)
|
6
|
+
);
|
7
|
+
insert into damage_types values (NULL,'Bludgeoning', 'B');
|
8
|
+
insert into damage_types values (NULL,'Piercing', 'P');
|
9
|
+
insert into damage_types values (NULL,'Slashing', 'S');
|
10
|
+
insert into damage_types values (NULL,'Bludgeoning or Slashing', 'B or S');
|
11
|
+
insert into damage_types values (NULL,'Bludgeoning and Slashing', 'B & S');
|
12
|
+
insert into damage_types values (NULL,'Piercing or Slashing', 'P or S');
|
13
|
+
insert into damage_types values (NULL,'Piercing and Slashing', 'P & S');
|
14
|
+
insert into damage_types values (NULL,'Bludgeoning or Piercing', 'B or P');
|
15
|
+
insert into damage_types values (NULL,'Bludgeoning and Piercing', 'B & P');
|
@@ -0,0 +1,10 @@
|
|
1
|
+
drop table encumbrance_types;
|
2
|
+
create table encumbrance_types (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255)
|
5
|
+
);
|
6
|
+
insert into encumbrance_types values (NULL,'Unarmed');
|
7
|
+
insert into encumbrance_types values (NULL,'Light');
|
8
|
+
insert into encumbrance_types values (NULL,'One-Handed');
|
9
|
+
insert into encumbrance_types values (NULL,'Two-Handed');
|
10
|
+
insert into encumbrance_types values (NULL,'Ranged');
|
@@ -0,0 +1,8 @@
|
|
1
|
+
drop table training_types;
|
2
|
+
create table training_types (
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255)
|
5
|
+
);
|
6
|
+
insert into training_types values (NULL,'Simple');
|
7
|
+
insert into training_types values (NULL,'Martial');
|
8
|
+
insert into training_types values (NULL,'Exotic');
|
@@ -0,0 +1,17 @@
|
|
1
|
+
drop table weapon_special_qualities;
|
2
|
+
create table weapon_special_qualities(
|
3
|
+
id integer not null primary key,
|
4
|
+
name varchar(255)
|
5
|
+
);
|
6
|
+
insert into weapon_special_qualities ('name') values ("Non-Lethal");
|
7
|
+
insert into weapon_special_qualities('name') values ("Brace");
|
8
|
+
insert into weapon_special_qualities('name') values ("Trip");
|
9
|
+
insert into weapon_special_qualities('name') values ("Monks");
|
10
|
+
insert into weapon_special_qualities('name') values ("Double");
|
11
|
+
insert into weapon_special_qualities('name') values ("Reach");
|
12
|
+
drop table weapon_special_qualities_weapons;
|
13
|
+
create table weapon_special_qualities_weapons(
|
14
|
+
weapon_id integer not null,
|
15
|
+
weapon_special_quality_id integer not null
|
16
|
+
);
|
17
|
+
|
data/db/test.sqlite
ADDED
Binary file
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class Character
|
2
|
+
DEFAULT_ARRAY = {:str => 10, :dex => 10, :con => 10, :int => 10, :wis => 10, :cha => 10 }
|
3
|
+
DEFAULT_RACE_ARRAY = {:str => 0, :dex => 0, :con => 0, :int => 0, :wis => 0, :cha => 0 }
|
4
|
+
DWARFMODS = {:str => 0, :dex => 0, :con => 2, :int => 0, :wis => 2, :cha => -2}
|
5
|
+
ELFMODS = {:str => 0, :dex => 0, :con => 2, :int => 0, :wis => 2, :cha => -2}
|
6
|
+
GNOMEMODS = {:str => 0, :dex => 0, :con => 2, :int => 0, :wis => 2, :cha => -2}
|
7
|
+
HALF_ELFMODS = {:str => 0, :dex => 0, :con => 2, :int => 0, :wis => 2, :cha => -2}
|
8
|
+
HALF_ORCMODS = {:str => 0, :dex => 0, :con => 2, :int => 0, :wis => 2, :cha => -2}
|
9
|
+
HALFLINGMODS = {:str => 0, :dex => 0, :con => 2, :int => 0, :wis => 2, :cha => -2}
|
10
|
+
HUMANMODS = {:str => 0, :dex => 0, :con => 0, :int => 0, :wis => 0, :cha => 0}
|
11
|
+
attr_accessor :basestats
|
12
|
+
attr_reader :race,:race_mods
|
13
|
+
def initialize
|
14
|
+
@basestats = DEFAULT_ARRAY
|
15
|
+
@race_mods = DEFAULT_RACE_ARRAY
|
16
|
+
end
|
17
|
+
|
18
|
+
def stat(stat)
|
19
|
+
@basestats[stat] + @race_mods[stat]
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_race(race)
|
23
|
+
@race = race
|
24
|
+
@race_mods = DEFAULT_RACE_ARRAY
|
25
|
+
case @race
|
26
|
+
when "Dwarf" then @race_mods.each {|name,mod| @race_mods[name] += DWARFMODS[name] }
|
27
|
+
when "Elf" then @race_mods.each {|name,mod| @race_mods[name] += ELFMODS[name] }
|
28
|
+
when "Gnome" then @race_mods.each {|name,mod| @race_mods[name] += GNOMEMODS[name] }
|
29
|
+
when "Half-Elf" then @race_mods.each {|name,mod| @race_mods[name] += HALF_ELFMODS[name] }
|
30
|
+
when "Half-Orc" then @race_mods.each {|name,mod| @race_mods[name] += HALF_ORCMODS[name] }
|
31
|
+
when "Halfling" then @race_mods.each {|name,mod| @race_mods[name] += HALFLINGFMODS[name] }
|
32
|
+
when "Human" then @race_mods.each {|name,mod| @race_mods[name] += HUMANMODS[name] }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def race_mods=(str = 0, dex = 0, con = 0, int = 0, wis = 0, cha = 0)
|
37
|
+
@race_mods = {:str => str, :dex => dex, :con => con, :int => int, :wis => wis, :cha => cha }
|
38
|
+
end
|
39
|
+
|
40
|
+
def race_mod(stat)
|
41
|
+
@race_mods[stat]
|
42
|
+
end
|
43
|
+
|
44
|
+
def mod(stat)
|
45
|
+
stat(stat)
|
46
|
+
end
|
47
|
+
|
48
|
+
def points(stat)
|
49
|
+
s = case @basestats[stat]
|
50
|
+
when 7 then -4
|
51
|
+
when 8 then -2
|
52
|
+
when 9 then -1
|
53
|
+
when 10 then 0
|
54
|
+
when 11 then 1
|
55
|
+
when 12 then 2
|
56
|
+
when 13 then 3
|
57
|
+
when 14 then 5
|
58
|
+
when 15 then 7
|
59
|
+
when 16 then 10
|
60
|
+
when 17 then 13
|
61
|
+
when 18 then 17
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def total_points
|
66
|
+
t = points(:str) + points(:dex) + points(:con) + points(:int) + points(:wis) + points(:cha)
|
67
|
+
end
|
68
|
+
|
69
|
+
# def initialize(str,dex,con,int,wis,cha)
|
70
|
+
# @basestats = {:str => str, :dex => dex, :con => con, :int => int, :wis => wis, :cha => cha}
|
71
|
+
# end
|
72
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
#class CharacterController
|
3
|
+
|
4
|
+
|
5
|
+
#
|
6
|
+
#def update_stats
|
7
|
+
# @char.str = @char.str + @char.race.str_mod
|
8
|
+
# dex = dex + self.race.dex_mod
|
9
|
+
# con = con + self.race.con_mod
|
10
|
+
# int = int + self.race.int_mod
|
11
|
+
# wis = wis + self.race.wis_mod
|
12
|
+
# cha = cha + self.race.cha_mod
|
13
|
+
# end
|
14
|
+
|
15
|
+
# def total_points
|
16
|
+
# t = points(:str) + points(:dex) + points(:con) + points(:int) + points(:wis) + points(:cha)
|
17
|
+
# end
|
18
|
+
|
19
|
+
# def points(stat)
|
20
|
+
# s = case stat.to_sym
|
21
|
+
# when 7 then -4
|
22
|
+
# when 8 then -2
|
23
|
+
# when 9 then -1
|
24
|
+
# when 10 then 0
|
25
|
+
# when 11 then 1
|
26
|
+
# when 12 then 2
|
27
|
+
# when 13 then 3
|
28
|
+
# when 14 then 5
|
29
|
+
# when 15 then 7
|
30
|
+
# when 16 then 10
|
31
|
+
# when 17 then 13
|
32
|
+
# when 18 then 17
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
class DmScreenController
|
3
|
+
|
4
|
+
def current_version_git
|
5
|
+
# <http://gist.github.com/198268>
|
6
|
+
#
|
7
|
+
# Call +git+ and obtain the current commit SHA1 and commit date. Store these values
|
8
|
+
# in +APP_VERSION_COMMIT_ID+ and +APP_VERSION_COMMIT_DATE+. Then define
|
9
|
+
# +APP_VERSION+ to be a string of the two.
|
10
|
+
|
11
|
+
`git show --pretty=format:"%H|%ci" --quiet`
|
12
|
+
#
|
13
|
+
# unless defined?(::APP_VERSION)
|
14
|
+
# APP_VERSION_COMMIT_ID = commit_id
|
15
|
+
# APP_VERSION_COMMIT_DATE = commit_date
|
16
|
+
# APP_VERSION = "#{commit_id} #{commit_date}"
|
17
|
+
# end
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_version_svn
|
21
|
+
`svnversion .`.chomp
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
root = File.dirname(__FILE__)
|
2
|
+
require File.join(root,"..","models","weapon.rb")
|
3
|
+
|
4
|
+
class WeaponController
|
5
|
+
|
6
|
+
def current_version_git
|
7
|
+
`git show --pretty=format:"%ci" --quiet`
|
8
|
+
end
|
9
|
+
|
10
|
+
def current_version_svn
|
11
|
+
`svnversion .`.chomp
|
12
|
+
end
|
13
|
+
|
14
|
+
def training_types
|
15
|
+
TrainingType.find(:all)
|
16
|
+
end
|
17
|
+
|
18
|
+
def encumbrance_types
|
19
|
+
EncumbranceType.find(:all)
|
20
|
+
end
|
21
|
+
|
22
|
+
def damages
|
23
|
+
Damage.find(:all)
|
24
|
+
end
|
25
|
+
|
26
|
+
def damage_types
|
27
|
+
DamageType.find(:all)
|
28
|
+
end
|
29
|
+
|
30
|
+
def criticals
|
31
|
+
Critical.find(:all)
|
32
|
+
end
|
33
|
+
|
34
|
+
def sizes
|
35
|
+
Size.find(:all)
|
36
|
+
end
|
37
|
+
end
|
data/lib/initdb.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'activerecord'
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
dir = File.dirname(__FILE__)
|
7
|
+
dbconfig = YAML::load(File.open(File.join(dir,'..','config','database.yml')))
|
8
|
+
if ENV["APDATA"] then
|
9
|
+
datpath = File.join(ENV["APDATA"], '.wxrcg')
|
10
|
+
else
|
11
|
+
if ENV["HOME"] then
|
12
|
+
datpath = File.join(ENV["HOME"], '.wxrcg')
|
13
|
+
else
|
14
|
+
puts "No place to put the database, arrggh!"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
if !Dir.exists?(datpath) then
|
18
|
+
Dir.mkdir(datpath)
|
19
|
+
Dir.mkdir(File.join(datpath, "db"))
|
20
|
+
Dir.mkdir(File.join(datpath, "log"))
|
21
|
+
File.copy_stream(File.join(dir,'..','db',dbconfig["development"]["database"]),File.join(datpath, "db",dbconfig["development"]["database"]))
|
22
|
+
end
|
23
|
+
dbpath = File.join(datpath, 'db', dbconfig["development"]["database"])
|
24
|
+
dbconfig["development"]["database"] = dbpath
|
25
|
+
|
26
|
+
ActiveRecord::Base.establish_connection(dbconfig["development"])
|
27
|
+
ActiveRecord::Base.logger = Logger.new(File.join(datpath,'log','development.log'))
|