コード例 #1
0
    public void SaveGameVariables()
    {
        try {
            LuaScriptBinder.Set(null, "PlayerPosX", DynValue.NewNumber(GameObject.Find("Player").transform.position.x));
            LuaScriptBinder.Set(null, "PlayerPosY", DynValue.NewNumber(GameObject.Find("Player").transform.position.y));
            LuaScriptBinder.Set(null, "PlayerPosZ", DynValue.NewNumber(GameObject.Find("Player").transform.position.z));
        } catch {
            LuaScriptBinder.Set(null, "PlayerPosX", DynValue.NewNumber(SaveLoad.savedGame.playerVariablesNum["PlayerPosX"]));
            LuaScriptBinder.Set(null, "PlayerPosY", DynValue.NewNumber(SaveLoad.savedGame.playerVariablesNum["PlayerPosY"]));
            LuaScriptBinder.Set(null, "PlayerPosZ", DynValue.NewNumber(SaveLoad.savedGame.playerVariablesNum["PlayerPosZ"]));
        }

        playerHeader = CYFAnimator.specialPlayerHeader;

        string mapName;

        if (UnitaleUtil.MapCorrespondanceList.ContainsKey(SceneManager.GetActiveScene().name))
        {
            mapName = UnitaleUtil.MapCorrespondanceList[SceneManager.GetActiveScene().name];
        }
        else if (GlobalControls.nonOWScenes.Contains(SceneManager.GetActiveScene().name) || GlobalControls.isInFight)
        {
            mapName = SaveLoad.savedGame.lastScene;
        }
        else
        {
            mapName = SceneManager.GetActiveScene().name;
        }
        lastScene = mapName;

        soundDictionary = MusicManager.hiddenDictionary;
        controlpanel    = ControlPanel.instance;
        player          = PlayerCharacter.instance;

        inventory.Clear();
        foreach (UnderItem item in Inventory.inventory)
        {
            inventory.Add(item.Name);
        }

        try {
            foreach (string key in LuaScriptBinder.GetSavedDictionary().Keys)
            {
                DynValue dv;
                LuaScriptBinder.GetSavedDictionary().TryGetValue(key, out dv);
                switch (dv.Type)
                {
                case DataType.Number: playerVariablesNum.Add(key, dv.Number); break;

                case DataType.String: playerVariablesStr.Add(key, dv.String); break;

                case DataType.Boolean: playerVariablesBool.Add(key, dv.Boolean); break;

                default: UnitaleUtil.WriteInLogAndDebugger("SaveLoad: This DynValue can't be added to the save because it is unserializable."); break;
                }
            }
        } catch { }

        mapInfos = GlobalControls.MapData;
    }
コード例 #2
0
 public static void BattleDialog(DynValue arg)
 {
     if (UIController.instance == null)
     {
         UnitaleUtil.WriteInLogAndDebugger("[WARN]BattleDialog can only be used as early as EncounterStarting.");
     }
     else
     {
         UIController.instance.battleDialogued = true;
         TextMessage[] msgs = null;
         if (arg.Type == DataType.String)
         {
             msgs = new TextMessage[] { new RegularMessage(arg.String) }
         }
         ;
         else if (arg.Type == DataType.Table)
         {
             msgs = new TextMessage[arg.Table.Length];
             for (int i = 0; i < arg.Table.Length; i++)
             {
                 msgs[i] = new RegularMessage(arg.Table.Get(i + 1).String);
             }
         }
         else
         {
             UnitaleUtil.DisplayLuaError("BattleDialog", "You need to input a non-empty array or a string here." +
                                         "\n\nIf you're sure that you've entered what's needed, you may contact the dev.");
         }
         UIController.instance.ActionDialogResult(msgs, UIController.UIState.ENEMYDIALOGUE);
     }
 }
コード例 #3
0
ファイル: LuaEventOW.cs プロジェクト: yxy-123/CreateYourFrisk
    /// <summary>
    /// Function that sets an event's animation prefix.
    /// If the header itself matches an animation this event has, it will play the animation instead of using it as a prefix.
    /// </summary>
    /// <param name="name"></param>
    /// <param name="anim"></param>
    [CYFEventFunction] public void SetAnimHeader(string name, string anim)
    {
        for (int i = 0; i < EventManager.instance.events.Count || name == "Player"; i++)
        {
            GameObject go = null;
            try { go = EventManager.instance.events[i]; } catch { }
            if (name == go.name || name == "Player")
            {
                if (name == "Player")
                {
                    go = GameObject.Find("Player");
                }
                if (go == null)
                {
                    throw new CYFException("Event.SetAnimHeader: The given event doesn't exist.");
                }

                CYFAnimator animator = go.GetComponent <CYFAnimator>();
                if (animator == null)
                {
                    throw new CYFException("Event.SetAnimHeader: The given event doesn't have a CYFAnimator component.");
                }

                if (animator.AnimExists(animator.specialHeader))
                {
                    animator.movementDirection = 2;
                }
                go.GetComponent <CYFAnimator>().specialHeader = anim;
                appliedScript.Call("CYFEventNextCommand");
                return;
            }
        }
        UnitaleUtil.WriteInLogAndDebugger("Event.SetAnimHeader: The name you entered in the function isn't an event's name. Did you forget to add the 'Event' tag?");
        appliedScript.Call("CYFEventNextCommand");
    }
コード例 #4
0
    /// <summary>
    /// Launch the GameOver screen
    /// </summary>
    [CYFEventFunction] public void GameOver(DynValue deathText = null, string deathMusic = null)
    {
        PlayerCharacter.instance.HP = PlayerCharacter.instance.MaxHP;
        Transform rt = GameObject.Find("Player").GetComponent <Transform>();

        rt.position = new Vector3(rt.position.x, rt.position.y, -1000);
        string[] deathTable = null;

        if (deathText != null)
        {
            deathTable = new string[deathText.Table.Length];
            for (int i = 0; i < deathText.Table.Length; i++)
            {
                deathTable[i] = deathText.Table[i + 1].ToString();
            }
        }

        GlobalControls.Music             = UnitaleUtil.GetCurrentOverworldAudio().clip;
        PlayerOverworld.instance.enabled = false;

        UnitaleUtil.WriteInLogAndDebugger(GameObject.FindObjectOfType <GameOverBehavior>().name);

        GameObject.FindObjectOfType <GameOverBehavior>().StartDeath(deathTable, deathMusic);
        appliedScript.Call("CYFEventNextCommand");
    }
コード例 #5
0
    public void UpdateVariables()
    {
        AlMightyVariablesNum.Clear();
        AlMightyVariablesStr.Clear();
        AlMightyVariablesBool.Clear();
        try {
            foreach (string key in LuaScriptBinder.GetAlMightyDictionary().Keys)
            {
                DynValue dv;
                LuaScriptBinder.GetAlMightyDictionary().TryGetValue(key, out dv);
                if (dv != null)
                {
                    switch (dv.Type)
                    {
                    case DataType.Number:  AlMightyVariablesNum.Add(key, dv.Number);   break;

                    case DataType.String:  AlMightyVariablesStr.Add(key, dv.String);   break;

                    case DataType.Boolean: AlMightyVariablesBool.Add(key, dv.Boolean); break;

                    default:               UnitaleUtil.WriteInLogAndDebugger("SaveLoad: This DynValue can't be added to the save because it is unserializable."); break;
                    }
                }
            }
        } catch { /* ignored */ }
    }
コード例 #6
0
ファイル: ItemBox.cs プロジェクト: yxy-123/CreateYourFrisk
 public static void RemoveFromBox(int index)
 {
     if (index < 0 || index >= items.Count)
     {
         UnitaleUtil.WriteInLogAndDebugger("Tried to remove the item #" + index + " of the box, however it only has " + items.Count + " items in it, starting from the index 0.");
         return;
     }
     items.RemoveAt(index);
 }
コード例 #7
0
 // Sets the parent of a sprite. Can't be used on an enemy
 public void SetParent(LuaSpriteController parent)
 {
     if (tag == "bubble")
     {
         UnitaleUtil.WriteInLogAndDebugger("sprite.SetParent(): bubbles' parent can't be changed.");
         return;
     }
     try {
         GetTarget().SetParent(parent.img.transform);
     } catch { throw new CYFException("You tried to set a removed sprite/unexisting sprite as this sprite's parent."); }
 }
コード例 #8
0
    public static void PlaySound(string name, float volume = 0.65f)
    {
        if (name == null)
        {
            UnitaleUtil.WriteInLogAndDebugger("[WARN]Attempted to load a nil value as a sound.");
            return;
        }

        try { UnitaleUtil.PlaySound("MusicPlaySound", AudioClipRegistry.GetSound(name), volume); }
        catch {  }
    }
コード例 #9
0
ファイル: ItemBox.cs プロジェクト: yxy-123/CreateYourFrisk
 public static void AddToBox(string name)
 {
     if (!Inventory.ItemExists(name))
     {
         UnitaleUtil.WriteInLogAndDebugger("The item " + name + "doesn't exist in CYF's item database.");
         return;
     }
     if (items.Count == capacity)
     {
         UnitaleUtil.WriteInLogAndDebugger("The box is already full! You can't add another item to it!");
         return;
     }
     items.Add(new UnderItem(name));
 }
コード例 #10
0
    public static void LoadFile(string name)
    {
        if (name == null)
        {
            UnitaleUtil.WriteInLogAndDebugger("[WARN]Attempted to load a nil value as an Audio file.");
            return;
        }

        src.Stop();
        src.clip = AudioClipRegistry.GetMusic(name);
        filename = "music:" + name.ToLower();
        NewMusicManager.audioname["src"] = filename;
        src.Play();
    }
コード例 #11
0
    public static bool PlaySound(string name, float volume = 0.65f)
    {
        if (name == null)
        {
            UnitaleUtil.WriteInLogAndDebugger("[WARN]Attempted to load a nil value as a sound.");
            return(false);
        }

        try {
            UnitaleUtil.PlaySound("MusicPlaySound", AudioClipRegistry.GetSound(name, GlobalControls.retroMode), volume);
            return(true);
        }
        catch { return(false); }
    }
コード例 #12
0
 public void MoveAbove(LuaSpriteController sprite)
 {
     if (sprite == null)
     {
         throw new CYFException("The sprite passed as an argument is null.");
     }
     else if (sprite.GetTarget().parent != GetTarget().parent)
     {
         UnitaleUtil.WriteInLogAndDebugger("[WARN]You can't move relatively two sprites without the same parent.");
     }
     else
     {
         GetTarget().SetSiblingIndex(sprite.GetTarget().GetSiblingIndex() + 1);
     }
 }
コード例 #13
0
 public void MoveBelow(LuaSpriteController sprite)
 {
     if (sprite == null)
     {
         throw new CYFException("sprite.MoveBelow: The sprite passed as an argument is nil.");
     }
     else if (sprite.GetTarget().parent != GetTarget().parent)
     {
         UnitaleUtil.WriteInLogAndDebugger("[WARN]You can't change the order of two sprites without the same parent.");
     }
     else
     {
         GetTarget().SetSiblingIndex(sprite.GetTarget().GetSiblingIndex());
     }
 }
コード例 #14
0
    public static bool LoadFile(string name)
    {
        if (name == null)
        {
            UnitaleUtil.WriteInLogAndDebugger("[WARN]Attempted to load a nil value as an Audio file.");
            return(false);
        }

        src.Stop();
        src.clip = AudioClipRegistry.GetMusic(name, GlobalControls.retroMode);
        filename = "music:" + name.ToLower();
        NewMusicManager.audioname["src"] = filename;
        src.loop = true;
        src.Play();
        return(src.clip != null);
    }
コード例 #15
0
 // Use this for initialization
 private void Start()
 {
     bgImage = GetComponent <Image>();
     try {
         Sprite bg = SpriteUtil.FromFile(FileLoader.pathToModFile("Sprites/bg.png"));
         if (bg != null)
         {
             bg.texture.filterMode = FilterMode.Point;
             bgImage.sprite        = bg;
             bgImage.color         = Color.white;
         }
     } catch {
         // Background failed loading, no need to do anything.
         UnitaleUtil.WriteInLogAndDebugger("[WARN]No background file found. Using empty background.");
     }
 }
コード例 #16
0
 public void MoveAbove(LuaTextManager otherText)
 {
     CheckExists();
     if (otherText == null || !otherText.isactive)
     {
         throw new CYFException("The text object passed as an argument is nil or inactive.");
     }
     else if (this.transform.parent.parent != otherText.transform.parent.parent)
     {
         UnitaleUtil.WriteInLogAndDebugger("[WARN]You can't change the order of two text objects without the same parent.");
     }
     else
     {
         try { this.transform.parent.SetSiblingIndex(otherText.transform.parent.GetSiblingIndex() + 1); }
         catch { throw new CYFException("Error while calling text.MoveAbove."); }
     }
 }
コード例 #17
0
 // Sets the parent of a sprite.
 public void SetParent(LuaSpriteController parent)
 {
     if (tag == "bubble")
     {
         UnitaleUtil.WriteInLogAndDebugger("sprite.SetParent(): bubbles' parent can't be changed.");
         return;
     }
     else if (tag == "event" || (parent != null && parent.tag == "event"))
     {
         throw new CYFException("sprite.SetParent(): Can not use SetParent with an Overworld Event's sprite.");
     }
     try {
         GetTarget().SetParent(parent.img.transform);
         if (img.GetComponent <MaskImage>())
         {
             img.GetComponent <MaskImage>().inverted = parent._masked > 3;
         }
     } catch { throw new CYFException("sprite.SetParent(): You tried to set a removed sprite/nil sprite as this sprite's parent."); }
 }
コード例 #18
0
    public static AudioClip tryLoad(string key)
    {
        string k = key;

        key = key.ToLower();
        if (dictMod.ContainsKey(key))
        {
            dict[key] = FileLoader.getAudioClip(currentPath, dictMod[key].FullName);
        }
        else if (dictDefault.ContainsKey(key))
        {
            dict[key] = FileLoader.getAudioClip(currentPath, dictDefault[key].FullName);
        }
        else
        {
            UnitaleUtil.WriteInLogAndDebugger("[WARN]The music file " + k + " doesn't exist.");
            return(null);
        }
        return(dict[key]);
    }
コード例 #19
0
    public static void SetItemList(string[] items = null)
    {
        foreach (string item in items)
        {
            // Make sure that the item exists before trying to create it
            string outString = "";
            int    outInt    = 0;
            if (!addedItems.Contains(item) && !NametoDesc.TryGetValue(item, out outString) && !NametoShortName.TryGetValue(item, out outString) && !NametoType.TryGetValue(item, out outInt) && !NametoPrice.TryGetValue(item, out outInt))
            {
                throw new CYFException("Inventory.SetInventory: The item \"" + item + "\" was not found.\n\nAre you sure you called Inventory.AddCustomItems first?");
            }
        }

        inventory = new List <UnderItem>(new UnderItem[] { });
        if (items != null)
        {
            for (int i = 0; i < items.Length; i++)
            {
                if (i == inventorySize)
                {
                    UnitaleUtil.WriteInLogAndDebugger("[WARN]The inventory can only contain " + inventorySize + " items, yet you tried to add the item \"" + items[i] + "\" as item number " + (i + 1) + ".");
                }
                else
                {
                    // Search through addedItemsTypes to find the type of the new item
                    int type = 0;

                    // Get the index of the new item in addedItems
                    for (int j = 0; j < addedItems.Count; j++)
                    {
                        if (addedItems[j] == items[i])
                        {
                            type = addedItemsTypes[j];
                        }
                    }
                    inventory.Add(new UnderItem(items[i]));
                }
            }
        }
    }
コード例 #20
0
 private void LateStart()
 {
     try {
         if (inner == null || outer == null)
         {
             UnitaleUtil.WriteInLogAndDebugger(outer == null && inner == null ? "outer & inner = null" : (outer == null ? "outer == null" : "inner == null"));
             inner = GameObject.Find("arena").GetComponent <RectTransform>();
             outer = inner.parent.GetComponent <RectTransform>();
         }
         arenaAbs         = new Rect(inner.position.x - inner.sizeDelta.x / 2, inner.position.y - inner.sizeDelta.y / 2, inner.rect.width, inner.rect.height);
         arenaCenter      = RTUtil.AbsCenterOf(inner);
         newX             = currentX = 320;
         newY             = currentY = 90;
         currentWidth     = inner.rect.width;
         currentHeight    = inner.rect.height;
         basisCoordinates = arenaCenter;
     } catch {
         LateUpdater.lateActions.Add(LateStart);
         UnitaleUtil.WriteInLogAndDebugger("Error during the Arena's initialization! (#" + errCount++ + ")");
     }
     //outer.localPosition = new Vector3(0, -50, 0);
     //outer.position = new Vector3(320, 90, outer.position.z);
 }
コード例 #21
0
    public void Remove()
    {
        if (_img == null)
        {
            return;
        }
        if (tag == "enemy" || tag == "bubble")
        {
            UnitaleUtil.WriteInLogAndDebugger("sprite.Remove(): You can't remove a " + tag + "'s sprite!");
            return;
        }

        if (tag == "projectile")
        {
            Projectile[] pcs = img.GetComponentsInChildren <Projectile>();
            for (int i = 1; i < pcs.Length; i++)
            {
                pcs[i].ctrl.Remove();
            }
        }
        StopAnimation();
        GameObject.Destroy(GetTarget().gameObject);
        _img = null;
    }
コード例 #22
0
    public void Dust(bool playDust = true, bool removeObject = false)
    {
        if (tag == "enemy" || tag == "bubble")
        {
            UnitaleUtil.WriteInLogAndDebugger("sprite.Dust(): You can't dust a " + tag + "'s sprite that way!");
            return;
        }
        GameObject go = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/MonsterDuster"));

        go.transform.SetParent(UIController.instance.psContainer.transform);
        if (playDust)
        {
            UnitaleUtil.PlaySound("DustSound", AudioClipRegistry.GetSound("enemydust"));
        }
        img.GetComponent <ParticleDuplicator>().Activate(this);
        if (img.gameObject.name != "player")
        {
            img.SetActive(false);
            if (removeObject)
            {
                img = null;
            }
        }
    }
コード例 #23
0
    protected override void LoadEnemiesAndPositions()
    {
        AudioSource musicSource = GameObject.Find("Main Camera").GetComponent <AudioSource>();

        EncounterText = script.GetVar("encountertext").String;
        DynValue enemyScriptsLua   = script.GetVar("enemies");
        DynValue enemyPositionsLua = script.GetVar("enemypositions");
        string   musicFile         = script.GetVar("music").String;

        try { enemies = new LuaEnemyController[enemyScriptsLua.Table.Length]; /*dangerously assumes enemies is defined*/ }
        catch (Exception) {
            UnitaleUtil.DisplayLuaError(StaticInits.ENCOUNTER, "There's no enemies table in your encounter. Is this a pre-0.1.2 encounter? It's easy to fix!\n\n"
                                        + "1. Create a Monsters folder in the mod's Lua folder\n"
                                        + "2. Add the monster script (custom.lua) to this new folder\n"
                                        + "3. Add the following line to the beginning of this encounter script, located in the mod folder/Lua/Encounters:\nenemies = {\"custom\"}\n"
                                        + "4. You're done! Starting from 0.1.2, you can name your monster and encounter scripts anything.");
            return;
        }
        if (enemyPositionsLua != null && enemyPositionsLua.Table != null)
        {
            enemyPositions = new Vector2[enemyPositionsLua.Table.Length];
            for (int i = 0; i < enemyPositionsLua.Table.Length; i++)
            {
                Table posTable = enemyPositionsLua.Table.Get(i + 1).Table;
                if (i >= enemies.Length)
                {
                    break;
                }

                enemyPositions[i] = new Vector2((float)posTable.Get(1).Number, (float)posTable.Get(2).Number);
            }
        }

        if (MusicManager.IsStoppedOrNull(PlayerOverworld.audioKept))
        {
            if (musicFile != null)
            {
                try {
                    AudioClip music = AudioClipRegistry.GetMusic(musicFile);
                    musicSource.clip      = music;
                    MusicManager.filename = "music:" + musicFile.ToLower();
                } catch (Exception) { UnitaleUtil.WriteInLogAndDebugger("[WARN]Loading custom music failed."); }
            }
            else
            {
                musicSource.clip      = AudioClipRegistry.GetMusic("mus_battle1");
                musicSource.volume    = .6f;
                MusicManager.filename = "music:mus_battle1";
            }
            NewMusicManager.audioname["src"] = MusicManager.filename;
        }
        // Instantiate all the enemy objects
        if (enemies.Length > enemyPositions.Length)
        {
            UnitaleUtil.DisplayLuaError(StaticInits.ENCOUNTER, "All enemies in an encounter must have a screen position defined. Either your enemypositions table is missing, "
                                        + "or there are more enemies than available positions. Refer to the documentation's Basic Setup section on how to do this.");
        }
        enemyInstances = new GameObject[enemies.Length];
        for (int i = 0; i < enemies.Length; i++)
        {
            enemyInstances[i] = Instantiate(Resources.Load <GameObject>("Prefabs/LUAEnemy 1"));
            enemyInstances[i].transform.SetParent(gameObject.transform);
            enemyInstances[i].transform.localScale = new Vector3(1, 1, 1); // apparently this was suddenly required or the scale would be (0,0,0)
            enemies[i]            = enemyInstances[i].GetComponent <LuaEnemyController>();
            enemies[i].scriptName = enemyScriptsLua.Table.Get(i + 1).String;
            enemies[i].index      = i;
            if (i < enemyPositions.Length)
            {
                enemies[i].GetComponent <RectTransform>().anchoredPosition = new Vector2(enemyPositions[i].x, enemyPositions[i].y);
            }
            else
            {
                enemies[i].GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 1);
            }
        }

        // Attach the controllers to the encounter's enemies table
        DynValue[] enemyStatusCtrl = new DynValue[enemies.Length];
        Table      luaEnemyTable   = script.GetVar("enemies").Table;

        for (int i = 0; i < enemyStatusCtrl.Length; i++)
        {
            //enemies[i].luaStatus = new LuaEnemyStatus(enemies[i]);
            enemies[i].script = new ScriptWrapper();
            luaEnemyTable.Set(i + 1, UserData.Create(enemies[i].script));
        }
        script.SetVar("enemies", DynValue.NewTable(luaEnemyTable));
        Table luaWaveTable = new Table(null);

        script.SetVar("waves", DynValue.NewTable(luaWaveTable));

        //if (MusicManager.isStoppedOrNull(PlayerOverworld.audioKept))
        //    musicSource.Play(); // play that funky music
    }
コード例 #24
0
    // Update is called once per frame
    void Update()
    {
        if (hasRevived && reviveFade2)
        {
            if (reviveFade2.transform.localPosition != new Vector3(0, 0, 0))
            {
                reviveFade2.transform.localPosition = new Vector3(0, 0, 0);
            }
            if (reviveFade2.color.a > 0.0f)
            {
                reviveFade2.color = new Color(1, 1, 1, reviveFade2.color.a - Time.deltaTime / 2);
            }
            else
            {
                GameObject.Destroy(reviveFade2.gameObject);
            }
        }
        if (!started)
        {
            return;
        }
        if (!revived)
        {
            if (!once && UnitaleUtil.IsOverworld)
            {
                once = true;
                utHeart.transform.SetParent(GameObject.Find("Canvas GameOver").transform);
                utHeart.transform.position           = heartPos;
                utHeart.GetComponent <Image>().color = heartColor;
                canvasOW = GameObject.Find("Canvas OW");
                canvasOW.SetActive(false);
            }
            else if (!once)
            {
                once = true;
                gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(16, 16);
                gameObject.GetComponent <Image>().enabled           = true; // abort the blink animation if it was playing
            }

            if (internalTimer > breakHeartAfter)
            {
                AudioSource.PlayClipAtPoint(AudioClipRegistry.GetSound("heartbeatbreaker"), Camera.main.transform.position, 0.75f);
                brokenHeartPrefab = Instantiate(brokenHeartPrefab);
                if (UnitaleUtil.IsOverworld)
                {
                    brokenHeartPrefab.transform.SetParent(GameObject.Find("Canvas GameOver").transform);
                }
                else
                {
                    brokenHeartPrefab.transform.SetParent(gameObject.transform);
                }
                brokenHeartPrefab.GetComponent <RectTransform>().position = heartPos;
                brokenHeartPrefab.GetComponent <Image>().color            = heartColor;
                brokenHeartPrefab.GetComponent <Image>().enabled          = true;
                if (UnitaleUtil.IsOverworld)
                {
                    utHeart.GetComponent <Image>().enabled = false;
                }
                else
                {
                    Color color = gameObject.GetComponent <Image>().color;
                    gameObject.GetComponent <Image>().color = new Color(color.r, color.g, color.b, 0);
                    if (LuaEnemyEncounter.script.GetVar("revive").Boolean)
                    {
                        Revive();
                    }
                }
                breakHeartAfter = 999.0f;
            }

            if (internalTimer > explodeHeartAfter)
            {
                AudioSource.PlayClipAtPoint(AudioClipRegistry.GetSound("heartsplosion"), Camera.main.transform.position, 0.75f);
                brokenHeartPrefab.GetComponent <Image>().enabled = false;
                heartShardInstances = new RectTransform[6];
                heartShardRelocs    = new Vector2[6];
                heartShardCtrl      = new LuaSpriteController[6];
                for (int i = 0; i < heartShardInstances.Length; i++)
                {
                    heartShardInstances[i] = Instantiate(heartShardPrefab).GetComponent <RectTransform>();
                    heartShardCtrl[i]      = new LuaSpriteController(heartShardInstances[i].GetComponent <Image>());
                    if (UnitaleUtil.IsOverworld)
                    {
                        heartShardInstances[i].transform.SetParent(GameObject.Find("Canvas GameOver").transform);
                    }
                    else
                    {
                        heartShardInstances[i].transform.SetParent(this.gameObject.transform);
                    }
                    heartShardInstances[i].GetComponent <RectTransform>().position = heartPos;
                    heartShardInstances[i].GetComponent <Image>().color            = heartColor;
                    heartShardRelocs[i] = UnityEngine.Random.insideUnitCircle * 100.0f;
                    heartShardCtrl[i].Set(heartShardAnim[0]);
                    heartShardCtrl[i].SetAnimation(heartShardAnim, 1 / 5f);
                }
                explodeHeartAfter = 999.0f;
            }

            if (internalTimer > gameOverAfter)
            {
                AudioClip originMusic = gameOverMusic.clip;
                if (deathMusic != null)
                {
                    gameOverMusic.clip = AudioClipRegistry.GetMusic(deathMusic);
                    if (gameOverMusic.clip == null)
                    {
                        UnitaleUtil.WriteInLogAndDebugger("[WARN]The specified death music doesn't exist. (" + deathMusic + ")");

                        gameOverMusic.clip = originMusic;
                    }
                }
                gameOverMusic.Play();
                gameOverAfter = 999.0f;
            }

            if (internalTimer > fluffybunsAfter)
            {
                gameOverTxt.SetHorizontalSpacing(7);
                if (deathText != null)
                {
                    List <TextMessage> text = new List <TextMessage>();
                    foreach (string str in deathText)
                    {
                        text.Add(new TextMessage(str, false, false));
                    }
                    TextMessage[] text2 = new TextMessage[text.Count + 1];
                    for (int i = 0; i < text.Count; i++)
                    {
                        text2[i] = text[i];
                    }
                    text2[text.Count] = new TextMessage("", false, false);
                    if (Random.Range(0, 400) == 44)
                    {
                        gameOverTxt.SetTextQueue(new TextMessage[] {
                            new TextMessage("[color:ffffff][voice:v_fluffybuns][waitall:2]4", false, false),
                            new TextMessage("[color:ffffff][voice:v_fluffybuns][waitall:2]" + PlayerCharacter.instance.Name + "!\n[w:15]Stay determined...", false, false),
                            new TextMessage("", false, false)
                        });
                    }
                    else
                    {
                        gameOverTxt.SetTextQueue(text2);
                    }
                }
                else
                {
                    //This "4" made us laugh so hard that I kept it :P
                    int fourChance = Random.Range(0, 80);

                    string[] possibleDeathTexts = new string[] { "You cannot give up\njust yet...", "It cannot end\nnow...", "Our fate rests upon\nyou...",
                                                                 "Don't lose hope...", "You're going to\nbe alright!" };
                    if (fourChance == 44)
                    {
                        possibleDeathTexts[4] = "4";
                    }

                    gameOverTxt.SetTextQueue(new TextMessage[] {
                        new TextMessage("[color:ffffff][voice:v_fluffybuns][waitall:2]" + possibleDeathTexts[Math.RandomRange(0, possibleDeathTexts.Length)], false, false),
                        new TextMessage("[color:ffffff][voice:v_fluffybuns][waitall:2]" + PlayerCharacter.instance.Name + "!\n[w:15]Stay determined...", false, false),
                        new TextMessage("", false, false)
                    });
                }

                fluffybunsAfter = 999.0f;
            }

            if (!done)
            {
                gameOverImage.color = new Color(1, 1, 1, gameOverFadeTimer);
                if (gameOverAfter >= 999.0f && gameOverFadeTimer < 1.0f)
                {
                    gameOverFadeTimer += Time.deltaTime / 2;
                    if (gameOverFadeTimer >= 1.0f)
                    {
                        gameOverFadeTimer = 1.0f;
                        done = true;
                    }
                }
                internalTimer += Time.deltaTime; // this is actually dangerous because done can be true before everything's done if timers are modified
            }
            else if (!exiting && !gameOverTxt.AllLinesComplete())
            {
                // Note: [noskip] only affects the UI controller's ability to skip, so we have to redo that here.
                if (InputUtil.Pressed(GlobalControls.input.Confirm) && gameOverTxt.LineComplete())
                {
                    gameOverTxt.NextLineText();
                }
            }
        }
        else
        {
            /*if (internalTimer <= breakHeartAfter) {
             *
             * } else {*/
            if (reviveTextSet && !reviveText.AllLinesComplete())
            {
                // Note: [noskip] only affects the UI controller's ability to skip, so we have to redo that here.
                if (InputUtil.Pressed(GlobalControls.input.Confirm) && reviveText.LineComplete())
                {
                    reviveText.NextLineText();
                }
            }
            else if (reviveTextSet && !exiting)
            {
                exiting = true;
            }
            else if (internalTimerRevive >= 5.0f && !reviveTextSet && breakHeartReviveAfter)
            {
                if (deathText != null)
                {
                    reviveText.SetHorizontalSpacing(7);
                    List <TextMessage> text = new List <TextMessage>();
                    foreach (string str in deathText)
                    {
                        text.Add(new TextMessage(str, false, false));
                    }
                    TextMessage[] text2 = new TextMessage[text.Count + 1];
                    for (int i = 0; i < text.Count; i++)
                    {
                        text2[i] = text[i];
                    }
                    text2[text.Count] = new TextMessage("", false, false);
                    reviveText.SetTextQueue(text2);
                }
                reviveTextSet = true;
            }
            else if (internalTimerRevive > 2.5f && internalTimerRevive < 4.0f)
            {
                brokenHeartPrefab.transform.localPosition = new Vector2(UnityEngine.Random.Range(-3, 2), UnityEngine.Random.Range(-3, 2));
            }
            else if (!breakHeartReviveAfter && internalTimerRevive > 2.5f)
            {
                breakHeartReviveAfter = true;
                AudioSource.PlayClipAtPoint(AudioClipRegistry.GetSound("heartbeatbreaker"), Camera.main.transform.position, 0.75f);
                if (UnitaleUtil.IsOverworld)
                {
                    utHeart.GetComponent <Image>().enabled = true;
                }
                else
                {
                    Color color = gameObject.GetComponent <Image>().color;
                    gameObject.GetComponent <Image>().color = new Color(color.r, color.g, color.b, 1);
                }
                GameObject.Destroy(brokenHeartPrefab);
            }
            //}

            if (internalTimer > explodeHeartAfter)
            {
            }

            if (internalTimer > gameOverAfter)
            {
            }

            if (internalTimer > fluffybunsAfter)
            {
            }

            if (!done)
            {
            }
            else if (!exiting && !reviveText.AllLinesComplete())
            {
            }

            if (!reviveTextSet)
            {
                internalTimerRevive += Time.deltaTime;
            }

            if (exiting && reviveFade.color.a < 1.0f && reviveFade.isActiveAndEnabled)
            {
                reviveFade.color = new Color(1, 1, 1, reviveFade.color.a + Time.deltaTime / 2);
            }
            else if (exiting)
            {
                // repurposing the timer as a reset delay
                gameOverFadeTimer -= Time.deltaTime;
                if (gameOverMusic.volume - Time.deltaTime > 0.0f)
                {
                    gameOverMusic.volume -= Time.deltaTime;
                }
                else
                {
                    gameOverMusic.volume = 0.0f;
                }
                if (gameOverFadeTimer < -1.0f)
                {
                    reviveFade2 = GameObject.Instantiate(reviveFade.gameObject).GetComponent <Image>();
                    reviveFade2.transform.SetParent(playerParent);
                    reviveFade2.transform.SetAsLastSibling();
                    reviveFade2.transform.localPosition = new Vector3(0, 0, 0);
                    reviveFade.color = new Color(1, 1, 1, 0);
                    EndGameOverRevive();
                    if (musicBefore != null)
                    {
                        musicBefore.clip = music;
                        musicBefore.Play();
                    }
                    hasRevived = true;
                }
            }
        }

        for (int i = 0; i < heartShardInstances.Length; i++)
        {
            heartShardInstances[i].position += (Vector3)heartShardRelocs[i] * Time.deltaTime;
            heartShardRelocs[i].y           -= 100f * Time.deltaTime;
        }

        if (gameOverTxt.textQueue != null)
        {
            if (!exiting && gameOverTxt.AllLinesComplete() && gameOverTxt.LineCount() != 0)
            {
                exiting           = true;
                gameOverFadeTimer = 1.0f;
            }
            else if (exiting && gameOverFadeTimer > 0.0f)
            {
                gameOverImage.color = new Color(1, 1, 1, gameOverFadeTimer);
                if (gameOverFadeTimer > 0.0f)
                {
                    gameOverFadeTimer -= Time.deltaTime / 2;
                    if (gameOverFadeTimer <= 0.0f)
                    {
                        gameOverFadeTimer = 0.0f;
                    }
                }
            }
            else if (exiting)
            {
                // repurposing the timer as a reset delay
                gameOverFadeTimer -= Time.deltaTime;
                if (gameOverMusic.volume - Time.deltaTime > 0.0f)
                {
                    gameOverMusic.volume -= Time.deltaTime;
                }
                else
                {
                    gameOverMusic.volume = 0.0f;
                }
                if (gameOverFadeTimer < -1.0f)
                {
                    //StaticInits.Reset();
                    EndGameOver();
                }
            }
        }
    }
コード例 #25
0
    public static IEnumerator GetIntoDaMap(string call, object[] neededArgs)
    {
        if (GameObject.Find("Main Camera OW"))
        {
            GameObject.Find("Main Camera OW").GetComponent <EventManager>().readyToReLaunch = true;
            GameObject.Find("Main Camera OW").tag = "MainCamera";
        }

        //Clear any leftover Sprite and Text objects that are no longer connected to any scripts
        foreach (Transform child in GameObject.Find("Canvas Two").transform)
        {
            if (!child.name.EndsWith("Layer"))
            {
                GameObject.Destroy(child.gameObject);
            }
            else
            {
                foreach (Transform child2 in child)
                {
                    GameObject.Destroy(child2.gameObject);
                }
            }
        }

        yield return(0);

        Camera.main.transparencySortMode = TransparencySortMode.CustomAxis;
        Camera.main.transparencySortAxis = new Vector3(0.0f, 1.0f, 1000000.0f);

        try { PlayerOverworld.instance.backgroundSize = GameObject.Find("Background").GetComponent <RectTransform>().sizeDelta *GameObject.Find("Background").GetComponent <RectTransform>().localScale.x; }
        catch { UnitaleUtil.WriteInLogAndDebugger("RectifyCameraPosition: The 'Background' GameObject is missing."); }

        EventManager.instance.onceReload = false;
        //Permits to reload the current data if needed
        MapInfos mi = GameObject.Find("Background").GetComponent <MapInfos>();

        if (StaticInits.MODFOLDER != mi.modToLoad)
        {
            StaticInits.MODFOLDER   = mi.modToLoad;
            StaticInits.Initialized = false;
            StaticInits.InitAll();
            LuaScriptBinder.Set(null, "ModFolder", DynValue.NewString(StaticInits.MODFOLDER));
            if (call == "transitionoverworld")
            {
                EventManager.instance.ScriptLaunched = false;
                EventManager.instance.script         = null;
            }
        }

        AudioSource audio = UnitaleUtil.GetCurrentOverworldAudio();

        if (mi.isMusicKeptBetweenBattles)
        {
            Camera.main.GetComponent <AudioSource>().Stop();
            Camera.main.GetComponent <AudioSource>().clip = null;
        }
        else
        {
            PlayerOverworld.audioKept.Stop();
            PlayerOverworld.audioKept.clip = null;
        }

        //Starts the music if there's no music
        if (audio.clip == null)
        {
            if (mi.music != "none")
            {
                audio.clip = AudioClipRegistry.GetMusic(mi.music);
                audio.time = 0;
                audio.Play();
            }
            else
            {
                audio.Stop();
            }
        }
        else
        {
            //Get the file's name with this...thing?
            string test = audio.clip.name.Replace('\\', '/').Split(new string[] { "/Audio/" }, System.StringSplitOptions.RemoveEmptyEntries)[1].Split('.')[0];
            if (test != mi.music)
            {
                if (mi.music != "none")
                {
                    audio.clip = AudioClipRegistry.GetMusic(mi.music);
                    audio.time = 0;
                    audio.Play();
                }
                else
                {
                    audio.Stop();
                }
            }
        }

        GameObject.Find("utHeart").GetComponent <Image>().color = new Color(GameObject.Find("utHeart").GetComponent <Image>().color.r,
                                                                            GameObject.Find("utHeart").GetComponent <Image>().color.g,
                                                                            GameObject.Find("utHeart").GetComponent <Image>().color.b, 0);
        PlayerOverworld.instance.cameraShift = Vector2.zero;
        if (call == "tphandler")
        {
            GameObject.Find("Player").transform.parent.position = (Vector2)neededArgs[0];
            PlayerOverworld.instance.gameObject.GetComponent <CYFAnimator>().movementDirection = ((TPHandler)neededArgs[1]).direction;
            ((TPHandler)neededArgs[1]).activated = false;
            GameObject.Destroy(((TPHandler)neededArgs[1]).gameObject);
        }

        if (GameObject.Find("Don't show it again"))
        {
            GameObject.Destroy(GameObject.Find("Don't show it again"));
        }
        StaticInits.SendLoaded();
    }
コード例 #26
0
ファイル: Inventory.cs プロジェクト: hl4hck/CreateYourFrisk
    public static void ItemLibrary(string name, int type, out TextMessage[] mess, out float amount)
    {
        mess = new TextMessage[] { }; amount = 0;
        switch (type)
        {
        case 0:
            switch (name)
            {
            case "Bandage":
                amount = 10;
                mess   = new TextMessage[] { new TextMessage("You re-applied the bandage.[w:10]\rStill kind of gooey.[w:10]\nYou recovered 10 HP!", true, false) };
                break;

            case "Monster Candy":
                amount = 10;
                mess   = new TextMessage[] { new TextMessage("You ate the Monster Candy.[w:10]\rVery un-licorice-like.[w:10]\nYou recovered 10 HP!", true, false) };
                break;

            case "Spider Donut":
                amount = 12;
                mess   = new TextMessage[] { new TextMessage("Don't worry,[w:5]spider didn't.[w:10]\nYou recovered 12 HP!", true, false) };
                break;

            case "Spider Cider":
                amount = 24;
                mess   = new TextMessage[] { new TextMessage("You drank the Spider Cider.[w:10]\nYou recovered 24 HP!", true, false) };
                break;

            case "Butterscotch Pie":
                amount = 999;
                mess   = new TextMessage[] { new TextMessage("You ate the Butterscotch Pie.[w:10]\nYour HP was maxed out.", true, false) };
                break;

            case "Snail Pie":
                amount = PlayerCharacter.instance.MaxHP - (int)PlayerCharacter.instance.HP - 1;
                mess   = new TextMessage[] { new TextMessage("You ate the Snail Pie.[w:10]\nYour HP was maxed out.", true, false) };
                break;

            case "Snowman Piece":
                amount = 45;
                mess   = new TextMessage[] { new TextMessage("You ate the Snowman Piece.[w:10]\nYou recovered 45 HP!", true, false) };
                break;

            case "Nice Cream":
                amount = 15;
                int    randomCream   = Math.RandomRange(0, 8);
                string sentenceCream = "[w:10]\nYou recovered 15 HP!";
                switch (randomCream)
                {
                case 0: sentenceCream = "You're super spiffy!" + sentenceCream; break;

                case 1: sentenceCream = "Are those claws natural?" + sentenceCream; break;

                case 2: sentenceCream = "Love yourself! I love you!" + sentenceCream; break;

                case 3: sentenceCream = "You look nice today!" + sentenceCream; break;

                case 4: sentenceCream = "(An illustration of a hug)" + sentenceCream; break;

                case 5: sentenceCream = "Have a wonderful day!" + sentenceCream; break;

                case 6: sentenceCream = "Is this as sweet as you?" + sentenceCream; break;

                case 7: sentenceCream = "You're just great!" + sentenceCream; break;
                }
                mess = new TextMessage[] { new TextMessage(sentenceCream, true, false) }; break;

            case "Bisicle":
                amount = 11;
                mess   = new TextMessage[] { new TextMessage("You ate one half of\rthe Bisicle.[w:10]\nYou recovered 11 HP!", true, false) };
                break;

            case "Unisicle":
                amount = 11;
                mess   = new TextMessage[] { new TextMessage("You ate the Unisicle.[w:10]\nYou recovered 11 HP!", true, false) };
                break;

            case "Cinnabon Bunny":
                amount = 22;
                mess   = new TextMessage[] { new TextMessage("You ate the Cinnabon Bun.[w:10]\nYou recovered 22 HP!", true, false) };
                break;

            case "Astronaut Food":
                amount = 21;
                mess   = new TextMessage[] { new TextMessage("You ate the Astronaut Food.[w:10]\nYou recovered 21 HP!", true, false) };
                break;

            case "Crab Apple":
                amount = 18;
                mess   = new TextMessage[] { new TextMessage("You ate the Crab Apple.[w:10]\nYou recovered 18 HP!", true, false) };
                break;

            case "Sea Tea":
                amount = 18;
                mess   = new TextMessage[] { new TextMessage("[sound:SeaTea]You drank the Sea Tea.[w:10]\nYour SPEED boosts![w:10]\nYou recovered 18 HP!", true, false),
                                             new TextMessage("[music:pause][waitall:10]...[waitall:1]but for now stats\rdon't change.", true, false),
                                             new TextMessage("[noskip][music:unpause][next]", true, false) }; break;

            case "Abandoned Quiche":
                amount = 34;
                mess   = new TextMessage[] { new TextMessage("You ate the quiche.[w:10]\nYou recovered 34 HP!", true, false) };
                break;

            case "Temmie Flakes":
                amount = 2;
                mess   = new TextMessage[] { new TextMessage("You ate the Temmie Flakes.[w:10]\nYou recovered 2 HP!", true, false) };
                break;

            case "Dog Salad":
                int    randomSalad = Math.RandomRange(0, 4);
                string sentenceSalad;
                switch (randomSalad)
                {
                case 0:
                    amount        = 2;
                    sentenceSalad = "Oh. These are bones...[w:10]\rYou recovered 2 HP!";
                    break;

                case 1:
                    amount        = 10;
                    sentenceSalad = "Oh. Fried tennis ball...[w:10]\rYou recovered 10 HP!";
                    break;

                case 2:
                    amount        = 30;
                    sentenceSalad = "Oh. Tastes yappy...[w:10]\rYou recovered 30 HP!";
                    break;

                default:
                    amount        = 999;
                    sentenceSalad = "It's literally garbage???[w:10]\rYour HP was maxed out.";
                    break;
                }
                mess = new TextMessage[] { new TextMessage(sentenceSalad, true, false) };
                break;

            case "Instant Noodles":
                mess = new TextMessage[] { new TextMessage("You remove the Instant\rNoodles from their\rpackaging.", true, false),
                                           new TextMessage("You put some water in\rthe pot and place it\ron the heat.", true, false),
                                           new TextMessage("You wait for the water\rto boil...", true, false),
                                           new TextMessage("[noskip][music:pause]...[w:30]\n...[w:30]\n...", true, false),
                                           new TextMessage("[noskip]It's[w:30] boiling.", true, false),
                                           new TextMessage("[noskip]You place the noodles[w:30]\rinto the pot.", true, false),
                                           new TextMessage("[noskip]4[w:30] minutes left[w:30] until\rthe noodles[w:30] are finished.", true, false),
                                           new TextMessage("[noskip]3[w:30] minutes left[w:30] until\rthe noodles[w:30] are finished.", true, false),
                                           new TextMessage("[noskip]2[w:30] minutes left[w:30] until\rthe noodles[w:30] are finished.", true, false),
                                           new TextMessage("[noskip]1[w:30] minute left[w:30] until\rthe noodles[w:30] are finished.", true, false),
                                           new TextMessage("[noskip]The noodles[w:30] are finished.", true, false),
                                           new TextMessage("...they don't taste very\rgood.", true, false),
                                           new TextMessage("You add the flavor packet.", true, false),
                                           new TextMessage("That's better.", true, false),
                                           new TextMessage("Not great,[w:5] but better.", true, false),
                                           new TextMessage("[music:unpause]You ate the Instant Noodles.[w:10]\nYou recovered 4 HP!", true, false) };
                break;

            case "Hot Dog...?":
                amount = 20;
                mess   = new TextMessage[] { new TextMessage("[sound:HotDog]You ate the Hot Dog.[w:10]\nYou recovered 20 HP!", true, false) };
                break;

            case "Hot Cat":
                amount = 21;
                mess   = new TextMessage[] { new TextMessage("[sound:HotCat]You ate the Hot Cat.[w:10]\nYou recovered 21 HP!", true, false) };
                break;

            case "Junk Food":
                amount = 17;
                mess   = new TextMessage[] { new TextMessage("You ate the Junk Food.[w:10]\nYou recovered 17 HP!", true, false) };
                break;

            case "Hush Puppy":
                amount = 65;
                mess   = new TextMessage[] { new TextMessage("You ate the Hush Puppy.[w:10]\rDog-magic is neutralized.[w:10]\nYou recovered 65 HP!", true, false) };
                break;

            case "Starfait":
                amount = 14;
                mess   = new TextMessage[] { new TextMessage("You ate the Starfait.[w:10]\nYou recovered 14 HP!", true, false) };
                break;

            case "Glamburger":
                amount = 27;
                mess   = new TextMessage[] { new TextMessage("You ate the Glamburger.[w:10]\nYou recovered 27 HP!", true, false) }; break;

            case "Legendary Hero":
                amount = 40;
                mess   = new TextMessage[] { new TextMessage("[sound:LegHero]You ate the Legendary Hero.[w:10]\nATTACK increased by 4![w:10]\nYou recovered 40 HP!", true, false),
                                             new TextMessage("[music:pause][waitall:10]...[waitall:1]but for now stats\rdon't change.", true, false),
                                             new TextMessage("[noskip][music:unpause][next]", true, false) };
                break;

            case "Steak in the Shape of Mettaton's Face":
                amount = 60;
                mess   = new TextMessage[] { new TextMessage("You ate the Face Steak.[w:10]\nYou recovered 60 HP!", true, false) };
                break;

            case "Popato Chisps":
                amount = 13;
                mess   = new TextMessage[] { new TextMessage("You ate the Popato Chisps.[w:10]\nYou recovered 13 HP!", true, false) };
                break;

            case "Bad Memory":
                if (PlayerCharacter.instance.HP <= 3)
                {
                    amount = 999;
                    mess   = new TextMessage[] { new TextMessage("You consume the Bad Memory.[w:10]\nYour HP was maxed out.", true, false) };
                }
                else
                {
                    amount = -1;
                    mess   = new TextMessage[] { new TextMessage("You consume the Bad Memory.[w:10]\nYou lost 1 HP.", true, false) };
                }
                break;

            case "Last Dream":
                amount = 17;
                mess   = new TextMessage[] { new TextMessage("Through DETERMINATION,\rthe dream became true.[w:10]\nYou recovered 17 HP!", true, false) };
                break;

            default:
                UnitaleUtil.WriteInLogAndDebugger("[WARN]The item doesn't exists in this pool.");
                break;
            }
            if (amount != 0)
            {
                if (UnitaleUtil.IsOverworld)
                {
                    mess[0].setText("[health:" + amount + ", killable]" + mess[0].Text);
                }
                else
                {
                    PlayerController.instance.Hurt(-amount, 0);
                }
            }
            break;

        case 1:
            switch (name)
            {
            case "Toy Knife": amount = 3; break;

            case "Tough Glove": amount = 5; break;

            case "Ballet Shoes": amount = 7; break;

            case "Torn Notebook": amount = 2; break;

            case "Burnt Pan": amount = 10; break;

            case "Empty Gun": amount = 12; break;

            case "Worn Dagger": amount = 15; break;

            case "Real Knife": amount = 99; break;

            default: UnitaleUtil.WriteInLogAndDebugger("[WARN]The item doesn't exists in this pool."); break;
            }
            break;

        case 2:
            switch (name)
            {
            case "Faded Ribbon": amount = 3; break;

            case "Manly Bandanna": amount = 7; break;

            case "Old Tutu": amount = 10; break;

            case "Cloudy Glasses": amount = 6; break;

            case "Stained Apron": amount = 11; break;

            case "Cowboy Hat": amount = 12; break;

            case "Heart Locket": amount = 15; break;

            case "The Locket": amount = 99; break;

            default: UnitaleUtil.WriteInLogAndDebugger("[WARN]The item doesn't exists in this pool."); break;
            }
            break;

        default:
            switch (name)
            {
            case "Testing Dog": mess = new TextMessage[] { new TextMessage("This dog is testing something.", true, false), new TextMessage("I must leave it alone.", true, false) }; break;

            case "Stick": mess = new TextMessage[] { new TextMessage("You throw the stick.[w:10]\nNothing happens.", true, false) }; break;

            default: UnitaleUtil.WriteInLogAndDebugger("[WARN]The item doesn't exists in this pool."); break;
            }
            break;
        }
    }