public bool?QueryDebug(IQueryEvent query) { var context = Resolve <IEventManager>().Context; bool result = true; InnerQuery(context, query, true, x => result = x); return(result); }
public void TestAddQueryEvent() { ShardImpl shard = new ShardImpl(new ShardId(1), Stub <ISessionFactoryImplementor>()); try { shard.AddQueryEvent(null, null); Assert.Fail("expected npe"); } catch (NullReferenceException npe) { // good } QueryId queryId = new QueryId(1); try { shard.AddQueryEvent(queryId, null); Assert.Fail("expected npe"); } catch (NullReferenceException npe) { // good } IQueryEvent qe = Stub <IQueryEvent>(); try { shard.AddQueryEvent(null, qe); Assert.Fail("expected npe"); } catch (NullReferenceException npe) { // good } shard.AddQueryEvent(queryId, qe); //assertNotNull(shard.getQueryEventMap()); //assertEquals(1, shard.getQueryEventMap().size()); //assertEquals(1, shard.getQueryEventMap().get(queryId).size()); //assertSame(qe, shard.getQueryEventMap().get(queryId).get(0)); // now add another event to the same query IQueryEvent anotherQe = Stub <IQueryEvent>(); shard.AddQueryEvent(queryId, anotherQe); //assertNotNull(shard.getQueryEventMap()); //assertEquals(1, shard.getQueryEventMap().size()); //assertEquals(2, shard.getQueryEventMap().get(queryId).size()); //assertSame(qe, shard.getQueryEventMap().get(queryId).get(0)); //assertSame(anotherQe, shard.getQueryEventMap().get(queryId).get(1)); // now add an event to a different query QueryId anotherQueryId = new QueryId(3); IQueryEvent yetAnotherQe = Stub <IQueryEvent>(); shard.AddQueryEvent(anotherQueryId, yetAnotherQe); //assertNotNull(shard.getQueryEventMap()); //assertEquals(2, shard.getQueryEventMap().size()); //assertEquals(2, shard.getQueryEventMap().get(queryId).size()); //assertSame(qe, shard.getQueryEventMap().get(queryId).get(0)); //assertSame(anotherQe, shard.getQueryEventMap().get(queryId).get(1)); //assertEquals(1, shard.getQueryEventMap().get(anotherQueryId).size()); //assertSame(yetAnotherQe, shard.getQueryEventMap().get(anotherQueryId).get(0)); }
public static IQueryEvent Serdes(IQueryEvent genericEvent, ISerializer s, AssetType textType, ushort textSourceId) { var subType = s.EnumU8("SubType", genericEvent?.QueryType ?? QueryType.IsScriptDebugModeActive); switch (subType) { case QueryType.InventoryHasItem: case QueryType.UsedItemId: return(QueryItemEvent.Serdes((QueryItemEvent)genericEvent, s, subType)); case QueryType.ChosenVerb: return(QueryVerbEvent.Serdes((QueryVerbEvent)genericEvent, s)); case QueryType.IsPartyMemberConscious: case QueryType.IsPartyMemberLeader: case QueryType.HasPartyMember: return(QueryPartyEvent.Serdes((QueryPartyEvent)genericEvent, s, subType)); case QueryType.PreviousActionResult: break; case QueryType.Ticker: break; case QueryType.CurrentMapId: break; case QueryType.TriggerType: break; case QueryType.PromptPlayer: return(PromptPlayerEvent.Serdes((PromptPlayerEvent)genericEvent, s, textType, textSourceId)); case QueryType.PromptPlayerNumeric: return(PromptPlayerNumericEvent.Serdes((PromptPlayerNumericEvent)genericEvent, s)); } var e = (QueryEvent)genericEvent ?? new QueryEvent { QueryType = subType }; s.Begin(); e.Operation = s.EnumU8(nameof(Operation), e.Operation); e.Immediate = s.UInt8(nameof(Immediate), e.Immediate); e.Unk4 = s.UInt8(nameof(Unk4), e.Unk4); e.Unk5 = s.UInt8(nameof(Unk5), e.Unk5); e.Argument = s.UInt16(nameof(Argument), e.Argument); ApiUtil.Assert(e.Unk4 == 0); ApiUtil.Assert(e.Unk5 == 0); s.End(); return(e); }
/// <summary> /// TODO: Documentation /// </summary> /// <param name="id">the id of the Query with which the event should be associated</param> /// <param name="event">the event to add</param> public void AddQueryEvent(QueryId id, IQueryEvent @event) { throw new System.NotImplementedException(); }
/// <summary> /// TODO: Documentation /// </summary> /// <param name="id">the id of the Query with which the event should be associated</param> /// <param name="event">the event to add</param> public void AddQueryEvent(QueryId id, IQueryEvent @event) { AddEventToMap(queryEventMap, id, @event); }
bool InnerQuery(EventContext context, IQueryEvent query, bool debugInspect, Action <bool> continuation) { var game = Resolve <IGameState>(); switch (query, query.QueryType) {
bool Query(IQueryEvent query, Action <bool> continuation) { var context = Resolve <IEventManager>().Context; return(InnerQuery(context, query, false, continuation)); }