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-b93c2d0d6712master
parent
aa0729ab16
commit
fdbcb1b6ff
|
@ -63,4 +63,3 @@ class CFBank:
|
|||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
|
|
@ -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.')
|
||||
|
|
|
@ -154,4 +154,3 @@ class CFData:
|
|||
keys.remove('#')
|
||||
keys.sort()
|
||||
return keys
|
||||
|
||||
|
|
|
@ -357,4 +357,3 @@ class Dialog:
|
|||
finished = finished + ";"
|
||||
finished = finished + key + ":" + value
|
||||
self.__character.WriteKey("dialog_" + self.__location, finished, 1)
|
||||
|
||||
|
|
|
@ -49,4 +49,3 @@ class SlotMachine:
|
|||
elif limit < self.minpot:
|
||||
self.slotdb[self.slotname] = self.minpot
|
||||
return self.slotdb[self.slotname]
|
||||
|
||||
|
|
|
@ -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)):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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 <friend\'s name>\'.')
|
||||
whoami.Say('To receive your packages, say \'receive\'.')
|
||||
|
||||
|
|
|
@ -43,4 +43,4 @@ else:
|
|||
while(top):
|
||||
next = top.Above
|
||||
top.Event(whoami,op, "give", 0)
|
||||
top = next
|
||||
top = next
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
import Crossfire
|
||||
Crossfire.RegisterCommand("give", "/python/commands/give", 0)
|
||||
Crossfire.RegisterCommand("give", "/python/commands/give", 0)
|
||||
|
|
|
@ -24,4 +24,3 @@ activator = Crossfire.WhoIsActivator()
|
|||
|
||||
log = CFLog.CFLog()
|
||||
log.kick_update(activator.Name)
|
||||
|
||||
|
|
|
@ -32,4 +32,3 @@ if total > 0:
|
|||
activator.Write('You have some mail waiting for you')
|
||||
else:
|
||||
activator.Write('No mail...')
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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 <amount>'
|
||||
message='Let me know how many jade coins you want to pay. Say pay <amount>'
|
||||
|
||||
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)
|
||||
|
|
|
@ -85,4 +85,3 @@ else:
|
|||
message = 'Guild Guardian Error, please notify a DM'
|
||||
|
||||
whoami.Say(message)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 <name>\n-remove <member>\n-info <member>\n-promote <member>\n-demote <member>\n-status <member> <status>\n-guildstatus <status>'
|
||||
else:
|
||||
message='\nList of commands:\n-list\n-remove <member>\n-info <member>\n-promote <member>\n-demote <member>\n-status <member> <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 <member_name>"'
|
||||
|
||||
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 <member_name>"'
|
||||
|
||||
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 <member_name>"'
|
||||
|
||||
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 <member_name>"'
|
||||
|
||||
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 <member_name> <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 <membername>"'
|
||||
|
||||
#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 <status>\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 <name>\n-remove <member>\n-info <member>\n-promote <member>\n-demote <member>\n-status <member> <status>\n-guildstatus <status>'
|
||||
else:
|
||||
message='\nList of commands:\n-list\n-remove <member>\n-info <member>\n-promote <member>\n-demote <member>\n-status <member> <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 <member_name>"'
|
||||
|
||||
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 <member_name>"'
|
||||
|
||||
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 <member_name>"'
|
||||
|
||||
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 <member_name>"'
|
||||
|
||||
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 <member_name> <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 <membername>"'
|
||||
|
||||
#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 <status>\n%s"' %str(guildhouse.status)
|
||||
|
||||
else:
|
||||
message = 'What did you need?'
|
||||
|
||||
else:
|
||||
message = 'Board Error'
|
||||
whoami.Say(message)
|
||||
|
|
|
@ -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)
|
||||
whoami.Say(message)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 ^_-
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -25,4 +25,3 @@ if option:
|
|||
tag = activator.CreateInvisibleObjectInside(option)
|
||||
tag.Name=option
|
||||
#Crossfire.Log(Crossfire.LogDebug, "adding tag")
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)):
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue