Crossfire Server, Trunk
death_punisher.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
# death_punisher.py - Punish players for killing some NPCs
3
#
4
# Copyright (C) 2010 Nicolas Weege
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
#
20
#
21
# This script punishes players killing a NPC by making all other
22
# non aggressive monsters in the map aggressive.
23
#
24
# It should be called from a "death" event.
25
26
import
Crossfire
27
28
def
handle_death
():
29
map = Crossfire.WhoAmI().Map
30
31
found =
None
32
33
for
h
in
range(0, map.Height):
34
for
w
in
range(0, map.Width):
35
top = map.ObjectAt(w, h)
36
while
top !=
None
:
37
if
top.Monster == 1
and
top.Unaggressive == 1:
38
found = top
39
found.Unaggressive = 0
40
break
41
top = top.Above
42
43
if
found !=
None
:
44
found.Say(
"You are going to pay!"
)
45
46
handle_death
()
death_punisher.handle_death
def handle_death()
Definition:
death_punisher.py:28
crossfire-crossfire-maps
python
items
death_punisher.py
Generated by
1.8.17