Beispiel #1
0
        private void BattlelistTimer_Execute(object sender, EventArgs e)
        {
            BattleList bl            = client.GetBattlelist();
            uint       localPlayerID = client.LocalPlayer.ID;

            Tibia.Location localPlayerLoc = client.LocalPlayer.Location;
            bl.Reset();

            #region Battle List Sounds
            do
            {
                if (!bl.OnScreen || bl.ID == localPlayerID)
                {
                    continue;
                }

                Tibia.Location entityLoc = bl.Location;

                bool isIgnore = false;
                foreach (var listBoxItem in BattlelistIgnoredPlayers.Items)
                {
                    if (bl.Name.ToLower().Contains(listBoxItem.ToString()))
                    {
                        isIgnore = true;
                        break;
                    }
                    else
                    {
                        isIgnore = false;
                    }
                }

                if (isIgnore == true)
                {
                    continue;
                }

                if (!BattlelistActivateIfPlayer.Checked && bl.IsPlayer)
                {
                    continue;
                }

                if (!BattlelistActivateIfMonsterNPC.Checked && bl.IsMonster)
                {
                    continue;
                }

                // Verify relative entity floor
                if ((entityLoc.IsHigherThan(localPlayerLoc) && !BattlelistMultiFloorAbove.Checked) ||
                    (entityLoc.IsLowerThan(localPlayerLoc) && !BattlelistMultiFloorBelow.Checked) ||
                    ((BattlelistMultiFloorAbove.Checked || BattlelistMultiFloorBelow.Checked) &&
                     Math.Abs((int)localPlayerLoc.Z - (int)entityLoc.Z) > BattlelistMultiFloorRange.Value))
                {
                    continue;
                }



                if (!BattlelistMultiFloorAbove.Checked &&
                    !BattlelistMultiFloorBelow.Checked &&
                    entityLoc.Z != localPlayerLoc.Z)
                {
                    continue;
                }

                if (BattlelistActivateIfPlayer.Checked && bl.IsPlayer)
                {
                    //MessageBox.Show("Player " + bl.Name);
                }
                else if (BattlelistActivateIfMonsterNPC.Checked && bl.IsMonster)
                {
                    //MessageBox.Show("Monster " + bl.Name + " " + entityLoc.Z);
                }


                if (BattlelistPlaySound.Checked)
                {
                    new SoundPlayer(BLSound).Play();
                    LogTextDetails = String.Format("ID: {0:X}     Name: {1}     Location: {2}     ", bl.ID, bl.Name, bl.Location);
                    logs.SaveLog(DateTime.Now, "Alarm", LogTextDetails);
                    client.SetStatusText("Alarm was activated by: " + bl.Name.ToString());
                }
                break;
            } while (bl.Next());
            #endregion
        }