From c8f185bb3b9ab6fac9c25902b2b0d63bb67c9b06 Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sun, 25 Jul 2010 18:18:57 +0000 Subject: [PATCH] Let's ring some bells, it'll make it funnier for players to hear those :) git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@13515 282e977c-c81d-0410-88c4-b93c2d0d6712 --- python/events/clock/bell.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 python/events/clock/bell.py diff --git a/python/events/clock/bell.py b/python/events/clock/bell.py new file mode 100644 index 000000000..2c4fc3dc6 --- /dev/null +++ b/python/events/clock/bell.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# +# This script makes players aware of the time, tracking the current time +import Crossfire + +def ring_bell(): + players = Crossfire.GetPlayers() + for player in players: + if player.Map == None: + continue + if player.Map.Region == None: + continue + if player.Map.Region.Name == 'scorn': + player.Message("You hear the bells of the various temples of Scorn.") + elif player.Map.Region.Name == 'darcap': + player.Message("You hear the bell of St Andreas.") + elif player.Map.Region.Name == 'navar': + player.Message("You hear the bell of all the temples of Navar.") + +dict = Crossfire.GetPrivateDictionary() +hour = Crossfire.GetTime()[3] + +if not 'init' in dict.keys(): + dict['init'] = 1 + dict['last'] = hour + Crossfire.Log(Crossfire.LogDebug, "Bell init") +else: + last = dict['last'] + if (hour != last): + dict['last'] = hour + Crossfire.Log(Crossfire.LogDebug, "Bell ringing") + ring_bell()