diff --git a/python/commands/dip.py b/python/commands/dip.py new file mode 100644 index 000000000..6183f279f --- /dev/null +++ b/python/commands/dip.py @@ -0,0 +1,32 @@ +import Crossfire + +def find_fountain(pl): + below = pl.Below + while below is not None: + if below.ArchName == "fountain": + return below + below = below.Below + return None + +def dip(pl): + f = find_fountain(pl) + if f is None: + pl.Message("You must be at a fountain to dip an object into one.") + return False + + ob = pl.MarkedItem + if ob is None: + pl.Message("Mark the item that you would like to dip.") + return False + + name_before = ob.Name + + if ob.ArchName == "wbottle_empty": + ob.Quantity -= 1 + w = Crossfire.CreateObjectByName("water") + w.InsertInto(pl) + pl.Message("You fill the %s with water from the %s." % (name_before, f.Name)) + else: + pl.Message("You dip the %s into the %s. Nothing happens." % (name_before, f.Name)) + +dip(Crossfire.WhoAmI()) diff --git a/python/events/init/dip_command.py b/python/events/init/dip_command.py new file mode 100644 index 000000000..454264f70 --- /dev/null +++ b/python/events/init/dip_command.py @@ -0,0 +1,2 @@ +import Crossfire +Crossfire.RegisterCommand("dip", "/python/commands/dip", 0)