예제 #1
0
 public GameDialog(WorldClient Client, int NpcID, Npc npc, NpcQuestion nQuestion) : base(GameActionTypeEnum.DIALOG_CREATE, Client.Character)
 {
     this.NpcID    = NpcID;
     this.Client   = Client;
     this.Question = nQuestion;
     this.NPC      = npc;
 }
예제 #2
0
 public static void GiveQuestion(ActionModel action, Player perso, Player target, int itemID, int cellID)
 {
     if (action.args.Equals("DV"))
     {
         perso.GetClient().EndGameAction(GameActionTypeEnum.DIALOG_CREATE);
     }
     else
     {
         int qID = -1;
         try
         {
             qID = int.Parse(action.args);
         }
         catch (Exception localNumberFormatException)
         {
         }
         NpcQuestion quest = NpcQuestionTable.getNPCQuestion(qID);
         if (quest == null)
         {
             perso.GetClient().EndGameAction(GameActionTypeEnum.DIALOG_CREATE);
             return;
         }
         perso.Send(new NpcDialogQuestionMessage(quest, perso));
     }
 }
예제 #3
0
        public static void Load()
        {
            Cache.Clear();
            var reader = DatabaseManager.Provider.ExecuteReader("SELECT * FROM npc_questions");

            while (reader.Read())
            {
                var npc = new NpcQuestion()
                {
                    ID            = reader.GetInt32("ID"),
                    Reponses      = reader.GetString("responses"),
                    Args          = reader.GetString("params"),
                    Conditions    = reader.GetString("cond"),
                    FalseQuestion = reader.GetInt32("ifFalse"),
                };
                Cache.Add(npc.ID, npc);
            }
            reader.Close();

            Logger.Info("Loaded @'" + Cache.Count + "'@ NPC Questions");
        }
예제 #4
0
 private static void DialogStart(WorldClient Client, String Packet)
 {
     try
     {
         int npcID = int.Parse(Packet.Substring(2).Split((char)0x0A)[0]);
         Npc npc   = Client.Character.myMap.getNPC(npcID);
         if (npc == null)
         {
             return;
         }
         Client.Send(new NpcDialogStartMessage(npcID));
         int qID = npc.get_template().InitQuestion;
         if (!NpcQuestionTable.Cache.ContainsKey(qID))
         {
             Client.Send(new NpcEndDialogMessage());
         }
         NpcQuestion quest = NpcQuestionTable.Cache[qID];
         Client.AddGameAction(new GameDialog(Client, npcID, npc, quest));
     }
     catch (Exception e)
     {
     }
 }
예제 #5
0
 public NpcDialogQuestionMessage(NpcQuestion npc, Player charc)
 {
     this.Question  = npc;
     this.Character = charc;
 }