ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/python/IPO/board.py
Revision: 1.1.1.1 (vendor branch)
Committed: Sun Feb 5 00:02:09 2006 UTC (18 years, 5 months ago) by root
Content type: text/x-python
Branch: UPSTREAM, MAIN
CVS Tags: post_fixaltar, last_stable, post_fixaltar2, rel-2_82, rel-2_81, rel-2_80, pre_coinconvert, UPSTREAM_2006_03_15, rel-3_0, rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_2, rel-2_0, rel-2_1, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, UPSTREAM_2006_02_01, rel-2_53, pre_material_cfarch_normalize_run, rel-2_32, pre_fixconverter, post_coinconvert, pre_fixaltar2, pre_map_rename, UPSTREAM_2006_02_22, rel-2_90, rel-2_92, rel-2_93, rel-2_78, post_fixconverter, pre_fixaltar, rel-2_61, rel-2_43, rel-2_42, rel-2_41, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
Initial Import

File Contents

# User Rev Content
1 root 1.1 # Script for say event of IPO message board
2     #
3     # Copyright (C) 2002 Joris Bontje
4     #
5     # This program is free software; you can redistribute it and/or modify
6     # it under the terms of the GNU General Public License as published by
7     # the Free Software Foundation; either version 2 of the License, or
8     # (at your option) any later version.
9     #
10     # This program is distributed in the hope that it will be useful,
11     # but WITHOUT ANY WARRANTY; without even the implied warranty of
12     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     # GNU General Public License for more details.
14     #
15     # You should have received a copy of the GNU General Public License
16     # along with this program; if not, write to the Free Software
17     # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18     #
19     # The author can be reached via e-mail at jbontje@suespammers.org
20     #
21     # help - gives information about usage
22     #
23     #Updated to use new path functions in CFPython -Todd Mitchell
24    
25     import Crossfire
26     import CFBoard
27     import string
28    
29     board = CFBoard.CFBoard()
30    
31     activator = Crossfire.WhoIsActivator()
32     activatorname = activator.Name
33     whoami = Crossfire.WhoAmI()
34    
35     boardname = Crossfire.ScriptParameters()
36     if boardname:
37    
38     text = string.split(Crossfire.WhatIsMessage(), ' ', 1)
39    
40     if text[0] == 'help' or text[0] == 'yes':
41     message='Help for %s\nList of commands:\n\n- list\n- write <message>\n- remove <id>\n'%boardname
42     activator.Write(message)
43    
44     elif text[0] == 'write':
45     if len(text) == 2:
46     board.write(boardname, activatorname, text[1])
47     activator.Write('Added to %s'%boardname)
48     else:
49     activator.Write('Usage "write <text>"')
50    
51     elif text[0] == 'list':
52     total = board.countmsg(boardname)
53     if total > 0:
54     activator.Write('Content of %s:'%boardname)
55     elements = board.list(boardname)
56     element = []
57     id = 1
58     for element in elements:
59     author, message = element
60     activator.Write('<%d> (%s) %s'%(id, author, message))
61     id = id+1
62     else:
63     activator.Write('%s is empty'%boardname)
64    
65     elif text[0] == 'remove':
66     if len(text) == 2:
67     index = int(text[1])
68     if board.getauthor(boardname, index) == activatorname or activator.DungeonMaster:
69     if board.delete(boardname, index):
70     activator.Write('Removed from %s'%boardname)
71     else:
72     activator.Write('Doesn\'t exist on %s'%boardname)
73     else:
74     activator.Write('Access denied')
75     else:
76     activator.Write('Usage "remove <id>"')
77    
78     else:
79     activator.Write('Do you need help?')
80    
81     else:
82     activator.Write('Board Error')