Xango's SeqNr Solution

Before Sending a request: store cmdId, seqNr and some piece of information that you can use to ensure that the Object you will receive is the Object you expected to receive. Example When sending a request for a PlayerInfo store the PlayerID of the player you are requesting PlayerInfo for. GameAPI.Game_Request(CmdId.Request_Player_Info, (ushort)SeqNr, new Id(playerID));

After Receiving the requested data: Check all 3 pieces of the Game Event to ensure that what was received is what was requested. Game_Event(CmdId cmdId, ushort seqNr, object data) Example Using the example above. The Event received has to be a PlayerInfo, the SeqNr has to be one I was expecting and the Received_PlayerInfo.entityId has to match the PlayerID I requested PlayerInfo for.

How I do this I have a Class called StorableData that I use to store all the various pieces of data that any chain of events could generate. internal class StorableData {           public string Requested; public string Match; public string function; public PlayerInfo TriggerPlayer; public List TargetPlayer; public ChatInfo ChatInfo; public IdStructureBlockInfo StructureBlockInfo; public PlayfieldEntityList PlayfieldEntities; public ConsoleCommandInfo ConsoleCommand; public Id PlayerConnected; public Id PlayerDisconnected; public IdList PlayerList; public ItemExchangeInfo ItemExchange; public IdCredits PlayerCredits; public IdPlayfield PlayfieldChange; public PlayfieldList PlayfieldList; public PlayfieldStats PlayfieldStats; public PlayfieldLoad PlayfieldLoad; public PlayfieldLoad PlayfieldUnload; public DediStats DediStats; public GameEventData GameEvent; public GlobalStructureList GlobalStructsList; public IdPositionRotation EntityPosRot; public FactionChangeInfo FactionChange; public FactionInfoList GetFactions; public StatisticsParam EventStatistics; public Id NewEntityId; public string OK; public ErrorInfo ErrorInfo; public Id PlayerDisconnectedWaiting; public IdStructureBlockInfo StructureBlockStatistics; public AlliancesTable AlliancesAll; public AlliancesFaction AlliancesFaction; public BannedPlayerData BannedPlayers; public TraderNPCItemSoldInfo TraderNPCItemSold; public Inventory PlayerGetAndRemoveInventory; public PdaStateChange PdaStateChange; public PlayfieldEntityList PlayfieldEntityList; public IdAndIntValue DialogButtonIndex; }

Before I send a request I create a new StorableData and add all the data I currently have to it then store that data in a Dictionary using the SeqNr as the Key and the StorableData as it's Value. internal static Dictionary SeqNrStorage = new Dictionary { };

Then When I receive an Event I retrieve from that Dictionary the StorableData listed for the received SeqNr so that I can check all 3 pieces of data.