1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-22 12:47:45 +00:00
sapphire/scripts/chai/quest/ManFst002.chai
2017-08-29 23:22:41 +02:00

258 lines
7.3 KiB
ChaiScript

// Quest Script: ManFst002_00124
// Quest Name: Close to Home
// Quest ID: 65660
// Start NPC: 1001140
// End NPC: 1000100
class ManFst002Def
{
//////////////////////////////////////////////////////////////////////
// default ctor
def ManFst002Def()
{
// Basic quest information
this.name = "Close to Home";
this.id = 65621;
// 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 = 1000251;
this.ACTOR20 = 1000159;
this.ACTOR3 = 1000768;
this.ACTOR4 = 1000100;
this.BIND_ACTOR0 = 6229224;
this.HOW_TO_DESION = 13;
this.HOW_TO_MAP_AND_NAVI = 4;
this.ITEM0 = 2000074;
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
{
ManFst002.Scene00050( player );
}
});
}
def Scene00001( player )
{
player.eventPlay( this.id, 1, 0x0EFB/*flags*/, 0/*unk*/, 0/*unk*/,
fun( player, eventId, param1, param2, param3 )
{
player.setQuestUI8AL( ManFst002.id, 1 );
ManFst002.checkQuestCompletion( player, 0 );
});
}
def Scene00002( player )
{
player.eventPlay( this.id, 2, 0, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
player.setQuestUI8BH( ManFst002.id, 1 );
ManFst002.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 )
{
ManFst002.Scene00100( player );
}
else
{
ManFst002.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( ManFst002.id, 0 ) )
{
player.questFinish( ManFst002.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( ManFst002.id, 1 );
player.setQuestUI8CH( ManFst002.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 )
{
ManFst002.Scene00001( player );
});
}
def Scene00099( player )
{
player.eventPlay( this.id, 99, 0, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
ManFst002.Scene00004( player );
});
}
def Scene00100( player )
{
player.eventPlay( this.id, 100, 0x0EFB, 0, 0,
fun( player, eventId, param1, param2, param3 )
{
player.setQuestUI8CH( ManFst002.id, 0 ); // remove key item, since we have just traded it
player.setQuestUI8BL( ManFst002.id, 1 );
ManFst002.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 eventaction 0x13 ( attuning )
player.eventActionStart( 0x050002, 0x13,
fun( player, eventId, additional )
{
player.questMessage( 0x050002, 0, 1, 0, 0 );
player.aetheryteRegister( 2 );
player.learnAction( 1 );
ManFst002.Scene00051( player );
},
fun( player, eventId, additional ) {},
0x050002 );
player.unlock();
}
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 ManFst002 = ManFst002Def();