What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Simple Plugin "looking for ! player"...

AngC

New Member
Joined
Mar 19, 2011
Messages
85
Reaction score
1
Solved. Simple Plugin "looking for ! player"...

*Solved* - it works after starting and stopping the bot - or selecting bot "Do Nothing".

Was:
Where's the bug... only NPCs/items are listed... Imean ObjectManager.ObjectList
It does neither show any player nor selects them...

using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Media;
using System.Threading;

using Styx.Helpers;
using Styx.Logic.Inventory;
using Styx.Plugins.PluginClass;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

namespace QuickPlugins
{
public class PlayerSearcher : HBPlugin
{
private readonly WaitTimer _updateTimer = WaitTimer.TenSeconds;
//new WaitTimer(TimeSpan.FromSeconds(2)); //WaitTimer.OneSecond; // WaitTimer.TenSeconds;
public override void Initialize()
{
{
_updateTimer.Reset();
}
Logging.Write("Starting player search...");
}
// public void Initialize()
public override string ButtonText
{
get
{
return "GO";
}
}

public override bool WantButton
{
get
{
return true;
}
}

public override void OnButtonPress()
{
Logging.Write(" starting search...");
DoSearch();
Logging.Write(" ended search...");
}

private static LocalPlayer Me { get { return ObjectManager.Me; } }

WoWPlayer DoSearch()
{
var target = (from player in ObjectManager.GetObjectsOfType <WoWPlayer>(false, false)
// where player.Name.IndexOf("a") > 0
// where player.IsAlliance == player.IsAlliance // Me.IsAlliance
// where player.Dead == player.Dead && player.IsGhost == player.IsGhost
orderby player.Distance ascending
select player).FirstOrDefault();

// foreach (WoWObject player in ObjectManager.ObjectList)
// {
// if ((int)player.Type != 4 || player.Guid == Me.Guid) continue;
// WoWPlayer newPlayer = player.ToPlayer();
// Logging.Write("Player--: " + newPlayer.Name + " / " + player.Type + " entry:" + player.Entry);
// }

if(target != null)
{
target.Target();
Logging.Write("Player: " + target.Name);
}
return target;
}

public override void Pulse()
{
if (_updateTimer.IsFinished)
{
Logging.Write(" search... timer...");
_updateTimer.Reset();
DoSearch();
}
}

public override string Name { get { return "Player searcher"; } }

public override string Author { get { return "Apoc/Ang"; } }

public override Version Version { get { return new Version(1,0,0,0);} }
}
}
 
Last edited:
so is this solved or are u still having a problem?
<div_prefs id="div_prefs"></div_prefs>
 
Back
Top