arkaan 1.2.11 → 1.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan/campaign.rb +1 -1
- data/lib/arkaan/campaigns.rb +1 -1
- data/lib/arkaan/campaigns/message.rb +25 -0
- metadata +3 -6
- data/lib/arkaan/campaigns/messages.rb +0 -9
- data/lib/arkaan/campaigns/messages/base.rb +0 -20
- data/lib/arkaan/campaigns/messages/diceroll.rb +0 -33
- data/lib/arkaan/campaigns/messages/text.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80de8d1fa27344cf14bd450f1f197243873e46a8
|
4
|
+
data.tar.gz: 1e0cdb147068955ab61505595624d12cf45491e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47d8d42e6b64fa1d090035e43be559063955686c82ce725f42860ffb05e09c7660c44ddb91b5d5587b2056b11fc97eed6b4dd6b1eeb75611529351a5b55153f9
|
7
|
+
data.tar.gz: cc31dbb113177e99fa476454ffec8b38cdba53740c7a7b9e7d0361b1c3fccbebba90fceb11eb06e695c7bd9a81ab4aa360d77f6ada092713559a7defbe12dcea
|
data/lib/arkaan/campaign.rb
CHANGED
@@ -27,7 +27,7 @@ module Arkaan
|
|
27
27
|
|
28
28
|
# @!attribute [rw] messages
|
29
29
|
# @return [Array<Arkaan::Campaigns::Messages::Base>] the messages sent in the chatroom of the campaign.
|
30
|
-
embeds_many :messages, class_name: 'Arkaan::Campaigns::
|
30
|
+
embeds_many :messages, class_name: 'Arkaan::Campaigns::Message', inverse_of: :campaign
|
31
31
|
|
32
32
|
validates :title,
|
33
33
|
presence: {message: 'required'},
|
data/lib/arkaan/campaigns.rb
CHANGED
@@ -3,7 +3,7 @@ module Arkaan
|
|
3
3
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
4
4
|
module Campaigns
|
5
5
|
autoload :Invitation, 'arkaan/campaigns/invitation'
|
6
|
-
autoload :
|
6
|
+
autoload :Message , 'arkaan/campaigns/message'
|
7
7
|
autoload :Tag , 'arkaan/campaigns/tag'
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Arkaan
|
2
|
+
module Campaigns
|
3
|
+
# This model represents an in-game tchat message sent in the tchat of a campaign.
|
4
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
|
+
class Message
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps
|
8
|
+
include Arkaan::Concerns::Enumerable
|
9
|
+
|
10
|
+
# @!attribute [rw] type
|
11
|
+
# @return [Symbol] the type of message (plain text or command) contained in the data, used to parse and display it.
|
12
|
+
enum_field :type, [:text, :command], default: :text
|
13
|
+
# @!attribute [rw] data
|
14
|
+
# @return [Hash] the additional data passed to the message (arguments of the command, or content of the text)
|
15
|
+
field :data, type: Hash, default: {}
|
16
|
+
|
17
|
+
# @!attribute [rw] campaign
|
18
|
+
# @return [Arkaan::Campaign] the campaign in which the message has been emitted.
|
19
|
+
embedded_in :campaign, class_name: 'Arkaan::Campaign', inverse_of: :messages
|
20
|
+
# @!attribute [rw] player
|
21
|
+
# @return [Arkaan::Account] the account that has emitted the message in the campaign.
|
22
|
+
belongs_to :player, class_name: 'Arkaan::Campaigns::Invitation'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -261,10 +261,7 @@ files:
|
|
261
261
|
- lib/arkaan/campaign.rb
|
262
262
|
- lib/arkaan/campaigns.rb
|
263
263
|
- lib/arkaan/campaigns/invitation.rb
|
264
|
-
- lib/arkaan/campaigns/
|
265
|
-
- lib/arkaan/campaigns/messages/base.rb
|
266
|
-
- lib/arkaan/campaigns/messages/diceroll.rb
|
267
|
-
- lib/arkaan/campaigns/messages/text.rb
|
264
|
+
- lib/arkaan/campaigns/message.rb
|
268
265
|
- lib/arkaan/campaigns/tag.rb
|
269
266
|
- lib/arkaan/concerns.rb
|
270
267
|
- lib/arkaan/concerns/activable.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Arkaan
|
2
|
-
module Campaigns
|
3
|
-
# This model represents an in-game tchat message sent in the tchat of a campaign.
|
4
|
-
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
|
-
module Messages
|
6
|
-
|
7
|
-
class Base
|
8
|
-
include Mongoid::Document
|
9
|
-
include Mongoid::Timestamps
|
10
|
-
|
11
|
-
# @!attribute [rw] campaign
|
12
|
-
# @return [Arkaan::Campaign] the campaign in which the message has been emitted.
|
13
|
-
embedded_in :campaign, class_name: 'Arkaan::Campaign', inverse_of: :messages
|
14
|
-
# @!attribute [rw] player
|
15
|
-
# @return [Arkaan::Account] the account that has emitted the message in the campaign.
|
16
|
-
belongs_to :player, class_name: 'Arkaan::Campaigns::Invitation'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Arkaan
|
2
|
-
module Campaigns
|
3
|
-
# This model represents an in-game tchat message sent in the tchat of a campaign.
|
4
|
-
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
|
-
module Messages
|
6
|
-
|
7
|
-
class Diceroll < Arkaan::Campaigns::Messages::Base
|
8
|
-
|
9
|
-
# @!attribute [rw] number_of_dices
|
10
|
-
# @return [Integer] the number of dices you want to roll.
|
11
|
-
field :number_of_dices, type: Integer, default: 1
|
12
|
-
# @!attribute [rw] number_of_faces
|
13
|
-
# @return [Integer] the number of faces each dice is supposed to have.
|
14
|
-
field :number_of_faces, type: Integer, default: 20
|
15
|
-
# @!attribute [rw] modifier
|
16
|
-
# @return [Integer] the value added to the sum of all dices to get the final result.
|
17
|
-
field :modifier, type: Integer, default: 0
|
18
|
-
# @!attribute [rw] results
|
19
|
-
# @return [Array<Integer>] an array of integers, each one of them representing the result for one of the dices.
|
20
|
-
field :results, type: Array, default: []
|
21
|
-
|
22
|
-
# Computes the results before saving the document, the first time it's saved.
|
23
|
-
before_save do |document|
|
24
|
-
if !document.persisted?
|
25
|
-
number_of_dices.times do
|
26
|
-
results << rand(document.number_of_faces) + 1
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Arkaan
|
2
|
-
module Campaigns
|
3
|
-
# This model represents an in-game tchat message sent in the tchat of a campaign.
|
4
|
-
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
|
-
module Messages
|
6
|
-
|
7
|
-
class Text < Arkaan::Campaigns::Messages::Base
|
8
|
-
|
9
|
-
# @!attribute [rw] content
|
10
|
-
# @return [String] the content of the message as raw text.
|
11
|
-
field :content, type: String
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|