private void StatusTimer_Tick(object sender, EventArgs e) { BattleList bl = client.GetBattlelist(); uint localPlayerHP = client.LocalPlayer.HealthPoints; uint localPlayerMana = client.LocalPlayer.ManaPoints; uint localPlayerSoul = client.LocalPlayer.SoulPoints; uint localPlayerCAP = client.LocalPlayer.Capacity; #region Status Sound if (StatusPlaySound.Checked) { if (RunStatus == true) { new SoundPlayer(STSound).Play(); LogTextDetails = String.Format("Alarm was activated by: Low {0:X}", statusText); logs.SaveLog(DateTime.Now, "Alarm", LogTextDetails); client.SetStatusText("Alarm was activated by: Low " + statusText); } statusText = ""; RunStatus = false; if (localPlayerHP < StatusHitPoints.Value) { RunStatus = true; statusText = statusText + " HitPoints"; } if (localPlayerMana < StatusManaPoints.Value) { RunStatus = true; statusText = statusText + ", ManaPoints"; } if (localPlayerSoul < StatusSoulPoints.Value) { RunStatus = true; statusText = statusText + ", SoulPoints"; } if (localPlayerCAP / 100 + 1 < StatusCapacity.Value) { RunStatus = true; statusText = statusText + ", Capacity"; } } #endregion }
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 }