using System.Xml.Linq; public class MinEventActionGiveQuestRebirth : MinEventActionRemoveBuff { private string ID = ""; public override void Execute(MinEventParams _params) { if (GameManager.IsDedicatedServer) { //Log.Out("MinEventActionGiveQuestRebirth-Execute IS SERVER"); return; } //Log.Out("MinEventActionGiveQuestRebirth-Execute IS CLIENT"); var player = _params.Self as EntityPlayerLocal; Quest newQuest = QuestClass.CreateQuest(ID); if (newQuest == null) return; if (newQuest != null) { QuestClass questClass = newQuest.QuestClass; if (questClass != null) { for (int i = 0; i < player.QuestJournal.quests.Count; i++) { //Log.Out("QUEST ID: " + player.QuestJournal.quests[i].ID); //Log.Out("QUEST STATE: " + player.QuestJournal.quests[i].CurrentState); if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress) { if (player.QuestJournal.quests[i].ID.ToLower() == ID.ToLower()) { GameManager.ShowTooltip((EntityPlayerLocal)player, Localization.Get("questunavailable")); //Log.Out("YOU ALREADY HAVE THIS QUEST"); return; } } } player.QuestJournal.AddQuest(newQuest); return; } } } public override bool ParseXmlAttribute(XAttribute _attribute) { var flag = base.ParseXmlAttribute(_attribute); if (flag) return true; var name = _attribute.Name; if (name == null) { return flag; } else if (name == "ID") { ID = _attribute.Value; return true; } else { return false; } } }