comparison plugins/xxsmiley.py @ 18:97265586402b ornery-orc

Traipse 'OpenRPG' {090827-00} 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: Update Manager is now in version 0.8. While not every button works, users can now browse the different revisions and their different changesets. The code has been refined some with feature from Core added to it. A Crash report is now created if the users software crashes. Update Manager has been moved to the Traipse Suite menu item, and a Debug Console as been added as well.
author sirebral
date Thu, 27 Aug 2009 01:04:43 -0500
parents 4385a7d0efd1
children
comparison
equal deleted inserted replaced
17:265b987cce4f 18:97265586402b
1 import os 1 import os
2 import orpg.pluginhandler 2 import orpg.pluginhandler
3 import orpg.dirpath 3 from orpg.dirpath import dir_struct
4 4
5 class Plugin(orpg.pluginhandler.PluginHandler): 5 class Plugin(orpg.pluginhandler.PluginHandler):
6 # Initialization subroutine. 6 # Initialization subroutine.
7 # 7 #
8 # !self : instance of self 8 # !self : instance of self
23 #This is where you set any variables that need to be initalized when your plugin starts 23 #This is where you set any variables that need to be initalized when your plugin starts
24 24
25 self.plugin_addcommand('/smiley', self.on_smiley, '- [add|remove|help] The Smiley command') 25 self.plugin_addcommand('/smiley', self.on_smiley, '- [add|remove|help] The Smiley command')
26 26
27 smlist = { 27 smlist = {
28 '>:-(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley7.gif" /> ', 28 '>:-(' : ' <img src="' + dir_struct['plugins'] + 'images/smiley7.gif" /> ',
29 ':/' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley5.gif" /> ', 29 ':/' : ' <img src="' + dir_struct['plugins'] + 'images/smiley5.gif" /> ',
30 ':|' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley6.gif" /> ', 30 ':|' : ' <img src="' + dir_struct['plugins'] + 'images/smiley6.gif" /> ',
31 ':(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley9.gif" /> ', 31 ':(' : ' <img src="' + dir_struct['plugins'] + 'images/smiley9.gif" /> ',
32 ' />:(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley7.gif" /> ', 32 ' />:(' : ' <img src="' + dir_struct['plugins'] + 'images/smiley7.gif" /> ',
33 ' />=(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley7.gif" /> ', 33 ' />=(' : ' <img src="' + dir_struct['plugins'] + 'images/smiley7.gif" /> ',
34 '=)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley0.gif" /> ', 34 '=)' : ' <img src="' + dir_struct['plugins'] + 'images/smiley0.gif" /> ',
35 '=D' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley1.gif" /> ', 35 '=D' : ' <img src="' + dir_struct['plugins'] + 'images/smiley1.gif" /> ',
36 ';)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley3.gif" /> ', 36 ';)' : ' <img src="' + dir_struct['plugins'] + 'images/smiley3.gif" /> ',
37 '=/' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley5.gif" /> ', 37 '=/' : ' <img src="' + dir_struct['plugins'] + 'images/smiley5.gif" /> ',
38 '=|' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley6.gif" /> ', 38 '=|' : ' <img src="' + dir_struct['plugins'] + 'images/smiley6.gif" /> ',
39 '=(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley9.gif" /> ', 39 '=(' : ' <img src="' + dir_struct['plugins'] + 'images/smiley9.gif" /> ',
40 ':)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley0.gif" /> ', 40 ':)' : ' <img src="' + dir_struct['plugins'] + 'images/smiley0.gif" /> ',
41 ':D' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley1.gif" /> ', 41 ':D' : ' <img src="' + dir_struct['plugins'] + 'images/smiley1.gif" /> ',
42 'B)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley2.gif" /> ', 42 'B)' : ' <img src="' + dir_struct['plugins'] + 'images/smiley2.gif" /> ',
43 ':p' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley4.gif" /> ', 43 ':p' : ' <img src="' + dir_struct['plugins'] + 'images/smiley4.gif" /> ',
44 '=\\' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley5.gif" /> ', 44 '=\\' : ' <img src="' + dir_struct['plugins'] + 'images/smiley5.gif" /> ',
45 ':P' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley4.gif" /> ', 45 ':P' : ' <img src="' + dir_struct['plugins'] + 'images/smiley4.gif" /> ',
46 '=P' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley4.gif" /> ', 46 '=P' : ' <img src="' + dir_struct['plugins'] + 'images/smiley4.gif" /> ',
47 '^_^' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley12.gif" /> ', 47 '^_^' : ' <img src="' + dir_struct['plugins'] + 'images/smiley12.gif" /> ',
48 '^-^' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley12.gif" /> ', 48 '^-^' : ' <img src="' + dir_struct['plugins'] + 'images/smiley12.gif" /> ',
49 '^.^' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley12.gif" /> ', 49 '^.^' : ' <img src="' + dir_struct['plugins'] + 'images/smiley12.gif" /> ',
50 'n_n' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley12.gif" /> ', 50 'n_n' : ' <img src="' + dir_struct['plugins'] + 'images/smiley12.gif" /> ',
51 'n.n' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley12.gif" /> ', 51 'n.n' : ' <img src="' + dir_struct['plugins'] + 'images/smiley12.gif" /> ',
52 'n,n' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley12.gif" /> ', 52 'n,n' : ' <img src="' + dir_struct['plugins'] + 'images/smiley12.gif" /> ',
53 'I-)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley13.gif" /> ', 53 'I-)' : ' <img src="' + dir_struct['plugins'] + 'images/smiley13.gif" /> ',
54 'n.n;' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley14.gif" /> ', 54 'n.n;' : ' <img src="' + dir_struct['plugins'] + 'images/smiley14.gif" /> ',
55 'n.n;;' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley14.gif" /> ', 55 'n.n;;' : ' <img src="' + dir_struct['plugins'] + 'images/smiley14.gif" /> ',
56 'n_n;' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley14.gif" /> ', 56 'n_n;' : ' <img src="' + dir_struct['plugins'] + 'images/smiley14.gif" /> ',
57 ':-)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley0.gif" /> ', 57 ':-)' : ' <img src="' + dir_struct['plugins'] + 'images/smiley0.gif" /> ',
58 ':-D' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley1.gif" /> ', 58 ':-D' : ' <img src="' + dir_struct['plugins'] + 'images/smiley1.gif" /> ',
59 ':-P' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley2.gif" /> ', 59 ':-P' : ' <img src="' + dir_struct['plugins'] + 'images/smiley2.gif" /> ',
60 ':-p' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley4.gif" /> ', 60 ':-p' : ' <img src="' + dir_struct['plugins'] + 'images/smiley4.gif" /> ',
61 ':-/' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley5.gif" /> ', 61 ':-/' : ' <img src="' + dir_struct['plugins'] + 'images/smiley5.gif" /> ',
62 ':-|' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley6.gif" /> ', 62 ':-|' : ' <img src="' + dir_struct['plugins'] + 'images/smiley6.gif" /> ',
63 ':-(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley9.gif" /> ', 63 ':-(' : ' <img src="' + dir_struct['plugins'] + 'images/smiley9.gif" /> ',
64 ':-\\' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/smiley5.gif" /> ', 64 ':-\\' : ' <img src="' + dir_struct['plugins'] + 'images/smiley5.gif" /> ',
65 '-)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_smile.gif" /> ', 65 '-)' : ' <img src="' + dir_struct['plugins'] + 'images/icon_smile.gif" /> ',
66 ';-)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_wink.gif" /> ', 66 ';-)' : ' <img src="' + dir_struct['plugins'] + 'images/icon_wink.gif" /> ',
67 ':->' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_smile2.gif" /> ', 67 ':->' : ' <img src="' + dir_struct['plugins'] + 'images/icon_smile2.gif" /> ',
68 ':-D' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_biggrin.gif" /> ', 68 ':-D' : ' <img src="' + dir_struct['plugins'] + 'images/icon_biggrin.gif" /> ',
69 ':-P' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_razz.gif" /> ', 69 ':-P' : ' <img src="' + dir_struct['plugins'] + 'images/icon_razz.gif" /> ',
70 ':-o' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_surprised.gif" /> ', 70 ':-o' : ' <img src="' + dir_struct['plugins'] + 'images/icon_surprised.gif" /> ',
71 ':mrgreen:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_mrgreen.gif" /> ', 71 ':mrgreen:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_mrgreen.gif" /> ',
72 ':lol:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_lol.gif" /> ', 72 ':lol:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_lol.gif" /> ',
73 ':-(' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_sad.gif" /> ', 73 ':-(' : ' <img src="' + dir_struct['plugins'] + 'images/icon_sad.gif" /> ',
74 ':-|' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_neutral.gif" /> ', 74 ':-|' : ' <img src="' + dir_struct['plugins'] + 'images/icon_neutral.gif" /> ',
75 ':-?' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_confused.gif" /> ', 75 ':-?' : ' <img src="' + dir_struct['plugins'] + 'images/icon_confused.gif" /> ',
76 ':-x' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_mad.gif" /> ', 76 ':-x' : ' <img src="' + dir_struct['plugins'] + 'images/icon_mad.gif" /> ',
77 ':shock:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_eek.gif" /> ', 77 ':shock:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_eek.gif" /> ',
78 ':cry:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_cry.gif" /> ', 78 ':cry:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_cry.gif" /> ',
79 ';_;' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_cry.gif" /> ', 79 ';_;' : ' <img src="' + dir_struct['plugins'] + 'images/icon_cry.gif" /> ',
80 ':oops:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_redface.gif" /> ', 80 ':oops:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_redface.gif" /> ',
81 '8-)' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_cool.gif" /> ', 81 '8-)' : ' <img src="' + dir_struct['plugins'] + 'images/icon_cool.gif" /> ',
82 ':evil:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_evil.gif" /> ', 82 ':evil:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_evil.gif" /> ',
83 ':twisted:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_twisted.gif" /> ', 83 ':twisted:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_twisted.gif" /> ',
84 ':roll:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_rolleyes.gif" /> ', 84 ':roll:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_rolleyes.gif" /> ',
85 ':!:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_exclaim.gif" /> ', 85 ':!:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_exclaim.gif" /> ',
86 ':?:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_question.gif" /> ', 86 ':?:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_question.gif" /> ',
87 ':idea:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_idea.gif" /> ', 87 ':idea:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_idea.gif" /> ',
88 ':arrow:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_arrow.gif" /> ', 88 ':arrow:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_arrow.gif" /> ',
89 ':ubergeek:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_e_ugeek.gif" /> ', 89 ':ubergeek:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_e_ugeek.gif" /> ',
90 ':geek:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/icon_e_geek.gif" /> ', 90 ':geek:' : ' <img src="' + dir_struct['plugins'] + 'images/icon_e_geek.gif" /> ',
91 ':fairy:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/fairy.gif" /> ', 91 ':fairy:' : ' <img src="' + dir_struct['plugins'] + 'images/fairy.gif" /> ',
92 ':hood:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/hood.gif" /> ', 92 ':hood:' : ' <img src="' + dir_struct['plugins'] + 'images/hood.gif" /> ',
93 ':gnome:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/gnome.gif" /> ', 93 ':gnome:' : ' <img src="' + dir_struct['plugins'] + 'images/gnome.gif" /> ',
94 ':link:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/link.gif" /> ', 94 ':link:' : ' <img src="' + dir_struct['plugins'] + 'images/link.gif" /> ',
95 ':mummy:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/mummy.gif" /> ', 95 ':mummy:' : ' <img src="' + dir_struct['plugins'] + 'images/mummy.gif" /> ',
96 ':ogre:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/ogre.gif" /> ', 96 ':ogre:' : ' <img src="' + dir_struct['plugins'] + 'images/ogre.gif" /> ',
97 ':medusa:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/medusa.gif" /> ', 97 ':medusa:' : ' <img src="' + dir_struct['plugins'] + 'images/medusa.gif" /> ',
98 ':mimic:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/mimic.gif" /> ', 98 ':mimic:' : ' <img src="' + dir_struct['plugins'] + 'images/mimic.gif" /> ',
99 ':skull:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/skull.gif" /> ', 99 ':skull:' : ' <img src="' + dir_struct['plugins'] + 'images/skull.gif" /> ',
100 ':zombie:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/zombie.gif" /> ', 100 ':zombie:' : ' <img src="' + dir_struct['plugins'] + 'images/zombie.gif" /> ',
101 ':chocobo:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/chocobo.gif" /> ', 101 ':chocobo:' : ' <img src="' + dir_struct['plugins'] + 'images/chocobo.gif" /> ',
102 ':darkside:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/darkside.gif" /> ', 102 ':darkside:' : ' <img src="' + dir_struct['plugins'] + 'images/darkside.gif" /> ',
103 ':flyingspaghetti:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/flyingspaghetti.gif" /> ', 103 ':flyingspaghetti:' : ' <img src="' + dir_struct['plugins'] + 'images/flyingspaghetti.gif" /> ',
104 ':rupee:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/rupee.gif" /> ', 104 ':rupee:' : ' <img src="' + dir_struct['plugins'] + 'images/rupee.gif" /> ',
105 ':ros:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/ros.gif" /> ', 105 ':ros:' : ' <img src="' + dir_struct['plugins'] + 'images/ros.gif" /> ',
106 ':skeleton:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/skeleton.gif" /> ', 106 ':skeleton:' : ' <img src="' + dir_struct['plugins'] + 'images/skeleton.gif" /> ',
107 ':samurai:' : ' <img src="' + orpg.dirpath.dir_struct['plugins'] + 'images/samurai.gif" /> '} 107 ':samurai:' : ' <img src="' + dir_struct['plugins'] + 'images/samurai.gif" /> '}
108 108
109 self.smileylist = self.plugindb.GetDict("xxsmiley", "smileylist", smlist) 109 self.smileylist = self.plugindb.GetDict("xxsmiley", "smileylist", smlist)
110 110
111 def plugin_disabled(self): 111 def plugin_disabled(self):
112 #Here you need to remove any commands you added, and anything else you want to happen when you disable the plugin 112 #Here you need to remove any commands you added, and anything else you want to happen when you disable the plugin
130 130
131 if args[0] == 'add' and len(args) == 3: 131 if args[0] == 'add' and len(args) == 3:
132 if args[2].find('http') > -1: 132 if args[2].find('http') > -1:
133 self.smileylist[args[1]] = ' <img src="' + args[2] + '" alt="' + args[1] + '" />' 133 self.smileylist[args[1]] = ' <img src="' + args[2] + '" alt="' + args[1] + '" />'
134 else: 134 else:
135 self.smileylist[args[1]] = ' <img src="' + orpg.dirpath.dir_struct["plugins"] + 'images/' + args[2] + '" />' + "\n" 135 self.smileylist[args[1]] = ' <img src="' + dir_struct["plugins"] + 'images/' + args[2] + '" />' + "\n"
136 136
137 self.chat.InfoPost('Added ' + args[1] + '&nbsp&nbsp&nbsp : &nbsp&nbsp&nbsp' + self.smileylist[args[1]]) 137 self.chat.InfoPost('Added ' + args[1] + '&nbsp&nbsp&nbsp : &nbsp&nbsp&nbsp' + self.smileylist[args[1]])
138 138
139 elif args[0] == 'remove' and len(args) == 2: 139 elif args[0] == 'remove' and len(args) == 2:
140 if self.smileylist.has_key(args[1]): 140 if self.smileylist.has_key(args[1]):