Add new dragon hangars

Retire the old dragon hangars in favor of new talking dragons who will
take you places if you pay them money.

When placed on world maps, these dragons will automatically compute fare
based on the destination location (relative to them).
master^2
Kevin Zheng 2024-03-16 18:04:05 -07:00
parent 4cd2f06db0
commit 1ac90a9881
17 changed files with 335 additions and 60773 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ enter_x 15
enter_y 30
msg
Created: 2001-03-06 Philipp Currlin (philipp.currlin@epost.de)
Modified: 2022-07-18 Rick Tanner
Modified: 2024-03-16 Kevin Zheng
endmsg
reset_group stoneville_dragon-hangar
end
@ -2837,9 +2837,9 @@ x 15
y 30
end
arch stair_up_2
slaying hangar
hp 15
sp 33
slaying /world/world_103_127
hp 3
sp 10
x 15
y 30
end
@ -3047,13 +3047,6 @@ arch dungeon_floor
x 16
y 30
end
arch stair_up_4
slaying hangar
hp 16
sp 33
x 16
y 30
end
arch dungeon_floor
x 16
y 31

View File

@ -1,10 +1,10 @@
arch map
name transport
width 7
height 1
height 2
msg
Created: 2023-04-02 Kevin Zheng
Modified: 2023-04-02 Kevin Zheng
Modified: 2024-03-16 Kevin Zheng
endmsg
end
arch creator
@ -41,3 +41,15 @@ x 1
connected 5000
elevation 602
end
arch dragon_exit
name Dragon Express
x 2
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ enter_x 5
enter_y 18
msg
Created: 1996-02-25
Modified: 2022-01-05 Kevin Zheng
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
background_music lonetown
@ -2909,26 +2909,10 @@ arch pstone_1
x 22
y 16
end
arch dungeon_magic
x 22
y 17
end
arch grass
x 22
y 17
end
arch barn
name Dragon Hangar
slaying /pup_land/lone_town/dragonhangar/hangar
hp 16
sp 1
x 22
y 17
end
arch dungeon_magic
x 22
y 18
end
arch grass
x 22
y 18
@ -3031,18 +3015,10 @@ arch pstone_1
x 23
y 16
end
arch dungeon_magic
x 23
y 17
end
arch grass
x 23
y 17
end
arch dungeon_magic
x 23
y 18
end
arch grass
x 23
y 18

View File

@ -6,7 +6,7 @@ width 30
height 30
msg
Created: 1996-02-07
Modified: 2023-06-09 Rick Tanner
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
background_music nurnberg
@ -3418,6 +3418,11 @@ arch grass
x 20
y 27
end
arch barn
name Dragon Hangar
x 20
y 27
end
arch grass
x 20
y 28
@ -3761,11 +3766,11 @@ arch cobblestones
x 22
y 26
end
arch grass
arch earth
x 22
y 27
end
arch grass
arch earth
x 22
y 28
end
@ -3942,11 +3947,24 @@ arch cobblestones
x 23
y 26
end
arch grass
arch earth
x 23
y 27
end
arch grass
arch dragon_exit
name Dragon Express
x 23
y 27
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch earth
x 23
y 28
end
@ -4084,11 +4102,11 @@ arch cobblestones
x 24
y 26
end
arch grass
arch earth
x 24
y 27
end
arch grass
arch earth
x 24
y 28
end
@ -4214,11 +4232,11 @@ arch cobblestones
x 25
y 26
end
arch grass
arch earth
x 25
y 27
end
arch grass
arch earth
x 25
y 28
end
@ -4363,7 +4381,7 @@ arch grass
x 26
y 21
end
arch cobblestones
arch grass
x 26
y 22
end
@ -4371,19 +4389,11 @@ arch grass
x 26
y 23
end
arch barn
name Dragon Hangar
slaying dragonhangar/hangar
hp 15
sp 1
x 26
y 23
end
arch grass
x 26
y 24
end
arch cobblestones
arch grass
x 26
y 25
end
@ -4399,7 +4409,7 @@ arch grass
x 26
y 27
end
arch grass
arch earth
x 26
y 28
end

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ enter_x 10
enter_y 2
msg
Created: 1996-04-05
Modified: 2022-01-05 Kevin Zheng
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
end
@ -1320,15 +1320,17 @@ x 9
y 1
end
arch dragon_exit
name Dragon to Scorn
slaying /world/world_104_115
msg
The dragon flies high up into the sky, heading towards Scorn...
endmsg
hp 43
sp 24
name Dragon Express
x 9
y 1
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch cobblestones2
x 9

View File

@ -0,0 +1,114 @@
"""
dragon.py -- talking dragon that flies you places
Kevin Zheng 2024
This replaces the old dragon hangers, where every location that wanted a dragon
hanger needed to copy/paste a template map.
Usage: Put an event_say and event_apply handler that calls this script on a
dragon_exit.
"""
import math
import re
import Crossfire
world_map_path_matcher = r"/world/world_(\d\d\d)_(\d\d\d)";
activator = Crossfire.WhoIsActivator()
event = Crossfire.WhatIsEvent()
whoami = Crossfire.WhoAmI()
price_per_worldmap_tile = 5*50 # price per world map tile traveled, in money units (silver)
max_fare = 150*50 # maximum fare per trip, in money units (silver)
# All the fun places we can go! Tuple of map path and X, Y coordinate.
destinations = {
'Port Joseph': ('/world/world_101_114', 16, 39),
'Red Town': ('/pup_land/rainbow/station', 7, 3),
'Wolfsburg': ('/world/world_128_109', 35, 13),
'Brest': ('/world/world_107_123', 32, 30),
'Navar': ('/world/world_121_116', 37, 46),
'Darcap': ('/world/world_116_102', 29, 37),
'Stoneville': ('/world/world_103_127', 5, 15),
'Scorn': ('/world/world_105_115', 5, 37),
'Lake Country': ('/world/world_109_126', 16, 20),
'Santo Dominion': ('/world/world_102_108', 17, 12),
# 'Nurnberg': ('/pup_land/nurnberg/city', 25, 15), # needs a passport check
}
def search_destination(name):
if name in destinations:
return destinations[name]
else:
return None
def world_map_coord(path):
"""Try to extract the coordinates from a world map path."""
groups = re.match(world_map_path_matcher, path)
if groups is not None:
coords = groups.group(1, 2)
cx, cy = int(coords[0]), int(coords[1])
return cx, cy
return None
def fare(dest):
curr_coord = world_map_coord(whoami.Map.Path)
dest_coord = world_map_coord(dest[0])
if curr_coord is None or dest_coord is None:
return max_fare
else:
return min(max_fare, dist_fare(curr_coord, dest_coord))
def dist_fare(start, end):
dist = math.hypot(end[0] - start[0], end[1] - start[1])
return math.ceil(dist * price_per_worldmap_tile)
# State for each player. Dict (player_name: str, state) where state is
# (destination: str, price: int).
state = Crossfire.GetPrivateDictionary()
def handle_say():
msg = Crossfire.WhatIsMessage()
text = msg.split()
if text[0] == "what":
whoami.Say("Dragon Express can whisk you to one of %d locations for a small fee. Travel faster today!" % len(destinations))
return
elif text[0] == "where":
whoami.Say("We have %d exciting destinations: %s. Where would you like to go?" % (len(destinations), ", ".join(destinations.keys())))
return
elif text[0] == "yes" and activator.Name in state:
dest_name = state[activator.Name][0]
price = state[activator.Name][1]
dest = destinations[dest_name]
m = Crossfire.ReadyMap(dest[0])
if not m:
whoami.Say("Oops, it looks like the landing site there is not clear. Let's try to go somewhere else.")
elif activator.PayAmount(price):
activator.Message("You pay the %s %s" % (whoami.Name, Crossfire.CostStringFromValue(price)))
activator.Message("You hop on the %s and it takes off. You enjoy a pleasant ride above the clouds before arriving at %s." % (whoami.Name, dest_name))
activator.Teleport(m, dest[1], dest[2])
else:
whoami.Say("It doesn't look like you can afford this trip. Please come back when you can.")
del(state[activator.Name])
return
dest = search_destination(msg)
if dest is not None:
dest_name = msg
price = fare(dest)
whoami.Say("Alright, let's go to %s. That will cost %s. Is that okay?" % (msg, Crossfire.CostStringFromValue(price)))
Crossfire.AddReply("yes", "Okay, let's go.")
Crossfire.AddReply("no", "No thanks.")
state[activator.Name] = (dest_name, price)
else:
whoami.Say("Welcome to Dragon Express. Where can I take you today?")
Crossfire.AddReply("what", "What is Dragon Express?")
Crossfire.AddReply("where", "Where can you take me?")
Crossfire.SetReturnValue(1)
if event.Subtype == Crossfire.EventType.SAY:
handle_say()
else:
whoami.Say("Hey, you can't get on without paying!")

View File

@ -9,7 +9,7 @@ enter_x 1
enter_y 1
msg
Created: 2002-02-19
Modified: 2023-04-02 Kevin Zheng
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_102_107
@ -11282,17 +11282,17 @@ x 37
y 14
elevation 5124
end
arch grass
arch earth
x 37
y 15
elevation 5117
end
arch brush
arch earth
x 37
y 16
elevation 5070
end
arch brush
arch earth
x 37
y 17
elevation 4418
@ -11595,21 +11595,38 @@ x 38
y 14
elevation 4605
end
arch brush
arch earth
x 38
y 15
elevation 4837
end
arch brush
arch dragon_exit
name Dragon Express
x 38
y 15
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch earth
x 38
y 16
elevation 4799
end
arch brush
arch earth
x 38
y 17
elevation 4741
end
arch lamppost
x 38
y 17
end
arch brush
x 38
y 18
@ -11900,17 +11917,17 @@ arch evergreens2
x 39
y 14
end
arch brush
arch earth
x 39
y 15
elevation 5599
end
arch brush
arch earth
x 39
y 16
elevation 4830
end
arch brush
arch earth
x 39
y 17
elevation 5306
@ -12173,17 +12190,17 @@ x 40
y 14
elevation 5445
end
arch brush
arch earth
x 40
y 15
elevation 5150
end
arch brush
arch earth
x 40
y 16
elevation 5244
end
arch brush
arch earth
x 40
y 17
elevation 4984

View File

@ -4,7 +4,7 @@ region stoneville
width 50
height 50
msg
Modified: 2023-06-16 Rick Tanner
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_103_126
@ -801,8 +801,9 @@ y 9
end
arch barn
name Stoneville Dragon Hangar
slaying /dragonisland/hangar
slaying /dragonisland/hangar2
hp 15
sp 30
x 3
y 9
end
@ -1332,19 +1333,15 @@ x 5
y 8
elevation 2730
end
arch grass
arch earth
x 5
y 9
end
arch grass
arch earth
x 5
y 10
end
arch grass
x 5
y 11
end
arch tree3
arch earth
x 5
y 11
end
@ -1610,15 +1607,28 @@ x 6
y 8
elevation 2762
end
arch grass
arch earth
x 6
y 9
end
arch grass
arch dragon_exit
name Dragon Express
x 6
y 9
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch earth
x 6
y 10
end
arch grass
arch earth
x 6
y 11
end
@ -1866,19 +1876,19 @@ x 7
y 8
elevation 2960
end
arch grass
arch earth
x 7
y 9
end
arch grass
arch earth
x 7
y 10
end
arch tree3
arch earth
x 7
y 10
y 11
end
arch grass
arch lamppost
x 7
y 11
end
@ -2124,15 +2134,15 @@ arch grass
x 8
y 8
end
arch grass
arch earth
x 8
y 9
end
arch grass
arch earth
x 8
y 10
end
arch grass
arch earth
x 8
y 11
end

View File

@ -9,7 +9,7 @@ enter_x 1
enter_y 1
msg
Created: 2001-02-16
Modified: 2019-01-01 Jason Zheng
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_104_114
@ -11984,15 +11984,17 @@ x 42
y 23
end
arch dragon_exit
name Dragon to Pup Land Dragon Terminal
slaying /pup_land/terminal
msg
The dragon flies high up into the sky, heading towards the Pup Land Dragon Terminal...
endmsg
hp 10
sp 2
name Dragon Express
x 42
y 23
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch dungeon_magic
x 42

View File

@ -3,7 +3,7 @@ name world_109_125
width 50
height 50
msg
Modified: 2022-04-18 Rick Tanner
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_109_124
@ -6852,10 +6852,7 @@ y 47
elevation 95
end
arch barn
name dragon hangar - Lake Country
slaying /lake_country/dragon_hangar/hangar
hp 15
sp 1
name dragon hangar
x 25
y 47
end
@ -7964,17 +7961,17 @@ x 29
y 45
elevation 1450
end
arch jungle_1
arch earth
x 29
y 46
elevation 1288
end
arch jungle_1
arch earth
x 29
y 47
elevation 1263
end
arch woods_3
arch earth
x 29
y 48
elevation 1020
@ -8209,17 +8206,30 @@ x 30
y 45
elevation 1489
end
arch jungle_1
arch earth
x 30
y 46
elevation 1307
end
arch woods_3
arch earth
x 30
y 47
elevation 1449
end
arch jungle_1
arch dragon_exit
name Dragon Express
x 30
y 47
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch earth
x 30
y 48
elevation 1699
@ -8460,17 +8470,17 @@ x 31
y 45
elevation 762
end
arch grass
arch earth
x 31
y 46
elevation 812
end
arch jungle_1
arch earth
x 31
y 47
elevation 1484
end
arch woods_3
arch earth
x 31
y 48
elevation 2005
@ -8710,17 +8720,17 @@ x 32
y 45
elevation 2846
end
arch woods
arch earth
x 32
y 46
elevation 2413
end
arch jungle_1
arch earth
x 32
y 47
elevation 1191
end
arch jungle_1
arch earth
x 32
y 48
elevation 2359

View File

@ -4,7 +4,7 @@ region darcap
width 50
height 50
msg
Modified: 2022-03-27 Rick Tanner
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_116_102
@ -5667,6 +5667,11 @@ x 19
y 4
elevation 411
end
arch barn
name Dragon Hangar
x 19
y 4
end
arch brush
x 19
y 5
@ -6263,17 +6268,17 @@ x 21
y 2
elevation 896
end
arch brush
arch earth
x 21
y 3
elevation 541
end
arch brush
arch earth
x 21
y 4
elevation 110
end
arch brush
arch earth
x 21
y 5
elevation 76
@ -6600,17 +6605,34 @@ x 22
y 2
elevation 1013
end
arch brush
arch earth
x 22
y 3
elevation 253
end
arch brush
arch lamppost
x 22
y 3
end
arch earth
x 22
y 4
elevation 586
end
arch brush
arch dragon_exit
name Dragon Express
x 22
y 4
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch earth
x 22
y 5
elevation 595
@ -6941,17 +6963,17 @@ x 23
y 2
elevation 999
end
arch brush
arch earth
x 23
y 3
elevation 967
end
arch brush
arch earth
x 23
y 4
elevation 865
end
arch brush
arch earth
x 23
y 5
elevation 708
@ -7230,17 +7252,17 @@ x 24
y 2
elevation 752
end
arch brush
arch earth
x 24
y 3
elevation 944
end
arch brush
arch earth
x 24
y 4
elevation 996
end
arch brush
arch earth
x 24
y 5
elevation 776

View File

@ -8,7 +8,7 @@ height 50
enter_x 1
enter_y 1
msg
Modified: 2023-12-06 Rick Tanner
Modified: 2024-03-16 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_121_116
@ -7573,9 +7573,6 @@ elevation 4602
end
arch barn
name Navar Dragon Hangar
slaying /navar_city/dragon_hangar/hangar
hp 15
sp 1
x 28
y 36
end
@ -8436,19 +8433,11 @@ x 31
y 35
elevation 1666
end
arch tree3
x 31
y 35
end
arch grass_only
x 31
y 36
elevation 1666
end
arch tree3
x 31
y 36
end
arch grass_only
x 31
y 37
@ -8712,17 +8701,17 @@ x 32
y 33
elevation 3434
end
arch steppe
arch earth
x 32
y 34
elevation 3756
end
arch steppe
arch earth
x 32
y 35
elevation 4209
end
arch hills_rocky
arch earth
x 32
y 36
elevation 4218
@ -8997,17 +8986,34 @@ x 33
y 33
elevation 2098
end
arch steppe
arch earth
x 33
y 34
elevation 3676
end
arch hills
arch lamppost
x 33
y 34
end
arch earth
x 33
y 35
elevation 4368
end
arch steppe
arch dragon_exit
name Dragon Express
x 33
y 35
arch event_say
title Python
slaying /python/monsters/dragon.py
end
arch event_apply
title Python
slaying /python/monsters/dragon.py
end
end
arch earth
x 33
y 36
elevation 4599
@ -9278,17 +9284,17 @@ x 34
y 33
elevation 2199
end
arch hills
arch earth
x 34
y 34
elevation 3623
end
arch hills
arch earth
x 34
y 35
elevation 4259
end
arch hills
arch earth
x 34
y 36
elevation 4324
@ -9601,17 +9607,17 @@ x 35
y 33
elevation 3137
end
arch hills
arch earth
x 35
y 34
elevation 3573
end
arch hills
arch earth
x 35
y 35
elevation 4048
end
arch hills
arch earth
x 35
y 36
elevation 3903