예제 #1
0
 /// <summary>
 /// Send the quest dialogue for a classic quest to the player
 /// </summary>
 /// <param name="questType"></param>
 /// <param name="sentence"></param>
 /// <param name="player"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 public static bool ProposeQuestToPlayer(Type questType, string sentence, GamePlayer player, GameNPC source)
 {
     if (CanGiveQuest(questType, player, source) > 0)
     {
         if (questType.IsSubclassOf(typeof(RewardQuest)))
         {
             RewardQuest rquest = null;
             foreach (Assembly asm in ScriptMgr.Scripts)
             {
                 try
                 {
                     rquest = (RewardQuest)asm.CreateInstance(questType.FullName, false, BindingFlags.CreateInstance, null, new object[] { }, null, null);
                 }
                 catch (Exception e)
                 {
                     if (log.IsErrorEnabled)
                     {
                         log.Error("ProposeQuestToPlayer.RewardQuest", e);
                     }
                 }
                 if (rquest != null)
                 {
                     break;
                 }
             }
             player.Out.SendQuestOfferWindow(source, player, rquest);
         }
         else
         {
             player.Out.SendQuestSubscribeCommand(source, QuestMgr.GetIDForQuestType(questType), sentence);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }