Skip to content

Commit

Permalink
Merge pull request #11 from AresMUSH/v0.9
Browse files Browse the repository at this point in the history
V0.9
  • Loading branch information
lynnfaraday authored Mar 25, 2018
2 parents 460cc00 + 203ec1b commit 2c3bb17
Show file tree
Hide file tree
Showing 32 changed files with 282 additions and 81 deletions.
6 changes: 6 additions & 0 deletions Rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def minimal_boot
AresMUSH::Install.configure_game
end

task :add_plugin, [:plugin_name] do |t, args|
minimal_boot
plugin_name = args[:plugin_name]
importer = AresMUSH::Manage::PluginImporter.new(plugin_name)
importer.import
end

task :webexport do
minimal_boot
Expand Down
2 changes: 2 additions & 0 deletions bin/addplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bundle install
bundle exec rake add_plugin[$*]
28 changes: 14 additions & 14 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ bin/configure

bin/wipedb

echo -e "${ARES_INSTALL_TEXT} Creating game dir link."

cd /var/www/html/

ln -s /home/ares/aresmush/game game

echo -e "${ARES_INSTALL_TEXT} Starting game"

cd /home/ares/aresmush

bin/startares

echo -e "${ARES_INSTALL_TEXT} Setup the web portal."

cd /home/ares/ares-webportal
Expand All @@ -75,19 +87,7 @@ nvm install node
echo -e "${ARES_INSTALL_TEXT} Ember CLI"
npm install -g ember-cli

echo -e "${ARES_INSTALL_TEXT} Bower for web dependencies"
npm install -g bower

echo -e "${ARES_INSTALL_TEXT} Creating game dir link."

cd /var/www/html/

ln -s /home/ares/aresmush/game game

echo -e "${ARES_INSTALL_TEXT} Starting game"

cd /home/ares/aresmush

bin/startares
bin/install
bin/deploy

echo -e "${ARES_INSTALL_TEXT} Done!"
15 changes: 15 additions & 0 deletions bin/local_setup_mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
brew update
brew install yarn
brew install git
brew install redis
brew install node

command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
\curl -sSL https://get.rvm.io | bash -s stable --rails
source /home/ares/.rvm/scripts/rvm
rvm install ruby-2.4.1
rvm use ruby-2.4.1

gem install bundler

npm install -g ember-cli
11 changes: 11 additions & 0 deletions bin/local_setup_windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
choco install git
choco install yarn
choco install redis-64
choco install github
choco install nodejs.install
choco install ruby --version 2.4.3.1
choco install ruby2.devkit

gem install bundler

npm install -g ember-cli
7 changes: 6 additions & 1 deletion engine/aresmush/templates/handlebars_template.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
module AresMUSH
mattr_accessor :handlebars_context

class HandlebarsTemplate
def initialize(file)
template = File.read(file)
@handlebars = Handlebars::Context.new
if (!AresMUSH.handlebars_context)
AresMUSH.handlebars_context = Handlebars::Context.new
end
@handlebars = AresMUSH.handlebars_context
template_contents = File.read(file)
@template = @handlebars.compile(template_contents)

Expand Down
1 change: 0 additions & 1 deletion game/config/fs3combat_hitloc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fs3combat:
Right Hand: [ 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Right Arm', 'Right Arm', 'Right Arm', 'Left Hand', 'Left Hand', 'Left Hand' ]
Left Arm: [ 'Head', 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Left Hand', 'Left Hand', 'Left Arm', 'Left Arm', 'Left Hand' ]
Right Arm: [ 'Head', 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Right Hand', 'Right Hand', 'Right Arm', 'Right Arm', 'Right Hand' ]
Abdomen: [ 'Head', 'Chest', 'Chest', 'Left Leg', 'Left Leg', 'Right Leg', 'Right Leg', 'Abdomen', 'Abdomen', 'Abdomen' ]
Head: [ 'Right Arm', 'Right Arm', 'Left Arm', 'Chest', 'Chest', 'Neck', 'Neck', 'Head', 'Head', 'Head' ]
Neck: [ 'Right Arm', 'Right Arm', 'Left Arm', 'Chest', 'Chest', 'Head', 'Head', 'Neck', 'Neck', 'Neck' ]
Abdomen: [ 'Left Leg', 'Right Leg', 'Left Leg', 'Right Leg', 'Chest', 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Abdomen' ]
Expand Down
1 change: 0 additions & 1 deletion game/config/fs3combat_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ fs3combat:
defense_skill: None

shortcuts:
"weapons": "weapon"
"combat/skill": "combat/summary"
"combat/skills": "combat/summary"
"combat/slackers": "combat/summary"
Expand Down
2 changes: 1 addition & 1 deletion game/config/fs3skills_chargen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fs3skills:
3: 4

max_points_on_attrs: 12
max_points_on_action: 25
max_points_on_action: 28

unusual_skills:
- Celtan
Expand Down
1 change: 0 additions & 1 deletion game/config/scenes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ scenes:
"scene/name" : "scene/title"
"scene/info" : "scene"
"scene/rename" : "scene/title"
"repose/notify" : "repose/nudge"
"repose/log" : "repose/all"
"repose/reset": "repose/clear"
"repose/gag": "repose/nudge mute"
Expand Down
2 changes: 1 addition & 1 deletion game/config/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ website:

portal_requires_registration: false

website_code_path: '~/ares-webportal'
website_code_path: '/home/ares/ares-webportal'
2 changes: 1 addition & 1 deletion game/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8
0.9
2 changes: 1 addition & 1 deletion install/configure_game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.error_if_blank(current, name)
def self.configure_game
template_path = File.join(File.dirname(__FILE__), 'templates')

puts "\nLet's set up your database. Please enter the requested information."
puts "\nLet's set up your database. The default options should suffice unless you've done something unusual with your Redis installation."

print "Database url (default 127.0.0.1:6379)> "
db_url = STDIN.gets.chomp
Expand Down
14 changes: 14 additions & 0 deletions install/upgrades/036-0.9_upgrade.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module AresMUSH

puts "======================================================================="
puts "Add timestamps to channel history. "
puts "======================================================================="


Channel.all.each do |c|
messages = c.messages
new_messages = c.messages.map { |m| { message: m, timestamp: DateTime.now }}
c.update(messages: new_messages)
end
puts "Upgrade complete!"
end
6 changes: 3 additions & 3 deletions plugins/channels/commands/channel_recall_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def handle
Channels.with_an_enabled_channel(self.name, client, enactor) do |channel|
total_messages = channel.messages.count
start_message = [ (total_messages - self.num_messages), 0 ].max
messages = channel.messages[start_message, total_messages].map { |m| " #{channel.display_name} #{m}" }

template = BorderedListTemplate.new messages, t('channels.recall_history', :name => channel.display_name(false))
messages = channel.messages[start_message, total_messages]
list = messages.map { |m| " [#{OOCTime.local_long_timestr(enactor, m['timestamp'])}] #{channel.display_name} #{m['message']}"}
template = BorderedListTemplate.new list, t('channels.recall_history', :name => channel.display_name(false))
client.emit template.render
end
end
Expand Down
5 changes: 3 additions & 2 deletions plugins/channels/commands/channel_report_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def required_args

def handle
Channels.with_an_enabled_channel(self.name, client, enactor) do |channel|
total_messages = channel.messages.count
messages = channel.messages.map { |m| " [#{OOCTime.local_long_timestr(enactor, m['timestamp'])}] #{channel.display_name} #{m['message']}"}.join("%R")

body = t('channels.channel_reported_body', :name => channel.name, :reporter => enactor_name)
body << self.reason
body << "%R-------%R"
body << channel.messages.map { |m| " #{m}" }.join('%R')
body << messages

Jobs.create_job(Jobs.trouble_category, t('channels.channel_reported_title'), body, Game.master.system_character)
client.emit_success t('channels.channel_reported')

Expand Down
2 changes: 1 addition & 1 deletion plugins/channels/public/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def display_name(include_markers = true)

def add_to_history(msg)
return if !self.recall_enabled
new_messages = (self.messages << msg)
new_messages = (self.messages << { message: msg, timestamp: DateTime.now })
if (new_messages.count > 25)
new_messages.shift
end
Expand Down
10 changes: 9 additions & 1 deletion plugins/channels/web/chat_request_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ def handle(request)
name: c.name,
enabled: Channels.is_on_channel?(enactor, c),
allowed: Channels.can_use_channel(enactor, c),
messages: Channels.is_on_channel?(enactor, c) ? c.messages.map { |m| WebHelpers.format_markdown_for_html(m) } : nil
who: Channels.channel_who(c).map { |w| {
name: w.name,
ooc_name: w.ooc_name,
icon: WebHelpers.icon_for_char(w),
muted: Channels.is_muted?(w, c)
}},
messages: Channels.is_on_channel?(enactor, c) ? c.messages.map { |m| {
message: WebHelpers.format_markdown_for_html(m['message']),
timestamp: OOCTime.local_long_timestr(enactor, m['timestamp']) }} : nil
}}

{
Expand Down
2 changes: 2 additions & 0 deletions plugins/forum/forum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def self.get_web_request_handler(request)
return ForumTopicRequestHandler
when "forumUnread"
return ForumUnreadRequestHandler
when "forumRecent"
return RecentForumPostsRequestHandler
end
end

Expand Down
8 changes: 8 additions & 0 deletions plugins/forum/public/bbs_post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ def authored_by?(char)
char == author
end

def last_updated
if (bbs_replies.empty?)
return self.updated_at
else
return bbs_replies.to_a[-1].updated_at
end
end

def author_name
!self.author ? t('forum.deleted_author') : self.author.name
end
Expand Down
4 changes: 4 additions & 0 deletions plugins/forum/public/bbs_reply.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ def author_name
def created_date_str(char)
OOCTime.local_long_timestr(char, self.created_at)
end

def created_date_str_short(char)
OOCTime.local_short_timestr(char, self.created_at)
end
end
end
1 change: 1 addition & 0 deletions plugins/forum/web/forum_list_request_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def handle(request)
.map { |b| {
id: b.id,
name: b.name,
description: b.description,
unread: enactor && b.has_unread?(enactor)
}}

Expand Down
49 changes: 49 additions & 0 deletions plugins/forum/web/recent_forum_posts_request_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module AresMUSH
module Forum
class RecentForumPostsRequestHandler
def handle(request)

enactor = request.enactor

error = WebHelpers.check_login(request, true)
return error if error

posts = BbsPost.all.select { |p| Forum.can_read_category?(enactor, p.bbs_board ) }
.sort_by { |p| p.last_updated }.reverse[0..6]

recent = []

posts.each do |p|
if (p.bbs_replies.empty?)
recent << {
id: p.id,
category_id: p.bbs_board.id,
author: {
name: p.author_name,
icon: p.author ? WebHelpers.icon_for_char(p.author) : nil
},
date: p.created_date_str_short(enactor),
subject: p.subject,
is_reply: false
}
else
last_reply = p.bbs_replies.to_a[-1]
recent << {
id: p.id,
category_id: p.bbs_board.id,
author: {
name: last_reply.author_name,
icon: last_reply.author ? WebHelpers.icon_for_char(last_reply.author) : nil
},
date: last_reply.created_date_str_short(enactor),
subject: p.subject,
is_reply: true
}
end
end

recent
end
end
end
end
11 changes: 8 additions & 3 deletions plugins/fs3skills/commands/char_backup_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ def check_permission

def handle
ClassTargetFinder.with_a_character(self.target, client, enactor) do |model|
Global.dispatcher.queue_command(client, Command.new("sheet #{model.name}"))
Global.dispatcher.queue_command(client, Command.new("bg #{model.name}"))
Global.dispatcher.queue_command(client, Command.new("info #{model.name}"))

["sheet", "bg", "profile", "damage", "relationships"].each_with_index do |cmd, seconds|
Global.dispatcher.queue_timer(seconds, "Character backup #{model.name}", client) do
Global.dispatcher.queue_command(client, Command.new("#{cmd} #{model.name}"))
end
end

template = Describe.desc_template(model, enactor)
client.emit template.render
end


end
end
end
Expand Down
Loading

0 comments on commit 2c3bb17

Please sign in to comment.