From 83c7fcac205e6e8885b8d94751fb8198ca63e29b Mon Sep 17 00:00:00 2001 From: cavesomething Date: Mon, 7 Jun 2010 23:47:26 +0000 Subject: [PATCH] Add a sage to scorn castle who will record the rank and title of the players who pass by. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@13373 282e977c-c81d-0410-88c4-b93c2d0d6712 --- python/maps/scorn/castle_write.py | 40 +++++++++++++++++++++++++++++++ scorn/misc/castle | 27 ++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 python/maps/scorn/castle_write.py diff --git a/python/maps/scorn/castle_write.py b/python/maps/scorn/castle_write.py new file mode 100644 index 000000000..7b5359e83 --- /dev/null +++ b/python/maps/scorn/castle_write.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2010 The Crossfire Development Team +# +# 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. +# + +import Crossfire +import CFDataFile + +player = Crossfire.WhoIsActivator() + +nobledata = CFDataFile.CFData('scorn_nobility', ['rank', 'title']) +currentstep = player.QuestGetState("scorn/Aristocracy") +currentrecord = { '#' : player.Name, 'rank' : currentstep, 'title' : player.Title } +lastrecord = nobledata.get_record(player.Name) +Crossfire.Log(Crossfire.LogDebug, "castle_write: previous record %s, new record %s." % (lastrecord, currentrecord)) +if lastrecord == 0: + lastrecord = { '#' : player.Name, 'rank' : -10, 'title' : 'The Default' } +if currentrecord['rank'] > 0 and currentrecord['rank'] == int(lastrecord['rank']) and currentrecord['title'] == lastrecord['title']: + Crossfire.Log(Crossfire.LogDebug, "castle_write, no update needed for player %s." % player.Name) +else: + Crossfire.Log(Crossfire.LogDebug, "castle_write, updating player %s, old state %s, new state %d" %(player.Name, lastrecord['rank'], currentstep)) + nobledata.put_record(currentrecord) + player.Message("The castle sage scribbles as you walk past") + + + diff --git a/scorn/misc/castle b/scorn/misc/castle index a82f02584..bc2bf2604 100644 --- a/scorn/misc/castle +++ b/scorn/misc/castle @@ -8,7 +8,7 @@ enter_x 11 enter_y 20 msg Created: 1997-04-27 -Modified: 2010-05-04 Cavesomething +Modified: 2010-06-07 Cavesomething endmsg maplore @quest Lursendis @@ -1691,6 +1691,15 @@ title Python slaying python/quests/QuestTriggerConnect.py end end +arch check_floor +hp 1 +x 11 +y 15 +arch event_trigger +title Python +slaying python/maps/scorn/castle_write.py +end +end arch cobblestones2 x 11 y 16 @@ -1937,6 +1946,15 @@ title Python slaying python/quests/QuestTriggerConnect.py end end +arch check_floor +hp 1 +x 12 +y 15 +arch event_trigger +title Python +slaying python/maps/scorn/castle_write.py +end +end arch cobblestones2 x 12 y 16 @@ -2107,6 +2125,13 @@ arch cobblestones2 x 13 y 14 end +arch sage +name castle scribe +x 13 +y 14 +type 0 +stand_still 1 +end arch magic_mouth msg The guards bow to the Noble of Scorn