* This patch reduces the excessive number of threads opened by the Timer event. Also simplifies the walking around method.
From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>GenericGridServerConcept
parent
57ab79e331
commit
c89a4d9eb6
|
@ -77,10 +77,14 @@ namespace pCampBot
|
||||||
|
|
||||||
void m_action_Elapsed(object sender, ElapsedEventArgs e)
|
void m_action_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
//client.Throttle.Task = 500000f;
|
while(true)
|
||||||
//client.Throttle.Set();
|
{
|
||||||
|
//client.Appearance.ForceRebakeAvatarTextures();
|
||||||
|
//client.Appearance.SetPreviousAppearance();
|
||||||
|
|
||||||
int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number,
|
int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number,
|
||||||
// the greater the bot's chances to walk instead of run.
|
// the greater the bot's chances to walk instead of run.
|
||||||
|
client.Self.Jump(false);
|
||||||
if (walkorrun == 0)
|
if (walkorrun == 0)
|
||||||
{
|
{
|
||||||
client.Self.Movement.AlwaysRun = true;
|
client.Self.Movement.AlwaysRun = true;
|
||||||
|
@ -94,18 +98,25 @@ namespace pCampBot
|
||||||
Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255));
|
Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255));
|
||||||
client.Self.Movement.TurnToward(newpos);
|
client.Self.Movement.TurnToward(newpos);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Why does it need to keep setting it true? Changing to just let it walk =)
|
||||||
for (int i = 0; i < 2000; i++)
|
for (int i = 0; i < 2000; i++)
|
||||||
{
|
{
|
||||||
client.Self.Movement.AtPos = true;
|
client.Self.Movement.AtPos = true;
|
||||||
Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time.
|
Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time.
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
client.Self.Movement.AtPos = true;
|
||||||
|
Thread.Sleep(somthing.Next(3000,13000));
|
||||||
|
client.Self.Movement.AtPos = false;
|
||||||
client.Self.Jump(true);
|
client.Self.Jump(true);
|
||||||
|
|
||||||
string randomf = talkarray[somthing.Next(talkarray.Length)];
|
string randomf = talkarray[somthing.Next(talkarray.Length)];
|
||||||
if (talkarray.Length > 1 && randomf.Length > 1)
|
if (talkarray.Length > 1 && randomf.Length > 1)
|
||||||
client.Self.Chat(randomf, 0, ChatType.Normal);
|
client.Self.Chat(randomf, 0, ChatType.Normal);
|
||||||
|
|
||||||
//Thread.Sleep(somthing.Next(1, 10)); // Apparently its better without it right now.
|
Thread.Sleep(somthing.Next(1000, 10000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -157,6 +168,8 @@ namespace pCampBot
|
||||||
if (OnConnected != null)
|
if (OnConnected != null)
|
||||||
{
|
{
|
||||||
m_action = new Timer(somthing.Next(1000, 10000));
|
m_action = new Timer(somthing.Next(1000, 10000));
|
||||||
|
m_action.Enabled = true;
|
||||||
|
m_action.AutoReset = false;
|
||||||
m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed);
|
m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed);
|
||||||
m_action.Start();
|
m_action.Start();
|
||||||
OnConnected(this, EventType.CONNECTED);
|
OnConnected(this, EventType.CONNECTED);
|
||||||
|
|
Loading…
Reference in New Issue