/// <summary> /// Static function for using in all quests (for smaller code) /// changed: 01.10.05, need mod /// </summary> public static DialogStatus QDS( Mobile questOwner, Character c, BaseQuest bq ) { DialogStatus result = DialogStatus.ChatUnAvailable; if ( questOwner.Reputation( c ) > bq.MinReputation ) { if ( !c.QuestDone( bq ) ) // этот квест уже пройден { if ( !c.HaveQuest( bq ) ) // у чара нету этого квеста { if ( AllowedTo( bq, c ) ) // разрешено выдать, подходит ( расса, класс, скилл ) { if ( bq.PreviousQuest > 0 ) // этот квест из серии, необходимо закончить предыдущий { BaseQuest q = World.CreateQuestById( bq.PreviousQuest ); if ( q != null && c.QuestDone( q ) ) { result = DialogStatus.SingleQuestAvailable; //предыдущий закончен, этот можно получить } } else // квест одиночный или начальный для серии { result = DialogStatus.SingleQuestAvailable; } } } else // Character have this quest already { ActiveQuest aq = c.FindPlayerQuest( bq ); if ( aq.Completed ) // закончен квест, нужно наградить { result = aq.Repeatable ? DialogStatus.RepeatQuestCompleate : DialogStatus.SingleQuestCompleate; } else if ( !QuestForNPC( bq, (BaseNPC)questOwner ) ) // квест не для этого нпс? { result = DialogStatus.QuestUnCompleate; } } } } return result; }
/// <summary> /// private internal Events on quest selections /// changed: 02.10.05 /// </summary> private void DoQuestEvents( Character c, BaseQuest bq ) { if ( c.QuestDone( bq ) ) return; if ( !c.QuestCompleted( bq ) ) { if ( !c.HaveQuest( bq ) ) { if ( bq.HaveDeliveryObj && !HaveFreeSlot( c ) ) // quest need free slot { c.QuestFailed( qFailedReason.InventoryFull ); } else if ( AmountActiveQuests( c ) >= 20 ) // questLog is full { c.QuestLogIsFull(); } else // can get quest {//need add questEmotion[] on get quest c.ResponseQuestDetails( this, bq.Id, bq.Name, bq.Desc, bq.Details, getEmoteOnStart( bq ) ); //c.ResponseQuestDetails( this, bq.Id, bq.Name, bq.Desc, bq.Details, new qEmote[] { new qEmote( Emote.ONESHOT_TALK, 500 ) } ); } } else { //c.QuestInvalid( qInvalidReason.ReadyHaveThatQuest ); c.SendGossip( this, OnlyQuests ? (int)NPCMenuId.Quests : (int)NPCMenuId.MainMenu, null, null ); //c.ResponseMessage( this, OnlyQuests ? (int)NPCMenuId.Quests : (int)NPCMenuId.MainMenu, bq.ProgressDialog ); } } else if ( c.QuestCompleted( bq ) ) {//need add questEmotion[] on complete quest c.OfferReward( this, bq.Id, bq.FinishTitle, bq.FinishDialog, getEmoteOnEnd( bq ) ); //c.OfferReward( this, bq.Id, bq.FinishTitle, bq.FinishDialog, new qEmote[] { new qEmote( Emote.ONESHOT_TALK, 500 ) } ); } }
/// <summary> /// User have [result] quests from NPC /// </summary> public static int AmountMyQuests( Character c, BaseNPC npc ) { int result = 0; if ( npc.Quests != null ) { foreach ( BaseQuest bq in npc.Quests ) { result += c.HaveQuest( bq ) ? 1 : 0; } } return result; }