Crossfire Server, Trunk
seen.py
Go to the documentation of this file.
1 # Script for seen event
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 #Updated to use new path functions in CFPython, and broken into tiny bits by -Todd Mitchell
22 #
23 # seen - tells player information from logger
24 
25 import Crossfire
26 import string
27 import CFLog
28 
29 activator=Crossfire.WhoIsActivator()
30 activatorname=activator.Name
31 whoami=Crossfire.WhoAmI()
32 isDM=activator.DungeonMaster
33 x=activator.X
34 y=activator.Y
35 
36 log = CFLog.CFLog()
37 text = Crossfire.WhatIsMessage().split()
38 
39 if text[0] == 'seen':
40  if len(text)==2:
41  record = log.info(text[1])
42  if record:
43  if isDM:
44  message = "I have seen '%s' %d times.\nI saw them last coming from\nIP: %s\non %s." % (text[1], int(record['Login_Count']), record['IP'], record['Last_Login_Date'])
45  else:
46  message = "I have seen '%s' %d times.\nI saw them last at %s." % (text[1], int(record['Login_Count']), record['Last_Login_Date'])
47  else:
48  message = "I have never seen '%s'." % text[1]
49  else:
50  message = 'Usage "seen <player>"'
51 
52 elif text[0] == 'help' or text[0] == 'yes':
53  if isDM:
54  message = "How can I help you? Here is a quick list of commands:\nseen, info, muzzlecount, lastmuzzle, kickcount, lastkick"
55  else:
56  message = "I have seen just about everybody - go ahead and ask me."
57 
58 elif text[0] == 'muzzlecount' and isDM:
59  if len(text)==2:
60  record = log.info(text[1])
61  if record:
62  message = "%s has been muzzled %d times" % (text[1],int(record['Muzzle_Count']))
63  else:
64  message = "I have no knowledge of '%s'." % text[1]
65  else:
66  message = 'Usage "muzzlecount <player>"'
67 
68 elif text[0] == 'lastmuzzle' and isDM:
69  if len(text)==2:
70  record = log.info(text[1])
71  if record:
72  message = "%s was last muzzled on %s" % (text[1],record['Last_Muzzle_Date'])
73  else:
74  message = "I have no knowledge of '%s'." % text[1]
75  else:
76  message = 'Usage "muzzlestatus <player>"'
77 
78 elif text[0] == 'kickcount' and isDM:
79  if len(text)==2:
80  record = log.info(text[1])
81  if record:
82  message = "%s has been kicked %d times" % (text[1],int(record['Kick_Count']))
83  else:
84  message = "I have no knowledge of '%s'." % text[1]
85  else:
86  message = 'Usage "kickcount <player>"'
87 
88 elif text[0] == 'lastkick' and isDM:
89  if len(text)==2:
90  record = log.info(text[1])
91  if record:
92  message = "%s was last kicked out on %s" % (text[1],record['Last_Kick_Date'])
93  else:
94  message = "I have no knowledge of '%s'." % text[1]
95  else:
96  message = 'Usage "lastkick <player>"'
97 
98 elif text[0] == 'info' and isDM:
99  if len(text)==2:
100  record = log.info(text[1])
101  if record:
102  message = "%s" % (record)
103  else:
104  message = "I have no knowledge of '%s'." % text[1]
105  else:
106  message = 'Usage "info <player>"'
107 else:
108  message = "Do you need help?"
109 
110 whoami.Say(message)
111 Crossfire.SetReturnValue(1)
CFLog.CFLog
Definition: CFLog.py:34
make_face_from_files.int
int
Definition: make_face_from_files.py:32
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2606