Modified all print of script to calls to Crossfire.Log(Crossfire.Log(Debug|Error|Info|Monster),message)

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@7496 282e977c-c81d-0410-88c4-b93c2d0d6712
master
tchize 2007-11-08 23:36:22 +00:00
parent 4bdce564f2
commit d0f032623a
13 changed files with 20 additions and 19 deletions

View File

@ -58,7 +58,7 @@ class CFBank:
def remove_account(self,user): def remove_account(self,user):
if self.bankdb.has_key(user): if self.bankdb.has_key(user):
del self.bankdb[user] del self.bankdb[user]
print "%s's bank account removed." %user Crossfire.Log(Crossfire.LogDebug, "%s's bank account removed." %user)
self.bankdb.sync() self.bankdb.sync()
return 1 return 1
else: else:

View File

@ -42,7 +42,7 @@ class CFDataFile:
try: try:
file = open(self.filename,'wb') file = open(self.filename,'wb')
except: except:
print "Can't create datafile %s" % self.datafile_name Crossfire.Log(Crossfire.LogError, "Can't create datafile %s" % self.datafile_name)
else: else:
temp = [] temp = []
for item in header: for item in header:
@ -50,7 +50,7 @@ class CFDataFile:
contents = '#|%s\n' %(string.join(temp,'|')) contents = '#|%s\n' %(string.join(temp,'|'))
file.write(contents) file.write(contents)
file.close() file.close()
print "New datafile created: %s" % self.datafile_name Crossfire.Log(Crossfire.LogInfo, "New datafile created: %s" % self.datafile_name)
def getData(self): def getData(self):
'''Gets the formatted file as a dictionary '''Gets the formatted file as a dictionary

View File

@ -32,13 +32,13 @@ def GuildUpdate():
guildfile.close() guildfile.close()
guildlisting.pop() guildlisting.pop()
except: except:
print 'No GuidList file. Please check %s' %GuildList Crossfire.Log(Crossfire.LogError,'No GuidList file. Please check %s' %GuildList)
if (guildlisting): if (guildlisting):
print guildlisting Crossfire.Log(Crossfire.LogDebug, '%s' %guildlisting)
for guild in guildlisting: for guild in guildlisting:
if not CFGuildHouses().info(guild): if not CFGuildHouses().info(guild):
if CFGuildHouses().add_guild(guild): if CFGuildHouses().add_guild(guild):
print 'New Guild: %s' %guild Crossfire.Log(Crossfire.LogInfo,'New Guild: %s' %guild)
def SearchGuilds(player): def SearchGuilds(player):
guildlist = CFGuildHouses().list_guilds() guildlist = CFGuildHouses().list_guilds()
@ -283,7 +283,7 @@ class CFGuild:
currentrank = record['Rank'] currentrank = record['Rank']
if currentrank != 'Initiate': if currentrank != 'Initiate':
ranknum = self.ranks.index(currentrank) ranknum = self.ranks.index(currentrank)
print "ranknum = %d"%ranknum Crossfire.Log(Crossfire.LogDebug, "ranknum = %d"%ranknum)
newrank = ranknum-1 newrank = ranknum-1
record['Rank'] = self.ranks[newrank] record['Rank'] = self.ranks[newrank]
self.guildlist.put_record(record) self.guildlist.put_record(record)

View File

@ -55,7 +55,7 @@ if total > 0:
msgob.Message=message msgob.Message=message
msgob.Value=0 msgob.Value=0
else: else:
print 'ERROR: unknown mailtype\n' Crossfire.Log(Crossfire.LogError, 'ERROR: unknown mailtype\n')
if total == 1: if total == 1:
activator.Write('You got 1 mail.') activator.Write('You got 1 mail.')

View File

@ -1,3 +1,4 @@
import CFGuilds import CFGuilds
print "Updating Guilds" import Crossfire
Crossfire.Log(Crossfire.LogDebug, "Updating Guilds")
CFGuilds.GuildUpdate() CFGuilds.GuildUpdate()

View File

@ -2,7 +2,7 @@ import Crossfire
import os.path import os.path
import sys import sys
print "Running python initialize script." Crossfire.Log(Crossfire.LogDebug, "Running python initialize script.")
sys.path.insert(0, os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python')) sys.path.insert(0, os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python'))
path = os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python/events/init') path = os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python/events/init')

View File

@ -17,6 +17,6 @@ if points:
else: else:
pass pass
else: else:
print 'Error, no points specified in %s on map %s' %(whoami,mapname) Crossfire.Log(Crossfire.LogError, 'Error, no points specified in %s on map %s' %(whoami,mapname))

View File

@ -32,7 +32,7 @@ if (guildname):
names.append(player.Name) names.append(player.Name)
if len(players) == 3: if len(players) == 3:
print '%s,%s and %s found guild %s' %(names[0], names[1], names[2], guildname) Crossfire.Log(Crossfire.LogInfo, '%s,%s and %s found guild %s' %(names[0], names[1], names[2], guildname))
CFGuilds.CFGuildHouses().establish(guildname) CFGuilds.CFGuildHouses().establish(guildname)
#Masterize them #Masterize them
@ -50,7 +50,7 @@ if (guildname):
else: else:
message = 'To purchase a guild requires two additional persons to stand on the alcoves above.' message = 'To purchase a guild requires two additional persons to stand on the alcoves above.'
else: else:
print 'Guild Purchase Error: %s, %s' %(guildname, activatorname) Crossfire.Log(Crossfire.LogError, 'Guild Purchase Error: %s, %s' %(guildname, activatorname))
message = 'Guild Purchase Error, please notify a DM' message = 'Guild Purchase Error, please notify a DM'
whoami.Say(message) whoami.Say(message)

View File

@ -56,7 +56,7 @@ if (guildname):
else: else:
message = 'No one is in the chair!' message = 'No one is in the chair!'
else: else:
print 'Guild Join Error: %s' %(guildname) Crossfire.Log(Crossfire.LogError, 'Guild Join Error: %s' %(guildname))
message = 'Guild Join Error, please notify a DM' message = 'Guild Join Error, please notify a DM'
whoami.Say(message) whoami.Say(message)

View File

@ -30,7 +30,7 @@ isDM=activator.DungeonMaster
log=CFLog.CFLog() log=CFLog.CFLog()
guildname=Crossfire.ScriptParameters() # 6 is say event guildname=Crossfire.ScriptParameters() # 6 is say event
print "Activated %s" %guildname Crossfire.Log(Crossfire.LogDebug, "Activated %s" %guildname)
if (guildname): if (guildname):
guild = CFGuilds.CFGuild(guildname) guild = CFGuilds.CFGuild(guildname)

View File

@ -19,10 +19,10 @@ if option:
inv = activator.CheckInventory(option) #Remove any previous disguise inv = activator.CheckInventory(option) #Remove any previous disguise
if inv: if inv:
inv.Remove() inv.Remove()
#print "removing tag" #Crossfire.Log(Crossfire.LogDebug, "removing tag")
if not whoami.Applied: #is the object is being applied if not whoami.Applied: #is the object is being applied
tag = activator.CreateInvisibleObjectInside(option) tag = activator.CreateInvisibleObjectInside(option)
tag.Name=option tag.Name=option
#print "adding tag" #Crossfire.Log(Crossfire.LogDebug, "adding tag")

View File

@ -44,7 +44,7 @@ def do_enemy():
msg = msg.replace('%e', whoami.Enemy.Name) msg = msg.replace('%e', whoami.Enemy.Name)
whoami.Say(msg) whoami.Say(msg)
said = said + str(whoami.Enemy.Count) + ';' said = said + str(whoami.Enemy.Count) + ';'
print 'said = ' + said Crossfire.Log(Crossfire.LogDebug, 'said = ' + said)
whoami.WriteKey('greet_enemy', said, 1) whoami.WriteKey('greet_enemy', said, 1)

View File

@ -29,7 +29,7 @@ def has_floor(x, y, name):
def find_food(chicken, x, y): def find_food(chicken, x, y):
obj = chicken.Map.ObjectAt(x, y) obj = chicken.Map.ObjectAt(x, y)
while obj != None: while obj != None:
#print obj.Name #Crossfire.Log(Crossfire.LogMonster, obj.Name)
if eat.has_key(obj.NamePl): if eat.has_key(obj.NamePl):
return obj return obj
obj = obj.Above obj = obj.Above