Exemplo n.º 1
0
        // first hack erekose
        private void brutalConversationAddOnQuestEnd(Quest quest)
        {
            if (ActorSNO.Id == 4580) // for now only leah is concerned :p
            {
                Logger.Debug(" (brutalCOnversationAssOnQuestEnd) called on quest {0} for actor with dynamic ID {1} ", quest.SNOHandle.Id, DynamicID);
                if (quest.IsDone())
                {
                    // check if NPC has the conversation in its inherited ConversationList
                    if ((ConversationList != null))
                        if (ConversationList.ConversationListEntries != null)
                            if (ConversationList.ConversationListEntries.Count > 0)
                            {
                                var convlistentries = ConversationList.ConversationListEntries;
                                bool l_found = false;
                                foreach (var convlistentry in convlistentries)
                                {
                                    if (convlistentry.SNOConv == 198541)
                                    {
                                        Logger.Debug(" (brutalCOnversationAssOnQuestEnd) NPC has the conversation 198541 in it inherited ConversationList ");
                                        l_found = true;
                                        break;
                                    }
                                }
                                if (!l_found)
                                    Logger.Debug(" (brutalCOnversationAssOnQuestEnd) NPC DOES NOT HAVE THE conversation 198541 in it inherited ConversationList !! THIS IS BAD !!");
                            }
                    //else
                    //{
                    //    Logger.Debug(" (brutalCOnversationAssOnQuestEnd) the inherited ConversationList IS NULL OR EMPTY WTF ????");
                    //}

                    Logger.Debug(" (brutalCOnversationAssOnQuestEnd) quest is marked as done trying to get the conversation lists ");
                    // looking for conversation in the whole conversation set !!! 
                    var conv_assets = Mooege.Common.MPQ.MPQStorage.Data.Assets[Common.Types.SNO.SNOGroup.Conversation];
                    var convs = from conv_asset in conv_assets.Values
                                where (conv_asset.Data as Mooege.Common.MPQ.FileFormats.Conversation).SNOQuest == quest.SNOHandle.Id
                                select (conv_asset.Data as Mooege.Common.MPQ.FileFormats.Conversation);
                    foreach (var conv in convs)
                    {
                        int[] tab = { conv.SNOAltNpc1, conv.SNOAltNpc2, conv.SNOAltNpc3, conv.SNOAltNpc4, conv.SNOPrimaryNpc };
                        if (tab.Contains(ActorSNO.Id))
                        {
                            Logger.Debug(" (brutalCOnversationAssOnQuestEnd) Trying to add conversation : INTERACTIVE NPC {0} is present in Conversation {1} SNO alt NPC where : {2}", ActorSNO.Id, conv.Header.SNOId, tab);
                            if (Conversations.Exists(x => x.ConversationSNO == conv.Header.SNOId))
                            {
                                //RAS 
                                Logger.Debug(" (brutalCOnversationAssOnQuestEnd) already present doing nothing ");
                            }
                            else
                            {
                                Logger.Debug(" (brutalCOnversationAssOnQuestEnd) added !!");
                                Conversations.Add(new ConversationInteraction(conv.Header.SNOId));
                            }
                        }
                    }

                }
            }

        }
Exemplo n.º 2
0
        private void UpdateConversationQuestList(Quest quest)
        {
            if ((ActorSNO.Id == 4580) && DynamicID == 83) // for now only the Leah near the stash
            {
                if (quest.IsDone())
                {
                    if (ConversationList != null) // this is from Actor
                    {
                        var ConversationsNew = new List<int>();
                        foreach (var entry in ConversationList.ConversationListEntries) // again on actor
                        {                        
                            if (entry.SNOQuestComplete == quest.SNOHandle.Id)   // we'll refine later...
                                ConversationsNew.Add(entry.SNOConv);
                        }

                        // remove outdates conversation options and add new ones
                        Conversations = Conversations.Where(x => ConversationsNew.Contains(x.ConversationSNO)).ToList(); // this is in the InteractiveNPC
                        foreach (var sno in ConversationsNew)
                            if (!Conversations.Select(x => x.ConversationSNO).Contains(sno))
                                Conversations.Add(new ConversationInteraction(sno));

                        // search for an unread questconversation
                        bool questConversation = false;
                        foreach (var conversation in Conversations) // this is in the InteractiveNPC
                            if (Mooege.Common.MPQ.MPQStorage.Data.Assets[Common.Types.SNO.SNOGroup.Conversation].ContainsKey(conversation.ConversationSNO))
                                if ((Mooege.Common.MPQ.MPQStorage.Data.Assets[Common.Types.SNO.SNOGroup.Conversation][conversation.ConversationSNO].Data as Mooege.Common.MPQ.FileFormats.Conversation).I0 == 1)
                                    if (conversation.Read == false)
                                    {
                                        // Logger.Debug(" (UpdateConversationList) for actor {0}-{1} has unread quest conversation no {2}: ", ActorSNO.Id, ActorSNO.Name, conversation.ConversationSNO);
                                        questConversation = true;
                                    }

                        // show the exclamation mark if actor has an unread quest conversation
                        Attributes[GameAttribute.Conversation_Icon, 0] = questConversation ? 1 : 0;
                        Attributes.BroadcastChangedIfRevealed();
                    }
                }
            }
        }