/// <summary>
        /// Call the server call for Get Items using HTTP Get
        /// </summary>
        /// <returns></returns>
        public async Task <string> GetItemsGet()
        {
            // Call to the ItemModel Service and have it Get the Items
            // The ServerItemValue Code stands for the batch of items to get
            // as the group to request.  1, 2, 3, 100 (All), or if not specified All

            var result = "No Results";

            var value    = Convert.ToInt32(ServerItemValue.Text);
            var dataList = await Services.ItemService.GetItemsFromServerGetAsync(value);

            if (dataList == null)
            {
                return(result);
            }

            if (dataList.Count == 0)
            {
                return(result);
            }

            // Reset the output
            result = "";

            foreach (var ItemModel in dataList)
            {
                // Add them line by one, use \n to force new line for output display.
                // Build up the output string by adding formatted ItemModel Output
                result += ItemModel.FormatOutput() + "\n";
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Drop Items
        /// </summary>
        public override int DropItems(PlayerInfoModel Target)
        {
            var DroppedMessage = "\nItems Dropped : \n";

            // Drop Items to ItemModel Pool
            var myItemList = Target.DropAllItems();

            // I feel generous, even when characters die, random drops happen :-)
            // If Random drops are enabled, then add some....
            myItemList.AddRange(GetRandomMonsterItemDrops(EngineSettings.BattleScore.RoundCount));

            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                EngineSettings.BattleScore.ItemsDroppedList += ItemModel.FormatOutput() + "\n";
                DroppedMessage += ItemModel.Name + "\n";
            }

            EngineSettings.ItemPool.AddRange(myItemList);

            if (myItemList.Count == 0)
            {
                DroppedMessage = " Nothing dropped. ";
            }

            EngineSettings.BattleMessagesModel.DroppedMessage = DroppedMessage;

            EngineSettings.BattleScore.ItemModelDropList.AddRange(myItemList);

            return(myItemList.Count());
        }
예제 #3
0
        /// <summary>
        /// Drop Items
        /// </summary>
        /// <param name="Target"></param>
        public int DropItems(DungeonFighterModel Target)
        {
            var DroppedMessage = "\nItems Dropped : \n";

            // Drop Items to ItemModel Pool
            var myItemList = Target.DropAllItems();

            // I feel generous, even when characters die, random drops happen :-)
            // If Random drops are enabled, then add some....
            myItemList.AddRange(GetRandomMonsterItemDrops());

            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                Referee.BattleScore.ItemsDroppedList += ItemModel.FormatOutput() + "\n";
                DroppedMessage += ItemModel.Name + "\n";
            }

            Referee.ItemPool.AddRange(myItemList);

            if (myItemList.Count == 0)
            {
                DroppedMessage = " Nothing dropped. ";
            }

            Referee.BattleMessages.DroppedMessage = DroppedMessage;

            Referee.BattleScore.ItemModelDropList.AddRange(myItemList);

            return(myItemList.Count());
        }
예제 #4
0
        public int CharacterDropItem(EntityInfoModel Target)
        {
            var DroppedMessage = "\nItems Dropped : \n";

            // Drop Items to ItemModel Pool
            var myItemList = Target.DropAllItems();


            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                BattleScore.ItemsDroppedList += ItemModel.FormatOutput() + "\n";
                DroppedMessage += ItemModel.Name + "\n";
            }

            ItemPool.AddRange(myItemList);

            if (myItemList.Count == 0)
            {
                DroppedMessage = " Nothing dropped. ";
            }

            BattleMessageModel.DroppedMessage = DroppedMessage;

            BattleScore.ItemModelDropList.AddRange(myItemList);

            return(myItemList.Count());
        }
예제 #5
0
        /// <summary>
        /// Drop Items
        /// </summary>
        public override int DropItems(PlayerInfoModel Target)
        {
            // Drop Items to ItemModel Pool

            // I feel generous, even when characters die, random drops happen :-)
            // If Random drops are enabled, then add some....

            // Add to ScoreModel

            var DroppedMessage = "\nItems Dropped : \n";

            // Drop Items to ItemModel Pool
            var myItemList = Target.DropAllItems();

            // Get the monster's unique drop item.
            if (Target.PlayerType == PlayerTypeEnum.Monster)
            {
                var myItem = ItemIndexViewModel.Instance.GetItem(Target.UniqueDropItem);
                if (myItem != null)
                {
                    myItemList.Add(myItem);
                }
            }

            // I feel generous, even when characters die, random drops happen :-)
            // If Random drops are enabled, then add some....

            // add item only if is not null
            foreach (ItemModel item in GetRandomMonsterItemDrops(EngineSettings.BattleScore.RoundCount))
            {
                if (item != null)
                {
                    myItemList.Add(item);
                }
            }

            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                EngineSettings.BattleScore.ItemsDroppedList += ItemModel.FormatOutput() + "\n";
                DroppedMessage += ItemModel.Name + "\n";
            }

            EngineSettings.ItemPool.AddRange(myItemList);

            if (myItemList.Count == 0)
            {
                DroppedMessage = " Nothing dropped. ";
            }

            EngineSettings.BattleMessagesModel.DroppedMessage = DroppedMessage;

            EngineSettings.BattleScore.ItemModelDropList.AddRange(myItemList);

            return(myItemList.Count());
        }
예제 #6
0
        public void ItemModel_FormatOuput_Default_Should_Pass()
        {
            // Arrange
            var data = new ItemModel();

            // Act
            var result = data.FormatOutput();

            // Reset

            // Assert
            Assert.AreEqual("This is an Item , Item Description for Unknown with Unknown+0 , Damage : 0 , Range : 0", result);
        }
예제 #7
0
        /// <summary>
        /// Helper method for debug output
        /// </summary>
        /// <param name="location"></param>
        /// <param name="dataList"></param>
        public string DropedItemOutput(string location, List <ItemModel> dataList)
        {
            // Reset the output
            var result = "Dropped items for " + location + " location: ";

            foreach (var ItemModel in dataList)
            {
                // Add them line by one, use \n to force new line for output display.
                result += ItemModel.FormatOutput() + "\n";
            }

            EngineSettings.BattleMessagesModel.DroppedMessage = result;
            Debug.WriteLine(result);
            return(result);
        }
예제 #8
0
        /// <summary>
        /// Drop equipped Items
        /// </summary>
        /// <param name="Target"></param>
        public int DropItems(PlayerInfoModel Target)
        {
            // Drop Items to ItemModel Pool
            var myItemList = Target.DropAllItems();

            // I feel generous, even when characters die, random drops happen :-)
            // If Random drops are enabled, then add some....
            myItemList.AddRange(GetRandomMonsterItemDrops(BattleScore.RoundCount));

            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                BattleScore.ItemsDroppedList           += ItemModel.FormatOutput() + "\n";
                BattleMessagesModel.TurnMessageSpecial += " ItemModel " + ItemModel.Name + " dropped";
            }

            ItemPool.AddRange(myItemList);

            return(myItemList.Count());
        }
예제 #9
0
        /// <summary>
        /// Get Items using the HTTP Post command
        /// </summary>
        /// <returns></returns>
        public async Task <string> GetItemsPost()
        {
            var result   = "No Results";
            var dataList = new List <ItemModel>();

            var number         = Convert.ToInt32(ServerItemValue.Text);
            var level          = 6;                        // Max Value of 6
            var attribute      = AttributeEnum.Unknown;    // Any Attribute
            var location       = ItemLocationEnum.Unknown; // Any Location
            var random         = true;                     // Random between 1 and Level
            var updateDataBase = true;                     // Add them to the DB
            var category       = 0;                        // What category to filter down to, 0 is all

            // will return shoes value 10 of speed.
            // Example  result = await ItemsController.Instance.GetItemsFromGame(1, 10, AttributeEnum.Speed, ItemLocationEnum.Feet, false, true);
            dataList = await ItemService.GetItemsFromServerPostAsync(number, level, attribute, location, category, random, updateDataBase);

            // Null not possible, returns empty instead
            //if (dataList == null)
            //{
            //    return result;
            //}

            if (dataList.Count == 0)
            {
                return(result);
            }

            // Reset the output
            result = "";

            foreach (var ItemModel in dataList)
            {
                // Add them line by one, use \n to force new line for output display.
                result += ItemModel.FormatOutput() + "\n";
            }

            return(result);
        }
예제 #10
0
        /// <summary>
        /// Drop Items
        /// </summary>
        public override int DropItems(PlayerInfoModel Target)
        {
            // INFO: Teams, work out how you want to drop items.
            var DroppedMessage = "\nItems Dropped : \n";

            // Drop Items to ItemModel Pool
            var myItemList = Target.DropAllItems();

            if (!Target.Alive)
            {
                if (Target.PlayerType == PlayerTypeEnum.Monster)
                {
                    if (Target.Job == CharacterJobEnum.Vet)
                    {
                        List <ItemModel> dataList = new List <ItemModel>()
                        {
                            new ItemModel
                            {
                                Name        = "Arthur's Ring",
                                Description = "A ring worn by king Arthur\nhimself and can be dropped\nby Anais after her defeat.",
                                Range       = 10,
                                Value       = 20,
                                Location    = ItemLocationEnum.Finger,
                                Attribute   = AttributeEnum.Defense,
                                ImageURI    = "arthursring.png"
                            },
                            new ItemModel {
                                Name        = "Arthur's Helmet",
                                Description = "Helmet worn by king Arthur\nhimself and can be dropped by\nAnais after her defeat.",
                                ImageURI    = "arthurshelmet.png",
                                Value       = 15,
                                Location    = ItemLocationEnum.Head,
                                Attribute   = AttributeEnum.Defense
                            },
                            new ItemModel {
                                Name        = "Arthur's Sword",
                                Description = "Sword swung by king Arthur\nhimself and can be dropped by\nAnais after her defeat.",
                                ImageURI    = "arthurssword.png",
                                Range       = 10,
                                Damage      = 5,
                                Value       = 20,
                                Location    = ItemLocationEnum.PrimaryHand,
                                Attribute   = AttributeEnum.Attack
                            },
                        };
                        myItemList.AddRange(dataList);
                    }
                    else if (Target.Job == CharacterJobEnum.Accountant)
                    {
                        List <ItemModel> dataList = new List <ItemModel>()
                        {
                            new ItemModel {
                                Name        = "Cash",
                                Description = "Yinying might drop cash that\ncan be equipped on a character,\ngiving them more reason to\nlive which gives them higher\ndefense.",
                                ImageURI    = "cash.png",
                                Value       = 10,
                                Location    = ItemLocationEnum.PrimaryHand,
                                Attribute   = AttributeEnum.Defense
                            },
                        };
                        myItemList.AddRange(dataList);
                    }
                    else if (Target.Job == CharacterJobEnum.Boss)
                    {
                        List <ItemModel> dataList = new List <ItemModel>()
                        {
                            new ItemModel {
                                Name        = "Steve's Controller",
                                Description = "After defeating Steve, you\nacquire his controller which\ncan be equipped on a character\nso they can have their special\nattacks ready at the beginning\nof every Round.",
                                ImageURI    = "stevescontroller.png",
                                Value       = 50,
                                Location    = ItemLocationEnum.PrimaryHand,
                                Attribute   = AttributeEnum.MaxHealth
                            },
                        };
                        myItemList.AddRange(dataList);
                    }
                }
                else if (Target.PlayerType == PlayerTypeEnum.Character)
                {
                    myItemList.AddRange(GetRandomMonsterItemDrops(EngineSettings.BattleScore.RoundCount));
                }
            }
            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                EngineSettings.BattleScore.ItemsDroppedList += ItemModel.FormatOutput() + "\n";
                DroppedMessage += ItemModel.Name + "\n";
            }

            EngineSettings.ItemPool.AddRange(myItemList);

            if (myItemList.Count == 0)
            {
                DroppedMessage = " Nothing dropped. ";
            }

            EngineSettings.BattleMessagesModel.DroppedMessage = DroppedMessage;

            EngineSettings.BattleScore.ItemModelDropList.AddRange(myItemList);

            return(myItemList.Count());
        }
예제 #11
0
        /// <summary>
        /// Have the target drop all their items
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public int DropItems(BattleEntityModel target)
        {
            // Reset item drop message
            BattleMessages.ItemDropMessage = string.Empty;

            // Drop Items to ItemModel Pool
            var myItemList = RemoveItems(target);

            // Add monster drop items
            if (target.EntityType == EntityTypeEnum.Monster)
            {
                myItemList.AddRange(GetRandomMonsterItemDrops(myItemList));

                if (CloudItemDropEnabled)
                {
                    var cloudItem = Task.Run(async() => await GetExternalItem(target.Level)).Result;

                    if (cloudItem != null)
                    {
                        myItemList.Add(cloudItem);
                    }
                }

                //// Hackathon Scenario 10
                //if (myItemList.Count == 1)
                //{
                //    var diceroll = DiceHelper.RollDice(1, 10);
                //    if (diceroll == 1)
                //    {
                //        var damageroll = DiceHelper.RollDice(1, 4);
                //        var damage = Score.RoundCount * damageroll;
                //        BattleMessages.ItemDropMessage += "GRENADE dropped!";
                //        Debug.WriteLine(BattleMessages.TurnMessageSpecial);

                //        foreach (var monster in MonsterList)
                //        {
                //            // monsters take damage
                //            TakeDamage(EntityList.First(a => a.Id == monster.Id), damage);
                //            // remove monsters if dead
                //            var dead = RemoveIfDead(EntityList.First(a => a.Id == monster.Id));
                //            // add dead monsters' items to myItemList
                //            if (dead)
                //            {
                //                var monsterItemList = RemoveItems(EntityList.First(a => a.Id == monster.Id));
                //                myItemList.AddRange(GetRandomMonsterItemDrops(monsterItemList));
                //            }
                //        }
                //    }
                //}
            }
            var itemsForPool = new List <ItemModel>();

            // Add to ScoreModel
            foreach (var ItemModel in myItemList)
            {
                if (ItemModel != null)
                {
                    Score.ItemsDroppedList         += ItemModel.FormatOutput() + "\n";
                    BattleMessages.ItemDropMessage += "\n" + ItemModel.Name + " dropped";

                    itemsForPool.Add(ItemModel);
                }
            }

            Debug.WriteLine(BattleMessages.ItemDropMessage);

            ItemPool.AddRange(itemsForPool);

            return(myItemList.Count());
        }