Skip to content

Commit

Permalink
Merge pull request #108 from AresMUSH/dev
Browse files Browse the repository at this point in the history
Beta 83
  • Loading branch information
lynnfaraday authored Aug 8, 2020
2 parents 7442777 + 471ba00 commit d705b29
Show file tree
Hide file tree
Showing 79 changed files with 695 additions and 184 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gem 'rake', '~> 12.3'
gem 'rspec', '~> 3.7.0'
gem 'timezone', '~> 1.2.10'
gem 'dentaku', '~>3.1'
gem 'json', '~> 2.1.0'
gem 'json', '~> 2.3.1'
gem 'redcarpet', '~> 3.4.0'
gem 'sinatra', '~> 2.0.4'
gem 'thin', '~> 1.7.2'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jmespath (1.4.0)
json (2.1.0)
json (2.3.1)
libv8 (3.16.14.19)
log4r (1.1.10)
minitest (5.14.1)
Expand Down Expand Up @@ -120,7 +120,7 @@ DEPENDENCIES
handlebars (~> 0.8.0)
htmlentities (~> 4.3.4)
i18n (~> 0.7)
json (~> 2.1.0)
json (~> 2.3.1)
log4r (~> 1.1.10)
ohm (~> 3.1.1)
rack (>= 2.1.4)
Expand Down
2 changes: 1 addition & 1 deletion engine/aresmush/commands/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def on_event(event)
AresMUSH.with_error_handling(nil, "Handling #{event_name}.") do
handler_class = p.get_event_handler(event_name)
if (handler_class)
if (event_name != "CronEvent" && event_name != "ConnectionEstablishedEvent")
if (event_name != "CronEvent" && event_name != "ConnectionEstablishedEvent" && event_name != "PoseEvent")
Global.logger.debug "#{handler_class} handling #{event_name}."
end
handler = handler_class.new
Expand Down
12 changes: 10 additions & 2 deletions engine/styles/ares.scss
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,8 @@ SCENES SCREEN
background-color: #337ab7;
}

.scene-privacy-limited {
background-color: #f0ad4e;
.scene-privacy-openstar {
background-color: #5bc0de;
}

.log-box {
Expand Down Expand Up @@ -1477,6 +1477,14 @@ JOBS SCREEN
border-color: #faebcc;
}

.job-participant-edit-box {
padding-left: 15px;
}

.job-template-editor {
margin: 0px;
}

/* -------------------------
OTHER
------------------------- */
Expand Down
1 change: 1 addition & 0 deletions install/game.distr/config/fs3skills_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ fs3skills:
fs3_roll:
type: fs3
message: Rolled a skill.
job_on_luck_spend: true
2 changes: 1 addition & 1 deletion install/game.distr/config/scenes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ scenes:
- 2
unshared_scene_deletion_days: 20
unshared_scene_warning_days: 13
use_custom_char_cards: false
use_custom_char_cards: false
6 changes: 3 additions & 3 deletions install/init_db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ def self.init_db
announce: false,
description: "Public chit-chat",
color: "%xy")
channel.default_alias = [ 'c', 'ch', 'cha' ]
channel.default_alias = [ 'ch', 'cha' ]
channel.save

channel = AresMUSH::Channel.create(name: "Questions",
color: "%xg",
description: "Questions and answers.")
channel.default_alias = [ 'q', 'qu', 'que' ]
channel.default_alias = [ 'qu', 'que' ]
channel.save

channel = AresMUSH::Channel.create(name: "Game",
Expand All @@ -167,7 +167,7 @@ def self.init_db
channel = AresMUSH::Channel.create(name: "Admin",
description: "Admin business.",
color: "%xr")
channel.default_alias = [ 'a', 'ad', 'adm' ]
channel.default_alias = [ 'adm' ]
channel.join_roles.add admin_role
channel.talk_roles.add admin_role
channel.save
Expand Down
17 changes: 17 additions & 0 deletions install/migrations/0061_beta83_update.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module AresMUSH

module Migrations
class MigrationBeta83Update
def require_restart
false
end

def migrate
Global.logger.debug "Adding luck job option."
config = DatabaseMigrator.read_config_file("fs3skills_misc.yml")
config['fs3skills']['job_on_luck_spend'] = true
config = DatabaseMigrator.write_config_file("fs3skills_misc.yml", config)
end
end
end
end
1 change: 1 addition & 0 deletions install/scripts/reset_headwiz_password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module AresMUSH
end

Game.master.master_admin.change_password(new_password)
Game.master.master_admin.update(login_failures: 0)

puts "Script complete! Password is now #{new_password}"
end
1 change: 1 addition & 0 deletions plugins/arescentral/helpers/handle_mgmt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def self.sync_handle(char)
char.update(ascii_mode_enabled: response.data["ascii_only"])
char.update(screen_reader: response.data["screen_reader"])
char.handle.update(friends: response.data["friends"])
char.handle.update(profile: response.data["profile"])
return nil
else
char.handle.delete
Expand Down
3 changes: 2 additions & 1 deletion plugins/arescentral/locales/locale_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ en:
game_registered: "You register this game with AresCentral. Note: The game will only appear in the directory if you have the game marked as public in the game configuration."
game_not_registered: "This game hasn't been registered with AresCentral, so handle functionality is currently disabled. Please contact your local game admin for more information."

unlink_failed: "There was a problem unlinking the character to your handle: %{error}"
unlink_failed: "There was a problem unlinking the character to your handle: %{error}"
view_full_profile: "View full profile (including other linked characters) at [AresCentral](https://arescentral.aresmush.com/handle/%{name})."
4 changes: 4 additions & 0 deletions plugins/arescentral/public/arescentral_char.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ def alts
AresCentral.alts(self)
end
end

class Handle
attribute :profile
end
end
3 changes: 2 additions & 1 deletion plugins/arescentral/specs/char_connected_event_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module AresCentral
allow(@char).to receive(:handle) { @handle }
allow(@char).to receive(:name) { "Bob" }
allow(@char).to receive(:id) { 111 }
response = { "status" => "success", "data" => { "linked" => true, "autospace" => "x", "timezone" => "t", "friends" => "f", "quote_color" => "q", "page_color" => "pc", "page_autospace" => "ps", "ascii_only" => true, "screen_reader" => true }}
response = { "status" => "success", "data" => { "linked" => true, "autospace" => "x", "timezone" => "t", "friends" => "f", "quote_color" => "q", "page_color" => "pc", "page_autospace" => "ps", "ascii_only" => true, "screen_reader" => true, "profile" => "handle profile" }}


expect(@connector).to receive(:sync_handle).with(123, "Bob", 111) { AresCentral::AresResponse.new(response) }
Expand All @@ -45,6 +45,7 @@ module AresCentral
expect(@char).to receive(:update).with({:timezone => "t"})
expect(@char).to receive(:update).with(ascii_mode_enabled: true)
expect(@char).to receive(:update).with(screen_reader: true)
expect(@handle).to receive(:update).with(profile: "handle profile")
expect(@handle).to receive(:update).with(friends: "f")
expect(@client).to receive(:emit_success).with("arescentral.handle_synced")
@handler.on_event(@event)
Expand Down
22 changes: 21 additions & 1 deletion plugins/arescentral/web/get_player_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ def handle(request)
error = Website.check_login(request, true)
return error if error

profile = player.profile.each_with_index.map { |(section, data), index|
{
name: section.titlecase,
key: section.parameterize(),
text: Website.format_markdown_for_html(data),
active_class: index == 0 ? 'active' : '' # Stupid bootstrap hack
}
}
if (player.handle && !player.handle.profile.blank?)
handle_profile = "#{player.handle.profile}\n\n----\n*#{t('arescentral.view_full_profile', :name => player.handle.name)}*"
handle_profile_data = {
name: "Handle Profile",
key: "arescentral",
text: Website.format_markdown_for_html(handle_profile),
active_class: profile.empty? ? "active" : ""
}
profile << handle_profile_data
end

{
id: player.id,
handle: player.handle ? player.handle.name : nil,
Expand All @@ -21,7 +40,8 @@ def handle(request)
alts: player.alts.map { |a| {name: a.name, icon: Website.icon_for_char(a)} },
can_manage: enactor && Profile.can_manage_char_profile?(enactor, player),
achievements: Achievements.is_enabled? ? Achievements.build_achievements(player) : nil,
admin_role_title: player.role_admin_note
admin_role_title: player.role_admin_note,
profile: profile
}
end
end
Expand Down
4 changes: 2 additions & 2 deletions plugins/channels/commands/management/channel_attribute_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def handle
Channels.with_a_channel(name, client) do |channel|

if (cmd.switch_is?("joinroles"))
channel.set_join_roles(roles)
channel.set_roles(roles, :join)
else
channel.set_talk_roles((roles))
channel.set_roles(roles, :talk)
end

Channels.emit_to_channel channel, t('channels.roles_changed_by', :name => enactor_name)
Expand Down
42 changes: 15 additions & 27 deletions plugins/channels/help/en/manage_channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,30 @@ summary: Managing channels.
## Creating and Deleting Channels

If you have the appropriate permissions, you can create and delete channels.
Channel admins can create, edit and delete channels. Go to [Admin -> Setup -> Setup Channels](/channels-manage). Channel properties include:

* Name - A unique name for the channel.
* Description - An optional description.
* Default Color - The default channel color, as an ansi code (e.g., \%xh\%xr). Players can set their own custom colors.
* Default Alias - A space-separated list of commands for talking on the channel (e.g., 'c ch cha' for the chat channel). If you don't specify this, the system will default to the first few letters of the channel.
* Join Roles - Players with this [role](/help/roles) can join the channel. Use 'everyone' to allow everybody to talk.
* Talk Roles - Players with this [role](/help/roles) can talk on the channel. Use 'everyone' to allow everybody to talk.

> **Note:** Take care to avoid ambiguous channel aliases (like 'g' if you have both a Galactica and Global channel) and aliases that overlap with other command (like 'n' for north or 'p' for page). Remember that AresMUSH ignores prefixes like '+' on commands.
`channel/create <channel>`
`channel/delete <channel>`
`channel/rename <channel>=<new name>` - Be cautious renaming channels since peoples' aliases may no longer make sense.
`channel/clear <channel>` - Clears the recall history.

## Adding and Removing Characters

Channel administrators can add or remove characters from a channel:

`channel/addchar <char>=<channel>`
`channel/removechar <char>=<channel>`

## Channel Appearance

You can set a description for the channel (which will appear in the channels list) and the color used for its name.

`channel/describe <channel>=<description>`
`channel/defaultcolor <channel>=<ansi prefix>` - Sets a channel's default color.

> **Tip:** Use full ansi code(s) not just the color name. For example: \%xc You can use multiple codes. For example: \%xh\%xr
## Roles

You can control who is allowed to use a channel by assigning roles to it. Only people with one of the specified roles will be allowed to join or talk on the channel.

If you change the roles for an existing channel, anyone who no longer has permission to be there will automatically leave the channel.

`channel/joinroles <channel>=<roles>` - Use commas to separate multiple roles. Use "none" to clear existing roles.
`channel/talkroles <channel>=<roles>` - Use commas to separate multiple roles. Use "none" to clear existing roles.
`channel/defaultalias <channel>=<aliases>` - Sets the default aliases for a channel.

## Default Aliases

The system will automatically use the first couple letters of the channel name for its default aliases (if the player doesn't specify their own). You can change this by specifying a list of space-separated names. For example: 'c ch cha' for the chat channel.
## Adding and Removing Characters

`channel/defaultalias <channel>=<aliases>` - Sets the default aliases for a channel.
Channel administrators can add or remove characters from a channel:

> **Tip:** Take care to avoid ambiguous channel aliases (like 'g' if you have both a Galactica and Global channel) and aliases that overlap with other command (like 'n' for north or 'p' for page). Remember that AresMUSH ignores prefixes like '+' on commands.
`channel/addchar <char>=<channel>`
`channel/removechar <char>=<channel>`
32 changes: 6 additions & 26 deletions plugins/channels/public/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,16 @@ def sorted_channel_messages
self.channel_messages.to_a.sort_by { |m| m.created_at }
end

def set_talk_roles(role_names)
role_names_upcase = role_names.map { |r| r.upcase }
self.talk_roles.each do |r|
if (!role_names_upcase.include?(r.name_upcase))
self.talk_roles.delete r
end
end

role_names.each do |r|
role = Role.find_one_by_name(r)
if (!self.talk_roles.include?(role))
self.talk_roles.add role
end
end
end

def set_join_roles(role_names)
role_names_upcase = role_names.map { |r| r.upcase }
self.join_roles.each do |r|
if (!role_names_upcase.include?(r.name_upcase))
self.join_roles.delete r
end
end

def set_roles(role_names, role_type)
role_list = role_type == :talk ? self.talk_roles : self.join_roles
new_roles = []
role_names.each do |r|
role = Role.find_one_by_name(r)
if (!self.join_roles.include?(role))
self.join_roles.add role
if (role)
new_roles << role
end
end
role_list.replace new_roles
end
end
end
2 changes: 1 addition & 1 deletion plugins/channels/web/chat_manage_request_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def handle(request)
id: c.id,
name: c.name,
color: c.color,
desc: c.description,
desc: Website.format_markdown_for_html(c.description),
can_join: c.join_roles.map { |r| r.name },
can_talk: c.talk_roles.map { |r| r.name }
}}
Expand Down
4 changes: 2 additions & 2 deletions plugins/channels/web/create_channel_request_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def handle(request)
Global.logger.info "Channel #{name} created by #{enactor.name}."

channel = Channel.create(name: name, description: Website.format_input_for_mush(desc), color: color)
channel.set_join_roles(can_join)
channel.set_talk_roles(can_talk)
channel.set_roles(can_join, :join)
channel.set_roles(can_talk, :talk)

{}
end
Expand Down
4 changes: 2 additions & 2 deletions plugins/channels/web/save_channel_request_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def handle(request)
color = "%xh"
end

channel.set_join_roles(can_join)
channel.set_talk_roles(can_talk)
channel.set_roles(can_join, :join)
channel.set_roles(can_talk, :talk)

channel.update(name: name, color: color, description: desc ? Website.format_input_for_mush(desc) : "")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ForumCreateCategoryCmd
attr_accessor :name

def parse_args
self.name = titlecase_arg(cmd.args)
self.name = trim_arg(cmd.args)
end

def required_args
Expand Down
12 changes: 12 additions & 0 deletions plugins/forum/forum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def self.get_web_request_handler(request)
return ForumHideRequestHandler
when "forumList"
return ForumListRequestHandler
when "forumMove"
return ForumMoveTopicRequestHandler
when "forumMute"
return ForumMuteRequestHandler
when "forumPin"
Expand All @@ -117,6 +119,16 @@ def self.get_web_request_handler(request)
return ForumUnreadRequestHandler
when "forumRecent"
return RecentForumPostsRequestHandler
when "createForum"
return CreateForumRequestHandler
when "deleteForum"
return DeleteForumRequestHandler
when "editForum"
return EditForumRequestHandler
when "manageForum"
return ManageForumRequestHandler
when "saveForum"
return SaveForumRequestHandler
when "searchForum"
return SearchForumRequestHandler
end
Expand Down
Loading

0 comments on commit d705b29

Please sign in to comment.