From 5f1609c4f99d98e2c6d26de71e4219e4658e722a Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sun, 29 Apr 2007 16:21:23 +0000 Subject: [PATCH] Wagon that should facilitate player's moving between towns. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@6148 282e977c-c81d-0410-88c4-b93c2d0d6712 --- python/items/roll-o-matic.py | 121 +++++++ world/world_105_115 | 673 ++++++++++++++++++----------------- 2 files changed, 465 insertions(+), 329 deletions(-) create mode 100644 python/items/roll-o-matic.py diff --git a/python/items/roll-o-matic.py b/python/items/roll-o-matic.py new file mode 100644 index 000000000..a2f7a872e --- /dev/null +++ b/python/items/roll-o-matic.py @@ -0,0 +1,121 @@ +# Script for the roll-o-matic. +# Idea courtesy Alex Schultz. +# +# Copyright 2007 Nicolas Weeger +# Released as GPL +# +# This script makes its item move following tiles, in direction specified by a player + +import Crossfire + +key_direction = 'rom_dir' +key_follow = 'rom_follow' + +dir_x = [ 0, 0, 1, 1, 1, 0, -1, -1, -1 ] +dir_y = [ 0, -1, -1, 0, 1, 1, 1, 0, -1 ] + +def find_floor(x, y): + obj = me.Map.ObjectAt(x, y) + while obj != None: + if obj.Floor == 1: + return obj.ArchName + obj = obj.Above + return '' + +def find_player(): + obj = me.Map.ObjectAt(me.X, me.Y) + while obj != None: + if obj.Type == Crossfire.Type.PLAYER: + return obj + obj = obj.Above + return None + +def has_floor(x, y, name): + obj = me.Map.ObjectAt(x, y) + while obj != None: + if obj.Floor == 1 and obj.ArchName == name: + return True + obj = obj.Above + return False + + +def abs_dir(d): + while d < 1: + d = d + 8 + while d > 8: + d = d - 8 + return d + +def handle_move(): + want_dir = me.ReadKey(key_direction) + floor = me.ReadKey(key_follow) + if want_dir == '' or floor == '': + return +# me.Map.Print('roll') + pl = find_player() + want_dir = int(want_dir) + done = False + x = me.X + y = me.Y + for check in [0, 1, -1]: + d = abs_dir(want_dir + check) + if has_floor(x + dir_x[d], y + dir_y[d], floor) == True: + if me.Move(d) == 0: + continue + + if pl != None: + pl.Move(d) + done = True + break + + if done == False: + me.WriteKey(key_direction, '', 1) + me.WriteKey(key_follow, '', 1) + return + +def handle_say(): + msg = Crossfire.WhatIsMessage() + if msg == 'stop': + if me.ReadKey(key_direction) != '': + me.WriteKey(key_direction, '', 1) + me.WriteKey(key_follow, '', 1) + me.Map.Print('The %s stops moving.'%me.Name) + return + + want_dir = -1 + + for d in Crossfire.DirectionName.keys(): + if msg == Crossfire.DirectionName[d].lower(): + want_dir = d + break + + if want_dir == -1: + return + + floor = find_floor(me.X, me.Y) + if floor == '': + return + + if me.ReadKey(key_direction) == '': + me.Map.Print('The %s starts moving!'%me.Name) + + me.WriteKey(key_direction, str(want_dir), 1) + me.WriteKey(key_follow, floor, 1) + +def do_handle(): + if me.Map == None: + return + + if evt.Subtype == Crossfire.EventType.SAY: + handle_say() + elif evt.Subtype == Crossfire.EventType.TIME: + handle_move() + + +evt = Crossfire.WhatIsEvent() +me = Crossfire.WhoAmI() +pl = Crossfire.WhoIsActivator() + +Crossfire.SetReturnValue(1) + +do_handle() diff --git a/world/world_105_115 b/world/world_105_115 index a02ca8128..ade1ce59b 100644 --- a/world/world_105_115 +++ b/world/world_105_115 @@ -206,6 +206,14 @@ arch brush y 31 elevation 4274 end +arch guild +name Scorn Sale Shop +name_pl Scorn Sale Shop +slaying /scorn/shops/scorn.sale1 +hp 10 +sp 16 +y 31 +end arch dungeon_magic y 32 end @@ -250,6 +258,14 @@ arch grass y 36 elevation 11542 end +arch courthouse +name City Hall +name_pl City Hall +slaying /scorn/misc/cityhall +hp 13 +sp 26 +y 36 +end arch dungeon_magic y 37 end @@ -544,6 +560,11 @@ x 1 y 27 elevation 9 end +arch house_up +x 1 +y 27 +elevation 9 +end arch dungeon_magic x 1 y 28 @@ -634,6 +655,15 @@ arch grass x 1 y 35 end +arch house_long +name Resir's house +name_pl Resir's house +slaying /scorn/houses/resir +hp 24 +sp 4 +x 1 +y 35 +end arch dungeon_magic x 1 y 36 @@ -1011,6 +1041,11 @@ x 2 y 28 elevation 337 end +arch barrack_up +x 2 +y 28 +elevation 337 +end arch dungeon_magic x 2 y 29 @@ -1380,6 +1415,10 @@ x 3 y 21 elevation -133 end +arch big_galleon +x 3 +y 21 +end arch dungeon_magic x 3 y 22 @@ -1410,8 +1449,8 @@ end arch gravestone2 x 3 y 24 -no_pick 1 move_block all +no_pick 1 end arch dungeon_magic x 3 @@ -2299,8 +2338,8 @@ end arch gravestone2 x 5 y 24 -no_pick 1 move_block all +no_pick 1 end arch dungeon_magic x 5 @@ -2628,6 +2667,13 @@ y 10 elevation -84 move_block 0 end +arch fishboat +slaying world_105_115 +hp 11 +sp 20 +x 6 +y 10 +end arch sea x 6 y 11 @@ -2762,6 +2808,15 @@ x 6 y 25 elevation -17 end +arch barn +name Pirates' Arena +name_pl Pirates' Arena +slaying /scorn/misc/port_arena +hp 38 +sp 6 +x 6 +y 25 +end arch dungeon_magic x 6 y 26 @@ -2789,6 +2844,10 @@ x 6 y 28 elevation 20 end +arch house_up +x 6 +y 28 +end arch dungeon_magic x 6 y 29 @@ -2820,6 +2879,15 @@ x 6 y 31 elevation 4536 end +arch store_general +name Gem Shop +name_pl Gem Shop +slaying /scorn/shops/gemshop +hp 1 +sp 14 +x 6 +y 31 +end arch dungeon_magic x 6 y 32 @@ -3001,6 +3069,15 @@ x 6 y 48 elevation 10859 end +arch church +name Undead Church +name_pl Undead Church +slaying /scorn/misc/church +hp 10 +sp 15 +x 6 +y 48 +end arch dungeon_magic x 6 y 49 @@ -3375,6 +3452,15 @@ x 7 y 45 elevation 10499 end +arch farmhouse +name Smith's House +name_pl Smith's House +slaying /scorn/houses/house1 +hp 10 +sp 14 +x 7 +y 45 +end arch dungeon_magic x 7 y 46 @@ -3518,6 +3604,17 @@ x 8 y 19 elevation -2256 end +arch big_galleon +name sailing big galleon +x 8 +y 19 +speed 0.5 +type 2 +container 10000000 +move_type boat +move_allow walk +passenger_limit 4 +end arch dungeon_magic x 8 y 20 @@ -3536,6 +3633,15 @@ x 8 y 21 elevation -406 end +arch s_ship +name to Stoneville +name_pl to Stoneville +slaying /world/world_102_127 +hp 43 +sp 13 +x 8 +y 21 +end arch dungeon_magic x 8 y 22 @@ -4017,6 +4123,15 @@ x 9 y 25 elevation -48 end +arch barn +name Animal Quarantine +name_pl Animal Quarantine +slaying /scorn/cannery/ware1 +hp 19 +sp 36 +x 9 +y 25 +end arch dungeon_magic x 9 y 26 @@ -4044,6 +4159,15 @@ x 9 y 28 elevation -9 end +arch guild +name Acme Inc. Building Shop +name_pl Acme Inc. Building Shop +slaying /scorn/shops/buildshop +hp 17 +sp 17 +x 9 +y 28 +end arch dungeon_magic x 9 y 29 @@ -4075,6 +4199,15 @@ x 9 y 31 elevation 2125 end +arch guild +name Bank of Skud +name_pl Bank of Skud +slaying /scorn/shops/bank +hp 7 +sp 14 +x 9 +y 31 +end arch dungeon_magic x 9 y 32 @@ -4223,6 +4356,14 @@ x 9 y 43 elevation 9490 end +arch city_tower +name Mad Mage's Tower +slaying /scorn/towers/tower.mad +hp 7 +sp 13 +x 9 +y 43 +end arch dungeon_magic x 9 y 44 @@ -4527,6 +4668,15 @@ x 10 y 34 elevation 2009 end +arch barrack_long +name Apartment Building +name_pl Apartment Building +slaying /scorn/taverns/apartments +hp 13 +sp 3 +x 10 +y 34 +end arch dungeon_magic x 10 y 35 @@ -4809,6 +4959,19 @@ x 11 y 19 elevation -890 end +arch fishboat +name to shrine +name_pl to shrine +slaying world_105_115 +msg +A nice day for a sail. +endmsg +hp 5 +sp 10 +x 11 +y 19 +passenger_limit 2 +end arch dungeon_magic x 11 y 20 @@ -4941,6 +5104,15 @@ x 11 y 31 elevation 141 end +arch church +name House of Healing +name_pl House of Healing +slaying /scorn/misc/HouseofHealing +hp 10 +sp 33 +x 11 +y 31 +end arch dungeon_magic x 11 y 32 @@ -5050,6 +5222,12 @@ x 11 y 40 elevation 11883 end +arch barrack_long +name large house +name_pl large house +x 11 +y 40 +end arch dungeon_magic x 11 y 41 @@ -5162,6 +5340,15 @@ x 11 y 48 elevation 7066 end +arch zoo_1 +name The Zoo +name_pl The Zoo +slaying /scorn/misc/zoo +hp 1 +sp 16 +x 11 +y 48 +end arch dungeon_magic x 11 y 49 @@ -5336,6 +5523,15 @@ x 12 y 25 elevation -412 end +arch barn +name Mailed Fist's storage room +name_pl Mailed Fist's storage room +slaying /scorn/guilds/mailed_fist/storage_room +hp 1 +sp 10 +x 12 +y 25 +end arch dungeon_magic x 12 y 26 @@ -5363,6 +5559,15 @@ x 12 y 28 elevation -141 end +arch inn +name Port Inn +name_pl Port Inn +slaying /scorn/taverns/inn2 +hp 4 +sp 2 +x 12 +y 28 +end arch dungeon_magic x 12 y 29 @@ -5425,6 +5630,15 @@ x 12 y 34 elevation 4731 end +arch t_house1 +name Central Library +name_pl Central Library +slaying /scorn/misc/library +hp 9 +sp 15 +x 12 +y 34 +end arch dungeon_magic x 12 y 35 @@ -5685,6 +5899,10 @@ x 13 y 20 elevation -2256 end +arch big_galleon +x 13 +y 20 +end arch dungeon_magic x 13 y 21 @@ -5791,6 +6009,14 @@ x 13 y 31 elevation 1393 end +arch store_magic +name House of Power +slaying /scorn/misc/PowerHouse +hp 10 +sp 33 +x 13 +y 31 +end arch dungeon_magic x 13 y 32 @@ -6134,6 +6360,13 @@ x 14 y 23 elevation -2256 end +arch tower_a +name Lighthouse +name_pl Lighthouse +x 14 +y 23 +glow_radius 4 +end arch dungeon_magic x 14 y 24 @@ -6606,6 +6839,10 @@ x 15 y 29 elevation -108 end +arch house_long +x 15 +y 29 +end arch dungeon_magic x 15 y 30 @@ -6664,6 +6901,15 @@ x 15 y 34 elevation 4816 end +arch fort +name dragon guild +name_pl dragon guild +slaying /scorn/misc/dragon_guild +hp 7 +sp 15 +x 15 +y 34 +end arch dungeon_magic x 15 y 35 @@ -6727,6 +6973,12 @@ x 15 y 40 elevation 6093 end +arch barrack_long +name large house +name_pl large house +x 15 +y 40 +end arch dungeon_magic x 15 y 41 @@ -6976,6 +7228,12 @@ x 16 y 22 elevation -832 end +arch big_galleon +name old galleon +name_pl old galleon +x 16 +y 22 +end arch dungeon_magic x 16 y 23 @@ -7077,6 +7335,14 @@ x 16 y 31 elevation -1 end +arch guild +name Guild of the Mailed Fist +slaying /scorn/guilds/mailed_fist/ground +hp 12 +sp 23 +x 16 +y 31 +end arch dungeon_magic x 16 y 32 @@ -7233,6 +7499,15 @@ x 16 y 45 elevation 5401 end +arch collesium +name the ARENA +name_pl the ARENA +slaying /scorn/misc/battle_arena/entrance +hp 11 +sp 24 +x 16 +y 45 +end arch dungeon_magic x 16 y 46 @@ -7876,6 +8151,15 @@ x 18 y 26 elevation -2256 end +arch big_galleon +name to Port Joseph +name_pl to Port Joseph +slaying /world/world_101_114 +hp 16 +sp 43 +x 18 +y 26 +end arch dungeon_magic x 18 y 27 @@ -8018,6 +8302,14 @@ x 18 y 40 elevation 8223 end +arch house_long +name Old Mansion +name_pl Old Mansion +slaying /scorn/mansion/entrance +hp 14 +x 18 +y 40 +end arch dungeon_magic x 18 y 41 @@ -8346,6 +8638,15 @@ x 19 y 31 elevation 129 end +arch prison +name Prison +name_pl Prison +slaying /scorn/anthony/prison +hp 9 +sp 23 +x 19 +y 31 +end arch dungeon_magic x 19 y 32 @@ -8373,6 +8674,15 @@ x 19 y 34 elevation 3490 end +arch l_shop1 +name Goth's Tavern +name_pl Goth's Tavern +slaying /scorn/taverns/goths +hp 18 +sp 32 +x 19 +y 34 +end arch dungeon_magic x 19 y 35 @@ -9971,6 +10281,14 @@ x 23 y 41 elevation 1773 end +arch farmhouse +slaying /scorn/houses/farmhouse +hp 11 +sp 9 +x 23 +y 41 +elevation 7844 +end arch farmland x 23 y 42 @@ -10722,6 +11040,11 @@ x 26 y 43 elevation 1343 end +arch barn2 +x 26 +y 43 +elevation 5093 +end arch brush x 26 y 44 @@ -10896,6 +11219,10 @@ x 27 y 28 elevation 7037 end +arch mountain_2 +x 27 +y 29 +end arch mountain x 27 y 31 @@ -11674,6 +12001,21 @@ arch cobblestones x 30 y 37 end +arch wagon +x 30 +y 37 +speed 1 +move_type walk +unique 1 +arch event_say +title Python +slaying /python/items/roll-o-matic.py +end +arch event_time +title Python +slaying /python/items/roll-o-matic.py +end +end arch cobblestones x 30 y 38 @@ -16342,330 +16684,3 @@ x 49 y 49 elevation 5588 end -arch guild -name Scorn Sale Shop -name_pl Scorn Sale Shop -slaying /scorn/shops/scorn.sale1 -hp 10 -sp 16 -y 31 -end -arch courthouse -name City Hall -name_pl City Hall -slaying /scorn/misc/cityhall -hp 13 -sp 26 -y 36 -end -arch house_up -x 1 -y 27 -elevation 9 -end -arch house_long -name Resir's house -name_pl Resir's house -slaying /scorn/houses/resir -hp 24 -sp 4 -x 1 -y 35 -end -arch barrack_up -x 2 -y 28 -elevation 337 -end -arch big_galleon -x 3 -y 21 -end -arch fishboat -slaying world_105_115 -hp 11 -sp 20 -x 6 -y 10 -end -arch barn -name Pirates' Arena -name_pl Pirates' Arena -slaying /scorn/misc/port_arena -hp 38 -sp 6 -x 6 -y 25 -end -arch house_up -x 6 -y 28 -end -arch store_general -name Gem Shop -name_pl Gem Shop -slaying /scorn/shops/gemshop -hp 1 -sp 14 -x 6 -y 31 -end -arch church -name Undead Church -name_pl Undead Church -slaying /scorn/misc/church -hp 10 -sp 15 -x 6 -y 48 -end -arch farmhouse -name Smith's House -name_pl Smith's House -slaying /scorn/houses/house1 -hp 10 -sp 14 -x 7 -y 45 -end -arch big_galleon -name sailing big galleon -x 8 -y 19 -speed 0.5 -type 2 -container 10000000 -move_type boat -move_allow walk -passenger_limit 4 -end -arch s_ship -name to Stoneville -name_pl to Stoneville -slaying /world/world_102_127 -hp 43 -sp 13 -x 8 -y 21 -end -arch barn -name Animal Quarantine -name_pl Animal Quarantine -slaying /scorn/cannery/ware1 -hp 19 -sp 36 -x 9 -y 25 -end -arch guild -name Acme Inc. Building Shop -name_pl Acme Inc. Building Shop -slaying /scorn/shops/buildshop -hp 17 -sp 17 -x 9 -y 28 -end -arch guild -name Bank of Skud -name_pl Bank of Skud -slaying /scorn/shops/bank -hp 7 -sp 14 -x 9 -y 31 -end -arch city_tower -name Mad Mage's Tower -slaying /scorn/towers/tower.mad -hp 7 -sp 13 -x 9 -y 43 -end -arch barrack_long -name Apartment Building -name_pl Apartment Building -slaying /scorn/taverns/apartments -hp 13 -sp 3 -x 10 -y 34 -end -arch fishboat -name to shrine -name_pl to shrine -slaying world_105_115 -msg -A nice day for a sail. -endmsg -hp 5 -sp 10 -x 11 -y 19 -passenger_limit 2 -end -arch church -name House of Healing -name_pl House of Healing -slaying /scorn/misc/HouseofHealing -hp 10 -sp 33 -x 11 -y 31 -end -arch barrack_long -name large house -name_pl large house -x 11 -y 40 -end -arch zoo_1 -name The Zoo -name_pl The Zoo -slaying /scorn/misc/zoo -hp 1 -sp 16 -x 11 -y 48 -end -arch barn -name Mailed Fist's storage room -name_pl Mailed Fist's storage room -slaying /scorn/guilds/mailed_fist/storage_room -hp 1 -sp 10 -x 12 -y 25 -end -arch inn -name Port Inn -name_pl Port Inn -slaying /scorn/taverns/inn2 -hp 4 -sp 2 -x 12 -y 28 -end -arch t_house1 -name Central Library -name_pl Central Library -slaying /scorn/misc/library -hp 9 -sp 15 -x 12 -y 34 -end -arch big_galleon -x 13 -y 20 -end -arch store_magic -name House of Power -slaying /scorn/misc/PowerHouse -hp 10 -sp 33 -x 13 -y 31 -end -arch tower_a -name Lighthouse -name_pl Lighthouse -x 14 -y 23 -glow_radius 4 -end -arch house_long -x 15 -y 29 -end -arch fort -name dragon guild -name_pl dragon guild -slaying /scorn/misc/dragon_guild -hp 7 -sp 15 -x 15 -y 34 -end -arch barrack_long -name large house -name_pl large house -x 15 -y 40 -end -arch big_galleon -name old galleon -name_pl old galleon -x 16 -y 22 -end -arch guild -name Guild of the Mailed Fist -slaying /scorn/guilds/mailed_fist/ground -hp 12 -sp 23 -x 16 -y 31 -end -arch collesium -name the ARENA -name_pl the ARENA -slaying /scorn/misc/battle_arena/entrance -hp 11 -sp 24 -x 16 -y 45 -end -arch big_galleon -name to Port Joseph -name_pl to Port Joseph -slaying /world/world_101_114 -hp 16 -sp 43 -x 18 -y 26 -end -arch house_long -name Old Mansion -name_pl Old Mansion -slaying /scorn/mansion/entrance -hp 14 -x 18 -y 40 -end -arch prison -name Prison -name_pl Prison -slaying /scorn/anthony/prison -hp 9 -sp 23 -x 19 -y 31 -end -arch l_shop1 -name Goth's Tavern -name_pl Goth's Tavern -slaying /scorn/taverns/goths -hp 18 -sp 32 -x 19 -y 34 -end -arch farmhouse -slaying /scorn/houses/farmhouse -hp 11 -sp 9 -x 23 -y 41 -elevation 7844 -end -arch barn2 -x 26 -y 43 -elevation 5093 -end -arch mountain_2 -x 27 -y 29 -end