protected void AddSearchArea(QuestSearchArea searchArea) { if (m_searchAreas.Contains(searchArea) == false) { m_searchAreas.Add(searchArea); } }
public virtual bool Command(GamePlayer player, eQuestCommand command, AbstractArea area = null) { if (m_searchAreas == null || m_searchAreas.Count == 0) { return(false); } if (player == null || command == eQuestCommand.None) { return(false); } if (command == eQuestCommand.Search) { foreach (AbstractArea playerArea in player.CurrentAreas) { if (playerArea is QuestSearchArea) { QuestSearchArea questArea = playerArea as QuestSearchArea; if (questArea != null && questArea.Step == Step) { foreach (QuestSearchArea searchArea in m_searchAreas) { if (searchArea == questArea) { StartQuestActionTimer(player, command, questArea.SearchSeconds); return(true); } } } } } } return(false); }
/// <summary> /// Add a search area to the static list of all DataQuest search areas /// </summary> /// <param name="str"></param> protected void CreateSearchArea(string areaStr) { try { string[] parse = areaStr.Split(';'); int requiredStep = 0; if (parse[0] == "SEARCHSTART") { requiredStep = 0; m_searchStartItemTemplate = parse[1]; } else { requiredStep = Convert.ToInt32(parse[1]); } // 0 1 2 3 4 5 6 7 // COMMAND;3;Search for necklace here;12;8000;74665;500;20 QuestSearchArea questArea = new QuestSearchArea(this, requiredStep, parse[2], Convert.ToUInt16(parse[3]), Convert.ToInt32(parse[4]), Convert.ToInt32(parse[5]), Convert.ToInt32(parse[6]), Convert.ToInt32(parse[7])); m_allQuestSearchAreas.Add(new KeyValuePair<int,QuestSearchArea>(ID, questArea)); m_lastErrorText += string.Format(" ::Created Search Area for quest {0}, step {1} in region {2} at X:{3}, Y:{4}, Radius:{5}, Text:{6}, Seconds:{7}.", Name, requiredStep, parse[3], parse[4], parse[5], parse[6], parse[2], parse[7]); } catch { string error = "Error creating search area for " + m_dataQuest.Name + " (" + m_dataQuest.ID + "), area str = '" + areaStr + "'"; log.Error(error); m_lastErrorText += error; } }