/// <summary> /// Add an interact item associated with a step for this quest /// </summary> /// <param name="step">What step is this item valid for</param> /// <param name="staticObjectName">the name of the static item to interact with</param> /// <param name="numRequired">How many times to interact before this step is complete</param> /// <param name="itemResult">What item is given to the player when interacting</param> /// <param name="interactText">Text presented to player when interacting with the object</param> protected void AddInteractStep(int step, string objectName, int numRequired, ItemTemplate itemResult, string interactText) { try { QuestStepInteraction info = new QuestStepInteraction(); info.objectName = objectName; info.numRequired = numRequired; info.itemResult = itemResult; info.interactText = interactText; m_interactions.Add(step, info); } catch (Exception ex) { log.Error("Error adding Interact Step, possible duplicate?", ex); } }
/// <summary> /// We are interacting with an object, check to see if this quest and step needs to respond /// </summary> /// <param name="player"></param> /// <param name="staticItem"></param> protected void InteractWithObject(GamePlayer player, GameStaticItem staticItem) { if (_interactions.Count > 0) { if (_interactions.ContainsKey(Step)) { QuestStepInteraction info = _interactions[Step]; if (staticItem.Name == info.ObjectName) { if (GiveItem(player, info.ItemResult, false)) { player.Out.SendMessage(info.InteractText, eChatType.CT_System, eChatLoc.CL_SystemWindow); staticItem.RemoveFromWorld(InteractItemRespawnSeconds); OnObjectInteract(info); } } } } }
/// <summary> /// We are interacting with an object, check to see if this quest and step needs to respond /// </summary> /// <param name="player"></param> /// <param name="staticItem"></param> protected void InteractWithObject(GamePlayer player, GameStaticItem staticItem) { if (m_interactions.Count > 0) { if (m_interactions.ContainsKey(Step)) { QuestStepInteraction info = m_interactions[Step]; if (staticItem.Name == info.objectName) { if (GiveItem(player, info.itemResult, false)) { player.Out.SendMessage(info.interactText, eChatType.CT_System, eChatLoc.CL_SystemWindow); staticItem.RemoveFromWorld(INTERACT_ITEM_RESPAWN_SECONDS); OnObjectInteract(info); } } } } }
/// <summary> /// When an object is interacted with this message is sent after world item is removed and inventory item added /// </summary> /// <param name="info"></param> protected virtual void OnObjectInteract(QuestStepInteraction info) { // this is needed in order to support both Base and Reward quests log.Error("Override OnObjectInteract to advance goal progress"); }
/// <summary> /// When an object is interacted with this message is sent after world item is removed and inventory item added /// </summary> /// <param name="info"></param> protected virtual void OnObjectInteract(QuestStepInteraction info) { // this is needed in order to support both Base and Reward quests Log.Error("Override OnObjectInteract to advance goal progress"); }