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