| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# CFQuestStartAdvance - A generic script to make quest items undisposable. |
| 3 |
# |
| 4 |
# Copyright (C) 2010 The Crossfire Development Team |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This program is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 |
# |
| 20 |
# |
| 21 |
# This script is intended to be bound to event_drop in the inventory of quest objects. |
| 22 |
# it must always be given the name of the quest as its first argument, followed by |
| 23 |
# the stage number it should act until. |
| 24 |
# Until the specified stage in the specified quest is reached, the player will not be |
| 25 |
# permitted to drop the item, after the stage specified, any attempt to drop the |
| 26 |
# item will have it marked as startequip, causing it to disappear. |
| 27 |
# This is to prevent quests being bypassed by trading keys, etc. |
| 28 |
|
| 29 |
import Crossfire |
| 30 |
item = Crossfire.WhoAmI() |
| 31 |
player = Crossfire.WhoIsActivator() |
| 32 |
args = Crossfire.ScriptParameters().split(' ') |
| 33 |
if type(player) == Crossfire.Player: |
| 34 |
questname = args[0] |
| 35 |
currentstep = player.QuestGetState(questname) |
| 36 |
|
| 37 |
questname = args[0] |
| 38 |
stagenumber = int(args[1]) |
| 39 |
currentstep = player.QuestGetState(questname) |
| 40 |
if currentstep == 0: |
| 41 |
Crossfire.SetReturnValue(0) |
| 42 |
elif currentstep >= stagenumber: |
| 43 |
item.GodGiven = True |
| 44 |
Crossfire.SetReturnValue(0) |
| 45 |
else: |
| 46 |
if item.Quantity == 1: |
| 47 |
player.Message("You consider dropping the "+ item.Name + " but then decide it would be better to hold on to it for now.") |
| 48 |
else: |
| 49 |
player.Message("You consider dropping the "+ item.NamePl + " but then decide it would be better to hold on to them for now.") |
| 50 |
Crossfire.SetReturnValue(1) |