Crossfire Server, Trunk
takeitem.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # takeitem.py
3 # This is one of the files that can be called by an npc_dialog,
4 # The following code runs when a dialog has a post rule of 'takeitem'
5 # The syntax is ["takeitem", "itemtotake", "quantitytotake"]
6 # "quantitytotake" is optional, if it is missing, then 1 is assumed.
7 # if it is 0, then *all* instances of the item are taken.
8 # The player must have a sufficiant quantity of the item being taken
9 # This should normally be determined by doing an "item" check in the
10 # pre-block of the rule
11 # items are matched by item name, not arch name.
12 
18 
19 itemname = args[0]
20 if len(args) == 2:
21  quantity = int(args[1])
22 else:
23  quantity = 1
24 Crossfire.Log(Crossfire.LogDebug, "CFDialog: trying to take: %s of item %s from character %s" %(quantity, itemname, character.Name ))
25 if itemname == "money":
26  paid = character.PayAmount(int(quantity))
27  if paid == 0:
28  Crossfire.Log(Crossfire.LogError, "Tried to make player %s pay more than they had" %(character.Name))
29  character.Write("You give {} to {}".format(Crossfire.CostStringFromValue(int(quantity)), speaker.Name))
30 else:
31  inv = character.CheckInventory(itemname)
32  if inv:
33  if quantity == 0:
34  character.Write("You give {} {} to {}".format(inv.Quantity, inv.NameSingular if inv.Quantity == 1 else inv.NamePl, speaker.Name))
35  inv.Remove()
36  else:
37  character.Write("You give {} {} to {}".format(int(quantity), inv.NameSingular if quantity == 1 else inv.NamePl, speaker.Name))
38  status = CFItemBroker.Item(inv).subtract(int(quantity))
39  if status == 0:
40  Crossfire.Log(Crossfire.LogError, "Dialog script tried to remove more items than available from player %s" %(character.Name))
41  # we might have been wearing an item that was taken.
42  character.Fix()
43  else:
44  Crossfire.Log(Crossfire.LogError, "Dialog script tried to remove non-existant item from player %s" %(character.Name))
CFItemBroker.Item
Definition: CFItemBroker.py:15
format
Python Guilds Quick outline Add a guild(mapmakers) this is still a problem *after dropping the token to gain access to the stove a woodfloor now appears which is Toolshed Token(found in Guild_HQ) *Note also have multiple gates in place to protect players and items from the mana explosion drop x for Jewelers room *Jewelers room works just need to determine what x is drop x for Thaumaturgy room *Thaumaturgy room works just need to determine what x is drop gold dropping the Firestar named fearless allows access to but I suspect that the drop location of the chest is not as intended because the player is in the way once you enter the chest the exit back to the basement is things such as the message et al reside on teleporters which then transport items to the map as they are when the map is already purchased items reappear in that area From my this does not cause any problems at the moment But this should be corrected fixed Major it s now possible to buy guilds Ryo Update Uploaded guild package to CVS Changes the cauldrons and the charging room I spent a while agonizing over They were natural guild enhancements but much too much value for any reasonable expense to buy them Then I thought that they should be pay access but at a greatly reduced rate SO when you buy a forge or whatever for your guild it is available on a perplayer daily rate but it will be accessable for testing and to DMs to play with Like I said lots still to do with the especially comingt up with quest items for buying things like the new workshops and stuff One of the things I would like some input on would be proposals for additional fields for either the guildhouses or guild datafiles to play with Currently the Guildhouse but there is no reason we can t have more than one measure of a guild perhaps have dues relate to Dues and use points for some other suspended or inactive or when a guild is founded inactive active Guilds have the format
Definition: README.txt:140
make_face_from_files.int
int
Definition: make_face_from_files.py:32