Пример #1
0
 public void removePerk(Perk perk)
 {
     perks.Add(perk);
     string text = "";
     for(int i=0;i<perks.Count;i++)
     {
         text=text+perks[i];
     }
     //perkText.text=text;
 }
        public string CheckRequirements(uint player)
        {
            var effectiveLevel = Perk.GetEffectivePerkLevel(player, _perk);

            if (effectiveLevel < _requiredLevel)
            {
                return($"{_perkDetail.Name} must be level {_requiredLevel}.");
            }

            return(string.Empty);
        }
Пример #3
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     components     = new System.ComponentModel.Container();
     this.CostLabel = new VLabel();
     this.CurrentLevelIncrementor = new VIncrementor();
     this.CostCaption             = new VLabel();
     this.perkBindingSource       = new VBindingSource();
     this.perkInfo = new ToolTip();
     ((System.ComponentModel.ISupportInitialize)(this.perkBindingSource)).BeginInit();
     //
     // CostCaption
     //
     this.CostCaption.Location  = DPIScalingHelper.GetScaledPoint(10, 69);
     this.CostCaption.Name      = "CostCaption";
     this.CostCaption.Size      = DPIScalingHelper.GetScaledSize(50, 23);
     this.CostCaption.TabIndex  = 6;
     this.CostCaption.Text      = "Cost";
     this.CostCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // CostLabel
     //
     this.CostLabel.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.perkBindingSource, "RemainingCost"));
     this.CostLabel.Location  = DPIScalingHelper.GetScaledPoint(70, 69);
     this.CostLabel.Name      = "CostLabel";
     this.CostLabel.Size      = DPIScalingHelper.GetScaledSize(70, 23);
     this.CostLabel.TabIndex  = 6;
     this.CostLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // CurrentLevelIncrementor
     //
     this.CurrentLevelIncrementor.Location = DPIScalingHelper.GetScaledPoint(27, 30);
     this.CurrentLevelIncrementor.DataBindings.Add("Value", perkBindingSource, "DesiredLevel");
     this.CurrentLevelIncrementor.DataBindings.Add("MaxValue", perkBindingSource, "MaxLevel");
     this.CurrentLevelIncrementor.IncrementHint = (x) => Perk.GetIncrementHint(x);
     this.CurrentLevelIncrementor.DecrementHint = (x) => Perk.GetDecrementHint(x);
     //
     // perkInfo
     //
     this.perkInfo.SetToolTip(this, "Perk Info");
     this.perkInfo.Popup += PerkInfo_Popup;
     //
     // perkBindingSource
     //
     this.perkBindingSource.DataSource = typeof(VPerk);
     //
     // VPerkControl
     //
     this.Controls.Add(this.CostLabel);
     this.Controls.Add(this.CurrentLevelIncrementor);
     this.Controls.Add(this.CostCaption);
     this.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.perkBindingSource, "Name"));
     this.Size = DPIScalingHelper.GetScaledSize(160, 100);
     ((System.ComponentModel.ISupportInitialize)(this.perkBindingSource)).EndInit();
 }
Пример #4
0
 public PerkNode GetPerk(Perk perk)
 {
     foreach (PerkNode Pnode in perks)
     {
         if (Pnode.GetPerk == perk)
         {
             return(Pnode);
         }
     }
     return(null);
 }
Пример #5
0
        public void ClientRemovePerk(string perkName)
        {
            Perk perk = Utils.GetObjectByType <Perk>(Utils.GetTypeByLibraryName <Perk>(perkName));

            if (perk == null)
            {
                return;
            }

            Inventory.Perks.Take(perk);
        }
Пример #6
0
        public void ClientAddPerk(string perkName)
        {
            Perk perk = Utils.GetObjectByType <Perk>(Utils.GetTypeByLibraryName <Perk>(perkName));

            if (perk == null)
            {
                return;
            }

            Inventory.TryAdd(perk, deleteIfFails: true, makeActive: false);
        }
Пример #7
0
        public void GivenАктёрИгрокаПолучаетПерк(string perkSid)
        {
            var schemeService = Context.ServiceProvider.GetRequiredService <ISchemeService>();

            var perkScheme = schemeService.GetScheme <IPerkScheme>(perkSid);
            var perk       = new Perk(perkScheme);

            var actor = Context.GetActiveActor();

            actor.Person.GetModule <IEvolutionModule>().AddBuildInPerks(new[] { perk });
        }
Пример #8
0
    public void ConnectPerk(Perk perk)
    {
        m_perkNameText.text = perk.GetReadableName();

        m_perkDescription.text = perk.GetDescription();

        switch (perk.GetRewardType())
        {
        case Perk.EPerkRewardType.PRT_NotSet:
            m_gold.gameObject.SetActive(false);
            m_dice.gameObject.SetActive(false);
            m_combo.gameObject.SetActive(false);
            m_power.gameObject.SetActive(false);
            break;

        case Perk.EPerkRewardType.PRT_Money:
            m_gold.gameObject.SetActive(true);
            m_dice.gameObject.SetActive(false);
            m_combo.gameObject.SetActive(false);
            m_power.gameObject.SetActive(false);

            m_gold.text = InsertReward(m_gold.text, perk.GetRewardAmount().ToString());

            break;

        case Perk.EPerkRewardType.PRT_Dice:
            m_gold.gameObject.SetActive(false);
            m_dice.gameObject.SetActive(true);
            m_combo.gameObject.SetActive(false);
            m_power.gameObject.SetActive(false);

            m_dice.text = InsertReward(m_dice.text, perk.GetRewardAmount().ToString());
            break;

        case Perk.EPerkRewardType.PRT_Combo:
            m_gold.gameObject.SetActive(false);
            m_dice.gameObject.SetActive(false);
            m_combo.gameObject.SetActive(true);
            m_power.gameObject.SetActive(false);

            m_combo.text = InsertReward(m_combo.text, "\"" + perk.GetComboReward().GetReadableName() + "\"");
            break;

        case Perk.EPerkRewardType.PRT_Power:
            m_gold.gameObject.SetActive(false);
            m_dice.gameObject.SetActive(false);
            m_combo.gameObject.SetActive(false);
            m_power.gameObject.SetActive(true);

            m_power.text = InsertReward(m_power.text, perk.GetRewardAmount().ToString());
            break;
        }
    }
Пример #9
0
    public void DuplicatePerk(Perk i)
    {
        Perk duplicate = new Perk(i);

        duplicate.PerkName = duplicate.PerkName + "copy";
        while (Contains(duplicate.PerkID))
        {
            duplicate.PerkID++;
        }

        AddPerk(duplicate);
    }
Пример #10
0
        public Leach()
        {
            Name = "Leach";
            Tier = 2;
            Cost = 750;
            AD   = 50;
            A    = 5;
            HP   = 200;

            Explanation = (h) => "Each attack heales you by " + ADScale * 100 + "% AD("
                          + h.GetAttackDamage() * ADScale + ").";
            Effect = new Perk()
            {
                Name        = this.Name,
                Explanation = this.Explanation,
                SkillFix    = (s) =>
                {
                    if (!s.SkillTypes.Contains(SkillType.Attack))
                    {
                        return(s);
                    }
                    var newSkill = new Skill()
                    {
                        Name       = s.Name,
                        CoolDown   = s.CoolDown,
                        SkillTypes = s.SkillTypes,
                        Job        = (h) =>
                        {
                            var res = s.Job(h);
                            if (res)
                            {
                                h.GetHeal(h.GetAttackDamage() * 0.3 * h.Targets.Count);
                                return(true);
                            }
                            return(false);
                        },
                        Explanation = () => s.Explanation() + " + LIIIFFESTTEAALL",
                    };

                    return(newSkill);
                }
            };


            //440
            Parts = new List <Item>
            {
                new XPeke(),
                new Razor(),
                new Razor(),
                new Razor(),
            };
        }
Пример #11
0
    /// <summary>
    /// Adds a perk to the actor according to the perk's ID no.
    /// </summary>
    /// <param name="perkID"></param>
    public void AddPerk(int perkID)
    {
        //Debug.LogWarning(db.perkdb);
        //Debug.LogWarning(db.perkdb.perk(perkID));

        Perk perk = db.perkdb.perk(perkID);

        perks.Add(perk);
        AddActorAuras(perk.PerkAuras);

        //Debug.LogWarning("Added perk: " + db.perkdb.perk(perkID).PerkName);
    }
 //Overloaded fuctions to add items to their specific inventories.
 //Could be improved via inheritance and interfaces? Ask tutors
 public void AddItem(Perk other)
 {
     if (inventoryType == (int)InvenKeys.e_perk)
     {
         perkInven.Add(other);
         Debug.Log("entered if");
     }
     if (perkInven.Count > 0)
     {
         Debug.Log("perk added");
     }
 }
Пример #13
0
        public bool HavePerk(Perk _perk)
        {
            List <PerkNode> list = nodeList.GetPerks;

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].GetPerk == _perk && list[i].GetEnable)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #14
0
	static void SwapPerkInList(int ID1, int ID2){
		Perk temp=allPerkList[ID1].Clone();
		allPerkList[ID1]=allPerkList[ID2].Clone();
		allPerkList[ID2]=temp.Clone();
		InitPerkUIDependency();
		
		foreach(Perk perk in allPerkList){
			for(int i=0; i<perk.prereq.Count; i++){
				if(perk.prereq[i]==ID1) perk.prereq[i]=ID2;
				else if(perk.prereq[i]==ID2) perk.prereq[i]=ID1;
			}
		}
	}
Пример #15
0
    public void AddPerk(Perk perk)
    {
        int oldPerkID = this.perks.FindIndex(p => p.Type == perk.Type);

        if (oldPerkID != -1)
        {
            this.perks[oldPerkID] = this.perks[oldPerkID] + perk;
        }
        else
        {
            this.perks.Add(perk);
        }
    }
Пример #16
0
        public bool CanBuyPerk(string key)
        {
            Perk buying = gameData.PerkData[key];

            foreach (var perkKey in buying.Requirement)
            {
                if (!HasPerk(perkKey))
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #17
0
 internal int Status(Perk perk, bool justAdd = false)
 {
     if (!justAdd)
     {
         int index = status.FindIndex(item => item.name == perk.name);
         if (index > -1)
         {
             return(Status(index, perk.rank, perk.tier));
         }
     }
     status.Add(perk);
     return(1);
 }
Пример #18
0
        private async Task <Socket> CreateSocket(DestinyItemSocketEntryDefinition socketEntry,
                                                 DestinySocketTypeDefinition socketType, DestinySocketCategoryDefinition categoryDef,
                                                 DestinyItemSocketState socketState)
        {
            Perk selectedPerk = null;

            if (socketState.PlugHash != 0)
            {
                selectedPerk = await _perkFactory.LoadPerk(socketState.PlugHash, true);
            }

            return(new Socket(selectedPerk, null));
        }
Пример #19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is ILockpickable)
                {
                    Item item = (Item)targeted;
                    from.Direction = from.GetDirectionTo(item);

                    Rogue rge = Perk.GetByType <Rogue>((Player)from);

                    if (((ILockpickable)targeted).Locked)
                    {
                        if (rge == null || !rge.SafeCracker())
                        {
                            from.PlaySound(0x241);
                        }

                        new InternalTimer(from, (ILockpickable)targeted, m_Item).Start();
                    }

                    else if (targeted is BaseDoor && ((BaseDoor)targeted).Picker == from)
                    {
                        if (from.CheckTargetSkill(SkillName.Lockpicking, targeted, ((ILockpickable)targeted).LockLevel, ((ILockpickable)targeted).MaxLockLevel))
                        {
                            from.SendMessage("You quickly relock the door.");
                            ((BaseDoor)targeted).Relock();

                            if (rge == null || !rge.SafeCracker())
                            {
                                from.PlaySound(0x4A);
                            }
                        }
                        else
                        {
                            from.SendMessage("You are unable to relock the door.");
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502069);                           // This does not appear to be locked
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501666);                       // You can't unlock that!
                }
            }
Пример #20
0
        public Buffer()
        {
            Name = "Buffer";
            Cost = 2345;
            Tier = 3;
            E    = 750;
            HP   = 550;
            HR   = 34;
            R    = 20;
            AP   = 100;
            ER   = 30;

            Explanation = (h) => "When attacked restores " + EnergyRestore * 100 + "% of damage. At the end of turn Heales all" +
                          " allies in " + HealRange + " range by " + HealScale * 100 + "%(Armor + Resist + AP) ("
                          + ((h.GetArmor() + h.GetResist() + h.GetAbilityPower()) * HealScale) + ").";
            Effect = new Perk
            {
                Name        = this.Name,
                Explanation = this.Explanation,
                GetDamage   = (f) => (d) =>
                {
                    var gotten = d.DamageValue.Sum() * EnergyRestore;
                    d.HeroValue.AddEnergy(gotten);
                    return(f(d));
                },

                EndTurn = (f) => (d) =>
                {
                    var me     = d.HeroValue;
                    var map    = me.M;
                    var player = me.P;
                    foreach (var ally in player.Heroes)
                    {
                        if (map.UnitPositions[ally].GetStepsTo(map.UnitPositions[me]) <= HealRange)
                        {
                            ally.GetHeal((me.GetArmor() + me.GetResist() + me.GetAbilityPower()) * HealScale);
                        }
                    }
                    return(f(d));
                },
            };



            //1420
            Parts = new List <Item>
            {
                new NanoArmor(),
                new MagicCrystal(),
            };
        }
Пример #21
0
    void DrawRewardFoldout(Perk perk)
    {
        rewardFoldout = EditorGUILayout.Foldout(rewardFoldout, "Reward Options");

        if (!rewardFoldout)
        {
            return;
        }

        EditorGUI.indentLevel++;
        perk.GUIAward = (Perk.EPerkRewardType)EditorGUILayout.EnumPopup("Reward to give:", perk.GUIAward);

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("The following reward will be given:");
        EditorGUI.indentLevel++;

        switch (perk.GUIAward)
        {
        case Perk.EPerkRewardType.PRT_Money:
            EditorGUILayout.LabelField("The player will start with more money:");
            perk.GUIRewardAmount = EditorGUILayout.IntField(" ", perk.GUIRewardAmount);
            break;

        case Perk.EPerkRewardType.PRT_Dice:
            EditorGUILayout.LabelField("The player will start with more dice:");
            perk.GUIRewardAmount = EditorGUILayout.IntField(" ", perk.GUIRewardAmount);
            break;

        case Perk.EPerkRewardType.PRT_Combo:
            EditorGUILayout.LabelField("The player will unlock the combo:");
            perk.GUIComboReward = (ComboBase)EditorGUILayout.ObjectField("", perk.GUIComboReward, typeof(ComboBase), false);
            break;

        case Perk.EPerkRewardType.PRT_Power:
            EditorGUILayout.LabelField("The players dice will start with more power:");
            perk.GUIRewardAmount = EditorGUILayout.IntField(" ", perk.GUIRewardAmount);
            break;

        default:
            EditorGUILayout.LabelField("WARNING: Reward type has not been set", "WARNING: Reward type has not been set");
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("WARNING: Reward type has not been set", "WARNING: Reward type has not been set");

            break;
        }

        EditorGUI.indentLevel--;
        EditorGUI.indentLevel--;
    }
Пример #22
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    Rogue rge = Perk.GetByType <Rogue>((Player)m_From);

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == -255)
                    {
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        // Do some training to gain skills
                        m_From.CheckSkill(SkillName.Lockpicking, 0, m_Item.LockLevel);

                        // The LockLevel is higher thant the LockPicking of the player
                        item.SendLocalizedMessageTo(m_From, 502072);                           // You don't see how that lock can be manipulated.
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076);                           // The lock quickly yields to your skill.
                        m_Item.LockPick(m_From);

                        if (rge == null || !rge.SafeCracker())
                        {
                            m_From.PlaySound(0x4A);
                        }
                    }
                    else
                    {
                        // The player failed to pick the lock
                        if (rge == null || !rge.SafeCracker())
                        {
                            BrokeLockPickTest();
                        }

                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.
                    }
                }
Пример #23
0
 public void updatePerkUI(Perk a_Perk)
 {
     if (a_Perk == null)
     {
         //m_Text.text = "NO PERK";
     }
     //todo set text/image
     m_Text.text = a_Perk.m_name;
     if (m_image != null)
     {
         m_image.sprite = a_Perk.m_PerkImage;
     }
     //print("perk "+a_Perk.m_name+": setting the image of perk " + m_PerkIndex + " is not implemented");
 }
Пример #24
0
    public void TestPerkValueLower()
    {
        int testStatValue = 50;
        int testGoalValue = 100;

        Basestat testStat = ScriptableObject.CreateInstance <Basestat>();

        testStat.AddPoints(testStatValue);
        Perk testPerk = ScriptableObject.CreateInstance <Perk>();

        testPerk.SetTestValues(testStat, testGoalValue);

        Assert.AreEqual(false, testPerk.CheckPerk());
    }
Пример #25
0
        public static string GetPerks(Perk perks)
        {
            var retval = new StringBuilder();

            foreach (Perk p in Enum.GetValues(typeof(Perk)))
            {
                if (perks.HasFlag(p) && Emoji.ContainsKey(p))
                {
                    retval.Append($"{Emoji[p]}");
                }
            }

            return(retval.ToString().Trim());
        }
Пример #26
0
    void fillInPerk(GameObject toFill, Perk perk)
    {
        GameObject buttonGameObject = toFill.transform.Find("PerkButton").gameObject;

        buttonGameObject.SetActive(true);
        buttonGameObject.transform.Find("PerkName").gameObject.GetComponent <Text>().text = perk.skillName;
        buttonGameObject.transform.Find("Frame").gameObject.SetActive(perk.own);
        GameObject panelGameObject = toFill.transform.Find("ExplainationPanel").gameObject;

        panelGameObject.transform.Find("ExplanationDescription").gameObject.GetComponent <Text>().text = perk.description;
        panelGameObject.transform.Find("ExplanationQuote").gameObject.GetComponent <Text>().text       = perk.quote;
        buttonGameObject.GetComponent <Button>().onClick.RemoveAllListeners();
        buttonGameObject.GetComponent <Button>().onClick.AddListener(delegate { panelGameObject.SetActive(!panelGameObject.activeSelf); });
    }
Пример #27
0
    static public bool HasPerkActivated(int number, Perk perk)
    {
        List <string> activatedPerks = PerkProperties.GetActivePerks(number);

        foreach (string activatedPerk in activatedPerks)
        {
            if (activatedPerk.Equals(perk.GetName()))
            {
                return(true);
            }
        }

        return(false);
    }
Пример #28
0
        public static List <Perk> RandomizePerks(int count, ListView list, bool uniquePerks)
        {
            Random r         = new Random();
            int    picksLeft = count;

            List <Perk> allPerks      = new List <Perk>();
            List <Perk> selectedPerks = new List <Perk>();

            // If there weren't previous perks, don't bother checking
            if (previousPerks == null)
            {
                uniquePerks = false;
            }

            // If there aren't enough perks selected to have a full set, ignore this
            if (previousPerks.Count + count > list.CheckedItems.Count)
            {
                uniquePerks = false;
            }

            foreach (ListViewItem perk in list.CheckedItems)
            {
                Image  img  = list.SmallImageList.Images[perk.ImageIndex];
                string name = perk.Text;

                // Filter out perks that were selected the previous roll, if that's asked for
                if (uniquePerks == false || !previousPerks.Contains(name))
                {
                    allPerks.Add(new Perk {
                        Img = img, Name = name
                    });
                }
            }

            previousPerks.Clear();

            while (allPerks.Count > 0 && picksLeft > 0)
            {
                int  nextIndex = r.Next(allPerks.Count);
                Perk nextPerk  = allPerks[nextIndex];
                selectedPerks.Add(nextPerk);
                previousPerks.Add(nextPerk.Name);
                allPerks.RemoveAt(nextIndex);

                picksLeft -= 1;
            }

            return(selectedPerks);
        }
        public static void ValidateDualWield()
        {
            var creature = OBJECT_SELF;
            var item     = StringToObject(Events.GetEventData("ITEM"));
            var slot     = (InventorySlot)Convert.ToInt32(Events.GetEventData("SLOT"));

            // Not equipping to the left hand, or there's nothing equipped in the right hand.
            if (slot != InventorySlot.LeftHand)
            {
                return;
            }
            if (!GetIsObjectValid(GetItemInSlot(InventorySlot.RightHand, creature)))
            {
                return;
            }

            var baseItem         = GetBaseItemType(item);
            var dualWieldWeapons = new[]
            {
                BaseItem.ShortSword,
                BaseItem.Longsword,
                BaseItem.BattleAxe,
                BaseItem.BastardSword,
                BaseItem.LightFlail,
                BaseItem.LightMace,
                BaseItem.Dagger,
                BaseItem.Club,
                BaseItem.HandAxe,
                BaseItem.Kama,
                BaseItem.Katana,
                BaseItem.Kukri,
                BaseItem.Rapier,
                BaseItem.Scimitar,
                BaseItem.Sickle
            };

            if (!dualWieldWeapons.Contains(baseItem))
            {
                return;
            }

            var dualWieldLevel = Perk.GetEffectivePerkLevel(creature, PerkType.DualWield);

            if (dualWieldLevel <= 0)
            {
                SendMessageToPC(creature, ColorToken.Red("Equipping two weapons requires the Dual Wield perk."));
                Events.SkipEvent();
            }
        }
Пример #30
0
        public override bool OnEquip(Mobile from)
        {
            if (from is Player)
            {
                Marksman mm = Perk.GetByType <Marksman>((Player)from);

                if (mm != null && mm.LongShot() == true)
                {
                    this.MaxRange  += 3;
                    mm.BowConverted = true;
                }
            }

            return(base.OnEquip(from));
        }
Пример #31
0
        public override bool OnEquip(Mobile from)
        {
            if (from is Player)
            {
                Legionnaire lgn = Perk.GetByType <Legionnaire>((Player)from);

                if (lgn != null && lgn.Hoplite() == true)
                {
                    this.Layer         = Layer.OneHanded;
                    lgn.SpearConverted = true;
                }
            }

            return(base.OnEquip(from));
        }
Пример #32
0
	public void AddPerk( Perk perk )
	{
		PerkData settings = perk.settings;

		// stash perk settings
		_perks[settings.type] = settings;

		// apply modifiers
		if ( settings.speedMod > 0.0f )
		{
			_playerSpeed.speedMultiplier = settings.speedMod;
		}

		_playerHealth.Heal( settings.healthMod );
		_playerWeapons.SetBuff( settings.fireRateMod, settings.damageMod, settings.reloadMod );

		if ( settings.shield )
		{
			_playerHealth.immune = true;
			shield.gameObject.SetActive( true );
			shield.ResetShield();
		}

		if ( settings.gunDrop != null )
		{
			if ( _playerWeapons.weapons.Count >= 2 )
			{
				_playerWeapons.RemoveSpecialWeapon();
			}

			_playerWeapons.weapons.Add( settings.gunDrop );
			_playerWeapons.perk = settings;
			_playerWeapons.NewSpecialWeapon();
		}

		if ( settings.duration > 0.0f )
		{
			// cancel existing coroutine
			if ( _perkEnding.ContainsKey( settings.type ) )
			{
				//StopCoroutine( _perkEnding[settings.type] ); // This is causing unity (the editor) to crash. It's a bug within unity, we'll have to work around it.
			}

			// start new coroutine
			_perkEnding[settings.type] = StartCoroutine( RemoveAfterDelay( settings ) );
		}
	}
Пример #33
0
 void CloseBuyPerkMenu()
 {
     mCurrentPerk = null;
     MenuCamera.Instance.PopupBuyMenu().Close();
 }
Пример #34
0
        /// <summary>
        /// Plays a special effect for upgrading a perk level
        /// </summary>
        private void PlayUpgradeEffect( Player player, Perk perk, PerkLevel newLevel )
        {
            Effects.SendMovingEffect(new Entity(Server.Serial.Zero, new Point3D(player.Location, player.Z + 20), player.Map), player, 0x373A, 10, 10, false, false);
            Effects.SendTargetEffect(player, 0x3779, 10, 10);
            player.PlaySound(0x0F8);

            if( newLevel == PerkLevel.First )
            {
                player.SendMessage("You have unlocked the first level of the {0} perk!", perk.Label);
            }
            else
            {
                player.SendMessage("You have upgraded {0} to the {1} level!", perk.Label, newLevel);
            }
        }
Пример #35
0
        /// <summary>
        /// Completes a perk level upgrade
        /// </summary>
        private void PurchaseUpgrade( Player player, Perk currentPerk, PerkLevel targetLevel )
        {
            if( currentPerk == null )
            {
                player.SendMessage("You have not started on this perk track!");
            }
            else if( targetLevel <= currentPerk.Level )
            {
                player.SendMessage("Your current abilities exceed your selected upgrade.");
            }
            else
            {
                int upgradeCost = GetUpgradeCost(currentPerk.Level, targetLevel);

                if( upgradeCost > player.EssenceOfCharacter )
                {
                    player.SendMessage("You do not have enough Essence of Character to afford this upgrade!");
                }
                else
                {
                    player.EssenceOfCharacter -= upgradeCost;
                    currentPerk.Level = targetLevel;

                    PlayUpgradeEffect(player, currentPerk, targetLevel);
                }
            }
        }
Пример #36
0
        public PerkOverviewGump( Player from, Page page, Perk perk, PerkLevel displayLevel, PerkLevel targetLevel )
            : base(10, 10)
        {
            Player = from;
            Perk = perk;
            CurrentLevel = displayLevel;
            bool hasPerk = Perk.HasPerk(from, perk);

            AddPage(0);

            int bkHeight = 135, bkWidth = 30;

            if( page == Page.Detail )
            {
                if( targetLevel > PerkLevel.None && (!hasPerk || targetLevel != Perk.Get(from, perk).Level) )
                    bkHeight = 475;
                else
                    bkHeight = 415;

                bkWidth = 450;
            }
            else
            {
                int columns = (int)Math.Ceiling((double)Perk.AllPerks.Count / 4);
                int rows = (Perk.AllPerks.Count >= 4 ? 4 : Perk.AllPerks.Count);

                bkHeight += (rows * 70);
                bkWidth += (columns * 105);
            }

            AddBackground(0, 0, bkWidth, bkHeight, 9250);

            switch( page )
            {
                case Page.Overview:
                    AddHtml(15, 15, (bkWidth - 30), 15, Color(Center("Perks Overview"), HtmlWhite), false, false);
                    AddHtml(15, 35, (bkWidth - 30), 70, String.Format("<center>Upgrade your character's Abilities using Essence of Character." +
                                                "<br><br><center>You currently have {0}",
                                                Color(String.Format("{0:N0} Essence of Character", from.EssenceOfCharacter), HtmlBlack)
                                                ), false, true);
                    AddImageTiled(15, 110, (bkWidth - 30), 4, 9151);

                    int x = 20, y = 120;

                    for( int i = 0; i < Perk.AllPerks.Count; i++ )
                    {
                        hasPerk = Perk.HasPerk(from, Perk.AllPerks[i]);

                        if( i > 0 && (i % 4) == 0 )
                        {
                            x += 105;
                            y = 120;
                        }

                        AddBlackAlpha((x - 2), (y + 3), 90, 65);
                        AddLabel(x, y, LabelHue, Perk.AllPerks[i].Label);

                        int perkIcon = Perk.AllPerks[i].GumpID;

                        if( perkIcon == 0 )
                            perkIcon = 21280;

                        AddButton((x + 30), (y + 20), perkIcon, perkIcon, GetButtonId(1, i), GumpButtonType.Reply, 0);
                        AddButton((x + 59), (y + 49), (hasPerk ? 2361 : 2360), (hasPerk ? 2361 : 2360), GetButtonId(1, i), GumpButtonType.Reply, 0);

                        y += 70;
                    }
                    break;
                case Page.Detail:
                    if( perk == null )
                        return;

                    AddHtml(15, 15, (bkWidth - 30), 18, Color(Center(perk.Label), HtmlWhite), false, false);

                    int imgId = perk.GumpID;

                    if( imgId == 0 )
                        imgId = 21280;

                    AddImage(15, 38, imgId);
                    AddHtml(45, 38, (bkWidth - 75), 40, Center(perk.Description), false, false);
                    AddImageTiled(15, 84, (bkWidth - 30), 4, 9151);
                    AddButton(15, 15, 4014, 4015, GetButtonId(2, 0), GumpButtonType.Reply, 0);

                    AddImage(45, 90, 2200);

                    if( displayLevel > PerkLevel.First )
                        AddButton(68, 94, 2205, 2205, GetButtonId(2, 1), GumpButtonType.Reply, 0);

                    if( displayLevel < PerkLevel.Fifth )
                        AddButton(339, 94, 2206, 2206, GetButtonId(2, 2), GumpButtonType.Reply, 0);

                    LabelEntry left = perk.LabelEntries[displayLevel];

                    AddHtml(70, 117, 140, 40, Center(left.Label), false, false);
                    AddHtml(70, 162, 140, 110, Color(left.Description, HtmlBlack), false, true);
                    AddLabel(135, 275, 0, LevelToNumeral(displayLevel));

                    if( displayLevel != PerkLevel.Fifth )
                    {
                        LabelEntry right = perk.LabelEntries[(displayLevel + 1)];

                        AddHtml(230, 117, 140, 40, Center(right.Label), false, false);
                        AddHtml(230, 162, 140, 110, Color(right.Description, HtmlBlack), false, true);
                        AddLabel(295, 275, 0, LevelToNumeral(displayLevel + 1));
                    }

                    string trackProgressLbl = "";

                    if( !hasPerk )
                    {
                        if( Perk.HasFreeSlot(from) )
                        {
                            trackProgressLbl = "You have not started on this perk track.";

                            if( from.EssenceOfCharacter >= Perk.FirstLevelCost )
                            {
                                AddLabel(15, 350, LabelHue, "You can begin developing this perk for 10,000 Essence of Character.");
                                AddButton(205, 380, 4023, 4024, GetButtonId(6, 0), GumpButtonType.Reply, 0);
                                AddLabel(245, 380, LabelHue, String.Format("Begin {0}", perk.Label));
                            }
                            else
                            {
                                AddLabel(15, 350, LabelHue, "You need at least 10,000 Essence of Character to develop a perk.");
                            }
                        }
                        else
                        {
                            trackProgressLbl = "You already have two other perks and cannot begin another track.";
                        }
                    }
                    else
                    {
                        Perk playerPerk = Perk.Get(from, perk);
                        from.ValidateEquipment();

                        if( playerPerk.Level == PerkLevel.Fifth )
                            trackProgressLbl = "You have mastered this perk, congratulations!";
                        else
                            trackProgressLbl = "You are currently progressing on this perk track.";

                        AddLabel(30, 365, LabelHue, "Level:");
                        AddImage(75, 370, 2053); //base progress bar

                        if( targetLevel > PerkLevel.None && targetLevel != playerPerk.Level )
                        {
                            AddImageTiled(75, 370, (4 + GetProgressionDim(targetLevel)), 11, 2057); //yellow progress overlay

                            if( targetLevel == PerkLevel.Fifth )
                            {
                                AddButton(190, 370, 2437, 2438, GetButtonId(4, (int)(targetLevel - 1)), GumpButtonType.Reply, 0);
                                AddLabel(205, 365, LabelHue, "- level");
                            }
                            else
                            {
                                AddButton(190, 360, 2435, 2436, GetButtonId(3, (int)(targetLevel + 1)), GumpButtonType.Reply, 0);
                                AddLabel(205, 355, LabelHue, "+ level");

                                AddButton(190, 380, 2437, 2438, GetButtonId(4, (int)(targetLevel - 1)), GumpButtonType.Reply, 0);
                                AddLabel(205, 375, LabelHue, "- level");
                            }

                            int upgradeCost = GetUpgradeCost(playerPerk.Level, targetLevel);

                            AddLabel(80, 395, LabelHue, "EoC Cost:");
                            AddLabel(155, 395, LabelHue, upgradeCost.ToString("N0"));

                            AddLabel(80, 415, LabelHue, "You have:");
                            AddLabel(155, 415, LabelHue, from.EssenceOfCharacter.ToString("N0"));

                            AddLabel(80, 435, LabelHue, "Remainder:");
                            AddLabel(155, 435, (upgradeCost > from.EssenceOfCharacter ? 32 : 1154), (from.EssenceOfCharacter - upgradeCost).ToString("N0"));

                            if( upgradeCost <= from.EssenceOfCharacter )
                            {
                                AddLabel(285, 440, LabelHue, "Purchase Upgrade");
                                AddButton(405, 440, 4023, 4024, GetButtonId(5, (int)targetLevel), GumpButtonType.Reply, 0);
                            }
                        }
                        else if( playerPerk.Level != PerkLevel.Fifth )
                        {
                            AddButton(190, 370, 2435, 2436, GetButtonId(3, (int)(playerPerk.Level + 1)), GumpButtonType.Reply, 0);
                            AddLabel(205, 365, LabelHue, "+ level");
                        }

                        int progress = GetProgressionDim(playerPerk.Level);

                        AddLabel((75 + progress), 350, LabelHue, ((int)playerPerk.Level).ToString()); //progress level indicator
                        AddImageTiled(75, 370, (4 + progress), 11, 2054); //blue progress overlay
                        AddImage((75 + progress), 370, 2104); //progress pin
                    }

                    AddLabel(15, 330, LabelHue, trackProgressLbl);
                    break;
            }
        }
Пример #37
0
 public PerkOverviewGump( Player from, Page page, Perk perk, PerkLevel displayLevel )
     : this(from, page, perk, displayLevel, PerkLevel.None)
 {
 }
Пример #38
0
 public void addPerk(Perk perk)
 {
     perks.Add(perk);
     //perkText.text=perkText.text+", "+perk;
 }
Пример #39
0
    void OpenBuyPerkMenu(int index)
    {
        mCurrentPerk = mPerks[index];

        // alredy unlocked or cannot unlock - ABORT! ABORT!!
        if (!mCurrentPerk.CanUnlockPart())
        {
            mCurrentPerk = null;
            return;
        }

        MenuCamera.Instance.PopupBuyMenu().Open(mCurrentPerk.PreviewObject());
    }