/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _minPlayers = Int32.MaxValue; foreach (Arena.FlagState fs in _arena._flags.Values) { //Determine the minimum number of players if (fs.flag.FlagData.MinPlayerCount < _minPlayers) { _minPlayers = fs.flag.FlagData.MinPlayerCount; } //Register our flag change events fs.TeamChange += onFlagChange; } if (_arena._name.ToLower().Substring(0, 3) == "ovd") { _IsOvD = true; _ovd = new OvD(_arena); } return(true); }
private CfgInfo _config; //The zone config /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; return(true); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public Royale(Arena arena, Script_Multi baseScript) { _baseScript = baseScript; _arena = arena; _config = arena._server._zoneConfig; _storm = new Boundary(_arena, 0, 0, 0, 0); _red = _arena.getTeamByName("Red"); _blue = _arena.getTeamByName("Blue"); _rand = new Random(); _activeTeams = new List <Team>(); _playersReady = new Dictionary <string, bool>(); _tickLastReadyCheck = 0; _tickLastPlayingCheck = 0; _tickGameStarting = 0; //test playing = 0; manualTeamSizePick = 0; bClassic = false; // Turn on looting. bGameLocked = false; bAllPlayersReady = false; bSquadRoyale = false; if (_arena._name.StartsWith("[Royale] Squad")) { bSquadRoyale = true; _baseScript.AllowPrivateTeams(true, 8); } }
public bool init(IEventObject invoker) { //Populate our variables _Arena = invoker as Arena; _CFG = _Arena._server._zoneConfig; _Settings = new Settings(); _KOTH = new KOTH(_Arena, _Settings); _CTF = new CTF(_Arena, _Settings); _TDM = new TDM(_Arena, _Settings); _Gladiator = new Gladiator(_Arena, _Settings); _GameType = GameTypes.TDM; foreach (string type in gametypes) { Settings.AllowedGameTypes.Add((GameTypes)_Settings.GetType(type)); } //Put here so allowed game types aren't doubled in the vote system _VoteSystem = new VoteSystem(); _gameCount = 0; return(true); }
public KOTH(Arena arena, Settings settings) { this.arena = arena; this.settings = settings; config = arena._server._zoneConfig; }
private bool _team2Upgrade; //True if team 2 requires stronger bots /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _minPlayers = 2; //We want at least two players to start a game _hqVehId = 1; //Our HQ ID _towerVehId = 1; //Our tower ID _inhibVehId = 1; //Our inhibitor ID _team1Upgrade = false; //Default to no upgraded bots _team2Upgrade = false; _team1MinionX = 1; //Set where bots will spawn (pixels) _team1MinionY = 1; _team2MinionX = 1; _team2MinionY = 1; _team1 = "Titan"; _team2 = "Collective"; _victoryTeam = null; return(true); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _minPlayers = Int32.MaxValue; //Teams teamOne = new arenaTeam(_arena.getTeamByID(0), 403); teamTwo = new arenaTeam(_arena.getTeamByID(1), 422); foreach (Arena.FlagState fs in _arena._flags.Values) { if (fs.flag.FlagData.MinPlayerCount < _minPlayers) { _minPlayers = fs.flag.FlagData.MinPlayerCount; } //Register our flag change events fs.TeamChange += onFlagChange; if (_minPlayers == Int32.MaxValue) { //No flags? Run blank games _minPlayers = 1; } } return(true); }
private void tsbCreate_Click(object sender, EventArgs e) { string distPath = op.DistPath; CfgInfo cfg = op.GetCfgInfo(); string sourceJarFile = cfg.Source; string distJarFilePath = cfg.Dist; string distJarFileName = Path.Combine(distJarFilePath, distJarName); string cmdExecuteFile = Path.Combine(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase, @"Dll\UnPress.exe"); string cmd = "a " + distJarFileName + " -ibck -o+ messages"; if (!Directory.Exists(distPath)) { this.ShowAlert("无对应资源,请执行【开始】汉化后再操作"); return; } if (!File.Exists(sourceJarFile)) { this.ShowAlert("无英文资源文件" + Path.GetFileName(sourceJarFile) + "\r\n请在【设置】中设置它的正确路径"); return; } //中文资源存放路径不存在,建立 if (!Directory.Exists(distJarFilePath)) { Directory.CreateDirectory(distJarFilePath); } //复制英文文件,然后替换 File.Copy(sourceJarFile, distJarFileName, true); System.Diagnostics.Process.Start(cmdExecuteFile, cmd); this.ShowAlert("成功生成中文语言资源文件【" + this.distJarName + "】"); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; caverns = new LowerLevel(); _minPlayers = Int32.MaxValue; foreach (Arena.FlagState fs in _arena._flags.Values) { //Determine the minimum number of players if (fs.flag.FlagData.MinPlayerCount < _minPlayers) { _minPlayers = fs.flag.FlagData.MinPlayerCount; } //Register our flag change events fs.TeamChange += onFlagChange; } if (_minPlayers == Int32.MaxValue) { //No flags? Run blank games _minPlayers = 1; } return(true); }
private void LoadDefaultInfo() { CfgInfo cfg = op.GetDefaultCfgInfo(); this.txtSourcePath.Text = cfg.Source; this.txtDistPath.Text = cfg.Dist; }
////////////////////////////////////////////////// // Game Functions ////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { arena = invoker as Arena; CFG = arena._server._zoneConfig; minPlayers = 2; victoryHoldTime = CFG.flag.victoryHoldTime; preGamePeriod = CFG.flag.startDelay; killStreaks = new Dictionary <string, PlayerStreak>(); explosives = new Dictionary <string, int>(); for (int i = 0; i < explosiveList.Length; i++) { explosives.Add(explosiveList[i], explosiveAliveTimes[i]); } foreach (Arena.FlagState fs in arena._flags.Values) { //Determine the minimum number of players if (fs.flag.FlagData.MinPlayerCount < minPlayers) { minPlayers = fs.flag.FlagData.MinPlayerCount; } //Register our flag change events fs.TeamChange += OnFlagChange; } gameState = GameState.Init; return(true); }
public Pylons(Arena arena, Script_Eol baseScript) { _arena = arena; _config = arena._server._zoneConfig; _baseScript = baseScript; _bpylonsSpawned = false; _gameBegun = false; }
public TDM(Arena arena, Settings settings) { this.arena = arena; this.settings = settings; config = arena._server._zoneConfig; minPlayers = config.deathMatch.minimumPlayers; }
public Coop(Arena arena, Script_Multi baseScript) { _baseScript = baseScript; _arena = arena; _config = arena._server._zoneConfig; _activePoints = new List <CapturePoint>(); _allPoints = new List <CapturePoint>(); _bots = new List <Bot>(); _condemnedBots = new List <Bot>(); spawnBots = true; _medBotFollowTargets = new Dictionary <ushort, Player>(); _medBotHealTargets = new Dictionary <ushort, Player>(); _team = _arena.getTeamByName("Titan Militia"); _botTeam = _arena.getTeamByName("Collective Military"); if (_arena._name.StartsWith("[Co-Op]")) { _botDifficulty = 1; if (_arena._name.EndsWith("Easy")) { _botDifficulty = 0; } if (_arena._name.EndsWith("Normal")) { _botDifficulty = 1; } if (_arena._name.EndsWith("Hard")) { _botDifficulty = 3; } if (_arena._name.EndsWith("Expert")) { _botDifficulty = 6; } if (_arena._name.EndsWith("Master")) { _botDifficulty = 9; } if (_arena._name.EndsWith("Elite")) { _botDifficulty = 12; } if (_arena._name.EndsWith("Insane")) { _botDifficulty = 15; } if (_arena._name.EndsWith("Hell")) { _botDifficulty = 35; } } }
private void InitFrom() { CfgInfo cfg = op.GetCfgInfo(); this.txtSourcePath.Text = cfg.Source; this.txtDistPath.Text = cfg.Dist; this.toolTip1.SetToolTip(this.lblSourcePath, "原始的英文资源文件"); this.toolTip1.SetToolTip(this.lblDistPath, "汉化后的中文资源文件(resources_cn.jar)存放路径"); }
internal MethodCfg(CfgInfo cfgInfo, Func <TInterface, string> methodProvider) { _cfgInfo = cfgInfo; var h = cfgInfo.Hook; h.MethodOrProp = methodProvider(default(TInterface)); h.MemberType = MemberType.Method; h.HookType = HookType.AfterCall; }
internal HookInOutCfg(CfgInfo cfgInfo, HookType hookType, int paramNo, Action <TParam> assert) : base(cfgInfo) { _cfgInfo = cfgInfo; var hook = cfgInfo.Hook; hook.ParamType = typeof(TParam); hook.HookType = hookType; hook.ParamNo = paramNo; hook.ParamDelegate = ToNonGeneric(assert); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _minPlayers = 2; _supplyBags = new List <Vehicle>(); return(true); }
internal HookCallCfg( CfgInfo cfgInfo, HookType hookType, Action <ICallInfo <TInterface> > callDelegate) : base(cfgInfo) { _cfgInfo = cfgInfo; var hook = cfgInfo.Hook; hook.HookType = hookType; hook.CallDelegate = ToNonGeneric(callDelegate); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _minPlayers = _config.king.minimumPlayers; _playerCrownStatus = new Dictionary <Player, PlayerCrownStatus>(); _crownTeams = new List <Team>(); return(true); }
internal WhenCfg(CfgInfo cfgInfo, Func <ICallInfo <TInterface>, bool> cond) : base(cfgInfo) { _cfgInfo = cfgInfo; var hook = cfgInfo.Hook; if (cond == null) { hook.Cond = null; } hook.Cond = c => cond((ICallInfo <TInterface>)c); }
private void TestDemo_Load(object sender, EventArgs e) { int _nTimes = 0; if (cconfig.OpenConfigSet()) { try { cInfo = cconfig.ReadConfig(); } catch (System.Exception ex) { MessageBox.Show("配置文件读取失败!" + ex.Message); return; } } else { frmSetConfig frmSC = new frmSetConfig(cconfig.fileFullName); frmSC.ShowDialog(); if (frmSC.DialogResult == DialogResult.OK) { if (_nTimes < 2) { _nTimes++; TestDemo_Load(this, new EventArgs()); } return; } else { this.Close(); } } WebApiAddress = cInfo.strSvrIP; if (WebApiAddress == ".") { WebApiAddress = "http://222.222.22.112:81/"; } else { WebApiAddress = "http://" + WebApiAddress + "/PayWebApi"; } txtUserSysID.Text = cInfo.UserSysId; txtWebApiAddress.Text = WebApiAddress; //tbHosId.Text = cInfo.strHosID; //tbDeptId.Text = cInfo.strDeptID; FillChargeClassID(); //dataTime_StartTime.Value = DateTime.Now; //dateTime_EndTime.Value = DateTime.Now; //this.cmb_QuerySelection.SelectedIndex = 0; dgrv_SelectName.Left = txt_QueryContent.Left; }
internal InterfaceCfg(Action <Hook> hookAdder) { _cfgInfo = new CfgInfo() { Hook = new Hook() { InterfaceType = typeof(TInterface), }, HookAdder = hookAdder, }; hookAdder(_cfgInfo.Hook); }
public Conquest(Arena arena, Script_Multi baseScript) { _baseScript = baseScript; _arena = arena; _config = arena._server._zoneConfig; _activePoints = new List <CapturePoint>(); _allPoints = new List <CapturePoint>(); _bots = new List <Bot>(); cqTeam1 = _arena.getTeamByName("Titan Militia"); cqTeam2 = _arena.getTeamByName("Collective Military"); }
private int _minPlayers; //The minimum amount of players /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _rand = new Random(); _minPlayers = 2; team1 = _arena.getTeamByName(_config.teams[0].name); team2 = _arena.getTeamByName(_config.teams[1].name); queue = new Dictionary <Player, int>(); inPlayers = new Dictionary <Player, bool>(); return(true); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public RTS(Arena arena, Script_Multi baseScript) { _baseScript = baseScript; _arena = arena; _config = arena._server._zoneConfig; _rand = new Random(); _arena._bIsPublic = true; _titan = _arena.getTeamByName("Titan Militia"); _collective = _arena.getTeamByName("Collective Military"); _bots = new List <Bot>(); _units = new Dictionary <ushort, Unit>(); }
private int _lastHQReward; //The tick at which we last checked for HQ rewards /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; //Headquarters stuff! _hqlevels = new int[] { 500, 1000, 2500, 5000, 10000, 15000, 20000, 25000, 30000, 35000 }; _hqVehId = 463; _baseXPReward = 25; _baseCashReward = 150; _basePointReward = 10; _rewardInterval = 90 * 1000; // 90 seconds _hqs = new Headquarters(_hqlevels); _hqs.LevelModify += onHQLevelModify; return(true); }
/////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Performs script initialization /// </summary> public bool init(IEventObject invoker) { //Populate our variables _arena = invoker as Arena; _config = _arena._server._zoneConfig; _minPlayers = Int32.MaxValue; //The flag's ID that corresponds to whichever team. teamOne.flagId = 102; teamOne.flagId = 101; //Assign each team's portal (goal box) teamOne.portalId = 133; teamTwo.portalId = 134; //Assign the teams teamOne.arenaTeam = _arena.getTeamByID(0); teamTwo.arenaTeam = _arena.getTeamByID(1); //Assign each team names teamOne.arenaTeam._name = _config.teams[0].name; teamTwo.arenaTeam._name = _config.teams[1].name; //Assign each team's flag teamOne.flag = _arena._flags.Values.Where(f => f.flag.GeneralData.Id == 102).First(); teamTwo.flag = _arena._flags.Values.Where(f => f.flag.GeneralData.Id == 101).First(); foreach (Arena.FlagState fs in _arena._flags.Values) { //Determine the minimum number of players if (fs.flag.FlagData.MinPlayerCount < _minPlayers) { _minPlayers = fs.flag.FlagData.MinPlayerCount; } //Register our flag change events fs.TeamChange += onFlagChange; } if (_minPlayers == Int32.MaxValue) { //No flags? Run blank games _minPlayers = 1; } return(true); }
/// <summary> /// Calculates and distributes rewards for a turret kill /// </summary> static public void calculateTurretKillRewards(Player victim, Computer comp, CS_VehicleDeath update) { //Does it have a valid owner? Player owner = comp._creator; if (owner == null) { return; } //Calculate kill reward for the turret owner CfgInfo cfg = victim._server._zoneConfig; int killerCash = (int)(cfg.cash.killReward + (victim.Bounty * (((float)cfg.cash.percentOfTarget) / 1000))); int killerExp = (int)(cfg.experience.killReward + (victim.Bounty * (((float)cfg.experience.percentOfTarget) / 1000))); int killerPoints = (int)(cfg.point.killReward + (victim.Bounty * (((float)cfg.point.percentOfTarget) / 1000))); int rewardCash = (int)(killerCash * (((float)cfg.arena.turretCashSharePercent) / 1000)); int rewardExp = (int)(killerExp * (((float)cfg.arena.turretExperienceSharePercent) / 1000)); int rewardPoints = (int)(killerPoints * (((float)cfg.arena.turretPointsSharePercent) / 1000)); //Update his stats owner.Cash += rewardCash; owner.KillPoints += rewardExp; owner.Experience += rewardPoints; //Is our creator still on the same team? if (owner._team == comp._team) { //Are we sharing kills to our owner? if (cfg.arena.turretKillShareOwner) { owner.Kills++; } //Show the message owner.triggerMessage(2, 500, String.Format("Turret Kill: Kills=1 (Points={0} Exp={1} Cash={2})", rewardCash, rewardExp, rewardPoints)); } //Route to the rest of the arena Helpers.Player_RouteKill(victim._arena.Players, update, victim, rewardCash, rewardPoints, 0, rewardExp); }
public bool loadAssets(string zoneConfig) { string assetsPath = "assets\\"; //Load our zone config InfServer.Log.write(InfServer.TLog.Normal, "Loading Zone Configuration"); if (!System.IO.Directory.Exists(assetsPath)) { InfServer.Log.write(InfServer.TLog.Error, "Unable to find assets directory '" + assetsPath + "'."); return(false); } string filePath = AssetFileFactory.findAssetFile(zoneConfig, assetsPath); if (filePath == null) { InfServer.Log.write(InfServer.TLog.Error, "Unable to find config file '" + assetsPath + zoneConfig + "'."); return(false); } _zoneConfig = CfgInfo.Load(filePath); //Load assets from zone config and populate AssMan try { _assets = new AssetManager(); _assets.bUseBlobs = false; if (!_assets.load(_zoneConfig, zoneConfig)) { //We're unable to continue InfServer.Log.write(InfServer.TLog.Error, "Files missing, unable to continue."); return(false); } } catch (System.IO.FileNotFoundException ex) { //Report and abort InfServer.Log.write(InfServer.TLog.Error, "Unable to find file '{0}'", ex.FileName); return(false); } return(true); }