/// <summary> /// Get or create the CharacterXDataQuest for this player /// </summary> /// <param name="player"></param> /// <returns></returns> public static CharacterXDataQuest GetCharacterQuest(GamePlayer player, int ID, bool create) { CharacterXDataQuest charQuest = GameServer.Database.SelectObject<CharacterXDataQuest>("Character_ID ='" + GameServer.Database.Escape(player.QuestPlayerID) + "' AND DataQuestID = " + ID); if (charQuest == null && create) { charQuest = new CharacterXDataQuest(player.QuestPlayerID, ID); charQuest.Count = 0; charQuest.Step = 0; GameServer.Database.AddObject(charQuest); } return charQuest; }
/// <summary> /// Dataquest that belongs to a player /// </summary> /// <param name="questingPlayer"></param> /// <param name="dataQuest"></param> /// <param name="charQuest"></param> public DataQuest(GamePlayer questingPlayer, DBDataQuest dataQuest, CharacterXDataQuest charQuest) : this(questingPlayer, null, dataQuest, charQuest) { }
/// <summary> /// This is a dataquest that belongs to a player /// </summary> /// <param name="questingPlayer"></param> /// <param name="dbQuest"></param> /// <param name="charQuest"></param> public DataQuest(GamePlayer questingPlayer, GameObject sourceObject, DBDataQuest dataQuest, CharacterXDataQuest charQuest) { m_questPlayer = questingPlayer; m_step = 1; m_dataQuest = dataQuest; m_charQuest = charQuest; if (sourceObject != null) { if (sourceObject is GameNPC) { m_startNPC = sourceObject as GameNPC; } m_startObject = sourceObject; } ParseQuestData(); }
/// <summary> /// Get or create the CharacterXDataQuest for this player /// </summary> /// <param name="player"></param> /// <returns></returns> public static CharacterXDataQuest GetCharacterQuest(GamePlayer player, int ID, bool create) { CharacterXDataQuest charQuest = GameServer.Database.SelectObjects<CharacterXDataQuest>("`Character_ID` = @Character_ID AND `DataQuestID` = @DataQuestID", new[] { new QueryParameter("@Character_ID", player.QuestPlayerID), new QueryParameter("@DataQuestID", ID) }).FirstOrDefault(); if (charQuest == null && create) { charQuest = new CharacterXDataQuest(player.QuestPlayerID, ID); charQuest.Count = 0; charQuest.Step = 0; GameServer.Database.AddObject(charQuest); } return charQuest; }