Inheritance: MonoBehaviour
Beispiel #1
0
        public async Task <bool> DeleteDrop(Guid?dropId)
        {
            if (dropId.HasValue)
            {
                var resp = await _dropClient.DeleteDrop(dropId.Value, _deviceService.DeviceId);

                if (resp.IsSuccessStatusCode)
                {
                    //remove drop from cache of all drops
                    var dropToDelete = Drops.FirstOrDefault(x => x.Id == dropId);
                    if (dropToDelete != null)
                    {
                        Drops.Remove(dropToDelete);
                    }

                    //remove drop from cache of own drops
                    dropToDelete = OwnDrops.FirstOrDefault(x => x.Id == dropId);
                    if (dropToDelete != null)
                    {
                        OwnDrops.Remove(dropToDelete);
                    }
                }
                return(resp.IsSuccessStatusCode);
            }
            return(false);
        }
Beispiel #2
0
        public async Task AddingDrops(ulong id, ulong idItem)
        {
            if (!IsHavingThisRole((SocketGuildUser)Context.User, "Developer") &&
                !IsHavingThisRole((SocketGuildUser)Context.User, "Quiz Manager"))
            {
                return;
            }
            Quiz selected = Quizzes.GetQuiz(id);

            if (selected == null)
            {
                await Context.Channel.SendMessageAsync("`NO QUIZ FOUND WITH THAT ID`");

                return;
            }
            if (selected.Drop.Count >= 3)
            {
                await Context.Channel.SendMessageAsync("`CAN'T ADD MORE DROPS`");

                return;
            }
            Item drop = Drops.GetSpecificItem(idItem);

            if (drop == null)
            {
                await Context.Channel.SendMessageAsync("`NO ITEM FOUND WITH THAT ID`");

                return;
            }
            Quizzes.AddingDrops(selected, drop);
            await Context.Channel.SendMessageAsync("`DROP HAS BEEN ADDED`");
        }
Beispiel #3
0
        public async Task GetItem([Remainder] string name)
        {
            List <Item> find = Drops.WordFind(name);

            if (find.Count <= 0)
            {
                await Context.Channel.SendMessageAsync($"`NO ITEM FOUND WITH THAT NAME`");

                return;
            }
            foreach (var select in find)
            {
                string text = "";
                string act  = (select.Active) ? "Active" : "Passive";
                text += $"Item-{select.ID}\nName : {select.Name}\nUsage : {act}\nType : {select.Type}\nRarity : {select.Rarity}\n";
                if (select.Countdown != -1)
                {
                    text += $"Countdown : {select.Countdown}\n";
                }
                foreach (var item in select.Buffs)
                {
                    text += $"Buff : {item.Name}, description : {item.Tech}\n";
                }
                foreach (var item in select.Debuffs)
                {
                    text += $"Debuff : {item.Name}, description : {item.Tech}\n";
                }
                text += $"Description : {select.Description}";
                await Context.Channel.SendMessageAsync($"`{text}`");
            }
        }
Beispiel #4
0
        public void Update(GameTime gameTime)
        {
            // Update drops
            for (int i = Drops.Count - 1; i >= 0; i--)
            {
                Drop drop = Drops[i];

                // Use map to detect collisions
                drop.DetectCollisions(this);

                // Calc dist from drop tp player
                float distToPlayer = Vector2.Distance(drop.Position, Main.Player.Bounds.Center.ToVector2());

                if (distToPlayer < 2 * Tile.Size)
                {
                    // Pick up
                    Drops.Remove(drop);
                    Main.inventory.AddItems(drop.Type, 1);
                }
                else if (distToPlayer < Player.PickupRange * Tile.Size)
                {
                    // Move drop towards player
                    drop.MoveToPlayer(Main.Player);
                }

                // Will move it
                drop.Update(gameTime);
            }
        }
        public override Packet GetInfoPacket(PlayerObject ob)
        {
            return(new S.ObjectMonster
            {
                ObjectID = ObjectID,
                MonsterIndex = MonsterInfo.Index,

                Location = CurrentLocation,

                NameColour = NameColour,
                Direction = Direction,
                Dead = Dead,

                PetOwner = PetOwner?.Name,

                Skeleton = NeedHarvest && Skeleton && (Drops == null || !Drops.ContainsKey(ob.Character.Account)),

                Poison = Poison,

                EasterEvent = EasterEventMob,
                HalloweenEvent = HalloweenEventMob,
                ChristmasEvent = ChristmasEventMob,

                ExtraInt = Stage,

                Buffs = Buffs.Where(x => x.Visible).Select(x => x.Type).ToList()
            });
        }
        protected override void Init()
        {
            Mobs.Clear();
            Drops.Clear();
            bStarted = false;
            bChaos   = MapId % 2 == 1;
            int nTimeLeftSec;

            switch (MapId)
            {
            case 240060000:                     // normal
                nTimeLeftSec = 60 * 60;         // 1 hour
                break;

            case 240060001:                     // chaos
                nTimeLeftSec = 120 * 60;        // 2 hours
                break;

            default:
                nTimeLeftSec = (int)ParentInstance.CFieldMan
                               .GetField(MapId - 100, nInstanceID)
                               .tFieldTimerExpiration
                               .SecondsUntilEnd() + 2;
                if (nTimeLeftSec < 0)
                {
                    nTimeLeftSec = 0;
                }

                break;
            }
            CreateFieldClock(nTimeLeftSec);

            base.Init();             // doesnt currently do anything but might in the future
        }
Beispiel #7
0
        /// <summary>
        /// Update the mouse manager.
        /// </summary>
        public override void Update(bool isActive)
        {
            //clear out the taps & touches
            Clicks.Clear();
            Highlights.Clear();
            Drags.Clear();
            Drops.Clear();
            Flicks.Clear();
            Pinches.Clear();

            if (null != Pinch)
            {
                //reset the pinch delta
                Pinch.Delta = 0f;
            }

            if (isActive)
            {
                TouchCollection = TouchPanel.GetState();

                //get the new taps & touches
                GetGestures();
                GetTouches();
            }

            //Add the pinch event if there is an ongoing gesture
            if (null != Pinch)
            {
                Pinches.Add(new PinchEventArgs(Pinch.Delta));
            }
        }
Beispiel #8
0
        public void AddDrop(Drop drop)
        {
            int id = _objectIDs.NextValue();

            Drops.Add(id, drop);
            drop.ID = id;
        }
Beispiel #9
0
        public void AddDrop(Drop drop)
        {
            ushort key = 0;

            if (availableDropKeys.Count > 0)
            {
                key = availableDropKeys.Dequeue();
            }
            else
            {
                if (dropIndexer == ushort.MaxValue)
                {
                    Log.WriteLine(LogLevel.Warn, "Drop buffer overflow at map {0}.", this.MapInfo.ShortName);
                    return;
                }
                else
                {
                    key = dropIndexer++;
                }
            }

            if (Drops.TryAdd(key, drop))
            {
                drop.ID        = key;
                drop.MapSector = GetSectorByPos(drop.Position);
                drop.MapSector.AddDrop(drop);
            }
            else
            {
                Log.WriteLine(LogLevel.Warn, "Failed to add drop at map {0}.", this.MapInfo.ShortName);
            }
        }
Beispiel #10
0
        public async Task ShowAllItems()
        {
            var    temp = Drops.GetItems();
            string text = "";

            foreach (var t in temp)
            {
                string act = (t.Active) ? "Active":"Passive";
                text += $"Item-{t.ID}\nName : {t.Name}\nUsage : {act}\nType : {t.Type}\nRarity : {t.Rarity}\n";
                text += "\n";
                if ((text.Length + 300) > 2048)
                {
                    await Context.Channel.SendMessageAsync($"`{text}`");

                    text = "";
                }
            }
            if (text.Equals(""))
            {
                await Context.Channel.SendMessageAsync("`NO ITEM HAS BEEN MADE BE THE FIRST TO MAKE ONE!`");

                return;
            }
            await Context.Channel.SendMessageAsync($"`{text}`");
        }
Beispiel #11
0
        protected override void RemoveExisting(Drop <ContainerDestination> drop)
        {
            var existingPosition = Drops.FirstOrDefault(x => x.Bay == drop.Bay && x.Row == drop.Row);

            if (existingPosition != null)
            {
                Drops.Remove(existingPosition);

                if (existingPosition.Data.Container.Size == ContainerSize.FortyFoot)
                {
                    string rowNumber      = existingPosition.Row;
                    string rightBayNumber = (int.Parse(existingPosition.Bay) + 1).ToString();
                    string leftBayNumber  = (int.Parse(existingPosition.Bay) - 1).ToString();

                    existingPosition = Drops.FirstOrDefault(x => x.Bay == rightBayNumber && x.Row == rowNumber);
                    if (existingPosition == null)
                    {
                        existingPosition = Drops.FirstOrDefault(x => x.Bay == leftBayNumber && x.Row == rowNumber);
                    }

                    Drops.Remove(existingPosition);
                }
            }

            foreach (var objectDrop in Drops.Where(x => x.Data.GetHashCode() == drop.Data.GetHashCode()).ToArray())
            {
                Drops.Remove(objectDrop);
            }
        }
Beispiel #12
0
    // ---------------------------------------------------------------------------------------------------------------------------------------------
    // OTHER FUNCTIONS
    // ---------------------------------------------------------------------------------------------------------------------------------------------

    // Return an index for a random object to spawn from a list of prefabs.
    // This will return and index depending on the prefabs rarity weight.
    // Keep rarity between 0.001 - 100 on prefab stats.
    public int ChooseRandomSpawn(List <GameObject> list)
    {
        float x           = 0; // counter
        float totalRarity = 0; // tht total rarity weight of all in the list
        int   index       = 0; // return this index

        if (list.Count >= 0)
        {
            // get total rarity
            for (int i = 0; i < list.Count; i++)
            {
                // check if target or obsticle
                if (list[i].GetComponentsInChildren <Drops>().Length != 0)
                {
                    Drops tmScript = list[i].GetComponentInChildren <Drops>();
                    totalRarity += tmScript.rarity;
                }
                else
                {
                    totalRarity += 0;
                }
            }

            // get random number from the total rarity weight
            x = Random.Range(0, totalRarity);

            // Step through the list and check if x is less than the rarity.
            // If x is less than the rarity then break out of the loop and
            // return the index;
            for (int i = 0; i < list.Count; i++)
            {
                index = i;

                //TargetManager tmScript = list[i].GetComponentInChildren<TargetManager>();
                //float rarity = tmScript.rarity;
                float rarity = 0;

                // check if target or obsticle
                if (list[i].GetComponentsInChildren <Drops>().Length != 0)
                {
                    Drops tmScript = list[i].GetComponentInChildren <Drops>();
                    rarity = tmScript.rarity;
                }
                else
                {
                    rarity = 0;
                }


                if (x <= rarity)
                {
                    break;
                }

                x -= rarity;
            }
        }
        return(index);
    }
Beispiel #13
0
 public void AddDrop(Drop drop)
 {
     Drops.Add(drop.ID, drop);
     using (var spawn = Handler7.ShowDrop(drop))
     {
         Broadcast(spawn);
     }
 }
 private void EndTacking()
 {
     //		np.NotificationsPanelDisabled();
     itemToSwitch = null;
     ring.gameObject.SetActive(false);
     active = false;
     GameManager.DisableSlowMotion();
 }
Beispiel #15
0
        protected override void UpdateDrops(Drop <ContainerDestination> drop)
        {
            base.UpdateDrops(drop);

            if (drop.Data.Container.Size == ContainerSize.FortyFoot)
            {
                Drops.Add(new Drop <ContainerDestination>(drop.Data, drop.Row, (int.Parse(drop.Bay) + 1).ToString()));
            }
        }
Beispiel #16
0
        private IEnumerable <string> OutputDrops(string parameters)
        {
            var retVal             = new List <string>();
            List <DropTable> drops = Drops.GetDrops(parameters);

            if (parameters.ToUpper() == "BOTWOON")
            {
                retVal.Add("Drops for Botwoon (first round) - Left hole: 100.00");
            }
            else if (parameters.ToUpper() == "MOTHER BRAIN")
            {
                retVal.Add("Drops for Mother Brain - Hyper Beam: 100.00, Roasted Critters: 100.00");
            }
            else if (drops.Count == 0)
            {
                retVal.Add("Could not find enemy. Please look here: http://deanyd.net/sm/index.php?title=Enemy_item_drops");
                UnknownInput.Enter(string.Format("!drops {0}", parameters));
            }
            else
            {
                foreach (var drop in drops)
                {
                    var dropString = new StringBuilder();
                    dropString.AppendFormat("Drops for {0} - ", drop.Name);
                    if (drop.Nothing > 0)
                    {
                        dropString.AppendFormat("Nothing: {0:0.00}, ", drop.Nothing);
                    }
                    if (drop.Energy > 0)
                    {
                        dropString.AppendFormat("Energy: {0:0.00}, ", drop.Energy);
                    }
                    if (drop.BigEnergy > 0)
                    {
                        dropString.AppendFormat("Big Energy: {0:0.00}, ", drop.BigEnergy);
                    }
                    if (drop.Missile > 0)
                    {
                        dropString.AppendFormat("Missile: {0:0.00}, ", drop.Missile);
                    }
                    if (drop.SuperMissile > 0)
                    {
                        dropString.AppendFormat("Super Missile: {0:0.00}, ", drop.SuperMissile);
                    }
                    if (drop.PowerBombs > 0)
                    {
                        dropString.AppendFormat("Power Bombs: {0:0.00}, ", drop.PowerBombs);
                    }
                    dropString.Remove(dropString.Length - 2, 2);

                    retVal.Add(dropString.ToString());
                }
            }

            return(retVal);
        }
Beispiel #17
0
 public void ImportCdrDrops(ICdrDrops stat)
 {
     stat.CdrDropsDistanceInfo = this.GenerateDistanceInfo <CdrDropsDistanceInfo, int>();
     stat.CdrDrops             = Drops.ConvertToInt(0);
     stat.CdrCalls             = Calls.ConvertToInt(1);
     stat.AverageRssi          = AverageRssi.ConvertToDouble(-120);
     stat.AverageDropEcio      = AverageDropEcio.ConvertToDouble(-12);
     stat.AverageDropDistance  = AverageDropDistance.ConvertToDouble(500);
     stat.CdrDropsHourInfo     = this.GenerateHourInfo <CdrDropsHourInfo, int>();
 }
Beispiel #18
0
        public async Task CreateDrop(Drop drop)
        {
            //set creatorId to current device id
            drop.CreatorId = _deviceService.DeviceId;

            var dropResult = await _dropClient.CreateDrop(drop);

            Drops.Add(dropResult);
            OwnDrops.Add(dropResult);
        }
Beispiel #19
0
 public Jell(bool server) : base(server)
 {
     InitVars();
     //Drops.Add(new ItemDrop(ItemName.Dirt, random.Next(5) + 5, server));
     Drops.Add(new ItemDrop(ItemName.Stone, random.Next(5) + 5, server));
     if (random.Next(10) < 1)
     {
         Drops.Add(new ItemDrop(ItemName.Sword, 1, server));
     }
 }
Beispiel #20
0
 public void RemoveDrop(Drop drop)
 {
     if (Drops.Remove(drop.ID))
     {
         using (var removedrop = Handler6.RemoveDrop(drop))
         {
             Broadcast(removedrop);
         }
     }
 }
 public void PickupWeaponWheel(Item newItem, Drops drops)
 {
     active       = true;
     itemToSwitch = drops;
     location     = 0;
     GameManager.EnableSlowMotion(0.1f);
     ring.gameObject.SetActive(true);
     SetupWeapon(leftArm, playerLo.loadout[2].itemSprite);
     SetupWeapon(rightArm, playerLo.loadout[3].itemSprite);
     SetupWeapon(newArm, newItem.itemSprite);
 }
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime, bool fullDraw)
 {
     Player.Draw(spriteBatch, gameTime);
     Enemies.Draw(spriteBatch, gameTime);
     Drops.Draw(spriteBatch, gameTime);
     Projectiles.Draw(spriteBatch, gameTime);
     if (isActive)
     {
         gameMode.Draw(spriteBatch, gameTime, fullDraw);
     }
 }
 /// <summary>
 /// Creates and returns an instance of EnemyDrops reprenting this enemy's effective drop rates,
 /// given that the provided resources are full.
 /// </summary>
 /// <param name="model">A model that can be used to obtain data about the current game configuration.</param>
 /// <param name="fullResources">An enumeration of consumable resources that are considered full
 /// (and hence no longer cause their corresponding enemy drop to happen).</param>
 /// <returns></returns>
 public EnemyDrops GetEffectiveDropRates(SuperMetroidModel model, IEnumerable <ConsumableResourceEnum> fullResources)
 {
     if (fullResources.Any())
     {
         return(model.Rules.CalculateEffectiveDropRates(Drops, model.Rules.GetUnneededDrops(fullResources)));
     }
     else
     {
         return(Drops.Clone());
     }
 }
Beispiel #24
0
 public ToxWyrm(int characterLV, Game1 _game, PlayerCharacter pc)
     : base(characterLV, _game)
 {
     name       = "Toxwyrm";
     image      = Content.Load <Texture2D>(@"Images/fireworm");
     ATK_MOD    = .5f;
     DEF_MOD    = .9f;
     SP_DEF_MOD = .85f;
     atk        = 12;
     goldAmt    = this.level * 12;
     Drops.Add(new HealthPot("Health Potion", pc, "+35% HP\n\nA small, red potion.\nAs generic as they come.", 20));
 }
Beispiel #25
0
 public void GetDropItem(int iterations = 1)
 {
     for (int i = 0; i < iterations; i++)
     {
         d = drops[Random.Range(0, drops.Count)];
         DroppedItem item = ObjectPooler.SharedInstance.GetPooledObject(3).GetComponent <DroppedItem>();
         item.gameObject.SetActive(true);
         item.transform.position = transform.position;
         item.transform.rotation = Quaternion.Euler(0, 0, 0);
         item.Init(d);
     }
 }
 public GameController(Player player, Projectiles projectiles, Drops drops, GameMode gameMode)
 {
     colHandler       = new CollisionHandler();
     this.Player      = player;
     this.Projectiles = projectiles;
     Drops            = drops;
     this.gameMode    = gameMode;
     spawnPointGen    = new SpawnPointGenerator(gameMode);
     spawnTimer       = new SpawnTimer(gameMode);
     Enemies          = new Enemies(player);
     dropPoints       = new DropSpawnPoints();
 }
Beispiel #27
0
        public void Update()
        {
            map.UpDate();
            MEvent Event;

            while ((Event = map.NextEvent()) != null)
            {
                if (Event.Type == MEvents.PlayerArrow)
                {
                    int TagArrow  = ((MEventArrowHit)Event).TagArrow;
                    int TagPlayer = ((MEventArrowHit)Event).TagPlayer;
                    players[TagPlayer].recieveDamage(Arrows[TagArrow].dmg);
                    if (players[TagPlayer].isDead())
                    {
                        if (ArenaPlayer.ContainsKey(Arrows[TagArrow].creater))
                        {
                            ArenaPlayer[Arrows[TagArrow].creater].AddKill();
                        }
                        ArenaPlayer[TagPlayer].AddDeath();
                        if (players[TagPlayer].rightHand != 1)
                        {
                            int NewTag = Utily.GetTag();
                            Drops.Add(NewTag, new ADrop(1, players[TagPlayer].rightHand));
                            map.SpawnDrops(NewTag, map.players[TagPlayer].x, map.players[TagPlayer].y);
                        }
                        map.SpawnPlayer(TagPlayer);
                        players[TagPlayer].respawn();
                    }
                    Arrows.Remove(TagArrow);
                }
                if (Event.Type == MEvents.PlayerDrop)
                {
                    var drop = Drops[((MEventDrop)Event).TagDrop];
                    players[((MEventDrop)Event).TagPlayer].pickedUpItem(drop.id, drop.Count);
                    Drops.Remove(((MEventDrop)Event).TagDrop);
                    if (((MEventDrop)Event).BySpawner)
                    {
                        DropForRespawn.Enqueue(Utily.MakePair <long, int>(timer.ElapsedMilliseconds, ((MEventDrop)Event).NumSpawner));
                    }
                }
                if (Event.Type == MEvents.DestroyArrow)
                {
                    Arrows.Remove(((MEventDestroyArrow)Event).TagArrow);
                }
            }
            while (DropForRespawn.Count > 0 && DropForRespawn.Peek().Item1 + WaitRespawnDrop < timer.ElapsedMilliseconds)
            {
                int num = DropForRespawn.Dequeue().Item2;
                int tag = Utily.GetTag();
                map.SpawnDrops(num, tag);
                Drops.Add(tag, new ADrop(map.dropSpawners[num].count, map.dropSpawners[num].id));
            }
        }
Beispiel #28
0
        public static void Create(string id, Entity entity, Area area = null, Dot where = null)
        {
            var drop = Drops.Get(id);

            if (drop == null)
            {
                return;
            }

            Create(new List <Drop> {
                drop
            }, entity, area, where);
        }
        private void HandleAllCollisions()
        {
            List <Collidable> pParts   = Player.Parts.ConvertAll(p => (Collidable)p);
            List <Collidable> eParts   = Enemies.GetValues().Where(e => ((Enemy)e).IsActive).SelectMany(e => ((Enemy)e).Parts).ToList().ConvertAll(p => (Collidable)p);
            List <Collidable> pBullets = Projectiles.GetValues().Where(p => ((Projectile)p).Team != EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY) && ((Projectile)p).IsActive).ToList().ConvertAll(p => (Collidable)p);
            List <Collidable> eBullets = Projectiles.GetValues().Where(p => ((Projectile)p).Team == EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY) && ((Projectile)p).IsActive).ToList().ConvertAll(p => (Collidable)p);
            List <Collidable> eDrops   = Drops.GetValues().Where(d => ((Drop)d).IsActive).ToList().ConvertAll(p => (Collidable)p);

            colHandler.CheckCollisions(pParts, eParts);
            colHandler.CheckCollisions(pParts, eBullets);
            colHandler.CheckCollisions(pParts, eDrops);
            colHandler.CheckCollisions(eParts, pBullets);
        }
Beispiel #30
0
        public async Task <GetDropsResponse> GetDropsForMap(double mapNorth, double mapSouth, double mapWest, double mapEast)
        {
            var dropsResult = await _dropClient.GetDrops(mapNorth, mapSouth, mapWest, mapEast);

            foreach (var drop in dropsResult.Drops)
            {
                if (Drops.All(x => x.Id != drop.Id))
                {
                    Drops.Add(drop);
                }
            }
            return(dropsResult);
        }
        static void Step()
        {
            DropLimiter limiter = null;

            try
            {
            limiter = new DropLimiter();
            }
            catch (StateNotFoundException)
            {
            Console.WriteLine("No previous state file found, exiting " +
                              "without doing any drops. This is not an " +
                              "error, it is expected for the first run.");
            return;
            }

            limiter.Logger.Writers.Add(new ConsoleLogWriter());

            if (limiter.Config.ContainsKey("Log"))
            limiter.Logger.Writers.Add(
                new FileLogWriter(limiter.Config["Log"]));

            if (limiter.Config.ContainsKey("Report"))
            limiter.Report = new CsvReport(limiter.Config["Report"]);

            switch (limiter.Config.DatabasePatch)
            {
            case "auto":
            if (!DBPatch.IsInstalled(limiter.GameDB))
                DBPatch.Install(limiter.GameDB);

            break;

            case "prompt":
            if (!DBPatch.IsInstalled(limiter.GameDB))
            {
                Console.Write("rm-drop-limiter database patch not " +
                              "detected. Install now (y/n) ? ");

                if (Console.ReadLine().Trim().ToLower() != "y")
                    break;

                DBPatch.Install(limiter.GameDB);
            }

            break;

            case "disabled":
            if (DBPatch.IsInstalled(limiter.GameDB))
                DBPatch.Uninstall(limiter.GameDB);

            break;

            default:
            Console.WriteLine("In .conf file, DatabasePatch is set to [" +
                              limiter.Config.DatabasePatch + "], which is " +
                              "unrecognized. Exiting.");
            return;
            }

            var drops = new Drops();

            var newdrops = limiter.Run(drops);

            limiter.State.Save();

            foreach (var item in newdrops.Keys)
            Console.WriteLine("{0}: spawning {1} more.",
                              drops.FindByItemIndex(item).Description,
                              newdrops[item]);

            if (newdrops.Count > 0)
            limiter.GameDB.IncrementLimits(newdrops);
        }