Beispiel #1
0
        private void Add(Player player, IEnumerable <string> args)
        {
            if (!CheckPermission(player, "RaidBoss.Modify"))
            {
                return;
            }
            if (!CheckArgs(player, args))
            {
                return;
            }

            var playerName = args.JoinToString(" ");
            var target     = Server.GetPlayerByName(playerName);

            if (target == null)
            {
                player.SendError(GetMessage("No player", player));
                return;
            }
            if (BossList.ContainsKey(target.Id))
            {
                player.SendError(GetMessage("Already a boss", player));
                return;
            }

            MakeBoss(target);
        }
Beispiel #2
0
 private void CheckAllBossesAreGone()
 {
     if (!BossList.Any())
     {
         PrintToChat(GetMessage("All bosses gone"));
     }
 }
Beispiel #3
0
        public DKTANK()
        {
            // TODO: Add constructor logic here

            weap          = new Stats();
            weap.Strength = 10;
            weapon        = new Item("test", ItemQuality.Common, ItemType.OneHandSword, 10101, "icon.bmp", ItemSlot.OneHand, "", false,
                                     weap, weap, ItemSlot.None, ItemSlot.None, ItemSlot.None, 100, 200, ItemDamageType.Physical, 3.8f, "Death Knight");

            m_char = new Character();
            string szXML = System.IO.File.ReadAllText("..\\..\\..\\..\\Rawr\\Rawr.UnitTests\\testdata\\~Test_Rawr4_Blood2h.xml");

            m_char = Character.LoadFromXml(szXML);
            if (m_char.Class == CharacterClass.Druid)
            {
                // This means it didn't load properly.
                m_char.Class = CharacterClass.DeathKnight;
                // So a weapon, so we have values in weapon specific abilities.
                m_char.MainHand = new ItemInstance(weapon, 0, null, null, null, new Enchant(), new Reforging(), new Tinkering());
                // Some talents.
                // Blood Talents.
                m_char.DeathKnightTalents = new DeathKnightTalents("03322203130022011321000000000000000000000000000000000000000.00000000000000000000000000000");
            }
            m_char.CurrentModel = "TankDK";
            if (m_char.BossOptions == null || m_char.BossOptions.Attacks.Count <= 0)
            {
                BossList    list     = new BossList();
                BossHandler testboss = new BossHandler();
                testboss = list.GetBossFromName("Pit Lord Argaloth");

                m_char.BossOptions = new BossOptions();
                m_char.BossOptions.CloneThis(testboss);
            }
        }
Beispiel #4
0
        public static bool IsBoss(this GameObject unit)
        {
            if (unit == null || !unit.IsValid)
            {
                return(false);
            }

            return(BossList.Contains(unit.NpcId));
        }
Beispiel #5
0
 private void RemoveBoss(Player player)
 {
     if (!BossList.ContainsKey(player.Id))
     {
         return;
     }
     BossList.Remove(player.Id);
     PrintToChat(GetMessage("Boss removed"));
     CheckAllBossesAreGone();
 }
 public CalculationOptionsPanelEnhance()
 {
     InitializeComponent();
     if (bosslist == null)
     {
         bosslist = new BossList();
     }
     comboBoxBoss.Items.AddRange(bosslist.GetBetterBossNamesAsArray());
     comboBoxCalculationToGraph.Items.AddRange(Graph.GetCalculationNames());
 }
Beispiel #7
0
        private void List(Player player)
        {
            if (!BossList.Any())
            {
                player.SendError(GetMessage("No bosses", player));
                return;
            }

            player.SendMessage(GetMessage("Bosslist title", player));
            BossList.Foreach(b => player.SendMessage(GetMessage("Bosslist player", player), b.Value));
        }
Beispiel #8
0
 private void OnPlayerDisconnected(Player player)
 {
     if (player == null)
     {
         return;
     }
     if (!BossList.ContainsKey(player.Id))
     {
         return;
     }
     BossList.Remove(player.Id);
     PrintToChat(GetMessage("Boss left"));
     CheckAllBossesAreGone();
 }
Beispiel #9
0
        private void RemoveAll(Player player)
        {
            if (!CheckPermission(player, "RaidBoss.Modify"))
            {
                return;
            }
            if (!BossList.Any())
            {
                player.SendError(GetMessage("No bosses", player));
                return;
            }

            BossList.Clear();
            PrintToChat(GetMessage("All bosses gone"));
        }
Beispiel #10
0
        static StaticData()
        {
            _getBoss         = BossList.ToDictionary(t => t.Item1, t => t.Item2);
            _getBossName     = BossList.ToDictionary(t => t.Item1, t => t.Item3);
            _getBossFromType = BossList.ToDictionary(t => t.Item2, t => t.Item3);

            _getMap         = MapList.Select(t => t.Item1).ToArray();
            _getMapName     = MapList.Select(t => t.Item2).ToArray();
            _getMapFromType = MapList.ToDictionary(t => t.Item1, t => t.Item2);

            _getMusic         = MusicList.Select(t => t.Item1).ToArray();
            _getMusicName     = MusicList.Select(t => t.Item2).ToArray();
            _getMusicFromType = MusicList.ToDictionary(t => t.Item1, t => t.Item2);

            _isBossMusic = Enumerable.Range(0, _getMusic.Length).Select(i => BossMusics.Contains(_getMusic[i])).ToArray();
        }
Beispiel #11
0
        private Boss GetBoss(string target)
        {
            Boss  boss;
            ulong id;

            if (ulong.TryParse(target, out id))
            {
                if (BossList.TryGetValue(id, out boss))
                {
                    return(boss);
                }
            }
            var player = Server.GetPlayerByName(target);

            if (player == null)
            {
                return(null);
            }
            return(BossList.TryGetValue(player.Id, out boss) ? boss : null);
        }
Beispiel #12
0
 private Questionnaire()
 {
     Questions = new QuestionList();
     Bosses = new BossList();
     Branches = new BranchList();
 }
Beispiel #13
0
        /// <summary>
        /// Occurs when the server sends data.
        /// </summary>
        void NetHooks_SendData(Hooks.SendDataEventArgs e)
        {
            if (e.MsgID == PacketTypes.NpcStrike)
            {
                NPC npc = Main.npc[e.number];

                if (npc != null)
                {
                    if (npc.boss)
                    {
                        if (npc.life <= 0)
                        {
                            for (int i = BossList.Count - 1; i >= 0; i--)
                            {
                                if (BossList[i].Npc == null)
                                {
                                    BossList.RemoveAt(i);
                                }
                                else if (BossList[i].Npc == npc)
                                {
                                    var rewardDict = BossList[i].GetRecalculatedReward();

                                    foreach (KeyValuePair <int, long> reward in rewardDict)
                                    {
                                        if (PlayerList[reward.Key] != null)
                                        {
                                            SEconomy.Economy.EconomyPlayer ePlayer = SEconomyPlugin.GetEconomyPlayerSafe(reward.Key);
                                            if (ePlayer != null)
                                            {
                                                //Pay from the world account to the reward recipient.
                                                Journal.BankAccountTransferOptions options = Journal.BankAccountTransferOptions.None;

                                                if (Config.AnnounceBossGain)
                                                {
                                                    options |= Journal.BankAccountTransferOptions.AnnounceToReceiver;
                                                }

                                                SEconomyPlugin.WorldAccount.TransferTo(ePlayer.BankAccount, reward.Value, options);
                                            }
                                        }
                                    }
                                    BossList.RemoveAt(i);
                                }
                                else if (!BossList[i].Npc.active)
                                {
                                    BossList.RemoveAt(i);
                                }
                            }

                            if (e.ignoreClient >= 0)
                            {
                                var player = PlayerList[e.ignoreClient];
                                if (player != null)
                                {
                                    player.AddKill(npc.netID);
                                }
                            }
                        }
                        else if (e.ignoreClient >= 0)
                        {
                            var bossnpc = BossList.Find(n => n.Npc == npc);
                            if (bossnpc != null)
                            {
                                bossnpc.AddDamage(e.ignoreClient, (int)e.number2);
                            }
                            else
                            {
                                BossNPC newBoss = new BossNPC(npc);
                                newBoss.AddDamage(e.ignoreClient, (int)e.number2);
                                BossList.Add(newBoss);
                            }
                        }
                    }
                    else if (npc.life <= 0 && e.ignoreClient >= 0)
                    {
                        var player = PlayerList[e.ignoreClient];
                        if (player != null)
                        {
                            if (npc.value > 0)
                            {
                                float Mod = 1;
                                if (player.TSPlayer.TPlayer.buffType.Contains(13))   // battle potion
                                {
                                    Mod *= Config.BattlePotionModifier;
                                }
                                if (Config.OptionalMobModifier.ContainsKey(npc.netID))
                                {
                                    Mod *= Config.OptionalMobModifier[npc.netID]; // apply custom modifiers
                                }


                                int minVal    = (int)((npc.value - (npc.value * 0.1)) * Mod);
                                int maxVal    = (int)((npc.value + (npc.value * 0.1)) * Mod);
                                int rewardAmt = _r.Next(minVal, maxVal);

                                int i = player.TSPlayer.Index;

                                SEconomy.Economy.EconomyPlayer     epl     = SEconomyPlugin.GetEconomyPlayerSafe(i);
                                Journal.BankAccountTransferOptions options = Journal.BankAccountTransferOptions.None;

                                if (Config.AnnounceKillGain)
                                {
                                    options |= Journal.BankAccountTransferOptions.AnnounceToReceiver;
                                }

                                SEconomyPlugin.WorldAccount.TransferTo(i, rewardAmt, options);
                            }
                            player.AddKill(npc.netID);
                        }
                    }
                }
            }
            else if (e.MsgID == PacketTypes.PlayerKillMe)
            {
                //Console.WriteLine("(SendData) PlayerKillMe -> 1:{0} 2:{4} 3:{5} 4:{6} 5:{1} remote:{2} ignore:{3}", e.number, e.number5, e.remoteClient, e.ignoreClient, e.number2, e.number3, e.number4);
                // 1-playerID, 2-direction, 3-dmg, 4-PVP
                var deadPlayer = PlayerList[e.number];
                Economy.EconomyPlayer eDeadPlayer = SEconomyPlugin.GetEconomyPlayerSafe(e.number);

                if (deadPlayer != null)
                {
                    long penaltyAmmount = 0;

                    if (Config.StaticDeathPenalty)
                    {
                        penaltyAmmount = _r.Next(Config.DeathPenaltyMin, Config.DeathPenaltyMax);
                    }
                    else if (eDeadPlayer.BankAccount != null)
                    {
                        penaltyAmmount = (long)(eDeadPlayer.BankAccount.Balance * (Config.DeathPenaltyPercent / 100f));
                    }

                    //   Console.WriteLine("penalty ammount: {0}", penaltyAmmount);
                    if (e.number4 == 1)
                    {
                        if (!deadPlayer.TSPlayer.Group.HasPermission("vault.bypass.death") /* && deadPlayer.ChangeMoney(-penaltyAmmount, MoneyEventFlags.PvP, true) */ && Config.PvPWinnerTakesLoosersPenalty && deadPlayer.LastPVPID != -1)
                        {
                            var killer = PlayerList[deadPlayer.LastPVPID];
                            Economy.EconomyPlayer eKiller = SEconomyPlugin.GetEconomyPlayerSafe(deadPlayer.LastPVPID);

                            if (eKiller != null && eKiller.BankAccount != null)
                            {
                                Journal.BankAccountTransferOptions options = Journal.BankAccountTransferOptions.MoneyFromPvP | Journal.BankAccountTransferOptions.AnnounceToReceiver | Journal.BankAccountTransferOptions.AnnounceToSender;

                                //  killer.ChangeMoney(penaltyAmmount, MoneyEventFlags.PvP, true);

                                //Here in PVP the loser pays the winner money out of their account.
                                eDeadPlayer.BankAccount.TransferTo(deadPlayer.LastPVPID, penaltyAmmount, options);
                            }
                        }
                    }
                    else if (!deadPlayer.TSPlayer.Group.HasPermission("vault.bypass.death"))
                    {
                        Journal.BankAccountTransferOptions options = Journal.BankAccountTransferOptions.MoneyFromPvP | Journal.BankAccountTransferOptions.AnnounceToReceiver | Journal.BankAccountTransferOptions.AnnounceToSender;

                        // deadPlayer.ChangeMoney(-penaltyAmmount, MoneyEventFlags.Death, true);

                        SEconomyPlugin.WorldAccount.TransferTo(deadPlayer.Index, -penaltyAmmount, options);
                    }
                }
            }
            else if (e.MsgID == PacketTypes.PlayerDamage)
            {
                // Console.WriteLine("(SendData) PlayerDamage -> 1:{0} 2:{4} 3:{5} 4:{6} 5:{1} remote:{2} ignore:{3}", e.number, e.number5, e.remoteClient, e.ignoreClient, e.number2, e.number3, e.number4);
                // 1: pID, ignore: Who, 2: dir, 3:dmg, 4:pvp;
                if (e.number4 == 1)   // if PvP {
                {
                    var player = PlayerList[e.number];

                    if (player != null)
                    {
                        player.LastPVPID = e.ignoreClient;
                    }
                }
            }
        }
Beispiel #14
0
        public BossPicker()
        {
            isLoading = true;
            try {
                InitializeComponent();
                //TheScroll.SetIsMouseWheelScrollingEnabled(true);

                // Create our local Boss List
                if (bosslist == null)
                {
                    bosslist = new BossList();
                }
                // Populate the Boss List ComboBox
                if (CB_BossList.Items.Count < 1)
                {
                    CB_BossList.Items.Add("Custom");
                }
                if (CB_BossList.Items.Count < 2)
                {
                    foreach (string s in bosslist.GetBetterBossNamesAsArray())
                    {
                        CB_BossList.Items.Add(s);
                    }
                }
                // Set the default Filter Type
                if (CB_BL_FilterType.SelectedIndex == -1)
                {
                    CB_BL_FilterType.SelectedIndex = 0;
                }
                // Set the Default filter to All and Populate the list based upon the Filter Type
                // E.g.- If the type is Content, the Filter List will be { "All", "T7", "T7.5",... }
                // E.g.- If the type is Version, the Filter List will be { "All", "10 Man", "25 man", "25 Man Heroic",... }
                if (CB_BL_Filter.Items.Count < 1)
                {
                    CB_BL_Filter.Items.Add("All");
                }
                if (CB_BL_Filter.SelectedItem == null)
                {
                    CB_BL_Filter.SelectedIndex = 0;
                }
                bosslist.GenCalledList(BossList.FilterType.Content, CB_BL_Filter.SelectedItem as String);
                if (CB_BL_Filter.Items.Count < 2)
                {
                    foreach (string s in bosslist.GetFilterListAsArray((BossList.FilterType)(CB_BL_FilterType.SelectedIndex)))
                    {
                        CB_BL_Filter.Items.Add(s);
                    }
                }

                if (CB_BossList.Items.Count > 0)
                {
                    CB_BossList.Items.Clear();
                }
                CB_BossList.Items.Add("Custom");

                foreach (string s in bosslist.GetBetterBossNamesAsArray())
                {
                    CB_BossList.Items.Add(s);
                }
            } catch (Exception ex) {
                new Base.ErrorBox()
                {
                    Title        = "Error in creating the BossTab Pane",
                    Function     = "BossPicker()",
                    TheException = ex,
                }.Show();
            }
            isLoading = false;
        }
Beispiel #15
0
 private void MakeBoss(Player player)
 {
     BossList.Add(player.Id, new Boss(player, DefaultDamageMultiplier, DefaultDefenseMulitplier, DefaultRewardAmount));
     PrintToChat(GetMessage("Boss added"), player.DisplayName);
 }
Beispiel #16
0
        private void OnEntityDeath(EntityDeathEvent deathEvent)
        {
            #region Null checks
            if (deathEvent == null)
            {
                return;
            }
            if (deathEvent.Entity == null)
            {
                return;
            }
            if (!deathEvent.Entity.IsPlayer)
            {
                return;
            }
            if (deathEvent.KillingDamage == null)
            {
                return;
            }
            if (deathEvent.KillingDamage.DamageSource == null)
            {
                return;
            }
            if (!deathEvent.KillingDamage.DamageSource.IsPlayer)
            {
                return;
            }
            #endregion

            var victim = deathEvent.Entity.Owner;
            var killer = deathEvent.KillingDamage.DamageSource.Owner;

            var boss = GetBoss(victim);
            if (boss == null)
            {
                return;
            }

            BossList.Remove(boss.Id);
            PrintToChat(GetMessage("Boss killed"));
            CheckAllBossesAreGone();

            if (!BossGold)
            {
                return;
            }
            if (victim.Equals(killer))
            {
                return;
            }
            if (boss.GoldReward <= 0)
            {
                return;
            }

            if (!GuildBossGold && victim.GetGuild().Equals(killer.GetGuild()))
            {
                killer.SendError(GetMessage("Guild member kill", killer));
                return;
            }

            if (GrandExchange == null)
            {
                return;
            }

            GrandExchange.Call("GiveGold", killer, boss.GoldReward);
            killer.SendMessage(GetMessage("Gold gained", killer), boss.GoldReward);
        }
Beispiel #17
0
 private void RemoveBoss(Boss boss)
 {
     BossList.Remove(boss.Id);
     PrintToChat(GetMessage("Boss removed"));
     CheckAllBossesAreGone();
 }
Beispiel #18
0
        public BossPicker()
        {
            isLoading = true;
            try {
                InitializeComponent();
                //TheScroll.SetIsMouseWheelScrollingEnabled(true);

                // Create our local Boss List
                if (bosslist == null) { bosslist = new BossList(); }
                // Populate the Boss List ComboBox
                if (CB_BossList.Items.Count < 1) { CB_BossList.Items.Add("Custom"); }
                if (CB_BossList.Items.Count < 2) {
                    foreach (string s in bosslist.GetBetterBossNamesAsArray()) { CB_BossList.Items.Add(s); }
                }
                // Set the default Filter Type
                if (CB_BL_FilterType.SelectedIndex == -1) { CB_BL_FilterType.SelectedIndex = 0; }
                // Set the Default filter to All and Populate the list based upon the Filter Type
                // E.g.- If the type is Content, the Filter List will be { "All", "T7", "T7.5",... }
                // E.g.- If the type is Version, the Filter List will be { "All", "10 Man", "25 man", "25 Man Heroic",... }
                if (CB_BL_Filter.Items.Count < 1) { CB_BL_Filter.Items.Add("All"); }
                if (CB_BL_Filter.SelectedItem == null) { CB_BL_Filter.SelectedIndex = 0; }
                bosslist.GenCalledList(BossList.FilterType.Content, CB_BL_Filter.SelectedItem as String);
                if (CB_BL_Filter.Items.Count < 2) {
                    foreach (string s in bosslist.GetFilterListAsArray((BossList.FilterType)(CB_BL_FilterType.SelectedIndex))) {
                        CB_BL_Filter.Items.Add(s);
                    }
                }

                if (CB_BossList.Items.Count > 0) { CB_BossList.Items.Clear(); }
                CB_BossList.Items.Add("Custom");

                foreach (string s in bosslist.GetBetterBossNamesAsArray()) { CB_BossList.Items.Add(s); }
            } catch (Exception ex) {
                new Base.ErrorBox()
                {
                    Title = "Error in creating the BossTab Pane",
                    Function = "BossPicker()",
                    TheException = ex,
                }.Show();
            }
            isLoading = false;
        }
        private void UpdateGraphBosses(string subgraph)
        {
            SetGraphControl(ComparisonGraph);
            List<ComparisonCalculationBase> bossCalculations = new List<ComparisonCalculationBase>();
#if DEBUG
            DateTime start;
#endif
            BossList bosslist = new BossList();
            List<BossHandler> bosses = new List<BossHandler>();

            string filter = "All";

            // Determine which chart we are looking for. All will have the whole list, specific will just have that content in the list
            if (subgraph == "All (This is Slow to Calc)") {
                filter = "All";
            } else {
                filter = subgraph;
            }
            BossHandler[] calledList = bosslist.GenCalledList(BossList.FilterType.Content, filter);
            if (filter == "All") {
                bosses.Add(bosslist.TheEZModeBoss.Clone());
                bosses.Add(bosslist.TheAvgBoss.Clone());
                bosses.Add(bosslist.TheHardestBoss.Clone());
            } else {
                bosses.Add(bosslist.TheEZModeBoss_Called.Clone());
                bosses.Add(bosslist.TheAvgBoss_Called.Clone());
                bosses.Add(bosslist.TheHardestBoss_Called.Clone());
            }
            foreach (BossHandler bh in calledList) { bosses.Add(bh.Clone()); }
            BossHandler easy = bosses.Find(b => b.Name.Contains("Easy"));

            CGL_Legend.LegendItems = Calculations.SubPointNameColors;
            ComparisonGraph.LegendItems = Calculations.SubPointNameColors;
            ComparisonGraph.Mode = ComparisonGraph.DisplayMode.Subpoints;
#if DEBUG
            System.Diagnostics.Debug.WriteLine("Starting Boss Comparison Calculations");
            start = DateTime.Now;
#endif
            foreach (BossHandler bh in bosses)
            {
                bossCalculations.Add(Calculations.GetBossCalculations(bh, easy, Character, Calculations.GetCharacterCalculations(Character)));
            }
            ComparisonGraph.DisplayCalcs(_bossCalculations = bossCalculations.ToArray());
#if DEBUG
            System.Diagnostics.Debug.WriteLine("Finished Boss Comparison Calculations: Total " + DateTime.Now.Subtract(start).TotalMilliseconds.ToString() + "ms");
#endif
        }
Beispiel #20
0
        private Boss GetBoss(Player target)
        {
            Boss boss;

            return(BossList.TryGetValue(target.Id, out boss) ? boss : null);
        }