Apply (part of) patch #326: Make sailing around the world cost money, by Kevin Zheng.

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@18659 282e977c-c81d-0410-88c4-b93c2d0d6712
master
ryo_saeba 2013-04-06 10:21:13 +00:00
parent 9d83b9ac56
commit e0057f4c39
6 changed files with 6845 additions and 8 deletions

View File

@ -0,0 +1,78 @@
# ship.py -- sailing around the world takes time
# Created by: Kevin Zheng <kevinz5000@gmail.com>
#
# This script should be used in specially designed ship maps. Please see the
# ship from Scorn to Santo Dominion for a working example. Note that connection
# 10 and 11 must be used for the entrance and exit gates, respectively.
import Crossfire
player = Crossfire.WhoIsActivator()
whoami = Crossfire.WhoAmI()
sailtime = 15
# Get a previously set value, otherwise return zero.
def getValue(key):
value = Crossfire.WhoAmI().ReadKey(key)
if (len(value) != 0):
return value
else:
return 0
# Set a value.
def setValue(key, value):
Crossfire.WhoAmI().WriteKey(key, str(value), 1)
# Check ship state.
def getState():
return int(getValue("ship_state"))
# Set ship state.
def setState(state):
setValue("ship_state", state)
# Check if the ship is already sailing.
def isSailing():
if getState() != 0:
return 1
else:
return 0
# Set a timer for the specified amount of time.
def setTimer(time):
setValue("ship_timer", str(whoami.CreateTimer(time, 1)))
# Clear the previously set timer.
def clearTimer():
Crossfire.DestroyTimer(int(getValue("ship_timer")))
# Start sailing if the ship isn't already sailing.
if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.APPLY:
if isSailing() == 0:
setState(1)
# Close the entrance and notify the players onboard.
whoami.Map.TriggerConnected(10, 1)
whoami.Map.Print("\"Ahoy, the ship is ready to set sail!\" You feel the ship beginning to move.")
setTimer(sailtime)
else:
player.Message("The ship has already set sail, be patient!")
# Handle the timer event based on what state the ship is in.
elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.TIMER:
if getState() == 1:
# Open the exit and tell players that they've arrived.
setState(2)
whoami.Map.TriggerConnected(11, 1)
whoami.Map.Print("The ship has arrived at its destination.")
# Clear and reset timer for another 15 seconds.
clearTimer()
setTimer(15)
elif getState() == 2:
# Reset the ship.
clearTimer()
whoami.Map.TriggerConnected(10, 0)
whoami.Map.TriggerConnected(11, 0)
whoami.Map.Print("The ship is ready to board.")
setState(0)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,992 @@
arch map
name Scorn Port Ticket Office
difficulty 1
region scorn
width 13
height 12
enter_x 7
enter_y 8
msg
Created: 2013-03-19 Kevin Zheng
Modified: 2013-04-06 Nicolas Weeger
endmsg
outdoor 1
end
arch cobblestones2
end
arch cobblestones2
y 1
end
arch woodfloor
y 2
end
arch wwall_2_2_2
y 2
end
arch woodfloor
y 3
end
arch wwall_2_1_1
y 3
end
arch woodfloor
y 4
end
arch wwall_3_2
y 4
end
arch woodfloor
y 5
end
arch wwall_2_1_1
y 5
end
arch woodfloor
y 6
end
arch wwall_3_2
y 6
end
arch woodfloor
y 7
end
arch wwall_2_1_1
y 7
end
arch woodfloor
y 8
end
arch wwall_3_2
y 8
end
arch woodfloor
y 9
end
arch wwall_2_1_1
y 9
end
arch woodfloor
y 10
end
arch wwall_2_2_1
y 10
end
arch cobblestones2
y 11
end
arch cobblestones2
x 1
end
arch cobblestones2
x 1
y 1
end
arch woodfloor
x 1
y 2
end
arch wwall_2_1_2
x 1
y 2
end
arch woodfloor
x 1
y 3
end
arch woodfloor
x 1
y 4
end
arch wwall_2_1_2
x 1
y 4
end
arch woodfloor
x 1
y 5
end
arch woodfloor
x 1
y 6
end
arch wwall_2_1_2
x 1
y 6
end
arch woodfloor
x 1
y 7
end
arch creator
slaying Boarding Pass to Stoneville
other_arch card
x 1
y 7
connected 2
lifesave 1
end
arch woodfloor
x 1
y 8
end
arch wwall_2_1_2
x 1
y 8
end
arch woodfloor
x 1
y 9
end
arch creator
slaying Boarding Pass to Santo Dominion
other_arch card
x 1
y 9
connected 3
lifesave 1
end
arch woodfloor
x 1
y 10
end
arch wwall_2_1_2
x 1
y 10
end
arch cobblestones2
x 1
y 11
end
arch cobblestones2
x 2
end
arch cobblestones2
x 2
y 1
end
arch woodfloor
x 2
y 2
end
arch wwall_2_1_2
x 2
y 2
end
arch woodfloor
x 2
y 3
end
arch grate_closed_2
x 2
y 3
end
arch woodfloor
x 2
y 4
end
arch wwall_1_3
x 2
y 4
end
arch light3
x 2
y 4
end
arch woodfloor
x 2
y 5
end
arch grate_closed_2
x 2
y 5
end
arch woodfloor
x 2
y 6
end
arch wwall_1_3
x 2
y 6
end
arch woodfloor
x 2
y 7
end
arch altar_trigger
name Stoneville (5 platinum)
slaying money
msg
Here's your ticket, enjoy your trip!
endmsg
food 250
x 2
y 7
last_sp 1
connected 2
end
arch woodfloor
x 2
y 8
end
arch wwall_1_3
x 2
y 8
end
arch light3
x 2
y 8
end
arch woodfloor
x 2
y 9
end
arch altar_trigger
name Santo Dominion (1 platinum)
slaying money
msg
Here's your ticket, enjoy your trip!
endmsg
food 50
x 2
y 9
last_sp 1
connected 3
end
arch woodfloor
x 2
y 10
end
arch wwall_2_1_2
x 2
y 10
end
arch cobblestones2
x 2
y 11
end
arch cobblestones2
x 3
end
arch cobblestones2
x 3
y 1
end
arch woodfloor
x 3
y 2
end
arch wwall_win2
x 3
y 2
end
arch woodfloor
x 3
y 3
end
arch sign_w
name Under Construction
msg
Under Construction
endmsg
x 3
y 3
end
arch woodfloor
x 3
y 4
end
arch woodfloor
x 3
y 5
end
arch sign_w
name Under Construction
msg
Under Construction
endmsg
x 3
y 5
end
arch woodfloor
x 3
y 6
end
arch woodfloor
x 3
y 7
end
arch sign_w
name Stoneville
msg
Buy here tickets for Stoneville for 5 platinum.
endmsg
x 3
y 7
end
arch woodfloor
x 3
y 8
end
arch woodfloor
x 3
y 9
end
arch sign_w
name Santo Dominion
msg
But here tickets for Santo Dominion for 1 platinum.
endmsg
x 3
y 9
end
arch woodfloor
x 3
y 10
end
arch wwall_win2
x 3
y 10
end
arch cobblestones2
x 3
y 11
end
arch cobblestones2
x 4
end
arch cobblestones2
x 4
y 1
end
arch woodfloor
x 4
y 2
end
arch wwall_2_1_2
x 4
y 2
end
arch woodfloor
x 4
y 3
end
arch woodfloor
x 4
y 4
end
arch woodfloor
x 4
y 5
end
arch woodfloor
x 4
y 6
end
arch woodfloor
x 4
y 7
end
arch woodfloor
x 4
y 8
end
arch woodfloor
x 4
y 9
end
arch woodfloor
x 4
y 10
end
arch wwall_2_1_2
x 4
y 10
end
arch cobblestones2
x 4
y 11
end
arch cobblestones2
x 5
end
arch cobblestones2
x 5
y 1
end
arch woodfloor
x 5
y 2
end
arch wwall_2_1_2
x 5
y 2
end
arch woodfloor
x 5
y 3
end
arch table_3
x 5
y 3
no_pick 1
end
arch random_food
x 5
y 3
end
arch woodfloor
x 5
y 4
end
arch chair_1.3
x 5
y 4
end
arch woodfloor
x 5
y 5
end
arch woodfloor
x 5
y 6
end
arch light4
x 5
y 6
end
arch woodfloor
x 5
y 7
end
arch woodfloor
x 5
y 8
end
arch woodfloor
x 5
y 9
end
arch woodfloor
x 5
y 10
end
arch wwall_2_1_2
x 5
y 10
end
arch cobblestones2
x 5
y 11
end
arch cobblestones2
x 6
end
arch cobblestones2
x 6
y 1
end
arch woodfloor
x 6
y 2
end
arch wwall_2_1_2
x 6
y 2
end
arch woodfloor
x 6
y 3
end
arch table_3
x 6
y 3
no_pick 1
end
arch random_food
x 6
y 3
end
arch woodfloor
x 6
y 4
end
arch chair_1.3
x 6
y 4
end
arch woodfloor
x 6
y 5
end
arch woodfloor
x 6
y 6
end
arch woodfloor
x 6
y 7
end
arch woodfloor
x 6
y 8
end
arch button_small
x 6
y 9
invisible 1
connected 1
end
arch woodfloor
x 6
y 9
end
arch woodfloor
x 6
y 10
end
arch wwall_1_3
x 6
y 10
end
arch invis_exit
slaying /world/world_105_115
hp 7
sp 28
x 6
y 11
end
arch cobblestones2
x 6
y 11
end
arch cobblestones2
x 7
end
arch cobblestones2
x 7
y 1
end
arch woodfloor
x 7
y 2
end
arch wwall_win2
x 7
y 2
end
arch woodfloor
x 7
y 3
end
arch table_3
x 7
y 3
no_pick 1
end
arch random_food
x 7
y 3
end
arch woodfloor
x 7
y 4
end
arch chair_1.3
x 7
y 4
end
arch woodfloor
x 7
y 5
end
arch woodfloor
x 7
y 6
end
arch woodfloor
x 7
y 7
end
arch woodfloor
x 7
y 8
end
arch button_small
x 7
y 9
invisible 1
connected 1
end
arch woodfloor
x 7
y 9
end
arch woodfloor
x 7
y 10
end
arch button_small
x 7
y 10
invisible 1
connected 1
end
arch odoorn2_closed_1
x 7
y 10
connected 1
end
arch invis_exit
slaying /world/world_105_115
hp 7
sp 28
x 7
y 11
end
arch cobblestones2
x 7
y 11
end
arch cobblestones2
x 8
end
arch cobblestones2
x 8
y 1
end
arch woodfloor
x 8
y 2
end
arch wwall_2_1_2
x 8
y 2
end
arch woodfloor
x 8
y 3
end
arch woodfloor
x 8
y 4
end
arch woodfloor
x 8
y 5
end
arch woodfloor
x 8
y 6
end
arch bench_2_2_2
x 8
y 6
move_block all
end
arch woodfloor
x 8
y 7
end
arch bench_2_1_1
x 8
y 7
move_block all
end
arch woodfloor
x 8
y 8
end
arch bench_2_1_1
x 8
y 8
move_block all
end
arch woodfloor
x 8
y 9
end
arch bench_1_2
x 8
y 9
move_block all
end
arch woodfloor
x 8
y 10
end
arch wwall_1_4
x 8
y 10
end
arch invis_exit
slaying /world/world_105_115
hp 7
sp 28
x 8
y 11
end
arch cobblestones2
x 8
y 11
end
arch cobblestones2
x 9
end
arch cobblestones2
x 9
y 1
end
arch woodfloor
x 9
y 2
end
arch wwall_2_1_2
x 9
y 2
end
arch woodfloor
x 9
y 3
end
arch clock
x 9
y 3
no_pick 1
end
arch woodfloor
x 9
y 4
end
arch woodfloor
x 9
y 5
end
arch woodfloor
x 9
y 6
end
arch bench_1_3
x 9
y 6
move_block all
end
arch light3
x 9
y 6
end
arch woodfloor
x 9
y 7
end
arch woodfloor
x 9
y 8
end
arch courier
name shipping officer
msg
@match ticket
Of course! Just head towards the correct booth and pay for your ticket there.
@match free
Well...
@match *
Welcome to the ticket office! How can I help you?
@reply free Why isn't shipping free anymore?
@reply ticket I'd like to buy a ticket, please.
endmsg
x 9
y 8
end
arch woodfloor
x 9
y 9
end
arch woodfloor
x 9
y 10
end
arch wwall_2_1_2
x 9
y 10
end
arch cobblestones2
x 9
y 11
end
arch cobblestones2
x 10
end
arch cobblestones2
x 10
y 1
end
arch woodfloor
x 10
y 2
end
arch wwall_2_2_3
x 10
y 2
end
arch woodfloor
x 10
y 3
end
arch wwall_2_1_1
x 10
y 3
end
arch woodfloor
x 10
y 4
end
arch wwall_2_1_1
x 10
y 4
end
arch woodfloor
x 10
y 5
end
arch wwall_2_1_1
x 10
y 5
end
arch woodfloor
x 10
y 6
end
arch wwall_2_1_1
x 10
y 6
end
arch woodfloor
x 10
y 7
end
arch wwall_win1
x 10
y 7
end
arch woodfloor
x 10
y 8
end
arch wwall_2_1_1
x 10
y 8
end
arch woodfloor
x 10
y 9
end
arch wwall_2_1_1
x 10
y 9
end
arch woodfloor
x 10
y 10
end
arch wwall_2_2_4
x 10
y 10
end
arch cobblestones2
x 10
y 11
end
arch cobblestones2
x 11
end
arch cobblestones2
x 11
y 1
end
arch cobblestones2
x 11
y 2
end
arch cobblestones2
x 11
y 3
end
arch cobblestones2
x 11
y 4
end
arch cobblestones2
x 11
y 5
end
arch cobblestones2
x 11
y 6
end
arch cobblestones2
x 11
y 7
end
arch cobblestones2
x 11
y 8
end
arch cobblestones2
x 11
y 9
end
arch cobblestones2
x 11
y 10
end
arch cobblestones2
x 11
y 11
end
arch cobblestones2
x 12
end
arch cobblestones2
x 12
y 1
end
arch cobblestones2
x 12
y 2
end
arch cobblestones2
x 12
y 3
end
arch cobblestones2
x 12
y 4
end
arch cobblestones2
x 12
y 5
end
arch cobblestones2
x 12
y 6
end
arch cobblestones2
x 12
y 7
end
arch cobblestones2
x 12
y 8
end
arch cobblestones2
x 12
y 9
end
arch cobblestones2
x 12
y 10
end
arch cobblestones2
x 12
y 11
end

View File

@ -9,7 +9,7 @@ enter_x 1
enter_y 1
msg
Created: 2001-02-16
Modified: 2013-03-17 Kevin Zheng
Modified: 2013-03-21 Kevin Zheng
endmsg
outdoor 1
tile_path_1 world_104_114
@ -13960,9 +13960,9 @@ y 19
end
arch s_ship
name Ship to Stoneville
slaying /world/world_102_127
hp 43
sp 11
slaying /scorn/port/ship_stoneville
hp 9
sp 10
x 47
y 19
end

View File

@ -9,7 +9,7 @@ enter_x 1
enter_y 1
msg
Created: 2001-02-16
Modified: 2013-03-17 Kevin Zheng
Modified: 2013-04-06 Nicolas Weeger
endmsg
outdoor 1
tile_path_1 world_105_114
@ -3278,7 +3278,10 @@ y 28
elevation 127
end
arch tavern
name The Rowdy Sailor
name Scorn Port Ticket Office
slaying /scorn/port/ticket_office
hp 7
sp 8
x 7
y 28
end
@ -3623,8 +3626,8 @@ elevation -406
end
arch s_ship
name Ship to Santo Dominion
slaying /world/world_102_108
hp 15
slaying /scorn/port/ship_santo_dominion
hp 9
sp 10
x 8
y 21