-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict traits from being changed after approval.
- Loading branch information
1 parent
010e478
commit 9a04455
Showing
5 changed files
with
90 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## Uninstalling Traits | ||
|
||
Ares plugins plug IN easily, but taking them out requires a bit of code fiddling. | ||
|
||
1. Open the [tinker](https://aresmush.com/tutorials/code/tinker.html#how-to-tinker) page (Admin -> Tinker) in the web portal with a coder character. | ||
|
||
2. Copy/paste the following to the tinker file, **right below `module AresMUSH`**. This will let us clear out the database fields. | ||
|
||
``` | ||
class Character | ||
attribute :traits | ||
end | ||
``` | ||
|
||
3. Add the following code to the `handle` method of the tinker file. | ||
|
||
``` | ||
begin | ||
Traits.uninstall_plugin | ||
Manage.uninstall_plugin("traits") | ||
client.emit_success "Plugin uninstalled." | ||
rescue Exception => e | ||
Global.logger.debug "Error loading plugin: #{e} backtrace=#{e.backtrace[0,10]}" | ||
client.emit_failure "Error uninstalling plugin: #{e}" | ||
end | ||
``` | ||
|
||
4. Click "Save" on the tinker page. | ||
|
||
5. Switch to a game client window and run the `tinker` command. | ||
|
||
6. Switch back to the web portal tinker page and click "Reset". | ||
|
||
7. Manually remove all plugin's files from your server (and GitHub fork, if applicable), including: | ||
* aresmush/plugins/traits | ||
* aresmush/game/config/traits.yml | ||
* Web portal files - See the /webportal folder in this repo for a specific list of files. | ||
|
||
8. Deploy the website. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module AresMUSH | ||
module Traits | ||
def self.can_edit_traits?(enactor, model) | ||
enactor.name == model.name || Traits.can_manage_traits?(enactor) | ||
end | ||
|
||
def self.can_manage_traits?(enactor) | ||
Chargen.can_approve?(enactor) | ||
end | ||
|
||
def self.check_traits_locked(enactor, model) | ||
return nil if Traits.can_manage_traits?(enactor) | ||
return Chargen.check_chargen_locked(model) | ||
end | ||
|
||
def self.uninstall_plugin | ||
Character.all.each do |c| | ||
c.update(traits: nil) | ||
end | ||
end | ||
|
||
end | ||
end |