public void PerformerUpdate(SigActorsData actors, SigPerfData data)
        {
            if (actors == null)
            {
                return;
            }
            Dictionary <string, BmpLocalPerformer> performerNames = this.GetPerformerNames();

            foreach (ActorData ad in actors.currentActors.Values.ToList())
            {
                this.PerformersInvoke(t => {
                    if (performerNames.ContainsKey(ad.name))
                    {
                        // Needs name cache because they might zone in or out
                        uint perfId = ad.perfid / 2;
                        if (perfId >= 0 && perfId < 99)
                        {
                            if (!data.Performances.ContainsKey(perfId))
                            {
                                return;
                            }
                            PerformanceData pdata = data.Performances[perfId];
                            Console.WriteLine(string.Format("{0}: {1}", ad.name, pdata.IsReady()));
                            performerNames[ad.name].PerformanceUp = pdata.IsReady();
                        }
                    }
                });
            }
        }
Exemple #2
0
        public void PipeMessage(NamedPipeConnection <PipeData, PipeData> conn, PipeData message)
        {
            Type type = Type.GetType(message.id + ",FFMemoryParser");

            if (type == null)
            {
                return;
            }

            Object obj = message.data.ToObject();

            if (obj != null)
            {
                if (type.Name == "SignatureList")
                {
                    Memory.SignatureList data = (obj as Memory.SignatureList);
                    if (data != null)
                    {
                        foreach (Signature item in data)
                        {
                            Console.WriteLine(string.Format("Signature {0} Not found!", item.Key));
                        }
                    }
                }

                if (type.Name == "SigWorldData")
                {
                    SigWorldData data = (obj as SigWorldData);
                    if (data != null)
                    {
                        World = data.world;
                    }
                }
                if (type.Name == "SigCharIdData")
                {
                    SigCharIdData data = (obj as SigCharIdData);
                    if (data != null)
                    {
                        CharacterID = data.id;
                        OnCharacterId?.Invoke(this, CharacterID);
                    }
                }
                // ...
                if (type.Name == "SigPerfData")
                {
                    SigPerfData data = (obj as SigPerfData);
                    if (data != null)
                    {
                        performanceData = data;

                        OnPerformanceChanged?.Invoke(this, performanceData);
                    }
                }
                if (type.Name == "SigActorsData")
                {
                    SigActorsData data = (obj as SigActorsData);
                    if (data != null)
                    {
                        actorData = data;

                        ActorData local = null;
                        if (actorData.currentActors.Count > 0)
                        {
                            local = actorData.currentActors.First().Value;
                        }
                        if (localPlayer == null || local.name != localPlayer.name)
                        {
                            localPlayer = local;
                            if (localPlayer != null)
                            {
                                OnLocalPlayerLogin?.Invoke(this, localPlayer);
                            }
                            else
                            {
                                OnLocalPlayerLogout?.Invoke(this, localPlayer);
                            }
                        }
                    }
                }
                if (type.Name == "SigChatLogData")
                {
                    SigChatLogData data = (obj as SigChatLogData);
                    if (data != null)
                    {
                        foreach (ChatLogItem item in data.chatMessages)
                        {
                            OnChatReceived?.Invoke(this, item);
                        }
                    }
                }
                if (type.Name == "SigChatInputData")
                {
                    SigChatInputData data = (obj as SigChatInputData);
                    if (data != null)
                    {
                        ChatInputOpen = data.open;
                        if (data.open)
                        {
                            Console.WriteLine(data.text);
                        }
                    }
                }
            }
        }