本文整理汇总了C#中SteamBot.Bot类的典型用法代码示例。如果您正苦于以下问题:C# Bot类的具体用法?C# Bot怎么用?C# Bot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bot类属于SteamBot命名空间,在下文中一共展示了Bot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReceivingUserHandler
// Todo: move the item-check after a failed trade to a separate method to clean up handler.
public ReceivingUserHandler(Bot bot, SteamID sid, Configuration config)
: base(bot, sid, config)
{
Success = false;
mySteamID = Bot.SteamUser.SteamID;
ReceivingSID = mySteamID;
}
开发者ID:narugo,项目名称:SteamBot-Idle,代码行数:8,代码来源:ReceivingUserHandler.cs
示例2: ChatTab
public ChatTab(Chat chat, Bot bot, ulong sid)
{
InitializeComponent();
this.Chat = chat;
this.sid = sid;
this.bot = bot;
this.steam_name.Text = bot.SteamFriends.GetFriendPersonaName(sid);
this.steam_status.Text = bot.SteamFriends.GetFriendPersonaState(sid).ToString();
this.chat_status.Text = "";
SteamKit2.SteamID SteamID = sid;
byte[] avatarHash = bot.SteamFriends.GetFriendAvatar(SteamID);
bool validHash = avatarHash != null && !IsZeros(avatarHash);
if ((AvatarHash == null && !validHash && avatarBox.Image != null) || (AvatarHash != null && AvatarHash.SequenceEqual(avatarHash)))
{
// avatar is already up to date, no operations necessary
}
else if (validHash)
{
AvatarHash = avatarHash;
CDNCache.DownloadAvatar(SteamID, avatarHash, AvatarDownloaded);
}
else
{
AvatarHash = null;
avatarBox.Image = ComposeAvatar(null);
}
}
开发者ID:Jamyn,项目名称:Mist,代码行数:28,代码来源:ChatTab.cs
示例3: ShowBackpack
public ShowBackpack(Bot bot, SteamID SID)
{
InitializeComponent();
this.bot = bot;
this.SID = SID;
this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
}
开发者ID:Jamyn,项目名称:Mist,代码行数:7,代码来源:ShowBackpack.cs
示例4: Trade
public Trade(SteamID me, SteamID other, string sessionId, string token, string apiKey, Bot bot)
{
MeSID = me;
OtherSID = other;
this.sessionId = sessionId;
steamLogin = token;
this.apiKey = apiKey;
this.bot = bot;
// Moved here because when Poll is called below, these are
// set to zero, which closes the trade immediately.
MaximumTradeTime = bot.MaximumTradeTime;
MaximumActionGap = bot.MaximiumActionGap;
baseTradeURL = String.Format (SteamTradeUrl, OtherSID.ConvertToUInt64 ());
// try to poll for the first time
try
{
Poll ();
}
catch (Exception)
{
bot.log.Error ("[TRADE] Failed To Connect to Steam!");
if (OnError != null)
OnError("There was a problem connecting to Steam Trading.");
}
FetchInventories ();
}
开发者ID:remco138,项目名称:SteamBot,代码行数:32,代码来源:Trade.cs
示例5: BotMode
// This mode is to run a single Bot until it's terminated.
private static void BotMode(int botIndex)
{
if (!File.Exists("settings.json"))
{
Console.WriteLine("No settings.json file found.");
return;
}
Configuration configObject;
try
{
configObject = Configuration.LoadConfiguration("settings.json");
}
catch (Newtonsoft.Json.JsonReaderException)
{
// handle basic json formatting screwups
Console.WriteLine("settings.json file is corrupt or improperly formatted.");
return;
}
if (botIndex >= configObject.Bots.Length)
{
Console.WriteLine("Invalid bot index.");
return;
}
Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true);
Console.Title = "Bot Manager";
b.StartBot();
string AuthSet = "auth";
string ExecCommand = "exec";
// this loop is needed to keep the botmode console alive.
// instead of just sleeping, this loop will handle console input
while (true)
{
string inputText = Console.ReadLine();
if (String.IsNullOrEmpty(inputText))
continue;
// Small parse for console input
var c = inputText.Trim();
var cs = c.Split(' ');
if (cs.Length > 1)
{
if (cs[0].Equals(AuthSet, StringComparison.CurrentCultureIgnoreCase))
{
b.AuthCode = cs[1].Trim();
}
else if (cs[0].Equals(ExecCommand, StringComparison.CurrentCultureIgnoreCase))
{
b.HandleBotCommand(c.Remove(0, cs[0].Length + 1));
}
}
}
}
开发者ID:angrychisel,项目名称:SteamBot,代码行数:61,代码来源:Program.cs
示例6: ShowBackpack
public ShowBackpack(Bot bot, SteamID SID)
{
InitializeComponent();
this.bot = bot;
this.SID = SID;
this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
Util.LoadTheme(metroStyleManager1);
}
开发者ID:notafraid90,项目名称:Mist,代码行数:8,代码来源:ShowBackpack.cs
示例7: Log
public Log(string logFile, Bot bot=null, LogLevel output=LogLevel.Success)
{
_FileStream = File.AppendText (logFile);
_FileStream.AutoFlush = true;
_Bot = bot;
OutputToConsole = output;
Console.ForegroundColor = DefaultConsoleColor;
}
开发者ID:iamnilay3,项目名称:SteamBot,代码行数:8,代码来源:Log.cs
示例8: GivingUserHandler
public GivingUserHandler(Bot bot, SteamID sid, Configuration config)
: base(bot, sid, config)
{
Success = false;
//Just makes referencing the bot's own SID easier.
mySteamID = Bot.SteamUser.SteamID;
}
开发者ID:narugo,项目名称:SteamBot-Idle,代码行数:8,代码来源:GivingUserHandler.cs
示例9: SteamEPHandler
public SteamEPHandler(Bot bot, SteamID sid)
: base(bot, sid)
{
messageResponses.Add ("hey", "Hello!|Howdy!|Oi!|Hey!|Hai!");
messageResponses.Add ("hello", "Hello!|Howdy!|Oi!|Hey!|Hai!");
messageResponses.Add ("help", "To use me, just send me a trade request and insert the items you want to give me!");
messageResponses.Add ("!help", "To use me, just send me a trade request and insert the items you want to give me!");
messageResponses.Add ("/help", "To use me, just send me a trade request and insert the items you want to give me!");
}
开发者ID:Elinea,项目名称:SteamBot,代码行数:9,代码来源:SteamEPHandler.cs
示例10: ShowBackpack
public ShowBackpack(Bot bot, SteamID SID)
{
InitializeComponent();
this.bot = bot;
this.SID = SID;
this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
Util.LoadTheme(this, this.Controls);
this.Width = 1012;
}
开发者ID:The-Mad-Pirate,项目名称:Mist,代码行数:9,代码来源:ShowBackpack.cs
示例11: UserHandlerCreator
/// <summary>
/// A method to return an instance of the <c>bot.BotControlClass</c>.
/// </summary>
/// <param name="bot">The bot.</param>
/// <param name="sid">The steamId.</param>
/// <returns>A <see cref="UserHandler"/> instance.</returns>
/// <exception cref="ArgumentException">Thrown if the control class type does not exist.</exception>
public static UserHandler UserHandlerCreator(Bot bot, SteamID sid)
{
Type controlClass = Type.GetType(bot.BotControlClass);
if (controlClass == null)
throw new ArgumentException("Configured control class type was null. You probably named it wrong in your configuration file.", "bot");
return (UserHandler)Activator.CreateInstance(
controlClass, new object[] { bot, sid });
}
开发者ID:aleksasavic3,项目名称:KeyBot,代码行数:17,代码来源:BotManager.cs
示例12: UserHandler
public UserHandler (Bot bot, SteamID sid)
{
Bot = bot;
OtherSID = sid;
MySID = bot.SteamUser.SteamID;
if (MySID != OtherSID)
{
MyInventory = new GenericInventory(MySID, MySID);
OtherInventory = new GenericInventory(OtherSID, MySID);
}
}
开发者ID:ElPresidentePro,项目名称:CSGOShop-Steambot,代码行数:11,代码来源:UserHandler.cs
示例13: ShowTrade
public ShowTrade(Bot bot, string name)
{
InitializeComponent();
Util.LoadTheme(metroStyleManager1);
this.Text = "Trading with " + name;
this.bot = bot;
this.sid = bot.CurrentTrade.OtherSID;
this.username = name;
this.label_yourvalue.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.label_othervalue.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
column_otherofferings.Text = name + "'s Offerings:";
ListInventory.ShowTrade = this;
Thread checkExpired = new Thread(() =>
{
while (true)
{
if (bot.CurrentTrade == null)
{
bot.main.Invoke((Action)(this.Close));
bot.log.Warn("Trade expired.");
if (Friends.chat_opened)
{
bot.main.Invoke((Action)(() =>
{
foreach (TabPage tab in Friends.chat.ChatTabControl.TabPages)
{
if (tab.Text == bot.SteamFriends.GetFriendPersonaName(sid))
{
tab.Invoke((Action)(() =>
{
foreach (var item in tab.Controls)
{
Friends.chat.chatTab = (ChatTab)item;
}
string result = "The trade session has closed.";
bot.log.Warn(result);
string date = "[" + DateTime.Now + "] ";
Friends.chat.chatTab.UpdateChat("[" + DateTime.Now + "] " + result + "\r\n", false);
ChatTab.AppendLog(sid, "===========[TRADE ENDED]===========\r\n");
}));
break; ;
}
}
}));
}
break;
}
}
});
checkExpired.Start();
}
开发者ID:notafraid90,项目名称:Mist,代码行数:52,代码来源:ShowTrade.cs
示例14: ChatTab
public ChatTab(Chat chat, Bot bot, ulong sid)
{
InitializeComponent();
this.Chat = chat;
this.userSteamId = sid;
this.bot = bot;
this.StyleManager.OnThemeChanged += metroStyleManager1_OnThemeChanged;
this.StyleManager.Theme = Friends.GlobalStyleManager.Theme;
this.StyleManager.Style = Friends.GlobalStyleManager.Style;
Util.LoadTheme(null, this.Controls, this);
this.Theme = Friends.GlobalStyleManager.Theme;
this.StyleManager.Style = Friends.GlobalStyleManager.Style;
metroStyleManager1_OnThemeChanged(null, EventArgs.Empty);
try
{
this.steam_name.Text = prevName = bot.SteamFriends.GetFriendPersonaName(sid);
this.steam_status.Text = prevStatus = bot.SteamFriends.GetFriendPersonaState(sid).ToString();
}
catch
{
}
this.chat_status.Text = "";
SteamKit2.SteamID SteamID = sid;
try
{
byte[] avatarHash = bot.SteamFriends.GetFriendAvatar(SteamID);
bool validHash = avatarHash != null && !IsZeros(avatarHash);
if ((AvatarHash == null && !validHash && avatarBox.Image != null) || (AvatarHash != null && AvatarHash.SequenceEqual(avatarHash)))
{
// avatar is already up to date, no operations necessary
}
else if (validHash)
{
AvatarHash = avatarHash;
CDNCache.DownloadAvatar(SteamID, avatarHash, AvatarDownloaded);
}
else
{
AvatarHash = null;
avatarBox.Image = ComposeAvatar(null);
}
}
catch
{
}
new System.Threading.Thread(GetChatLog).Start();
status_update.RunWorkerAsync();
text_input.Focus();
}
开发者ID:The-Mad-Pirate,项目名称:Mist,代码行数:52,代码来源:ChatTab.cs
示例15: assignRequest
public static void assignRequest(Bot bot)
{
new Thread(() =>
{
while (true)
{
if (getItem().User!=null)
{
bot.DoRequest(getItem());
break;
}
Thread.Sleep(5000);
}
}).Start();
}
开发者ID:norgalyn,项目名称:SteamBot,代码行数:15,代码来源:MySQL.cs
示例16: CraftItems
public static void CraftItems(Bot bot, short recipe, params ulong[] items)
{
if (bot.CurrentGame != 440)
throw new Exception("SteamBot is not ingame with AppID 440; current AppID is " + bot.CurrentGame);
var craftMsg = new ClientGCMsg<MsgCraft>();
craftMsg.Body.NumItems = (short)items.Length;
craftMsg.Body.Recipe = recipe;
foreach (ulong id in items)
craftMsg.Write(id);
bot.SteamGameCoordinator.Send(craftMsg, 440);
}
开发者ID:holychipmunk,项目名称:SteamBot,代码行数:15,代码来源:Crafting.cs
示例17: ShowTrade
public ShowTrade(Bot bot, string name)
{
InitializeComponent();
this.Text = "Trading with " + name;
this.bot = bot;
this.sid = bot.CurrentTrade.OtherSID;
this.username = name;
column_otherofferings.Text = name + "'s Offerings:";
ListInventory.ShowTrade = this;
Thread checkExpired = new Thread(() =>
{
while (true)
{
if (bot.CurrentTrade == null)
{
bot.main.Invoke((Action)(this.Dispose));
bot.log.Warn("Trade expired.");
if (Friends.chat_opened)
{
bot.main.Invoke((Action)(() =>
{
foreach (TabPage tab in Friends.chat.ChatTabControl.TabPages)
{
if (tab.Text == bot.SteamFriends.GetFriendPersonaName(sid))
{
tab.Invoke((Action)(() =>
{
foreach (var item in tab.Controls)
{
Friends.chat.chatTab = (ChatTab)item;
}
string result = "The trade session has closed.";
bot.log.Warn(result);
Friends.chat.chatTab.UpdateChat("[" + DateTime.Now + "] " + result + "\r\n");
}));
break; ;
}
}
}));
}
break;
}
}
});
checkExpired.Start();
}
开发者ID:Jamyn,项目名称:Mist,代码行数:47,代码来源:ShowTrade.cs
示例18: AddBan
/// <summary>
/// <para>Add ban for user</para>
/// <para></para>
/// <para>Example : ban.Addban(Bot, OtherSID, true); -> Add ban to user + block user's Steam profile</para>
/// <para>Example : ban.Addban(Bot, OtherSID, false); -> Add ban to user ONLY</para>
/// </summary>
/// <returns><c>true</c>, if ban was added, <c>false</c> otherwise.</returns>
/// <param name="bot">Bot.</param>
/// <param name="steam64">Steam64.</param>
/// <param name="banProfile">If set to <c>true</c> ban user Steam's profile.</param>
public bool AddBan(Bot bot, ulong steam64, bool banProfile)
{
if (FileExist()) {
if (!IsBanned(steam64)) { // if does not exist in ban list
XDocument doc = XDocument.Load(fileName);
XElement service = doc.Element("bannedIDs");
service.Add(new XElement ("steamID", steam64.ToString()));
if (banProfile) {
bot.SteamFriends.IgnoreFriend(steam64, true);
}
WriteLog(TAG + "[AddBan] : Successful - " + steam64.ToString());
doc.Save(fileName);
}
} else {
AddBan(bot, steam64, banProfile);
}
return true;
}
开发者ID:aleksasavic3,项目名称:SteamBotBanList,代码行数:28,代码来源:FriendsBanList.cs
示例19: BackpackExpander
public BackpackExpander(Bot bot, SteamKit2.SteamID id)
: base(bot, id)
{
this.steamID = this.Bot.SteamClient.SteamID;
lock (BackpackExpander.lockingVar)
{
if (BackpackExpander.groupManager == null)
BackpackExpander.groupManager = new GroupManager(this.Bot.apiKey);
// Add the bot to its group
// TODO: use a different data structure to enable a sorted list
BackpackExpander.groupManager.AddMember(this.steamID, this.groupID);
}
// Wait for own group to be complete, so we really add all group members to friends
//while (!BackpackExpander.groupManager.GroupComplete(this.groupID)) ;
// Add all group members to friendslist (also accepts pending invites of group members)
AddGroupFriends();
}
开发者ID:KloolK,项目名称:SteamBot,代码行数:21,代码来源:BackpackExpander.cs
示例20: UserHandler
public UserHandler(Bot bot, SteamID sid, Configuration config)
{
Bot = bot;
OtherSID = sid;
if (Settings == null)
{
BotMode = config.BotMode;
NumberOfBots = config.TotalBots;
AutoCraftWeps = config.Options.AutoCraftWeapons;
ManageCrates = config.Options.ManageCrates;
DeleteCrates = config.Options.DeleteCrates;
TransferCrates = config.Options.TransferCrates;
ExcludedCrates = config.Options.SavedCrates;
CrateUHIsRunning = config.HasCrateUHLoaded;
MainUHIsRunning = config.HasMainUHLoaded;
Settings = config;
}
}
开发者ID:narugo,项目名称:SteamBot-Idle,代码行数:21,代码来源:UserHandler.cs
注:本文中的SteamBot.Bot类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论