1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-22 20:57:46 +00:00
sapphire/scripts/chai/quest/ManFst004.chai

259 lines
7.3 KiB
ChaiScript
Raw Normal View History

2017-08-08 13:53:47 +02:00
// Quest Script: ManFst004_00124
// Quest Name: Close to Home
// Quest ID: 65660
// Start NPC: 1001140
// End NPC: 1000100
class ManFst004Def
{
//////////////////////////////////////////////////////////////////////
// default ctor
def ManFst004Def()
{
// Basic quest information
this.name = "Close to Home";
this.id = 65660;
// These are the quest vars / flags used in this quest
// GetQuestBitFlag8
// GetQuestUI8AL -- attube to Aetheryte
// GetQuestUI8BH -- visit class guild
// GetQuestUI8BL -- Listen to Parsement in the market check mark
// GetQuestUI8CH -- recieve Key item
// Steps in this quest ( 0 is before accepting,
// 1 is first, 255 means ready for turning it in
this.SEQ_0 = 0;
this.SEQ_1 = 1;
this.SEQ_FINISH = 255;
//this.SEQ_OFFER = ?;
// Quest rewards
this.RewardExpFactor = 100;
this.RewardGil = 107;
// Entities found in the script data of the quest
// some of these may be useful
this.ACTOR0 = 1001140;
this.ACTOR1 = 2;
this.ACTOR2 = 1000323;
this.ACTOR20 = 1000159;
this.ACTOR3 = 1000768;
this.ACTOR4 = 1000100;
this.BIND_ACTOR0 = 6229224;
this.ITEM0 = 2000120;
this.LOC_ACTOR0 = 1003159;
this.LOC_MARKER_01 = 2153091;
this.LOC_MARKER_02 = 2153104;
this.LOC_MARKER_03 = 2153111;
this.LOC_MARKER_04 = 2154539;
this.LOC_MARKER_05 = 2154540;
this.LOC_MARKER_06 = 2154541;
this.LOC_MARKER_07 = 2210446;
this.LOC_MARKER_08 = 2210454;
this.LOC_MARKER_09 = 2210461;
this.LOC_MOTION0 = 799;
this.POPRANGE0 = 2280858;
this.REWARD_DESION = 1;
this.SEQ_0_ACTOR0 = 0;
this.SEQ_0_ACTOR0_LQ = 50;
this.SEQ_1_ACTOR0 = 4;
this.SEQ_1_ACTOR1 = 1;
this.SEQ_1_ACTOR1_WAIT = 51;
this.SEQ_1_ACTOR2 = 2;
this.SEQ_1_ACTOR3 = 3;
this.SEQ_1_ACTOR3_NPCTRADENO = 99;
this.SEQ_1_ACTOR3_NPCTRADEOK = 100;
this.SEQ_2_ACTOR4 = 5;
this.TERRITORYTYPE0 = 132;
this.UNLOCK_DESION = 14;
}
def checkQuestCompletion( player, varIdx )
{
if (varIdx == 3)
{
player.questMessage(this.id, 1, 0, 0, 0 );
}
else if (varIdx == 2)
{
player.questMessage(this.id, 2, 0, 0, 0 );
}
else
{
player.questMessage(this.id, 0, 0, 0, 0 );
}
var QUEST_VAR_ATTUNE = player.getQuestUI8AL( this.id );
var QUEST_VAR_CLASS = player.getQuestUI8BH( this.id );
var QUEST_VAR_TRADE = player.getQuestUI8BL( this.id );
if ( QUEST_VAR_ATTUNE == 1 && QUEST_VAR_CLASS == 1 && QUEST_VAR_TRADE == 1 )
{
player.questUpdate( this.id, this.SEQ_FINISH );
}
}
//////////////////////////////////////////////////////////////////////
// Available Scenes in this quest, not necessarly all are used
def Scene00000( player )
{
player.eventPlay( this.id, 0, 0x2000/*flags*/, 0/*unk*/, 0/*unk*/,
fun( player, eventId, param1, param2, param3 )
{
if( param2 == 1 ) // accept quest
{
ManFst004.Scene00050( player );
}
});
}
def Scene00001( player )
{
player.eventPlay( this.id, 1, 0x0EFB/*flags*/, 0/*unk*/, 0/*unk*/,
fun( player, eventId, param1, param2, param3 )
{
player.setQuestUI8AL( ManFst004.id, 1 );
ManFst004.checkQuestCompletion( player, 0 );
});
}
def Scene00002( player )
{
player.eventPlay( this.id, 2, 0, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
player.setQuestUI8BH( ManFst004.id, 1 );
ManFst004.checkQuestCompletion( player, 3 );
});
}
def Scene00003( player )
{
player.eventPlay( this.id, 3, NONE/*flags*/, 0/*unk*/, 0/*unk*/,
fun( player, eventId, param1, param2, param3 )
{
if ( param2 == 1 )
{
ManFst004.Scene00100( player );
}
else
{
ManFst004.Scene00099( player );
}
});
}
def Scene00004( player )
{
player.eventPlay( this.id, 4, 0, 0, 0 );
}
def Scene00005( player )
{
player.eventPlay( this.id, 5, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
if( param2 == 1 ) // finish quest
{
if( player.giveQuestRewards( ManFst004.id, 0 ) )
{
player.questFinish( ManFst004.id );
}
}
});
}
def Scene00050( player )
{
player.eventPlay( this.id, 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0/*unk*/, 0/*unk*/,
fun( player, eventId, param1, param2, param3 )
{
// accepting quest "close to home"
player.questUpdate( ManFst004.id, 1 );
player.setQuestUI8CH( ManFst004.id, 1 ); // receive key item
// event is done, need to teleport to real zone.
player.setZone( 132 );
//player.setZone(183); back to starting griania for debug purpose
});
}
def Scene00051( player )
{
player.eventPlay( this.id, 51, 0, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
ManFst004.Scene00001( player );
});
}
def Scene00099( player )
{
player.eventPlay( this.id, 99, 0, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
ManFst004.Scene00004( player );
});
}
def Scene00100( player )
{
player.eventPlay( this.id, 100, 0x0EFB, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
player.setQuestUI8CH( ManFst004.id, 0 ); // remove key item, since we have just traded it
player.setQuestUI8BL( ManFst004.id, 1 );
ManFst004.checkQuestCompletion(player, 2 );
});
}
def onTalk( eventId, player, actorId )
{
var actor = mapActor( actorId );
if( actor == this.ACTOR0 )
{
this.Scene00000( player );
}
else if( actor == this.ACTOR1 )
{
// starting the Aetheryte eventaction
// player.eventStart( actorId, 0x050002, 7, 0, 0);
// starting the eventaction 0x13 ( attuning )
player.eventActionStart( 0x050002, 0x13,
fun( player, eventId, additional )
{
player.questMessage( 0x050002, 0, 1, 0, 0 );
player.aetheryteRegister( 2 );
player.learnAction( 1 );
ManFst004.Scene00051( player );
},
fun( player, eventId, additional ) {},
eventId );
}
else if( actor == this.ACTOR2 )
{
this.Scene00002( player );
}
else if( actor == this.ACTOR3 )
{
this.Scene00003( player );
}
else if( actor == this.ACTOR4 )
{
this.Scene00005( player );
}
}
};
GLOBAL ManFst004 = ManFst004Def();