private void RunLoop() { while (bRun) { RoomInformation r = ReadRoomInforation(); World = r.WorldNumber.ToString("X"); Room = r.RoomNumber.ToString("X"); Event = r.EventNumberMain.ToString("X"); foreach (var item in DataQuery.Instance.AllTriggers) { if (item.HasChildren()) { var list = item as TriggerList; foreach (Trigger child in list.Children) { RunTrigger(child, r); } } else { var t = item as Trigger; RunTrigger(t, r); } } } }
public Trigger(SerializationInfo info, StreamingContext ctxt) { RoomInfo = (RoomInformation)info.GetValue("RoomInformation", typeof(RoomInformation)); CodeEntries = (CodeEntries)info.GetValue("CodeEntries", typeof(CodeEntries)); StopWhenMapIsLoaded = (bool)info.GetValue("StopWhenMapIsLoaded", typeof(bool)); IsWorldWarp = (bool)info.GetValue("IsWorldWarp", typeof(bool)); HasEvent = (bool)info.GetValue("HasEvent", typeof(bool)); }
public Trigger(int w, int r, int e) { RoomInfo = new RoomInformation(); RoomInfo.WorldNumber = w; RoomInfo.RoomNumber = r; RoomInfo.EventNumberMain = e; CodeEntries = new CodeEntries(); }
public static RoomInformation ReadRoomInforation() { RoomInformation r = new RoomInformation(); r.WorldNumber = PCSX2_RAM.ReadBytes(IngameConstants.WORLD_PTR, 1)[0]; r.RoomNumber = PCSX2_RAM.ReadShort(IngameConstants.ROOM_PTR); r.EventNumberMain = PCSX2_RAM.ReadShort(IngameConstants.EVENT1_PTR); return(r); }
public void RunTrigger(Trigger t, RoomInformation r) { if (t.IsTriggered(r)) { if (t.StopWhenMapIsLoaded) { if (PCSX2_RAM.IsRoomWithPlayerLoaded()) { return; } } //Console.WriteLine("Executing trigger - " + t.RoomInfo.ToString()); t.CodeEntries.Execute(); } }
public bool IsTriggered(RoomInformation other) { if (HasEvent) { if (other.Equals(RoomInfo)) { return(true); } } else { if (other.Equals2(RoomInfo)) { return(true); } } return(false); }
public Trigger() { RoomInfo = new RoomInformation(); CodeEntries = new CodeEntries(); }