Exemplo n.º 1
0
        public void Create(Loadout loadout, string externalUserId)
        {
            if (loadout.PlayerId == Guid.Empty) throw new ArgumentException("Player id is required");
            loadout.Id = loadout.Id == Guid.Empty ? Guid.NewGuid() : loadout.Id;

            _loadoutRepository.Create(loadout);

            Task.Run(() => HandleLoadoutCreated(loadout, externalUserId));
        }
Exemplo n.º 2
0
        public static async Task <Loadout> MacroTotalsLoadoutAsync(Loadout loadout)
        {
            thisLoadout = loadout;
            await ResetTotalsLoadoutAsync();

            for (int i = 0; i < thisLoadout.Meals.Count; i++)
            {
                await CalcTotalsLoadoutAsync(i);
            }
            return(thisLoadout);
        }
Exemplo n.º 3
0
 private static Loadout.Entry[] LoadEntryArray(Loadout.Entry[] array, Inventory.Slot.Kind kind)
 {
     array = array ?? Loadout.Empty.EntryArray;
     for (int i = 0; i < (int)array.Length; i++)
     {
         Loadout.Entry entry = array[i];
         entry.inferredSlotKind = kind;
         entry.inferredSlotOfKind = i;
     }
     return array;
 }
Exemplo n.º 4
0
        /// <summary>
        /// When the user click a loadout, we download it.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvLoadouts_Click(object sender, EventArgs e)
        {
            if (lvLoadouts.SelectedItems.Count == 0)
            {
                return;
            }

            Loadout loadout = (Loadout)lvLoadouts.SelectedItems[0].Tag;

            DownloadLoadout(loadout);
        }
Exemplo n.º 5
0
        public Task <int> SpawnNPC(Loadout loadout, Vector3 position)
        {
            var completionSource = new TaskCompletionSource <int>();

            World.EnqueueAction(() =>
            {
                var obj = DoSpawn(null, loadout, null, position, Quaternion.Identity);
                completionSource.SetResult(obj.NetID);
            });
            return(completionSource.Task);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Called when trying to find something to drop (ie coming back from a caravan).  This is useful even on pawns without a loadout.
        /// </summary>
        /// <param name="dropThing">Thing to be dropped from inventory.</param>
        /// <param name="dropCount">Amount to drop from inventory.</param>
        /// <returns></returns>
        static public bool GetAnythingForDrop(this Pawn pawn, out Thing dropThing, out int dropCount)
        {
            dropThing = null;
            dropCount = 0;

            if (pawn.inventory == null || pawn.inventory.innerContainer == null)
            {
                return(false);
            }

            Loadout loadout = pawn.GetLoadout();

            if (loadout == null || loadout.Slots.NullOrEmpty())
            {
                List <HoldRecord> recs = LoadoutManager.GetHoldRecords(pawn);
                if (recs != null)
                {
                    // hand out any inventory item not covered by a HoldRecord.
                    foreach (Thing thing in pawn.inventory.innerContainer)
                    {
                        int        numContained = pawn.inventory.innerContainer.TotalStackCountOfDef(thing.def);
                        HoldRecord rec          = recs.FirstOrDefault(hr => hr.thingDef == thing.def);
                        if (rec == null)
                        {
                            // we don't have a HoldRecord for this thing, drop it.
                            dropThing = thing;
                            dropCount = numContained > dropThing.stackCount ? dropThing.stackCount : numContained;
                            return(true);
                        }

                        if (numContained > rec.count)
                        {
                            dropThing = thing;
                            dropCount = numContained - rec.count;
                            dropCount = dropCount > dropThing.stackCount ? dropThing.stackCount : dropCount;
                            return(true);
                        }
                    }
                }
                else
                {
                    // we have nither a HoldTracker nor a Loadout that we can ask, so just pick stuff at random from Inventory.
                    dropThing = pawn.inventory.innerContainer.RandomElement <Thing>();
                    dropCount = dropThing.stackCount;
                }
            }
            else
            {
                // hand out an item from GetExcessThing...
                return(GetExcessThing(pawn, out dropThing, out dropCount));
            }

            return(false);
        }
Exemplo n.º 7
0
    public static Loadout[][] UnserializeAllPlayersLoadouts(int[][][] arararLoadoutSelection)
    {
        Loadout[][] ararLoadouts = new Loadout[arararLoadoutSelection.Length][];

        for (int i = 0; i < arararLoadoutSelection.Length; i++)
        {
            ararLoadouts[i] = UnserializePlayerLoadouts(arararLoadoutSelection[i]);
        }

        return(ararLoadouts);
    }
Exemplo n.º 8
0
        public async void SaveLoadout(object sender, RoutedEventArgs e)
        {
            var temp       = loadout;
            var newLoadout = await inventoryManager.GetEquiped();

            newLoadout.Name     = temp.Name;
            newLoadout.Shortcut = temp.Shortcut;

            loadout = newLoadout;

            SaveLoadoutChanges();
        }
        public void refreshLoadouts()
        {
            foreach (ListViewItem item in loadoutList.Items)
            {
                Loadout load = (Loadout)item.Tag;

                var monid = ulong.Parse(item.SubItems[2].Text);

                load.RecountDiff(monid);
                ListViewItemLoad(item, load);
            }
        }
Exemplo n.º 10
0
        public void TestToughness_HasDifficulty()
        {
            var loadout = new Loadout();

            loadout.Units.Add(VUnit.New(UnitType.WarpLord, loadout));

            loadout.UnitConfiguration.DifficultyLevel = DifficultyLevel.VeryEasy;
            Assert.That(loadout.Stats.Toughness, Is.Not.EqualTo(0));

            loadout.UnitConfiguration.DifficultyLevel = DifficultyLevel.None;
            Assert.That(loadout.Stats.Toughness, Is.Not.EqualTo(0));
        }
Exemplo n.º 11
0
        public void ListLoadouts_UserHasOneLoadout_ShouldReturnSuccessWithLoadoutMessageString()
        {
            IConfiguration        config               = Mock.Of <IConfiguration>();
            IBungieApiService     bungieApiService     = Mock.Of <IBungieApiService>();
            IManifestDao          manifestDao          = Mock.Of <IManifestDao>();
            EmissaryDbContext     dbContext            = Mock.Of <EmissaryDbContext>();
            IEmissaryDao          emissaryDao          = Mock.Of <IEmissaryDao>();
            IAuthorizationService authorizationService = Mock.Of <IAuthorizationService>();


            ulong        discordId             = 221313820847636491;
            long         destinyProfileId      = 4611686018467260757;
            int          destinyMembershipType = BungieMembershipType.Steam;
            EmissaryUser user = new EmissaryUser(discordId, destinyProfileId, destinyMembershipType);

            long        titanCharacterId  = 2305843009504575107;
            uint        izanagiHash       = 3211806999;
            long        izanagiInstanceId = 6917529135183883487;
            DestinyItem izanagiItem       = new DestinyItem(izanagiInstanceId, "Izanagi's Burden",
                                                            new List <string>()
            {
                "Weapon", "Kinetic Weapon", "Sniper Rifle"
            }, izanagiHash,
                                                            new List <uint>()
            {
                2, 1, 10
            }, "Exotic");
            Loadout titanLoadout = new Loadout(discordId, titanCharacterId, "raid",
                                               new List <DestinyItem>()
            {
                izanagiItem
            });

            ProfileCharactersResponse charactersResponse = new ProfileCharactersResponse();
            DestinyCharacter          titan = new DestinyCharacter(titanCharacterId, DateTimeOffset.Parse("2019-12-24T22:40:31Z"), destinyProfileId, BungieMembershipType.Steam);

            charactersResponse.Characters.Add(titan.CharacterId, titan);

            IList <Loadout> allLoadoutsForUser = new List <Loadout>()
            {
                titanLoadout
            };

            Mock.Get(emissaryDao).Setup(m => m.GetUserByDiscordId(discordId)).Returns(user);
            Mock.Get(emissaryDao).Setup(m => m.GetAllLoadoutsForUser(discordId)).Returns(allLoadoutsForUser);
            Mock.Get(bungieApiService).Setup(m => m.GetProfileCharacters(It.IsAny <ProfileCharactersRequest>())).Returns(charactersResponse);

            IEmissary      emissary = new Emissary(config, bungieApiService, manifestDao, dbContext, emissaryDao, authorizationService);
            EmissaryResult result   = emissary.ListLoadouts(discordId);

            Assert.IsTrue(result.Success);
            Assert.AreEqual(JsonConvert.SerializeObject(allLoadoutsForUser), result.Message);
        }
Exemplo n.º 12
0
 static void AddMaxGems(Loadout loadout)
 {
     loadout.Gems.AttackGem.CurrentLevel       = 10;
     loadout.Gems.AttackSpeedGem.CurrentLevel  = 20;
     loadout.Gems.HealthGem.CurrentLevel       = 30;
     loadout.Gems.HealthArmorGem.CurrentLevel  = 40;
     loadout.Gems.ShieldsGem.CurrentLevel      = 50;
     loadout.Gems.ShieldsArmorGem.CurrentLevel = 60;
     loadout.Gems.CritChanceGem.CurrentLevel   = 70;
     loadout.Gems.CritDamageGem.CurrentLevel   = 80;
     loadout.Gems.DoubleWarpGem.CurrentLevel   = 90;
     loadout.Gems.TripleWarpGem.CurrentLevel   = 100;
 }
 // Token: 0x060020A0 RID: 8352 RVA: 0x0008D39F File Offset: 0x0008B59F
 public void SetLoadout(Loadout src)
 {
     src.Copy(this.loadout);
     if (NetworkServer.active)
     {
         base.SetDirtyBit(1U);
     }
     else if (base.isLocalPlayer)
     {
         this.SendLoadoutClient();
     }
     this.OnLoadoutUpdated();
 }
Exemplo n.º 14
0
        public void AddRuneTest()
        {
            Loadout load = new Loadout();

            load.AddRune(TestData.Rune1());
            load.AddRune(TestData.Rune2());
            load.AddRune(TestData.Rune3());
            load.AddRune(TestData.Rune4());
            load.AddRune(TestData.Rune5());
            load.AddRune(TestData.Rune6());

            Assert.AreEqual(6, load.RuneCount);
        }
Exemplo n.º 15
0
 // Token: 0x060017F2 RID: 6130 RVA: 0x00081618 File Offset: 0x0007F818
 public void SetLoadout(Loadout loadout)
 {
     if (this.Loadout != null)
     {
         this.Loadout.ClearAllSlots();
         this.Loadout.OnGearChanged   -= this.RebuildDecorator;
         this.Loadout.OnWeaponChanged -= this.UpdateWeapon;
     }
     this.Loadout = loadout;
     this.Loadout.OnGearChanged   += this.RebuildDecorator;
     this.Loadout.OnWeaponChanged += this.UpdateWeapon;
     this.RebuildDecorator();
 }
Exemplo n.º 16
0
    public List <Loadout> GetLoadoutsFromFiles(string folder)
    {
        List <Loadout> loadouts = new List <Loadout>();

        //string path = $"{Application.persistentDataPath}/{folder}";
        foreach (string file in Directory.GetFiles(FolderPath(folder)))
        {
            string  json    = File.ReadAllText(file);
            Loadout loadout = JsonUtility.FromJson <Loadout>(json);
            loadouts.Add(loadout);
        }
        return(loadouts);
    }
Exemplo n.º 17
0
    // Token: 0x06001502 RID: 5378 RVA: 0x00076CDC File Offset: 0x00074EDC
    private AvatarDecoratorConfig CreateLutzRavinoff(Loadout gearLoadout)
    {
        AvatarDecoratorConfig defaultRagdoll        = PrefabManager.Instance.DefaultRagdoll;
        AvatarDecoratorConfig avatarDecoratorConfig = UnityEngine.Object.Instantiate(defaultRagdoll) as AvatarDecoratorConfig;
        List <GameObject>     list = new List <GameObject>();

        SkinnedMeshCombiner.Combine(avatarDecoratorConfig.gameObject, list);
        foreach (GameObject obj in list)
        {
            UnityEngine.Object.Destroy(obj);
        }
        return(avatarDecoratorConfig);
    }
Exemplo n.º 18
0
        public async Task <Loadout> AddLoadoutToCharacter(
            int characterId,
            Loadout newLoadout
            )
        {
            var character = await Get(characterId);

            newLoadout.Id = character.Loadouts.Max(x => x.Id) + 1;
            character.Loadouts.Add(newLoadout);
            await _repo.Update(character);

            return(newLoadout);
        }
Exemplo n.º 19
0
    public static int[] SerializeLoadout(Loadout loadout)
    {
        int[] arSerialized = new int[Chr.nTotalCharacterSkills];

        int iSerialized = 0;

        for (int i = 0; i < Chr.nTotalCharacterSkills; i++, iSerialized++)
        {
            arSerialized[iSerialized] = (int)loadout.lstChosenSkills[i];
        }

        return(arSerialized);
    }
Exemplo n.º 20
0
    public static void SaveLoadout(CharType.CHARTYPE chartype, int iSlot, Loadout loadout)
    {
        Debug.Assert(iSlot < nLOADOUTSLOTS, "Cannot save slot " + iSlot + " since we don't allow that many slots");

        // Save the name of the loadout
        PlayerPrefs.SetString(GetKeyName(chartype, iSlot), loadout.sName);

        // Save all the standard skill selections
        for (int i = 0; i < Chr.nTotalCharacterSkills; i++)
        {
            PlayerPrefs.SetInt(GetKeySkills(chartype, iSlot, i), (int)loadout.lstChosenSkills[i]);
        }
    }
Exemplo n.º 21
0
    public ShipBase SpawnAIShip(Loadout loadout, string factionID, MacroAIParty party)
    {
        ShipBase ship = (GameObject.Instantiate(Resources.Load("AIShip")) as GameObject).GetComponent <ShipBase>();

        BuildShip(ship, loadout, factionID, party);



        //load weapons
        foreach (WeaponJoint joint in ship.MyReference.WeaponJoints)
        {
            joint.ParentShip = ship;
            foreach (KeyValuePair <string, InvItemData> jointSetup in loadout.WeaponJoints)
            {
                if (jointSetup.Key == joint.JointID)
                {
                    joint.LoadWeapon(jointSetup.Value);
                }
            }
        }

        for (int i = 0; i < loadout.Defensives.Count; i++)
        {
            if (loadout.Defensives[i] != null && loadout.Defensives[i].Item.GetStringAttribute("Defensive Type") == "Countermeasure")
            {
                CMDispenser dispenser = new CMDispenser();
                dispenser.ParentShip = ship;
                dispenser.AmmoID     = loadout.Defensives[i].RelatedItemID;
                dispenser.Type       = DefensiveType.Countermeasure;
                ship.MyReference.Defensives.Add(dispenser);
            }
        }

        //load ammo bay
        ship.Storage.AmmoBayItems = new Dictionary <string, InvItemData>();
        foreach (InvItemData item in loadout.AmmoBayItems)
        {
            ship.Storage.AmmoBayItems.Add(item.Item.ID, item);
        }
        ship.Storage.CargoBayItems = new List <InvItemData>();
        foreach (InvItemData item in loadout.CargoBayItems)
        {
            ship.Storage.CargoBayItems.Add(item);
        }

        AI ai = ship.GetComponent <AI>();

        ai.Initialize(party, _allFactions[factionID]);

        return(ship);
    }
Exemplo n.º 22
0
        static VLoadout GetFullyPopulatedLoadout()
        {
            var loadout = new Loadout();

            loadout.ShouldRestrict = false;
            AddMaxPerks(loadout);
            AddCP(loadout);
            AddMaxGems(loadout);
            AddUnits(loadout);
            AddUpgrades(loadout);
            AddSouls(loadout);
            PopulateOtherProperties(loadout);
            return(loadout);
        }
Exemplo n.º 23
0
        public void Setup()
        {
            var loadout = new Loadout();

            loadout.Equip(new CloakOfSpikes());

            _userRepository.Setup(repo => repo.GetUser(User)).Returns(new User()
            {
                Id = "testuser", Loadout = loadout
            });
            _equipmentRepository.Setup(repo => repo.UnequipItem(It.IsAny <User>(), EquipmentSlot.Body)).Returns(new CloakOfSpikes());

            _inventoryCommands = new InventoryCommands(_userRepository.Object, _slack.Object, _inventoryRepository.Object, _equipmentRepository.Object, _userService.Object);
        }
Exemplo n.º 24
0
        public void AddOrUpdateLoadout_SameDiscordIdAndSameNameButDifferentDestinyCharacter_ShouldWriteBothToDatabase()
        {
            ulong       discordId          = 221313820847636491;
            long        destinyCharacterId = 2305843009504575107;
            uint        izanagiHash        = 3211806999;
            long        izanagiInstanceId  = 6917529135183883487;
            string      loadoutName        = "crucible";
            DestinyItem izanagiItem        = new DestinyItem(izanagiInstanceId, "Izanagi's Burden", new List <string>()
            {
                "Weapon", "Kinetic Weapon", "Sniper Rifle"
            }, izanagiHash, new List <uint>()
            {
                2, 1, 10
            }, "Exotic");
            Loadout loadout = new Loadout(discordId, destinyCharacterId, loadoutName, new List <DestinyItem>()
            {
                izanagiItem
            });
            Loadout loadout2 = new Loadout(discordId, 69, loadoutName, new List <DestinyItem>()
            {
            });

            using (SqliteConnection connection = new SqliteConnection("DataSource=:memory:")) {
                connection.Open();
                DbContextOptions <EmissaryDbContext> options = new DbContextOptionsBuilder <EmissaryDbContext>()
                                                               .UseSqlite(connection)
                                                               .Options;
                using (EmissaryDbContext dbContext = new EmissaryDbContext(options)) {
                    dbContext.Database.EnsureCreated();
                }
                using (EmissaryDbContext dbContext = new EmissaryDbContext(options)) {
                    LoadoutDao loadoutDao = new LoadoutDao(dbContext);
                    loadoutDao.AddOrUpdateLoadout(loadout);
                }
                using (EmissaryDbContext dbContext = new EmissaryDbContext(options)) {
                    Assert.AreEqual(1, dbContext.Loadouts.Count());
                    Loadout foundLoadout = dbContext.Loadouts.Where(l => l.LoadoutName == loadoutName && l.DiscordId == discordId && l.DestinyCharacterId == destinyCharacterId).AsQueryable().FirstOrDefault();
                    Assert.AreEqual(loadout.DestinyCharacterId, foundLoadout.DestinyCharacterId);
                }
                using (EmissaryDbContext dbContext = new EmissaryDbContext(options)) {
                    LoadoutDao loadoutDao = new LoadoutDao(dbContext);
                    loadoutDao.AddOrUpdateLoadout(loadout2);
                }
                using (EmissaryDbContext dbContext = new EmissaryDbContext(options)) {
                    Assert.AreEqual(2, dbContext.Loadouts.Count());
                    Loadout foundLoadout = dbContext.Loadouts.Where(l => l.LoadoutName == loadoutName && l.DiscordId == discordId && l.DestinyCharacterId == 69).AsQueryable().FirstOrDefault();
                    Assert.AreEqual(69, foundLoadout.DestinyCharacterId);
                }
            }
        }
        static VLoadout GetTestLoadout()
        {
            var loadout = new Loadout();

            loadout.ShouldRestrict = false;
            var perks = (PerkCollection)loadout.Perks;

            perks.MaximumPotiential.DesiredLevel  = 8;
            perks.MaximumPotiential2.DesiredLevel = 10;
            perks.MaximumPotiental3.DesiredLevel  = 10;
            perks.MaximumPotential4.DesiredLevel  = 10;

            return(loadout);
        }
Exemplo n.º 26
0
    private InvItemData GetShipItemDataFromLoadout(Loadout loadout)
    {
        Debug.Log("Creating ship item " + loadout.ShipID);
        Item shipItem = new Item(GameManager.Inst.ItemManager.AllItemStats["ship_" + loadout.ShipID]);

        shipItem.DisplayName = GameManager.Inst.ItemManager.AllShipStats[loadout.ShipID].DisplayName;
        shipItem.Description = loadout.LoadoutID;
        InvItemData shipInvItem = new InvItemData();

        shipInvItem.Item     = shipItem;
        shipInvItem.Quantity = 1;

        return(shipInvItem);
    }
Exemplo n.º 27
0
 public void UpdateLoad(Loadout load)
 {
     if (load != null)
     {
         UpdateRunes(load.Runes);
         UpdateSets(load.Sets, !load.SetsFull);
     }
     else
     {
         UpdateRunes();
         UpdateSets();
     }
     runeDial.Loadout = load;
 }
Exemplo n.º 28
0
        public void EquipLoadout_AccessTokenExpired_ShouldEmitRequestAuthorizationEvent()
        {
            IConfiguration        config               = Mock.Of <IConfiguration>();
            IBungieApiService     bungieApiService     = Mock.Of <IBungieApiService>();
            IManifestDao          manifestDao          = Mock.Of <IManifestDao>();
            EmissaryDbContext     dbContext            = Mock.Of <EmissaryDbContext>();
            IEmissaryDao          emissaryDao          = Mock.Of <IEmissaryDao>();
            IAuthorizationService authorizationService = Mock.Of <IAuthorizationService>();


            ulong        discordId             = 221313820847636491;
            long         destinyProfileId      = 4611686018467260757;
            int          destinyMembershipType = BungieMembershipType.Steam;
            string       accessToken           = "expired-access-token";
            EmissaryUser user = new EmissaryUser(discordId, destinyProfileId, destinyMembershipType);

            ProfileCharactersResponse charactersResponse = new ProfileCharactersResponse();
            DestinyCharacter          titan = new DestinyCharacter(2305843009504575107, DateTimeOffset.Parse("2019-12-24T22:40:31Z"), destinyProfileId, BungieMembershipType.Steam);

            charactersResponse.Characters.Add(titan.CharacterId, titan);

            long        destinyCharacterId = 2305843009504575107;
            uint        izanagiHash        = 3211806999;
            long        izanagiInstanceId  = 6917529135183883487;
            DestinyItem izanagiItem        = new DestinyItem(izanagiInstanceId, "Izanagi's Burden", new List <string>()
            {
                "Weapon", "Kinetic Weapon", "Sniper Rifle"
            }, izanagiHash, new List <uint>()
            {
                2, 1, 10
            }, "Exotic");
            Loadout loadout = new Loadout(discordId, destinyCharacterId, "raid", new List <DestinyItem>()
            {
                izanagiItem
            });

            Mock.Get(emissaryDao).Setup(m => m.GetUserByDiscordId(It.Is <ulong>(u => u == discordId))).Returns(user);
            Mock.Get(bungieApiService).Setup(m => m.GetProfileCharacters(It.IsAny <ProfileCharactersRequest>())).Returns(charactersResponse);
            Mock.Get(emissaryDao).Setup(m => m.GetLoadout(discordId, destinyCharacterId, "last wish raid")).Returns(loadout);
            Mock.Get(bungieApiService).Setup(m => m.EquipItems(It.IsAny <EquipItemsRequest>())).Throws(new BungieApiException("Unauthorized: Access is denied due to invalid credentials."));

            IEmissary emissary     = new Emissary(config, bungieApiService, manifestDao, dbContext, emissaryDao, authorizationService);
            bool      eventEmitted = false;

            emissary.RequestAuthorizationEvent += (discordId) => eventEmitted = true;
            EmissaryResult result = emissary.EquipLoadout(discordId, "last wish raid");

            Assert.IsFalse(result.Success);
            Assert.IsTrue(eventEmitted);
        }
Exemplo n.º 29
0
        public void CheckSetsTest()
        {
            Loadout load = new Loadout();

            load.AddRune(TestData.Rune1());
            load.AddRune(TestData.Rune2());
            load.AddRune(TestData.Rune3());
            load.AddRune(TestData.Rune4());
            load.AddRune(TestData.Rune5());
            load.AddRune(TestData.Rune6());

            Assert.IsTrue(load.Sets.Contains(RuneSet.Energy));
            Assert.IsTrue(load.Sets.Contains(RuneSet.Swift));
        }
    public void RecreateRunnerFromSaveData(SaveRunner savedRunner)
    {
        id               = savedRunner.id;
        locked           = savedRunner.locked;
        bio              = savedRunner.bio;
        runnerName       = savedRunner.runnerName;
        maximumHealth    = savedRunner.maximumHealth;
        currentHealth    = savedRunner.currentHealth;
        maximumEnergy    = savedRunner.maximumEnergy;
        currentEnergy    = savedRunner.currentEnergy;
        startingHandSize = savedRunner.handSize;

        loadout = CreateInstance <Loadout>();
    }
Exemplo n.º 31
0
        public void SetStatTest()
        {
            Loadout load = new Loadout();

            load.AddRune(TestData.Rune1());
            load.AddRune(TestData.Rune2());
            load.AddRune(TestData.Rune3());
            load.AddRune(TestData.Rune4());
            load.AddRune(TestData.Rune5());
            load.AddRune(TestData.Rune6());

            Assert.AreEqual(15, load.SetStat(Attr.HealthPercent));
            Assert.AreEqual(25, load.SetStat(Attr.SpeedPercent));
        }
    // Setup Character
    private void SetupCharacter(string newRunnerName, int newMaxHealth, int newCurrentHealth, int newMaxEnergy, int newCurrentEnergy, int newStartingHandSize, string newBio)
    {
        runnerName = newRunnerName;

        maximumHealth = newMaxHealth;
        currentHealth = newCurrentHealth;
        maximumEnergy = newMaxEnergy;
        currentEnergy = newCurrentEnergy;
        bio           = newBio;

        startingHandSize = newStartingHandSize;

        loadout = CreateInstance <Loadout>();
        loadout.SetupInitialLoadout(id);
    }
Exemplo n.º 33
0
//--------------------------------------------------------------------------------------------

	void Start()
	{
		mSavedGameManager = GameObject.FindGameObjectWithTag("SaveManager").GetComponent<SavedGameManager>();

		//if the current game ptr is somehow bad, return to the main menu
		if(mSavedGameManager.getCurrentGame() == null)
		{
			Debug.Log("CURRENT GAME PTR NULL: RETURNING TO MAIN MENU");

			//TODO -- spawn error message, return to main menu
		}

		//TODO -- enable / disable loadout buttons using current game ptr's avaialble loadouts

		//sanity check -- null any current loadout data on the current game ptr
		mSavedGameManager.getCurrentGame().setCurrentLoadout(null);
		mCurrentLoadout = new Loadout();
	}
Exemplo n.º 34
0
        public void Create(Loadout loadout)
        {
            using (var db = new Pb.Dal.EfEntities())
            {
                db.Loadouts.Add(new Pb.Dal.Loadout()
                {
                    Created = DateTime.Now,
                    Deleted = false,
                    Id = loadout.Id,
                    ImageUrl = loadout.ImageUrl,
                    Modified = DateTime.Now,
                    Name = loadout.Name,
                    PlayerId = loadout.PlayerId
                });

                db.SaveChanges();
            }
        }
//--------------------------------------------------------------------------------------------

	private void initDataPanel(
		Loadout.LoadoutChasis ci, 
		Loadout.LoadoutPrimary pi, 
		Loadout.LoadoutSecondary si,
		bool isChoiceUnlocked = false)
	{
		Text[] texts = mDataPanel.GetComponentsInChildren<Text>();
		int index = 0;

		if(ci != Loadout.LoadoutChasis.NULL)
		{
			index = (int)ci;
		}
		else if(pi != Loadout.LoadoutPrimary.NULL)
		{
			index = (int)pi + 5;
		}
		else if(si != Loadout.LoadoutSecondary.NULL)
		{
			index = (int)si + 10;
		}
		else
		{
			index = 15;
		}

		//if the element is unlocked...
		if(isChoiceUnlocked)
		{
			//set name, description, blank unlock criteria
			texts[0].text = elementStrings[index, 0];
			texts[1].text = elementStrings[index, 1];
			texts[2].text = "-";

			dataPanelFirstIndex = index * 3;
		}

		//otherwise, if the element is locked...
		else
		{
			//set blank name, blank description, unlock criteria
			texts[0].text = "-";
			texts[1].text = "-";
			texts[2].text = elementStrings[index, 2];

			dataPanelFirstIndex = 45;
		}
	}
//--------------------------------------------------------------------------------------------

	void Start()
	{
		mSavedGameManager = SavedGameManager.createOrLoadSavedGameManager(gmPrefab).GetComponent<SavedGameManager>();

		//if the current game ptr is somehow bad, return to the main menu
		if(mSavedGameManager.getCurrentGame() == null)
		{
			Debug.Log("ERROR: CURRENT GAME PTR NULL -- LOADING MAIN MENU");
			SceneManager.LoadScene((int)SceneIndex.MAIN_MENU);
			return;
		}

		//init resource arrays
		buttonSprites = Resources.LoadAll<Sprite>("GUI_Assets/Menu_Loadouts");
		iconSprites = Resources.LoadAll<Sprite>("GUI_Assets/LoadoutIcons_new");

		elementStrings = new string[16, 3]		//name, description, unlock
		{
			{"Exterminator", 		"Standard issue chassis. Takes 3 hits.", 									"-"},
			{"Final", 				"Breaks after a single hit, but radiates a mysterious energy...", 			"Complete Tutorial 3 to unlock!"},
			{"Booster", 			"Slower than the Exterminator, but Precision gives you a speed boost.", 	"Complete Level 1-1 to unlock!"},
			{"Shrink", 				"Slower than the Exterminator, but your hitbox in Precision is SMALL.", 	"Complete Level 2-2 to unlock!"},
			{"Quick", 				"Quicker but weaker than the Exterminator. Secondaries recharge faster.", 	"Complete Level 3-3 to unlock!"},

			{"Bug Repellants", 		"Standard issue anti-bug bullets.", 										"-"},
			{"No-Miss Swatter", 	"Fire and forget! Automatically attacks the nearest enemy.", 				"Complete Tutorial 2 to unlock!"},
			{"Precision Pesticide", "Laser that sweeps from side to side as you move.", 						"Complete Level 1-2 to unlock!"},
			{"Citronella Flame", 	"Shoots a short, but powerful cone of fire.", 								"Complete Level 2-1 to unlock!"},
			{"Volt Lantern", 		"Powerful forward and rear facing lasers.", 								"Complete Level 3-2 to unlock!"},

			{"EMP Counter", 		"Disrupts enemy firing systems and clears the area of bullets.", 			"-"},
			{"Phasing System", 		"Renders your ship invulnerable for a short time.", 						"Complete Tutorial 1 to unlock!"},
			{"Holo-Duplicate", 		"Deploys a hologram of your ship that enemies attack instead.", 			"Complete Level 1-3 to unlock!"},
			{"Mosquito Tesla Coil", "Hold to absorb bullets. Release to send damage back. Does not recharge!", 	"Complete Level 2-3 to unlock!"},
			{"Freeze Ray", 			"Starts a chain reaction that freezes nearby enemy bullets.", 				"Complete Level 3-1 to unlock!"},

			{"-", "-", "-"}
		};

		//sanity check -- null any current loadout data on the current game ptr
		mSavedGameManager.getCurrentGame().setCurrentLoadout(null);
		mCurrentLoadout = new Loadout();

		//initialize the default loadout
		mCurrentLoadout.setChasis(Loadout.LoadoutChasis.EXTERMINATOR);
		mCurrentLoadout.setPrimary(Loadout.LoadoutPrimary.REPEL);
		mCurrentLoadout.setSecondary(Loadout.LoadoutSecondary.EMP);

		//init menu as though chassis button has been clicked
		chassisButton.Select();
		handleChassisButtonClicked();

		StartCoroutine(mScreenFader.FadeFromBlack());
		StartCoroutine(handleIconAnimation());
	}
Exemplo n.º 37
0
 private static IEnumerable<Loadout.Entry> EnumerateRequired(Loadout.Entry[][] arrays)
 {
     Loadout.<EnumerateRequired>c__Iterator3D variable = null;
     return variable;
 }
Exemplo n.º 38
0
	//JUSTIN

	// Use this for initialization
	void Start()
	{
		scoreHandle = GameObject.Find("Score").GetComponent<Score>();	//JUSTIN

		loadout = GameObject.FindGameObjectWithTag ("SaveManager").GetComponent<SavedGameManager> ().getCurrentGame ().getCurrentLoadout ();
		shrinkCollider = GetComponent<CircleCollider2D>(); 
		setLoadout ();

		hitCool = false;
		dead = false;

		//determines chassis health type
		if (chassisExterminator || chassisBooster || chassisShrink) {
			health = 3;
		} 
		else if (chassisQuick)
		{
			health = 2;
		} 
		else if (chassisFinal)
		{
			if((SceneIndex)SceneManager.GetActiveScene().buildIndex == SceneIndex.GAMEPLAY_4_2)
			{
				health = 5;
			}
			else
			{
				health = 1;
			}
		}

		//determines chassis movement speed type
		if (chassisExterminator || chassisFinal)
		{
			moveSpeed = 10f;
			precisionSpeed = 6f;
		} 
		else if (chassisBooster)
		{
			moveSpeed = 8f;
			precisionSpeed = 14f;
		} 
		else if (chassisShrink) 
		{
			moveSpeed = 6f;
			precisionSpeed = 4f;
		} 
		else if (chassisQuick)
		{
			moveSpeed = 12f;
			precisionSpeed = 8f;
		}



		hBorder = GameObject.FindGameObjectWithTag ("Border").GetComponent<HealthBorder> ();
		sf = GameObject.Find ("ScreenFade").GetComponent<ScreenFade> ();	
		hBorder.health = health;
		if (health == 5) {
			hBorder.fiveHealth = true;
		}
	}
//--------------------------------------------------------------------------------------------

	public void handleChoiceButtonMouseOver(
		Loadout.LoadoutChasis ci, 
		Loadout.LoadoutPrimary pi, 
		Loadout.LoadoutSecondary si,
		bool isChoiceUnlocked)
	{
		initDataPanel(ci, pi, si, isChoiceUnlocked);
	}
//--------------------------------------------------------------------------------------------

	public void handleChoiceButtonClicked(Loadout.LoadoutChasis ci, Loadout.LoadoutPrimary pi, Loadout.LoadoutSecondary si)
	{
		//CHASSIS
		if(ci != Loadout.LoadoutChasis.NULL)
		{
			if(!mSavedGameManager.getCurrentGame().unlockedChasis[(int)ci]) return;

			mCurrentLoadout.setChasis(ci);
			Debug.Log("NEW CHASSIS SELECTED: " + ci);

			chassisChoiceFirstIndex = (int)ci * 3;
			handlePrimaryButtonClicked();
		}

		//PRIMARY
		else if(pi != Loadout.LoadoutPrimary.NULL)
		{
			if(!mSavedGameManager.getCurrentGame().unlockedPrimary[(int)pi]) return;

			mCurrentLoadout.setPrimary(pi);
			Debug.Log("NEW PRIMARY SELECTED: " + pi);

			primaryChoiceFirstIndex = ((int)pi + 5) * 3;
			handleSecondaryButtonClicked();
		}

		//SECONDARY
		else if(si != Loadout.LoadoutSecondary.NULL)
		{
			if(!mSavedGameManager.getCurrentGame().unlockedSecondary[(int)si]) return;

			mCurrentLoadout.setSecondary(si);
			Debug.Log("NEW SECONDARY SELECTED: " + si);

			secondaryChoiceFirstIndex = ((int)si + 10) * 3;
		}
	}
Exemplo n.º 41
0
 private static IEnumerable<Inventory.Addition> EnumerateAdditions(Loadout.Entry[][] arrays)
 {
     Loadout.<EnumerateAdditions>c__Iterator3C variable = null;
     return variable;
 }
Exemplo n.º 42
0
 private void GetMinimumRequirementArray(ref Loadout.Entry[] array, bool forceUpdate)
 {
     if (forceUpdate || array == null)
     {
         array = (new List<Loadout.Entry>(Loadout.EnumerateRequired(this.GetEntryArrays()))).ToArray();
     }
 }
Exemplo n.º 43
0
 private void HandleLoadoutDeleted(Loadout loadout, string externalUserId)
 {
     var e = new LoadoutDeleted(loadout.Id, loadout.Name);
     _eventBuilder.Build(e, externalUserId);
     _logger.InformationDefault(e);
 }
Exemplo n.º 44
0
//--------------------------------------------------------------------------------------------

	public SavedGame(string name)
	{
		mName = name;

		mSelectedLevel = SceneIndex.NULL;
		mCurrentLoadout = null;

		initLevelCompletionArray(SavedGameManager.NUM_GAMEPLAY_LEVELS);
		initHighScoreArray(SavedGameManager.NUM_GAMEPLAY_LEVELS);
		initFinalChassisArray(SavedGameManager.NUM_GAMEPLAY_LEVELS);

		initLoadoutArrays(Loadout.NUM_LOADOUTS);
	}
Exemplo n.º 45
0
        private void HandleLoadoutUpdated(Loadout loadout, string name, string externalUserId)
        {
            var copiedLoadout = _copier.Copy(loadout);
            copiedLoadout.Name = name;

            var e = new LoadoutUpdated(loadout.Id, name);
            _eventBuilder.Build(e, externalUserId, loadout, copiedLoadout);

            _logger.InformationDefault(e);
        }
Exemplo n.º 46
0
	public void setCurrentLoadout(Loadout cl){ mCurrentLoadout = cl; }
Exemplo n.º 47
0
//--------------------------------------------------------------------------------------------

	public SavedGame(string name)
	{
		mName = name;

		mSelectedLevel = SceneIndex.NULL;
		mCurrentLoadout = null;
	}