Exemple #1
0
    def do_pay(self, text):
        '''Handle player paying dues to the guild.'''
        if len(text) < 2:
            whoami.Say(
                "How much ya wanna pay %s?\nYou can specify amounts in " %
                (random.choice(buddylist)) +
                ', '.join(i.lower() for i in CoinTypes.keys()))
            return

        cost = text[1]
        type = ' '.join(text[2:])
        utype = type.upper()
        if not utype in CoinTypes.keys():
            whoami.Say("Sorry, I don't know what are %s" % type)
            return

        conversionfactor = CoinTypes.get(utype)
        total = int(cost) * conversionfactor
        if activator.PayAmount(total):
            guild = CFGuilds.CFGuild(self.guildname)
            guild.pay_dues(activator.Name, total)
            whoami.Say("%s, %s %s paid to the guild." %
                       (random.choice(remarklist), cost, type))
            bank = CFBank.CFBank(bankdatabase)
            bank.deposit(self.accountname, total)
        else:
            if cost > 1:
                whoami.Say("%s, you don't have %s %ss." %
                           (random.choice(exclaimlist), cost, type))
            else:
                whoami.Say("You don't have any %s, %s." %
                           (type, random.choice(buddylist)))
def CheckClearance(lParams,oActivator):
        
        ClearanceLevels={"Initiate":1,"Novice":2,"Guildman":3,"Journeyman":4,"Master":5,"GuildMaster":6}
        oGuild=CFGuilds.CFGuild(lParams[0])
        
        if oActivator.DungeonMaster==1:
                return True
        iClearanceLevel=ClearanceLevels.get(lParams[1],0)
        dGuildInfo=oGuild.info(oActivator.Name)
        
        if dGuildInfo==0:
            return False

        iClearanceApproved=ClearanceLevels.get(dGuildInfo['Rank'],0)
        if dGuildInfo["Status"]=='suspended':
                iClearanceApproved=0
                Crossfire.WhoIsActivator().Say("You are currently suspended from the guild.")
        elif dGuildInfo["Status"]=="probation":
                Crossfire.WhoIsActivator().Say("You are currently on probation.")
        if iClearanceLevel>iClearanceApproved:
                return False
        return True
Exemple #3
0
    def do_pay(self, text):
        '''Handle player paying dues to the guild.'''
        if len(text) < 3:
            whoami.Say(
                "How much ya wanna pay %s?\nYou can specify amounts in " %
                (random.choice(buddylist)) +
                ', '.join(i.lower() for i in CoinTypes.keys()))
            return

        cost = text[1]
        currency = ' '.join(text[2:])
        ucurrency = currency.upper()
        if not ucurrency in CoinTypes.keys():
            whoami.Say("Sorry, I don't know what %s are" % currency)
            return

        conversionfactor = CoinTypes.get(ucurrency)
        total = int(cost) * conversionfactor
        if total and activator.PayAmount(total):
            guild = CFGuilds.CFGuild(self.guildname)
            guild.pay_dues(activator.Name, total)
            whoami.Say("%s, %s %s paid to the guild." %
                       (random.choice(remarklist), cost, currency))
            bank = CFBank.CFBank(bankdatabase)
            bank.deposit(self.accountname, total)
        else:
            if total == 0:
                whoami.Say("Uh? Ya wanna trick me, %s." %
                           random.choice(buddylist))
            elif int(cost) > 1:
                plural = ''
                if ucurrency.endswith('NOTE'):
                    plural = 's'
                whoami.Say(
                    "%s, you don't have %s %s%s." %
                    (random.choice(exclaimlist), cost, currency, plural))
            else:
                whoami.Say("You don't have any %s, %s." %
                           (currency, random.choice(buddylist)))
Exemple #4
0
x4 = random.randint(21, 23)
y4 = random.randint(22, 24)

Curse = activator.Map.ObjectAt(int(x4), int(y4))

x3 = 1
y3 = 8
Params = Crossfire.ScriptParameters().split()
Approved = "Access granted" if CheckClearance(Params,
                                              activator) else "Access denied"
x1 = activator.X
Y1 = activator.Y
x = 26
y = 0
guildname = Params[0]
guild = CFGuilds.CFGuild(guildname)
guildrecord = CFGuilds.CFGuildHouses().info(guildname)
ActionRequired = Params[2]

# things which are not a player are ok
if activator.Type != Crossfire.Type.PLAYER:
    Approved = 'Access granted'

if (Approved != 'Access granted'):
    if (ActionRequired == "A"):
        activator.Teleport(Crossfire.ReadyMap('/scorn/misc/jail'), int(15),
                           random.choice([1, 3, 5, 9, 11]))
    elif (ActionRequired == "D"):
        Corpse.Name = str("%s's body" % (activator.Name))
        Corpse.Race = str("%s's Curse" % (activator.Name))
        Corpse.Weight = 1
import string

activator = Crossfire.WhoIsActivator()
activatorname = activator.Name
mymap = activator.Map
x = 32
y = 16
x1 = 36
y1 = 20
activatorx = activator.X
activatory = activator.Y
whoami = Crossfire.WhoAmI()

Params = Crossfire.ScriptParameters().split()

guild = CFGuilds.CFGuild(Params[0])
guildname = Params[0]

text = Crossfire.WhatIsMessage().split()
guildrecord = CFGuilds.CFGuildHouses().info(guildname)
found = 0
if text:
    if text[0].upper() == 'ENTER':
        #print guildrecord
        if guildrecord['Status'] == 'inactive':
            message = 'This guild is currently inactive and available to be bought.'
        elif guildrecord['Status'] == 'suspended':
            message = 'This guild is currently under suspension.\nPlease see a DM for more information'
        elif guildrecord['Status'] == 'probation':
            activator.Write(
                'This guild is currently under probation.\nPlease see a DM for more information'
Exemple #6
0
    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' % (
import CFGuilds
import Crossfire
Crossfire.Log(Crossfire.LogDebug, "Updating Guilds")
CFGuilds.GuildUpdate()
Exemple #8
0
    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')

            #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
    elif len(players) == 2:
        message = "To purchase a guild requires one additional person to stand on the alcoves above."
    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'
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]))

Crossfire.SetReturnValue(1)
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)
# Copyright (C) 2002 Joris Bontje
#
# 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 [email protected]
#
# Updated to use new path functions in CFPython and Bank
# acount cleanup - Todd Mitchell

import Crossfire
import CFGuilds

activator = Crossfire.WhoIsActivator()
name = activator.Name

in_guild = CFGuilds.SearchGuilds(name)
if in_guild:
    CFGuilds.CFGuild(in_guild).remove_member(name)