From fdbcb1b6ff005fe3d29ce7f4760927906e1660af Mon Sep 17 00:00:00 2001 From: anmaster Date: Fri, 30 Jan 2009 01:22:22 +0000 Subject: [PATCH] Run whitespace cleanup script in maps/python. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@11283 282e977c-c81d-0410-88c4-b93c2d0d6712 --- python/CFBank.py | 1 - python/CFCampfire.py | 2 +- python/CFDataFile.py | 1 - python/CFDialog.py | 1 - python/CFGamble.py | 1 - python/CFMapTransformer.py | 14 +- python/CFMove.py | 2 +- python/CFTimeOfDay.py | 4 +- python/IPO/say.py | 2 +- python/commands/give.py | 2 +- python/events/init/give_command.py | 2 +- python/events/kick/log_kick.py | 1 - python/events/login/mail_login.py | 1 - python/guilds/README.txt | 5 - python/guilds/guild_dues.py | 4 +- python/guilds/guild_entry.py | 1 - python/guilds/guild_questpoints_apply.py | 42 ++- python/guilds/guildboard.py | 43 ++- python/guilds/guildbuy.py | 114 ++++--- python/guilds/guildjoin.py | 126 ++++---- python/guilds/guildoracle.py | 315 +++++++++---------- python/guilds/guildpay.py | 18 +- python/items/banquet.py | 36 +-- python/items/experience_rewarder.py | 6 +- python/items/roll-o-matic.py | 16 +- python/items/smoking_pipe.py | 2 +- python/items/sunnista.py | 9 +- python/maps/navar-midane_time.py | 10 +- python/maps/witherspoon_manor/devourers.py | 25 +- python/maps/witherspoon_manor/ghost.py | 46 +-- python/maps/witherspoon_manor/rolanda.py | 2 +- python/maps/witherspoon_manor/tomb.py | 18 +- python/maps/witherspoon_manor/weapon_shop.py | 7 +- python/misc/CFweardisguise.py | 1 - python/misc/npc_dialog.py | 3 +- python/misc/swallow_whole.py | 7 +- python/monsters/combat_chicken.py | 10 +- python/monsters/farnass.py | 28 +- python/monsters/lursendis.py | 6 +- python/tod/filter.py | 3 +- python/tod/push.py | 17 +- python/tod/replace.py | 8 +- python/tod/sleep.py | 7 +- 43 files changed, 470 insertions(+), 499 deletions(-) diff --git a/python/CFBank.py b/python/CFBank.py index b032c8d7d..8d8219315 100644 --- a/python/CFBank.py +++ b/python/CFBank.py @@ -63,4 +63,3 @@ class CFBank: return 1 else: return 0 - diff --git a/python/CFCampfire.py b/python/CFCampfire.py index d736c21ad..f79581c40 100644 --- a/python/CFCampfire.py +++ b/python/CFCampfire.py @@ -33,7 +33,7 @@ class CFCampfire: def say(self): '''Called when the player talks to the firecamp.''' w = Crossfire.WhoAmI() - + if ( Crossfire.WhatIsMessage() == 'story' ): if w.ReadKey(key_status) == '': w.Say('So you want a story, he... All right.') diff --git a/python/CFDataFile.py b/python/CFDataFile.py index 736610ea3..8cf34a69d 100644 --- a/python/CFDataFile.py +++ b/python/CFDataFile.py @@ -154,4 +154,3 @@ class CFData: keys.remove('#') keys.sort() return keys - diff --git a/python/CFDialog.py b/python/CFDialog.py index 379e2ce8d..96c59259b 100644 --- a/python/CFDialog.py +++ b/python/CFDialog.py @@ -357,4 +357,3 @@ class Dialog: finished = finished + ";" finished = finished + key + ":" + value self.__character.WriteKey("dialog_" + self.__location, finished, 1) - diff --git a/python/CFGamble.py b/python/CFGamble.py index f85f54252..783f280be 100644 --- a/python/CFGamble.py +++ b/python/CFGamble.py @@ -49,4 +49,3 @@ class SlotMachine: elif limit < self.minpot: self.slotdb[self.slotname] = self.minpot return self.slotdb[self.slotname] - diff --git a/python/CFMapTransformer.py b/python/CFMapTransformer.py index 19c464e8c..316b177a7 100644 --- a/python/CFMapTransformer.py +++ b/python/CFMapTransformer.py @@ -19,12 +19,12 @@ # The author can be reached via e-mail at tchize+cfpython@gmail.com # # Small helper class. Instanciate with -# transform = CFMapTransformer(key) -# or +# transform = CFMapTransformer(key) +# or # transform = CFMapTransformer(key, map) # default map value is to use The map of current event. # -# The key is used to keep track of transform. Different transforms +# The key is used to keep track of transform. Different transforms # on same map should use different key to prevent mixup # transformAll(criteria,whatTo) @@ -33,11 +33,11 @@ # This will scan the whole map for item's whose # "name" are in the list of criteria and transform # the to one of the whatTo objects, choosen randomly. -# original object is kept in inventory of newly created +# original object is kept in inventory of newly created # item and can be restored from there # untransformAll() # this no argument method cancel all changes that have been -# made by transformAll +# made by transformAll import Crossfire import random @@ -54,7 +54,7 @@ def MakeIdentifier(key): m.Name= key m.Speed=0 return m - + class CFMapTransformer: key = None cfmap = None @@ -67,7 +67,7 @@ class CFMapTransformer: while (o.Env): o = o.Env self.cfmap = o.Map - + def transformAll(self, criteria, whatTo): mustClean = False if (not isinstance (criteria,list)): diff --git a/python/CFMove.py b/python/CFMove.py index 0e3506be2..be98d63b9 100644 --- a/python/CFMove.py +++ b/python/CFMove.py @@ -38,7 +38,7 @@ def coordinates_to_dir(x, y): if (q < 242): return 8 ; return 7 - + if (q < -242): return 7 if (q < -41): diff --git a/python/CFTimeOfDay.py b/python/CFTimeOfDay.py index c97cb2315..c7fb81dad 100644 --- a/python/CFTimeOfDay.py +++ b/python/CFTimeOfDay.py @@ -4,13 +4,13 @@ class TimeOfDay: def __init__(self): self.now = Crossfire.GetTime() self.current = [Crossfire.GetMonthName(self.now[1]),Crossfire.GetWeekdayName(self.now[5]),Crossfire.GetSeasonName(self.now[7]),Crossfire.GetPeriodofdayName(self.now[8])] - + def matchAny(self,what): if isinstance(what,list): return bool(set(what) & set(self.current)) else: return bool(set([what]) & set (self.current)) - + def matchAll(self,what): if isinstance(what,list): return bool(not (set(what) - set(self.current))) diff --git a/python/IPO/say.py b/python/IPO/say.py index 38397bc36..ac5326394 100755 --- a/python/IPO/say.py +++ b/python/IPO/say.py @@ -70,7 +70,7 @@ if text[0] == 'help' or text[0] == 'yes': for pack in packages.keys(): # weight is in grams, so need to convert. whoami.Say('- %s (max weight: %d kg, price: %d platinum)'%(pack, packages[pack][1] / 1000, packages[pack][0])) - + whoami.Say('To send a package to a friend, say \'send \'.') whoami.Say('To receive your packages, say \'receive\'.') diff --git a/python/commands/give.py b/python/commands/give.py index 0bca17b0a..63d9f080f 100644 --- a/python/commands/give.py +++ b/python/commands/give.py @@ -43,4 +43,4 @@ else: while(top): next = top.Above top.Event(whoami,op, "give", 0) - top = next \ No newline at end of file + top = next diff --git a/python/events/init/give_command.py b/python/events/init/give_command.py index 17306d690..5d6839fff 100644 --- a/python/events/init/give_command.py +++ b/python/events/init/give_command.py @@ -1,2 +1,2 @@ import Crossfire -Crossfire.RegisterCommand("give", "/python/commands/give", 0) \ No newline at end of file +Crossfire.RegisterCommand("give", "/python/commands/give", 0) diff --git a/python/events/kick/log_kick.py b/python/events/kick/log_kick.py index c16a3bfa9..3816303b8 100644 --- a/python/events/kick/log_kick.py +++ b/python/events/kick/log_kick.py @@ -24,4 +24,3 @@ activator = Crossfire.WhoIsActivator() log = CFLog.CFLog() log.kick_update(activator.Name) - diff --git a/python/events/login/mail_login.py b/python/events/login/mail_login.py index f20740955..bf8634fd3 100644 --- a/python/events/login/mail_login.py +++ b/python/events/login/mail_login.py @@ -32,4 +32,3 @@ if total > 0: activator.Write('You have some mail waiting for you') else: activator.Write('No mail...') - diff --git a/python/guilds/README.txt b/python/guilds/README.txt index d81b34fcc..1dff0cbb2 100644 --- a/python/guilds/README.txt +++ b/python/guilds/README.txt @@ -168,8 +168,3 @@ Update 04-11-21 Ok, I've done a bit more work and implemented guild ranks, status and various other gizmos. I changed the list function in CFDataFile to use dictionary keys instead of iteration because python 2.1 does not have dictionary sequence method and as I've said I want to keep crossfire 2.1 compatible (at least till Debian Sarge is mainstream anyway). I've also started on python scripts for buying a guild, a guildhouses info board which will show scores and stuff and a tiny bit of the Dues stuff. I think I would like to place some 'tokens' for some of the bigger guild enhancements (like the kennels, the garden, additional levels...) on the HQ map itself and make them accessable (a scripted lever perhaps) only when a certain number of dues have been paid by the members (many many imperials perhaps?) Naturally other things should be quest items. I noticed that the guild master message board was changed to a second guild controll station and the guild message board in the HQ was changed to a GM message board - perhaps this was a misunderstanding? The GM board is for GM messages and the other is for the regular members. Also the cauldrons on the second floor don't seem to have a way to buy entry anymore. I don't know if the charging room should be key driven because keys are easily lended out and can't be recovered unless the lendee want's to return them, maybe we can use Rank for this (only guildsmen or above get access) or use a permemant maker instead of a key. I also want to do away with the keys altogether and make the code initiate the three guild masters when the guild I bought. - - - - - diff --git a/python/guilds/guild_dues.py b/python/guilds/guild_dues.py index f046ffadb..e7c309bd4 100644 --- a/python/guilds/guild_dues.py +++ b/python/guilds/guild_dues.py @@ -53,7 +53,7 @@ if whoami.Name=='Jack': object = activator.CheckInventory(cointype) if text[0] == 'help' or text[0] == 'yes': - message='Let me know how many jade coins you want to pay. Say pay ' + message='Let me know how many jade coins you want to pay. Say pay ' elif text[0] == 'pay': if len(text)==2: @@ -71,7 +71,7 @@ if whoami.Name=='Jack': guildbalance4 = str(guildbalance1) guildbalance3.write(guildbalance4) print guildbalance4 - + else: if cost > 1: message ="%s, you don't have %d %ss." %(random.choice(exclaimlist),cost,cointype) diff --git a/python/guilds/guild_entry.py b/python/guilds/guild_entry.py index 125def29b..265ac914b 100644 --- a/python/guilds/guild_entry.py +++ b/python/guilds/guild_entry.py @@ -85,4 +85,3 @@ else: message = 'Guild Guardian Error, please notify a DM' whoami.Say(message) - diff --git a/python/guilds/guild_questpoints_apply.py b/python/guilds/guild_questpoints_apply.py index af6dbfa1c..191af65a0 100644 --- a/python/guilds/guild_questpoints_apply.py +++ b/python/guilds/guild_questpoints_apply.py @@ -1,22 +1,20 @@ -import Crossfire -import CFGuilds - -activator=Crossfire.WhoIsActivator() -activatorname=activator.Name -whoami=Crossfire.WhoAmI() -mymap = activator.Map -mapname = mymap.Name -trank = 0 - -points=Crossfire.ScriptParameters() # 1 is apply event - -if points: - guild = CFGuilds.SearchGuilds(activatorname) - if guild: - CFGuilds.CFGuild.add_questpoints(activatorname,points) - else: - pass -else: - print 'Error, no points specified in %s on map %s' %(whoami,mapname) - - +import Crossfire +import CFGuilds + +activator=Crossfire.WhoIsActivator() +activatorname=activator.Name +whoami=Crossfire.WhoAmI() +mymap = activator.Map +mapname = mymap.Name +trank = 0 + +points=Crossfire.ScriptParameters() # 1 is apply event + +if points: + guild = CFGuilds.SearchGuilds(activatorname) + if guild: + CFGuilds.CFGuild.add_questpoints(activatorname,points) + else: + pass +else: + print 'Error, no points specified in %s on map %s' %(whoami,mapname) diff --git a/python/guilds/guildboard.py b/python/guilds/guildboard.py index a6a9ea256..405e0ce15 100644 --- a/python/guilds/guildboard.py +++ b/python/guilds/guildboard.py @@ -1,22 +1,21 @@ -import Crossfire -import CFGuilds - -def mycmp(a, b): - return cmp(a[1], b[1]) - -activator=Crossfire.WhoIsActivator() -guilds = CFGuilds.CFGuildHouses() - -activator.Write('Guild Standings:') -activator.Write('Guild - Points - Status') - -guildlist = guilds.list_guilds() -standings = [] -for guild in guildlist: - record = guilds.info(guild) - if record['Status'] != 'inactive': - standings.append([record['Points'], guild, record['Status']]) -standings.sort(mycmp) -for item in standings: - activator.Write('%s - %s - %s' %(item[1],item[0],item[2])) - +import Crossfire +import CFGuilds + +def mycmp(a, b): + return cmp(a[1], b[1]) + +activator=Crossfire.WhoIsActivator() +guilds = CFGuilds.CFGuildHouses() + +activator.Write('Guild Standings:') +activator.Write('Guild - Points - Status') + +guildlist = guilds.list_guilds() +standings = [] +for guild in guildlist: + record = guilds.info(guild) + if record['Status'] != 'inactive': + standings.append([record['Points'], guild, record['Status']]) +standings.sort(mycmp) +for item in standings: + activator.Write('%s - %s - %s' %(item[1],item[0],item[2])) diff --git a/python/guilds/guildbuy.py b/python/guilds/guildbuy.py index adfc48155..a1bea7709 100644 --- a/python/guilds/guildbuy.py +++ b/python/guilds/guildbuy.py @@ -1,58 +1,56 @@ -import Crossfire -import CFGuilds - -whoami=Crossfire.WhoAmI() -guildname=Crossfire.ScriptParameters() # 1 is 'apply' event - -def find_player(object): - while (object.Type != 1) : #1 is type 'Player' - object = object.Above - if not object: - return 0 - return object - -activator=Crossfire.WhoIsActivator() -map = activator.Map - -players = [] -names = [] - -if (guildname): - #find players by coords - ob1=map.ObjectAt(33,24) - ob2=map.ObjectAt(33,26) - objects = [ob1, ob2] - for object in objects: - temp = find_player(object) - if temp: - players.append(temp) - players.append(activator) - - for player in players: - names.append(player.Name) - - if len(players) == 3: - print '%s,%s and %s found guild %s' %(names[0], names[1], names[2], guildname) - - CFGuilds.CFGuildHouses().establish(guildname) - #Masterize them - for player, name in zip(players, names): - CFGuilds.CFGuild(guildname).add_member(name, 'GuildMaster') - guildmarker = player.CreateObject("marker") - guildmarker.Speed = 0 - guildmarker.Name=guildname - guildmarker.Slaying='GuildMaster' - - #teleport them - player.Teleport(map,int(11),int(16)) - message = "You have purchased the %s guild. Rule it wisely. (I would type 'save' right about now...)"%guildname - - else: - message = 'To purchase a guild requires two additional persons to stand on the alcoves above.' -else: - print 'Guild Purchase Error: %s, %s' %(guildname, activatorname) - message = 'Guild Purchase Error, please notify a DM' - -whoami.Say(message) - - +import Crossfire +import CFGuilds + +whoami=Crossfire.WhoAmI() +guildname=Crossfire.ScriptParameters() # 1 is 'apply' event + +def find_player(object): + while (object.Type != 1) : #1 is type 'Player' + object = object.Above + if not object: + return 0 + return object + +activator=Crossfire.WhoIsActivator() +map = activator.Map + +players = [] +names = [] + +if (guildname): + #find players by coords + ob1=map.ObjectAt(33,24) + ob2=map.ObjectAt(33,26) + objects = [ob1, ob2] + for object in objects: + temp = find_player(object) + if temp: + players.append(temp) + players.append(activator) + + for player in players: + names.append(player.Name) + + if len(players) == 3: + print '%s,%s and %s found guild %s' %(names[0], names[1], names[2], guildname) + + CFGuilds.CFGuildHouses().establish(guildname) + #Masterize them + for player, name in zip(players, names): + CFGuilds.CFGuild(guildname).add_member(name, 'GuildMaster') + guildmarker = player.CreateObject("marker") + guildmarker.Speed = 0 + guildmarker.Name=guildname + guildmarker.Slaying='GuildMaster' + + #teleport them + player.Teleport(map,int(11),int(16)) + message = "You have purchased the %s guild. Rule it wisely. (I would type 'save' right about now...)"%guildname + + else: + message = 'To purchase a guild requires two additional persons to stand on the alcoves above.' +else: + print 'Guild Purchase Error: %s, %s' %(guildname, activatorname) + message = 'Guild Purchase Error, please notify a DM' + +whoami.Say(message) diff --git a/python/guilds/guildjoin.py b/python/guilds/guildjoin.py index 171171089..f2e68369c 100644 --- a/python/guilds/guildjoin.py +++ b/python/guilds/guildjoin.py @@ -1,64 +1,62 @@ -# guildjoin.py - operates perilous chair for Hall of Joining in crossfire guilds -# -# Copyright (C) 2004 Todd Mitchell -# -# 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 temitchell@sourceforge.net -# - -import Crossfire -import CFGuilds - -def find_player(object): - while (object.Type != 1) : #1 is type 'Player' - object = object.Above - if not object: - return 0 - return object - -activator=Crossfire.WhoIsActivator() -activatorname=activator.Name -map = activator.Map -whoami=Crossfire.WhoAmI() - -guildname=Crossfire.ScriptParameters() # 1 is 'apply' event - -if (guildname): - guild = CFGuilds.CFGuild(guildname) - #find players by coords - ob=map.ObjectAt(9,16) - player = find_player(ob) - if player: # look for player - charname=player.Name - in_guild = CFGuilds.SearchGuilds(charname) - if in_guild == 0: - if guild.info(charname): - #already a member - message = '%s is already a member.' %charname - else: - guild.add_member(charname, 'Initiate') - message = 'Added %s to the guild' %charname - else: - message = 'It appears that %s is already a member of the %s guild' %(charname, in_guild) - else: - message = 'No one is in the chair!' -else: - print 'Guild Join Error: %s' %(guildname) - message = 'Guild Join Error, please notify a DM' - -whoami.Say(message) - - +# guildjoin.py - operates perilous chair for Hall of Joining in crossfire guilds +# +# Copyright (C) 2004 Todd Mitchell +# +# 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 temitchell@sourceforge.net +# + +import Crossfire +import CFGuilds + +def find_player(object): + while (object.Type != 1) : #1 is type 'Player' + object = object.Above + if not object: + return 0 + return object + +activator=Crossfire.WhoIsActivator() +activatorname=activator.Name +map = activator.Map +whoami=Crossfire.WhoAmI() + +guildname=Crossfire.ScriptParameters() # 1 is 'apply' event + +if (guildname): + guild = CFGuilds.CFGuild(guildname) + #find players by coords + ob=map.ObjectAt(9,16) + player = find_player(ob) + if player: # look for player + charname=player.Name + in_guild = CFGuilds.SearchGuilds(charname) + if in_guild == 0: + if guild.info(charname): + #already a member + message = '%s is already a member.' %charname + else: + guild.add_member(charname, 'Initiate') + message = 'Added %s to the guild' %charname + else: + message = 'It appears that %s is already a member of the %s guild' %(charname, in_guild) + else: + message = 'No one is in the chair!' +else: + print 'Guild Join Error: %s' %(guildname) + message = 'Guild Join Error, please notify a DM' + +whoami.Say(message) diff --git a/python/guilds/guildoracle.py b/python/guilds/guildoracle.py index b766127e6..dcd4bd2b5 100644 --- a/python/guilds/guildoracle.py +++ b/python/guilds/guildoracle.py @@ -1,158 +1,157 @@ -# Script for say event of guild member board -# -# 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. -# -# authors: majorwoo josh@woosworld.net, Avion temitchell@sourceforge.net - -import Crossfire -import CFGuilds -import CFLog - -import sys -import string - -activator=Crossfire.WhoIsActivator() -activatorname=activator.Name -whoami=Crossfire.WhoAmI() -isDM=activator.DungeonMaster -mymap=activator.Map -print mymap -log=CFLog.CFLog() -guildname=Crossfire.ScriptParameters() # 6 is say event -print "Activated %s" %guildname - -if (guildname): - guild = CFGuilds.CFGuild(guildname) - guildhouse = CFGuilds.CFGuildHouses() - text = string.split(Crossfire.WhatIsMessage()) - - if guild.info(activatorname) == 0 and isDM == 0: - message = 'You don\'t belong to this guild!' - elif text[0] == 'help' or text[0] == 'yes': - if isDM: - message = '\nList of commands:\n-list\n-add \n-remove \n-info \n-promote \n-demote \n-status \n-guildstatus ' - else: - message='\nList of commands:\n-list\n-remove \n-info \n-promote \n-demote \n-status ' - - elif text[0] == 'info': - if len(text)==2: - record = guild.info(text[1]) - if record: - message = '%s' %record - else: - message = '%s is not a member' %text[1] - else: - message = 'Usage "info "' - - elif text[0] == 'remove': - if len(text)==2: - if guild.info(text[1]): - message = 'Removed %s from the guild' %text[1] - #delete them - guild.remove_member(text[1]) - else: - #if we didn't find them on the board - message = '%s was not a member' %text[1] - else: - message = 'Usage "remove "' - - elif text[0] == 'list': - list = guild.list_members() - for member in list: - activator.Write(member) - message = 'Total members = ' + str(len(list)) - - elif text[0] == 'promote': - if len(text)==2: - record = guild.info(text[1]) - if record: - if guild.promote_member(text[1]): - record = guild.info(text[1]) #refresh record - message = '%s promoted to %s' %(text[1], record['Rank']) - else: - message = 'You cannot promote %s' %text[1] - else: - message = '%s is not a member' %text[1] - else: - message = 'Usage "promote "' - - elif text[0] == 'demote': - if len(text)==2: - record = guild.info(text[1]) - if record: - if guild.demote_member(text[1]): - record = guild.info(text[1]) #refresh record - message = '%s demoted to %s' %(text[1], record['Rank']) - else: - message = 'You cannot demote %s' %text[1] - else: - message = '%s is not a member' %text[1] - else: - message = 'Usage "demote "' - - elif text[0] == 'status': - if len(text)==3: - record = guild.info(text[1]) - if record: - if guild.change_status(text[1],text[2]): - record = guild.info(text[1]) #refresh record - message = '%s now has status of %s' %(text[1], record['Status']) - else: - message = '%s is not a valid status' %text[2] - else: - message = '%s is not a member' %text[1] - else: - message = 'Usage "status \n%s"' %str(guild.status) - -# DM commands - #add user directly - elif text[0] == 'add' and isDM: - if len(text)==2: - #check if they are a player - if log.info(text[1]): - #see if they are on the board already - if guild.info(text[1]): - #already a member - message = '%s is already a member.' %text[1] - else: - guild.add_member(text[1], 'Initiate') - message = 'Added %s to the guild' %text[1] - else: - message = 'Sorry, I don\'t know any %s' %text[1] - else: - message = 'Usage "add "' - - #change guild status - elif text[0] == 'guildstatus' and isDM: - if len(text)==2: - record = guildhouse.info(guildname) - if record: - if guildhouse.change_status(guildname,text[1]): - record = guildhouse.info(text[1]) #refresh record - message = '%s now has status of %s' %(guildname, record['Status']) - else: - message = '%s is not a valid status' %text[1] - else: - message = '%s is not a guild' %guildname - else: - message = 'Usage "guildstatus \n%s"' %str(guildhouse.status) - - else: - message = 'What did you need?' - -else: - message = 'Board Error' -whoami.Say(message) - +# Script for say event of guild member board +# +# 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. +# +# authors: majorwoo josh@woosworld.net, Avion temitchell@sourceforge.net + +import Crossfire +import CFGuilds +import CFLog + +import sys +import string + +activator=Crossfire.WhoIsActivator() +activatorname=activator.Name +whoami=Crossfire.WhoAmI() +isDM=activator.DungeonMaster +mymap=activator.Map +print mymap +log=CFLog.CFLog() +guildname=Crossfire.ScriptParameters() # 6 is say event +print "Activated %s" %guildname + +if (guildname): + guild = CFGuilds.CFGuild(guildname) + guildhouse = CFGuilds.CFGuildHouses() + text = string.split(Crossfire.WhatIsMessage()) + + if guild.info(activatorname) == 0 and isDM == 0: + message = 'You don\'t belong to this guild!' + elif text[0] == 'help' or text[0] == 'yes': + if isDM: + message = '\nList of commands:\n-list\n-add \n-remove \n-info \n-promote \n-demote \n-status \n-guildstatus ' + else: + message='\nList of commands:\n-list\n-remove \n-info \n-promote \n-demote \n-status ' + + elif text[0] == 'info': + if len(text)==2: + record = guild.info(text[1]) + if record: + message = '%s' %record + else: + message = '%s is not a member' %text[1] + else: + message = 'Usage "info "' + + elif text[0] == 'remove': + if len(text)==2: + if guild.info(text[1]): + message = 'Removed %s from the guild' %text[1] + #delete them + guild.remove_member(text[1]) + else: + #if we didn't find them on the board + message = '%s was not a member' %text[1] + else: + message = 'Usage "remove "' + + elif text[0] == 'list': + list = guild.list_members() + for member in list: + activator.Write(member) + message = 'Total members = ' + str(len(list)) + + elif text[0] == 'promote': + if len(text)==2: + record = guild.info(text[1]) + if record: + if guild.promote_member(text[1]): + record = guild.info(text[1]) #refresh record + message = '%s promoted to %s' %(text[1], record['Rank']) + else: + message = 'You cannot promote %s' %text[1] + else: + message = '%s is not a member' %text[1] + else: + message = 'Usage "promote "' + + elif text[0] == 'demote': + if len(text)==2: + record = guild.info(text[1]) + if record: + if guild.demote_member(text[1]): + record = guild.info(text[1]) #refresh record + message = '%s demoted to %s' %(text[1], record['Rank']) + else: + message = 'You cannot demote %s' %text[1] + else: + message = '%s is not a member' %text[1] + else: + message = 'Usage "demote "' + + elif text[0] == 'status': + if len(text)==3: + record = guild.info(text[1]) + if record: + if guild.change_status(text[1],text[2]): + record = guild.info(text[1]) #refresh record + message = '%s now has status of %s' %(text[1], record['Status']) + else: + message = '%s is not a valid status' %text[2] + else: + message = '%s is not a member' %text[1] + else: + message = 'Usage "status \n%s"' %str(guild.status) + +# DM commands + #add user directly + elif text[0] == 'add' and isDM: + if len(text)==2: + #check if they are a player + if log.info(text[1]): + #see if they are on the board already + if guild.info(text[1]): + #already a member + message = '%s is already a member.' %text[1] + else: + guild.add_member(text[1], 'Initiate') + message = 'Added %s to the guild' %text[1] + else: + message = 'Sorry, I don\'t know any %s' %text[1] + else: + message = 'Usage "add "' + + #change guild status + elif text[0] == 'guildstatus' and isDM: + if len(text)==2: + record = guildhouse.info(guildname) + if record: + if guildhouse.change_status(guildname,text[1]): + record = guildhouse.info(text[1]) #refresh record + message = '%s now has status of %s' %(guildname, record['Status']) + else: + message = '%s is not a valid status' %text[1] + else: + message = '%s is not a guild' %guildname + else: + message = 'Usage "guildstatus \n%s"' %str(guildhouse.status) + + else: + message = 'What did you need?' + +else: + message = 'Board Error' +whoami.Say(message) diff --git a/python/guilds/guildpay.py b/python/guilds/guildpay.py index ac44b5227..678eaa2be 100644 --- a/python/guilds/guildpay.py +++ b/python/guilds/guildpay.py @@ -45,14 +45,14 @@ if (guildname): found = 0 if text[0] == 'dues' or text[0] == 'Dues': - - - - - - + + + + + + record = guild.info(activatorname) #see if they are on the board if record: @@ -73,9 +73,9 @@ if (guildname): activator.Teleport(mymap,int(x2),int(y2)) activator.Teleport (mymap,int(x),int(y)) - else: + else: if balance >= 101: - balance1 = int (balance) - 100 + balance1 = int (balance) - 100 gdues1=open('share/maps/python/guilds/guildbalance.py', 'w') balance2 = str (balance1) gdues1.write (balance2) @@ -107,4 +107,4 @@ if (guildname): else: message = 'Guild Guardian Error, please notify a DM' -whoami.Say(message) \ No newline at end of file +whoami.Say(message) diff --git a/python/items/banquet.py b/python/items/banquet.py index 38126c838..b56707dcb 100644 --- a/python/items/banquet.py +++ b/python/items/banquet.py @@ -48,7 +48,7 @@ def return_to_bed(): # Ok, this is real bad. Let player handle the situation - worse case, call to DMs or WoR manually. act.Message('The %s whines really loudly.'%l.Name) return - + act.Teleport(dest, act.BedX, act.BedY) def do_back(): @@ -57,18 +57,18 @@ def do_back(): y = l.ReadKey('banquet_y') mn = l.ReadKey('banquet_map') rw = l.ReadKey('banquet_rw') - + l.WriteKey('banquet_x', '', 0) l.WriteKey('banquet_y', '', 0) l.WriteKey('banquet_map', '', 0) l.WriteKey('banquet_rw', '', 0) - + if x == '' or y == '' or mn == '': # Logic error, but can't be helped - teleport player back to his bed of reality act.Message('You feel a distorsion of reality!') return_to_bed() return - + # find and remove statue in the map dest = Crossfire.ReadyMap(mn) if (dest == None): @@ -76,7 +76,7 @@ def do_back(): act.Message('The %s whines something. You barely understand it can\'t take you back to your starting point.'%l.Name) return_to_bed() return - + # Remove statue - let's assume it's found, or was removed due to map reset. st = dest.ObjectAt(int(x), int(y)) while st != None: @@ -85,27 +85,27 @@ def do_back(): continue; st.Remove() break; - + act.Message('You feel a powerful force engulf you.') act.Teleport(dest, int(x), int(y)) def do_banquet(): '''Teleports the player to the banquet map, if not used since one day. ''' - + now = str(Crossfire.GetTime()[0]) + '-' + str(Crossfire.GetTime()[1]) + '-' + str(Crossfire.GetTime()[2]) - + l = Crossfire.WhoAmI() act = Crossfire.WhoIsActivator() - + last = l.ReadKey('banquet_last') - - + + if (last == now): act.Message('You read the %s but nothing happens.'%l.Name) return; - + l.WriteKey('banquet_last', now, 1) - + # map generation m = Crossfire.CreateMap(size_x, size_y) m.Path = os.path.join(Crossfire.ScriptName(), Crossfire.WhoIsActivator().Name) @@ -116,7 +116,7 @@ def do_banquet(): for y in range(size_y): fl = Crossfire.CreateObjectByName(floor) fl.Teleport(m, x, y) - + # Put walls. wall = get_one(walls) # top left @@ -150,22 +150,22 @@ def do_banquet(): fo = Crossfire.CreateObjectByName(get_one(foods)) fo.GodGiven = 1 fo.Teleport(m, x + 1, y + 1) - + # Store player's current location x = act.X y = act.Y im = act.Map rw = get_one(replace_with) - + l.WriteKey('banquet_x', str(x), 1) l.WriteKey('banquet_y', str(y), 1) l.WriteKey('banquet_map', im.Path, 1) l.WriteKey('banquet_rw', rw, 1) - + # Teleport act.Message('You feel grabbed by some powerful force.') act.Teleport(m, int(( size_x - 1 ) / 2), int( size_y - 1 ) / 2) - + # Keep free spot by putting a statue statue = im.CreateObject(rw, x, y) statue.Name = '%s\'s statue'%act.Name diff --git a/python/items/experience_rewarder.py b/python/items/experience_rewarder.py index ed0b26d20..058ae6ec0 100644 --- a/python/items/experience_rewarder.py +++ b/python/items/experience_rewarder.py @@ -24,16 +24,16 @@ key_prefix = 'experience_rewarder_' def do_give_exp(): pl = Crossfire.WhoIsActivator() evt = Crossfire.WhatIsEvent() - + if evt.Race != None and evt.Race != '': if pl.ReadKey(key_prefix + evt.Race) != '': return pl.WriteKey(key_prefix + evt.Race, 'used', 1) - + if evt.Skill == None or evt.Skill == '': pl.AddExp(evt.Exp) return - + wc = evt.WC if wc < 0 or wc > 2: wc = 1 diff --git a/python/items/roll-o-matic.py b/python/items/roll-o-matic.py index a2f7a872e..5f23e7abe 100644 --- a/python/items/roll-o-matic.py +++ b/python/items/roll-o-matic.py @@ -62,12 +62,12 @@ def handle_move(): if has_floor(x + dir_x[d], y + dir_y[d], floor) == True: if me.Move(d) == 0: continue - + if pl != None: pl.Move(d) done = True break - + if done == False: me.WriteKey(key_direction, '', 1) me.WriteKey(key_follow, '', 1) @@ -81,24 +81,24 @@ def handle_say(): me.WriteKey(key_follow, '', 1) me.Map.Print('The %s stops moving.'%me.Name) return - + want_dir = -1 - + for d in Crossfire.DirectionName.keys(): if msg == Crossfire.DirectionName[d].lower(): want_dir = d break - + if want_dir == -1: return - + floor = find_floor(me.X, me.Y) if floor == '': return - + if me.ReadKey(key_direction) == '': me.Map.Print('The %s starts moving!'%me.Name) - + me.WriteKey(key_direction, str(want_dir), 1) me.WriteKey(key_follow, floor, 1) diff --git a/python/items/smoking_pipe.py b/python/items/smoking_pipe.py index b906cfb91..6e90e55e0 100644 --- a/python/items/smoking_pipe.py +++ b/python/items/smoking_pipe.py @@ -15,7 +15,7 @@ def smoke(): if what == None: who.Write('You don\'t have anything to smoke.', color) return - + what.Quantity = what.Quantity - 1 force = who.CreateObject('force_effect') force.Speed = 0.1 diff --git a/python/items/sunnista.py b/python/items/sunnista.py index 1a6d7b33b..75f9d985a 100644 --- a/python/items/sunnista.py +++ b/python/items/sunnista.py @@ -23,7 +23,7 @@ max_charges = 15 def do_release(friendly): act = Crossfire.WhoIsActivator() l = Crossfire.WhoAmI() - + charges = l.ReadKey('sunnista_charges') if (charges != ''): charges = int(charges) @@ -55,14 +55,14 @@ def do_absorb(count): charges = int(charges) else: charges = 0 - + Crossfire.WhoIsActivator().Message('The %s absorbs some %s!'%(l.Name, affect_pl)) - + charges += count l.WriteKey('sunnista_charges', str(charges), 1) if charges > max_charges: do_release(0) - + def do_find(): #global max_affect got = 0 @@ -89,4 +89,3 @@ if got == 0: do_release(1) else: do_absorb(got) - diff --git a/python/maps/navar-midane_time.py b/python/maps/navar-midane_time.py index 23e73cb7c..53e160ba9 100644 --- a/python/maps/navar-midane_time.py +++ b/python/maps/navar-midane_time.py @@ -17,24 +17,24 @@ else: on_map = Crossfire.GetPrivateDictionary()['on_map'] def check_player(player): - + if player in on_map: return - + on_map.append(player) - + if not data.exist(player.Name): who.Say('Well, welcome, stranger.') record = { '#' : player.Name, 'state' : 'seen' } data.put_record(record) return - + record = data.get_record(player.Name) if record['state'] == 'seen': who.Say('Welcome back, stranger.') return - + who.Say('Welcome back, %s'%player.Name) def on_time(): diff --git a/python/maps/witherspoon_manor/devourers.py b/python/maps/witherspoon_manor/devourers.py index 7a6087822..f05491287 100644 --- a/python/maps/witherspoon_manor/devourers.py +++ b/python/maps/witherspoon_manor/devourers.py @@ -27,7 +27,7 @@ def do_give(): if whoisother.Quantity < 10: pl.Message('The priest looks at your money and sighes deeply, but doesn\'t take it.', color) return - + rem = whoisother.Quantity if whoisother.Quantity > 50: rem = 50 @@ -35,43 +35,43 @@ def do_give(): pl.Message('The priest takes 50 platinum coins.', color) else: pl.Message('The priest accepts your money.', color) - + whoisother.Quantity = whoisother.Quantity - rem - + whoami.WriteKey('got_offrand', '1', 1) whoami.Say('Many thanks for your offrand!') - + return - + whoami.Say('Our church needs some restoration, could you donate to it?') - + return - + whoami.WriteKey('got_offrand', '', 1) - + if whoisother.ReadKey('special_item') != 'ghost_dagger': whoami.Say('Nice %s.'%whoisother.Name) return - + whoami.Say('My, my, those runes are pretty interesting.') pl.Message('The priest takes the %s and looks at it carefully.'%whoisother.Name, color) whoami.CreateTimer(8, 1) whoami.WriteKey('examining_item', '1', 1) whoami.WriteKey('examining_for', pl.Name, 1) - + return def do_timer(): '''Priest finished examining the item.''' whoami.WriteKey('examining_item', '0', 1) - + #let's see if the player is still around pl = Crossfire.FindPlayer(whoami.ReadKey('examining_for')) if pl == None: # just in case someone else is around ^_- whoami.Say('Tss, people just aren\'t patient...') return - + pl.WriteKey('witherspoon_know_dagger', '1', 1) whoami.Say('As far as I can tell, the runes on this dagger represent an invocation to our Lord. It is meant to keep the soul in the body for hours after the death.') whoami.Map.Print('The priest shudders.', color) @@ -93,4 +93,3 @@ elif event.Subtype == Crossfire.EventType.TIME: if whoami.ReadKey('examining_item') == '1': #No moving while examining. Crossfire.SetReturnValue(1) - diff --git a/python/maps/witherspoon_manor/ghost.py b/python/maps/witherspoon_manor/ghost.py index 2d1c84e25..5e61ba611 100644 --- a/python/maps/witherspoon_manor/ghost.py +++ b/python/maps/witherspoon_manor/ghost.py @@ -18,7 +18,7 @@ def warn_player(player, ghost): player.Write('You feel a very powerful force gather around the %s! Your instinct tell you you\'d rather feel fast!'%ghost.Name) else: player.Write('You feel a really powerful force gather around the %s! Time to start fleeing, maybe?'%ghost.Name) - + drop = ghost.Map.CreateObject('reeking_urine', player.X, player.Y) player.Write('You feel so frightened you can\'t control your bladder!') @@ -26,7 +26,7 @@ def check_body(player, rule): '''Did the player already dig?''' if player.ReadKey('witherspoon_tomb') != 'dig': return True - + return False def start_disappear(ghost, player): @@ -35,27 +35,27 @@ def start_disappear(ghost, player): ghost.CreateTimer(5, 1) ghost.StandStill = True player.Write('The %s starts fading...'%ghost.Name) - + def found_body(player, rule): '''Does the player have the body?''' if player.ReadKey('witherspoon_tomb') != 'dig': return False - + player.WriteKey('witherspoon_tomb', '', 1) #reset our dialog anyway - the player did dig, so quest ends (nicely or badly) player.WriteKey('dialog_witherspoon_ghost', '', 1) - + #try to find the body, if not found then get angry body = player.CheckInventory('tortured body') - + ghost = Crossfire.WhoAmI() - + if body: #all fine! body.Remove() start_disappearing(ghost, player) return 1 - + #oh oh, bad, ghost is getting angry! ghost.WriteKey(key_angry, '1', 1) ghost.CreateTimer(10, 1) @@ -75,7 +75,7 @@ def do_dialog(): '''Main dialog routine.''' if not can_talk(None, None): return - + whoami = Crossfire.WhoAmI() pl = Crossfire.WhoIsActivator() if pl.ReadKey('witherspoon_know_all') == '1': @@ -87,17 +87,17 @@ def do_dialog(): whoami.WriteKey('bonus', '1', 1) start_disappear(whoami, pl) return - + if pl.ReadKey('witherspoon_know_dagger') == '1': # player talked to the priest of Devourers, and knows the dagger is special. whoami.Say('Oh, please find who could be as cruel as to use such a horrible spell on me!') return - + # default dialog, just talk - + # If you ever change this key, change the value in tomb.py too! speech = Dialog(Crossfire.WhoIsActivator(), Crossfire.WhoAmI(), "witherspoon_ghost") - + prer = [["witherspoon_ghost","0"]] postr = [["witherspoon_ghost", "explain"]] rmsg = ["I was killed by surprise, and ever since I'm stuck here.\n\n" @@ -105,32 +105,32 @@ def do_dialog(): "Could you find my body, please?" ] speech.addRule(DialogRule(["help","yes","how"], prer, rmsg, postr),0) - + prer = [["witherspoon_ghost","explain"]] postr = [["witherspoon_ghost", "wait"]] rmsg = ["I was walking near a lake west of Scorn, so maybe my body is buried here."] speech.addRule(DialogRule(["where","location"], prer, rmsg, postr),1) - + prer = [["witherspoon_ghost","explain"]] postr = [["witherspoon_ghost", "*"]] rmsg = ["Please, go find my body...", "Please, I need my body to rest in peace..."] speech.addRule(DialogRule(["*"], prer, rmsg, postr),2) - + prer = [["witherspoon_ghost","wait"]] postr = [["witherspoon_ghost", "*"]] rmsg = ["Please, go find my body.\n\nIt should be near the lake west of Scorn...", "Did you find my body yet? No?\n\nThen please, go search for it, west of Scorn there is a lake..."] speech.addRule(DialogRule(["*"], prer, rmsg, postr, check_body),3) - + prer = [["witherspoon_ghost","wait"]] postr = [["witherspoon_ghost", "0"]] rmsg = ["Thanks, you found my body!"] speech.addRule(DialogRule(["*"], prer, rmsg, postr, found_body),4) - + prer = [["witherspoon_ghost","*"]] postr = [["witherspoon_ghost", "*"]] rmsg = ["Please help me....", "Heeeeeeeelp...", "Pleaseeeee..."] speech.addRule(DialogRule(["*"], prer, rmsg, postr, can_talk),5) - + speech.speak(Crossfire.WhatIsMessage()) def do_angry(ghost): @@ -157,17 +157,17 @@ def do_disappear(): if ghost.ReadKey(key_disappear) != '1': '''Hu? Not supposed to come here in this case...''' return - + ghost.Say('Thanks a lot! Please take those small presents as a token of my gratitude.') - + bonus = 0 if ghost.ReadKey('bonus') == '1': bonus = 25 - + presents = ['gem', 'ruby', 'emerald', 'pearl', 'sapphire'] got = ghost.Map.CreateObject(presents[random.randint(0, len(presents) - 1)], ghost.X, ghost.Y) got.Quantity = random.randint(3 + bonus, 7 + bonus) - + ghost.Remove() if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY: diff --git a/python/maps/witherspoon_manor/rolanda.py b/python/maps/witherspoon_manor/rolanda.py index 723e0ac7c..e2885db2f 100644 --- a/python/maps/witherspoon_manor/rolanda.py +++ b/python/maps/witherspoon_manor/rolanda.py @@ -65,7 +65,7 @@ def move_to_chair(): def explain(): '''explanation of the ghost story. Let Rolanda be still from now on.''' - + pl = Crossfire.FindPlayer(whoami.ReadKey('explaining_for')) if pl == None: # just in case someone else is around ^_- diff --git a/python/maps/witherspoon_manor/tomb.py b/python/maps/witherspoon_manor/tomb.py index bf4f4c727..3167bbc80 100644 --- a/python/maps/witherspoon_manor/tomb.py +++ b/python/maps/witherspoon_manor/tomb.py @@ -17,7 +17,7 @@ def can_dig(pl): if pl.CheckArchInventory('shovel_1') != None: pl.Write('You dig with your shovel.') return True - + pl.Write('You\'d dig, but you have nothing to dig with...') return False @@ -34,38 +34,38 @@ def main(): pl = find_player() if pl == None: return - + if pl.ReadKey('dialog_witherspoon_ghost') != 'witherspoon_ghost:wait': return - + if pl.ReadKey('witherspoon_tomb') != '': # Already dig, no need to give more items return - + pl.Write('You notice the earth here is kind of bumpy.') - + #ok, so two choices for the player: if she got clawing, easy to dig. Else need a shovel. dig = can_dig(pl) if dig == 0: return - + #don't want the player to dig again! Will be reset by the ghost later on pl.WriteKey('witherspoon_tomb', 'dig', 1) - + body = Crossfire.CreateObjectByName('corpse') # so it doesn't merge with another item body.WriteKey('special_item', 'ghost_body', 1) body.Name = 'tortured body' body.NamePl = 'tortured bodies' body.Message = 'You suppose this is the body of the ghost in Witherspoon Manor. It is covered in scars, as if someone really wanted to make him pay for something.' body.InsertInto(pl) - + dagger = Crossfire.CreateObjectByName('dagger') dagger.WriteKey('special_item', 'ghost_dagger', 1) dagger.Name = 'strange dagger' dagger.NamePl = 'strange daggers' dagger.Message = 'You found this dagger with the body of the Witherspoon Manor ghost. It has some weird look. You wonder if a marchant could figure what the symbols mean.' dagger.InsertInto(pl) - + pl.Write('You find a body with a dagger in it!') main() diff --git a/python/maps/witherspoon_manor/weapon_shop.py b/python/maps/witherspoon_manor/weapon_shop.py index ae03a0cda..a6dd3916d 100644 --- a/python/maps/witherspoon_manor/weapon_shop.py +++ b/python/maps/witherspoon_manor/weapon_shop.py @@ -25,19 +25,19 @@ def do_give(): if whoisother.ReadKey('special_item') != 'ghost_dagger': whoami.Say('Nice %s.'%whoisother.Name) return - + whoami.Say('Oh, this looks like a really interesting dagger.') pl.Message('The owner takes the %s and starts examining it carefully.'%whoisother.Name, color) whoami.CreateTimer(8, 1) whoami.WriteKey('examining_item', '1', 1) whoami.WriteKey('examining_for', pl.Name, 1) - + return def do_timer(): '''Owner finished examining the item.''' whoami.WriteKey('examining_item', '0', 1) - + #let's see if the player is still around pl = Crossfire.FindPlayer(whoami.ReadKey('examining_for')) if pl == None: @@ -58,4 +58,3 @@ elif event.Subtype == Crossfire.EventType.TIME: if whoami.ReadKey('examining_item') == '1': #No moving while examining. Crossfire.SetReturnValue(1) - diff --git a/python/misc/CFweardisguise.py b/python/misc/CFweardisguise.py index bfc3faeab..0d602cbba 100644 --- a/python/misc/CFweardisguise.py +++ b/python/misc/CFweardisguise.py @@ -25,4 +25,3 @@ if option: tag = activator.CreateInvisibleObjectInside(option) tag.Name=option #Crossfire.Log(Crossfire.LogDebug, "adding tag") - diff --git a/python/misc/npc_dialog.py b/python/misc/npc_dialog.py index 668bd4010..a9fa51f67 100644 --- a/python/misc/npc_dialog.py +++ b/python/misc/npc_dialog.py @@ -27,7 +27,7 @@ # arch guildmaster # name Sigmund # msg -# +# # endmsg # x 11 # y 7 @@ -150,4 +150,3 @@ for jsonRule in parameters["rules"]: if speech.speak(Crossfire.WhatIsMessage()) == 0: Crossfire.SetReturnValue(1) - diff --git a/python/misc/swallow_whole.py b/python/misc/swallow_whole.py index 0c642eaee..d9f2230fb 100644 --- a/python/misc/swallow_whole.py +++ b/python/misc/swallow_whole.py @@ -18,7 +18,7 @@ if (r <= 0.26): isplayer = 2 if isplayer == 1: - me.Map.Print("\nYou are swallowed whole by the %s!" % (worm.Name)) + me.Map.Print("\nYou are swallowed whole by the %s!" % (worm.Name)) map = Crossfire.ReadyMap(eatmap) if map: me.Teleport(map, eat_x, eat_y) @@ -27,10 +27,10 @@ if (r <= 0.26): elif isplayer == 0: me.Map.Print("\nThe %s is swallowed whole by the %s!" % (me.Name, worm.Name)) - + while (me.Inventory is not None): me.Inventory.InsertInto(worm) - + mexists = Crossfire.WhoIsOther() if mexists: me.Remove() @@ -38,4 +38,3 @@ if (r <= 0.26): worm.Map.Print('doesnt exist') else: me.Map.Print("\nThe %s misses the %s" % (worm.Name, me.Name)) - diff --git a/python/monsters/combat_chicken.py b/python/monsters/combat_chicken.py index 38a692512..fdb3b15b4 100644 --- a/python/monsters/combat_chicken.py +++ b/python/monsters/combat_chicken.py @@ -41,15 +41,15 @@ def move_chicken(): if chicken.Enemy != None: # chicken won't let itself get killed easily! chicken.WriteKey(key_attacked, '1', 1) - + if chicken.ReadKey(key_attacked) != '': return - + Crossfire.SetReturnValue(1) if chicken.Map.Darkness >= 3: # too dark, night is for sleeping return - + target = chicken.ReadKey(key_target) if target != '': x = int(target.split('|')[0]) @@ -93,7 +93,7 @@ def move_chicken(): break if food != None: break - + # nothing found, random walk for test in [1, 10]: dir = random.randint(1, 8) @@ -101,6 +101,6 @@ def move_chicken(): chicken.Move(dir) Crossfire.SetReturnValue(1) return - + move_chicken() diff --git a/python/monsters/farnass.py b/python/monsters/farnass.py index 2a1de4e39..7b0cdaea2 100644 --- a/python/monsters/farnass.py +++ b/python/monsters/farnass.py @@ -39,7 +39,7 @@ def check_ingredients(): arrives on the recipient (to avoid player picking up items)''' mushroom = None eggs = None - + # whoami.Say('before') obj = whoami.Map.ObjectAt(recipient_x, recipient_y) while obj != None: @@ -57,29 +57,29 @@ def check_ingredients(): break obj = obj.Above #whoami.Say('after') - + #if mushroom != None: # whoami.Say('got mushroom') #if eggs != None: # whoami.Say('got eggs') - + if mushroom == None or eggs == None or eggs.Quantity < eggs_count: if whoami.ReadKey(key_status) == st_getting: whoami.Say('Haha, you tried to trick me!') whoami.WriteKey(key_status, '', 1) return - + if whoami.ReadKey(key_status) != st_getting: whoami.Say('Oh, great, you found what I need to make my special caramel!') whoami.WriteKey(key_status, st_getting, 1); return - + # if called here, Farnass moved to the recipient, and can pick the ingredients whoami.Map.Print('%s expertly opens the frypan with a leg, and grabs the ingredient using two sticks in his mouth!'%whoami.Name, color) - + mushroom.Quantity = mushroom.Quantity - 1 eggs.Quantity = eggs.Quantity - eggs_count - + Crossfire.SetReturnValue(1) whoami.WriteKey(key_status, st_stove, 1) @@ -87,7 +87,7 @@ def end_cooking(success): ''' Everything is finish, let's decide if cooking was successful or not.''' whoami.WriteKey(key_status, '', 1) whoami.WriteKey(key_cooking_step, '', 1) - + if success == 0: return if random.randint(1, 100) < failure_chance: @@ -113,7 +113,7 @@ def clean_check(): def move_cook(): '''Main moving routine.''' - + #whoami.Say('move') status = whoami.ReadKey(key_status) if status == st_getting: @@ -125,16 +125,16 @@ def move_cook(): elif m == 2: whoami.Say('Get off my way! You want me to cook this caramel or what?') return - + if status == st_cooking: clean_check() Crossfire.SetReturnValue(1) - + if whoami.X != stove_x or whoami.Y != stove_y: whoami.Say('You fool! The ingredients are wasted, now!') end_cooking(0) return - + step = int(whoami.ReadKey(key_cooking_step)) - 1 if step == 0: end_cooking(1) @@ -151,7 +151,7 @@ def move_cook(): whoami.WriteKey(key_cooking_step, str(random.randint(60, 69)), 1) whoami.WriteKey(key_cooking_step, str(step), 1) return - + if status == st_stove: clean_check() move = CFMove.get_object_to(whoami, stove_x, stove_y) @@ -163,7 +163,7 @@ def move_cook(): whoami.Say('Get off my way, I need to get to the stove!') Crossfire.SetReturnValue(1) return - + d = Crossfire.GetPrivateDictionary() if d.has_key(key_need_check): whoami.Map.Print('You see %s look at the frypan.'%whoami.Name, color) diff --git a/python/monsters/lursendis.py b/python/monsters/lursendis.py index 0fbf33f2f..1b49b17ae 100644 --- a/python/monsters/lursendis.py +++ b/python/monsters/lursendis.py @@ -38,14 +38,14 @@ def check_plate(): whoami.WriteKey(key_eating_step, str(random.randint(5, 10)), 1) Crossfire.SetReturnValue(1) return - + whoami.Say('Oh! Could this be...') whoami.WriteKey(key_status, st_getting, 1) Crossfire.SetReturnValue(1) return obj = obj.Above - + if whoami.ReadKey(key_status) == st_getting: # we were on the spot, but no more omelet... whoami.WriteKey(key_status, '', 1) @@ -81,7 +81,7 @@ def move_gourmet(): whoami.WriteKey(key_eating_step, str(step), 1) Crossfire.SetReturnValue(1) return - + check_plate() whoami = Crossfire.WhoAmI() diff --git a/python/tod/filter.py b/python/tod/filter.py index 41cd2c276..34c131b47 100644 --- a/python/tod/filter.py +++ b/python/tod/filter.py @@ -22,7 +22,7 @@ # works only in specific moment of year/day. Periods are separated # by comas. See wiki doc list of possible values # exemple, to make an "apply" work only during Blizzard, new year and every morning: -# +# # arch event_apply # title Python # slaying /python/tod/filter.py @@ -51,4 +51,3 @@ elif string.lower(parameters["match"]) == "all": Crossfire.SetReturnValue(inverse) else: Crossfire.Log(Crossfire.LogError,"Script filter.py didn't get a 'match' parameter. Only got %s" %parameters) - diff --git a/python/tod/push.py b/python/tod/push.py index f55f8b97c..202074cb2 100644 --- a/python/tod/push.py +++ b/python/tod/push.py @@ -23,18 +23,18 @@ # It will behave as if a button was "pushed" when entering period # and "release" after the period. Typical use is to use it as # event_time on a living object (that objects that triggers -# time events). -# This script ensure button remains pushed for all period, and +# time events). +# This script ensure button remains pushed for all period, and # get release after period. This works even is map is loaded -# in middle of period or map gets released from memory and put in -# cache. In those case, event will just ensure that "current" state +# in middle of period or map gets released from memory and put in +# cache. In those case, event will just ensure that "current" state # correspond to expected state and correct status if needed. # Note: the event must be inside an object # which can find a path, using inventory, to a toplavel -# object that is on a Map. -# +# object that is on a Map. +# # exemple, to make an "push" starting at Morning and ending after Noon: -# +# # arch event_time # title Python # slaying /python/tod/push.py @@ -53,7 +53,7 @@ import Crossfire import string from CFTimeOfDay import TimeOfDay import cjson -event = Crossfire.WhatIsEvent() +event = Crossfire.WhatIsEvent() parameters = cjson.decode(event.Message) alreadymatched = (event.Value!=0) connected = int(parameters["connected"]) @@ -83,4 +83,3 @@ if ( (not match) & alreadymatched): map = op.Map map.TriggerConnected(connected,0,Crossfire.WhoAmI()) event.Value=0 - diff --git a/python/tod/replace.py b/python/tod/replace.py index 7dee28aa0..40cb5fefc 100644 --- a/python/tod/replace.py +++ b/python/tod/replace.py @@ -20,12 +20,12 @@ # Uses JSON notation for parameters # This script make the object is is attached to swap at # given periods of day with a specifc object in the event's inventory -# To use it, give this event's parameter the name of +# To use it, give this event's parameter the name of # period where the swap is active. Put in the inventiry the swapped object # The swap can occur for objects in map and for object in other object -# +# # exemple -# +# # arch event_time # title Python # slaying /python/tod/replace_all_periods.py @@ -63,7 +63,7 @@ if ( match != alreadymatched ): event = Crossfire.WhatIsEvent() current = Crossfire.WhoAmI() future = event.Inventory - # we do not want to repace a monster/anything useable in game by a subevent on the event. + # we do not want to repace a monster/anything useable in game by a subevent on the event. # seems for technical reasons, EVENT object have a destroy subevent. So let's just # ignore subevents while ( (future != None) & (future.Type == Crossfire.Type.EVENT_CONNECTOR)): diff --git a/python/tod/sleep.py b/python/tod/sleep.py index 2e3d5d7f0..455d4247b 100644 --- a/python/tod/sleep.py +++ b/python/tod/sleep.py @@ -25,9 +25,9 @@ # by a PC will not all of sudden go to sleep. Also, remember that most moster # awaken and attack when a player is nearby. So effects of this script might be # limited. -# +# # exemple -# +# # arch event_time # title Python # slaying /python/tod/sleep.py @@ -70,7 +70,6 @@ if ( match != alreadymatched ): current.Sleeping=0 Crossfire.Log(Crossfire.LogDebug, "Awaken %s" %current.Name) else: - event.Value=1 + event.Value=1 current.Sleeping=1 Crossfire.Log(Crossfire.LogDebug, "Put %s to sleep" %current.Name) -