arkaan 1.2.11 → 1.2.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82aa68bb4f6bce232d42d45f87f6c14c0e07440c
4
- data.tar.gz: bb2a4b384892b5e13b79ff0cd9e381ce5adf9c5f
3
+ metadata.gz: 80de8d1fa27344cf14bd450f1f197243873e46a8
4
+ data.tar.gz: 1e0cdb147068955ab61505595624d12cf45491e7
5
5
  SHA512:
6
- metadata.gz: ecdcac9b934815ea41f52afc3be2c6fb600fde45b69cf9eeb10e16994512d1a130d8c3ca48820f2b8c921f7786aca122cc717c91add76837c0507efda85f9938
7
- data.tar.gz: 906e1b8c58df10283f679f1f4933948da640a4e00db46f95459b60e557f200d8a0efdec0252cda2c2dc349d72b10ae3087cb833b72532b34187f33b01eea648b
6
+ metadata.gz: 47d8d42e6b64fa1d090035e43be559063955686c82ce725f42860ffb05e09c7660c44ddb91b5d5587b2056b11fc97eed6b4dd6b1eeb75611529351a5b55153f9
7
+ data.tar.gz: cc31dbb113177e99fa476454ffec8b38cdba53740c7a7b9e7d0361b1c3fccbebba90fceb11eb06e695c7bd9a81ab4aa360d77f6ada092713559a7defbe12dcea
@@ -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::Messages::Base', inverse_of: :campaign
30
+ embeds_many :messages, class_name: 'Arkaan::Campaigns::Message', inverse_of: :campaign
31
31
 
32
32
  validates :title,
33
33
  presence: {message: 'required'},
@@ -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 :Messages , 'arkaan/campaigns/messages'
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.11
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-07 00:00:00.000000000 Z
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/messages.rb
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,9 +0,0 @@
1
- module Arkaan
2
- module Campaigns
3
- module Messages
4
- autoload :Base , 'arkaan/campaigns/messages/base'
5
- autoload :Diceroll, 'arkaan/campaigns/messages/diceroll'
6
- autoload :Text , 'arkaan/campaigns/messages/text'
7
- end
8
- end
9
- end
@@ -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