File: seen.py

package info (click to toggle)
crossfire-maps 1.75.0%2Bdfsg1-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 275,656 kB
  • sloc: python: 7,711; sql: 92; sh: 73; makefile: 7
file content (111 lines) | stat: -rw-r--r-- 3,813 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Script for seen event
#
# Copyright (C) 2002 Joris Bontje
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# The author can be reached via e-mail at jbontje@suespammers.org
#
#Updated to use new path functions in CFPython, and broken into tiny bits by -Todd Mitchell
#
# seen            - tells player information from logger

import Crossfire
import string
import CFLog

activator=Crossfire.WhoIsActivator()
activatorname=activator.Name
whoami=Crossfire.WhoAmI()
isDM=activator.DungeonMaster
x=activator.X
y=activator.Y

log = CFLog.CFLog()
text = Crossfire.WhatIsMessage().split()

if text[0] == 'seen':
    if len(text)==2:
        record = log.info(text[1])
        if record:
            if isDM:
                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'])
            else:
                message = "I have seen '%s' %d times.\nI saw them last at %s." % (text[1], int(record['Login_Count']), record['Last_Login_Date'])
        else:
            message = "I have never seen '%s'." % text[1]
    else:
        message = 'Usage "seen <player>"'

elif text[0] == 'help' or text[0] == 'yes':
    if isDM:
        message = "How can I help you? Here is a quick list of commands:\nseen, info, muzzlecount, lastmuzzle, kickcount, lastkick"
    else:
        message = "I have seen just about everybody - go ahead and ask me."

elif text[0] == 'muzzlecount' and isDM:
    if len(text)==2:
        record = log.info(text[1])
        if record:
            message = "%s has been muzzled %d times" % (text[1],int(record['Muzzle_Count']))
        else:
            message = "I have no knowledge of '%s'." % text[1]
    else:
        message = 'Usage "muzzlecount <player>"'

elif text[0] == 'lastmuzzle' and isDM:
    if len(text)==2:
        record = log.info(text[1])
        if record:
            message = "%s was last muzzled on %s" % (text[1],record['Last_Muzzle_Date'])
        else:
            message = "I have no knowledge of '%s'." % text[1]
    else:
        message = 'Usage "muzzlestatus <player>"'

elif text[0] == 'kickcount' and isDM:
    if len(text)==2:
        record = log.info(text[1])
        if record:
            message = "%s has been kicked %d times" % (text[1],int(record['Kick_Count']))
        else:
            message = "I have no knowledge of '%s'." % text[1]
    else:
        message = 'Usage "kickcount <player>"'

elif text[0] == 'lastkick' and isDM:
    if len(text)==2:
        record = log.info(text[1])
        if record:
            message = "%s was last kicked out on %s" % (text[1],record['Last_Kick_Date'])
        else:
            message = "I have no knowledge of '%s'." % text[1]
    else:
        message = 'Usage "lastkick <player>"'

elif text[0] == 'info' and isDM:
    if len(text)==2:
        record = log.info(text[1])
        if record:
            message = "%s" % (record)
        else:
            message = "I have no knowledge of '%s'." % text[1]
    else:
        message = 'Usage "info <player>"'
else:
    message = "Do you need help?"

whoami.Say(message)
Crossfire.SetReturnValue(1)