using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Holo.Source.Plugins
{
public class chatTrigger
{
///
/// A System.String array with words that invoke this trigger.
///
private string[] Words;
///
/// A System.String array with replies that are used when this trigger is invoked.
///
private string[] Replies;
///
/// A System.String array with replies that are used when the bot hands over the food/drink item for this trigger.
///
private string[] serveReplies;
///
/// The item (food/drink) that will be served when one of this trigger's words match a given word.
///
internal string serveItem;
internal chatTrigger(string[] Words, string[] Replies, string[] serveReplies, string serveItem)
{
this.Words = Words;
this.Replies = Replies;
this.serveReplies = serveReplies;
this.serveItem = serveItem;
}
///
/// Returns a boolean that indicates if this trigger replies on a certain word.
///
/// The word to check.
internal bool containsWord(string Word)
{
if (Word.Substring(Word.Length - 1, 1) == "?")
Word = Word.Substring(0, Word.Length - 1);
for (int i = 0; i < Words.Length; i++)
if (Words[i] == Word)
return true;
return false;
}
///
/// Returns a random reply from the replies array.
///
internal string Reply
{
get
{
return Replies[new Random(DateTime.Now.Millisecond).Next(0, Replies.Length)];
}
}
///
/// Returns a random 'hand over item, here you are' reply from the replies array.
///
internal string serveReply
{
get
{
return serveReplies[new Random(DateTime.Now.Millisecond).Next(0, serveReplies.Length)];
}
}
}
}