Which part is wrong? menu

User Tag List

Results 1 to 2 of 2
  1. #1
    ljj16's Avatar Member
    Reputation
    1
    Join Date
    Nov 2019
    Posts
    7
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Which part is wrong?

    Is it possible to show COE rotation only the witchdoctor or necromancer, not myself?


    Which part is wrong?

    How should I change this part "var player = Hud.Game.Players.FirstOrDefault(p => p.CoordinateKnown); " ?

    Or is the other part wrong?

    plz help me








    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Turbo.Plugins.Default;

    namespace Turbo.Plugins.wq
    {
    using System.Text;
    public class ConventionOfElementsAndBrokenPromissesBuffOnCenterPlugin : BasePlugin, IInGameTopPainter {

    public bool HideWhenUiIsHidden { get; set; }
    public BuffPainter BuffPainter { get; set; }
    public float PositionOffset { get; set; }
    public float IconSizeMultiplier{get; set;}
    public const int ConventionElementID = 430674;

    private BuffRuleCalculator ruleCalculatorCoE;

    public ConventionOfElementsAndBrokenPromissesBuffOnCenterPlugin() {
    Enabled = true;
    PositionOffset = 0.04f;
    IconSizeMultiplier = 2.0f;
    }

    public override void Load(IController hud) {
    base.Load(hud);

    HideWhenUiIsHidden = false;

    BuffPainter = new BuffPainter(Hud, true)
    {
    Opacity = 1.0f,
    TimeLeftFont = Hud.Render.CreateFont("tahoma", 35, 255, 255, 255, 255, true, false, 255, 0, 0, 0, true),
    };

    ruleCalculatorCoE = new BuffRuleCalculator(Hud);
    ruleCalculatorCoE.SizeMultiplier = IconSizeMultiplier;

    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 1, MinimumIconCount = 0, DisableName = true }); // Arcane
    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 2, MinimumIconCount = 0, DisableName = true }); // Cold
    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 3, MinimumIconCount = 0, DisableName = true }); // Fire
    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 4, MinimumIconCount = 0, DisableName = true }); // Holy
    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 5, MinimumIconCount = 0, DisableName = true }); // Lightning
    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 6, MinimumIconCount = 0, DisableName = true }); // Physical
    ruleCalculatorCoE.Rules.Add(new BuffRule(ConventionElementID) { IconIndex = 7, MinimumIconCount = 0, DisableName = true }); // Poison



    }


    private List<BuffPaintInfo> GeneratePaintList() {



    var player = Hud.Game.Players.FirstOrDefault(p => p.CoordinateKnown);

    var paintInfoList = new List<BuffPaintInfo>();

    //Add Convention Of Elements and caculate timedown
    var elementPaintInfo = GetElementPaintInfo();
    if(elementPaintInfo != null) {
    paintInfoList.Add(elementPaintInfo);
    }

    return paintInfoList;
    }



    private IEnumerable<BuffRule> GetCurrentRules(HeroClass heroClass) {
    for (int i = 1; i <= 7; i++)
    {
    switch (heroClass)
    {
    case HeroClass.Barbarian: if (i == 1 || i == 4 || i == 7) continue; break;
    case HeroClass.Crusader: if (i == 1 || i == 2 || i == 7) continue; break;
    case HeroClass.DemonHunter: if (i == 1 || i == 4 || i == 7) continue; break;
    case HeroClass.Monk: if (i == 1 || i == 7) continue; break;
    case HeroClass.Necromancer: if (i == 1 || i == 3 || i == 4 || i == 5) continue; break;
    case HeroClass.WitchDoctor: if (i == 1 || i == 4 || i == 5) continue; break;
    case HeroClass.Wizard: if (i == 4 || i == 6 || i == 7) continue; break;
    }
    yield return ruleCalculatorCoE.Rules[i - 1];
    }
    }



    private BuffPaintInfo GetElementPaintInfo() {

    var player = Hud.Game.Players.FirstOrDefault(p => p.CoordinateKnown);
    var classSpecificRules = GetCurrentRules(player.HeroClassDefinition.HeroClass);

    ruleCalculatorCoE.CalculatePaintInfo(player, classSpecificRules);

    if (ruleCalculatorCoE.PaintInfoList.Count == 0) return null;
    if (!ruleCalculatorCoE.PaintInfoList.Any(info => info.TimeLeft > 0)) return null;

    var buff = player.Powers.GetBuff(ConventionElementID);

    if ((buff == null) || (buff.IconCounts[0] <= 0)) return null;

    var bestElementIndex = LocateBestElement();
    var currentElementIndex = LocateCurrentElement();

    var paintInfo = ruleCalculatorCoE.PaintInfoList[currentElementIndex];

    if (bestElementIndex == currentElementIndex) {
    paintInfo.TimeLeftNumbersOverride = false;
    } else if(bestElementIndex > currentElementIndex) {
    paintInfo.TimeLeft += (bestElementIndex - currentElementIndex - 1) * 4;
    } else {
    paintInfo.TimeLeft += (ruleCalculatorCoE.PaintInfoList.Count - 1 - currentElementIndex + bestElementIndex) * 4;
    }
    return paintInfo;
    }



    private int LocateCurrentElement() {
    for (int index = 0; index < ruleCalculatorCoE.PaintInfoList.Count; index++) {
    if (ruleCalculatorCoE.PaintInfoList[index].TimeLeft > 0) return index;
    }
    return 0;
    }

    private int LocateBestElement() {
    var player = Hud.Game.Players.FirstOrDefault(p => p.CoordinateKnown);
    var highestElementalBonus = player.Offense.HighestElementalDamageBonus;
    var list = ruleCalculatorCoE.PaintInfoList;
    for(int index = 0; index < list.Count - 1; index++) {
    var best = false;
    var info = list[index];
    switch (info.Rule.IconIndex) {
    case 1: best = player.Offense.BonusToArcane == highestElementalBonus; break;
    case 2: best = player.Offense.BonusToCold == highestElementalBonus; break;
    case 3: best = player.Offense.BonusToFire == highestElementalBonus; break;
    case 4: best = player.Offense.BonusToHoly == highestElementalBonus; break;
    case 5: best = player.Offense.BonusToLightning == highestElementalBonus; break;
    case 6: best = player.Offense.BonusToPhysical == highestElementalBonus; break;
    case 7: best = player.Offense.BonusToPoison == highestElementalBonus; break;
    }
    if (best) return index;
    }
    return 0;
    }


    private void debug(string message) {
    Hud.TextLog.Log("Debug", message);
    }

    public void PaintTopInGame(ClipState clipState) {
    if (clipState != ClipState.BeforeClip) return;
    if (HideWhenUiIsHidden && Hud.Render.UiHidden) return;


    foreach (var player in Hud.Game.Players)
    {
    if (player.HeroClassDefinition.HeroClass == HeroClass.Necromancer)
    {

    if(!Enabled) return;
    var paintInfoList = GeneratePaintList();
    if (paintInfoList == null || paintInfoList.Count == 0) return;

    var x = 0;
    var y = Hud.Window.Size.Height * 0.20f - Hud.Window.Size.Height * PositionOffset;
    BuffPainter.PaintHorizontalCenter(paintInfoList, x, y, Hud.Window.Size.Width, ruleCalculatorCoE.StandardIconSize, ruleCalculatorCoE.StandardIconSpacing);

    }
    }

    }
    }

    }

    These ads disappear when you log in.

  2. #2
    RNN's Avatar Legendary
    Reputation
    681
    Join Date
    Sep 2018
    Posts
    899
    Thanks G/R
    94/653
    Trade Feedback
    0 (0%)
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    ..........
    Last edited by RNN; 08-13-2020 at 11:27 AM. Reason: deleted

Similar Threads

  1. What is wrong?
    By iccy in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 09-02-2007, 10:23 AM
  2. Which 1 is better?
    By Robob in forum WoW PvP & Battlegrounds
    Replies: 31
    Last Post: 08-08-2007, 11:41 PM
  3. What is wrong with mywarcraft studio?...
    By xigon in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 08-03-2007, 01:13 AM
  4. Which song is Better? Your thoughts :D
    By Gelormino in forum Community Chat
    Replies: 6
    Last Post: 08-01-2007, 08:52 PM
  5. Which fish is the most expensive?
    By AngryLlama in forum World of Warcraft General
    Replies: 0
    Last Post: 02-16-2007, 08:07 PM
All times are GMT -5. The time now is 11:31 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search