Inform of given/taken items during dialogs
parent
0b8d7dfe12
commit
20b385f928
|
@ -19,6 +19,7 @@ if itemname == "money":
|
|||
if quantity % 50 > 0:
|
||||
id = character.CreateObject('silver coin')
|
||||
CFItemBroker.Item(id).add(int(quantity % 10))
|
||||
character.Write("{} gives you {}".format(speaker.Name, Crossfire.CostStringFromValue(quantity)))
|
||||
else:
|
||||
# what we will do, is increase the number of items the NPC is holding, then
|
||||
# split the stack into the players inventory.
|
||||
|
@ -45,6 +46,7 @@ else:
|
|||
quantity = 1
|
||||
newob = nextob.Clone(0)
|
||||
newob.Quantity = quantity
|
||||
character.Write("{} gives you {} {}".format(speaker.Name, quantity, newob.Name))
|
||||
newob.InsertInto(character)
|
||||
nextob=nextob.Below
|
||||
else:
|
||||
|
@ -55,6 +57,7 @@ else:
|
|||
CFItemBroker.Item(inv).add(quantity+1)
|
||||
newob = inv.Split(quantity)
|
||||
|
||||
character.Write("{} gives you {} {}".format(speaker.Name, quantity, newob.Name))
|
||||
newob.InsertInto(character)
|
||||
else:
|
||||
# ok, we didn't find any
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
itemname = args[0]
|
||||
if len(args) == 2:
|
||||
quantity = args[1]
|
||||
quantity = int(args[1])
|
||||
else:
|
||||
quantity = 1
|
||||
Crossfire.Log(Crossfire.LogDebug, "CFDialog: trying to take: %s of item %s from character %s" %(quantity, itemname, character.Name ))
|
||||
|
@ -26,12 +26,15 @@ if itemname == "money":
|
|||
paid = character.PayAmount(int(quantity))
|
||||
if paid == 0:
|
||||
Crossfire.Log(Crossfire.LogError, "Tried to make player %s pay more than they had" %(character.Name))
|
||||
character.Write("You give {} to {}".format(Crossfire.CostStringFromValue(int(quantity)), speaker.Name))
|
||||
else:
|
||||
inv = character.CheckInventory(itemname)
|
||||
if inv:
|
||||
if quantity == 0:
|
||||
character.Write("You give {} {} to {}".format(inv.Quantity, inv.NameSingular if inv.Quantity == 1 else inv.NamePl, speaker.Name))
|
||||
inv.Remove()
|
||||
else:
|
||||
character.Write("You give {} {} to {}".format(int(quantity), inv.NameSingular if quantity == 1 else inv.NamePl, speaker.Name))
|
||||
status = CFItemBroker.Item(inv).subtract(int(quantity))
|
||||
if status == 0:
|
||||
Crossfire.Log(Crossfire.LogError, "Dialog script tried to remove more items than available from player %s" %(character.Name))
|
||||
|
|
Loading…
Reference in New Issue