public override bool FireEvent(Event E) { if (E.ID == "OwnerGetInventoryActions") { GameObject targetObject = E.GetGameObjectParameter("Object"); try { Egocarib.Code.Egcb_UIMonitor.DirectEnableUIMode("Popup", "LookTiler", targetObject); //enable popup mode to draw tiles while this item's popup menus (interact / description) are open } catch (Exception ex) { Debug.Log("QudUX Mod: Encountered an exception trying to DirectEnable Popup UI mode for object " + (targetObject == null ? "<NULL>" : targetObject.DisplayNameOnlyDirect) + "\n\nException:\n" + ex); } } if (E.ID == "PlayerBeginConversation") { Egcb_PlayerUIHelper.PlayerBody = XRLCore.Core.Game.Player.Body; GameObject speaker = E.GetGameObjectParameter("Speaker"); if (speaker != null) { Egcb_PlayerUIHelper.ConversationPartner = speaker; if (Egcb_PlayerUIHelper.CurrentInteractionZoneID != speaker.CurrentCell.ParentZone.ZoneID) { Egcb_PlayerUIHelper.ZoneTradersTradedWith.Clear(); Egcb_PlayerUIHelper.CurrentInteractionZoneID = speaker.CurrentCell.ParentZone.ZoneID; } string questID = speaker.GetStringProperty("GivesDynamicQuest", string.Empty); Conversation convo = E.GetParameter <Conversation>("Conversation"); if (speaker.HasPart("GenericInventoryRestocker") || speaker.HasPart("Restocker")) { try { Egcb_PlayerUIHelper.AddChoiceToRestockers(convo, speaker); } catch (Exception ex) { Debug.Log("QudUX Mod: Encountered exception while adding conversation choice to merchant to ask about restock duration.\nException details: \n" + ex.ToString()); } } if (questID == string.Empty || XRLCore.Core.Game.FinishedQuests.ContainsKey(questID)) //speaker has no dynamic quests { try { this.AddChoiceToIdentifyQuestGivers(convo, speaker); } catch (Exception ex) { Debug.Log("QudUX Mod: Encountered exception while adding conversation choices to identify village quest givers.\nException details: \n" + ex.ToString()); } } else //speaker does have dynamic quest { //Previously we updated "some forgotten ruins" references in quest conversations here, but that is now handled with a Harmony patch. } try { Egocarib.Code.Egcb_UIMonitor.DirectEnableUIMode("Conversation", "ConversationTiler", speaker); //enable conversation mode to draw tiles while the conversationUI is open } catch (Exception ex) { Debug.Log("QudUX Mod: Encountered an exception trying to DirectEnable Conversation UI mode for speaker " + (speaker == null ? "<NULL>" : speaker.DisplayNameOnlyDirect) + "\n\nException:\n" + ex); } } } else if (E.ID == "ObjectEnteringCellBlockedBySolid") { GameObject barrier = E.GetGameObjectParameter("Object"); if (barrier.CurrentCell.ParentZone.ZoneID != this.ParentObject.CurrentCell.ParentZone.ZoneID) //ran into a wall or object in another zone while trying to leave the zone { Cell centerCell = this.ParentObject.CurrentCell.ParentZone.GetCell(40, 12); string direction = this.ParentObject.CurrentCell.GetDirectionFromCell(centerCell); Cell effectOriginCell = this.ParentObject.CurrentCell.GetCellFromDirection(direction, true) ?? this.ParentObject.CurrentCell; int effectX = effectOriginCell.X; int effectY = effectOriginCell.Y; int rand = Stat.Random(1, 3); string text; if (rand == 1) { text = "&wOUCH!"; } else if (rand == 2) { text = barrier.IsWall() ? "&wWall!" : "&wBlocked!"; } else { text = "&wBlocked!"; } //when moving eastward into a new cell, most of the phrase is cut off the edge of the screen, so we need to shift it left to accomodate the string size int phraseLength = ConsoleLib.Console.ColorUtility.StripFormatting(text).Length; if ((80 - effectX) < phraseLength) { effectX = Math.Max(10, 80 - phraseLength); } float num = (float)this.GetDegreesForVisualEffect(direction) / 58f; float xDel = (float)Math.Sin((double)num) / 4f; float yDel = (float)Math.Cos((double)num) / 4f; XRLCore.ParticleManager.Add(text, (float)effectX, (float)effectY, xDel, yDel, 22, 0f, 0f); } } return(base.FireEvent(E)); }
public static void SetTraderInteraction() { Egcb_PlayerUIHelper.ZoneTradersTradedWith.Add(Egcb_PlayerUIHelper.ConversationPartner); Egcb_PlayerUIHelper.AddChoiceToRestockers(); }