botemon 0.6 → 0.7
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.
- checksums.yaml +4 -4
- data/bin/botemon +30 -24
- data/lib/botemon.rb +0 -2
- data/lib/botemon/movesetdex.rb +4 -4
- data/lib/botemon/smogon/moveset.rb +7 -8
- data/lib/botemon/smogon/pokemon.rb +5 -5
- data/lib/botemon/version.rb +2 -4
- metadata +5 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3df70fe78c7cdd0135358fd8c09c20b436ed76ff
|
4
|
+
data.tar.gz: 3524bccd5236fc147fcfef51a708be301b486e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64120d70649dc92f119c50fdc22244e8f54076ec5af6ff4bfbc9ccc80dcddb68217e0c9fb5874b9ad03d0cdcbc63ca657d798b8defc10a596af4030f87b63679
|
7
|
+
data.tar.gz: 78c531ef41dabda70f93b6caaec73bfa83e008172880eff7301e58b9acbf38fdfee97f83e1e544c7c1a0e2eb46e34c9c68b7c895bd14f5303f8258534401663e
|
data/bin/botemon
CHANGED
@@ -32,10 +32,10 @@ Cinch::Bot.new {
|
|
32
32
|
c.password = ARGV[1]
|
33
33
|
c.server = ARGV[2]
|
34
34
|
c.channels = ARGV.drop(3).map { |c| "\##{c}" }
|
35
|
-
|
35
|
+
|
36
36
|
c.plugins.plugins = [Cinch::Plugins::Login]
|
37
37
|
c.plugins.options[Cinch::Plugins::Login] = { :password => ARGV[1] }
|
38
|
-
|
38
|
+
|
39
39
|
@storage = Storage.new './cache.db'
|
40
40
|
@pokemon_trivia = nil
|
41
41
|
@players = []
|
@@ -45,22 +45,22 @@ Cinch::Bot.new {
|
|
45
45
|
|
46
46
|
on :message, /^pkmn (.+)/ do |m, name|
|
47
47
|
@storage = Storage.new('./cache.db') unless @storage
|
48
|
-
|
48
|
+
|
49
49
|
name = Smogon::Pokemon.id2name(name) if name.numeric?
|
50
50
|
|
51
|
-
pokemon = Pokedex.get name
|
51
|
+
pokemon = Pokedex.get name, @storage
|
52
52
|
m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map(&:colorize).join("\n") : 'Pokémon not found.'.colorize
|
53
53
|
end
|
54
54
|
|
55
|
-
on :message, /^ability (.+)/ do |m, name|
|
55
|
+
on :message, /^ability (.+)/ do |m, name|
|
56
56
|
ability = Abilitydex.get name
|
57
|
-
|
57
|
+
|
58
58
|
m.reply ability ? "#{ability.to_s}\n#{ability.url}".split("\n").map(&:colorize).join("\n") : 'Ability not found.'.colorize
|
59
59
|
end
|
60
60
|
|
61
|
-
on :message, /^item (.+)/ do |m, name|
|
61
|
+
on :message, /^item (.+)/ do |m, name|
|
62
62
|
item = Itemdex.get name
|
63
|
-
|
63
|
+
|
64
64
|
m.reply item ? "#{item.to_s}\n#{item.url}".split("\n").map(&:colorize).join("\n") : 'Item not found.'.colorize
|
65
65
|
end
|
66
66
|
|
@@ -73,10 +73,16 @@ Cinch::Bot.new {
|
|
73
73
|
on :message, /^moveset (.+) (.+) (.+)/ do |m, name, tier, metagame|
|
74
74
|
name = Smogon::Pokemon.id2name(name) if name.numeric?
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
tier = nil if tier.empty?
|
77
|
+
metagame = nil if metagame.empty?
|
78
|
+
|
79
|
+
movesets = Movesetdex.get name, tier, metagame
|
80
|
+
if movesets && movesets.any?
|
81
|
+
m.reply "--- #{movesets.first.pokemon} ---".colorize
|
82
|
+
|
83
|
+
movesets.each do |moveset|
|
84
|
+
m.reply " -- #{moveset.name} (#{moveset.tier}) --\n#{moveset.to_s.split("\n").map(&:colorize).join("\n")}\n"
|
85
|
+
end
|
80
86
|
else
|
81
87
|
m.reply 'Moveset not found.'.colorize
|
82
88
|
end
|
@@ -86,7 +92,7 @@ Cinch::Bot.new {
|
|
86
92
|
@storage = Storage.new('./cache.db') unless @storage
|
87
93
|
|
88
94
|
name = Smogon::Pokemon.id2name(name) if name.numeric?
|
89
|
-
pokemon = Pokedex.get name
|
95
|
+
pokemon = Pokedex.get name, @storage
|
90
96
|
|
91
97
|
hidden_values = evs.strip.split
|
92
98
|
if hidden_values.length == 2
|
@@ -96,28 +102,28 @@ Cinch::Bot.new {
|
|
96
102
|
evs = evs.split ?/
|
97
103
|
ivs = '31/31/31/31/31/31'.split ?/
|
98
104
|
end
|
99
|
-
|
105
|
+
|
100
106
|
m.reply "#{pokemon.name}: (#{pokemon.types.join(?-)}) #{pokemon.stats(level.to_i, nature, evs, ivs).join(?/)}"
|
101
107
|
end
|
102
108
|
|
103
109
|
on :message, /^pkrandom$/ do |m|
|
104
110
|
@storage = Storage.new('./cache.db') unless @storage
|
105
|
-
|
106
|
-
pokemon = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649))
|
111
|
+
|
112
|
+
pokemon = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)), @storage
|
107
113
|
m.reply pokemon ? "#{pokemon.to_s}\n#{pokemon.url}".split("\n").map(&:colorize).join("\n") : 'Pokémon not found.'.colorize
|
108
114
|
end
|
109
115
|
|
110
116
|
on :message, /^pktrivia$/ do |m|
|
111
117
|
@storage = Storage.new('./cache.db') unless @storage
|
112
|
-
|
118
|
+
|
113
119
|
if @pokemon_trivia != nil
|
114
120
|
m.reply 'Other players are playing, please wait until they finish.'.colorize
|
115
121
|
m.reply @pokemon_trivia.clues.colorize
|
116
122
|
else
|
117
|
-
@pokemon_trivia = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649))
|
123
|
+
@pokemon_trivia = Pokedex.get Smogon::Pokemon.id2name(Random.new.rand(1..649)), @storage
|
118
124
|
@trivia_owner = m.user.nick
|
119
125
|
@trivia_wrong = 0
|
120
|
-
|
126
|
+
|
121
127
|
if @pokemon_trivia
|
122
128
|
m.reply @pokemon_trivia.clues.split("\n").map(&:colorize).join("\n")
|
123
129
|
m.reply 'You have 3 chances to try to say which Pokémon is this!'.colorize
|
@@ -168,17 +174,17 @@ Cinch::Bot.new {
|
|
168
174
|
m.reply proverbs.colorize
|
169
175
|
end
|
170
176
|
end
|
171
|
-
|
177
|
+
|
172
178
|
on :message, /^pkcache$/ do |m|
|
173
179
|
if m.user.nick.to_s.oper? bot
|
174
180
|
File.delete('./cache.db') if File.exists? './cache.db'
|
175
|
-
|
181
|
+
|
176
182
|
@storage = Storage.new './cache.db'
|
177
183
|
@pokemon_trivia = nil
|
178
184
|
@players = []
|
179
185
|
@trivia_owner = ''
|
180
186
|
@trivia_wrong = 0
|
181
|
-
|
187
|
+
|
182
188
|
m.reply 'Cache created.'.colorize
|
183
189
|
else
|
184
190
|
proverbs = open('http://pastebin.com/raw.php?i=qWF65TcP').read.each_line.to_a.sample.strip
|
@@ -187,8 +193,8 @@ Cinch::Bot.new {
|
|
187
193
|
end
|
188
194
|
|
189
195
|
on :message, /^pkversion$/ do |m|
|
190
|
-
m.reply "Botémon: #{Botemon::
|
191
|
-
m.reply "Smogon-API: #{Smogon::
|
196
|
+
m.reply "Botémon: #{Botemon::VERSION}".colorize
|
197
|
+
m.reply "Smogon-API: #{Smogon::VERSION}".colorize
|
192
198
|
end
|
193
199
|
|
194
200
|
on :message, /^pkhelp$/ do |m|
|
data/lib/botemon.rb
CHANGED
data/lib/botemon/movesetdex.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright(C)
|
2
|
+
# Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
3
|
#
|
4
4
|
# This file is part of Botémon.
|
5
5
|
#
|
@@ -17,8 +17,8 @@
|
|
17
17
|
# along with Botémon. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
class Movesetdex
|
20
|
+
class Movesetdex
|
21
21
|
def self.get(name, tier, metagame)
|
22
|
-
name
|
22
|
+
name ? Smogon::Movesetdex.get(name, tier, metagame) : nil
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright(C)
|
2
|
+
# Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
3
|
#
|
4
4
|
# This file is part of Botémon.
|
5
5
|
#
|
6
6
|
# Botémon is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
8
8
|
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
9
|
+
# (at your option) any later version.d
|
10
10
|
#
|
11
11
|
# Botémon is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
@@ -27,10 +27,9 @@ module Smogon
|
|
27
27
|
@nature = []
|
28
28
|
@moves = []
|
29
29
|
end
|
30
|
-
|
31
|
-
def to_s
|
32
|
-
|
33
|
-
end
|
34
|
-
|
30
|
+
|
31
|
+
# def to_s
|
32
|
+
# "Set: #{@name}\nItem: #{@item.join(' / ')}\nAbility: #{@ability.join(' / ')}\nNature: #{@nature.join(' / ')}\nMoves: #{''.tap { |s| @moves.each { |move| s << move.join(' / ') + ', '}}[0..-3]}\nEVs: #{@evs}"
|
33
|
+
# end
|
35
34
|
end
|
36
|
-
end
|
35
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright(C)
|
2
|
+
# Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
3
|
#
|
4
4
|
# This file is part of Botémon.
|
5
5
|
#
|
@@ -20,11 +20,11 @@
|
|
20
20
|
module Smogon
|
21
21
|
class Pokemon
|
22
22
|
attr_accessor :name, :_name, :types, :tier, :abilities, :base_stats, :moves
|
23
|
-
|
23
|
+
|
24
24
|
def clues
|
25
25
|
"Ability: #{@abilities.join(', ')}\nType: #{@types.join(?/)}\nTier: #{@tier}\nBase stats: #{@base_stats.join(?/)}"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def self.to_pokemon(ary)
|
29
29
|
Pokemon.new.tap { |pokemon|
|
30
30
|
pokemon.name = ary['name' ]
|
@@ -36,7 +36,7 @@ module Smogon
|
|
36
36
|
pokemon.moves = ary['moves' ]
|
37
37
|
}
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def to_ary
|
41
41
|
{
|
42
42
|
'name' => @name,
|
@@ -104,4 +104,4 @@ module Smogon
|
|
104
104
|
}
|
105
105
|
end
|
106
106
|
end
|
107
|
-
end
|
107
|
+
end
|
data/lib/botemon/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright(C)
|
2
|
+
# Copyright(C) 2015 Giovanni Capuano <webmaster@giovannicapuano.net>
|
3
3
|
#
|
4
4
|
# This file is part of Botémon.
|
5
5
|
#
|
@@ -18,7 +18,5 @@
|
|
18
18
|
#++
|
19
19
|
|
20
20
|
module Botemon
|
21
|
-
|
22
|
-
'0.6'
|
23
|
-
end
|
21
|
+
VERSION = '0.7'
|
24
22
|
end
|
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: nokogiri
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sanitize
|
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
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: cinch
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +74,8 @@ executables:
|
|
102
74
|
extensions: []
|
103
75
|
extra_rdoc_files: []
|
104
76
|
files:
|
77
|
+
- bin/botemon
|
78
|
+
- lib/botemon.rb
|
105
79
|
- lib/botemon/abilitydex.rb
|
106
80
|
- lib/botemon/itemdex.rb
|
107
81
|
- lib/botemon/movedex.rb
|
@@ -112,8 +86,6 @@ files:
|
|
112
86
|
- lib/botemon/storage.rb
|
113
87
|
- lib/botemon/string.rb
|
114
88
|
- lib/botemon/version.rb
|
115
|
-
- lib/botemon.rb
|
116
|
-
- bin/botemon
|
117
89
|
homepage: http://www.giovannicapuano.net
|
118
90
|
licenses:
|
119
91
|
- GPL-3
|
@@ -134,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
106
|
version: '0'
|
135
107
|
requirements: []
|
136
108
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.2.2
|
138
110
|
signing_key:
|
139
111
|
specification_version: 4
|
140
112
|
summary: IRC bot for Pokéfags.
|