Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase to current master branch #1

Open
wants to merge 115 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
5577289
Update tysong.xml
mrhoribu Mar 9, 2022
c64fb3c
Merge pull request #17 from mrhoribu/patch-3
ondreian Mar 9, 2022
ff065f8
[profanity.rb] Remove $SAFE reference
mrhoribu Jan 14, 2023
13db722
Merge pull request #5 from elanthia-online/ruby-v3-safe-issues
LeBigNasty Jan 16, 2023
6a7d0a3
adds arbitrary progress bar handler
FarFigNewGut Jan 18, 2023
53f70d6
[profanity.rb] Ruby 3.2 compatibility
mrhoribu Feb 19, 2023
091fbf5
Merge pull request #6 from FarFigNewGut/arbtimer
mrhoribu Feb 19, 2023
041e19f
Merge pull request #7 from elanthia-online/ruby-3.2-untaint
mrhoribu Feb 19, 2023
9d02ee0
added the code to make links blue correctly
h6b45 Aug 14, 2023
71591dd
color #6666ff to #6060ff for optimal blue links
h6b45 Aug 14, 2023
c643bb4
profanity command .links added
h6b45 Aug 14, 2023
d2bf717
added <preset> elements to default.xml for roomName and links colors
h6b45 Aug 14, 2023
2be21be
added <preset> elements to tysong.xml for roomName and links colors
h6b45 Aug 14, 2023
48f687d
added nil check so link preset of bg='000000' is transparent
h6b45 Aug 14, 2023
b9c68d8
Update tysong.xml
mrhoribu Aug 14, 2023
b2f78fe
Update default.xml
mrhoribu Aug 14, 2023
6fae57b
Update tysong.xml
mrhoribu Aug 14, 2023
580c6c2
Update profanity.rb
mrhoribu Aug 14, 2023
cad083c
Merge pull request #9 from h6b45/master
mrhoribu Aug 14, 2023
1df9f73
Create .rubocop.yml
mrhoribu Aug 14, 2023
86cd409
Create rubocop.yml
mrhoribu Aug 14, 2023
07209f8
Update string.rb rubocop
mrhoribu Aug 14, 2023
84d0706
Create Gemfile
mrhoribu Aug 14, 2023
c971776
Update .rubocop.yml
mrhoribu Jan 30, 2024
65bee38
Update hilite.rb
mrhoribu Jan 30, 2024
4a83383
Update autocomplete.rb
mrhoribu Jan 30, 2024
07f2306
Update profanity.rb
mrhoribu Jan 30, 2024
a3721be
Update default.xml
mrhoribu Jan 30, 2024
4b7e368
Update tysong.xml
mrhoribu Jan 30, 2024
79322eb
Update text.rb
mrhoribu Jan 30, 2024
55523ee
rubocop cleanup
mrhoribu Jan 30, 2024
ef19ee9
rubocop cleanup
mrhoribu Jan 30, 2024
8d3a191
rubocop cleanup
mrhoribu Jan 30, 2024
e85d268
rubocop cleanup
mrhoribu Jan 30, 2024
490f790
rubocop cleanup
mrhoribu Jan 30, 2024
abc4c95
rubocop cleanup
mrhoribu Jan 30, 2024
168e629
rubocop cleanup
mrhoribu Jan 30, 2024
4ecc811
rubocop cleanup
mrhoribu Jan 30, 2024
c657aa6
rubocop cleanup
mrhoribu Jan 30, 2024
529b8ff
rubocop cleanup
mrhoribu Jan 30, 2024
0a7816d
Update settings.rb
mrhoribu Feb 6, 2024
0554a88
Update profanity.rb
mrhoribu Feb 6, 2024
44b11e4
rubocop cleanup
mrhoribu Feb 6, 2024
46eb6ee
Update profanity.rb
mrhoribu Feb 6, 2024
87301eb
missing closing bracket syntax fix
mrhoribu Feb 6, 2024
3d754b6
default template load behavior
mrhoribu Feb 6, 2024
d059788
Update profanity.rb
mrhoribu Feb 6, 2024
350d750
Update README.md
mrhoribu Feb 12, 2024
e178589
Create original.xml
mrhoribu Feb 13, 2024
0e316cc
Create .gitattributes
mrhoribu Feb 13, 2024
b2feffd
Merge pull request #12 from elanthia-online/Rubocop-Cleanup-and-Featu…
mrhoribu Feb 29, 2024
36ae636
update folder path to default git names
mrhoribu Mar 27, 2024
c4d5ece
add CLI options
mrhoribu Mar 27, 2024
13c8726
[profanity.rb] support clearStream
mrhoribu Mar 27, 2024
f2d05e5
Update profanity.rb
mrhoribu Mar 27, 2024
7627015
add `clear_buffer` def
mrhoribu Mar 27, 2024
e6e0235
feat: add DragonRealms customizations
mrhoribu Mar 27, 2024
31a5273
Create exp.rb
mrhoribu Mar 27, 2024
bdd2fa5
Update profanity.rb
mrhoribu Mar 27, 2024
b745b1a
Update perc.rb
mrhoribu Mar 27, 2024
6e505f3
robocop cleanup
mrhoribu Mar 27, 2024
a254b05
robocop cleanup
mrhoribu Mar 27, 2024
6ce7dda
Update profanity.rb
mrhoribu Mar 27, 2024
6af2347
Update text.rb
mrhoribu Mar 27, 2024
400115f
Update perc.rb
mrhoribu Mar 27, 2024
559907a
Update profanity.rb
mrhoribu Mar 27, 2024
19432e1
Update profanity.rb
mrhoribu Mar 27, 2024
78135e1
robocop
mrhoribu Mar 27, 2024
9dbff2b
robocop
mrhoribu Mar 27, 2024
64ea565
additional robocop
mrhoribu Mar 27, 2024
0b88bc0
add timestamp compatibility for settings.xml
mrhoribu Mar 27, 2024
9382250
add timestamp compatibility for settings.xml
mrhoribu Mar 27, 2024
2828de1
Update text.rb
mrhoribu Mar 27, 2024
5b3cb66
add numpad support
mrhoribu Mar 27, 2024
8fb8081
add numpad support
mrhoribu Mar 27, 2024
d528f7b
add numpad support
mrhoribu Mar 27, 2024
7d299bc
add numpad support
mrhoribu Mar 27, 2024
524ddc0
robocop cleanup
mrhoribu Mar 27, 2024
6c45664
additional stream support
mrhoribu Mar 27, 2024
110ac8d
Merge pull request #13 from elanthia-online/clearStream-support
mrhoribu Mar 27, 2024
4c2a80f
Merge branch 'dr-customizations' into master
mrhoribu Mar 27, 2024
fe1419b
Revert "feat: add DragonRealms customizations"
mrhoribu Mar 27, 2024
0b4ccff
Merge pull request #16 from elanthia-online/revert-14-dr-customizations
mrhoribu Mar 27, 2024
4aed1cc
Revert "Revert "feat: add DragonRealms customizations""
mrhoribu Mar 27, 2024
1c06eca
robocop cleanup
mrhoribu Mar 27, 2024
20b6a07
Update profanity.rb
mrhoribu May 8, 2024
ac4c5f8
Merge pull request #17 from elanthia-online/revert-16-revert-14-dr-cu…
mrhoribu May 25, 2024
184e8a2
Added support for a room window
strnglp May 25, 2024
d0d8d4e
Fixup deafult color support
strnglp May 29, 2024
ff25547
* Fixed resize issue with overriding default colors
strnglp May 29, 2024
b6372fa
Merge pull request #18 from strnglp/master
mrhoribu Jun 19, 2024
beb61ae
Add Rubocop for PRs as well
mrhoribu Jun 22, 2024
51c5626
Reworked room window - no longer spams "look"
strnglp Jun 22, 2024
1083162
Bugfix: Newline no longer added before text if first line in window
strnglp Jun 25, 2024
f53487e
Merge branch 'elanthia-online:master' into master
strnglp Jun 25, 2024
96b0150
chore: sync rubocop config across repositories
mrhoribu Jun 26, 2024
bf1ab2d
Merge pull request #20 from elanthia-online/mrhoribu-patch-1
mrhoribu Jun 26, 2024
fab3907
Merge pull request #19 from strnglp/master
mrhoribu Jul 1, 2024
527f919
update to run on Ruby 3.3
mrhoribu Jul 7, 2024
d23de65
update actions to latest version
mrhoribu Jul 8, 2024
1ac3046
[profanity.rb] remove unnecessary env headers
mrhoribu Jul 10, 2024
f93f911
Merge pull request #23 from elanthia-online/profanity-headers-fix
mrhoribu Jul 10, 2024
c889448
arbProgress updates
strnglp Aug 14, 2024
4f667a5
[eleazzar.xml] - added information to header
strnglp Aug 15, 2024
e563ec0
Update README.md
mrhoribu Aug 15, 2024
9fae39e
Update README.md
mrhoribu Aug 15, 2024
349fc21
correct nerdfont.com to nerdfonts.com
mrhoribu Aug 15, 2024
30f1cc4
Merge pull request #24 from strnglp/arbProgress-fix
mrhoribu Aug 15, 2024
3c00a96
add ENV line back, removed in error
mrhoribu Dec 10, 2024
9b15a05
bugfix: NilClass Opts.char when none passed
mrhoribu Dec 10, 2024
fcfc19e
Update profanity.rb
mrhoribu Dec 10, 2024
0cf8ed2
Update rubocop.yml
mrhoribu Dec 10, 2024
6381e55
Merge pull request #26 from elanthia-online/mrhoribu-patch-1
mrhoribu Dec 10, 2024
bcae31b
Update .rubocop.yml
mrhoribu Dec 10, 2024
3daa837
bugfix: use default template if no --char provided
mrhoribu Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git* export-ignore
*.yml export-ignore
README.md export-ignore
Gemfile* export-ignore
47 changes: 47 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Rubocop
on:
push:
paths:
- "**/*.rb"
- "profanity.rb"
pull_request:
paths:
- "**/*.rb"
- "profanity.rb"

jobs:
rubocop:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.3']
name: Run Rubocop on Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
**/*.rb
profanity.rb

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: false
- name: Install ruby gem dependencies with bundler
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- run: bundle install
- name: Rubocop
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
bundle exec rubocop $file
done
69 changes: 69 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
AllCops:
TargetRubyVersion: 3.3
NewCops: disable
Include:
- '**/*.lic'
- '**/*.rb'

Naming:
Enabled: false

Style:
Enabled: false

Layout/EmptyLineAfterGuardClause:
Enabled: false

Layout/EndOfLine:
Enabled: false

Layout/FirstHashElementIndentation:
EnforcedStyle: consistent

Layout/HashAlignment:
EnforcedHashRocketStyle: table

Layout/LineLength:
Enabled: false

Layout/HeredocIndentation:
Enabled: false

Layout/ClosingHeredocIndentation:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Metrics/ParameterLists:
Enabled: false

Security/Eval:
Enabled: false

Security/MarshalLoad:
Enabled: false

Lint/ScriptPermission:
Enabled: false
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

group :development do
gem "rspec"
gem 'rubocop'
end
85 changes: 82 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,83 @@
ProfanityFE
===========

# ProfanityFE
A terminal frontend for Simutronics games based on Ruby and Ncurses.

## Installation
1. Install Ruby on machine
2. Git Clone the Lich5 repository
3. Git Clone the ProfanityFE repository
4. Configure the template file for your character in the ProfanityFE\templates folder, otherwise use default.xml
5. Open Lich5 and save a character entry, alternatively do this on another machine with a GUI interface and copy Lich5\data\entry.dat
6. Launch Lich5 via `ruby ~/lich-5/lich.rbw --login Rinualdo --without-frontend --detachable-client=8000 &` or similar.
7. Launch Profanity via `ruby ~/ProfanityFE/profanity.rb --port=8000 --char=Rinualdo`

## Profanity CLI Options
* --port=<port>
* --default-color-id=<id>
* --default-background-color-id=<id>
* --custom-colors=<on|off>
* --settings-file=<filename>
* --char=<character>
* --no-status do not redraw the process title with status updates
* --links enable links to be shown by default, otherwise can enable via .links command
* --speech-ts display timestamps on speech, familiar and thought window
* --remote-url display LaunchURLs on screen, used for remote environments
* --template=<filename.xml> filename of template to use in templates subdirectory

## Sample Scripts
Here's a sample login script written for Linux, usage syntax would be `.\gemstone.sh <CHARNAME>`

Do note that some of these settings will need to be adjusted based on the terminal being used (e.g. xterm-256color vs screen-256color)
```bash
#!/bin/bash
set -e

port=8000
CHAR=$1
LICH_BIN=~/lich-5/lich.rbw
PROFANITY_BIN=~/ProfanityFE/profanity.rb

export TERM=screen-256color

lookup_char_port () {
local char=$1
port=$(ps a | egrep -0 "\-\-login $char \-\-detachable-client=([0-9]+)" | egrep -o "[0-9]+" | sort | tail -n1)
}

if [[ -z $CHAR ]]; then
echo "Usage: gemstone.sh {{character_name}}"
exit
fi

if [[ -z $DISPLAY ]]; then
echo "Detected empty DISPLAY setting, defaulting to :0"
fi

echo "Attempting to login as $CHAR..."

if ps aux | \grep [l]ich | \grep -i $CHAR; then
lookup_char_port $CHAR
echo "Detecting existing connection on port $port"
else
if ps a | \grep [d]etachable-client; then
max_port=$(ps a | grep -Eo "\-\-detachable-client=([0-9]+)" | egrep -o "[0-9]+" | sort | tail -n1)
port=$(expr $max_port + 1)
fi
echo "Detecting existing clients but no connection for this character. Using Port[$port]"
echo "ruby $LICH_BIN --login $CHAR --detachable-client=$port --without-frontend 2> /dev/null &"

ruby $LICH_BIN --login $CHAR --detachable-client=$port --without-frontend 2> /dev/null &
sleep 4
fi

for i in {1..10}; do
echo "Attempting to connect to lich process... "
echo "ruby $PROFANITY_BIN --port=$port --char=$CHAR"
if ruby $PROFANITY_BIN --port=$port --char=$CHAR; then
echo "Done"
break
else
echo "Failed to establish connection, trying again in 3 seconds..."
sleep 3
fi
done
```
42 changes: 21 additions & 21 deletions ext/string.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
class String
def alnum?
!!match(/^[[:alnum:]]+$/)
end
def alnum?
!!match(/^[[:alnum:]]+$/)
end

def digits?
!!match(/^[[:digit:]]+$/)
end
!!match(/^[[:digit:]]+$/)
end

def punct?
!!match(/^[[:punct:]]+$/)
end
!!match(/^[[:punct:]]+$/)
end

def space?
!!match(/^[[:space:]]+$/)
!!match(/^[[:space:]]+$/)
end

def &(other)
shortest, longest = [self, other].sort { |a, b| a.size - b.size }
shortest, longest = [self, other].sort { |a, b| a.size - b.size }

shortest.each_char.to_a
.zip(longest.each_char.to_a)
.take_while { |a, b| a == b }
.transpose
.first
.join("")
end
end
shortest.each_char.to_a
.zip(longest.each_char.to_a)
.take_while { |a, b| a == b }
.transpose
.first
.join("")
end
end
24 changes: 13 additions & 11 deletions hilite/hilite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ module Hilite
def self.load(file:, flush: true)
Hilite.fetch(file: file, flush: flush) do |xml|
store.clear() if flush

xml.elements
.select do |ele| ele.name.eql?("highlight") end
.each do |highlight| Hilite.parse(highlight: highlight, parent: file) end
.select do |ele| ele.name.eql?("highlight") end
.each do |highlight| Hilite.parse(highlight: highlight, parent: file) end

return xml
end
end
Expand All @@ -26,22 +26,24 @@ def self.parse(highlight:, parent:)
def self.inherit(file:, parent:)
Profanity.log("[Settings] inheriting #{file} from #{parent}") if Opts.debug
Hilite.load(
file: File.join(File.dirname(parent), file),
flush: false)
file: File.join(File.dirname(parent), file),
flush: false
)
end

def self.add_highlight(highlight)
begin
pattern = %r{#{highlight.text.strip}}
Hilite.put(pattern, [
highlight.attributes["fg"],
highlight.attributes["bg"],
highlight.attributes["ul"]])
Hilite.put(pattern, [
highlight.attributes["fg"],
highlight.attributes["bg"],
highlight.attributes["ul"]
])
rescue => exception
# todo: write useful error/backtrace to UI
Profanity.log(highlight.text)
Profanity.log(exception.message)
Profanity.log(exception.backtrace)
end
end
end
end
2 changes: 1 addition & 1 deletion layout/layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
module Layout
extend KVStore
extend Loader
end
end
Loading