Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 2
0
    private void ToggleCharacterSheet()
    {
        var canvas = GameObject.FindGameObjectWithTag("Canvas");

        canvas.GetComponent <Inventory>().Refresh();
        characterSheet.GetComponent <DuloGames.UI.UIWindow>().Toggle();
        DropsArea.ClearDrops();
    }
Esempio n. 3
0
 public void OnClick()
 {
     if (PlayerCharacter.localPlayer.inventory.items.Contains(item))
     {
         GameObject.FindGameObjectWithTag("Canvas").GetComponent <Inventory>().Refresh();
         DropsArea.OpenInventory();
     }
     DropsArea.ClearDrops();
 }
Esempio n. 4
0
    private void ToggleInventory()
    {
        var canvas = GameObject.FindGameObjectWithTag("Canvas");

        canvas.GetComponent <Inventory>().Refresh();
        //inventory.SetActive(!inventory.activeSelf);
        inventory.GetComponent <DuloGames.UI.UIWindow>().Toggle();
        DropsArea.ClearDrops();
    }
Esempio n. 5
0
 public void GainSoulGem(Ability ability)
 {
     GetComponent <ObjectSpawner>().CreateFloatingStatusText("FOUND A SOUL GEM!", "Found a soul gem!");
     if (ability is ActiveAbility activeAbility)
     {
         activeAbility.currentCooldown = 0;
         GetComponent <AbilityUser>().soulGemActives.Add(activeAbility);
     }
     else
     {
         GetComponent <AbilityUser>().soulGemPassivesOverflow.Add((PassiveAbility)ability);
     }
     DropsArea.AddAbilityDrop(ability);
     GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
 }
Esempio n. 6
0
 private void EquipBraceletIfPossible(Equipment item, PlayerCharacter pc)
 {
     if (!(item is Bracelet bracelet))
     {
         return;
     }
     for (int i = 0; i < pc.bracelets.Length; i++)
     {
         if (pc.bracelets[i] == null)
         {
             pc.bracelets[i] = bracelet;
             pc.ModifyStats(null, item);
             pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
             return;
         }
     }
     PlayerCharacter.localPlayer.inventory.items.Add(item);
     DropsArea.AddItemDrop(item);
     StartCoroutine(pc.inventory.RefreshInABit());
 }
Esempio n. 7
0
    public void DropEquipment(Character attacker, int quality)
    {
        int[] stat1            = { 0, 2, 3, 5, 7, 9, 12, 15 };
        int[] stat2            = { 0, 0, 2, 3, 4, 5, 6, 7 };
        int[] stat3            = { 0, 0, 0, 0, 2, 2, 3, 4 };
        var   statPreAdjusted1 = (float)stat1[quality];
        var   statPreAdjusted2 = (float)stat2[quality];
        var   statPreAdjusted3 = (float)stat3[quality];

        intendedLevel = 1;
        if (GetComponent <MonsterScaler>() != null && GetComponent <MonsterScaler>().level > 1)
        {
            intendedLevel = GetComponent <MonsterScaler>().level;
        }
        else if (GetComponent <Chest>() != null && attacker.GetComponent <ExperienceGainer>().level > 1)
        {
            intendedLevel = attacker.GetComponent <ExperienceGainer>().level;
        }
        for (int i = 1; i < intendedLevel; i++)
        {
            statPreAdjusted1 *= 1.1f;
            statPreAdjusted2 *= 1.1f;
            statPreAdjusted3 *= 1.1f;
        }
        var       statAdjusted1 = (int)statPreAdjusted1;
        var       statAdjusted2 = (int)statPreAdjusted2;
        var       statAdjusted3 = (int)statPreAdjusted3;
        int       armor         = 100 + (21 * intendedLevel);
        Equipment item          = null;

        if (SceneInitializer.instance != null && SceneInitializer.instance.inside && LevelGen.dungeonData != null)
        {
            item = DropItemForLootAffinities(attacker, armor, quality);
        }
        else
        {
            item = DropItemDefault(attacker, armor, quality);
        }
        if (statAdjusted1 > 0)
        {
            BuffRandomStat(item, statAdjusted1);
        }
        if (statAdjusted2 > 0)
        {
            BuffRandomStat(item, statAdjusted2);
        }
        if (statAdjusted3 > 0)
        {
            BuffRandomStat(item, statAdjusted3);
        }
        if (quality >= 2)
        {
            BuffRandomSecondaryStat(item, statAdjusted1);
        }
        if (quality >= 3)
        {
            BuffRandomSecondaryStat(item, statAdjusted2);
        }
        if (item == null)
        {
            return;
        }

        item.description += GetDescriptionText(item);
        item.level        = intendedLevel;
        item.quality      = quality;
        EquipmentNamer.NameEquipment(item);
        var pc = attacker.GetComponent <PlayerCharacter>();

        if (item is Armor && pc.armor == null)
        {
            pc.armor = (Armor)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Hat && pc.hat == null)
        {
            pc.hat = (Hat)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Shoes && pc.shoes == null)
        {
            pc.shoes = (Shoes)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Belt && pc.belt == null)
        {
            pc.belt = (Belt)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Cloak && pc.cloak == null)
        {
            pc.cloak = (Cloak)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Earring && pc.earring == null)
        {
            pc.earring = (Earring)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Necklace && pc.necklace == null)
        {
            pc.necklace = (Necklace)item;
            pc.ModifyStats(null, item);
            pc.GetComponent <HotbarUser>().CmdRefreshAbilityInfo();
        }
        else if (item is Bracelet)
        {
            EquipBraceletIfPossible(item, pc);
        }
        else
        {
            pc.inventory.items.Add(item);
            DropsArea.AddItemDrop(item);
            StartCoroutine(pc.inventory.RefreshInABit());
        }
    }
Esempio n. 8
0
 public void OnClick()
 {
     if (ability is ActiveAbility activeAbility && PlayerCharacter.localPlayer.GetComponent <AbilityUser>().soulGemActivesOverflow.Contains(activeAbility))
     {
         DropsArea.OpenAbilities();
     }
Esempio n. 9
0
 private void ToggleAbilityMenu()
 {
     abilityScreen.GetComponent <DuloGames.UI.UIWindow>().Toggle();
     DropsArea.ClearDrops();
 }
Esempio n. 10
0
 public void ToggleInventory()
 {
     canvas.GetComponent <Inventory>().Refresh();
     inventory.GetComponent <DuloGames.UI.UIWindow>().Toggle();
     DropsArea.ClearDrops();
 }