Crossfire Server, Trunk
commongive.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # commongive.py
3 # This is a common block of 'give' code to handle give item and give contents.
4 
5 itemname = args[0]
6 if len(args) == 2:
7  quantity = int(args[1])
8 else:
9  quantity = 1
10 if itemname == "money":
11  # we can't guarentee that the player has any particular type of coin already
12  # so create the object first, then add 1 less than the total.
13  if quantity >= 50:
14  id = character.CreateObject('platinum coin')
15  CFItemBroker.Item(id).add(int(quantity/50))
16  if quantity % 50 > 0:
17  id = character.CreateObject('gold coin')
18  CFItemBroker.Item(id).add(int((quantity % 50)/10))
19  if quantity % 50 > 0:
20  id = character.CreateObject('silver coin')
21  CFItemBroker.Item(id).add(int(quantity % 10))
22  character.Write("{} gives you {}".format(speaker.Name, Crossfire.CostStringFromValue(quantity)))
23 else:
24  # what we will do, is increase the number of items the NPC is holding, then
25  # split the stack into the players inventory.
26  # first we will check if there is an NPC_Gift_Box, and look in there.
27  lookin = speaker.CheckInventory("NPC_Gift_Box")
28  if lookin:
29  inv = lookin.CheckInventory(itemname)
30  if not inv:
31  # ok, the NPC has no 'Gift Box', we'll check the other items.
32  inv = speaker.CheckInventory(itemname)
33  else:
34  inv = speaker.CheckInventory(itemname)
35 
36  if inv:
37  if contents:
38  nextob=inv.Inventory
39  while nextob:
40  # when giving the contents of a container, always give the
41  # number of items in the container, not the quantity number.
42  quantity = nextob.Quantity
43  if quantity == 0:
44  # if quantity is 0, then we need to set it to one, otherwise bad things happen.
45  nextob.Quantity = 1
46  quantity = 1
47  newob = nextob.Clone(0)
48  newob.Quantity = quantity
49  character.Write("{} gives you {} {}".format(speaker.Name, quantity, newob.Name))
50  newob.InsertInto(character)
51  nextob=nextob.Below
52  else:
53  if quantity == 0:
54  nextob.Quantity = 2
55  quantity = 1
56  else:
57  CFItemBroker.Item(inv).add(quantity+1)
58  newob = inv.Split(quantity)
59 
60  character.Write("{} gives you {} {}".format(speaker.Name, quantity, newob.Name))
61  newob.InsertInto(character)
62  else:
63  # ok, we didn't find any
64  Crossfire.Log(Crossfire.LogError, "Dialog script tried to give a non-existant item to a player")
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