Beispiel #1
0
 public WorldGenSpawnConditions Clone()
 {
     return(new WorldGenSpawnConditions()
     {
         Group = Group,
         MinLightLevel = MinLightLevel,
         MaxLightLevel = MaxLightLevel,
         LightLevelType = LightLevelType,
         HerdSize = HerdSize?.Clone(),
         Companions = Companions?.Clone() as AssetLocation[],
         InsideBlockCodes = InsideBlockCodes?.Clone() as AssetLocation[],
         RequireSolidGround = RequireSolidGround,
         TryOnlySurface = TryOnlySurface,
         MinTemp = MinTemp,
         MaxTemp = MaxTemp,
         MinRain = MinRain,
         MaxRain = MaxRain,
         ClimateValueMode = ClimateValueMode,
         MinForest = MinForest,
         MaxForest = MaxForest,
         MinShrubs = MinShrubs,
         MaxShrubs = MaxShrubs,
         MinForestOrShrubs = MinForestOrShrubs,
         TriesPerChunk = TriesPerChunk?.Clone()
     });
 }
        private void RenumberCompanions()
        {
            int  companionId       = 1;
            bool refreshCompanions = false;

            foreach (var companion in Companions.OrderBy(x => x.Id))
            {
                if (companion.Id != companionId)
                {
                    refreshCompanions = true;
                }

                companion.Id = companionId;
                companionId++;
            }

            if (refreshCompanions)
            {
                listCompanions.Items.Clear();
                foreach (var obj in Companions)
                {
                    var name = string.IsNullOrEmpty(obj.Name) ?
                               " - Companion" :
                               " - " + obj.Name;

                    listCompanions.Items.Add(new ListBoxItem
                    {
                        Tag     = obj.Id,
                        Content = obj.Id + name
                    });
                }
            }
        }
Beispiel #3
0
 public void Recruit()
 {
     if (CurrentLocation.Location.PossibleActions?.Contains(Enums.LocationActions.Recruit) == true)
     {
         Companions.Add(Characters.Goblin_Swordsman_LeatherArmor());
     }
 }
Beispiel #4
0
        public static async Task PocceCompanion()
        {
            var pocce = Config.PocceList[API.GetRandomIntInRange(0, Config.PocceList.Length)];
            var ped   = await Companions.SpawnHuman(pocce);

            API.SetPedAsNoLongerNeeded(ref ped);
        }
Beispiel #5
0
        public static async Task PetCompanion()
        {
            int player = Game.Player.Character.Handle;

            if (API.IsPedInAnyHeli(player))
            {
                Hud.Notification("Don't spawn that poor pet on a heli");
                return;
            }
            else if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (API.GetVehicleDashboardSpeed(vehicle) > 0.1f)
                {
                    Hud.Notification("Player is in a moving vehicle");
                    return;
                }
            }

            var ped = await Peds.Spawn(Config.PetList, 28);

            Companions.Add(ped);
            await Peds.Arm(ped, null);

            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Beispiel #6
0
        public static async Task PocceCompanion()
        {
            int ped;
            int player = Game.Player.Character.Handle;

            if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (Vehicles.GetFreeSeat(vehicle, out int seat))
                {
                    var pocce = Config.PocceList[API.GetRandomIntInRange(0, Config.PocceList.Length)];
                    await Common.RequestModel(pocce);

                    ped = API.CreatePedInsideVehicle(vehicle, 26, pocce, seat, true, false);
                }
                else if (API.GetEntitySpeed(vehicle) > 0.1f)
                {
                    Hud.Notification("Player is in a moving vehicle and there are no free seats");
                    return;
                }
                else
                {
                    ped = await Peds.Spawn(Config.PocceList);
                }
            }
            else
            {
                ped = await Peds.Spawn(Config.PocceList);
            }

            Companions.Add(ped);
            await Peds.Arm(ped, Config.WeaponList);

            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Beispiel #7
0
    public void RetreatFromBattle()
    {
        for (int i = 0; i < Controls.Count; i++)
        {
            if (Controls[i].PrisonerUnit.Character.IsMonster == false)
            {
                var heroInfo = RaidSceneManager.Raid.RaidParty.HeroInfo.Find(info =>
                                                                             info.Hero == Controls[i].PrisonerUnit.Character as Hero);
                heroInfo.IsAlive     = false;
                heroInfo.DeathRecord = new DeathRecord()
                {
                    HeroClassIndex = heroInfo.Hero.ClassIndexId,
                    HeroName       = heroInfo.Hero.Name,
                    KillerName     = Controls[i].ControllUnit.Character.Name,
                    ResolveLevel   = heroInfo.Hero.Resolve.Level,
                    Factor         = DeathFactor.AttackMonster,
                };
                Controls[i].PrisonerUnit.Formation.DeleteUnit(Controls[i].PrisonerUnit);
                if (RaidSceneManager.RaidPanel.SelectedUnit == Controls[i].PrisonerUnit)
                {
                    if (RaidSceneManager.Formations.heroes.party.Units.Count > 0)
                    {
                        RaidSceneManager.Formations.heroes.party.Units[0].OverlaySlot.UnitSelected();
                    }
                }
            }
        }
        Controls.Clear();

        for (int i = 0; i < Captures.Count; i++)
        {
            if (Captures[i].PrisonerUnit.Character.IsMonster == false)
            {
                var heroInfo = RaidSceneManager.Raid.RaidParty.HeroInfo.Find(info =>
                                                                             info.Hero == Captures[i].PrisonerUnit.Character as Hero);
                heroInfo.IsAlive     = false;
                heroInfo.DeathRecord = new DeathRecord()
                {
                    HeroClassIndex = heroInfo.Hero.ClassIndexId,
                    HeroName       = heroInfo.Hero.Name,
                    KillerName     = Captures[i].CaptorUnit.Character.Name,
                    ResolveLevel   = heroInfo.Hero.Resolve.Level,
                    Factor         = DeathFactor.CaptorMonster,
                };
                Captures[i].PrisonerUnit.Formation.DeleteUnit(Captures[i].PrisonerUnit);
                if (RaidSceneManager.RaidPanel.SelectedUnit == Captures[i].PrisonerUnit)
                {
                    if (RaidSceneManager.Formations.heroes.party.Units.Count > 0)
                    {
                        RaidSceneManager.Formations.heroes.party.Units[0].OverlaySlot.UnitSelected();
                    }
                }
            }
        }
        Captures.Clear();
        Companions.Clear();

        FinishBattle();
        Round.HeroAction = HeroTurnAction.Retreat;
    }
Beispiel #8
0
        public override int GetHashCode()
        {
            int num = 1;

            if (AccountData)
            {
                num ^= AccountData.GetHashCode();
            }
            if (Occupation)
            {
                num ^= Occupation.GetHashCode();
            }
            if (HeroData)
            {
                num ^= HeroData.GetHashCode();
            }
            if (Decks)
            {
                num ^= Decks.GetHashCode();
            }
            if (Companions)
            {
                num ^= Companions.GetHashCode();
            }
            if (Weapons)
            {
                num ^= Weapons.GetHashCode();
            }
            if (_unknownFields != null)
            {
                num ^= ((object)_unknownFields).GetHashCode();
            }
            return(num);
        }
        private void NewCompanion()
        {
            var newCompanion = new Companion();

            newCompanion.Id = 1;
            if (Companions.Any())
            {
                newCompanion.Id = Companions.Max(x => x.Id) + 1;
            }

            Companions.Add(newCompanion);
            _currentCompanion = newCompanion;
            var newCompanionListItem = new ListBoxItem
            {
                Tag     = newCompanion.Id,
                Content = newCompanion.Id + " - Companion"
            };

            listCompanions.Items.Add(newCompanionListItem);
            foreach (ListBoxItem item in listCompanions.Items)
            {
                var tag = (int)item.Tag;
                if (tag == newCompanion.Id)
                {
                    listCompanions.SelectedItem = item;
                }
            }

            LoadCompanion();
            SaveCompanions();
        }
Beispiel #10
0
        public static async Task PetCompanion()
        {
            var pet = Config.PetList[API.GetRandomIntInRange(0, Config.PetList.Length)];
            var ped = await Companions.SpawnNonhuman(pet);

            API.SetPedAsNoLongerNeeded(ref ped);
        }
Beispiel #11
0
 /// <summary>
 /// Creates a deep copy of this set of spawn conditions.
 /// </summary>
 /// <returns></returns>
 public RuntimeSpawnConditions Clone()
 {
     return(new RuntimeSpawnConditions()
     {
         Group = Group,
         MinLightLevel = MinLightLevel,
         MaxLightLevel = MaxLightLevel,
         LightLevelType = LightLevelType,
         HerdSize = HerdSize?.Clone(),
         Companions = Companions?.Clone() as AssetLocation[],
         InsideBlockCodes = InsideBlockCodes?.Clone() as AssetLocation[],
         RequireSolidGround = RequireSolidGround,
         TryOnlySurface = TryOnlySurface,
         MinTemp = MinTemp,
         MaxTemp = MaxTemp,
         MinRain = MinRain,
         MaxRain = MaxRain,
         MinForest = MinForest,
         MaxForest = MaxForest,
         MinShrubs = MinShrubs,
         MaxShrubs = MaxShrubs,
         ClimateValueMode = ClimateValueMode,
         MinForestOrShrubs = MinForestOrShrubs,
         Chance = Chance,
         MaxQuantity = MaxQuantity,
         MinDistanceToPlayer = MinDistanceToPlayer
     });
 }
        private void Build()
        {
            OrbitNum = ComOrbit();

            if (NumOrbits > (OrbitNum / 2))
            {
                NumOrbits = OrbitNum / 2;
            }

            if (OrbitNum == 0)
            {
                Orbits[0].OrbitalType = Orbit.OrbitType.UNAVAILABLE;
            }

            if (OrbitNum == FAR_ORBIT)
            {
                Range  = Common.d6() * 1000;
                SysNat = StarSystem.Nature(true);
                if (SysNat == StarSystem.SystemType.BINARY)
                {
                    NumCompanions = 1;
                    Companions.Add(new CompanionStar(_configuration));
                    AvaialbleOribits(0);
                }
            }
        }
Beispiel #13
0
 protected IFighter GetFighter(double fighterId)
 {
     return(Monsters.Find(x => x.Id == fighterId) != null
         ? Monsters.FirstOrDefault(m => m.Id == fighterId)
         : (Companions.Find(x => x.Id == fighterId) != null
             ? Companions.FirstOrDefault(c => c.Id == fighterId)
             : Fighters.FirstOrDefault(f => f.Id == fighterId)));
 }
Beispiel #14
0
 public CompanionState(Companions companion, string greeting, int[] talkIndex, string lastReply, int numberOfChanges, DateTime lastChangeTime)
 {
     Companion       = companion;
     Greeting        = greeting;
     TalkIndex       = talkIndex;
     LastReply       = lastReply;
     NumberOfChanges = numberOfChanges;
     LastChangeTime  = lastChangeTime;
 }
Beispiel #15
0
        /// <summary>
        /// Gets the companion list
        /// </summary>
        /// <returns>A tuple containing lists of all companion data</returns>
        public async Task <(List <XivMinion> MinionList, List <XivMount> MountList, List <XivPet> PetList, List <XivMount> OrnamentList)> GetCompanionList()
        {
            var companions = new Companions(_gameDirectory, GetLanguage());

            if (GetLanguage() == XivLanguage.Chinese)
            {
                return(await companions.GetMinionList(), await companions.GetMountList(), await companions.GetPetList(), new List <XivMount>());
            }
            return(await companions.GetMinionList(), await companions.GetMountList(), await companions.GetPetList(), await companions.GetOrnamentList());
        }
    public void UpdateFromBattleGround(BattleGround battleGround)
    {
        RoundNumber = battleGround.Round.RoundNumber;
        RoundStatus = battleGround.RoundStatus;
        TurnType    = battleGround.Round.TurnType;
        TurnStatus  = battleGround.TurnStatus;

        HeroAction       = battleGround.Round.HeroAction;
        SelectedUnitId   = battleGround.Round.SelectedUnit == null ? -1 : battleGround.Round.SelectedUnit.CombatInfo.CombatId;
        SelectedTargetId = battleGround.Round.SelectedTarget == null ? -1 : battleGround.Round.SelectedTarget.CombatInfo.CombatId;

        BattleStatus   = battleGround.BattleStatus;
        SurpriseStatus = battleGround.SurpriseStatus;

        StallingRoundNumber = battleGround.StallingRoundNumber;

        OrderedUnitsCombatIds.Clear();
        for (int i = 0; i < battleGround.Round.OrderedUnits.Count; i++)
        {
            OrderedUnitsCombatIds.Add(battleGround.Round.OrderedUnits[i].CombatInfo.CombatId);
        }

        CombatIds.Clear();
        CombatIds.AddRange(battleGround.CombatIds);
        Companions.Clear();
        for (int i = 0; i < battleGround.Companions.Count; i++)
        {
            Companions.Add(battleGround.Companions[i].GetHashCode());
        }

        Captures.Clear();
        RemovedUnits.Clear();
        for (int i = 0; i < battleGround.Captures.Count; i++)
        {
            Captures.Add(battleGround.Captures[i].GetHashCode());
            if (battleGround.Captures[i].RemoveFromParty)
            {
                var newRemovedUnitData = new FormationUnitSaveData();
                newRemovedUnitData.UpdateFromUnit(battleGround.Captures[i].PrisonerUnit);
                RemovedUnits.Add(newRemovedUnitData);
            }
        }

        Controls.Clear();
        for (int i = 0; i < battleGround.Controls.Count; i++)
        {
            Controls.Add(battleGround.Controls[i].GetHashCode());
        }

        BattleLoot    = battleGround.BattleLoot;
        LastDamaged   = battleGround.LastDamaged;
        LastSkillUsed = battleGround.LastSkillUsed == null ? "" : battleGround.LastSkillUsed;

        MonsterFormation.UpdateFormation(battleGround.MonsterFormation);
    }
Beispiel #17
0
        public bool CompanionWith(string name, string mode)
        {
            General other = Engine.GetGeneral(name, mode);

            if (other == null || !Engine.GetMode(mode).GeneralPackage.Contains(Package))
            {
                return(false);
            }

            return(lord || other.lord || (Kingdom.Count == 1 && other.Kingdom.Count == 1 &&
                                          Kingdom[0] == other.Kingdom[0] && (Companions.Contains(name) || other.Companions.Contains(Name))));
        }
Beispiel #18
0
 private WangLordItemVM GetDefaultMember()
 {
     if (Family.Any())
     {
         return(Family.First());
     }
     if (Companions.Any())
     {
         return(Companions.First());
     }
     return(null);
 }
Beispiel #19
0
        public static async Task CustomCompanionByName()
        {
            var model = await Common.GetUserInput("Spawn companion by model name", "", 30);

            if (string.IsNullOrEmpty(model))
            {
                return;
            }

            var hash = (uint)API.GetHashKey(model);
            var ped  = await Companions.SpawnHuman(hash);

            API.SetPedAsNoLongerNeeded(ref ped);
        }
Beispiel #20
0
 private void HandleGameFightSynchronizeMessage(IAccount account, GameFightSynchronizeMessage message)
 {
     lock (CheckLock)
     {
         Fighters.Clear();
         Monsters.Clear();
         Companions.Clear();
         foreach (var fighter in message.Fighters)
         {
             AddFighter(fighter);
         }
     }
     Account.Character.Status = CharacterStatus.Fighting;
 }
        private void DeleteCompanion()
        {
            if (_currentCompanion == null ||
                listCompanions.SelectedItem == null ||
                !Companions.Any())
            {
                return;
            }

            Companions.RemoveAll(x => x.Id == _currentCompanion.Id);
            listCompanions.Items.Remove(listCompanions.SelectedItem);

            _currentCompanion = null;
            ClearCompanion();
            RenumberCompanions();
        }
Beispiel #22
0
 public override void RefreshValues()
 {
     base.RefreshValues();
     FamilyText              = GameTexts.FindText("str_family_group").ToString();
     WishPerksText           = new TextObject("{=wang_washPerk}WashPerk").ToString();
     TraitsText              = GameTexts.FindText("str_traits_group").ToString();
     LearnSkillFromOtherText = new TextObject("{=str_learning_skill}Learning which skill from other").ToString();
     Family.ApplyActionOnAllItems(delegate(WangLordItemVM x)
     {
         x.RefreshValues();
     });
     Companions.ApplyActionOnAllItems(delegate(WangLordItemVM x)
     {
         x.RefreshValues();
     });
 }
Beispiel #23
0
        public bool CompanionWith(string name)
        {
            General other = Engine.GetGeneral(name, "Hegemony");

            if (other == null || !Engine.GetMode("Hegemony").GeneralPackage.Contains(Package))
            {
                return(false);
            }

            if (Kingdom != other.Kingdom)
            {
                return(false);
            }
            return(lord || other.lord || Companions.Contains(name) ||
                   other.Companions.Contains(Name));
        }
Beispiel #24
0
        static void Main(string[] args)
        {
            ReadConfig();

            var lang = XivLanguage.English;

            _gameDir    = new DirectoryInfo(_gamePath);
            _ttObj      = new Obj(_gameDir);
            _gear       = new Gear(_gameDir, lang);
            _companions = new Companions(_gameDir, lang);

            BatchExport();

            Console.WriteLine("Done");
            Console.ReadKey();
        }
        private void LoadCompanion()
        {
            if (listCompanions.SelectedItem == null)
            {
                _currentCompanion = null;
                return;
            }

            ClearCompanion();

            var selectedCompanion = listCompanions.SelectedItem as ListBoxItem;
            var companionId       = Convert.ToInt32(selectedCompanion.Tag);
            var companion         = Companions.Single(x => x.Id == companionId);

            _currentCompanion = companion;

            txtCompanionName.Text = companion.Name;
        }
Beispiel #26
0
        /// <summary>
        /// Populate the mounts table.
        /// </summary>
        /// <returns></returns>
        private async Task RebuildMountsCache()
        {
            using (var db = new SQLiteConnection(_connectionString))
            {
                var _companions = new Companions(_gameInfo.GameDirectory, _gameInfo.GameLanguage);
                var list        = await _companions.GetUncachedMountList();

                // Don't get the ornament list for the Chinese or Korean clients as they don't have them yet
                if (_gameInfo.GameLanguage != XivLanguage.Chinese && _gameInfo.GameLanguage != XivLanguage.Korean)
                {
                    list.AddRange(await _companions.GetUncachedOrnamentList());
                }

                db.Open();
                using (var transaction = db.BeginTransaction())
                {
                    foreach (var item in list)
                    {
                        var query = @"
                            insert into monsters ( name, category,  primary_id,  secondary_id,  imc_variant,  model_type) 
                                           values($name, $category, $primary_id, $secondary_id, $imc_variant, $model_type)
                            on conflict do nothing";
                        using (var cmd = new SQLiteCommand(query, db))
                        {
                            try
                            {
                                cmd.Parameters.AddWithValue("name", item.Name);
                                cmd.Parameters.AddWithValue("category", item.SecondaryCategory);
                                cmd.Parameters.AddWithValue("primary_id", item.ModelInfo.PrimaryID);
                                cmd.Parameters.AddWithValue("secondary_id", item.ModelInfo.SecondaryID);
                                cmd.Parameters.AddWithValue("imc_variant", item.ModelInfo.ImcSubsetID);
                                cmd.Parameters.AddWithValue("model_type", ((XivMonsterModelInfo)item.ModelInfo).ModelType.ToString());
                                cmd.ExecuteScalar();
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }
                    }
                    transaction.Commit();
                }
            }
        }
Beispiel #27
0
 protected void AddFighter(GameFightFighterInformations infos)
 {
     if (infos is GameFightMonsterInformations monsterInfo)
     {
         Monsters.Add(new Monster(monsterInfo.ContextualId, monsterInfo.Disposition.CellId, monsterInfo.Stats,
                                  monsterInfo.TeamId, monsterInfo.Alive, monsterInfo.CreatureGenericId, monsterInfo.CreatureGrade));
     }
     else if (infos is GameFightCompanionInformations companionInfo)
     {
         Companions.Add(new Companion(companionInfo.ContextualId, companionInfo.Disposition.CellId,
                                      companionInfo.Stats, companionInfo.TeamId, companionInfo.Alive, companionInfo.CompanionGenericId,
                                      companionInfo.Level, companionInfo.MasterId));
     }
     else
     {
         Fighters.Add(new Fighter(infos.ContextualId, infos.Disposition.CellId, infos.Stats, infos.TeamId,
                                  infos.Alive));
     }
 }
Beispiel #28
0
 public Fellowship RemoveCompanion(Companion casualty)
 {
     if (casualty.IsRemovable())
     {
         if (Companions.Length == 1)
         {
             Companion[] gollums = { new Gollum() };
             return(new Fellowship(gollums));
         }
         else
         {
             return(new Fellowship(Companions.Where(companion => companion != casualty).ToArray()));
         }
     }
     else
     {
         return(this);
     }
 }
        private void SaveCompanions()
        {
            if (_currentCompanion == null)
            {
                return;
            }

            lblSaveSuccess.Visibility = Visibility.Collapsed;
            saveTimer.Stop();
            saveCounter = 0;

            var companion = Companions.Single(x => x.Id == _currentCompanion.Id);

            companion.Name = txtCompanionName.Text;

            _currentCompanion = companion;

            lblSaveSuccess.Visibility = Visibility.Visible;
            saveTimer.Start();
            UpdateNames();
        }
Beispiel #30
0
        public void RefreshMembersList()
        {
            Family.Clear();
            Companions.Clear();
            List <Hero> list = new List <Hero>();

            foreach (Hero noble in _faction.Nobles)
            {
                HeroHelper.SetLastSeenLocation(noble, willUpdateImmediately: true);
                if (noble.IsAlive)
                {
                    if (noble == Hero.MainHero)
                    {
                        list.Insert(0, noble);
                    }
                    else
                    {
                        list.Add(noble);
                    }
                }
            }
            IEnumerable <Hero> enumerable = _faction.Companions.Where((Hero m) => m.IsPlayerCompanion);

            foreach (Hero item in list)
            {
                Family.Add(new WangLordItemVM(item, OnMemberSelection));
            }
            foreach (Hero item2 in enumerable)
            {
                Companions.Add(new WangLordItemVM(item2, OnMemberSelection));
            }
            GameTexts.SetVariable("COMPANION_COUNT", _faction.Companions.Count());
            GameTexts.SetVariable("COMPANION_LIMIT", _faction.CompanionLimit);
            CompanionsText = GameTexts.FindText("str_companions_group").ToString();
            OnMemberSelection(GetDefaultMember());
        }