Mercurial > traipse_dev
view plugins/xxgvm.py @ 188:043ce9a25b20 beta
Traipse Beta 'OpenRPG' {100123-02}
Traipse is a distribution of OpenRPG that is designed to be easy to
setup and go. Traipse also makes it easy for developers to work on code
without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy'
and adds fixes to the code. 'Ornery-Orc's main goal is to offer more
advanced features and enhance the productivity of the user.
Update Summary (Beta)
New Features:
Added Bookmarks
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from
FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
New TrueDebug Class in orpg_log (See documentation for usage)
Portable Mercurial
Tip of the Day added, from Core and community
New Reference Syntax added for custom PC sheets
New Child Reference for gametree
New Parent Reference for gametree
New Gametree Recursion method, mapping, context sensitivity, and
effeciency..
New Features node with bonus nodes and Node Referencing help added
Dieroller structure from Core
New DieRoller portability for odd Dice
Added 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)]
New 'Mythos' System die roller added
Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)].
Included for Mythos roller also
New Warhammer FRPG Die Roller (Special thanks to Puu-san for the
support)
New EZ_Tree Reference system. Push a button, Traipse the tree, get a
reference (Beta!)
Fixes:
Fix to Text based Server
Fix to Remote Admin Commands
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Fix to Map from gametree not showing to all clients
Fix to gametree about menus
Fix to Password Manager check on startup
Fix to PC Sheets from tool nodes. They now use the tabber_panel
Fix to Whiteboard ID to prevent random line or text deleting.
Fixes to Server, Remote Server, and Server GUI
Fix to Update Manager; cleaner clode for saved repositories
Fixes made to Settings Panel and now reactive settings when Ok is
pressed
Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of
a Splice
Fix to Use panel of Forms and Tabbers. Now longer enters design mode
Fix made Image Fetching. New fetching image and new failed image
Modified ID's to prevent non updated clients from ruining the fix.
default_manifest.xml renamed to default_upmana.xml
author | sirebral |
---|---|
date | Sat, 23 Jan 2010 03:47:58 -0600 |
parents | c54768cffbd4 |
children |
line wrap: on
line source
import os import orpg.pluginhandler import string class Plugin(orpg.pluginhandler.PluginHandler): # Initialization subroutine. # # !self : instance of self # !openrpg : instance of the the base openrpg control def __init__(self, plugindb, parent): orpg.pluginhandler.PluginHandler.__init__(self, plugindb, parent) # The Following code should be edited to contain the proper information self.name = 'Game Variable Manager' self.author = 'mDuo13' self.help = 'This plugin is used to manage variables in your idle status. That way,\n' self.help += 'you can keep as many numbers as you want in your idle status, and you can update \n' self.help += 'them without having to go to the Settings menu.\n' self.help += '\n' self.help += 'First you must create some variables. You can do that by typing \n' self.help += '"/gvm set *var*=*value*" where *var* is the variables name (no $ symbol), and\n' self.help += '*value* is the variables starting value. The variables name can be any word,\n' self.help += 'but dont put spaces between the variables name and value.\n' self.help += '\n' self.help += 'You can look up the value of a variable by typing "/gvm get *var*"\n' self.help += '\n' self.help += 'To set your status, type "/gvm status *message*" where *message* is the message \n' self.help += 'you want your status to have. To include variables, simply the variables name, \n' self.help += 'STARTING WITH A $ SYMBOL. For example, you could create a status with \n' self.help += '"/gvm status HP:$hp MP:$mp AC:$ac" which, if $hp was 20, $mp was 10, and $ac\n' self.help += 'was 5, would make your status "HP:20 MP:10 AC:5".\n' self.help += '\n' self.help += 'If you later change the values of any of the variables in your status, they will \n' self.help += 'be automatically updated; to update a value, just type\n' self.help += '"/gvm set *var*=*variable*" the same way you used it to create the variable.\n' self.help += '\n' self.help += 'You can list the current variables with the "/gvm list" command. You can also\n' self.help += 'now roll dice with curly brackets, and have filters apply to them, like this:\n' self.help += '"{4d6.takeHighest(3)+$bonus}". Any other filters you have (i.e. the Alias \n' self.help += 'Library) will also apply to curly bracket rolls automatically.\n' self.help += '\n' self.help += 'Note that the GVM plugin conflicts with the NowPlaying and GSC plugins, so if\n' self.help += 'you have both plugin enabled at the same time, they may not work quite right.\n' self.help += '\n' self.help += 'You can now save a group of variables with "/gvm save *name*". You can also load\n' self.help += 'a group of previously saved variables with "/gvm open *name*"\n' #You can set variables below here. Always set them to a blank value in this section. Use plugin_enabled #to set their proper values. self.vars = {} self.status_scrip="" self.status_on=0 def plugin_enabled(self): #You can add new /commands like # self.plugin_addcommand(cmd, function, helptext) self.plugin_addcommand('/gvm', self.on_gvm, '[set name=value | calc name=value | get name | status | list | save set_name | open set_name] - This plugin is used to manage variables that you can use in your status bar or in dice rolls') self.plugin_addcommand('/gvmq', self.on_gvmq, '[set name=value | calc name=value | get name | status | list | save set_name | open set_name] - This plugin is used to manage variables that you can use in your status bar or in dice rolls', False) self.plugin_addcommand('/=', self.on_comment, '', False) def plugin_disabled(self): #Here you need to remove any commands you added, and anything else you want to happen when you disable the plugin #such as closing windows created by the plugin self.plugin_removecmd('/gvm') self.plugin_removecmd('/gvmq') self.plugin_removecmd('/=') def on_comment(self, cmdargs): pass def on_gvm(self, cmdargs): for key in self.vars.keys(): cmdargs = cmdargs.replace("$" + key, self.vars[key]) args = cmdargs.split(None,-1) if len(args) == 0: args = [' '] if args[0]=="set": cmd = cmdargs[len(args[0])+1:].strip().split("=") self.vars[cmd[0]] = cmd[1] self.chat.InfoPost("GVM: Set variable $" + cmd[0] + " to be: " + cmd[1]) if self.status_on: self.gvm_status(self.status_scrip) elif args[0]=="calc": cmd = cmdargs[len(args[0])+1:].strip().split("=") val = str(eval(cmd[1])) self.vars[cmd[0]] = val self.chat.InfoPost("GVM: Set variable $" + cmd[0] + " to be: " + val) if self.status_on: self.gvm_status(self.status_scrip) elif args[0]=="get": if args[1] in self.vars.keys(): self.chat.InfoPost("GVM: Variable $" + args[1] + " is: " + self.vars[args[1]]) else: self.chat.InfoPost("GVM: Variable $" + args[1] + " does not exist!") elif args[0]=="status": self.status_scrip = cmdargs[len(args[0])+1:] status_on = 1 self.gvm_status(self.status_scrip) elif args[0]=="save": fname = cmdargs[len(args[0])+1:] self.plugindb.SetDict("xxgvm", fname, self.vars) self.chat.InfoPost("GVM: Successfully saved variable set " + fname + "!") elif args[0]=="open": fname = cmdargs[len(args[0])+1:] self.vars = self.plugindb.GetDict("xxgvm", fname, {}) self.chat.InfoPost("GVM: Loaded the file " + fname + ". Variables contained are:<br />" + self.make_list()) elif args[0] == "list": self.chat.Post(self.make_list()) else: self.chat.InfoPost("GVM: SYNTAX ERROR. <br />USEAGE: /gvm [set name=value | get name | status | list | save set_name | open set_name]") def on_gvmq(self, cmdargs): for key in self.vars.keys(): cmdargs = cmdargs.replace("$" + key, self.vars[key]) args = cmdargs.split(None,-1) if len(args) == 0: args = [' '] if args[0]=="set": cmd = cmdargs[len(args[0])+1:].strip().split("=") self.vars[cmd[0]] = cmd[1] if self.status_on: self.gvm_status(self.status_scrip) elif args[0]=="calc": cmd = cmdargs[len(args[0])+1:].strip().split("=") self.vars[cmd[0]] = str(eval(cmd[1])) if self.status_on: self.gvm_status(self.status_scrip) elif args[0]=="get": if args[1] in self.vars.keys(): self.chat.InfoPost("GVM: Variable $" + args[1] + " is: " + self.vars[args[1]]) else: self.chat.InfoPost("GVM: Variable $" + args[1] + " does not exist!") elif args[0]=="status": self.status_scrip = cmdargs[len(args[0])+1:] status_on = 1 self.gvm_status(self.status_scrip) elif args[0]=="save": fname = cmdargs[len(args[0])+1:] self.plugindb.SetDict("xxgvm", fname, self.vars) elif args[0]=="open": fname = cmdargs[len(args[0])+1:] self.vars = self.plugindb.GetDict("xxgvm", fname, {}) elif args[0] == "list": self.chat.Post(self.make_list()) else: self.chat.InfoPost("GVM: SYNTAX ERROR. <br />USEAGE: /gvmq [set name=value | get name | status | list | save set_name | open set_name]") def pre_parse(self, text): try: for key in self.vars.keys(): text = text.replace("$" + key, self.vars[key]) except Exception, e: print e print key self.vars[key] return text def gvm_status(self, cmd): keychain = self.vars.keys() keychain.sort() newchain = [] for key in keychain: newchain = [key] + newchain for key in keychain: cmd = cmd.replace("$" + key, self.vars[key]) self.settings.set_setting("IdleStatusAlias", cmd) self.session.set_text_status(cmd) def make_list(self): keychain = self.vars.keys() lister = "" for key in keychain: lister += "$" + key + "\t::\t" + self.vars[key] + "<br />" if len(keychain)==0: return "No variables!" else: return lister