Add support for the "give" command, that allows a player to show an item to an NPC.
Useful when coupled with scripts to write "bring me back something" quests. Add support for the "give" command to the Mad Mage, with a generic "show me and I'll talk" kind of system. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@8018 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
c0a9b6c0cd
commit
6573ac0db9
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2007-12-23 Yann (gros) Chachkoff
|
||||
A python/maps/scorn
|
||||
A python/maps/scorn/towers
|
||||
A python/maps/scorn/towers/mad_mage
|
||||
A python/maps/scorn/towers/mad_mage/mad_mage_user.py
|
||||
A python/maps/scorn/towers/mad_mage/brewery_letter
|
||||
A python/commands
|
||||
A python/commands/give.py
|
||||
A python/events/init/give_command.py
|
||||
Add support for the "give" command, that allows a player to show an item to an NPC.
|
||||
Useful when coupled with scripts to write "bring me back something" quests.
|
||||
Add support for the "give" command to the Mad Mage, with a generic "show me and
|
||||
I'll talk" kind of system.
|
||||
|
||||
2007-12-22 tchize
|
||||
scorn/misc/cityhall
|
||||
Cityhall is now closed at night :) Petition board and bonus amulet stay accessible.
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
import Crossfire
|
||||
|
||||
def getReceiver(me, direction):
|
||||
map = me.Map
|
||||
x = me.X
|
||||
y = me.Y
|
||||
|
||||
if direction==2:
|
||||
ob = map.ObjectAt(x+1, y-1)
|
||||
elif direction==3:
|
||||
ob = map.ObjectAt(x+1, y)
|
||||
elif direction==4:
|
||||
ob = map.ObjectAt(x+1, y+1)
|
||||
elif direction==5:
|
||||
ob = map.ObjectAt(x, y+1)
|
||||
elif direction==6:
|
||||
ob = map.ObjectAt(x-1, y+1)
|
||||
elif direction==7:
|
||||
ob = map.ObjectAt(x-1, y)
|
||||
elif direction==8:
|
||||
ob = map.ObjectAt(x-1, y-1)
|
||||
else:
|
||||
ob = map.ObjectAt(x, y-1)
|
||||
return ob
|
||||
|
||||
whoami = Crossfire.WhoAmI()
|
||||
name = Crossfire.ScriptName()
|
||||
parms = Crossfire.ScriptParameters()
|
||||
|
||||
if not parms:
|
||||
whoami.Message("Show which object ?")
|
||||
else:
|
||||
op = whoami.CheckInventory(parms)
|
||||
if not op:
|
||||
whoami.Message('No matching object found to give.')
|
||||
else:
|
||||
direction = whoami.Facing
|
||||
receiver = getReceiver(whoami, direction)
|
||||
if not receiver:
|
||||
whoami.Message('Nobody to give this to.')
|
||||
else:
|
||||
top = receiver
|
||||
while(top):
|
||||
next = top.Above
|
||||
top.Event(whoami,op, "give", 0)
|
||||
top = next
|
|
@ -0,0 +1,2 @@
|
|||
import Crossfire
|
||||
Crossfire.RegisterCommand("give", "/python/commands/give", 0)
|
|
@ -0,0 +1,4 @@
|
|||
Mmm...
|
||||
This is written in ancient Daigojij, a language that was once spoken by a race of dwarves living on the Old World. It isn't used nowadays on Bigworld anymore, but no worries: I can easily read it!
|
||||
Mmm...
|
||||
This seems to be the plan for some milking machine. I wonder what it is for, and I doubt you could fit a regular cow in that device...
|
|
@ -0,0 +1,16 @@
|
|||
import Crossfire
|
||||
import os
|
||||
|
||||
whoami = Crossfire.WhoAmI()
|
||||
whoisother = Crossfire.WhoIsOther()
|
||||
parms = Crossfire.WhatIsMessage()
|
||||
|
||||
if parms=="give":
|
||||
key = whoisother.ReadKey("mad_mage_marker")
|
||||
if key:
|
||||
file = open(os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python/maps/scorn/towers/mad_mage',key), "r")
|
||||
for line in file:
|
||||
whoami.Say(line)
|
||||
file.close()
|
||||
else:
|
||||
whoami.Say("Yes?")
|
Loading…
Reference in New Issue