コード例 #1
0
 public static void HandleMissileCollisionReaction(
     ref int missileIndex,
     ref Mission.MissileCollisionReaction collisionReaction,
     ref MatrixFrame attachLocalFrame,
     ref Agent attackerAgent,
     ref Agent attachedAgent,
     ref bool attachedToShield,
     ref sbyte attachedBoneIndex,
     ref MissionObject attachedMissionObject,
     ref Vec3 bounceBackVelocity,
     ref Vec3 bounceBackAngularVelocity,
     ref int forcedSpawnIndex)
 {
     try
     {
         if (attachedAgent.IsPlayer() &&
             collisionReaction == Mission.MissileCollisionReaction.Stick &&
             BannerlordCheatsSettings.Instance?.NoStuckArrows == true)
         {
             collisionReaction = Mission.MissileCollisionReaction.BecomeInvisible;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoStuckArrows));
     }
 }
コード例 #2
0
        public DataSet GetDataSet(string path)
        {
            DataSet dataSet = new DataSet();

            string          connestionString = string.Format("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = {0}", path);
            OleDbConnection connection       = new OleDbConnection(connestionString);

            connection.Open();

            string[] restrictions = new string[4];
            restrictions[3] = "Table";

            DataTable     userTables       = connection.GetSchema("Tables", restrictions);
            List <string> listOfTableNames = userTables.AsEnumerable().Select(r => r.Field <string>("TABLE_NAME")).ToList();
            SubModule     subModule        = GetDataSetName(listOfTableNames);

            foreach (string item in listOfTableNames)
            {
                string           strSQL      = string.Format("SELECT * FROM {0}", item);
                OleDbDataAdapter dataAdapter = new OleDbDataAdapter(strSQL, connection);

                dataAdapter.Fill(dataSet, item);
            }

            connection.Close();
            dataSet.DataSetName = subModule.ToString();

            return(dataSet);
        }
コード例 #3
0
        public void CreateSubModuleTest()
        {
            const string title = "SubModule1";

            var app = new Application {
                Title = "App1"
            };

            app = Provider.CreateApplicaton(app);

            var module = new Module {
                AppId = app.Id, Title = "Module1"
            };

            module = Provider.CreateModule(module);

            var subModule = new SubModule {
                ModuleId = module.Id, Title = title
            };
            var actual = Provider.CreateSubModule(subModule);

            Assert.IsNotNull(actual);
            Assert.AreNotEqual(0, actual.Id);
            Assert.AreEqual(module.Id, actual.ModuleId);
            Assert.AreEqual(title, actual.Title);
        }
コード例 #4
0
        /// <summary>
        /// Processes sub module of module.
        /// </summary>
        private SubModule ProcessSubModule(Record record, Module module)
        {
            Debug.Assert(module != null); // module shall be specified

            string    title;
            SubModule subModule = null;

            // If specified for the record
            if (module != null && record.TryGetValue(SubModuleCol, out title) && title != null)
            {
                // Key for cache is used to distinguish submodules
                // with the same titles for different modules
                ComplexKey key = new ComplexKey(module.Id, title);
                // Check that sub module already added to cache
                // and, correspondingly, to database
                // Add to DB new one overwise
                if (!m_subModuleCache.TryGetValue(key, out subModule))
                {
                    // Create new DTO
                    subModule = new SubModule {
                        Title = title, ModuleId = module.Id
                    };
                    // Add to DB (we get at least it's ID)
                    subModule = m_provider.CreateSubModule(subModule);
                    // Add to cache
                    m_subModuleCache.Add(key, subModule);
                }
            }
            return(subModule);
        }
コード例 #5
0
        public static void OnAgentShootMissile(
            ref Agent shooterAgent,
            ref EquipmentIndex weaponIndex,
            ref Vec3 position,
            ref Vec3 velocity,
            ref Mat3 orientation,
            ref bool hasRigidBody,
            ref bool isPrimaryWeaponShot,
            ref int forcedMissileIndex)
        {
            try
            {
                if (shooterAgent.IsPlayer() &&
                    BannerlordCheatsSettings.Instance?.InfiniteAmmo == true)
                {
                    for (var index = EquipmentIndex.WeaponItemBeginSlot; index < EquipmentIndex.NumAllWeaponSlots; ++index)
                    {
                        var missionWeapon = shooterAgent.Equipment[index];

                        if (missionWeapon.IsAnyConsumable(out _) &&
                            missionWeapon.Amount <= missionWeapon.ModifiedMaxAmount)
                        {
                            shooterAgent.SetWeaponAmountInSlot(index, missionWeapon.ModifiedMaxAmount, true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(InfiniteAmmo));
            }
        }
コード例 #6
0
 public static void Initialize(
     ref ItemRoster leftItemRoster,
     ref MobileParty party,
     ref bool isTrading,
     ref bool isSpecialActionsPermitted,
     ref CharacterObject initialCharacterOfRightRoster,
     ref InventoryManager.InventoryCategoryType merchantItemType,
     ref IMarketData marketData,
     ref bool useBasePrices,
     ref TextObject leftRosterName)
 {
     try
     {
         if (party.IsPlayerParty() &&
             !isTrading &&
             !Game.Current.CheatMode &&
             BannerlordCheatsSettings.Instance?.NativeItemSpawning == true)
         {
             var objectTypeList = Game.Current.ObjectManager.GetObjectTypeList <ItemObject>();
             for (var index = 0; index != objectTypeList.Count; ++index)
             {
                 var itemObject = objectTypeList[index];
                 leftItemRoster.AddToCounts(itemObject, 10);
             }
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NativeItemSpawning));
     }
 }
コード例 #7
0
        public static void OnApplicationTick()
        {
            try
            {
                if (ScreenManager.TopScreen is InventoryGauntletScreen &&
                    BannerlordCheatsSettings.Instance?.EnableHotkeys == true)
                {
                    if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.LeftShift, InputKey.X))
                    {
                        Hero.MainHero.ChangeHeroGold(100000);

                        Message.Show(string.Format(L10N.GetText("AddGoldMessage"), 100000));
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.X))
                    {
                        Hero.MainHero.ChangeHeroGold(1000);

                        Message.Show(string.Format(L10N.GetText("AddGoldMessage"), 1000));
                    }
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(EnableHotkeysMoney));
            }
        }
コード例 #8
0
        public async Task <IActionResult> Create(SubModuleVm model)
        {
            if (ModelState.IsValid)
            {
                var SubModule = new SubModule()
                {
                    // CourseId= model.CourseId,
                    ModuleId = model.ModuleId,
                    Title    = model.Title,
                    Content  = model.Content,
                };
                if (model.File != null)
                {
                    SubModule.File = hostingEnvironment.UploadFileToFolder(model.File);
                }


                _context.Add(SubModule);



                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
コード例 #9
0
        public static void GetModifierChanges(int modifierTier, ref OverrideData __result)
        {
            try
            {
                if (BannerlordCheatsSettings.Instance?.CraftedWeaponHandlingBonus > 0)
                {
                    __result.Handling += BannerlordCheatsSettings.Instance.CraftedWeaponHandlingBonus;
                }

                if (BannerlordCheatsSettings.Instance?.CraftedWeaponSwingDamageBonus > 0)
                {
                    __result.SwingDamageOverriden += BannerlordCheatsSettings.Instance.CraftedWeaponSwingDamageBonus;
                }

                if (BannerlordCheatsSettings.Instance?.CraftedWeaponSwingSpeedBonus > 0)
                {
                    __result.SwingSpeedOverriden += BannerlordCheatsSettings.Instance.CraftedWeaponSwingSpeedBonus;
                }

                if (BannerlordCheatsSettings.Instance?.CraftedWeaponThrustDamageBonus > 0)
                {
                    __result.ThrustDamageOverriden += BannerlordCheatsSettings.Instance.CraftedWeaponThrustDamageBonus;
                }

                if (BannerlordCheatsSettings.Instance?.CraftedWeaponThrustSpeedBonus > 0)
                {
                    __result.ThrustSpeedOverriden += BannerlordCheatsSettings.Instance.CraftedWeaponThrustSpeedBonus;
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(CraftedWeaponModifierBonus));
            }
        }
コード例 #10
0
        public static void GetConstructionProgressPerHour(ref SiegeEngineType type, ref SiegeEvent siegeEvent, ref ISiegeEventSide side, ref float __result)
        {
            try
            {
                BattleSideEnum otherSide;
                switch (side.BattleSide)
                {
                case BattleSideEnum.Attacker:
                    otherSide = BattleSideEnum.Defender;
                    break;

                case BattleSideEnum.Defender:
                    otherSide = BattleSideEnum.Attacker;
                    break;

                default:
                    return;
                }

                if ((siegeEvent.GetSiegeEventSide(otherSide)?.SiegeParties.Any(x => x.IsPlayerParty()) ?? false) &&
                    BannerlordCheatsSettings.Instance?.EnemySiegeBuildingSpeedPercentage < 100f)
                {
                    var factor = BannerlordCheatsSettings.Instance.EnemySiegeBuildingSpeedPercentage / 100f;

                    var newValue = factor * __result;

                    __result = newValue;
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(EnemySiegeBuildingSpeedPercentage));
            }
        }
コード例 #11
0
        public static void OnApplicationTick(float dt)
        {
            try
            {
                if (Mission.Current != null &&
                    Agent.Main != null &&
                    MBCommon.IsPaused != true &&
                    BannerlordCheatsSettings.Instance?.HealthRegeneration > 0f)
                {
                    var now = DateTime.Now.Second;

                    if (LastSet == null || now != LastSet)
                    {
                        LastSet = now;

                        float health    = Agent.Main.Health;
                        float maxHealth = Agent.Main.HealthLimit;

                        if (health < maxHealth)
                        {
                            float regen     = (BannerlordCheatsSettings.Instance.HealthRegeneration / maxHealth) * 100;
                            float newHealth = (float)Math.Round(health + regen);

                            Agent.Main.Health = Math.Min(maxHealth, newHealth);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(HealthRegeneration));
            }
        }
コード例 #12
0
ファイル: SocketMessage.cs プロジェクト: damon0609/JungleWars
 public SocketMessage(Module mod, SubModule sub, string str)
 {
     this.module    = mod;
     this.subModule = sub;
     this.message   = str;
     //消息协议 字符串长度 + 主模块长度 + 子模块长度 + 字符串长度 系统自动添加的存储字符串长度的字节
     length = 4 + 4 + 4 + Encoding.UTF8.GetBytes(str).Length + 1;
 }
コード例 #13
0
        public static void OnApplicationTick()
        {
            try
            {
                if (ScreenManager.TopScreen is GauntletCharacterDeveloperScreen &&
                    BannerlordCheatsSettings.Instance?.EnableHotkeys == true)
                {
                    if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.A))
                    {
                        var charVM = ScreenManager.TopScreen.GetViewModel <CharacterDeveloperVM>();

                        var currentHero = charVM.CurrentCharacter.Hero;

                        EnableHotkeysCharacterAttributes.SetMaximum(currentHero, DefaultCharacterAttributes.Control);
                        EnableHotkeysCharacterAttributes.SetMaximum(currentHero, DefaultCharacterAttributes.Cunning);
                        EnableHotkeysCharacterAttributes.SetMaximum(currentHero, DefaultCharacterAttributes.Endurance);
                        EnableHotkeysCharacterAttributes.SetMaximum(currentHero, DefaultCharacterAttributes.Intelligence);
                        EnableHotkeysCharacterAttributes.SetMaximum(currentHero, DefaultCharacterAttributes.Social);
                        EnableHotkeysCharacterAttributes.SetMaximum(currentHero, DefaultCharacterAttributes.Vigor);

                        charVM.RefreshValues();

                        var message = string.Format(L10N.GetText("SetAllAttributesMessage"), currentHero.Name);

                        Message.Show(message);
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.D1))
                    {
                        EnableHotkeysCharacterAttributes.AddPoint(DefaultCharacterAttributes.Vigor);
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.D2))
                    {
                        EnableHotkeysCharacterAttributes.AddPoint(DefaultCharacterAttributes.Control);
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.D3))
                    {
                        EnableHotkeysCharacterAttributes.AddPoint(DefaultCharacterAttributes.Endurance);
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.D4))
                    {
                        EnableHotkeysCharacterAttributes.AddPoint(DefaultCharacterAttributes.Cunning);
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.D5))
                    {
                        EnableHotkeysCharacterAttributes.AddPoint(DefaultCharacterAttributes.Social);
                    }
                    else if (Keys.IsKeyPressed(InputKey.LeftControl, InputKey.D6))
                    {
                        EnableHotkeysCharacterAttributes.AddPoint(DefaultCharacterAttributes.Intelligence);
                    }
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(EnableHotkeysCharacterAttributes));
            }
        }
コード例 #14
0
 public static void PregnancyDurationInDays(ref float __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.AdjustPregnancyDuration < 36)
         {
             __result = BannerlordCheatsSettings.Instance.AdjustPregnancyDuration;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(AdjustPregnancyDuration));
     }
 }
コード例 #15
0
 public static void IsBribeNotNeededToEnterKeep(Settlement settlement, ref bool __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NoBribeToEnterKeep == true)
         {
             __result = true;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoBribeToEnterKeep));
     }
 }
コード例 #16
0
 public static void GetPlayerMaximumTroopCountForHideoutMission(ref MobileParty party, ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.BanditHideoutTroopLimit > 0)
         {
             __result += BannerlordCheatsSettings.Instance.BanditHideoutTroopLimit;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(BanditHideoutTroopLimit));
     }
 }
コード例 #17
0
 public static void GetRequiredFocusPointsToAddFocus(ref SkillObject skill, ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.FreeFocusPointAssignment == true)
         {
             __result = 0;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(FreeFocusPointAssignment));
     }
 }
 public static void GetRelationCostOfDisbandingArmy(bool isLeaderParty, ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NoRelationshipLossOnDecision == true)
         {
             __result = 0;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoRelationshipLossOnDecisionArmyDisband));
     }
 }
コード例 #19
0
 public static void IsOfferAcceptable(BarterData args, Hero hero, PartyBase party, ref BarterManager __instance, ref bool __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.BarterOfferAlwaysAccepted == true)
         {
             __result = true;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(BarterOfferAlwaysAccepted));
     }
 }
コード例 #20
0
 public static void GetSellingCost(ref Workshop workshop, ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.WorkshopSellingCostMultiplier > 1f)
         {
             __result = (int)(__result * BannerlordCheatsSettings.Instance.WorkshopSellingCostMultiplier);
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(WorkshopSellingCostMultiplier));
     }
 }
コード例 #21
0
 public static void GetCrimeRatingOf(ref CrimeModel.CrimeType crime, ref object[] additionalArgs, ref float __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NoCrimeRatingForCrimes == true)
         {
             __result = 0f;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoCrimeRatingForCrimes));
     }
 }
コード例 #22
0
 public static void IsOpened(CraftingPiece craftingPiece, ref bool __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.UnlockAllParts == true)
         {
             __result = true;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(UnlockAllParts));
     }
 }
コード例 #23
0
 public static void GetCompanionHiringPrice(Hero companion, ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.FreeCompanionHiring == true)
         {
             __result = 0;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(FreeCompanionHiring));
     }
 }
コード例 #24
0
 public static void DoesMissionRequireCivilianEquipment(ref Mission __instance, ref bool __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NeverRequireCivilianEquipment == true)
         {
             __result = false;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NeverRequireCivilianEquipment));
     }
 }
コード例 #25
0
 public static void CanPlayerBarterWithHero(Hero hero, ref bool __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NoBarterCooldown == true)
         {
             __result = true;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoBarterCooldown));
     }
 }
コード例 #26
0
 public static void CheckCaptivityChange(float dt, ref string __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.InstantEscape == true)
         {
             PlayerCaptivity.EndCaptivity();
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(InstantEscape));
     }
 }
コード例 #27
0
 public static void CalculateDisguiseDetectionProbability(Settlement settlement, ref float __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.DisguiseAlwaysWorks == true)
         {
             __result = 1;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(DisguiseAlwaysWorks));
     }
 }
コード例 #28
0
 public static void GetRelationChangeWithSponsor(Supporter.SupportWeights supportWeight, bool isOpposingSides, ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NoRelationshipLossOnDecision == true)
         {
             __result = Math.Max(__result, 0);
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoRelationshipLossOnDecisionKingdomDecision));
     }
 }
 public static void GetRelationCostOfExpellingClanFromKingdom(ref int __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.NoRelationshipLossOnDecision == true)
         {
             __result = 0;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoRelationshipLossOnDecisionExpellingClan));
     }
 }
コード例 #30
0
        private void trvwModules_AfterNodeSelect(object sender, DevComponents.AdvTree.AdvTreeNodeEventArgs e)
        {
            if (_nodesloading)
            {
                return;
            }
            if (e.Node == null)
            {
                return;
            }
            _selectedsubmodule = SubModule.None;

            if (e.Node.Nodes.Count > 0)
            {
                DisableButtons(); grdRecords.Hide();
                if (lstvwRecords.Redraw)
                {
                    lstvwRecords.BeginUpdate();
                }
                lstvwRecords.ImageList = _images32; lstvwRecords.Show();
                lstvwRecords.ListItems.Clear();

                for (int i = 0; i <= (e.Node.Nodes.Count - 1); i++)
                {
                    ListViewGridItem _item = new ListViewGridItem(e.Node.Nodes[i].Name, e.Node.Nodes[i].Text.Replace(" ", "\n"), e.Node.Nodes[i].Name);
                    _item.Tag = e.Node.Nodes[i].Tag;
                    lstvwRecords.ListItems.Add(_item);
                }

                while (!lstvwRecords.Redraw)
                {
                    lstvwRecords.EndUpdate();
                }
            }
            else
            {
                if (VisualBasic.IsNumeric(e.Node.Tag))
                {
                    if (VisualBasic.CInt(e.Node.Tag) > 0)
                    {
                        try { _selectedsubmodule = (SubModule)e.Node.Tag; }
                        catch { _selectedsubmodule = SubModule.None; }

                        grdRecords.Show(); lstvwRecords.Hide();
                        InitializeDataSource();
                    }
                }
            }
        }