Exemplo n.º 1
0
        private static void SetPreviewWeaponNames(FindLogic.Combo.ComboInfo info, Dictionary <ulong, ulong> weaponReplacements, STU_A0872511[] entities, int index)
        {
            if (entities == null)
            {
                return;
            }
            foreach (STU_A0872511 weaponEntity in entities)
            {
                FindLogic.Combo.Find(info, weaponEntity.m_entityDefinition, weaponReplacements);

                if (weaponEntity.m_loadout == 0)
                {
                    continue;
                }
                Loadout loadout = Loadout.GetLoadout(weaponEntity.m_loadout);
                if (loadout == null)
                {
                    continue;
                }
                info.SetEntityName(weaponEntity.m_entityDefinition, $"{loadout.Name}-{teResourceGUID.Index(weaponEntity.m_entityDefinition)}");

                if ((weaponReplacements == null || index == 0) && info.m_entities.TryGetValue(weaponEntity.m_entityDefinition, out var entity) && info.m_models.TryGetValue(entity.m_modelGUID, out var model))
                {
                    foreach (var modellook in model.m_modelLooks)
                    {
                        info.SetModelLookName(modellook, $"{(STUWeaponType) index:G}-{teResourceGUID.Index(modellook):X}");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void SavePreviewWeapons(FindLogic.Combo.ComboInfo info, Dictionary <ulong, ulong> weaponReplacements, STU_A0872511[] entities)
        {
            if (entities == null)
            {
                return;
            }
            foreach (STU_A0872511 weaponEntity in entities)
            {
                FindLogic.Combo.Find(info, weaponEntity.m_entityDefinition, weaponReplacements);

                if (weaponEntity.m_loadout == 0)
                {
                    continue;
                }
                Loadout loadout = Loadout.GetLoadout(weaponEntity.m_loadout);
                if (loadout == null)
                {
                    continue;
                }
                info.SetEntityName(weaponEntity.m_entityDefinition, $"{loadout.Name}-{teResourceGUID.Index(weaponEntity.m_entityDefinition)}");
            }
        }
Exemplo n.º 3
0
        public async Task LoadoutTask(LoadoutAction action = LoadoutAction.Show, [Remainder] string loadoutName = "")
        {
            if (!(Context.User is SocketGuildUser sgu))
            {
                return;
            }

            var user = EntityConverter.ConvertUser(sgu);

            switch (action)
            {
            case LoadoutAction.Show:
                var embed = new EmbedBuilder();
                if (user.Loadouts.loadouts.Count > 0)
                {
                    foreach (var item in user.Loadouts.loadouts)
                    {
                        var items = item.Gear.Count > 0 ? string.Join("", item.Gear.Select(i => user.Inv.GetItem(i)?.Icon ?? "-")) : "no gear";
                        var djinn = item.Djinn.Count > 0 ? string.Join("", item.Djinn.Select(d => user.DjinnPocket.GetDjinn(d)?.Emote ?? "-")) : "no Djinn";
                        embed.AddField(item.LoadoutName,
                                       $"{ElementIcons[item.Element]} {item.ClassSeries}\n" +
                                       $"{items}\n" +
                                       $"{djinn}"
                                       , inline: true);
                    }
                }
                else
                {
                    embed.WithDescription("No loadouts saved.");
                }
                _ = ReplyAsync(embed: embed.Build());
                break;

            case LoadoutAction.Save:
                if (loadoutName.IsNullOrEmpty())
                {
                    return;
                }

                user.Loadouts.RemoveLoadout(loadoutName);
                if (user.Loadouts.loadouts.Count >= 6)
                {
                    _ = ReplyAsync("Loadout limit of 6 reached.");
                    return;
                }
                var newLoadout = Loadout.GetLoadout(user);
                newLoadout.LoadoutName = loadoutName;
                user.Loadouts.SaveLoadout(newLoadout);
                UserAccountProvider.StoreUser(user);
                _ = LoadoutTask(LoadoutAction.Show);
                break;

            case LoadoutAction.Load:
                var loadedLoadout = user.Loadouts.GetLoadout(loadoutName);
                if (loadedLoadout != null)
                {
                    await GiveElementRole(sgu, loadedLoadout.Element);
                    await ChangeElement(user, loadedLoadout.Element);

                    loadedLoadout.ApplyLoadout(user);
                    UserAccountProvider.StoreUser(user);
                    _ = Status();
                }
                break;

            case LoadoutAction.Remove:
                if (loadoutName.IsNullOrEmpty())
                {
                    return;
                }

                user.Loadouts.RemoveLoadout(loadoutName);
                UserAccountProvider.StoreUser(user);
                _ = LoadoutTask(LoadoutAction.Show);
                break;
            }
            await Task.CompletedTask;
        }
Exemplo n.º 4
0
        public async Task LoadoutTask(LoadoutAction action = LoadoutAction.Show, [Remainder] string loadoutName = "")
        {
            var user = UserAccounts.GetAccount(Context.User);

            switch (action)
            {
            case LoadoutAction.Show:
                var embed = new EmbedBuilder();
                if (user.Loadouts.loadouts.Count > 0)
                {
                    foreach (var item in user.Loadouts.loadouts)
                    {
                        embed.AddField(item.LoadoutName, $"{ElementIcons[item.Element]} {item.ClassSeries}\n" +
                                       $"{string.Join("", item.Gear.Select(i => user.Inv.GetItem(i).Icon))}\n" +
                                       $"{string.Join("", item.Djinn.Select(d => user.DjinnPocket.GetDjinn(d)?.Emote))}", inline: true);
                    }
                }
                else
                {
                    embed.WithDescription("No loadouts saved.");
                }
                _ = ReplyAsync(embed: embed.Build());
                break;

            case LoadoutAction.Save:
                if (loadoutName.IsNullOrEmpty())
                {
                    return;
                }
                if (user.Loadouts.loadouts.Count >= 6)
                {
                    return;
                }
                var newLoadout = Loadout.GetLoadout(user);
                newLoadout.LoadoutName = loadoutName;
                user.Loadouts.SaveLoadout(newLoadout);
                _ = LoadoutTask(LoadoutAction.Show);
                UserAccounts.SaveAccounts();
                break;

            case LoadoutAction.Load:
                var loadedLoadout = user.Loadouts.GetLoadout(loadoutName);
                if (loadedLoadout != null)
                {
                    await ChooseElement(loadedLoadout.Element);

                    loadedLoadout.ApplyLoadout(user);
                    _ = Status();
                }
                break;

            case LoadoutAction.Remove:
                if (loadoutName.IsNullOrEmpty())
                {
                    return;
                }
                user.Loadouts.RemoveLoadout(loadoutName);
                _ = LoadoutTask(LoadoutAction.Show);
                break;
            }
            await Task.CompletedTask;
        }