private static void SLOracleBehaviorHasMark_GrabObject(On.SLOracleBehaviorHasMark.orig_GrabObject orig,
                                                               SLOracleBehaviorHasMark self, PhysicalObject item)
        {
            if (item is DataPearl dataPearl)
            {
                DataPearl.AbstractDataPearl.DataPearlType          pearlType  = dataPearl.AbstractPearl.dataPearlType;
                KeyValuePair <int, CustomWorldStructs.CustomPearl> foundPearl =
                    CustomWorldMod.customPearls.FirstOrDefault(x => x.Value.name.Equals(pearlType.ToString()));

                CustomWorldMod.Log($"Moon grabbed pearl: {pearlType}");

                // Pearl is not vanilla
                if (!foundPearl.Equals(default(KeyValuePair <int, CustomWorldStructs.CustomPearl>)))
                {
                    CustomWorldMod.Log($"Loading custom pearl...[{foundPearl.Value.name}] from [{foundPearl.Value.packName}]");
                    if (!self.State.HaveIAlreadyDescribedThisItem(item.abstractPhysicalObject.ID))
                    {
                        if (self.currentConversation != null)
                        {
                            self.currentConversation.Interrupt("...", 0);
                            self.currentConversation.Destroy();
                            self.currentConversation = null;
                        }
                        Conversation.ID id = Conversation.ID.None;
                        try
                        {
                            id = (Conversation.ID)Enum.Parse(typeof(Conversation.ID), "Moon_" + foundPearl.Value.name);
                        }
                        catch (Exception e)
                        {
                            CustomWorldMod.Log($"Conversation not found for [{foundPearl.Value.name}] + {e}");
                        }

                        self.currentConversation = new SLOracleBehaviorHasMark.MoonConversation(id, self, SLOracleBehaviorHasMark.MiscItemType.NA);
                        self.State.totalPearlsBrought++;
                        CustomWorldMod.Log("pearls brought up: " + self.State.totalPearlsBrought);
                        self.State.totalItemsBrought++;
                        self.State.AddItemToAlreadyTalkedAbout(item.abstractPhysicalObject.ID);

                        // <3 bee <3 ~ base.GrabObject(item)
                        var method = typeof(SLOracleBehavior).GetMethod("GrabObject");
                        var ftn    = method.MethodHandle.GetFunctionPointer();
                        var func   = (Action <PhysicalObject>)Activator.CreateInstance(typeof(Action <PhysicalObject>), self, ftn);
                        func(item);
                        // <3 bee <3

                        return;
                    }
                }
            }
            orig(self, item);
        }
        private static void MoonConversation_AddEvents(On.SLOracleBehaviorHasMark.MoonConversation.orig_AddEvents orig, SLOracleBehaviorHasMark.MoonConversation self)
        {
            bool foundPearl = false;

            foreach (KeyValuePair <int, CustomPearl> pearls in CustomWorldMod.customPearls)
            {
                if (foundPearl)
                {
                    break;
                }

                Conversation.ID id = (Conversation.ID)Enum.Parse(typeof(Conversation.ID), "Moon_" + pearls.Value.name);
                if (self.id == id)
                {
                    foundPearl = true;
                    self.PearlIntro();
                    LoadCustomEventsFromFile(pearls.Value.ID, CustomWorldMod.activatedPacks[pearls.Value.packName], self);
                }
            }
            orig(self);
        }
 public ConversationBehavior(MaxOracleBehavior owner, SubBehavior.SubBehavID ID, Conversation.ID convoID) : base(owner, ID)
 {
     this.convoID = convoID;
 }
Beispiel #4
0
 public patch_Conversation(IOwnAConversation interfaceOwner, Conversation.ID id, DialogBox dialogBox) : base(interfaceOwner, id, dialogBox)
 {
 }
 public MoonConversation(Conversation.ID id, PearlConversation pearlConversation) : base(pearlConversation, id, pearlConversation.dialogBox)
 {
     this.pearlConversation = pearlConversation;
     this.id = id;
     AddEvents();
 }
    public void PlayerSwallowItem(PhysicalObject item)
    {
        Debug.LogError("Player Swallow Item");
        if (State.HaveIAlreadyDescribedThisItem(item.abstractPhysicalObject.ID))
        {
            Debug.LogError("Pearl Already read");
            return;
        }
        else
        {
            if (item is DataPearl)
            {
                if (currentConversation != null)
                {
                    currentConversation.Interrupt("...", 0);
                    currentConversation.Destroy();
                    currentConversation = null;
                    currentPearl        = null;
                }
                this.currentPearl        = item as DataPearl;
                State.increaseLikeOnSave = true;
                State.InfluenceLike(0.1f);
                Debug.Log((item as DataPearl).AbstractPearl.dataPearlType);
                if ((item as DataPearl).AbstractPearl.dataPearlType == DataPearl.AbstractDataPearl.DataPearlType.Misc)
                {
                    currentConversation = new PearlConversation.MoonConversation(Conversation.ID.Moon_Pearl_Misc, this);
                    talking             = true;
                }
                else if ((item as DataPearl).AbstractPearl.dataPearlType == DataPearl.AbstractDataPearl.DataPearlType.Misc2)
                {
                    currentConversation = new PearlConversation.MoonConversation(Conversation.ID.Moon_Pearl_Misc2, this);
                    talking             = true;
                }
                else if ((item as DataPearl).AbstractPearl.dataPearlType == DataPearl.AbstractDataPearl.DataPearlType.PebblesPearl)
                {
                    currentConversation = new PearlConversation.MoonConversation(Conversation.ID.Moon_Pebbles_Pearl, this);
                    talking             = true;
                }
                else
                {
                    Debug.LogError("Pearl Conversation Started.");
                    Conversation.ID id = Conversation.ID.None;
                    switch ((item as DataPearl).AbstractPearl.dataPearlType)
                    {
                    case DataPearl.AbstractDataPearl.DataPearlType.CC:
                        this.player.room.game.rainWorld.progression.currentSaveState.miscWorldSaveData.moonRevived = true;
                        id = Conversation.ID.Moon_Pearl_CC;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SI_west:
                        id = Conversation.ID.Moon_Pearl_SI_west;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SI_top:
                        id = Conversation.ID.Moon_Pearl_SI_top;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.LF_west:
                        id = Conversation.ID.Moon_Pearl_LF_west;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.LF_bottom:
                        id = Conversation.ID.Moon_Pearl_LF_bottom;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.HI:
                        id = Conversation.ID.Moon_Pearl_HI;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SH:
                        id = Conversation.ID.Moon_Pearl_SH;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.DS:
                        id = Conversation.ID.Moon_Pearl_DS;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SB_filtration:
                        id = Conversation.ID.Moon_Pearl_SB_filtration;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SB_ravine:
                        id = Conversation.ID.Moon_Pearl_SB_ravine;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.GW:
                        id = Conversation.ID.Moon_Pearl_GW;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SL_bridge:
                        id = Conversation.ID.Moon_Pearl_SL_bridge;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SL_moon:
                        id = Conversation.ID.Moon_Pearl_SL_moon;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SU:
                        id = Conversation.ID.Moon_Pearl_SU;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.UW:
                        id = Conversation.ID.Moon_Pearl_UW;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.SL_chimney:
                        id = Conversation.ID.Moon_Pearl_SL_chimney;
                        break;

                    case DataPearl.AbstractDataPearl.DataPearlType.Red_stomach:
                        id = Conversation.ID.Moon_Pearl_Red_stomach;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.MoonPearl:
                        id = (Conversation.ID)patch_Conversation.ID.Moon_Pearl_MoonPearl;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.DroughtPearl1:
                        id = (Conversation.ID)patch_Conversation.ID.Moon_Pearl_Drought1;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.DroughtPearl2:
                        id = (Conversation.ID)patch_Conversation.ID.Moon_Pearl_Drought2;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.DroughtPearl3:
                        id = (Conversation.ID)patch_Conversation.ID.Moon_Pearl_Drought3;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.SI_Spire1:
                        id = (Conversation.ID)patch_Conversation.ID.SI_Spire1;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.SI_Spire2:
                        id = (Conversation.ID)patch_Conversation.ID.SI_Spire2;
                        break;

                    case (DataPearl.AbstractDataPearl.DataPearlType)patch_DataPearl.patch_AbstractDataPearl.DataPearlType.SI_Spire3:
                        id = (Conversation.ID)patch_Conversation.ID.SI_Spire3;
                        break;
                    }
                    currentConversation = new PearlConversation.MoonConversation(id, this);
                    talking             = true;
                    State.significantPearls[(int)(item as DataPearl).AbstractPearl.dataPearlType] = true;
                    State.totalPearlsBrought++;
                    Debug.LogError("pearls brought up: " + State.totalPearlsBrought);
                }
                State.totalItemsBrought++;
                State.AddItemToAlreadyTalkedAbout(item.abstractPhysicalObject.ID);
            }
        }
    }