// I.method public Animal createAnimal(int animalCode) { Animal newAnimal = null; switch (animalCode) { case 0: newAnimal = new Kangaroo(); break; case 1: newAnimal = new Dingo(); break; case 2: newAnimal = new Crocodile(); break; case 3: newAnimal = new Koala(); break; } return(newAnimal); }
//private Dictionary<ulong, Reply> _memcache; public ReplyManager(Koala bot, Logger logger = null) : base(bot, logger) { ReplyTimeout = TimeSpan.FromDays(1); //_memcache = new Dictionary<ulong, Reply>(16); Bot.Discord.MessageUpdated += HandleCommandsAsync; Bot.Discord.MessageDeleted += HandleMessageDelete; }
public void KoalaLengthInInches() { Koala koala = new Koala(); decimal expected = koala.LengthInInches; decimal input = 30; //Assert Assert.Equal(expected, input); }
public void GetKoalaWeight() { Koala koala = new Koala(); //act int input = 30; int expected = koala.GetWeight(); //assert Assert.Equal(expected, input); }
public void removeTrainee(Koala k) { foreach (object[] ob in trainees) { Koala ko = (Koala)ob[0]; if (ko.Equals(k)) { trainees.Remove(ob); break; } } }
static void Main(string[] args) { Console.WriteLine("Welcome to the Zoo"); //create new animal array Animals[] animals = new Animals[6]; Puffin puffin = new Puffin() { IsInZoo = true, Name = "Puff Diddy" }; ScarletIbis scarletIbis = new ScarletIbis() { IsInZoo = true, Name = "Q-T Pie" }; Seahorse seahorse = new Seahorse() { IsInZoo = true, Name = "Sven" }; Stingray stingray = new Stingray() { IsInZoo = true, Name = "Spotty" }; Koala koala = new Koala() { IsInZoo = true, Name = "George" }; SnowLeopard snowLeopard = new SnowLeopard(); //Animal Array Contains 6 animals //Bird animals[0] = puffin; animals[1] = scarletIbis; // Fish animals[2] = seahorse; animals[3] = stingray; // Mammals animals[4] = koala; animals[5] = snowLeopard; //for loop to display animals foreach (var t in animals) { t.DisplayCard(); } }
public BoostEmojiManager(Koala bot, Logger logger = null) : base(bot, logger) { Discord.GuildMemberRemoved += async(args) => { await DeleteEmojiAsync(args.Member); }; Discord.GuildMemberUpdated += async(args) => { if (!args.Member.PremiumSince.HasValue) { await DeleteEmojiAsync(args.Member); } }; }
public static void removeKoalaJob(Koala k) { bool b = false; object[] o = new object[2]; foreach (object[] ob in koalaToJob) { if (((Koala)ob[0]).Equals(k)) { b = true; o = ob; } } if (b) { koalaToJob.Remove(o); } }
public static void addKoalaJob(TrainingFacility fac, Koala k) { bool b = true; foreach (object[] ob in koalaToJob) { if (((Koala)ob[0]).Equals(k)) { b = false; } } if (b) { object[] ob = new object[2]; ob[0] = k; ob[1] = fac; koalaToJob.Add(ob); } }
public void addTrainee(Koala k, Skill s, int daysToTrain) { bool b = true; foreach (object[] ob in trainees) { Koala ko = (Koala)ob[0]; if (ko.Equals(k)) { b = false; } } if (b) { object[] sl = new object[4]; sl[0] = k; sl[1] = 0; sl[2] = s; sl[3] = daysToTrain; trainees.Add(sl); } }
public void incrementDayTrain() { List <object[]> toRemove = new List <object[]>(); List <object[]> toIncrement = new List <object[]>(); foreach (object[] ob in trainees) { Koala k = (Koala)ob[0]; if (k.isAlive()) { if (((int)ob[1]) + 1 >= (int)ob[3]) { Skill s = (Skill)ob[2]; k.setSkill(s); EventLogger.addLog(((Koala)ob[0]).getName() + " has finished training to be a " + s.ToString()); toRemove.Add(ob); } else { toIncrement.Add(ob); } } else { toRemove.Add(ob); } } foreach (object[] ob in toRemove) { trainees.Remove(ob); } foreach (object[] ob in toIncrement) { trainees.Remove(ob); ob[1] = ((int)ob[1]) + 1; trainees.Add(ob); } }
public PermissionManager(Koala bot, Logger logger = null) : base(bot, logger) { _guildEngines = new Dictionary <ulong, Engine>(); Bot.Discord.GuildAvailable += (args) => { Logger.Log("Loading Guild {0}", args.Guild); var gm = new Engine(new RedisStore(Redis, Namespace.Join(Namespace.RootNamespace, args.Guild.Id.ToString(), "perms"))); _guildEngines[args.Guild.Id] = gm; return(Task.CompletedTask); }; Bot.Discord.GuildUnavailable += (args) => { Logger.Log("Clearing Guild {0}", args.Guild); _guildEngines.Remove(args.Guild.Id); return(Task.CompletedTask); }; /* * Bot.Discord.GuildMemberRemoved += async (args) => * { * Logger.Log("Deleting Member {0}", args.Member); * var manager = GetEngine(args.Guild); * var group = await manager.GetMemberGroupAsync(args.Member); * await group.DeleteAsync(); * }; */ Bot.Discord.GuildRoleDeleted += async(args) => { Logger.Log("Deleting Role {0}", args.Role); var group = await GetRoleGroupAsync(args.Guild, args.Role); await group.DeleteAsync(); }; }
public ReactRoleManager(Koala bot, Logger logger = null) : base(bot, logger) { /* * Discord.MessageDeleted += async (args) => * { * //Remove the reactions that we stored. * await RemoveAllReactionRoleAsync(args.Message); * }; * * Discord.MessagesBulkDeleted += async (args) => * { * //Bulk deletes * foreach (var m in args.Messages) * await RemoveAllReactionRoleAsync(m); * }; * * Discord.MessageReactionAdded += async (args) => * { * //Award the reaction * var r = await GetReactionRoleAsync(args.Message, args.Emoji); * if (r != null) * { * var gm = await args.Channel.Guild.GetMemberAsync(args.User); * await gm.GrantRoleAsync(r, "Reaction Role"); * } * }; * * Discord.MessageReactionRemoved += async (args) => * { * //Remove the role * var r = await GetReactionRoleAsync(args.Message, args.Emoji); * var gm = await args.Channel.Guild.GetMemberAsync(args.User); * await gm.RevokeRoleAsync(r, "Reaction Role"); * }; */ }
public Animal createAnimal(int animalCode) { Animal newAnimal = null; switch (animalCode) { case 0: newAnimal = new Crocodile(); break; case 1: newAnimal = new Koala(); break; case 2: newAnimal = new Kangaroo(); break; case 3: newAnimal = new Kookaburra(); break; case 4: newAnimal = new Funnelweb(); break; } return newAnimal; }
public MessageCounter(Koala bot, double syncTimeMillis) { this.Bot = bot; this.SyncRate = syncTimeMillis; _userTallies = new Dictionary <ulong, GuildTracking>(); _semaphore = new SemaphoreSlim(1, 1); _syncTimer = new System.Timers.Timer(syncTimeMillis) { AutoReset = true }; _syncTimer.Elapsed += async(sender, args) => await SyncChanges(); _syncTimer.Start(); bot.Discord.MessageCreated += async(args) => { if (args.Author.IsBot) { return; } await RecordMessage(args.Message); }; }
public void addEngineer(Koala k) { this.engineers.Add(k); }
public AccountModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-SW-ACC", bot.Logger); }
public void addTrainer(Koala k) { trainers.Add(k); }
public StarwatchModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-SW", bot.Logger); }
public FunModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-FUN", bot.Logger); }
public RoleplayModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-RP", bot.Logger); }
/// <summary> /// Gets the probably reply to this command. /// </summary> /// <param name="koala"></param> /// <returns></returns> public Task <Reply> GetReplyAsync(Koala koala = null) { koala = koala ?? Koala.Bot; return(koala.ReplyManager.GetReplyAsync(GuildId, MessageId)); }
//For time related stuffies, use FixedUpdate void Start() { terrain = GameObject.FindGameObjectWithTag("terrain"); RAND_Day = Random.Range(2, 6); events.Add(Events.DUST_STORM); events.Add(Events.EARTHQUAKE); events.Add(Events.METEOR); events.Add(Events.SOLAR_FLARE); timeScale = PlayerPrefs.GetInt("TimeScale"); Time.timeScale = .1f; DirectoryInfo d = new DirectoryInfo(@Application.dataPath); IFormatter formatter = new BinaryFormatter(); FileInfo[] pdFiles = d.Parent.GetFiles("Assetspd.bin"); foreach (FileInfo f in pdFiles) { Stream stream = new FileStream(f.Name, FileMode.Open, FileAccess.Read, FileShare.Read); pd = (PlayerData)formatter.Deserialize(stream); stream.Close(); days = pd.getDayCount(); years = pd.getYearCount(); minutes = pd.getMinuteCount(); Debug.Log(pd.getFoodSupply()); Debug.Log(pd.getWaterSupply()); } if (pd == null) { pd = new PlayerData(1500, 1500, 1000, 500); FileInfo[] allBinFiles = d.Parent.GetFiles("*.bin"); foreach (FileInfo f in allBinFiles) { f.Delete(); } for (int i = 0; i < 10; i++) { System.Random rnd = new System.Random(); koalas.Add(new Koala(NameDictionary.firstNames[rnd.Next(NameDictionary.firstNames.Length)] + " " + NameDictionary.lastNames[rnd.Next(NameDictionary.lastNames.Length)], 0, rnd.Next(2) + 1, rnd.Next(2) + 1, rnd.Next(2) + 1, Storage.days, Random.Range(1, 3))); } Debug.Log("New game"); } else { FileInfo[] tbFiles = d.Parent.GetFiles("*tb.bin"); foreach (FileInfo f in tbFiles) { Stream stream = new FileStream(f.Name, FileMode.Open, FileAccess.Read, FileShare.Read); Facility fac = (Facility)formatter.Deserialize(stream); Storage.allTB.Add(fac); fac.create(); stream.Close(); Debug.Log(f.Name); } FileInfo[] tfFiles = d.Parent.GetFiles("*tf.bin"); foreach (FileInfo f in tfFiles) { Stream stream = new FileStream(f.Name, FileMode.Open, FileAccess.Read, FileShare.Read); TrainingFacility tf = (TrainingFacility)formatter.Deserialize(stream); tf.create(); allTF.Add(tf); stream.Close(); } FileInfo[] files = d.Parent.GetFiles("*koala.bin"); foreach (FileInfo f in files) { Stream stream = new FileStream(f.Name, FileMode.Open, FileAccess.Read, FileShare.Read); Koala ko = (Koala)formatter.Deserialize(stream); koalas.Add(ko); stream.Close(); } } FileInfo[] fe = d.Parent.GetFiles("*.bin"); foreach (FileInfo f in fe) { f.Delete(); } }
public ModerationModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-MOD", bot.Logger); }
public ReactRoleModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-ROLE", bot.Logger); }
public void removeTrainer(Koala k) { trainers.Remove(k); }
public ConfigurationModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-CONFIG", bot.Logger); }
public WorldModule(Koala bot) { this.Bot = bot; this.Logger = new Logger("CMD-SW-PROC", bot.Logger); }
public void removeKoala(Koala k) { this.koalas.Remove(k); }
public void addKoala(Koala k) { this.koalas.Add(k); }
public Manager(Koala bot, Logger logger = null) { Bot = bot; Logger = logger ?? new Logger(GetType().Name); }